123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <template>
- <web-view :src="webViewSrc"></web-view>
- </template>
- <script>
- import {getToken} from '@/libs/auth.js';
- export default {
- data() {
- return {
- webViewSrc:""
- }
- },
- onLoad(options) {
- this.init(options)
- },
- methods: {
- init(options){
- let t=new Date().getTime()
- if(options.type==='scan'){
- let href="http://h5.xazhyc.com/scanApp/#/pages/index/index"
- let qrcode=uni.getStorageSync('qrcode')
- qrcode=qrcode.split('?')[1]
- this.webViewSrc=`${href}?token=${getToken()}&${qrcode}&v=${t}`
- uni.setNavigationBarTitle({
- title:"扫码操作"
- })
- }else{
- let other=""
- for(let key in options){
- if(key!=='href'&&key!=='name'){
- other+=`${key}=${options[key]}&`
- }
- }
- this.webViewSrc=`${options.href}?token=${getToken()}&${other}v=${t}`
- uni.setNavigationBarTitle({
- title:`${options.name}`
- })
- }
- }
- }
- }
- </script>
|