报名工具小程序初始代码
This commit is contained in:
47
pages/web/WebActivity.vue
Normal file
47
pages/web/WebActivity.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<web-view :src="url"></web-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
onLoad(e) {
|
||||
// 获取传递的网址
|
||||
this.url = this.getWEBExtra(e)
|
||||
if (this.url.indexOf("?") != -1) {
|
||||
// 代表有拼接,传递登录的sid给网页,让网页去保存sid
|
||||
this.url += ("&loginSid=" + getApp().globalData.memberSid)
|
||||
this.url += ("&writeLogin=" + true)
|
||||
} else {
|
||||
// 代表无拼接,传递登录的sid给网页,让网页去保存sid
|
||||
this.url += ("?loginSid=" + getApp().globalData.memberSid)
|
||||
this.url += ("&writeLogin=" + true)
|
||||
}
|
||||
|
||||
|
||||
let _this = this
|
||||
// $on 监听事件
|
||||
uni.$on('login', (data) => {
|
||||
// 这里加载登录状态保存的页面
|
||||
_this.url = "https://www.ourpyw.com/hide/#/pages/login/LoginState?loginSid=" + getApp().globalData
|
||||
.memberSid + "&writeLogin=" + true + "&refresh=" + true
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
// 移除监听事件
|
||||
uni.$off('login');
|
||||
}
|
||||
// 不能支持分享,否则可能把登录状态页分享出去
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user