123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <view>
- <web-view :webview-styles="webviewStyles" :src="url" style='width: 100%;max-width:100%' ></web-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- url: "",
- webviewStyles: {
- progress: {
- color: '#F07423'
- }
- },
- type: "",
- };
- },
- onLoad(param) {
- this.type = param.type;
- let title = ""
- if (this.type == 1) {
- title = "用户使用协议"
- } else if (this.type == 2) {
- title = "隐私协议"
- } else if (this.type == 3) {
- title = "入驻协议"
- }
- uni.setNavigationBarTitle({
- title: title
- })
- this.webviewStyles.progress.color = getApp().globalData.color1;
- this.queryProtocolConfigView();
- },
- methods: {
- async queryProtocolConfigView() {
- let res = await this.$myRequest({
- url: "/project/queryProtocolConfigView",
- data: {},
- })
- if (res.data.success) {
- const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=")
- if (this.type == '1') { //使用协议
- this.url = curryUrl(res.data.single.userUseProtocol);
- } else if (this.type == '2') { //隐私协议
- this.url = curryUrl(res.data.single.userPrivacyProtocol);
- } else if (this.type == '3') { //业主注册协议
- this.url = curryUrl(res.data.single.ownerRegistProtocol);
- }
- }
- },
- curry(baseUrl) {
- return function(url) {
- let index = url.lastIndexOf('.');
- if (url.substring(index + 1).indexOf('pdf') > -1) {
- return baseUrl + url;
- } else {
- return url;
- }
- }
- },
- }
- }
- </script>
- <style lang="scss">
- </style>
|