baoMing2.vue 17 KB

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