personal.vue 12 KB

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