self_info.vue 17 KB

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