wechat_yxcl/App.vue
2021-02-07 21:21:12 +08:00

181 lines
3.9 KiB
Vue

<script>
import Vue from 'vue'
import {
mapGetters,
mapActions,
mapMutations
} from 'vuex'
export default {
globalData: {
visitChannels: ''
},
computed:{
...mapGetters({'user':'getUser'})
},
methods: {
...mapActions(['memberLogin','getLoginCode']),
...mapMutations(['setVisitChannels']),
},
onLaunch: function(options) {
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
}
})
let _this = this
if (this.user.WeChat_MiniProToken) {
this.memberLogin() // 获取用户数据
} else {
this.getLoginCode()
}
this.$scope.globalData.visitChannels = options.scene
this.setVisitChannels(options.scene)
const updateManager = uni.getUpdateManager()
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
this.$util.addUserBehavior( {intoRoute: '/'+options.path, outtoRoute: ''}) // 记录用户行为
},
onShow: function() {
var pages = getCurrentPages() // 获取加载的页面
let len = pages.length
if (len > 0) {
var currentPage = pages[len - 1] // 获取当前页面的对象
var nowRoute = '/' + currentPage.route // 当前页面url
this.$util.addUserBehavior({intoRoute: nowRoute, outtoRoute: ''}) // 记录用户行为
}
console.log('App Show')
},
onHide: function(options) {
let pages = getCurrentPages() // 获取加载的页面
let len = pages.length
if (len > 0) {
let currentPage = pages[len - 1] // 获取当前页面的对象
let nowRoute = '/' + currentPage.route // 当前页面url
this.$util.addUserBehavior( {intoRoute: '', outtoRoute:nowRoute}) // 记录用户行为
}
console.log('App Hide')
}
}
</script>
<style>
@import url("./common/uni.css");
/*每个页面公共css */
page {
font-size: 26upx;
color: #333;
height: 100%;
background-color: #f8f9fb;
line-height: 1.2;
}
/* 加载更多 */
.load-more {
text-align: center;
width: 100%;
height: 80upx;
color: #9999;
font-size: 24upx;
}
/* 审核环节最后一个加底部边距 */
.process-box.uni-active {
padding-bottom: 30upx;
}
.process-box process-unit:nth-last-child(1) .prosess-unit::before{
content: '';
width: 0rpx;
}
.ico,
.ico-s {
display: block;
}
.ico-s:before,
.ico:before {
content: '';
width: 36upx;
height: 34upx;
display: block;
margin-right: 6upx;
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.ico-s:before {
width: 18upx;
height: 18upx;
}
.ico-fj:before {
background-image: url('./static/images/fjwj.png');
}
.ico-tp:before {
background-image: url('./static/images/fjtp.png');
}
.ico-bz:before {
background-image: url('./static/images/tender/yj.png');
}
/* #ifdef MP-WEIXIN */
checkbox .wx-checkbox-input {
border-radius: 50%;
border: 1upx solid #63B7F9;
width: 42upx;
height: 42upx;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
background-color: #63B7F9;
color: #fff !important;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
font-size: 30upx;
}
/* #endif */
</style>