cart.vue 11 KB

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