Browse Source

分享默认图片

natasha 1 năm trước cách đây
mục cha
commit
eafd1622de

+ 1 - 1
src/components/NavMenu.vue

@@ -170,7 +170,7 @@ export default {
                         index:'discount_setting',
                     },
                     {
-                        title:'分享路径',
+                        title:'分享配置',
                         index:'share_setting',
                     },
                     {

+ 12 - 7
src/views/system_config/ExportSetting.vue

@@ -173,13 +173,18 @@ export default {
         .then((res) => {
             if(res.status===1){
                 this.registerForm.file_id = res.person_data_import_template_file_id
-                this.registerForm.file_url = res.person_data_import_template_file_url,
-                this.registerForm.resource = [
-                    {
-                        id: res.person_data_import_template_file_id,
-                        name: res.person_data_import_template_file_name
-                    }
-                ]
+                this.registerForm.file_url = res.person_data_import_template_file_url
+                if(res.person_data_import_template_file_id){
+                    this.registerForm.resource = [
+                        {
+                            id: res.person_data_import_template_file_id,
+                            name: res.person_data_import_template_file_name
+                        }
+                    ]
+                }else{
+                    this.registerForm.resource = []
+                }
+                
             }
         }).catch((res) =>{
             

+ 10 - 6
src/views/system_config/PaySetting.vue

@@ -193,12 +193,16 @@ export default {
         .then((res) => {
             if(res.status===1){
                 this.registerForm = res
-                this.registerForm.wx.cert_file_List = [
-                    {
-                        id: res.wx.cert_file_id,
-                        name: res.wx.cert_file_name
-                    }
-                ]
+                if(res.wx.cert_file_id){
+                    this.registerForm.wx.cert_file_List = [
+                        {
+                            id: res.wx.cert_file_id,
+                            name: res.wx.cert_file_name
+                        }
+                    ]
+                }else{
+                    this.registerForm.wx.cert_file_List = []
+                }
             }
         }).catch((res) =>{
             

+ 128 - 12
src/views/system_config/ShareSetting.vue

@@ -6,12 +6,21 @@
         <div class="manage-root-contain-right">
             <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
             <div class="create-bottom">
-                <h3>分享路径</h3>
+                <h3>分享配置</h3>
                 <el-form :model="registerForm" :rules="rulesRegister" ref="registerForm" label-width="100px" class="registerForm" label-position="top">
-                    <el-form-item label="" prop="article_share_url_path">
+                    <el-form-item label="分享路径" prop="article_share_url_path">
                         <el-input v-model="registerForm.article_share_url_path" autocomplete="off" placeholder="请输入分享路径" @blur="handleTrim('registerForm','article_share_url_path')" maxlength="200">
                         </el-input>
                     </el-form-item>
+                    <el-form-item label="分享默认封面" prop="cert_file_List">
+                        <upload :datafileList="registerForm.cert_file_List" :changeFillId="handleAvatarSuccess" :fileName="'courseResource'" :filleNumber="1" :showList="true" />
+                        <ul v-if="registerForm.cert_file_List.length>0" class="resource-list">
+                            <li v-for="(itemR,indexR) in registerForm.cert_file_List" :key="indexR">
+                                <a @click="handlePreview(itemR)"><svg-icon icon-class="jpg" class="icon-logo"></svg-icon><span>{{itemR.name}}</span></a>
+                                <i class="el-icon-delete" @click="handleDelResource(indexR)"></i>
+                            </li>
+                        </ul>
+                    </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>
@@ -20,6 +29,20 @@
             </div>
         </div>
     </div>
+    <el-dialog
+        :visible.sync="resourceFlag"
+        :show-close="true"
+        :close-on-click-modal="false"
+        :modal-append-to-body="false"
+        width="1000px"
+        class="login-dialog"
+        v-if="resourceFlag">
+        <iframe
+          :src="resourceUrl"
+          width="100%"
+          height="600px"
+        ></iframe>
+    </el-dialog>
   </div>
 </template>
 
@@ -30,10 +53,12 @@ import Header from "../../components/Header.vue";
 import NavMenu from "../../components/NavMenu.vue"
 import Breadcrumb from '../../components/Breadcrumb.vue';
 import { getLogin } from "@/api/ajax";
-
+import Upload from "../../components/Upload.vue"
+import { mapState } from 'vuex';
+const Base64 = require("js-base64").Base64;
 export default {
   //import引入的组件需要注入到对象中才能使用
-  components: { Header, NavMenu, Breadcrumb },
+  components: { Header, NavMenu, Breadcrumb, Upload },
   props: {},
   data() {
     //这里存放数据
@@ -58,17 +83,21 @@ export default {
             }
         ],
         registerForm:{
-            article_share_url_path: ''
+            article_share_url_path: '',
+            article_share_default_cover_image_id: '',
+            cert_file_List: []
         },
         rulesRegister:{
         },
         newPwdFlag: false, // 查看新密码
-        loading: false
+        loading: false,
+        resourceUrl: '', // 课节资源预览地址
+        resourceFlag: false,
     }
   },
   //计算属性 类似于data概念
   computed: {
-    
+      ...mapState(['file_preview_url']),
   },
   //监控data中数据变化
   watch: {
@@ -88,9 +117,10 @@ export default {
         this.$refs[formName].validate((valid) => {
           if (valid) {
             this.loading = true
-            let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_SharePath";
+            let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_Share";
             let data = {
-                article_share_url_path: this.registerForm.article_share_url_path
+                article_share_url_path: this.registerForm.article_share_url_path,
+                article_share_default_cover_image_id: this.registerForm.article_share_default_cover_image_id
             }
             getLogin(MethodName, data)
             .then((res) => {
@@ -112,16 +142,60 @@ export default {
     },
     // 得到配置信息
     getInfo(){
-        let MethodName = "/OrgServer/Manager/SysConfigManager/GetSysConfig_SharePath";
+        let MethodName = "/OrgServer/Manager/SysConfigManager/GetSysConfig_Share";
         getLogin(MethodName, {})
         .then((res) => {
             if(res.status===1){
-                this.registerForm.article_share_url_path = res.article_share_url_path
+                this.registerForm = res
+                if(res.article_share_default_cover_image_id){
+                    this.registerForm.cert_file_List = [
+                        {
+                            id: res.article_share_default_cover_image_id,
+                            name: '默认分享封面.png'
+                        }
+                    ]
+                }else{
+                    this.registerForm.cert_file_List = []
+                }
             }
         }).catch((res) =>{
             
         })
-    }
+    },
+    handleAvatarSuccess(fileList,name) {
+        this.registerForm.cert_file_List = fileList
+        this.registerForm.article_share_default_cover_image_id = fileList[0]&&fileList[0].response&&fileList[0].response.file_info_list&&fileList[0].response.file_info_list[0]?fileList[0].response.file_info_list[0].file_id:''
+        this.$forceUpdate()
+    },
+    // 删除资源文件
+    handleDelResource(i){
+        this.$confirm("确定删除吗?", "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+        }).then(() => {
+            this.registerForm.cert_file_List.splice(i, 1);
+            this.$forceUpdate()
+        });
+    },
+    // 预览文件
+    handlePreview(item){
+        let MethodName = '/FileServer/GetFileInfo'
+        let data = {
+            file_id: item.id
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+                let path =
+                `${this.file_preview_url}/onlinePreview?url=` +
+                Base64.encode(res.file_url);
+                this.resourceUrl = path;
+                this.resourceFlag = true
+            }
+        })
+        
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -163,6 +237,48 @@ export default {
         color: #1D2129;
     }
 }
+.resource-list{
+    list-style: none;
+    margin: 12px 0 0 0;
+    padding: 0;
+    li{
+        display: flex;
+        align-items: center;
+        a{
+            width: 360px;
+            padding: 7px 12px;
+            background: #F7F8FA;
+            border-radius: 2px;
+            color: #1D2129;
+            display: flex;
+            align-items: center;
+            cursor: pointer;
+            span{
+                overflow:hidden;
+                text-overflow:ellipsis;
+                white-space: nowrap;
+                flex: 1;
+                display: block;
+                font-size: 14px;
+                line-height: 22px;
+            }
+            .svg-icon{
+                width: 16px;
+                height: 16px;
+                margin-right: 8px;
+                color: #4E5969;
+            }
+        }
+        .el-icon-delete{
+            color: #4E5969;
+            cursor: pointer;
+            margin-left: 12px;
+            &:hover{
+                color: #165DFF;
+            }
+        }
+    }
+}
 </style>
 
 <style lang="scss">