cart.vue 13 KB

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