ソースを参照

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/asking/question/index.vue
lchao 1 年間 前
コミット
67cd6a7af0

+ 9 - 0
src/api/asking/question.js

@@ -43,6 +43,15 @@ export function updateQuestion(data) {
   })
   })
 }
 }
 
 
+//修改是否展示
+export function updateWhetherShow(data) {
+  return request({
+    url: '/asking/question/updateWhetherShow',
+    method: 'put',
+    data: data
+  })
+}
+
 // 删除问答列-问题
 // 删除问答列-问题
 export function delQuestion(id) {
 export function delQuestion(id) {
   return request({
   return request({

+ 9 - 0
src/api/asking/type.js

@@ -42,3 +42,12 @@ export function delType(id) {
     method: 'delete'
     method: 'delete'
   })
   })
 }
 }
+
+// 修改是否展示
+export function updateAskType(data) {
+  return request({
+    url: '/JnbQuestionType/type/updateAskType',
+    method: 'put',
+    data: data
+  })
+}

+ 2 - 1
src/views/asking/question/index.vue

@@ -246,6 +246,7 @@
 <script>
 <script>
 import { listQuestion, getQuestion, delQuestion, addQuestion, updateQuestion, listType,through,addAnswer,delAnswer } from "@/api/asking/question";
 import { listQuestion, getQuestion, delQuestion, addQuestion, updateQuestion, listType,through,addAnswer,delAnswer } from "@/api/asking/question";
 import {addType, updateType} from "@/api/asking/type";
 import {addType, updateType} from "@/api/asking/type";
+import { listQuestion, getQuestion, delQuestion, addQuestion, updateQuestion, listType,through,updateWhetherShow } from "@/api/asking/question";
 
 
 export default {
 export default {
   name: "Question",
   name: "Question",
@@ -326,7 +327,7 @@ export default {
     handleSwitchChange(row) {
     handleSwitchChange(row) {
       this.form.id = row.id
       this.form.id = row.id
       this.form.whetherShow = row.whetherShow
       this.form.whetherShow = row.whetherShow
-      updateQuestion(this.form).then(response => {
+      updateWhetherShow(this.form).then(response => {
         this.$modal.msgSuccess("修改成功");
         this.$modal.msgSuccess("修改成功");
         this.getList();
         this.getList();
       });
       });

+ 20 - 3
src/views/asking/type/index.vue

@@ -66,8 +66,12 @@
       <el-table-column label="类型名称" align="center" prop="type" />
       <el-table-column label="类型名称" align="center" prop="type" />
       <el-table-column label="是否首页展示" align="center" prop="whetherShow">
       <el-table-column label="是否首页展示" align="center" prop="whetherShow">
         <template slot-scope="scope">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_yes_no"
-                    :value="scope.row.whetherShow"/>
+          <el-switch
+            v-model="scope.row.whetherShow"
+            active-value="Y"
+            inactive-value="N"
+            @change="handleSwitchChange(scope.row)"
+          ></el-switch>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -127,7 +131,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { listType, getType, delType, addType, updateType } from "@/api/asking/type";
+import { listType, getType, delType, addType, updateType, updateAskType} from "@/api/asking/type";
 
 
 export default {
 export default {
   name: "Type",
   name: "Type",
@@ -179,6 +183,19 @@ export default {
     this.getList();
     this.getList();
   },
   },
   methods: {
   methods: {
+    /**点击开关 */
+    handleSwitchChange(row) {
+      console.log(row)
+      this.form.id = row.id
+      this.form.type = row.type
+      this.form.whetherShow = row.whetherShow
+      updateAskType(this.form).then(response => {
+        this.$modal.msgSuccess("修改成功");
+        this.getList();
+      });
+      // 在这里处理开关状态改变后的逻辑,例如发送一个请求到服务器
+      // console.log('Switch value:', row.homeDisplay);
+    },
     /** 查询类型配置列表 */
     /** 查询类型配置列表 */
     getList() {
     getList() {
       this.loading = true;
       this.loading = true;