editUserInfo.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. methods: {
  111. goBack() {
  112. uni.navigateBack()
  113. },
  114. // 获取用户数据
  115. getUserInfoData() {
  116. uni.showLoading({
  117. title: '加载中'
  118. })
  119. this.$Request.getT("/app/userFirst/getUserResumes", {}).then((res) => {
  120. if (res.code === 0) {
  121. this.selectedJobStatus = res.data.resumeList.resumesStatus
  122. this.advantages = res.data.resumeList.adv
  123. this.skills = res.data.skills.map(skill => skill.skillName)
  124. }
  125. }).finally(() => {
  126. uni.hideLoading()
  127. })
  128. },
  129. // 显示求职状态选择器
  130. showJobStatusPicker() {
  131. this.showJobStatusModal = true;
  132. },
  133. // 选择求职状态
  134. selectJobStatus(item) {
  135. this.selectedJobStatus = item.value;
  136. this.showJobStatusModal = false;
  137. },
  138. // 移除技能
  139. removeSkill(index) {
  140. this.skills.splice(index, 1)
  141. },
  142. // 增加技能
  143. addSkill() {
  144. uni.navigateTo({
  145. url: '/package/jobIntention/jobSkills?from=userInfo&set=1&jobTitle=我的&skill=' + encodeURIComponent(JSON
  146. .stringify(this.skills == null ? [] : this.$queue.array_column(this
  147. .skills, 'skillName')))
  148. })
  149. },
  150. // 更新本地技能数据
  151. updateSkills(data) {
  152. this.skills = data;
  153. },
  154. // 保存数据
  155. submitData() {
  156. uni.showLoading({
  157. title: '保存中'
  158. })
  159. this.$Request.postJson('/app/user/updatePersonalInfo', {
  160. resumesStatus: this.selectedJobStatus,
  161. adv: this.advantages,
  162. skills: this.skills.map(skill => {
  163. return {
  164. isUse: 1,
  165. skillId: '',
  166. skillName: skill,
  167. userId: ''
  168. }
  169. })
  170. }).then((res) => {
  171. uni.showToast({
  172. title: '更新成功',
  173. icon: 'none',
  174. })
  175. setTimeout(() => {
  176. uni.$emit('updateResume')
  177. uni.navigateBack()
  178. }, 1000)
  179. }).catch(err => {
  180. uni.showToast({
  181. title: err.msg,
  182. icon: 'none'
  183. })
  184. }).finally(() => {
  185. uni.hideLoading()
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss">
  192. @import '../../common.scss';
  193. .container {
  194. .flex-between {
  195. display: flex;
  196. justify-content: space-between;
  197. }
  198. .form-content-border {
  199. min-height: 75rpx;
  200. border: 1px solid rgba(227, 231, 236, 1);
  201. border-radius: 48rpx;
  202. padding: 24rpx 32rpx;
  203. font-size: 28rpx;
  204. color: #78828a;
  205. }
  206. // 下拉选择器样式
  207. .select-picker {
  208. display: flex;
  209. align-items: center;
  210. justify-content: space-between;
  211. .select-text {
  212. color: #78828a;
  213. font-family: DM Sans;
  214. font-size: 14px;
  215. font-weight: 400;
  216. line-height: 22px;
  217. letter-spacing: 0%;
  218. text-align: left;
  219. }
  220. }
  221. // 求职状态选择器样式
  222. .job-status-picker {
  223. background: #fff;
  224. border-radius: 42rpx 42rpx 0 0;
  225. .picker-header {
  226. padding: 40rpx 40rpx 20rpx 40rpx;
  227. text-align: center;
  228. border-bottom: 1px solid #f0f0f0;
  229. .picker-title {
  230. color: rgba(23, 23, 37, 1);
  231. font-family: DM Sans;
  232. font-size: 18px;
  233. font-weight: 600;
  234. line-height: 26px;
  235. letter-spacing: 0%;
  236. text-align: center;
  237. }
  238. }
  239. .picker-content {
  240. padding: 20rpx 40rpx 40rpx 40rpx;
  241. .status-option {
  242. padding: 30rpx 0;
  243. border-bottom: 1px solid #f0f0f0;
  244. &:last-child {
  245. border-bottom: none;
  246. }
  247. .option-left {
  248. display: flex;
  249. align-items: center;
  250. .radio-btn {
  251. width: 40rpx;
  252. height: 40rpx;
  253. border-radius: 50%;
  254. border: 2px solid #e0e0e0;
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. margin-right: 20rpx;
  259. &.checked {
  260. background-color: #007AFF;
  261. border-color: #007AFF;
  262. }
  263. }
  264. .option-text {
  265. flex: 1;
  266. color: rgba(23, 23, 37, 1);
  267. font-family: DM Sans;
  268. font-size: 16px;
  269. font-weight: 400;
  270. line-height: 22px;
  271. letter-spacing: 0%;
  272. text-align: left;
  273. }
  274. .recommend-tag {
  275. background-color: #007AFF;
  276. border-radius: 8rpx;
  277. padding: 4rpx 12rpx;
  278. margin-left: 16rpx;
  279. text {
  280. color: #fff;
  281. font-family: DM Sans;
  282. font-size: 12px;
  283. font-weight: 500;
  284. line-height: 16px;
  285. letter-spacing: 0%;
  286. text-align: center;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. // 输入框内容
  294. .form-input {
  295. font-size: 28rpx;
  296. line-height: 32rpx;
  297. }
  298. .text-num {
  299. font-weight: normal;
  300. color: #78828a;
  301. font-size: 28rpx;
  302. }
  303. // 我的技能
  304. .skills-content {
  305. align-items: center;
  306. .skills-tags {
  307. display: flex;
  308. flex-wrap: wrap;
  309. gap: 12rpx;
  310. flex: 1;
  311. .skill-tag {
  312. padding: 8rpx 16rpx;
  313. background: #F5F5F5;
  314. border-radius: 8rpx;
  315. display: flex;
  316. align-items: center;
  317. text {
  318. font-size: 24rpx;
  319. color: #666666;
  320. margin-right: 8rpx;
  321. }
  322. }
  323. }
  324. .add-skill-btn {
  325. width: 40rpx;
  326. height: 40rpx;
  327. border: 1rpx solid rgba(102, 102, 102, 1);
  328. border-radius: 8rpx;
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. background: #fff;
  333. flex-shrink: 0;
  334. }
  335. }
  336. }
  337. </style>