Commit ac5edd5c by 杨北旺

修复头像显示问题

1 parent 319ec225
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
Notify Notify
} from 'vant' } from 'vant'
import store from '@/store' import store from '@/store'
import { common,equity } from '../api/api' import { common } from '../api/api'
Vue.use(VueRouter) Vue.use(VueRouter)
const router = new VueRouter({ const router = new VueRouter({
routes, routes,
...@@ -75,14 +75,15 @@ const getSessionAppId = (sid,status) => { ...@@ -75,14 +75,15 @@ const getSessionAppId = (sid,status) => {
setUserInfo(data); setUserInfo(data);
if(status) { if(status) {
store.commit('reload'); store.commit('reload');
}else {
equity.getCardInfo().then(res => {
let { code } = res;
if (code == 0) {
router.push({name: 'equity.index'})
}
})
} }
// else {
// equity.getCardInfo().then(res => {
// let { code } = res;
// if (code == 0) {
// router.push({name: 'equity.index'})
// }
// })
// }
} }
}) })
} }
......
...@@ -21,6 +21,15 @@ export default { ...@@ -21,6 +21,15 @@ export default {
center:false center:false
}; };
}, },
created(){
if (window.history && window.history.pushState) {
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', this.watchReturn, false);//false阻止默认事件
  }
},
destroyed() {
window.removeEventListener('popstate', this.watchReturn, false);//false阻止默认事件
},
mounted() { mounted() {
let result = this.getLocalStorage("bindinfo"); let result = this.getLocalStorage("bindinfo");
const {code,errId,message} = result const {code,errId,message} = result
...@@ -41,6 +50,11 @@ export default { ...@@ -41,6 +50,11 @@ export default {
methods: { methods: {
copyName(){ copyName(){
this.cloneText('嘀加智享车生活') this.cloneText('嘀加智享车生活')
},
watchReturn(){
// this.$router.replace({ name: "common.expcard"});
window.history.back();
history.pushState(null, null, document.URL);
} }
}, },
}; };
......
...@@ -245,6 +245,10 @@ export default { ...@@ -245,6 +245,10 @@ export default {
this.isOpen = 0; this.isOpen = 0;
} }
// 重新获取头像,避免头像拿不到 // 重新获取头像,避免头像拿不到
//app那边可能拿不到头像---写这个重新获取一下
let { nickName, logo } = this.$store.state;
this.userInfo.nickName = nickName;
this.userInfo.logo = logo;
this.getUserInfoBySession(); this.getUserInfoBySession();
// 试用期到期。弹框提示 // 试用期到期。弹框提示
let showMydialog1 = this.getLocalStorage("showMydialog1"); let showMydialog1 = this.getLocalStorage("showMydialog1");
...@@ -266,7 +270,6 @@ export default { ...@@ -266,7 +270,6 @@ export default {
this.isConcernFn(); this.isConcernFn();
//app那边可能拿不到头像---写这个重新获取一下 //app那边可能拿不到头像---写这个重新获取一下
let { nickName, logo } = this.$store.state; let { nickName, logo } = this.$store.state;
console.log('store',this.$store.state);
this.userInfo.nickName = nickName; this.userInfo.nickName = nickName;
this.userInfo.logo = logo; this.userInfo.logo = logo;
}, },
......
...@@ -258,6 +258,8 @@ export default { ...@@ -258,6 +258,8 @@ export default {
}, },
//详情 //详情
jumpDetail(val) { jumpDetail(val) {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
window.vm.$router.push({ name: 'oilStation.detail',query:{ window.vm.$router.push({ name: 'oilStation.detail',query:{
oilId: val.id, oilId: val.id,
oilNo: val.oilNo, oilNo: val.oilNo,
...@@ -266,6 +268,28 @@ export default { ...@@ -266,6 +268,28 @@ export default {
distance: val.distance distance: val.distance
} }
}) })
}else{
let { sessionId } = this.$store.state;
let [href] = window.location.href.split('/#/');
let url = `${href}/#/oilStation/detail?sessionId=${sessionId}&oilId=${val.id}&&oilNo=${val.oilNo}&longitude=${val.gasAddressLongitude}&latitude=${val.gasAddressLatitude}&distance=${val.distance}`;
this.openWindows(url, 'oilStation.detail')
}
// const ua = navigator.userAgent.toLowerCase()
// if (ua.match(/MicroMessenger/i) == 'micromessenger') {
// window.vm.$router.push({ name: 'oilStation.detail',query:{
// oilId: val.id,
// oilNo: val.oilNo,
// longitude: val.gasAddressLongitude,
// latitude: val.gasAddressLatitude,
// distance: val.distance
// }
// })
// }else{
// let [href] = window.location.href.split('/#/');
// let url = `${href}/#/cardRoll/detail?sessionId=${sessionId}&oilId=${val.id}&&oilNo=${val.oilNo}&longitude=${val.gasAddressLongitude}&latitude=${val.gasAddressLatitude}&distance=${distance}`;
// this.openWindows(url, 'cardRoll.detail')
// }
}, },
change() { change() {
this.pageNum = 1; this.pageNum = 1;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!