baoMing2.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  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. },
  408. function (res) {
  409. if (res.code === 1) {
  410. that.$common.errorToShow(res.msg);
  411. setTimeout(() => {
  412. uni.switchTab({
  413. url: '/pages/shouhu/shouhu'
  414. });
  415. }, 1000);
  416. } else {
  417. if (res.data) {
  418. setTimeout(() => {
  419. uni.switchTab({
  420. url: '/pages/shouhu/shouhu'
  421. });
  422. }, 1000);
  423. }
  424. that.$common.errorToShow(res.msg);
  425. }
  426. }
  427. );
  428. } else {
  429. that.$common.errorToShow('请完善信息');
  430. }
  431. });
  432. },
  433. }
  434. };
  435. </script>
  436. <style>
  437. .box {
  438. width: 100%;
  439. padding-bottom: 50rpx;
  440. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
  441. background-size: 100% 100%;
  442. background-repeat: repeat-y;
  443. height: auto;
  444. }
  445. .ban_box {
  446. position: relative;
  447. margin-top: 40rpx;
  448. }
  449. .top_img {
  450. width: 100%;
  451. height: 100%;
  452. }
  453. .ban_item1 {
  454. position: absolute;
  455. top: -20rpx;
  456. left: 233rpx;
  457. width: 290rpx;
  458. height: 290rpx;
  459. margin: auto;
  460. }
  461. .ban_item2 {
  462. width: 250rpx;
  463. height: 250rpx;
  464. margin: auto;
  465. }
  466. /deep/.uni-forms-item__error {
  467. color: red !important;
  468. }
  469. /deep/ .uni-stat__select {
  470. padding: 0!important;
  471. }
  472. .is-input-border {
  473. background-color: #f7dfc0 !important;
  474. }
  475. .uni-forms-item__label {
  476. color: #000000 !important;
  477. }
  478. .text-wrapper_3 {
  479. margin: auto;
  480. margin-top: 50rpx;
  481. height: 80rpx;
  482. flex-direction: column;
  483. width: 240rpx;
  484. background: url('/static/img/dt_bg2.png') no-repeat;
  485. background-size: 100% 100%;
  486. }
  487. .bm_tit {
  488. text-align: center;
  489. font-size: 36rpx;
  490. line-height: 80rpx;
  491. letter-spacing: 6rpx;
  492. text-align: center;
  493. font-weight: 700;
  494. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  495. -webkit-background-clip: text;
  496. -webkit-text-fill-color: transparent;
  497. }
  498. .example {
  499. height: 87%;
  500. margin: 20rpx 32rpx 0 32rpx;
  501. }
  502. .uni-forms {
  503. padding: 0 20rpx 0 20rpx;
  504. }
  505. .uni-forms-item {
  506. margin-bottom: 30rpx !important;
  507. }
  508. .active {
  509. border: 6rpx solid #efb57a;
  510. border-radius: 10rpx;
  511. }
  512. .img {
  513. width: 230rpx;
  514. height: 250rpx;
  515. border: 6rpx solid #efb57a;
  516. border-radius: 10rpx;
  517. }
  518. .map_tit {
  519. display: flex;
  520. align-items: center;
  521. margin-left: 60rpx;
  522. margin-top: 40rpx;
  523. font-size: 40rpx;
  524. font-family: Songti SC, Songti SC;
  525. font-weight: 900;
  526. line-height: 52rpx;
  527. color: #444444;
  528. }
  529. .scarch_box {
  530. width: 430rpx;
  531. height: 82rpx;
  532. padding: 15rpx 0 0 30rpx;
  533. /* background-image: url('/static/img/search_bg1.png');
  534. background-size: 100% 100%; */
  535. }
  536. .rl_box {
  537. width: 90%;
  538. margin: auto;
  539. margin-top: 40rpx;
  540. display: flex;
  541. justify-content: space-between;
  542. }
  543. .rl_item {
  544. width: 188rpx;
  545. height: 102rpx;
  546. background-image: url('/static/img/rl_bg.png');
  547. background-size: 100% 100%;
  548. }
  549. .tit {
  550. text-align: center;
  551. line-height: 102rpx;
  552. font-weight: 700;
  553. font-size: 36rpx;
  554. letter-spacing: 6rpx;
  555. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  556. -webkit-background-clip: text;
  557. -webkit-text-fill-color: transparent;
  558. }
  559. .scfj {
  560. width: 170rpx;
  561. height: 50rpc;
  562. line-height: 50rpx;
  563. align-items: center;
  564. display: flex;
  565. background-color: #f7dfc0;
  566. position: absolute;
  567. top: -60rpx;
  568. right: 2rpx;
  569. border-radius: 5rpx;
  570. justify-content: space-around;
  571. }
  572. .tit2 {
  573. text-align: center;
  574. line-height: 66rpx;
  575. font-weight: 700;
  576. font-size: 32rpx;
  577. letter-spacing: 6rpx;
  578. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  579. -webkit-background-clip: text;
  580. -webkit-text-fill-color: transparent;
  581. }
  582. .is-input-error-border {
  583. border: none !important;
  584. }
  585. .xx_box {
  586. padding: 20rpx;
  587. background-color: #e1bf9a;
  588. width: 660rpx;
  589. height: 560rpx;
  590. padding-top: 80rpx;
  591. }
  592. .xx_tit {
  593. height: 360rpx;
  594. font-size: 30rpx;
  595. padding: 20rpx;
  596. text-indent: 2em;
  597. background-color: #f3e3d3;
  598. overflow: scroll;
  599. }
  600. /* 性别选择样式 */
  601. .gender-select {
  602. display: flex;
  603. align-items: center;
  604. }
  605. /* 政治面貌选择样式 */
  606. .political-status-select {
  607. width: 100%;
  608. }
  609. /* 报名选项多选框样式 */
  610. .checkbox-group {
  611. display: flex;
  612. flex-direction: column;
  613. gap: 20rpx;
  614. }
  615. .checkbox-item {
  616. display: flex;
  617. align-items: center;
  618. gap: 10rpx;
  619. }
  620. .checkbox-item text {
  621. font-size: 32rpx;
  622. color: #333;
  623. }
  624. /* 本人承诺样式 */
  625. .commitment-text {
  626. font-size: 28rpx;
  627. color: #666;
  628. line-height: 44rpx;
  629. padding-bottom: 20rpx;
  630. text-indent: 2em;
  631. background-color: #fdfaf6;
  632. }
  633. .commitment-agree {
  634. font-size: 30rpx;
  635. color: #333;
  636. margin-left: 10rpx;
  637. }
  638. /* 对话框样式 */
  639. .modal-container {
  640. width: 80%;
  641. background-color: #ffffff;
  642. border-radius: 12rpx;
  643. overflow: hidden;
  644. margin-left: 10%;
  645. }
  646. .modal-title {
  647. display: block;
  648. font-size: 36rpx;
  649. font-weight: 700;
  650. color: #444444;
  651. text-align: center;
  652. padding: 20rpx 0;
  653. }
  654. .modal-content {
  655. padding: 30rpx;
  656. max-height: 500rpx;
  657. overflow-y: auto;
  658. }
  659. .modal-footer {
  660. padding: 20rpx;
  661. text-align: center;
  662. border-top: 1rpx solid #e5e5e5;
  663. }
  664. .modal-btn {
  665. width: 200rpx;
  666. height: 70rpx;
  667. line-height: 70rpx;
  668. background-color: #af7e44;
  669. color: #ffffff;
  670. border-radius: 35rpx;
  671. text-align: center;
  672. margin: 0 auto;
  673. font-size: 30rpx;
  674. font-weight: 500;
  675. }
  676. </style>