self_info.vue 17 KB

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