Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 020e131df0 | |||
| 533170f0a9 |
@@ -151,17 +151,19 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 外部调用:启动开门流程
|
// 外部调用:启动开门流程
|
||||||
async open() {
|
async open(userId) {
|
||||||
if (this.step) return;
|
if (this.step) return;
|
||||||
|
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
this.step = 'opening';
|
this.step = 'opening';
|
||||||
|
|
||||||
|
const uid = userId || this.userId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await post('/device-scan/open', {
|
const res = await post('/device-scan/open', {
|
||||||
device_id: this.deviceId,
|
device_id: this.deviceId,
|
||||||
door_index: 0,
|
door_index: 0,
|
||||||
user_id: this.userId
|
user_id: uid
|
||||||
});
|
});
|
||||||
|
|
||||||
const ret = res.data || {};
|
const ret = res.data || {};
|
||||||
|
|||||||
@@ -418,14 +418,15 @@ export default {
|
|||||||
const openId = uni.getStorageSync('openid') || '';
|
const openId = uni.getStorageSync('openid') || '';
|
||||||
const infoRes = await gatewayGet('/api/v1/user/info', { open_id: openId });
|
const infoRes = await gatewayGet('/api/v1/user/info', { open_id: openId });
|
||||||
const infoData = (infoRes.data || {}).data || {};
|
const infoData = (infoRes.data || {}).data || {};
|
||||||
if (infoData.user_id) {
|
const userInfo = infoData.user_info || {};
|
||||||
|
if (userInfo.user_id) {
|
||||||
const existing = getCachedUserInfo() || {};
|
const existing = getCachedUserInfo() || {};
|
||||||
uni.setStorageSync('user_info', {
|
uni.setStorageSync('user_info', {
|
||||||
...existing,
|
...existing,
|
||||||
user_id: infoData.user_id,
|
user_id: userInfo.user_id,
|
||||||
nickname: infoData.nickname || existing.nickname || '',
|
nickname: userInfo.nickname || existing.nickname || '',
|
||||||
avatar: infoData.avatar || existing.avatar || '',
|
avatar: userInfo.avatar || existing.avatar || '',
|
||||||
phone: infoData.phone || existing.phone || '',
|
phone: userInfo.phone || existing.phone || '',
|
||||||
});
|
});
|
||||||
this.loadUserInfo();
|
this.loadUserInfo();
|
||||||
}
|
}
|
||||||
@@ -440,7 +441,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用组件方法启动开门流程
|
// 调用组件方法启动开门流程
|
||||||
this.$refs.doorPanel.open();
|
this.$refs.doorPanel.open(this.userId);
|
||||||
},
|
},
|
||||||
handleMenuClick(item) {
|
handleMenuClick(item) {
|
||||||
switch (item.action) {
|
switch (item.action) {
|
||||||
|
|||||||
Reference in New Issue
Block a user