| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <template>
- <view>
- <!-- #ifdef APP-PLUS -->
- <monitor-native :device-id="device_id" :is-dgp="false" />
- <!-- #endif -->
- <!-- #ifndef APP-PLUS -->
- <view class="webview">
- <web-view :src="url" id="webcon" @message="handleMessage" cache-control="no-cache">
- </web-view>
- </view>
- <!-- #endif -->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- url: '',
- device_id: '',
- accessToken: ''
- }
- },
- onLoad(options) {
- this.device_id = options.device_id
- this.accessToken = uni.getStorageSync('session_key')
- // this.url = "http://192.168.2.86:9090/h52.html?device_id="+ this.device_id + "&accessToken=" + this.accessToken+'&t='+Date.now()
- // this.url = "https://wx.hnyfwlw.com/wexin/h52.html?device_id=" + this.device_id + "&accessToken=" + this.accessToken
- this.url = "/static/h52.html?device_id=" + this.device_id + "&accessToken=" + this.accessToken+'&t='+Date.now()
-
- // uni.setStorage({
- // key: 'obj',
- // data: JSON.stringify({
- // device_id: this.device_id,
- // accessToken: this.accessToken
- // })
- // })
- //设置 webview 界面的状态栏的 title
- uni.setNavigationBarTitle({
- title: '监控详情'
- });
- // this.getWebviewPage()
- },
- methods: {
- getWebviewPage(id) {
- this.url = "/static/h5.html?device_id=" + this.device_id + "&accessToken=" + this.accessToken+'&t='+Date.now()
- // uni.setStorage({
- // key: 'obj',
- // data: JSON.stringify({
- // device_id: this.device_id,
- // accessToken: this.accessToken
- // })
- // })
- //设置 webview 界面的状态栏的 title
- uni.setNavigationBarTitle({
- title: '监控详情'
- });
- },
- handleMessage(evt) {
- console.log('接收到的消息:' + JSON.stringify(evt.detail.data));
- }
- }
- }
- </script>
- <style>
- .webview {
- width: 100vw;
- height: 100vh;
- }
- </style>
|