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

@ -1,81 +1,88 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
// uni.getSystemInfo({
// success: function(e) {
// // #ifndef MP
// Vue.prototype.StatusBar = e.statusBarHeight;
// if (e.platform == 'android') {
// Vue.prototype.CustomBar = e.statusBarHeight + 50;
// } else {
// Vue.prototype.CustomBar = e.statusBarHeight + 45;
// };
// // #endif
// // #ifdef MP-WEIXIN
// Vue.prototype.StatusBar = e.statusBarHeight;
// let custom = wx.getMenuButtonBoundingClientRect();
// Vue.prototype.Custom = custom;
// Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// // #endif
// // #ifdef MP-ALIPAY
// Vue.prototype.StatusBar = e.statusBarHeight;
// Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
// // #endif
// }
// })
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "colorui/main.css";
@import "colorui/icon.css";
@import "uview-ui/index.scss";
@import "common/iconfont.css";
page {
background-color: #F5F5F5;
font-size: 30rpx;
}
/* 全局公共样式类 */
.text-hidden {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.two-line {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.clear {
overflow: hidden;
}
.bg-img {
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: #F5F5F5;
}
image {
display: block;
height: auto;
// background-color: #ffffff;
}
<script>
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
// Vue.prototype.StatusBar = e.statusBarHeight;
// if (e.platform == 'android') {
// Vue.prototype.CustomBar = e.statusBarHeight + 50;
// } else {
// Vue.prototype.CustomBar = e.statusBarHeight + 45;
// };
// // #endif
// // #ifdef MP-WEIXIN
// Vue.prototype.StatusBar = e.statusBarHeight;
// let custom = wx.getMenuButtonBoundingClientRect();
// Vue.prototype.Custom = custom;
// Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// // #endif
// // #ifdef MP-ALIPAY
// Vue.prototype.StatusBar = e.statusBarHeight;
// Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
// // #endif
// }
// })
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "colorui/main.css";
@import "colorui/icon.css";
@import "uview-ui/index.scss";
@import "common/iconfont.css";
page {
background-color: #F5F5F5;
font-size: 30rpx;
}
/* 全局公共样式类 */
.text-hidden {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.two-line {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.clear {
overflow: hidden;
}
.bg-img {
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: #F5F5F5;
}
image {
display: block;
height: auto;
// background-color: #ffffff;
}
</style>

@ -310,10 +310,7 @@
text: "设置",
page: "/pages/settings/settings"
}
],
],
roleLevel: 500,
showTipModel: false,
info: {},
@ -328,9 +325,15 @@
orderNum: 0
}
};
},
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()

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

Loading…
Cancel
Save