reghao 1 year ago
parent
commit
c93ef5dec6
5 changed files with 106 additions and 8 deletions
  1. 6 4
      src/api/account.js
  2. 90 1
      src/views/my/MyOAuth.vue
  3. 1 1
      src/views/my/MyProfile.vue
  4. 4 2
      src/views/my/MyRealname.vue
  5. 5 0
      src/views/my/MyVip.vue

+ 6 - 4
src/api/account.js

@@ -4,21 +4,19 @@ const accountApi = {
   checkUsernameApi: '/api/user/account/check/username',
   selectUsernameApi: '/api/user/account/select/username',
   checkEmailApi: '/api/user/account/check/email',
-
   verifyCodeApi: '/api/auth/code/verify',
   captchaCodeApi: '/api/auth/code/captcha',
   pubkeyApi: '/api/auth/code/pubkey',
-
   registerApi: '/api/auth/create',
   forgotApi: '/api/auth/forgot',
   loginApi: '/api/auth/signin',
   logoutApi: '/api/auth/signout',
   resetPasswordApi: '/api/account/user/reset',
   updateAvatarApi: '/api/account/profile/avatar',
-
   accountMyVipApi: '/api/user/vip/my',
   accountVipPlanApi: '/api/user/vip/plan',
-  accountVipApi: '/api/user/vip/buy'
+  accountVipApi: '/api/user/vip/buy',
+  oauthAppApi: '/api/account/oauth/create'
 }
 
 export function isUsernameExist(username) {
@@ -86,3 +84,7 @@ export function getVipPlans() {
 export function vip(data) {
   return post(accountApi.accountVipApi, data)
 }
+
+export function createApp(data) {
+  return post(accountApi.oauthAppApi, data)
+}

+ 90 - 1
src/views/my/MyOAuth.vue

@@ -1,18 +1,107 @@
 <template>
-  <span>oauth</span>
+  <el-main>
+    <el-row class="movie-list">
+      <el-col :md="20" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
+        <el-card class="box-card">
+          <div slot="header" class="clearfix">
+            <span>我的应用</span>
+            <el-button style="float: right; padding: 3px 0" type="text" @click="addAppDialog">添加</el-button>
+          </div>
+          <el-table
+            :data="dataList"
+            style="width: 100%"
+          >
+            <el-table-column
+              prop="createAt"
+              label="时间"
+            />
+            <el-table-column
+              prop="type"
+              label="类型"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="quantity"
+              label="金额"
+            >
+            </el-table-column>
+            <el-table-column label="操作">
+              <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  @click="handleDetail(scope.$index, scope.row)"
+                >详情</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-card>
+      </el-col>
+    </el-row>
+
+    <el-dialog
+      title="OAuth 应用"
+      append-to-body
+      :visible.sync="oauthDialog"
+      width="30%"
+      center
+    >
+      <el-form ref="form" :model="appForm">
+        <el-form-item label="应用名">
+          <el-input v-model="appForm.name" style="margin-left: 5px" />
+        </el-form-item>
+        <el-form-item label="主页 URL">
+          <el-input v-model="appForm.homeUrl" style="margin-left: 5px" />
+        </el-form-item>
+        <el-form-item label="应用描述">
+          <el-input v-model="appForm.description" style="margin-left: 5px" />
+        </el-form-item>
+        <el-form-item label="回调 URL">
+          <el-input v-model="appForm.callbackUrl" style="margin-left: 5px" />
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            type="primary"
+            @click="addApp"
+          >确定</el-button>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+  </el-main>
 </template>
 
 <script>
+import {createApp} from "@/api/account";
+
 export default {
   name: 'MyOAuth',
   data() {
     return {
+      dataList: [],
+      oauthDialog: false,
+      appForm: {
+        name: ''
+      }
     }
   },
   created() {
     document.title = 'OAuth'
   },
   methods: {
+    addAppDialog() {
+      this.oauthDialog = true
+    },
+    addApp() {
+      createApp(this.appForm).then(resp => {
+        if (resp.code !== 0) {
+          this.$notify.warning({
+            message: resp.msg,
+            type: 'warning',
+            duration: 3000
+          })
+        }
+      })
+      this.oauthDialog = false
+    }
   }
 }
 </script>

+ 1 - 1
src/views/my/MyProfile.vue

@@ -79,7 +79,7 @@ export default {
         Authorization: ''
       },
       imgData: {
-        channelId: null
+        channelId: 0
       },
       coverUrl: null,
       // ****************************************************************************************************************

+ 4 - 2
src/views/my/MyRealname.vue

@@ -114,6 +114,7 @@
 import { getServerInfo } from '@/api/content'
 import { updateAvatar } from '@/api/account'
 import { getAuthedUser, updateAuthedUser } from '@/utils/auth'
+import {getAvatarChannelInfo} from "@/api/file";
 
 export default {
   name: 'MyRealname',
@@ -124,7 +125,7 @@ export default {
         Authorization: ''
       },
       imgData: {
-        channelId: process.env.VUE_APP_UPLOAD_AVATAR_CHANNEL
+        channelId: 0
       },
       coverUrl: null,
       // ****************************************************************************************************************
@@ -135,9 +136,10 @@ export default {
     document.title = '我的实名认证'
     this.loginUser = getAuthedUser()
 
-    getServerInfo(this.imgData.channelId).then(res => {
+    getAvatarChannelInfo().then(res => {
       if (res.code === 0) {
         const resData = res.data
+        this.imgData.channelId = resData.channelId
         this.imgOssUrl = resData.ossUrl
         this.imgHeaders.Authorization = 'Bearer ' + resData.token
       } else {

+ 5 - 0
src/views/my/MyVip.vue

@@ -112,6 +112,11 @@ export default {
             message: '小会员已开通',
             duration: 3000
           })
+        } else {
+          this.$notify.error({
+            message: resp.msg,
+            duration: 3000
+          })
         }
       })
     }