12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <template>
- <view>
- <web-view @message="onmessage" src="/hybrid/html/video.html"></web-view>
- </view>
- </template>
- <script>
- import { clzConfirm } from '@/libs/tools.js'
- export default {
- data() {
- return {
- wv: null,
- isClose: false, // 是否关闭当前窗口
- isEditImg: false, // 是否正在编辑图片
- showPz: false, // 是否正在拍照
- };
- },
- methods: {
- onmessage(event) {
- let data = event.detail.data[0]
- console.log(data)
- // webview 窗口传过来的页面状态
- if(data.action == 'getWinStatus'){
- let d = JSON.parse(data.msg)
- this[d.key] = d.val
- }
- }
- },
- onReady() {
- let _this = this
- // #ifdef APP-PLUS
- //获取当前页面的webview对象
- var currentWebview = this.$mp.page.$getAppWebview()
- //如果是页面初始化调用时,需要延时一下
- setTimeout(function() {
- _this.wv = currentWebview.children()[0]
- }, 500);
- // #endif
- },
- // 监听返回键
- onBackPress() {
- console.log(this.isEditImg,'onBackPress')
- let _this = this
- if(!_this.isClose){
- // 正在编辑图片
- if(this.isEditImg){
- // 关闭编辑图片
- _this.wv.evalJS("vm.closeImgsEdit()")
- }
- // 正在拍照
- else if(this.showPz){
- // 关闭拍照弹框
- _this.wv.evalJS("vm.onClosePz()")
- }else{
- clzConfirm({
- title: '提示',
- content: '巡店还未完成,确定退出吗?',
- success: function(res) {
- if (res.confirm || res.index == 0) {
- _this.isClose = true
- uni.navigateBack({
- delta: 1
- });
- }
- }
- });
- }
-
- return true
- }
- },
- onNavigationBarButtonTap(e) {
- if(e.index==0){
- console.log(e.text)
- }
- }
- }
- </script>
- <style>
- </style>
|