Commit 62cb8ae5 authored by jyx's avatar jyx

代码优化

parent 772c36dc
......@@ -15,11 +15,11 @@ export default class User {
bookLegumes
} = param || {}
this.id = id;
this.name = name || "微信用户";
this.name = name || "用户";
this.phone = phone;
this.sign = sign || '书中自有颜如玉,书中自有黄金屋,书中自有千钟黍';
this.avater = '/static/images/logo.png';
this.nickName = nickName || "微信用户";
this.nickName = nickName || "用户";
this.roleId = roleId;
this.sex = sex;
this.status = status;
......
......@@ -104,15 +104,15 @@ function login(data, callback) {
function refreshUserInfo() {
requestUserInfo((success, userData) => {
if (success) {
console.log(userData)
let user = new User({
...userData,
name: userData.username,
nickName: userData.nickname,
name: userData.nickName,
nickName: userData.nickName,
avater: userData.avatar,
isVip: userData.expireTime > 0
id: userData.idcode,
memberExpirationDate: userData.expireTime
})
console.log(user)
console.log(userData)
saveNickname(userData.nickname);
saveUserInfo(user); // 存储用户数据
postNotification(KEY_NOTIFICATION_LOGIN_SUCCESS); // 通知登录成功
......
......@@ -136,9 +136,6 @@
initHeight() {
const query = uni.createSelectorQuery().in(this);
query.select("#count").boundingClientRect();
},
onShow(){
},
show() {
// 更新阅读时间统计
......
......@@ -11,7 +11,7 @@
<swiper :style="[listStyle]" :indicator-dots="false" :autoplay="false" :current="currentIndex"
@change="changeSwiper">
<swiper-item v-for='(item, index) in categorys' :key='index'>
<WarehouseList ref='bookList' :category='item' :height='listHeight'></WarehouseList>
<WarehouseList :ref="`bookList${index}`" :category='item' :height='listHeight'></WarehouseList>
</swiper-item>
</swiper>
</view>
......@@ -76,10 +76,11 @@
categroyChange: {
handler: function(n, o) {
this.$nextTick(() => {
let ref = this.$refs.bookList;
if (ref) {
ref[n.currentIndex].initRefresh();
}
this.$refs[`bookList${n.currentIndex}`][0].initRefresh();
// let ref = this.$refs.bookList;
// if (ref) {
// ref[n.currentIndex].initRefresh();
// }
})
},
deep: true
......
......@@ -10,10 +10,14 @@
@tapVip='tapVipPop' @tapBean='tapBeanPop'></detail-new-buy>
<detail-bottom :detail='bookData' :userInfo='userInfo' @tapBottomItem='tapBottomItem'></detail-bottom>
<setting-pop :show='showSetting' @close='closePop'></setting-pop>
<vip-pop v-if="bookData.isUnlock==0 && !isVip()" :show='showVip' @close='closeVipPop'></vip-pop>
<!-- <vip-pop v-if="bookData.isUnlock==0 && !isVip()" :show='showVip' @close='closeVipPop'></vip-pop>
<bean-pop v-if="bookData.isUnlock==0 && userInfo.bookLegumes<bookData.bookLegumes" :show='showBean'
@close='closeBeanPop'></bean-pop>
@close='closeBeanPop'></bean-pop> -->
<recommend-pop :show='showRecommend' @close='closeRecommendPop' :bookId="bookId"></recommend-pop>
<coin-popup v-if="bookData.isUnlock==0 && !isVip()" :show="showVip" @close="closeVipPop"
@paySuccess="paySuccess">
</coin-popup>
</template>
<c-login :isShareLink="true"></c-login>
<popup :show="showMoibleLogin" @close="showMoibleLogin=false">
......@@ -127,11 +131,8 @@
if (info.userInfo) {
addReadRecord(this.bookId)
}
console.log(info)
console.log(this.userInfo)
// this.showVipOpen = data.openVips
// this.showVipOpen = data.openVips
// // 用户变动,需要刷新数据
// this.$nextTick(() => {
// uni.startPullDownRefresh({})
......@@ -259,10 +260,8 @@
setTimeout(() => {
uni.stopPullDownRefresh();
if (success) {
this.bookData = new BookDetail(data);
console.log('bookData=' + JSON.stringify(this.bookData));
// console.log('bookData=' + JSON.stringify(this.bookData));
}
}, 1000)
})
......@@ -290,10 +289,8 @@
}
},
isVip() {
if (this.userInfo != null && this.userInfo.memberFlag) {
let cDate = new Date();
cDate = cDate.getTime();
return this.userInfo.memberExpirationDate >= cDate;
if (this.userInfo != null && this.userInfo.memberExpirationDate > 0) {
return true;
}
return false;
},
......
......@@ -68,7 +68,6 @@
if (index != '' && index != undefined) {
this.currentPage = index
}
},
onShow() {
// try {
......@@ -92,7 +91,7 @@
tabChange(index) {
if (this.currentPage == index) return
this.currentPage = index;
// this.loadComponentData();
this.loadComponentData();
},
loadComponentData() {
if (this.currentPage == 0) {
......
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