form.vue 33 KB

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