|
@@ -1,54 +1,105 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
|
|
<view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
|
|
|
<cus-header title="报名信息" bgColor="#FFFFFF"></cus-header>
|
|
<cus-header title="报名信息" bgColor="#FFFFFF"></cus-header>
|
|
|
- <div class="add">
|
|
|
|
|
- <div class="btn adfacjc" @tap="handleAdd">
|
|
|
|
|
|
|
+ <view class="add">
|
|
|
|
|
+ <view class="btn adfacjc" @click="handleAdd">
|
|
|
<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/af9133fd-e15e-454d-9152-e4629fd0ce28.png"></image>
|
|
<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/af9133fd-e15e-454d-9152-e4629fd0ce28.png"></image>
|
|
|
<text>添加</text>
|
|
<text>添加</text>
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
<template v-if="list.length">
|
|
<template v-if="list.length">
|
|
|
- <div class="list">
|
|
|
|
|
|
|
+ <view class="list">
|
|
|
<up-list @scrolltolower="scrolltolower" style="height: 100%;">
|
|
<up-list @scrolltolower="scrolltolower" style="height: 100%;">
|
|
|
<up-list-item v-for="(item, index) in list" :key="index">
|
|
<up-list-item v-for="(item, index) in list" :key="index">
|
|
|
- <div class="box adfacjb">
|
|
|
|
|
- <div class="box-left adfac" @tap="handleEdit(item,index)">
|
|
|
|
|
- <div class="box-left-edit">
|
|
|
|
|
|
|
+ <view class="box adfacjb">
|
|
|
|
|
+ <view class="box-left adfac" @click="handleEdit(item,index)">
|
|
|
|
|
+ <view class="box-left-edit">
|
|
|
<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/7799f9f2-1dca-4af3-980b-7f6def10e22f.png"></image>
|
|
<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/7799f9f2-1dca-4af3-980b-7f6def10e22f.png"></image>
|
|
|
- </div>
|
|
|
|
|
- <div class="box-left-info">
|
|
|
|
|
- <div class="box-left-info-top adfac">
|
|
|
|
|
- <div class="name">{{'张琳琳'}}</div>
|
|
|
|
|
- <image class="sex" v-if="item.sex==2" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b6d1fcb3-55ba-4104-b8cd-756b963a4da8.png"></image>
|
|
|
|
|
- <image class="sex" v-else-if="item.sex==1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/a1899fd0-c468-48d9-b554-2f17b75a4157.png"></image>
|
|
|
|
|
- <div class="age" :class="{'women':item.sex==2,'man':item.sex==1}">{{46}}岁</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="box-left-info-bottom">
|
|
|
|
|
- 身份证 {{'340123**********09'}}
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="box-right" @tap="handleSelect(item,index)">
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="box-left-info">
|
|
|
|
|
+ <view class="box-left-info-top adfac">
|
|
|
|
|
+ <view class="name">{{item.name||''}}</view>
|
|
|
|
|
+ <image class="sex" v-if="item.gender==1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b6d1fcb3-55ba-4104-b8cd-756b963a4da8.png"></image>
|
|
|
|
|
+ <image class="sex" v-else-if="item.gender==0" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/a1899fd0-c468-48d9-b554-2f17b75a4157.png"></image>
|
|
|
|
|
+ <view class="age" :class="{'women':item.gender==1,'man':item.gender==0}">{{age}}岁</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="box-left-info-bottom">
|
|
|
|
|
+ 身份证 {{item.idCardCopy}}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="box-right" @click="handleSelect(item,index)">
|
|
|
<image v-if="item.select" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/87b5b244-d14f-43cd-991b-4ac9f48d909e.png"></image>
|
|
<image v-if="item.select" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/87b5b244-d14f-43cd-991b-4ac9f48d909e.png"></image>
|
|
|
<image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b8a5cabd-57f8-4ad7-9677-f6372423c50a.png"></image>
|
|
<image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b8a5cabd-57f8-4ad7-9677-f6372423c50a.png"></image>
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
</up-list-item>
|
|
</up-list-item>
|
|
|
</up-list>
|
|
</up-list>
|
|
|
- </div>
|
|
|
|
|
- <div class="confirm">确定,已选择{{2}}人</div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template v-else>
|
|
|
|
|
- <div class="empty">暂无可选人员,请添加</div>
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="confirm" @click="confirmSelect">确定,已选择{{selectNum}}人</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <view class="dataEmpty" v-else>
|
|
|
|
|
+ <page-empty text="暂无可选成员,请添加"></page-empty>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="">
|
|
<script setup name="">
|
|
|
import CusHeader from '@/components/CusHeader/index.vue'
|
|
import CusHeader from '@/components/CusHeader/index.vue'
|
|
|
- import { ref } from 'vue'
|
|
|
|
|
|
|
+ import PageEmpty from '@/components/pageEmpty/index.vue'
|
|
|
|
|
+ import { ref, onMounted, getCurrentInstance } from 'vue'
|
|
|
|
|
+ const { proxy } = getCurrentInstance()
|
|
|
|
|
+
|
|
|
|
|
+ const queryParams = ref({
|
|
|
|
|
+ page:1,
|
|
|
|
|
+ limit:-1,
|
|
|
|
|
+ userId:''
|
|
|
|
|
+ })
|
|
|
|
|
+ const list = ref([])
|
|
|
|
|
+ const selectNum = ref(0)
|
|
|
|
|
+
|
|
|
|
|
+ const getMemberList = () => {
|
|
|
|
|
+ proxy.$api.get('/core/family/member/page',queryParams.value).then(({data:res})=>{
|
|
|
|
|
+ if(res.code!==0) return proxy.$showToast(res.msg)
|
|
|
|
|
+ list.value = [...list.value,...res.data.list]
|
|
|
|
|
+ list.value.forEach(l=>{
|
|
|
|
|
+ l.age = getAge(l.idCard)
|
|
|
|
|
+ l.select = false;
|
|
|
|
|
+ l.idCardCopy = l.idCard.replace(/^(\d{6})(\d{8})(\d{3}[\dX])$/i,'$1********$3')
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- const list = ref([{sex:1},{sex:2},{sex:2}])
|
|
|
|
|
|
|
+ const isValid = (idCard) => {
|
|
|
|
|
+ // 正则表达式校验18位身份证号码(最后一位可以是数字或X/x)
|
|
|
|
|
+ const regex = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
|
|
|
+ return typeof idCard === 'string' && regex.test(idCard);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const getAge = (idCard) => {
|
|
|
|
|
+ if (!isValid(idCard)) return 0
|
|
|
|
|
+
|
|
|
|
|
+ // 从身份证的第7位开始,截取8位作为出生日期字符串 (YYYYMMDD)
|
|
|
|
|
+ const birthDateStr = idCard.substring(6, 14);
|
|
|
|
|
+ const birthYear = parseInt(birthDateStr.substring(0, 4), 10);
|
|
|
|
|
+ const birthMonth = parseInt(birthDateStr.substring(4, 6), 10);
|
|
|
|
|
+ const birthDay = parseInt(birthDateStr.substring(6, 8), 10);
|
|
|
|
|
+
|
|
|
|
|
+ const today = new Date();
|
|
|
|
|
+ const currentYear = today.getFullYear();
|
|
|
|
|
+ const currentMonth = today.getMonth() + 1; // getMonth() 返回 0-11
|
|
|
|
|
+ const currentDay = today.getDate();
|
|
|
|
|
+
|
|
|
|
|
+ // 计算周岁
|
|
|
|
|
+ let age = currentYear - birthYear;
|
|
|
|
|
+
|
|
|
|
|
+ // 如果当前月份小于出生月份,或者月份相同但日期小于出生日期,说明今年的生日还没过
|
|
|
|
|
+ if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) {
|
|
|
|
|
+ age--;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return age < 0 ? 0 : age;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
const handleAdd = () => {
|
|
const handleAdd = () => {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
@@ -58,12 +109,29 @@
|
|
|
|
|
|
|
|
const handleEdit = (item,index) => {
|
|
const handleEdit = (item,index) => {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
|
- url:'/pagesHome/applyMemberVindicate?member='+encodeURIComponent(JSON.stringify(item))
|
|
|
|
|
|
|
+ url:'/pagesHome/applyMemberVindicate?id='+item.id
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const handleSelect = (item,index) => {
|
|
const handleSelect = (item,index) => {
|
|
|
-
|
|
|
|
|
|
|
+ list.value[index].select = !list.value[index].select;
|
|
|
|
|
+ selectNum.value = list.value.filter(l=>l.select).length;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const confirmSelect = () => {
|
|
|
|
|
+ if(list.value.filter(l=>l.select).length===0) return proxy.$showToast('请至少选择一位人员')
|
|
|
|
|
+ let selectList = list.value.filter(l=>l.select);
|
|
|
|
|
+ proxy.getOpenerEventChannel().emit('selectMembers',selectList);
|
|
|
|
|
+ uni.navigateBack();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ onMounted(()=>{
|
|
|
|
|
+ try{
|
|
|
|
|
+ queryParams.value.userId = JSON.parse(uni.getStorageSync('userInfo')).id;
|
|
|
|
|
+ getMemberList()
|
|
|
|
|
+ }catch(e){
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|