Explorar el Código

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

李思淳 hace 5 años
padre
commit
e767f92af2

BIN
TEAMModelGrpc/habook.pfx


+ 53 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/ContentFileList.less

@@ -0,0 +1,53 @@
+@main-bgColor: rgb(40,40,40); //主背景颜色
+@borderColor: #424242;
+@primary-textColor: #fff; //文本主颜色
+@second-textColor: #a5a5a5; //文本副级颜色
+@primary-fontSize: 14px;
+@second-fontSize: 16px;
+
+.content-file-wrap {
+    height: fit-content;
+    padding: 10px 0px 20px 0px;
+    color: white;
+}
+.content-file-item {
+    width: ~"calc(100% - 10px)";
+
+    .action-icon {
+        cursor: pointer;
+        margin-right: 8px;
+        font-size: 18px;
+        line-height: 22px;
+
+        &:hover {
+            color: aqua;
+        }
+    }
+
+    .content-file-name-wrap {
+        font-size: 15px;
+        width: ~"calc(100% - 80px)";
+    }
+
+    .content-file-item-action {
+        display: none;
+    }
+
+    &:hover {
+        border-bottom: 1px solid @borderColor;
+        background: #606060;
+        padding-left: 4px;
+        border-radius: 4px;
+    }
+
+    &:hover .content-file-item-action {
+        display: inline-block;
+        float: right;
+    }
+}
+
+.file-icon {
+    display: inline-block;
+    vertical-align: sub;
+    margin-right: 5px;
+}

+ 71 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/ContentFileList.vue

@@ -0,0 +1,71 @@
+<template>
+    <div class="content-file-wrap">
+        <div v-for="(item,index) in resources" class="content-file-item" :key="index">
+            <div class="file-icon">
+                <img v-if="item.extension == 'ppt' || item.extension == 'pptx'" src="../../assets/icon/ppt50.png" width="15" />
+                <img v-else-if="item.extension == 'doc' || item.extension == 'docx'" src="../../assets/icon/word50.png" width="15" />
+                <img v-else-if="item.extension == 'xls' || item.extension == 'xlsx'" src="../../assets/icon/xls50.png" width="15" />
+                <img v-else-if="item.extension == 'pdf'" src="../../assets/icon/pdf50.png" width="15" />
+                <img v-else-if="item.type == 'picture'" src="../../assets/icon/icon_img.png" width="15" />
+                <img v-else-if="item.type == 'video'" src="../../assets/icon/icon_video.png" width="15" />
+                <img v-else src="../../assets/icon/prelearn50.png" width="15" />
+            </div>
+            <span>
+                {{item.fileName}}
+            </span>
+            <span class="content-file-item-action">
+                <Icon type="md-download" class="action-icon" title="下载" @click="downloadFile(item)" />
+                <Icon v-if="item.type == 'video' || item.type == 'picture' || item.extension == 'pdf'" type="md-eye" class="action-icon" title="预览" @click="clickToPreview(item)" />
+            </span>
+        </div>
+        <NoData style="margin-top:30px;" v-if="resources.length == 0"></NoData>
+        <Modal v-model="previewStatus" :title="previewFile.fileName" width="800px" class="dark-iview-modal">
+            <video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.blobUrl+sasString" width="780" controls="controls">
+                {{$t('teachContent.tips8')}}
+            </video>
+            <img v-if="previewFile.type == 'picture'" :src="previewFile.blobUrl+sasString" width="780" style="border-radius:5px;" />
+            <embed v-if="previewFile.type == 'document'" :src="previewFile.blobUrl+sasString" width="780" height="600" />
+            <div slot="footer"></div>
+        </Modal>
+    </div>
+</template>
+<script>
+    import NoData from '@/common/NoData.vue'
+    export default {
+        props: {
+            resources: {
+                type: Array,
+                default: () => {
+                    return []
+                }
+            }
+        },
+        components: {
+            NoData
+        },
+        data() {
+            return {
+                previewStatus: false,
+                previewFile: [],
+                sasString: '',
+            }
+        },
+        methods: {
+            downloadFile(item) {
+                window.location.href = item.blobUrl + this.sasString
+            },
+            clickToPreview(file) {
+                this.previewStatus = true
+                this.previewFile = file
+            }
+        },
+        watch: {
+            
+        }
+    }
+</script>
+<style scoped lang="less">
+    @import "./ContentFileList.less";
+</style>
+<style>
+</style>

+ 0 - 1
TEAMModelOS/ClientApp/src/components/learnactivity/QuestionList.vue

@@ -5,7 +5,6 @@
 
                 <span class="question-order">{{index+1+'.'}}</span>
                 <span class="question-text" v-html='item.question' ></span>
-                <!--<slot name="score"></slot>-->
                 <Icon v-if="config.showSelect" type="ios-cart" title="选题" class="choose-question-btn" size="25" @click.stop="selectQuestion(item)" :color="selectedId.indexOf(item.id) == -1 ? 'white':'aqua'"/>
                 <Icon type="ios-arrow-dropdown" :color="index == openIndex? 'cyan':'white'" size="25" @click.stop="toglleQuestionDetail(index)" :class="index == openIndex ? 'toggle-detail-icon toggle-detail-icon-up':'toggle-detail-icon toggle-detail-icon-down'" :title="openIndex == index ? '收起':'查看详情'" />
             </div>

+ 76 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/SelectLearnUnit.less

@@ -0,0 +1,76 @@
+.unit-filter-wrap {
+    background: #666666;
+    margin-bottom: 10px;
+    border-radius: 5px;
+    color: red;
+}
+
+.unit-list-wrap {
+    width: 100%;
+    height: 400px;
+    overflow: hidden;
+
+    &:before {
+        content: '';
+    }
+
+    .unit-list-item {
+        position: relative;
+        background: #484848;
+        margin-bottom: 2px;
+        margin-top: 6px;
+        border-radius: 2px;
+        padding: 10px 10px;
+        width: ~"calc(100% - 8px)";
+        height: fit-content;
+
+        &:hover {
+            background: #525252;
+            margin-bottom: 10px;
+            margin-top: 0px;
+            box-shadow: 1px 4px 5px #191919;
+        }
+
+        &:hover .unit-detail-action-icon {
+            display: inline-block !important;
+        }
+
+        .unit-name {
+            font-size: 16px;
+        }
+
+        .devid-line {
+            margin: 0 15px;
+            color: #AAAAAA;
+        }
+
+        .unit-detail-info {
+            font-size: 12px;
+            margin-top: 15px;
+            color: #AAAAAA;
+
+            .unit-detail-count {
+                color: white;
+            }
+        }
+
+        .unit-detail-action {
+            position: absolute;
+            right: 10px;
+            top: 0px;
+            line-height: 80px;
+
+            .unit-detail-action-icon {
+                color: white;
+                cursor: pointer;
+                font-size: 18px;
+                margin-right: 15px;
+                display: none;
+            }
+
+            .unit-detail-action-icon:hover {
+                color: aqua;
+            }
+        }
+    }
+}

+ 195 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/SelectLearnUnit.vue

@@ -0,0 +1,195 @@
+<template>
+    <div style="width:100%;height:100%;">
+        <div class="unit-filter-wrap dark-iview-input">
+            <Input search clearable placeholder="关键字搜索..." style="width: 100%" />
+        </div>
+        <div class="unit-list-wrap">
+            <vuescroll>
+                <div class="unit-list-item" v-for="(item,index) in unitList" @click="selectUnit(item)">
+                    <p class="unit-name">
+                        {{item.name}}
+                    </p>
+                    <div class="unit-detail-info">
+                        <span class="unit-datail-label">
+                            资源数量:
+                        </span>
+                        <span class="unit-detail-count">
+                            {{item.resource.length}}
+                        </span>
+                        <span class="devid-line">|</span>
+                        <span class="unit-datail-label">
+                            题目数量:
+                        </span>
+                        <span class="unit-detail-count">
+                            {{item.item.length}}
+                        </span>
+                    </div>
+                    <div class="unit-detail-action">
+                        <Icon class="unit-detail-action-icon" type="ios-folder-open" />
+                        <Icon class="unit-detail-action-icon" type="md-checkmark" :style="{color:selectedUnitId.indexOf(item.id) == -1 ? 'white':'aqua','display':selectedUnitId.indexOf(item.id) == -1 ? 'none':'inline-block'}" size="20" @click.stop="selectUnit(item)" />
+                    </div>
+                </div>
+            </vuescroll>
+        </div>
+    </div>
+</template>
+<script>
+    export default {
+        props: {
+            config: {
+                type: Object,
+                default: () => {
+                    return {
+                        type: 'check' //check:多选模式 radio:单选模式
+                    }
+                }
+            }
+        },
+        data() {
+            return {
+                currentUnitIndex: 0,
+                unitList: [],
+                selectedUnitId: [],
+                selectedUnitItem: [],
+            }
+        },
+        methods: {
+            /**
+             * 通过id查询题目信息
+             * */
+            findQuestionById() {
+                if (this.unitList.length > 0) {
+                    this.isLoading = true
+                    if (!this.unitList[this.currentUnitIndex].requestedI) {
+                        this.$api.learnActivity.FindQuestionById(this.unitList[this.currentUnitIndex].item).then(
+                            res => {
+                                if (res.error == null) {
+                                    this.unitList[this.currentUnitIndex].item.length = 0
+                                    this.$set(this.unitList[this.currentUnitIndex], 'item', res.result.data)
+                                    this.unitList[this.currentUnitIndex].requestedI = true
+                                    console.log(this.unitList)
+                                } else {
+                                    this.$Message.error("API ERROR!")
+                                    setTimeout(() => {
+                                        this.isLoading = false
+                                    }, 500)
+                                }
+                            },
+                            err => {
+                                this.$Message.error("API ERROR!")
+                                setTimeout(() => {
+                                    this.isLoading = false
+                                }, 500)
+                            }
+                        )
+                    } else {
+                        setTimeout(() => {
+                            this.isLoading = false
+                        }, 200)
+                    }
+                }
+            },
+            /**
+             * 通过id查询内容信息
+             * */
+            findResourceById() {
+                if (this.unitList.length > 0) {
+                    this.isLoading = true
+                    if (!this.unitList[this.currentUnitIndex].requestedR) {
+
+                        this.$api.learnActivity.FindSyllabusResourceById(this.unitList[this.currentUnitIndex].resource).then(
+                            res => {
+                                if (res.error == null) {
+                                    this.unitList[this.currentUnitIndex].resource.length = 0
+                                    this.unitList[this.currentUnitIndex].resource = res.result.data
+                                    this.unitList[this.currentUnitIndex].requestedR = true
+                                } else {
+                                    this.$Message.error("API ERROR!")
+                                }
+                                setTimeout(() => {
+                                    this.isLoading = false
+                                }, 500)
+                            },
+                            err => {
+                                this.$Message.error("API ERROR!")
+                                setTimeout(() => {
+                                    this.isLoading = false
+                                }, 500)
+                            }
+                        )
+                    } else {
+                        setTimeout(() => {
+                            this.isLoading = false
+                        }, 200)
+                    }
+                }
+            },
+            /**
+             * 获取最小单元列表
+             * */
+            getUnit() {
+                //this.isLoading = true
+                let requestData = {
+                    scopeCode: this.$store.state.schoolBaseInfo.demoLoginInfo.TEAMModelId
+                }
+                this.$api.learnActivity.FindUnit(requestData).then(
+                    res => {
+                        if (res.error == null) {
+                            this.unitList = res.result.data
+                            if (this.unitList.length > 0) {
+                                this.findResourceById()
+                                this.findQuestionById()
+                            }
+                        } else {
+                            this.$Message.error('API ERROR!')
+                        }
+                    },
+                    err => {
+
+                    }
+                )
+            },
+            selectUnit(item) {
+                if (this.config.type == 'check') {
+                    let index = this.selectedUnitId.indexOf(item.id)
+                    if (index == -1) {
+                        this.selectedUnitId.push(item.id)
+                        this.selectedUnitItem.push(item)
+                    } else {
+                        this.selectedUnitId.splice(index, 1)
+                        this.selectedUnitItem.splice(index, 1)
+                    }
+                    
+                } else {
+                    if (this.selectedUnitId.length == 0) {
+                        this.selectedUnitId.push(item.id)
+                        this.selectedUnitItem.push(item)
+                    } else {
+                        let index = this.selectedUnitId.indexOf(item.id)
+                        if (index == -1) {
+                            this.selectedUnitId.length = 0
+                            this.selectedUnitItem.length = 0
+                            this.selectedUnitId.push(item.id)
+                            this.selectedUnitItem.push(item)
+                        } else {
+                            this.selectedUnitId.splice(index, 1)
+                            this.selectedUnitItem.splice(index, 1)
+                        }
+                    }
+                    
+                }
+                console.log(this.selectedUnitItem)
+                this.$emit('selectUnit', this.selectedUnitItem)
+            },
+        },
+        created() {
+            this.getUnit()
+        }
+    }
+</script>
+<style lang="less" scoped>
+@import "./SelectLearnUnit.less";
+</style>
+<style>
+
+</style>

+ 1 - 1
TEAMModelOS/ClientApp/src/css/custom-animate.less

@@ -32,7 +32,7 @@
 .line-bottom::before {
     content: '';
     position: absolute;
-    bottom: -10px;
+    bottom: 0px;
     width: 0px;
     height: 2px;
     background-color: white;

+ 0 - 75
TEAMModelOS/ClientApp/src/view/selflearning/CreateSelfLearn.less

@@ -110,82 +110,7 @@
     margin-right:16px;
     color:white;
 }
-.unit-filter-wrap{
-    background:#666666;
-    margin-bottom:10px;
-    border-radius:5px;
-    color:red;
-}
-.unit-list-wrap {
-    width: 100%;
-    height: 400px;
-    overflow: hidden;
-
-    &:before {
-        content: '';
-    }
-
-    .unit-list-item {
-        position: relative;
-        background: #484848;
-        margin-bottom: 2px;
-        margin-top: 6px;
-        border-radius: 2px;
-        padding: 10px 10px;
-        width: ~"calc(100% - 8px)";
-        height: fit-content;
-
-        &:hover {
-            background: #525252;
-            margin-bottom: 10px;
-            margin-top: 0px;
-            box-shadow: 1px 4px 5px #191919;
-        }
-
-        &:hover .unit-detail-action-icon {
-            display: inline-block !important;
-        }
-
-        .unit-name {
-            font-size: 16px;
-        }
-
-        .devid-line {
-            margin: 0 15px;
-            color: #AAAAAA;
-        }
 
-        .unit-detail-info {
-            font-size: 12px;
-            margin-top: 15px;
-            color: #AAAAAA;
-
-            .unit-detail-count {
-                color: white;
-            }
-        }
-
-        .unit-detail-action {
-            position: absolute;
-            right: 10px;
-            top: 0px;
-            line-height: 80px;
-
-            .unit-detail-action-icon {
-                color: white;
-                cursor: pointer;
-                font-size: 18px;
-                margin-right: 15px;
-                display: none;
-            }
-
-            .unit-detail-action-icon:hover {
-                color: aqua;
-            }
-        }
-
-    }
-}
 .content-type-label {
     color: white;
     line-height: 13px;

+ 12 - 144
TEAMModelOS/ClientApp/src/view/selflearning/CreateSelfLearn.vue

@@ -109,37 +109,7 @@
                class="dark-iview-modal"
                width="960"
                @on-ok="confirmSelectUnit">
-            <div class="unit-filter-wrap dark-iview-input">
-                <Input search clearable placeholder="关键字搜索..." style="width: 100%" />
-            </div>
-            <div class="unit-list-wrap">
-                <vuescroll>
-                    <div class="unit-list-item" v-for="(item,index) in unitList">
-                        <p class="unit-name">
-                            {{item.name}}
-                        </p>
-                        <div class="unit-detail-info">
-                            <span class="unit-datail-label">
-                                资源数量:
-                            </span>
-                            <span class="unit-detail-count">
-                                {{item.resource.length}}
-                            </span>
-                            <span class="devid-line">|</span>
-                            <span class="unit-datail-label">
-                                题目数量:
-                            </span>
-                            <span class="unit-detail-count">
-                                {{item.resource.length}}
-                            </span>
-                        </div>
-                        <div class="unit-detail-action">
-                            <Icon class="unit-detail-action-icon" type="ios-folder-open" />
-                            <Icon class="unit-detail-action-icon" type="md-checkmark" :style="{color:selectedUnitId.indexOf(item.id) == -1 ? 'white':'aqua','display':selectedUnitId.indexOf(item.id) == -1 ? 'none':'inline-block'}" size="20" @click="selectUnit(item)" />
-                        </div>
-                    </div>
-                </vuescroll>
-            </div>
+            <SelectLearnUnit></SelectLearnUnit>
         </Modal>
         <Modal v-model="selectOrderStatus"
                title="选择编序式教材"
@@ -197,15 +167,16 @@
 <script>
     import ChooseContent from '@/components/learnactivity/ChooseContent.vue'
     import QuestionList from '@/components/learnactivity/QuestionList.vue'
+    import SelectLearnUnit from '@/components/learnactivity/SelectLearnUnit.vue'
     import NoData from '@/common/NoData.vue'
     export default {
         components: {
-            ChooseContent,NoData,QuestionList
+            ChooseContent,NoData,QuestionList,SelectLearnUnit
         },
         data() {
             return {
-                selectedUnitId: [],
-                selectedUnitItem: [],
+                
+                
                 selectedOrderId: [],
                 selectedOrderItem: [],
                 editStepName: '',
@@ -256,10 +227,10 @@
                 },
                 addStepStatus: false,
                 classroomList: [],
-                unitList: [],
+                
                 orderLearnList: [],
                 isLoading: false,
-                currentUnitIndex: 0,
+                
                 columns: [
                     {
                         title: '',
@@ -307,101 +278,9 @@
                     }
                 )
             },
-            /**
-             * 通过id查询题目信息
-             * */
-            findQuestionById() {
-                if (this.unitList.length > 0) {
-                    this.isLoading = true
-                    if (!this.unitList[this.currentUnitIndex].requestedI) {
-                        this.$api.learnActivity.FindQuestionById(this.unitList[this.currentUnitIndex].item).then(
-                            res => {
-                                if (res.error == null) {
-                                    this.unitList[this.currentUnitIndex].item.length = 0
-                                    this.$set(this.unitList[this.currentUnitIndex], 'item', res.result.data)
-                                    this.unitList[this.currentUnitIndex].requestedI = true
-                                    console.log(this.unitList)
-                                } else {
-                                    this.$Message.error("API ERROR!")
-                                    setTimeout(() => {
-                                        this.isLoading = false
-                                    }, 500)
-                                }
-                            },
-                            err => {
-                                this.$Message.error("API ERROR!")
-                                setTimeout(() => {
-                                    this.isLoading = false
-                                }, 500)
-                            }
-                        )
-                    } else {
-                        setTimeout(() => {
-                            this.isLoading = false
-                        }, 200)
-                    }
-                }
-            },
-            /**
-             * 通过id查询内容信息
-             * */
-            findResourceById() {
-                if (this.unitList.length > 0) {
-                    this.isLoading = true
-                    if (!this.unitList[this.currentUnitIndex].requestedR) {
-
-                        this.$api.learnActivity.FindSyllabusResourceById(this.unitList[this.currentUnitIndex].resource).then(
-                            res => {
-                                if (res.error == null) {
-                                    this.unitList[this.currentUnitIndex].resource.length = 0
-                                    this.unitList[this.currentUnitIndex].resource = res.result.data
-                                    this.unitList[this.currentUnitIndex].requestedR = true
-                                } else {
-                                    this.$Message.error("API ERROR!")
-                                }
-                                setTimeout(() => {
-                                    this.isLoading = false
-                                }, 500)
-                            },
-                            err => {
-                                this.$Message.error("API ERROR!")
-                                setTimeout(() => {
-                                    this.isLoading = false
-                                }, 500)
-                            }
-                        )
-                    } else {
-                        setTimeout(() => {
-                            this.isLoading = false
-                        }, 200)
-                    }
-                }
-            },
-            /**
-             * 获取最小单元列表
-             * */
-            getUnit() {
-                //this.isLoading = true
-                let requestData = {
-                    scopeCode: this.$store.state.schoolBaseInfo.demoLoginInfo.TEAMModelId
-                }
-                this.$api.learnActivity.FindUnit(requestData).then(
-                    res => {
-                        if (res.error == null) {
-                            this.unitList = res.result.data
-                            if (this.unitList.length > 0) {
-                                this.findResourceById()
-                                this.findQuestionById()
-                            }
-                        } else {
-                            this.$Message.error('API ERROR!')
-                        }
-                    },
-                    err => {
-
-                    }
-                )
-            },
+            
+            
+            
             confirmEditStep() {
                 this.selfLearnInfo.steps[this.stepIndex].name = this.editStepName
             },
@@ -438,18 +317,7 @@
                 this.selectedUnitItem.length = 0
                 console.log(this.selfLearnInfo)
             },
-            selectUnit(item) {
-                let index = this.selectedUnitId.indexOf(item.id)
-                if (index == -1) {
-                    this.selectedUnitId.push(item.id)
-                    this.selectedUnitItem.push(item)
-                } else {
-                    this.selectedUnitId.splice(index, 1)
-                    this.selectedUnitItem.splice(index, 1)
-                }
-                console.log(this.selectedUnitId)
-
-            },
+            
             selectOrder(item) {
                 let index = this.selectedOrderId.indexOf(item.id)
                 if (index == -1) {
@@ -493,7 +361,7 @@
             }
         },
         created() {
-            this.getUnit()
+            
             this.findOrderLearn()
         }
     }

+ 0 - 47
TEAMModelOS/ClientApp/src/view/teachcontent/CreateLearnUnit.less

@@ -60,12 +60,6 @@
       margin-top: 15px;
     }
 
-    .content-file-wrap {
-      height: fit-content;
-      padding: 10px 0px 20px 0px;
-      color: white;
-    }
-
     .content-question-wrap {
       min-height: 200px;
       padding: 10px 0px 20px 0px;
@@ -140,48 +134,7 @@
 .file-content-wrap{
   padding-top:5px;
 }
-.content-file-item {
-    width: 100%;
-    display: flex;
-    flex-direction: row;
-    margin-bottom: 5px;
-
-    .action-icon {
-        cursor: pointer;
-        margin-right: 8px;
-        font-size: 18px;
-        line-height: 22px;
-
-        &:hover {
-            color: aqua;
-        }
-    }
-
-    .content-file-name-wrap {
-        font-size: 15px;
-        width: ~"calc(100% - 80px)";
-    }
 
-    .content-file-item-action {
-        display: none;
-    }
-
-    &:hover {
-        border-bottom: 1px solid @borderColor;
-        background: #606060;
-        padding-left: 4px;
-        border-radius: 4px;
-    }
-
-    &:hover .content-file-item-action {
-        display: inline-block;
-    }
-}
-.file-icon {
-    display: inline-block;
-    vertical-align: sub;
-    margin-right: 5px;
-}
 .btn-save {
     color: rgb(107, 223, 195);
     float: right;

+ 7 - 34
TEAMModelOS/ClientApp/src/view/teachcontent/CreateLearnUnit.vue

@@ -19,28 +19,7 @@
                         <div style="height: calc(100% - 45px);">
                             <vuescroll>
                                 <p class="content-type-label">内容:{{learnUnit.resource.length}}个</p>
-                                <div class="content-file-wrap">
-                                    <NoData style="margin-top:30px;" v-if="learnUnit.resource.length == 0"></NoData>
-                                    <div class="content-file-item" v-for="(item,index) in learnUnit.resource">
-                                        <div class="content-file-name-wrap">
-                                            <div class="file-icon">
-                                                <img v-if="item.extension == 'ppt' || item.extension == 'pptx'" src="../../assets/icon/ppt50.png" width="15" />
-                                                <img v-else-if="item.extension == 'doc' || item.extension == 'docx'" src="../../assets/icon/word50.png" width="15" />
-                                                <img v-else-if="item.extension == 'xls' || item.extension == 'xlsx'" src="../../assets/icon/xls50.png" width="15" />
-                                                <img v-else-if="item.extension == 'pdf'" src="../../assets/icon/pdf50.png" width="15" />
-                                                <img v-else-if="item.type == 'picture'" src="../../assets/icon/icon_img.png" width="15" />
-                                                <img v-else-if="item.type == 'video'" src="../../assets/icon/icon_video.png" width="15" />
-                                                <img v-else src="../../assets/icon/prelearn50.png" width="15" />
-                                            </div>
-                                            <span>{{item.fileName}}</span>
-                                        </div>
-                                        <span class="content-file-item-action">
-                                            <Icon type="md-download" class="action-icon" title="下载" @click="downloadFile(item)"/>
-                                            <Icon v-if="item.type == 'video' || item.type == 'picture' || item.extension == 'pdf'" type="md-eye" class="action-icon" title="预览" @click="clickToPreview(item)" />
-                                            <!--<Icon type="md-close" class="action-icon" title="删除"/>-->
-                                        </span>
-                                    </div>
-                                </div>
+                                <ContentFileList :resources="learnUnit.resource"></ContentFileList>
                                 <p class="content-type-label">题目:{{learnUnit.item.length}}道</p>
                                 <div class="content-question-wrap">
                                     <NoData v-if="learnUnit.item.length == 0" style="margin-top:30px;"></NoData>
@@ -48,7 +27,6 @@
                                 </div>
                             </vuescroll>
                         </div>
-
                     </div>
                 </div>
             </Split>
@@ -60,22 +38,14 @@
                @on-ok="confirmToManage">
             <p>最小学习单元保存成功,是否跳转到管理页面查看?</p>
         </Modal>
-        <Modal v-model="previewStatus" :title="previewFile.fileName" width="800px" class="dark-iview-modal">
-            <video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.blobUrl+sasString" width="780" controls="controls">
-                {{$t('teachContent.tips8')}}
-            </video>
-            <img v-if="previewFile.type == 'picture'" :src="previewFile.blobUrl+sasString" width="780" style="border-radius:5px;" />
-            <embed v-if="previewFile.type == 'document'" :src="previewFile.blobUrl+sasString" width="780" height="600" />
-            <div slot="footer"></div>
-        </Modal>
     </div>
 </template>
 <script>
-
     import EditableLabel from '@/common/EditableLabel.vue'
     import NoData from '@/common/NoData.vue'
     import QuestionList from '@/components/learnactivity/QuestionList.vue'
     import ChooseContent from '@/components/learnactivity/ChooseContent.vue'
+    import ContentFileList from '@/components/learnactivity/ContentFileList.vue'
     export default {
         data() {
             return {
@@ -103,7 +73,8 @@
             ChooseContent,
             NoData,
             EditableLabel,
-            QuestionList
+            QuestionList,
+            ContentFileList
         },
         methods: {
             /**
@@ -141,6 +112,7 @@
                         id: this.learnUnit.id,
                         name: this.learnUnit.name,
                         scopeCode: this.demoLoginInfo.TEAMModelId,
+                        creator: this.demoLoginInfo.TEAMModelId,
                         item: this.learnUnit.item.map(item => { return item.id }),
                         resource: this.learnUnit.resource.map(item => { return item.id })
                     }
@@ -170,7 +142,8 @@
             },
             getSelectFile(data) {
                 console.log(data)
-                this.learnUnit.resource.push(data.file)
+                //this.learnUnit.resource.push(data.file)
+                this.learnUnit.resource = data.files
             }
         },
         created() {

+ 35 - 4
TEAMModelOS/ClientApp/src/view/teachcontent/CreateOrderLearn.less

@@ -159,8 +159,7 @@
 }
 
 .content-file-wrap {
-    height: fit-content;
-    padding: 10px 0px 20px 0px;
+    padding: 5px 0px 20px 0px;
     color: white;
     margin-bottom:10px;
 }
@@ -248,8 +247,19 @@
     border-left: 2px solid white;
     background: #333333;
 }
-.content-file-item{
-    margin-bottom:4px;
+.content-file-item {
+    margin-bottom: 4px;
+
+    &:hover {
+        border-bottom: 1px solid @borderColor;
+        background: #606060;
+        padding-left: 4px;
+        border-radius: 4px;
+    }
+
+    &:hover .content-file-item-action {
+        display: inline-block;
+    }
 }
 .btn-save {
     color: rgb(107, 223, 195);
@@ -257,4 +267,25 @@
     cursor: pointer;
     margin-top: 6px;
     margin-right: 40px;
+}
+
+.file-icon {
+    display: inline-block;
+    vertical-align: sub;
+    margin-right: 5px;
+}
+.action-icon {
+    cursor: pointer;
+    margin-right: 8px;
+    font-size: 18px;
+    line-height: 22px;
+
+    &:hover {
+        color: aqua;
+    }
+}
+.content-file-item-action {
+    display: none;
+    float:right;
+    margin-right:15px;
 }

+ 144 - 30
TEAMModelOS/ClientApp/src/view/teachcontent/CreateOrderLearn.vue

@@ -62,7 +62,7 @@
                                 <Icon class="add-learn-step-icon" type="md-add" size="20" />
                                 <div slot="content">
                                     <p class="add-step-type-label" @click="addStepStatus = true"><Icon type="ios-hand-outline" size="18" style="margin-right:5px;" />手动选择内容</p>
-                                    <p class="add-step-type-label"><Icon type="md-list" size="18" style="margin-right:5px;" @click="selectUnit" />选择最小单元</p>
+                                    <p class="add-step-type-label" @click="selectUnit"><Icon type="md-list" size="18" style="margin-right:5px;" />选择最小单元</p>
                                 </div>
                             </Tooltip>
 
@@ -83,12 +83,12 @@
                             学习资源
                             <div class="radio-box-wrap">
                                 <div :class="currentView == 0 ? 'radio-box-item active-radio-box-item':'radio-box-item'" @click="setCurrentView(0)">
-                                    <Tooltip content="查看学习资源" placement="bottom" theme="light">
+                                    <Tooltip content="查看学习资源" placement="bottom">
                                         <Icon type="md-list" size="15" />
                                     </Tooltip>
                                 </div>
                                 <div :class="currentView == 1 ? 'radio-box-item active-radio-box-item':'radio-box-item'" @click="setCurrentView(1)">
-                                    <Tooltip content="挑选学习资源" placement="bottom" theme="light">
+                                    <Tooltip content="挑选学习资源" placement="bottom">
                                         <Icon type="md-card" size="15" />
                                     </Tooltip>
                                 </div>
@@ -96,12 +96,7 @@
                         </div>
                         <!-- 选择学习资源 -->
                         <div v-if="orderLearnInfo.steps.length !== 0" :class="currentView == 1 ? 'animated faster fadeInLeft choose-learn-content-wrap':'animated fadeOutRight choose-learn-content-wrap'">
-                            <div class="create-learn-content">
-                                <span :class="currentCreateType == 0 ? 'active-span':''" @click="selectCreateType(0)">选择已建自学内容</span>
-                                <span :class="currentCreateType == 1 ? 'active-span':''" @click="selectCreateType(1)">临时创建自学内容</span>
-                            </div>
-                            <ChooseContent ref="chooseContent" v-show="currentCreateType == 1" :class="currentCreateType == 1 ? 'animated fadeIn':''" style="margin-top:10px;height:calc(100% - 50px);" @on-select-question="getSelectedQuestion" @on-cancel-file="cancelFile" @on-select-file="getSelectFile"></ChooseContent>
-                            <ManageUnit :type="0" v-show="currentCreateType == 0" :class="currentCreateType == 0 ? 'animated fadeIn':''" @chooseUnit="chooseUnit"></ManageUnit>
+                            <ChooseContent ref="chooseContent" style="margin-top:10px;height:calc(100% - 10px);" @on-select-question="getSelectedQuestion" @on-cancel-file="cancelFile" @on-select-file="getSelectFile"></ChooseContent>
                             <Poptip padding="0px 0px" offset="10" placement="top-end" width="300" trigger="hover" :class="shoppingCarClass">
                                 <Badge type="success" :count="getContentLength.total" show-zero :offset="[-3,-3]" style="margin-top:10px;cursor:pointer;" @mouseenter.native="changeActive($event)" @mouseleave.native="removeActive($event)">
                                     <img src="../../assets/shopping_car.svg" width="40" height="40" />
@@ -130,14 +125,15 @@
                         <div v-if="orderLearnInfo.steps.length !== 0" :class="currentView == 0 ? 'animated faster fadeInLeft preview-learn-content-wrap':'animated fadeOutRight preview-learn-content-wrap'">
                             <vuescroll>
                                 <p class="content-type-label">内容:{{orderLearnInfo.steps[stepIndex].resource.length}}个</p>
-                                <div class="content-file-wrap">
-                                    <NoData style="margin-top:30px;" v-if="orderLearnInfo.steps[stepIndex].resource.length == 0"></NoData>
-                                    <p v-for="(item,index) in orderLearnInfo.steps[stepIndex].resource" class="content-file-item">{{item.fileName}}</p>
+                                <div class="content-file-wrap" style="min-height:240px;">
+                                    <Loading v-show="listLoading"></Loading>
+                                    <ContentFileList v-show="!listLoading" :resources="orderLearnInfo.steps[stepIndex].resource"></ContentFileList>
                                 </div>
                                 <p class="content-type-label">题目:{{orderLearnInfo.steps[stepIndex].item.length}}道</p>
                                 <div class="content-question-wrap">
                                     <NoData v-if="orderLearnInfo.steps[stepIndex].item.length == 0" style="margin-top:30px;"></NoData>
-                                    <QuestionList v-else :questions="orderLearnInfo.steps[stepIndex].item"></QuestionList>
+                                    <Loading v-show="listLoading"></Loading>
+                                    <QuestionList v-show="!listLoading" :questions="orderLearnInfo.steps[stepIndex].item"></QuestionList>
                                 </div>
                             </vuescroll>
                         </div>
@@ -149,10 +145,18 @@
         <Modal v-model="addStepStatus"
                title="添加学习阶段"
                class="dark-iview-modal dark-iview-input"
+               width="660"
                @on-ok="confirmAddStep">
             <span>名称:</span>
             <Input v-model="newStepName" placeholder="请输入名称..." style="width: calc(100% - 50px);" />
         </Modal>
+        <Modal v-model="selectUnitStatus"
+               title="选择最小单元"
+               class="dark-iview-modal"
+               width="960"
+               @on-ok="confirmSelectUnit">
+            <SelectLearnUnit @selectUnit="getSelectedUnit"></SelectLearnUnit>
+        </Modal>
         <Modal v-model="editStepStatus"
                title="修改名称"
                class="dark-iview-modal dark-iview-input"
@@ -167,23 +171,32 @@
                @on-ok="confirmToManage">
             <p>编序式自主学习活动保存成功,是否跳转到管理页面查看?</p>
         </Modal>
+
     </div>
 </template>
 <script>
     import NoData from '@/common/NoData.vue'
     import QuestionList from '@/components/learnactivity/QuestionList.vue'
     import ChooseContent from '@/components/learnactivity/ChooseContent.vue'
-    import ManageUnit from "./ManageUnit.vue"
+    import SelectLearnUnit from '@/components/learnactivity/SelectLearnUnit.vue'
+    import ContentFileList from '@/components/learnactivity/ContentFileList.vue'
+    import Loading from '@/common/Loading.vue'
+    import { setTimeout } from 'core-js'
     export default {
         components: {
             NoData,
             QuestionList,
             ChooseContent,
-            ManageUnit
+            SelectLearnUnit,
+            ContentFileList,
+            Loading
         },
         data() {
             return {
+                selectedUnit: [],
+                selectUnitStatus: false,
                 isLoading: false,
+                listLoading: false,
                 goToManageStatus: false,
                 demoLoginInfo: {
                     user: 'admin',
@@ -211,19 +224,19 @@
                         title: '',
                         slot: 'action',
                         width: 50,
-                        align:'right'
+                        align: 'right'
                     }
                 ],
                 orderLearnInfo: {
                     name: '',
                     periodCode: '',
-                    subjectCode:'',
-                    target: [],
-                    isOrder: '',
-                    creator:'',
+                    subjectCode: '',
+                    creator: '',
                     introduce: '',
-                    type:'',
                     steps: []
+                    //target: [],
+                    //type: '',
+                    //isOrder: '',
                 },
                 ruleValidate: {
                     name: [
@@ -266,17 +279,87 @@
                         resourceL,
                         total: itemL + resourceL
                     }
-                    
+
                 }
             }
         },
         methods: {
+            /**
+             * 通过id查询题目信息
+             * */
+            findQuestionById() {
+                if (this.orderLearnInfo.steps.length > 0) {
+                    this.listLoading = true
+                    if (!this.orderLearnInfo.steps[this.stepIndex].requestedI) {
+                        this.$api.learnActivity.FindQuestionById(this.orderLearnInfo.steps[this.stepIndex].item).then(
+                            res => {
+                                if (res.error == null) {
+                                    this.orderLearnInfo.steps[this.stepIndex].item.length = 0
+                                    this.$set(this.orderLearnInfo.steps[this.stepIndex], 'item', res.result.data)
+                                    this.orderLearnInfo.steps[this.stepIndex].requestedI = true
+                                    console.log(this.orderLearnInfo)
+                                } else {
+                                    this.$Message.error("API ERROR!")
+                                }
+                                setTimeout(() => {
+                                    this.listLoading = false
+                                }, 500)
+                            },
+                            err => {
+                                this.$Message.error("API ERROR!")
+                                setTimeout(() => {
+                                    this.listLoading = false
+                                }, 1000)
+                            }
+                        )
+                    } else {
+                        setTimeout(() => {
+                            this.listLoading = false
+                        }, 300)
+                    }
+                }
+            },
+            /**
+             * 通过id查询内容信息
+             * */
+            findResourceById() {
+                if (this.orderLearnInfo.steps.length > 0) {
+                    this.listLoading = true
+                    if (!this.orderLearnInfo.steps[this.stepIndex].requestedR) {
+                        this.$api.learnActivity.FindSyllabusResourceById(this.orderLearnInfo.steps[this.stepIndex].resource).then(
+                            res => {
+                                if (res.error == null) {
+                                    this.orderLearnInfo.steps[this.stepIndex].resource.length = 0
+                                    this.orderLearnInfo.steps[this.stepIndex].resource = res.result.data
+                                    this.orderLearnInfo.steps[this.stepIndex].requestedR = true
+                                } else {
+                                    this.$Message.error("API ERROR!")
+                                }
+                                setTimeout(() => {
+                                    this.listLoading = false
+                                }, 500)
+                            },
+                            err => {
+                                this.$Message.error("API ERROR!")
+                                setTimeout(() => {
+                                    this.listLoading = false
+                                }, 500)
+                            }
+                        )
+                    } else {
+                        setTimeout(() => {
+                            this.listLoading = false
+                        }, 300)
+                    }
+                }
+            },
             /**
              * 确认修改学习阶段名称
              * @param index
              */
             confirmEditStep() {
                 this.orderLearnInfo.steps[this.stepIndex].name = this.editStepName
+                console.log(this.orderLearnInfo)
             },
             /**
              * 编辑学习阶段名称
@@ -295,7 +378,20 @@
                 this.currentView = 0
             },
             selectUnit() {
-
+                this.selectUnitStatus = true
+            },
+            /**
+             * 处理SelectLearnUnit组件选择事件
+             * @param data
+             */
+            getSelectedUnit(data) {
+                console.log(data)
+                this.selectedUnit = data
+            },
+            confirmSelectUnit() {
+                this.orderLearnInfo.steps.push(...this.selectedUnit)
+                this.selectedUnit.length = 0
+                console.log(this.orderLearnInfo)
             },
             changeActive(e) {
                 this.shoppingCarClass = 'question-shopping-car animated pulse'
@@ -311,7 +407,7 @@
                     {
                         name: this.newStepName,
                         resource: [],
-                        item:[]
+                        item: []
                     }
                 )
                 this.newStepName = ''
@@ -331,9 +427,18 @@
                     this.isLoading = true
                     this.orderLearnInfo.creator = this.demoLoginInfo.TEAMModelId
                     this.orderLearnInfo.scopeCode = this.demoLoginInfo.TEAMModelId
-                    this.orderLearnInfo.type = '1'//教学情境
-                    this.orderLearnInfo.target = ['三年级五班']//学习对象
-                    this.$api.learnActivity.SaveOrderLearn(this.orderLearnInfo).then(
+                    let str = JSON.stringify(this.orderLearnInfo)
+                    let requestData = JSON.parse(str)
+                    for (let i = 0; i < requestData.steps.length; i++) {
+                        if (requestData.steps[i].requestedI) {
+                            requestData.steps[i].item = requestData.steps[i].item.map(item => { return item.id })
+                        } 
+                        if (requestData.steps[i].requestedR) {
+                            requestData.steps[i].resource = requestData.steps[i].resource.map(item => { return item.id })
+                        }                        
+                    }
+                    
+                    this.$api.learnActivity.SaveOrderLearn(requestData).then(
                         res => {
                             if (res.error == null) {
                                 this.orderLearnInfo.id = res.result.data.id
@@ -385,6 +490,8 @@
             getCurrentItem(row, index) {
                 this.stepIndex = index
                 this.currentView = 0
+                this.findResourceById()
+                this.findQuestionById()
                 this.$refs.chooseContent.refreshData()
             },
             dragOrder(index1, index2) {
@@ -405,6 +512,13 @@
     @import "./CreateOrderLearn.less";
 </style>
 <style lang="less">
+    .content-file-wrap #loadingBox {
+        margin-top: 88px !important;
+    }
+    .base-info-label .ivu-tooltip-inner {
+        background-color: rgba(70,76,91,1);
+    }
+
     .base-info-form .ivu-input, .base-info-form .ivu-select-selection {
         background: none;
         color: white;
@@ -488,8 +602,8 @@
     .learn-step-wrap .ivu-table-row-highlight {
         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%);
     }
-    .learn-step-wrap .ivu-table-row-hover .edit-step-name-icon{
-        display:inline-block;
+
+    .learn-step-wrap .ivu-table-row-hover .edit-step-name-icon {
+        display: inline-block;
     }
-    
 </style>

+ 3 - 10
TEAMModelOS/ClientApp/src/view/teachcontent/ManageOrderLearn.vue

@@ -12,7 +12,7 @@
                     <p class="order-learn-name">{{item.name}}</p>
                     <div class="order-learn-steps">
                         <span><Icon type="md-filing" style="margin-right:8px;" />闯关模式:</span>
-                        <span>{{item.isOrder == 1 ? '是':'否'}}</span>
+                        <!--<span>{{item.isOrder == 1 ? '是':'否'}}</span>-->
                     </div>
                     <div class="order-learn-steps">
                         <span><Icon type="ios-cube" style="margin-right:8px;" />学习阶段:</span>
@@ -24,17 +24,10 @@
         </div>
         <div class="order-learn-main">
             <div class="main-bar-wrap">
-                <!--<span :class="currentBarIndex == 0 ? 'main-bar-item main-bar-item-active':'main-bar-item'" @click="selectBar(0)">基础信息</span>-->
-                <!--<span :class="currentBarIndex == 1 ? 'main-bar-item main-bar-item-active':'main-bar-item'" @click="selectBar(1)">学习进度</span>
-                <span :class="currentBarIndex == 2 ? 'main-bar-item main-bar-item-active':'main-bar-item'" @click="selectBar(2)">作答数据</span>-->
                 <span class="main-bar-action-btn" @click="editInfo()">
                     <Icon type="ios-create-outline" size="20" />
                     编辑内容
                 </span>
-                <!--<span class="main-bar-action-btn">
-                    <Icon type="ios-send" size="20" />
-                    发布内容
-                </span>-->
             </div>
             <div :class="currentBarIndex == 0 ? 'animated fadeIn order-learn-main-body dark-iview-split':'order-learn-main-body'" v-show="currentBarIndex == 0">
                 <Split v-model="split1">
@@ -69,14 +62,14 @@
                                     {{orderLearnList[currentLearnIndex].subjectCode}}
                                 </p>
                             </div>
-                            <div class="base-info-item">
+                            <!--<div class="base-info-item">
                                 <span class="base-info-label">
                                     学习对象:
                                 </span>
                                 <p class="base-info-value">
                                     {{orderLearnList[currentLearnIndex].target.join(',')}}
                                 </p>
-                            </div>
+                            </div>-->
                             <div class="base-info-item">
                                 <span class="base-info-label">
                                     闯关模块:

+ 1 - 44
TEAMModelOS/ClientApp/src/view/teachcontent/ManageUnit.less

@@ -85,7 +85,7 @@
             .unit-content-label {
                 color: white;
                 line-height: 13px;
-                margin: 15px 0px;
+                margin-top: 15px;
                 padding: 5px;
                 padding-left: 8px;
                 border-left: 2px solid white;
@@ -99,50 +99,7 @@
         }
     }
 }
-.content-file-item {
-    width: 100%;
-    display: flex;
-    flex-direction: row;
-    margin-bottom: 5px;
-
-    .action-icon {
-        cursor: pointer;
-        margin-right: 8px;
-        font-size: 18px;
-        line-height: 22px;
-        color:white;
-        &:hover {
-            color: aqua;
-        }
-    }
-
-    .content-file-name-wrap {
-        font-size: 15px;
-        width: ~"calc(100% - 100px)";
-        color:white;
-    }
 
-    .content-file-item-action {
-        display: none;
-    }
-
-    &:hover {
-        border-bottom: 1px solid @borderColor;
-        background: #606060;
-        padding-left: 4px;
-        border-radius: 4px;
-    }
-
-    &:hover .content-file-item-action {
-        display: inline-block;
-    }
-}
-
-.file-icon {
-    display: inline-block;
-    vertical-align: text-top;
-    margin-right: 5px;
-}
 .to-create-icon {
     float: right;
     margin-right: 20px;

+ 5 - 37
TEAMModelOS/ClientApp/src/view/teachcontent/ManageUnit.vue

@@ -25,37 +25,17 @@
                 <vuescroll>
                     <p class="unit-content-label">自学内容</p>
                     <div class="unit-content-detail">
-                        <NoData v-if="unitList[currentUnitIndex].length == 0" style="margin-top:120px;"></NoData>
                         <Loading v-show="isLoading"></Loading>
-                        <div v-show="!isLoading" :class="isLoading ? 'content-file-item':'content-file-item animated fadeIn'" v-for="(item,index) in unitList[currentUnitIndex].resource">
-                            <div class="content-file-name-wrap">
-                                <div class="file-icon">
-                                    <img v-if="item.extension == 'ppt' || item.extension == 'pptx'" src="../../assets/icon/ppt50.png" width="15" />
-                                    <img v-else-if="item.extension == 'doc' || item.extension == 'docx'" src="../../assets/icon/word50.png" width="15" />
-                                    <img v-else-if="item.extension == 'xls' || item.extension == 'xlsx'" src="../../assets/icon/xls50.png" width="15" />
-                                    <img v-else-if="item.extension == 'pdf'" src="../../assets/icon/pdf50.png" width="15" />
-                                    <img v-else-if="item.type == 'picture'" src="../../assets/icon/icon_img.png" width="15" />
-                                    <img v-else-if="item.type == 'video'" src="../../assets/icon/icon_video.png" width="15" />
-                                    <img v-else src="../../assets/icon/prelearn50.png" width="15" />
-                                </div>
-                                <span>{{item.fileName}}</span>
-                            </div>
-                            <span class="content-file-item-action">
-                                <Icon type="md-download" class="action-icon" title="下载" @click="downloadFile(item)" />
-                                <Icon v-if="item.type == 'video' || item.type == 'picture' || item.extension == 'pdf'" type="md-eye" class="action-icon" title="预览" @click="clickToPreview(item)" />
-                                <Icon type="md-close" class="action-icon" title="删除" />
-                            </span>
-                        </div>
+                        <ContentFileList v-show="!isLoading" :resources="unitList[currentUnitIndex].resource"></ContentFileList>
                     </div>
 
                     <p class="unit-content-label">检测题目</p>
                     <div class="unit-content-detail">
                         <NoData v-if="unitList[currentUnitIndex].length == 0" style="margin-top:120px;"></NoData>
                         <Loading v-show="isLoading"></Loading>
-                        <QuestionList v-show="!isLoading" :class="isLoading ? '':'animated fadeIn'" :questions="unitList[currentUnitIndex].item"></QuestionList>
+                        <QuestionList v-show="!isLoading" :class="isLoading ? '':'animated fadeIn'" :questions="unitList[currentUnitIndex].item" style="margin-top:12px;"></QuestionList>
 
                     </div>
-
                 </vuescroll>
             </div>
         </div>
@@ -64,20 +44,13 @@
                @on-ok="confirmEdit">
             <p>确认跳转到最小单元编辑页面?</p>
         </Modal>
-        <Modal v-model="previewStatus" :title="previewFile.fileName" width="800px" class="dark-iview-modal">
-            <video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.blobUrl+sasString" width="780" controls="controls">
-                {{$t('teachContent.tips8')}}
-            </video>
-            <img v-if="previewFile.type == 'picture'" :src="previewFile.blobUrl+sasString" width="780" style="border-radius:5px;" />
-            <embed v-if="previewFile.type == 'document'" :src="previewFile.blobUrl+sasString" width="780" height="600" />
-            <div slot="footer"></div>
-        </Modal>
     </div>
 </template>
 <script>
     import NoData from '@/common/NoData.vue'
     import Loading from '@/common/Loading.vue'
     import QuestionList from '@/components/learnactivity/QuestionList.vue'
+    import ContentFileList from '@/components/learnactivity/ContentFileList.vue'
     export default {
         props: {
             type: {
@@ -87,12 +60,11 @@
         components: {
             NoData,
             QuestionList,
-            Loading
+            Loading,
+            ContentFileList
         },
         data() {
             return {
-                previewStatus: false,
-                previewFile: {},
                 sasString:'',
                 editUnitStatus: false,
                 isLoading: false,
@@ -106,10 +78,6 @@
                     name: 'createLearnUnit'
                 })
             },
-            clickToPreview(file) {
-                this.previewStatus = true
-                this.previewFile = file
-            },
             downloadFile(item) {
                 window.location.href = item.blobUrl + this.sasString
             },

+ 45 - 10
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -1235,33 +1235,33 @@ namespace TEAMModelOS.Controllers.Analysis
             if (RedisHelper.Instance != null)
             {
 
-                List<ExamInfo> info =  await RedisHelper.CacheShellAsync(CacheCosmosPrefix + "FindExamInfo", 
-                    ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindExamInfoToRedis(request.@params); });
+                List<ExamInfo> info =  await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method, 
+                    ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindExamInfoRedis(request.@params,request.method); });
                 builder.Data(info);
 
             }
             else
             {
-                List<ExamInfo> info =  await FindExamInfoToRedis(request.@params);
+                List<ExamInfo> info =  await FindExamInfoRedis(request.@params,request.method);
                 builder.Data(info);
             }
             return builder.build();
         }
 
-        public async Task<List<ExamInfo>> FindExamInfoToRedis(Dictionary<string, object> dict)
+        public async Task<List<ExamInfo>> FindExamInfoRedis(Dictionary<string, object> dict,string method)
         {
             try {
                 List<ExamInfo> info = await azureCosmosDBRepository.FindByDict<ExamInfo>(dict);
                 if (RedisHelper.Instance != null)
                 {
-                    if (!RedisHelper.Exists(CacheCosmosPrefix + "FindExamInfo"))
+                    if (!RedisHelper.Exists(CacheCosmosPrefix + method))
                     {
-                        await RedisHelper.HSetAsync(CacheCosmosPrefix + "FindExamInfo", ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), info);
+                        await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), info);
                     }
                     else
                     {
-                        await RedisHelper.HSetAsync(CacheCosmosPrefix + "FindExamInfo", ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), info);
-                        await RedisHelper.ExpireAsync(CacheCosmosPrefix + "FindExamInfo", timeoutSeconds);
+                        await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), info);
+                        await RedisHelper.ExpireAsync(CacheCosmosPrefix + method, timeoutSeconds);
                     }
                 }
                 return info;
@@ -1275,12 +1275,47 @@ namespace TEAMModelOS.Controllers.Analysis
         public async Task<BaseJosnRPCResponse> FindExamPaper(JosnRPCRequest<Dictionary<string, object>> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (RedisHelper.Instance != null)
+            {
 
-            List<ExamPaper> info = await azureCosmosDBRepository.FindByDict<ExamPaper>(request.@params);
-            builder.Data(info);
+                List<ExamPaper> info = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method,
+                    ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindExamPaperRedis(request.@params, request.method); });
+                builder.Data(info);
+
+            }
+            else
+            {
+                List<ExamPaper> info = await FindExamPaperRedis(request.@params, request.method);
+                builder.Data(info);
+            }
 
             return builder.build();
         }
+        public async Task<List<ExamPaper>> FindExamPaperRedis(Dictionary<string, object> dict, string method)
+        {
+            try
+            {
+                List<ExamPaper> info = await azureCosmosDBRepository.FindByDict<ExamPaper>(dict);
+                if (RedisHelper.Instance != null)
+                {
+                    if (!RedisHelper.Exists(CacheCosmosPrefix + method))
+                    {
+                        await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), info);
+                    }
+                    else
+                    {
+                        await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), info);
+                        await RedisHelper.ExpireAsync(CacheCosmosPrefix + method, timeoutSeconds);
+                    }
+                }
+                return info;
+            }
+            catch (Exception e)
+            {
+                throw new BizException(e.Message);
+
+            }
+        }
         [HttpPost("FindExamAnswer")]
         public async Task<BaseJosnRPCResponse> FindExamAnswer(JosnRPCRequest<Dictionary<string, object>> request)
         {