form1.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <!-- 中国嘉宾 -->
  2. <template>
  3. <div>
  4. <van-nav-bar fixed :border="false">
  5. <template #left>
  6. <van-icon name="arrow-left" color="#3D3D3D" @click="onClickLeft" />
  7. </template>
  8. <template #title>
  9. <p class="navTitle" v-text="lang[langType].signUpZH"></p>
  10. </template>
  11. </van-nav-bar>
  12. <div class="form">
  13. <van-form ref="form" @submit="onSubmit" label-width="8em">
  14. <!-- 国家/地区 -->
  15. <van-field size="large" input-align="right" clickable readonly
  16. @click="countryRegionList = lang[langType].countryRegionList, showCountryRegion = true"
  17. right-icon="arrow"
  18. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].countryRegionContent }]"
  19. required v-model="formData.countryRegionName" :placeholder="lang[langType].countryRegionContent">
  20. <template #label>
  21. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].countryRegion"></span>
  22. </template>
  23. </van-field>
  24. <van-popup v-model:show="showCountryRegion" destroy-on-close round position="bottom">
  25. <van-picker :confirm-button-text="lang[langType].confirm" :columns="countryRegionList"
  26. :cancel-button-text="lang[langType].cancel" @confirm="countryRegionConfirm"
  27. :title="lang[langType].countryRegion" @cancel="showCountryRegion = false">
  28. <template #columns-top>
  29. <van-search @update:model-value="input" v-model="searchConuntry"
  30. :placeholder="lang[langType].searchText" />
  31. </template>
  32. </van-picker>
  33. </van-popup>
  34. <!-- 姓名 -->
  35. <van-field size="large" input-align="right"
  36. :rules="[{ required: formData, trigger: 'onBlur', message: lang[langType].nameContent }]" required
  37. v-model="formData.name" :placeholder="lang[langType].nameContent">
  38. <template #label>
  39. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].name"></span>
  40. </template>
  41. </van-field>
  42. <!-- 省市 -->
  43. <van-field size="large" input-align="right"
  44. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].provinceCityContent }]"
  45. v-model="formData.provinceCity" required :placeholder="lang[langType].provinceCityContent">
  46. <template #label>
  47. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].provinceCity"></span>
  48. </template>
  49. </van-field>
  50. <!-- 性别 -->
  51. <van-field size="large" input-align="right"
  52. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].genderContent }]"
  53. v-model="formData.gender" required :placeholder="lang[langType].genderContent">
  54. <template #label>
  55. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].gender"></span>
  56. </template>
  57. </van-field>
  58. <!-- 生日 -->
  59. <van-field size="large" input-align="right"
  60. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].birthdayContent }]" clickable
  61. right-icon="calendar-o" readonly @click="showBirthday = true" v-model="formData.birthday" required
  62. :placeholder="lang[langType].birthdayContent">
  63. <template #label>
  64. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].birthday"></span>
  65. </template>
  66. </van-field>
  67. <van-popup v-model:show="showBirthday" destroy-on-close round position="bottom">
  68. <van-date-picker :confirm-button-text="lang[langType].confirm"
  69. :cancel-button-text="lang[langType].cancel" @confirm="packerConfirm"
  70. :title="lang[langType].birthday" @cancel="showBirthday = false" :min-date="new Date(1920, 0, 1)"
  71. :max-date="new Date()" />
  72. </van-popup>
  73. <!-- 照片 -->
  74. <van-field size="large" input-align="right" :placeholder="lang[langType].photoContent" required
  75. :rules="[{ required: true, trigger: 'onChange', message: lang[langType].photoContent }]"
  76. v-model="formData.photoUrl">
  77. <template #label>
  78. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].photo"></span>
  79. </template>
  80. <template #input>
  81. <van-uploader :preview-full-image="false" accept="image/*" v-model="photo"
  82. :before-delete="beforeDelete" :max-count="1" :max-size="524288000" @oversize="filesize"
  83. :after-read="beforeRead" result-type="file">
  84. </van-uploader>
  85. <p class="upFileSubtitle" v-text="lang[langType].photoSubContent"> </p>
  86. </template>
  87. </van-field>
  88. <!-- 手机号 -->
  89. <van-field size="large" input-align="right"
  90. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].contactContent }]"
  91. v-model="formData.contact" type="number" required :placeholder="lang[langType].contactContent">
  92. <template #label>
  93. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].contact"></span>
  94. </template>
  95. </van-field>
  96. <!-- 邮箱 -->
  97. <van-field size="large" input-align="right"
  98. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].emailContent }]" required
  99. v-model="formData.email" :placeholder="lang[langType].emailContent">
  100. <template #label>
  101. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].email"></span>
  102. </template>
  103. </van-field>
  104. <!-- 紧急联系人 -->
  105. <van-field size="large" input-align="right" v-model="formData.emergencyContact"
  106. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].emergencyContactContent }]"
  107. required :placeholder="lang[langType].emergencyContactContent">
  108. <template #label>
  109. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].emergencyContact"></span>
  110. </template>
  111. </van-field>
  112. <!-- 紧急联系人电话 -->
  113. <van-field size="large" input-align="right" v-model="formData.emergencyContactPhone" required
  114. type="number"
  115. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].emergencyContactPhoneContent }]"
  116. :placeholder="lang[langType].emergencyContactPhoneContent">
  117. <template #label>
  118. <span :class="langType === 'zh' ? 'label' : ''"
  119. v-html="lang[langType].emergencyContactPhone"></span>
  120. </template>
  121. </van-field>
  122. <!-- 证件类型 -->
  123. <van-field size="large" label-align="top" v-model="formData.cardType" clickable
  124. :rules="[{ required: true, trigger: 'onChange', message: lang[langType].conferenceTypeContent }]"
  125. :placeholder="lang[langType].conferenceTypeContent" required>
  126. <template #label>
  127. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].conferenceType"></span>
  128. </template>
  129. <template #input>
  130. <van-radio-group checked-color="#3F5AC8" style="width: 100%;" v-model="formData.cardType"
  131. :direction="langType == 'zh' ? 'horizontal' : 'vertical'">
  132. <van-radio v-for="item in cardTypeList" :key="item.value"
  133. :style="langType == 'zh' ? 'width: 50%;margin: 10px 0 0 0;' : 'margin: 10px 0 0 0;'"
  134. :name="item.value">{{ item.text }}</van-radio>
  135. </van-radio-group>
  136. </template>
  137. </van-field>
  138. <!-- 证件 -->
  139. <van-field size="large" input-align="right"
  140. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].passportContent }]"
  141. v-model="formData.passport" required :placeholder="lang[langType].passportContent">
  142. <template #label>
  143. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].passport"></span>
  144. </template>
  145. </van-field>
  146. <!-- 饮食要求 -->
  147. <van-field size="large" input-align="right" v-model="formData.catering" rows="1" autosize
  148. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].cateringContent }]"
  149. type="textarea" required :placeholder="lang[langType].cateringContent">
  150. <template #label>
  151. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].catering"></span>
  152. </template>
  153. </van-field>
  154. <div style="background-color: #F7F7F7;height: 10px;"></div>
  155. <!-- 工作单位 -->
  156. <van-field size="large" input-align="right" v-model="formData.workUnit"
  157. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].companyContent }]" required
  158. :placeholder="lang[langType].companyContent">
  159. <template #label>
  160. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].company"></span>
  161. </template>
  162. </van-field>
  163. <!-- 单位类型 -->
  164. <van-field size="large" input-align="right" v-model="formData.unitTypeName" clickable
  165. :rules="[{ required: true, trigger: 'onChange', message: lang[langType].unitTypeContent }]"
  166. right-icon="calendar-o" readonly :placeholder="lang[langType].unitTypeContent"
  167. @click="showUnitType = true" required>
  168. <template #label>
  169. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].unitType"></span>
  170. </template>
  171. </van-field>
  172. <van-popup v-model:show="showUnitType" destroy-on-close round position="bottom">
  173. <van-picker :confirm-button-text="lang[langType].confirm"
  174. :cancel-button-text="lang[langType].cancel" :columns="unitTypeList"
  175. @cancel="showUnitType = false" @confirm="onUnitTypeConfirm" />
  176. </van-popup>
  177. <!-- 职务 -->
  178. <van-field size="large" input-align="right" v-model="formData.career"
  179. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].careerContent }]" required
  180. :placeholder="lang[langType].careerContent">
  181. <template #label>
  182. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].career"></span>
  183. </template>
  184. </van-field>
  185. <!-- 职级 -->
  186. <van-field size="large" label-align="top" input-align="right" v-model="formData.level"
  187. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].levelContent }]" required
  188. :placeholder="lang[langType].levelContent">
  189. <template #label>
  190. <span :style="langType === 'zh' ? 'text-align-last: justify;' : ''"
  191. :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].level"></span>
  192. </template>
  193. <template #input>
  194. <van-radio-group checked-color="#3F5AC8" style="width: 100%;" v-model="formData.level"
  195. :direction="langType == 'zh' ? 'horizontal' : 'vertical'">
  196. <van-radio style="flex: 1;margin-top: 10px " :name="item.value"
  197. v-for="item in lang[langType].careerList" :key="item.value">{{
  198. item.text
  199. }}</van-radio>
  200. </van-radio-group>
  201. </template>
  202. </van-field>
  203. <!-- 传真 -->
  204. <van-field size="large" input-align="right" v-model="formData.fax"
  205. :placeholder="lang[langType].faxContent">
  206. <template #label>
  207. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].fax"></span>
  208. </template>
  209. </van-field>
  210. <!-- 办公地址 -->
  211. <van-field size="large" input-align="right" v-model="formData.officeAddress" rows="1" autosize
  212. type="textarea" :placeholder="lang[langType].officeAddressContent">
  213. <template #label>
  214. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].officeAddress"></span>
  215. </template>
  216. </van-field>
  217. <div style="background-color: #F7F7F7;height: 10px;"></div>
  218. <!-- 接受采访意向 -->
  219. <van-field size="large" v-model="formData.interview" required label-align="top"
  220. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].interviewContent }]"
  221. :placeholder="lang[langType].interviewContent">
  222. <template #label>
  223. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].interview"></span>
  224. </template>
  225. <template #input>
  226. <van-radio-group checked-color="#3F5AC8" style="justify-content: flex-end;width: 100%;"
  227. v-model="formData.interview" direction="horizontal">
  228. <van-radio style="flex: 1;margin-top: 10px " name="是">{{ lang[langType].confirm
  229. }}</van-radio>
  230. <van-radio style="flex: 1;margin-top: 10px " name="否">{{ lang[langType].cancel
  231. }}</van-radio>
  232. </van-radio-group>
  233. </template>
  234. </van-field>
  235. <div style="background-color: #F7F7F7;height: 10px;"></div>
  236. <!-- 是否参加开幕式 active0 -->
  237. <van-field size="large" label-align="top" v-model="formData.active1" required
  238. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].active0Content }]"
  239. :placeholder="lang[langType].active0Content">
  240. <template #label>
  241. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].active0"></span>
  242. </template>
  243. <template #input>
  244. <van-radio-group checked-color="#3F5AC8" style="width: 100%;" v-model="formData.active1"
  245. direction="horizontal">
  246. <van-radio style="flex: 1;margin-top: 10px " name="是">{{ lang[langType].confirm
  247. }}</van-radio>
  248. <van-radio style="flex: 1;margin-top: 10px " name="否">{{ lang[langType].cancel
  249. }}</van-radio>
  250. </van-radio-group>
  251. </template>
  252. </van-field>
  253. <!-- 选择分论坛 -->
  254. <van-field size="large" label-align="top" required
  255. :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].activeContent }]"
  256. :placeholder="lang[langType].activeContent">
  257. <template #label>
  258. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].active"></span>
  259. </template>
  260. <template #input>
  261. <van-radio-group checked-color="#3F5AC8" style="width: 100%;padding-left: 16px;"
  262. v-model="formData.active2">
  263. <van-radio style="flex: 1;margin-top: 10px " name="共享数字经济发展机遇">
  264. {{ lang[langType].active1 }}
  265. </van-radio>
  266. <van-radio style="flex: 1;margin-top: 10px " name="共筑网络安全防线">
  267. {{ lang[langType].active2 }}
  268. </van-radio>
  269. <van-radio style="flex: 1;margin-top: 10px " name="共商人工智能发展治理">
  270. {{ lang[langType].active3 }}
  271. </van-radio>
  272. </van-radio-group>
  273. </template>
  274. </van-field>
  275. <!-- 拟参加的活动 -->
  276. <van-field size="large" label-align="top" v-model="formData.activitiesAttended" required
  277. :placeholder="lang[langType].activitiesAttendedContent">
  278. <template #label>
  279. <span :class="langType === 'zh' ? 'label' : ''"
  280. v-html="lang[langType].activitiesAttended"></span>
  281. </template>
  282. <template #input>
  283. <div>
  284. <van-checkbox-group :border="false" ref="checkbox" checked-color="#3F5AC8"
  285. v-model="activitiesAttended" @change="isGroup">
  286. <van-cell clickable :title="lang[langType].active4" @click="checkboxRefs[0].toggle()">
  287. <template #icon>
  288. <van-checkbox :ref="el => checkboxRefs[0] = el" style="margin-right: 5px;"
  289. name="active4" @click.stop shape="square" />
  290. </template>
  291. </van-cell>
  292. <van-cell clickable :title="lang[langType].active5" @click="checkboxRefs[1].toggle()">
  293. <template #icon>
  294. <van-checkbox :ref="el => checkboxRefs[1] = el" style="margin-right: 5px;"
  295. name="active5" @click.stop shape="square" />
  296. </template>
  297. </van-cell>
  298. <!-- <van-cell clickable :title="lang[langType].active6" @click="checkboxRefs[2].toggle()">
  299. <template #icon>
  300. <van-checkbox :ref="el => checkboxRefs[2] = el" style="margin-right: 5px;"
  301. name="active6" @click.stop shape="square" />
  302. </template>
  303. </van-cell> -->
  304. </van-checkbox-group>
  305. <van-cell clickable :title="lang[langType].active7"
  306. @click="() => isUndefined(checkboxRefs[3])">
  307. <template #icon>
  308. <div class="noClcik">
  309. <van-checkbox checked-color="#3F5AC8" v-model="selectunde"
  310. style="margin-right: 5px;" :ref="el => checkboxRefs[3] = el" name="none"
  311. @click.stop shape="square" />
  312. </div>
  313. </template>
  314. </van-cell>
  315. </div>
  316. </template>
  317. </van-field>
  318. <div style="background-color: #F7F7F7;height: 10px;"></div>
  319. <!-- 抵达西安交通车次 -->
  320. <van-field size="large" input-align="right" v-model="formData.reachTrainNumber"
  321. :placeholder="lang[langType].reachTrainNumberContent">
  322. <template #label>
  323. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].reachTrainNumber"></span>
  324. </template>
  325. </van-field>
  326. <!-- 抵达西安时间 -->
  327. <van-field size="large" input-align="right" v-model="formData.reachTime" clickable
  328. right-icon="calendar-o" readonly @click="showReachTime = true"
  329. :placeholder="lang[langType].reachTimeContent">
  330. <template #label>
  331. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].reachTime"></span>
  332. </template>
  333. </van-field>
  334. <van-popup v-model:show="showReachTime" destroy-on-close round position="bottom">
  335. <van-picker :confirm-button-text="lang[langType].confirm"
  336. :cancel-button-text="lang[langType].cancel" :title="lang[langType].reachTime"
  337. :columns="dateTimeColumns" @confirm="reachTimeConfirm" @cancel="showReachTime = false" />
  338. </van-popup>
  339. <!-- 离开车次 -->
  340. <van-field size="large" input-align="right" v-model="formData.leavingTrainNumber"
  341. :placeholder="lang[langType].leavingTrainNumberContent">
  342. <template #label>
  343. <span :class="langType === 'zh' ? 'label' : ''"
  344. v-html="lang[langType].leavingTrainNumber"></span>
  345. </template>
  346. </van-field>
  347. <!-- 离开时间 -->
  348. <van-field size="large" input-align="right" v-model="formData.leavingTime" clickable
  349. right-icon="calendar-o" readonly @click="showLeavingTime = true"
  350. :placeholder="lang[langType].leavingTimeContent">
  351. <template #label>
  352. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].leavingTime"></span>
  353. </template>
  354. </van-field>
  355. <van-popup v-model:show="showLeavingTime" destroy-on-close round position="bottom">
  356. <van-picker :confirm-button-text="lang[langType].confirm"
  357. :cancel-button-text="lang[langType].cancel" :title="lang[langType].leavingTime"
  358. :columns="dateTimeColumns" @confirm="leavingTimeConfirm" @cancel="showLeavingTime = false" />
  359. </van-popup>
  360. <!-- 离店时间 -->
  361. <van-field size="large" input-align="right" v-model="formData.checkOutTime" clickable
  362. right-icon="calendar-o" readonly @click="showCheckOutTime = true"
  363. :placeholder="lang[langType].checkOutTimeContent">
  364. <template #label>
  365. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].checkOutTime"></span>
  366. </template>
  367. </van-field>
  368. <van-popup v-model:show="showCheckOutTime" destroy-on-close round position="bottom">
  369. <van-picker :confirm-button-text="lang[langType].confirm"
  370. :cancel-button-text="lang[langType].cancel" :title="lang[langType].checkOutTime"
  371. :columns="dateTimeColumns" @confirm="checkOutTimeConfirm" @cancel="showCheckOutTime = false" />
  372. </van-popup>
  373. <van-field size="large" input-align="right" v-model="formData.message" rows="3" autosize type="textarea"
  374. :placeholder="lang[langType].ortherNotesContent">
  375. <template #label>
  376. <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].ortherNotes"></span>
  377. </template>
  378. </van-field>
  379. <br />
  380. <van-button
  381. :loading="loading"
  382. style="background: linear-gradient(270deg, #1D19BC 0%, #1C4CD5 100%);margin: 0 auto;width: calc(100% - 40px);"
  383. block type="primary" native-type="submit">
  384. {{ lang[langType].submit }}
  385. </van-button>
  386. </van-form>
  387. </div>
  388. </div>
  389. </template>
  390. <script setup>
  391. import { defineProps, defineEmits, defineExpose, reactive, ref, computed } from 'vue';
  392. import { showToast, showDialog } from 'vant';
  393. import { saveData, uploadImage } from '@/api/2025.js';
  394. import lang from './lang.js';
  395. const props = defineProps(['langType', 'verificationCode', 'subData']);
  396. const emits = defineEmits(['closeComponent']);
  397. const loading = ref(false);
  398. const formData = reactive({})
  399. const cardTypeList = computed(() => lang[props.langType].cardTypeList)
  400. const unitTypeList = computed(() => lang[props.langType].foreignCountryUnitType)
  401. const showBirthday = ref(false)
  402. const showReachTime = ref(false)
  403. const showUnitType = ref(false)
  404. const showLeavingTime = ref(false)
  405. const showCountryRegion = ref(false)
  406. const showCheckOutTime = ref(false)
  407. const selectunde = ref(false)
  408. const activitiesAttended = ref([])
  409. const form = ref(null);
  410. const photo = ref([]);
  411. const checkbox = ref(null);
  412. const checkboxRefs = ref([]);
  413. const searchConuntry = ref('')
  414. const countryRegionList = ref([]);
  415. let t
  416. const input = (val) => {
  417. if (t) clearTimeout(t);
  418. t = setTimeout(() => {
  419. countryRegionList.value = lang[props.langType].countryRegionList.filter(item => {
  420. // 判断是否包含搜索的关键字,中英西班牙
  421. if (props.langType === 'zh') return item.text.includes(val)
  422. else return item.text.toLowerCase().includes(val.toLowerCase())
  423. })
  424. clearTimeout(t);
  425. }, 200);
  426. }
  427. const reset = () => {
  428. form.value.resetValidation();
  429. }
  430. const isGroup = (val) => {
  431. formData.activitiesAttended = val.join(',')
  432. if (val.length > 0) {
  433. selectunde.value = false
  434. }
  435. }
  436. const isUndefined = (ele) => {
  437. ele.toggle()
  438. formData.activitiesAttended = selectunde.value ? 'none' : '';
  439. activitiesAttended.value = []
  440. }
  441. const countryRegionConfirm = (values) => {
  442. showCountryRegion.value = false;
  443. formData.countryRegionName = values.selectedOptions[0].text;
  444. formData.countryRegion = values.selectedOptions[0].value;
  445. }
  446. const onClickLeft = () => {
  447. emits('closeComponent');
  448. };
  449. const createTextDate = values => values.slice(0, 3).join('-') + ' ' + values.slice(3).join(':');
  450. const packerConfirm = (values) => {
  451. showBirthday.value = false;
  452. formData.birthday = createTextDate(values.selectedValues);
  453. }
  454. const leavingTimeConfirm = ({ selectedValues }) => {
  455. showLeavingTime.value = false;
  456. formData.leavingTime = createTextDate(selectedValues);
  457. }
  458. const onUnitTypeConfirm = (values) => {
  459. showUnitType.value = false;
  460. formData.unitType = values.selectedOptions[0].value;
  461. formData.unitTypeName = values.selectedOptions[0].text;
  462. }
  463. const reachTimeConfirm = ({ selectedValues }) => {
  464. showReachTime.value = false;
  465. formData.reachTime = createTextDate(selectedValues);
  466. }
  467. const checkOutTimeConfirm = ({ selectedValues }) => {
  468. showCheckOutTime.value = false;
  469. formData.checkOutTime = createTextDate(selectedValues);
  470. }
  471. // 上传
  472. const beforeDelete = (index) => {
  473. photo.value.splice(index, 1);
  474. formData.photoUrl = '';
  475. return false;
  476. }
  477. const filesize = () => showToast(lang[props.langType].fileSize);
  478. const beforeRead = (file) => {
  479. if (!file) showToast(lang[props.langType].photoContent);
  480. uploadImage(file).then(res => {
  481. showToast(lang[props.langType].upFileSusscess);
  482. formData.photoUrl = res
  483. photo.value = [
  484. {
  485. url: res,
  486. file: file.file,
  487. }
  488. ]
  489. }).catch((res) => {
  490. showToast(res.msg || lang[props.langType].upFileError);
  491. })
  492. return false;
  493. };
  494. let arrivalTime = []
  495. const dateTimeColumns = computed(() => {
  496. const dateList = lang[props.langType].dateList;
  497. const years = [{ text: dateList[0], value: '', disabled: true }, ...Array.from({ length: 10 }, (_, i) => {
  498. const t = 2020 + i + ''
  499. return {
  500. text: t,
  501. value: t
  502. }
  503. })];
  504. const months = [{ text: dateList[1], value: '', disabled: true }, ...Array.from({ length: 12 }, (_, i) => {
  505. const m = (i + 1).toString().padStart(2, '0')
  506. return {
  507. text: m,
  508. value: m
  509. }
  510. })];
  511. // 动态计算当前选中年月对应的天数
  512. const daysInMonth = new Date(
  513. parseInt(arrivalTime[0] || '0'),
  514. parseInt(arrivalTime[1] || '0'),
  515. 0
  516. ).getDate();
  517. const days = [{ text: dateList[2], value: '', disabled: true }, ...Array.from({ length: daysInMonth }, (_, i) => {
  518. const d = (i + 1).toString().padStart(2, '0')
  519. return {
  520. text: d,
  521. value: d
  522. }
  523. })];
  524. const hours = [{ text: dateList[3], value: '', disabled: true }, ...Array.from({ length: 24 }, (_, i) => {
  525. const h = i.toString().padStart(2, '0')
  526. return {
  527. text: h,
  528. value: h
  529. }
  530. })];
  531. const minutes = [{ text: dateList[4], value: '', disabled: true }, ...Array.from({ length: 60 }, (_, i) => {
  532. const m = i.toString().padStart(2, '0')
  533. return {
  534. text: m,
  535. value: m
  536. }
  537. })];
  538. return [years, months, days, hours, minutes];
  539. });
  540. const onSubmit = () => {
  541. if (loading.value) return
  542. loading.value = true
  543. const active = {
  544. active2: '否',
  545. active3: '否',
  546. active4: '否',
  547. active5: '否',
  548. active6: '否',
  549. active7: '否'
  550. }
  551. if (!selectunde.value) {
  552. activitiesAttended.value.forEach((item) => {
  553. active[item] = '是'
  554. })
  555. }
  556. if (formData.active2.includes('共享数字经济发展机遇')) {
  557. active.active7 = '是'
  558. }
  559. if (formData.active2.includes('共筑网络安全防线')) {
  560. active.active2 = '是'
  561. }
  562. if (formData.active2.includes('共商人工智能发展治理')) {
  563. active.active3 = '是'
  564. }
  565. saveData({
  566. ...active,
  567. active1: formData.active1 || '否',
  568. code: props.verificationCode, // 邀请码
  569. name: formData.name, // 姓名
  570. provinceCity: formData.provinceCity, // 省市区
  571. gender: formData.gender, // 性别
  572. birthDate: formData.birthday, // 出生日期
  573. photo: formData.photoUrl, // 照片
  574. phone: formData.contact, // 手机号
  575. level: formData.level, // 职级
  576. email: formData.email, // 邮箱
  577. emergencyContact: formData.emergencyContact, // 紧急联系人
  578. emergencyContactPhone: formData.emergencyContactPhone, // 紧急联系人电话
  579. cardType: formData.cardType, // 证件类型
  580. idCard: formData.passport, // 证件号
  581. dietaryRequirements: formData.catering, // 饮食要求
  582. workUnit: formData.workUnit, // 工作单位
  583. unitType: formData.unitType, // 单位类型
  584. position: formData.career, // 职务
  585. countryRegion: formData.countryRegion, // 国家/地区
  586. fax: formData.fax, // fax
  587. interviewIntention: formData.interview, // 接受采访意向
  588. officeAddress: formData.officeAddress, // 办公地址
  589. arrivalNumberXian: formData.reachTrainNumber, // 抵达西安交通车次
  590. arrivalTimeXian: formData.reachTime, // 抵达西安时间
  591. departureNumber: formData.leavingTrainNumber, // 离开车次
  592. departureTime: formData.leavingTime, // 离开时间
  593. checkOutTime: formData.checkOutTime, // 离店时间
  594. remarks: formData.message, // 备注
  595. userType: '国内嘉宾'
  596. }).then((res) => {
  597. if (!isNaN(res.code) && res.code !== 0) {
  598. showToast(res.msg || lang[props.langType].networkError);
  599. return;
  600. }
  601. // 清空表单内容 from
  602. // Object.keys(from).forEach((key) => {
  603. // from[key] = '';
  604. // });
  605. loading.value = false
  606. showDialog({
  607. message: lang[props.langType].registration,
  608. })
  609. }).catch((res) => {
  610. loading.value = false
  611. showToast(res.msg || lang[props.langType].networkError);
  612. });
  613. }
  614. defineExpose({ reset })
  615. </script>