xiaozy_优化 #3

Closed
caoliancun wants to merge 6 commits from xiaozy_优化 into master
6 changed files with 43 additions and 91 deletions
Showing only changes of commit 4176a82927 - Show all commits

117
App.vue
View File

@@ -100,7 +100,6 @@
this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes) this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes)
this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands) this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands)
uni.setStorageSync('filterData', this.menuList) uni.setStorageSync('filterData', this.menuList)
console.log(uni.getStorageSync('filterData'),'pppppppppppppppppppppppp')
// this.$refs.slFilter.resetMenuList(this.menuList) // this.$refs.slFilter.resetMenuList(this.menuList)
} }
}) })
@@ -108,15 +107,10 @@
onShareAppMessage() { onShareAppMessage() {
let that = this let that = this
wx.onAppRoute(() => { wx.onAppRoute(() => {
let white = ['BagStation/pages/stationDetail/stationDetail']
// console.log('当前页面路由发生变化 触发该事件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
// 若想给个别页面做特殊处理 可以给特殊页面加isOverShare为true 就不会重写了
// const data = view.data
// if (!data.isOverShare) {
// data.isOverShare = true
view.onShareAppMessage = () => { //重写分享配置 view.onShareAppMessage = () => { //重写分享配置
return { return {
title: '中品加油', title: '中品加油',
@@ -125,85 +119,47 @@
imageUrl: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/login-bg.png', imageUrl: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/login-bg.png',
} }
} }
console.log(view.route) // console.log(view.route)
clearTimeout(loginTimer) clearTimeout(loginTimer)
clearTimeout(onlineTimer) clearTimeout(onlineTimer)
if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { if(view.route === 'pages/index/startPage/startPage' || view.route.includes('BagAuth')) return
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid') const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid')
let jumpUrl = '/BagAuth/pages/login/login'
let target = {} console.log('token',token)
console.log('openid',openid)
// if(view.route === 'BagStation/pages/stationDetail/stationDetail') {
// let urlTarget = this.obtainUrlPathParameterTarget(view.$page.fullPath)
// if(urlTarget.q) {
// let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q))
// target = this.obtainUrlPathParameterTarget(originLink)
// target.siteId && (jumpUrl += `?scanningParams=${decodeURIComponent(urlTarget.q)}`)
// }
// }
// console.log('jumpUrl',jumpUrl) if (token && openid) {
if (token && openid) { this.getAmount()
this.getAmount()
// if(!white.includes(view.route) ){
// this.getAmount()
// }
// if(target.siteId || !white.includes(view.route) ){
// this.getAmount()
// }
onlineTimer = setTimeout(() => { onlineTimer = setTimeout(() => {
if (this.loginStatus == 'offline') { if (this.loginStatus == 'offline') {
uni.clearStorageSync() uni.clearStorageSync()
uni.showModal({ uni.showModal({
title: '需要您重新登录', title: '需要您重新登录',
content: this.msg, content: this.msg,
duration: '3000', duration: '3000',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
uni.redirectTo({ uni.redirectTo({
url: jumpUrl url: '/BagAuth/pages/login/login'
}) })
}
},
complete: () => {
clearTimeout(onlineTimer)
} }
}) },
}else{ complete: () => {
// if(!uni.getStorageSync('filterData')){ clearTimeout(onlineTimer)
// that.getFilterData() }
// }
}
}, 500)
} else {
target.siteId && uni.redirectTo({
url: jumpUrl
}) })
// loginTimer = setTimeout(() => { }else{
// uni.showModal({
// title: '请您登录',
// content: '您还没有登录,暂时查不到油站哦',
// duration: '3000',
// success: function(res) {
// if (res.confirm) {
// uni.redirectTo({
// url: '/BagAuth/pages/login/login'
// })
// }
// }
// })
// }, 1000)
}
}
}, 500)
} else {
} }
// }
}) })
}, },
@@ -216,16 +172,14 @@
target[item.split('=')[0]] = item.split('=')[1] target[item.split('=')[0]] = item.split('=')[1]
}) })
} }
console.log('11target',target)
return target return target
}, },
// 是否token过期或ip更改 // 是否token过期或ip更改
getAmount() { getAmount() {
console.log('执行')
clearTimeout(loginTimer) clearTimeout(loginTimer)
accountApi.getTotalOilCardInfo().then(res => { accountApi.getTotalOilCardInfo().then(res => {
console.log('res.code',res.code)
console.log(555)
if (res.code == 20000) { if (res.code == 20000) {
this.loginStatus = 'online' this.loginStatus = 'online'
} else if (res.code == 42011) { } else if (res.code == 42011) {
@@ -241,7 +195,6 @@
}, },
onShow: function() { onShow: function() {
console.log(12388)
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: function(res) { success: function(res) {
@@ -251,7 +204,6 @@
}) })
} }
}); });
console.log('onReady')
const token = uni.getStorageSync('Authorization') const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid') const openid = uni.getStorageSync('openid')
let key = '' let key = ''
@@ -265,7 +217,6 @@
} }
setTimeout(() => { setTimeout(() => {
console.log(key)
if (key == '在线') { if (key == '在线') {
} else { } else {

View File

@@ -162,6 +162,7 @@
if(scanningParamsLocale || options.scanningParams) { if(scanningParamsLocale || options.scanningParams) {
// 用于扫码进入油站详情页面 // 用于扫码进入油站详情页面
uni.setStorageSync('scanningParams',options.scanningParams || scanningParamsLocale) uni.setStorageSync('scanningParams',options.scanningParams || scanningParamsLocale)
console.log('login scanningParams',uni.getStorageSync('scanningParams'))
} }
this.refreshLocation() this.refreshLocation()
uni.login({ uni.login({

View File

@@ -191,9 +191,9 @@
if(option.q) { if(option.q) {
uni.setStorageSync('scanningParams',option.q) uni.setStorageSync('scanningParams',option.q)
console.log('stationDetail scanningParams',uni.getStorageSync('scanningParams'))
let originLink = decodeURIComponent(option.q) let originLink = decodeURIComponent(option.q)
let target = this.obtainUrlPathParameterTarget(originLink) let target = this.obtainUrlPathParameterTarget(originLink)
console.log('target',target)
if(target.siteId) { if(target.siteId) {
this.siteId = target.siteId this.siteId = target.siteId
this.getSiteInfo(target.siteId) this.getSiteInfo(target.siteId)

View File

@@ -83,14 +83,14 @@
} }
}, },
created() { created() {
console.log(this.siteItem,'-----------------') // console.log(this.siteItem,'-----------------')
}, },
methods: { methods: {
}, },
filters: { filters: {
channelCodeFamt(value) { channelCodeFamt(value) {
console.log(value) // console.log(value)
if (!value) { if (!value) {
return '未知' return '未知'
// 渠道编码 ( XOIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌) // 渠道编码 ( XOIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌)

View File

@@ -357,7 +357,7 @@
// this.goCall() // this.goCall()
// break; // break;
default: default:
console.log('item.link') // console.log('item.link')
uni.navigateTo({ uni.navigateTo({
url: '/pages/tabbar/home/link?url=' + encodeURIComponent(JSON.stringify(item.link)) url: '/pages/tabbar/home/link?url=' + encodeURIComponent(JSON.stringify(item.link))
}) })
@@ -686,7 +686,7 @@
scanType: 'qrCode', scanType: 'qrCode',
onlyFromCamera: false, onlyFromCamera: false,
success: (res) => { success: (res) => {
console.log(res.result) // console.log(res.result)
this.getScanRes(res.result) this.getScanRes(res.result)
}, },
fail: (err) => { fail: (err) => {

View File

@@ -3,8 +3,8 @@ import utils from '@/utils/encode'
// const env = process.env.NODE_ENV // const env = process.env.NODE_ENV
// const env = 'production'/* */ // const env = 'production'/* */
const env = 'production' const env = 'test'
const testUrl = 'http://192.168.110.10:38080' const testUrl = 'http://192.168.110.230:38080'
// const productUrl = 'http://121.196.213.68/adminapi' //预生产 // const productUrl = 'http://121.196.213.68/adminapi' //预生产
// const productUrl = 'https://www.xingoil.com/adminapi' // 生产,加密 new // const productUrl = 'https://www.xingoil.com/adminapi' // 生产,加密 new
@@ -12,7 +12,7 @@ const productUrl = 'http://uat.xingoil.com/adminapi' // 生产,加密 new
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
}) })
var url = '' var url = ''