更新
This commit is contained in:
@@ -73,8 +73,8 @@
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
content: "登录后才能查看哦",
|
||||||
confirmText: '去登陆',
|
confirmText: '去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
|||||||
72
App.vue
72
App.vue
@@ -79,7 +79,6 @@
|
|||||||
onShareAppMessage(e) {
|
onShareAppMessage(e) {
|
||||||
let that = this
|
let that = this
|
||||||
wx.onAppRoute((res) => {
|
wx.onAppRoute((res) => {
|
||||||
// console.log(res, '当前页面路由发生变化 触发该事件onShareAppMessage');
|
|
||||||
const pages = getCurrentPages() //获取加载的页面
|
const pages = getCurrentPages() //获取加载的页面
|
||||||
const view = pages[pages.length - 1] //获取当前页面的对象
|
const view = pages[pages.length - 1] //获取当前页面的对象
|
||||||
if (!view) return false //如果不存在页面对象 则返回
|
if (!view) return false //如果不存在页面对象 则返回
|
||||||
@@ -91,40 +90,38 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let white = ['pages/index/startPage/startPage','AppletCode/pages/index/index']
|
// let white = ['pages/index/startPage/startPage','AppletCode/pages/index/index']
|
||||||
if(view.route === 'BagStation/pages/stationDetail/stationDetail') {
|
// if(view.route === 'BagStation/pages/stationDetail/stationDetail') {
|
||||||
uni.removeStorageSync('refuseLogin')
|
// uni.removeStorageSync('refuseLogin')
|
||||||
}
|
// }
|
||||||
// console.log('white.includes(view.route)',white.includes(view.route))
|
// // // 是否跳过登陆
|
||||||
// // 是否跳过登陆
|
// let isRefuseLogin = uni.getStorageSync('refuseLogin')
|
||||||
let isRefuseLogin = uni.getStorageSync('refuseLogin')
|
// if(isRefuseLogin || white.includes(view.route) || view.route.includes('BagAuth')) return
|
||||||
if(isRefuseLogin || white.includes(view.route) || view.route.includes('BagAuth')) return
|
// this.getAmount()
|
||||||
// console.log('111111111111111')
|
|
||||||
this.getAmount()
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 是否token过期或ip更改
|
// 是否token过期或ip更改
|
||||||
getAmount() {
|
getAmount() {
|
||||||
// clearTimeout(loginTimer)
|
// clearTimeout(loginTimer)
|
||||||
accountApi.getTotalOilCardInfo().then(res => {
|
accountApi.getTotalOilCardInfo().then(res => {
|
||||||
if (res.code == 42011) {
|
// if (res.code == 42011) {
|
||||||
uni.setStorageSync('Authorization',null)
|
// uni.setStorageSync('Authorization',null)
|
||||||
uni.setStorageSync('openid',null)
|
// uni.setStorageSync('openid',null)
|
||||||
|
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: '需要您重新登录',
|
// title: '需要您重新登录',
|
||||||
content: res.msg,
|
// content: res.msg,
|
||||||
duration: '3000',
|
// duration: '3000',
|
||||||
showCancel:false,
|
// showCancel:false,
|
||||||
success: function(res) {
|
// success: function(res) {
|
||||||
if (res.confirm) {
|
// if (res.confirm) {
|
||||||
uni.redirectTo({
|
// uni.redirectTo({
|
||||||
url: '/BagAuth/pages/login/login'
|
// url: '/BagAuth/pages/login/login'
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -142,15 +139,16 @@
|
|||||||
// if (token && openid) {
|
// if (token && openid) {
|
||||||
// this.getAmount()
|
// this.getAmount()
|
||||||
// }
|
// }
|
||||||
uni.getLocation({
|
|
||||||
type: 'wgs84',
|
// uni.getLocation({
|
||||||
success: function(res) {
|
// type: 'wgs84',
|
||||||
uni.setStorageSync('location', {
|
// success: function(res) {
|
||||||
longitude: res.longitude + '',
|
// uni.setStorageSync('location', {
|
||||||
latitude: res.latitude + ''
|
// longitude: res.longitude + '',
|
||||||
})
|
// latitude: res.latitude + ''
|
||||||
}
|
// })
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,10 @@
|
|||||||
<button class="cu-btn margin-top round lg" @tap="refuseEmpower">
|
<button class="cu-btn margin-top round lg" @tap="refuseEmpower">
|
||||||
输入手机号码登录
|
输入手机号码登录
|
||||||
</button>
|
</button>
|
||||||
<button class="cu-btn margin-top bg-0 round lg" style="font-size: 28rpx;" @tap="refuseLogin">
|
<!-- <button class="cu-btn margin-top bg-0 round lg" style="font-size: 28rpx;" @tap="refuseLogin">
|
||||||
跳过登录
|
回到首页
|
||||||
</button>
|
</button> -->
|
||||||
|
<view class="tip">仅提供给星油能源内部合作用户使用</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="isKLUser" v-if='otherUser'>
|
<view class="isKLUser" v-if='otherUser'>
|
||||||
<view class="isKLUser">卡力用户仅支持跳转登录</view>
|
<view class="isKLUser">卡力用户仅支持跳转登录</view>
|
||||||
@@ -207,19 +208,19 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
refuseLogin(){
|
refuseLogin(){
|
||||||
uni.clearStorageSync()
|
// uni.clearStorageSync()
|
||||||
uni.setStorageSync('refuseLogin','true')
|
// uni.setStorageSync('refuseLogin','true')
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/tabbar/home/home'
|
url: '/pages/tabbar/home/home'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshLocation() {
|
refreshLocation() {
|
||||||
uni.getLocation({
|
// uni.getLocation({
|
||||||
type: 'wgs84',
|
// type: 'wgs84',
|
||||||
success: function(res) {
|
// success: function(res) {
|
||||||
uni.setStorageSync('location', res)
|
// uni.setStorageSync('location', res)
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
},
|
},
|
||||||
autoLogin() {
|
autoLogin() {
|
||||||
let url = 'loginCompany'
|
let url = 'loginCompany'
|
||||||
@@ -308,6 +309,13 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.tip {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 150rpx;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
.isKLUser{
|
.isKLUser{
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|||||||
@@ -330,9 +330,10 @@
|
|||||||
let type = this.TabCur == 0 ? 'Personal' : 'Company';
|
let type = this.TabCur == 0 ? 'Personal' : 'Company';
|
||||||
authApi.loginPwd(data, type).then(res => {
|
authApi.loginPwd(data, type).then(res => {
|
||||||
this.loginSuccess(res)
|
this.loginSuccess(res)
|
||||||
}).catch(err => {
|
|
||||||
this.logout()
|
|
||||||
})
|
})
|
||||||
|
// .catch(err => {
|
||||||
|
// this.logout()
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
loginRandom() {
|
loginRandom() {
|
||||||
if (!this.checked) {
|
if (!this.checked) {
|
||||||
|
|||||||
@@ -331,8 +331,8 @@
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title:'请您登录',
|
|
||||||
content:"登录星油云才可以加油 |˛˙꒳˙)♡",
|
content:"登录后才能查看哦",
|
||||||
confirmText:'去登陆',
|
confirmText:'去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if(res.confirm){
|
if(res.confirm){
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
this.titleList = titleArr;
|
this.titleList = titleArr;
|
||||||
this.tempTitleObj = r;
|
this.tempTitleObj = r;
|
||||||
this.areaCodeList1 = this.areaCodeList
|
this.areaCodeList1 = this.areaCodeList
|
||||||
console.log(this.productCodeList,this.areaCodeList1,uni.getStorageSync('areaCodeList'),'-------------------')
|
// console.log(this.productCodeList,this.areaCodeList1,uni.getStorageSync('areaCodeList'),'-------------------')
|
||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
this.titleList = titleArr;
|
this.titleList = titleArr;
|
||||||
this.tempTitleObj = r;
|
this.tempTitleObj = r;
|
||||||
this.areaCodeList1 = this.areaCodeList
|
this.areaCodeList1 = this.areaCodeList
|
||||||
console.log(this.titleList,this.areaCodeList1,'-------------------ddd')
|
// console.log(this.titleList,this.areaCodeList1,'-------------------ddd')
|
||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
data() {
|
data() {
|
||||||
@@ -246,8 +246,8 @@
|
|||||||
showMenuClick(index) {
|
showMenuClick(index) {
|
||||||
if(!uni.getStorageSync('user')){
|
if(!uni.getStorageSync('user')){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
content: "登录后才能查看哦",
|
||||||
confirmText: '去登陆',
|
confirmText: '去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('广告组件挂载完成');
|
// console.log('广告组件挂载完成');
|
||||||
this.showAdvertisement()
|
this.showAdvertisement()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
return {
|
return {
|
||||||
showAdvertisement: false,
|
showAdvertisement: false,
|
||||||
key: '',
|
key: '',
|
||||||
|
isOnline:false,
|
||||||
option: null,
|
option: null,
|
||||||
imgURL: this.global.imgURL + 'start/',
|
imgURL: this.global.imgURL + 'start/',
|
||||||
yellowURL: this.global.yellowURL + 'xq-ad/',
|
yellowURL: this.global.yellowURL + 'xq-ad/',
|
||||||
@@ -96,10 +97,10 @@
|
|||||||
const token = uni.getStorageSync('Authorization')
|
const token = uni.getStorageSync('Authorization')
|
||||||
const openid = uni.getStorageSync('openid')
|
const openid = uni.getStorageSync('openid')
|
||||||
// this.key = '';
|
// this.key = '';
|
||||||
let isOnline = false;
|
// this.isOnline = false;
|
||||||
if (token) {
|
if (token) {
|
||||||
await oilSiteApi.isLoginSuccess().then(res => {
|
await oilSiteApi.isLoginSuccess().then(res => {
|
||||||
if (res.code == 20000) isOnline = true
|
if (res.code == 20000) this.isOnline = true
|
||||||
}).catch(err => {})
|
}).catch(err => {})
|
||||||
}
|
}
|
||||||
// console.log(isOnline,'isOnline')
|
// console.log(isOnline,'isOnline')
|
||||||
@@ -108,7 +109,7 @@
|
|||||||
// } else {
|
// } else {
|
||||||
// this.key = '离线'
|
// this.key = '离线'
|
||||||
// }
|
// }
|
||||||
if (isOnline) {
|
if (this.isOnline) {
|
||||||
if (!uni.getStorageSync('filterData')) {
|
if (!uni.getStorageSync('filterData')) {
|
||||||
this.getFilterData()
|
this.getFilterData()
|
||||||
} else if (uni.getStorageSync('filterData')[0].detailList.length < 2) {
|
} else if (uni.getStorageSync('filterData')[0].detailList.length < 2) {
|
||||||
@@ -124,21 +125,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
goHome(type) {
|
goHome(type) {
|
||||||
if (type) {
|
if (this.isOnline) {
|
||||||
uni.setStorageSync('isJump', {
|
if (type) {
|
||||||
page: 'Financial/pages/estimate/index',
|
uni.setStorageSync('isJump', {
|
||||||
disposable: true
|
page: 'Financial/pages/estimate/index',
|
||||||
|
disposable: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
uni.switchTab({
|
||||||
|
url: `/pages/tabbar/home/home`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/BagAuth/pages/login/login'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
uni.switchTab({
|
|
||||||
url: `/pages/tabbar/home/home`
|
|
||||||
})
|
|
||||||
// if (this.key == '在线') {
|
|
||||||
// } else {
|
|
||||||
// uni.redirectTo({
|
|
||||||
// url: '/BagAuth/pages/login/login'
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
Interceptor(id) {
|
Interceptor(id) {
|
||||||
// let taht = this
|
// let taht = this
|
||||||
@@ -167,9 +168,9 @@
|
|||||||
...res.data,
|
...res.data,
|
||||||
qrCode: id
|
qrCode: id
|
||||||
}),
|
}),
|
||||||
fail(e) {
|
// fail(e) {
|
||||||
console.log(e, '跳转失败')
|
// console.log(e, '跳转失败')
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -158,7 +158,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<msg-models :showAuthFrror="showAuthFrror" @hideOneModal="hideModel"></msg-models>
|
<msg-models :showAuthFrror="showAuthFrror" @hideOneModal="hideModel"></msg-models>
|
||||||
<three-sites v-if="showThreeSites" @hideOneModal="showThreeSites=false" :showThreeSites="showThreeSites"></three-sites>
|
<three-sites v-if="showThreeSites" @hideOneModal="showThreeSites=false"
|
||||||
|
:showThreeSites="showThreeSites"></three-sites>
|
||||||
<transBlcok ref="transBlcok" />
|
<transBlcok ref="transBlcok" />
|
||||||
<!-- <tabbar :current-page="0"/> -->
|
<!-- <tabbar :current-page="0"/> -->
|
||||||
</view>
|
</view>
|
||||||
@@ -241,7 +242,7 @@
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
getCount: 0,
|
// getCount: 0,
|
||||||
siteList: [],
|
siteList: [],
|
||||||
height: 0,
|
height: 0,
|
||||||
starUrl: this.global.starUrl,
|
starUrl: this.global.starUrl,
|
||||||
@@ -329,7 +330,7 @@
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
showAuthFrror(n, o) {
|
showAuthFrror(n, o) {
|
||||||
console.log(n, o, '=================')
|
// console.log(n, o, '=================')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -403,18 +404,11 @@
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
const token = uni.getStorageSync('Authorization')
|
const token = uni.getStorageSync('Authorization')
|
||||||
const openid = uni.getStorageSync('openid')
|
if (token) {
|
||||||
if (token && openid) {
|
|
||||||
this.getAuthInfo()
|
this.getAuthInfo()
|
||||||
|
|
||||||
this.refreshLocation()
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: '您还没有登录哦',
|
|
||||||
icon: "none"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
this.getSiteList();
|
this.refreshLocation()
|
||||||
|
// this.getSiteList();
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
beforeCreate() {},
|
beforeCreate() {},
|
||||||
@@ -427,7 +421,7 @@
|
|||||||
if (res.code == '20000') {
|
if (res.code == '20000') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '该油卡已被禁用',
|
title: '该油卡已被禁用',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
uni.clearStorageSync()
|
uni.clearStorageSync()
|
||||||
uni.setStorageSync('loginOut', true)
|
uni.setStorageSync('loginOut', true)
|
||||||
@@ -449,7 +443,7 @@
|
|||||||
customerId: cardInfo.customerId
|
customerId: cardInfo.customerId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 20000) {
|
if (res.code === 20000) {
|
||||||
if(res.data.accountState == 0) {
|
if (res.data.accountState == 0) {
|
||||||
this.logOut()
|
this.logOut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,22 +501,28 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.setStorageSync('location', res)
|
uni.setStorageSync('location', res)
|
||||||
},
|
},
|
||||||
|
fail: err => {
|
||||||
|
if (err.errMsg === "getLocation:fail auth deny") {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "您已拒绝获取位置信息,请重新授权",
|
||||||
|
confirmText: "开启定位",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.openSetting({
|
||||||
|
success: (res) => {
|
||||||
|
if (res.authSetting["scope.userLocation"]) {
|
||||||
|
this.refreshLocation()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
complete: (res) => {
|
complete: (res) => {
|
||||||
this.getSiteList()
|
this.getSiteList()
|
||||||
var msgTip = ''
|
|
||||||
if (res.errMsg == 'getLocation:fail auth deny') {
|
|
||||||
msgTip = '请允许小程序获取您的位置'
|
|
||||||
} else if (res.errMsg == 'getLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
|
|
||||||
msgTip = '请您打开手机定位'
|
|
||||||
}
|
|
||||||
if (msgTip) {
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: msgTip,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}, 300)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -585,22 +585,20 @@
|
|||||||
url: '/pages/tabbar/station/stationList'
|
url: '/pages/tabbar/station/stationList'
|
||||||
})
|
})
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
|
// if (!uni.getStorageSync('user')) {
|
||||||
if (!uni.getStorageSync('user')) {
|
// uni.showModal({
|
||||||
uni.showModal({
|
// content: "登录后才能查看哦",
|
||||||
title: '请您登录',
|
// confirmText: '去登陆',
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
// success: (res) => {
|
||||||
confirmText: '去登陆',
|
// if (res.confirm) {
|
||||||
success: (res) => {
|
// uni.reLaunch({
|
||||||
if (res.confirm) {
|
// url: '../../../BagAuth/pages/login/login'
|
||||||
uni.reLaunch({
|
// })
|
||||||
url: '../../../BagAuth/pages/login/login'
|
// }
|
||||||
})
|
// }
|
||||||
}
|
// })
|
||||||
}
|
// return
|
||||||
})
|
// }
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.removeStorageSync("origins")
|
uni.removeStorageSync("origins")
|
||||||
uni.removeStorageSync("destination")
|
uni.removeStorageSync("destination")
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
@@ -611,26 +609,29 @@
|
|||||||
} else if (index == 9) {
|
} else if (index == 9) {
|
||||||
this.goToPage('/BagAuth/pages/agreeMent/OperationGuide')
|
this.goToPage('/BagAuth/pages/agreeMent/OperationGuide')
|
||||||
} else if (index == 2) {
|
} else if (index == 2) {
|
||||||
if (!uni.getStorageSync('user')) {
|
// if (!uni.getStorageSync('user')) {
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: '请您登录',
|
// content: "登录后才能查看哦",
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
// confirmText: '去登陆',
|
||||||
confirmText: '去登陆',
|
// success: (res) => {
|
||||||
success: (res) => {
|
// if (res.confirm) {
|
||||||
if (res.confirm) {
|
// uni.reLaunch({
|
||||||
uni.reLaunch({
|
// url: '../../../BagAuth/pages/login/login'
|
||||||
url: '../../../BagAuth/pages/login/login'
|
// })
|
||||||
})
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// })
|
||||||
})
|
// return
|
||||||
return
|
// }
|
||||||
}
|
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
|
|
||||||
url: '../../../BagStation/pages/overviewMap/overviewMap',
|
url: '../../../BagStation/pages/overviewMap/overviewMap',
|
||||||
})
|
})
|
||||||
} else if (index == 6) {
|
} else if (index == 6) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '功能即将开放,敬请期待',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
const user = uni.getStorageSync('user');
|
const user = uni.getStorageSync('user');
|
||||||
if (user) {
|
if (user) {
|
||||||
Financial.findHomePageReport({
|
Financial.findHomePageReport({
|
||||||
@@ -657,7 +658,7 @@
|
|||||||
this.swiperClick(this.swiperArray[0], 1)
|
this.swiperClick(this.swiperArray[0], 1)
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '功能暂无',
|
title: '功能即将开放,敬请期待',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -670,8 +671,7 @@
|
|||||||
// })
|
// })
|
||||||
if (!uni.getStorageSync('user')) {
|
if (!uni.getStorageSync('user')) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '请您登录',
|
content: "登录后才能查看哦",
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
|
||||||
confirmText: '去登陆',
|
confirmText: '去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
@@ -731,38 +731,20 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.getCount++
|
// this.getCount++
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
// console.log(res.data.list)
|
// console.log(res.data.list)
|
||||||
this.siteList = res.data.list
|
this.siteList = res.data.list
|
||||||
} else {
|
}
|
||||||
if (this.getCount == 1) {
|
// else {
|
||||||
setTimeout(() => {
|
// if (this.getCount == 1) {
|
||||||
this.getSiteList()
|
// setTimeout(() => {
|
||||||
}, 1000)
|
// this.getSiteList()
|
||||||
|
// }, 1000)
|
||||||
|
|
||||||
|
|
||||||
} else {
|
// }
|
||||||
uni.getSetting({
|
// }
|
||||||
success: (resSet) => {
|
|
||||||
if (resSet.authSetting['scope.address'] == false) {
|
|
||||||
uni.showMode({
|
|
||||||
title: '请您打开定位权限',
|
|
||||||
content: '用于获取您当前位置附近的油站',
|
|
||||||
confirmText: '去设置',
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.openSetting({
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
oilSiteApi.getSiteList(data1).then(res => {
|
oilSiteApi.getSiteList(data1).then(res => {
|
||||||
@@ -775,33 +757,31 @@
|
|||||||
},
|
},
|
||||||
toDetail(item) {
|
toDetail(item) {
|
||||||
let itemS = JSON.stringify(item)
|
let itemS = JSON.stringify(item)
|
||||||
if (uni.getStorageSync('user')) {
|
if (item.channelCode === 'TY') {
|
||||||
if (item.channelCode === 'TY') {
|
uni.setStorageSync('OtherSiteInfo', item)
|
||||||
uni.setStorageSync('OtherSiteInfo', item)
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
|
|
||||||
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
|
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
|
||||||
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
|
||||||
confirmText: '去登陆',
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '../../../BagAuth/pages/login/login'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
|
||||||
|
|
||||||
|
})
|
||||||
|
// if (uni.getStorageSync('user')) {
|
||||||
|
// } else {
|
||||||
|
// uni.showModal({
|
||||||
|
// content: "登录后才能查看哦",
|
||||||
|
// confirmText: '去登陆',
|
||||||
|
// success: (res) => {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url: '../../../BagAuth/pages/login/login'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
getFilterData() {
|
getFilterData() {
|
||||||
oilSiteApi.getCheckInfo().then(res => {
|
oilSiteApi.getCheckInfo().then(res => {
|
||||||
@@ -901,16 +881,12 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
scan1() {
|
|
||||||
// 测试用
|
|
||||||
this.getScanRes('fixed_1371293944539422720')
|
|
||||||
},
|
|
||||||
openScan() {
|
openScan() {
|
||||||
let user = uni.getStorageSync('user')
|
let user = uni.getStorageSync('user')
|
||||||
if (!user) {
|
if (!user) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
content: "登录后才能查看哦",
|
||||||
confirmText: '去登陆',
|
confirmText: '去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
|||||||
@@ -68,8 +68,8 @@
|
|||||||
qrFn(){
|
qrFn(){
|
||||||
if(!uni.getStorageSync('user')){
|
if(!uni.getStorageSync('user')){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
content: "登录后才能查看哦",
|
||||||
confirmText: '去登陆',
|
confirmText: '去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
@@ -136,15 +136,12 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
scan1() {
|
|
||||||
// 测试用
|
|
||||||
this.getScanRes('fixed_1371293944539422720')
|
|
||||||
},
|
|
||||||
scan() {
|
scan() {
|
||||||
if(!uni.getStorageSync('user')){
|
if(!uni.getStorageSync('user')){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
content: "登录后才能查看哦",
|
||||||
confirmText: '去登陆',
|
confirmText: '去登陆',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: '0#轻柴油',
|
title: '0#轻柴油',
|
||||||
key: 'oilProductCode',
|
key: 'oilProductCode',
|
||||||
@@ -239,12 +239,12 @@
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
if (!uni.getStorageSync('filterDatas')) {
|
if (!uni.getStorageSync('filterDatas')) {
|
||||||
this.getFilterData()
|
this.getFilterData()
|
||||||
} else {}
|
}
|
||||||
this.findPriceDetails()
|
this.findPriceDetails()
|
||||||
if (uni.getStorageSync('productCodeList')) {
|
if (uni.getStorageSync('productCodeList')) {
|
||||||
this.productCodeList = uni.getStorageSync('productCodeList')
|
this.productCodeList = uni.getStorageSync('productCodeList')
|
||||||
}
|
}
|
||||||
this.getSiteList()
|
// this.getSiteList()
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.updateFn()
|
this.updateFn()
|
||||||
@@ -282,7 +282,7 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
params: { //类型:Object 必有字段 备注:// 筛选对象
|
params: { //类型:Object 必有字段 备注:// 筛选对象
|
||||||
// siteNameOrId: this.siteName, //产品类型(加注方式):
|
// siteNameOrId: this.siteName, //产品类型(加注方式):
|
||||||
address:this.siteAddress,
|
address: this.siteAddress,
|
||||||
productType: this.productType ? this.productType : '', //1-加注机; 2-桶装
|
productType: this.productType ? this.productType : '', //1-加注机; 2-桶装
|
||||||
brandName: this.brandName ? this.brandName : '', // 桶装品牌名称
|
brandName: this.brandName ? this.brandName : '', // 桶装品牌名称
|
||||||
currentLongitude: location.longitude + '', // 当前经度
|
currentLongitude: location.longitude + '', // 当前经度
|
||||||
@@ -328,11 +328,28 @@
|
|||||||
},
|
},
|
||||||
changeHaed(code) {
|
changeHaed(code) {
|
||||||
this.TabHead = code
|
this.TabHead = code
|
||||||
this.siteList = []
|
// this.siteList = []
|
||||||
this.siteAddress = ''
|
this.siteAddress = ''
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
if (code == 1) {
|
if (code == 1) {
|
||||||
this.getUreaList()
|
if (uni.getStorageSync('user')) {
|
||||||
|
this.getUreaList()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
content: "登录后才能查看哦",
|
||||||
|
confirmText: '去登陆',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/BagAuth/pages/login/login'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.changeHaed(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
} else if (code == 0) {
|
} else if (code == 0) {
|
||||||
this.getSiteList()
|
this.getSiteList()
|
||||||
}
|
}
|
||||||
@@ -340,31 +357,31 @@
|
|||||||
ureaToDetail(list) {
|
ureaToDetail(list) {
|
||||||
|
|
||||||
let itemS = JSON.stringify(list)
|
let itemS = JSON.stringify(list)
|
||||||
if (uni.getStorageSync('user')) {
|
uni.navigateTo({
|
||||||
uni.navigateTo({
|
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
|
||||||
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
|
})
|
||||||
})
|
// if (uni.getStorageSync('user')) {
|
||||||
} else {
|
|
||||||
uni.showModal({
|
// } else {
|
||||||
title: '请您登录',
|
// uni.showModal({
|
||||||
content: "登录小星加油才可以加油 |˛˙꒳˙)♡",
|
// content: "登录后才能查看哦",
|
||||||
confirmText: '去登陆',
|
// confirmText: '去登陆',
|
||||||
success: (res) => {
|
// success: (res) => {
|
||||||
if (res.confirm) {
|
// if (res.confirm) {
|
||||||
uni.reLaunch({
|
// uni.reLaunch({
|
||||||
url: '../../../BagAuth/pages/login/login'
|
// url: '/BagAuth/pages/login/login'
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
filterRes(val) {
|
filterRes(val) {
|
||||||
console.log(val, '重置')
|
|
||||||
if (this.TabHead == 0) {
|
if (this.TabHead == 0) {
|
||||||
this.filterDatas = val
|
this.filterDatas = val
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
this.siteList = []
|
// this.siteList = []
|
||||||
this.getSiteList()
|
this.getSiteList()
|
||||||
} else {
|
} else {
|
||||||
if (val.formats == 2) {
|
if (val.formats == 2) {
|
||||||
@@ -376,7 +393,7 @@
|
|||||||
this.productType = val.formats
|
this.productType = val.formats
|
||||||
this.brandName = val.productType
|
this.brandName = val.productType
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
this.siteList = []
|
// this.siteList = []
|
||||||
this.getUreaList()
|
this.getUreaList()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -393,7 +410,6 @@
|
|||||||
this.productCodeList = uni.getStorageSync('productCodeList')
|
this.productCodeList = uni.getStorageSync('productCodeList')
|
||||||
|
|
||||||
res.data.channelCodes.map(item => {
|
res.data.channelCodes.map(item => {
|
||||||
|
|
||||||
// this.menuList[3].detailLists.push({
|
// this.menuList[3].detailLists.push({
|
||||||
// title: item.name,
|
// title: item.name,
|
||||||
// value: item.id
|
// value: item.id
|
||||||
@@ -433,7 +449,7 @@
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
|
// console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onSelected(e) {
|
onSelected(e) {
|
||||||
@@ -448,8 +464,6 @@
|
|||||||
}
|
}
|
||||||
this.ureaMenuList[1].detailList.push(obj)
|
this.ureaMenuList[1].detailList.push(obj)
|
||||||
})
|
})
|
||||||
console.log(this.ureaMenuList)
|
|
||||||
console.log(this.productTypes)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshLocation() {
|
refreshLocation() {
|
||||||
@@ -458,34 +472,44 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.setStorageSync('location', res)
|
uni.setStorageSync('location', res)
|
||||||
},
|
},
|
||||||
complete(res) {
|
fail: err => {
|
||||||
console.log('定位', res)
|
if (err.errMsg === "getLocation:fail auth deny") {
|
||||||
var msgTip = ''
|
uni.showModal({
|
||||||
if (res.errMsg == 'getLocation:fail auth deny') {
|
title: "提示",
|
||||||
msgTip = '请允许小程序获取您的位置'
|
content: "您已拒绝获取位置信息,请重新授权",
|
||||||
} else if (res.errMsg == 'getLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
|
confirmText: "开启定位",
|
||||||
msgTip = '请您打开手机定位'
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.openSetting({
|
||||||
|
success: (res) => {
|
||||||
|
if (res.authSetting[
|
||||||
|
"scope.userLocation"]) {
|
||||||
|
this.currentPage = 1
|
||||||
|
// this.siteList = []
|
||||||
|
this.refreshLocation()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (msgTip) {
|
},
|
||||||
setTimeout(() => {
|
complete: () => {
|
||||||
uni.showToast({
|
this.getSiteList()
|
||||||
title: msgTip,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}, 300)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getSiteList() {
|
getSiteList() {
|
||||||
this.refreshLocation()
|
// this.refreshLocation()
|
||||||
let location = uni.getStorageSync('location')
|
// let location = uni.getStorageSync('location')
|
||||||
let data1 = {
|
let data1 = {
|
||||||
currentPage: this.currentPage,
|
currentPage: this.currentPage,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
params: {
|
params: {
|
||||||
siteAddress: this.siteAddress,
|
siteAddress: this.siteAddress,
|
||||||
|
longitude: 116.397451,
|
||||||
|
latitude: 39.909187,
|
||||||
...uni.getStorageSync('location'),
|
...uni.getStorageSync('location'),
|
||||||
siteBrand: this.filterDatas
|
siteBrand: this.filterDatas
|
||||||
.siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
|
.siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
|
||||||
@@ -506,8 +530,11 @@
|
|||||||
data1.params.role = 1
|
data1.params.role = 1
|
||||||
oilSiteApi.readOnlySites(data1).then(res => {
|
oilSiteApi.readOnlySites(data1).then(res => {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
|
if (this.currentPage == 1) {
|
||||||
|
this.siteList = []
|
||||||
|
}
|
||||||
this.siteList = this.siteList.concat(res.data.list)
|
this.siteList = this.siteList.concat(res.data.list)
|
||||||
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
if (res.data.list.length < 10) {
|
||||||
this.loadStatus = 'nomore'
|
this.loadStatus = 'nomore'
|
||||||
} else {
|
} else {
|
||||||
this.currentPage++
|
this.currentPage++
|
||||||
@@ -518,9 +545,11 @@
|
|||||||
} else {
|
} else {
|
||||||
oilSiteApi.getSiteList(data1).then(res => {
|
oilSiteApi.getSiteList(data1).then(res => {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
console.log(res, '+++')
|
if (this.currentPage == 1) {
|
||||||
|
this.siteList = []
|
||||||
|
}
|
||||||
this.siteList = this.siteList.concat(res.data.list)
|
this.siteList = this.siteList.concat(res.data.list)
|
||||||
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
if (res.data.list.length < 10) {
|
||||||
this.loadStatus = 'nomore'
|
this.loadStatus = 'nomore'
|
||||||
} else {
|
} else {
|
||||||
this.currentPage++
|
this.currentPage++
|
||||||
@@ -534,32 +563,31 @@
|
|||||||
|
|
||||||
toDetail(item) {
|
toDetail(item) {
|
||||||
let itemS = JSON.stringify(item)
|
let itemS = JSON.stringify(item)
|
||||||
|
if (item.channelCode === 'TY') {
|
||||||
if (uni.getStorageSync('user')) {
|
uni.setStorageSync('OtherSiteInfo', item)
|
||||||
if (item.channelCode === 'TY') {
|
|
||||||
uni.setStorageSync('OtherSiteInfo', item)
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
|
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
title: '请您登录',
|
|
||||||
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
|
|
||||||
confirmText: '去登陆',
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '../../../BagAuth/pages/login/login'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
|
||||||
|
})
|
||||||
|
// if (uni.getStorageSync('user')) {
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// uni.showModal({
|
||||||
|
// content: "登录后才能查看哦",
|
||||||
|
// confirmText: '去登陆',
|
||||||
|
// success: (res) => {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url: '../../../BagAuth/pages/login/login'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
nameSelect(value, item) {
|
nameSelect(value, item) {
|
||||||
this.title2 = item.text
|
this.title2 = item.text
|
||||||
@@ -587,7 +615,7 @@
|
|||||||
clearTimeout(this.getSiteListTimer);
|
clearTimeout(this.getSiteListTimer);
|
||||||
this.getSiteListTimer = setTimeout(() => {
|
this.getSiteListTimer = setTimeout(() => {
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
this.siteList = []
|
// this.siteList = []
|
||||||
this.getSiteList()
|
this.getSiteList()
|
||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
@@ -595,7 +623,7 @@
|
|||||||
clearTimeout(this.getSiteListTimer);
|
clearTimeout(this.getSiteListTimer);
|
||||||
this.getSiteListTimer = setTimeout(() => {
|
this.getSiteListTimer = setTimeout(() => {
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
this.siteList = []
|
// this.siteList = []
|
||||||
if (this.TabHead == 0) {
|
if (this.TabHead == 0) {
|
||||||
this.getSiteList()
|
this.getSiteList()
|
||||||
} else if (this.TabHead == 1) {
|
} else if (this.TabHead == 1) {
|
||||||
@@ -656,4 +684,4 @@
|
|||||||
.min-height-50 {
|
.min-height-50 {
|
||||||
min-height: 50vh;
|
min-height: 50vh;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
114
utils/request.js
114
utils/request.js
@@ -1,36 +1,32 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import utils from '@/utils/encode'
|
import utils from '@/utils/encode'
|
||||||
// const env = process.env.NODE_ENV
|
|
||||||
// const env = 'production'/* */
|
|
||||||
// const env = 'test'
|
// const env = 'test'
|
||||||
const env = 'production'
|
const env = 'production'
|
||||||
// 45
|
|
||||||
const testUrl = 'http://192.168.110.77:38080'
|
|
||||||
// const productUrl = 'https://www.xingoil.com/adminapi'
|
|
||||||
|
|
||||||
const productUrl = 'http://uat.xingoil.com/adminapi'
|
const testUrl = 'http://192.168.110.77:38080'
|
||||||
// const productUrl = 'http://192.168.0.191:38080'
|
// const productUrl = 'http://uat.xingoil.com/adminapi'
|
||||||
// const productUrl = 'http://121.196.213.68/adminapi'
|
const productUrl = 'https://www.xingoil.com/adminapi'
|
||||||
|
|
||||||
|
let whiteList = ['/oil-site/oilSiteOrderInfo/getOrderQrCode']
|
||||||
|
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: env == 'production' ? productUrl : testUrl,
|
baseURL: env == 'production' ? productUrl : testUrl,
|
||||||
// baseURL: testUrl,
|
// baseURL: testUrl,
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
let closeShowLoading
|
let closeShowLoading
|
||||||
var url = ''
|
var url = ''
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
// 拦截请求
|
closeShowLoading = config?.closeShowLoading || false;
|
||||||
closeShowLoading = config?.closeShowLoading||false;
|
if (!closeShowLoading) {
|
||||||
// console.log(closeShowLoading,'isLoadingisLoadingisLoading')
|
|
||||||
if(!closeShowLoading){
|
|
||||||
//判断是否自动开始请求loading
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const token = uni.getStorageSync('Authorization')
|
const token = uni.getStorageSync('Authorization')
|
||||||
const unionId = uni.getStorageSync('unionid')
|
const unionId = uni.getStorageSync('unionid')
|
||||||
const openId = uni.getStorageSync('openid')
|
const openId = uni.getStorageSync('openid')
|
||||||
@@ -44,35 +40,24 @@ service.interceptors.request.use(
|
|||||||
config.headers['dataSources'] = 'MP'
|
config.headers['dataSources'] = 'MP'
|
||||||
|
|
||||||
if (env === 'production') {
|
if (env === 'production') {
|
||||||
// console.log("这里是生产")
|
|
||||||
// 生产环境,加密,不输出任何东西
|
|
||||||
// 设置jsessionid和token
|
|
||||||
const JSESSIONID = utils.uuid()
|
const JSESSIONID = utils.uuid()
|
||||||
config.headers['JSESSIONID'] = JSESSIONID
|
config.headers['JSESSIONID'] = JSESSIONID
|
||||||
config.headers['token'] = utils.md5Salt(JSESSIONID)
|
config.headers['token'] = utils.md5Salt(JSESSIONID)
|
||||||
// if ( encryptWhite.indexOf(config.url) < 0) {
|
|
||||||
// if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) {
|
const data = {
|
||||||
// 这是定义在哪的
|
params: ''
|
||||||
const data = { // 用于存储加密
|
|
||||||
params: '' // 加密后的密文
|
|
||||||
}
|
}
|
||||||
// 要加密
|
|
||||||
data.params = utils.encrypt(JSON.stringify(config.data))
|
data.params = utils.encrypt(JSON.stringify(config.data))
|
||||||
// console.log('参数', config.url, '参数加密前', config.data, '加密:', data)
|
|
||||||
config.data = data
|
config.data = data
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
// console.log("这里是测试")
|
|
||||||
// console.log('\n\n-----------------------')
|
|
||||||
// console.log('参数', config.url, '参数加密前', config.data)
|
|
||||||
url = config.url
|
url = config.url
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
if(!closeShowLoading){
|
if (!closeShowLoading) {
|
||||||
//判断是否自动开始请求loading
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -83,62 +68,50 @@ service.interceptors.request.use(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
response => {
|
response => {
|
||||||
// console.log(response.config?.closePrompt,'response.config?.closePrompt')
|
|
||||||
const res = response.data
|
const res = response.data
|
||||||
if (env === 'production') {
|
if (env === 'production') {
|
||||||
// 生产环境,进行加密解密,不输出日志
|
|
||||||
if (res.encrypt == 1) {
|
if (res.encrypt == 1) {
|
||||||
// 加密的数据,需要解密
|
|
||||||
const dataParam = JSON.parse(utils.decrypt(res.data))
|
const dataParam = JSON.parse(utils.decrypt(res.data))
|
||||||
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
|
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
|
||||||
// console.log(res.data)
|
|
||||||
// console.log('返回', response.config.url, '返回结果',res)
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// console.log('返回', response.config.url, '返回结果未加密', res)
|
|
||||||
// console.log('-------------------------------------------\n\n')
|
|
||||||
}
|
}
|
||||||
if(!closeShowLoading){
|
if (!closeShowLoading) {
|
||||||
//判断是否自动开始请求loading
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
if (response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1) {
|
if (!whiteList.includes(response.config.url)) {
|
||||||
if (response.config.url.indexOf('/oil-site/oilSiteAppInfo/getBSiteDetails') != -1) {
|
if (res.code === 42011) {
|
||||||
// console.log('这里是getBSiteDetails 拦截处')
|
uni.showModal({
|
||||||
// if (res.code != 20000&&res.msg!='令牌为空,不允许操作'&&res.msg!='您的ip已经更改,请重新登录'&&res.msg!='登录与操作设备不同') {
|
title: "提示",
|
||||||
// uni.showToast({
|
content: "登录信息过期,请重新登录哦",
|
||||||
// title: res.msg,
|
confirmText: "去登录",
|
||||||
// icon: "none"
|
success: function(res) {
|
||||||
// })
|
if (res.confirm) {
|
||||||
// }
|
uni.navigateTo({
|
||||||
} else {
|
url: "/BagAuth/pages/login/login",
|
||||||
if (res.code != 20000 && res.msg != '令牌为空,不允许操作' && res.msg != '您的ip已经更改,请重新登录' && res.msg != '登录与操作设备不同') {
|
});
|
||||||
uni.showToast({
|
}
|
||||||
title: res.msg,
|
},
|
||||||
icon: "none"
|
});
|
||||||
});
|
return Promise.reject();
|
||||||
if (response.config.url.indexOf('/oil-user/oilCompanyInfo/getQrCodeType') != -1) {
|
}
|
||||||
setTimeout(() => {
|
if (res.code != 20000) {
|
||||||
uni.redirectTo({
|
uni.showToast({
|
||||||
url: '/BagAuth/pages/login/oldLogin'
|
title: res.msg,
|
||||||
})
|
icon: "none",
|
||||||
}, 2000)
|
});
|
||||||
}
|
return Promise.reject();
|
||||||
// return Promise.reject()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
if(!closeShowLoading){
|
if (!closeShowLoading) {
|
||||||
//判断是否自动开始请求loading
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
uni.getNetworkType({
|
uni.getNetworkType({
|
||||||
success: function(res) {
|
success: (res) => {
|
||||||
console.log(res.networkType);
|
|
||||||
if (res.networkType === 'none') {
|
if (res.networkType === 'none') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '没有网啦!',
|
title: '没有网啦!',
|
||||||
@@ -149,7 +122,6 @@ service.interceptors.response.use(
|
|||||||
title: '请求失败!',
|
title: '请求失败!',
|
||||||
icon: "none"
|
icon: "none"
|
||||||
})
|
})
|
||||||
console.log(error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -186,4 +158,4 @@ service.defaults.adapter = function(config) {
|
|||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
export default service
|
export default service
|
||||||
Reference in New Issue
Block a user