input - 副本.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <view class="topBox">
  4. <view>
  5. <u-icon name="error-circle-fill" color="#FF3B30" size="28"></u-icon>
  6. <text style="color: #FF3B30;margin-left: 10rpx;">学习前请提交完整审核资料</text>
  7. </view>
  8. <view style="color: #007AFF;">稍后再填</view>
  9. </view>
  10. <u-collapse v-if="remarkStatus" :item-style="itemStyle" event-type="close">
  11. <u-collapse-item title="审核结果反馈">
  12. <view style="padding-bottom: 30rpx;">
  13. <text class="collapse-item">{{ remark }}</text>
  14. </view>
  15. </u-collapse-item>
  16. </u-collapse>
  17. <view class="submit_btn" @click="cahngeText">
  18. 改变值
  19. </view>
  20. <view class="bodyBox" style="margin-top: 30rpx;padding:0 20rpx;">
  21. <u-form :model="form" ref="uForm">
  22. <template v-for="(item, index) in listData">
  23. <u-form-item
  24. :key="index"
  25. v-if="item.inputType == 1"
  26. :label="item.fieldName"
  27. :required="item.required"
  28. :label-width="auto"
  29. :prop="item.required ? item.fieldKey : ''"
  30. >
  31. <u-input v-model="form[item.fieldKey]" :placeholder="`请输入${item.fieldName}`" />
  32. </u-form-item>
  33. <u-form-item
  34. :key="index"
  35. v-if="item.inputType == 2"
  36. :label="item.fieldName"
  37. :label-width="auto"
  38. :required="item.required"
  39. :prop="item.required ? item.fieldKey : ''"
  40. >
  41. <picker @change="bindPickerChange(item.fieldKey, $event)" :value="form[item.fieldKey]" :range="getarrays(item.fieldKey)">
  42. <view class="picker">{{ returnName(item.fieldKey) }}</view>
  43. </picker>
  44. </u-form-item>
  45. <u-form-item
  46. :key="index"
  47. v-if="item.inputType == 5"
  48. :label="item.fieldName"
  49. :label-width="auto"
  50. :required="item.required"
  51. :prop="item.required ? item.fieldKey : ''"
  52. >
  53. <picker mode="date" :value="form[item.fieldKey]" @change="bindDateChange(item.fieldKey, $event)">
  54. <view class="picker">{{ getTimes(item.fieldKey) }}</view>
  55. </picker>
  56. </u-form-item>
  57. <u-form-item
  58. :key="index"
  59. v-if="item.inputType == 3 && item.fieldKey !== 'commitment_electr_signature'"
  60. :label="item.fieldName"
  61. :required="item.required"
  62. :label-width="auto"
  63. label-position="top"
  64. :prop="item.required ? item.fieldKey : ''"
  65. >
  66. <text v-if="item.fieldKey === 'recent_photos'" style="color: #999999;position: absolute;top: 20rpx;left: 130rpx;">竖向证件照 文件大小≤2M</text>
  67. <text
  68. v-if="item.fieldKey === 'idcard_face_photo' || item.fieldKey === 'idcard_national_photo'"
  69. style="color: #999999;position: absolute;top: 20rpx;left: 180rpx;"
  70. >
  71. 文件大小≤2M
  72. </text>
  73. <u-upload
  74. :max-size="2097152"
  75. @on-list-change="
  76. item.fieldKey === 'recent_photos'
  77. ? changePhotoListHeader1($event)
  78. : item.fieldKey === 'idcard_face_photo'
  79. ? changePhotoListHeader2($event)
  80. : item.fieldKey === 'idcard_national_photo'
  81. ? changePhotoListHeader3($event)
  82. : ''
  83. "
  84. :auto-upload="false"
  85. custom-btn="true"
  86. :action="action"
  87. :file-list="
  88. item.fieldKey === 'recent_photos'
  89. ? fileList1
  90. : item.fieldKey === 'idcard_face_photo'
  91. ? fileList2
  92. : item.fieldKey === 'idcard_national_photo'
  93. ? fileList3
  94. : ''
  95. "
  96. width="120"
  97. height="120"
  98. size-type="['compressed']"
  99. max-count="1"
  100. >
  101. <template v-slot:addBtn>
  102. <image
  103. :src="
  104. item.fieldKey === 'recent_photos'
  105. ? '/static/info_1.png'
  106. : item.fieldKey === 'idcard_face_photo'
  107. ? '/static/info_2.png'
  108. : item.fieldKey === 'idcard_national_photo'
  109. ? '/static/info_3.png'
  110. : ''
  111. "
  112. :style="
  113. item.fieldKey === 'recent_photos'
  114. ? 'width: 120rpx; height: 169rpx;'
  115. : item.fieldKey === 'idcard_face_photo'
  116. ? 'width: 120rpx; height: 82rpx;'
  117. : item.fieldKey === 'idcard_national_photo'
  118. ? 'width: 120rpx; height: 82rpx;'
  119. : ''
  120. "
  121. ></image>
  122. </template>
  123. </u-upload>
  124. </u-form-item>
  125. <view :key="index" v-if="item.inputType == 3 && item.fieldKey === 'commitment_electr_signature'">
  126. <u-form-item
  127. v-if="item.inputType == 3 && item.fieldKey === 'commitment_electr_signature'"
  128. label="承诺书"
  129. :required="true"
  130. :label-width="auto"
  131. label-position="top"
  132. >
  133. <view style="line-height: 40rpx;text-indent:2em">
  134. <text>
  135. 本人自愿做出如下承诺:本人己仔细阅读《广东省住房和城乡建设厅关于推进住房和城乡建设领域施工现场专业人员职业培训工作的通知》
  136. 全部内容并知晓和理解,本人的学历证书、身份证、工作年限、相片等所有资料完全真实、符合报名条件、资格审查要求和相关规定,本人在报名、审查、培训、测试等有关的事项中会严格道守相关规定和要求,如有虛假或与实际规定不符等情况造成的一切后果由本人承担。
  137. </text>
  138. <view style="line-height: 40rpx;text-indent:2em"><text>特此承诺!</text></view>
  139. </view>
  140. </u-form-item>
  141. <u-form-item
  142. v-if="item.inputType == 3 && item.fieldKey === 'commitment_electr_signature'"
  143. label="签名板"
  144. :required="true"
  145. :label-width="auto"
  146. label-position="top"
  147. :prop="item.required ? item.fieldKey : ''"
  148. >
  149. <view class="dis_stys">
  150. <text style="color: #999999;">请在下方签名区进行签名</text>
  151. <text @click="retDraw" mode="">清空</text>
  152. </view>
  153. <view class="handCenter">
  154. <canvas
  155. class="handWriting"
  156. disable-scroll="true"
  157. @touchstart="uploadScaleStart"
  158. @touchmove="uploadScaleMove"
  159. @touchend="uploadScaleEnd"
  160. @tap="mouseDown"
  161. canvas-id="handWriting"
  162. ></canvas>
  163. </view>
  164. </u-form-item>
  165. </view>
  166. </template>
  167. </u-form>
  168. </view>
  169. <view @click="submits" class="submit_btn">提交资料</view>
  170. </view>
  171. </template>
  172. <script>
  173. import { mapGetters } from 'vuex';
  174. import Handwriting from '@/common/signature.js';
  175. export default {
  176. data() {
  177. return {
  178. itemStyle: {
  179. marginTop: '20px',
  180. backgroundColor: '#fff',
  181. borderRadius: '24rpx',
  182. padding: '0rpx 20rpx'
  183. },
  184. form: {
  185. name: '',
  186. sex: '',
  187. idcard: '',
  188. telphone: '',
  189. education: '',
  190. school: '',
  191. graduation_time: '',
  192. work_unit: '',
  193. unit_contact: '',
  194. unit_tel: '',
  195. apply_post: '',
  196. major: '',
  197. working_years: '',
  198. recent_photos: '',
  199. idcard_face_photo: '',
  200. idcard_national_photo: '',
  201. commitment_electr_signature: ''
  202. },
  203. lineColor: 'black',
  204. slideValue: 50,
  205. handwriting: '',
  206. goodsId: null,
  207. listData: [], //页面数据
  208. fileList1: [], //个人近照
  209. fileList2: [], //人像
  210. fileList3: [], //国徽
  211. openVerify: false, // 控制是否手动验证
  212. remark: '', //反馈文本
  213. remarkStatus: false, //是否存在审核结果反馈
  214. // nextStatus: false, //是否有下一步
  215. rules: {
  216. name: [
  217. {
  218. required: true,
  219. message: '请输入姓名',
  220. trigger: ['change', 'blur']
  221. }
  222. ],
  223. sex: [
  224. {
  225. required: true,
  226. message: '请选择性别',
  227. trigger: 'change'
  228. }
  229. ],
  230. idcard: [
  231. {
  232. required: true,
  233. message: '请输入身份证号',
  234. trigger: ['change', 'blur']
  235. },
  236. {
  237. validator: (rule, value, callback) => {
  238. return this.$u.test.idCard(value);
  239. },
  240. message: '身份证号不正确',
  241. trigger: ['change', 'blur']
  242. }
  243. ],
  244. telphone: [
  245. {
  246. required: true,
  247. message: '请输入手机号码',
  248. trigger: ['change', 'blur']
  249. },
  250. {
  251. validator: (rule, value, callback) => {
  252. return this.$u.test.mobile(value);
  253. },
  254. message: '手机号码不正确',
  255. trigger: ['change', 'blur']
  256. }
  257. ],
  258. education: [
  259. {
  260. required: true,
  261. message: '请选择学历',
  262. trigger: 'change'
  263. }
  264. ],
  265. school: [
  266. {
  267. required: true,
  268. message: '请输入毕业院校',
  269. trigger: ['change', 'blur']
  270. }
  271. ],
  272. graduation_time: [
  273. {
  274. required: true,
  275. message: '请选择毕业时间',
  276. trigger: 'change'
  277. }
  278. ],
  279. work_unit: [
  280. {
  281. required: true,
  282. message: '请输入工作单位',
  283. trigger: ['change', 'blur']
  284. }
  285. ],
  286. unit_contact: [
  287. {
  288. required: true,
  289. message: '请输入单位联系人',
  290. trigger: ['change', 'blur']
  291. }
  292. ],
  293. unit_tel: [
  294. {
  295. required: true,
  296. message: '请输入单位联系电话',
  297. trigger: ['change', 'blur']
  298. },
  299. {
  300. validator: (rule, value, callback) => {
  301. return this.$u.test.mobile(value);
  302. },
  303. message: '单位联系电话不正确',
  304. trigger: ['change', 'blur']
  305. }
  306. ],
  307. apply_post: [
  308. {
  309. required: true,
  310. message: '请输入报名岗位',
  311. trigger: ['change', 'blur']
  312. }
  313. ],
  314. major: [
  315. {
  316. required: true,
  317. message: '请输入所学专业',
  318. trigger: ['change', 'blur']
  319. }
  320. ],
  321. working_years: [
  322. {
  323. required: true,
  324. message: '请选择工作年限',
  325. trigger: 'change'
  326. }
  327. ],
  328. recent_photos: [
  329. {
  330. required: true,
  331. message: '请上传个人近照',
  332. trigger: ['change', 'blur']
  333. }
  334. ],
  335. idcard_face_photo: [
  336. {
  337. required: true,
  338. message: '请上传身份证正面照',
  339. trigger: ['change', 'blur']
  340. }
  341. ],
  342. idcard_national_photo: [
  343. {
  344. required: true,
  345. message: '请上传身份证国徽照',
  346. trigger: ['change', 'blur']
  347. }
  348. ],
  349. commitment_electr_signature: [
  350. {
  351. required: true,
  352. message: '请签写承诺书电子签',
  353. trigger: ['change', 'blur']
  354. }
  355. ]
  356. }
  357. };
  358. },
  359. onLoad(option) {
  360. this.goodsId = Number(option.id);
  361. this.getInfo();
  362. },
  363. onReady(res) {
  364. this.handwriting = new Handwriting({
  365. lineColor: this.lineColor,
  366. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  367. canvasName: 'handWriting'
  368. });
  369. this.$refs.uForm.setRules(this.rules);
  370. },
  371. computed: { ...mapGetters(['dictObj']) },
  372. methods: {
  373. cahngeText(){
  374. this.$set(this.form,'name','唐')
  375. console.log(this.form.name,123)
  376. },
  377. uploadDatas(data) {
  378. var self = this;
  379. var objs = {};
  380. for (let k in data) {
  381. objs[k] = {
  382. fieldKey: k,
  383. value: data[k],
  384. fieldName: (function() {
  385. for (let i = 0; i < self.listData.length; i++) {
  386. if (self.listData[i].fieldKey == k) {
  387. return self.listData[i].fieldName;
  388. }
  389. }
  390. })(),
  391. status: 0
  392. };
  393. }
  394. var datas = {
  395. goodsId: this.goodsId,
  396. keyValue: JSON.stringify(objs)
  397. };
  398. this.$api.addbaseprofiletp(datas).then(res => {
  399. if (res.data.code === 200) {
  400. this.$method.showToast('提交成功');
  401. }
  402. });
  403. },
  404. //提交表单
  405. async submitApi() {
  406. var data = JSON.parse(JSON.stringify(this.form));
  407. if (data['sex']) {
  408. data.sex = this.dictObj['sys_user_sex'][Number(data.sex)];
  409. }
  410. if (data['education']) {
  411. data.education = this.dictObj['edu_level'][Number(data.education)];
  412. }
  413. if (data['working_years']) {
  414. data.working_years = this.dictObj['working_years'][Number(data.working_years)];
  415. }
  416. if (data['recent_photos']) {
  417. data.recent_photos = await this.$method.uploadFile(data.recent_photos, 0);
  418. }
  419. if (data['idcard_face_photo']) {
  420. data.idcard_face_photo = await this.$method.uploadFile(data.idcard_face_photo, 0);
  421. }
  422. if (data['idcard_national_photo']) {
  423. data.idcard_national_photo = await this.$method.uploadFile(data.idcard_national_photo, 0);
  424. }
  425. if (data['commitment_electr_signature']) {
  426. data.commitment_electr_signature = await this.$method.uploadFile(data.commitment_electr_signature, 0);
  427. }
  428. // if (this.nextStatus) {
  429. // this.$store.commit('updataCopyData', data);
  430. // this.$navTo.togo('/pages2/verify/input2', {
  431. // id: this.goodsId
  432. // });
  433. // } else {
  434. this.uploadDatas(data);
  435. // }
  436. },
  437. //验证表单
  438. resultForm(int) {
  439. if (this.openVerify) {
  440. this.$refs.uForm.validate(valid => {
  441. if (valid) {
  442. if (int === 1) {
  443. this.submitApi();
  444. }
  445. } else {
  446. console.log('验证失败');
  447. }
  448. });
  449. }
  450. },
  451. async submits() {
  452. await this.subCanvas();
  453. this.openVerify = true;
  454. this.resultForm(1);
  455. },
  456. async changePhotoListHeader1(lists, name) {
  457. if (lists.length) {
  458. this.fileList1 = lists;
  459. this.form.recent_photos = await this.$method.imageInfos(lists[0].url);
  460. } else {
  461. this.fileList1 = [];
  462. this.$set(this.form, 'recent_photos', '');
  463. }
  464. this.$nextTick(function() {
  465. this.resultForm();
  466. });
  467. },
  468. async changePhotoListHeader2(lists, name) {
  469. if (lists.length) {
  470. this.fileList2 = lists;
  471. this.form.idcard_face_photo = await this.$method.imageInfos(lists[0].url);
  472. } else {
  473. this.fileList2 = [];
  474. this.$set(this.form, 'idcard_face_photo', '');
  475. }
  476. this.$nextTick(function() {
  477. this.resultForm();
  478. });
  479. },
  480. async changePhotoListHeader3(lists, name) {
  481. if (lists.length) {
  482. this.fileList3 = lists;
  483. this.form.idcard_national_photo = await this.$method.imageInfos(lists[0].url);
  484. } else {
  485. this.fileList3 = [];
  486. this.$set(this.form, 'idcard_national_photo', '');
  487. }
  488. this.$nextTick(function() {
  489. this.resultForm();
  490. });
  491. },
  492. getTimes(key) {
  493. if (this.form[key]) {
  494. return this.form[key];
  495. } else {
  496. return '请选择时间';
  497. }
  498. },
  499. getarrays(key) {
  500. if (key === 'sex') {
  501. return this.dictObj['sys_user_sex'];
  502. }
  503. if (key === 'education') {
  504. return this.dictObj['edu_level'];
  505. }
  506. if (key === 'working_years') {
  507. return this.dictObj['working_years'];
  508. }
  509. },
  510. returnName(key) {
  511. if (key === 'sex') {
  512. if (this.form[key]) {
  513. return this.dictObj['sys_user_sex'][Number(this.form[key])];
  514. } else {
  515. return '请选择性别';
  516. }
  517. }
  518. if (key === 'education') {
  519. if (this.form[key]) {
  520. return this.dictObj['edu_level'][Number(this.form[key])];
  521. } else {
  522. return '请选择学历';
  523. }
  524. }
  525. if (key === 'working_years') {
  526. if (this.form[key]) {
  527. return this.dictObj['working_years'][Number(this.form[key])];
  528. } else {
  529. return '请选择工作年限';
  530. }
  531. }
  532. },
  533. getInfo() {
  534. var self = this;
  535. this.$api.getbaseprofiletpId(this.goodsId).then(res => {
  536. self.listData = JSON.parse(res.data.data.keyValue);
  537. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  538. if (result.data.code === 200) {
  539. if (result.data.data && result.data.data.status === 3) {
  540. self.remark = result.data.data.text;
  541. self.remarkStatus = true;
  542. self.id = result.data.data.id;
  543. var arrays = JSON.parse(result.data.data.keyValue);
  544. for (let k in arrays) {
  545. self.$set(self.form, k, arrays[k].value);
  546. }
  547. } else if (result.data.data && (result.data.data.status === 1 || result.data.data.status === 2)) {
  548. uni.showModal({
  549. showCancel: false,
  550. content:
  551. result.data.data.status === 1
  552. ? '该商品审核资料已通过,不可重复提交资料'
  553. : result.data.data.status === 2
  554. ? '该商品审核资料处于待审核状态,不可重复提交资料'
  555. : '请联系管理员',
  556. success: function(k) {
  557. if (k.confirm) {
  558. uni.navigateBack();
  559. }
  560. }
  561. });
  562. }
  563. }
  564. });
  565. });
  566. },
  567. bindPickerChange(key, e) {
  568. this.$set(this.form, key, e.detail.value);
  569. this.$nextTick(function() {
  570. this.resultForm();
  571. });
  572. },
  573. bindDateChange(key, e) {
  574. this.form[key] = e.detail.value;
  575. },
  576. retDraw() {
  577. this.handwriting.retDraw();
  578. this.$set(this.form, 'commitment_electr_signature', '');
  579. this.$nextTick(function() {
  580. this.resultForm();
  581. });
  582. },
  583. uploadScaleStart(event) {
  584. this.handwriting.uploadScaleStart(event);
  585. },
  586. uploadScaleMove(event) {
  587. this.handwriting.uploadScaleMove(event);
  588. },
  589. uploadScaleEnd(event) {
  590. this.handwriting.uploadScaleEnd(event);
  591. },
  592. subCanvas() {
  593. return new Promise((resolve, reject) => {
  594. var self = this;
  595. self.handwriting
  596. .saveCanvas()
  597. .then(res => {
  598. if (this.handwriting.linePrack.length) {
  599. this.$set(this.form, 'commitment_electr_signature', res);
  600. }
  601. resolve(res);
  602. })
  603. .catch(err => {
  604. uni.showToast({
  605. title: '签名上传失败',
  606. icon: 'error'
  607. });
  608. });
  609. });
  610. }
  611. }
  612. };
  613. </script>
  614. <style>
  615. page {
  616. background: #eaeef1;
  617. }
  618. </style>
  619. <style scope>
  620. /deep/ .u-collapse-title {
  621. color: red;
  622. font-size: 24rpx;
  623. }
  624. .collapse-item {
  625. color: #666;
  626. font-size: 24rpx;
  627. padding-bottom: 30rpx;
  628. }
  629. .dis_stys {
  630. display: flex;
  631. align-items: center;
  632. justify-content: space-between;
  633. }
  634. .handCenter {
  635. background: #f7f7f7;
  636. border: 2rpx solid #eeeeee;
  637. border-radius: 24rpx;
  638. }
  639. .headerSDels {
  640. height: 58rpx;
  641. padding: 0rpx 24rpx;
  642. font-weight: bold;
  643. display: flex;
  644. align-items: center;
  645. flex-direction: row-reverse;
  646. }
  647. .listBox {
  648. margin: 24rpx 32rpx 0rpx;
  649. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  650. border-radius: 32rpx;
  651. background-color: #fff;
  652. overflow: hidden;
  653. }
  654. .imgBoxs {
  655. width: 156rpx;
  656. height: 203rpx;
  657. }
  658. .imgBoxs2 {
  659. width: 171rpx;
  660. height: 108rpx;
  661. }
  662. .submit_btn {
  663. width: 526rpx;
  664. height: 80rpx;
  665. background: #007aff;
  666. border-radius: 40rpx;
  667. text-align: center;
  668. line-height: 80rpx;
  669. color: #ffffff;
  670. margin: 30rpx auto;
  671. }
  672. .picker {
  673. text-align: right;
  674. }
  675. input {
  676. text-align: right;
  677. }
  678. .bodyBox {
  679. background: #ffffff;
  680. border-radius: 24rpx;
  681. width: 100%;
  682. }
  683. .topBox {
  684. height: 80rpx;
  685. background: #ffffff;
  686. border-radius: 24rpx;
  687. width: 100%;
  688. display: flex;
  689. justify-content: space-between;
  690. line-height: 80rpx;
  691. padding: 0 20rpx;
  692. font-size: 24rpx;
  693. }
  694. </style>