102 lines
2.5 KiB
JavaScript
102 lines
2.5 KiB
JavaScript
// pages/home/home.js
|
|
const app = getApp();
|
|
const regeneratorRuntime = app.loadAsync()
|
|
const http = app.loadHttp()
|
|
const model = app.loadModel("index")
|
|
const util = app.loadUtils("util")
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
system: app.globalData.system, //设备相关信息
|
|
pageTitle: "我的", //头部标题
|
|
titleColor: { //头部背景和文字颜色
|
|
bColor: "#1dbf53",
|
|
tColor: "#ffffff"
|
|
},
|
|
userInfo: {},//用户信息
|
|
},
|
|
created() {
|
|
this.getUserInfo()
|
|
app.setWatching('userInfo', (v) => {
|
|
this.setData({
|
|
userInfo: v
|
|
});
|
|
});
|
|
},
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
// 获取个人信息
|
|
async getUserInfo() {
|
|
let rel = await model.storage.getSetting("userInfo")
|
|
this.setData({
|
|
userInfo: rel
|
|
})
|
|
},
|
|
// 列表跳转
|
|
async jump(e) {
|
|
let url = e.currentTarget.dataset.url
|
|
let isLog = e.currentTarget.dataset.islog //控制跳转到登陆为1时不让他跳转到登陆
|
|
let type = e.currentTarget.dataset.type
|
|
let userInfo = this.data.userInfo
|
|
let getSetting = await model.getauth.getSetting() //获取已经授权的信息
|
|
if (isLog == '3' && !getSetting.authSetting['scope.userLocation']) {
|
|
// 用户取消授权的处理
|
|
wx.showModal({
|
|
title: '你拒绝了地理位置授权',
|
|
content: '请点击确定,到权限表设置',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
wx.openSetting()
|
|
}
|
|
}
|
|
})
|
|
return
|
|
}
|
|
if (!isLog) {
|
|
let isLogin = await util.isLoginJump()
|
|
if (isLogin == 1) return;
|
|
}
|
|
if ((userInfo['telnum'] == "未授权手机号" || userInfo['telnum'] == '') && type == 5) {
|
|
wx.navigateTo({
|
|
url: '/pages/login/login'
|
|
})
|
|
return
|
|
}
|
|
if (type == 1 && userInfo.isLogistics == 2) {
|
|
wx.navigateTo({
|
|
url: '/view/logistics/appLogistics/appLogistics'
|
|
})
|
|
return
|
|
} else if (type == 1 && userInfo.isLogistics == 3) {
|
|
wx.showToast({
|
|
title: '你已申请成为小马哥,请耐心等待后台人员确认!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
wx.navigateTo({
|
|
url: url
|
|
})
|
|
},
|
|
goTelnum(e){
|
|
if (e.currentTarget.dataset.telnum == '点击授权手机号'){
|
|
wx.navigateTo({
|
|
url:'/pages/login/login'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|