|
@@ -135,7 +135,7 @@
|
|
|
import uniStars from '@/components/uni-stars/uni-stars.vue'
|
|
|
import { userInfoLogin, queryHomeInfo } from "@/api/use.js"
|
|
|
import { queryPreferred } from "@/api/product.js"
|
|
|
- import { mapMutations} from 'vuex';
|
|
|
+ import { mapState,mapMutations} from 'vuex';
|
|
|
export default {
|
|
|
components:{
|
|
|
tuiSkeleton,
|
|
@@ -145,6 +145,11 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ webviewStyles: {
|
|
|
+ progress: {
|
|
|
+ color: '#FF3333'
|
|
|
+ }
|
|
|
+ },
|
|
|
userID:'',
|
|
|
inputActive:'float',
|
|
|
hotSearchText:'你想要的这里都有',
|
|
@@ -175,16 +180,15 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.initData()
|
|
|
+ this.getHomeInformation()
|
|
|
+ this.getOrganizeProducts()
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['hasLogin','userInfo','isWxAuthorize'])
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations(['login','logout']),
|
|
|
- async initData(){
|
|
|
- this.skeletonShow = true;
|
|
|
- let hotGoodsList = await this.$util.json('hotGoodsList');
|
|
|
- this.hotGoodsList = hotGoodsList;
|
|
|
- },
|
|
|
- getCheekeyCode(){
|
|
|
+ getWxAuthorize(){
|
|
|
authorize.getCode('weixin').then(wechatcode =>{// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
|
|
|
authorize.getUserInfo('weixin').then(wxResponse =>{
|
|
|
userInfoLogin({code:wechatcode,encryptedData:wxResponse.encryptedData,iv:wxResponse.iv}).then(response =>{
|
|
@@ -197,9 +201,6 @@
|
|
|
uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
|
|
|
if(response.data.userIdentity ==1){
|
|
|
this.$api.navigateTo('/market/pages/index/index')
|
|
|
- }else{
|
|
|
- this.getHomeInformation()
|
|
|
- this.getOrganizeProducts()
|
|
|
}
|
|
|
}).catch(response =>{
|
|
|
this.isLogin = false;
|
|
@@ -207,8 +208,6 @@
|
|
|
uni.removeStorageSync('sessionid')
|
|
|
uni.setStorageSync('sessionid','JSESSIONID='+response.data)
|
|
|
this.$store.commit('updateStatus',response.data)
|
|
|
- this.getHomeInformation()
|
|
|
- this.getOrganizeProducts()
|
|
|
})
|
|
|
})
|
|
|
})
|
|
@@ -218,13 +217,17 @@
|
|
|
let data = res.data;
|
|
|
this.bannerImageList = data.bannerImageList
|
|
|
this.mallPageModules = data.mallPageModules
|
|
|
- this.$store.commit('updateAllNum',data.shoppingCartCount)
|
|
|
this.firstModulesName= data.firstModulesName
|
|
|
this.secondModulesName= data.secondModulesName
|
|
|
this.firstModulesImage= data.firstModulesImage
|
|
|
this.secondModulesImage= data.secondModulesImage
|
|
|
this.thirdModulesName= data.thirdModulesName
|
|
|
this.skeletonShow = false;
|
|
|
+ if(this.isWxAuthorize){
|
|
|
+ this.$store.commit('updateAllNum',data.shoppingCartCount)
|
|
|
+ }else{
|
|
|
+ this.$store.commit('updateAllNum',0)
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
getOrganizeProducts(){//获取模块三商品
|
|
@@ -264,8 +267,8 @@
|
|
|
console.log(e.detail.query)
|
|
|
},
|
|
|
showTost(){
|
|
|
- this.$util.msg("正在开发中,敬请期待~",2000)
|
|
|
- // this.$api.navigateTo(`/market/pages/login/login`)
|
|
|
+ // this.$util.msg("正在开发中,敬请期待~",2000)
|
|
|
+ this.$api.navigateTo(`/market/pages/login/login`)
|
|
|
// uni.navigateToMiniProgram({
|
|
|
// appId: 'wx5a5cda32926f55ac',
|
|
|
// path: '/pages/tabBar/home/home',
|
|
@@ -317,17 +320,10 @@
|
|
|
},
|
|
|
onShow(){
|
|
|
this.modallayer = false;
|
|
|
- //查看此微信用户是否已经授权过
|
|
|
authorize.getSetting().then(res =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
|
|
|
if(res == 1){
|
|
|
- this.getCheekeyCode()
|
|
|
- }else{
|
|
|
- this.$api.redirectTo('/pages/authorization/authorization?type=1')
|
|
|
+ this.getWxAuthorize()
|
|
|
}
|
|
|
- }).catch(res =>{
|
|
|
- this.$util.modal('提示',res,'去授权','取消',true,() =>{
|
|
|
- this.$api.redirectTo('/pages/authorization/authorization?type=1')
|
|
|
- })
|
|
|
})
|
|
|
}
|
|
|
}
|