Commit d487ee16 authored by June's avatar June

fix:弹窗异步问题以及登录失效bug

parent ac968755
......@@ -5,6 +5,7 @@ import dayjs from 'dayjs'
import { removeStorage } from '@/lib/storage/index.js'
export default {
onLaunch: async function() {
await this.checkUpdate() // 检查更新
this.setMobileData() // 获取系统信息和胶囊信息
const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync(): {}
this.$store.state.user.appid = extConfig.appid
......@@ -23,9 +24,7 @@ export default {
removeStorage('search-history')
}
}
})
this.checkUpdate() // 检查更新
})
},
globalData: {
......
......@@ -127,10 +127,11 @@
open() {
this.showPopup = true
this.$nextTick(() => {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.showTrans = true
}, 50);
this.showTrans = true
// clearTimeout(this.timer)
// this.timer = setTimeout(() => {
// this.showTrans = true
// }, 50);
})
this.$emit('popchange', {
show: true
......
......@@ -4,6 +4,7 @@ import { isObeject, isFunction } from "@/utils/types.js"
import Validator from "@/utils/validate.js"
import { login_slilen } from '@/utils/modules/login.js'
import store from '@/store/index.js'
import { removeStorage } from '@/lib/storage'
/**
* @desc 请求 所有的状态码都在这里处理
......@@ -54,6 +55,9 @@ async function successRes(res, options, resolve, reject) {
return Toast({title: data.rep_msg})
break;
case -3:
store.state.user.token = ''
store.state.userInfo = {}
removeStorage('token')
Toast({
title: '登录已失效,请重新登录',
cb: () => uni.navigateTo({
......
......@@ -138,6 +138,7 @@ import { searchGoods, goodsSku } from '@/apis/goods.js'
import { baseUrl } from '@/config/index.js'
import common_share from '@/mixins/setting_share.js'
import { mapState, mapActions } from 'vuex'
import { debounce } from '@/utils/common.js'
let cat_id = 0
export default {
......@@ -245,7 +246,7 @@ export default {
// },
// 点击拉起弹窗
async handlePop(goods) {
handlePop: debounce(async function(goods) {
try{
uni.showLoading({
title: '加载中...',
......@@ -272,7 +273,7 @@ export default {
uni.hideLoading()
//TODO handle the exception
}
}
}, 800)
}
}
// disableScroll: true
......
......@@ -61,9 +61,17 @@
this.$checkLogin(makePhoneCall)
},
changePopup: throttle(function() {
changePopup() {
uni.showLoading({
title: '加载中...',
mask: true
})
this.$parent.handlePopup()
}),
let timer = setTimeout(() => {
clearTimeout(timer)
uni.hideLoading()
}, 300)
},
// 收藏商品
changeCollect() {
......
......@@ -330,7 +330,24 @@ export default {
res.eventChannel.emit('acceptDataFromOpenerPage', { detail: this.detail, skuData: this.skuData })
}
})
}
},
// sku弹窗
// handlePopup: debounce(function() {
// const skuData = this.skuData
// const detail = this.detail
// if(!skuData || !skuData.length) return this.$toast({title: '该商品暂无库存'})
// const params = {
// goodsInfo: {
// cover: `${this.baseUrl}/${detail.goods_thumb}`,
// title: detail.goods_name,
// is_inquiry: detail.is_inquiry,
// unit: skuData[0].unit
// },
// skuData: skuData
// }
// this.$refs.popup.show(params)
// }, 800)
}
}
</script>
......
......@@ -41,6 +41,7 @@
import price from '@/components/price/index.vue'
import { goodsSku } from '@/apis/goods.js'
import { baseUrl } from '@/config/index.js'
import { debounce } from '@/utils/common.js'
export default {
props: {
title: {
......@@ -64,7 +65,7 @@ export default {
},
methods: {
async handlePop(goods) {
handlePop: debounce(async function(goods) {
try{
uni.showLoading({
title: '加载中...',
......@@ -91,7 +92,7 @@ export default {
uni.hideLoading()
//TODO handle the exception
}
}
}, 800)
}
}
</script>
......@@ -116,7 +117,6 @@ export default {
.cart-btn {
width: 34rpx;
height: 32rpx;
padding: 0 20rpx;
}
}
}
......
......@@ -193,7 +193,7 @@ import LoadMore from '@/utils/load-more.js'
import { checkLogin } from '@/utils/modules/login.js'
import indexModule from './index.js'
import { baseUrl } from '@/config/index.js'
import { makePhoneCall, throttle } from '@/utils/common.js'
import { makePhoneCall, throttle, debounce } from '@/utils/common.js'
import { goodsSku } from '@/apis/goods.js'
import { mapState, mapActions } from 'vuex'
import common_share from '@/mixins/setting_share.js'
......@@ -334,7 +334,7 @@ export default {
},
// 点击拉起弹窗
async handlePop(goods) {
handlePop: debounce(async function(goods) {
try{
uni.showLoading({
title: '加载中...',
......@@ -359,7 +359,7 @@ export default {
uni.hideLoading()
//TODO handle the exception
}
}
}, 800)
}
}
</script>
......
......@@ -126,8 +126,7 @@ export default {
wait_receive: 0,
wait_send: 0
},
commentCounts: 0,
version: ''
commentCounts: 0
}
},
......@@ -138,11 +137,6 @@ export default {
})
},
created() {
const accountInfo = uni.getAccountInfoSync()
this.version = accountInfo.miniProgram.version
},
onShow() { // 获取更新用户信息
this.init()
},
......
......@@ -137,12 +137,11 @@ import price from '@/components/price/index.vue'
import { searchGoods, goodsSku } from '@/apis/goods.js'
import LoadMore from '@/utils/load-more.js'
import { baseUrl } from '@/config/index.js'
import { debounce } from '@/utils/common.js'
export default {
data() {
return {
baseUrl,
searchList: [],
current_tab: 1, // sort参数从1开始,为了方便
searchParams: {
......@@ -243,7 +242,7 @@ export default {
},
// 点击拉起弹窗
async handlePop(goods) {
handlePop: debounce(async function(goods) {
try{
uni.showLoading({
title: '加载中...',
......@@ -268,7 +267,7 @@ export default {
uni.hideLoading()
//TODO handle the exception
}
}
}, 800)
}
}
</script>
......@@ -392,7 +391,7 @@ export default {
.cart-icon {
width: 44rpx;
height: 42rpx;
padding: 5rpx 20rpx;
padding: 5rpx 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