cart.vue 12 KB

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