reghao 2 лет назад
Родитель
Сommit
66266ce5e2
2 измененных файлов с 35 добавлено и 1 удалено
  1. 6 0
      src/api/account.js
  2. 29 1
      src/views/my/MyVip.vue

+ 6 - 0
src/api/account.js

@@ -9,6 +9,7 @@ const accountApi = {
   captchaCodeApi: '/api/auth/code/captcha',
   pubkeyApi: '/api/auth/code/pubkey',
 
+  accountVipApi: '/api/account/vip/basic',
   registerApi: '/api/account/user/register',
   resetPasswordApi: '/api/account/user/reset',
   loginApi: '/api/auth/signin',
@@ -63,3 +64,8 @@ export function login(loginData) {
 export function logout() {
   return get(accountApi.logoutApi)
 }
+
+// VIP
+export function vip() {
+  return post(accountApi.accountVipApi)
+}

+ 29 - 1
src/views/my/MyVip.vue

@@ -1,10 +1,28 @@
 <template>
   <el-row>
-    <span>我的小会员</span>
+    <el-col :md="12">
+      <el-card class="box-card">
+        <div slot="header" class="clearfix">
+          <h3>我的小会员</h3>
+        </div>
+        <div class="text item">
+          <el-row>
+            <el-button
+              size="medium"
+              type="success"
+              @click="handleVip"
+            >开通 VIP</el-button>
+          </el-row>
+        </div>
+      </el-card>
+    </el-col>
   </el-row>
 </template>
 
 <script>
+
+import { vip } from '@/api/account'
+
 export default {
   name: 'MyVip',
   data() {
@@ -17,6 +35,16 @@ export default {
   mounted() {
   },
   methods: {
+    handleVip() {
+      vip().then(resp => {
+        if (resp.code === 0) {
+          this.$notify.info({
+            message: 'VIP 已开通',
+            duration: 3000
+          })
+        }
+      })
+    }
   }
 }
 </script>