Pārlūkot izejas kodu

feat: 增加钢琴音响壁纸图片删除和编辑修复

Damon 8 mēneši atpakaļ
vecāks
revīzija
2bba0319a6
2 mainītis faili ar 53 papildinājumiem un 36 dzēšanām
  1. 2 2
      src/utils/request.js
  2. 51 34
      src/views/operation/piano/index.vue

+ 2 - 2
src/utils/request.js

@@ -65,7 +65,7 @@ service.interceptors.request.use(config => {
       const s_time = sessionObj.time; // 请求时间
       var interval; // 间隔时间(ms),小于此时间视为重复提交
 
-      console.log("gadfadsqwerqewrwqr=aaa==" + JSON.stringify(config));
+      // console.log("gadfadsqwerqewrwqr=aaa==" + JSON.stringify(config));
 
       ///活动管理-新增赠送流量特殊处理
       if (config.url === "/admin/activity/doExchange") {
@@ -96,7 +96,7 @@ service.interceptors.response.use(res => {
     // 获取错误信息
     const msg = errorCode[code] || res.data.msg || errorCode['default']
 
-    console.log("gadfadsqwerqewrwqr=bbb==" + code + "====" + res.data.msg);
+    // console.log("gadfadsqwerqewrwqr=bbb==" + code + "====" + res.data.msg);
     // console.log("gadfadsqwerqewrwqr=cccc==" + JSON.stringify(res));
 
     // 二进制数据则直接返回

+ 51 - 34
src/views/operation/piano/index.vue

@@ -78,17 +78,13 @@
         </el-form-item>
 
         <el-form-item label="应用类型:" prop="applicationType">
-          <el-select
-            v-model="dialogData.applicationType"
-            placeholder="请选择设备类型"
-          >
-            <el-option
-              v-for="item in applicationType"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            />
-          </el-select>
+          <input type="checkbox" v-model="isChecked1" /> 小程序
+          <input
+            type="checkbox"
+            style="margin-left: 30px"
+            v-model="isChecked2"
+          />
+          APP
         </el-form-item>
       </el-form>
 
@@ -117,6 +113,9 @@ export default {
   mixins: [devMixin, currentMixin, disabledMixin],
   data() {
     return {
+      isChecked1: false,
+      isChecked2: false,
+
       // 遮罩层
       loading: false,
       // 表单
@@ -134,17 +133,6 @@ export default {
       dialogData: {
         sort: 1,
       },
-      // 设备连接
-      applicationType: [
-        {
-          value: "0",
-          label: "小程序",
-        },
-        {
-          value: "1",
-          label: "APP",
-        },
-      ],
       ///弹窗类型
       dialogStatus: 0,
 
@@ -181,13 +169,41 @@ export default {
 
     // 弹窗
     async getDialog(status, row) {
-      console.log("gadfadfqwwerqewr=aaa==" + JSON.stringify(row));
       this.dialogVisible = true;
       this.dialogStatus = status;
+      ///新增
       if (status == 0) {
         this.dialogData = { sort: 1 };
-      } else {
+      }
+      ///编辑
+      else {
         this.dialogData = row;
+        var applicationType = this.dialogData.applicationType;
+        this.isChecked1 = false;
+        this.isChecked2 = false;
+        if (applicationType != null && applicationType != "") {
+          applicationType = applicationType.replace(/[\[\]]/g, "");
+          // 使用split按逗号分割字符串
+          let result = applicationType.split(",");
+          if (result != null && result != "" && result.length > 0) {
+            if (result.length == 2) {
+              this.isChecked1 = true;
+              this.isChecked2 = true;
+            } else {
+              if (result[0] == "0") {
+                this.isChecked1 = true;
+              } else {
+                this.isChecked2 = true;
+              }
+            }
+          } else {
+            if (applicationType == 0) {
+              this.isChecked1 = true;
+            } else if (applicationType == 1) {
+              this.isChecked2 = true;
+            }
+          }
+        }
       }
     },
 
@@ -213,7 +229,7 @@ export default {
     getDialogClose() {
       this.dialogVisible = false;
       this.dialogData = { sort: 1 };
-      this.$refs.dialogData.resetFields();
+      // this.$refs.dialogData.resetFields();
     },
 
     // 上传
@@ -235,18 +251,19 @@ export default {
         return;
       }
 
-      var applicationType = this.dialogData.applicationType;
-      if (applicationType == null || applicationType == "") {
+      if (!this.isChecked1 && !this.isChecked2) {
         this.$message.success("请选择应用类型");
         return;
       }
 
-      console.log(
-        "gadfadfqwwerqewr==111=" +
-          this.dialogStatus +
-          "===" +
-          JSON.stringify(this.dialogData)
-      );
+      if (this.isChecked1 && this.isChecked2) {
+        this.dialogData.applicationType = "[0,1]";
+      } else if (this.isChecked2) {
+        this.dialogData.applicationType = "[1]";
+      } else {
+        this.dialogData.applicationType = "[0]";
+      }
+
       ///新增
       if (this.dialogStatus == 0) {
         add(this.dialogData).then((res) => {
@@ -259,7 +276,7 @@ export default {
         edit(this.dialogData).then((res) => {
           if (res.code === 0) {
             this.$message.success("修改成功!");
-            this.cancel();
+            this.getDialogClose();
           }
         });
       }