12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <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.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>
|