返回取消sessionkey

This commit is contained in:
wuxw 2023-11-27 13:48:21 +08:00
parent 9310b66372
commit 0f3b9efd64

View File

@ -4,13 +4,12 @@
<image :src="topImg" class="heard-location-icon"></image> <image :src="topImg" class="heard-location-icon"></image>
</view> </view>
<view class="cu-list grid" :class="'col-2'"> <view class="cu-list grid" :class="'col-2'">
<view class="cu-item" @click="showOpenDoor(item);" <view class="cu-item" @click="showOpenDoor(item);" v-for="(item,index) in machines" :key="index">
v-for="(item,index) in machines" :key="index">
<view :class="['cuIcon-command','text-red']"></view> <view :class="['cuIcon-command','text-red']"></view>
<text>{{item.machineName}}</text> <text>{{item.machineName}}</text>
</view> </view>
</view> </view>
<view class="cu-modal" :class="openDoorFlag==true?'show':''"> <view class="cu-modal" :class="openDoorFlag==true?'show':''">
<view class="cu-dialog"> <view class="cu-dialog">
<view class="cu-bar bg-white justify-end"> <view class="cu-bar bg-white justify-end">
@ -33,18 +32,26 @@
<script> <script>
import noDataPage from '@/components/no-data-page/no-data-page.vue'; import noDataPage from '@/components/no-data-page/no-data-page.vue';
import {listOwnerMachines,openDoor} from '../../api/applicationKey/applicationKeyApi.js' import {
import {getCurOwner} from '../../api/owner/ownerApi.js' listOwnerMachines,
openDoor
} from '../../api/applicationKey/applicationKeyApi.js'
import {
getCurOwner
} from '../../api/owner/ownerApi.js';
import {
autoLogin
} from '../../api/user/sessionApi.js';
export default { export default {
data() { data() {
return { return {
machines: [], machines: [],
communityName: '', communityName: '',
communityId: '', communityId: '',
openDoorFlag:false, openDoorFlag: false,
curMachine:{}, curMachine: {},
memberId:'', memberId: '',
topImg:this.imgUrl+'/h5/images/openDoorTop.png' topImg: this.imgUrl + '/h5/images/openDoorTop.png'
}; };
}, },
components: { components: {
@ -55,6 +62,7 @@
*/ */
onLoad: function(options) { onLoad: function(options) {
this.vc.onLoad(options); this.vc.onLoad(options);
autoLogin(options);
this.loadOwnerMachines(); this.loadOwnerMachines();
}, },
@ -65,47 +73,47 @@
methods: { methods: {
loadOwnerMachines: function() { loadOwnerMachines: function() {
let _that = this; let _that = this;
getCurOwner() getCurOwner()
.then((_owner)=>{ .then((_owner) => {
let _data = { let _data = {
memberId: _owner.memberId, memberId: _owner.memberId,
communityId: _owner.communityId communityId: _owner.communityId
}; };
_that.communityName = _owner.communityName; _that.communityName = _owner.communityName;
_that.communityId = _owner.communityId; _that.communityId = _owner.communityId;
_that.memberId = _owner.memberId; _that.memberId = _owner.memberId;
listOwnerMachines(_data) listOwnerMachines(_data)
.then((_machines)=>{ .then((_machines) => {
_that.machines = _machines; _that.machines = _machines;
}) })
}) })
}, },
showOpenDoor:function(_machine){ showOpenDoor: function(_machine) {
this.openDoorFlag = true; this.openDoorFlag = true;
this.curMachine = _machine; this.curMachine = _machine;
}, },
_cancleOpenDoor:function(){ _cancleOpenDoor: function() {
this.openDoorFlag = false; this.openDoorFlag = false;
this.curMachine = {}; this.curMachine = {};
}, },
_doOpenDoor:function(){ _doOpenDoor: function() {
let _that = this; let _that = this;
wx.showLoading({ wx.showLoading({
title: '请求中' title: '请求中'
}); });
openDoor({ openDoor({
communityId:this.communityId, communityId: this.communityId,
userRole:'owner', userRole: 'owner',
machineCode:_that.curMachine.machineCode, machineCode: _that.curMachine.machineCode,
userId:this.memberId userId: this.memberId
}).then((res)=>{ }).then((res) => {
wx.hideLoading(); wx.hideLoading();
let data = res.data; let data = res.data;
let msg = ''; let msg = '';
if(data.code == 0){ if (data.code == 0) {
msg = '请求发送至门禁' msg = '请求发送至门禁'
}else{ } else {
msg = data.msg; msg = data.msg;
} }
wx.showToast({ wx.showToast({
@ -114,7 +122,7 @@
duration: 2000 duration: 2000
}); });
_that._cancleOpenDoor(); _that._cancleOpenDoor();
},(err)=>{ }, (err) => {
wx.hideLoading(); wx.hideLoading();
wx.showToast({ wx.showToast({
title: '开门失败', title: '开门失败',
@ -128,11 +136,12 @@
}; };
</script> </script>
<style> <style>
.heard-location-icon{ .heard-location-icon {
width: 100%; width: 100%;
height: 300rpx; height: 300rpx;
} }
text { text {
text-align: center; text-align: center;
} }
</style> </style>