Commit aef08587 by 李伟康

修复

1 parent d3effbfe
...@@ -393,7 +393,9 @@ Page({ ...@@ -393,7 +393,9 @@ Page({
} }
}) })
}, },
getGoodscouponList(id) { async getGoodscouponList(id) {
const res = await wx.p.router.intercept(false)
if (res) return
id = id ? id : this.data.id id = id ? id : this.data.id
wx.p.api.shopmallApi wx.p.api.shopmallApi
.getGoodscouponList({ .getGoodscouponList({
...@@ -513,6 +515,7 @@ Page({ ...@@ -513,6 +515,7 @@ Page({
*/ */
onLoginSuccess() { onLoginSuccess() {
this.getUserAddressDefault() this.getUserAddressDefault()
this.getGoodscouponList()
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
......
...@@ -12,10 +12,11 @@ Page({ ...@@ -12,10 +12,11 @@ Page({
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
if (code == '0') { if (code == '0') {
// wx.$Track.setTrack({}, 4) // wx.$Track.setTrack({}, 4)
wx.$authStatus = true wx.$LoginStatus = true
// wx.$util.removeSystemStorage() // wx.$util.removeSystemStorage()
wx.p.storage.rm('userInfo') wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId') wx.p.storage.rm('sessionId')
wx.p.storage.rm('isVIP')
wx.p.router.back(prevPage => { wx.p.router.back(prevPage => {
prevPage.setData({ prevPage.setData({
userInfo: null, userInfo: null,
......
...@@ -126,6 +126,9 @@ Page({ ...@@ -126,6 +126,9 @@ Page({
wx.hideLoading() wx.hideLoading()
} catch (error) { } catch (error) {
this.showTips(error || '服务不可用') this.showTips(error || '服务不可用')
setTimeout(() => {
this.onLoad()
}, 1500)
} }
}, },
/**微信登录 */ /**微信登录 */
...@@ -150,13 +153,15 @@ Page({ ...@@ -150,13 +153,15 @@ Page({
else throw message else throw message
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.onLoad()
this.showTips(error || '服务不可用') this.showTips(error || '服务不可用')
setTimeout(() => {
this.onLoad()
}, 1500)
} }
}, },
/**C端登录回调 */ /**C端登录回调 */
customerLoginCallBack(data) { customerLoginCallBack(data) {
wx.$authStatus = false wx.$LoginStatus = false
wx.p.storage.set('userInfo', data) wx.p.storage.set('userInfo', data)
wx.p.storage.set('sessionId', data.sessionId) wx.p.storage.set('sessionId', data.sessionId)
// 返回上一页 // 返回上一页
......
...@@ -36,7 +36,7 @@ Page({ ...@@ -36,7 +36,7 @@ Page({
data, data,
message message
} = await wx.p.api.userApi.login() } = await wx.p.api.userApi.login()
wx.$authStatus = code != 0 wx.$LoginStatus = code != 0
if (data) wx.p.storage.set('merchant_info', { if (data) wx.p.storage.set('merchant_info', {
merchantId: data.merchantId, merchantId: data.merchantId,
merchantName: data.merchantName merchantName: data.merchantName
...@@ -48,6 +48,7 @@ Page({ ...@@ -48,6 +48,7 @@ Page({
} else { } else {
wx.p.storage.rm('userInfo') wx.p.storage.rm('userInfo')
wx.p.storage.rm('sessionId') wx.p.storage.rm('sessionId')
} }
console.log('登陆信息:', data) console.log('登陆信息:', data)
if (options.url) { if (options.url) {
...@@ -56,6 +57,7 @@ Page({ ...@@ -56,6 +57,7 @@ Page({
// 默认跳转到首页 // 默认跳转到首页
wx.p.router.goHome() wx.p.router.goHome()
} catch (error) { } catch (error) {
wx.$LoginStatus = true //请求失败默认未登录
console.log(error) console.log(error)
wx.p.wxApi.showToast(String(error)) wx.p.wxApi.showToast(String(error))
wx.p.router.goHome() wx.p.router.goHome()
......
...@@ -59,9 +59,10 @@ Component({ ...@@ -59,9 +59,10 @@ Component({
}, },
changePage(e) { changePage(e) {
let { let {
current current,
source
} = e.detail } = e.detail
this.setData({ if(source == 'autoplay' || source == 'touch') this.setData({
bannerIndex: current bannerIndex: current
}) })
}, },
......
<view class="banner"> <view class="banner">
<swiper class="swiper" bindchange="changePage" autoplay interval="5000" current="{{bannerIndex}}"> <swiper class="swiper" bindanimationfinish="changePage" autoplay interval="5000" current="{{bannerIndex}}">
<block wx:for="{{bannerList}}" wx:key="index"> <block wx:for="{{bannerList}}" wx:key="index">
<swiper-item> <swiper-item>
<image webp src="{{item.bannerImg}}" class="banner-img" bindtap="jumpGoods" data-item="{{item}}" data-bannerType="{{item.bannerType}}" data-id="{{item.goods.id}}" data-url="{{item.linkUrl}}" data-equity="{{item.equity}}"></image> <image webp src="{{item.bannerImg}}" class="banner-img" bindtap="jumpGoods" data-item="{{item}}" data-bannerType="{{item.bannerType}}" data-id="{{item.goods.id}}" data-url="{{item.linkUrl}}" data-equity="{{item.equity}}"></image>
......
...@@ -85,13 +85,14 @@ class Router { ...@@ -85,13 +85,14 @@ class Router {
/** /**
* *
* @param {*} auto 是否自动跳转到登录,默认自动跳转 * @param {*} auto 是否自动跳转到登录,默认自动跳转
* @param {*} callBack true未登录 false已登录
*/ */
async intercept(auto = true) { async intercept(auto = true) {
const authStatus = wx.$authStatus; const authStatus = wx.$LoginStatus
if (authStatus) { if (authStatus) {
if (auto) wx.navigateTo({ if (auto) wx.navigateTo({
url: '/pages/Login/Login', url: '/pages/Login/Login',
}); })
return true; return true;
} else { } else {
return false; return false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!