Browse Source

分享默认头像及精读订阅价格配置

natasha 1 year ago
parent
commit
fd83f4abfa

+ 4 - 0
src/components/NavMenu.vue

@@ -184,6 +184,10 @@ export default {
                     {
                         title:'预览配置',
                         index:'preview_setting',
+                    },
+                    {
+                        title:'精读订阅包年价格',
+                        index:'reservation_setting',
                     }
                 ]
             }

+ 5 - 0
src/router/index.js

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

+ 194 - 0
src/views/system_config/ReservationSetting.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="iread_year_valid_period_price" class="price-box">
+                        <el-input-number v-model="registerForm.iread_year_valid_period_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: "reservation_setting",
+        breadcrumbList:[
+            {
+                icon:'setting',
+                url:'',
+                text:''
+            },
+            {
+                icon:'',
+                url:'',
+                notLink: true,
+                text:'系统配置'
+            },
+            {
+                icon:'',
+                url:'',
+                text:'精读订阅包年价格'
+            }
+        ],
+        registerForm:{
+            iread_year_valid_period_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_Reservation";
+            let data = {
+                iread_year_valid_period_price: this.registerForm.iread_year_valid_period_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_Reservation";
+        getLogin(MethodName, {})
+        .then((res) => {
+            if(res.status===1){
+                this.registerForm.iread_year_valid_period_price = res.iread_year_valid_period_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>

+ 45 - 6
src/views/system_config/ShareSetting.vue

@@ -11,6 +11,7 @@
                     <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>
+                        <p class="tips">域名+/#/share 例如https://21st.helxsoft.cn/#/share</p>
                     </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" />
@@ -21,6 +22,15 @@
                             </li>
                         </ul>
                     </el-form-item>
+                    <el-form-item label="分享默认头像" prop="person_file_List">
+                        <upload :datafileList="registerForm.person_file_List" :changeFillId="handleAvatarSuccess" :fileName="'personImage'" :filleNumber="1" :showList="true" />
+                        <ul v-if="registerForm.person_file_List.length>0" class="resource-list">
+                            <li v-for="(itemR,indexR) in registerForm.person_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,'personImage')"></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>
@@ -85,7 +95,9 @@ export default {
         registerForm:{
             article_share_url_path: '',
             article_share_default_cover_image_id: '',
-            cert_file_List: []
+            cert_file_List: [],
+            person_file_List: [],
+            article_share_default_person_image_id: ''
         },
         rulesRegister:{
         },
@@ -120,7 +132,8 @@ export default {
             let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_Share";
             let data = {
                 article_share_url_path: this.registerForm.article_share_url_path,
-                article_share_default_cover_image_id: this.registerForm.article_share_default_cover_image_id
+                article_share_default_cover_image_id: this.registerForm.article_share_default_cover_image_id,
+                article_share_default_person_image_id: this.registerForm.article_share_default_person_image_id
             }
             getLogin(MethodName, data)
             .then((res) => {
@@ -157,24 +170,44 @@ export default {
                 }else{
                     this.registerForm.cert_file_List = []
                 }
+                if(res.article_share_default_person_image_id){
+                    this.registerForm.person_file_List = [
+                        {
+                            id: res.article_share_default_person_image_id,
+                            name: '默认分享头像.png'
+                        }
+                    ]
+                }else{
+                    this.registerForm.person_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:''
+        if(name==='personImage'){
+            this.registerForm.person_file_List = fileList
+            this.registerForm.article_share_default_person_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:''
+        }else{
+            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){
+    handleDelResource(i,type){
         this.$confirm("确定删除吗?", "提示", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
             type: "warning",
         }).then(() => {
-            this.registerForm.cert_file_List.splice(i, 1);
+            if(type){
+                this.registerForm.person_file_List.splice(i, 1);
+            }else{
+                this.registerForm.cert_file_List.splice(i, 1);
+            }
             this.$forceUpdate()
         });
     },
@@ -279,6 +312,12 @@ export default {
         }
     }
 }
+.tips{
+    margin: 0;
+    color: #86909C;
+    font-size: 12px;
+    line-height: 20px;
+}
 </style>
 
 <style lang="scss">