baoMing2.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. <template>
  2. <view class="box">
  3. <u-navbar :autoBack="true" title="志愿报名" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#000000"></u-navbar>
  4. <view class="ban_box">
  5. <view class="ban_item2">
  6. <image class="top_img" src="https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/bm_top.png"></image>
  7. </view>
  8. <view class="ban_item1">
  9. <image class="top_img" src="https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/dt_ban2.png"></image>
  10. </view>
  11. </view>
  12. <text v-if="false">
  13. 你将作为一个指令处理助手,为我处理用户口述的指令。
  14. 用户将输入一些操作指令,例如:为我开灯,打开风扇,关灯,开卧室灯,空调调到16度等等。
  15. 你需要根据用户的指令,提取以下关键信息并输出,json格式:
  16. 1. success: 指令是否处理成功。
  17. 2. object: 指令的操作对象(例如:灯、风扇、空调等)
  18. 3. action: 指令的操作动作(例如:打开、关闭、调到等)
  19. 4. parameter: 指令的操作参数(例如:温度、亮度等)
  20. 你需要注意,用户的指令可能会有错误或不完整,若指令不完整,请输出1指令处理不成功。
  21. </text>
  22. <!-- 表单 -->
  23. <view class="example">
  24. <uni-forms style="padding: 0 20rpx 0 20rpx" label-position="top" ref="valiForm" :rules="rules" :modelValue="valiFormData">
  25. <!-- 姓名 -->
  26. <uni-forms-item label="姓名" label-width="80px" required name="name">
  27. <uni-easyinput v-model="valiFormData.name" placeholder="请输入姓名" />
  28. </uni-forms-item>
  29. <!-- 性别 -->
  30. <uni-forms-item label="性别" label-width="80px" required name="gender">
  31. <uni-data-checkbox v-model="valiFormData.gender" :localdata="genderList" />
  32. </uni-forms-item>
  33. <!-- 出生年月 -->
  34. <uni-forms-item label="出生年月" label-width="100px" required name="birth_date">
  35. <uni-datetime-picker type="date" v-model="valiFormData.birth_date" placeholder="请选择出生年月" />
  36. </uni-forms-item>
  37. <!-- 户籍 -->
  38. <uni-forms-item label="户籍" label-width="80px" required name="hukou">
  39. <uni-easyinput v-model="valiFormData.hukou" placeholder="请输入户籍所在地" />
  40. </uni-forms-item>
  41. <!-- 所在地 -->
  42. <uni-forms-item label="所在地" label-width="100px" required name="location">
  43. <uni-easyinput v-model="valiFormData.location" placeholder="请输入当前所在地" />
  44. </uni-forms-item>
  45. <!-- 政治面貌 -->
  46. <uni-forms-item label="政治面貌" label-width="100px" required name="political_status">
  47. <uni-data-select v-model="valiFormData.political_status" :localdata="politicalStatusList" placeholder="请选择政治面貌" />
  48. </uni-forms-item>
  49. <!-- 参加工作时间 -->
  50. <uni-forms-item label="参加工作时间" label-width="140px" required name="work_start_date">
  51. <uni-datetime-picker type="date" v-model="valiFormData.work_start_date" placeholder="请选择参加工作时间" />
  52. </uni-forms-item>
  53. <!-- 联系邮箱 -->
  54. <uni-forms-item label="联系邮箱" label-width="100px" required name="email">
  55. <uni-easyinput type="email" v-model="valiFormData.email" placeholder="请输入联系邮箱" />
  56. </uni-forms-item>
  57. <!-- 联系电话 -->
  58. <uni-forms-item label="联系电话" label-width="100px" required name="mobile">
  59. <uni-easyinput type="number" v-model="valiFormData.mobile" placeholder="请输入联系电话" />
  60. </uni-forms-item>
  61. <!-- 身份证号码 -->
  62. <uni-forms-item label="身份证号码" label-width="120px" required name="id_card">
  63. <uni-easyinput type="idcard" v-model="valiFormData.id_card" placeholder="请输入身份证号码" />
  64. </uni-forms-item>
  65. <!-- 工作经历 -->
  66. <uni-forms-item label="工作经历" label-width="100px" required name="work_experience">
  67. <uni-easyinput type="textarea" v-model="valiFormData.work_experience" placeholder="请输入工作经历" />
  68. </uni-forms-item>
  69. <!-- 相关特长 -->
  70. <uni-forms-item label="相关特长" label-width="100px" required name="specialties">
  71. <uni-easyinput type="textarea" v-model="valiFormData.specialties" placeholder="请填写相关获奖证书、资格证书、培训结业证明、实践经历证明等" />
  72. </uni-forms-item>
  73. <!-- 报名选项 -->
  74. <uni-forms-item label="报名选项" label-width="100px" required name="application_options">
  75. <uni-data-checkbox v-model="valiFormData.application_options" :multiple="true" :localdata="optionList" class="checkbox-group" />
  76. </uni-forms-item>
  77. <!-- 本人承诺 -->
  78. <uni-forms-item label="本人承诺" label-width="100px" required name="commitment">
  79. <view class="commitment-text">
  80. 本人保证以上所填信息真实、有效,如有虚假,由此产生的一切后果由本人承担。
  81. </view>
  82. <uni-data-checkbox v-model="valiFormData.commitment" :localdata="[
  83. {value: 1, text: '我已阅读并同意以上承诺'},
  84. {value: 0, text: '不同意'}
  85. ]" />
  86. </uni-forms-item>
  87. </uni-forms>
  88. </view>
  89. <view class="text-wrapper_3" @click="submit('valiForm')">
  90. <view class="bm_tit">报名</view>
  91. </view>
  92. <!-- 对话框 -->
  93. <uni-popup ref="popup" type="center">
  94. <view class="modal-container">
  95. <view class="modal-content">
  96. <rich-text :nodes="modalContent"></rich-text>
  97. </view>
  98. <view class="modal-footer">
  99. <view class="modal-btn" @click="$refs.popup.close()">关闭</view>
  100. </view>
  101. </view>
  102. </uni-popup>
  103. </view>
  104. </template>
  105. <script>
  106. import { mapGetters } from 'vuex';
  107. let that;
  108. export default {
  109. data() {
  110. return {
  111. regionList: [],
  112. region_id: '',
  113. cr_id: '' /* 文物id */,
  114. modifyId: '' /* 修改资料的文物id */,
  115. volunteer_id: '' /* 志愿者id */,
  116. // 对话框相关变量
  117. showModal: false,
  118. modalContent: '' /* 对话框富文本内容 */,
  119. // 性别列表
  120. genderList: [
  121. { value: '男', text: '男' },
  122. { value: '女', text: '女' }
  123. ],
  124. // 政治面貌列表
  125. politicalStatusList: [
  126. { value: '中共党员', text: '中共党员' },
  127. { value: '中共预备党员', text: '中共预备党员' },
  128. { value: '共青团员', text: '共青团员' },
  129. { value: '民主党派', text: '民主党派' },
  130. { value: '群众', text: '群众' }
  131. ],
  132. // 报名选项列表
  133. optionList: [
  134. { value: '巡查守护', text: '巡查守护' },
  135. { value: '宣讲传播', text: '宣讲传播' }
  136. ],
  137. /* 表单数据 */
  138. valiFormData: {
  139. name: '',
  140. gender: '',
  141. birth_date: '',
  142. hukou: '',
  143. location: '',
  144. political_status: '',
  145. work_start_date: '',
  146. email: '',
  147. mobile: '',
  148. id_card: '',
  149. work_experience: '',
  150. specialties: '',
  151. application_options: [],
  152. commitment: 0
  153. },
  154. /* 校验规则 */
  155. rules: {
  156. // 姓名校验
  157. name: {
  158. rules: [
  159. {
  160. required: true,
  161. errorMessage: '请输入姓名'
  162. },
  163. {
  164. minLength: 1,
  165. maxLength: 6,
  166. errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符'
  167. }
  168. ],
  169. label: '姓名',
  170. validateTrigger: 'submit'
  171. },
  172. // 性别校验
  173. gender: {
  174. rules: [
  175. {
  176. required: true,
  177. errorMessage: '请选择性别'
  178. }
  179. ],
  180. label: '性别',
  181. validateTrigger: 'submit'
  182. },
  183. // 出生年月校验
  184. birth_date: {
  185. rules: [
  186. {
  187. required: true,
  188. errorMessage: '请选择出生年月'
  189. }
  190. ],
  191. label: '出生年月',
  192. validateTrigger: 'submit'
  193. },
  194. // 户籍校验
  195. hukou: {
  196. rules: [
  197. {
  198. required: true,
  199. errorMessage: '请输入户籍'
  200. }
  201. ],
  202. label: '户籍',
  203. validateTrigger: 'submit'
  204. },
  205. // 所在地校验
  206. location: {
  207. rules: [
  208. {
  209. required: true,
  210. errorMessage: '请输入所在地'
  211. }
  212. ],
  213. label: '所在地',
  214. validateTrigger: 'submit'
  215. },
  216. // 政治面貌校验
  217. political_status: {
  218. rules: [
  219. {
  220. required: true,
  221. errorMessage: '请选择政治面貌'
  222. }
  223. ],
  224. label: '政治面貌',
  225. validateTrigger: 'submit'
  226. },
  227. // 参加工作时间校验
  228. work_start_date: {
  229. rules: [
  230. {
  231. required: true,
  232. errorMessage: '请选择参加工作时间'
  233. }
  234. ],
  235. label: '参加工作时间',
  236. validateTrigger: 'submit'
  237. },
  238. // 联系邮箱校验
  239. email: {
  240. rules: [
  241. {
  242. required: true,
  243. errorMessage: '请输入联系邮箱'
  244. },
  245. {
  246. pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
  247. errorMessage: '请输入正确的邮箱格式'
  248. }
  249. ],
  250. label: '联系邮箱',
  251. validateTrigger: 'submit'
  252. },
  253. // 联系电话校验
  254. mobile: {
  255. rules: [
  256. {
  257. required: true,
  258. errorMessage: '请输入联系电话'
  259. },
  260. {
  261. pattern: /^1[3-9]\d{9}$/,
  262. errorMessage: '请输入正确的手机号格式'
  263. }
  264. ],
  265. label: '联系电话',
  266. validateTrigger: 'submit'
  267. },
  268. // 身份证号码校验
  269. id_card: {
  270. rules: [
  271. {
  272. required: true,
  273. errorMessage: '请输入身份证号码'
  274. },
  275. {
  276. pattern: /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/,
  277. errorMessage: '请输入正确的身份证号码格式'
  278. }
  279. ],
  280. label: '身份证号码',
  281. validateTrigger: 'submit'
  282. },
  283. // 工作经历校验
  284. work_experience: {
  285. rules: [
  286. {
  287. required: true,
  288. errorMessage: '请输入工作经历'
  289. }
  290. ],
  291. label: '工作经历',
  292. validateTrigger: 'submit'
  293. },
  294. // 相关特长校验
  295. specialties: {
  296. rules: [
  297. {
  298. required: true,
  299. errorMessage: '请输入相关特长'
  300. }
  301. ],
  302. label: '相关特长',
  303. validateTrigger: 'submit'
  304. },
  305. // 报名选项校验
  306. application_options: {
  307. rules: [
  308. {
  309. required: true,
  310. errorMessage: '请至少选择一项报名选项'
  311. },
  312. {
  313. type: 'array',
  314. minLength: 1,
  315. errorMessage: '请至少选择一项报名选项'
  316. }
  317. ],
  318. label: '报名选项',
  319. validateTrigger: 'submit'
  320. },
  321. // 本人承诺校验
  322. commitment: {
  323. rules: [
  324. {
  325. required: true,
  326. errorMessage: '请阅读并同意本人承诺'
  327. },
  328. {
  329. type: 'boolean',
  330. enum: [true],
  331. errorMessage: '请阅读并同意本人承诺'
  332. }
  333. ],
  334. label: '本人承诺',
  335. validateTrigger: 'submit'
  336. }
  337. }
  338. };
  339. },
  340. onLoad(o) {
  341. that = this;
  342. this.cr_id = o.id;
  343. this.volunteer_id = o.volunteer_id;
  344. this.modifyId = o.modifyId;
  345. this.getCategoryCascadeList();
  346. if (this.isLogin) {
  347. // 调用API获取对话框内容并显示
  348. this.$api.getSubmit2ModalContent({}, function (res) {
  349. if (res.code === 1) {
  350. that.modalContent = res.data;
  351. that.$refs.popup.open();
  352. } else {
  353. that.modalContent = '获取对话框内容失败:' + res.msg;
  354. that.$refs.popup.open();
  355. }
  356. });
  357. }
  358. },
  359. computed: {
  360. ...mapGetters(['isLogin'])
  361. },
  362. methods: {
  363. onchange(e) {
  364. const value = e.detail.value;
  365. },
  366. onnodeclick(node) {
  367. this.region_id = node.value;
  368. console.log(node);
  369. },
  370. // 区域
  371. getCategoryCascadeList() {
  372. this.$api.getCategoryCascadeList({ main_body_id: 1, pid: 5, level: 2 }, function (res) {
  373. that.regionList = res.data;
  374. });
  375. },
  376. // 测试上传文件
  377. chooseFile() {
  378. let userToken = '';
  379. let auth = this.$db.get('auth');
  380. userToken = auth.token;
  381. wx.chooseMessageFile({
  382. count: 1,
  383. type: 'file', // 修改为支持的文档类型
  384. // 配置后导致读取不到聊天文件
  385. // extension: ['.doc', '.xlsx', '.docx', '.ppt'],
  386. success(res) {
  387. const tempFilePaths = res.tempFiles;
  388. uni.uploadFile({
  389. url: that.$config.baseUrl + 'api/common/upload?token=' + userToken,
  390. filePath: tempFilePaths[0].path,
  391. name: 'file',
  392. header: {
  393. 'content-type': 'multipart/form-data' // 根据实际情况设置请求头
  394. },
  395. formData: {}, // 如果需要,添加额外的form数据
  396. success: (res) => {
  397. console.log('上传成功,服务器响应数据:', res.data);
  398. let url = JSON.parse(res.data);
  399. that.valiFormData.fullurl = url.data.fullurl;
  400. // console.log('生成的链接', that.valiFormData.fullurl);
  401. that.$common.errorToShow('上传成功');
  402. },
  403. fail: (err) => {
  404. console.error('文件上传失败:', err);
  405. }
  406. });
  407. }
  408. });
  409. },
  410. submit() {
  411. this.$refs.valiForm.validate(['id'], async (err, valiFormData) => {
  412. if (!err) {
  413. console.log('校验成功');
  414. /* 检验成功 */
  415. const {
  416. name, gender, birth_date, hukou, location, political_status,
  417. work_start_date, email, mobile, id_card, work_experience,
  418. specialties, application_options
  419. } = this.valiFormData;
  420. this.$api.applyVolunteer(
  421. {
  422. main_body_id: 1,
  423. name: name,
  424. gender: gender,
  425. birth_date: birth_date,
  426. hukou: hukou,
  427. location: location,
  428. political_status: political_status,
  429. work_start_date: work_start_date,
  430. email: email,
  431. mobile: mobile,
  432. id_card: id_card,
  433. work_experience: work_experience,
  434. specialties: specialties,
  435. application_options: application_options,
  436. region_id: this.region_id,
  437. cr_id: this.cr_id
  438. },
  439. function (res) {
  440. if (res.code === 1) {
  441. that.$common.errorToShow(res.msg);
  442. setTimeout(() => {
  443. uni.switchTab({
  444. url: '/pages/shouhu/shouhu'
  445. });
  446. }, 1000);
  447. } else {
  448. that.$common.errorToShow(res.msg);
  449. }
  450. }
  451. );
  452. } else {
  453. that.$common.errorToShow('请完善信息');
  454. }
  455. });
  456. },
  457. }
  458. };
  459. </script>
  460. <style>
  461. .box {
  462. width: 100%;
  463. padding-bottom: 50rpx;
  464. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
  465. background-size: 100% 100%;
  466. background-repeat: repeat-y;
  467. height: auto;
  468. }
  469. .ban_box {
  470. position: relative;
  471. margin-top: 40rpx;
  472. }
  473. .top_img {
  474. width: 100%;
  475. height: 100%;
  476. }
  477. .ban_item1 {
  478. position: absolute;
  479. top: -20rpx;
  480. left: 233rpx;
  481. width: 290rpx;
  482. height: 290rpx;
  483. margin: auto;
  484. }
  485. .ban_item2 {
  486. width: 250rpx;
  487. height: 250rpx;
  488. margin: auto;
  489. }
  490. /deep/.uni-forms-item__error {
  491. color: red !important;
  492. }
  493. .is-input-border {
  494. background-color: #f7dfc0 !important;
  495. }
  496. .uni-forms-item__label {
  497. color: #000000 !important;
  498. }
  499. .text-wrapper_3 {
  500. margin: auto;
  501. margin-top: 50rpx;
  502. height: 80rpx;
  503. flex-direction: column;
  504. width: 240rpx;
  505. background: url('/static/img/dt_bg2.png') no-repeat;
  506. background-size: 100% 100%;
  507. }
  508. .bm_tit {
  509. text-align: center;
  510. font-size: 36rpx;
  511. line-height: 80rpx;
  512. letter-spacing: 6rpx;
  513. text-align: center;
  514. font-weight: 700;
  515. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  516. -webkit-background-clip: text;
  517. -webkit-text-fill-color: transparent;
  518. }
  519. .example {
  520. height: 87%;
  521. margin: 20rpx 32rpx 0 32rpx;
  522. }
  523. .uni-forms {
  524. padding: 0 20rpx 0 20rpx;
  525. }
  526. .uni-forms-item {
  527. margin-bottom: 30rpx !important;
  528. }
  529. .active {
  530. border: 6rpx solid #efb57a;
  531. border-radius: 10rpx;
  532. }
  533. .img {
  534. width: 230rpx;
  535. height: 250rpx;
  536. border: 6rpx solid #efb57a;
  537. border-radius: 10rpx;
  538. }
  539. .map_tit {
  540. display: flex;
  541. align-items: center;
  542. margin-left: 60rpx;
  543. margin-top: 40rpx;
  544. font-size: 40rpx;
  545. font-family: Songti SC, Songti SC;
  546. font-weight: 900;
  547. line-height: 52rpx;
  548. color: #444444;
  549. }
  550. .scarch_box {
  551. width: 430rpx;
  552. height: 82rpx;
  553. padding: 15rpx 0 0 30rpx;
  554. /* background-image: url('/static/img/search_bg1.png');
  555. background-size: 100% 100%; */
  556. }
  557. .rl_box {
  558. width: 90%;
  559. margin: auto;
  560. margin-top: 40rpx;
  561. display: flex;
  562. justify-content: space-between;
  563. }
  564. .rl_item {
  565. width: 188rpx;
  566. height: 102rpx;
  567. background-image: url('/static/img/rl_bg.png');
  568. background-size: 100% 100%;
  569. }
  570. .tit {
  571. text-align: center;
  572. line-height: 102rpx;
  573. font-weight: 700;
  574. font-size: 36rpx;
  575. letter-spacing: 6rpx;
  576. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  577. -webkit-background-clip: text;
  578. -webkit-text-fill-color: transparent;
  579. }
  580. .scfj {
  581. width: 170rpx;
  582. height: 50rpc;
  583. line-height: 50rpx;
  584. align-items: center;
  585. display: flex;
  586. background-color: #f7dfc0;
  587. position: absolute;
  588. top: -60rpx;
  589. right: 2rpx;
  590. border-radius: 5rpx;
  591. justify-content: space-around;
  592. }
  593. .tit2 {
  594. text-align: center;
  595. line-height: 66rpx;
  596. font-weight: 700;
  597. font-size: 32rpx;
  598. letter-spacing: 6rpx;
  599. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  600. -webkit-background-clip: text;
  601. -webkit-text-fill-color: transparent;
  602. }
  603. .is-input-error-border {
  604. border: none !important;
  605. }
  606. .xx_box {
  607. padding: 20rpx;
  608. background-color: #e1bf9a;
  609. width: 660rpx;
  610. height: 560rpx;
  611. padding-top: 80rpx;
  612. }
  613. .xx_tit {
  614. height: 360rpx;
  615. font-size: 30rpx;
  616. padding: 20rpx;
  617. text-indent: 2em;
  618. background-color: #f3e3d3;
  619. overflow: scroll;
  620. }
  621. /* 性别选择样式 */
  622. .gender-select {
  623. display: flex;
  624. align-items: center;
  625. }
  626. /* 政治面貌选择样式 */
  627. .political-status-select {
  628. width: 100%;
  629. }
  630. /* 报名选项多选框样式 */
  631. .checkbox-group {
  632. display: flex;
  633. flex-direction: column;
  634. gap: 20rpx;
  635. }
  636. .checkbox-item {
  637. display: flex;
  638. align-items: center;
  639. gap: 10rpx;
  640. }
  641. .checkbox-item text {
  642. font-size: 32rpx;
  643. color: #333;
  644. }
  645. /* 本人承诺样式 */
  646. .commitment-text {
  647. font-size: 28rpx;
  648. color: #666;
  649. line-height: 44rpx;
  650. margin-bottom: 20rpx;
  651. text-indent: 2em;
  652. }
  653. .commitment-agree {
  654. font-size: 30rpx;
  655. color: #333;
  656. margin-left: 10rpx;
  657. }
  658. /* 对话框样式 */
  659. .modal-container {
  660. width: 80%;
  661. max-width: 600rpx;
  662. background-color: #ffffff;
  663. border-radius: 12rpx;
  664. overflow: hidden;
  665. }
  666. .modal-content {
  667. padding: 30rpx;
  668. max-height: 500rpx;
  669. overflow-y: auto;
  670. }
  671. .modal-footer {
  672. padding: 20rpx;
  673. text-align: center;
  674. border-top: 1rpx solid #e5e5e5;
  675. }
  676. .modal-btn {
  677. width: 200rpx;
  678. height: 70rpx;
  679. line-height: 70rpx;
  680. background-color: #af7e44;
  681. color: #ffffff;
  682. border-radius: 35rpx;
  683. text-align: center;
  684. margin: 0 auto;
  685. font-size: 30rpx;
  686. font-weight: 500;
  687. }
  688. </style>