Browse Source

添加文章推荐

aaa 3 years ago
parent
commit
f7a18d7e4a

+ 27 - 1
src/views/articleManagement/articleCreate.vue

@@ -121,6 +121,20 @@
               style="width: 100%"
             />
           </a-form-item>
+          <a-form-item label="推荐:">
+            <a-radio-group
+              @change="recommendChange"
+              v-decorator="[
+                'recommand',
+                {
+                  initialValue: recommand,
+                },
+              ]"
+            >
+              <a-radio value="true"> 是 </a-radio>
+              <a-radio value="false"> 否 </a-radio>
+            </a-radio-group>
+          </a-form-item>
           <a-form-item v-show="false" :wrapper-col="{ span: 20, offset: 10 }">
             <a-button id="articleCreateSubmit" type="primary" html-type="submit"
               >提交</a-button
@@ -198,6 +212,7 @@ export default {
       articleChildClass: {},
       engineerType: "",
       learnDate: "",
+      recommand: "false",
       optionType: "",
       description: "",
       bodyStyle: {
@@ -301,6 +316,11 @@ export default {
     learnDateChoose(date, dateString) {
       this.learnDate = dateString;
     },
+    // 推荐选择
+    recommendChange(date) {
+      this.recommand = date.target.value;
+      console.log("------" + this.recommand);
+    },
     handleSubmitBtnFun() {
       document.getElementById("articleCreateSubmit").click();
     },
@@ -347,6 +367,8 @@ export default {
       // 必学日期
       this.learnDate = learnDate ? formateStringDate(learnDate) : null;
       console.log("编辑初始化时间为YYYY-MM-DD", this.learnDate, learnDate);
+      this.recommand = item.recommand;
+      console.log("--推荐--" + item.recommand);
       // 文章内容
       this.content = item.contents;
       // 附件内容
@@ -392,6 +414,9 @@ export default {
       this.form.setFieldsValue({
         engineerType: this.engineerType.name
       });
+      this.form.setFieldsValue({
+        recommand: this.recommand
+      });
       this.form.validateFields((err, values) => {
         if (!err) {
           // 新建文章
@@ -419,7 +444,8 @@ export default {
                 contents: that.content,
                 tags: tag ? [tag] : [],
                 engineerTypes: [that.engineerType.id],
-                links: links
+                links: links,
+                recommand: that.recommand
               };
               that.$_http
                 .post(that.$_API.INTERFACE_POST_ADMIN_MATERIALS, bodyParams, {

+ 2 - 1
src/views/articleManagement/videoCreate.vue

@@ -474,7 +474,8 @@ export default {
                 contents: JSON.stringify(contentObj),
                 tags: tag ? [tag] : [],
                 engineerTypes: [that.engineerType.id],
-                links: links
+                links: links,
+                recommand: that.recommand
               };
               that.$_http
                 .post(that.$_API.INTERFACE_POST_ADMIN_MATERIALS, bodyParams, {