Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
xysBooking
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-01-22 12:27:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ae58caf1daad5295efd09ae23d478316d92c9495
ae58caf1
1 parent
98a09c5d
预约码需要轮询使用状态
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
src/components/qrCode.vue
src/components/qrCode.vue
View file @
ae58caf
<!--
* @Date: 2024-01-16 10:06:47
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-01-
19 19:15:34
* @LastEditTime: 2024-01-
22 12:23:30
* @FilePath: /xysBooking/src/components/qrCode.vue
* @Description: 文件描述
-->
...
...
@@ -87,6 +87,14 @@ const nextCode = () => {
}
};
watch(
() => select_index.value,
(index) => {
// 监听用户选择变化时,刷新二维码
refreshBtn();
}
)
/**
* 生成15位身份证号中间8位替换为*号
* @param {*} inputString
...
...
@@ -185,7 +193,26 @@ onMounted(async () => {
userList.value = data;
}
}
})
});
// 定义轮询函数
const poll = async () => {
// 二维码未使用不停轮询接口
if (useStatus.value !== '7') {
const { code, data } = await qrcodeStatusAPI({ qr_code: userList.value[select_index.value].qr_code });
if (code) {
useStatus.value = data.status;
}
}
};
// 每秒执行一次轮询函数
const intervalId = setInterval(poll, 1000);
// 在组件卸载时清除定时器
onUnmounted(() => {
clearInterval(intervalId);
});
</script>
<style lang="less" scoped>
...
...
Please
register
or
login
to post a comment