123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <template>
- <div>
- <div class="config_button">
- <el-button type="primary" @click="save" size="mini">保存</el-button>
- <el-button @click="goBack" size="mini">取消</el-button>
- </div>
- <div id="bar" class="bar"></div>
- <div id="editor" class="editor"></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.back();
- }
- });
- }
- });
- },
- goBack: function() {
- this.$router.back();
- }
- },
- mounted: function() {
- var that = this;
- var editor = new E("#bar", "#editor");
- editor.customConfig.uploadImgShowBase64 = true;
- editor.customConfig.colors = [
- '#00000000',
- '#000000',
- '#eeece0',
- '#1c487f',
- '#4d80bf',
- '#c24f4a',
- '#8baa4a',
- '#7b5ba1',
- '#46acc8',
- '#f9963b',
- '#ffffff'
- ];
- //editor.customConfig.uploadImgServer = process.env.SERVER_PATH + 'editupload'
- //editor.customConfig.uploadFileName = 'file'
- editor.customConfig.onchange = function(html) {
- that.value = html;
- };
- editor.create();
- var key = this.$route.query.key;
- this.key = key;
- this.$http.getSysConfig({ key: key }, this).then(res => {
- if (res.code === 0) {
- editor.txt.html(res.obj);
- }
- });
- }
- };
- </script>
- <style scoped>
- .bar {
- background-color: #f1f1f1;
- border: 1px solid #ccc;
- }
- .editor {
- border: 1px solid #ccc;
- border-top: none;
- height: 700px;
- }
- .config_button {
- margin-bottom: 20px;
- }
- .operation {
- display: flex;
- height: 50px;
- border-bottom: 1px solid #e6e6e6;
- margin-bottom: 10px;
- }
- .operation .btn {
- display: flex;
- height: 28px;
- }
- .operation .btn,
- .operation .el-input,
- .operation .el-select {
- width: 150px;
- margin-right: 8px;
- }
- </style>
|