Commit d487ee16 authored by June's avatar June

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

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