editUserInfo.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="container">
  3. <!-- 顶部导航 -->
  4. <view class="nav-bar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
  5. <view class="nav-left" @click="goBack">
  6. <u-icon name="arrow-leftward" color="rgba(51, 51, 51, 1)" style="font-size: 38rpx;"></u-icon>
  7. </view>
  8. <view class="nav-title">个人信息</view>
  9. <view class="nav-right"></view>
  10. </view>
  11. <!-- 表单内容 -->
  12. <view class="form-container">
  13. <view class="form-item">
  14. <view class="form-label">
  15. <text class="required-mark">*</text>
  16. <text class="label-text">求职状态</text>
  17. </view>
  18. <view class="form-content flex-between select-picker form-content-border" @click="showJobStatusPicker">
  19. <text class="select-text">{{ jobStatusList[selectedJobStatus].text }}</text>
  20. <u-icon name="arrow-down" color="#999" size="24"></u-icon>
  21. </view>
  22. </view>
  23. <view class="form-item">
  24. <view class="form-label">
  25. <text class="label-text">我的优势</text>
  26. <text class="text-num">({{ textNum }}/1000)</text>
  27. </view>
  28. <view class="form-content form-content-border">
  29. <textarea class="form-input" type="text" maxlength="1000" auto-height placeholder="请填写您的个人优势" v-model="advantages" />
  30. </view>
  31. </view>
  32. <view class="form-item">
  33. <view class="form-label">
  34. <text class="label-text">我的技能</text>
  35. </view>
  36. <view class="form-content flex-between form-content-border skills-content">
  37. <view class="skills-tags">
  38. <view v-for="(skill, index) in skills" :key="index" class="skill-tag">
  39. <text>{{ skill }}</text>
  40. </view>
  41. </view>
  42. <view class="add-skill-btn" @click="addSkill()">
  43. <u-icon name="plus" color="rgba(102, 102, 102, 1)" size="28"></u-icon>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 求职状态选择器 -->
  49. <u-popup v-model="showJobStatusModal" mode="bottom" border-radius="42" height="auto"
  50. :safe-area-inset-bottom="true">
  51. <view class="job-status-picker">
  52. <view class="picker-header">
  53. <text class="picker-title">求职状态</text>
  54. </view>
  55. <view class="picker-content">
  56. <view class="status-option" :class="{ active: selectedJobStatus == item.value }"
  57. v-for="item in jobStatusList" :key="item.value" @click="selectJobStatus(item)">
  58. <view class="option-left">
  59. <view class="radio-btn" :class="{ checked: selectedJobStatus == item.value }">
  60. <u-icon v-if="selectedJobStatus == item.value" name="checkmark" color="#ffffff"
  61. size="28"></u-icon>
  62. </view>
  63. <text class="option-text">{{ item.text }}</text>
  64. <view v-if="item.recommended" class="recommend-tag">
  65. <text>推荐</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </u-popup>
  72. <view class="fixed-section">
  73. <u-button type="primary" class="submit-btn" @click="submitData">保存</u-button>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import { jobStatus } from '@/constants/userInfo.js'
  79. export default {
  80. data() {
  81. return {
  82. statusBarHeight: 0, // 状态栏高度
  83. selectedJobStatus: 0,
  84. jobStatusList: jobStatus,
  85. showJobStatusModal: false,
  86. advantages: '', // 优势
  87. skills: [], // 我的技能
  88. };
  89. },
  90. computed: {
  91. textNum() {
  92. if (typeof this.advantages == 'string') {
  93. return this.advantages.length
  94. }
  95. return '0'
  96. }
  97. },
  98. onLoad() {
  99. // 获取状态栏高度
  100. let systemInfo = uni.getSystemInfoSync();
  101. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  102. this.getUserInfoData()
  103. // 监听技能设置更新
  104. uni.$on('skillsUpdated', (data) => {
  105. if (data.set != 1)
  106. return
  107. this.updateSkills(data.selectedTags)
  108. })
  109. },
  110. onUniLoad() {
  111. uni.$off('skillsUpdated')
  112. },
  113. methods: {
  114. goBack() {
  115. uni.navigateBack()
  116. },
  117. // 获取用户数据
  118. getUserInfoData() {
  119. uni.showLoading({
  120. title: '加载中'
  121. })
  122. this.$Request.getT("/app/userFirst/getUserResumes", {}).then((res) => {
  123. if (res.code === 0) {
  124. this.selectedJobStatus = res.data.resumeList.resumesStatus
  125. this.advantages = res.data.resumeList.adv
  126. this.skills = res.data.skills.map(skill => skill.skillName)
  127. }
  128. }).finally(() => {
  129. uni.hideLoading()
  130. })
  131. },
  132. // 显示求职状态选择器
  133. showJobStatusPicker() {
  134. this.showJobStatusModal = true;
  135. },
  136. // 选择求职状态
  137. selectJobStatus(item) {
  138. this.selectedJobStatus = item.value;
  139. this.showJobStatusModal = false;
  140. },
  141. // 移除技能
  142. removeSkill(index) {
  143. this.skills.splice(index, 1)
  144. },
  145. // 增加技能
  146. addSkill() {
  147. uni.navigateTo({
  148. url: '/package/jobIntention/jobSkills?from=userInfo&set=1&jobTitle=我的&skill=' + encodeURIComponent(JSON
  149. .stringify(this.skills == null ? [] : this.$queue.array_column(this
  150. .skills, 'skillName')))
  151. })
  152. },
  153. // 更新本地技能数据
  154. updateSkills(data) {
  155. this.skills = data;
  156. },
  157. // 保存数据
  158. submitData() {
  159. uni.showLoading({
  160. title: '保存中'
  161. })
  162. this.$Request.postJson('/app/user/updatePersonalInfo', {
  163. resumesStatus: this.selectedJobStatus,
  164. adv: this.advantages,
  165. skills: this.skills.map(skill => {
  166. return {
  167. isUse: 1,
  168. skillId: '',
  169. skillName: skill,
  170. userId: ''
  171. }
  172. })
  173. }).then((res) => {
  174. uni.showToast({
  175. title: '更新成功',
  176. icon: 'none',
  177. })
  178. setTimeout(() => {
  179. uni.$emit('updateResume')
  180. uni.navigateBack()
  181. }, 1000)
  182. }).catch(err => {
  183. uni.showToast({
  184. title: err.msg,
  185. icon: 'none'
  186. })
  187. }).finally(() => {
  188. uni.hideLoading()
  189. })
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss">
  195. @import '../../common.scss';
  196. .container {
  197. .flex-between {
  198. display: flex;
  199. justify-content: space-between;
  200. }
  201. .form-content-border {
  202. min-height: 75rpx;
  203. border: 1px solid rgba(227, 231, 236, 1);
  204. border-radius: 48rpx;
  205. padding: 24rpx 32rpx;
  206. font-size: 28rpx;
  207. color: #78828a;
  208. }
  209. // 下拉选择器样式
  210. .select-picker {
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. .select-text {
  215. color: #78828a;
  216. font-family: DM Sans;
  217. font-size: 14px;
  218. font-weight: 400;
  219. line-height: 22px;
  220. letter-spacing: 0%;
  221. text-align: left;
  222. }
  223. }
  224. // 求职状态选择器样式
  225. .job-status-picker {
  226. background: #fff;
  227. border-radius: 42rpx 42rpx 0 0;
  228. .picker-header {
  229. padding: 40rpx 40rpx 20rpx 40rpx;
  230. text-align: center;
  231. border-bottom: 1px solid #f0f0f0;
  232. .picker-title {
  233. color: rgba(23, 23, 37, 1);
  234. font-family: DM Sans;
  235. font-size: 18px;
  236. font-weight: 600;
  237. line-height: 26px;
  238. letter-spacing: 0%;
  239. text-align: center;
  240. }
  241. }
  242. .picker-content {
  243. padding: 20rpx 40rpx 40rpx 40rpx;
  244. .status-option {
  245. padding: 30rpx 0;
  246. border-bottom: 1px solid #f0f0f0;
  247. &:last-child {
  248. border-bottom: none;
  249. }
  250. .option-left {
  251. display: flex;
  252. align-items: center;
  253. .radio-btn {
  254. width: 40rpx;
  255. height: 40rpx;
  256. border-radius: 50%;
  257. border: 2px solid #e0e0e0;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. margin-right: 20rpx;
  262. &.checked {
  263. background-color: #007AFF;
  264. border-color: #007AFF;
  265. }
  266. }
  267. .option-text {
  268. flex: 1;
  269. color: rgba(23, 23, 37, 1);
  270. font-family: DM Sans;
  271. font-size: 16px;
  272. font-weight: 400;
  273. line-height: 22px;
  274. letter-spacing: 0%;
  275. text-align: left;
  276. }
  277. .recommend-tag {
  278. background-color: #007AFF;
  279. border-radius: 8rpx;
  280. padding: 4rpx 12rpx;
  281. margin-left: 16rpx;
  282. text {
  283. color: #fff;
  284. font-family: DM Sans;
  285. font-size: 12px;
  286. font-weight: 500;
  287. line-height: 16px;
  288. letter-spacing: 0%;
  289. text-align: center;
  290. }
  291. }
  292. }
  293. }
  294. }
  295. }
  296. // 输入框内容
  297. .form-input {
  298. font-size: 28rpx;
  299. line-height: 32rpx;
  300. }
  301. .text-num {
  302. font-weight: normal;
  303. color: #78828a;
  304. font-size: 28rpx;
  305. }
  306. // 我的技能
  307. .skills-content {
  308. align-items: center;
  309. .skills-tags {
  310. display: flex;
  311. flex-wrap: wrap;
  312. gap: 12rpx;
  313. flex: 1;
  314. .skill-tag {
  315. padding: 8rpx 16rpx;
  316. background: #F5F5F5;
  317. border-radius: 8rpx;
  318. display: flex;
  319. align-items: center;
  320. text {
  321. font-size: 24rpx;
  322. color: #666666;
  323. margin-right: 8rpx;
  324. }
  325. }
  326. }
  327. .add-skill-btn {
  328. width: 40rpx;
  329. height: 40rpx;
  330. border: 1rpx solid rgba(102, 102, 102, 1);
  331. border-radius: 8rpx;
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. background: #fff;
  336. flex-shrink: 0;
  337. }
  338. }
  339. }
  340. </style>