renzheng.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <view class="userinfo">
  3. <view class="user-head u-flex u-row-between">
  4. <text>头像</text>
  5. <image :src="userinfo.avatar" mode="aspectFill" @click="uploadimg"></image>
  6. </view>
  7. <view class="user-item" @click="tochangename">
  8. <view class="item-name">
  9. 真实姓名
  10. </view>
  11. <view class="item-input u-flex">
  12. <input type="text" placeholder="请输入真实姓名" :disabled="true" v-model="userinfo.name">
  13. </view>
  14. </view>
  15. <view class="user-item" @click="">
  16. <view class="item-name">
  17. 学历
  18. </view>
  19. <view class="item-input u-flex" @click="show=true">
  20. <input type="text" placeholder="请选择学历" :disabled="true" v-model="info.education_name">
  21. <u-icon name="arrow-right"></u-icon>
  22. </view>
  23. </view>
  24. <view class="user-item">
  25. <view class="item-name">
  26. 毕业院校
  27. </view>
  28. <view class="item-input u-flex">
  29. <input type="text" placeholder="请填写毕业院校" v-model="info.name">
  30. <!-- <u-icon name="arrow-right"></u-icon> -->
  31. </view>
  32. </view>
  33. <view class="user-item" @click="">
  34. <view class="item-name">
  35. 专业类别
  36. </view>
  37. <view class="item-input u-flex">
  38. <input type="text" placeholder="请填写专业类别" v-model="info.major">
  39. <!-- <u-icon name="arrow-right"></u-icon> -->
  40. </view>
  41. </view>
  42. <view class="user-item" @click="recruit_show = true">
  43. <view class="item-name">
  44. 是否统招
  45. </view>
  46. <view class="item-input u-flex">
  47. <input type="text" :disabled="true" placeholder="请选择" v-model="is_recruit">
  48. <u-icon name="arrow-right"></u-icon>
  49. </view>
  50. </view>
  51. <view class="user-item u-flex-col u-row-center">
  52. <text class="item-name">时间</text>
  53. <view class="u-flex u-row-between">
  54. <view class="item-input" @click="start()">
  55. <u--input :disabled="true" disabledColor="#fff" customStyle="padding:0 !important" type="text"
  56. placeholder="上学时间" border placeholderClass='input-style' v-model="info.start_time"></u--input>
  57. </view>
  58. <view class="">-</view>
  59. <view class="" @click="end()">
  60. <u--input :disabled="true" disabledColor="#fff" customStyle="padding:0 !important" type="text"
  61. placeholder="毕业时间" inputAlign="center" border placeholderClass='input-style'
  62. v-model="info.end_time"></u--input>
  63. </view>
  64. </view>
  65. </view>
  66. <view style="height: 150rpx;"></view>
  67. <view class="safe-area-inset-bottom"></view>
  68. <view class="user-down">
  69. <view class="down-btn u-flex">
  70. <text @click="save">立即认证</text>
  71. </view>
  72. <view class="safe-area-inset-bottom"></view>
  73. </view>
  74. <u-picker :show="show" @cancel="show = false" title="学历" keyName="name" :columns="education"
  75. @confirm="education_confirm"></u-picker>
  76. <u-picker :show="recruit_show" title= "是否统招" @cancel="recruit_show = false" keyName="name" :columns="is_recruitlist"
  77. @confirm="recruit"></u-picker>
  78. <u-datetime-picker ref="pickers" title="上学时间" :minDate="minDate1" @confirm="entryConfirm" :show="entryShow" mode="year-month"
  79. @cancel='entryShow = false'></u-datetime-picker>
  80. <u-datetime-picker ref="pickers1" title="毕业时间" :minDate="minDate" @confirm="dimissionConfirm" :show="dimissionShow"
  81. mode="year-month" @cancel='dimissionShow = false'></u-datetime-picker>
  82. </view>
  83. </template>
  84. <script>
  85. import {
  86. profile,
  87. get_experience,
  88. getareacity,
  89. get_sex,
  90. index,
  91. activityauth,
  92. is_auth,
  93. get_education
  94. } from "@/units/inquire.js"
  95. import { get } from "https"
  96. import fuxing from "../common/fuxing.js"
  97. export default {
  98. data() {
  99. return {
  100. dimissionShow: false,
  101. entryShow: false,
  102. education: [
  103. []
  104. ],
  105. recruit_show:false,
  106. show: false,
  107. workShow: false,
  108. userinfo: {},
  109. sexlist: [],
  110. citylist: [],
  111. qiye: '',
  112. jingyanlist: [],
  113. is_recruit:'',
  114. is_recruitid:'',
  115. is_recruitlist:[[
  116. {
  117. "name":'统招',
  118. num:1
  119. },
  120. {
  121. "name":"非统招",
  122. num:0
  123. }
  124. ]],
  125. // worklist: [{
  126. // label: 'soho猎头',
  127. // value: 'soho'
  128. // }, {
  129. // label: '就职猎头',
  130. // value: 'job'
  131. // }],
  132. info: {
  133. id: "", // integer 学校认证ID
  134. school_id: "", // integer 学校ID
  135. name: "", // string 学校名称
  136. education_id: "", // integer 学历ID
  137. major: "", // string 专业
  138. start_time: "", // string 开始时间
  139. end_time: "", // string 毕业时间
  140. education_name: "", // string 学历名称
  141. }
  142. }
  143. },
  144. onLoad() {
  145. this.getuser()
  146. this.getconfig()
  147. this.minDate = Number(new Date('2000-01-01'));
  148. this.minDate1 = Number(new Date('2000-01-01'));
  149. this.is_auth()
  150. this.get_education()
  151. },
  152. methods: {
  153. recruit(e){
  154. // console.log(e);
  155. this.is_recruit = e.value[0].name
  156. this.is_recruitid = e.value[0].num
  157. // console.log(this.is_recruit);
  158. this.recruit_show = false
  159. },
  160. async dimissionConfirm(e) {
  161. const timeFormat = uni.$u.timeFormat;
  162. let timeValue = await timeFormat(e.value, 'yyyy-mm');
  163. this.info.end_time = timeValue
  164. this.dimissionShow = false
  165. },
  166. start(){
  167. this.entryShow = true
  168. this.$refs.pickers.innerValue = new Date(1577808000000).getTime()
  169. },
  170. end(){
  171. this.dimissionShow = true
  172. this.$refs.pickers1.innerValue = new Date(1672502400000).getTime()
  173. },
  174. async entryConfirm(e) {
  175. const timeFormat = uni.$u.timeFormat;
  176. console.log(e.value);
  177. let timeValue = await timeFormat(e.value, 'yyyy-mm');
  178. this.info.start_time = timeValue;
  179. this.entryShow = false
  180. },
  181. education_confirm(e) {
  182. console.log(e);
  183. console.log(this.info);
  184. this.info.education_name = e.value[0].name
  185. this.info.education_id = e.value[0].id
  186. this.show = false
  187. },
  188. get_education() {
  189. get_education().then(res => {
  190. this.education[0] = res.data
  191. })
  192. },
  193. is_auth() {
  194. is_auth().then(res => {
  195. if (res.data.is_auth == 1) {
  196. this.info = res.data.info
  197. this.info.education_id = res.data.info.education.id
  198. this.info.education_name = res.data.info.education.name
  199. this.is_recruitid= res.data.info.is_recruit
  200. if(res.data.info.is_recruit==1){
  201. this.is_recruit = "统招"
  202. }else{
  203. this.is_recruit = "非统招"
  204. }
  205. }
  206. })
  207. },
  208. //参加工作时间
  209. async workConfirm(e) {
  210. const timeFormat = uni.$u.timeFormat;
  211. let timeValue = await timeFormat(e.value, 'yyyy-mm');
  212. this.from.job_time = timeValue;
  213. this.workShow = false
  214. },
  215. changework(e) {
  216. this.userinfo.work_status = e[0].value
  217. },
  218. changejingyan(e) {
  219. this.userinfo.experience_id = e[0].value
  220. this.userinfo.experience_name = e[0].label
  221. },
  222. save() {
  223. if (!this.userinfo.avatar) {
  224. this.$u.toast("请上传头像")
  225. return
  226. }
  227. if (!this.userinfo.name) {
  228. this.$u.toast("请输入真实名字")
  229. return
  230. }
  231. if (!this.info.education_name) {
  232. this.$u.toast("请选择学历")
  233. return
  234. }
  235. if (!this.info.name) {
  236. this.$u.toast("请填写毕业院校")
  237. return
  238. }
  239. if (!this.info.major) {
  240. this.$u.toast("请填写专业类别")
  241. return
  242. }
  243. if (!this.info.start_time) {
  244. this.$u.toast("请选择上学时间")
  245. return
  246. }
  247. if (!this.info.end_time) {
  248. this.$u.toast("请选择毕业时间")
  249. return
  250. }
  251. uni.showLoading({
  252. mask: true,
  253. title: "请稍后"
  254. })
  255. activityauth({
  256. name: this.info.name, //学校名称
  257. is_recruit: this.is_recruitid, //是否统招:0=非统招,1=统招
  258. education_id: this.info.education_id, //学历ID
  259. major: this.info.major, //专业
  260. start_time: this.info.start_time, // 开始时间 例:2023-01
  261. end_time: this.info.end_time // 毕业时间
  262. }).then(res => {
  263. if (res.code == 1) {
  264. this.$u.toast("修改成功")
  265. setTimeout(() => {
  266. uni.navigateBack()
  267. }, 800)
  268. } else {
  269. this.$u.toast(res.msg)
  270. }
  271. })
  272. // profile({
  273. // avatar: this.userinfo.avatar,
  274. // name: this.userinfo.name,
  275. // industry_first: this.userinfo.industry_first,
  276. // industry_id: this.userinfo.industry_id,
  277. // experience_id: this.userinfo.experience_id,
  278. // work_status: this.userinfo.work_status,
  279. // work_address: this.userinfo.work_address,
  280. // realname: this.userinfo.virtual_name,
  281. // }).then(res => {
  282. // if (res.code == 1) {
  283. // this.$u.toast("修改成功")
  284. // setTimeout(() => {
  285. // uni.navigateBack()
  286. // }, 800)
  287. // } else {
  288. // this.$u.toast(res.msg)
  289. // }
  290. // })
  291. },
  292. changecity(e) {
  293. this.userinfo.work_address = `${e[0].label} ${e[1].label}`
  294. },
  295. changsex(e) {
  296. this.userinfo.sex_text = e[0].label
  297. this.userinfo.sex = e[0].value
  298. if (this.userinfo.name != this.userinfo.virtual_name && this.userinfo.virtual_name) {
  299. if (this.userinfo.name.length == 3) {
  300. this.userinfo.name = this.userinfo.virtual_name[0] + (this.userinfo.sex == 'female' ? '女士' : '先生')
  301. } else {
  302. this.userinfo.name = this.userinfo.virtual_name[0] + this.userinfo.virtual_name[1] + (this.userinfo
  303. .sex == 'female' ? '女士' : '先生')
  304. }
  305. }
  306. },
  307. getconfig() {
  308. get_sex().then(res => {
  309. for (var key in res.data) {
  310. this.sexlist.push({
  311. label: res.data[key],
  312. value: key
  313. })
  314. }
  315. })
  316. getareacity().then(res => {
  317. this.citylist = res.data
  318. })
  319. get_experience().then(res => {
  320. this.jingyanlist = res.data
  321. })
  322. },
  323. uploadimg() {
  324. uni.chooseImage({
  325. count: 1,
  326. success: (img) => {
  327. uni.showLoading({
  328. mask: true,
  329. title: "请稍后"
  330. })
  331. uni.uploadFile({
  332. url: this.$url + '/api/common/upload',
  333. filePath: img.tempFilePaths[0],
  334. name: 'file',
  335. success: (res) => {
  336. uni.hideLoading()
  337. if (JSON.parse(res.data).code == 1) {
  338. this.userinfo.avatar = JSON.parse(res.data).data.fullurl
  339. } else {
  340. this.$u.toast(JSON.parse(res.data).msg)
  341. }
  342. },
  343. fail: (e) => {
  344. console.log(e);
  345. }
  346. })
  347. }
  348. })
  349. },
  350. getuser() {
  351. index().then(res => {
  352. this.userinfo = res.data.group_info
  353. this.userinfo.sex_text = {
  354. 'male': '男',
  355. 'female': '女',
  356. 'secret': '保密'
  357. } [this.userinfo.sex]
  358. console.log(this.userinfo);
  359. })
  360. },
  361. tochangename() {
  362. uni.navigateTo({
  363. url: "/pagesD/change-name?name=" + JSON.stringify({
  364. name: this.userinfo.name,
  365. virtual_name: this.userinfo.realname
  366. }),
  367. events: {
  368. getname: (res) => {
  369. if (res.name) {
  370. this.userinfo.name = res.name
  371. } else {
  372. var name = ''
  373. fuxing.forEach(val => {
  374. if (res.virtual_name.indexOf(val) > -1) {
  375. name = res.virtual_name[0] + res.virtual_name[1] + (this
  376. .userinfo.sex == 'female' ? '女士' : '先生')
  377. }
  378. })
  379. if (!name) {
  380. name = res.virtual_name[0] + (this.userinfo.sex == 'female' ? '女士' : '先生')
  381. }
  382. this.userinfo.name = name
  383. }
  384. this.userinfo.realname = res.virtual_name
  385. }
  386. }
  387. })
  388. }
  389. }
  390. }
  391. </script>
  392. <style lang="scss">
  393. .userinfo {
  394. padding: 0 32rpx;
  395. .user-down {
  396. position: fixed;
  397. bottom: 0;
  398. left: 0;
  399. z-index: 99;
  400. width: 750rpx;
  401. background-color: #fff;
  402. .down-btn {
  403. padding: 8rpx 32rpx;
  404. text {
  405. line-height: 88rpx;
  406. background: #0C66C2;
  407. border-radius: 12rpx;
  408. width: 100%;
  409. font-size: 32rpx;
  410. font-family: PingFangSC-Medium, PingFang SC;
  411. font-weight: 500;
  412. color: #FFFFFF;
  413. text-align: center;
  414. }
  415. }
  416. }
  417. .user-item {
  418. padding-top: 30rpx;
  419. border-bottom: 2rpx solid #F0F0F0;
  420. .item-input {
  421. height: 100rpx;
  422. input {
  423. height: 100rpx;
  424. flex: 1;
  425. }
  426. }
  427. .item-name {
  428. font-size: 26rpx;
  429. font-family: PingFangSC-Regular, PingFang SC;
  430. font-weight: 400;
  431. color: #888888;
  432. }
  433. }
  434. .user-head {
  435. padding: 32rpx 0;
  436. border-bottom: 2rpx solid #F0F0F0;
  437. text {
  438. font-size: 32rpx;
  439. font-family: PingFangSC-Regular, PingFang SC;
  440. font-weight: 400;
  441. color: #222222;
  442. }
  443. image {
  444. border-radius: 100%;
  445. width: 120rpx;
  446. height: 120rpx;
  447. }
  448. }
  449. }
  450. </style>