zh
小钻风 4 years ago
parent 0f1316027c
commit 8db34b8302

@ -2,6 +2,13 @@
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
//
if (uni.getStorageSync("userInfo").invitationNo) {
this.$store.commit('setinvitationNo', uni.getStorageSync("userInfo").invitationNo);
}
if( uni.getStorageSync("userInfo").roleLevel){
this.$store.commit('setRoleLevel', uni.getStorageSync("userInfo").roleLevel);
}
// uni.getSystemInfo({ // uni.getSystemInfo({
// success: function(e) { // success: function(e) {
// // #ifndef MP // // #ifndef MP

@ -311,9 +311,6 @@
page: "/pages/settings/settings" page: "/pages/settings/settings"
} }
], ],
roleLevel: 500, roleLevel: 500,
showTipModel: false, showTipModel: false,
info: {}, info: {},
@ -329,8 +326,14 @@
} }
}; };
}, },
created() {
this.$store.commit('setIsLogin')
this.isLogin = this.$store.state.isLogin
console.log(this.$store.state.isLogin)
this.roleLevel = this.$store.state.roleLevel
},
onLoad() { onLoad() {
if (uni.getStorageSync("auth").token) { if (this.isLogin) {
this.getUserInfo() this.getUserInfo()
this.getTotalEarning() this.getTotalEarning()
} }
@ -347,9 +350,7 @@
*/ */
}, },
onShow() { onShow() {
console.log(uni.getStorageSync("auth")) if (this.isLogin) {
if (uni.getStorageSync("auth").token) {
this.isLogin = true
this.userInfo.nickname = uni.getStorageSync("userInfo").nickname this.userInfo.nickname = uni.getStorageSync("userInfo").nickname
this.userInfo.headImgUrl = uni.getStorageSync("userInfo").headImgUrl this.userInfo.headImgUrl = uni.getStorageSync("userInfo").headImgUrl
this.myIncome() this.myIncome()

@ -3,19 +3,27 @@ import Vuex from "vuex" // 引入vuex
Vue.use(Vuex) // 让vue使用vuex Vue.use(Vuex) // 让vue使用vuex
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
selectCity:"",//城市信息 selectCity: "", //城市信息
preOrderMsg: {},//预购订单信息 preOrderMsg: {}, //预购订单信息
returnGoodsMsg:{},//售后商品信息 returnGoodsMsg: {}, //售后商品信息
logisticsDetail:[],//物流信息 logisticsDetail: [], //物流信息
userInfo:{},//邀请人的信息 userInfo: {}, //邀请人的信息
videoDetail:{},//小视频详情 videoDetail: {}, //小视频详情
invitationNo: '' ,// 本人邀请码 invitationNo: '', // 本人邀请码
roleLevel:500,//用户等级默认设置会员 invite: '', // 别人的邀请码
invite: '' ,// 别人的邀请码
url: null, // 跳转到登录页面时原地址 url: null, // 跳转到登录页面时原地址
roleLevel: 500, //用户等级默认设置会员
isLogin: false,
}, },
mutations: { mutations: {
setRoleLevel(state, val){ setIsLogin(state) {
if (uni.getStorageSync("auth").token) {
state.isLogin = true
} else {
state.isLogin = false
}
},
setRoleLevel(state, val) {
state.roleLevel = val state.roleLevel = val
}, },
changeCity(state, name) { changeCity(state, name) {
@ -25,26 +33,26 @@ const store = new Vuex.Store({
let newObj = Object.assign({}, obj) let newObj = Object.assign({}, obj)
state.preOrderMsg = newObj state.preOrderMsg = newObj
}, },
setReturnGoodsMsg(state,obj){ setReturnGoodsMsg(state, obj) {
let newObj = Object.assign({}, obj) let newObj = Object.assign({}, obj)
state.returnGoodsMsg = newObj state.returnGoodsMsg = newObj
}, },
setLogisticsDetail(state,arr){ setLogisticsDetail(state, arr) {
let newArr = arr let newArr = arr
state.logisticsDetail = newArr state.logisticsDetail = newArr
}, },
setUserInfo(state,obj){ setUserInfo(state, obj) {
let newObj = Object.assign({}, obj) let newObj = Object.assign({}, obj)
state.userInfo = newObj state.userInfo = newObj
}, },
setVideoDetail(state,obj){ setVideoDetail(state, obj) {
let newObj = Object.assign({}, obj) let newObj = Object.assign({}, obj)
state.videoDetail = newObj state.videoDetail = newObj
}, },
setinvitationNo(state,val){ setinvitationNo(state, val) {
state.invitationNo = val state.invitationNo = val
}, },
setinvite(state,val){ setinvite(state, val) {
state.invite = val state.invite = val
}, },
setUrl(state, val) { setUrl(state, val) {

Loading…
Cancel
Save