Ver Fonte

AdminUploadChannel.vue 添加 UploadChannel 初始化接口

reghao há 5 meses atrás
pai
commit
3648602f2b
2 ficheiros alterados com 15 adições e 2 exclusões
  1. 6 1
      src/api/oss.js
  2. 9 1
      src/views/admin/oss/AdminUploadChannel.vue

+ 6 - 1
src/api/oss.js

@@ -11,7 +11,8 @@ const ossApi = {
   resetUserKey: '/api/oss/key/regenerate',
   getChannelList: '/api/oss/channel/list',
   getChannelAttr: '/api/oss/channel/attr',
-  addChannel: '/api/oss/channel/add'
+  addChannel: '/api/oss/channel/add',
+  initChannel: '/api/oss/channel/init'
 }
 
 export function getStoreList() {
@@ -57,3 +58,7 @@ export function getChannelAttr() {
 export function addChannel(payload) {
   return post(ossApi.addChannel, payload)
 }
+
+export function initChannel() {
+  return post(ossApi.initChannel)
+}

+ 9 - 1
src/views/admin/oss/AdminUploadChannel.vue

@@ -12,6 +12,7 @@
           <el-option v-for="(item, index) in tableList" :key="index" :label="item.label" :value="item.value" />
         </el-select>
         <el-button style="margin-left: 5px" type="plain" icon="el-icon-plus" @click="onAddChannel">添加</el-button>
+        <el-button style="margin-left: 5px" type="plain" icon="el-icon-plus" @click="onInitChannel">初始化</el-button>
       </el-row>
     </el-header>
     <el-main>
@@ -142,7 +143,7 @@
 </template>
 
 <script>
-import {addChannel, getChannelAttr, getChannelList, getUserNodeKeyValue} from '@/api/oss'
+import { addChannel, getChannelAttr, getChannelList, getUserNodeKeyValue, initChannel } from '@/api/oss'
 
 export default {
   name: 'AdminUploadChannel',
@@ -263,6 +264,13 @@ export default {
       addChannel(this.myChannelForm).then(resp => {
         this.$message.info(resp.msg)
       })
+    },
+    onInitChannel() {
+      initChannel().then(resp => {
+        this.$message.info(resp.msg)
+      }).catch(error => {
+        this.$message.error(error.message)
+      })
     }
   }
 }