Jelajahi Sumber

score lock update

abpcoder 1 hari lalu
induk
melakukan
ab8bcb4043

+ 2 - 1
.env.development

@@ -4,7 +4,8 @@ ENV = 'development'
 # 名学金榜学习系统/生产环境
 #VUE_APP_BASE_API = 'https://www.mingxuejinbang.com/prod-api'
 #VUE_APP_BASE_API = 'http://localhost:8080'
-VUE_APP_BASE_API = 'https://www.mingxuejinbang.com/prod-v2'
+#VUE_APP_BASE_API = 'https://www.mingxuejinbang.com/prod-v2'
+VUE_APP_BASE_API = 'https://mxjb.mx.jinliyk.com/prod-v2'
 
 VUE_APP_MOBILE = "https://www.mingxuejinbang.com/h5"
 

+ 5 - 2
src/components/TopNav/index.vue

@@ -36,8 +36,10 @@
 
 <script>
 import { mapGetters } from 'vuex'
+import LoginCheckInterceptor from "@/views/index/blocks/LoginCheckInterceptor";
 
 export default {
+  mixins: [LoginCheckInterceptor],
   data() {
     return {
       // 顶部栏初始数
@@ -63,8 +65,9 @@ export default {
     window.removeEventListener('resize', this.setVisibleNumber)
   },
   methods: {
-    handleClick(data) {
-      this.$store.dispatch('AccessDeepMenu', data)
+    async handleClick(data) {
+      await this.loginCheck()
+      await this.$store.dispatch('AccessDeepMenu', data)
     },
     // 根据宽度计算设置显示栏数
     setVisibleNumber() {

+ 2 - 2
src/store/modules/UserInterceptors.js

@@ -6,12 +6,12 @@ import MxConfig from '@/common/MxConfig'
 const checkMobileBind = async function(state, getters, ignore) {
   // 暂无需求乎略手机号绑定校验
   // 卡号登陆需要绑定手机
-  const isBinding = window.location.href.endsWith('/bind')
+  const isBinding = window.location.href.endsWith('/login')
   if (!isBinding && !getters.isBind && !getters.isMobileBind) {
     setTimeout(async() => {
       const msg = '您的账号还没有绑定手机,请先完善基础信息'
       await MessageBox.alert(msg, { type: 'warning', showClose: false })
-      router.push('/bind')
+      router.push('/login')
     }, 200)
     return false
   }

+ 5 - 0
src/views/career/zhiyuan/NewSimulatedVolunteer.vue

@@ -68,6 +68,11 @@ import TransferMixin from '@/components/TransferMixin'
 import SearchMajorProviderMixin from '@/views/career/zhiyuan/components/SearchMajorProviderMixin'
 import VoluntarySaveRouteGuard from '@/views/career/zhiyuan/components/VoluntarySaveRouteGuard'
 import VoluntaryIdentifierProvider from '@/views/career/zhiyuan/components/VoluntaryIdentifierProvider'
+import MxConst from "@/common/MxConst";
+import MxConfig from "@/common/MxConfig";
+import {MessageBox} from "element-ui";
+import router from "@/router";
+import {debounce} from "@/utils";
 
 export default {
   components: {

+ 18 - 1
src/views/index/blocks/index-login-check-mixin.js

@@ -1,4 +1,8 @@
 import { mapGetters } from 'vuex'
+import MxConst from "@/common/MxConst";
+import MxConfig from "@/common/MxConfig";
+import {MessageBox} from "element-ui";
+import router from "@/router";
 
 export default {
   provide() {
@@ -13,7 +17,20 @@ export default {
     loginStatusCheck() {
       // 首页统一注入登陆检测方法,未登陆时直接跳至登陆框
       if (this.isLogin) {
-        if (!!this.currentUser?.isBind) return Promise.resolve(true)
+        if (!!this.currentUser?.isBind) {
+
+          const { scoreLock, scoreLockingMsg } = this.currentUser
+          if (scoreLock == MxConst.enum.scoreLock.locking) {
+            setTimeout(async() => {
+              const msg = scoreLockingMsg || MxConfig.scoreLockingTips
+              await MessageBox.alert(msg, { type: 'warning', showClose: false })
+              router.push('/user/info/userinfo')
+            }, 200)
+            return Promise.reject(false)
+          }
+
+          return Promise.resolve(true)
+        }
 
         this.dialogVisible = true
         this.$message.error('请先完善信息!')

+ 1 - 0
src/views/index/login.vue

@@ -155,6 +155,7 @@ export default {
       this.dialogVisible = !this.currentUser.isBind
       await this.CheckRoutes(true)
       await this.GetInfo()
+      setTimeout(() => this.loginStatusCheck(), 500)
     }
   }
 }

+ 5 - 5
src/views/system/user/profile/index.vue

@@ -64,6 +64,7 @@
 </template>
 
 <script>
+import {mapGetters} from 'vuex'
 import userAvatar from "./userAvatar";
 import userInfo from "./userInfo";
 import resetPwd from "./resetPwd";
@@ -83,6 +84,9 @@ export default {
       title:''
     };
   },
+  computed: {
+    ...mapGetters(['currentUser'])
+  },
   created() {
     this.name =  this.$route.name
     this.title  =  this.$route.meta.title
@@ -94,11 +98,7 @@ export default {
   },
   methods: {
     getUser() {
-      getUserProfile().then(response => {
-        this.user = response.data;
-        this.roleGroup = response.roleGroup;
-        this.postGroup = response.postGroup;
-      });
+      this.user = {...this.currentUser}
     }
   }
 };

+ 54 - 16
src/views/system/user/profile/userInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-form ref="form" :model="user" :rules="rules" label-width="80px">
+    <el-form ref="form" :model="user" :rules="rules" label-width="120px">
       <el-form-item label="用户名称" prop="userName">
         <el-input v-model="user.userName" disabled="disabled" maxlength="50"/>
       </el-form-item>
@@ -27,11 +27,20 @@
           <el-radio label="1">女</el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item>
-        <el-button type="primary" size="mini" @click="submit">保存</el-button>
-        <!--<el-button type="danger" size="mini" @click="close">关闭</el-button>-->
-      </el-form-item>
     </el-form>
+    <simulate-score
+      ref="score"
+      :form="scoreModel"
+      :disabled="!user.provinceName"
+      :hidden-ranking="true"
+      :province-name="user.provinceName"
+      :disable-required="disableScoreRequired"
+      :keep-value="true"
+      class="scoreForm"
+    />
+    <div class="mb30 ml60 pl60">
+      <el-button type="primary" size="mini" @click="submit">保存</el-button>
+    </div>
     <el-dialog :visible.sync="dialogVisible" title="变更手机号" width="450px">
       <reset-mobile-form @cancel="dialogVisible=false" @completed="dialogVisible=false,GetInfo()"></reset-mobile-form>
     </el-dialog>
@@ -42,20 +51,30 @@
 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: { ResetMobileForm },
+  components: {SimulateScore, ResetMobileForm },
   props: {
     user: {
       type: Object
     }
   },
   computed: {
-    ...mapGetters(['isFrontStudent'])
+    ...mapGetters(['isFrontStudent']),
+    disableScoreRequired() {
+      return this.user.scoreLock == MxConst.enum.scoreLock.unlock
+    }
   },
   data() {
     return {
       dialogVisible: false,
+      scoreModel: {
+        score: '',
+        firstSubject: '',
+        lastSubject: ''
+      },
       // 表单校验
       rules: {
         nickName: [
@@ -64,17 +83,27 @@ export default {
       }
     }
   },
+  mounted() {
+    const mode = this.user.mode?.split(',') || []
+    this.scoreModel.score = this.user.score
+    this.scoreModel.firstSubject = mode.first() || ''
+    this.scoreModel.lastSubject = mode.length > 1 ? mode.slice(1) : []
+  },
   methods: {
     ...mapActions(['GetInfo']),
-    submit() {
-      this.$refs['form'].validate((valid) => {
-        if (valid) {
-          updateUserProfile(this.user).then((response) => {
-            this.msgSuccess('修改成功')
-            this.GetInfo()
-          })
-        }
-      })
+    async submit() {
+      const validates = [this.$refs.form.validate(), this.$refs.score.validate()]
+      await Promise.all(validates)
+
+      const mode = [this.scoreModel.firstSubject].concat(this.scoreModel.lastSubject)
+      const commit = {
+        ...this.user,
+        mode: mode.toString(),
+        score: this.scoreModel.score
+      }
+      await updateUserProfile(commit)
+      this.msgSuccess('修改成功')
+      await this.GetInfo()
     },
     close() {
       this.$store.dispatch('tagsView/delView', this.$route)
@@ -91,4 +120,13 @@ export default {
 /deep/ .el-radio {
   display: inline-block;
 }
+
+.scoreForm.form {
+  padding: 0;
+  width: auto;
+}
+
+.scoreForm.form >>> .el-form-item__label {
+  padding-right: 12px;
+}
 </style>