优化代码

This commit is contained in:
wuxw 2024-07-24 11:06:21 +08:00
parent f449c7c7f2
commit 0c4695df5e
6 changed files with 178 additions and 9 deletions

View File

@ -135,3 +135,24 @@ export function getQrCode(_obj){
});
})
}
export function getOwnerAcVideoUrl(_obj){
return new Promise((resolve, reject) => {
request({
url: url.queryOwnerAcVideoUrl,
method: "GET",
data: _obj, //动态数据
success: function(res) {
let _json = res.data;
if (_json.code == 0) {
resolve(_json);
return;
}
reject(_json.msg);
},
fail: function(e) {
reject(e);
}
});
})
}

View File

@ -18,7 +18,7 @@ const baseUrl = '/';
const baseUrl = 'http://127.0.0.1:8008/';
// #endif
let commonBaseUrl = 'http://demo.homecommunity.cn/';
let commonBaseUrl = 'http://127.0.0.1:3000/';
//商城的url
let mallUrl = 'http://mallapp.homecommunity.cn/';
@ -43,7 +43,7 @@ let systemName="业主版";
if(_systemConfig){
mallUrl = _systemConfig.mallUrl;
commonBaseUrl = _systemConfig.imgUrl;
//commonBaseUrl = _systemConfig.imgUrl;
systemName = _systemConfig.ownerTitle;
DEFAULT_COMMUNITY_ID = _systemConfig.defaultCommunityId;
}

View File

@ -247,7 +247,7 @@ export default {
appSaveMemberCar: baseUrl+"app/owner.appSaveMemberCar",
appDeleteMemberCar: baseUrl+"app/owner.appDeleteMemberCar",
queryAppUserIntegral: baseUrl+"app/integral.queryAppUserIntegral",
queryOwnerAcVideoUrl:baseUrl+"app/owner.queryOwnerAcVideoUrl",

View File

@ -1050,6 +1050,13 @@
{
"navigationBarTitleText" : "车辆详情"
}
},
{
"path" : "pages/machine/openDoorVideo",
"style" :
{
"navigationBarTitleText" : ""
}
}
],
"tabBar": {

View File

@ -10,19 +10,20 @@
</view>
</view>
<view class="cu-modal" :class="openDoorFlag==true?'show':''">
<view class="cu-dialog">
<view class="cu-modal" :class="openDoorFlag==true?'show':''" >
<view class="cu-dialog" >
<view class="cu-bar bg-white justify-end">
<view class="content">温馨提示</view>
<view class="content">{{curMachine.machineName}}</view>
<view class="action" @tap="_cancleCall()">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-xl">
您确认{{curMachine.machineName}}开门? 开门次数有限,请勿频繁操作
您确认开门? 开门次数有限,请勿频繁操作
</view>
<view class="cu-bar bg-white justify-end">
<view class="action margin-0 flex-sub solid-left" @tap="_cancleOpenDoor()">取消</view>
<view class="action margin-0 flex-sub solid-left" v-if="curMachine.monitorId" @tap="_viewDoorVideo()">视频</view>
<view class="action margin-0 flex-sub text-green solid-left" @tap="_doOpenDoor()">确认开门</view>
</view>
</view>
@ -34,8 +35,9 @@
import noDataPage from '@/components/no-data-page/no-data-page.vue';
import {
listOwnerMachines,
openDoor
} from '../../api/applicationKey/applicationKeyApi.js'
openDoor,
getOwnerAcVideoUrl
} from '@/api/applicationKey/applicationKeyApi.js'
import {
getCurOwner
} from '../../api/owner/ownerApi.js';
@ -51,6 +53,7 @@
openDoorFlag: false,
curMachine: {},
memberId: '',
videoUrl:'',
topImg: this.imgUrl + '/h5/images/openDoorTop.png'
};
},
@ -92,6 +95,7 @@
})
},
showOpenDoor: function(_machine) {
//
this.openDoorFlag = true;
this.curMachine = _machine;
},
@ -99,6 +103,17 @@
this.openDoorFlag = false;
this.curMachine = {};
},
_viewDoorVideo:function(){
uni.navigateTo({
url:'/pages/machine/openDoorVideo?machineId='
+this.curMachine.machineId
+"&machineName="+this.curMachine.machineName
+"&memberId="+this.memberId
+"&machineCode="+this.curMachine.machineCode
});
this._cancleOpenDoor();
},
_doOpenDoor: function() {
let _that = this;
wx.showLoading({

View File

@ -0,0 +1,126 @@
<template>
<view>
<!--#ifdef H5 -->
<view class="padding-xl" style="height: 600upx;">
<web-view :src="videoUrl" style="height: 600upx;"></web-view>
</view>
<view class="padding flex flex-direction margin-top">
<button class="cu-btn bg-blue lg" @click="_doOpenDoor()">开门</button>
<button class="cu-btn line-orange margin-tb-sm lg" @click="_goBack()">返回</button>
</view>
<!--#endif -->
<!-- #ifndef H5 -->
<view class="padding-xl">
<web-view :src="videoUrl" @onPostMessage="_onMessage" @message="_onMessage"></web-view>
</view>
<!--#endif -->
</view>
</template>
<script>
import {
getCommunityId
} from '../../api/community/communityApi.js';
import {
listOwnerMachines,
openDoor,
getOwnerAcVideoUrl
} from '@/api/applicationKey/applicationKeyApi.js';
import conf from '@/conf/config.js';
import {
autoLogin
} from '../../api/user/sessionApi.js';
export default {
data() {
return {
videoUrl: '',
machineId: '',
machineName: '',
machineCode: '',
memberId: '',
}
},
onLoad(options) {
this.machineId = options.machineId;
this.machineName = options.machineName;
this.machineCode = options.machineCode;
this.memberId = options.memberId;
autoLogin(options);
this._loadVideo();
},
methods: {
_loadVideo: function() {
let _that = this;
getOwnerAcVideoUrl({
machineId: this.machineId,
communityId: getCommunityId()
}).then(_data => {
// #ifndef H5
let _url = conf.commonBaseUrl + "/h5/jessibuca/videoOpenDoor.html?tt=" +
encodeURIComponent(_data.data) +
"&time=" + new Date().getTime();
// #endif
// #ifdef H5
let _url = conf.commonBaseUrl + "/h5/jessibuca/videoh5.html?tt=" +
encodeURIComponent(_data.data) +
"&time=" + new Date().getTime();
// #endif
_that.videoUrl = _url;
})
},
_onMessage:function(e){
let _data = e.detail.data;
console.log(e.detail.data);
this._doOpenDoor();
},
_doOpenDoor: function() {
let _that = this;
wx.showLoading({
title: '请求中'
});
openDoor({
communityId: getCommunityId(),
userRole: 'owner',
machineCode: this.machineCode,
memberId: this.memberId
}).then((res) => {
wx.hideLoading();
let data = res.data;
let msg = '';
if (data.code == 0) {
msg = '请求发送至门禁'
} else {
msg = data.msg;
}
wx.showToast({
title: msg,
icon: 'none',
duration: 2000
});
}, (err) => {
wx.hideLoading();
wx.showToast({
title: '开门失败',
icon: 'none',
duration: 2000
});
})
},
_goBack: function() {
uni.navigateBack();
}
}
}
</script>
<style>
.cover-box {
position: fixed;
bottom: 100px;
z-index: 999999;
}
</style>