natasha пре 1 година
родитељ
комит
c49ed550fd

+ 4 - 0
src/components/NavMenu.vue

@@ -188,6 +188,10 @@ export default {
                     {
                         title:'精读订阅包年价格',
                         index:'reservation_setting',
+                    },
+                    {
+                        title:'测评价格',
+                        index:'test_setting',
                     }
                 ]
             }

+ 26 - 8
src/components/Upload.vue

@@ -7,7 +7,6 @@
       class="upload-demo"
       :action="url"
       :on-preview="handlePreview"
-      multiple
       :limit="filleNumber ? filleNumber : 1"
       :before-upload="handlebeforeUpload"
       :on-exceed="handleExceed"
@@ -17,6 +16,7 @@
       :before-remove="beforeRemove"
       :on-remove="handleRemove"
       :show-file-list="showList?false:true"
+      :on-progress="uploadVideoProcess"
     >
       <template v-if="styleType==='upload'">
         <div class="upload-style">
@@ -39,6 +39,7 @@
       </div>
     </el-upload>
     <!-- <div class="zhezhao" v-loading.fullscreen.lock="fullscreenLoading"></div> -->
+    <el-progress style="width: 500px" v-if="progressFlag" :percentage="loadProgress"></el-progress>
   </div>
 </template>
 
@@ -64,6 +65,8 @@ export default {
       uploadName: "",
       uploadTip:"",
       loading: false,
+      loadProgress: 0, // 动态显示进度条
+      progressFlag: false, // 关闭进度条
     };
   },
   computed: {
@@ -106,7 +109,17 @@ export default {
   activated() {},
   // 方法集合
   methods: {
-    handleChange(file, fileList) {},
+    handleChange(file, fileList) {
+        
+    },
+    uploadVideoProcess(event, file, fileList) {
+        this.progressFlag = true; // 显示进度条
+        this.loadProgress = parseInt(event.percent); // 动态获取文件上传进度
+        if (this.loadProgress >= 100) {
+            this.loadProgress = 100
+            setTimeout( () => {this.progressFlag = false}, 1000) // 一秒后关闭进度条
+        }
+    },
     handleSuccess(response, file, fileList) {
       if (response.status == 1) {
         response.duration = response.file_info_list[0].media_duration
@@ -136,6 +149,11 @@ export default {
           this.$message.warning('上传视频大小不能超过2G');
           return false; // 必须返回false
         }
+      } else if (this.uploadType === 'mp3') {
+        if (file.size > 20 * 1024 * 1024) {
+          this.$message.warning('上传音频大小不能超过20M');
+          return false; // 必须返回false
+        }
       }else if(this.uploadType === 'video&radio'){
         if (file.size > 500 * 1024 * 1024) {
           this.$message.warning('上传文件大小不能超过500M');
@@ -153,12 +171,12 @@ export default {
             return false
         } 
       }
-      this.loading = this.$loading({
-        lock: true,
-        text: "Loading",
-        spinner: "el-icon-loading",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
+    //   this.loading = this.$loading({
+    //     lock: true,
+    //     text: "Loading",
+    //     spinner: "el-icon-loading",
+    //     background: "rgba(0, 0, 0, 0.7)",
+    //   });
     },
     handleRemove(file, fileList) {
       this.changeFillId(fileList, this.fileName);

+ 5 - 0
src/router/index.js

@@ -150,6 +150,11 @@ export const constantRoutes = [{
             import ('@/views/system_config/ReservationSetting.vue')
     },
     {
+        path: '/test_setting',
+        component: () =>
+            import ('@/views/system_config/TestSetting.vue')
+    },
+    {
         path: '/personal',
         component: () =>
             import ('@/views/personal.vue')

+ 72 - 24
src/views/content_manage/course_manage/components/ResourcesList.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="resource-list" v-if="list">
-    <a class="package-download"><svg-icon icon-class="download" class="icon-download"></svg-icon>打包下载</a>
+    <a class="package-download" @click="allDownload"><svg-icon icon-class="download" class="icon-download"></svg-icon>打包下载</a>
     <ul class="resource-box">
         <li :class="['item-'+type]" v-for="(item,index) in list" :key="index" :title="item.name" 
             :style="{
@@ -18,6 +18,8 @@
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
+import { getToken } from '@/utils/auth'
+import { getLogin } from "@/api/ajax";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: { },
@@ -75,30 +77,76 @@ export default {
         }
         return finalType
     },
-    // 下载图片
+    // 下载单个文件
     handleDownloadPic(item){
-        // getLogin('/FileServer/GetFileInfo', {
-        //     file_id: item.file_id
-        // })
-        // .then((res) => {
-        //     if(res.status===1){
-        //         Axios({
-        //             method: 'get',
-        //             url: res.file_url,
-        //             responseType: 'blob'
-        //         }).then((res)=>{
-        //             let bloburl = window.URL.createObjectURL(res.data)
-        //             let link = document.createElement(a)
-        //             document.body.appendChild(link)
-        //             link.style.display = 'none'
-        //             link.href = bloburl
-        //             link.download = item.file_name
-        //             link.click()
-        //             document.body.removeChild(link)
-        //             window.URL.revokeObjectURL(bloburl)
-        //         })
-        //     }
-        // })
+        let userInfor = getToken();
+        let access_token = "";
+        if (userInfor) {
+            let user = JSON.parse(getToken());
+            access_token = user.access_token;
+            let FileID = item.file_id
+            let data = {
+                access_token,
+                FileID
+            };
+            let href = process.env.VUE_APP_BASE_API +
+                `/FileServer/WebFileDownload?AccessToken=${data.access_token}&FileID=${data.FileID}`;
+            window.open(href)
+        }else{
+            this.$message.warning('请先登录')
+        }
+    },
+    // 打包下载
+    allDownload() {
+      let _this = this;
+      // 拿到当前课的所有文件id
+      let userInfor = getToken();
+        let access_token = "";
+        if (userInfor) {
+            _this.loading = true;
+            let user = JSON.parse(getToken());
+            access_token = user.access_token;
+            let FileID = null;
+            let data = {
+                access_token,
+                FileID,
+            };
+            let arr = [];
+            _this.list.forEach((item) => {
+                arr.push(`${item.file_id}`);
+            });
+            let MethodName = "/FileServer/FilePackManager/StartCreateFileCompressPack";
+            getLogin(MethodName, {
+                file_id_list: arr,
+            })
+            .then((res) => {
+            let MethodName2 = "/FileServer/FilePackManager/GetFileCompressTaskProgress";
+            let timer = setTimeout(() => {
+                getLogin(MethodName2, {
+                    file_compress_task_id: res.file_compress_task_id,
+                })
+                .then((res) => {
+                    if (res.is_finish == "true") {
+                        data.FileID = res.compress_pack_file_id;
+                        clearTimeout(timer);
+                        timer = null;
+                        _this.loading = false;
+                        location.href =
+                            process.env.VUE_APP_BASE_API +
+                            `/FileServer/WebFileDownload?AccessToken=${data.access_token}&FileID=${data.FileID}`;
+                        }
+                })
+                .catch((res) => {
+                    this.loading = false;
+                });
+            }, 1000);
+            })
+            .catch((res) => {
+                this.loading = false;
+            });
+        }else{
+            this.$message.warning('请先登录')
+        }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)

+ 194 - 0
src/views/system_config/TestSetting.vue

@@ -0,0 +1,194 @@
+<template>
+  <div class="manage-root reservation_setting">
+    <Header />
+    <div class="manage-root-contain">
+        <nav-menu class="manage-root-contain-left" :activeMenuIndex="activeMenuIndex"></nav-menu>
+        <div class="manage-root-contain-right">
+            <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
+            <div class="create-bottom">
+                <h3>测评价格</h3>
+                <el-form :model="registerForm" :rules="rulesRegister" ref="registerForm" label-width="100px" class="registerForm" label-position="top">
+                    <el-form-item label="" prop="test_order_price" class="price-box">
+                        <el-input-number v-model="registerForm.test_order_price" :min="0" size="small" :precision="2" class="personal-ceil" maxlength="10"></el-input-number>
+                        <span class="prepend">¥</span>
+                        <span class="append">元</span>
+                    </el-form-item>
+                    <el-form-item>
+                        <el-button type="primary" @click="onSubmit('registerForm')" size="small" :loading="loading">保存</el-button>
+                        <el-button @click="onCancel('registerForm')" size="small">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+import Header from "../../components/Header.vue";
+import NavMenu from "../../components/NavMenu.vue"
+import Breadcrumb from '../../components/Breadcrumb.vue';
+import { getLogin } from "@/api/ajax";
+
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: { Header, NavMenu, Breadcrumb },
+  props: {},
+  data() {
+    //这里存放数据
+    return {
+        activeMenuIndex: "test_setting",
+        breadcrumbList:[
+            {
+                icon:'setting',
+                url:'',
+                text:''
+            },
+            {
+                icon:'',
+                url:'',
+                notLink: true,
+                text:'系统配置'
+            },
+            {
+                icon:'',
+                url:'',
+                text:'测评价格'
+            }
+        ],
+        registerForm:{
+            test_order_price: null
+        },
+        rulesRegister:{
+        },
+        loading: false
+    }
+  },
+  //计算属性 类似于data概念
+  computed: {
+    
+  },
+  //监控data中数据变化
+  watch: {
+    
+  },
+  //方法集合
+  methods: {
+    // 去掉前后空格
+    handleTrim(form,fild){
+        this[form][fild] = this[form][fild].trim()
+    },
+    // 提交表单
+    onSubmit(formName){
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_Test";
+            let data = {
+                test_order_price: this.registerForm.test_order_price
+            }
+            getLogin(MethodName, data)
+            .then((res) => {
+                this.loading = false
+                if(res.status===1){
+                    this.$message.success("保存成功")
+                }
+            }).catch((res) =>{
+                this.loading = false
+            })
+          } else {
+            return false;
+          }
+        });
+    },
+    // 取消 恢复到修改前状态
+    onCancel(formName){
+        this.$refs[formName].resetFields();
+    },
+    // 得到配置信息
+    getInfo(){
+        let MethodName = "/OrgServer/Manager/SysConfigManager/GetSysConfig_Test";
+        getLogin(MethodName, {})
+        .then((res) => {
+            if(res.status===1){
+                this.registerForm.test_order_price = res.test_order_price
+            }
+        }).catch((res) =>{
+            
+        })
+    }
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    this.getInfo()
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  },
+  //生命周期-创建之前
+  beforeCreated() { },
+  //生命周期-挂载之前
+  beforeMount() { },
+  //生命周期-更新之前
+  beforUpdate() { },
+  //生命周期-更新之后
+  updated() { },
+  //生命周期-销毁之前
+  beforeDestory() { },
+  //生命周期-销毁完成
+  destoryed() { },
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() { }
+}
+</script>
+<style lang="scss" scoped>
+/* @import url(); 引入css类 */
+.create-bottom{
+    padding: 40px 40px;
+    background: #FFFFFF;
+    border-radius: 4px;
+    height: calc(100vh - 140px);
+    overflow: auto;
+    h3{
+        font-size: 20px;
+        font-weight: 500;
+        line-height: 28px;
+        margin: 0 0 28px 0;
+        color: #1D2129;
+    }
+}
+
+</style>
+
+<style lang="scss">
+.reservation_setting{
+    .personal-ceil{
+        width: 200px;
+        .el-input__inner{
+            width: 200px;
+            padding: 0 60px;
+        }
+    }
+    .price-box{
+        width: 300px;
+        display: inline-block;
+        .el-form-item__content{
+            position: relative;
+            .prepend,.append{
+                position: absolute;
+                left: 44px;
+                font-size: 14px;
+                line-height: 22px;
+                color: #1D2129;
+                line-height: 34px;
+            }
+            .append{
+                left: 142px;
+            }
+        }
+    }
+}
+</style>