advantage.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!-- -->
  2. <template>
  3. <view style="padding: 20rpx 30rpx;">
  4. <textarea
  5. placeholder-style="color:#F76260"
  6. placeholder="请填写您的个人优势..."
  7. auto-focus
  8. maxlength="300"
  9. v-model="advantage"
  10. style="border: 1rpx solid gray; width: 100%; min-height: 300px;"
  11. ></textarea>
  12. <view class="f-horizon-center">
  13. <button type="primary" size="default" class="send-button MiSans-Medium" :disabled="disabled" @click="submit">提 交</button>
  14. </view>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { saveResumeAdvantage } from '@/api/user'
  19. import { ref } from 'vue'
  20. import { userStore } from '@/store/user'; const useUserStore = userStore()
  21. const advantage = ref('')
  22. // 获取基础信息-
  23. function getBaseInfo () {
  24. const baseInfo = useUserStore.baseInfo
  25. advantage.value = baseInfo?.advantage || ''
  26. }
  27. // 获取基础信息
  28. getBaseInfo()
  29. // 提交
  30. const disabled = ref(false)
  31. const submit = async () => {
  32. if (!advantage.value) {
  33. uni.showToast({ title: '请填写您的个人优势', icon: 'none' })
  34. return
  35. }
  36. disabled.value = true
  37. try {
  38. await saveResumeAdvantage({ content: advantage.value })
  39. uni.showToast({ title: '编辑成功', icon: 'success' })
  40. await useUserStore.getInfo(false)
  41. setTimeout(() => {
  42. uni.navigateBack({
  43. delta: 1
  44. })
  45. disabled.value = false
  46. }, 1000)
  47. } catch {
  48. disabled.value = false
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. </style>