Browse Source

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

zhousheng 4 years ago
parent
commit
66cda4f033

+ 3 - 2
TEAMModelFunction/MonitorCosmosDB.cs

@@ -24,12 +24,13 @@ namespace TEAMModelFunction
             collectionName: "School",
             ConnectionStringSetting = "CosmosConnection",
             LeaseCollectionName = "leases")]IReadOnlyList<Document> input, ILogger log)
-        {           
+        {          
                 if (input != null && input.Count > 0)
                 {
                     log.LogInformation("Documents modified " + input.Count);
                     log.LogInformation("First document Id " + input[0].Id);
-                }           
+                }
+            //_clientFactory.CreateClient().
         }
     }
 }

+ 3 - 3
TEAMModelFunction/MonitorServicesBus.cs

@@ -7,11 +7,11 @@ namespace TEAMModelFunction
 {
     public static class MonitorServicesBus
     {
-        [FunctionName("test_queue_activetask")]
-        public static void Run([ServiceBusTrigger("test_queue_activetask", Connection = "ServiceBusConnection")]string myQueueItem, ILogger log)
+/*        [FunctionName("test_queue_activetask")]
+        public static void Run([ServiceBusTrigger("test_topic_ActiveTask", Connection = "ServiceBusConnection")]string myQueueItem, ILogger log)
         {
             ///ÖØÊÔ´ÎÊý
             log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
-        }
+        }*/
     }
 }

+ 40 - 0
TEAMModelFunction/ServiceBusTopic.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using System.Threading.Tasks;
+using Azure.Cosmos;
+using Microsoft.Azure.WebJobs;
+using Microsoft.Azure.WebJobs.Host;
+using Microsoft.Extensions.Logging;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK.Extension;
+
+namespace TEAMModelFunction
+{
+    public   class ServiceBusTopic
+    {
+        private readonly AzureCosmosFactory _azureCosmos;
+        public ServiceBusTopic(  AzureCosmosFactory azureCosmos)
+        {
+            _azureCosmos = azureCosmos;
+        }
+        [FunctionName("ServiceBusTopic")]
+        public async Task Run([ServiceBusTrigger("test_topic_ActiveTask", "test_topic_ReciveTask", Connection = "ConnectionBusName")]string mySbMsg, ILogger log)
+        {
+            log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
+            var client = _azureCosmos.GetCosmosClient();
+            List<object> classes = new List<object>();
+            await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: $"select value(c) from c",requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-hbcn") }))
+            {
+                using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                {
+                    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                    {
+                        classes.Add(obj.ToObject<object>());
+                    }
+                }
+            }
+        }
+    }
+}

+ 7 - 2
TEAMModelFunction/Startup.cs

@@ -1,19 +1,24 @@
 using Microsoft.Azure.Functions.Extensions.DependencyInjection;
+using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.IO;
 using System.Reflection;
 using System.Text;
+using TEAMModelOS.SDK.DI;
 
 [assembly: FunctionsStartup(typeof(TEAMModelFunction.Startup))]
 namespace TEAMModelFunction
 {
     public class Startup : FunctionsStartup
-    {
+    { 
         public override void Configure(IFunctionsHostBuilder builder)
         {
-            builder.Services.AddHttpClient();            
+         //   builder.Services.con
+            builder.Services.AddHttpClient();
+            builder.Services.AddOptions<string>("AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;");
         }
     }
 }

+ 3 - 0
TEAMModelFunction/TEAMModelFunction.csproj

@@ -3,6 +3,9 @@
     <TargetFramework>netcoreapp3.1</TargetFramework>
     <AzureFunctionsVersion>v3</AzureFunctionsVersion>
   </PropertyGroup>
+  <ItemGroup>
+    <Compile Remove="AServiceBus.cs" />
+  </ItemGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
     <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.7" />

+ 1 - 7
TEAMModelOS/ClientApp/src/api/learnActivity.js

@@ -58,7 +58,7 @@ export default {
      *删除最小单元
      */
     DeleteUnit: function (data) {
-        return post('/api/Learn/DeleteUnit', data)
+        return post('/teacher/learn/delete-unit', data)
     },
     /*
     *根据id数组查询资源文件
@@ -193,12 +193,6 @@ export default {
         return post('/api/Learn/DeleteProcess', data)
     },
     /*
-    *删除最小单元
-    */
-    DeleteUnit: function (data) {
-        return post('/api/Learn/DeleteUnit', data)
-    },
-    /*
     * 新增或者修改投票活动
     */
     SaveorUpdataVote: function (data) {

+ 127 - 97
TEAMModelOS/ClientApp/src/components/learnactivity/NewChooseContent.vue

@@ -66,7 +66,7 @@
                         </div>
                         <div class="content-filter-item">
                             <span class="content-filter-label">类型:</span>
-                            <RadioGroup v-model="contentFilter.fileType" style="display:inline-block;" @on-change="filterContentByType">
+                            <RadioGroup v-model="contentFilter.fileType" style="display:inline-block;" @on-change="getFileList">
                                 <Radio class="radio-width" :key="index" v-for="(item,index) in contentTypeList" :label="item.type">{{item.label}}</Radio>
                             </RadioGroup>
                         </div>
@@ -89,12 +89,14 @@
                             <template slot-scope="{ row, index }" slot="name">
                                 <div>
                                     <div class="file-icon">
-                                        <img v-if="row.extension == 'ppt' || row.extension == 'pptx'" src="../../assets/icon/ppt50.png" width="15" />
-                                        <img v-else-if="row.extension == 'doc' || row.extension == 'docx'" src="../../assets/icon/word50.png" width="15" />
-                                        <img v-else-if="row.extension == 'xls' || row.extension == 'xlsx'" src="../../assets/icon/xls50.png" width="15" />
-                                        <img v-else-if="row.extension == 'pdf'" src="../../assets/icon/pdf50.png" width="15" />
-                                        <img v-else-if="row.type == 'picture'" src="../../assets/icon/icon_img.png" width="15" />
+                                        <img v-if="row.extension == 'PPT' || row.extension == 'PPTX'" src="../../assets/icon/ppt50.png" width="15" />
+                                        <img v-else-if="row.extension == 'DOC' || row.extension == 'DOCX'" src="../../assets/icon/word50.png" width="15" />
+                                        <img v-else-if="row.extension == 'XLS' || row.extension == 'XLSX' || row.extension == 'CSV'" src="../../assets/icon/xls50.png" width="15" />
+                                        <img v-else-if="row.extension == 'PDF'" src="../../assets/icon/pdf50.png" width="15" />
+                                        <img v-else-if="row.extension == 'ZIP' || row.extension == 'RAR'" src="../../assets/icon/zip50.png" width="15" />
+                                        <img v-else-if="row.type == 'image'" src="../../assets/icon/icon_img.png" width="15" />
                                         <img v-else-if="row.type == 'video'" src="../../assets/icon/icon_video.png" width="15" />
+                                        <img v-else-if="row.type == 'res'" src="../../assets/icon/htex.png" width="15" />
                                         <img v-else src="../../assets/icon/prelearn50.png" width="15" />
                                     </div>
                                     <span style="margin-left:8px;vertical-align: text-bottom;">{{row.name}}</span>
@@ -177,9 +179,9 @@
                             <div>
                                 <EmptyData v-if="questionList.length == 0"></EmptyData>
                             </div>
-                            <div class="page-wrap">
+                            <!--<div class="page-wrap">
                                 <Page :current.sync="pageNum" :total="totalNum" :page-size="pageSize" size="small" show-total show-sizer @on-change="getCurrentPageData" />
-                            </div>
+                            </div>-->
                         </div>
                     </vuescroll>
                 </div>
@@ -254,13 +256,13 @@
                 },
                 contentFilter: {
                     scope: 'private',
-                    fileType: 'teach'
+                    fileType: 'res'
                 },
                 keyWord: '',
                 contentTypeList: [
                     {
                         label: '教材',
-                        type: 'teach',
+                        type: 'res',
                     },
                     {
                         label: this.$t('teachContent.filterPicture'),
@@ -270,9 +272,13 @@
                         label: this.$t('teachContent.filterVideo'),
                         type: 'video',
                     },
+                    {
+                        label: '音频',
+                        type: 'audio',
+                    },
                     {
                         label: this.$t('teachContent.filterDoc'),
-                        type: 'document',
+                        type: 'doc',
                     },
                     {
                         label: this.$t('teachContent.filterOther'),
@@ -280,8 +286,22 @@
                     }
                 ],
                 fileList: {
-                    school: [],
-                    private: []
+                    school: {
+                        res: [],
+                        image: [],
+                        video: [],
+                        audio: [],
+                        doc: [],
+                        other: []
+                    },
+                    private: {
+                        res: [],
+                        image: [],
+                        video: [],
+                        audio: [],
+                        doc: [],
+                        other:[]
+                    }
                 },
                 selectedFiles: [],
                 fileListShow: [],
@@ -393,10 +413,11 @@
              */
             queryQuestionByPage() {
                 let queryData = {
-                    '@CURRPAGE': this.pageNum,
-                    '@PAGESIZE': this.pageSize,
+                    //'@CURRPAGE': this.pageNum,
+                    //'@PAGESIZE': this.pageSize,
                     '@DESC': "createTime",
                     'code': this.questionFilter.code,
+                    'scope': this.questionFilter.code == this.$store.state.userInfo.TEAMModelId ? 'private':'school',
                     'periodId': this.questionFilter.periodId == "" ? [] : [this.questionFilter.periodId],
                     'level': this.deleteAll(this.questionFilter.level),
                     'type': this.deleteAll(this.questionFilter.type),
@@ -404,27 +425,21 @@
                     'subjectId': this.questionFilter.subjectId == "" ? [] : [this.questionFilter.subjectId],
                 }
                 this.isLoading = true
-                this.$api.newEvaluation.FindExerciseList(queryData).then(async res => {
-                    let privateSas = await this.$tools.getPrivateSas()
-                    let schoolSas = await this.$tools.getSchoolSas()
+                this.$api.newEvaluation.FindExerciseList(queryData).then(res => {
+                    
                     /* 拿到Summary的题目之后要通过每个题目的JSON URL 换取完整题目数据 */
                     let list = res.items
-                    list.forEach(async (i, index) => {
-                        if (i.url) {
-                            try {
-                                let sasString = i.code === this.$store.state.userInfo.TEAMModelId ? privateSas : schoolSas
-                                let jsonInfo = await this.$tools.getFile(i.url + sasString.sas)
-                                let jsonData = JSON.parse(jsonInfo)
-                                jsonData.id = i.id
-                                jsonData.fileName = i.url.split('/')[i.url.split('/').length - 1].split('.json')[0]
-                                this.$set(list, index, jsonData)
-                            } catch (e) {
-                                this.$Message.warning('存在试题读取异常!')
-                            }
-
+                    this.$evTools.getFullItem(list).then(
+                        (res) => {
+                            this.questionList = res
+                        },
+                        (err) => {
+                            this.$Message.error('题库获取失败')
                         }
-                    })
-                    this.questionList = list
+                    )
+                    
+                    
+                }).finally(() => {
                     setTimeout(() => {
                         this.isLoading = false
                     }, 500)
@@ -536,80 +551,95 @@
                 let type = this.contentFilter.fileType
                 let files = this.fileList[this.contentFilter.scope]
                 this.fileListShow = []
-                switch (type) {
-                    case 'teach':
-                        this.fileListShow = files.filter(item => {
-                            return item.type === 'teach'
-                        })
-                        break
-                    case 'image':
-                        this.fileListShow = files.filter(item => {
-                            return item.type === 'image'
-                        })
-                        break
-                    case 'video':
-                        this.fileListShow = files.filter(item => {
-                            return item.type === 'video'
-                        })
-                        break
-                    case 'doc':
-                        this.fileListShow = files.filter(item => {
-                            return item.type === 'doc'
-                        })
-                        break
-                    case 'other':
-                        this.fileListShow = files.filter(item => {
-                            return item.type === 'other'
-                        })
-                        break
-                }
+                this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter.fileType]
+                //switch (type) {
+                //    case 'res':
+                //        this.fileListShow = files.filter(item => {
+                //            return item.type === 'res'
+                //        })
+                //        break
+                //    case 'image':
+                //        this.fileListShow = files.filter(item => {
+                //            return item.type === 'image'
+                //        })
+                //        break
+                //    case 'video':
+                //        this.fileListShow = files.filter(item => {
+                //            return item.type === 'video'
+                //        })
+                //        break
+                //    case 'doc':
+                //        this.fileListShow = files.filter(item => {
+                //            return item.type === 'doc'
+                //        })
+                //        break
+                //    case 'other':
+                //        this.fileListShow = files.filter(item => {
+                //            return item.type === 'other'
+                //        })
+                //        break
+                //}
                 this.searchBefore = this.fileListShow
                 this.keyWord = ''
                 this.handleCheckStatus()
             },
             //获取文件列表
             async getFileList() {
-                if (this.contentFilter.scope == 'private' && this.fileList[this.contentFilter.scope].length == 0) {
-                    let sasRes = await this.$tools.getPrivateSas()
-                    let op1 = new BlobTool(sasRes.url, sasRes.name, sasRes.sas, this.contentFilter.scope)
-                    op1.listBlob({
-                        prefix: 'res'
-                    }).then(
-                        (res) => {
-                            this.fileList[this.contentFilter.scope] = res.blobList
-                            this.fileListShow = this.fileList[this.contentFilter.scope].filter((item) => {
-                                return item.type == this.contentFilter.fileType
-                            })
-                            this.searchBefore = [...this.fileListShow]
-                        },
-                        (err) => {
-                            this.$Message.error('API Error')
-                        }
-                    )
-                } else if (this.contentFilter.scope == 'school' && this.fileList[this.contentFilter.scope].length == 0) {
-                    let sasRes = await this.$tools.getSchoolSas()
-                    let op1 = new BlobTool(sasRes.url, sasRes.name, sasRes.sas, this.contentFilter.scope)
-                    op1.listBlob({
-                        prefix: 'res'
-                    }).then(
-                        (res) => {
-                            this.fileList[this.contentFilter.scope] = res.blobList
-                            this.fileListShow = this.fileList[this.contentFilter.scope].filter((item) => {
-                                return item.type == this.contentFilter.fileType
-                            })
-                            this.searchBefore = [...this.fileListShow]
-                        },
-                        (err) => {
-                            this.$Message.error('API Error')
-                        }
-                    )
+                if (this.fileList[this.contentFilter.scope][this.contentFilter.fileType].length == 0) {
+                    let sasRes
+                    if (this.contentFilter.scope == 'private') {
+                        sasRes = await this.$tools.getPrivateSas()
+                    } else if (this.contentFilter.scope == 'school'){
+                        sasRes = await this.$tools.getSchoolSas()
+                    }
+                    if (sasRes) {
+                        let op1 = new BlobTool(sasRes.url, sasRes.name, sasRes.sas, this.contentFilter.scope)
+                        op1.listBlob({
+                            prefix: this.contentFilter.fileType
+                        }).then(
+                            (res) => {
+                                this.fileList[this.contentFilter.scope][this.contentFilter.fileType] = res.blobList
+                                this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter.fileType]
+                                this.searchBefore = [...this.fileListShow]
+                            },
+                            (err) => {
+                                this.$Message.error('API Error')
+                            }
+                        )
+                    } else {
+                        this.$Message.error('获取Blob授权信息失败')
+                    }
                 } else {
-                    this.fileListShow = this.fileList[this.contentFilter.scope].filter((item) => {
-                        return item.type == this.contentFilter.fileType
-                    })
+                    this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter.fileType]
                     this.searchBefore = [...this.fileListShow]
                     this.handleCheckStatus()
                 }
+
+                //if (this.contentFilter.scope == 'private' && this.fileList[this.contentFilter.scope][this.contentFilter.fileType].length == 0) {
+                //    let sasRes = await this.$tools.getPrivateSas()
+                //    let op1 = new BlobTool(sasRes.url, sasRes.name, sasRes.sas, this.contentFilter.scope)
+                //    op1.listBlob({
+                //        prefix: this.contentFilter.fileType
+                //    }).then(
+                //        (res) => {
+                //            this.fileList[this.contentFilter.scope][this.contentFilter.fileType] = res.blobList
+                //            this.fileListShow = this.fileList[this.contentFilter.scope][this.contentFilter.fileType]
+                //            this.searchBefore = [...this.fileListShow]
+                //        },
+                //        (err) => {
+                //            this.$Message.error('API Error')
+                //        }
+                //    )
+                //} else if (this.contentFilter.scope == 'school' && this.fileList[this.contentFilter.scope].length == 0) {
+                //    let sasRes = await this.$tools.getSchoolSas()
+                    
+                //} else {
+                //    this.fileListShow = this.fileList[this.contentFilter.scope].filter((item) => {
+                //        return item.type == this.contentFilter.fileType
+                //    })
+                //    this.searchBefore = [...this.fileListShow]
+                //    this.handleCheckStatus()
+                //}
             },
             selectVolume(index) {
                 this.currentVolumeIndex = index

+ 3 - 3
TEAMModelOS/ClientApp/src/components/learnactivity/QuestionList.less

@@ -6,15 +6,15 @@
 @second-fontSize: 16px;
 
 .question-item-wrap {
-    background-color: #505050;
+    background-color: #454545;
     margin-bottom: 3px;
     padding: 10px 30px 10px 10px;
     position: relative;
     border-radius: 4px;
 
     &:hover {
-        background: #525252;
-        transform: translate(-2px,-2px);
+        background: #606060;
+        /*transform: translate(-2px,-2px);*/
         transition: all .1s;
         box-shadow: 1px 4px 5px #191919;
     }

+ 5 - 2
TEAMModelOS/ClientApp/src/view/classrecord/ClassRecord.vue

@@ -4,9 +4,9 @@
             <div style="padding: 1% 3% 0px 3%;">
                 <!--头部信息-->
                 <div class="class-record-header">
-                    <span class="course-name">物理</span>
+                    <span class="course-name">数学</span>
                     <span class="record-name">
-                        力的组成
+                        速度与时间
                     </span>
                     <div style="float:right;">
                         <span class="label-text">
@@ -753,6 +753,9 @@
     @import "./ClassRecord.less";
 </style>
 <style>
+    .class-content .vjs-progress-holder {
+        font-size:10px !important;
+    }
     .mouse-over-status .vjs-control-bar {
         opacity: 1 !important;
     }

+ 20 - 3
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -591,12 +591,29 @@
             },
             //删除个人课程
             delCourse() {
-                let _this = this
                 this.$Modal.confirm({
                     title: '删除课程',
                     content: `确认删除${this.courseListP[this.curCusIndex].name}吗?`,
-                    onOk: function () {
-                        _this.$Message.warning('暂未对接API')
+                    onOk:()=> {
+                        this.$Message.warning('暂未对接API')
+                        this.$api.courseMgmt.deleteCourse({
+                            id: '',
+                            code: '',
+                            scope: ''
+                        }).then(
+                            res => {
+                                if (!res.error) {
+                                    let index = this.curCusIndex
+                                    this.courseListP.splice(index,1)
+                                    this.$Message.success('删除成功!')
+                                } else {
+                                    this.$Message.error('删除失败!')
+                                }
+                            },
+                            err => {
+                                this.$Message.error('删除失败!')
+                            }
+                        )
                     }
                 })
             },