cart.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <!-- <view class="red-box">
  5. 报名参与
  6. </view> -->
  7. <view class="box-1">
  8. <view class="box-left">
  9. 姓名<text class="imp"></text>:
  10. </view>
  11. <input type="text" value="" class="list-input" v-model="name" />
  12. </view>
  13. <view class="box-1">
  14. <view class="box-left">
  15. 出生年月:
  16. </view>
  17. <picker mode="date" :value="birth" fields="month" :start="startDate" :end="endDate" @change="bindDateChange" class="box-right">
  18. <view>{{ birth }}</view>
  19. </picker>
  20. </view>
  21. <view class="box-1">
  22. <view class="box-left">
  23. 性别:
  24. </view>
  25. <picker @change="bindPickerSex" :value="index" :range="array" class="box-right">
  26. <text>{{ sex }}</text>
  27. </picker>
  28. </view>
  29. <view class="box-1">
  30. <view class="box-left">
  31. 文化程度:
  32. </view>
  33. <picker @change="bindPickerEdu" :value="index" :range="chooseEdu" class="box-right">
  34. <text>{{ education }}</text>
  35. </picker>
  36. </view>
  37. <view class="box-1">
  38. <view class="box-left">
  39. 民族:
  40. </view>
  41. <input type="text" value="" class="list-input" v-model="mz" />
  42. </view>
  43. <view class="box-1">
  44. <view class="box-left">
  45. 职位:
  46. </view>
  47. <input type="text" value="" class="list-input" v-model="specialty" />
  48. </view>
  49. <view class="box-1">
  50. <view class="box-left">
  51. 地址:
  52. </view>
  53. <input type="text" value="" class="list-input" v-model="address" />
  54. </view>
  55. <view class="box-1">
  56. <view class="box-left">
  57. 身份证号码:
  58. </view>
  59. <input type="text" value="" class="list-input" v-model="card" />
  60. </view>
  61. <view class="box-1">
  62. <view class="box-left">
  63. 联系电话:
  64. </view>
  65. <input type="text" value="" class="list-input" v-model="phone" />
  66. </view>
  67. <view class="box-1">
  68. <view class="box-left">
  69. 工作单位:
  70. </view>
  71. <input type="text" value="" class="list-input" v-model="work" />
  72. </view>
  73. <view class="upload-box">
  74. <view class="upload-left">
  75. 证件:
  76. </view>
  77. <view class="upload-right">
  78. <image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub" v-if="cardimg"></image>
  79. <image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!cardimg" @click.stop="imgsub"></image>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="buttom" :class="{ action: loding }" @click="!loding?join():''">
  84. 提交申请
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. joinSec
  91. } from '@/api/index.js';
  92. import {
  93. upload
  94. } from '@/api/ask.js';
  95. export default {
  96. data() {
  97. const currentDate = this.getDate({
  98. format: true
  99. })
  100. return {
  101. loding: false, //是否提交中
  102. array: ['男', '女'],
  103. chooseEdu: ['博士后', '博士', '硕士', '本科', '专科', '其他'],
  104. chooseVol: ['是', '否'],
  105. chooseExp: ['是', '否'],
  106. index: 0,
  107. mz: '',
  108. cardimg: '', //证件照
  109. card: '',
  110. checklist: [],
  111. name: '',
  112. sex: '',
  113. birth: '',
  114. phone: '',
  115. address: '',
  116. work: '',
  117. specialty: '',
  118. education: '',
  119. }
  120. },
  121. computed: {
  122. startDate() {
  123. return this.getDate('start');
  124. },
  125. endDate() {
  126. return this.getDate('end');
  127. }
  128. },
  129. methods: {
  130. async join() {
  131. let obj = this;
  132. if (obj.name == '') {
  133. obj.$api.msg('请输入您的姓名');
  134. return;
  135. }
  136. if (obj.birth == '') {
  137. obj.$api.msg('请选择出生年月');
  138. return
  139. }
  140. if (obj.sex == '') {
  141. obj.$api.msg('请输入您的性别');
  142. return;
  143. }
  144. if (obj.education == '') {
  145. obj.$api.msg('请选择您的文化程度');
  146. return;
  147. }
  148. if (obj.mz == '') {
  149. obj.$api.msg('请填写您所属的民族');
  150. return;
  151. }
  152. if (obj.specialty == '') {
  153. obj.$api.msg('请填写您的职位');
  154. return;
  155. }
  156. if (obj.address == '') {
  157. obj.$api.msg('请填写您的地址');
  158. return;
  159. }
  160. let reg1 =
  161. /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
  162. if (!reg1.test(obj.card)) {
  163. obj.$api.msg('请填写正确的身份证信息');
  164. return;
  165. }
  166. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  167. if (!reg.test(obj.phone)) {
  168. obj.$api.msg('请填写正确的手机号码');
  169. return;
  170. }
  171. // /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
  172. if (obj.work == '') {
  173. obj.$api.msg('请填写您的工作单位');
  174. return;
  175. }
  176. if (obj.cardimg == '') {
  177. obj.$api.msg('请上传您的证件');
  178. return
  179. }
  180. if (obj.specialty == '') {
  181. obj.$api.msg('请填写您的职位');
  182. return;
  183. }
  184. // if (obj.education == '') {
  185. // obj.$api.msg('请填写您的教育程度');
  186. // return;
  187. // }
  188. // if (obj.is_vol == '') {
  189. // obj.$api.msg('请填写您的是否受过志愿服务');
  190. // return;
  191. // }
  192. // if (obj.is_experience == '') {
  193. // obj.$api.msg('请填写您的有无服务经验');
  194. // return;
  195. // }
  196. obj.loding = true;
  197. joinSec({
  198. name: obj.name,
  199. sex: obj.sex,
  200. education: obj.education,
  201. birth: obj.birth,
  202. mz: obj.mz,
  203. phone: obj.phone,
  204. address: obj.address,
  205. work: obj.work,
  206. specialty: obj.specialty,
  207. img: obj.cardimg,
  208. card: obj.card,
  209. }).then(e => {
  210. obj.name = '';
  211. obj.sex = '';
  212. obj.education = '';
  213. obj.birth = '';
  214. obj.mz = '',
  215. obj.phone = '';
  216. obj.address = '';
  217. obj.work = '';
  218. obj.specialty = '';
  219. obj.cardimg = '',
  220. obj.card = ''
  221. uni.navigateTo({
  222. url: '../joinSuc/joinNow'
  223. });
  224. }).catch(function(e) {
  225. console.log('出错了')
  226. console.log(e);
  227. });
  228. },
  229. imgsub() {
  230. console.log('imgsub')
  231. upload({
  232. filename: ''
  233. }).then(data => {
  234. this.cardimg = data[0].url;
  235. })
  236. },
  237. // 选择性别
  238. bindPickerSex: function(e) {
  239. console.log(this.array[e.target.value])
  240. this.sex = this.array[e.target.value];
  241. this.index = e.target.value + 1;
  242. },
  243. // 选择教育程度
  244. bindPickerEdu: function(e) {
  245. this.education = this.chooseEdu[e.target.value];
  246. this.index = e.target.value + 1;
  247. },
  248. // 选择日期
  249. bindDateChange: function(e) {
  250. this.birth = e.target.value
  251. },
  252. // 是否参加志愿活动
  253. bindPickerVol: function(e) {
  254. this.is_vol = this.chooseVol[e.target.value];
  255. this.index = e.target.value + 1;
  256. },
  257. // 有无服务经验
  258. bindPickerExp: function(e) {
  259. this.is_experience = this.chooseExp[e.target.value];
  260. this.index = e.target.value + 1;
  261. },
  262. getDate(type) {
  263. const date = new Date();
  264. let year = date.getFullYear();
  265. let month = date.getMonth() + 1;
  266. let day = date.getDate();
  267. if (type === 'start') {
  268. year = year - 60;
  269. } else if (type === 'end') {
  270. year = year + 2;
  271. }
  272. month = month > 9 ? month : '0' + month;;
  273. day = day > 9 ? day : '0' + day;
  274. return `${year}-${month}-${day}`;
  275. },
  276. // 选择可提供时间
  277. // this.quantum = item.detail.value.join(',');
  278. checktime1(e) {
  279. // var items = this.timeList,
  280. // let quantum = [];
  281. this.quantum = e.detail.value.join(',');
  282. console.log(this.quantum);
  283. },
  284. checktime2(e) {
  285. // var items = this.timeList,
  286. let values = e.detail.value;
  287. // let quantum = [];
  288. console.log(values);
  289. },
  290. checktime3(e) {
  291. // var items = this.timeList,
  292. let values = e.detail.value;
  293. // let quantum = [];
  294. console.log(values);
  295. },
  296. //选择有兴趣参与的工作
  297. checkjob(item) {
  298. this.taste = item.detail.value.join(',');
  299. },
  300. // 选择专长checkspeciality
  301. checkspeciality(item) {
  302. this.speciali = item.detail.value.join(',');
  303. },
  304. }
  305. }
  306. </script>
  307. <style lang="scss">
  308. page {
  309. background-color: #f3afad;
  310. }
  311. .content {
  312. padding-top: 44rpx;
  313. background-color: #f3afad;
  314. .buttom {
  315. width: 660rpx;
  316. height: 100rpx;
  317. background: linear-gradient(0deg, #C90F1B, #F14D33);
  318. border-radius: 50rpx;
  319. margin: 50rpx auto;
  320. font-size: 36rpx;
  321. font-weight: 400;
  322. color: #FFFFFF;
  323. line-height: 100rpx;
  324. text-align: center;
  325. &.action {
  326. background: #999999;
  327. }
  328. }
  329. .box {
  330. // margin-top: 44rpx;
  331. width: 690rpx;
  332. margin: 20rpx auto 0;
  333. background-color: #FFFFFF;
  334. border-radius: 10rpx;
  335. padding: 28rpx 20rpx 32rpx 20rpx;
  336. position: relative;
  337. .red-box {
  338. width: 405rpx;
  339. line-height: 66rpx;
  340. text-align: center;
  341. background: linear-gradient(0deg, #C90F1B, #F14D33);
  342. border-radius: 10rpx;
  343. font-size: 30rpx;
  344. font-weight: 500;
  345. color: #FFFFFF;
  346. // position: relative;
  347. position: absolute;
  348. top: -36rpx;
  349. left: 50%;
  350. transform: translateX(-50%);
  351. z-index: 1;
  352. }
  353. .box-check {
  354. font-size: 28rpx;
  355. font-weight: 500;
  356. color: #666666;
  357. line-height: 100rpx;
  358. }
  359. .imp {
  360. color: red;
  361. margin-left: 5rpx;
  362. }
  363. .box-1 {
  364. display: flex;
  365. flex-direction: column;
  366. align-items: center;
  367. width: 100%;
  368. margin-top: 32rpx;
  369. // height: 133rpx;
  370. .box-left {
  371. padding-left: 2rpx;
  372. width: 100%;
  373. text-align: left;
  374. color: #E63931;
  375. }
  376. input{
  377. height: 66rpx;
  378. line-height: 66rpx;
  379. margin-top: 32rpx;
  380. // height: 88rpx;
  381. }
  382. .list-input {
  383. padding-left: 24rpx;
  384. // margin: 12rpx 0 ;
  385. // line-height: 66rpx;
  386. display: flex;
  387. align-items: center;
  388. width: 100%;
  389. font-size: 36rpx;
  390. flex: 1;
  391. color: #FF9797;
  392. border: 1rpx solid #f3afad;
  393. border-radius: 22rpx;
  394. text-align: left;
  395. padding-right: 24rpx;
  396. .input-placeholder {
  397. height: 70rpx;
  398. color: #FF9797;
  399. }
  400. }
  401. .box-right {
  402. display: flex;
  403. align-items: center;
  404. padding-left: 24rpx;
  405. height: 66rpx;
  406. line-height: 66rpx;
  407. border: 1rpx solid #f3afad;
  408. border-radius: 22rpx;
  409. margin: 32rpx 36rpx 0 36rpx;
  410. width: 96%;
  411. font-size: 36rpx;
  412. color: #FF9797;
  413. text-align: left;
  414. // line-height: 1;
  415. }
  416. }
  417. .upload-box {
  418. width: 100%;
  419. height: 247rpx;
  420. background: #FFFFFF;
  421. // border: 1px solid #E63931;
  422. border-radius: 27rpx;
  423. display: flex;
  424. flex-direction: column;
  425. padding: 30rpx 40rpx 30rpx 0;
  426. margin: 0 auto 30rpx;
  427. .upload-left {
  428. font-weight: 400;
  429. color: #E63931;
  430. }
  431. .upload-right {
  432. flex: 1;
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. .upload-img {
  437. width: 103rpx;
  438. height: 103rpx;
  439. margin-top: 24rpx;
  440. }
  441. }
  442. }
  443. }
  444. }
  445. </style>