yuhaitao14 7 years ago
parent
commit
e51e49b4d6

+ 7 - 0
shop/src/main/java/com/zskk/shop/dao/entry/ShopConfig.java

@@ -12,6 +12,7 @@ public class ShopConfig {
 	private Integer id;
 	private String key;
 	private String description;
+	private Integer editType;
 	private String value;
 	private Integer ctime;
 	public Integer getId() {
@@ -44,4 +45,10 @@ public class ShopConfig {
 	public void setCtime(Integer ctime) {
 		this.ctime = ctime;
 	}
+	public Integer getEditType() {
+		return editType;
+	}
+	public void setEditType(Integer editType) {
+		this.editType = editType;
+	}
 }

+ 7 - 3
shop/src/main/resource/mapper/ShopConfigMapper.xml

@@ -1,6 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zskk.shop.dao.ShopConfigMapper">
+	<sql id="select">
+		id, `key`, description, edit_type as editType, value, ctime
+	</sql>
+
 	<insert id="add" parameterType="com.zskk.shop.dao.entry.ShopConfig">
 		insert into shop_config(`key`, description, `value`, ctime)
 		values(#{key}, #{description}, #{value}, #{ctime})
@@ -10,17 +14,17 @@
 		where `key`=#{key}
 	</update>
 	<select id="query" resultType="com.zskk.shop.dao.entry.ShopConfig">
-		select *
+		select <include refid="select"></include>
 		from shop_config
 		where `key`=#{key}
 	</select>
 	<select id="queryAll" resultType="com.zskk.shop.dao.entry.ShopConfig">
-		select *
+		select <include refid="select"></include>
 		from shop_config
 	</select>
 	
 	<select id="queryOnline" resultType="com.zskk.shop.dao.entry.ShopConfig">
-		select *
+		select <include refid="select"></include>
 		from shop_config_online
 		where `key`=#{key}
 	</select>

+ 72 - 0
shop/static/manager/src/components/page/config/EditShopConfigType2.vue

@@ -0,0 +1,72 @@
+<template>
+    <div>
+        <div class="config_button">
+            <el-button type="primary" @click="save">保存</el-button>
+            <el-button @click="goBack">取消</el-button>
+        </div>
+        <div>
+            <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="value">
+            </el-input>
+        </div>
+    </div>
+</template>
+<script>
+var E = require('wangeditor')
+export default {
+  data() {
+    return {
+      key: '',
+      value: ''
+    }
+  },
+  methods: {
+    save: function() {
+      var that = this
+      var param = {
+        key: this.key,
+        value: this.value
+      }
+      this.$http.saveSysConfig(param, this).then(res => {
+        if (res.code === 0) {
+          this.$message({
+            message: '操作成功',
+            type: 'success',
+            duration: 1000,
+            onClose: function() {
+              that.$router.push('/sysConfig')
+            }
+          })
+        }
+      })
+    },
+    goBack: function() {
+      this.$router.back()
+    }
+  },
+  mounted: function() {
+    var key = this.$route.query.key
+    this.key = key
+    this.$http.getSysConfig({ key: key }, this).then(res => {
+      if (res.code === 0) {
+        this.value = res.obj
+      }
+    })
+  }
+}
+</script>
+
+<style>
+.bar {
+  background-color: #f1f1f1;
+  border: 1px solid #ccc;
+}
+.editor {
+  border: 1px solid #ccc;
+  border-top: none;
+  height: 700px;
+}
+
+.config_button {
+  margin-bottom: 20px;
+}
+</style>

+ 24 - 3
shop/static/manager/src/components/page/config/ShopConfigManager.vue

@@ -2,13 +2,17 @@
     <el-table :data="items">
         <el-table-column label="KEY" prop="key"></el-table-column>
         <el-table-column label="名称" prop="description">
+        </el-table-column>
+         <el-table-column label="内容类型" prop="editType" :formatter="formatEditType">
         </el-table-column>
         <el-table-column label="操作">
             <template slot-scope="scope">
                 <el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
-                <a :href="serverPath + 'info/preview/' + scope.row.key" target="_black">
+                <template v-if="scope.row.editType == 1">
+                   <a :href="serverPath + 'info/preview/' + scope.row.key" target="_blank">
                     <el-button type="text" size="small">预览</el-button>
-                </a>
+                  </a>
+                </template>
                 <el-button type="text" size="small" @click="release(scope.row)">发布</el-button>
             </template>
         </el-table-column>
@@ -23,8 +27,25 @@ export default {
     }
   },
   methods: {
+    formatEditType: function(row){
+      if (row.editType == 1){
+        return '富文本';
+      }else if (row.editType == 2){
+        return "文本";
+      }
+    },
     goEdit: function(row) {
-      this.$router.push({ path: '/editSysConfig', query: { key: row.key } })
+      if (row.editType == 1){
+        this.$router.push({ path: '/editSysConfig', query: { key: row.key } })
+      }else if (row.editType == 2){
+        this.$router.push({ path: '/editShopConfigType2', query: { key: row.key } })
+      }else{
+        this.$message({
+            message: '未知类型',
+            type: 'warning'
+          })
+      }
+      
     },
     release: function(row) {
       this.$confirm('您确定要发布配置信息吗 , 是否继续?', '提示', {

+ 4 - 0
shop/static/manager/src/router/index.js

@@ -62,6 +62,10 @@ export default new Router({
                     path: '/editSysConfig',
                     component: resolve => require(['../components/page/config/EditShopConfig'], resolve)
                 },
+                {
+                    path: '/editShopConfigType2',
+                    component: resolve => require(['../components/page/config/EditShopConfigType2'], resolve)
+                },
                 {
                     path: '/bannerManage',
                     component: resolve => require(['../components/page/banner/BannerManager'], resolve)