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');
......
This diff is collapsed.
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