Commit e3fc0f40 by wenyang

商品详细页面浏览器打开时不需要分享,并且在没有登录的状态时默认游客登录

parent 898d6d66
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<uni-popup-share @select="sharechange"></uni-popup-share> <uni-popup-share @select="sharechange"></uni-popup-share>
</uni-popup> </uni-popup>
</view> </view>
<view class="" style="width: 40rpx;height: 40rpx;padding-right: 20rpx;"> <view v-if="isWxH5" class="" style="width: 40rpx;height: 40rpx;padding-right: 20rpx;">
<image class="image" @click="reinvite" src="../../static/fastentry/Slice122.png" mode=""></image> <image class="image" @click="reinvite" src="../../static/fastentry/Slice122.png" mode=""></image>
</view> </view>
<view class="" style="width: 40rpx;height: 40rpx; "> <view class="" style="width: 40rpx;height: 40rpx; ">
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
}, },
data() { data() {
return { return {
isWxH5:false,
bannerViewType: '1', bannerViewType: '1',
swiperList: [], swiperList: [],
current : 0, current : 0,
...@@ -256,13 +257,30 @@ ...@@ -256,13 +257,30 @@
this.sharelogin = false this.sharelogin = false
} }
}, },
isWx_Miniprogram(){
// 判断是否在微信内
// const ua = navigator.userAgent.toLowerCase();
// if (ua.includes('micromessenger') && window.__wxjs_environment === 'miniprogram') {
// this.isWxH5 = true;
// } else {
// this.isWxH5 = false;
// }
if(this.isWeiXin()){
this.isWxH5 = true;
}else{
this.isWxH5 = false;
}
// #ifdef APP-PLUS
this.isWxH5 = true;
// #endif
},
/** /**
* 判断是否为微信浏览器 * 判断是否为微信浏览器
* 兼容ios * 兼容ios
* */ * */
// isWeiXin() { isWeiXin() {
// return /micromessenger/i.test(navigator.userAgent.toLowerCase()) || typeof navigator.wxuserAgent !== 'undefined' return /micromessenger/i.test(navigator.userAgent.toLowerCase()) || typeof navigator.wxuserAgent !== 'undefined'
// }, },
// openApp(url, callback) { // openApp(url, callback) {
// let {isAndroid, isIOS, isIOS9} = judgePhoneType(); // let {isAndroid, isIOS, isIOS9} = judgePhoneType();
// if(this.isWeiXin()){ // if(this.isWeiXin()){
...@@ -780,6 +798,21 @@ ...@@ -780,6 +798,21 @@
this.realName = res.data.realName; this.realName = res.data.realName;
} }
}) })
},
init() {
if (!uni.getStorageSync('isLogin')) {
api.loginVerification({
"loginType": 1
}).then((res) => {
if (res['success']) {
this.userId = String(res['data']['userId']);
uni.setStorageSync('isLogin', '1');
uni.setStorageSync('cffp_userId', this.userId);
uni.setStorageSync('loginType', 'visitor');
uni.setStorageSync('uni-token', res.data['token']);
}
})
}
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -814,6 +847,8 @@ ...@@ -814,6 +847,8 @@
}, },
onShow() { onShow() {
//this.switchTab(1); //this.switchTab(1);
this.init();
this.isWx_Miniprogram();
this.tabType = 1; this.tabType = 1;
this.courseDetail(); this.courseDetail();
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
......
...@@ -7,6 +7,7 @@ const whiteList = [ ...@@ -7,6 +7,7 @@ const whiteList = [
'/pages/orderDetail/orderDetail', '/pages/orderDetail/orderDetail',
'/pages/courseDetail/courseDetail', '/pages/courseDetail/courseDetail',
'/pages/courselist/courselist', '/pages/courselist/courselist',
'/pages/index/index',
] ]
export default function initApp(){ export default function initApp(){
uni.addInterceptor('navigateTo', { uni.addInterceptor('navigateTo', {
......
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