self_info.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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. console.log(tmpres);
  333. uni.hideLoading();
  334. that.imgIdList.push(tmpres.data.id);
  335. that.headImgId = tmpres.data.id;
  336. },
  337. fail: (res) => {
  338. console.log("上传请求失败");
  339. console.log(res);
  340. },
  341. });
  342. },
  343. delPhoto(idx) {
  344. this.uploadList.splice(idx, 1);
  345. this.imgIdList.splice(idx, 1);
  346. },
  347. showLarge(src) {
  348. uni.previewImage({
  349. urls: [src],
  350. longPressActions: {
  351. itemList: ["发送给朋友", "保存图片"],
  352. success: function (data) {},
  353. fail: function (err) {
  354. console.log(err.errMsg);
  355. },
  356. },
  357. });
  358. },
  359. radioCheck(e){
  360. console.log(e.target.value)
  361. this.userSex = e.target.value;
  362. //this.gender = e.target.value == '0' ? '男' : '女';
  363. },
  364. changeCity(data) {
  365. this.txt = data.data.join('')
  366. console.log(data.data.join(''))
  367. },
  368. bindPickerChange(e,type) {
  369. this.educationValue = this.educationArray[e.target.value]
  370. console.log(this.educationValue)
  371. console.log(this.educationObjEdit[this.educationValue])
  372. },
  373. formSubmit(e) {
  374. //进行表单检查
  375. var formData = e.detail.value;
  376. console.log(formData)
  377. if(!formData.selfName){
  378. uni.showToast({
  379. title:'请填写姓名',
  380. duration:2500,
  381. icon:'none'
  382. })
  383. }else {
  384. this.submitRequest(formData)
  385. }
  386. },
  387. submitRequest(params){
  388. console.log(this.userTitle,this.headImgId)
  389. let md5Sign = md5(
  390. "method=" +"member" + "&timestamp=" + getApp().globalData.globalTimestamp +
  391. "&secret=" + getApp().globalData.secret
  392. );
  393. let url = getApp().globalData.shareUrl +"api/api.php" +
  394. "?method=member&action=info_update&timestamp=" +
  395. getApp().globalData.globalTimestamp +
  396. "&sign=" +
  397. md5Sign;
  398. uni.request({
  399. url: url,
  400. method: "POST",
  401. header: {
  402. "content-type": "application/x-www-form-urlencoded",
  403. },
  404. data: {
  405. openid: getApp().globalData.open_id,
  406. name:params.selfName,
  407. jion_year :this.dateYear,
  408. jion_month :this.dateMonth,
  409. sex : this.userSex,
  410. birth_day: this.userBorn,
  411. office :params.selfOffice,
  412. position:params.selfPosition,
  413. nation:params.selfNation,
  414. technical_title:params.selfTitle,
  415. education_level:this.educationObjEdit[this.educationValue],
  416. photo_attach_id:this.headImgId,
  417. },
  418. success: (res) => {
  419. if (res.data.code === 200) {
  420. uni.showToast({
  421. title:'修改成功',
  422. duration:2500,
  423. icon:'none'
  424. })
  425. }
  426. },
  427. fail: () => {
  428. console.log("连接失败");
  429. },
  430. });
  431. },
  432. }
  433. }
  434. </script>
  435. <style lang="scss" scoped>
  436. .content {
  437. &_list{
  438. display: flex;
  439. flex-direction: row;
  440. align-items: center;
  441. justify-content:space-around;
  442. &_lable{
  443. }
  444. &_content{
  445. flex: 1;
  446. width: auto;
  447. text-align: right;
  448. }
  449. }
  450. }
  451. .content-box {
  452. width: 100%;
  453. /* height: 100%; */
  454. display: flex;
  455. flex-direction: column;
  456. align-items: center;
  457. /* justify-content: center; */
  458. }
  459. .header-box {
  460. width: 85%;
  461. height:80rpx;
  462. border: .5px dotted #00A1B4;
  463. border-radius: 50rpx;
  464. display: flex;
  465. justify-content: center;
  466. align-items: center;
  467. font-size: 24rpx;
  468. color:#00A1B4 ;
  469. /* font-family: PingFangSC-Regular; */
  470. margin-top: 2%;
  471. }
  472. .header-box image {
  473. width: 36rpx;
  474. height: 36rpx;
  475. margin-right: 1%;
  476. }
  477. .self-title-box {
  478. width: 90%;
  479. display: flex;
  480. align-items: center;
  481. font-size: 32rpx;
  482. letter-spacing: 2rpx;
  483. color:#3C3C3C ;
  484. /* font-family: SimHei; */
  485. margin: 4% auto;
  486. font-weight: bold;
  487. height: 50rpx;
  488. line-height: 50rpx;
  489. }
  490. .self-title-box image {
  491. width: 6rpx;
  492. height: 32rpx;
  493. margin-right: 2%;
  494. }
  495. .info-box {
  496. width: 90%;
  497. margin: 3% auto;
  498. display: flex;
  499. align-items: center;
  500. // height: 180rpx;
  501. }
  502. .info-title-box {
  503. width: 20%;
  504. display: flex;
  505. align-items: center;
  506. font-size: 26rpx;
  507. }
  508. .info-title-box image{
  509. width: 15rpx;
  510. height: 15rpx;
  511. margin-right: 2%;
  512. }
  513. .info-value-box {
  514. width: 75%;
  515. }
  516. .info-value-box input {
  517. height: 88rpx;
  518. background: #f7f7f7;
  519. font-size: 28rpx;
  520. padding-left: 4%;
  521. margin: 2% auto;
  522. }
  523. .info-value-box picker {
  524. position: relative;
  525. }
  526. .info-value-box picker image {
  527. position: absolute;
  528. width: 25rpx;
  529. height: 25rpx;
  530. right: 10px;
  531. top: 30rpx;
  532. }
  533. .select-box {
  534. height: 80rpx;
  535. background: #f7f7f7;
  536. font-size: 28rpx;
  537. padding-left: 4%;
  538. margin: 2% auto;
  539. color: #888;
  540. line-height: 88rpx;
  541. }
  542. .info-gender-box {
  543. width: 75%;
  544. font-size: 28rpx;
  545. }
  546. .form-radio {
  547. transform: scale(0.6);
  548. }
  549. .padding-left-2 {
  550. // padding-left: 2%;
  551. }
  552. .margin-right-10 {
  553. margin-right: 10%;
  554. }
  555. .border-line-box {
  556. width: 100%;
  557. height: 20rpx;
  558. background: #f7f7f7;
  559. }
  560. .picker-box{
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. height: 60rpx;
  565. line-height: 60rpx;
  566. background: #f7f7f7;
  567. height: 88rpx;
  568. line-height: 88rpx;
  569. background: #f7f7f7;
  570. font-size: 28rpx;
  571. padding-left: 4%;
  572. }
  573. .uni-input image {
  574. width: 40rpx;
  575. height: 40rpx;
  576. margin-right: 2%;
  577. float: right;
  578. }
  579. .textarea-box {
  580. background: #f7f7f7;
  581. min-height: 120rpx;
  582. font-size: 28rpx;
  583. margin: 5% auto;
  584. padding: 4%;
  585. margin-bottom: 8%;
  586. }
  587. .upload-box {
  588. display: flex;
  589. flex-flow: column;
  590. width: 25%;
  591. background-color: #e0e0e0;
  592. height: 100rpx;
  593. border-radius: 10rpx;
  594. padding-top: 15rpx;
  595. image {
  596. margin-top: 10rpx;
  597. width: 60rpx !important;
  598. height: 60rpx !important;
  599. }
  600. }
  601. .upload-box-photo {
  602. width: 25%;
  603. height: 100rpx;
  604. border-radius: 10rpx;
  605. padding-top: 15rpx;
  606. position: relative;
  607. margin-left: 10rpx;
  608. }
  609. .del-icon {
  610. position: absolute;
  611. right: 0;
  612. width: 30rpx;
  613. height: 30rpx;
  614. }
  615. .update_button {
  616. text-align: center;
  617. display: flex;
  618. flex-wrap: wrap;
  619. }
  620. .picker-class {
  621. border-radius: 10rpx;
  622. padding: 10rpx;
  623. width: 73%;
  624. font-size: 28rpx;
  625. background: #f5f5f5;
  626. }
  627. .picker-class image {
  628. width: 26rpx;
  629. height: 26rpx;
  630. }
  631. .submit-bth {
  632. width: 25%;
  633. font-size: 26rpx;
  634. margin: 0 0 5% 0;
  635. color: #fff;
  636. }
  637. </style>