Browse Source

增加无连接网络状态

master
zhengshuiqi 3 years ago
parent
commit
be3936a1bf
  1. 3
      pages/account/myCoupons.vue
  2. 24
      pages/index/index.vue
  3. 4
      pages/login/index.vue

3
pages/account/myCoupons.vue

@ -23,7 +23,8 @@
</view>
<view>sorry,no coupons~</view>
<view>
<button @click="goPage(1)">Go to the home page</button>
<button @click="goPage(1)">Get coupons</button>
<!-- <button @click="goPage(1)">Go to the home page</button> -->
</view>
</view>
</view>

24
pages/index/index.vue

@ -216,7 +216,13 @@
uni.getNetworkType({
success: (res) => {
console.log(res.networkType, s);
if (res.networkType !== 'none') {
if (res.networkType == 'none') {
uni.showToast({
icon: 'none',
title: 'Please connect to the network',
duration: 3000,
})
} else if (res.networkType !== 'none') {
that.typee = 2;
clearInterval(time);
let home = 'HOME'
@ -323,18 +329,18 @@
},
methods: {
checkNetwork(){
checkNetwork() {
uni.getNetworkType({
complete:function(res){
complete: function(res) {
// console.log(res.networkType)
if(res.networkType=='none'){
setTimeout(()=>{
if (res.networkType == 'none') {
setTimeout(() => {
uni.showToast({
icon:'none',
title:'Please connect to the network',
duration:3000,
icon: 'none',
title: 'Please connect to the network',
duration: 3000,
})
},200)
}, 200)
// return false
}
}

4
pages/login/index.vue

@ -207,8 +207,8 @@
uni.setStorageSync('isLogin',1)
uni.setStorageSync('user_info',res.data)
uni.switchTab({
// delta: 1
url:'../index/index'
delta: 1
// url:'../index/index'
})
}else{
if(res.data){

Loading…
Cancel
Save