feat(qrCodeSearch): 添加id_type参数支持不同二维码类型查询
在qrCodeSearch组件中新增id_type参数,用于区分不同类型的二维码查询 修改watch监听逻辑以同时响应id和id_type的变化
Showing
2 changed files
with
12 additions
and
6 deletions
| ... | @@ -46,6 +46,10 @@ const props = defineProps({ | ... | @@ -46,6 +46,10 @@ const props = defineProps({ |
| 46 | type: String, | 46 | type: String, |
| 47 | default: '' | 47 | default: '' |
| 48 | }, | 48 | }, |
| 49 | + id_type: { | ||
| 50 | + type: Number, | ||
| 51 | + default: 1 | ||
| 52 | + } | ||
| 49 | }); | 53 | }); |
| 50 | 54 | ||
| 51 | const userinfo = ref({}); | 55 | const userinfo = ref({}); |
| ... | @@ -143,7 +147,9 @@ const load_qr_code_info = async (id_number) => { | ... | @@ -143,7 +147,9 @@ const load_qr_code_info = async (id_number) => { |
| 143 | } | 147 | } |
| 144 | 148 | ||
| 145 | is_loading.value = true | 149 | is_loading.value = true |
| 146 | - const res = await queryQrCodeAPI({ id_number: id }) | 150 | + const params = { id_number: id } |
| 151 | + if (props.id_type) params.id_type = props.id_type | ||
| 152 | + const res = await queryQrCodeAPI(params) | ||
| 147 | if (is_destroyed) return | 153 | if (is_destroyed) return |
| 148 | is_loading.value = false | 154 | is_loading.value = false |
| 149 | 155 | ||
| ... | @@ -172,8 +178,8 @@ onMounted(() => { | ... | @@ -172,8 +178,8 @@ onMounted(() => { |
| 172 | }) | 178 | }) |
| 173 | 179 | ||
| 174 | watch( | 180 | watch( |
| 175 | - () => props.id, | 181 | + () => [props.id, props.id_type], |
| 176 | - (val) => { | 182 | + ([val]) => { |
| 177 | if (is_loading.value) return | 183 | if (is_loading.value) return |
| 178 | load_qr_code_info(val) | 184 | load_qr_code_info(val) |
| 179 | } | 185 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-26 13:08:09 | 2 | * @Date: 2024-01-26 13:08:09 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2026-01-15 09:27:42 | 4 | + * @LastEditTime: 2026-01-22 11:45:46 |
| 5 | - * @FilePath: /xyxBooking-weapp/src/pages/search/index.vue | 5 | + * @FilePath: /git/xyxBooking-weapp/src/pages/search/index.vue |
| 6 | * @Description: 搜索页 | 6 | * @Description: 搜索页 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| ... | @@ -36,7 +36,7 @@ | ... | @@ -36,7 +36,7 @@ |
| 36 | </view> | 36 | </view> |
| 37 | </view> | 37 | </view> |
| 38 | <view v-else> | 38 | <view v-else> |
| 39 | - <qrCodeSearch :id="id_number" /> | 39 | + <qrCodeSearch :id="id_number" :id_type="id_type" /> |
| 40 | </view> | 40 | </view> |
| 41 | </view> | 41 | </view> |
| 42 | <view class="logo"></view> | 42 | <view class="logo"></view> | ... | ... |
-
Please register or login to post a comment