wszhyWx/pages/web_view_controller/web_view_controller.vue

50 lines
922 B
Vue

<template>
<web-view v-if='src' :src="src"></web-view>
</template>
<script>
export default {
data() {
return {
token:'',
deviceId:'',
src:'',
userid:'',
url:''
};
},
onLoad(options) {
let that = this
uni.getStorage({
key: 'token',
success: function(res) {
// console.log('res',res);
that.token = res.data;
uni.getStorage({
key:'userid',
success:function(res){
that.userid = res.data
that.src = `https://portal.lihe-control.com/#/${options.url}?token=${that.token}&userid=${that.userid}&deviceId=${options.deviceId}`+ (options.num ? '&id=' + options.num : '')
console.log(that.src);
}
})
},
fail:function(err){
uni.navigateTo({
url:'/pages/controller/controller'
});
uni.showToast({
title: "跳转失败!",
icon: 'fail',
})
}
})
}
}
</script>
<style lang="scss">
</style>