baoMing2.vue 18 KB

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