37 Commits

Author SHA1 Message Date
@fawn-nine
522b236dae . 2023-10-23 13:24:06 +08:00
@fawn-nine
3d5574df5c . 2023-10-23 10:05:53 +08:00
@fawn-nine
6ea49ff709 微调 2023-10-20 16:40:49 +08:00
@fawn-nine
1e8dc0ee9a 详情页点击图片放大+听书logo不居中 2023-10-20 14:34:01 +08:00
@fawn-nine
ae340d1944 微调 2023-10-18 17:56:08 +08:00
@fawn-nine
536ffb3ad6 删除地址 2023-10-18 17:27:04 +08:00
@fawn-nine
39ec8fdb34 物流+下单+地址修改 2023-10-18 17:03:48 +08:00
@fawn-nine
bd998074a3 修改密码 2023-10-16 17:49:14 +08:00
@fawn-nine
05829f5617 添加版本更新功能 2023-10-16 16:02:09 +08:00
@fawn-nine
cbbbaab9a9 Merge branch 'xie1010' 2023-10-13 14:59:23 +08:00
@fawn-nine
5b77dbc5c4 添加隐私入口 2023-10-13 14:59:06 +08:00
@fawn-nine
34af877bd8 Merge branch 'xie1010' 2023-10-13 14:36:02 +08:00
@fawn-nine
f998b3be47 微调 2023-10-13 14:35:46 +08:00
@fawn-nine
2aa8994f70 Merge branch 'xie1010' 2023-10-13 13:43:50 +08:00
@fawn-nine
4b56dad146 引入公共组件 2023-10-13 13:41:59 +08:00
@fawn-nine
162290eaab Merge branch 'xie1010' 2023-10-13 13:38:23 +08:00
@fawn-nine
1b51a0dcd0 引入公共组件 2023-10-13 13:38:01 +08:00
@fawn-nine
ddd68f8736 Merge branch 'xie1010' 2023-10-13 13:33:56 +08:00
@fawn-nine
f5dc71993f 部分微调 2023-10-13 13:32:32 +08:00
yanwenlong
fcc84b91a0 讲书:已购、推荐 2023-10-13 10:08:50 +08:00
@fawn-nine
350f9d22d2 . 2023-10-12 17:08:35 +08:00
@fawn-nine
39dabee715 打卡重写 2023-10-12 17:08:22 +08:00
@fawn-nine
84a2505e2a 打卡重写 2023-10-12 16:39:55 +08:00
@fawn-nine
9a5afe03d3 订单倒计时 2023-10-10 17:41:07 +08:00
yanwenlong
96f7e499db Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-html 2023-10-09 22:23:37 +08:00
yanwenlong
aad0cd8fe6 加载中问题 2023-10-09 22:22:22 +08:00
@fawn-nine
04c821ff48 音频样式bug修复 2023-10-09 16:51:26 +08:00
@fawn-nine
c6bff04039 Merge branch 'xie0928' 2023-10-09 15:45:08 +08:00
yanwenlong
af31b446ae 打卡、书集加已购图书、推荐图书tab 2023-10-08 08:55:30 +08:00
@fawn-nine
9b9a7df309 Merge branch 'xie0928' 2023-10-07 18:01:20 +08:00
@fawn-nine
4a379caa6b Merge branch 'xie0928' 2023-10-07 17:03:58 +08:00
@fawn-nine
acf38bc1cc Merge branch 'xie0928' 2023-10-07 17:01:03 +08:00
@fawn-nine
6a40105fc1 Merge branch 'xie0928' 2023-10-07 13:53:46 +08:00
@fawn-nine
bf3782a06f Merge branch 'xie0928' 2023-10-07 13:42:00 +08:00
@fawn-nine
1e09529158 . 2023-10-07 13:23:46 +08:00
yanwenlong
9ecd033775 书评主要逻辑修改 2023-10-01 21:58:12 +08:00
yanwenlong
dedd92e58f 首页精选图书问题 2023-09-28 21:55:57 +08:00
57 changed files with 3505 additions and 946 deletions

496
App.vue
View File

@@ -1,247 +1,289 @@
<script>
import {music, bgm} from '@/utils/music.js'
import store from '@/store/index.js';
import socket from '@/config/socket';
// #ifdef H5
import { h5Login } from '@/config/html5Utils';
// #endif
// #ifdef APP-PLUS
import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
// #endif
import Vue from 'vue'
import {
music,
bgm
} from '@/utils/music.js'
import store from '@/store/index.js';
import socket from '@/config/socket';
// #ifdef H5
import {
h5Login
} from '@/config/html5Utils';
// #endif
// // #ifdef APP-PLUS
// import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
// // #endif
// #ifdef APP-PLUS
import updata from '@/uni_modules/uni-upgrade-center-app/utils/check-update'
// #endif
import Vue from 'vue'
export default {
onLaunch: function(e) {
uni.getSystemInfo({
success(res) {
Vue.prototype.winWidth=res.screenWidth
Vue.prototype.winHeight=res.screenHeight
}
})
// 取出初始播放信息
uni.getStorage({
key: 'playingInfo',
success: function (res) {
console.log(res,'playingInfo本地初始化')
store.commit('setUserInfo',{'playingInfo': res.data})
store.commit('setUserInfo',{
'playTitle':res.data.chapter,
'fengImg':res.data.bookImage
})
console.log(store.state.userInfo,'初始化')
},
fail:function(e){
console.log(e,'playingInfo本地初始化失败')
store.commit('setUserInfo',{'playingInfo': {
'images':'../../static/icon/fengziIcon.jpg',
'chapterName':'暂无播放信息',
}})
store.commit('setUserInfo',{
'playTitle': '暂无播放信息',
'fengImg': '../../static/icon/fengziIcon.jpg'
})
},
})
// 取出播放列表
uni.getStorage({
key: 'playData',
success: function (res) { // 本地有播放数据就用本地的
console.log(res.data,'取出的本地数据');
if(res.data.myList.length<=0){
store.commit('setUserInfo',{'playVisible': false})
}else{
music.setList(res.data.myList,'',store.state.userInfo.playIndex)
// music.setCoverImg(res.data.fengImg)
store.commit('setUserInfo',res.data)
export default {
onLaunch: function(e) {
// 检测自动更新
// #ifdef APP-PLUS
updata()
// #endif
uni.getSystemInfo({
success(res) {
Vue.prototype.winWidth = res.screenWidth
Vue.prototype.winHeight = res.screenHeight
}
store.commit('setUserInfo',{'playFlag': false}); // 设置播放按钮状态为暂停
store.commit('setUserInfo',{'currentTime': 0});
},
fail:function(e){ // 如果没有,就查询一下线上的播放记录
console.log('本地无数据');
music.setList([])
//store.commit('setUserInfo',{'playingInfo': {'bookid':0,'chapterId':0}});
store.commit('setUserInfo',{'playVisible': false})
store.commit('setUserInfo',{
'myList':[],
'fengImg':'../../static/icon/fengziIcon.jpg'
})
store.commit('setUserInfo',{'playFlag': false});
store.commit('setUserInfo',{'currentTime': 0});
}
});
// end
// 取出播放弹窗显示或者隐藏
uni.getStorage({
key: 'playVisible',
success: function (res) {
store.commit('setUserInfo',{'playVisible': res.data}); // 设置是否显示按钮
},
fail:function(e){ // 如果本地没有playVisible数据默认为false
store.commit('setUserInfo',{'playVisible': false});
}
});
//取出缓存数据
store.commit('setCacheData');
// #ifdef MP-WEIXIN
if (store.state.userInfo.token) {
socket.init();
}
// #endif
// #ifdef H5
console.log(store.state)
if (store.state.userInfo.token) {
socket.init();
} else {
h5Login('force', () => {
socket.init();
});
}
// #endif
// #ifdef APP-PLUS
if (store.state.userInfo.token) {
socket.init();
}
APPUpdate();
// #endif
},
onShow: function(e) {
// console.log(store.state,'playVisible')
// #ifdef MP-WEIXIN
//获取二维码携带的参数
let scene = decodeURIComponent(e.query.scene);
scene = scene.split('&');
let data = {
//场景值
scene: e.scene
};
scene.forEach(item => {
let arr = item.split('=');
if (arr.length == 2) {
data[arr[0]] = arr[1];
}
});
store.commit('setChatScenesInfo', Object.assign(e.query, data));
//小程序更新
if (uni.getUpdateManager) {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
// console.log(res.hasUpdate);
});
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
})
// 取出初始播放信息
uni.getStorage({
key: 'playingInfo',
success: function(res) {
console.log(res, 'playingInfo本地初始化')
store.commit('setUserInfo', {
'playingInfo': res.data
})
store.commit('setUserInfo', {
'playTitle': res.data.chapter,
'fengImg': res.data.bookImage
})
console.log(store.state.userInfo, '初始化')
},
fail: function(e) {
console.log(e, 'playingInfo本地初始化失败')
store.commit('setUserInfo', {
'playingInfo': {
'images': '../../static/icon/fengziIcon.jpg',
'chapterName': '暂无播放信息',
}
})
store.commit('setUserInfo', {
'playTitle': '暂无播放信息',
'fengImg': '../../static/icon/fengziIcon.jpg'
})
},
})
// 取出播放列表
uni.getStorage({
key: 'playData',
success: function(res) { // 本地有播放数据就用本地的
console.log(res.data, '取出的本地数据');
if (res.data.myList.length <= 0) {
store.commit('setUserInfo', {
'playVisible': false
})
} else {
music.setList(res.data.myList, '', store.state.userInfo.playIndex)
// music.setCoverImg(res.data.fengImg)
store.commit('setUserInfo', res.data)
}
});
store.commit('setUserInfo', {
'playFlag': false
}); // 设置播放按钮状态为暂停
store.commit('setUserInfo', {
'currentTime': 0
});
},
fail: function(e) { // 如果没有,就查询一下线上的播放记录
console.log('本地无数据');
music.setList([])
//store.commit('setUserInfo',{'playingInfo': {'bookid':0,'chapterId':0}});
store.commit('setUserInfo', {
'playVisible': false
})
store.commit('setUserInfo', {
'myList': [],
'fengImg': '../../static/icon/fengziIcon.jpg'
})
store.commit('setUserInfo', {
'playFlag': false
});
store.commit('setUserInfo', {
'currentTime': 0
});
}
});
updateManager.onUpdateFailed(function(res) {
// 新的版本下载失败
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
showCancel: false
});
// end
// 取出播放弹窗显示或者隐藏
uni.getStorage({
key: 'playVisible',
success: function(res) {
store.commit('setUserInfo', {
'playVisible': res.data
}); // 设置是否显示按钮
},
fail: function(e) { // 如果本地没有playVisible数据默认为false
store.commit('setUserInfo', {
'playVisible': false
});
}
});
//取出缓存数据
store.commit('setCacheData');
// #ifdef MP-WEIXIN
if (store.state.userInfo.token) {
socket.init();
}
// #endif
// #ifdef H5
console.log(store.state)
if (store.state.userInfo.token) {
socket.init();
} else {
h5Login('force', () => {
socket.init();
});
}
// #endif
// #ifdef APP-PLUS
if (store.state.userInfo.token) {
socket.init();
}
// APPUpdate();
// #endif
},
onShow: function(e) {
// console.log(store.state,'playVisible')
// #ifdef MP-WEIXIN
//获取二维码携带的参数
let scene = decodeURIComponent(e.query.scene);
scene = scene.split('&');
let data = {
//场景值
scene: e.scene
};
scene.forEach(item => {
let arr = item.split('=');
if (arr.length == 2) {
data[arr[0]] = arr[1];
}
});
store.commit('setChatScenesInfo', Object.assign(e.query, data));
//小程序更新
if (uni.getUpdateManager) {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
// console.log(res.hasUpdate);
});
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function(res) {
// 新的版本下载失败
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
showCancel: false
});
});
}
// #endif
},
onHide: function() {},
destroyed() {
store.commit('setUserInfo', {
'playFlag': true
})
console.log('页面销毁')
},
methods: {
}
// #endif
},
onHide: function() {},
destroyed() {
store.commit('setUserInfo',{'playFlag': true})
console.log('页面销毁')
},
methods:{
}
};
};
</script>
<style lang="scss">
@import "uview-ui/index.scss";
/* #ifndef APP-NVUE */
@import './style/common.scss';
@import './style/input.scss';
@import './style/table.scss';
page {
height: 100%;
background-color: #f7faf9;
}
/* #endif */
@import "uview-ui/index.scss";
/* #ifndef APP-NVUE */
@import './style/common.scss';
@import './style/input.scss';
@import './style/table.scss';
/* #ifdef H5 */
//修复H5底部导航挡住内容bug
uni-app {
height: auto;
}
/*每个页面公共css */
page {
height: 100%;
background-color: #f7faf9;
}
/* #endif */
/* #ifdef H5 */
//修复H5底部导航挡住内容bug
uni-app {
height: auto;
}
/*每个页面公共css */
@font-face {
font-family: 'iconfont' ; /* project id 1997429 */
src: url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.eot');
src: url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.eot?#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.woff2') format('woff2'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.woff') format('woff'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.ttf') format('truetype'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.svg#iconfont') format('svg');
}
.iconfont{
font-family:"iconfont" !important;
font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
font-family: 'iconfont';
/* project id 1997429 */
src: url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.eot');
src: url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.eot?#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.woff2') format('woff2'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.woff') format('woff'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.ttf') format('truetype'),
url('https://at.alicdn.com/t/font_1997429_8xzvctxta3u.svg#iconfont') format('svg');
}
//修复H5输入框上下不居中bug
.uni-input-form {
height: 100%;
}
//去除地图上高德地图标识符
.amap-copyright {
display: none !important;
}
.iconfont {
font-family: "iconfont" !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.amap-logo {
display: none !important;
}
//修复H5输入框上下不居中bug
.uni-input-form {
height: 100%;
}
.amap-ui-control-zoom {
width: 60upx !important;
}
//去除地图上高德地图标识符
.amap-copyright {
display: none !important;
}
.amap-ui-control-zoom > * {
width: 60upx !important;
height: 60upx !important;
line-height: 60upx !important;
}
.amap-logo {
display: none !important;
}
.amap-ui-control-theme-dark {
display: none !important;
}
//设置圆角
checkbox.round .wx-checkbox-input,
checkbox.round .uni-checkbox-input {
border-radius: 100upx;
}
.amap-ui-control-zoom {
width: 60upx !important;
}
//设置背景色
checkbox.checkedItem[checked] .wx-checkbox-input,
checkbox.checkedItem .uni-checkbox-input-checked{
background-color: #e5a000 !important;
border-color: #e5a000 !important;
color: #ffffff !important;
}
/* #endif */
</style>
.amap-ui-control-zoom>* {
width: 60upx !important;
height: 60upx !important;
line-height: 60upx !important;
}
.amap-ui-control-theme-dark {
display: none !important;
}
//设置圆角
checkbox.round .wx-checkbox-input,
checkbox.round .uni-checkbox-input {
border-radius: 100upx;
}
//设置背景色
checkbox.checkedItem[checked] .wx-checkbox-input,
checkbox.checkedItem .uni-checkbox-input-checked {
background-color: #e5a000 !important;
border-color: #e5a000 !important;
color: #ffffff !important;
}
/* #endif */
</style>

View File

@@ -7,6 +7,7 @@ if (process.env.NODE_ENV === 'development') {
// baseUrl = "https://twin-ui.com/demo/";
// baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
// baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1
// socketUrl = "ws://8.129.186.35:6001/";

View File

@@ -245,7 +245,7 @@ export const setWXPay = function(payInfo, callback) {
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res,'res')
console.log(res,'resshoppingPay')
if(res.code === 0){
let payData = {
provider : 'wxpay',

View File

@@ -12,8 +12,8 @@
"src" : "图片路径"
}
],
"versionName" : "1.2.1",
"versionCode" : 121,
"versionName" : "1.2.6",
"versionCode" : 126,
"app-plus" : {
"compatible" : {
"ignoreVersion" : true
@@ -37,7 +37,8 @@
},
"distribute" : {
"apple" : {
"devices" : "universal"
"devices" : "universal",
"UIBackgroundModes" : [ "audio" ]
},
"android" : {
"permissionPhoneState" : {
@@ -76,7 +77,8 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"minSdkVersion" : 21
"minSdkVersion" : 21,
"targetSdkVersion" : 30
},
"sdkConfigs" : {
"ad" : {},
@@ -84,7 +86,7 @@
"share" : {
"weixin" : {
"appid" : "wx47134a8f15083734",
"UniversalLinks" : ""
"UniversalLinks" : "https://verification.nuttyreading.com/uni-universallinks/__UNI__9788EB5/"
}
},
"payment" : {
@@ -95,7 +97,7 @@
"weixin" : {
"__platform__" : [ "android" ],
"appid" : "wx47134a8f15083734",
"UniversalLinks" : ""
"UniversalLinks" : "https://verification.nuttyreading.com/uni-universallinks/__UNI__9788EB5/"
}
}
},
@@ -106,7 +108,12 @@
},
"ios" : {
"dSYMs" : false,
"UIBackgroundModes" : [ "audio" ] // 背景播放音乐
"UIBackgroundModes" : [ "audio" ], // 背景播放音乐
"capabilities" : {
"entitlements" : {
"com.apple.developer.associated-domains" : [ "applinks:verification.nuttyreading.com" ]
}
}
},
"icons" : {
"android" : {
@@ -177,7 +184,8 @@
"enable" : true
}
}
}
},
"_spaceID" : "mp-3614b80b-2d75-4462-a481-4998f8187274"
}
// 小程序特有相关

View File

@@ -459,7 +459,23 @@
"enablePullDownRefresh": false
}
}
},
{ // 更新版本
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
"style": {
"disableScroll": true,
"app-plus": {
"backgroundColorTop": "transparent",
"background": "transparent",
"titleNView": false,
"scrollIndicator": false,
"popGesture": "none",
"animationType": "fade-in",
"animationDuration": 200
}
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",

View File

@@ -8,7 +8,8 @@
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"
style="width: 100%;height: 100%;">
<swiper-item v-for="(item,index) in swiperlist" :key="index" style="width: 100%;height: 100%;">
<image :src="item" mode="aspectFit" style="width: 100%;height: 100%;"></image>
<image :src="item" mode="aspectFit" style="width: 100%;height: 100%;" @click="previewImage(item)">
</image>
</swiper-item>
</swiper>
</view>
@@ -36,7 +37,7 @@
<view v-if="linkProducts && linkProducts.length > 0 && linkProducts[0]">
<view class="spbh" v-for="(item, index) in linkProducts" :key="item.id">
<view class="flexbox aligncenter" @click="previewProduct(item,index)">
<view class="spbhimg" >
<view class="spbhimg">
<image :src="item.productImages" mode="aspectFit"></image>
</view>
<text class="username nowrap ">{{item.productName}}</text>
@@ -109,9 +110,9 @@
</u-row>
</view>
<!-- <view class="commodityIntroduce" v-html="productInfo.productDetails"> -->
<view class="commodityIntroduce">
<view class="commodityIntroduce">
<view v-if="productInfo.productDetails">
<rich-text v-if="productInfo.productDetails" class="xiangqing"
<rich-text v-if="productInfo.productDetails" class="xiangqing" @itemclick="showImg"
:nodes="productInfo.productDetails|formatRichText"></rich-text>
</view>
</view>
@@ -122,7 +123,8 @@
</view>
<view class="pingjia" v-else>
<view class="">
<view style="font-weight: 700;margin-bottom: 30rpx;">评价({{commentsList?commentsList.length:0}})</view>
<view style="font-weight: 700;margin-bottom: 30rpx;">评价({{commentsList?commentsList.length:0}})
</view>
<!-- <view class="icon-del rotate"></view> -->
</view>
<!-- 商品评价 -->
@@ -176,7 +178,8 @@
<view class="imgBox">
<image v-if="linkimg == ''" src="../../static/icon/wufeng.jpg" mode="aspectFit"
style="width: 100%; height: 100%;"></image>
<image v-else :src="linkimg" mode="aspectFit" style="width: 100%; height: 100%;" @click="previewImage(linkimg)"></image>
<image v-else :src="linkimg" mode="aspectFit" style="width: 100%; height: 100%;"
@click="previewImage(linkimg)"></image>
<view class="xiangxi" v-if="productId != linkProducts[linkCur].productId"
@click="gotoDetail(linkProducts[linkCur])">
<text>查看详情</text>
@@ -185,8 +188,8 @@
<view :class="['spbh', linkCur == index ? 'cur' :'']" v-for="(item, index) in linkProducts"
:key="item.id">
<view class="flexbox aligncenter" @click="previewProduct(item,index)">
<view class="spbhimg" >
<image :src="item.productImages" mode="aspectFit" ></image>
<view class="spbhimg">
<image :src="item.productImages" mode="aspectFit"></image>
</view>
<text class="username nowrap ">{{item.productName}}</text>
<text class="price"
@@ -200,13 +203,11 @@
</view>
</u-popup>
</view>
<uni-goods-nav class="goods_nav" :fill="true" :options="options" :buttonGroup="buttonGroup" @click="onClick"
@buttonClick="buttonClick" />
<music-play :playData="playData"></music-play>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import emojiList1 from '../../bkhumor-emojiplus/emoji/biaoqin.js'
@@ -224,7 +225,7 @@
options: [{
icon: 'cart',
text: '购物车'
}],
}],
buttonGroup: [{
text: '加入购物车',
backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
@@ -254,7 +255,7 @@
listenList: [], // 关联得听书
linkProducts: [], // 关联的商品,
upoShow: false, // 显示底部购买选项
linkCur: 0, // 当前选中的关联项
linkCur: 0, // 当前选中的关联项
}
},
onLoad(e) {
@@ -271,6 +272,12 @@
musicPlay
},
methods: {
showImg(e) {
// console.log(e,'点击的内容')
// let contentimg = e.target.dataset.nodes;
this.previewImage(e.target.node.attrs.src)
},
gotoDetail(item) {
// console.log(item,'gotoDetail')
uni.navigateTo({
@@ -296,14 +303,14 @@
})
.then(res => {
console.log('关联商品', res)
if (res.code == 0) {
if (res.code == 0) {
if (res.result.length > 0) {
this.linkProducts = res.result
this.linkimg = this.linkProducts[0].productImages
this.linkCur = 0
}else{
} else {
this.linkProducts = []
}
}
}
})
.catch(e => {
@@ -320,7 +327,13 @@
previewImage(url) {
console.log(url)
uni.previewImage({
urls: [url]
urls: [url],
longPressActions: {
itemList: ['很抱歉,暂不支持保存图片到本地'],
success: function(res) {
// console.log(res,'+++++')
}
}
});
},
// 获取html格式的评论1
@@ -474,17 +487,17 @@
// console.log(e)
if (e.index == 0) {
// 点击的是加入购物车
// console.log('+.........',this.linkProducts,'this.linkProducts')
if (this.linkProducts.length == 0) {
this.addCart()
// console.log('+.........',this.linkProducts,'this.linkProducts')
if (this.linkProducts.length == 0) {
this.addCart()
} else {
this.upoShow = true
}
} else {
// 点击的是立即购买
if (this.linkProducts.length == 0) {
this.goPurse()
if (this.linkProducts.length == 0) {
this.goPurse()
} else {
this.upoShow = true
}
@@ -682,7 +695,7 @@
}
},
formatRichText(html) { //控制小程序中图片大小
formatRichText(html) { //控制图片大小
let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
@@ -694,6 +707,10 @@
'max-width:100%;');
return match;
});
// newContent = newContent.replace(/<img[^>]*>/gi, function(match, capture) {
// match = match.replace(/<img[^>]*>/gi, "@click='1111'").replace(/<img[^>]*>/gi, "@click='1111'");
// return match;
// });
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
@@ -705,7 +722,9 @@
url: '../peanut/shopping'
});
},
clickImg() {
console.log('点击了图片')
}
},
filters: {
/**

View File

@@ -86,7 +86,7 @@
this.deliverList = []
uni.showLoading()
this.$http
.post(`/book/buyorder/queryFMS?orderId=${this.orderId}`)
.post(`/book/buyOrder/queryFMS?orderId=${this.orderId}`)
.then(res => {
console.log(res, '物流信息')
if (res && res.code === 0) {

View File

@@ -35,6 +35,10 @@
<view class="orderList">
<view class="orderItem">
<!-- <view class="guoqi flexbox" v-if="orderContet.orderStatus==0 && orderContet.overTime > 0">
<text>剩余支付时间</text>
<uni-countdown background-color="#ff5500" color="#ffffff" :font-size="14" :show-day="false" :hour="0" :minute="0" :second="orderContet.overTime" @timeup="countDown"></uni-countdown>
</view> -->
<view class="orderContent" v-for="(item,index) in orderContet.products" :key="index"
@click="goDetail(item.productId)" v-if="orderContet.products!=''">
<image :src="item.image" mode=""></image>
@@ -106,7 +110,7 @@
<view v-if="orderContet.orderStatus==2" class="opCan" @click="OverOrder" >确认收货</view>
<view v-if="orderContet.orderStatus==0" class="opFix" @click="canceOrder">取消订单</view>
<view v-if="orderContet.orderStatus==0" class="opCan" @click="goPay">去支付</view>
<view v-if="orderContet.orderStatus==0" class="opCan" @click="goPay(orderContet)">去支付</view>
<view class="opCan" @click="kefu">联系客服</view>
@@ -174,7 +178,7 @@
import $http from '@/config/requestConfig.js';
import {
setPay,
setPayAssign
setPayAssign,setWXPay
} from '@/config/utils';
import {
mapState
@@ -245,7 +249,12 @@
...mapState(['userInfo']),
},
methods: {
methods: {
// 倒计时回调
countDown(){
console.log('重新刷新订单')
this.getOrderList()
},
// 获得输入的表情数组
handleEmj(i) {
console.log(i,'i---------');
@@ -491,7 +500,7 @@
if (res.confirm) {
uni.showLoading()
$http.request({
url: "book/buyorder/update",
url: "book/buyOrder/update",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
@@ -520,12 +529,16 @@
getOrderList() {
console.log('this.orderType',this.orderType)
this.$http
.post(`book/buyorder/appGetOrderInfo/${this.orderType}?orderId=${this.orderID}`)
.get(`book/buyOrder/getOrderInfo?orderId=${this.orderID}`)
.then(res => {
console.log('res+++',res)
this.orderContet = res.buyOrder
console.log('订单详情',res)
var seconds = res.result.timestamp + 30 * 60 + 2 // 过期时间
var nowSeconds = Math.floor(new Date().getTime() / 1000);
res.result.overTime = seconds - nowSeconds
this.orderContet = res.result
this.userRecordid = res.userRecordid
this.productIDs = res.buyOrder.products.map(item => {
this.productIDs = res.result.products.map(item => {
return item.productId
})
// console.log(this.orderContet,'this.orderContet')
@@ -538,15 +551,14 @@
} else if (this.orderContet.orderStatus == 3) {
this.titleStat = '已完成'
}
// if (this.orderType == 2) {
// this.getdeliverDetails()
// }
console.log(this.orderContet,'订单详情')
})
},
// 获取物流
getdeliverDetails() {
this.$http
.post(`/book/buyorder/queryFMS?orderId=${this.orderID}`)
.post(`/book/buyOrder/queryFMS?orderId=${this.orderID}`)
.then(res => {
if (res && res.code === 0) {
console.log(res, '物流信息')
@@ -575,7 +587,7 @@
success: res => {
if (res.confirm) {
this.$http
.post('book/buyorder/appDelete?orderId=' + this.orderContet.orderId)
.post('book/buyOrder/appDelete?orderId=' + this.orderContet.orderId)
.then(res => {
uni.showToast({
icon: 'none',
@@ -592,28 +604,84 @@
// 支付
goPay() {
setPay({
typePay: 'alipay',
subject: 'order',
totalAmount: this.orderContet.realMoney,
type: 2,
relevanceoid: this.orderContet.orderSn,
customerId: this.userInfo.id,
}, res => {
if (res.success) {
uni.showToast({
title: "支付成功"
});
} else {
uni.showToast({
title: "支付失败",
icon: "none",
image: '../../static/icon/ic_close.png'
});
goPay(payItem) {
console.log(payItem,'订单数据')
if(payItem.paymentMethod == 2){
console.log('阿里支付')
setPay({
typePay: 'alipay',
subject: 'order',
totalAmount: payItem.realMoney,
type: 2,
relevanceoid: payItem.orderSn,
customerId: this.userInfo.id,
}, res => {
if (res.success) {
uni.showToast({
title: "支付成功"
});
} else {
uni.showToast({
title: "支付失败",
icon: "none",
image: '../../static/icon/ic_close.png'
});
}
this.getOrderList()
})
} else if(payItem.paymentMethod == 1){
console.log('微信支付')
// console.log(this.isAndorid)
if(this.isAndorid == false){
uni.showModal({
title: '提示',
content: '很抱歉,苹果系统暂不支持微信支付',
showCancel:false
})
return false
}else{
let data1={
orderSn:payItem.orderSn,
buyOrderId: null,
totalAmount: payItem.realMoney
}
console.log(data1,'data1')
setWXPay(data1,res => {
if (res.success) {
uni.showToast({
title: "支付成功"
});
} else {
console.log(res)
if(res.data.errMsg.indexOf('User canceled') != -1){
uni.showToast({
title: "用户取消支付",
icon: "none",
image: '../../static/icon/ic_close.png'
});
}else{
uni.showToast({
title: "支付失败",
icon: "none",
image: '../../static/icon/ic_close.png'
});
}
}
})
}
this.getOrderList()
})
}else if(payItem.paymentMethod == 3){
// 苹果充值
console.log('苹果二次支付')
if(this.isAndorid){
uni.showModal({
title:'提示',
showCancel:false,
content:'很抱歉,当前订单属于苹果系统内购订单,安卓系统无法完成支付操作,您可切换到苹果系统进行支付,也可以取消该订单,并重新下单'
})
}else{
this.iphonepay(payItem)
}
}
},
// 商品内容跳转
@@ -627,6 +695,7 @@
</script>
<style lang="scss" scoped>
.guoqi{ font-size: 28rpx; align-items: center; color: red; float: right; line-height: 40rpx;}
.star{display: inline-block; width: 20px; height: 20px; margin-right: 10rpx;}
.starGray{ background : url(../../static/icon/star_greey.png) no-repeat; background-size: contain; }
.starLight{ background : url(../../static/icon/star_light.png) no-repeat; background-size: contain;}

View File

@@ -10,12 +10,17 @@
:class="orderListTab==item.value?'ordStyle':''">{{item.name}}</view>
</view>
<view class="orderList">
<view class="orderList" v-if="orderList.length > 0">
<view class="orderItem" v-for="(ifex,inten) in orderList">
<text class="orderState orderState0" v-if="ifex.orderStatus==0">待支付</text>
<text class="orderState orderState1" v-if="ifex.orderStatus==1">待发货</text>
<text class="orderState orderState2" v-if="ifex.orderStatus==2">待收货</text>
<text class="orderState orderState3" v-if="ifex.orderStatus==3">已完成</text>
<text class="orderState orderState5" v-if="ifex.orderStatus==5">已超时</text>
<view class="guoqi flexbox" v-if="ifex.orderStatus==0 && ifex.overTime > 0">
<text>剩余支付时间</text>
<uni-countdown background-color="#ff5500" color="#ffffff" :font-size="14" :show-day="false" :hour="0" :minute="0" :second="ifex.overTime" @timeup="countDown"></uni-countdown>
</view>
<view class="flexbox orderSn">
<text class="">订单编号: {{ifex.orderSn}}</text>
</view>
@@ -72,6 +77,9 @@
</view>
</view>
</view>
<view class="" v-else style=" margin-top: 250rpx;">
<u-divider text="暂无列表数据"></u-divider>
</view>
<z-navigation></z-navigation>
<music-play :playData="playData"></music-play>
</view>
@@ -106,7 +114,11 @@ import {
}, {
name: '已完成',
value: 3
}],
},{
name: '已超时',
value: 5
},
],
orderListTab: 9,
orderList: [],
iapChannel:{},
@@ -119,6 +131,8 @@ import {
this.getOrderList()
this.checkIapOrders() //检查未完成的苹果支付订单
this.getOS()
// this.countDown()
},
computed: {
...mapState(['userInfo']),
@@ -133,6 +147,11 @@ import {
},
methods: {
...mapMutations(['setUserInfo']),
// 倒计时回调
countDown(){
console.log('重新刷新订单')
this.getOrderList()
},
// 获得操作系统
getOS(){
let oprateOs = ''
@@ -170,9 +189,18 @@ import {
// 获取订单列表
getOrderList() {
this.$http
.post(`book/buyorder/appUserGetlist?userId=${this.userInfo.id}&orderStatus=${this.orderListTab}`)
.then(res => {
.post(`book/buyOrder/getMyOrderList?userId=${this.userInfo.id}&orderStatus=${this.orderListTab}`)
.then(res => {
res.page.list.forEach((item,index) => {
var seconds = item.timestamp + 30 * 60 + 2 // 过期时间 30分钟+2
// var seconds = item.timestamp + 30 + 2 // 过期时间 30秒
var nowSeconds = Math.floor(new Date().getTime() / 1000); // 单位秒
item.overTime = seconds - nowSeconds
// console.log(item.overTime,'item.overTime')
})
this.orderList = res.page.list
console.log(this.orderList,'订单列表')
})
},
@@ -203,7 +231,7 @@ import {
success: res => {
if (res.confirm) {
this.$http
.post(`book/buyorder/appDelete?orderId=${e.orderId}`)
.post(`book/buyOrder/appDelete?orderId=${e.orderId}`)
.then(res => {
uni.showToast({
icon: 'none',
@@ -510,16 +538,15 @@ import {
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.guoqi{ font-size: 28rpx; align-items: center; color: red; float: right; line-height: 40rpx;}
.flexbox{display: flex;}
.orderTabs {
margin: 100rpx 0 0 0;
width: 100%;
padding: 0 3% 3% 3%;
.orderTabs {
margin: 60rpx 0 0 0;
width: 100%;
padding: 30rpx 3% 3% 3%;
// padding-top: 100rpx;
position: fixed;
top: 80rpx;
top: 80rpx;
background-color: #fff;
z-index: 100;
@@ -566,6 +593,7 @@ import {
.orderState1{background-color: #409eff;}
.orderState2{background-color: #f56c6c;}
.orderState3{background-color: #67c23a;}
.orderState5{background-color: #787878;}
.orderContent {
margin-bottom: 20rpx;

View File

@@ -3,25 +3,25 @@
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="商品结算"></z-nav-bar>
<view v-if="adressMoRen.username==undefined" class="addShouhuo" @click="toAddress()">
<view v-if="adressMoRen.consigneeName==undefined" class="addShouhuo" @click="toAddress()">
<u-icon name="plus" size="20" style="display: inline-block;margin-right: 10rpx;"></u-icon>
请添加收货地址
</view>
<view class="adDefault" @click="dizhiShow = true" v-if="adressMoRen.username!=undefined">
<view class="adDefault" @click="dizhiShow = true" v-if="adressMoRen.consigneeName!=undefined">
<view class="defalTop">
<text class="userName">
{{adressMoRen.username}}
{{adressMoRen.consigneeName}}
</text>
<text class="userTel">
{{adressMoRen.userphone}}
{{adressMoRen.consigneePhone}}
</text>
<text class="userMoren" v-if="adressMoRen.isdefault==1">
<text class="userMoren" v-if="adressMoRen.isDefault==1">
默认
</text>
</view>
<view class="defalBottom">
<text class="userAddress">
{{adressMoRen.areaidpathtext}} {{adressMoRen.useraddress}}
{{adressMoRen.province}} {{adressMoRen.city}} {{adressMoRen.county}} {{adressMoRen.useraddress}}
</text>
</view>
@@ -137,12 +137,12 @@
<view class="addrContent">
<view class="addrContentTop">
<view class="userName">
{{item.username}}
{{item.consigneeName}}
</view>
<view class="userTel">
{{item.userphone}}
{{item.consigneePhone}}
</view>
<view class="userMoren" v-if="item.isdefault==1">
<view class="userMoren" v-if="item.isDefault==1">
默认
</view>
<u-icon name="checkmark-circle-fill" class="chooseCheck" size="20" color="#fd6004"
@@ -150,7 +150,8 @@
</view>
<view class="addrContentBottom">
<view class="userAddress">
{{item.areaidpathtext}} {{item.useraddress}}
{{item.province}} {{item.city}} {{item.county}}
{{item.useraddress}}
</view>
</view>
</view>
@@ -287,17 +288,23 @@
this.shangIDNum = e.list
}
// this.getYunFei()
},
onShow() {
if (this.typeId == 1) {
this.getCartList()
} else if (this.typeId == 0) {
this.getShangList(this.shangIDNum);
}
}
},
onShow() {
// if (this.typeId == 1) {
// this.getCartList()
// } else if (this.typeId == 0) {
// this.getShangList(this.shangIDNum);
// }
this.getData()
this.getOS()
this.getUserAddress()
},
computed: {
...mapState(['userInfo']),
@@ -342,7 +349,8 @@
// 获取地址列表
getUserAddress() {
this.$http
.post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
// .post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
.post(`book/userAddress/getUserAddress?userId=${this.userInfo.id}`)
.then(res => {
if (res.code == 0) {
if (res.list.length != 0) {
@@ -433,7 +441,7 @@
for (let i = 0; i < this.cartIDNum.length; i++) {
this.cartList.push(res.cartList[this.cartIDNum[i]])
}
// console.log(this.cartList, '购物车列表')
console.log(this.cartList, '购物车列表')
this.getCourpe()
this.getUserAddress()
@@ -445,14 +453,18 @@
let dataToString = ''
// console.log(this.adressMoRen, '默认地址')
this.cartList.forEach((item, index) => {
key.push({productsid: item.productId, productAmount:item.productAmount})
dataToString = dataToString.concat(item.productId+"="+item.productAmount+"&")
key.push({productId: item.productId, quantity:item.productAmount})
// dataToString = dataToString.concat(item.productId+"="+item.productAmount+"&")
})
console.log(this.adressMoRen.areaidpath,dataToString,'this.adressMoRen.areaidpath')
console.log(key,'this.adressMoRen.areaidpath')
$http.request({
url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
url: "book/buyOrder/calculateTransportPrice/",
// url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data:{
'regionCode':this.adressMoRen.regionCode,
'products':key,
loadAnimate:'none', // 请求加载动画
} ,
header: { //默认 无 说明:请求头
@@ -460,11 +472,11 @@
},
}).then(res => {
if (res.code == 0) {
this.farePrice = res.price
this.farePrice = res.result
}else{
this.farePrice = 0
}
console.log('需要的运费',res.price)
console.log('需要的运费',res.result)
this.allPrice()
})
},
@@ -584,12 +596,14 @@
let data = {
buyType: this.typeId, //0- 商品页直接下单 1- 购物车结算
userId: this.userInfo.id, //下单人ID
shippingUser: this.adressMoRen.username, //收货人姓名
userPhone: this.adressMoRen.userphone, //收货人手机号
province: this.adressMoRen.areaidpathtext.split(' ')[0], //省
city: this.adressMoRen.areaidpathtext.split(' ')[1], //
district: this.adressMoRen.areaidpathtext.split(' ')[2], //
address: this.adressMoRen.useraddress, //地址
shippingUser: this.adressMoRen.consigneeName, //收货人姓名
userPhone: this.adressMoRen.consigneePhone, //收货人手机号
// province: this.adressMoRen.areaidpathtext.split(' ')[0], //
// city: this.adressMoRen.areaidpathtext.split(' ')[1], //
// district: this.adressMoRen.areaidpathtext.split(' ')[2], //区
//address: this.adressMoRen.useraddress, //地址
paymentMethod: this.payType, //支付方式 2支付宝1微信3ios内购 4天医币购买
orderMoney: this.totalPrice, //订单金额
realMoney: this.realPrice, //实收金额
@@ -601,11 +615,11 @@
orderStatus: 0, //订单状态
products: xiaBiao, //订单列表
orderType: "order", //订单类型
addressId:this.adressMoRen.addressid // 地址ID
addressId:this.adressMoRen.id // 地址ID
}
$http.request({
// url: "book/buyorder/save",
url: "book/buyorder/buySave",
url: "book/buyOrder/buySave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头

View File

@@ -473,7 +473,7 @@
})
console.log(this.adressMoRen.areaidpath,dataToString,'this.adressMoRen.areaidpath')
$http.request({
url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
url: "book/buyOrder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data:{
loadAnimate:'none', // 请求加载动画
@@ -627,7 +627,7 @@
}
$http.request({
// url: "book/buyorder/save",
url: "book/buyorder/buysave",
url: "book/buyOrder/buysave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头

View File

@@ -17,8 +17,8 @@
<text>返回今天</text>
</view>
<!-- <u-icon name="checkbox-mark" color="#55aa7f" size="14" style="display: inline;"></u-icon> -->
<view class="dakaBtn" @tap="buSign()"
v-if="signList.indexOf(currentDay) == -1 && currentDay > linshiDay">
<view class="dakaBtn" @tap="buSign(linshiDay)"
v-if="currentDay > linshiDay">
<text style="font-size: 24rpx;">补卡</text>
</view>
<view class="dakaBtn" @tap="kuickSign()"
@@ -52,7 +52,7 @@
<view class="container1">
<view class="task" v-if="taskInfo.id">
<view class="title">
{{taskInfo.heading}}
{{taskInfo.title}}
</view>
<view class="video " v-if="taskInfo.video">
<!-- 视频形式的任务 -->
@@ -61,9 +61,9 @@
@error="videoErrorCallback" controls></video>
</view>
</view>
<view class="image " v-if="taskInfo.images">
<view class="image " v-if="taskInfo.image">
<!-- 图片形式的任务 -->
<image :src="taskInfo.images" @click="previewImage(taskInfo.images)" style="width: 100%;"
<image :src="taskInfo.image" @click="previewImage(taskInfo.image)" style="width: 100%;"
mode="aspectFit"></image>
</view>
<view class="txt" v-if="taskInfo.content" v-html="taskInfo.content"></view>
@@ -76,16 +76,14 @@
<!-- 已打卡 -->
<view class="had">
<view class="item" v-for="(item, index) in myword" :key="index">
<h3>#{{item.TaskHeading}}#</h3>
<view class="content" v-html="item.phtml">
</view>
<!-- <h3>#{{item.TaskHeading}}#</h3> -->
<view class="pjimgs flexbox">
<view class="item" v-for="(item1,index) in item.clockinimages">
<view class="item" v-for="(item1,index) in item.imageList">
<image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1"
mode="aspectFill" style="width:100%; height: 50px;"></image>
</view>
</view>
<view class="content" v-html="item.phtml"></view>
<view class="opBtns flexbox">
<span class="flexbox"><u-icon name="clock"
color="#b3b3b3"></u-icon>{{item.createTime}}</span>
@@ -98,39 +96,112 @@
<text class="clockTitle">-- 更多签到记录 --</text>
<view class="" v-if="commentsList && commentsList.length > 0">
<view :class="['pingjiaBox']" v-for="(item, index) in commentsList" :key="index">
<view class="flexbox">
<view class="flexbox" style="margin-bottom: 20rpx;">
<view class="touxiang">
<image :src="item.avatar" mode="aspectFit"></image>
<text class="username nowrap ">{{item.name}}</text>
<image v-if="!item.avatar || item.avatar == ''" src="../../static/icon/morenAvavter.png"
mode="aspectFit"></image>
<image v-else :src="item.avatar" mode="aspectFit"></image>
<text class="username nowrap ">{{item.nickName?item.nickName:'匿名用户'}}</text>
</view>
<view class="contentBox">
<div class="pjimgs flexbox">
<view class="item" v-for="(item1,index) in item.images">
<view class="item" v-for="(item1,index) in item.imageList">
<image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1"
mode="aspectFill" style="width:100%; height: 50px;"></image>
</view>
</div>
<view class="content" v-html="item.phtml"></view>
<text class="time">{{item.createdate}}</text>
<view class="content" style="width: 100%;" @click="showPingLun(item)">
<view class="" v-html="item.phtml"></view>
</view>
<view class="flexbox" style="text-align: right; align-items: center; justify-content: space-between;">
<view class="flexbox" @click="showPingLun(item)" style="align-items: center; ">
<u-icon style="display: inline ;margin-left: 10rpx; " name="chat" color="#999"
size="18" ></u-icon>
<text class="time" style="display: inline ;margin-right: 20rpx; ">回复</text>
</view>
<text class="time">{{item.createTime}}</text>
</view>
</view>
</view>
<!-- 显示追平 -->
<!-- <view class="zhuiping item" v-if="item.zphtml != ''" style="padding-left: 50px;">
<h5 style="color: #dbdbdb; margin:10px;">追评内容</h5>
<view class="flexbox">
<view class="contentBox">
<view class="content" v-html="item.zphtml"></view>
<text class="time">{{item.followUpdate}}</text>
</view>
</view>
</view> -->
<view class="zhuiping item" v-if="item.subCommentList.length > 0" style="padding-left: 50px;">
<view class="subPItem" v-for="item2 in item.subCommentList" :key="item2.key">
<view class="touxiang zhuipingTX flexbox">
<view class="left">
<image v-if="!item2.avatar || item2.avatar == ''" src="../../static/icon/morenAvavter.png"
mode="aspectFit"></image>
<image v-else :src="item2.avatar" mode="aspectFit"></image>
</view>
<view class="neirong" style="text-align: left;">
<text class="username nowrap subPName">{{item2.nickName?item2.nickName:'匿名用户'}}</text>
<text class="username nowrap" style="padding: 0 10rpx; color: #c7c7c7;">回复了</text>
<text class="username nowrap">{{item2.puserNickName?item2.puserNickName:'匿名用户'}}</text>
<view class="contentBox" style="width: 100% !important; padding-left: 3px;">
<!-- <div class="pjimgs flexbox">
<view class="item" v-for="(item1,index) in item2.imageList">
<image v-if="item1.length > 10" @click="previewImage(item1)" :src="item1"
mode="aspectFill" style="width:100%; height: 50px;"></image>
</view>
</div> -->
<view class="content" style="width: 100%;" @click="showPingLun(item2)">
<view class="" v-html="item2.phtml"></view>
<!-- <view class="" v-html="item2.content"></view> -->
</view>
<view class="flexbox" style="text-align: right; align-items: center; justify-content: space-between;">
<view class="flexbox" @click="showPingLun(item2)" style="align-items: center;justify-content: space-between; ">
<u-icon style="display: inline ;margin-left: 10rpx; " name="chat" color="#999"
size="18" ></u-icon>
<text class="time" style="display: inline ;margin-right: 20rpx; ">回复</text>
</view>
<text class="time">{{item2.createTime}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-divider text="已加载全部"></u-divider>
</view>
<u-divider v-else text="暂无更多签到记录"></u-divider>
</view>
</view>
<!-- 回复评论弹窗 -->
<u-popup mode="bottom" :show="pinglunShow" :round="10" @close="pinglunShow=false">
<view class="tanchu">
<view class="dp_title">回复 {{opPinglun.nickName ? opPinglun.nickName : '匿名用户'}}</view>
<view style="max-height: 1000rpx;overflow-y: scroll;">
<!-- 提交 -->
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
<!-- <view class="mb30">
<u-upload :fileList="formData.images" @afterRead="afterRead" @delete="deletePic" multiple
:maxCount="4" width="80" height="80" :previewFullImage="true">
</u-upload>
</view> -->
<view class="flex-sub flexbox mb30">
<i @click="showEmj()" :class="emojiIcon"></i>
<!-- <input type="text" @focus="InputFocus" @blur="InputBlur" v-model="message" @input="textareaBInput" placeholder-style="font-size:24rpx;color:#aaaaaa;" placeholder="请输入您要发送的内容"></input> -->
<textarea style="border: 1px solid #EEEEEE;" class="textarea" v-model="formData.content"
@focus="InputFocus" @blur="InputBlur" @input="textareaBInput"
placeholder-style="font-size:24rpx;color:#aaaaaa;" placeholder="请输入回复内容"></textarea>
</view>
<view>
<u-button type="success" @click="goToHuiFu">提交</u-button>
</view>
</view>
<view style="position: relative;">
<emotion @emotion="handleEmj" :height="220" v-if="isShowEmj" :windowWidth="windowWidth">
</emotion>
</view>
</view>
</view>
</u-popup>
<!-- 发布评论弹窗 -->
<u-popup mode="bottom" :show="addTextShow" :round="10" @close="addTextShow=false">
<view class="tanchu">
<view class="dp_title">今日签到随想</view>
@@ -138,7 +209,7 @@
<i @click="showEmj()" :class="emojiIcon"></i>
<editor id="editor" class="ql-container" :placeholder="placeholder" @ready="onEditorReady"></editor>
</view> -->
<view style="max-height: 1000rpx;overflow-y: scroll;">
<!-- 提交 -->
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
@@ -171,8 +242,10 @@
</u-popup>
<view class="leaveBtn" v-if="!addTextShow && currentDay == linshiDay && taskInfo.id && myword.length == 0">
<button style="height: 70rpx; font-size: 28rpx; line-height: 70rpx;" type="primary" plain="true"
@click="addTextShow = true">说点什么</button>
@click="addTextShow = true">说点什么</button>
</view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<music-play :playData="playData"></music-play>
<!-- <z-navigation></z-navigation> -->
</view>
@@ -188,9 +261,14 @@
import {
mapState
} from 'vuex';
import {
param
} from 'jquery';
export default {
data() {
return {
opPinglun:{}, // 针对的评论对象
pinglunShow:false,
placeholder: '开始输入...',
dayCurrent: 0, // 载入页面时的显示页数
showBack: false,
@@ -250,12 +328,23 @@
}]
},
},
recordPageSize:20,
recordPage:1,
secondPage:1,
}
},
onLoad(e) {
this.bookid = e.bookid
this.windowWidth = uni.getSystemInfoSync().windowWidth;
},
onPullDownRefresh() {
console.log('下拉刷新了')
this.getBookInfo()
this.initDay()
this.getmySign()
uni.stopPullDownRefresh();
},
onShow() {
this.getBookInfo()
this.initDay()
@@ -270,6 +359,12 @@
...mapState(['userInfo'])
},
methods: {
showPingLun(item) {
// 回复评论
this.opPinglun = item
this.pinglunShow = true
console.log('item45456', this.opPinglun)
},
onEditorReady() {
// #ifdef MP-BAIDU
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
@@ -292,7 +387,7 @@
} else {
console.log(res.msg)
}
console.log(res, 'res基本信息')
console.log(res, '书籍基本信息')
}).catch((error) => {
console.log(error)
})
@@ -340,7 +435,13 @@
previewImage(url) {
console.log(url)
uni.previewImage({
urls: [url]
urls: [url],
longPressActions:{
itemList:['很抱歉,暂不支持保存图片到本地'],
success:function(res){
// console.log(res,'+++++')
}
}
});
},
// 获取打卡参数
@@ -350,12 +451,13 @@
'userId': this.userInfo.id
}
this.$http
.post('book/clockinPunch/clockindays', data)
// .post('book/clockinPunch/clockindays', data)
.get('book/userClockIn/clockInDays', data)
.then(res => {
if (res.code == 0) {
this.currentDay = res.daysBetween
this.linshiDay = res.daysBetween
this.signList = res.dayslist
this.currentDay = res.currentDay
this.linshiDay = res.currentDay
this.signList = res.clockInDayList
console.log(res, '打卡参数')
let zheng = Math.floor(this.currentDay / 5)
this.currentIndex = zheng
@@ -382,19 +484,25 @@
// 获取当天我的发布内容
getmyWord() {
let data = {
'userId': this.userInfo.id,
'entryId': this.taskInfo.id
}
this.$http
.post('book/clockin/myinfolist?userid=' + this.userInfo.id + '&taskid=' + this.taskInfo.id +
'&bookid=' + this.bookid)
// .post('book/clockin/myinfolist?userid=' + this.userInfo.id + '&taskid=' + this.taskInfo.id +
// '&bookid=' + this.bookid)
.get('book/clockInForum/getChatList', data)
.then(res => {
console.log(res, '当天我的打卡内容')
if (res.code == 0 && res.productlist.length > 0) {
if (res.code == 0 && res.chatList.length > 0) {
var arr = []
res.productlist.forEach((item1) => {
res.chatList.forEach((item1) => {
var pjstr = ''
var imgs = []
imgs = item1.clockinimages.split(',')
//imgs = item1.clockinimages.split(',')
pjstr = this.getHtmlComment(item1.content)
item1.clockinimages = imgs
// item1.clockinimages = imgs
item1.phtml = pjstr
arr.push(item1)
})
@@ -422,33 +530,37 @@
// 获取某天的签到列表信息
getAllSign(val) {
console.log(val, '-----------')
let data = {
'bookid': this.bookid,
'limit': 5,
'page': this.page,
'taskid': val.id
}
this.$http
.post('book/clockin/applist', data)
let param = {
'entryId': val.id,
// 'userId': null,
'currentPage': this.recordPage,
'pageSize': this.recordPageSize,
// 'taskid': val.id
}
this.$http
.get('book/clockInForum/getChatList', param)
// .get('book/clockInForum/getChatList', data)
.then(res => {
if (res.code == 0) {
console.log(res, '所有人打卡信息')
if (res.list.length > 0) {
var arr = res.list
if (res.chatList.length > 0) {
var arr = res.chatList
for (var i = 0; i < arr.length; i++) {
var arr1 = []
var pjstr = ''
// console.log(arr[i].content,'arr[i].content')
pjstr = this.getHtmlComment(arr[i].content)
// console.log(pjstr,'pjstr')
arr1 = arr[i].images.split(',')
arr[i].images = arr1
arr[i].phtml = pjstr
// console.log(arr1,'arr1')
//arr1 = arr[i].images.split(',')
// arr[i].images = arr1
arr[i].phtml = pjstr
for (var j = 0; j < arr[i].subCommentList.length; j++) {
var subpjstr = ''
subpjstr = this.getHtmlComment(arr[i].subCommentList[j].content)
arr[i].subCommentList[j].phtml = subpjstr
}
}
// console.log(arr,'res.page.list')
console.log(arr,'评论处理后的数据结构')
this.commentsList = arr
} else {
this.commentsList = []
@@ -462,18 +574,19 @@
getTask(index) {
uni.showLoading()
let data = {
'bookid': this.bookid,
'days': index
'bookId': this.bookid,
'day': index
}
console.log(data)
this.linshiDay = index
this.$http
.post('book/task/applist', data)
// .post('book/task/applist', data)
.get('book/clockInForum/getPostingInfo', data)
.then(res => {
if (res.code == 0) {
console.log(res, '任务信息')
if (res.page.list.length > 0) {
this.taskInfo = res.page.list[0]
if (res.result != {}) {
this.taskInfo = res.result
this.taskInfo.video != '' ? this.poster = this.taskInfo.video +
"?x-oss-process=video/snapshot,t_0,f_jpg" : ''
this.getmyWord()
@@ -491,39 +604,37 @@
},
// 补卡
buSign(day) {
console.log('正在补卡', this.taskInfo)
if (!this.taskInfo.id) {
uni.showToast({
title: '当天未发布打卡任务,不可补卡哦',
icon: 'none'
})
return
console.log('正在补卡', this.taskInfo,day)
// return false
// if (!this.taskInfo.id) {
// uni.showToast({
// title: '当天未发布打卡任务,不可补卡哦',
// icon: 'none'
// })
// return
// }
let param = {
'bookId': this.bookid,
'userId':this.userInfo.id,
'day':day
}
let data = {
"bookId": this.bookid,
"userId": this.userInfo.id,
"tid": this.taskInfo.id,
"days": this.linshiDay
}
console.log(data, 'data')
$http.request({
url: 'book/clockinPunch/save',
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
console.log(param, 'param')
this.$http
.get('/book/userClockIn/correctClockIn', param)
.then(res => {
if (res.code == 0) {
//console.log(res, '快捷签到')
uni.showToast({
title: '签到成功'
title: '补卡成功'
})
this.addTextShow = false
this.formData.content = ''
this.formData.images = []
this.getmySign()
this.getAllSign(this.taskInfo)
setTimeout(()=>{
this.addTextShow = false
this.formData.content = ''
this.formData.images = []
this.getmySign()
// this.getAllSign(this.taskInfo)
},2000)
}
});
@@ -541,49 +652,116 @@
let data = {
"bookId": this.bookid,
"userId": this.userInfo.id,
"tid": this.taskInfo.id,
"days": this.currentDay
// "tid": this.taskInfo.id,
// "days": this.currentDay
}
this.$http
// .post('book/clockinPunch/clockindays', data)
.get('book/userClockIn/clockIn', data)
.then(res => {
if (res.code == 0) {
//console.log(res, '快捷签到')
uni.showToast({
title: '签到成功',
icon: 'success'
})
setTimeout(() => {
this.addTextShow = false
this.formData.content = ''
this.formData.images = []
this.getmySign()
this.getAllSign(this.taskInfo)
}, 1000)
}
});
},
// 提交回复评论
goToHuiFu(){
let myFid = null
if(this.opPinglun.fid == 0){
myFid = this.opPinglun.id
}else if (this.opPinglun.fid != 0){
myFid = this.opPinglun.fid
}
let data = {
// 'bookId': this.bookid,
"userId": this.userInfo.id,
"entryId": this.taskInfo.id,
'fid': myFid,
'puserId': this.opPinglun.userId,
// "dayId": this.currentDay,
"content": this.formData.content,
"pchatId": this.opPinglun.id,
// "imageList": imgs,
}
console.log(data, 'data回复提交数据')
// url: 'book/clockin/save',
// this.$http
// .post('book/clockInForum/addChat', data)
$http.request({
url: 'book/clockinPunch/save',
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
url: "book/clockInForum/addChat",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
//console.log(res, '快捷签到')
uni.showToast({
title: '签到成功',
icon: 'success'
})
this.addTextShow = false
this.pinglunShow = false
this.opPinglun = {}
this.formData.content = ''
this.formData.images = []
this.getmySign()
this.getAllSign(this.taskInfo)
this.formData.imagesStr = []
uni.showToast({
title: '回复成功',
icon: 'success'
})
setTimeout(() => {
this.getmySign()
this.getTask(this.currentDay)
},2000)
}
});
},
// 说点什么
goToSign() {
let data = {
'bookId': this.bookid,
"userId": this.userInfo.id,
"taskId": this.taskInfo.id,
"dayId": this.currentDay,
"content": this.formData.content,
// "images": this.formData.imagesStr.join(),
"imageeStrings": this.formData.images,
}
// images数据处理
if(this.formData.images.length > 0){
var imgs = []
imgs = this.formData.images.map(item => {
return item.url
})
}
if(this.formData.content == ''){
uni.showToast({
title: '请输入内容',
icon: 'none'
})
return false
}
let data = {
// 'bookId': this.bookid,
"userId": this.userInfo.id,
"entryId": this.taskInfo.id,
'fid': 0,
'puserId': 0,
// "dayId": this.currentDay,
"content": this.formData.content,
"pchatId": 0,
"imageList": imgs,
}
console.log(data, 'data')
// url: 'book/clockin/save',
// this.$http
// .post('book/clockInForum/addChat', data)
$http.request({
url: 'book/clockin/save',
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
url: "book/clockInForum/addChat",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -591,16 +769,18 @@
}).then(res => {
if (res.code == 0) {
//console.log(res, '快捷签到')
uni.showToast({
title: '发布成功',
icon: 'success'
})
this.addTextShow = false
this.formData.content = ''
this.formData.images = []
this.formData.imagesStr = []
this.getmySign()
this.getTask()
uni.showToast({
title: '发布成功',
icon: 'success'
})
setTimeout(() => {
this.getmySign()
this.getTask(this.currentDay)
},2000)
}
@@ -731,20 +911,24 @@
</script>
<style lang="scss" scoped>
.ql-editor{min-height: 50rpx;}
.pingjiaBox{margin-bottom: 20rpx;}
.ql-editor {
min-height: 50rpx;
}
.ql-container {
width: calc(100% - 30rpx);
min-height: 50rpx !important;
height: auto !important;
font-style: normal;
font-size: 30rpx;
margin: 0 auto;
border: 1px solid #ddd;
margin: 0 auto;
border: 1px solid #ddd;
border-radius: 20rpx;
}
.pjimgs {
margin: 10px 0;
margin: 10rpx 0;
flex-wrap: wrap;
display: flex;
@@ -764,6 +948,7 @@
.content {
font-size: 28rpx;
margin: 10rpx 0;
line-height: 40rpx;
}
@@ -774,7 +959,7 @@
float: right;
}
}
.touxiang {
width: 50px;
overflow: hidden;
@@ -796,7 +981,20 @@
margin-top: 6rpx;
}
}
.subPItem{margin-bottom: 40rpx;}
.subPName{padding-left: 10rpx;}
.zhuipingTX{
width: 100%;
image {
width: 30px !important;
padding: 3px;
height: 30px !important;
border: 1px solid #eee;
border-radius: 64px;
overflow: hidden;
;
}
}
.allComments {
background-color: #fff;
margin-top: 20rpx;
@@ -844,6 +1042,11 @@
}
}
.gzicon {
width: 10px !important;
height: 10px !important;
}
.scroll-view_H {
white-space: nowrap;
margin: 8rpx 0;
@@ -1145,8 +1348,8 @@
}
.had {
padding: 60rpx;
margin-top: 30rpx;
padding: 20rpx;
// margin-top: 30rpx;
background-color: #fff;
h3 {
@@ -1156,7 +1359,7 @@
.content {
line-height: 60rpx;
margin-top: 30rpx;
margin-top: 10rpx;
font-size: 30rpx;
color: #0e0e15;
}
@@ -1173,7 +1376,7 @@
}
.opBtns {
margin-top: 30rpx;
margin-top: 10rpx;
span {
color: #b3b3b3;

View File

@@ -1,9 +1,19 @@
<template>
<view>
<z-nav-bar title="读书打卡"></z-nav-bar>
<view class="tip">
<text>请选择要打卡的书籍</text>
<z-nav-bar title="读书打卡"></z-nav-bar>
<view class="" style="padding:40rpx 20rpx;">
<view class="mytabs flexbox">
<view :class="['item','item1', contentShow == 1 ? 'active' :'']" @click="setData(1)">
已购图书
</view>
<view :class="['item','item2', contentShow == 2 ? 'active' :'']" @click="setData(2)">
推荐图书
</view>
</view>
</view>
<!-- <view class="tip">
<text>请选择要打卡的书籍</text>
</view> -->
<view class="listenList" v-if="bookList.length > 0">
<view class="wrap" >
<u-row gutter="16" justify="flex-start">
@@ -36,49 +46,61 @@
playData:{},
bookList:[],
page:1, // 页码
contentShow: 1,
}
},
onLoad() {
this.getfreeBook()
},
methods: {
setData(e) {
this.contentShow = e
this.getfreeBook()
},
// 跳转到打卡页面
goToClock(val){
if(val.clockIn != 1){
uni.showModal({
title: '提示',
cancelText: '暂不购买',
confirmText:'立即购买',
content: '购买后才可参与本书打卡哦~',
success: function (res) {
if (res.confirm) {
console.log('点击了去购买');
}
}
});
}else{
console.log(val,'val')
console.log(val,'val')
if(this.contentShow == 1){
this.onPageJump('../clock/clock?bookid='+val.id)
}else{
uni.navigateTo({
url: '../eBook/bookContent?Id=' + val.id
});
}
},
// 获取打卡图书
getfreeBook(){
this.$http
.post('book/userebookbuy/getUserClockBookList', { // 磊哥新写
// .post('book/userebookbuy/appbooklist', { 原接口
'userId': this.userInfo.id,
})
.then(res => {
if(this.contentShow == 1){
// this.$http.post('book/clockinPunch/myClockBooks', {
this.$http.post('book/clock/getUserClockBooks', {
'userId': this.userInfo.id,
limit: 100,
page:1,
}).then(res => {
if(res.code == 0){
//this.ygtotalPage = res.resultlist.totalCount
this.bookList = res.books
console.log(this.bookList,'打卡列表')
this.bookList = res.page.records
console.log(this.bookList,'打卡列表')
// this.status = 3
}
}
});
} else {
//this.$http.post('book/clockinPunch/getBestClockBooks', {
this.$http.post('book/clock/getUserClockBestBooks', {
'userId': this.userInfo.id,
limit: 100,
page:1,
}).then(res => {
if(res.code == 0){
//this.ygtotalPage = res.resultlist.totalCount
this.bookList = res.page.records
console.log(this.bookList,'打卡列表')
// this.status = 3
}
});
}
},
// 跳转
onPageJump(url) {
@@ -98,6 +120,33 @@
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.mytabs {
// background: url('@/static/icon/bgtushu.png') no-repeat left top;
height: 80rpx;
// margin-bottom: 30rpx;
.item {
border-radius: 10rpx;
background-color: #c6ead0;
width: 48%;
// margin: 0 10rpx;
text-align: center;
color: #3c7f56;
font-size: 36rpx;
line-height: 80rpx;
}
.item.active {
background-color: #3c7f56;
color: #fff;
}
.item1 {
margin-right: 20rpx;
}
}
.tip{
padding: 20rpx; background-color: #fff;
text{ font-size: 36rpx;}

View File

@@ -18,7 +18,11 @@
<span class="author">作者{{productInfo.authorName}}</span>
<!-- <view class="description">{{productInfo.bookdesc}}</view> -->
<span class="author">听书读书打卡立即购买</span>
<view class="ting-du-mai">
<view class="ting-du-mai-item" @click="toOtherPage(1,productInfo)">听书</view>
<view class="ting-du-mai-item" @click="toOtherPage(2,productInfo)">读书打卡</view>
<view class="ting-du-mai-item" @click="toOtherPage(3,productInfo)">立即购买</view>
</view>
</view>
</view>
@@ -29,6 +33,16 @@
</view>
<view class="mainContent">
<view v-if="shupingList.length > 0">
<view class="flexbox shuping-topbar">
<view class="shuping-topbar-tiao">{{shupingNum || 0}}条书评</view>
<view class="shuping-topbar-order">
<!-- <view v-for="(item,index) in orderTabs" @click="orderTabCLi(item.value)" :key="index"
:class="orderListTab==item.value?'orderdefine ordStyle':'orderdefine'">{{item.name}}</view> -->
<view :class="orderListTab==1?'orderdefine ordStyle':'orderdefine'" @click="orderTabCLi(1)">按时间</view>
<view style="border-left:2rpx solid #e9e9e9;height:36rpx;"></view>
<view :class="orderListTab==2?'orderdefine ordStyle':'orderdefine'" @click="orderTabCLi(2)">按热度</view>
</view>
</view>
<view class="item" @click.stop="toDetail(item)" v-for="(item,index1) in shupingList" :key="index">
<view class="title">{{item.title}}</view>
<image class="feng" v-if="item.image" :src="item.image" mode="aspectFill"></image>
@@ -39,14 +53,16 @@
<view class="btns flexbox" style="margin-top:10rpx;">
<span class="left" style="color: #C0C4CC;">{{formatTimeDifferenceFromT(item.createTime)}}</span>
<span class="right flexbox opbtns">
<image class="gzicon" v-if="item.ilike" src="../../static/icon/gz2.png" mode="aspectFill"></image>
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill"></image>
<image class="gzicon" v-if="item.ilike" src="../../static/icon/gz2.png" mode="aspectFill" @click.stop="clickLike(item)"></image>
<image class="gzicon" v-else src="../../static/icon/gz.png" mode="aspectFill" @click.stop="clickLike(item)"></image>
<view style="color: #C0C4CC;">{{item.contlike}}</view>
<image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill" @click.stop="pinglun(item.id)"></image>
<view style="color: #C0C4CC;" @click.stop="pinglun(item.id)">{{item.commentNum}}</view>
<!-- <image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill" @click.stop="pinglun(item.id)"></image>
<view style="color: #C0C4CC;" @click.stop="pinglun(item.id)">{{item.commentNum}}</view> -->
<image class="gzicon" v-if="1" src="../../static/icon/pinglun.png" mode="aspectFill"></image>
<view style="color: #C0C4CC;">{{item.commentNum}}</view>
</span>
</view>
<view style="border-bottom:2rpx solid #e9e9e9;height:50rpx;" v-if="index1<shupingList.length-1"></view>
<view style="border-bottom:2rpx solid #e9e9e9;height:36rpx;" v-if="index1<shupingList.length-1"></view>
<!-- <image class="feng" v-if="item.image == ''" src="../../static/icon/home_bg.jpg" mode="scaleToFill" style="width: 100%;"></image>
<image class="feng" v-else :src="item.image" mode="scaleToFill" style="width: 100%;"></image>
<text class="title">{{item.title}}</text> -->
@@ -126,6 +142,15 @@ import { data } from 'jquery';
export default {
data() {
return {
orderListTab: 1,
orderTabs: [{
name: '按时间',
value: 1
}, {
name: '按热度',
value: 2
}],
shupingNum: 0,
loadingNow : false,
playData:{},
isShowEmj: false,
@@ -156,7 +181,7 @@ import { data } from 'jquery';
this.page=1, // 页码
this.shupingList = []
this.getBookCom()
this.getBookCom(this.orderListTab)
},
onReachBottom() {
@@ -165,7 +190,7 @@ import { data } from 'jquery';
this.page++
console.log('加载',this.page)
this.status = 0
this.getBookCom()
this.getBookCom(this.orderListTab)
}else{
this.status = 1
@@ -178,12 +203,55 @@ import { data } from 'jquery';
console.log(e,'onload')
this.bookid = e.bookid
this.getProDetail(e)
this.getBookCom()
this.getBookCom(this.orderListTab)
},
computed:{
...mapState(['userInfo']),
},
methods: {
toOtherPage(e,productInfo) {
if(e==1){
// 跳转到听书
uni.navigateTo({
url: "../listen/listen?bookid=" + productInfo.id
});
}
if(e==2){
// 跳转到读书打卡
uni.navigateTo({
url: '../clock/clock?bookid='+ productInfo.id
})
}
if(e==3){
// 跳转到购买
uni.navigateTo({
url: '../bookShop/commodityDetail?id=' + productInfo.id
});
}
},
// 切换tab状态
orderTabCLi(e) {
this.orderListTab = e
this.page = 1
this.shupingList = []
this.getBookCom(this.orderListTab)
},
clickLike(item){
this.$http
.post("forum/articles/chickForumContlike?forum_id=" + item.id,)
.then(res => {
if (res.code == 0) {
uni.showToast({
title:'点赞成功!',
icon:'success'
})
item.contlike++
}
}).catch((e)=>{
console.log(e,'e')
})
},
formatTimeDifferenceFromT(dateTimeT) {
const now = new Date();
const t = new Date(dateTimeT);
@@ -237,24 +305,26 @@ import { data } from 'jquery';
})
},
// 获得书评
getBookCom(){
getBookCom(flag){
let data = {
'page': this.page,
'limit': this.pageSize,
'bookid' : this.bookid
'bookId' : this.bookid,
'order' : flag
}
console.log(data,'data')
this.$http
.post('forum/articles/descupdatelist', data)
.post('forum/articles/getForumByBook', data)
.then(res => {
console.log(res,'获取成功')
this.total = res.page.totalPage
this.shupingList = this.shupingList.concat(res.page.list)
this.total = res.page.pages
this.shupingNum = res.page.total
this.shupingList = this.shupingList.concat(res.page.records)
// console.log(res,'已购买')
this.status = 3
}).catch((e)=>{
console.log(e,'e')
})
console.log(e,'e')
})
},
// 获得输入的表情数组
handleEmj(i) {
@@ -462,18 +532,59 @@ import { data } from 'jquery';
margin-right: 5rpx;
}
}}
.shuping-topbar{
display: flex;
justify-content: space-between;
align-items: center;
.shuping-topbar-tiao{
font-size: 28rpx;
color: #8b8a91;
}
.shuping-topbar-order{
width: 280rpx;
display: flex;
justify-content: space-between;
align-items: center;
.orderdefine {
display: inline-block;
padding: 20rpx 0 20rpx 0;
// margin: 40rpx 0 15rpx 0;
width:230rpx;
text-align: center;
font-size: 30rpx;
}
.ordStyle {
// border-bottom: 4rpx solid #54a966;
// color: #54a966;
font-weight: bold;
}
}
}
.quesheng{text-align: center; margin-top: 100rpx; color: #8b8a91; padding-bottom: 20rpx; padding-top: 20rpx;}
.bookInfo{
justify-content: space-between;
margin-bottom: 15px;
background-color: #fff;
padding:10px;
border: 1px splid #999;
// border: 1px splid #999;
box-sizing: border-box;
padding-bottom: 20rpx;
border-radius: 20rpx;
margin-bottom: 20rpx;
.ting-du-mai{
display: flex;
justify-content: space-between;
align-content: center;
font-size: 28rpx;
width: 400rpx;
.ting-du-mai-item{
color: deepskyblue;
border: 1px solid deepskyblue;
border-radius: 6rpx;
padding: 4rpx 6rpx;
}
}
.imageradius{
border-radius: 20rpx;
border:1rpx solid #e9e9e9;
@@ -522,8 +633,20 @@ import { data } from 'jquery';
border-radius: 20rpx;
margin-bottom: 20rpx;
}
.feng{margin:10rpx 0 0 0;height: 200rpx;width: 200rpx;float:right;border-radius: 20rpx;border:1rpx solid #e9e9e9;}
.title{font-size: 30rpx; font-weight: 700; color: #000; overflow: hidden;}
.feng{
margin:10rpx 20rpx 0 0;
height: 160rpx;
width: 140rpx;
float:left;
border-radius: 20rpx;
border:1rpx solid #e9e9e9;
}
.title{
font-size: 30rpx;
font-weight: 700;
color: #000;
overflow: hidden;
}
.description{
overflow: hidden;
color: #666;
@@ -534,10 +657,10 @@ import { data } from 'jquery';
-webkit-line-clamp: 5;
line-clamp: 5;
-webkit-box-orient: vertical;
font-size: 28rpx;
margin-bottom: 15px;
margin-top:5px;
min-height: 186rpx;
font-size: 26rpx;
margin-bottom: 20rpx;
margin-top:10rpx;
height: 172rpx;
}
// .btns{
// font-size: 24rpx;

View File

@@ -37,7 +37,8 @@
</span> -->
</span>
</view>
<view class="zhengwen" v-html="commentInfo.content"></view>
<view class="zhengwen" v-html="commentInfo.content">
</view>
<view class="btns flexbox">
<span class="left"></span>
<span class="right flexbox opbtns" style="color:#C0C4CC;">
@@ -72,7 +73,7 @@
<view v-if="plList.length > 0">
<view class="pl-item" v-for="item in plList" :key="item.id">
<view class="plusername">{{item.user.name}}</view>
<view class="content" v-html="item.phtml"></view>
<view class="content" v-html="item.content"></view>
<!-- <view class="btns flexbox"> -->
<!-- <span class="time">{{formatTimeDifferenceFromT(item.createTime)}}</span> -->
<!-- <span class="flexbox opbtns">
@@ -106,6 +107,7 @@
<!-- <view style="color: #C0C4CC;" @click="pinglun(item1)">{{item1.commentsNum}}</view> -->
</span>
</view>
<view style="border-bottom:2rpx solid #e9e9e9;height:20rpx;" v-if="index<item.comments.length-1"></view>
</view>
</view>
<!-- </view> -->
@@ -258,18 +260,15 @@
this.status = 3
// 评论格式化
var newarr = []
plList1.forEach((item1)=>{
var pjstr = ''
pjstr = this.getHtmlComment(item1.content)
item1.phtml = pjstr
if(item1.comments && item1.comments.length>0){
item1.comments.forEach((item2)=>{
var pjstr1 = ''
item2.content = this.getHtmlComment(item2.content)
})
}
// console.log(pjstr)
newarr.push(item1)
plList1.forEach((item1)=>{
item1.content = this.getHtmlComment(item1.content)
if(item1.comments && item1.comments.length>0){
item1.comments.forEach((item2)=>{
item2.content = this.getHtmlComment(item2.content)
})
}
// console.log(pjstr)
newarr.push(item1)
})
this.plList = this.plList.concat(newarr)
@@ -508,18 +507,40 @@
.post("forum/articles/pushMsgToForum", data)
.then(res => {
if (res.code == 0) {
if (res.code == 0) {
uni.showToast({
title:'评论成功!',
icon:'success'
})
// this.getCommPL()
this.pingjiaShow = false
this.Pform.comment = ''
this.Pform.name = ''
this.Pform.pid = ''
this.Pform.puserId = ''
// this.pinglunId = null
uni.showToast({
title:'评论成功!',
icon:'success'
})
// this.getCommPL()
this.pingjiaShow = false
this.Pform.comment = ''
this.Pform.name = ''
this.Pform.pid = ''
this.Pform.puserId = ''
// this.pinglunId = null
// 把回复的评论拼进this.plList回复列表中
let comment = res.comment
// 第一种情况1级回复
if(comment&&comment.pid == 0){
comment.content = this.getHtmlComment(comment.content)
console.log('this.userInfo',this.userInfo)
comment.user = this.userInfo
comment.comments = []
this.plList.unshift(comment)
}else if(comment&&comment.pid > 0){// 第二种情况回复第1级回复和回复第2级回复
for(let i=0;i<this.plList.length;i++){
if(this.plList[i].id == comment.pid){
comment.content = this.getHtmlComment(comment.content)
console.log('this.userInfo',this.userInfo)
comment.user = this.userInfo
comment.puser = this.plList[i].user
// comment.comments = []
this.plList[i].comments.push(comment)
}
}
}
}
}).catch((e)=>{
@@ -569,7 +590,7 @@
border-bottom: 1px solid #f0f0f0;
.pl-son{
margin: 14rpx 0 14rpx 60rpx;
padding: 0 0 14rpx 14rpx;
padding: 0 14rpx 14rpx 14rpx;
background-color: #f0f0f0;
border-radius: 10rpx;
.pl-son-item{
@@ -626,7 +647,14 @@
}
// .mbtns{padding: 5px; background-color: #f4fff5; border-radius: 10px; font-size: 34rpx; color: #8b8a91; margin:15px 0; justify-content: space-between;}
.zhengwen{line-height: 50rpx; font-size: 28rpx;margin-top: 20rpx;}
/deep/.zhengwen{
line-height: 50rpx;
font-size: 28rpx;
margin-top: 20rpx;
img{
width: 100% !important;
}
}
.flexbox{display: flex;}
.container{padding: 10px;}
.star{display: inline-block; width: 20px; height: 20px; margin-right: 10rpx;}

View File

@@ -1,5 +1,7 @@
<template>
<view class="container">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="header">
<!-- 顶部导航栏 -->
<z-nav-bar title="书评列表"></z-nav-bar>
@@ -83,6 +85,16 @@
</view>
</view>
<view v-if="commentsListTab == 3">
<view class="" style="padding:40rpx 20rpx;">
<view class="mytabs flexbox">
<view :class="['item','item1', contentShow == 1 ? 'active' :'']" @click="setData(1)">
已购图书
</view>
<view :class="['item','item2', contentShow == 2 ? 'active' :'']" @click="setData(2)">
推荐图书
</view>
</view>
</view>
<view v-if="bookList.length > 0">
<view class="bookInfo3" v-for="(item,index) in bookList" :key="index">
<view class="mainContent3">
@@ -128,7 +140,7 @@
import musicPlay from '@/components/music.vue'
import { data } from 'jquery';
import {
mapState
mapState, mapMutations
} from 'vuex';
export default {
data() {
@@ -173,6 +185,7 @@ import { data } from 'jquery';
newList:[],
hotList:[],
bookList:[],
contentShow: 1,
}
},
@@ -186,25 +199,30 @@ import { data } from 'jquery';
this.newList = []
this.hotList = []
this.bookList = []
this.getBookList(this.commentsListTab, true)
this.getBookList(this.commentsListTab, false)
},
onReachBottom() {
this.newestpage++
this.hotestpage++
this.booksetpage++
this.getBookList(this.commentsListTab, true)
this.getBookList(this.commentsListTab, false)
},
onLoad(e) {
this.windowWidth = uni.getSystemInfoSync().windowWidth;
console.log(e,'onload')
// this.bookid = e.bookid
this.getBookList(1, true)
this.getBookList(1, false)
},
computed:{
...mapState(['userInfo']),
},
methods: {
...mapMutations(['setLoadingShow']),
setData(e) {
this.contentShow = e
this.getBookList(this.commentsListTab, true)
},
formatTimeDifferenceFromT(dateTimeT) {
const now = new Date();
const t = new Date(dateTimeT);
@@ -243,7 +261,7 @@ import { data } from 'jquery';
this.newList = []
this.hotList = []
this.bookList = []
this.getBookList(this.commentsListTab, true)
this.getBookList(this.commentsListTab, false)
},
// 查看本书更多书评
toMore(val){
@@ -275,18 +293,27 @@ import { data } from 'jquery';
console.log(e,'e')
})
},
getBookList(flag, clear){
getBookList(flag, tushuflag){
// 根据tab不同获取最新书评、最热书评、书集列表
uni.showLoading({
title: '加载中'
});
// uni.showLoading({
// title: '加载中'
// });
var httpurl = ""
if(flag == 1){
httpurl = "forum/articles/getForumsNew?page=" + this.newestpage + '&limit=10'
}else if(flag == 2){
httpurl = "forum/articles/getForumsHot?page=" + this.hotestpage + '&limit=10'
}else{
httpurl = "forum/articles/getForumsAndBook?page=" + this.booksetpage + '&limit=10&userId=' + this.userInfo.id
if(tushuflag){ // 点击切换已购和推荐
this.booksetpage = 1
this.bookList = []
}
if(this.contentShow == 1){
httpurl = "forum/articles/getHasForumsAndBook?page=" + this.booksetpage + '&limit=10&userId=' + this.userInfo.id
} else {
httpurl = "forum/articles/getBestForumsAndBook?page=" + this.booksetpage + '&limit=10&userId=' + this.userInfo.id
}
}
this.$http
.post(httpurl)
@@ -324,12 +351,12 @@ import { data } from 'jquery';
// console.log(e,'e')
// })
// }
if(res.page.records.size != 10){
if(res.page.records.length != 10){
this.status = 1
} else {
this.status = 0
}
uni.hideLoading();
}
// uni.hideLoading();
}).catch((e)=>{
console.log(e,'e')
})
@@ -509,7 +536,7 @@ import { data } from 'jquery';
border:1rpx solid #e9e9e9;
}
.title{font-size: 30rpx; font-weight: 700; color: #000; overflow: hidden;}
.description{
/deep/.description{
overflow: hidden;
color: #666;
text-overflow: -o-ellipsis-lastline;
@@ -523,6 +550,9 @@ import { data } from 'jquery';
margin-bottom: 20rpx;
margin-top:10rpx;
height: 172rpx;
img{
width: 100% !important;
}
}
.btns{
font-size: 22rpx;
@@ -590,7 +620,7 @@ import { data } from 'jquery';
.shupingList{
min-height: 212rpx;
}
.description{
/deep/.description{
overflow: hidden;
color: #666;
text-overflow: -o-ellipsis-lastline;
@@ -603,6 +633,9 @@ import { data } from 'jquery';
font-size: 26rpx;
margin-bottom: 20rpx;
margin-top:10rpx;
img{
width: 100% !important;
}
}
.btns{
font-size: 22rpx;
@@ -632,4 +665,30 @@ import { data } from 'jquery';
}
}
}
.mytabs {
// background: url('@/static/icon/bgtushu.png') no-repeat left top;
height: 80rpx;
// margin-bottom: 30rpx;
.item {
border-radius: 10rpx;
background-color: #c6ead0;
width: 48%;
// margin: 0 10rpx;
text-align: center;
color: #3c7f56;
font-size: 36rpx;
line-height: 80rpx;
}
.item.active {
background-color: #3c7f56;
color: #fff;
}
.item1 {
margin-right: 20rpx;
}
}
</style>

View File

@@ -194,25 +194,25 @@
this.freeChapterCount = res.book.freeChapterCount
this.bokMesDet.userId = this.userInfo.id
if (this.bookMessage.publisherName.indexOf(',') > 0) {
this.bookMessage.publisherName = this.bookMessage.publisherName.split(',')
this.bookMessage.publisherId = this.bookMessage.publisherId.split(',')
this.bookMessage.publisherNIList = []
for (let i in this.bookMessage.publisherName) {
this.bookMessage.publisherNIList.push({
title: this.bookMessage.publisherName[i]
})
}
for (let j in this.bookMessage.publisherId) {
this.bookMessage.publisherNIList[j].id = this.bookMessage.publisherId[j]
}
} else {
this.bookMessage.publisherNIList = []
this.bookMessage.publisherNIList.push({
'title': this.bookMessage.publisherName,
'id': this.bookMessage.publisherId
})
}
// if (this.bookMessage.publisherName.indexOf(',') > 0) {
// this.bookMessage.publisherName = this.bookMessage.publisherName.split(',')
// this.bookMessage.publisherId = this.bookMessage.publisherId.split(',')
// this.bookMessage.publisherNIList = []
// for (let i in this.bookMessage.publisherName) {
// this.bookMessage.publisherNIList.push({
// title: this.bookMessage.publisherName[i]
// })
// }
// for (let j in this.bookMessage.publisherId) {
// this.bookMessage.publisherNIList[j].id = this.bookMessage.publisherId[j]
// }
// } else {
// this.bookMessage.publisherNIList = []
// this.bookMessage.publisherNIList.push({
// 'title': this.bookMessage.publisherName,
// 'id': this.bookMessage.publisherId
// })
// }
});
// 获取电子目录

View File

@@ -87,7 +87,7 @@
<view class="">
<image src="../../static/icon/home3.png" mode="aspectFit"></image>
</view>
<view class="v1"><text> </text></view>
<view class="v1"><text> </text></view>
</view>
<view class="item " >
<!-- <u-icon name="chat" color="#fcbd71" size="24"></u-icon> -->
@@ -390,7 +390,7 @@
.btns{ margin-left: 20rpx; width: calc(100% - 200rpx); box-sizing: border-box; font-size: 34rpx; justify-content: space-between;
.item{ margin-bottom:30rpx; width: 20%; text-align: center;
image{
display: block; margin-right: 10rpx; height: 112rpx;
display: block; height: 108rpx;
}
.v1{margin-top: -30rpx;}
}

View File

@@ -4,11 +4,14 @@
<public-module></public-module>
<z-nav-bar title="我的听书"></z-nav-bar>
<view class="home_bg">
<image src="../../static/icon/home_icon_1.png" mode="aspectFit" class="icon_hua_1"></image>
<view v-if="showEbook" class="search_box" @click="onPageJump('./searchFor')">
<view class="icon_hua_1">
<image src="../../static/icon/home_icon_1.png" mode="aspectFit" ></image>
</view>
<!-- <view v-if="showEbook" class="search_box" @click="onPageJump('./searchFor')">
<text class="icon_search"></text>
<text class="prompt">搜索...</text>
</view>
</view> -->
</view>
<!-- <view class="contentButton">
<u-tabs :scrollable="false" bg-color="#d4d4d4" active-color="#2979ff" inactive-color="#606266"
@@ -105,7 +108,7 @@
ygtotalPage: 1,
tjPage: 1,
tjTotalPage: 1,
tjPageSize:9,
tjPageSize:12,
tjBookLIst: [],
// contentButtonList: [{
// name: '已购图书'
@@ -147,7 +150,6 @@
// console.log('加载',this.page)
this.freeStatus = 0
this.getfreeBook()
}else{
this.freeStatus = 1
console.log('加载完成了', this.freeStatus)
@@ -481,13 +483,17 @@
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
padding: 100rpx 0 40rpx 0;
// padding: 100rpx 0 40rpx 0;
position: relative;
.icon_hua_1 {
margin: 0 auto;
width: 150rpx;
height: 150rpx;
padding: 40rpx 0;
image{
width: 150rpx;
height: 150rpx;
}
}
.search_box {

View File

@@ -16,11 +16,16 @@
<image @click="makeTel" src="../../static/icon/tel.png" mode="" style="height: 46rpx; width: 46rpx; margin-bottom: -10rpx; display: inline-block; "></image>
</view>
</view>
</view>
</view>
<view class="prof">
<p>一款线上电子书APP包含医学类国学类文学类中医古籍等各种类型3D仿真翻页护眼模式等阅读技术打造舒适阅读体验图文混排AI人声读书听书部分电子书也有对应的纸质书给予用户更多的阅读选择</p>
</view>
<view class="" style="text-align: center;">
<!-- https://main.nuttyreading.com/privacy.html -->
<!-- <text @click="seeDetail('')" style="color: #007aff; font-size: 26rpx;">隐私政策</text> -->
<uni-link href="https://main.nuttyreading.com/privacy.html" text="隐私政策"></uni-link>
<!-- <uni-link href="https://uniapp.dcloud.io/" text="https://uniapp.dcloud.io/"></uni-link> -->
</view>
<music-play :playData="playData"></music-play>
</view>
</template>

View File

@@ -366,7 +366,8 @@
},
//方法
methods: {
...mapMutations(['setUserInfo']),
...mapMutations(['setUserInfo']),
// ...mapMutations(['setLoadingShow']),
// 获取商品标签
getTags() {
this.loadingNow = false
@@ -408,9 +409,9 @@
}else{
this.tjProList = []
this.totalPage = 0
}
}).catch(e => {
console.log(e,'e')
}
}).catch(e => {
console.log(e,'标签检索报错')
});
},
// 获取折扣图书
@@ -422,8 +423,7 @@
if(res.code == 0 && res.page.list.length > 0){
this.offSaleList = res.page.list
this.tabsNumber = 0
}
}
}).catch(e => {
console.log(e,'e')
@@ -439,6 +439,8 @@
.then(res => {
console.log(res,'xinshu')
this.newBookList = res.page.list
}).catch(e => {
console.log(e,'新书上市报错')
});
},
// 检测未完成订单

View File

@@ -9,7 +9,7 @@
<view>
<text class="name" v-if="userMes.nickname!=null">{{userMes.nickname}}</text>
<text class="name" v-if="userMes.nickname==null">未设置</text>
<image v-if="userMes.vip==1" src="../../static/icon/mine_v.png" alt="" class="per_user_img"></image>
<!-- <image v-if="userMes.vip==1" src="../../static/icon/mine_v.png" alt="" class="per_user_img"></image> -->
<text style="margin-left: 20rpx;font-size: 22rpx;color: #888;">({{userMes.tel}})</text>
<!-- <text class="tong">累计读书5本
@@ -58,9 +58,9 @@
<view class="nav_list" @click="switchTab('../bookShop/orderList')">
<text>我的订单</text>
</view>
<view class="nav_list" @click="onPageJump('../clock/clockList')">
<!-- <view class="nav_list" @click="onPageJump('../clock/clockList')">
<text>我的打卡</text>
</view>
</view> -->
<view class="nav_list" @click="onPageJump('../listen/home')">
<text>我的听书</text>
</view>
@@ -89,7 +89,7 @@
<!-- <view class="nav_list" @click="onGoing()">
<text>帮助与反馈11111</text>
</view> -->
<view class="nav_list" @click="newOnShare">
<view class="nav_list" @click="newOnShare" v-if="isAndorid">
<text>分享App</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/aboutUs')">
@@ -131,13 +131,15 @@
userMes: {},
signShow: false,
signContent: '是否要退出登录?',
playData:{}
playData:{},
isAndorid:true,
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getOS()
},
computed: {
...mapState(['userInfo'])
@@ -153,6 +155,17 @@
},
//方法
methods: {
// 获得操作系统
getOS(){
let oprateOs = ''
oprateOs = uni.getSystemInfoSync().platform
// console.log(oprateOs)
if(oprateOs == 'android'){
this.isAndorid = true
}else{
this.isAndorid = false
}
},
haveSelected(data){
console.log(data,' 选择的是')
if(data.index == 0){
@@ -216,32 +229,7 @@
// 新写分享
newOnShare(){
this.$refs.share.open()
},
//分享app
// onShare(){
// let shareData = {
// shareUrl:"https://www.nuttyreading.com/nuttyreading.apk",
// shareTitle:"疯子读书",
// type:'0',
// summary:'疯子读书,请使用浏览器打开本链接,自动下载安装包', // 分享内容的摘要
// shareContent:"疯子读书,请使用浏览器打开本链接,自动下载安装包",
// shareImg:"static/fengziIcon.jpg",
// appId : "wx47134a8f15083734", // 默认不传type的时候必须传appId和appPath才会显示小程序图标
// appPath : "https://www.nuttyreading.com/nuttyreading.apk",
// appWebUrl : "https://www.nuttyreading.com/nuttyreading.apk",
// };
// // 调用
// let shareObj = appShare(shareData,res => {
// console.log("疯子读书",res);
// // 分享成功后关闭弹窗
// // 第一种关闭弹窗的方式
// closeShare();
// });
// setTimeout(() => {
// // 第二种关闭弹窗的方式
// shareObj.close();
// },5000);
// },
},
// 注销账户
logout(){

View File

@@ -288,7 +288,7 @@
orderType: "vip", //订单类型
}
$http.request({
url: "book/buyorder/rechargeSave",
url: "book/buyOrder/rechargeSave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头

View File

@@ -401,7 +401,7 @@
productId: that.stepsCj.priceTypeId // 充值的类型id
}
$http.request({
url: "book/buyorder/rechargeSave",
url: "book/buyOrder/rechargeSave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明请求头1

View File

@@ -359,7 +359,7 @@
orderType: "point", //订单类型
}
$http.request({
url: "book/buyorder/rechargeSave",
url: "book/buyOrder/rechargeSave",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明请求头1

View File

@@ -23,21 +23,25 @@
</view>
</view> -->
<view class="sear_list" v-if="this.show==1">
<view class="bl_tioa" v-for="(item,index) in bookList" @click="onBookJump(item)">
<image :src="item.productImages"></image>
<view>
<text class="bok_name">{{item.productName}}</text>
<view class="flexbox" style="display: flex; flex-wrap: wrap; justify-content: space-evenly;">
<view class="bl_tioa" v-for="(item,index) in bookList" @click="onBookJump(item)">
<image :src="item.productImages"></image>
<view>
<text class="bok_name">{{item.productName}}</text>
</view>
<!-- <view>
<text>作者<text style="color: #333;">{{item.authorName}}</text></text>
</view>
<view>
<text>出版商<text style="color: #333;">{{item.publisherName}}</text></text>
</view>
<view>
<text style="line-height: 20rpx;">{{item.title}}</text>
</view> -->
</view>
<!-- <view>
<text>作者<text style="color: #333;">{{item.authorName}}</text></text>
</view>
<view>
<text>出版商<text style="color: #333;">{{item.publisherName}}</text></text>
</view>
<view>
<text style="line-height: 20rpx;">{{item.title}}</text>
</view> -->
</view>
<view style="height: 1px;"></view>
<view>
<view v-if="status==0" style="text-align: center;">
@@ -49,13 +53,14 @@
</view>
</view>
<view v-if="this.show==1&&this.bookList==''">
<u-divider text="暂无数据"></u-divider>
</view>
<view style="padding-bottom: 20rpx;">
<u-back-top :scroll-top="scrollTop"></u-back-top>
</view>
</view>
<view v-if="this.show==1&&this.bookList==''">
<u-divider text="暂无数据"></u-divider>
</view>
<music-play :playData="playData"></music-play>
</view>
</template>
@@ -285,8 +290,9 @@
}
}
.sear_list {
margin: 50rpx 30rpx 0 30rpx; display: flex; flex-wrap: wrap; justify-content: space-between;
.sear_list {
margin: 50rpx 30rpx 0 30rpx;
// justify-content: space-between;
.bl_tioa {
width: 30%;

View File

@@ -4,9 +4,19 @@
<!-- 顶部导航栏 -->
<z-nav-bar title="讲书"></z-nav-bar>
</view>
<view class="tip">
<text>请选择要查看的书籍</text>
<view class="" style="padding:40rpx 20rpx;">
<view class="mytabs flexbox">
<view :class="['item','item1', contentShow == 1 ? 'active' :'']" @click="setData(1)">
已购图书
</view>
<view :class="['item','item2', contentShow == 2 ? 'active' :'']" @click="setData(2)">
推荐图书
</view>
</view>
</view>
<!-- <view class="tip">
<text>请选择要查看的书籍</text>
</view> -->
<view class="mainContainer">
<view class="item" v-if="bookList.length > 0">
<u-row gutter="16" justify="flex-start" >
@@ -33,7 +43,8 @@
</view>
</view>
<!-- 评价对话框 -->
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<music-play :playData="playData"></music-play>
</view>
</template>
@@ -62,6 +73,7 @@ import { data } from 'jquery';
status:3,
shupingList:[],
bfaid:null,
contentShow: 1,
}
},
onPullDownRefresh() {
@@ -93,11 +105,24 @@ import { data } from 'jquery';
...mapState(['userInfo']),
},
methods: {
setData(e) {
this.contentShow = e
this.getBooks()
},
getBooks(){
this.$http
.post('book/teach/getTeachBooks',{
'limit': 100,
'page': this.page
if(this.contentShow == 1){
$http.request({
url: "book/teach/getUserTeachBooks",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: this.userInfo.id,
'limit': 100,
'page': this.page
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
console.log(res,'讲书列表')
@@ -114,6 +139,42 @@ import { data } from 'jquery';
}).catch(e => {
console.log(e,'e')
});
}else{
$http.request({
url: "book/teach/getUserBestTeachBooks",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
id: this.userInfo.id,
'limit': 100,
'page': this.page
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
// this.$http
// .post('book/teach/getUserBestTeachBooks',{
// id: this.userInfo.id,
// 'limit': 100,
// 'page': this.page
// })
.then(res => {
console.log(res,'讲书列表')
if(res.code == 0 && res.page.records.length > 0){
this.bookList = res.page.records
this.totalPage = res.page.pages
this.status = 3
console.log(this.bookList,'this.bookList')
}else{
this.bookList = []
this.totalPage = 0
}
}).catch(e => {
console.log(e,'e')
});
}
},
// 书评详情
toDetail(val){
@@ -133,6 +194,31 @@ import { data } from 'jquery';
</script>
<style lang="scss" scoped>
.mytabs {
// background: url('@/static/icon/bgtushu.png') no-repeat left top;
height: 80rpx;
// margin-bottom: 30rpx;
.item {
border-radius: 10rpx;
background-color: #c6ead0;
width: 48%;
// margin: 0 10rpx;
text-align: center;
color: #3c7f56;
font-size: 36rpx;
line-height: 80rpx;
}
.item.active {
background-color: #3c7f56;
color: #fff;
}
.item1 {
margin-right: 20rpx;
}
}
.tip{
padding: 20rpx; background-color: #fff;
text{ font-size: 36rpx;}

View File

@@ -4,9 +4,10 @@
<view class="mainContent">
<view class="title">{{talkBookDetail.title}}</view>
<view class="voices" v-if="talkBookDetail.voices != '' && audioShow">
<audio style="text-align: left" :src="talkBookDetail.voices" poster="../../static/icon/fengziIcon.jpg"
:name="talkBookDetail.title" :author="bookInfo.author.authorName" :action="audioAction" controls></audio>
</view>
<audio style="text-align: left; overflow: hidden;" :src="talkBookDetail.voices"
poster="../../static/icon/home_icon_0.png" :name="talkBookDetail.title"
:author="bookInfo.author.authorName" :action="audioAction" controls></audio>
</view>
<view class="content" v-if="talkBookDetail.content != ''" v-html="talkBookDetail.content"></view>
<view class="content" v-else></view>
<view class="time">
@@ -14,14 +15,15 @@
</view>
<view class="tuijin" v-if="!isBuy && bookInfo.productId != null">
<p>觉得这本书还不错</p>
<view class="flexbox" style="justify-content: space-between; border: 1px solid #55aa7f; padding: 10rpx; border-radius: 10rpx;">
<view class="flexbox"
style="justify-content: space-between; border: 1px solid #55aa7f; padding: 10rpx; border-radius: 10rpx;">
<view class="flexbox">
<view class="img">
<image v-if="bookInfo.images != ''" :src="bookInfo.images" mode="aspectFit"></image>
<image v-else src="../../static/icon/wufeng.jpg" mode="aspectFit"></image>
</view>
<view>
<text style=" display: inline-block; margin-top: 40rpx;">{{bookInfo.name}}</text><br/>
<text style=" display: inline-block; margin-top: 40rpx;">{{bookInfo.name}}</text><br />
<text>作者{{bookInfo.author.authorName}}</text>
</view>
</view>
@@ -36,6 +38,8 @@
</view> -->
</view>
<music-play :playData="playData"></music-play>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
</view>
</template>
@@ -52,20 +56,22 @@
method: 'pause'
},
audioShow: false,
voicesImg:'',
voicesImg: '',
isBuy: false,
playData: {},
teachId: null, // 讲书id
bookId: null, // 书籍id
bookInfo: {
author:{
authorName:''
author: {
authorName: ''
}
}, // 书籍信息
talkBookDetail: {},
windowWidth: 0,
}
},
onLoad(e) {
this.windowWidth = uni.getSystemInfoSync().windowWidth;
console.log(e, 'onLoad')
this.bookId = e.bookId
this.teachId = e.teachId
@@ -80,14 +86,14 @@
methods: {
...mapMutations(['setUserInfo']),
// 购买
gotoBuy(){
gotoBuy() {
uni.navigateTo({
url: '../bookShop/commodityDetail?id=' + this.bookInfo.productId
url: '../bookShop/commodityDetail?id=' + this.bookInfo.productId
});
},
getBookInfo() {
// 获取书本基本信息
this.$http
this.$http
.post('book/book/getBookInfo', {
'bookId': this.bookId,
'userId': this.userInfo.id
@@ -96,18 +102,18 @@
if (res.code == 0) {
console.log(res, 'res')
this.bookInfo = res.book
if(!this.bookInfo.author || this.bookInfo.author == null){
if (!this.bookInfo.author || this.bookInfo.author == null) {
this.bookInfo.author = {
'authorName' : '未知'
'authorName': '未知'
}
console.log(this.bookInfo.author.authorName,'this.bookInfo.author.authorName')
console.log(this.bookInfo.author.authorName, 'this.bookInfo.author.authorName')
}
//console.log(this.bookInfo.author.authorName,'this.bookInfo.author.authorName')
this.voicesImg = res.book.images
// this.bookInfo.name = res.book.name
this.isBuy = res.book.isBuy
console.log(this.voicesImg,'this.voicesImg')
console.log(this.voicesImg, 'this.voicesImg')
// this.freeChapterCount = res.book.freeChapterCount
} else {
console.log(res.msg)
@@ -128,7 +134,7 @@
if (res.code == 0) {
console.log(res, 'res')
this.talkBookDetail = res.bookTeach
// this.isBuy = res.book.isBuy
// this.freeChapterCount = res.book.freeChapterCount
} else {
@@ -163,27 +169,38 @@
.voices {
margin: 10rpx auto;
text-align: center;
}
/deep/ .uni-audio-name {
// white-space: wrap !important;
width: 340rpx;
}
.title {
font-size: 30rpx;
color: #55aa7f;
font-weight: bold;
margin-bottom: 10px;
margin: 40rpx 0;
}
.time{
text-align: right; font-size: 24rpx; margin-top: 20rpx; color: #999;
.time {
text-align: right;
font-size: 24rpx;
margin-top: 20rpx;
color: #999;
}
.content {
font-size: 28rpx; text-align:justify;
font-size: 28rpx;
text-align: justify;
color: #666;
line-height: 48rpx;
}
.tuijin {
font-size: 26rpx;
margin-top: 20rpx;
.img {
@@ -198,15 +215,25 @@
}
p {
font-size: 28rpx; margin-bottom: 20rpx;
font-size: 28rpx;
margin-bottom: 20rpx;
color: #55aa7f;
}
}
.btn{ margin-right: 20rpx;
text{ display: inline-block; margin-top:52rpx; font-size: 30rpx;
padding: 5px 8px;
background: #55aa7f; color: #fff;
border-radius: 5px;
}}
.btn {
margin-right: 20rpx;
text {
display: inline-block;
margin-top: 52rpx;
font-size: 30rpx;
padding: 5px 8px;
background: #55aa7f;
color: #fff;
border-radius: 5px;
}
}
// .opbtn{font-size: 14rpx;}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<!--父组件-->
<view class="container" style="padding-bottom: 10rpx;">
<!-- <view class="mini"></view> -->
<view>
@@ -70,6 +70,8 @@
</view>
<u-divider v-else text="暂无讲书目录"></u-divider>
<music-play :playData="playData"></music-play>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<!-- <z-navigation></z-navigation> -->
</view>
</view>

View File

@@ -267,10 +267,10 @@
addconfirm(e) { //点击确定按钮
this.addressChanged = true
this.addreShow = false;
this.addressForm.areaidpathtext = e.value[0].UName + ' ' + e.value[1].UName + ' ' + e.value[2].UName
this.addressForm.areaidpathtext = e.value[0].UName + '-' + e.value[1].UName + '-' + e.value[2].UName
this.provId = e.value[0].provId
this.cityId = e.value[1].cityId
this.countyId = e.value[2].countyId
this.countyId = e.value[2].regionCode
},
addcancel() { //点击取消按钮
@@ -284,9 +284,9 @@
.then(res => {
let link_add = ''
if (!this.isShowDel) {
link_add = 'book/useraddress/save'
link_add = 'book/userAddress/save'
} else {
link_add = 'book/useraddress/update'
link_add = 'book/userAddress/update'
// this.addconfirm(e)
}
if (this.addressForm.areaidpath == '') {
@@ -296,15 +296,30 @@
});
return
}
this.addressForm.userid = this.userInfo.id
if(this.addressChanged){ // 如果修改过地址区域,就重新赋值,否则保持不变
this.addressForm.areaidpath = `${this.provId}_${this.cityId}_${this.countyId}`
this.addressChanged = false
}
this.addressForm.areaid = this.countyId
this.addressForm.isdefault = this.addressForm.isDafault ? 1 : 0
// this.addressForm.userId = this.userInfo.id
// this.addressForm.consigneePhone = this.addressForm.userphone
// this.addressForm.consigneeName = this.addressForm.username
// this.addressForm.regionCode = ''
// // this.addressForm.userid = this.userInfo.id
// if(this.addressChanged){ // 如果修改过地址区域,就重新赋值,否则保持不变
// this.addressForm.areaidpath = `${this.provId}_${this.cityId}_${this.countyId}`
// this.addressChanged = false
// }
// this.addressForm.areaid = this.countyId
// this.addressForm.isDefault = this.addressForm.isDafault ? 1 : 0
let data = this.addressForm
// let data = this.addressForm
let data = {
'id':this.addressForm.addressid,
'detailAddress' : this.addressForm.useraddress,
'regionCode':this.countyId,
'userId':this.userInfo.id,
'consigneePhone':this.addressForm.userphone,
'consigneeName': this.addressForm.username,
'isDefault':this.addressForm.isDafault ? 1 : 0
}
console.log(data,'保存参数')
$http.request({
url: link_add,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
@@ -315,7 +330,7 @@
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '地址添加成功',
title: '操作成功',
duration: 1000,
});
setTimeout(function() {
@@ -334,17 +349,28 @@
},
changeSwitch(e) {
e ? this.addressForm.isdefault = 1 : this.addressForm.isdefault = 0
this.addressForm.isDafault = e
console.log(this.addressForm)
console.log(this.addressForm, e)
},
// 编辑地址获取信息
getAddress() {
this.$http
.post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
.post(`book/userAddress/getUserAddress?userId=${this.userInfo.id}`)
.then(res => {
if (res.code == 0) {
this.addressForm = res.list[this.editIndex]
this.addressForm = {
'useraddress':res.list[this.editIndex].detailAddress,
'userphone':res.list[this.editIndex].consigneePhone,
'username':res.list[this.editIndex].consigneeName,
'isdefault':res.list[this.editIndex].isDefault,
'isDafault':res.list[this.editIndex].isDefault == 1 ? true : false,
'areaidpathtext':res.list[this.editIndex].province +'-'+ res.list[this.editIndex].city +'-'+ res.list[this.editIndex].county
,'addressid':res.list[this.editIndex].id
}
this.countyId = res.list[this.editIndex].regionCode
// this.addressForm = res.list[this.editIndex]
if (this.addressForm.isdefault == 1) {
this.addressForm.isDafault = true
}
@@ -357,15 +383,9 @@
let addressArr = [];
addressArr.push(this.addressForm.addressid)
this.deleteShow = false
$http.request({
url: "book/useraddress/delete",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data:addressArr,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
this.$http
.get(`book/userAddress/delete?id=${this.addressForm.addressid}`)
.then(res => {
if (res.code == 0) {
uni.showToast({
title: '地址删除成功',

View File

@@ -10,18 +10,19 @@
<view class="addrContent">
<view class="addrContentTop">
<view class="userName">
{{item.username}}
{{item.consigneeName}}
</view>
<view class="userTel">
{{item.userphone}}
{{item.consigneePhone}}
</view>
<view class="userMoren" v-if="item.isdefault==1">
<view class="userMoren" v-if="item.isDefault==1">
默认
</view>
</view>
<view class="addrContentBottom">
<view class="userAddress">
{{item.areaidpathtext}} {{item.useraddress}}
{{item.province}} {{item.city}} {{item.county}}
{{item.detailAddress}}
</view>
</view>
</view>
@@ -63,7 +64,8 @@
methods: {
getUserAddress() {
this.$http
.post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
.post(`book/userAddress/getUserAddress?userId=${this.userInfo.id}`)
// .post(`book/useraddress/getUserAddress?userId=${this.userInfo.id}`)
.then(res => {
if (res.code == 0) {
this.addressList = res.list

View File

@@ -1,8 +1,8 @@
<template>
<view class="page">
<z-nav-bar></z-nav-bar>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="title">忘记密码</view>
<view class="input_box">
<text class="input_tit">手机号</text>
@@ -15,239 +15,298 @@
</view>
<view class="input_box">
<text class="input_tit">密码</text>
<input type="password" v-model="password" placeholder="请输入密码" />
</view>
<input type="password" maxlength="8" v-model="password" placeholder="请输入密码" @input="inputMethod(password)" />
</view>
<view class="" style="font-size: 28rpx; color: #999;">
<p v-if="note != ''">{{note}}</p>
<p v-html="str2" style="margin-top: 10rpx;"></p>
</view>
<view class="input_box">
<text class="input_tit">确认密码</text>
<input type="password" v-model="confirmPassword" placeholder="请确认密码" />
<input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" />
</view>
<view class="btn_box"><button @click="onSubmit"> </button></view>
<music-play :playData="playData"></music-play>
<music-play :playData="playData"></music-play>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import md5 from '@/plugins/md5';
var clear;
export default {
data() {
return {
playData:{},
//手机号账号
phone: '',
// 密码
password: '',
//验证码
code: '',
//确认密码
confirmPassword: '',
//验证码
codeText: '获取验证码',
//验证码已发
readonly: false
};
},
//第一次加载
onLoad(e) {},
//页面显示
onShow() {},
components:{
musicPlay
},
//方法
methods: {
//获取验证码
getCode() {
if (this.readonly) {
uni.showToast({
title: '验证码已发送',
icon: 'none'
});
return;
}
if (!this.phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return;
}
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
return;
}
this.$http
// .post('api/common/v1/send_sms', {
.post('book/user/sms/sendcode', {
phone: this.phone,
type: 3000
})
.then(res => {
this.getCodeState();
});
import md5 from '@/plugins/md5';
// 密码验证的正则
//1、密码为八位及以上并且字母数字特殊字符三项都包括
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
//2、密码为八位及以上并且字母、数字、特殊字符三项中有两项强度是中等
var mediumRegex = new RegExp(
"^(?=.{8,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[a-z])(?=.*\\W))|((?=.*[0-9])(?=.*\\W))|((?=.*[A-Z])(?=.*\\W))).*$",
"g");
var enoughRegex = new RegExp("(?=.{8,}).*", "g");
var clear;
export default {
data() {
return {
playData: {},
//手机号账号
phone: '',
// 密码
password: '',
//验证码
code: '',
//确认密码
confirmPassword: '',
//验证码
codeText: '获取验证码',
//验证码已发
readonly: false,
passwordOk:false,
note: '',
str2: '',
};
},
//验证码按钮文字状态
getCodeState() {
const _this = this;
this.readonly = true;
this.codeText = '60S后重新获取';
var s = 60;
clear = setInterval(() => {
s--;
_this.codeText = s + 'S后重新获取';
if (s <= 0) {
clearInterval(clear);
_this.codeText = '获取验证码';
_this.readonly = false;
//第一次加载
onLoad(e) {},
//页面显示
onShow() {},
components: {
musicPlay
},
//方法
methods: {
// 密码验证
inputMethod(value) {
this.passwordOk = false
// console.log('输入的值为:', value)
if (strongRegex.test(value)) {
//console.log('强密码-----',value)
this.str2 = "<span style='color:#18bc37'>密码强度很不错哦!</span>"
// this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度至少为8位。'
this.note = ''
this.passwordOk = true
} else if (mediumRegex.test(value)) {
// console.log('中等密码-----',value)
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
this.str2 = "<span style='color:#2979ff'>密码强度中等!</span>"
this.passwordOk = true
} else if (enoughRegex.test(value)) {
// console.log('弱密码-----',value)
// this.str2 = "<span style='color:#f3a73f'>密码强度太弱!</span>"
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
}
else {
this.passwordOk = false
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
this.str2 = ""
//console.log('密码-----',value)
}
}, 1000);
},
onSubmit() {
if (!this.phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return;
}
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
return;
}
if (!this.code) {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return;
}
if (!this.password) {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return;
}
if (!this.confirmPassword) {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return;
}
if (this.confirmPassword != this.password) {
uni.showToast({
title: '两次密码不一致',
icon: 'none'
});
return;
}
if (!this.$base.passwordRegular.test(this.password)) {
uni.showToast({
title: '请输入不少于6位且包含数字和字母的密码',
icon: 'none'
});
return;
}
this.$http
// .post('api/common/v1/forget_password', {
.post('book/user/setPassword', {
phone: this.phone,
code:this.code,
// password: md5(this.password),
password: this.password
})
.then(res => {
uni.showModal({
title:"提示",
content:"密码修改成功!",
showCancel:false,
success: (res) => {
uni.navigateBack();
}
},
//获取验证码
getCode() {
if (this.readonly) {
uni.showToast({
title: '验证码已发送',
icon: 'none'
});
});
return;
}
if (!this.phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return;
}
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
return;
}
this.$http
// .post('api/common/v1/send_sms', {
.post('book/user/sms/sendcode', {
phone: this.phone,
type: 3000
})
.then(res => {
this.getCodeState();
});
},
//验证码按钮文字状态
getCodeState() {
const _this = this;
this.readonly = true;
this.codeText = '60S后重新获取';
var s = 60;
clear = setInterval(() => {
s--;
_this.codeText = s + 'S后重新获取';
if (s <= 0) {
clearInterval(clear);
_this.codeText = '获取验证码';
_this.readonly = false;
}
}, 1000);
},
onSubmit() {
if(!this.passwordOk){
console.log('不满足密码格式',this.note)
uni.showToast({
title:this.note,
icon: 'none'
})
return
}
if (!this.phone) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return;
}
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
return;
}
if (!this.code) {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return;
}
if (!this.password) {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return;
}
if (!this.confirmPassword) {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return;
}
if (this.confirmPassword != this.password) {
uni.showToast({
title: '两次密码不一致',
icon: 'none'
});
return;
}
if (!this.$base.passwordRegular.test(this.password)) {
uni.showToast({
title: '请输入不少于6位且包含数字和字母的密码',
icon: 'none'
});
return;
}
this.$http
// .post('api/common/v1/forget_password', {
.post('book/user/setPassword', {
phone: this.phone,
code: this.code,
// password: md5(this.password),
password: this.password
})
.then(res => {
uni.showModal({
title: "提示",
content: "密码修改成功!",
showCancel: false,
success: (res) => {
uni.navigateBack();
}
});
});
}
},
//页面隐藏
onHide() {},
//页面卸载
onUnload() {},
//页面下来刷新
onPullDownRefresh() {},
//页面上拉触底
onReachBottom() {},
//用户点击分享
onShareAppMessage(e) {
return this.wxShare();
}
},
//页面隐藏
onHide() {},
//页面卸载
onUnload() {},
//页面下来刷新
onPullDownRefresh() {},
//页面上拉触底
onReachBottom() {},
//用户点击分享
onShareAppMessage(e) {
return this.wxShare();
}
};
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.page {
background-color: #ffffff;
padding: 0 65rpx;
min-height: 100vh;
.title {
padding: 60rpx 0 40rpx 0;
font-size: 60rpx;
color: #333333;
}
.input_box {
display: flex;
justify-content: space-between;
height: 100rpx;
padding-top: 30rpx;
border-bottom: 1rpx solid #eeeeee;
@import '@/style/mixin.scss';
.page {
background-color: #ffffff;
padding: 0 65rpx;
min-height: 100vh;
.title {
padding: 60rpx 0 40rpx 0;
font-size: 60rpx;
color: #333333;
}
.input_box {
display: flex;
justify-content: space-between;
height: 100rpx;
padding-top: 30rpx;
border-bottom: 1rpx solid #eeeeee;
align-items: center;
text{
font-size: 30rpx;
width: 180rpx;
text {
font-size: 30rpx;
width: 180rpx;
}
input {
flex: 1;
height: 70rpx;
line-height: 70rpx;
font-size: 30rpx;
}
button {
height: 78rpx;
line-height: 78rpx;
font-size: 30rpx;
color: $themeColor;
&:active {
background-color: transparent;
}
}
}
input {
flex: 1;
height: 70rpx;
line-height: 70rpx;
font-size: 30rpx;
.btn_box {
margin-top: 70rpx;
button {
font-size: 32rpx;
@include theme('btn_bg') color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
}
}
button {
height: 78rpx;
line-height: 78rpx;
font-size: 30rpx;
color: $themeColor;
&:active {
background-color: transparent;
.protocol {
font-size: 24rpx;
color: #999999;
text-align: center;
margin-top: 20rpx;
text {
color: $themeColor;
}
}
}
.btn_box {
margin-top: 70rpx;
button {
font-size: 32rpx;
@include theme('btn_bg')
color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
}
}
.protocol {
font-size: 24rpx;
color: #999999;
text-align: center;
margin-top: 20rpx;
text {
color: $themeColor;
}
}
}
</style>
</style>

View File

@@ -64,7 +64,11 @@
<view class="qie_huan" style="display: flex; justify-content: center;">
<view style="width: 30%;" @click="type = 1000" v-if="type == 2000">密码登录</view>
<view style="width: 30%;" @click="type = 2000" v-if="type == 1000">验证码登录</view>
<view style="width:50%; display: flex; justify-content:space-between;" v-if="type == 1000">
<text @click="type = 2000">验证码登录</text>
<text v-if="type == 1000" @click="onPageJump('/pages/user/forget')">忘记密码</text>
<!-- <text @click="resetPassWord()">忘记密码</text> -->
</view>
</view>
<z-popup v-model="HealthOpen" type="center" :hideOnBlur="false">
@@ -188,6 +192,13 @@
methods: {
...mapMutations(['setUserInfo']),
...mapMutations(['setHealthMes']),
// 修改密码
resetPassWord(){
console.log('重置密码')
uni.navigateTo({
url: "/pages/home/shop/goodsDetail"
})
},
// 显示协议
showXieyi(str){
if(str == 'user'){

View File

@@ -91,14 +91,14 @@
<u-popup :show="passwordShow" :round="10" @close="cancelPass">
<view class="tanchu">
<view class="dp_title">请修改密码</view>
<u--input v-model="userMes.password" placeholder="请输入新密码" :password="true" border="surround" clearable
<u--input maxlength="8" v-model="userMes.password" placeholder="请输入新密码" :password="true" border="surround" clearable
@input="inputMethod(userMes.password)">
</u--input>
<view class="" style="font-size: 28rpx; color: #999;">
<p v-if="note != ''">{{note}}</p>
<p v-html="str2" style="margin-top: 10rpx;"></p>
</view>
<u--input v-model="userMes.Repassword" placeholder="请再确认密码" :password="true" border="surround" clearable
<u--input maxlength="8" v-model="userMes.Repassword" placeholder="请再确认密码" :password="true" border="surround" clearable
style="margin-top: 20rpx;"></u--input>
<u-button color="linear-gradient(to right, #72d386, #317e42)" text="确定" @click="chosePassword()"
style="margin-top: 50rpx;"></u-button>
@@ -207,24 +207,26 @@
// 密码验证
inputMethod(value) {
this.passwordOk = false
console.log('输入的值为:', value)
// console.log('输入的值为:', value)
if (strongRegex.test(value)) {
//console.log('强密码-----',value)
this.str2 = "<span style='color:#18bc37'>密码强度很不错哦!</span>"
// this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度至少为8位。'
// this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
this.note = ''
this.passwordOk = true
} else if (mediumRegex.test(value)) {
//console.log('中等密码-----',value)
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度至少为8位。'
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
this.str2 = "<span style='color:#2979ff'>密码强度中等!</span>"
this.passwordOk = true
} else if (enoughRegex.test(value)) {
//console.log('弱密码-----',value)
this.str2 = "<span style='color:#f3a73f'>密码强度太弱!</span>"
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码,长度至少为8位。'
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
} else {
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度至少为8位。'
this.passwordOk = false
this.note = '请至少使用大小写字母、数字、符号两种类型组合的密码长度为8位。'
this.str2 = ""
//console.log('密码-----',value)
}
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -64,6 +64,7 @@ export const mutations = {
} else {
state.loadingShow = data;
}
// console.log('加载状态',state.loadingShow)
},
//微信场景参数
setChatScenesInfo(state, data) {

View File

@@ -0,0 +1,24 @@
## 1.2.22022-01-19
- 修复 在微信小程序中样式不生效的bug
## 1.2.12022-01-18
- 新增 update 方法 ,在动态更新时间后,刷新组件
## 1.2.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-countdown](https://uniapp.dcloud.io/component/uniui/uni-countdown)
## 1.1.32021-10-18
- 重构
- 新增 font-size 支持自定义字体大小
## 1.1.22021-08-24
- 新增 支持国际化
## 1.1.12021-07-30
- 优化 vue3下小程序事件警告的问题
## 1.1.02021-07-30
- 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.52021-06-18
- 修复 uni-countdown 重复赋值跳两秒的 bug
## 1.0.42021-05-12
- 新增 组件示例地址
## 1.0.32021-05-08
- 修复 uni-countdown 不能控制倒计时的 bug
## 1.0.22021-02-04
- 调整为uni_modules目录规范

View File

@@ -0,0 +1,6 @@
{
"uni-countdown.day": "day",
"uni-countdown.h": "h",
"uni-countdown.m": "m",
"uni-countdown.s": "s"
}

View File

@@ -0,0 +1,8 @@
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}

View File

@@ -0,0 +1,6 @@
{
"uni-countdown.day": "天",
"uni-countdown.h": "时",
"uni-countdown.m": "分",
"uni-countdown.s": "秒"
}

View File

@@ -0,0 +1,6 @@
{
"uni-countdown.day": "天",
"uni-countdown.h": "時",
"uni-countdown.m": "分",
"uni-countdown.s": "秒"
}

View File

@@ -0,0 +1,271 @@
<template>
<view class="uni-countdown">
<text v-if="showDay" :style="[timeStyle]" class="uni-countdown__number">{{ d }}</text>
<text v-if="showDay" :style="[splitorStyle]" class="uni-countdown__splitor">{{dayText}}</text>
<text :style="[timeStyle]" class="uni-countdown__number">{{ h }}</text>
<text :style="[splitorStyle]" class="uni-countdown__splitor">{{ showColon ? ':' : hourText }}</text>
<text :style="[timeStyle]" class="uni-countdown__number">{{ i }}</text>
<text :style="[splitorStyle]" class="uni-countdown__splitor">{{ showColon ? ':' : minuteText }}</text>
<text :style="[timeStyle]" class="uni-countdown__number">{{ s }}</text>
<text v-if="!showColon" :style="[splitorStyle]" class="uni-countdown__splitor">{{secondText}}</text>
</view>
</template>
<script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const {
t
} = initVueI18n(messages)
/**
* Countdown 倒计时
* @description 倒计时组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=25
* @property {String} backgroundColor 背景色
* @property {String} color 文字颜色
* @property {Number} day 天数
* @property {Number} hour 小时
* @property {Number} minute 分钟
* @property {Number} second 秒
* @property {Number} timestamp 时间戳
* @property {Boolean} showDay = [true|false] 是否显示天数
* @property {Boolean} show-colon = [true|false] 是否以冒号为分隔符
* @property {String} splitorColor 分割符号颜色
* @event {Function} timeup 倒计时时间到触发事件
* @example <uni-countdown :day="1" :hour="1" :minute="12" :second="40"></uni-countdown>
*/
export default {
name: 'UniCountdown',
emits: ['timeup'],
props: {
showDay: {
type: Boolean,
default: true
},
showColon: {
type: Boolean,
default: true
},
start: {
type: Boolean,
default: true
},
backgroundColor: {
type: String,
default: ''
},
color: {
type: String,
default: '#333'
},
fontSize: {
type: Number,
default: 14
},
splitorColor: {
type: String,
default: '#333'
},
day: {
type: Number,
default: 0
},
hour: {
type: Number,
default: 0
},
minute: {
type: Number,
default: 0
},
second: {
type: Number,
default: 0
},
timestamp: {
type: Number,
default: 0
}
},
data() {
return {
timer: null,
syncFlag: false,
d: '00',
h: '00',
i: '00',
s: '00',
leftTime: 0,
seconds: 0
}
},
computed: {
dayText() {
return t("uni-countdown.day")
},
hourText(val) {
return t("uni-countdown.h")
},
minuteText(val) {
return t("uni-countdown.m")
},
secondText(val) {
return t("uni-countdown.s")
},
timeStyle() {
const {
color,
backgroundColor,
fontSize
} = this
return {
color,
backgroundColor,
fontSize: `${fontSize}px`,
width: `${fontSize * 22 / 14}px`, // 按字体大小为 14px 时的比例缩放
lineHeight: `${fontSize * 20 / 14}px`,
borderRadius: `${fontSize * 3 / 14}px`,
}
},
splitorStyle() {
const { splitorColor, fontSize, backgroundColor } = this
return {
color: splitorColor,
fontSize: `${fontSize * 12 / 14}px`,
margin: backgroundColor ? `${fontSize * 4 / 14}px` : ''
}
}
},
watch: {
day(val) {
this.changeFlag()
},
hour(val) {
this.changeFlag()
},
minute(val) {
this.changeFlag()
},
second(val) {
this.changeFlag()
},
start: {
immediate: true,
handler(newVal, oldVal) {
if (newVal) {
this.startData();
} else {
if (!oldVal) return
clearInterval(this.timer)
}
}
}
},
created: function(e) {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.countDown()
},
// #ifndef VUE3
destroyed() {
clearInterval(this.timer)
},
// #endif
// #ifdef VUE3
unmounted() {
clearInterval(this.timer)
},
// #endif
methods: {
toSeconds(timestamp, day, hours, minutes, seconds) {
if (timestamp) {
return timestamp - parseInt(new Date().getTime() / 1000, 10)
}
return day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
},
timeUp() {
clearInterval(this.timer)
this.$emit('timeup')
},
countDown() {
let seconds = this.seconds
let [day, hour, minute, second] = [0, 0, 0, 0]
if (seconds > 0) {
day = Math.floor(seconds / (60 * 60 * 24))
hour = Math.floor(seconds / (60 * 60)) - (day * 24)
minute = Math.floor(seconds / 60) - (day * 24 * 60) - (hour * 60)
second = Math.floor(seconds) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60)
} else {
this.timeUp()
}
if (day < 10) {
day = '0' + day
}
if (hour < 10) {
hour = '0' + hour
}
if (minute < 10) {
minute = '0' + minute
}
if (second < 10) {
second = '0' + second
}
this.d = day
this.h = hour
this.i = minute
this.s = second
},
startData() {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
if (this.seconds <= 0) {
this.seconds = this.toSeconds(0, 0, 0, 0, 0)
this.countDown()
return
}
clearInterval(this.timer)
this.countDown()
this.timer = setInterval(() => {
this.seconds--
if (this.seconds < 0) {
this.timeUp()
return
}
this.countDown()
}, 1000)
},
update(){
this.startData();
},
changeFlag() {
if (!this.syncFlag) {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.startData();
this.syncFlag = true;
}
}
}
}
</script>
<style lang="scss" scoped>
$font-size: 14px;
.uni-countdown {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
&__splitor {
margin: 0 2px;
font-size: $font-size;
color: #333;
}
&__number {
border-radius: 3px;
text-align: center;
font-size: $font-size;
}
}
</style>

View File

@@ -0,0 +1,86 @@
{
"id": "uni-countdown",
"displayName": "uni-countdown 倒计时",
"version": "1.2.2",
"description": "CountDown 倒计时组件",
"keywords": [
"uni-ui",
"uniui",
"countdown",
"倒计时"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": ["uni-scss"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,10 @@
## CountDown 倒计时
> **组件名uni-countdown**
> 代码块: `uCountDown`
倒计时组件。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-countdown)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

View File

@@ -0,0 +1,17 @@
## 1.0.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-link](https://uniapp.dcloud.io/component/uniui/uni-link)
## 1.1.72021-11-08
## 0.0.72021-09-03
- 修复 在 nvue 下不显示的 bug
## 0.0.62021-07-30
- 新增 支持自定义插槽
## 0.0.52021-06-21
- 新增 download 属性H5平台下载文件名
## 0.0.42021-05-12
- 新增 组件示例地址
## 0.0.32021-03-09
- 新增 href 属性支持 tel:|mailto:
## 0.0.22021-02-05
- 调整为uni_modules目录规范

View File

@@ -0,0 +1,128 @@
<template>
<a v-if="isShowA" class="uni-link" :href="href"
:class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
:style="{color,fontSize:fontSize+'px'}" :download="download">
<slot>{{text}}</slot>
</a>
<!-- #ifndef APP-NVUE -->
<text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
:style="{color,fontSize:fontSize+'px'}" @click="openURL">
<slot>{{text}}</slot>
</text>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
:style="{color,fontSize:fontSize+'px'}" @click="openURL">
{{text}}
</text>
<!-- #endif -->
</template>
<script>
/**
* Link 外部网页超链接组件
* @description uni-link是一个外部网页超链接组件在小程序内复制url在app内打开外部浏览器在h5端打开新网页
* @tutorial https://ext.dcloud.net.cn/plugin?id=1182
* @property {String} href 点击后打开的外部网页url
* @property {String} text 显示的文字
* @property {String} downlaod H5平台下载文件名
* @property {Boolean} showUnderLine 是否显示下划线
* @property {String} copyTips 在小程序端复制链接时显示的提示语
* @property {String} color 链接文字颜色
* @property {String} fontSize 链接文字大小
* @example * <uni-link href="https://ext.dcloud.net.cn" text="https://ext.dcloud.net.cn"></uni-link>
*/
export default {
name: 'uniLink',
props: {
href: {
type: String,
default: ''
},
text: {
type: String,
default: ''
},
download: {
type: String,
default: ''
},
showUnderLine: {
type: [Boolean, String],
default: true
},
copyTips: {
type: String,
default: '已自动复制网址,请在手机浏览器里粘贴该网址'
},
color: {
type: String,
default: '#999999'
},
fontSize: {
type: [Number, String],
default: 14
}
},
computed: {
isShowA() {
// #ifdef H5
this._isH5 = true;
// #endif
if ((this.isMail() || this.isTel()) && this._isH5 === true) {
return true;
}
return false;
}
},
created() {
this._isH5 = null;
},
methods: {
isMail() {
return this.href.startsWith('mailto:');
},
isTel() {
return this.href.startsWith('tel:');
},
openURL() {
// #ifdef APP-PLUS
if (this.isTel()) {
this.makePhoneCall(this.href.replace('tel:', ''));
} else {
plus.runtime.openURL(this.href);
}
// #endif
// #ifdef H5
window.open(this.href)
// #endif
// #ifdef MP
uni.setClipboardData({
data: this.href
});
uni.showModal({
content: this.copyTips,
showCancel: false
});
// #endif
},
makePhoneCall(phoneNumber) {
uni.makePhoneCall({
phoneNumber
})
}
}
}
</script>
<style>
/* #ifndef APP-NVUE */
.uni-link {
cursor: pointer;
}
/* #endif */
.uni-link--withline {
text-decoration: underline;
}
</style>

View File

@@ -0,0 +1,87 @@
{
"id": "uni-link",
"displayName": "uni-link 超链接",
"version": "1.0.0",
"description": "uni-link是一个外部网页超链接组件在小程序内复制url在app内打开外部浏览器在h5端打",
"keywords": [
"uni-ui",
"uniui",
"link",
"超链接",
""
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": ["uni-scss"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
## Link 链接
> **组件名uni-link**
> 代码块: `uLink`
uni-link是一个外部网页超链接组件在小程序内复制url在app内打开外部浏览器在h5端打开新网页。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-link)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

View File

@@ -0,0 +1,70 @@
## 0.6.42023-09-01
chore: 优化代码结构
## 0.6.32023-08-30
- 修复 下载 wgt 时如果后缀名不正确,重命名后安装
## 0.6.22022-11-21
- 处理 cloudfunctions 目录
## 0.6.12022-08-17
- 修复 后台添加应用市场但都没有启用的情况下报错的Bug (需要 uni-admin 1.9.3+
## 0.6.02022-07-19
- 新增 支持多应用商店配置(需要 uni-admin 1.9.3+
## 0.4.12022-05-27
- 修复 上版引出的报错问题
## 0.4.02022-05-27
- 新增 Android 支持跳转手机自带商店,填写升级包地址时请填写跳转商店链接
- 新增 改为云对象调用方式,使用更直观
## 0.3.32022-04-14
- 修复 调用 check-update当 code 为 0 时没有回调
## 0.3.22022-01-12
- 优化显示逻辑
## 0.3.12021-11-24
- 修复 vue3 上图片不显示的Bug
## 0.3.02021-11-18
- 移除 wgt 安装成功后提示,防止重启过快弹框不消失
## 0.2.22021-08-25
- 兼容vue3.0
## 0.2.12021-07-26
- 修复 使用腾讯云并手动填写地址时导致下载链接失效的bug
## 0.2.02021-07-13
- 更新文档 关于报错local_storage_key 为空请不要将页面路径设置为pages.json中第一项
## 0.1.92021-06-28
- 更新文档
- 修复 wgt安装失败时按钮状态不对
## 0.1.82021-06-16
- 修复 跳转安装时导致上次下载的apk还没安装就被删掉的bug
## 0.1.72021-06-03
- 修改 移除static中的图片
## 0.1.62021-06-03
- 修改 下载更新按钮使用CSS渐变色
## 0.1.52021-04-22
- 更新check-update函数。现在返回一个Promise有更新时成功回调其他情况错误回调
## 0.1.42021-04-13
- 更新文档。明确云函数调用结果
## 0.1.32021-04-13
- 解耦云函数与弹框处理。utils中新增 call-check-version.js可用于单独检测是否有更新
## 0.1.22021-04-07
- 更新版本对比函数 compare
## 0.1.12021-04-07
- 修复 腾讯云空间下载链接不能下载问题
## 0.1.02021-04-07
- 新增使用uni.showModal提示升级示例
- 修改iOS升级提示方式
## 0.0.72021-04-02
- 修复在iOS上打开弹框报错
## 0.0.62021-04-01
- 兼容旧版本安卓
## 0.0.52021-04-01
- 修复低版本安卓上进度条错位
## 0.0.42021-04-01
- 更新readme
- 修复check-update语法错误
## 0.0.32021-04-01
- 新增前台更新弹框详见readme
- 更新前台检查更新方法
## 0.0.22021-03-29
- 更新文档
- 移除 dependencies
## 0.0.12021-03-25
- 升级中心前台检查更新

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,81 @@
{
"id": "uni-upgrade-center-app",
"displayName": "升级中心 uni-upgrade-center - App",
"version": "0.6.4",
"description": "uni升级中心 - 客户端检查更新",
"keywords": [
"uniCloud",
"update",
"升级",
"wgt"
],
"repository": "https://gitee.com/dcloud/uni-upgrade-center/tree/master/uni_modules/uni-upgrade-center-app",
"engines": {
"HBuilderX": "^3.2.14"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": "",
"type": "unicloud-template-page"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,555 @@
<template>
<view class="mask flex-center">
<view class="content botton-radius">
<view class="content-top">
<text class="content-top-text">{{title}}</text>
<image class="content-top" style="top: 0;" width="100%" height="100%" src="../images/bg_top.png">
</image>
</view>
<view class="content-header"></view>
<view class="content-body">
<view class="title">
<text>{{subTitle}}</text>
<!-- <text style="padding-left:20rpx;font-size: 0.5em;color: #666;">v.{{version}}</text> -->
</view>
<view class="body">
<scroll-view class="box-des-scroll" scroll-y="true">
<text class="box-des">
{{contents}}
</text>
</scroll-view>
</view>
<view class="footer flex-center">
<template v-if="isAppStore">
<button class="content-button" style="border: none;color: #fff;" plain @click="jumpToAppStore">
{{downLoadBtnTextiOS}}
</button>
</template>
<template v-else>
<template v-if="!downloadSuccess">
<view class="progress-box flex-column" v-if="downloading">
<progress class="progress" border-radius="35" :percent="downLoadPercent" activeColor="#3DA7FF" show-info
stroke-width="10" />
<view style="width:100%;font-size: 28rpx;display: flex;justify-content: space-around;">
<text>{{downLoadingText}}</text>
<text>({{downloadedSize}}/{{packageFileSize}}M)</text>
</view>
</view>
<button v-else class="content-button" style="border: none;color: #fff;" plain @click="updateApp">
{{downLoadBtnText}}
</button>
</template>
<button v-else-if="downloadSuccess && !installed" class="content-button" style="border: none;color: #fff;"
plain :loading="installing" :disabled="installing" @click="installPackage">
{{installing ? '正在安装' : '下载完成立即安装'}}
</button>
<button v-if="installed && isWGT" class="content-button" style="border: none;color: #fff;" plain
@click="restart">
安装完毕点击重启
</button>
</template>
</view>
</view>
<image v-if="!is_mandatory" class="close-img" src="../images/app_update_close.png" @click.stop="closeUpdate">
</image>
</view>
</view>
</template>
<script>
const localFilePathKey = 'UNI_ADMIN_UPGRADE_CENTER_LOCAL_FILE_PATH'
const platform_iOS = 'iOS';
let downloadTask = null;
let openSchemePromise
/**
* 对比版本号,如需要,请自行修改判断规则
* 支持比对 ("3.0.0.0.0.1.0.1", "3.0.0.0.0.1") ("3.0.0.1", "3.0") ("3.1.1", "3.1.1.1") 之类的
* @param {Object} v1
* @param {Object} v2
* v1 > v2 return 1
* v1 < v2 return -1
* v1 == v2 return 0
*/
function compare(v1 = '0', v2 = '0') {
v1 = String(v1).split('.')
v2 = String(v2).split('.')
const minVersionLens = Math.min(v1.length, v2.length);
let result = 0;
for (let i = 0; i < minVersionLens; i++) {
const curV1 = Number(v1[i])
const curV2 = Number(v2[i])
if (curV1 > curV2) {
result = 1
break;
} else if (curV1 < curV2) {
result = -1
break;
}
}
if (result === 0 && (v1.length !== v2.length)) {
const v1BiggerThenv2 = v1.length > v2.length;
const maxLensVersion = v1BiggerThenv2 ? v1 : v2;
for (let i = minVersionLens; i < maxLensVersion.length; i++) {
const curVersion = Number(maxLensVersion[i])
if (curVersion > 0) {
v1BiggerThenv2 ? result = 1 : result = -1
break;
}
}
}
return result;
}
export default {
data() {
return {
// 从之前下载安装
installForBeforeFilePath: '',
// 安装
installed: false,
installing: false,
// 下载
downloadSuccess: false,
downloading: false,
downLoadPercent: 0,
downloadedSize: 0,
packageFileSize: 0,
tempFilePath: '', // 要安装的本地包地址
// 默认安装包信息
title: '更新日志',
contents: '',
is_mandatory: false,
// 可自定义属性
subTitle: '发现新版本',
downLoadBtnTextiOS: '立即跳转更新',
downLoadBtnText: '立即下载更新',
downLoadingText: '安装包下载中,请稍后'
}
},
onLoad({
local_storage_key
}) {
if (!local_storage_key) {
console.error('local_storage_key为空请检查后重试')
uni.navigateBack()
return;
};
const localPackageInfo = uni.getStorageSync(local_storage_key);
if (!localPackageInfo) {
console.error('安装包信息为空,请检查后重试')
uni.navigateBack()
return;
};
const requiredKey = ['version', 'url', 'type']
for (let key in localPackageInfo) {
if (requiredKey.indexOf(key) !== -1 && !localPackageInfo[key]) {
console.error(`参数 ${key} 必填,请检查后重试`)
uni.navigateBack()
return;
}
}
Object.assign(this, localPackageInfo)
this.checkLocalStoragePackage()
},
onBackPress() {
// 强制更新不允许返回
if (this.is_mandatory) {
return true
}
downloadTask && downloadTask.abort()
},
onHide() {
openSchemePromise = null
},
computed: {
isWGT() {
return this.type === 'wgt'
},
isiOS() {
return !this.isWGT ? this.platform.includes(platform_iOS) : false;
},
isAppStore() {
return this.isiOS || (!this.isiOS && !this.isWGT && this.url.indexOf('.apk') === -1)
}
},
methods: {
checkLocalStoragePackage() {
// 如果已经有下载好的包,则直接提示安装
const localFilePathRecord = uni.getStorageSync(localFilePathKey)
if (localFilePathRecord) {
const {
version,
savedFilePath,
installed
} = localFilePathRecord
// 比对版本
if (!installed && compare(version, this.version) === 0) {
this.downloadSuccess = true;
this.installForBeforeFilePath = savedFilePath;
this.tempFilePath = savedFilePath
} else {
// 如果保存的包版本小 或 已安装过,则直接删除
this.deleteSavedFile(savedFilePath)
}
}
},
async closeUpdate() {
if (this.downloading) {
if (this.is_mandatory) {
return uni.showToast({
title: '下载中,请稍后……',
icon: 'none',
duration: 500
})
}
uni.showModal({
title: '是否取消下载?',
cancelText: '否',
confirmText: '是',
success: res => {
if (res.confirm) {
downloadTask && downloadTask.abort()
uni.navigateBack()
}
}
});
return;
}
if (this.downloadSuccess && this.tempFilePath) {
// 包已经下载完毕,稍后安装,将包保存在本地
await this.saveFile(this.tempFilePath, this.version)
uni.navigateBack()
return;
}
uni.navigateBack()
},
updateApp() {
this.checkStoreScheme().catch(() => {
this.downloadPackage()
})
},
// 跳转应用商店
checkStoreScheme() {
const storeList = (this.store_list || []).filter(item => item.enable)
if (storeList && storeList.length) {
storeList
.sort((cur, next) => next.priority - cur.priority)
.map(item => item.scheme)
.reduce((promise, cur, curIndex) => {
openSchemePromise = (promise || (promise = Promise.reject())).catch(() => {
return new Promise((resolve, reject) => {
plus.runtime.openURL(cur, (err) => {
reject(err)
})
})
})
return openSchemePromise
}, openSchemePromise)
return openSchemePromise
}
return Promise.reject()
},
downloadPackage() {
this.downloading = true;
//下载包
downloadTask = uni.downloadFile({
url: this.url,
success: res => {
if (res.statusCode == 200) {
this.downloadSuccess = true;
// fix: wgt 文件下载完成后后缀不是 wgt
// if (this.isWGT && res.tempFilePath.split('.').slice(-1) !== 'wgt') {
if (this.isWGT && res.tempFilePath.split('.').slice(-1)[0] !== 'wgt'){
const failCallback = (e) => {
console.log('[FILE RENAME FAIL]', JSON.stringify(e));
}
plus.io.resolveLocalFileSystemURL(res.tempFilePath, function(entry) {
entry.getParent((parent) => {
const newName = `new_wgt_${Date.now()}.wgt`
entry.copyTo(parent, newName, (res) => {
this.tempFilePath = res.fullPath
this.downLoadComplete()
}, failCallback)
}, failCallback)
}, failCallback);
} else {
this.tempFilePath = res.tempFilePath
this.downLoadComplete()
}
}
}
});
downloadTask.onProgressUpdate(res => {
this.downLoadPercent = res.progress;
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
});
},
downLoadComplete() {
this.downloading = false;
this.downLoadPercent = 0
this.downloadedSize = 0
this.packageFileSize = 0
downloadTask = null;
// 强制更新,直接安装
if (this.is_mandatory) {
this.installPackage();
}
},
installPackage() {
// #ifdef APP-PLUS
// wgt资源包安装
if (this.isWGT) {
this.installing = true;
}
plus.runtime.install(this.tempFilePath, {
force: false
}, async res => {
this.installing = false;
this.installed = true;
// wgt包安装后会提示 安装成功,是否重启
if (this.isWGT) {
// 强制更新安装完成重启
if (this.is_mandatory) {
uni.showLoading({
icon: 'none',
title: '安装成功,正在重启……'
})
setTimeout(() => {
uni.hideLoading()
this.restart();
}, 1000)
}
} else {
const localFilePathRecord = uni.getStorageSync(localFilePathKey)
uni.setStorageSync(localFilePathKey, {
...localFilePathRecord,
installed: true
})
}
}, async err => {
// 如果是安装之前的包,安装失败后删除之前的包
if (this.installForBeforeFilePath) {
await this.deleteSavedFile(this.installForBeforeFilePath)
this.installForBeforeFilePath = '';
}
// 安装失败需要重新下载安装包
this.installing = false;
this.installed = false;
uni.showModal({
title: '更新失败,请重新下载',
content: err.message,
showCancel: false
});
});
// 非wgt包安装跳出覆盖安装此处直接返回上一页
if (!this.isWGT && !this.is_mandatory) {
uni.navigateBack()
}
// #endif
},
restart() {
this.installed = false;
// #ifdef APP-PLUS
//更新完重启app
plus.runtime.restart();
// #endif
},
saveFile(tempFilePath, version) {
return new Promise((resolve, reject) => {
uni.saveFile({
tempFilePath,
success({
savedFilePath
}) {
uni.setStorageSync(localFilePathKey, {
version,
savedFilePath
})
},
complete() {
resolve()
}
})
})
},
deleteSavedFile(filePath) {
uni.removeStorageSync(localFilePathKey)
return uni.removeSavedFile({
filePath
})
},
jumpToAppStore() {
plus.runtime.openURL(this.url);
}
}
}
</script>
<style>
page {
background: transparent;
}
.flex-center {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
}
.mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .65);
}
.botton-radius {
border-bottom-left-radius: 30rpx;
border-bottom-right-radius: 30rpx;
}
.content {
position: relative;
top: 0;
width: 600rpx;
background-color: #fff;
box-sizing: border-box;
padding: 0 50rpx;
font-family: Source Han Sans CN;
}
.text {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
line-height: 200px;
text-align: center;
color: #FFFFFF;
}
.content-top {
position: absolute;
top: -195rpx;
left: 0;
width: 600rpx;
height: 270rpx;
}
.content-top-text {
font-size: 45rpx;
font-weight: bold;
color: #F8F8FA;
position: absolute;
top: 120rpx;
left: 50rpx;
z-index: 1;
}
.content-header {
height: 70rpx;
}
.title {
font-size: 33rpx;
font-weight: bold;
color: #3DA7FF;
line-height: 38px;
}
.footer {
height: 150rpx;
display: flex;
align-items: center;
justify-content: space-around;
}
.box-des-scroll {
box-sizing: border-box;
padding: 0 40rpx;
height: 200rpx;
text-align: left;
}
.box-des {
font-size: 26rpx;
color: #000000;
line-height: 50rpx;
}
.progress-box {
width: 100%;
}
.progress {
width: 90%;
height: 40rpx;
border-radius: 35px;
}
.close-img {
width: 70rpx;
height: 70rpx;
z-index: 1000;
position: absolute;
bottom: -120rpx;
left: calc(50% - 70rpx / 2);
}
.content-button {
text-align: center;
flex: 1;
font-size: 30rpx;
font-weight: 400;
color: #FFFFFF;
border-radius: 40rpx;
margin: 0 18rpx;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(to right, #1785ff, #3DA7FF);
}
.flex-column {
display: flex;
flex-direction: column;
align-items: center;
}
</style>

View File

@@ -0,0 +1,126 @@
## 升级中心 - app插件与 `uni-admin` 版本关系
### `uni-admin >= 1.9.3`:云函数 `checkVersion` 废弃,使用 uni-admin 自带的 `uni-upgrade-center` 云函数。
# uni-upgrade-center - App
### 概述
> 统一管理App及App在`Android`、`iOS`平台上`App安装包`和`wgt资源包`的发布升级
> uni升级中心分为业务插件和后台管理插件。本插件为业务插件包括uni升级中心客户端检查更新的前后端逻辑。后台管理系统另见 [uni-upgrade-center - Admin](https://ext.dcloud.net.cn/plugin?id=4470)
### uni升级中心 - 客户端检查更新插件
- 一键式检查更新同时支持整包升级与wgt资源包更新
- 好看、实用、可自定义的客户端提示框
## 安装指引
1. 依赖数据库`opendb-app-versions`,如果没有此库,请在云服务空间中创建。
2. 使用`HBuilderX 3.1.0+`,因为要使用到`uni_modules`
3. 在插件市场打开本插件页面,在右侧点击`使用 HBuilderX 导入插件`,选择要导入的项目点击确定
4. 绑定一个服务空间。自 `0.6.0` 起,依赖 `uni-admin 1.9.3+``uni-upgrade-center 云函数`,请和 uni-admin 项目关联同一个服务空间
5. 找到`/uni_modules/uni-upgrade-center-app/uniCloud/cloudfunctions/check-version`,右键上传部署。自 `0.6.0` 起,依赖 `uni-admin 1.9.3+``uni-upgrade-center 云函数`,插件不再单独提供云函数,这样可以省下一个云函数名额。
6.`pages.json`中添加页面路径。**注请不要设置为pages.json中第一项**
```json
"pages": [
// ……其他页面配置
{
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
"style": {
"disableScroll": true,
"app-plus": {
"backgroundColorTop": "transparent",
"background": "transparent",
"titleNView": false,
"scrollIndicator": false,
"popGesture": "none",
"animationType": "fade-in",
"animationDuration": 200
}
}
}
]
```
7.`@/uni_modules/uni-upgrade-center-app/utils/check-update`import到需要用到的地方调用一下即可
1. 默认使用当前绑定的服务空间,如果要请求其他服务空间,可以使用其他服务空间的 `callFunction`。[详情](https://uniapp.dcloud.io/uniCloud/cf-functions.html#call-by-function-cross-space)
8. 升级弹框可自行编写,也可以使用`uni.showModal`或使用现有的升级弹框样式如果不满足UI需求请自行替换资源文件。在`utils/check-update.js`中都有实例。
9. wgt更新时打包前请务必将manifest.json中的版本修改为更高版本。
### 更新下载安装`check-update.js`
*该函数在utils目录下*
1. 如果是静默更新,则不会打开更新弹框,会在后台下载后安装,下次启动应用生效
2. 如果是 iOS则会直接打开AppStore的链接
3. 其他情况,会将`check-version`返回的结果保存在localStorage中并跳转进入`upgrade-popup.vue`打开更新弹框
### 检查更新函数`check-version`
*该函数在uniCloud/cloudfunctions目录下*
1. 使用检查更新需要传递三个参数 `appid``appVersion``wgtVersion`
2. `appid` 使用 plus.runtime.appid 获取,*注真机运行时为固定值HBuilder在调试的时候请使用本地调试云函数*
3. `appVersion` 使用 plus.runtime.version 获取
4. `wgtVersion` 使用 plus.runtime.getProperty(plus.runtime.appid,(wgtInfo) => { wgtInfo.version }) 获取
5. `check-version`云函数内部会自动获取 App 平台
**Tips**
1. `check-version`云函数内部有版本对比函数compare
- 使用多段式版本格式(如:"3.0.0.0.0.1.0.1", "3.0.0.0.0.1")。如果不满足对比规则,请自行修改。
- 如果修改,请将*pages/upgrade-popup.vue*中*compare*函数一并修改
## 项目代码说明
### 更新弹框
- `upgrade-popup.vue` - 更新应用:
- 如果云函数`check-version`返回的参数表明需要更新则将参数保存在localStorage中带着键值跳转该页面
- 进入时会先从localStorage中尝试取出之前存的安装包路径此包不会是强制安装类型的包
- 如果有已经保存的包,则和传进来的 `version` 进行比较如果相等则安装。大于和小于都不进行安装因为admin端可能会调整包的版本。不符合更新会将此包删除
- 如果本地没有包或者包不符合安装条件,则进行下载安装包
- 点击下载会有进度条、已下载大小和下载包的大小
- 下载完成会提示安装:
- 如果是 wgt 包,安装时则会提示 正在安装…… 和 安装完成。安装完成会提示是否重启
- 如果是 原生安装包,则直接跳出去覆盖安装
- 下载过程中,如果退出会提示是否取消下载。如果是强制更新,则只会提示正在下载请稍后,此时不可退出
- 如果是下载完成了没有安装就退出则会将下载完成的包保存在本地。将包的本地路径和包version保存在localStorage中
### 工具类 utils
- `call-check-version`
- 请求云函数`check-version`拿取版本检测结果
- `check-update`
- 调用`call-check-version`并根据结果判断是否显示更新弹框
### 云函数
- `check-version` - 检查应用更新:
- 根据传参先检测传参是否完整appid appVersion wgtVersion 必传
- 先从数据库取出所有该平台(会从上下文读取平台信息)的所有线上发行更新
- 再从所有线上发行更新中取出版本最大的一版。如果可以尽量先检测wgt的线上发行版更新
- 使用上一步取出的版本包的版本号 和传参 appVersion、wgtVersion 来检测是否有更新。必须同时大于这两项因为上一次可能是wgt热更新否则返回暂无更新
- 如果库中 wgt包 版本大于传参 appVersion但是不满足 min_uni_version < appVersion则不会使用wgt更新会接着判断库中 app包version 是否大于 appVersion
- 返回结果:
|code|message|
|:-:|:-:|
|0|当前版本已经是最新的,不需要更新|
|101|wgt更新|
|102|整包更新|
|-101|暂无更新或检查appid是否填写正确|
|-102|请检查传参是否填写正确|

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,32 @@
export default function() {
// #ifdef APP-PLUS
return new Promise((resolve, reject) => {
plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
let data = {
action: 'checkVersion',
appid: plus.runtime.appid,
appVersion: plus.runtime.version,
wgtVersion: widgetInfo.version
}
uniCloud.callFunction({
name: 'uni-upgrade-center',
data,
success: (e) => {
console.log("e: ", e);
resolve(e)
},
fail: (error) => {
reject(error)
}
})
})
})
// #endif
// #ifndef APP-PLUS
return new Promise((resolve, reject) => {
reject({
message: '请在App中使用'
})
})
// #endif
}

View File

@@ -0,0 +1,158 @@
import callCheckVersion from './call-check-version'
// 推荐再App.vue中使用
const PACKAGE_INFO_KEY = '__package_info__'
export default function() {
// #ifdef APP-PLUS
return new Promise((resolve, reject) => {
callCheckVersion().then(async (e) => {
if (!e.result) return;
const {
code,
message,
is_silently, // 是否静默更新
url, // 安装包下载地址
platform, // 安装包平台
type // 安装包类型
} = e.result;
// 此处逻辑仅为实例,可自行编写
if (code > 0) {
// 腾讯云和阿里云下载链接不同,需要处理一下,阿里云会原样返回
const {
fileList
} = await uniCloud.getTempFileURL({
fileList: [url]
});
if (fileList[0].tempFileURL)
e.result.url = fileList[0].tempFileURL;
resolve(e)
// 静默更新只有wgt有
if (is_silently) {
uni.downloadFile({
url: e.result.url,
success: res => {
if (res.statusCode == 200) {
// 下载好直接安装,下次启动生效
plus.runtime.install(res.tempFilePath, {
force: false
});
}
}
});
return;
}
/**
* 提示升级一
* 使用 uni.showModal
*/
// return updateUseModal(e.result)
/**
* 提示升级二
* 官方适配的升级弹窗可自行替换资源适配UI风格
*/
uni.setStorageSync(PACKAGE_INFO_KEY, e.result)
uni.navigateTo({
url: `/uni_modules/uni-upgrade-center-app/pages/upgrade-popup?local_storage_key=${PACKAGE_INFO_KEY}`,
fail: (err) => {
console.error('更新弹框跳转失败', err)
uni.removeStorageSync(PACKAGE_INFO_KEY)
}
})
return
} else if (code < 0) {
// TODO 云函数报错处理
console.error(message)
return reject(e)
}
return resolve(e)
}).catch(err => {
// TODO 云函数报错处理
console.error(err.message)
reject(err)
})
});
// #endif
}
/**
* 使用 uni.showModal 升级
*/
function updateUseModal(packageInfo) {
const {
title, // 标题
contents, // 升级内容
is_mandatory, // 是否强制更新
url, // 安装包下载地址
platform, // 安装包平台
type // 安装包类型
} = packageInfo;
let isWGT = type === 'wgt'
let isiOS = !isWGT ? platform.includes('iOS') : false;
let confirmText = isiOS ? '立即跳转更新' : '立即下载更新'
return uni.showModal({
title,
content: contents,
showCancel: !is_mandatory,
confirmText,
success: res => {
if (res.cancel) return;
// 安装包下载
if (isiOS) {
plus.runtime.openURL(url);
return;
}
uni.showToast({
title: '后台下载中……',
duration: 1000
});
// wgt 和 安卓下载更新
downloadTask = uni.downloadFile({
url,
success: res => {
if (res.statusCode !== 200) {
console.error('下载安装包失败', err);
return;
}
// 下载好直接安装,下次启动生效
plus.runtime.install(res.tempFilePath, {
force: false
}, () => {
if (is_mandatory) {
//更新完重启app
plus.runtime.restart();
return;
}
uni.showModal({
title: '安装成功是否重启?',
success: res => {
if (res.confirm) {
//更新完重启app
plus.runtime.restart();
}
}
});
}, err => {
uni.showModal({
title: '更新失败',
content: err
.message,
showCancel: false
});
});
}
});
}
});
}