| | |
| | | <div id="app"> |
| | | <transition name="fade" mode="out-in"> |
| | | <!-- 页面,isRouterAlive 刷新用 --> |
| | | <router-view v-if="isRouterAlive"/> |
| | | <!-- <router-view v-if="isRouterAlive"/> --> |
| | | <div> |
| | | <keep-alive> |
| | | <router-view v-if="isRouterAlive" /> |
| | | </keep-alive> |
| | | </div> |
| | | </transition> |
| | | |
| | | <!-- Toast 提示 --> |
| | |
| | | // 入口参数 |
| | | // 这里注释入口参数 |
| | | |
| | | import Login from '@/utils/jun_login.js' |
| | | // import Login from '@/utils/jun_login.js' |
| | | import wxsign from '@/utils/wxsign.js' |
| | | import Config from './config' |
| | | import eruda from 'eruda' |
| | | // import Config from './config' |
| | | // import xioFn from './utils/xio_fn.js' |
| | | // import eruda from 'eruda' |
| | | export default { |
| | | name: 'App', |
| | | |
| | |
| | | console.log('app amounted') |
| | | |
| | | // 避免刷新导致code重复使用 |
| | | let code = this.getQueryString('code') // 微信回调code |
| | | let cover = this.getQueryString('cover') // 是否封面入口 |
| | | let local_code = this.getLocalStorage('code') // 本地缓存code |
| | | let isRule = this.getQueryString('rule')==1 // 规则 |
| | | let isCoupon = this.getQueryString('coupon')==1 // 优惠券 |
| | | // let code = this.getQueryString('code') // 微信回调code |
| | | // let cover = this.getQueryString('cover') // 是否封面入口 |
| | | // let local_code = this.getLocalStorage('code') // 本地缓存code |
| | | // let isRule = this.getQueryString('rule')==1 // 规则 |
| | | // let isCoupon = this.getQueryString('coupon')==1 // 优惠券 |
| | | |
| | | // 以下情况需要重定向到长链 |
| | | // 1. 链接带有code,但code已经用过 |
| | |
| | | // 4. 非优惠券单页 |
| | | // console.dir(Config.createCodeUrl()) |
| | | |
| | | if(Config.isWxLoginType){ |
| | | if (code && local_code == code || (!isCoupon && !isRule && !cover && !code && !Config.ismock && !Config.istest)) { |
| | | // 该微信code已使用,重新跳转长链 |
| | | Login.toLongUrl() |
| | | return |
| | | } else { |
| | | this.removeLocalStorage('code') |
| | | } |
| | | } |
| | | // if(Config.isWxLoginType){ |
| | | // if (code && local_code == code || (!isCoupon && !isRule && !cover && !code && !Config.ismock && !Config.istest)) { |
| | | // // 该微信code已使用,重新跳转长链 |
| | | // Login.toLongUrl() |
| | | // return |
| | | // } else { |
| | | // this.removeLocalStorage('code') |
| | | // } |
| | | // } |
| | | |
| | | // 刷新固定首页 |
| | | if (location.hash && location.hash!='#/') { |
| | | this.$router.replace({name: 'root'}) |
| | | } |
| | | // if (location.hash && location.hash!='#/') { |
| | | // this.$router.replace({name: 'root'}) |
| | | // } |
| | | |
| | | // 暴露到全局,jun_httpEvent.js 调用 |
| | | window.appLoading = this.loading.bind(this) |
| | |
| | | window.appToast = this.toast.bind(this) |
| | | |
| | | // this.$refs.audio.play() |
| | | if(Config.isWxLoginType) this.wxinit() |
| | | // if(Config.isWxLoginType) this.wxinit() |
| | | |
| | | }, |
| | | methods: { |
| | | // 微信初始化 |