Browse Source

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

CrazyIter_Bin 4 years ago
parent
commit
cad5163727

+ 4 - 0
TEAMModelOS/ClientApp/src/api/service.js

@@ -4,4 +4,8 @@ export default {
     getNotification: function (data) {
         return post('https://api2.teammodel.net/service/getnotification', data)
     },
+    /* 获取id详细信息 */
+    getIdProfile: function (host,data) {
+        return post(`${host}/oauth2/profile`, data)
+    },
 }

+ 2 - 2
TEAMModelOS/ClientApp/src/static/Global.js

@@ -2,8 +2,8 @@ import i18n from '../locale/index.js'
 import Vue from 'vue'
 import VueI18n from 'vue-i18n'
 
-const PRIVATE_SPACE = 1024 * 1024 * 1024 * 1 //教师Blob个人空间
-const SCHOOL_SPACE = 1024 * 1024 * 1024 * 10 //学校Blob空间
+var PRIVATE_SPACE = 1024 * 1024 * 1024 * 1 //教师Blob个人空间
+var SCHOOL_SPACE = 1024 * 1024 * 1024 * 10 //学校Blob空间
 const DEFAULT_SCHOOL_CODE = 'SYSTEM_NO_SCHOOL' //尚未归属学校的默认学校编码
 
 //文件类型,对应内容模块Blob目录

+ 42 - 6
TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue

@@ -7,17 +7,16 @@
         </p>
         <div class="verify-status">
             <!-- 如果是大陆站需要验证是否完成手机号认证 -->
-            <div class="verify-status-box" v-if="$store.state.userInfo.hasVerify">
+            <div v-show="srvAdr == 'China'" class="verify-status-box" v-if="!hasVerify">
                 <Icon custom="iconfont icon-phone-unverify" class="tips-icon" />
                 <b class="verify-title">{{$t('home.verifyPh')}}</b>
                 <router-link to="/regist" class="to-verify">{{$t('home.toPhone')}}</router-link>
             </div>
-            <div class="verify-status-box" v-else>
+            <div v-show="srvAdr == 'China'" class="verify-status-box" v-else>
                 <Icon type="md-checkmark-circle-outline" class="tips-icon" color="#19be6b" />
                 <p class="phone-tips">
                     <span style="font-size:16px;color:white">{{$t('home.phoneSuccess')}}</span>
                     <br />
-                    <span style="font-size:12px">(暂未对接API)</span>
                 </p>
                 <span class="has-verify">{{$t('home.hasBanding')}}</span>
             </div>
@@ -323,6 +322,7 @@ import AcCountPie from "./AcCountPie.vue"
 import TechScore from "./TechScore.vue"
 import TeachScore from "./TeachScore.vue"
 import MinTable from "./MinTable.vue"
+import jwtDecode from 'jwt-decode'
 export default {
     components: {
         AcCountPie, TechScore, TeachScore, MinTable
@@ -333,7 +333,9 @@ export default {
             split2: 0.5,
             split3: 0.5,
             itemCount: 10,
-            tmwCus: []
+            tmwCus: [],
+            srvAdr:'China',
+            hasVerify: false, //是否完成手机号验证
         }
     },
     methods: {
@@ -375,15 +377,49 @@ export default {
             this.$router.push({
                 path: '/home/settings'
             })
+        },
+        // 获取账号详细信息,用来验证大陆站用户是否完成手机号绑定
+        getIdInfo() {
+            let host = this.$store.state.config.China.coreAPIUrl
+            let clientId = this.$store.state.config.China.clientID
+            let idToken = localStorage.getItem('id_token')
+            let tokenData = jwtDecode(idToken)
+            let nonce = tokenData ? tokenData.nonce : ''
+            let params = {
+                "grant_type": "get",
+                "nonce": nonce,
+                "client_id": clientId,
+                "id_token": idToken
+            }
+            this.$api.service.getIdProfile(host, params).then(
+                res => {
+                    console.log(res)
+                    if(!res.error){
+                        if(res.mobile) this.hasVerify = true
+                    }else{
+                        this.$Message.error('API Error')
+                    }
+                },
+                err => {
+                    console.log(err)
+                }
+            )
+
         }
     },
     created() {
+        this.srvAdr = this.$store.state.config.srvAdr
+        //只有大陆站才验证手机号
+        if (this.srvAdr == 'China'){
+            this.getIdInfo()
+        }else{
+            this.hasVerify = true
+        }
     },
     computed: {
         //暂时只验证加入学校, 手机号需要对接API
         isComplete() {
-            // return this.$store.state.userInfo.hasSchool && this.$store.state.userInfo.hasVerify
-            return this.$store.state.userInfo.hasSchool
+            return this.$store.state.userInfo.hasSchool && this.hasVerify
         }
     }
 }

+ 0 - 1
TEAMModelOS/ClientApp/src/view/homepage/MinTable.vue

@@ -285,7 +285,6 @@ export default {
         },
         getNextDay() {
             let today = new Date().getDay()
-            console.log('今天是',today)
             let tomorrow
             if (today < 7) {
                 tomorrow = ++today