configurationDetail.vue
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<template>
<view class="content">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<web-view :src="showConfiguration" bindload="bindload" binderror="binderror"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
showConfiguration: '',
params: ''
};
},
onLoad(e) {
uni.setStorageSync('getConfiguration', {
isConfiguration: true
});
if (e.configId !== null) {
this.params = e.configId;
this.requestUrl(this.params);
}
// 隐藏原生的tabbar
uni.hideTabBar();
},
onShow() {
uni.setStorageSync('getConfiguration', {
isConfiguration: true
});
},
onUnload() {
uni.setStorageSync('getConfiguration', {
isConfiguration: false
});
uni.removeStorageSync('config');
},
methods: {
// 网页加载成功时候触发此事件
bindload(res) {
console.log(res, res.detail);
},
// 网页加载失败的时候触发此事件
binderror(err) {
console.log(err, err.detail);
},
async requestUrl(e) {
const httpData = {
configurationId: e,
lightbox: 1
};
const getUrl = await uni.$u.http.get('/', {
params: httpData,
custom: {
load: false
}
});
const pathUrl = uni.getStorageSync('config');
const userInfo = uni.getStorageSync('userInfo')
this.showConfiguration =
`${pathUrl.baseURL}/?configurationId=${e}&userId=${userInfo.userId}&lightbox=1`
}
}
};
</script>
<style lang="scss" scoped>
.content {
background: #f8f9fa;
min-height: 100vh;
}
</style>