Explorar o código

经销商新反馈换php接口

suxinf %!s(int64=4) %!d(string=hai) anos
pai
achega
f729ffe34f

+ 8 - 13
src/components/Modal.vue

@@ -225,9 +225,9 @@ export default {
       this.localDay = year + "-" + month + "-" + day;
     },
     // 判断非空
-    boforeEdit: function () {
-      this.releaseP = (this.releaseP || '').replace(/\s/g, "");
-      this.mediaTitle = (this.mediaTitle || '').replace(/\s/g, "");
+    beforeEdit: function () {
+      this.releaseP = (this.releaseP || "").replace(/\s/g, "");
+      this.mediaTitle = (this.mediaTitle || "").replace(/\s/g, "");
       if (!this.ziliaoTime) {
         this.noEditFlag = true;
         alert("发布时间不能为空");
@@ -298,7 +298,7 @@ export default {
         return item.id === idVal;
       });
       this.ziliaoName = obj.informationName; */
-      this.boforeEdit();
+      this.beforeEdit();
       if (!this.noEditFlag) {
         //获取车系 id
         let nameCarS = this.carS;
@@ -325,35 +325,30 @@ export default {
             releaseTime: this.ziliaoTime,
             carService: this.carS,
             carType: this.carT,
-
             //发布平台  渠道
             releaseMedia: this.releaseC,
             //发布板块
             releasePlate: this.releaseP,
-
             draftGenre: this.contentName1,
-
             //内容分类2?
             contentClass: this.contentName2,
             articleTitle: this.mediaTitle,
             articleLink: this.mediaUrl,
-
             readCount: this.readCount,
             goodCount: this.goodCount,
             bbsCount: this.bbsCount,
             lookingCount: this.lookingCount,
           },
         };
-
         if (this.LinkData.id) {
           //编辑
           config.url = "/updateDealerFeedback";
           config.data.id = this.LinkData.id;
-        } else {
-          //新增
-          config.url = "/dealerFeedback";
         }
-
+        // else {
+        //   //新增
+        //   config.url = "/dealerFeedback";
+        // }
         this.$emit("update", config);
         this.$emit("closeme");
       }

+ 59 - 16
src/views/data/UploadLink/sonUploadLink.vue

@@ -67,7 +67,7 @@
             <!-- 反馈截止日期 -->
             <td>{{ obj.mediaTitle }}</td>
             <!-- 稿件标题 -->
-            <td>
+            <td >
               <a :href="obj.mediaUrl" target="blank">{{ obj.mediaUrl }}</a>
             </td>
             <!-- 链接 -->
@@ -75,10 +75,7 @@
             <td
               class="operationStyle"
               style="cursor: pointer"
-              v-if="
-                +(obj.endDate || '').replace(RegExp('-', 'g'), '') - nowDate >=
-                0
-              "
+              v-if="+(obj.endDate || '').replace(RegExp('-', 'g'), '') - nowDate >= 0"
             >
               <span @click="toggleModal(index)">编辑</span>
               <!-- :class="showItemOperation" -->
@@ -97,15 +94,22 @@
       @update="editTitle"
       :releaseMedia="releaseMedia"
     ></Modal>
-    <!-- 弹窗: 新增内容   :LinkData="tableData[0]"-->
-    <Modal
+    <!-- 弹窗: 新增内容 -->
+    <AddModal
       v-if="showModalAdd"
       v-on:closeme="closemeAdd"
-      @update="editTitle"
+      @add_feedback="addFeedBack"
       :fileName="sfileName"
-      :modalTitle='addModalTitle'
-    ></Modal>
-
+      :ziliaoId='ziliaoId'
+      :userId="accountId"
+    ></AddModal>
+    <ResultModal
+      v-show="isShowresultModal"
+      :tipText="tipModalText"
+      :flag="resultModalFlag"
+      @close_result_modal="closeResultModal"
+      @result_modal_submit="submit"
+    ></ResultModal>
     <!-- 弹窗: 确定删除? -->
     <deleteModal
       v-if="showModal2"
@@ -114,7 +118,6 @@
       :LinkData="modalData"
       :showModalFlag="showModal2"
     ></deleteModal>
-
     <div class="pageBottom">
       <TablePage
         :currentPage="currentPage"
@@ -129,16 +132,20 @@
 
 <script>
 import Modal from "../../../components/Modal";
+import AddModal from "../components/addFeedbackMoal";
 import TablePage from "../../../components/TablePage";
 import deleteModal from "../../data/components/UploadLinkModalDelete";
 import { env_url, php_url } from "../../../config/env";
 import axiosTest from "axios";
+import ResultModal from "../components/UploadResultModal";
 export default {
   props: {},
   components: {
     Modal,
     TablePage,
     deleteModal,
+    AddModal,
+    ResultModal
   },
   data() {
     return {
@@ -188,11 +195,13 @@ export default {
       onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
       accountId: "",
       informationName: this.$route.query.informationName || "",
-      ziliaoId: this.$route.query.id || "",
-
+      ziliaoId: this.$route.query.informationId || "",
       nowDate: "", //反馈截止时间
       php_url: php_url,
-      addModalTitle: '新增'
+      isShowresultModal: false,
+      resultModalFlag: true,
+      tipModalText: "",
+      addReportConfig: {}
     };
   },
   computed: {
@@ -261,8 +270,42 @@ export default {
         .catch((err) => {
           console.log(err);
         });
+      // axiosTest({})
+      // console.log(val);
+    },
+    // 新增反馈接口
+    add_report: function () {
+       axiosTest({
+        method: "post",
+        url: this.php_url + "/lexus_php/api/add_report.php",
+        data: this.addReportConfig.data,
+      }).then((res) => {
+        console.log(res);
+        if(res.data && res.data.code === 0) {
+          this.isShowresultModal = true;
+          this.tipModalText = res.data.message;
+        } else {
+          this.getDataList();
+        }
+      }).catch((err) => {
+        console.log(err);
+      })
+    },
+    // 新增
+    addFeedBack: function (val) {
+      this.addReportConfig = val;
+      this.addReportConfig.data.add_times = 1
+      this.add_report();
+    },
+    // 关闭导入结果弹窗
+    closeResultModal: function () {
+      this.isShowresultModal = false;
+    },
+    // 导入结果返回结果是code是0
+    submit: function () {
+      this.addReportConfig.data.add_times = 2
+      this.add_report();
     },
-
     toDel: function () {
       this.showModal2 = !this.showModal2;
       //更新数据

+ 529 - 0
src/views/data/components/addFeedbackMoal.vue

@@ -0,0 +1,529 @@
+<template>
+  <div class="modal-backdrop">
+    <div class="modal">
+      <div class="modal-header">
+        <span>新增</span>
+      </div>
+      <div class="modal-body">
+        <div class="bodyRow">
+          <span>资料名称</span>
+          <div>{{ fileName }}</div>
+        </div>
+        <div class="bodyRow timeWidth">
+          <span>发布时间</span
+          ><input
+            type="date"
+            placeholder="选择时间"
+            :max="localDay"
+            v-model="ziliaoTime"
+          />
+        </div>
+        <div class="bodyRow">
+          <div class="contentCol1">
+            <span>涉及车型</span
+            ><select v-model="carTypeValue">
+              <option
+                v-for="(item, index) in carType"
+                :key="index"
+                :value="item.typeName"
+              >
+                {{ item.typeName || "123" }}
+              </option>
+            </select>
+          </div>
+        </div>
+        <div class="bodyRow">
+          <div class="contentCol1">
+            <span>发布渠道</span>
+            <select
+              name=""
+              id=""
+              v-model="releaseC"
+              @change="chooseChannel($event)"
+            >
+              <option v-for="(item, index) in releaseChannel" :key="index">
+                {{ item.platformName || "-" }}
+              </option>
+            </select>
+          </div>
+          <div class="contentCol2">
+            <span>平台版块</span>
+            <div v-if="releaseC !== '其它'">
+              <select name="" id="" v-model="releaseP">
+                <option v-for="(item, index) in releasePlate" :key="index">
+                  {{ item.platformName || "-" }}
+                </option>
+              </select>
+            </div>
+            <div v-else>
+              <input type="text" v-model="releaseP" />
+            </div>
+          </div>
+        </div>
+        <div class="bodyRow">
+          <div class="contentCol1">
+            <span>稿件类别</span>
+            <select name="" id="" v-model="contentName1">
+              <option v-for="(item, index) in content1" :key="index">
+                {{ item.dictName }}
+              </option>
+            </select>
+          </div>
+          <div class="contentCol2">
+            <span>内容分类</span
+            ><select name="" id="" v-model="contentName2">
+              <option v-for="(item, index) in content2" :key="index">
+                {{ item.dictName || "-" }}
+              </option>
+            </select>
+          </div>
+        </div>
+        <div class="bodyRow">
+          <div class="contentCol1">
+            <span>阅读量</span>
+            <input type="number" placeholder="" min="0" v-model="readCount" />
+          </div>
+          <div class="contentCol2">
+            <span>点赞</span>
+            <input type="number" placeholder="" min="0" v-model="goodCount" />
+          </div>
+        </div>
+        <div class="bodyRow">
+          <div class="contentCol1">
+            <span>评论</span>
+            <input type="number" placeholder="" min="0" v-model="bbsCount" />
+          </div>
+          <div class="contentCol2">
+            <span>在看/转发</span>
+            <input
+              type="number"
+              placeholder=""
+              min="0"
+              v-model="lookingCount"
+            />
+          </div>
+        </div>
+        <div class="bodyRow longInput">
+          <span>标题</span>
+          <input type="text" placeholder="文章标题" v-model="mediaTitle" />
+        </div>
+        <div class="bodyRow longInput">
+          <span>链接</span>
+          <input type="text" placeholder="文章发布地址" v-model="mediaUrl" />
+        </div>
+      </div>
+      <div class="modal-footer">
+        <!-- <button type="button" class="btn-confirm" @click="confirm">确认</button> -->
+        <button type="button" class="btn-confirm" @click="testUrl()">
+          确认
+        </button>
+        <button type="button" class="btn-close" @click="closeSelf">取消</button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "Modal",
+  props: {
+    fileName: {
+      type: String,
+      default: "",
+    },
+    ziliaoId: {
+      type: String,
+      default: "",
+    },
+    userId: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return {
+      ziliaoTime: "",
+      carTypeValue: "1",
+      carType: [],
+      releaseC: "", //'发布渠道',
+      releaseChannel: [], // 发布渠道列表
+      releaseP: "", //'平台版块',
+      releasePlate: [], // 平台版块
+      contentName1: "", //"稿件类别",
+      content1: [],
+      contentName2: "", //'内容分类',
+      content2: [],
+      readCount: 0,
+      goodCount: 0,
+      bbsCount: 0,
+      lookingCount: 0,
+      mediaTitle: "", //'文章标题',
+      mediaUrl: "",
+      dictList: [],
+      initParentId: "",
+      localDay: "",
+      noEditFlag: false,
+    };
+  },
+  methods: {
+    // 改变发布渠道
+    chooseChannel: function (e) {
+      let index = e.target.options.selectedIndex;
+      let req = {
+        parentId: this.releaseChannel[index].id,
+      };
+      this.channelType(req);
+    },
+    // 确认
+    testUrl: function () {
+      var regex = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/;
+      let flag = regex.test(this.mediaUrl);
+      if (flag) {
+        this.edit();
+      } else {
+        alert("链接输入有误!\n示例:https://www.baidu.com");
+      }
+    },
+    // 取消
+    closeSelf: function () {
+      this.$emit("closeme");
+    },
+    // 判断非空
+    beforeEdit: function () {
+      this.releaseP = (this.releaseP || "").replace(/\s/g, "");
+      this.mediaTitle = (this.mediaTitle || "").replace(/\s/g, "");
+      if (!this.ziliaoTime) {
+        this.noEditFlag = true;
+        alert("发布时间不能为空");
+        return;
+      }
+      if (!this.carTypeValue) {
+        this.noEditFlag = true;
+        alert("请选择车型");
+        return;
+      }
+      if (!this.releaseC) {
+        this.noEditFlag = true;
+        alert("请选择发布渠道");
+        return;
+      }
+      if (!this.releaseP) {
+        this.noEditFlag = true;
+        alert("请选择平台版块");
+        return;
+      }
+      if (!this.contentName1) {
+        this.noEditFlag = true;
+        alert("请选择稿件类别");
+        return;
+      }
+      if (!this.contentName2) {
+        this.noEditFlag = true;
+        alert("请选择内容分类");
+        return;
+      }
+      if (!this.readCount || this.readCount < 0) {
+        this.noEditFlag = true;
+        alert("请填写阅读量");
+        return;
+      }
+      if (!this.goodCount || this.goodCount < 0) {
+        this.noEditFlag = true;
+        alert("请填写点赞量");
+        return;
+      }
+      if (!this.bbsCount || this.bbsCount < 0) {
+        this.noEditFlag = true;
+        alert("请填写评论量");
+        return;
+      }
+      if (!this.lookingCount || this.lookingCount < 0) {
+        this.noEditFlag = true;
+        alert("请填写正确的在看/转发");
+        return;
+      }
+      if (!this.mediaTitle) {
+        this.noEditFlag = true;
+        alert("标题不能为空");
+        return;
+      }
+      if (!this.mediaUrl) {
+        this.noEditFlag = true;
+        alert("链接不能为空");
+        return;
+      }
+    },
+    edit() {
+      this.noEditFlag = false;
+      this.beforeEdit();
+      if (!this.noEditFlag) {
+        //当前月份
+        let date = new Date();
+        let m = date.getMonth() + 1;
+        let y = date.getFullYear();
+        let d = y + "/" + m;
+        let config = {
+          url: "",
+          data: {
+            month: d,
+            dealerId: this.userId,
+            dataId: this.ziliaoId,
+            informationName: this.fileName,
+            releaseTime: this.ziliaoTime,
+            carType: this.carTypeValue,
+            releaseMedia: this.releaseC,
+            releasePlate: this.releaseP,
+            draftGenre: this.contentName1,
+            contentClass: this.contentName2,
+            articleTitle: this.mediaTitle,
+            articleLink: this.mediaUrl,
+            readCount: this.readCount,
+            goodCount: this.goodCount,
+            bbsCount: this.bbsCount,
+            lookingCount: this.lookingCount,
+          },
+        };
+        this.$emit("add_feedback", config);
+        this.closeSelf();
+      }
+    },
+    // 获取当前的月份
+    getLocalMonth: function () {
+      let data = new Date();
+      let year = data.getFullYear();
+      let month = data.getMonth() + 1;
+      let day = data.getDate();
+      if (month < 10) {
+        month = "0" + month;
+      } else {
+        month = month + "";
+      }
+      this.localDay = year + "-" + month + "-" + day;
+    },
+    getCarType: function () {
+      this.$http({
+        method: "post",
+        url: "/base/carTypeManager/selectCarTypePage",
+        data: {},
+      })
+        .then((res) => {
+          if (res.data && res.data.code === 200) {
+            this.carType = res.data.data;
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    channelType: function (data) {
+      return new Promise((resolve, reject) => {
+        this.$http({
+          url: "/base/publishPlatformManager/selectPublishPlatformPage",
+          method: "post",
+          data,
+        })
+          .then((res) => {
+            this.releasePlate = [];
+            if (res.data.code === 200) {
+              if (!data) {
+                this.releaseChannel = res.data.data;
+              } else {
+                this.releasePlate = res.data.data;
+              }
+            }
+            resolve();
+          })
+          .catch((err) => {
+            console.log(err);
+            reject();
+          });
+      });
+    },
+    // 获取内容分类、媒体平台、常用参数接口的标识,再调接口时需要用到
+    selectSysDataDictList: function () {
+      return new Promise((resolve, reject) => {
+        this.$http({
+          method: "post",
+          url: "/sys/dataDict/selectSysDataDictList",
+          data: {},
+        })
+          .then((res) => {
+            if (res.data && res.data.code === 200) {
+              this.dictList = res.data.data;
+              resolve();
+            }
+          })
+          .catch((err) => {
+            console.log(err);
+            reject();
+          });
+      });
+    },
+    getContent1: function () {
+      this.$http({
+        method: "post",
+        url: "/sys/dataDict/selectSysDataDictPage",
+        data: {
+          dictCode: this.dictList[1]["dictCode"],
+          parentId: this.dictList[1]["id"],
+        },
+      })
+        .then((res) => {
+          if (res.data && res.data.code === 200) {
+            this.content1 = res.data.data;
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    getContent2: function () {
+      this.$http({
+        method: "post",
+        url: "/sys/dataDict/selectSysDataDictPage",
+        data: {
+          dictCode: this.dictList[2]["dictCode"],
+          parentId: this.dictList[2]["id"],
+        },
+      })
+        .then((res) => {
+          if (res.data && res.data.code === 200) {
+            this.content2 = res.data.data;
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+  },
+  mounted() {
+    this.getLocalMonth();
+    this.getCarType();
+    this.channelType();
+    this.selectSysDataDictList().then(() => {
+      this.getContent1();
+      this.getContent2();
+    });
+  },
+};
+</script>
+
+<style>
+.modal-backdrop {
+  position: fixed;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  background-color: #7d9191;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.modal {
+  background-color: #eeeeee;
+  box-shadow: 2px 2px 20px 1px;
+  overflow-x: auto;
+  display: flex;
+  flex-direction: column;
+  border-radius: 0px;
+  width: 1030px;
+}
+.modal-header {
+  border-bottom: 1px solid #eee;
+  color: #313131;
+  justify-content: space-between;
+  padding: 15px;
+  display: flex;
+  border-bottom: 1px solid #e3e3e3;
+}
+.modal-header span {
+  font-size: 16px;
+  font-weight: bold;
+}
+.modal-footer {
+  border-top: 1px solid #eee;
+  justify-content: center;
+  padding: 15px;
+  display: flex;
+}
+.modal-footer button {
+  width: 90px;
+  margin-left: 0px;
+}
+.modal-footer button:nth-child(1) {
+  margin-right: 80px;
+}
+.modal-body {
+  position: relative;
+  padding: 20px 120px 20px 180px;
+}
+.modal-body span,
+select,
+input,
+div {
+  font-size: 14px;
+}
+
+.btn-close,
+.btn-confirm {
+  border-radius: 8px;
+  margin-left: 16px;
+  width: 56px;
+  height: 36px;
+  border: none;
+  cursor: pointer;
+}
+.btn-close {
+  color: #313131;
+  background-color: gray;
+}
+.btn-confirm {
+  color: #fff;
+  background-color: #0056a0;
+}
+.bodyRow {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+  padding: 4px;
+}
+.bodyRow span {
+  width: 80px;
+  margin: 10px;
+}
+.bodyRow select {
+  width: 120px;
+}
+.bodyRow input {
+  width: 112px;
+}
+.longInput input {
+  width: 476px;
+}
+.bodyRow select,
+input {
+  padding: 2px;
+}
+.contentCol1 {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+}
+.contentCol1 span {
+  width: 80px;
+  margin: 10px;
+}
+.contentCol1 div {
+  width: 120px;
+}
+.contentCol2 {
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+  width: 363px;
+}
+.timeWidth input {
+  width: 150px;
+}
+</style>