personal_information_info.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <template>
  2. <view>
  3. <view class="top">
  4. <view class="avatar" @click="change_avatar(info.avatar)">
  5. <image v-if="info.avatar" :src="info.avatar" mode="aspectFill"></image>
  6. <view class="avatar" v-if="!info.avatar && !info" :style="{backgroundColor:bgColor[1]}">
  7. {{info.name.split('').pop()}}
  8. </view>
  9. </view>
  10. <view class="info">
  11. <view class="name">{{info.name}}</view>
  12. <view class="box">
  13. <view class="item">
  14. <view class="label">部门</view>
  15. <view class="text">{{info.section_fullname}}</view>
  16. </view>
  17. <view class="item">
  18. <view class="label">职务</view>
  19. <view class="text">{{info.duty_num}}</view>
  20. </view>
  21. <view class="item">
  22. <view class="label">员工编号</view>
  23. <view class="text">{{info.staff_num}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="content">
  29. <view class="box">
  30. <view class="item" @click="change_active(1)">
  31. <view class="text" :style="{color:active == 1?'#333':'#8e8e8e'}">个人信息</view>
  32. <view class="line" v-if="active == 1"></view>
  33. </view>
  34. <view class="item" @click="change_active(2)">
  35. <view class="text" :style="{color:active == 2?'#333':'#8e8e8e'}">工作经历</view>
  36. <view class="line" v-if="active == 2"></view>
  37. </view>
  38. <view class="item" @click="change_active(3)">
  39. <view class="text" :style="{color:active == 3?'#333':'#8e8e8e'}">荣誉及证书</view>
  40. <view class="line" v-if="active == 3"></view>
  41. </view>
  42. </view>
  43. <!-- 个人信息 -->
  44. <view class="list_1" v-if="active == 1">
  45. <view class="item" @click="binding_phone()">
  46. <view class="label">手机号</view>
  47. <view class="text">{{info.mobile}}</view>
  48. <view class="right">
  49. <uni-icons type="arrowright"></uni-icons>
  50. </view>
  51. </view>
  52. <view class="item" @click="go_qianming()">
  53. <view class="label">手写签名</view>
  54. <view class="text">
  55. <image :src="info.base_img" style="width: 300rpx;height: 120rpx;" mode="aspectFill"></image>
  56. </view>
  57. <view class="right">
  58. <uni-icons type="arrowright"></uni-icons>
  59. </view>
  60. </view>
  61. <view class="item">
  62. <view class="label">岗位分类</view>
  63. <view class="text">{{info.job_classify}}</view>
  64. <view class="right"></view>
  65. </view>
  66. <view class="item">
  67. <view class="label">岗位</view>
  68. <view class="text">{{info.job}}</view>
  69. <view class="right"></view>
  70. </view>
  71. <view class="item">
  72. <view class="label">职级(职务码)</view>
  73. <view class="text">{{info.duty_num}}</view>
  74. <view class="right"></view>
  75. </view>
  76. <view class="item">
  77. <view class="label">性别</view>
  78. <view class="text" v-if="info.sex == 1">男</view>
  79. <view class="text" v-if="info.sex == 0">女</view>
  80. <view class="right"></view>
  81. </view>
  82. <view class="item">
  83. <view class="label">初始学历</view>
  84. <view class="text">{{info.start_education}}</view>
  85. <view class="right"></view>
  86. </view>
  87. <view class="item">
  88. <view class="label">最高学历</view>
  89. <view class="text">{{info.best_education}}</view>
  90. <view class="right"></view>
  91. </view>
  92. <view class="item">
  93. <view class="label">员工组</view>
  94. <view class="text">{{info.group}}</view>
  95. <view class="right"></view>
  96. </view>
  97. <view class="item">
  98. <view class="label">员工子组</view>
  99. <view class="text">{{info.group_sub}}</view>
  100. <view class="right"></view>
  101. </view>
  102. <view class="item">
  103. <view class="label">籍贯</view>
  104. <view class="text">{{info.native}}</view>
  105. <view class="right"></view>
  106. </view>
  107. <view class="item">
  108. <view class="label">宗教信仰</view>
  109. <view class="text">{{info.faith}}</view>
  110. <view class="right"></view>
  111. </view>
  112. <view class="item">
  113. <view class="label">户口性质</view>
  114. <view class="text">{{info.registered}}</view>
  115. <view class="right"></view>
  116. </view>
  117. <view class="item">
  118. <view class="label">民族</view>
  119. <view class="text">{{info.nation}}</view>
  120. <view class="right"></view>
  121. </view>
  122. <view class="item">
  123. <view class="label">出生日期</view>
  124. <view class="text">{{info.birthday}}</view>
  125. <view class="right"></view>
  126. </view>
  127. <view class="item">
  128. <view class="label">身份证号</view>
  129. <view class="text">{{info.identity_card}}</view>
  130. <view class="right"></view>
  131. </view>
  132. <view class="item">
  133. <view class="label">参加工作时间</view>
  134. <view class="text">{{info.working_date}}</view>
  135. <view class="right"></view>
  136. </view>
  137. <view class="item">
  138. <view class="label">进入神华系统时间</view>
  139. <view class="text">{{info.system_date}}</view>
  140. <view class="right"></view>
  141. </view>
  142. <view class="item">
  143. <view class="label">进入子分公司时间</view>
  144. <view class="text">{{info.system_sub_date}}</view>
  145. <view class="right"></view>
  146. </view>
  147. <view class="item">
  148. <view class="label">进入本单位时间</view>
  149. <view class="text">{{info.section_date}}</view>
  150. <view class="right"></view>
  151. </view>
  152. <view class="item">
  153. <view class="label">政治面貌</view>
  154. <view class="text">{{info.politics}}</view>
  155. <view class="right"></view>
  156. </view>
  157. <view class="item">
  158. <view class="label">参加党派时间</view>
  159. <view class="text">{{info.politics_date}}</view>
  160. <view class="right"></view>
  161. </view>
  162. </view>
  163. <!-- 工作经历 -->
  164. <view class="list_2" v-if="active == 2">
  165. <view class="item">
  166. <view class="text_1">任职时间</view>
  167. <view class="text_2">工作单位</view>
  168. <view class="text_3">职务</view>
  169. </view>
  170. <view class="item" v-for="(item,index) in info.work_experience" :key="index" @click="del_job(index)">
  171. <view class="text_1">{{item.range_text}}</view>
  172. <view class="text_2">{{item.job_unit}}</view>
  173. <view class="text_3">{{item.job_post}}</view>
  174. </view>
  175. <view class="item" @click="add_text()">
  176. <view style="margin: 0 auto;">
  177. <uni-icons type="compose" size="24"></uni-icons>
  178. </view>
  179. </view>
  180. </view>
  181. <!-- 荣誉及证书 -->
  182. <view class="list_3" v-if="active == 3">
  183. <view class="item" v-for="(item,index) in info.honor" :key="index"
  184. @click="click_image(index,item.path)">
  185. <view class="img">
  186. <image :src="item.path" mode="aspectFill"></image>
  187. </view>
  188. <view class="text">{{item.imageName}}</view>
  189. </view>
  190. <view class="item">
  191. <view class="img">
  192. <view class="add" @click="add_image()">+</view>
  193. </view>
  194. <view class="text"></view>
  195. </view>
  196. </view>
  197. </view>
  198. </view>
  199. </template>
  200. <script>
  201. import {set_base_url} from '@/common/set_base_url.js'
  202. export default {
  203. data() {
  204. return {
  205. mine_code:"",
  206. base_url: "",
  207. active: 1,
  208. info: {},
  209. // 头像随机色
  210. bgColor: [],
  211. };
  212. },
  213. onLoad() {
  214. // 初始化当前煤矿编码
  215. this.mine_code = uni.getStorageSync('mine_code')
  216. // 根据矿编码切换首页接口不同的请求基础路径
  217. this.base_url = set_base_url(this.mine_code)
  218. // 设置头像
  219. for (let i = 0; i < 2; i++) {
  220. // 获取随机色
  221. let r = parseInt(Math.random() * 256)
  222. let g = parseInt(Math.random() * 256)
  223. let b = parseInt(Math.random() * 256)
  224. // ES6 字符串拼接
  225. // this.bgColor = `rgba(${r},${g},${b},0.3)`
  226. let color = "rgba(" + r + "," + g + "," + b + "," + 0.3 + ")"
  227. // console.log(color)
  228. this.bgColor.push(color)
  229. }
  230. },
  231. onShow() {
  232. this.get_info()
  233. },
  234. methods: {
  235. change_active(index) {
  236. this.active = index
  237. },
  238. // 获取个人信息
  239. get_info() {
  240. this.$api.user_getUinfo({
  241. staff_num: uni.getStorageSync('user').staff_num
  242. }).then((res) => {
  243. // console.log(res.data.data)
  244. this.info = res.data.data
  245. this.info.work_experience = JSON.parse(res.data.data.work_experience)
  246. this.info.honor = JSON.parse(res.data.data.honor)
  247. })
  248. },
  249. // 新增工作经历
  250. add_text() {
  251. const data = {
  252. work_experience: this.info.work_experience
  253. }
  254. uni.navigateTo({
  255. url: "./job_record/job_record",
  256. success: (res) => {
  257. // 通过eventChannel向被打开页面传送数据
  258. res.eventChannel.emit('acceptDataFromOpenerPage', {
  259. data: data
  260. })
  261. }
  262. })
  263. },
  264. del_job(index) {
  265. uni.showActionSheet({
  266. itemList: ['删除'],
  267. success: (res) => {
  268. this.info.work_experience.splice(index, 1)
  269. this.$api.user_updateUserMessage({
  270. work_experience: JSON.stringify(this.info.work_experience)
  271. }).then((res) => {
  272. console.log(res)
  273. uni.showToast({
  274. icon: "none",
  275. title: "删除成功"
  276. })
  277. })
  278. },
  279. fail: (res) => {
  280. console.log(res.errMsg);
  281. }
  282. });
  283. },
  284. // 新增荣誉
  285. add_image() {
  286. const data = {
  287. base_url: this.base_url,
  288. honor_list: this.info.honor
  289. }
  290. uni.navigateTo({
  291. url: "./honor/honor",
  292. success: (res) => {
  293. // 通过eventChannel向被打开页面传送数据
  294. res.eventChannel.emit('acceptDataFromOpenerPage', {
  295. data: data
  296. })
  297. }
  298. })
  299. },
  300. click_image(index, path) {
  301. console.log(index, path)
  302. uni.showActionSheet({
  303. itemList: ['查看', '删除'],
  304. success: (res) => {
  305. if (res.tapIndex == 0) {
  306. console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
  307. uni.previewImage({
  308. urls: path.split(','),
  309. });
  310. } else if (res.tapIndex == 1) {
  311. console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
  312. console.log(index)
  313. this.info.honor.splice(index, 1)
  314. console.log(this.info.honor)
  315. this.$api.user_updateUserMessage({
  316. honor: JSON.stringify(this.info.honor)
  317. }).then((res) => {
  318. console.log(res)
  319. uni.showToast({
  320. icon: "none",
  321. title: "删除成功"
  322. })
  323. })
  324. }
  325. },
  326. fail: (res) => {
  327. console.log(res.errMsg);
  328. }
  329. })
  330. },
  331. // 更换头像
  332. change_avatar() {
  333. uni.showActionSheet({
  334. itemList: ['更换头像'],
  335. success: (res) => {
  336. console.log("更换头像")
  337. uni.navigateTo({
  338. url:"./upload_avatar/upload_avatar?base_url=" + this.base_url
  339. })
  340. },
  341. fail: (res) => {
  342. console.log(res.errMsg);
  343. }
  344. })
  345. },
  346. // 绑定手机
  347. binding_phone(){
  348. uni.navigateTo({
  349. url:"../setPhone/setPhone"
  350. })
  351. },
  352. go_qianming(){
  353. uni.navigateTo({
  354. url:"../signature/signature"
  355. })
  356. }
  357. }
  358. }
  359. </script>
  360. <style lang="scss">
  361. page {
  362. background-color: #F5F8F8;
  363. }
  364. .top {
  365. position: relative;
  366. background-color: #FFFFFF;
  367. width: 750rpx;
  368. min-height: 490rpx;
  369. background-image: url(./icon/top.png);
  370. background-size: 100% 100%;
  371. background-position: 0 -110rpx;
  372. background-repeat: no-repeat;
  373. .avatar {
  374. padding-top: 70rpx;
  375. text-align: center;
  376. image {
  377. width: 200rpx;
  378. height: 200rpx;
  379. border-radius: 50%;
  380. }
  381. }
  382. .info {
  383. margin-top: 20rpx;
  384. .name {
  385. text-align: center;
  386. font-size: 40rpx;
  387. font-weight: 700;
  388. }
  389. .box {
  390. margin-top: 30rpx;
  391. display: flex;
  392. justify-content: space-around;
  393. .item {
  394. width: 250rpx;
  395. text-align: center;
  396. .label {
  397. font-size: 30rpx;
  398. color: #009FE8;
  399. margin-bottom: 10rpx;
  400. }
  401. .text {
  402. font-size: 32rpx;
  403. }
  404. }
  405. }
  406. }
  407. .redo {
  408. width: 100rpx;
  409. height: 100rpx;
  410. line-height: 100rpx;
  411. text-align: center;
  412. position: absolute;
  413. top: 0;
  414. right: 0;
  415. }
  416. margin-bottom: 20rpx;
  417. }
  418. .content {
  419. background-color: #FFFFFF;
  420. .box {
  421. display: flex;
  422. justify-content: space-around;
  423. align-items: center;
  424. border-bottom: 2rpx solid #F5F8F8;
  425. .item {
  426. height: 95rpx;
  427. width: 230rpx;
  428. text-align: center;
  429. position: relative;
  430. .text {
  431. font-size: 34rpx;
  432. line-height: 95rpx;
  433. }
  434. .line {
  435. margin: -6rpx auto 0;
  436. width: 80rpx;
  437. height: 6rpx;
  438. background-color: #009FE8;
  439. }
  440. }
  441. }
  442. .list_1 {
  443. box-sizing: border-box;
  444. padding: 0 50rpx;
  445. .item {
  446. border-bottom: 2rpx solid #F5F8F8;
  447. // height: 95rpx;
  448. box-sizing: border-box;
  449. padding: 30rpx 0;
  450. display: flex;
  451. // justify-content: space-between;
  452. justify-content: space-between;
  453. align-items: center;
  454. font-size: 32rpx;
  455. .label {
  456. width: 300rpx;
  457. text-align: left;
  458. }
  459. .text {
  460. width: 300rpx;
  461. text-align: left;
  462. color: #8e8e8e;
  463. }
  464. .right {
  465. // width: 100rpx;
  466. text-align: right;
  467. }
  468. }
  469. }
  470. .list_2 {
  471. box-sizing: border-box;
  472. padding: 0 50rpx;
  473. .item {
  474. border-bottom: 2rpx solid #F5F8F8;
  475. // height: 95rpx;
  476. box-sizing: border-box;
  477. padding: 20rpx 0;
  478. display: flex;
  479. justify-content: space-between;
  480. align-items: center;
  481. font-size: 28rpx;
  482. text-align: center;
  483. color: #8e8e8e;
  484. .text_1 {
  485. width: 190rpx;
  486. }
  487. .text_2 {
  488. width: 240rpx;
  489. }
  490. .text_3 {
  491. width: 160rpx;
  492. }
  493. }
  494. .item:first-child {
  495. font-size: 32rpx;
  496. color: #333;
  497. }
  498. }
  499. .list_3 {
  500. box-sizing: border-box;
  501. padding: 50rpx;
  502. overflow: hidden;
  503. .item {
  504. float: left;
  505. margin-right: 50rpx;
  506. margin-bottom: 30rpx;
  507. width: 300rpx;
  508. text-align: center;
  509. .img {
  510. margin-bottom: 10rpx;
  511. image {
  512. width: 300rpx;
  513. height: 180rpx;
  514. }
  515. .add {
  516. font-size: 140rpx;
  517. color: #DCDCDC;
  518. text-align: center;
  519. height: 180rpx;
  520. line-height: 160rpx;
  521. background-color: #EEEEEE;
  522. }
  523. }
  524. .text {
  525. width: 260rpx;
  526. font-size: 30rpx;
  527. color: #8e8e8e;
  528. overflow: hidden;
  529. white-space: nowrap;
  530. text-overflow: ellipsis;
  531. }
  532. }
  533. .item:nth-child(2n) {
  534. margin-right: 0;
  535. }
  536. }
  537. }
  538. </style>