浏览代码

support hidden voluntary

abpcoder 1 天之前
父节点
当前提交
ce12fb92a8
共有 1 个文件被更改,包括 10 次插入8 次删除
  1. 10 8
      src/views/system/user/profile/userInfo.vue

+ 10 - 8
src/views/system/user/profile/userInfo.vue

@@ -29,6 +29,7 @@
       </el-form-item>
     </el-form>
     <simulate-score
+      v-if="!currentUser.isHiddenVoluntary"
       ref="score"
       :form="scoreModel"
       :disabled="!user.provinceName"
@@ -48,21 +49,21 @@
 </template>
 
 <script>
-import { updateUserProfile } from '@/api/system/user'
-import { mapActions, mapGetters } from 'vuex'
+import {updateUserProfile} from '@/api/system/user'
+import {mapActions, mapGetters} from 'vuex'
 import ResetMobileForm from '@/views/system/user/profile/components/ResetMobileForm'
 import MxConst from "@/common/MxConst";
 import SimulateScore from "@/views/career/zhiyuan/components/SimulateScore.vue";
 
 export default {
-  components: {SimulateScore, ResetMobileForm },
+  components: {SimulateScore, ResetMobileForm},
   props: {
     user: {
       type: Object
     }
   },
   computed: {
-    ...mapGetters(['isFrontStudent']),
+    ...mapGetters(['isFrontStudent', 'currentUser']),
     disableScoreRequired() {
       return this.user.scoreLock == MxConst.enum.scoreLock.unlock
     }
@@ -78,7 +79,7 @@ export default {
       // 表单校验
       rules: {
         nickName: [
-          { required: true, message: '用户昵称不能为空', trigger: 'blur' }
+          {required: true, message: '用户昵称不能为空', trigger: 'blur'}
         ]
       }
     }
@@ -92,10 +93,11 @@ export default {
   methods: {
     ...mapActions(['GetInfo']),
     async submit() {
-      const validates = [this.$refs.form.validate(), this.$refs.score.validate()]
+      const validates = [this.$refs.form.validate()]
+      if (this.$refs.score) validates.push(this.$refs.score.validate())
       await Promise.all(validates)
 
-      const mode = [this.scoreModel.firstSubject].concat(this.scoreModel.lastSubject)
+      const mode = [this.scoreModel.firstSubject].concat(this.scoreModel.lastSubject).filter(i => !!i)
       const commit = {
         ...this.user,
         mode: mode.toString(),
@@ -107,7 +109,7 @@ export default {
     },
     close() {
       this.$store.dispatch('tagsView/delView', this.$route)
-      this.$router.push({ path: '/' })
+      this.$router.push({path: '/'})
     }
   }
 }