瀏覽代碼

文章修改

LIPENGTAO1313 6 年之前
父節點
當前提交
4e780da031

+ 4 - 1
src/components/bench-views/ArticleTemplate.vue

@ -29,7 +29,7 @@
29 29
          </ul>
30 30
        </div>
31 31
        <div class="dele" v-if='flag === 1'>
32
          <el-button type="primary" size="small" v-if="(item.status == 0 || item.status == 2)">修改</el-button>
32
          <el-button type="primary" size="small" v-if="(item.status == 0 || item.status == 2)" @click.stop="revise(item)">修改</el-button>
33 33
          <el-button type="danger" icon="el-icon-delete" circle  @click.stop="delet(item.articleId, index)"></el-button>
34 34
        </div>
35 35
        <div class="dele" v-else-if='flag === 2'>
@ -94,6 +94,9 @@
94 94
      this.expertList();
95 95
    },
96 96
    methods: {
97
      revise(item) {
98
        this.$router.push({ path: '/PublishArticle?arId=' + item.articleId});
99
      },
97 100
      comTime: util.dateChange,
98 101
      expertList() {
99 102
        this.dataList = [];

+ 22 - 1
src/components/bench-views/contentManagement/PublishArticle.vue

@ -24,7 +24,7 @@
24 24
        <el-form-item label="文章标题" prop="artTit">
25 25
          <el-input v-model="ruleForm.artTit" placeholder="请填写文章标题"></el-input>
26 26
        </el-form-item>
27
        <dynamicTags :tagInfo="tagInfo" :industry="ruleForm.industry" ref="subjectTags" v-on:turnTags="turnTags($event)"></dynamicTags>
27
        <dynamicTags :tagInfo="tagInfo" :industry="ruleForm.industry" ref="subjectTags" v-on:turnTags="turnTags($event)" :dy="dy" :dynamicTagsLength="5"></dynamicTags>
28 28
        <el-form-item label="文章正文">
29 29
          <!-- <el-input type="textarea" :rows="4" v-model="ruleForm.artDesc" placeholder="
30 30
  请填写详细描述"></el-input> -->
@ -95,6 +95,7 @@
95 95
  export default {
96 96
    data() {
97 97
      return {
98
        dy:'',
98 99
        plf_user: '',
99 100
        platSource: '',
100 101
        tagInfo: {
@ -123,8 +124,13 @@
123 124
      };
124 125
    },
125 126
    created() {
127
      this.articleId = util.urlParse('arId');
128
      if (this.articleId) {
129
        this.getArticle();
130
      }
126 131
      this.plf_user = Cookies.get('plf_user');
127 132
      this.platSource = Cookies.get('platSource');
133
      this.ifDelete = true;
128 134
      // this.$refs.subjectTags
129 135
    },
130 136
    computed: {
@ -134,6 +140,21 @@
134 140
      }
135 141
    },
136 142
    methods: {
143
      getArticle() {
144
        this.$axios.get(httpUrl.kxQurey.article.query, {
145
          params: {
146
            articleId: this.articleId
147
          }
148
        }).then((res) => {
149
          if (res.success) {
150
            this.ruleForm.artTit = res.data.articleTitle;
151
            this.ruleForm.imageUrl = util.ImageUrl('article/' + res.data.articleImg, false);
152
            this.ruleForm.industry = res.data.subject;
153
            this.dy = res.data.subject;
154
            this.$refs.ueBox.setUEContent(res.data.articleContent);
155
          }
156
        });
157
      },
137 158
      turnTags(msg) {
138 159
        this.ruleForm.industry = msg;
139 160
      },

+ 6 - 0
src/components/bench-views/contentManagement/editorUE.vue

@ -43,6 +43,12 @@
43 43
      getUEContent() { // 获取内容方法
44 44
        return this.editor.getContent();
45 45
      },
46
      setUEContent(uhtml) { // 获取内容方法
47
        var self = this;
48
        this.editor.addListener('ready', function () {
49
          self.editor.setContent(uhtml); // 确保UE加载完成后放入内容
50
        });
51
      },
46 52
      testMsg() {
47 53
        const self = this;
48 54
        this.defaultMsg = this.text;

+ 13 - 2
src/components/sub-component/DynamicTags.vue

@ -36,6 +36,12 @@
36 36
      },
37 37
      industry: {
38 38
        type: String
39
      },
40
      dy: {
41
        type: String
42
      },
43
      dynamicTagsLength: {
44
        type: Number
39 45
      }
40 46
    },
41 47
    data() {
@ -50,10 +56,15 @@
50 56
    },
51 57
    created() {
52 58
      this.dynamicTags = this.industry.split(',');
53
      if (this.dynamicTags.length === 10) {
59
      if (this.dynamicTags.length === this.dynamicTagsLength) {
54 60
        this.isShowAdd = false;
55 61
      };
56 62
    },
63
    watch: {
64
      dy() {
65
        this.dynamicTags = this.dy.split(',');
66
      }
67
    },
57 68
    methods: {
58 69
      // add tag
59 70
      handleClose(tag) {
@ -74,7 +85,7 @@
74 85
        if (inputValue.length > 15) {
75 86
          this.$message.error(`${this.tagInfo.lableTit}不得超过15个字,添加失败!`);
76 87
        }
77
        if (this.dynamicTags.length === 10) {
88
        if (this.dynamicTags.length === this.dynamicTagsLength) {
78 89
          this.isShowAdd = false;
79 90
        }
80 91
        if (inputValue && inputValue.length < 15 && this.dynamicTags.length < 10) {