liqk 4 лет назад
Родитель
Сommit
6ce3bf98ad

+ 4 - 1
TEAMModelOS/ClientApp/src/locale/lang/en-US/cusMgt.js

@@ -245,6 +245,9 @@ export default {
         listLabel:'名单:',
         joinBtn:'立即加入',
         errorTile:'信息错误',
-        errorContent:'课程名单获取失败,请重新扫码加入!'
+        errorContent:'课程名单获取失败,请重新扫码加入!',
+        joinOk:'加入成功',
+        joinErr:'加入失敗',
+        getListErr:'獲取名單信息失敗'
     }
 }

+ 4 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/cusMgt.js

@@ -245,6 +245,9 @@ export default {
         listLabel:'名单:',
         joinBtn:'立即加入',
         errorTile:'信息错误',
-        errorContent:'课程名单获取失败,请重新扫码加入!'
+        errorContent:'课程名单获取失败,请重新扫码加入!',
+        joinOk:'加入成功',
+        joinErr:'加入失败',
+        getListErr:'获取名单信息失败'
     }
 }

+ 4 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/cusMgt.js

@@ -245,6 +245,9 @@ export default {
         listLabel:'名單:',
         joinBtn:'立即加入',
         errorTile:'信息錯誤',
-        errorContent:'課程名單獲取失敗,請重新掃碼加入! '
+        errorContent:'課程名單獲取失敗,請重新掃碼加入! ',
+        joinOk:'加入成功',
+        joinErr:'加入失敗',
+        getListErr:'獲取名單信息失敗'
     }  
 }

+ 48 - 13
TEAMModelOS/ClientApp/src/view/joinclass/JoinClass.vue

@@ -5,9 +5,6 @@
                 <span>
                     {{$t('cusMgt.join.title')}}
                 </span>
-                <!-- <Divider dashed plain class="join-title">
-                    加入课程名单
-                </Divider> -->
             </p>
             <p class="course-name">{{cusName || $t('cusMgt.join.errorInfo')}}</p>
             <div style="width:fit-content;margin: auto;">
@@ -29,7 +26,7 @@
                 </p>
             </div>
 
-            <div class="join-btn" @click="joinList()">
+            <div class="join-btn" @click="findList()">
                 {{$t('cusMgt.join.joinBtn')}}
             </div>
         </div>
@@ -44,11 +41,52 @@ export default {
             listId: '',
             listName: '',
             cusName: '',
+            tmid: ''
         }
     },
     methods: {
-        joinList() {
-            this.$Message.warning('暂未对接API')
+        joinList(stulist) {
+            if (stulist) {
+                stulist.tmids.push(this.tmid)
+                this.$api.courseMgmt.upsertStulist({
+                    scope: 'private',
+                    stuList: stulist
+                }).then(
+                    res => {
+                        if (!res.error) {
+                            this.$Message.success(this.$t('cusMgt.join.joinOk'))
+                        } else {
+                            this.$Message.error(this.$t('cusMgt.join.joinErr'))
+                        }
+                    },
+                    err => {
+                        this.$Message.error(this.$t('cusMgt.join.joinErr'))
+                    }
+                )
+            } else {
+                this.$Message.error(this.$t('cusMgt.join.getListErr'))
+            }
+        },
+        //查询名单详细信息
+        findList() {
+            let params = {
+                code: this.tId,
+                ids: [this.listId],
+                scope: 'private'
+            }
+            this.$api.courseMgmt.findListSummary(params).then(
+                res => {
+                    if (!res.error && res.stulist && res.stulist.length) {
+                        console.log(res)
+                        this.joinList(res.stulist[0])
+                    } else {
+                        this.$Message.error(this.$t('cusMgt.join.getListErr'))
+                    }
+                },
+                err => {
+                    this.$Message.error(this.$t('cusMgt.join.getListErr'))
+                }
+            )
         }
     },
     created() {
@@ -77,29 +115,26 @@ export default {
     background-image: url("../../assets/image/bak_light.jpg");
 }
 .join-btn {
-    // width: fit-content;
     width: 100%;
     margin: auto;
     margin-top: 60px;
     text-align: center;
     border: 1px solid rgba(25, 190, 107, 0.5);
-    color: rgba(25, 190, 107, 1);
+    // color: rgba(25, 190, 107, 1);
+    color: white;
     padding: 4px 30px;
     border-radius: 5px;
     font-size: 16px;
     letter-spacing: 2px;
     font-weight: 400;
     user-select: none;
-    &:hover {
-        background: rgba(25, 190, 107, 0.5);
-        color: white;
-    }
+    background: rgba(25, 190, 107, 0.5);
 }
 .course-name {
     color: white;
     margin-bottom: 15px;
     font-size: 30px;
-    font-family: cursive;
+    // font-family: cursive;
 }
 .join-main-box {
     max-width: 90%;

+ 13 - 4
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -330,6 +330,7 @@ import PersonalPhoto from '@/components/public/personalPhoto/Index.vue'
 import E from '@/utils/wangEditor.js'
 import StudentList from '@/components/coursemgt/StudentList.vue'
 import TeaTable from './TeaTable.vue'
+import jwtDecode from 'jwt-decode'
 export default {
     components: {
         StudentList, PersonalPhoto, TeaTable
@@ -1001,7 +1002,7 @@ export default {
             //这里需要根据站点动态拼接域名
             let addr = this.$store.state.config.srvAdr
             let type = this.$store.state.config.srvAdrType
-            let host
+            let host, clientId
             //国际站
             if (addr == 'Global') {
                 if (type == 'product') {
@@ -1011,6 +1012,7 @@ export default {
                     // 测试站
                     host = this.$store.state.config[addr].domainUrl[1].url
                 }
+                clientId = this.$store.state.config.Global.clientID
             }
             // 大陆站
             else {
@@ -1019,10 +1021,17 @@ export default {
                 } else {
                     host = this.$store.state.config.China.domainUrl[1].url
                 }
+                clientId = this.$store.state.config.China.clientID
             }
-            let url = `${host}/joinclass?tId=${tId}&listName=${listName}&tName=${tName}&listId=${listId}&cusName=${cusName}`
-            console.log(url)
-            this.createQRCode(url)
+            let state = this.$jsFn.getBtwRandom(1000,9999)
+            let idToken = localStorage.getItem('id_token')
+            let tokenData = jwtDecode(idToken)
+            let nonce = tokenData ? tokenData.nonce : ''
+            let callbackUrl = `${host}/joinclass?tId=${tId}&listName=${listName}&tName=${tName}&listId=${listId}&cusName=${cusName}`
+            let dcUrl = encodeURIComponent(callbackUrl)
+            let loginUrl = `https://account-rc.teammodel.cn?response_type=code&client_id=${clientId}&state=${state}&nonce=${nonce}&redirect_uri=${dcUrl}`
+            console.log(loginUrl)
+            this.createQRCode(loginUrl)
         },
         //确认添加自定义名单
         confirmCreateList() {