self_info.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <view class="content-box">
  3. <!-- <view class="header-box">
  4. <image src="/static/tips.png" mode="aspectFill"></image>
  5. <text>温馨提示:请填写以下信息,填写后信息不可修改</text>
  6. </view> -->
  7. <form @submit="formSubmit" style="width: 100%">
  8. <!-- <view class="self-title-box">
  9. <image src="/static/rect-icon.png" mode="aspectFill"></image>
  10. <text>登记信息</text>
  11. </view> -->
  12. <view class="info-box">
  13. <view class="info-title-box">
  14. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  15. <text>姓名</text>
  16. </view>
  17. <view class="info-value-box">
  18. <input type="text" placeholder="请输入姓名" name="selfName">
  19. </view>
  20. </view>
  21. <view class="info-box">
  22. <view class="info-title-box">
  23. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  24. <text>手机号</text>
  25. </view>
  26. <view class="info-value-box">
  27. <input type="tel" placeholder="请输入手机号" name="selfTel">
  28. </view>
  29. </view>
  30. <view class="info-box">
  31. <view class="info-title-box">
  32. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  33. <text>个人照片</text>
  34. </view>
  35. <view class="info-value-box">
  36. <view class="update_button display-flex">
  37. <view class="upload-box" @click="getImage('album')">
  38. <view class="img">
  39. <image src="/static/photo.png" class="photo"></image>
  40. </view>
  41. </view>
  42. <view
  43. class="display-flex upload-box-photo"
  44. v-for="(item, index) in uploadList"
  45. :key="index"
  46. >
  47. <image :src="item" mode="aspectFit" style="width: 100%; height: 100%" @click="showLarge(item)"/>
  48. <image src="/static/del.png" class="del-icon"mode="aspectFit"
  49. style="width: 30rpx; height: 30rpx" @click="delPhoto(index)"></image>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="info-box">
  55. <view class="info-title-box">
  56. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  57. <text>入党年月</text>
  58. </view>
  59. <view class="info-value-box">
  60. <view class="uni-list title-date-box">
  61. <view class="uni-list-cell">
  62. <view class="uni-list-cell-db display-flex-start">
  63. <picker mode="date" fields="year" @change="bindDateChange" class="picker-class">
  64. <view class="uni-input display-between items-center">{{dateYear}}年<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
  65. </picker>
  66. <picker :range="arrayMonth" :value="dateMonth" @change="bindDateMonthChange" class="picker-class" style="margin-left: 2%;">
  67. <view class="uni-input display-between items-center" style="color: #707070;">{{dateMonth}}月<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
  68. </picker>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="info-box">
  75. <view class="info-title-box">
  76. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  77. <text>民族</text>
  78. </view>
  79. <view class="info-value-box">
  80. <input type="text" placeholder="请输入民族" name="selfName">
  81. </view>
  82. </view>
  83. <view class="info-box">
  84. <view class="info-title-box">
  85. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  86. <text>性别</text>
  87. </view>
  88. <view class="info-gender-box">
  89. <radio-group @change="radioCheck" class="padding-left-2">
  90. <label class="radio margin-right-10"><radio value="1" :checked="userSex==='1'" color="#00A1B4" class="form-radio"/>男</label>
  91. <label class="radio"><radio value="0" :checked="userSex==='0'" color="#00A1B4" class="form-radio"/>女</label>
  92. </radio-group>
  93. </view>
  94. </view>
  95. <view class="info-box">
  96. <view class="info-title-box">
  97. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  98. <text>出生日期</text>
  99. </view>
  100. <view class="info-value-box">
  101. <uni-datetime-picker
  102. class="time-select-box"
  103. type="date"
  104. :value="single"
  105. @change="change"
  106. :clear-icon="false"
  107. />
  108. </view>
  109. </view>
  110. <view class="info-box">
  111. <view class="info-title-box">
  112. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  113. <text>学历</text>
  114. </view>
  115. <view class="info-value-box">
  116. <picker @change="bindPickerChange($event,'education')" :range="educationArray" class="select-box" name="education">
  117. <view class="uni-input">{{educationValue}}</view>
  118. <image src="/static/arrow_down.svg" mode="aspectFill"></image>
  119. </picker>
  120. </view>
  121. </view>
  122. <view class="info-box">
  123. <view class="info-title-box">
  124. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  125. <text>工作单位</text>
  126. </view>
  127. <view class="info-value-box">
  128. <input type="text" placeholder="西安芝麻开花科技有限公司" name="selfName">
  129. </view>
  130. </view>
  131. <view class="info-box">
  132. <view class="info-title-box">
  133. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  134. <text>职务</text>
  135. </view>
  136. <view class="info-value-box">
  137. <input type="text" placeholder="无" name="selfName">
  138. </view>
  139. </view>
  140. <view class="info-box">
  141. <view class="info-title-box">
  142. <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
  143. <text>职称</text>
  144. </view>
  145. <view class="info-value-box">
  146. <input type="text" placeholder="项目经理" name="selfName">
  147. </view>
  148. </view>
  149. <view style="display: flex;justify-content: space-evenly;">
  150. <button type="default" class="submit-bth" style="background-color: #aaaaaa;">清空</button>
  151. <button type="primary" class="submit-bth" style="background-color: #169bd5;" formType="submit">提交</button>
  152. </view>
  153. </form>
  154. </view>
  155. </template>
  156. <script>
  157. import md5 from "@/common/md5.js";
  158. // import pickerAddress from '@/components/liudx-pickerAddress/index.vue'
  159. // var graceChecker = require("../../../common/graceChecker.js");
  160. export default {
  161. components: {
  162. },
  163. data() {
  164. return {
  165. dateYear:new Date().getFullYear(),
  166. dateMonth:new Date().getMonth() + 1,
  167. arrayMonth:["1", "2","3", "4","5", "6","7", "8","9", "10","11", "12"],
  168. title: 'Hello',
  169. detailObj:{},
  170. shareContent:'',
  171. shareCode:'',
  172. storeImg:'',
  173. isAuthPhone:getApp().globalData.user_phone,
  174. userSex:'1',
  175. txt: '请选择',
  176. educationValue:'请选择',
  177. educationArray: ['博士研究生','硕士研究生','本科','大专','中专'],
  178. professionValue:'请选择',
  179. professionArray:[],
  180. endsValue:'请选择',
  181. endsArray:[],
  182. provinceArray: [],
  183. addressShow: false,
  184. form: {
  185. province: '',
  186. city: '',
  187. },
  188. address: '',
  189. addressObj:{},
  190. userBrand:'',
  191. addressDetail:'',
  192. loginObj:{},
  193. uploadList: [],
  194. imgIdList: [],
  195. }
  196. },
  197. onLoad() {
  198. //this.getTradeRequest();
  199. },
  200. onShow() {
  201. },
  202. // onShareAppMessage() {
  203. // return {
  204. // title: '分销小助手',
  205. // path:'/pages/index/index?scene=' + getApp().globalData.user_id
  206. // }
  207. // },
  208. methods: {
  209. bindDateChange(e){
  210. this.dateYear = e.target.value
  211. },
  212. bindDateMonthChange(e){
  213. this.dateMonth = this.arrayMonth[e.target.value]
  214. },
  215. change(e) {
  216. this.single = e;
  217. console.log("-change事件:", e);
  218. },
  219. getImage(type) {
  220. let that = this;
  221. // if (that.uploadList.length >= 9) {
  222. // uni.showToast({
  223. // title: "最多上传9张图片",
  224. // icon: "none",
  225. // duration: 2500,
  226. // });
  227. // return;
  228. // }
  229. uni.chooseImage({
  230. sourceType: [type],
  231. count: 1,
  232. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  233. success: (res) => {
  234. for (let i = 0; i < res.tempFilePaths.length; i++) {
  235. console.log(res.tempFilePaths[i])
  236. that.uploadList.push(res.tempFilePaths[i]);
  237. that.uploadFileRequest(res.tempFilePaths[i]);
  238. }
  239. },
  240. });
  241. },
  242. uploadFileRequest(fileVal) {
  243. uni.showLoading({
  244. title: "上传中",
  245. mask: true,
  246. });
  247. let that = this;
  248. let md5Sign = md5(
  249. "method=" +
  250. "upload" +
  251. "&timestamp=" +
  252. getApp().globalData.globalTimestamp +
  253. "&secret=" +
  254. getApp().globalData.secret
  255. );
  256. let url =
  257. getApp().globalData.shareUrl +
  258. "api/api.php" +
  259. "?method=upload&source=activity&id=1&timestamp=" +
  260. getApp().globalData.globalTimestamp +
  261. "&sign=" +
  262. md5Sign;
  263. uni.uploadFile({
  264. url: url, //需要设置为全局
  265. filePath: fileVal,
  266. name: "file",
  267. formData: {
  268. file: fileVal,
  269. },
  270. success: (res) => {
  271. let tmpres = JSON.parse(res.data);
  272. console.log(tmpres);
  273. uni.hideLoading();
  274. that.imgIdList.push(tmpres.data.id);
  275. },
  276. fail: (res) => {
  277. console.log("上传请求失败");
  278. console.log(res);
  279. },
  280. });
  281. },
  282. delPhoto(idx) {
  283. this.uploadList.splice(idx, 1);
  284. this.imgIdList.splice(idx, 1);
  285. },
  286. showLarge(src) {
  287. uni.previewImage({
  288. urls: [src],
  289. longPressActions: {
  290. itemList: ["发送给朋友", "保存图片"],
  291. success: function (data) {},
  292. fail: function (err) {
  293. console.log(err.errMsg);
  294. },
  295. },
  296. });
  297. },
  298. getProvinceRequest(){
  299. let that = this;
  300. },
  301. getTradeRequest(){
  302. let that = this;
  303. },
  304. radioCheck(e){
  305. console.log(e.target.value)
  306. this.userSex = e.target.value;
  307. //this.gender = e.target.value == '0' ? '男' : '女';
  308. },
  309. changeCity(data) {
  310. this.txt = data.data.join('')
  311. console.log(data.data.join(''))
  312. },
  313. bindPickerChange(e,type) {
  314. let that = this;
  315. switch (type){
  316. case 'education':
  317. that.educationValue = that.educationArray[e.target.value]
  318. console.log(that.educationValue)
  319. break;
  320. case 'profession':
  321. that.professionValue = that.professionArray[e.target.value]
  322. break;
  323. case 'ends':
  324. that.endsValue = that.endsArray[e.target.value]
  325. break;
  326. }
  327. },
  328. testLength(){
  329. if(this.addressDetail.length > 25){
  330. uni.showToast({
  331. title: '详细地址应为0-25个字符',
  332. icon: 'none'
  333. });
  334. }
  335. },
  336. formSubmit(e) {
  337. //this.goCustomCardPage()
  338. //将下列代码加入到对应的检查位置
  339. //定义表单规则
  340. var rule = [
  341. {
  342. name: "selfName",
  343. checkType: "notnull",
  344. errorMsg: "姓名不能为空"
  345. },
  346. // {
  347. // name: "selfName",
  348. // checkType: "string",
  349. // checkRule: "2,15",
  350. // errorMsg: "姓名不能少于2个汉字"
  351. // },
  352. {
  353. name: "selfName",
  354. checkType: "reg",
  355. checkRule: "[\u4e00-\u9fa5]",
  356. errorMsg: "姓名需为中文"
  357. }
  358. // {
  359. // name: "trade",
  360. // checkType: "notnull",
  361. // errorMsg: "行业不能为空"
  362. // }
  363. ];
  364. //进行表单检查
  365. var formData = e.detail.value;
  366. console.log(formData)
  367. var checkRes = graceChecker.check(formData, rule);
  368. if (checkRes) {
  369. this.txt === '请选择' ?
  370. uni.showToast({
  371. title: '请选择地区',
  372. icon: "none"
  373. }):
  374. this.submitRequest(formData);
  375. } else {
  376. uni.showToast({
  377. title: graceChecker.error,
  378. icon: "none"
  379. });
  380. }
  381. },
  382. submitRequest(params){
  383. console.log(params)
  384. let that = this;
  385. },
  386. goCustomCardPage(){
  387. uni.redirectTo({
  388. url: '/pages/index/successPage/index?types='+'custom', //游客成功页面
  389. success: res => {},
  390. fail: () => {},
  391. complete: () => {}
  392. })
  393. }
  394. }
  395. }
  396. </script>
  397. <style lang="scss" scoped>
  398. .content {
  399. &_list{
  400. display: flex;
  401. flex-direction: row;
  402. align-items: center;
  403. justify-content:space-around;
  404. &_lable{
  405. }
  406. &_content{
  407. flex: 1;
  408. width: auto;
  409. text-align: right;
  410. }
  411. }
  412. }
  413. .content-box {
  414. width: 100%;
  415. /* height: 100%; */
  416. display: flex;
  417. flex-direction: column;
  418. align-items: center;
  419. /* justify-content: center; */
  420. }
  421. .header-box {
  422. width: 85%;
  423. height:80rpx;
  424. border: .5px dotted #00A1B4;
  425. border-radius: 50rpx;
  426. display: flex;
  427. justify-content: center;
  428. align-items: center;
  429. font-size: 24rpx;
  430. color:#00A1B4 ;
  431. /* font-family: PingFangSC-Regular; */
  432. margin-top: 2%;
  433. }
  434. .header-box image {
  435. width: 36rpx;
  436. height: 36rpx;
  437. margin-right: 1%;
  438. }
  439. .self-title-box {
  440. width: 90%;
  441. display: flex;
  442. align-items: center;
  443. font-size: 32rpx;
  444. letter-spacing: 2rpx;
  445. color:#3C3C3C ;
  446. /* font-family: SimHei; */
  447. margin: 4% auto;
  448. font-weight: bold;
  449. height: 50rpx;
  450. line-height: 50rpx;
  451. }
  452. .self-title-box image {
  453. width: 6rpx;
  454. height: 32rpx;
  455. margin-right: 2%;
  456. }
  457. .info-box {
  458. width: 90%;
  459. margin: 3% auto;
  460. display: flex;
  461. align-items: center;
  462. // height: 180rpx;
  463. }
  464. .info-title-box {
  465. width: 20%;
  466. display: flex;
  467. align-items: center;
  468. font-size: 26rpx;
  469. }
  470. .info-title-box image{
  471. width: 15rpx;
  472. height: 15rpx;
  473. margin-right: 2%;
  474. }
  475. .info-value-box {
  476. width: 75%;
  477. }
  478. .info-value-box input {
  479. height: 88rpx;
  480. background: #f7f7f7;
  481. font-size: 28rpx;
  482. padding-left: 4%;
  483. margin: 2% auto;
  484. }
  485. .info-value-box picker {
  486. position: relative;
  487. }
  488. .info-value-box picker image {
  489. position: absolute;
  490. width: 25rpx;
  491. height: 25rpx;
  492. right: 10px;
  493. top: 30rpx;
  494. }
  495. .select-box {
  496. height: 80rpx;
  497. background: #f7f7f7;
  498. font-size: 28rpx;
  499. padding-left: 4%;
  500. margin: 2% auto;
  501. color: #888;
  502. line-height: 88rpx;
  503. }
  504. .info-gender-box {
  505. width: 75%;
  506. font-size: 28rpx;
  507. }
  508. .form-radio {
  509. transform: scale(0.6);
  510. }
  511. .padding-left-2 {
  512. // padding-left: 2%;
  513. }
  514. .margin-right-10 {
  515. margin-right: 10%;
  516. }
  517. .border-line-box {
  518. width: 100%;
  519. height: 20rpx;
  520. background: #f7f7f7;
  521. }
  522. .picker-box{
  523. display: flex;
  524. align-items: center;
  525. justify-content: space-between;
  526. height: 60rpx;
  527. line-height: 60rpx;
  528. background: #f7f7f7;
  529. height: 88rpx;
  530. line-height: 88rpx;
  531. background: #f7f7f7;
  532. font-size: 28rpx;
  533. padding-left: 4%;
  534. }
  535. .uni-input image {
  536. width: 40rpx;
  537. height: 40rpx;
  538. margin-right: 2%;
  539. float: right;
  540. }
  541. .textarea-box {
  542. background: #f7f7f7;
  543. min-height: 120rpx;
  544. font-size: 28rpx;
  545. margin: 5% auto;
  546. padding: 4%;
  547. margin-bottom: 8%;
  548. }
  549. .upload-box {
  550. display: flex;
  551. flex-flow: column;
  552. width: 25%;
  553. background-color: #e0e0e0;
  554. height: 100rpx;
  555. border-radius: 10rpx;
  556. padding-top: 15rpx;
  557. image {
  558. margin-top: 10rpx;
  559. width: 60rpx !important;
  560. height: 60rpx !important;
  561. }
  562. }
  563. .upload-box-photo {
  564. width: 25%;
  565. height: 100rpx;
  566. border-radius: 10rpx;
  567. padding-top: 15rpx;
  568. position: relative;
  569. margin-left: 10rpx;
  570. }
  571. .del-icon {
  572. position: absolute;
  573. right: 0;
  574. width: 30rpx;
  575. height: 30rpx;
  576. }
  577. .update_button {
  578. text-align: center;
  579. display: flex;
  580. flex-wrap: wrap;
  581. }
  582. .picker-class {
  583. border-radius: 10rpx;
  584. padding: 10rpx;
  585. width: 73%;
  586. font-size: 28rpx;
  587. background: #f5f5f5;
  588. }
  589. .picker-class image {
  590. width: 26rpx;
  591. height: 26rpx;
  592. }
  593. .submit-bth {
  594. width: 25%;
  595. font-size: 26rpx;
  596. margin: 0 0 5% 0;
  597. color: #fff;
  598. }
  599. </style>