瀏覽代碼

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

CrazyIter 5 年之前
父節點
當前提交
456d6bd687
共有 22 個文件被更改,包括 1047 次插入515 次删除
  1. 5 0
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs
  2. 62 12
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/SQLHelperParametric.cs
  3. 17 1
      TEAMModelOS/ClientApp/src/api/newEvaluation.js
  4. 1 1
      TEAMModelOS/ClientApp/src/components/learnactivity/QuestionList.less
  5. 16 6
      TEAMModelOS/ClientApp/src/components/learnactivity/QuestionList.vue
  6. 13 0
      TEAMModelOS/ClientApp/src/css/dark-iview-form.less
  7. 1 0
      TEAMModelOS/ClientApp/src/view/Home.vue
  8. 28 6
      TEAMModelOS/ClientApp/src/view/evaluation/index/ExercisesList.css
  9. 250 89
      TEAMModelOS/ClientApp/src/view/evaluation/index/ExercisesList.vue
  10. 26 24
      TEAMModelOS/ClientApp/src/view/evaluation/index/index.vue
  11. 2 149
      TEAMModelOS/ClientApp/src/view/learnactivity/AutoCreate.vue
  12. 15 19
      TEAMModelOS/ClientApp/src/view/learnactivity/CreateEvaluation.vue
  13. 52 0
      TEAMModelOS/ClientApp/src/view/learnactivity/ManageEvaluation.less
  14. 41 3
      TEAMModelOS/ClientApp/src/view/learnactivity/ManageEvaluation.vue
  15. 4 2
      TEAMModelOS/ClientApp/src/view/learnactivity/ManualCreate.vue
  16. 10 0
      TEAMModelOS/ClientApp/src/view/learnactivity/TeacherPreview.less
  17. 136 6
      TEAMModelOS/ClientApp/src/view/learnactivity/TeacherPreview.vue
  18. 219 196
      TEAMModelOS/Controllers/Analysis/AchievementController.cs
  19. 38 1
      TEAMModelOS/Controllers/Test/TestController.cs
  20. 55 0
      TEAMModelOS/Models/Family.cs
  21. 55 0
      TEAMModelOS/Models/SampleCustomerRepository.cs
  22. 1 0
      TEAMModelOS/TEAMModelOS.csproj

+ 5 - 0
TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs

@@ -430,6 +430,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 //    QueryText = sql.ToString()
 
                 //};
+                dict.Remove("@CURRPAGE");
+                dict.Remove("@PAGESIZE");
+                dict.Remove("@ASC");
+                dict.Remove("@DESC");
+
                 StringBuilder sql = new StringBuilder("select  value count(c)  from c");
                 CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql);
                 QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(itemsPerPage, maxItemCount));

+ 62 - 12
TEAMModelOS.SDK/Module/AzureCosmosDBV3/SQLHelperParametric.cs

@@ -71,14 +71,50 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             return sql;
         }
 
-        public static CosmosDbQuery GetSQL(Dictionary<string, object> dict, StringBuilder sql)
+        public static void DictIsNotNULL(Dictionary<string, object> dict)
         {
+            Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
+            foreach (KeyValuePair<string, object> keyValuePair in dict)
+            {
+                if (keyValuePair.Value is JArray array)
+                {
+                    if (array == null || array.Count == 0) keyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
+                }
+                else if (keyValuePair.Value is IList enumerable && !(keyValuePair.Value is String))
+                {
+                    if (enumerable == null || enumerable.Count == 0) keyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
+                }
+                else if (keyValuePair.Value is JsonElement jsonElement && jsonElement.ValueKind is JsonValueKind.Array)
+                {
+
+                    if (jsonElement.EnumerateArray().Count() == 0)
+                    {
+                        keyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
+                    }
+                }
+                else if (keyValuePair.Value is null)
+                {
+                    keyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
+                }
+            }
 
+            if (keyValuePairs.Count > 0)
+            {
+                foreach (KeyValuePair<string, object> keyValuePair in keyValuePairs)
+                {
+                    dict.Remove(keyValuePair.Key);
+                }
+            }
+        }
+
+        public static CosmosDbQuery GetSQL(Dictionary<string, object> dict, StringBuilder sql)
+        {
             if (dict != null)
             {
+                DictIsNotNULL(dict);
                 Dictionary<string, object> parmeters = new Dictionary<string, object>();
 
-                int offsetNum = 0;
+                int offsetNum = -1;
                 int limitNum = 0;
                 bool pageBool = false;
                 GetPageNum(dict, ref offsetNum, ref limitNum, ref pageBool);
@@ -239,15 +275,19 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                    // sql.Append(" Order By c." + "@OrderByValue"+ " DESC " );
                 }
 
-                if (pageBool && offsetNum != 0 && limitNum != 0)
+                if (pageBool && offsetNum != -1 && limitNum != 0)
                 {
                     //sql.Append(" OFFSET " + offsetNum + " LIMIT " + limitNum);
                     sql.Append(" OFFSET " + " @offsetNum " + " LIMIT " + " @limitNum ");
                 }
 
-
+                //替换关键字
                 ReplaceKeyWords(ref sql);
+
+                //参数化查询拼接 参数dict
                 parmeters = GetParmeter(dict, parmeters, offsetNum, limitNum);
+
+
                 CosmosDbQuery cosmosDbQuery = new CosmosDbQuery
                 {
                     QueryText = sql.ToString(),
@@ -260,15 +300,21 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
 
         private static void GetPageNum(Dictionary<string, object> dict, ref int offsetNum, ref int limitNum, ref bool pageBool)
         {
-            dict.TryGetValue("@OFFSET", out object offset);
-            dict.Remove("@OFFSET");
-            dict.TryGetValue("@LIMIT", out object limit);
-            dict.Remove("@LIMIT");
-            if (offset != null && limit != null)
+            dict.TryGetValue("@CURRPAGE", out object page);
+            dict.Remove("@CURRPAGE");
+            dict.TryGetValue("@PAGESIZE", out object limit);
+            dict.Remove("@PAGESIZE");
+            if (page != null && limit != null)
             {
                 pageBool = true;
-                offsetNum = int.Parse(offset.ToString());
                 limitNum = int.Parse(limit.ToString());
+                if (limitNum < 0) {
+                    throw new BizException("PAGESIZE can't be less than 0 !");
+                }
+                offsetNum = (int.Parse(page.ToString()) - 1) * limitNum;
+                if (offsetNum < 0) {
+                    throw new BizException("CURRPAGE can't be less than 1 !");
+                }
             }
         }
 
@@ -535,7 +581,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                         aa++;
                     }
                 }
-                else if (value is JsonElement jsonElement && jsonElement.ValueKind! is JsonValueKind.Array)
+                else if (value is JsonElement jsonElement && jsonElement.ValueKind is JsonValueKind.Array)
                 {
                     int aa = 0;
                     foreach (JsonElement obja in jsonElement.EnumerateArray().ToArray())
@@ -562,6 +608,10 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                     {
                         sql1 = logicOper + "Contains(  c." + key + " ,  @" + key1 + " ) = " + compareOperBool + " ";
                     }
+                    if (value is JsonElement jsonElement1 && jsonElement1.ValueKind is JsonValueKind.String)
+                    {
+                        sql1 = logicOper + "Contains(  c." + key + " ,  @" + key1 + " ) = " + compareOperBool + " ";
+                    }
                     else
                     {
                         sql1 = logicOper + "Contains(  ToString( c." + key + " ),  \'@" + key1 + "\' ) = " + compareOperBool + " ";
@@ -773,7 +823,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                     parmeters.Add("@" + key, keyValue.Value);
                 }
             }
-            if (offset != 0 && limit != 0)
+            if (offset != -1 && limit != 0)
             {
                 parmeters.Add("@offsetNum", offset);
                 parmeters.Add("@limitNum", limit);

+ 17 - 1
TEAMModelOS/ClientApp/src/api/newEvaluation.js

@@ -16,7 +16,23 @@ export default {
      * @param {any} data
      */
     FindExerciseList: function (data) {
-        return post('/api/ItemInfo/Find', data)
+        return post('/api/ItemInfo/FindSummary', data)
+    },
+
+    /**
+     * 条件查询结果数量
+     * @param {any} data
+     */
+    FindCount: function (data) {
+        return post('/api/Common/FindCount', data)
+    },
+
+    /**
+     * 查询单个题目的详细数据
+     * @param {any} data
+     */
+    FindExerciseById: function (data) {
+        return post('/api/ItemInfo/FindById', data)
     }
 
     

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

@@ -7,7 +7,7 @@
 
 .question-item-wrap {
   background-color: #505050;
-  margin-bottom: 15px;
+  margin-bottom: 3px;
   padding: 10px 30px 10px 10px;
   max-height: 400px;
   transition: max-height ease 5.5s;

+ 16 - 6
TEAMModelOS/ClientApp/src/components/learnactivity/QuestionList.vue

@@ -2,9 +2,11 @@
   <div>
     <div :class="index == openIndex ? 'question-item-wrap-detail question-item-wrap':'question-item-wrap'" v-for="(item,index) in questions">
       <p class="question-content">
+
         <span class="question-order">{{index+1+'.'}}</span>
         <span class="question-text" v-html='item.question'></span>
-        <Icon v-if="showSelect" type="ios-cart" title="选题" class="choose-question-btn" size="25" @click="selectQuestion(item)"/>
+        <!--<slot name="score"></slot>-->
+        <Icon v-if="showSelect" type="ios-cart" title="选题" class="choose-question-btn" size="25" @click="selectQuestion(item)" />
         <Icon type="ios-arrow-dropdown" :color="index == openIndex? 'cyan':'white'" size="25" @click="toglleQuestionDetail(index)" :class="index == openIndex ? 'toggle-detail-icon toggle-detail-icon-up':'toggle-detail-icon toggle-detail-icon-down'" :title="openIndex == index ? '收起':'查看详情'" />
       </p>
       <div v-show="index == openIndex" :class="index == openIndex ? 'question-detail animated  fadeIn':'question-detail animated  fadeOut'">
@@ -12,6 +14,10 @@
           <span class="option-order">{{optionItem.code+'.'}}</span>
           <span class="option-text" v-html='optionItem.value'></span>
         </p>
+        <p class="dark-iview-inputnumber" style="margin-top:15px;">
+          <span class="answer-label">配分:</span>
+          <InputNumber :max="10" :min="1" v-model="value1" size="small" style="width: 110px" :formatter="value => value+' 分'"  :parser="value => value.replace(' 分','')"></InputNumber>
+        </p>
         <p class="answer-label">答案:点击展开答案详情</p>
         <p class="answer-detail">
           <span v-for="(answerItem,index) in item.answer" v-html='answerItem'></span>
@@ -25,7 +31,9 @@
     props: {
       questions: {
         type: Array,
-        default: []
+        default: () => {
+          return []
+        }
       },
       showSelect: { //是否显示选题图标
         type: Boolean,
@@ -63,9 +71,7 @@
       }
     },
     mounted() {
-      console.log('11111')
-      this.groupQuestion = this.groupBy(this.questions,'type')
-      console.log(this.groupQuestion)
+      //this.groupQuestion = this.groupBy(this.questions,'type')
     }
   }
 </script>
@@ -73,5 +79,9 @@
   @import "./QuestionList.less";
 </style>
 <style>
-
+  .question-detail .ivu-input-number{
+    border:none;
+    border-radius:0px;
+    border-bottom:1px solid #aaaaaa;
+  }
 </style>

+ 13 - 0
TEAMModelOS/ClientApp/src/css/dark-iview-form.less

@@ -0,0 +1,13 @@
+.drak-iview-input{
+
+
+}
+.dark-iview-inputnumber {
+  .ivu-input-number, .ivu-input-number-small input {
+    background: none;
+    /*text-align: center;*/
+    font-size: 16px;
+    color: white;
+  }
+
+}

+ 1 - 0
TEAMModelOS/ClientApp/src/view/Home.vue

@@ -380,4 +380,5 @@
   @import '../css/dark-iview-modal.less';
   @import '../css/dark-iview-tabs.less';
   @import '../css/dark-iview-collapse.less';
+  @import '../css/dark-iview-form.less';
 </style>

+ 28 - 6
TEAMModelOS/ClientApp/src/view/evaluation/index/ExercisesList.css

@@ -206,6 +206,7 @@
         font-size: 16px;
         font-weight: 600;
         background: #fff;
+        cursor:pointer;
         /*box-shadow: 6px 5px 5px 2px rgb(214, 214, 214);*/
     }
 
@@ -282,8 +283,14 @@
     margin-top:10px;
 }
 
-.exercise-item .item-options p {
-    margin: 7px 0;
+    .exercise-item .item-options .item-option-content {
+        margin: 7px 0;
+    }
+
+.exercise-item .toggle-area {
+    border-top: 1px #c3c3c34d dashed;
+    padding-top: 10px;
+    margin-top: 10px;
 }
 
 .exercise-item .item-answer {
@@ -300,7 +307,6 @@
 }
 
 .exercise-item .item-answer-details {
-    display: none;
     margin: 10px 20px;
 }
 
@@ -318,6 +324,7 @@
 .exercise-item .item-explain {
     display: table;
     margin-top: 10px;
+    margin-left:-10px;
     cursor: pointer;
     font-size: 14px;
 }
@@ -329,8 +336,8 @@
 }
 
 .exercise-item .item-explain-details {
-    display: none;
-    margin: 10px 20px;
+    margin: 10px;
+    display:inline-block;
 }
 
 .exercise-item .item-explain .explain-title-line {
@@ -352,10 +359,25 @@
     border-top: 1px #c3c3c34d dashed;
 }
 
+    .exercise-item .item-tools .item-tools-action {
+        float:right;
+        color:#01b4ef;
+        margin:0 20px;
+        margin-top:8px;
+        font-size:14px;
+        display:flex;
+        align-items:center;
+        cursor:pointer;
+    }
+
+    .exercise-item .item-tools .item-tools-action .ivu-icon {
+        font-size:18px;
+
+    }
+
     .exercise-item .item-tools .ivu-icon {
         font-size: 16px;
         margin-right: 5px;
-        margin-top: 12px;
         font-weight: bold;
     }
 

+ 250 - 89
TEAMModelOS/ClientApp/src/view/evaluation/index/ExercisesList.vue

@@ -3,15 +3,15 @@
         <div class="ev-header">
             <Icon type="md-bookmarks" size="30" color="rgb(16, 171, 231)" />
             <span class="ev-title">题库列表</span>
-            <span class="ev-length">共 {{exerciseList.length}} 道题</span>
+            <span class="ev-length">共 {{totalNum}} 道题</span>
         </div>
         <!-- 筛选部分 -->
         <div class="filter-wrap">
             <div class="filter-item">
                 <span class="filter-title">来源:</span>
                 <RadioGroup v-model="filterOrigin" type="button" @on-change="filterOriginChange">
-                    <Radio label="self">私有题库</Radio>
-                    <Radio label="school">学校公用库</Radio>
+                    <Radio :label="userId">私有题库</Radio>
+                    <Radio :label="schoolCode">学校公用库</Radio>
                 </RadioGroup>
             </div>
             <div class="filter-item">
@@ -49,11 +49,7 @@
                 <span class="filter-title">难度:</span>
                 <CheckboxGroup v-model="filterDiff" border @on-change="filterDiffChange">
                     <Checkbox label="all">全部</Checkbox>
-                    <Checkbox label="0">容易</Checkbox>
-                    <Checkbox label="1">较易</Checkbox>
-                    <Checkbox label="2">一般</Checkbox>
-                    <Checkbox label="3">较难</Checkbox>
-                    <Checkbox label="4">困难</Checkbox>
+                    <Checkbox v-for="(item,index) in exersicesDiff" :key="index" :label="index + 1">{{ item }}</Checkbox>
                 </CheckboxGroup>
             </div>
             <div class="filter-item">
@@ -70,8 +66,8 @@
             <div class="filter-item">
                 <span class="filter-title">排序:</span>
                 <RadioGroup v-model="filterSort" type="button" @on-change="filterSortChange">
-                    <Radio label="0">新增时间<Icon type="md-arrow-round-down" /></Radio>
-                    <Radio label="1">使用次数<Icon type="md-arrow-round-down" /></Radio>
+                    <Radio label="createTime">新增时间<Icon type="md-arrow-round-down" /></Radio>
+                    <Radio label="usageCount">使用次数<Icon type="md-arrow-round-down" /></Radio>
                 </RadioGroup>
             </div>
         </div>
@@ -91,9 +87,8 @@
             <span style="margin-top:15px;color:#808080">暂无数据</span>
         </div>
         <div class="content-wrap" v-else>
-            <Loading v-show="importLoading"></Loading>
-
-            <div class="exercise-item" v-for="(item,index) of exerciseList" :key="index">
+            <Loading :top="100" v-show="dataLoading" type="1"></Loading>
+            <div class="exercise-item" v-for="(item,index) of exerciseList" :key="index" @click="onQuestionToggle(index,item.id,$event)">
                 <!-- 题目难度类型以及绑定知识点 -->
                 <!--<div class="item-types">
                     <span class="item-difficulty" :style="{backgroundColor:diffColors[item.difficulty || 3]}">{{exersicesDiff[item.difficulty || 3]}}</span>
@@ -111,19 +106,18 @@
                     </span>
                 </div>-->
                 <!-- 题干部分 -->
-                <div class="item-question" @click="onQuestionToggle(index)">
-                    <p>{{index+1}} : <span v-html="item.question"></span></p>
+                <div class="item-question" style="pointer-events:none">
+                    <p>{{ pageSize * (pageNum - 1) + index + 1 }} : <span v-html="item.question"></span></p>
                     <span class="item-btn-toggle">
                         <Icon :type="collapseList.indexOf(index) > -1 ? 'ios-arrow-dropup' : 'ios-arrow-dropdown'" />
                     </span>
                 </div>
+                <!-- 选项部分 -->
+                <div v-for="(option,optionIndex) in item.option" :key="optionIndex" class="item-options" style="pointer-events:none">
+                    <p class="item-option-content">{{String.fromCharCode(64 + parseInt(optionIndex+1))}} : <span v-html="option.value"></span></p>
+                </div>
                 <transition name="slide">
-                    <div v-show="collapseList.indexOf(index) > -1">
-                        <!-- 选项部分 -->
-                        <div v-for="(option,optionIndex) in item.option" :key="optionIndex" class="item-options">
-                            <p>{{String.fromCharCode(64 + parseInt(optionIndex+1))}} : <span v-html="option.value"></span></p>
-                        </div>
-
+                    <div v-show="collapseList.indexOf(index) > -1" class="toggle-area">
                         <!-- 如果是组合题 -->
                         <div v-for="(childQuestion,childIndex) in item.children" :key="childIndex">
                             <div v-if="item.children.length">
@@ -141,16 +135,15 @@
                                 </div>
                                 <div class="item-explain" v-show="isShowAnswer">
                                     <span style="color:#01b4ef">【解析】:</span>
-                                    <span v-html="childQuestion.explain"></span>
+                                    <span v-html="childQuestion.explain || '暂无解析'"></span>
                                 </div>
                             </div>
                         </div>
                         <!-- 组合题结束 -->
                         <!-- 答案展示部分 -->
-                        <div class="item-answer" v-show="isShowAnswer">
-                            <span class="answer-title-line"></span>
-                            <span class="answer-title" @click="showAnswer($event,'answer')">答案:点击展开答案详情</span>
-                            <div class="item-answer-details">
+                        <div class="item-explain" v-show="isShowAnswer">
+                            <span class="explain-title">【答案】</span>
+                            <div class="item-explain-details">
                                 <span v-html="item.answer" v-if="item.type === 'Subjective'"></span>
                                 <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index" v-else-if="item.type === 'Complete'" v-html="answer"></span>
                                 <span :class="[ item.type === 'Complete' ? 'item-answer-item':'']" v-for="(answer,index) in item.answer" :key="index" v-else>{{answer}}</span>
@@ -158,19 +151,39 @@
                         </div>
                         <!-- 解析部分 -->
                         <div class="item-explain" v-show="isShowAnswer">
-                            <span class="explain-title-line"></span>
-                            <span class="explain-title" @click="showAnswer($event,'explain')">解析:点击展开解析详情</span>
+                            <span class="explain-title">【解析】</span>
+                            <div class="item-explain-details">
+                                <span v-html="item.explain || '暂无解析'"></span>
+                            </div>
+                        </div>
+                        <!-- 知识点部分 -->
+                        <div class="item-explain" v-show="isShowAnswer">
+                            <span class="explain-title">【知识点】</span>
                             <div class="item-explain-details">
-                                <span v-html="item.explain"></span>
+                                <span v-html="item.points.length ? item.points : '暂未绑定知识点'"></span>
                             </div>
                         </div>
                         <!-- 底部题目操作栏 -->
                         <div class="item-tools">
-                            <span class="item-tools-info">来源:浙江省温州市2019年中考数学试卷</span>
-                            <span class="item-tools-info">使用次数:98 次</span>
-                            <span class="item-tools-info" style="border:0">更新时间:2019-07-01</span>
+                            <span class="item-tools-info">题型:{{ exersicesType[item.type] }}</span>
+                            <span class="item-tools-info">难度:{{ exersicesDiff[item.level] }}</span>
+                            <span class="item-tools-info">使用次数:{{ item.usageCount }} 次</span>
+                            <span class="item-tools-info" style="border:0">更新时间:{{ formatDateTime(new Date(item.createTime * 1000)) }}</span>
                             <!--<Button type="info" :style="{backgroundColor:basketList.all.indexOf(item) > -1 ? '#bbbbbb' : ''}" @click="handleChoose(item)">{{basketList.all.indexOf(item) > -1 ? '已选入' : '选题'}} </Button>-->
+
                             <Button type="primary" @click="handleEdit(item)" style="margin-right:10px">编辑题目</Button>
+                            <div class="item-tools-action">
+                                <Icon type="md-bookmarks" />绑定知识点
+                            </div>
+                            <div class="item-tools-action">
+                                <Icon type="md-school" />认知层次
+                            </div>
+                            <div class="item-tools-action">
+                                <Icon type="md-trash" />删除
+                            </div>
+                            <div class="item-tools-action">
+                                <Icon type="md-create" />编辑
+                            </div>
                         </div>
                     </div>
                 </transition>
@@ -191,16 +204,17 @@
 </template>
 <script>
     import Loading from '@/common/Loading.vue'
-    import CreateLink from '@/common/CreateLink.vue'
     import { setTimeout } from 'core-js'
     export default {
         components: {
-            Loading,
-            CreateLink
+            Loading
         },
         data() {
             return {
-                exerciseList:[],
+                userId: 'habook0001',
+                schoolCode: '',
+                dataLoading: false,
+                exerciseList: [],
                 schoolInfo: {},
                 isShowUploadList: false,
                 exersicesType: {
@@ -214,156 +228,300 @@
                 exersicesDiff: ['容易', '较易', '一般', '较难', '困难'],
                 diffColors: ['#32CF74', '#E8BE15', '#F19300', '#EB5E00', '#D30000'],
                 filterType: ['all'],
-                filterOrigin: 'self',
+                filterOrigin: 'habook0001',
                 filterDiff: ['all'],
                 filterField: ['all'],
-                filterSort: '0',
-                filterPeriod:0,
+                filterSort: 'createTime',
+                filterPeriod: 0,
                 filterGrade: [false],
-                filterSubject:[false],
-                totalNum: 100,
+                filterSubject: [false],
+                totalNum: 0,
                 isShowAnswer: true,
                 importLoading: false,
                 pageSize: 5,
                 pageNum: 1,
+                currentPage:1,
                 collapseList: [],
                 periodList: [],
                 gradeList: [],
-                subjectList: []
+                subjectList: [],
+                filterParams: {}
             }
         },
         created() {
             this.getSchoolInfo()
-            this.getExerciseList({
-                '@OFFSET': this.pageNum,
-                '@LIMIT': this.pageSize
 
-            })
         },
         methods: {
             /** 获取区班校信息 */
             getSchoolInfo() {
                 this.$store.dispatch('schoolBaseInfo/getSchoolBaseData').then(res => {
                     this.schoolInfo = JSON.parse(JSON.stringify(res.data))
+                    this.schoolCode = res.data.schoolCode
                     this.periodList = res.data.period
                     this.gradeList = res.data.period[0].grades
                     this.subjectList = res.data.period[0].subjects
+                    this.doFilter();
                 })
             },
 
-            // 获取最新题库列表
+            /** 执行筛选条件获取数据 */
+            doFilter() {
+                this.dataLoading = true
+                this.collapseList = [] // 所有详情都收起来
+                /** 定义查询接口的参数规格 */
+                this.filterParams = {
+                    '@CURRPAGE': this.pageNum,
+                    '@PAGESIZE': this.pageSize,
+                    '@DESC': this.filterSort,
+                    'scopeCode': this.filterOrigin,
+                    'period': [this.periodList[this.filterPeriod].periodCode],
+                    'grade': this.deleteFalse(this.filterGrade),
+                    'subject': this.deleteFalse(this.filterSubject),
+                    'scopeCode': this.filterOrigin,
+                    'level': this.deleteFalse(this.filterDiff),
+                    'type': this.deleteFalse(this.filterType),
+                    'field': this.deleteFalse(this.filterField),
+                }
+
+                /** 查询总数参数 */
+                let findCountParams = {
+                    "collectionName": "ExamItem",
+                    "queryDict": {
+                        'scopeCode': this.filterOrigin,
+                        'period': [this.periodList[this.filterPeriod].periodCode],
+                        'grade': this.deleteFalse(this.filterGrade),
+                        'subject': this.deleteFalse(this.filterSubject),
+                        'scopeCode': this.filterOrigin,
+                        'level': this.deleteFalse(this.filterDiff),
+                        'type': this.deleteFalse(this.filterType),
+                        'field': this.deleteFalse(this.filterField),
+                    }
+                }
+
+
+                this.getExerciseList(this.filterParams)
+                this.getResultCount(findCountParams)
+            },
+
+            /**
+             * 获取最新题库列表
+             * @param data
+             */
             getExerciseList(data) {
+                let that = this
                 this.$api.newEvaluation.FindExerciseList(data).then(res => {
                     this.exerciseList = res.result.data
+                    setTimeout(() => {
+                        that.dataLoading = false
+                    }, 1000)
                 })
             },
 
-            // 筛选学段条件
+            /**
+             * 获取筛选结果数量
+             * @param data
+             */
+            getResultCount(data) {
+                this.$api.newEvaluation.FindCount(data).then(res => {
+                    this.totalNum = res.result.data[0]
+                })
+            },
+
+            /**
+             * 根据ID获取试题详细数据
+             * @param id 试题ID
+             */
+            getDetailsById(id, index) {
+                this.$api.newEvaluation.FindExerciseById(id).then(res => {
+                    /* 查询到详细数据则替换掉原数据 */
+                    this.exerciseList.splice(index, 1, res.result.data)
+                })
+            },
+
+            /**
+             * 题干展开与收缩
+             * @param index
+             * @param id
+             */
+            onQuestionToggle(index, id, e) {
+                e.stopPropagation();
+                let listIndex = this.collapseList.indexOf(index)
+                if (listIndex > -1) {
+                    this.collapseList.splice(listIndex, 1)
+                } else {
+                    this.collapseList.push(index)
+                    if (!this.exerciseList[index].answer.length) this.getDetailsById(id, index)
+                }
+                this.pageScrollTo(e.target.offsetTop + 490) // 490就是 content-wrap 距离顶部高度
+            },
+
+
+            /**
+             * 筛选学段条件
+             * @param val
+             */
             filterPeriodChange(val) {
+                //this.filterPeriod = this.periodList[val].periodCode
                 this.gradeList = this.schoolInfo.period[val].grades
                 this.subjectList = this.schoolInfo.period[val].subjects
                 this.filterGrade = [false]
                 this.filterSubject = [false]
+                this.pageChange(1)
             },
 
-            // 筛选年级
+            /**
+             * 筛选年级
+             * @param val
+             */
             filterGradeChange(val) {
                 if (val !== [false] && val.indexOf(false) === 0) {
                     this.filterGrade.splice(val.indexOf(false), 1)
                 } else if (val.indexOf(false) > 0) {
                     this.filterGrade = [false]
                 }
+                this.pageChange(1)
             },
 
-            // 筛选科目
+            /**
+             * 筛选科目
+             * @param val
+             */
             filterSubjectChange(val) {
                 if (val !== [false] && val.indexOf(false) === 0) {
                     this.filterSubject.splice(val.indexOf(false), 1)
                 } else if (val.indexOf(false) > 0) {
                     this.filterSubject = [false]
                 }
+                this.pageChange(1)
             },
 
-            // 根据题库加载题目
+            /**
+             * 根据题库加载题目
+             * @param val
+             */
             filterOriginChange(origin) {
-                console.log(origin)
+                this.filterOrigin = origin
+                this.pageChange(1)
+
             },
 
-            // 筛选题型
+            /**
+             * 筛选题型
+             * @param val
+             */
             filterTypeChange(val) {
                 if (val !== ['all'] && val.indexOf('all') === 0) {
                     this.filterType.splice(val.indexOf('all'), 1)
                 } else if (val.indexOf('all') > 0) {
                     this.filterType = ['all']
                 }
+                this.pageChange(1)
             },
 
-            // 筛选难度
+            /**
+             * 筛选难度
+             * @param val
+             */
             filterDiffChange(val) {
                 if (val !== ['all'] && val.indexOf('all') === 0) {
                     this.filterDiff.splice(val.indexOf('all'), 1)
                 } else if (val.indexOf('all') > 0) {
                     this.filterDiff = ['all']
                 }
+                this.pageChange(1)
             },
 
-            // 筛选认知层次
+            /**
+             * 筛选认知层次
+             * @param val
+             */
             filterFieldChange(val) {
                 if (val !== ['all'] && val.indexOf('all') === 0) {
                     this.filterField.splice(val.indexOf('all'), 1)
                 } else if (val.indexOf('all') > 0) {
                     this.filterField = ['all']
                 }
+                this.pageChange(1)
             },
 
-            // 排序条件更换
+            /**
+             * 排序条件更换
+             * @param val
+             */
             filterSortChange(val) {
-                console.log(val)
-            },
-
-            // 题干展开与收缩
-            onQuestionToggle(index) {
-                let listIndex = this.collapseList.indexOf(index)
-                if (listIndex > -1) {
-                    this.collapseList.splice(listIndex, 1)
-                } else {
-                    this.collapseList.push(index)
-                }
+                this.pageChange(1)
             },
 
-            // 展开与收起答案
-            showAnswer(e, type) {
-                let el = e.currentTarget
-                let isShow = e.currentTarget.nextElementSibling.style.display || 'none'
-                setTimeout(function () {
-                    console.log(type)
-                    if (type === 'explain') {
-                        el.nextElementSibling.style.display = isShow !== 'none' ? 'none' : 'block'
-                        el.innerHTML = isShow !== 'none' ? '解析:点击收起解析详情' : '解析:点击展开解析详情'
-                    } else {
-                        el.nextElementSibling.style.display = isShow === 'none' ? 'block' : 'none'
-                        el.innerHTML = isShow !== 'none' ? '答案:点击收起答案详情' : '答案:点击展开答案详情'
-                    }
-                }, 100)
+            /**
+             * 删除筛选条件里面的False值与All值
+             * @param arr
+             */
+            deleteFalse(arr) {
+                let list = JSON.parse(JSON.stringify(arr))
+                list.forEach((item, index) => { if (!item || item === 'all') list.splice(index, 1) })
+                return list
             },
 
+            /** 返回创建试题页面 */
             goCreateExercise() {
                 this.$router.push({
                     name: 'createExercises'
                 })
             },
 
-            // 切换页码
+            /**
+             * 切换页码操作
+             * @param page
+             */
             pageChange(page) {
-                console.log(page)
+                this.pageNum = page
+                this.doFilter()
+                this.pageScrollTo(0)
+            },
+
+            /**
+             * 页面滚动事件
+             * @param scrollDistance 页面滚动距离
+             */
+            pageScrollTo(scrollDistance) {
+                let parentVm = this.$parent.$parent.$parent
+                parentVm.$refs['evScroll'].scrollTo(
+                    {
+                        y: scrollDistance
+                    },
+                    500, 'easeInQuad'
+                )
             },
 
-            // 切换分页Size
+            /**
+             * 切换每页显示数量
+             * @param val
+             */
             pageSizeChange(val) {
                 this.pageSize = val
                 this.pageChange(1)
             },
 
+            /**
+             * 更新时间日期格式化
+             * @param date
+             */
+            formatDateTime(date) {
+                var y = date.getFullYear();
+                var m = date.getMonth() + 1;
+                m = m < 10 ? ('0' + m) : m;
+                var d = date.getDate();
+                d = d < 10 ? ('0' + d) : d;
+                var h = date.getHours();
+                h = h < 10 ? ('0' + h) : h;
+                var minute = date.getMinutes();
+                minute = minute < 10 ? ('0' + minute) : minute;
+                var second = date.getSeconds();
+                second = second < 10 ? ('0' + second) : second;
+                return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
+            },
+
             // 编辑习题
             handleEdit(item) {
                 item.options = item.option
@@ -429,14 +587,17 @@
         width: 50px;
         height: 50px;
     }
+
     .slide-enter-active {
-      transition: all .3s ease;
+        transition: all .3s ease;
     }
+
     .slide-leave-active {
-      transition: all .3s ease;
+        transition: all .3s ease;
     }
-    .slide-enter, .slide-leave-to{
-      transform: translateY(10px);
-      opacity: 0;
+
+    .slide-enter, .slide-leave-to {
+        transform: translateY(10px);
+        opacity: 0;
     }
 </style>

+ 26 - 24
TEAMModelOS/ClientApp/src/view/evaluation/index/index.vue

@@ -3,29 +3,31 @@
     <div class="ev-header" style="display:none;">
       <Header :parentToChild="syllabusTitle" :identityselect="identitydata"></Header>
     </div>
-    <div class="ev-body">
-      <!--<div class="ev-slide">
-        <div class="ev-slide-school"><Icon type="ios-school" size="26" color="#10abe7" style="vertical-align:sub"/> {{schoolInfo.claimName}}</div>
-        <div class="ev-slide-header">选择学段及科目</div>
-        <div class="ev-slide-select">
-          <Select v-model="evPeriodSelect" @on-change="periodChange" label-in-value>
-            <Option v-for="item in evPeriodsList" :value="item.code" :key="item.rowKey">{{ item.name }}</Option>
-          </Select>
-          <Select v-model="evSubjectSelect" @on-change="subjectChange" label-in-value>
-            <Option v-for="item in evSubjectList" :value="item.code" :key="item.rowKey">{{ item.name }}</Option>
-          </Select>
+    <vuescroll ref="evScroll">
+        <div class="ev-body">
+            <!--<div class="ev-slide">
+          <div class="ev-slide-school"><Icon type="ios-school" size="26" color="#10abe7" style="vertical-align:sub"/> {{schoolInfo.claimName}}</div>
+          <div class="ev-slide-header">选择学段及科目</div>
+          <div class="ev-slide-select">
+            <Select v-model="evPeriodSelect" @on-change="periodChange" label-in-value>
+              <Option v-for="item in evPeriodsList" :value="item.code" :key="item.rowKey">{{ item.name }}</Option>
+            </Select>
+            <Select v-model="evSubjectSelect" @on-change="subjectChange" label-in-value>
+              <Option v-for="item in evSubjectList" :value="item.code" :key="item.rowKey">{{ item.name }}</Option>
+            </Select>
+          </div>
+          <div class="ev-slide-header ev-slide-select-volumes" style="position:relative">
+            <Select v-model="evVolumeSelect" @on-change="volumeChange" label-in-value placeholder="请选择册别">
+              <Option v-for="item in evVolumesList" :value="item.rowKey" :key="item.rowKey">{{ item.gradeName + '' + item.termName }}</Option>
+            </Select>
+          </div>
+          <SyllabusTree :treeDatas="treeData"></SyllabusTree>
+        </div>-->
+            <div class="ev-content">
+                <router-view />
+            </div>
         </div>
-        <div class="ev-slide-header ev-slide-select-volumes" style="position:relative">
-          <Select v-model="evVolumeSelect" @on-change="volumeChange" label-in-value placeholder="请选择册别">
-            <Option v-for="item in evVolumesList" :value="item.rowKey" :key="item.rowKey">{{ item.gradeName + '' + item.termName }}</Option>
-          </Select>
-        </div>
-        <SyllabusTree :treeDatas="treeData"></SyllabusTree>
-      </div>-->
-      <div class="ev-content">
-        <router-view />
-      </div>
-    </div>
+    </vuescroll>
     <div class="slide-menu animated">
       <ul>
         <li @click="goRouter('createExercises')">创建习题</li>
@@ -152,9 +154,9 @@
   .evaluation {
     background:#eee;
     width:100%;
-    min-height:100%;
-    padding-bottom:50px;
+    height:100%;
     position:relative;
+    overflow:hidden;
   }
   .ev-body {
     width:100%;

+ 2 - 149
TEAMModelOS/ClientApp/src/view/learnactivity/AutoCreate.vue

@@ -206,146 +206,6 @@
             <span class="input-tag-text">道</span>
           </div>
         </div>
-        <!--<Divider dashed />-->
-        <!--<div class="question-condition-item">
-        <span class="condition-label" style="vertical-align:top;">题量设置:</span>
-        <div style="display:inline-block;width:calc(100% - 95px);">
-          <div :class="autoCreateFilter.questionType.indexOf('single') != -1 ? 'question-num-item':'question-num-item'" v-if="autoCreateFilter.questionType.indexOf('single') != -1">
-            <span class="question-type-label">单选题:</span>
-            <span class="input-tag-text">共</span>
-            <InputNumber v-model="single.total" v-if="single.policy !== '2'" placeholder="0" style="width: 40px" size="small" />
-            <span v-if="single.policy == '2'" class="count-difficulty-item">{{getNumber(single.easy) + getNumber(single.common) + getNumber(single.difficulty)}}</span>
-            <span class="input-tag-text">道</span>
-            <span class="question-difficulty-label">难度设置:</span>
-            <Select v-model="single.policy" style="width:100px" size="small">
-              <Option v-for="(item,index) in difficultyList" :value="item.value" :key="index">{{ item.label }}</Option>
-            </Select>
-            <div style="display:inline-block;" v-if="single.policy == '2'" :class="single.policy == '2' ? 'animated fadeIn':''">
-              <span class="input-tag-text" style="margin-left:30px;">简单</span>
-              <InputNumber v-model="single.easy" number placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">一般</span>
-              <InputNumber v-model="single.common" number placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="    margin-left: 30px;">困难</span>
-              <InputNumber v-model="single.difficulty" number placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-            </div>
-          </div>
-          <div :class="autoCreateFilter.questionType.indexOf('multiple') != -1 ? 'question-num-item':'question-num-item'" v-if="autoCreateFilter.questionType.indexOf('multiple') != -1">
-            <span class="question-type-label">多选题:</span>
-            <span class="input-tag-text">共</span>
-            <InputNumber v-model="multiple.total" v-if="multiple.policy !== '2'" placeholder="0" style="width: 40px" size="small" />
-            <span v-if="multiple.policy == '2'" class="count-difficulty-item">{{getNumber(multiple.easy) + getNumber(multiple.common) + getNumber(multiple.difficulty)}}</span>
-            <span class="input-tag-text">道</span>
-            <span class="question-difficulty-label">难度设置:</span>
-            <Select v-model="multiple.policy" style="width:100px" size="small">
-              <Option v-for="(item,index) in difficultyList" :value="item.value" :key="index">{{ item.label }}</Option>
-            </Select>
-            <div style="display:inline-block;" v-if="multiple.policy == '2'" :class="multiple.policy == '2' ? 'animated fadeIn':''">
-              <span class="input-tag-text" style="margin-left:30px;">简单</span>
-              <InputNumber v-model="multiple.easy" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">一般</span>
-              <InputNumber v-model="multiple.common" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">困难</span>
-              <InputNumber v-model="multiple.difficulty" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-            </div>
-          </div>
-          <div :class="autoCreateFilter.questionType.indexOf('judge') != -1 ? 'question-num-item':'question-num-item'" v-if="autoCreateFilter.questionType.indexOf('judge') != -1">
-            <span class="question-type-label">判断题:</span>
-            <span class="input-tag-text">共</span>
-            <InputNumber v-model="judge.total" v-if="judge.policy !== '2'" placeholder="0" style="width: 40px" size="small" />
-            <span v-if="judge.policy == '2'" class="count-difficulty-item">{{getNumber(judge.easy) + getNumber(judge.common) + getNumber(judge.difficulty)}}</span>
-            <span class="input-tag-text">道</span>
-            <span class="question-difficulty-label">难度设置:</span>
-            <Select v-model="judge.policy" style="width:100px" size="small">
-              <Option v-for="(item,index) in difficultyList" :value="item.value" :key="index">{{ item.label }}</Option>
-            </Select>
-            <div style="display:inline-block;" v-if="judge.policy == '2'" :class="judge.policy == '2' ? 'animated fadeIn':''">
-              <span class="input-tag-text" style="margin-left:30px;">简单</span>
-              <InputNumber v-model="judge.easy" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">一般</span>
-              <InputNumber v-model="judge.common" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">困难</span>
-              <InputNumber v-model="judge.difficulty" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-            </div>
-
-          </div>
-          <div :class="autoCreateFilter.questionType.indexOf('complete') != -1 ? 'question-num-item':'question-num-item'" v-if="autoCreateFilter.questionType.indexOf('complete') != -1">
-            <span class="question-type-label">填空题:</span>
-            <span class="input-tag-text">共</span>
-            <InputNumber v-model="complete.total" v-if="complete.policy !== '2'" placeholder="0" style="width: 40px" size="small" />
-            <span v-if="complete.policy == '2'" class="count-difficulty-item">{{getNumber(complete.easy) + getNumber(complete.common) + getNumber(complete.difficulty)}}</span>
-            <span class="input-tag-text">道</span>
-            <span class="question-difficulty-label">难度设置:</span>
-            <Select v-model="complete.policy" style="width:100px" size="small">
-              <Option v-for="(item,index) in difficultyList" :value="item.value" :key="index">{{ item.label }}</Option>
-            </Select>
-            <div style="display:inline-block;" v-if="complete.policy == '2'" :class="complete.policy == '2' ? 'animated fadeIn':''">
-              <span class="input-tag-text" style="margin-left:30px;">简单</span>
-              <InputNumber v-model="complete.easy" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">一般</span>
-              <InputNumber v-model="complete.common" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">困难</span>
-              <InputNumber v-model="complete.difficulty" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-            </div>
-          </div>
-          <div :class="autoCreateFilter.questionType.indexOf('subjective') != -1 ? 'question-num-item':'question-num-item'" v-if="autoCreateFilter.questionType.indexOf('subjective') != -1">
-            <span class="question-type-label">问答题:</span>
-            <span class="input-tag-text">共</span>
-            <InputNumber v-model="subjective.total" v-if="subjective.policy !== '2'" placeholder="0" style="width: 40px" size="small" />
-            <span v-if="subjective.policy == '2'" class="count-difficulty-item">{{getNumber(subjective.easy) + getNumber(subjective.common) + getNumber(subjective.difficulty)}}</span>
-            <span class="input-tag-text">道</span>
-            <span class="question-difficulty-label">难度设置:</span>
-            <Select v-model="subjective.policy" style="width:100px" size="small">
-              <Option v-for="(item,index) in difficultyList" :value="item.value" :key="index">{{ item.label }}</Option>
-            </Select>
-            <div style="display:inline-block;" v-if="subjective.policy == '2'" :class="subjective.policy == '2' ? 'animated fadeIn':''">
-              <span class="input-tag-text" style="margin-left:30px;">简单</span>
-              <InputNumber v-model="subjective.easy" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">一般</span>
-              <InputNumber v-model="subjective.common" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">困难</span>
-              <InputNumber v-model="subjective.difficulty" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-            </div>
-          </div>
-          <div :class="autoCreateFilter.questionType.indexOf('compose') != -1 ? 'question-num-item':'question-num-item'" v-if="autoCreateFilter.questionType.indexOf('compose') != -1">
-            <span class="question-type-label">综合题:</span>
-            <span class="input-tag-text">共</span>
-            <InputNumber v-model="compose.total" v-if="compose.policy !== '2'" placeholder="0" style="width: 40px" size="small" />
-            <span v-if="compose.policy == '2'" class="count-difficulty-item">{{getNumber(compose.easy) + getNumber(compose.common) + getNumber(compose.difficulty)}}</span>
-            <span class="input-tag-text">道</span>
-            <span class="question-difficulty-label">难度设置:</span>
-            <Select v-model="compose.policy" style="width:100px" size="small">
-              <Option v-for="(item,index) in difficultyList" :value="item.value" :key="index">{{ item.label }}</Option>
-            </Select>
-            <div style="display:inline-block;" v-if="compose.policy == '2'" :class="compose.policy == '2' ? 'animated fadeIn':''">
-              <span class="input-tag-text" style="margin-left:30px;">简单</span>
-              <InputNumber v-model="compose.easy" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">一般</span>
-              <InputNumber v-model="compose.common" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-              <span class="input-tag-text" style="margin-left:30px;">困难</span>
-              <InputNumber v-model="compose.difficulty" placeholder="0" style="width: 40px" size="small" />
-              <span class="input-tag-text">道</span>
-            </div>
-          </div>
-        </div>
-      </div>-->
-
         <div class="question-condition-item" style="margin-top:0px;">
           <span class="condition-label">知识点:</span>
           <Tag closable color="#404040">知识点1</Tag>
@@ -533,12 +393,9 @@
         })
       },
       getOpenKeys(data) {
-        console.log('......')
-        console.log(data)
         
       },
       getCurrentIndex(points) {
-        console.log(points)
         this.getPointObject(points)
       },
       getPointsData() {
@@ -622,13 +479,12 @@
           filterData.quInfos.push(quInfoItem)
         }
         filterData.count = count
-        console.log(JSON.stringify(filterData))
         this.$api.learnActivity.Automatic(filterData).then(
           res => {
             if (res.error == null) {
               if (res.result.data.length > 0) {
-                
-                for (let i = 0; i < res.result.data; i++) {
+
+                for (let i = 0; i < res.result.data.length; i++) {
                   this.$emit('autoQuestions', res.result.data[i].item)
                 }
                 this.comfirmPreviewStatus = true
@@ -653,9 +509,6 @@
 <style lang="less" scoped>
   @import "./AutoCreate.less";
 </style>
-<style lang="less">
-  /*@import '../../css/dark-iview-modal.less';*/
-</style>
 <style>
   .question-num-item .ivu-input {
     background:none;

+ 15 - 19
TEAMModelOS/ClientApp/src/view/learnactivity/CreateEvaluation.vue

@@ -67,7 +67,7 @@
               <ImportCreate @importedQuestions="getImportQuestions" @goToPreview="goToPreview"></ImportCreate>
             </TabPane>
             <TabPane label="试题预览" name="preview" :index="4" tab="createTest">
-              <TeacherPreview :questionList="evaluationInfo.testPaper[currentSubjectIndex].questions"></TeacherPreview>
+              <TeacherPreview :testPaper="evaluationInfo.testPaper[currentSubjectIndex]"></TeacherPreview>
             </TabPane>
             <TabPane label="学生作答预览" name="student" :index="5" tab="createTest">
               <StudentPreview></StudentPreview>
@@ -193,9 +193,6 @@
     },
     methods: {
       getDate(value, date) {
-        console.log('123')
-        console.log(value)
-        console.log(date)
       },
       getImportQuestions(questions) {
         if (this.evaluationInfo.testPaper[this.currentSubjectIndex].questions != undefined) {
@@ -204,13 +201,15 @@
           this.evaluationInfo.testPaper[this.currentSubjectIndex].questions = [...questions]
         }
       },
-      getSelectedQuestion(questions) {
-        console.log(this.evaluationInfo.testPaper[this.currentSubjectIndex].questions)
-        if (this.evaluationInfo.testPaper[this.currentSubjectIndex].questions != undefined) {
-          this.evaluationInfo.testPaper[this.currentSubjectIndex].questions = [...questions, ...this.evaluationInfo.testPaper[this.currentSubjectIndex].questions]
+      getSelectedQuestion(data) {
+        if (this.evaluationInfo.testPaper[this.currentSubjectIndex].questions == undefined) {
+          this.evaluationInfo.testPaper[this.currentSubjectIndex].questions = []
+          this.evaluationInfo.testPaper[this.currentSubjectIndex].questions.push(data.item)
         } else {
-          this.evaluationInfo.testPaper[this.currentSubjectIndex].questions = [...questions]
+          this.evaluationInfo.testPaper[this.currentSubjectIndex].questions.push(data.item)
         }
+        console.log("index")
+        console.log(this.evaluationInfo.testPaper[this.currentSubjectIndex])
       },
       goToPreview() {
         this.activeTab = 'preview'
@@ -277,12 +276,13 @@
       confirmAddSubject() {
         for (let item of this.newAddSubjects) {
           this.evaluationInfo.testPaper.push({
-              periodName:this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodName,
-              periodCode:this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodCode,
-              subjectName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectName,
-              subjectCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectCode,
-              createType: 'auto',
-              filter: {}
+            periodName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodName,
+            periodCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].periodCode,
+            subjectName: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectName,
+            subjectCode: this.$store.state.schoolBaseInfo.schoolBaseInfo.period[item.index].subjects[item.i].subjectCode,
+            createType: 'auto',
+            questions: [],
+            filter: {}
           })
         }
         this.newAddSubjects.length = 0
@@ -323,7 +323,6 @@
         return flag
       },
       handleData() {
-        console.log(this.evaluationInfo)
         this.evaluationInfo.schoolCode = this.demoLoginInfo.schoolCode
         let requestData = {
           name: this.evaluationInfo.name,
@@ -341,7 +340,6 @@
         this.$api.learnActivity.SaveExamInfo(requestData).then(
           res => {
             if (res.error == null) {
-              console.log(res.result.data)
               this.examInfo = res.result.data
               for (let index in this.evaluationInfo.testPaper) {
                 this.saveTestPaper(this.evaluationInfo.testPaper[index], index)
@@ -371,7 +369,6 @@
           this.$api.learnActivity.SaveExamPaper(requestData).then(
             res => {
               if (res.error == null) {
-                console.log(res.result.data)
                 this.evaluationInfo.testPaper[index].id = res.result.data.id
               } else {
                 this.$Message.error('API ERROR!')
@@ -384,7 +381,6 @@
         }
       },
       saveEvaluation() {
-        console.log(this.evaluationInfo)
         if (this.checkData()) {
           this.handleData()
           

+ 52 - 0
TEAMModelOS/ClientApp/src/view/learnactivity/ManageEvaluation.less

@@ -0,0 +1,52 @@
+@main-bgColor: rgb(40,40,40); //主背景颜色
+@borderColor: #424242;
+@primary-textColor: #fff; //文本主颜色
+@second-textColor: #a5a5a5; //文本副级颜色
+@primary-fontSize: 14px;
+@second-fontSize: 16px;
+
+.manage-evaluation-container {
+  width: 100%;
+  height: 100%;
+  color: white;
+  .evaluation-list-wrap{
+    width:350px;
+    height:100%;
+    border-right:1px solid @borderColor;
+    padding-left:15px;
+  }
+}
+
+.evaluation-list-wrap {
+  .evaluation-list-title {
+    width: 100%;
+    height: 45px;
+    line-height: 45px;
+    border-bottom: 1px solid @borderColor;
+    color: @second-textColor;
+  }
+
+  .evaluation-list-main {
+    width: 100%;
+    height: ~"calc(100% - 45px)";
+
+    .evaluation-item {
+      border-bottom: 1px solid @borderColor;
+      padding: 10px 10px 10px 0px;
+      cursor: pointer;
+
+      .evaluation-name {
+        font-size: 20px;
+      }
+
+      .evaluation-type {
+        margin-top: 8px;
+        color: @second-textColor;
+      }
+    }
+
+    .evaluation-item-active {
+      background-image: linear-gradient(90deg, rgba(30, 30, 30, 0) 0%, rgba(110, 110, 110, 0.2) 50%, rgba(110, 110, 110, 0.4) 100%);
+    }
+  }
+}

+ 41 - 3
TEAMModelOS/ClientApp/src/view/learnactivity/ManageEvaluation.vue

@@ -1,12 +1,50 @@
 <template>
-  <div>
-    管理评测
+  <div class="manage-evaluation-container">
+    <div class="evaluation-list-wrap">
+      <div class="evaluation-list-title">
+        评测列表
+      </div>
+      <div class="evaluation-list-main">
+        <vuescroll>
+          <div :class="index == avtiveEvaluationIndex ? 'evaluation-item evaluation-item-active':'evaluation-item'" v-for="(item,index) in evaluationList" @click="selectEvaluation(index)">
+            <p class="evaluation-name">一年级期末考试</p>
+            <p class="evaluation-type">
+              <Icon type="ios-cube" color="#a5a5a5" style="margin-right:10px;" size="16" />
+              <span>评测类型:段考</span>
+            </p>
+            <p class="evaluation-type">
+              <Icon type="ios-funnel" color="#a5a5a5" style="margin-right:10px;" size="16" />
+              <span>小学 / 语文</span>
+            </p>
+          </div>
+          <!--<div class="evaluation-info-item evaluation-info-item-active">
+            <p class="evaluation-name">一年级期末考试</p>
+            <p class="evaluation-type">
+              <Icon type="ios-cube" color="#a5a5a5" style="margin-right:10px;" size="16" />
+              <span>评测类型:段考</span>
+            </p>
+            <p class="evaluation-type">
+              <Icon type="ios-funnel" color="#a5a5a5" style="margin-right:10px;" size="16" />
+              <span>小学 / 语文</span>
+            </p>
+          </div>-->
+        </vuescroll>
+      </div>
+    </div>
   </div>
 </template>
 <script>
   export default {
     data() {
-
+      return {
+        avtiveEvaluationIndex: 0,
+        evaluationList:[1,1,1,2]
+      }
+    },
+    methods: {
+      selectEvaluation(index) {
+        this.avtiveEvaluationIndex = index
+      }
     }
   }
 </script>

+ 4 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/ManualCreate.vue

@@ -154,8 +154,10 @@
           for (let i = 0; i < groupResult.length; i++) {
             this.groupQuestion[groupResult[i][0].type] = groupResult[i].length
           }
-          console.log(this.groupQuestion)
-          this.$emit('selectedQuestion', this.shoppingQuestionList)
+          this.$emit('selectedQuestion', {
+            questions: this.shoppingQuestionList,
+            item:data
+          })
         } else {
           this.$Message.warning('此题目已添加!')
         }

+ 10 - 0
TEAMModelOS/ClientApp/src/view/learnactivity/TeacherPreview.less

@@ -6,4 +6,14 @@
 .test-paper-points{
   width:100%;
   margin-top:15px;
+}
+.question-type-scope {
+  width: 100%;
+  margin-bottom:15px;
+  .question-type-count{
+    color:white;
+    font-size:16px;
+    display:inline-block;
+    /*margin-bottom:15px;*/
+  }
 }

+ 136 - 6
TEAMModelOS/ClientApp/src/view/learnactivity/TeacherPreview.vue

@@ -17,7 +17,7 @@
           </Col>
           <Col :xs="24" :sm="24" :md="12" :lg="6">
           <span>题量:</span>
-          <span>15</span>
+          <span>{{testPaper.questions.length}}</span>
           </Col>
         </Row>
         <div class="test-paper-points">
@@ -34,31 +34,161 @@
           <Tag>标签二</Tag>
         </div>
       </div>
-      <QuestionList :questions="questionList"></QuestionList>
+      <div class="question-type-scope" v-if="groupQuestion.Single != undefined">
+        <span class="question-type-count">{{getOrder('Single')}}单选题(共{{groupQuestion.Single.length}}题)</span>
+        <QuestionList :questions="groupQuestion.Single">
+          <template v-slot:score>
+            <span>配分</span>
+            <InputNumber :max="10" :min="1" v-model="value1" size="small" style="width: 40px"></InputNumber>
+          </template>
+        </QuestionList>
+      </div>
+      <div class="question-type-scope" v-if="groupQuestion.Multiple != undefined">
+        <span class="question-type-count">{{getOrder('Multiple')}}多选题(共{{groupQuestion.Multiple.length}}题)</span>
+        <QuestionList :questions="groupQuestion.Multiple"></QuestionList>
+      </div>
+      <div class="question-type-scope" v-if="groupQuestion.Complete != undefined">
+        <span class="question-type-count">{{getOrder('Complete')}}填空题(共{{groupQuestion.Complete.length}}题)</span>
+        <QuestionList :questions="groupQuestion.Complete"></QuestionList>
+      </div>
+      <div class="question-type-scope" v-if="groupQuestion.Judge != undefined">
+        <span class="question-type-count">{{getOrder('Judge')}}判断题(共{{groupQuestion.Judge.length}}题)</span>
+        <QuestionList :questions="groupQuestion.Judge"></QuestionList>
+      </div>
+      <div class="question-type-scope" v-if="groupQuestion.Subjective != undefined">
+        <span class="question-type-count">{{getOrder('Subjective')}}问答题(共{{groupQuestion.Subjective.length}}题)</span>
+        <QuestionList :questions="groupQuestion.Subjective"></QuestionList>
+      </div>
+      <div class="question-type-scope" v-if="groupQuestion.Compose != undefined">
+        <span class="question-type-count">{{getOrder('Compose')}}综合题(共{{groupQuestion.Compose.length}}题)</span>
+        <QuestionList :questions="groupQuestion.Compose"></QuestionList>
+      </div>
+
+      <div style="text-align:center;margin-top:20px;margin-bottom:30px;">
+        <Button type="info" style="width:300px;" @click="saveTestPaper">保存试卷</Button>
+      </div>
     </vuescroll>
   </div>
 </template>
 <script>
   import QuestionList from '@/components/learnactivity/QuestionList.vue'
+  import jsFn from '@/utils/js-fn.js'
   export default {
     components: {
       QuestionList
     },
     props: {
-      questionList: {
-        type: Array,
+      testPaper: {
+        type: Object,
         default: () => {
-          return []
+          return {
+            questions:[]
+          }
         }
       }
     },
     data() {
       return {
-        value1:100
+        value1: 100,
+        index:-1,
+        groupQuestion: {}
       }
     },
     methods: {
+      saveTestPaper() {
 
+      },
+      checkCount(count) {
+        switch (count) {
+          case 0:
+            return '一、'
+            break
+          case 1:
+            return '二、'
+            break
+          case 2:
+            return '三、'
+            break
+          case 3:
+            return '四、'
+            break
+          case 4:
+            return '五、'
+            break
+          case 5:
+            return '六、'
+            break
+          default:
+            return ''
+            break
+        }
+      },
+      getOrder(type) {
+        let count = 0
+        switch (type) {
+          case 'Single':
+            return '一、'
+            break
+          case 'Multiple':
+            if (this.groupQuestion.Single != undefined) {
+              return '二、'
+            } else {
+              return '一、'
+            }
+            break
+          case 'Complete':
+            for (let key in this.groupQuestion) {
+              if (key == 'Single' || key == 'Multiple') {
+                count++
+              }
+            }
+            return this.checkCount(count)
+            break
+          case 'Judge':
+            
+            for (let key in this.groupQuestion) {
+              if (key == 'Single' || key == 'Complete' || key == 'Multiple') {
+                count++
+              }
+            }
+            return this.checkCount(count)
+            break
+          case 'Subjective':
+            for (let key in this.groupQuestion) {
+              if (key == 'Single' || key == 'Complete' || key == 'Multiple' || key == 'Judge') {
+                count++
+              }
+            }
+            return this.checkCount(count)
+            break
+          case 'Compose':
+            for (let key in this.groupQuestion) {
+              if (key == 'Single' || key == 'Complete' || key == 'Multiple' || key == 'Judge' || key == 'Subjective') {
+                count++
+              }
+            }
+            return this.checkCount(count)
+            break
+          default:
+            return ''
+            break
+        }
+      }
+    },
+    computed: {
+    },
+    watch: {
+      'testPaper.questions': {
+        handler(newName, oldName) {
+          let groupResult = jsFn.groupBy(this.testPaper.questions, 'type')
+          console.log('45678')
+          for (let i = 0; i < groupResult.length; i++) {
+            this.groupQuestion[groupResult[i][0].type] = groupResult[i]
+          }
+          console.log(this.groupQuestion)
+        },
+        deep: true
+      }
     },
     mounted() {
     }

+ 219 - 196
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -1260,242 +1260,265 @@ namespace TEAMModelOS.Controllers.Analysis
             string Grade = "";
             List<double> CoreAverage = new List<double>();
             double weightSum = 0;
-            foreach(ExamInfo e in exams) { 
-                Dictionary<string, object> sub = new Dictionary<string, object>
+            try {
+                foreach (ExamInfo e in exams)
+                {
+                    Dictionary<string, object> sub = new Dictionary<string, object>
                 {
                     { "ExamCode",  e.id}
                 };
-                Period = e.conditions.period;
-                Grade = e.conditions.grade;
-                List<string> subjects = new List<string>();
-                List<List<string>> SubjectClassAverage = new List<List<string>>();
-                List<List<string>> SubjectAverage = new List<List<string>>();
-                //List<List<string>> SubjectClassAverage = new List<List<string>>();
-                List<SimpleExam> simples = await azureCosmosDBRepository.FindByDict<SimpleExam>(sub);
-                // 学生总分
-                double coreSum = 0;
-                int stuCount = e.stuCount;
-                //初始化进行人数
-                double iPersons = 0;
-                //获取进线人数
-                iPersons = stuCount * 0.4;
-                //
-                List<List<int>> subSum = new List<List<int>>();
-                if (simples.IsEmpty()) continue;
-                double weight = 0.5; 
-                weightSum += weight;
-                int classLen = simples[0].Classes.Count;
-                for (int cls = 0; cls < classLen; cls++)
-                {
-                    if (simples[0].Classes[cls].TryGetValue(simples[0].Classes[cls].Keys.ToArray<string>()[0], out int[] indexs))
+                    Period = e.conditions.period;
+                    Grade = e.conditions.grade;
+                    List<string> subjects = new List<string>();
+                    List<List<string>> SubjectClassAverage = new List<List<string>>();
+                    List<List<string>> SubjectAverage = new List<List<string>>();
+                    //List<List<string>> SubjectClassAverage = new List<List<string>>();
+                    List<SimpleExam> simples = await azureCosmosDBRepository.FindByDict<SimpleExam>(sub);
+                    // 学生总分
+                    double coreSum = 0;
+                    int stuCount = e.stuCount;
+                    //初始化进行人数
+                    double iPersons = 0;
+                    //获取进线人数
+                    iPersons = stuCount * 0.4;
+                    //
+                    List<List<int>> subSum = new List<List<int>>();
+                    if (simples.IsEmpty()) continue;
+                    double weight = 0.5;
+                    weightSum += weight;
+                    int classLen = simples[0].Classes.Count;
+                    for (int cls = 0; cls < classLen; cls++)
                     {
-                        List<int> stuScore = new List<int>();
-                        int stdLen = indexs[1] - indexs[0] + 1;
-
-                        for (int i = 0; i < stdLen; i++)
+                        if (simples[0].Classes[cls].TryGetValue(simples[0].Classes[cls].Keys.ToArray<string>()[0], out int[] indexs))
                         {
-                            stuScore.Add(0);
+                            List<int> stuScore = new List<int>();
+                            int stdLen = indexs[1] - indexs[0] + 1;
+
+                            for (int i = 0; i < stdLen; i++)
+                            {
+                                stuScore.Add(0);
+                            }
+                            subSum.Add(stuScore);
                         }
-                        subSum.Add(stuScore);
                     }
-                }
 
-                simples.ForEach(s =>
-                {
-                    Dictionary<string, object> detail = new Dictionary<string, object>
+                    simples.ForEach(s =>
+                    {
+                        Dictionary<string, object> detail = new Dictionary<string, object>
                     {
                         { "name", s.Subject }
                     };
-                    subjects.Add(s.Subject);
-                    subjectList.Add(s.Subject);
-                    //计算试卷总分
-                    int sum = s.Point.Sum();
-                    //int stuSum = 0;
-                    int classIndex = 0;
-                    List<string> ClassAverage = new List<string>();
-                    List<string> Average = new List<string>();
-                    List<string> passList = new List<string>();
-                    s.Classes.ForEach(c =>
-                    {
-                        List<List<string>> classPRL = new List<List<string>>();
-
-                        //初始化班级总分
-                        int classPoint = 0;
-                        //初始化班级缺考人数
-                        int classCount = 0;
-                        //初始化班级平均得分率
-                        double points = 0;
-                        //初始化班级平均得分率
-                        double AveragePoints = 0;
-                        //初始化各班参考人数
-                        int counts = 0;
-                        //c.Keys遍历key值
-                        foreach (string key in c.Keys)
+                        subjects.Add(s.Subject);
+                        subjectList.Add(s.Subject);
+                        //计算试卷总分
+                        int sum = s.Point.Sum();
+                        //int stuSum = 0;
+                        int classIndex = 0;
+                        List<string> ClassAverage = new List<string>();
+                        List<string> Average = new List<string>();
+                        List<string> passList = new List<string>();
+                        s.Classes.ForEach(c =>
                         {
-                            classList.Add(key);
-                        }
-                        //每个班级平均分
-                        foreach (int[] value in c.Values)
-                        {
-                            for (int i = value[0]; i <= value[1]; i++)
+                            List<List<string>> classPRL = new List<List<string>>();
+
+                            //初始化班级总分
+                            int classPoint = 0;
+                            //初始化班级缺考人数
+                            int classCount = 0;
+                            //初始化班级平均得分率
+                            double points = 0;
+                            //初始化班级平均得分率
+                            double AveragePoints = 0;
+                            //初始化各班参考人数
+                            int counts = 0;
+                            //c.Keys遍历key值
+                            foreach (string key in c.Keys)
                             {
-                                //初始化学生单科个人得分
-                                int stuPoints = s.Result[i].Sum();
+                                classList.Add(key);
+                            }
+                            //每个班级平均分
+                            foreach (int[] value in c.Values)
+                            {
+                                for (int i = value[0]; i <= value[1]; i++)
+                                {
+                                    //初始化学生单科个人得分
+                                    int stuPoints = s.Result[i].Sum();
 
-                                subSum[classIndex][i - value[0]] = stuPoints + subSum[classIndex][i - value[0]];
+                                    subSum[classIndex][i - value[0]] = stuPoints + subSum[classIndex][i - value[0]];
 
-                                classPoint += s.Result[i].Sum();
-                                coreSum += s.Result[i].Sum();
+                                    classPoint += s.Result[i].Sum();
+                                    coreSum += s.Result[i].Sum();
 
-                                if (s.Result[i].Sum() == 0)
-                                {
-                                    classCount++;
+                                    if (s.Result[i].Sum() == 0)
+                                    {
+                                        classCount++;
+                                    }
                                 }
-                            }                            
-                            //每个班级实际参考人数
-                            counts = value[1] - value[0] - classCount + 1;
-                            //stuSum += counts;
-                            points = Convert.ToDouble(classPoint) / counts / sum;
-                            //计算每个班级平均得分
-                            AveragePoints = Convert.ToDouble(classPoint) / counts;
-                            ClassAverage.Add(points.ToString("0.000"));
-                            Average.Add(AveragePoints.ToString());                            
+                                //每个班级实际参考人数
+                                counts = value[1] - value[0] - classCount + 1;
+                                //stuSum += counts;
+                                points = Convert.ToDouble(classPoint) / counts / sum;
+                                //计算每个班级平均得分
+                                AveragePoints = Convert.ToDouble(classPoint) / counts;
+                                ClassAverage.Add(points.ToString("0.000"));
+                                Average.Add(AveragePoints.ToString());
+                            }
+                            classIndex += 1;
+                        });
+                        SubjectClassAverage.Add(ClassAverage);
+                        SubjectAverage.Add(Average);
+                        //subAverage = subjectPoint / ClassAverage.Count();
+                        //subjectAverage.Add(subAverage.ToString("0.00"));
+                    });
+                    double core = coreSum / stuCount * weight;
+                    CoreAverage.Add(core);
+                    AllPoint.Add(SubjectClassAverage);
+                    AllPointAverage.Add(SubjectAverage);
+
+                    //处理人数为整
+                    string ip = iPersons.ToString("0");
+                    //初始化进线分数
+                    int ipoint = 0;
+                    List<int> AllPoints = new List<int>();
+                    foreach (List<int> points in subSum)
+                    {
+                        foreach (int po in points)
+                        {
+                            AllPoints.Add(po);
                         }
-                        classIndex += 1;
-                    });                  
-                    SubjectClassAverage.Add(ClassAverage);
-                    SubjectAverage.Add(Average);
-                    //subAverage = subjectPoint / ClassAverage.Count();
-                    //subjectAverage.Add(subAverage.ToString("0.00"));
-                });
-                double core = coreSum / stuCount * weight;
-                CoreAverage.Add(core);
-                AllPoint.Add(SubjectClassAverage);
-                AllPointAverage.Add(SubjectAverage);
-
-                //处理人数为整
-                string ip = iPersons.ToString("0");
-                //初始化进线分数
-                int ipoint = 0;
-                List<int> AllPoints = new List<int>();
-                foreach (List<int> points in subSum) {
-                    foreach (int po in points) {
-                        AllPoints.Add(po);
                     }
-                }
-                for (int i = 0;i< subSum.Count;i++) {
-                    for (int j =0;j <subSum[i].Count;j++) {
-                        if (subSum[i][j].Equals("0")) {
-                            subSum[i].Remove(subSum[i][j]);
+                    for (int i = 0; i < subSum.Count; i++)
+                    {
+                        for (int j = 0; j < subSum[i].Count; j++)
+                        {
+                            if (subSum[i][j].Equals("0"))
+                            {
+                                subSum[i].Remove(subSum[i][j]);
+                            }
                         }
                     }
-                }
-                //计算成绩年级排名
-                AllPoints.Sort(delegate (int s1, int s2) { return s2.CompareTo(s1); });
-                ipoint = AllPoints[int.Parse(ip)];
-                int m = 0;
-                List<List<string>> KeyLine = new List<List<string>>();
-                foreach (List<int> points in subSum)
-                {
-                    List<string> detail = new List<string>();
-                    double sum = points.Count;
-                    int j = 0;
-                    for (int i = 0; i < points.Count; i++)
+                    //计算成绩年级排名
+                    AllPoints.Sort(delegate (int s1, int s2) { return s2.CompareTo(s1); });
+                    ipoint = AllPoints[int.Parse(ip)];
+                    int m = 0;
+                    List<List<string>> KeyLine = new List<List<string>>();
+                    foreach (List<int> points in subSum)
                     {
-                        if (points[i] > ipoint)
+                        List<string> detail = new List<string>();
+                        double sum = points.Count;
+                        int j = 0;
+                        for (int i = 0; i < points.Count; i++)
                         {
-                            j++;
+                            if (points[i] > ipoint)
+                            {
+                                j++;
+                            }
                         }
+                        double Lines = j;
+                        detail.Add(Lines.ToString());
+                        detail.Add(points.Count.ToString());
+                        var t3 = Math.Floor(Math.Round(decimal.Parse((Lines / sum).ToString("0.000")), 2) * 100);
+                        detail.Add(t3.ToString());
+                        KeyLine.Add(detail);
+                        m++;
                     }
-                    double Lines = j;
-                    detail.Add(Lines.ToString());
-                    detail.Add(points.Count.ToString());
-                    var t3 = Math.Floor(Math.Round(decimal.Parse((Lines / sum).ToString("0.000")), 2) * 100);
-                    detail.Add(t3.ToString());
-                    KeyLine.Add(detail);
-                    m++;
+                    AllKeyLine.Add(KeyLine);
+
                 }
-                AllKeyLine.Add(KeyLine);
-
-            } 
-            //年级成就指标
-            double index = CoreAverage.Sum() / weightSum;
-            List<List<double>> AveragePoint = new List<List<double>>();
-            List<List<double>> AverageClassPoint = new List<List<double>>();
-            //List<double> ClassCore = new List<double>();
-            int k = AllPoint.Count;
-            for (int m = 0; m < AllPoint[0].Count; m++)
-            {
-                List<double> SubjectAverage = new List<double>();
-                for (int n = 0; n < AllPoint[0][m].Count; n++)
+                //年级成就指标
+                double index = CoreAverage.Sum() / weightSum;
+                List<List<double>> AveragePoint = new List<List<double>>();
+                List<List<double>> AverageClassPoint = new List<List<double>>();
+                //List<double> ClassCore = new List<double>();
+                int k = AllPoint.Count;
+                if (k > 0)
                 {
-                    double startPoint = 0;
-                    for (int f = 0; f < k;f++) {
-                        startPoint = double.Parse(AllPoint[f][m][n]) + startPoint;
+                    for (int m = 0; m < AllPoint[0].Count; m++)
+                    {
+                        List<double> SubjectAverage = new List<double>();
+                        for (int n = 0; n < AllPoint[0][m].Count; n++)
+                        {
+                            double startPoint = 0;
+                            for (int f = 0; f < k; f++)
+                            {
+                                startPoint = double.Parse(AllPoint[f][m][n]) + startPoint;
+                            }
+                            SubjectAverage.Add(startPoint / k);
+                        }
+                        AveragePoint.Add(SubjectAverage);
                     }
-                    SubjectAverage.Add(startPoint/k);
                 }
-                AveragePoint.Add(SubjectAverage);
-            }
-            
-            //每个班级成就指标
-            int p = AllPointAverage.Count;
-            for (int m = 0; m < AllPointAverage[0].Count; m++)
-            {
-                List<double> SubjectAverage = new List<double>();
-                for (int n = 0; n < AllPointAverage[0][m].Count; n++)
+                //每个班级成就指标
+                int p = AllPointAverage.Count;
+                if (p > 0)
                 {
-                    double startPoint = 0;
-                    for (int f = 0; f < k; f++)
+                    for (int m = 0; m < AllPointAverage[0].Count; m++)
                     {
-                        startPoint = double.Parse(AllPointAverage[f][m][n]) + startPoint;
+                        List<double> SubjectAverage = new List<double>();
+                        for (int n = 0; n < AllPointAverage[0][m].Count; n++)
+                        {
+                            double startPoint = 0;
+                            for (int f = 0; f < k; f++)
+                            {
+                                startPoint = double.Parse(AllPointAverage[f][m][n]) + startPoint;
+                            }
+                            SubjectAverage.Add(startPoint / k);
+                        }
+                        AverageClassPoint.Add(SubjectAverage);
                     }
-                    SubjectAverage.Add(startPoint / k);
                 }
-                AverageClassPoint.Add(SubjectAverage);
-            }
-            int c = AverageClassPoint.Count;
-            List<double> ClassCore = new List<double>();
-            for (int j = 0; j < AverageClassPoint[0].Count; j++)
-            {
-                double startAverage = 0;
-                for (int f = 0; f < c; f++)
+                int c = AverageClassPoint.Count;
+                List<double> ClassCore = new List<double>();
+                if (c > 0)
                 {
-                    startAverage = AverageClassPoint[f][j] + startAverage;
+                    for (int j = 0; j < AverageClassPoint[0].Count; j++)
+                    {
+                        double startAverage = 0;
+                        for (int f = 0; f < c; f++)
+                        {
+                            startAverage = AverageClassPoint[f][j] + startAverage;
+                        }
+                        ClassCore.Add(startAverage / weightSum);
+                    }
                 }
-                ClassCore.Add(startAverage / weightSum);
-            }
-           
-            //班级平均进线率
-            int ExamCount = AllKeyLine.Count;
-            List<List<double>> KeyLines = new List<List<double>>();
-            for (int m = 0; m < AllKeyLine[0].Count; m++)
-            {
-                List<double> ClassLine = new List<double>();
-                for (int n = 0; n < AllKeyLine[0][m].Count; n++)
+                //班级平均进线率
+                int ExamCount = AllKeyLine.Count;
+                List<List<double>> KeyLines = new List<List<double>>();
+                if (ExamCount > 0)
                 {
-                    double startPoint = 0;
-                    for (int f = 0; f < ExamCount; f++)
+                    for (int m = 0; m < AllKeyLine[0].Count; m++)
                     {
-                        startPoint = double.Parse(AllKeyLine[f][m][n]) + startPoint;
+                        List<double> ClassLine = new List<double>();
+                        for (int n = 0; n < AllKeyLine[0][m].Count; n++)
+                        {
+                            double startPoint = 0;
+                            for (int f = 0; f < ExamCount; f++)
+                            {
+                                startPoint = double.Parse(AllKeyLine[f][m][n]) + startPoint;
+                            }
+                            ClassLine.Add(startPoint / ExamCount);
+                        }
+                        KeyLines.Add(ClassLine);
                     }
-                    ClassLine.Add(startPoint / ExamCount);
                 }
-                KeyLines.Add(ClassLine);
+                Dictionary<string, object> AveragePointMap = new Dictionary<string, object>
+                {
+                    { "Period",Period},
+                    { "Grade",Grade},
+                    { "index", index},
+                    { "className", classList },
+                    { "subjectName", subjectList },
+                    { "AveragePoint", AveragePoint },
+                    //{ "AverageClassPoint", AverageClassPoint },
+                    { "ClassCore", ClassCore },
+                    { "KeyLines",KeyLines}
+                };
+                builder.Data(AveragePointMap);
+                return builder.build();
+            } catch (Exception e) {
+                Console.WriteLine("---------------------" + e.Message + "--------------------------");
             }
-            Dictionary<string, object> AveragePointMap = new Dictionary<string, object>
-            {
-                { "Period",Period},
-                { "Grade",Grade},
-                { "index", index},
-                { "className", classList },
-                { "subjectName", subjectList },
-                { "AveragePoint", AveragePoint },
-                //{ "AverageClassPoint", AverageClassPoint },
-                { "ClassCore", ClassCore },
-                { "KeyLines",KeyLines}
-             };
-            builder.Data(AveragePointMap);
+            builder.Data("");
             return builder.build();
         }
     }

+ 38 - 1
TEAMModelOS/Controllers/Test/TestController.cs

@@ -5,18 +5,55 @@ using System.Threading.Tasks;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using TEAMModelOS.Models;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 namespace TEAMModelOS.Controllers.Test
 {
-    [Authorize]
+    //[Authorize]
     [Route("[controller]")]
     [ApiController]
     public class TestController : ControllerBase
     {
+        private readonly IAzureCosmosDBV3Repository azureCosmosDBRepository;
+
+        public TestController(IAzureCosmosDBV3Repository azureCosmosDBRepository)
+        {
+            this.azureCosmosDBRepository = azureCosmosDBRepository;
+        }
+
         [HttpGet]
         public IActionResult Get()
         {
             return new JsonResult(new { a="aa", c="bb" });
         }
+
+
+        [HttpPost("SimulatedData")]
+        public async Task<List<Family>> SimulatedDataAsync(string request)
+        {
+            var repository = new SampleCustomerRepository();
+            List<Family> customers = repository.GetCustomers().ToList();
+            List<Family> customers1 = await azureCosmosDBRepository.SaveAll<Family>(customers);
+            return customers;
+        }
+
+
+        [HttpPost("FindKnowledge")]
+        public async Task<BaseJosnRPCResponse> FindSchoolPointByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+          JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<string> st = new List<string> { "FamilyOrder", "LastName","Children", "Parents" , "Address" };
+            //List<Family> families = await azureCosmosDBRepository.FindAll<Family>(propertys: st);
+            Dictionary<string,object > keyValuePairs = new Dictionary<string, object>();
+            List<Family> families1 = new List<Family>();
+            keyValuePairs.Add("aaaa", families1);
+            //List<Family> families = await azureCosmosDBRepository.FindByDict<Family>(dict: keyValuePairs, propertys: st);
+            List<Family> families = await azureCosmosDBRepository.FindByDict<Family>(dict: request.@params);
+
+          return builder.Data(families).Extend(new Dictionary<string, object> { {"Count", families.Count } }).build();
+        }
     }
 }

+ 55 - 0
TEAMModelOS/Models/Family.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+
+namespace TEAMModelOS.Controllers.Test
+{
+    [CosmosDB(RU = 400, Name = "Family")]
+    public class Family : ID
+    {
+        // public string Id { get; set; }
+        public int FamilyOrder { get; set; }
+        public string LastName { get; set; }
+        [PartitionKey]
+        public string PartitionKey { get; set; } = "aaaaaaaa";
+        public List<Parent> Parents { get; set; }
+        public List<Child> Children { get; set; }
+        public Address Address { get; set; }
+        public bool IsRegistered { get; set; }
+        public string id { get; set; }
+        // The ToString() method is used to format the output, it's used for demo purpose only. It's not required by Azure Cosmos DB
+
+    }
+
+    public class Parent
+    {
+        public string FamilyName { get; set; }
+        public string FirstName { get; set; }
+    }
+
+    public class Child
+    {
+        public string FamilyName { get; set; }
+        public string FirstName { get; set; }
+        public string Gender { get; set; }
+        public int Grade { get; set; }
+        public double Score { get; set; }
+        public List<Pet> Pets { get; set; }
+    }
+
+    public class Pet
+    {
+        public string GivenName { get; set; }
+        public int Age { get; set; }
+    }
+
+    public class Address
+    {
+        public string State { get; set; }
+        public string County { get; set; }
+        public string City { get; set; }
+    }
+}

+ 55 - 0
TEAMModelOS/Models/SampleCustomerRepository.cs

@@ -0,0 +1,55 @@
+using Bogus;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.Controllers.Test
+{
+    public class SampleCustomerRepository
+    {
+        public enum Gender
+        {
+            Male,
+            Female
+        }
+        public IEnumerable<Family> GetCustomers()
+        {
+       
+
+        //Randomizer.Seed = new Random(123456);
+        var parent = new Faker<Parent>("zh_CN")
+                .RuleFor(o => o.FamilyName, f => f.Name.FirstName())
+                .RuleFor(o => o.FirstName, f => f.Name.LastName());
+
+            var pet = new Faker<Pet>("zh_CN")
+              .RuleFor(o => o.GivenName, f => f.Name.FullName())
+               .RuleFor(o => o.Age, f => f.Random.Number(0,13));
+
+            var child = new Faker<Child>("zh_CN")
+             .RuleFor(o => o.FamilyName, f => f.Name.FirstName())
+             .RuleFor(o => o.FirstName, f => f.Name.FirstName())
+             .RuleFor(o => o.Gender, f => f.PickRandom<Gender>().ToString())
+             .RuleFor(o => o.Grade, f => f.Random.Number(1, 16))
+             .RuleFor(o => o.Score, f => f.Random.Double(30, 100))
+             .RuleFor(o => o.Pets, f => pet.Generate(f.Random.Number(1, 4)).ToList());
+
+            var address = new Faker<Address>("zh_CN")
+           .RuleFor(o => o.State, f => f.Address.State())
+           .RuleFor(o => o.County, f => f.Address.Country())
+           .RuleFor(o => o.City, f => f.Address.City());
+
+            var orderIds = 0;
+            var customerGenerator = new Faker<Family>("zh_CN")
+                .RuleFor(c => c.FamilyOrder, f => orderIds++)
+                .RuleFor(c => c.id, f =>f.Random.Guid().ToString())//Guid.NewGuid().ToString()
+                .RuleFor(c => c.LastName, f => f.Name.LastName())
+                .RuleFor(c => c.IsRegistered, f => f.Random.Bool())
+                .RuleFor(c => c.Parents, f => parent.Generate(f.Random.Number(2,2)).ToList())
+                .RuleFor(c => c.Children, f => child.Generate(f.Random.Number(1,3)).ToList())
+                .RuleFor(c => c.Address, f => address.Generate(1).ToList()[0]);
+
+            return customerGenerator.Generate(350);
+        }
+    }
+}

+ 1 - 0
TEAMModelOS/TEAMModelOS.csproj

@@ -10,6 +10,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="Bogus" Version="29.0.1" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />
     <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
     <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />