Commit 9ab70baf authored by mengcuiguang's avatar mengcuiguang

代码优化

parent a8d16bc4
<template> <template>
<view class="body"> <view class="body">
<!-- <scroll-view :scroll-y="true"> --> <!-- <scroll-view :scroll-y="true"> -->
<z-paging style="height: 100%;"> <z-paging style="height: 100%;">
<view <view
:style="'display: flex;flex-direction: row;align-items: center;margin: 20rpx;padding-left: 10rpx;margin-top:'+10+'px;'"> :style="'display: flex;flex-direction: row;align-items: center;margin: 20rpx;padding-left: 10rpx;margin-top:'+10+'px;'">
<image class="avatar" src="@/static/logo-about.png"></image> <image class="avatar" src="@/static/logo-about.png"></image>
<view> <view>
<view style="font-size: 34rpx;color: black;margin-left: 30rpx;">用户ID:{{userBean.idcode}}</view> <view style="font-size: 34rpx;color: black;margin-left: 30rpx;">用户ID:{{userBean.idcode}}</view>
<view style="font-size: 26rpx;color: #b5b5b5;margin-left: 30rpx;margin-top: 10rpx;">书中自有颜如玉,书中自有黄金屋,书中自有千钟黍</view> <view style="font-size: 26rpx;color: #b5b5b5;margin-left: 30rpx;margin-top: 10rpx;">
</view> 书中自有颜如玉,书中自有黄金屋,书中自有千钟黍</view>
</view> </view>
</view>
<view
style="display: flex;height: 200rpx;margin:30rpx 20rpx;background: #263358;border-radius: 20rpx;"> <read-time-count-row id='count' ref='timeCount' @resize='resizeTimeCount'></read-time-count-row>
<view style="flex-grow: 2; margin-left: 20rpx;">
<view <view style="display: flex;height: 200rpx;margin:30rpx 20rpx;background: #263358;border-radius: 20rpx;">
style="width: 100%;height: 100%;display: flex;flex-direction: column;justify-content: center;"> <view style="flex-grow: 2; margin-left: 20rpx;">
<view style="display: flex;align-items: center;"> <view
<image style="width: 100%;height: 100%;display: flex;flex-direction: column;justify-content: center;">
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;" <view style="display: flex;align-items: center;">
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_my_coin.png"></image> <image
<view style="font-size: 36rpx;font-weight: 777;color: white;">我的书豆 {{userBean.point}}</view> style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
</view> src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_my_coin.png"></image>
<view style="font-size: 36rpx;font-weight: 777;color: white;">我的书豆 {{userBean.point}}</view>
<view v-if="userBean.expireTime<=0" style="font-size: 28rpx;color: #b5b5b5;margin-top: 20rpx;">开通会员畅读VIP享更多福利</view> </view>
<view v-else style="font-size: 28rpx;color: #b5b5b5;margin-top: 20rpx;">到期时间:{{userBean.expireTime*1000 | formatDate('yyyy-MM-dd')}}</view>
</view> <view v-if="userBean.expireTime<=0" style="font-size: 28rpx;color: #b5b5b5;margin-top: 20rpx;">
</view> 开通会员畅读VIP享更多福利</view>
<view v-if="userBean.expireTime<=0" style="width: 220rpx;"> <view v-else style="font-size: 28rpx;color: #b5b5b5;margin-top: 20rpx;">
<view 到期时间:{{userBean.expireTime*1000 | formatDate('yyyy-MM-dd')}}</view>
style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;"> </view>
<view @click="handleCoinPay" </view>
style="width: 160rpx;height: 60rpx;background-color: #fff;border-radius:30rpx;color: 263358;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;"> <view v-if="userBean.expireTime<=0" style="width: 220rpx;">
去开通 <view
</view> style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
</view> <view @click="handleCoinPay"
</view> style="width: 160rpx;height: 60rpx;background-color: #fff;border-radius:30rpx;color: 263358;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;">
</view> 去开通
</view>
</view>
</view>
<view class="infobg" style="margin: 20rpx;"> </view>
<view v-if="userBean.showVipInner" class="item arrow" @click="handlePayRecord">
我的订单 <view class="infobg" style="margin: 20rpx;">
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view> <view class="item arrow" @click="handlePayRecord">
</view> 我的订单
<view class="item arrow" @click="handleDotRecord"> <view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
书豆记录 </view>
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view> <view class="item arrow" @click="handleDotRecord">
</view> 书豆记录
<view class="item arrow" @click="handleUseDotRecord"> <view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
消费记录 </view>
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view> <view class="item arrow" @click="handleUseDotRecord">
</view> 消费记录
<view class="item arrow" @click="handleWatchRecord"> <view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
阅读记录 </view>
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view> <view class="item arrow" @click="handleReadRecord">
</view> 阅读记录
<view class="item arrow" @click="handlePhone"> <view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
联系客服 </view>
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view> <view class="item arrow" @click="handlePhone">
</view> 联系客服
</view> <view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view style="display: flex;justify-content: center;margin-top: 20rpx;font-size: 26rpx;color: gray;"> </view>
{{ versionName }}
</view> <view style="display: flex;justify-content: center;margin-top: 20rpx;font-size: 26rpx;color: gray;">
</z-paging> {{ versionName }}
<!-- </scroll-view> --> </view>
<coin-popup :show="showAnimate" @close="showAnimate = false" @paySuccess="paySuccess"> </z-paging>
</coin-popup> <!-- </scroll-view> -->
<coin-popup :show="showAnimate" @close="showAnimate = false" @paySuccess="paySuccess">
</view> </coin-popup>
</template> </view>
<script>
import common from '@/mixins/common'; </template>
<script>
import { import common from '@/mixins/common';
getToLocal
} from "@/utils/utils.js" import {
getToLocal
import { } from "@/utils/utils.js"
navigateTo,
message, import {
alert, navigateTo,
loading message,
} from '@/utils/fun.js'; alert,
import { loading
openUrl } from '@/utils/fun.js';
} from '@/utils/app+.js'; import {
openUrl
const app = getApp(); } from '@/utils/app+.js';
export default { const app = getApp();
name: 'index',
mixins: [common], export default {
data() { name: 'index',
return { mixins: [common],
statusBarHeight: app.globalData.statusBarHeight, data() {
userBean: {}, return {
showAnimate: false, statusBarHeight: app.globalData.statusBarHeight,
versionName: app.globalData.versionName userBean: {},
}; showAnimate: false,
}, versionName: app.globalData.versionName
methods: { };
show() { },
// loadData() { methods: {
this.post({ resizeTimeCount() {
url: '/user/baseMsg', this.initHeight();
showLoading: false, },
success: ({ refreshTimeCount() {
data let ref = this.$refs.timeCount;
}) => { if (ref) {
this.userBean = data; ref.refresh();
} }
}); },
}, initHeight() {
hide() { const query = uni.createSelectorQuery().in(this);
query.select("#count").boundingClientRect();
}, },
handleDotRecord() { show() {
// 书豆记录 // 更新阅读时间统计
navigateTo(`/pagesD/dotRecord/dotRecord`) this.refreshTimeCount();
},
handleUseDotRecord() { this.post({
// 书豆消费记录 url: '/user/baseMsg',
navigateTo(`/pagesD/useDotRecord/useDotRecord`) showLoading: false,
}, success: ({
handleWatchRecord() { data
navigateTo(`/pagesD/watchRecord/watchRecord`) }) => {
}, this.userBean = data;
handleCoinPay() { }
this.showAnimate = true; });
}, },
handlePayRecord() { hide() {
navigateTo(`/pagesD/payRecord/payRecord`)
}, },
handlePhone() { handleDotRecord() {
wx.makePhoneCall({ // 书豆记录
phoneNumber: '4000969950', navigateTo(`/pagesD/dotRecord/dotRecord`)
success: function(res) { },
console.log('拨打电话成功!'); handleUseDotRecord() {
}, // 书豆消费记录
fail: function(res) { navigateTo(`/pagesD/useDotRecord/useDotRecord`)
console.log('拨打电话失败!'); },
} handleReadRecord() {
}) navigateTo(`/pagesD/readerRecord/readerRecord`)
}, },
paySuccess(largeType) { handleCoinPay() {
// largeType=vip 开通vip this.showAnimate = true;
// largeType=point 购买书豆 },
if(tt.getSystemInfoSync().platform=='ios'){ handlePayRecord() {
message.notify('支付成功'); navigateTo(`/pagesD/payRecord/payRecord`)
} },
handlePhone() {
this.post({ wx.makePhoneCall({
url: '/user/baseMsg', phoneNumber: '4000969950',
showLoading: false, success: function(res) {
success: ({ console.log('拨打电话成功!');
data },
}) => { fail: function(res) {
this.userBean = data; console.log('拨打电话失败!');
} }
}); })
} },
} paySuccess(largeType) {
}; // largeType=vip 开通vip
</script> // largeType=point 购买书豆
message.notify('支付成功');
<style lang="scss">
@import '@/scss/uni.scss'; this.post({
url: '/user/baseMsg',
.body { showLoading: false,
background-color: whitesmoke; success: ({
} data
}) => {
.avatar { this.userBean = data;
background-color: #d8d8d8; }
width: 100rpx; });
height: 100rpx; }
border-radius: 50%; }
overflow: hidden; };
//box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1) </script>
}
<style lang="scss">
.vip-item { @import '@/scss/uni.scss';
width: 100%;
padding: 10rpx 40rpx; .body {
background-color: whitesmoke;
.content { }
width: 90%;
margin: auto; .avatar {
display: flex; background-color: #d8d8d8;
flex-direction: row; width: 100rpx;
justify-content: space-between; height: 100rpx;
padding: 20rpx 40rpx; border-radius: 50%;
background: #263358; overflow: hidden;
color: #fff; //box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
border-radius: 18rpx; }
}
.vip-item {
.item { width: 100%;
display: flex; padding: 10rpx 40rpx;
flex-direction: column;
align-items: flex-start; .content {
justify-content: center; width: 90%;
margin-right: 20rpx; margin: auto;
} display: flex;
flex-direction: row;
.item:last-child { justify-content: space-between;
margin-right: 0; padding: 20rpx 40rpx;
} background: #263358;
color: #fff;
.row { border-radius: 18rpx;
display: flex; }
flex-direction: row;
align-items: center; .item {
margin-bottom: 15rpx; display: flex;
} flex-direction: column;
align-items: flex-start;
.row:last-child { justify-content: center;
margin-bottom: 0; margin-right: 20rpx;
} }
.title { .item:last-child {
font-size: 38rpx; margin-right: 0;
font-weight: 700; }
font-style: italic;
} .row {
display: flex;
.desc { flex-direction: row;
font-size: 26rpx; align-items: center;
color: #b5b5b5; margin-bottom: 15rpx;
} }
.button { .row:last-child {
height: 40rpx; margin-bottom: 0;
line-height: 70rpx; }
border-radius: 35rpx;
width: 160rpx; .title {
background: #fff; font-size: 38rpx;
color: #263358; font-weight: 700;
text-align: center; font-style: italic;
font-size: 30rpx; }
font-weight: 700;
font-style: italic; .desc {
} font-size: 26rpx;
} color: #b5b5b5;
}
.button {
height: 40rpx;
line-height: 70rpx;
border-radius: 35rpx;
width: 160rpx;
background: #fff;
color: #263358;
text-align: center;
font-size: 30rpx;
font-weight: 700;
font-style: italic;
}
}
</style> </style>
\ No newline at end of file
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
}, { }, {
"path": "dotRecord/dotRecord", "path": "dotRecord/dotRecord",
"style": { "style": {
"navigationBarTitleText": "看点记录", "navigationBarTitleText": "书豆记录",
"navigationStyle": "default", "navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff", "navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
...@@ -141,6 +141,14 @@ ...@@ -141,6 +141,14 @@
"navigationBarBackgroundColor": "#ffffff", "navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
}, {
"path": "readerRecord/readerRecord",
"style": {
"navigationBarTitleText": "阅读记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}] }]
}], }],
// 分包预载配置 // 分包预载配置
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
}, },
data() { data() {
return { return {
currentPage: 0 currentPage: 2
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -70,8 +70,19 @@ ...@@ -70,8 +70,19 @@
} }
}, },
onShow() { onShow() {
this.loadComponentData(); try {
// 在子组件重写show()代替onShow()
if (this.currentPage == 0) {
this.$refs.index.show();
} else if (this.currentPage == 1) {
this.$refs.recommend.show();
} else if (this.currentPage == 2) {
this.$refs.user.show();
}
} catch (e) {
}
}, },
mounted() { mounted() {
// 渲染完成 初始化首页数据 // 渲染完成 初始化首页数据
......
<template>
<view class="body">
<!-- <scroll-view :scroll-y="true"> -->
<z-paging style="height: 100%;">
<view
:style="'display: flex;flex-direction: row;align-items: center;margin: 20rpx;padding-left: 10rpx;margin-top:'+statusBarHeight+'px;'">
<image class="avatar" src="@/static/logo-about.png"></image>
<view>
<view style="font-size: 32rpx;color: black;margin-left: 20rpx;">用户ID:{{userBean.idcode}}</view>
</view>
<!-- <button text="微信用户一键登录" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">123123</button> -->
</view>
<view v-if="userBean.showVipInner && os === 'android' "
style="display: flex;flex-direction: row;background: #f5ca86;margin: 20rpx;padding: 40rpx;border-radius:20rpx;align-items: center;justify-content:space-between;">
<view style="display: flex;flex-direction: column;justify-content: center;">
<view style="font-size: 36rpx;color: #5b1500;font-weight: 777;">
{{userBean.expireTime<=0 ? '开通VIP会员' : 'VIP会员'}}
</view>
<view v-if="userBean.expireTime<=0" style="font-size: 30rpx;color: #5b1500;margin-top: 12rpx;">
解锁全部小说
</view>
<view v-else style="font-size: 30rpx;color: #5b1500;margin-top: 12rpx;">
到期时间:{{userBean.expireTime*1000 | formatDate('yyyy-MM-dd')}}
</view>
<view v-if="userBean.expireTime<=0" @click="handleCoinPay"
style="width: 210rpx;height: 60rpx;background-color: #5b1500;border-radius:30rpx;color: white;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;margin-top: 30rpx;">
立即开通
</view>
<view v-else style="width: 210rpx;height: 60rpx;padding-bottom: 4rpx;margin-top: 30rpx;">
</view>
</view>
<image style="border-radius:10rpx; width: 130rpx;height: 100rpx;margin-right: 20rpx;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/bg_my_vip.png" mode="scaleToFill"></image>
</view>
<view v-if="os === 'android' "
style="display: flex;height: 200rpx;margin: 20rpx;background: #f5ca86;border-radius: 20rpx;">
<view style="flex-grow: 2; margin-left: 20rpx;">
<view
style="width: 100%;height: 100%;display: flex;flex-direction: column;justify-content: center;">
<view style="display: flex;align-items: center;">
<image
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_my_coin.png"></image>
<view style="font-size: 36rpx;font-weight: 777;">看点充值</view>
</view>
<view style="font-size: 28rpx;color: #5b1500;margin-top: 20rpx;">海量看点狂洒中,好剧等你来解锁</view>
</view>
</view>
<view style="width: 220rpx;">
<view
style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<view style="font-size: 30rpx;color: #5b1500;margin-bottom: 20rpx;">{{userBean.point}}</view>
<view @click="handleCoinPay"
style="width: 160rpx;height: 60rpx;background-color: #5b1500;border-radius:30rpx;color: white;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;">
去充值
</view>
</view>
</view>
</view>
<view class="infobg" style="margin: 20rpx;">
<view v-if="userBean.showVipInner && os === 'android' " class="item arrow" @click="handlePayRecord">
我的订单
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view v-if="os === 'android' " class="item arrow" @click="handleDotRecord">
看点记录
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view v-if="os === 'android' " class="item arrow" @click="handleUseDotRecord">
消费记录
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view class="item arrow" @click="handleWatchRecord">
观看记录
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view class="item arrow" @click="handlePhone">
联系客服
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
</view>
<view style="display: flex;justify-content: center;margin-top: 20rpx;font-size: 26rpx;color: gray;">
{{ versionName }}
</view>
</z-paging>
<!-- </scroll-view> -->
<coin-popup :show="showAnimate" @close="showAnimate = false" @paySuccess="paySuccess">
</coin-popup>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
getToLocal
} from "@/utils/utils.js"
import {
navigateTo,
message,
alert,
loading
} from '@/utils/fun.js';
import {
openUrl
} from '@/utils/app+.js';
const app = getApp();
export default {
name: 'index',
mixins: [common],
data() {
return {
statusBarHeight: app.globalData.statusBarHeight,
userBean: {},
showAnimate: false,
windowHeight: 0,
os: 'android',
versionName: app.globalData.versionName,
corpid: '', // 企业ID
curl: '', // 客服链接
};
},
methods: {
show() {
this.os = wx.getSystemInfoSync().platform;
this.windowHeight = uni.getSystemInfoSync().windowHeight
// loadData() {
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
},
hide() {
},
handleDotRecord() {
// 看点记录
navigateTo(`/pagesD/dotRecord/dotRecord`)
},
handleUseDotRecord() {
// 看点消费记录
navigateTo(`/pagesD/useDotRecord/useDotRecord`)
},
handleWatchRecord() {
navigateTo(`/pagesD/watchRecord/watchRecord`)
},
handleCoinPay() {
this.showAnimate = true;
},
handlePayRecord() {
navigateTo(`/pagesD/payRecord/payRecord`)
},
handleVipPay() {
navigateTo(`/pagesA/vipPay/vipPay`)
},
handlePhone() {
// if (this.corpid != '' && this.curl != '') {
// wx.openCustomerServiceChat({
// extInfo: {
// url: this.curl
// },
// corpId: this.corpid,
// success(res) {},
// fail(e) {
// console.log(e)
// }
// })
// } else {
// let that = this
// // 联系我们
// this.post({
// url: '/vedio/customerServiceNumbers',
// showLoading: false,
// success: ({
// data
// }) => {
// let datas = data.customerServiceNumbers.split(',')
// that.corpid = datas[0]
// that.curl = datas[1]
// wx.openCustomerServiceChat({
// extInfo: {
// url: that.curl
// },
// corpId: that.corpid,
// success(res) {},
// fail(e) {
// console.log(e)
// }
// })
// }
// });
// }
wx.makePhoneCall({
phoneNumber: '4000969950',
success: function(res) {
console.log('拨打电话成功!');
},
fail: function(res) {
console.log('拨打电话失败!');
}
})
},
paySuccess(largeType) {
// largeType=vip 开通vip
// largeType=point 购买看点
if(wx.getSystemInfoSync().platform=='ios'){
message.notify('支付成功');
}
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
},
getPhoneNumber(e) {
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
}
}
};
</script>
<style lang="scss">
@import '@/scss/uni.scss';
.body {
background-color: whitesmoke;
}
.avatar {
background-color: #d8d8d8;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
overflow: hidden;
//box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
}
</style>
\ No newline at end of file
<template> <template>
<view class="body"> <view class="body">
<!-- <status-title :showBack="true">阅读记录</status-title> -->
<z-paging class="flex-1" ref="paging" v-model="dataList" @query="queryList" :defaultPageNo="1" <z-paging class="flex-1" ref="paging" v-model="dataList" @query="queryList" :defaultPageNo="1"
:defaultPageSize="500"> :defaultPageSize="500">
<view style="font-size: 30rpx;font-weight: 777;margin-left: 12rpx;margin-top: 10rpx;">最近阅读</view> <view style="font-size: 30rpx;font-weight: 777;margin-left: 12rpx;margin-top: 10rpx;">最近阅读</view>
<view v-for="(item, i) in dataList" :key="i"> <view v-for="(item, i) in dataList" :key="i">
<view style="display: flex;flex-direction: row;justify-content:space-between;margin: 20rpx;"> <view style="display: flex;flex-direction: row;justify-content:space-between;margin: 20rpx;">
<view style="display: flex;align-items: center;" @click="handleInfo(item)"> <view style="display: flex;align-items: center;" @click="handleInfo(item)">
...@@ -36,11 +34,6 @@ ...@@ -36,11 +34,6 @@
</template> </template>
<script> <script>
import common from '@/mixins/common'; import common from '@/mixins/common';
import {
getToLocal
} from "@/utils/utils.js"
import { import {
navigateTo, navigateTo,
message, message,
...@@ -121,8 +114,7 @@ ...@@ -121,8 +114,7 @@
}; };
</script> </script>
<style lang="scss"> <style>
@import '@/scss/uni.scss';
.body { .body {
background-color: whitesmoke; background-color: whitesmoke;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
font-weight: bold; font-weight: bold;
color: black; color: black;
&.active { &.active {
color: #F8425A; color: #FECF02;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment