zqwang 2 роки тому
батько
коміт
8a5b17c4b4

+ 1 - 8
.quickapp.preview.json

@@ -1,13 +1,6 @@
 {
   "modeOptions": {
     "current": -1,
-    "list": [
-      {
-        "name": "ts",
-        "pathName": "views/Free",
-        "query": "",
-        "id": 0
-      }
-    ]
+    "list": []
   }
 }

+ 8 - 5
src/components/yinsi/policy.ux

@@ -50,11 +50,14 @@ export default {
     })
   },
   gotoPrivacy() {
-    let privacy = this.$app.$def.manifest.config.data.yinsi_addr;
-      webview.loadUrl({
-        url:privacy,
-        showloadingdialog: true
-      })
+      router.push({
+        uri: '/views/Web',
+        params: {
+            url:this.$app.$def.manifest.config.data.yinsi_addr,
+            title:"隐私协议",
+            allowthirdpartycookies: false
+        }
+    })
   }
 }
 </script>

+ 7 - 1
src/manifest.json

@@ -58,7 +58,7 @@
     "logLevel": "debug",
     "data": {
       "yinsi_addr": "https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/qapp/privacy/shouyue-privacy.htm",
-      "company_name":"杭州植宇科技有限公司"
+      "company_name": "杭州植宇科技有限公司"
     }
   },
   "router": {
@@ -144,6 +144,9 @@
       },
       "views/Dispatch": {
         "component": "index"
+      },
+      "views/Web": {
+        "component": "index"
       }
     },
     "widgets": {}
@@ -315,6 +318,9 @@
       },
       "views/Dispatch": {
         "titleBarText": ""
+      },
+      "views/Web": {
+        "titleBarText": ""
       }
     }
   }

+ 7 - 4
src/views/My/index.ux

@@ -189,10 +189,13 @@ export default {
       }
     }
     if (page == 'Privacy') {
-     let privacy = this.$app.$def.manifest.config.data.yinsi_addr;
-      webview.loadUrl({
-        url:privacy,
-        showloadingdialog: true
+      router.push({
+          uri: '/views/Web',
+          params: {
+              url:this.$app.$def.manifest.config.data.yinsi_addr,
+              title:"隐私协议",
+              allowthirdpartycookies: false
+          }
       })
     } else {
       router.push({

+ 91 - 0
src/views/Web/index.ux

@@ -0,0 +1,91 @@
+<template>
+  <div class="doc-comp">
+    <web class="web-comp" src="{{websrc}}" allowthirdpartycookies="{{allow}}" onpagestart="onPageStart" onpagefinish="onPageFinish"  ontitlereceive="onTitleReceive" onerror="onError" onprogress="onProgress" id="web"></web>
+  </div>
+</template>
+
+<script>
+  import router from '@system.router'
+  import prompt from '@system.prompt'
+  export default {
+    data: {
+      websrc: '',
+      titleBarParams: {
+        type: 'titleBar',
+        config: {
+          'titleBarShow': true
+        }
+      },
+      allow: false
+    },
+    onInit () {
+      this.websrc = this.url
+      this.allow = this.allowthirdpartycookies === 'true'
+      this.$page.setTitleBar({ text: this.title })
+      this.$on('arrowLeft', this.arrowLeftIcon)
+      this.$on('arrowRight', this.arrowRightIcon)
+    },
+    onPageStart (evt) {
+      this.isSupportWebRTC()
+      console.info(`### pagestart ### url: ${evt.url} canBack: ${ evt.canBack } canForward: ${ evt.canForward }`)
+    },
+    onPageFinish (evt) {
+      console.info(`### pagestart ### url: ${evt.url} canBack: ${ evt.canBack } canForward: ${ evt.canForward }`)
+    },
+    onTitleReceive (evt) {
+      this.titleBarParams.config.title = evt.title
+    },
+    onError (evt) {
+      console.info(`### pageError ###`, evt)
+    },
+    onProgress (evt) {
+      console.info('progressValue: ' + evt.progress)
+    },
+    arrowLeftIcon () {
+      this.isCanBack()
+    },
+    arrowRightIcon () {
+      this.isCanForward()
+    },
+    isCanForward () {
+      this.$element('web').canForward({
+        callback: function(e){
+          if(e){
+            this.$element('web').forward()
+          }
+        }.bind(this)
+      })
+    },
+    isCanBack () {
+      this.$element('web').canBack({
+        callback: function(e){
+          if (e) {
+            this.$element('web').back()
+          } else {
+            router.back()
+          }
+        }.bind(this)
+      })
+    },
+    isSupportWebRTC () {
+      this.$element('web').isSupportWebRTC({
+        callback: function (data){
+          console.log(`是否支持webrtc功能:${ data }`)
+        }
+      })
+    }
+  }
+</script>
+
+<style lang ="less">
+  .doc-comp {
+    flex: 1;
+    flex-direction: column;
+    padding:  0 10px;
+  
+  }
+  .web-comp {
+    flex: 1;
+    height: calc(100);
+  }
+</style>