Commit 36b4ed06 authored by 郝聪敏's avatar 郝聪敏

优化网络刷新页面;添加签到开奖音效

parent ec09cbdb
...@@ -15,33 +15,33 @@ wepy.app({ ...@@ -15,33 +15,33 @@ wepy.app({
// 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处 // 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
}, },
globalData: { globalData: {
statusBarHeight:'' statusBarHeight: ''
}, },
onLaunch() { onLaunch() {
// this.$options.globalData.info = '333'; // this.$options.globalData.info = '333';
let that = this; let that = this;
wx.getSystemInfo({ wx.getSystemInfo({
success: function (res) { success: function (res) {
that.$options.globalData.statusBarHeight = res.statusBarHeight that.$options.globalData.statusBarHeight = res.statusBarHeight;
} }
}); });
wx.checkSession({ wx.checkSession({
success () { success () {
console.log('已登录') console.log('已登录');
//session_key 未过期,并且在本生命周期一直有效 // session_key 未过期,并且在本生命周期一直有效
}, },
fail () { fail () {
// session_key 已经失效,需要重新执行登录流程 // session_key 已经失效,需要重新执行登录流程
wx.login({ wx.login({
success (res) { success (res) {
if (res.code) { if (res.code) {
//发起网络请求,告诉后端 // 发起网络请求,告诉后端
wx.setStorageSync('wxCode',res.code); wx.setStorageSync('wxCode', res.code);
} else { } else {
console.log('登录失败!' + res.errMsg) console.log('登录失败!' + res.errMsg);
} }
} }
}) });
} }
}); });
wx.setStorageSync('onNetworkStatusChange', true); wx.setStorageSync('onNetworkStatusChange', true);
......
<template> <template>
<div class="network-container"> <div class="network-container" :class="{'show': show}">
<div class="network-wrapper"> <div class="network-wrapper">
<span class="network-text">网络状况不佳,请刷新重试</span> <span class="network-text">网络状况不佳,请刷新重试</span>
<van-button custom-class="network-button" round type="info" @tap="setIsConnected">刷新</van-button> <van-button custom-class="network-button" round type="info" @tap="setIsConnected">刷新</van-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -12,9 +12,15 @@ ...@@ -12,9 +12,15 @@
import store from '../../store'; import store from '../../store';
wepy.component({ wepy.component({
data: {
show: false
},
store, store,
methods: { methods: {
...mapActions(['setIsConnected']) ...mapActions(['setIsConnected'])
},
created() {
this.show = true;
} }
}); });
</script> </script>
...@@ -25,28 +31,31 @@ ...@@ -25,28 +31,31 @@
height: 100%; height: 100%;
background: #000; background: #000;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 10; z-index: -1;
.network-wrapper { .network-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
.network-text { .network-text {
color: #AAA; color: #AAA;
font-size: 12px; font-size: 24rpx;
} }
.network-button { .network-button {
margin-top: 10px; margin-top: 20rpx;
width: 90px; width: 180rpx;
font-size: 12px; font-size: 24rpx;
height: 28px; height: 56rpx;
line-height: 28px; line-height: 56rpx;
background: #FF6600; background: #FF6600;
border-color: #FF6600; border-color: #FF6600;
} }
} }
}
.show {
z-index: 10;
} }
</style> </style>
<config> <config>
......
...@@ -39,6 +39,16 @@ ...@@ -39,6 +39,16 @@
setTimeout(() => { setTimeout(() => {
this.opened = true; this.opened = true;
setTimeout(() => { setTimeout(() => {
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/images/winning.mp3';
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
this.showChest = false; this.showChest = false;
this.blur = true; this.blur = true;
this.show = true; this.show = true;
...@@ -52,8 +62,8 @@ ...@@ -52,8 +62,8 @@
created() { created() {
setTimeout(() => { setTimeout(() => {
this.showAnimation = true; this.showAnimation = true;
this.click(); // this.click();
},1000); }, 1000);
} }
}); });
</script> </script>
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
}, },
total: { total: {
type: Number, type: Number,
value: 0, value: 0
} }
}, },
data: { data: {
...@@ -129,8 +129,8 @@ ...@@ -129,8 +129,8 @@
_invalidUp: 0, _invalidUp: 0,
_invalidDown: 0, _invalidDown: 0,
_videoContexts: [], _videoContexts: [],
progress:0, progress: 0,
progressStyle:'', progressStyle: '',
loading: false loading: false
}, },
watch: { watch: {
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
}, },
attached() { attached() {
this.progress = 47; this.progress = 47;
this.progressStyle = 'width:'+this.progress+'%'; this.progressStyle = 'width:' + this.progress + '%';
this._videoContexts = [ this._videoContexts = [
wx.createVideoContext('video_0', this.$wx), wx.createVideoContext('video_0', this.$wx),
wx.createVideoContext('video_1', this.$wx), wx.createVideoContext('video_1', this.$wx),
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
if (diff === 0) return; if (diff === 0) return;
this._last = current; this._last = current;
this.playCurrent(current); this.playCurrent(current);
// this.$emit('change', { activeId: this.curQueue[current].id }); this.$emit('change', { activeId: this.curQueue[current].id });
this.loading = true; this.loading = true;
this.circular = false; this.circular = false;
...@@ -217,8 +217,7 @@ ...@@ -217,8 +217,7 @@
// console.log('circular2'); // console.log('circular2');
// this.circular = false; // this.circular = false;
// } // }
});
})
}, },
onWaiting (e) { onWaiting (e) {
this.trigger(e, 'wait'); this.trigger(e, 'wait');
......
...@@ -239,6 +239,8 @@ ...@@ -239,6 +239,8 @@
<script> <script>
let touchDotX = 0, touchDotY = 0; let touchDotX = 0, touchDotY = 0;
let timeout = null;
let timeout1 = null;
import store from '../store'; import store from '../store';
import { mapState, mapActions } from '@wepy/x'; import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core'; import wepy from '@wepy/core';
...@@ -250,22 +252,23 @@ ...@@ -250,22 +252,23 @@
}, },
data: { data: {
list:[], //商品list list: [], // 商品list
adlist:[], adlist: [],
current:5, //商品列表初次展示第几个 current: 5, // 商品列表初次展示第几个
// userInfo: {}, // userInfo: {},
swiperItem:2, swiperItem: 2,
videoList:[], videoList: [],
length: 4, length: 4,
circular:false, // 商品是否无限循环 circular: false, // 商品是否无限循环
topPage:0, topPage: 0,
lastPage:0, lastPage: 0,
currentIndex:5, //商品当前滑动到第几个 currentIndex: 5, // 商品当前滑动到第几个
authmodal:false, authmodal: false,
sign: false, sign: false,
showAnimation: false, showAnimation: false,
userImgStyle:'', userImgStyle: '',
goldNum:2500, goldNum: 2500,
awards: false
}, },
computed: { computed: {
...@@ -274,36 +277,36 @@ ...@@ -274,36 +277,36 @@
methods: { methods: {
...mapActions([ 'setIsConnected', 'setUserInfo' ]), ...mapActions([ 'setIsConnected', 'setUserInfo' ]),
moveSwiper(e){ moveSwiper(e) {
if(e.$wx.detail.source == 'touch') { if (e.$wx.detail.source == 'touch') {
let current = e.$wx.detail.current; let current = e.$wx.detail.current;
this.currentIndex = current; this.currentIndex = current;
} }
}, },
swipermoveDone(e){ swipermoveDone(e) {
if(e.$wx.detail.source == 'touch') { if (e.$wx.detail.source == 'touch') {
let current = e.$wx.detail.current; let current = e.$wx.detail.current;
let totalPage = 3; let totalPage = 3;
let nextlist=[ let nextlist = [
{value:11,text: '白色条纹马克杯,马克吐温同款11', imgsrc:'/static/images/test1.jpg', price:'¥9.89',people:2200,sku:'100004549235'}, {value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value:12,text: '白色条纹马克杯,马克吐温同款12', imgsrc:'/static/images/test2.png', price:'¥19.20',people:'2200',sku:'100004549235'}, {value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
{value:13,text: '白色条纹马克杯,马克吐温同款13', imgsrc:'/static/images/peo1.jpg', price:'¥39.08',people:2200,sku:'100004549235'}, {value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},
{value:14,text: '白色条纹马克杯,马克吐温同款14', imgsrc:'/static/images/peo2.jpg', price:'¥599.20',people:2200,sku:'100004549235'}, {value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},
{value:15,text: '白色条纹马克杯,马克吐温同款15', imgsrc:'/static/images/peo3.jpg', price:'¥2399.01',people:2200,sku:'100004549235'}, {value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}
]; ];
let that = this; let that = this;
function debounce(func,wait) { function debounce(func, wait) {
let timeout; let timeout;
return function () { return function () {
if (timeout) clearTimeout(timeout); if (timeout) clearTimeout(timeout);
let callNow = !timeout; let callNow = !timeout;
timeout = setTimeout(func, wait) timeout = setTimeout(func, wait);
if (callNow) func(); if (callNow) func();
} };
} }
/*if(current <= 2) { /* if(current <= 2) {
debounce(setTimeout(function(){ debounce(setTimeout(function(){
that.topPage +=1; that.topPage +=1;
if(that.lastPage+that.topPage >= totalPage) { if(that.lastPage+that.topPage >= totalPage) {
...@@ -314,35 +317,35 @@ ...@@ -314,35 +317,35 @@
// that.current = current+1; // that.current = current+1;
// that.currentIndex = current+1; // that.currentIndex = current+1;
},1000),500); },1000),500);
}*/ } */
if(current >= this.list.length-3) { if (current >= this.list.length - 3) {
debounce(setTimeout(function(){ debounce(setTimeout(function() {
that.lastPage +=1; that.lastPage += 1;
if(that.lastPage+that.topPage >= totalPage) { if (that.lastPage + that.topPage >= totalPage) {
that.circular = true; that.circular = true;
return; return;
} }
that.list = [ ...that.list,...nextlist]; that.list = [ ...that.list, ...nextlist];
},1000),500) }, 1000), 500);
} }
} }
}, },
toViewPage(e) { toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item let item = e.$wx.currentTarget.dataset.item;
// console.log(sku,12) // console.log(sku,12)
//解决长按触发tap事件的bug // 解决长按触发tap事件的bug
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74', appId: 'wx91d27dbf599dff74',
path: 'pages/item/detail/detail?sku='+item.sku, // 跳转小程序的路径 path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径
// 有效值 develop(开发版),trial(体验版),release(正式版) // 有效值 develop(开发版),trial(体验版),release(正式版)
envVersion: 'release', envVersion: 'release',
success(res) { success(res) {
console.log('跳转成功'); console.log('跳转成功');
} }
}) });
/* wx.navigateTo({ /* wx.navigateTo({
url: '/pages/auth' url: '/pages/auth'
});*/ }); */
}, },
touchStart (event) { touchStart (event) {
touchDotX = event.touches[0].pageX; // 获取触摸时的原点 touchDotX = event.touches[0].pageX; // 获取触摸时的原点
...@@ -366,7 +369,7 @@ ...@@ -366,7 +369,7 @@
// 手指离开屏幕时记录的坐标 // 手指离开屏幕时记录的坐标
let touchMoveX = event.changedTouches[0].pageX; let touchMoveX = event.changedTouches[0].pageX;
let touchMoveY = event.changedTouches[0].pageY; let touchMoveY = event.changedTouches[0].pageY;
let current = event.currentTarget.dataset let current = event.currentTarget.dataset;
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差 // 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差
let tmX = touchMoveX - touchDotX; let tmX = touchMoveX - touchDotX;
let tmY = touchMoveY - touchDotY; let tmY = touchMoveY - touchDotY;
...@@ -394,7 +397,7 @@ ...@@ -394,7 +397,7 @@
} }
}, },
getUserInfo (e) { getUserInfo (e) {
if(e.$wx.detail.userInfo) { if (e.$wx.detail.userInfo) {
this.setUserInfo(e.$wx.detail.userInfo); this.setUserInfo(e.$wx.detail.userInfo);
this.authmodal = false; this.authmodal = false;
} }
...@@ -402,11 +405,11 @@ ...@@ -402,11 +405,11 @@
changeVideo(e) { changeVideo(e) {
this.setIsConnected(); this.setIsConnected();
console.log(this.length, e.activeId); console.log(this.length, e.activeId);
if (this.length - e.activeId === 1) { // if (this.length - e.activeId === 1) {
this.videoList = [{id: e.activeId + 2, url: 'https://ip1707952229.mobgslb.tbcache.com/youku/6974c3708c0337150e1743b1c/03000801005EA2A6C8FB4C2003E8807282A547-8207-4F52-9663-969096765248.mp4?sid=158960247500010009412_00_Bac09720260d484f23ac2ccebe5206930&sign=b76f4099e108fc306d3db993d1bec0a8&ctype=50&ali_redirect_domain=vali.cp31.ott.cibntv.net&ali_redirect_ex_ftag=5898cd25832bbff232de6d9fa668e8ddf8bacc5fef3f2e7b&ali_redirect_ex_tmining_ts=1589602477&ali_redirect_ex_tmining_expire=3600&ali_redirect_ex_hot=111'}]; // this.videoList = [{id: e.activeId + 2, url: 'https://ip1707952229.mobgslb.tbcache.com/youku/6974c3708c0337150e1743b1c/03000801005EA2A6C8FB4C2003E8807282A547-8207-4F52-9663-969096765248.mp4?sid=158960247500010009412_00_Bac09720260d484f23ac2ccebe5206930&sign=b76f4099e108fc306d3db993d1bec0a8&ctype=50&ali_redirect_domain=vali.cp31.ott.cibntv.net&ali_redirect_ex_ftag=5898cd25832bbff232de6d9fa668e8ddf8bacc5fef3f2e7b&ali_redirect_ex_tmining_ts=1589602477&ali_redirect_ex_tmining_expire=3600&ali_redirect_ex_hot=111'}];
this.length += 1; // this.length += 1;
console.log('add video'); // console.log('add video');
} // }
}, },
deleteAnimation (current) { deleteAnimation (current) {
if (current && current.itemid != undefined) { if (current && current.itemid != undefined) {
...@@ -420,12 +423,12 @@ ...@@ -420,12 +423,12 @@
}); });
this.list = list; this.list = list;
let that = this; let that = this;
//如果剩下4个就不让他循环了,这时候就一屏显示出来了 // 如果剩下4个就不让他循环了,这时候就一屏显示出来了
if(list.length <= 4) { if (list.length <= 4) {
this.circular = false; this.circular = false;
} }
if(current.itemid >= list.length -1) { if (current.itemid >= list.length - 1) {
this.current = this.currentIndex -1; this.current = this.currentIndex - 1;
} }
setTimeout(function() { setTimeout(function() {
let newlist = that.list.filter((item, index) => index != current.itemid); let newlist = that.list.filter((item, index) => index != current.itemid);
...@@ -461,6 +464,16 @@ ...@@ -461,6 +464,16 @@
timeout = null; timeout = null;
timeout1 = null; timeout1 = null;
} else { } else {
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/images/supermarie.mp3';
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
timeout = setTimeout(() => { timeout = setTimeout(() => {
that.showAnimation = that.sign; that.showAnimation = that.sign;
timeout1 = setTimeout(() => { timeout1 = setTimeout(() => {
...@@ -488,20 +501,20 @@ ...@@ -488,20 +501,20 @@
} }
const openid = '提示:请注意 encodeURIComponent() 函数 与 encodeURI() 函数的区别之处,前者假定它的参数是 URI 的一部分(比如协议、主机名、路径或查询字符串)。因此 encodeURIComponent() 函数将转义用于分隔 URI 各个部分的标点符号。'; const openid = '提示:请注意 encodeURIComponent() 函数 与 encodeURI() 函数的区别之处,前者假定它的参数是 URI 的一部分(比如协议、主机名、路径或查询字符串)。因此 encodeURIComponent() 函数将转义用于分隔 URI 各个部分的标点符号。';
return { return {
title: '自定义转发标题', title: '自定义转发标题',
path: `/pages/index?openid=${openid}`, path: `/pages/index?openid=${openid}`,
imageUrl: '', imageUrl: '',
success: function(res) { success: function(res) {
let shareId = res.shareTickets[0]; let shareId = res.shareTickets[0];
console.log('shareId', shareId) console.log('shareId', shareId);
// 转发成功 // 转发成功
console.log(res) console.log(res);
}, },
fail: function(res) { fail: function(res) {
// 转发失败 // 转发失败
console.log(res) console.log(res);
} }
} };
}, },
getAwards: function() { getAwards: function() {
wx.navigateTo({ wx.navigateTo({
...@@ -514,7 +527,7 @@ ...@@ -514,7 +527,7 @@
created () { created () {
let self = this; let self = this;
let statusHeight = this.$app.$options.globalData.statusBarHeight || ''; let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.userImgStyle = 'top:'+statusHeight+'px') statusHeight && (this.userImgStyle = 'top:' + statusHeight + 'px');
if (store.state.userInfo) { if (store.state.userInfo) {
this.userInfo = store.state.userInfo; this.userInfo = store.state.userInfo;
} else { } else {
...@@ -526,16 +539,16 @@ ...@@ -526,16 +539,16 @@
}); });
} }
this.list = [ this.list = [
{value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc:'/static/images/test1.jpg', price:'¥399.00',people:2200,sku:'100004549235'}, {value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc: '/static/images/test1.jpg', price: '¥399.00', people: 2200, sku: '100004549235'},
{value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc:'/static/images/test2.png', price:'¥1399.22',people:2200,sku:'2004203'}, {value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc: '/static/images/test2.png', price: '¥1399.22', people: 2200, sku: '2004203'},
{value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc:'/static/images/peo1.jpg', price:'¥199.22',people:2200,sku:'17818909707'}, {value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc: '/static/images/peo1.jpg', price: '¥199.22', people: 2200, sku: '17818909707'},
{value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc:'/static/images/peo2.jpg', price:'¥134.12',people:2200,sku:'67704484242'}, {value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc: '/static/images/peo2.jpg', price: '¥134.12', people: 2200, sku: '67704484242'},
{value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc:'/static/images/peo3.jpg', price:'¥194.22',people:2200,sku:'100004549235'}, {value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc: '/static/images/peo3.jpg', price: '¥194.22', people: 2200, sku: '100004549235'},
{value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc:'/static/images/peo1.jpg', price:'¥292.22',people:2200,sku:'100004549235'}, {value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc: '/static/images/peo1.jpg', price: '¥292.22', people: 2200, sku: '100004549235'},
{value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc:'/static/images/test1.jpg', price:'¥1399.92',people:2200,sku:'100004549235'}, {value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc: '/static/images/test1.jpg', price: '¥1399.92', people: 2200, sku: '100004549235'},
{value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc:'/static/images/test2.png', price:'¥1399.98',people:2200,sku:'100004549235'}, {value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc: '/static/images/test2.png', price: '¥1399.98', people: 2200, sku: '100004549235'},
{value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc:'/static/images/peo3.jpg', price:'¥1399.78',people:2200,sku:'100004549235'}, {value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc: '/static/images/peo3.jpg', price: '¥1399.78', people: 2200, sku: '100004549235'},
{value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc:'/static/images/peo2.jpg', price:'¥1399.67',people:2200,sku:'100004549235'} {value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc: '/static/images/peo2.jpg', price: '¥1399.67', people: 2200, sku: '100004549235'}
]; ];
let urls = [ let urls = [
// 'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4', // 'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4',
...@@ -567,8 +580,8 @@ ...@@ -567,8 +580,8 @@
{imgsrc: '/static/images/test1.jpg', text: '小8刚刚参与了抽奖'} {imgsrc: '/static/images/test1.jpg', text: '小8刚刚参与了抽奖'}
]; ];
// console.log(this.$app.$options.globalData.info,111) // console.log(this.$app.$options.globalData.info,111)
//如果已经存在store里就不用再获取用户信息了 // 如果已经存在store里就不用再获取用户信息了
if(this.userInfo) return; if (this.userInfo) return;
wx.getSetting({ wx.getSetting({
success: res => { success: res => {
if (res.authSetting['scope.userInfo']) { if (res.authSetting['scope.userInfo']) {
...@@ -576,7 +589,7 @@ ...@@ -576,7 +589,7 @@
wx.getUserInfo({ wx.getUserInfo({
success: res => { success: res => {
// 可以将 res 发送给后台解码出 unionId // 可以将 res 发送给后台解码出 unionId
if(res.userInfo) { if (res.userInfo) {
that.setUserInfo(res.userInfo); that.setUserInfo(res.userInfo);
// that.userInfo = res.userInfo; // that.userInfo = res.userInfo;
} }
...@@ -584,22 +597,22 @@ ...@@ -584,22 +597,22 @@
// 所以此处加入 callback 以防止这种情况 // 所以此处加入 callback 以防止这种情况
if (that.userInfoReadyCallback) { if (that.userInfoReadyCallback) {
that.userInfoReadyCallback(res => { that.userInfoReadyCallback(res => {
that.setUserInfo(res.userInfo||{}); that.setUserInfo(res.userInfo || {});
// that.userInfo = res.userInfo||{}; // that.userInfo = res.userInfo||{};
}) });
} }
} }
}) });
}else{ } else {
that.authmodal = true; that.authmodal = true;
} }
} }
}); });
}, },
onShow() { onShow() {
//从其他小程序回来可以在当前生命周期检测到,但是这个方法,自己的小程序页面返回也会进入 // 从其他小程序回来可以在当前生命周期检测到,但是这个方法,自己的小程序页面返回也会进入
console.log('页面show!!') console.log('页面show!!');
}, }
}); });
</script> </script>
<config> <config>
......
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