master
xiaozhiyong 6 months ago
parent bd75b1f7ac
commit 5803d8a222
  1. 4
      Activity/pages/index/index.vue
  2. 72
      App.vue
  3. 30
      BagAuth/pages/login/login.vue
  4. 5
      BagAuth/pages/login/oldLogin.vue
  5. 4
      BagStation/pages/routePlain/routePlain.vue
  6. 8
      components/sl-filter/sl-filter.vue
  7. 2
      pages/components/Advertisement.vue
  8. 39
      pages/index/startPage/startPage.vue
  9. 218
      pages/tabbar/home/home.vue
  10. 13
      pages/tabbar/qrCenter/qrCenter.vue
  11. 184
      pages/tabbar/station/stationList.vue
  12. 114
      utils/request.js

@ -73,8 +73,8 @@
})
} else {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {

@ -79,7 +79,6 @@
onShareAppMessage(e) {
let that = this
wx.onAppRoute((res) => {
// console.log(res, ' onShareAppMessage');
const pages = getCurrentPages() //
const view = pages[pages.length - 1] //
if (!view) return false //
@ -91,40 +90,38 @@
}
}
let white = ['pages/index/startPage/startPage','AppletCode/pages/index/index']
if(view.route === 'BagStation/pages/stationDetail/stationDetail') {
uni.removeStorageSync('refuseLogin')
}
// console.log('white.includes(view.route)',white.includes(view.route))
// //
let isRefuseLogin = uni.getStorageSync('refuseLogin')
if(isRefuseLogin || white.includes(view.route) || view.route.includes('BagAuth')) return
// console.log('111111111111111')
this.getAmount()
// let white = ['pages/index/startPage/startPage','AppletCode/pages/index/index']
// if(view.route === 'BagStation/pages/stationDetail/stationDetail') {
// uni.removeStorageSync('refuseLogin')
// }
// // //
// let isRefuseLogin = uni.getStorageSync('refuseLogin')
// if(isRefuseLogin || white.includes(view.route) || view.route.includes('BagAuth')) return
// this.getAmount()
})
},
// tokenip
getAmount() {
// clearTimeout(loginTimer)
accountApi.getTotalOilCardInfo().then(res => {
if (res.code == 42011) {
uni.setStorageSync('Authorization',null)
uni.setStorageSync('openid',null)
// if (res.code == 42011) {
// uni.setStorageSync('Authorization',null)
// uni.setStorageSync('openid',null)
uni.showModal({
title: '需要您重新登录',
content: res.msg,
duration: '3000',
showCancel:false,
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: '/BagAuth/pages/login/login'
})
}
}
})
}
// uni.showModal({
// title: '',
// content: res.msg,
// duration: '3000',
// showCancel:false,
// success: function(res) {
// if (res.confirm) {
// uni.redirectTo({
// url: '/BagAuth/pages/login/login'
// })
// }
// }
// })
// }
})
},
},
@ -142,15 +139,16 @@
// if (token && openid) {
// this.getAmount()
// }
uni.getLocation({
type: 'wgs84',
success: function(res) {
uni.setStorageSync('location', {
longitude: res.longitude + '',
latitude: res.latitude + ''
})
}
});
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// uni.setStorageSync('location', {
// longitude: res.longitude + '',
// latitude: res.latitude + ''
// })
// }
// });
},
}

@ -35,9 +35,10 @@
<button class="cu-btn margin-top round lg" @tap="refuseEmpower">
输入手机号码登录
</button>
<button class="cu-btn margin-top bg-0 round lg" style="font-size: 28rpx;" @tap="refuseLogin">
跳过登录
</button>
<!-- <button class="cu-btn margin-top bg-0 round lg" style="font-size: 28rpx;" @tap="refuseLogin">
回到首页
</button> -->
<view class="tip">仅提供给星油能源内部合作用户使用</view>
</view>
<view class="isKLUser" v-if='otherUser'>
<view class="isKLUser">卡力用户仅支持跳转登录</view>
@ -207,19 +208,19 @@
})
},
refuseLogin(){
uni.clearStorageSync()
uni.setStorageSync('refuseLogin','true')
// uni.clearStorageSync()
// uni.setStorageSync('refuseLogin','true')
uni.switchTab({
url: '/pages/tabbar/home/home'
})
},
refreshLocation() {
uni.getLocation({
type: 'wgs84',
success: function(res) {
uni.setStorageSync('location', res)
}
});
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// uni.setStorageSync('location', res)
// }
// });
},
autoLogin() {
let url = 'loginCompany'
@ -308,6 +309,13 @@
</script>
<style>
.tip {
position: absolute;
left: 0;
bottom: 150rpx;
width: 100%;
text-align: center;
}
.isKLUser{
font-size: 40rpx;
font-weight: 700;

@ -330,9 +330,10 @@
let type = this.TabCur == 0 ? 'Personal' : 'Company';
authApi.loginPwd(data, type).then(res => {
this.loginSuccess(res)
}).catch(err => {
this.logout()
})
// .catch(err => {
// this.logout()
// })
},
loginRandom() {
if (!this.checked) {

@ -331,8 +331,8 @@
})
} else {
uni.showModal({
title:'请您登录',
content:"登录星油云才可以加油 |˛˙꒳˙)♡",
content:"登录后才能查看哦",
confirmText:'去登陆',
success: (res) => {
if(res.confirm){

@ -138,7 +138,7 @@
this.titleList = titleArr;
this.tempTitleObj = r;
this.areaCodeList1 = this.areaCodeList
console.log(this.productCodeList,this.areaCodeList1,uni.getStorageSync('areaCodeList'),'-------------------')
// console.log(this.productCodeList,this.areaCodeList1,uni.getStorageSync('areaCodeList'),'-------------------')
},
// #endif
@ -176,7 +176,7 @@
this.titleList = titleArr;
this.tempTitleObj = r;
this.areaCodeList1 = this.areaCodeList
console.log(this.titleList,this.areaCodeList1,'-------------------ddd')
// console.log(this.titleList,this.areaCodeList1,'-------------------ddd')
},
// #endif
data() {
@ -246,8 +246,8 @@
showMenuClick(index) {
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {

@ -22,7 +22,7 @@
}
},
mounted() {
console.log('广告组件挂载完成');
// console.log('广');
this.showAdvertisement()
},
methods: {

@ -17,6 +17,7 @@
return {
showAdvertisement: false,
key: '',
isOnline:false,
option: null,
imgURL: this.global.imgURL + 'start/',
yellowURL: this.global.yellowURL + 'xq-ad/',
@ -96,10 +97,10 @@
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid')
// this.key = '';
let isOnline = false;
// this.isOnline = false;
if (token) {
await oilSiteApi.isLoginSuccess().then(res => {
if (res.code == 20000) isOnline = true
if (res.code == 20000) this.isOnline = true
}).catch(err => {})
}
// console.log(isOnline,'isOnline')
@ -108,7 +109,7 @@
// } else {
// this.key = '线'
// }
if (isOnline) {
if (this.isOnline) {
if (!uni.getStorageSync('filterData')) {
this.getFilterData()
} else if (uni.getStorageSync('filterData')[0].detailList.length < 2) {
@ -124,21 +125,21 @@
}
},
goHome(type) {
if (type) {
uni.setStorageSync('isJump', {
page: 'Financial/pages/estimate/index',
disposable: true
if (this.isOnline) {
if (type) {
uni.setStorageSync('isJump', {
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) {
// let taht = this
@ -167,9 +168,9 @@
...res.data,
qrCode: id
}),
fail(e) {
console.log(e, '跳转失败')
}
// fail(e) {
// console.log(e, '')
// }
})
}
})

@ -158,7 +158,8 @@
</view>
</view>
<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" />
<!-- <tabbar :current-page="0"/> -->
</view>
@ -241,7 +242,7 @@
}]
}
],
getCount: 0,
// getCount: 0,
siteList: [],
height: 0,
starUrl: this.global.starUrl,
@ -329,7 +330,7 @@
},
watch: {
showAuthFrror(n, o) {
console.log(n, o, '=================')
// console.log(n, o, '=================')
}
},
@ -403,18 +404,11 @@
},
onShow() {
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid')
if (token && openid) {
if (token) {
this.getAuthInfo()
this.refreshLocation()
} else {
uni.showToast({
title: '您还没有登录哦',
icon: "none"
})
}
this.getSiteList();
this.refreshLocation()
// this.getSiteList();
},
mounted() {},
beforeCreate() {},
@ -427,7 +421,7 @@
if (res.code == '20000') {
uni.showToast({
title: '该油卡已被禁用',
icon:'none'
icon: 'none'
})
uni.clearStorageSync()
uni.setStorageSync('loginOut', true)
@ -449,7 +443,7 @@
customerId: cardInfo.customerId
}).then(res => {
if (res.code === 20000) {
if(res.data.accountState == 0) {
if (res.data.accountState == 0) {
this.logOut()
}
}
@ -507,22 +501,28 @@
success: function(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) => {
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'
})
} else if (index == 1) {
if (!uni.getStorageSync('user')) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
return
}
// if (!uni.getStorageSync('user')) {
// uni.showModal({
// content: "",
// confirmText: '',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// return
// }
uni.removeStorageSync("origins")
uni.removeStorageSync("destination")
wx.navigateTo({
@ -611,26 +609,29 @@
} else if (index == 9) {
this.goToPage('/BagAuth/pages/agreeMent/OperationGuide')
} else if (index == 2) {
if (!uni.getStorageSync('user')) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
return
}
// if (!uni.getStorageSync('user')) {
// uni.showModal({
// content: "",
// confirmText: '',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// return
// }
wx.navigateTo({
url: '../../../BagStation/pages/overviewMap/overviewMap',
})
} else if (index == 6) {
uni.showToast({
title: '功能即将开放,敬请期待',
icon: 'none'
})
return
const user = uni.getStorageSync('user');
if (user) {
Financial.findHomePageReport({
@ -657,7 +658,7 @@
this.swiperClick(this.swiperArray[0], 1)
} else {
uni.showToast({
title: '功能暂无',
title: '功能即将开放,敬请期待',
icon: 'none'
})
}
@ -670,8 +671,7 @@
// })
if (!uni.getStorageSync('user')) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
@ -731,38 +731,20 @@
})
return
}
this.getCount++
// this.getCount++
if (res.code == 20000) {
// console.log(res.data.list)
this.siteList = res.data.list
} else {
if (this.getCount == 1) {
setTimeout(() => {
this.getSiteList()
}, 1000)
}
// else {
// if (this.getCount == 1) {
// setTimeout(() => {
// 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 {
oilSiteApi.getSiteList(data1).then(res => {
@ -775,33 +757,31 @@
},
toDetail(item) {
let itemS = JSON.stringify(item)
if (uni.getStorageSync('user')) {
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
})
return
}
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
})
} else {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
})
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() {
oilSiteApi.getCheckInfo().then(res => {
@ -901,16 +881,12 @@
}
})
},
scan1() {
//
this.getScanRes('fixed_1371293944539422720')
},
openScan() {
let user = uni.getStorageSync('user')
if (!user) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {

@ -68,8 +68,8 @@
qrFn(){
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
@ -136,15 +136,12 @@
}
})
},
scan1() {
//
this.getScanRes('fixed_1371293944539422720')
},
scan() {
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {

@ -132,7 +132,7 @@
}
]
},
{
title: '0#轻柴油',
key: 'oilProductCode',
@ -239,12 +239,12 @@
onLoad() {
if (!uni.getStorageSync('filterDatas')) {
this.getFilterData()
} else {}
}
this.findPriceDetails()
if (uni.getStorageSync('productCodeList')) {
this.productCodeList = uni.getStorageSync('productCodeList')
}
this.getSiteList()
// this.getSiteList()
},
onPullDownRefresh() {
this.updateFn()
@ -282,7 +282,7 @@
pageSize: 10,
params: { //Object //
// siteNameOrId: this.siteName, //()
address:this.siteAddress,
address: this.siteAddress,
productType: this.productType ? this.productType : '', //1- 2-
brandName: this.brandName ? this.brandName : '', //
currentLongitude: location.longitude + '', //
@ -328,11 +328,28 @@
},
changeHaed(code) {
this.TabHead = code
this.siteList = []
// this.siteList = []
this.siteAddress = ''
this.currentPage = 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) {
this.getSiteList()
}
@ -340,31 +357,31 @@
ureaToDetail(list) {
let itemS = JSON.stringify(list)
if (uni.getStorageSync('user')) {
uni.navigateTo({
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
})
} else {
uni.showModal({
title: '请您登录',
content: "登录小星加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
}
uni.navigateTo({
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
})
// if (uni.getStorageSync('user')) {
// } else {
// uni.showModal({
// content: "",
// confirmText: '',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '/BagAuth/pages/login/login'
// })
// }
// }
// })
// }
},
filterRes(val) {
console.log(val, '重置')
if (this.TabHead == 0) {
this.filterDatas = val
this.currentPage = 1
this.siteList = []
// this.siteList = []
this.getSiteList()
} else {
if (val.formats == 2) {
@ -376,7 +393,7 @@
this.productType = val.formats
this.brandName = val.productType
this.currentPage = 1
this.siteList = []
// this.siteList = []
this.getUreaList()
}
},
@ -393,7 +410,6 @@
this.productCodeList = uni.getStorageSync('productCodeList')
res.data.channelCodes.map(item => {
// this.menuList[3].detailLists.push({
// title: item.name,
// value: item.id
@ -433,7 +449,7 @@
},
]
}
console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
// console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
})
},
onSelected(e) {
@ -448,8 +464,6 @@
}
this.ureaMenuList[1].detailList.push(obj)
})
console.log(this.ureaMenuList)
console.log(this.productTypes)
})
},
refreshLocation() {
@ -458,34 +472,44 @@
success: function(res) {
uni.setStorageSync('location', res)
},
complete(res) {
console.log('定位', res)
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)
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.currentPage = 1
// this.siteList = []
this.refreshLocation()
}
},
});
}
},
});
}
},
complete: () => {
this.getSiteList()
}
})
},
getSiteList() {
this.refreshLocation()
let location = uni.getStorageSync('location')
// this.refreshLocation()
// let location = uni.getStorageSync('location')
let data1 = {
currentPage: this.currentPage,
pageSize: 10,
params: {
siteAddress: this.siteAddress,
longitude: 116.397451,
latitude: 39.909187,
...uni.getStorageSync('location'),
siteBrand: this.filterDatas
.siteBrand, // // ( 1- 2- 3- 4- 5- 6- 7- 8- )
@ -506,8 +530,11 @@
data1.params.role = 1
oilSiteApi.readOnlySites(data1).then(res => {
if (res.code == 20000) {
if (this.currentPage == 1) {
this.siteList = []
}
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //
if (res.data.list.length < 10) {
this.loadStatus = 'nomore'
} else {
this.currentPage++
@ -518,9 +545,11 @@
} else {
oilSiteApi.getSiteList(data1).then(res => {
if (res.code == 20000) {
console.log(res, '+++')
if (this.currentPage == 1) {
this.siteList = []
}
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //
if (res.data.list.length < 10) {
this.loadStatus = 'nomore'
} else {
this.currentPage++
@ -534,32 +563,31 @@
toDetail(item) {
let itemS = JSON.stringify(item)
if (uni.getStorageSync('user')) {
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
})
return
}
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
})
} else {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
})
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) {
this.title2 = item.text
@ -587,7 +615,7 @@
clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1
this.siteList = []
// this.siteList = []
this.getSiteList()
}, 500);
},
@ -595,7 +623,7 @@
clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1
this.siteList = []
// this.siteList = []
if (this.TabHead == 0) {
this.getSiteList()
} else if (this.TabHead == 1) {
@ -656,4 +684,4 @@
.min-height-50 {
min-height: 50vh;
}
</style>
</style>

@ -1,36 +1,32 @@
import axios from 'axios'
import utils from '@/utils/encode'
// const env = process.env.NODE_ENV
// const env = 'production'/* */
// const env = 'test'
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 productUrl = 'http://192.168.0.191:38080'
// const productUrl = 'http://121.196.213.68/adminapi'
const testUrl = 'http://192.168.110.77:38080'
// const productUrl = 'http://uat.xingoil.com/adminapi'
const productUrl = 'https://www.xingoil.com/adminapi'
let whiteList = ['/oil-site/oilSiteOrderInfo/getOrderQrCode']
const service = axios.create({
baseURL: env == 'production' ? productUrl : testUrl,
// baseURL: testUrl,
timeout: 5000
})
let closeShowLoading
let closeShowLoading
var url = ''
service.interceptors.request.use(
config => {
// 拦截请求
closeShowLoading = config?.closeShowLoading||false;
// console.log(closeShowLoading,'isLoadingisLoadingisLoading')
if(!closeShowLoading){
//判断是否自动开始请求loading
closeShowLoading = config?.closeShowLoading || false;
if (!closeShowLoading) {
uni.showLoading({
title: '加载中...',
mask: true
})
}
const token = uni.getStorageSync('Authorization')
const unionId = uni.getStorageSync('unionid')
const openId = uni.getStorageSync('openid')
@ -44,35 +40,24 @@ service.interceptors.request.use(
config.headers['dataSources'] = 'MP'
if (env === 'production') {
// console.log("这里是生产")
// 生产环境,加密,不输出任何东西
// 设置jsessionid和token
const JSESSIONID = utils.uuid()
config.headers['JSESSIONID'] = 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))
// console.log('参数', config.url, '参数加密前', config.data, '加密:', data)
config.data = data
// }
} else {
// console.log("这里是测试")
// console.log('\n\n-----------------------')
// console.log('参数', config.url, '参数加密前', config.data)
url = config.url
}
return config
},
error => {
if(!closeShowLoading){
//判断是否自动开始请求loading
if (!closeShowLoading) {
uni.hideLoading()
}
uni.showToast({
@ -83,62 +68,50 @@ service.interceptors.request.use(
}
)
service.interceptors.response.use(
response => {
// console.log(response.config?.closePrompt,'response.config?.closePrompt')
response => {
const res = response.data
if (env === 'production') {
// 生产环境,进行加密解密,不输出日志
if (res.encrypt == 1) {
// 加密的数据,需要解密
const dataParam = JSON.parse(utils.decrypt(res.data))
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){
//判断是否自动开始请求loading
if (!closeShowLoading) {
uni.hideLoading()
}
if (response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1) {
if (response.config.url.indexOf('/oil-site/oilSiteAppInfo/getBSiteDetails') != -1) {
// console.log('这里是getBSiteDetails 拦截处')
// if (res.code != 20000&&res.msg!='令牌为空,不允许操作'&&res.msg!='您的ip已经更改,请重新登录'&&res.msg!='登录与操作设备不同') {
// uni.showToast({
// title: res.msg,
// icon: "none"
// })
// }
} else {
if (res.code != 20000 && res.msg != '令牌为空,不允许操作' && res.msg != '您的ip已经更改,请重新登录' && res.msg != '登录与操作设备不同') {
uni.showToast({
title: res.msg,
icon: "none"
});
if (response.config.url.indexOf('/oil-user/oilCompanyInfo/getQrCodeType') != -1) {
setTimeout(() => {
uni.redirectTo({
url: '/BagAuth/pages/login/oldLogin'
})
}, 2000)
}
// return Promise.reject()
}
if (!whiteList.includes(response.config.url)) {
if (res.code === 42011) {
uni.showModal({
title: "提示",
content: "登录信息过期,请重新登录哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return Promise.reject();
}
if (res.code != 20000) {
uni.showToast({
title: res.msg,
icon: "none",
});
return Promise.reject();
}
}
return res
},
error => {
if(!closeShowLoading){
//判断是否自动开始请求loading
if (!closeShowLoading) {
uni.hideLoading()
}
uni.getNetworkType({
success: function(res) {
console.log(res.networkType);
success: (res) => {
if (res.networkType === 'none') {
uni.showToast({
title: '没有网啦!',
@ -149,7 +122,6 @@ service.interceptors.response.use(
title: '请求失败!',
icon: "none"
})
console.log(error)
}
}
});
@ -186,4 +158,4 @@ service.defaults.adapter = function(config) {
}
// #endif
export default service
export default service
Loading…
Cancel
Save