Commit 75dfbac4 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 7d4fae55
...@@ -17,7 +17,7 @@ var systemInfoMixin = { ...@@ -17,7 +17,7 @@ var systemInfoMixin = {
} }
}, },
mounted() { mounted() {
const systemInfo = com.mingce.wxhelibookgetSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
this.sdkVersion = systemInfo.hostSDKVersion; this.sdkVersion = systemInfo.hostSDKVersion;
this.windowWidth = this.dataCheck(systemInfo.windowWidth); this.windowWidth = this.dataCheck(systemInfo.windowWidth);
this.windowHeight = this.dataCheck(systemInfo.windowHeight); this.windowHeight = this.dataCheck(systemInfo.windowHeight);
......
...@@ -147,7 +147,7 @@ function postPhone(data, callback) { ...@@ -147,7 +147,7 @@ function postPhone(data, callback) {
// 请求token // 请求token
function requestToken(data, callback) { function requestToken(data, callback) {
let url = `${config["BASE_URL"]}/user/ttLogin`; let url = `${config["BASE_URL"]}/user/wechatlogin`;
let header = { let header = {
pkgName: PAKEAGE_NAME, pkgName: PAKEAGE_NAME,
version: VERSION_CODE, version: VERSION_CODE,
......
...@@ -139,15 +139,10 @@ ...@@ -139,15 +139,10 @@
login({ login({
vedioId: bookId, vedioId: bookId,
code: res.code, code: res.code,
anonymousCode: res.anonymousCode,
thirdParam: thirdParam thirdParam: thirdParam
}) })
}, },
fail(res) { fail(res) {
// 登录授权失败
uni.navigateTo({
url: `/pages/warehouse/warehousetemp`,
})
}, },
}); });
......
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
signType: wxParams.signType, signType: wxParams.signType,
paySign: wxParams.paySign, paySign: wxParams.paySign,
success(res) { success(res) {
that.queryOrderStatus(largeType,wxParams.sigData.outTradeNo); that.queryOrderStatus(largeType,wxData.tidStr);
}, },
fail(res) {} fail(res) {}
}) })
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image> margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content"> <view class="content">
<button class="button1" type="default" size="default" @click="tapMakePhoneCall">客服电话</button> <button class="button1" type="default" size="default" @click="tapMakePhoneCall">客服电话</button>
<button class="button2" open-type="im" data-im-id="93264117800">客服在线</button> <!-- <button class="button2" open-type="im" data-im-id="93264117800">客服在线</button> -->
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
......
...@@ -54,14 +54,7 @@ ...@@ -54,14 +54,7 @@
}; };
}, },
onLoad() { onLoad() {
this.getCategoryData();
watchUserInfoChange((info) => {
this.userInfo = info.userInfo
}, this);
},
onShow() {
this.refreshUserData();
}, },
computed: { computed: {
showEmpty: function() { showEmpty: function() {
...@@ -96,7 +89,18 @@ ...@@ -96,7 +89,18 @@
deep: true deep: true
} }
}, },
methods: { methods: {
show(){
console.log("123123123")
this.getCategoryData();
watchUserInfoChange((info) => {
this.userInfo = info.userInfo
}, this);
this.refreshUserData();
},
hide() {
},
readyCategory() { readyCategory() {
setTimeout(() => { setTimeout(() => {
this.initHeight() this.initHeight()
......
<template> <template>
<view class="body"> <view v-if="localActiviteFlag==1" class="body">
<view style="height: 92%;"> <view style="height: 92%;">
<bookshelf v-show="currentPage==0" ref="index" /> <bookshelf v-show="currentPage==0" ref="index" />
<warehouse v-show="currentPage==1" ref="recommend" /> <warehouse v-show="currentPage==1" ref="recommend" />
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
我的 我的
</view> </view>
</view> </view>
</view>
<view v-else class="body">
<view style="height: 95%;">
<warehouse v-show="currentPage==1" ref="recommend" />
</view>
</view> </view>
</template> </template>
...@@ -60,11 +66,14 @@ ...@@ -60,11 +66,14 @@
}, },
data() { data() {
return { return {
currentPage: 1 currentPage: 1,
localActiviteFlag: 0
} }
}, },
onLoad(options) { onLoad(options) {
let index = options.index ?? '' let index = options.index ?? ''
this.localActiviteFlag = options.activiteFlag;
console.log("activiteFlag====", options.activiteFlag)
if (index != '' && index != undefined) { if (index != '' && index != undefined) {
this.currentPage = index this.currentPage = index
} }
...@@ -86,11 +95,14 @@ ...@@ -86,11 +95,14 @@
mounted() { mounted() {
// 渲染完成 初始化首页数据 // 渲染完成 初始化首页数据
this.loadComponentData(); this.loadComponentData();
let that = this if (this.localActiviteFlag == 1) {
uni.$on('goWareHouse', function(data) { let that = this
that.tabChange(1) uni.$on('goWareHouse', function(data) {
}) that.tabChange(1)
})
}
}, },
methods: { methods: {
tabChange(index) { tabChange(index) {
...@@ -99,12 +111,18 @@ ...@@ -99,12 +111,18 @@
this.loadComponentData(); this.loadComponentData();
}, },
loadComponentData() { loadComponentData() {
if (this.currentPage == 0) { if (this.localActiviteFlag == 1) {
this.$refs.index.show(); if (this.currentPage == 0) {
} else if (this.currentPage == 1) { this.$refs.index.show();
this.$refs.recommend.show(); } else if (this.currentPage == 1) {
} else if (this.currentPage == 2) { this.$refs.recommend.show();
this.$refs.user.show(); } else if (this.currentPage == 2) {
this.$refs.user.show();
}
} else {
if (this.currentPage == 1) {
this.$refs.recommend.show();
}
} }
} }
} }
......
...@@ -71,36 +71,33 @@ ...@@ -71,36 +71,33 @@
key: 'firstBookId', key: 'firstBookId',
data: bookId data: bookId
}); });
} }
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: function(loginRes) { success: function(loginRes) {
that.post({ that.post({
url: '/user/wechatlogin', url: '/user/wechatlogin',
data: { data: {
vedioId: bookId, vedioId: bookId,
code: loginRes.code, code: loginRes.code,
thirdParam: thirdParam thirdParam: thirdParam
}, },
showLoading: false, showLoading: false,
success: ({ success: ({
data data
}) => { }) => {
app.globalData.userId = data.idcode; app.globalData.userId = data.idcode;
saveToken(data.token) saveToken(data.token)
setTimeout(() => { setTimeout(() => {
redirectTo('home'); // redirectTo('home?activiteFlag='+data.activiteFlag);
}, 1000); redirectTo('home?activiteFlag='+0);
} }, 1000);
}); }
}, });
fail: function(err) { },
// 登录授权失败 fail: function(err) {
uni.navigateTo({ }
url: `/pages/warehouse/warehousetemp`,
})
}
}); });
} }
} }
......
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