Kaynağa Gözat

1、新增点播播放源配置

yfh 5 gün önce
ebeveyn
işleme
67be9da54b
1 değiştirilmiş dosya ile 151 ekleme ve 1 silme
  1. 151 1
      src/views/system/config/config.vue

+ 151 - 1
src/views/system/config/config.vue

@@ -485,6 +485,91 @@
            </div>
          </el-form>
        </el-tab-pane>
+       <el-tab-pane label="点播播放源配置" name="courseMa.config">
+         <el-button type="primary" @click="addCourseMaConfig" style="margin-bottom: 10px">添加配置</el-button>
+         <el-table  height="660" border v-loading="courseMaConfigLoading" :data="courseMaConfigList">
+           <el-table-column label="名称" align="center" prop="name">
+             <template slot-scope="scope">
+               <el-input v-model="scope.row.name" placeholder="请输入名称" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="类型" align="center" prop="type">
+             <template slot-scope="scope">
+               <el-select
+                 v-model="scope.row.type"
+                 placeholder="请选择类型"
+                 :disabled="!scope.row.editing">
+                 <el-option label="小程序" value="1"></el-option>
+                 <el-option label="服务号" value="2"></el-option>
+               </el-select>
+             </template>
+           </el-table-column>
+           <el-table-column label="小程序原始ID" align="center" prop="username">
+             <template slot-scope="scope" v-if="scope.row.type == 1">
+               <el-input v-model="scope.row.username" placeholder="请输入原始ID" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="小程序图标" align="center" prop="log">
+             <template slot-scope="scope" v-if="scope.row.type == 1">
+               <el-image v-if="!scope.row.editing && scope.row.log" :src="scope.row.log" :preview-src-list="[scope.row.log]" />
+               <image-upload v-if="scope.row.editing" v-model="scope.row.log" :file-type='["png", "jpg", "jpeg"]' :limit="1"/>
+             </template>
+           </el-table-column>
+           <el-table-column label="AppId" align="center" prop="appid">
+             <template slot-scope="scope">
+               <el-input v-model="scope.row.appid" placeholder="请输入AppId" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="Secret" align="center" prop="secret">
+             <template slot-scope="scope">
+               <el-input v-model="scope.row.secret" placeholder="请输入Secret" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="token" align="center" prop="token">
+             <template slot-scope="scope">
+               <el-input v-model="scope.row.token" placeholder="请输入token" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="aesKey" align="center" prop="aesKey">
+             <template slot-scope="scope">
+               <el-input v-model="scope.row.aesKey" placeholder="请输入aesKey" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="msgDataFormat" align="center" prop="msgDataFormat">
+             <template slot-scope="scope">
+               <el-input v-model="scope.row.msgDataFormat" placeholder="请输入消息格式" :disabled="!scope.row.editing" />
+             </template>
+           </el-table-column>
+           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+             <template slot-scope="scope">
+               <el-button
+                 v-if="!scope.row.editing"
+                 size="mini"
+                 type="text"
+                 icon="el-icon-edit"
+                 @click="handleEdit(scope.$index, scope.row)"
+               >编辑</el-button>
+               <el-button
+                 v-if="scope.row.editing"
+                 size="mini"
+                 type="text"
+                 icon="el-icon-check"
+                 @click="handleSave(scope.$index, scope.row)"
+               >保存</el-button>
+               <el-button
+                 size="mini"
+                 type="text"
+                 icon="el-icon-delete"
+                 @click="deleteCourseMaConfig(scope.$index)"
+               >删除</el-button>
+             </template>
+           </el-table-column>
+         </el-table>
+         <div class="footer">
+
+           <el-button type="primary" @click="submitCourseMaConfig">提 交</el-button>
+         </div>
+       </el-tab-pane>
        <el-tab-pane label="红包商户配置" name="redPacket.config" >
          <el-form ref="form19" :model="form19"  label-width="150px">
            <el-form-item   label="红包接口类型" prop="isNew">
@@ -720,6 +805,8 @@ export default {
   },
   data() {
     return {
+      courseMaConfigLoading:false,
+      courseMaConfigList:[],
       // productTypeOptions:[],
       companyOptions:[],
       uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
@@ -809,6 +896,56 @@ export default {
     this.getConfigByKey(this.activeName);
   },
   methods: {
+    addCourseMaConfig() {
+      this.courseMaConfigList.push({
+        name: "",
+        appid: "",
+        secret: "",
+        token: "",
+        aesKey: "",
+        msgDataFormat: "",
+        editing: true
+      });
+    },
+    handleEdit(index, row) {
+      this.$set(this.courseMaConfigList[index], 'editing', true);
+    },
+    handleSave(index, row) {
+      // 验证必填字段
+      if (!row.name || !row.appid || !row.secret) {
+        this.$message.error('请填写所有必填字段');
+        return;
+      }
+      this.$set(this.courseMaConfigList[index], 'editing', false);
+    },
+    deleteCourseMaConfig(index) {
+      this.$confirm('确认删除该配置?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.courseMaConfigList.splice(index, 1);
+        this.$message.success('删除成功');
+      }).catch(() => {});
+    },
+    submitCourseMaConfig() {
+      // 验证所有必填字段
+      const isValid = this.courseMaConfigList.every(item => {
+        return item.name && item.appid && item.secret;
+      });
+
+      if (!isValid) {
+        this.$message.error('请填写所有必填字段');
+        return;
+      }
+
+      var param = {configId: this.configId, configValue: JSON.stringify(this.courseMaConfigList)};
+      updateConfigByKey(param).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess("修改成功");
+        }
+      });
+    },
     getCompanyOptions() {
         listCompany().then(response=>{
           this.companyOptions = response.rows
@@ -908,7 +1045,20 @@ export default {
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;
              this.form18 =JSON.parse(response.data.configValue);
-           }
+           }else  if(key=="courseMa.config"){
+            this.configId=response.data.configId;
+            this.configKey=response.data.configKey;
+            this.courseMaConfigLoading = true;
+            if(response.data && response.data.configValue) {
+              this.courseMaConfigList = JSON.parse(response.data.configValue).map(item => ({
+                ...item,
+                editing: false
+              }));
+            } else {
+              this.courseMaConfigList = [];
+            }
+            this.courseMaConfigLoading = false;
+          }
           else if(key=="redPacket.config"){
              this.configId=response.data.configId;
              this.configKey=response.data.configKey;