Forráskód Böngészése

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

liqk 4 éve
szülő
commit
eca088de10

+ 2 - 0
TEAMModelOS/ClientApp/src/api/index.js

@@ -28,6 +28,7 @@ import serviceDriveAuth from './serviceDriveAuth'
 import spaceAuth from './spaceAuth'
 import room from './room'
 import mark from './mark'
+import openMgmt from './openMgmt';
 
 export default {
     accessToken,
@@ -57,6 +58,7 @@ export default {
     spaceAuth,
     room,
     mark,
+    openMgmt,
 
     // 获取登录跳转链接
     getLoginLink: function (data) {

+ 25 - 3
TEAMModelOS/ClientApp/src/api/openMgmt.js

@@ -1,11 +1,33 @@
-import { } from '@/api/http';
+import { post } from '@/api/http';
 
 export default{
     /**
      * 开放平台列表
-     * @param {any} data
+     * @param {code: "学校编码"} data
      */
     getOpenList: function (data) {
-        return post('', data)
+        return post('/open-api/find-app', data)
+    },
+    /**
+     * 获取token
+     * @param {id: "应用id", code: "学校编码"} data
+     */
+    getToken: function (data) {
+        return post('/open-api/create-token', data)
+    },
+    /**
+     * 获取api
+     * @param {} data
+     */
+    getApiList: function (data) {
+        return post('/open-api/get', data)
+    },
+    /**
+     * 新增/编辑
+     * @param {} data  新增
+     * @param {id: "应用id"} data  编辑
+     */
+    editOpenInfo: function (data) {
+        return post('/open-api/upsert-app', data)
     }
 }

+ 6 - 6
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/LessonTestReport.vue

@@ -170,7 +170,7 @@
                                 <!-- 作答结果 -->
                                 <div class="TitleRec1"><span style="margin:5px;color:#1472c7">{{$t("studentWeb.exam.report.ansRes")}}:</span></div>
                                 <br />
-                                <div v-if="ansData[index]" style="margin-left:10px" v-html="ansData[index].length > 0 ? ansData[index][0] : $t('studentWeb.exam.report.noAns')"></div>
+                                <div v-if="ansData[index]" style="margin-left:10px" v-html="ansData[index].length > 0 ? ansData[index].join(' ') : $t('studentWeb.exam.report.noAns')"></div>
                             </div>
                         </div>
                         <!-- 参考答案、解析 -->
@@ -507,11 +507,11 @@
                             paper.push(exam[i])
                         }
                     }
-               }
-               this.paperData = [...paper]
-               if (this.paperData.length) {
-                   this.ansData = await this.getItem(this.examInfo.stuAns[0])
-               }
+                }
+                this.paperData = [...paper]
+                if (this.paperData.length) {
+                    this.ansData= await this.getItem(this.examInfo.stuAns[0])
+                }
             },
             closeDetail() {
                 this.closeAnsDetail = !this.closeAnsDetail;

+ 2 - 2
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperTest.vue

@@ -474,7 +474,7 @@
                     let req = {
                         id: this.getItemTitle.id,
                         answer: this.checkers,
-                        studentId: this.userInfo.sub,
+                        studentId: this.getUserInfo.studentId,
                         classId: this.getExamInfo.allClass,
                         subjectId: this.getExamInfo.subject.id,
                         multipleRule: this.getExamInfo.multipleRule,
@@ -589,7 +589,7 @@
                 "getPaperInfo",
                 "getCurrentSubject",
                 "getExamInfo",
-                "userInfo"
+                "getUserInfo"
             ]),
             completeRate() {
                 if (this.examInfo.length) {

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/settings.js

@@ -55,6 +55,7 @@ export default {
 	apiName: '接口名称',
 	apiAddress: '接口地址',
 	apiMethod: '请求方法',
+	apiParams: '参数示例',
 	openKeep: '保存平台',
 	unedit: '取消编辑',
 }

+ 123 - 69
TEAMModelOS/ClientApp/src/view/settings/OpenMgmt2.vue

@@ -67,16 +67,16 @@
                                 ></Input>
                             </FormItem>
                             <FormItem :label="$t('settings.des')">
-                                <Input v-model="openMgInfo.des"
+                                <Input v-model="openMgInfo.descr"
                                        type="textarea"
                                        :autosize="{ minRows: 2, maxRows: 10 }"
                                        :class="isEdit ? '' : 'open-info-disabled'"
                                        :readonly="isEdit ? false : true"></Input>
                             </FormItem>
                             <FormItem :label="$t('settings.openStatus')">
-                                <RadioGroup v-model="openMgInfo.type">
-                                    <Radio label="1" :disabled="isEdit ? false : true">{{ $t("settings.enable") }}</Radio>
-                                    <Radio label="0" :disabled="isEdit ? false : true">{{ $t("settings.disable") }}</Radio>
+                                <RadioGroup v-model="openMgInfo.status">
+                                    <Radio :label="1" :disabled="isEdit ? false : true">{{ $t("settings.enable") }}</Radio>
+                                    <Radio :label="0" :disabled="isEdit ? false : true">{{ $t("settings.disable") }}</Radio>
                                 </RadioGroup>
                             </FormItem>
                         </Form>
@@ -87,7 +87,11 @@
                     <!-- <div class="open-api-header">
                         <span>Api列表</span>
                     </div> -->
-                    <Table ref="selection" :columns="apiListCol" :data="apiList"></Table>
+                    <Table ref="selection"
+                           :columns="apiListCol"
+                           :data="isEdit ? apiList : apiListNow"
+                           @on-select="select"
+                    ></Table>
                     <Page :total="pageTotal" :page-size-opts="pageSizeOpts" size="small" show-sizer show-total />
                 </div>
             </div>
@@ -97,31 +101,19 @@
 
 <script>
 export default {
+    name: "OpenMgmt",
     data() {
         return {
             // 开放平台列表
-            openList: [
-                {
-                    name: "fvrhrthtyjhtyhregr",
-                },
-                {
-                    name: "mfghgjyj",
-                }
-            ],
+            openList: [],
             // 平台信息
-            openMgInfo:{
-                school: "XXXXXXXXXX学校",
-                name: "哈哈哈哈哈哈哈哈哈",
-                des: "屏幕看了上面的几个wfegrh逆回购将",
-                type: "1",
-                token: "zcnjkdfjoiwfjergerghwfhefvsojfoergjorhbnfbkdnvjeroiguitrghbfdvneavnesvbnrbnkbnbrgeirgre"
-            },
+            openMgInfo: {},
             // api表头
             apiListCol: [
                 {
                     type: 'selection',
                     width: 80,
-                    align: 'center'
+                    align: 'center',
                 },
                 {
                     title: this.$t("settings.apiName"),
@@ -129,98 +121,157 @@ export default {
                 },
                 {
                     title: this.$t("settings.apiAddress"),
-                    key: "address",
+                    key: "url",
                 },
                 {
                     title: this.$t("settings.apiMethod"),
                     key: "method",
                 },
                 {
-                    title: this.$t("settings.des"),
-                    key: "des",
+                    title: this.$t("settings.apiParams"),
+                    key: "descr",
                 },
             ],
             // api列表
-            apiList: [
-                {
-                    name: "vdfvd",
-                    address: "fvrhtyjuyjgjg",
-                    method: "get",
-                    des: "侧福晋而破格饿哦通过方能听你提过rfretrhjrtzo南非方恒包括v你的恐怖活动飞机二十分你大概v哪些不能代表的版本太高i不耐烦"
-                },
-                {
-                    name: "vdfvd",
-                    address: "fvrhtyjuyjgjg",
-                    method: "get",
-                    des: "侧福晋而破格饿哦通过方能听你提过"
-                },
-                {
-                    name: "vdfvd",
-                    address: "fvrhtyjuyjgjg",
-                    method: "get",
-                    des: "侧福晋而破格饿哦通过方能听你提过"
-                },
-                {
-                    name: "vdfvd",
-                    address: "fvrhtyjuyjgjg",
-                    method: "get",
-                    des: "侧福晋而破格饿哦通过方能听你提过rfretrhjrtzo南非方恒包括v你的恐怖活动飞机二十分你大概v哪些不能代表的版本太高i不耐烦"
-                },
-                {
-                    name: "vdfvd",
-                    address: "fvrhtyjuyjgjg",
-                    method: "get",
-                    des: "侧福晋而破格饿哦通过方能听你提过"
-                },
-                {
-                    name: "vdfvd",
-                    address: "fvrhtyjuyjgjg",
-                    method: "get",
-                    des: "侧福晋而破格饿哦通过方能听你提过"
-                }
-            ],
+            apiList: [],
+            // 当前应用已有的api 列表
+            apiListNow: [],
             pageTotal: 0,
             pageSizeOpts:[5, 10, 20, 30, 40],
             // 当前下标
             nowIndex: 0,
             isEdit: false, //编辑状态
+            isAdd: false, // 编辑/新增
         }
     },
     mounted () {
-        // this.getOpenList()  
+        // this.getApiList()
+        this.getOpenList()
     },
     methods: {
+        // 获取应用列表
         getOpenList() {
-            let req = {}
-            this.$api.openMgmt.getOpenList(req).then()
+            let list = []
+            let req = {code: this.$store.state.userInfo.schoolCode}
+            this.$api.openMgmt.getOpenList(req).then(
+                res => {
+                    if (res) {
+                        list = res.apps
+                        this.openList = list
+                        this.list(0)
+                    }
+                }, err => {
+                    this.$Message.warning("api获取失败")
+                    setTimeout(() => {
+                        this.isLoading = false
+                    }, 1000)
+            })
+        },
+        // 获取api 列表
+        getApiList() {
+            let reqs = {}
+            this.$api.openMgmt.getApiList(reqs).then(res => {
+                    if (res) {
+                        let list = res.apis
+                        if(list.length > 0) {
+                            list.sort((a, b) => {
+                                return a.auth - b.auth
+                            })
+                        }
+                        this.apiList = list
+                    }
+                }, err => {
+                    this.$Message.warning("api获取失败")
+                    setTimeout(() => {
+                        this.isLoading = false
+                    }, 1000)
+            })
         },
         editOpen (isEdit, isAdd) {
             this.isEdit = isEdit
+            this.isAdd = isAdd
+            this.getApiList()
+            var list = this.apiList
             // 是新增
             if(isAdd) {
-                this.openMgInfo = {type: "0",}
+                var defaultInfo = {
+                    auths: [],
+                    code: "",
+                    descr: null,
+                    icon: null,
+                    id: "",
+                    name: "开放平台应用",
+                    pk: "",
+                    school: this.$store.state.userInfo.schoolCode,
+                    status: 0,
+                    token: "",
+                    ttl: -1
+                }
+                this.openList.unshift(defaultInfo)
+                this.openMgInfo = defaultInfo
+            } else {
             }
         },
         delOpen () {
             this.$Modal.confirm({
                 title: "您确定删除XXXXXX平台吗?",
                 onOk: () => {
-                    this.$Message.info('Clicked ok');
+                    this.$Message.info('删除成功');
                 },
                 onCancel: () => {
-                    this.$Message.info('Clicked cancel');
+                    this.$Message.info('已取消删除');
                 },
             })
         },
         list (index) {
             this.nowIndex = index
+            var info = this.openList[index]
+            this.openMgInfo = info
         },
         // 编辑平台信息
         editMgmt (type) {
+            var that = this
             this.isEdit = type
+            if(type) {
+                let req = {}
+                if(!this.isAdd) {
+                    req = {id: this.openMgInfo.id}
+                }
+                console.log(req);
+                this.$api.openMgmt.editOpenInfo(req).then(res => {
+                        if (res) {
+                            console.log(res)
+                            that.$Message.success("保存成功!");
+                        }
+                    }, err => {
+                        this.$Message.warning("保存失败")
+                        setTimeout(() => {
+                            this.isLoading = false
+                        }, 1000)
+                })
+            } else {
+                console.log(this.openList.filter(i => !i.id).length);
+                this.openList.filter(i => !i.id)
+            }            
         },
         refresh() {
-
+            var that = this
+            let req = {
+                id: this.openMgInfo.id,
+                code: this.openMgInfo.school
+            }
+            this.$api.openMgmt.getToken(req).then(res => {
+                    if (res) {
+                        console.log(res)
+                        this.openMgInfo.token = res.auth_token
+                        that.$Message.success("刷新成功!");
+                    }
+                }, err => {
+                    this.$Message.warning("刷新失败")
+                    setTimeout(() => {
+                        this.isLoading = false
+                    }, 1000)
+            })
         },
         copyToken() {
             var that = this;
@@ -233,6 +284,9 @@ export default {
                 }
             );
         },
+        select() {
+
+        },
     }
 }
 </script>