更新
This commit is contained in:
@@ -64,75 +64,73 @@
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
// uni.showToast({
|
||||
// title:'这里是show'
|
||||
// })
|
||||
//console.log('这里是indexonshow')
|
||||
uni.setStorageSync('orderType',null)
|
||||
// uni.preloadPage({url: "/pages/station-info/scan-camera/scan-camera"});
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const openid = uni.getStorageSync('device')
|
||||
// //console.log('++++++++++++')
|
||||
// //console.log(token)
|
||||
// //console.log(openid)
|
||||
// //console.log('++++++++++++')
|
||||
if (token && openid) {
|
||||
// this.getUserInfo()
|
||||
// this.getSiteInfo()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '您还没有登录哦',
|
||||
icon: "none"
|
||||
})
|
||||
setTimeout(function() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/boforeLogin/boforeLogin',
|
||||
success: () => {
|
||||
//console.log('跳转成功')
|
||||
},
|
||||
fail: (err) => {
|
||||
//console.log(err)
|
||||
}
|
||||
})
|
||||
}, 1500);
|
||||
// uni.showToast({
|
||||
// title: '您还没有登录哦',
|
||||
// icon: "none"
|
||||
// })
|
||||
// setTimeout(function() {
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/login/boforeLogin/boforeLogin',
|
||||
// success: () => {
|
||||
// //console.log('跳转成功')
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// //console.log(err)
|
||||
// }
|
||||
// })
|
||||
// }, 1500);
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// uni.showToast({
|
||||
// title:'这里是onLoad'
|
||||
// })
|
||||
// uni.navigateTo({
|
||||
// url:'/pages/stationDetail/ZYSite'
|
||||
// })
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
if(!token) return
|
||||
let _that =this
|
||||
const Menus = uni.getStorageSync('userMenu')
|
||||
//console.log('这里是接收menus处',Menus)
|
||||
let menusList = []
|
||||
Menus.forEach((item,index,Menus)=>{
|
||||
if(item.roleName != 'ROOT' ){
|
||||
// this.Splicing(item)
|
||||
menusList.push(this.Splicing(item))
|
||||
}
|
||||
})
|
||||
//console.log('这里是menusLisPush',menusList)
|
||||
// uni.setStorageSync('menusLists',menusList)
|
||||
let check = uni.getStorageSync('checkFirst')
|
||||
//console.log(check)
|
||||
if(check){
|
||||
_that.checkUser = true
|
||||
}
|
||||
uni.setStorageSync('menusChangeList',menusList)
|
||||
this.menusList = menusList
|
||||
//console.log('这里是menusfor循环完成处',this.menusList)
|
||||
// this.getUserInfo()
|
||||
this.longiCheck()
|
||||
// //console.log('++++++++')
|
||||
//console.log('这里是传值处menus',this.menusList)
|
||||
this.getPosition()
|
||||
},
|
||||
methods: {
|
||||
checkLogin() {
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
if (!token) {
|
||||
uni.showModal({
|
||||
content: '您还没有登录哦',
|
||||
confirmText: '前往登录',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/boforeLogin/boforeLogin'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
getPosition(){
|
||||
console.log('getPositiongetPositiongetPositiongetPosition')
|
||||
let that = this
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
@@ -145,15 +143,12 @@
|
||||
});
|
||||
},
|
||||
changMenus(data){
|
||||
//console.log('这里是获取子级数据的地方+++++',data)
|
||||
this.menusList =data
|
||||
},
|
||||
longiCheck(){
|
||||
let userInfo = uni.getStorageSync('loginUser'),
|
||||
_that =this
|
||||
//console.log(userInfo)
|
||||
oliUserApi.getByPhone(userInfo.userPhone).then((res)=>{
|
||||
//console.log('调用')
|
||||
if(res.code == 20000){
|
||||
_that.checkList = 'show'
|
||||
_that.oliList = res.data
|
||||
@@ -251,6 +246,7 @@
|
||||
|
||||
// },
|
||||
NavChange: function(e) {
|
||||
if(!this.checkLogin()) return
|
||||
this.PageCur = e.currentTarget.dataset.cur
|
||||
if (this.PageCur == "scan") {
|
||||
this.scanQr()
|
||||
@@ -261,21 +257,15 @@
|
||||
var scanUrl
|
||||
let _that = this
|
||||
this.menusList.forEach((item, index) => {
|
||||
//console.log('1')
|
||||
//console.log(index)
|
||||
//console.log(_that.userMenu)
|
||||
//console.log(item.name)
|
||||
//console.log('2')
|
||||
if (item.name === '扫码加油') {
|
||||
// scanUrl = item.path
|
||||
scanUrl = '/pages/station-info/scan-camera/scan-camera'
|
||||
uni.navigateTo({
|
||||
url: scanUrl,
|
||||
fail: (err) => {
|
||||
// //console.log(err)
|
||||
|
||||
},
|
||||
success: (res) => {
|
||||
// //console.log('chengg', res)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user