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

@ -2,6 +2,13 @@
export default {
onLaunch: function() {
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({
// success: function(e) {
// // #ifndef MP

@ -311,9 +311,6 @@
page: "/pages/settings/settings"
}
],
roleLevel: 500,
showTipModel: false,
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() {
if (uni.getStorageSync("auth").token) {
if (this.isLogin) {
this.getUserInfo()
this.getTotalEarning()
}
@ -347,9 +350,7 @@
*/
},
onShow() {
console.log(uni.getStorageSync("auth"))
if (uni.getStorageSync("auth").token) {
this.isLogin = true
if (this.isLogin) {
this.userInfo.nickname = uni.getStorageSync("userInfo").nickname
this.userInfo.headImgUrl = uni.getStorageSync("userInfo").headImgUrl
this.myIncome()

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

Loading…
Cancel
Save