reghao 5 tháng trước cách đây
mục cha
commit
29eb129de5

+ 5 - 0
src/api/oss.js

@@ -7,6 +7,7 @@ const ossApi = {
   getUserNodeList: '/api/oss/my/list',
   getUserNodeKeyValue: '/api/oss/my/kv',
   addUserNode: '/api/oss/my/add',
+  updateUserNode: '/api/oss/my/update',
   getUserKeyList: '/api/oss/key/list',
   resetUserKey: '/api/oss/key/regenerate',
   getChannelList: '/api/oss/channel/list',
@@ -39,6 +40,10 @@ export function addUserNode(payload) {
   return postForm(ossApi.addUserNode, payload)
 }
 
+export function updateUserNode(payload) {
+  return postForm(ossApi.updateUserNode, payload)
+}
+
 export function getUserKeyList() {
   return get(ossApi.getUserKeyList)
 }

+ 1 - 1
src/permission.js

@@ -5,7 +5,7 @@ router.beforeEach((to, from, next) => {
   const needAuth = to.meta.needAuth
   const token = getAccessToken()
   if (token != null) {
-    if (to.path === '/login') {
+    if (to.path === '/login' || to.path === '/register') {
       next({ path: '/' })
     } else {
       next()

+ 87 - 8
src/views/admin/oss/AdminUserNode.vue

@@ -23,7 +23,7 @@
         />
         <el-table-column
           prop="userNodeDomain"
-          label="节点域名"
+          label="绑定域名"
         />
         <el-table-column
           prop="referer"
@@ -41,7 +41,7 @@
           <template slot-scope="scope">
             <el-button
               size="mini"
-              @click="handleEdit(scope.$index, scope.row)"
+              @click="onEditNode(scope.$index, scope.row)"
             >编辑</el-button>
             <el-button
               size="mini"
@@ -101,7 +101,7 @@
     </el-dialog>
     <el-dialog
       append-to-body
-      :visible.sync="showNodeDialog"
+      :visible.sync="showAddNodeDialog"
       center
     >
       <div>
@@ -152,11 +152,59 @@
         </el-form>
       </div>
     </el-dialog>
+    <el-dialog
+      append-to-body
+      :visible.sync="showEditNodeDialog"
+      center
+    >
+      <div>
+        <el-form ref="editNodeForm" :model="editNodeForm">
+          <el-form-item label="域名" label-width="120px" prop="domain">
+            <el-input
+              v-model="editNodeForm.domain"
+              placeholder="绑定域名"
+              style="margin-left: 5px;width: 220px"
+            />
+          </el-form-item>
+          <el-form-item label="Referer" label-width="120px" prop="domain">
+            <el-input
+              v-model="editNodeForm.referer"
+              placeholder="referer"
+              style="margin-left: 5px;width: 220px"
+            />
+          </el-form-item>
+          <el-form-item label="SecretKey" label-width="120px" prop="domain">
+            <el-input
+              v-model="editNodeForm.secretKey"
+              placeholder="secretKey"
+              style="margin-left: 5px;width: 220px"
+            />
+          </el-form-item>
+          <el-button
+            type="primary"
+            plain
+            size="small"
+            icon="el-icon-plus"
+            style="margin-left: 40px"
+            @click="updateUserNodeWrapper"
+          >
+            更新
+          </el-button>
+        </el-form>
+      </div>
+    </el-dialog>
   </el-container>
 </template>
 
 <script>
-import { addUserNode, getStoreNodeKeyValue, getUserKeyList, getUserNodeList, resetUserKey } from '@/api/oss'
+import {
+  addUserNode,
+  getStoreNodeKeyValue,
+  getUserKeyList,
+  getUserNodeList,
+  resetUserKey,
+  updateUserNode
+} from '@/api/oss'
 
 export default {
   name: 'AdminUserNode',
@@ -179,11 +227,18 @@ export default {
         videoId: null,
         scope: 1
       },
-      showNodeDialog: false,
+      showAddNodeDialog: false,
       selectOptionList: [],
       myNodeForm: {
         storeNodeId: null,
         domain: null
+      },
+      showEditNodeDialog: false,
+      editNodeForm: {
+        userNodeId: null,
+        domain: null,
+        referer: null,
+        secretKey: null
       }
     }
   },
@@ -200,6 +255,9 @@ export default {
         } else {
           this.$message.error(resp.msg)
         }
+      }).catch(error => {
+        console.log(error)
+        this.$message.error(error.message)
       })
     },
     onRefresh() {
@@ -215,7 +273,7 @@ export default {
       this.$message.info('handleEdit')
     },
     handleDelete(index, row) {
-      this.$confirm('确定要删除 ' + row.title + '?', '提示', {
+      this.$confirm('确定要删除 ' + row.userNodeDomain + '?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
@@ -259,7 +317,7 @@ export default {
       getStoreNodeKeyValue().then(resp => {
         if (resp.code === 0) {
           this.selectOptionList = resp.data
-          this.showNodeDialog = true
+          this.showAddNodeDialog = true
           this.myNodeForm.storeNodeId = this.selectOptionList[0].value
         } else {
           this.$message.error(resp.msg)
@@ -269,7 +327,7 @@ export default {
       })
     },
     addUserNodeWrapper() {
-      this.showNodeDialog = false
+      this.showAddNodeDialog = false
       addUserNode(this.myNodeForm).then(resp => {
         console.log(resp)
         this.$message.info(resp.msg)
@@ -278,6 +336,27 @@ export default {
       }).finally(() => {
         this.$refs['myNodeForm'].resetFields()
       })
+    },
+    onEditNode(index, row) {
+      this.editNodeForm.userNodeId = row.userNodeId
+      this.editNodeForm.domain = row.userNodeDomain
+      this.editNodeForm.referer = row.referer
+      this.editNodeForm.secretKey = row.secretKey
+      this.showEditNodeDialog = true
+    },
+    updateUserNodeWrapper() {
+      this.showEditNodeDialog = false
+      updateUserNode(this.editNodeForm).then(resp => {
+        if (resp.code === 0) {
+          this.getData()
+        } else {
+          this.$message.error(resp.msg)
+        }
+      }).catch(error => {
+        this.$message.error(error.message)
+      }).finally(() => {
+        this.$refs['editNodeForm'].resetFields()
+      })
     }
   }
 }

+ 1 - 4
src/views/admin/site/AdminRegistry.vue

@@ -69,10 +69,7 @@
 
 <script>
 import { userMixin } from 'assets/js/mixin'
-import {
-  getAccountRegistry,
-  getChargeReq, getVipPlan, setAccountCode, setAccountRegistry
-} from '@/api/admin'
+import { getAccountRegistry, getVipPlan, setAccountCode, setAccountRegistry } from '@/api/admin'
 
 export default {
   name: 'AdminRegistry',

+ 1 - 1
src/views/post/VideoPost.vue

@@ -395,7 +395,7 @@ export default {
             type: 'warning',
             duration: 3000
           })
-          this.$router.push('/background/post/video')
+          this.getData()
         } else {
           this.$notify({
             title: '提示',

+ 5 - 6
src/views/post/VideoPostPublish.vue

@@ -283,13 +283,12 @@ export default {
         addVideoFile(videoFileForm).then(resp => {
           if (resp.code === 0) {
             this.videoPostForm.videoId = resp.data
-            this.$notify({
-              title: '提示',
-              message: '视频已上传',
-              type: 'warning',
-              duration: 3000
-            })
+            this.$message.info('视频已上传')
+          } else {
+            this.$message.error('创建视频稿件失败')
           }
+        }).catch(error => {
+          this.$message.info(error.message)
         })
       } else {
         this.$notify({