资源包管理功能
This commit is contained in:
parent
b2cec26840
commit
29b90815e9
|
@ -3,6 +3,5 @@ const merge = require('webpack-merge')
|
|||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"',
|
||||
BASE_API: '"http://user.api.it120.cc"',
|
||||
NODE_ENV: '"development"'
|
||||
})
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function fetchDataList(page, pageSize) {
|
||||
return request({
|
||||
url: '/user/centerUserResourceBundle/list',
|
||||
method: 'post',
|
||||
data:{
|
||||
page,
|
||||
pageSize
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function buyResource(key) {
|
||||
return request({
|
||||
url: '/user/centerUserResourceBundle/buy/pc',
|
||||
method: 'get',
|
||||
params: { key }
|
||||
})
|
||||
}
|
||||
|
||||
export function delResource(id) {
|
||||
return request({
|
||||
url: '/user/centerUserResourceBundle/del',
|
||||
method: 'post',
|
||||
data: { id }
|
||||
})
|
||||
}
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.9 KiB |
|
@ -28,6 +28,7 @@ export const constantRouterMap = [
|
|||
{ path: '/404', component: () => import('@/views/404'), hidden: true },
|
||||
|
||||
{
|
||||
name: '首页',
|
||||
path: '',
|
||||
component: Layout,
|
||||
redirect: '/dashboard',
|
||||
|
@ -39,18 +40,22 @@ export const constantRouterMap = [
|
|||
},
|
||||
|
||||
{
|
||||
path: '',
|
||||
name: '工厂设置',
|
||||
path: '/user/centerUserResourceBundle',
|
||||
component: Layout,
|
||||
redirect: '/user/centerUserResourceBundle/list',
|
||||
meta: { title: '工厂设置', icon: 'setting' },
|
||||
children: [{
|
||||
path: 'dashboard2',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
meta: { title: '我的资源包', icon: 'setting' }
|
||||
name: '我的资源包',
|
||||
path: 'list',
|
||||
component: () => import('@/views/centerUserResourceBundle/list'),
|
||||
meta: { title: '我的资源包', icon: 'ziyuan' }
|
||||
},
|
||||
{
|
||||
name: '我的资源包2',
|
||||
path: 'dashboard3',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
meta: { title: '我的资源包', icon: 'setting' }
|
||||
meta: { title: '我的资源包2', icon: 'setting' }
|
||||
}]
|
||||
},
|
||||
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div>
|
||||
<el-tag type="info" style="margin-bottom:20px;">
|
||||
购买视频包:
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('vod_100')">100元视频包</a>
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('vod_500')">500元视频包</a>
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('vod_1000')">1000元视频包</a>
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('vod_2000')">2000元视频包</a>
|
||||
</el-tag>
|
||||
</div>
|
||||
<div>
|
||||
<el-tag type="info" style="margin-bottom:20px;">
|
||||
购买存储包:
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('store_100GB')">100GB存储包</a>
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('store_500GB')">500GB存储包</a>
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('store_1T')">1TB存储包</a>
|
||||
</el-tag>
|
||||
<el-tag type="danger" style="margin-bottom:20px;">
|
||||
<a @click="goBuy('store_2T')">2TB存储包</a>
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row empty-text="暂无数据">
|
||||
<el-table-column prop="keyStr" label="名称"></el-table-column>
|
||||
<el-table-column prop="number" label="资源包数量"></el-table-column>
|
||||
<el-table-column prop="numberLeft" label="剩余数量"></el-table-column>
|
||||
<el-table-column label="支付状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.isPay">已支付</el-tag>
|
||||
<el-tag type="danger" v-if="!scope.row.isPay">未支付</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dateAdd" label="购买时间"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" class='delete' @click="delResource(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="totalRow">
|
||||
</el-pagination>
|
||||
|
||||
|
||||
<el-dialog title="在线支付" :visible.sync="dialogTableVisible">
|
||||
<form :action="alipayPostData.gateway" method="POST" target="_blank">
|
||||
<input type="hidden" v-for="(v, k) in alipayPostData.params" v-bind:key="k" :name="k" :value="v" />
|
||||
<el-button type="success" native-type="submit" round>打开支付宝</el-button>
|
||||
</form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchDataList, buyResource, delResource } from '@/api/centerUserResourceBundle'
|
||||
import { Message, MessageBox } from 'element-ui'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
page:1,
|
||||
pageSize:10,
|
||||
totalRow:0,
|
||||
|
||||
|
||||
list: null,
|
||||
listLoading: true,
|
||||
dialogTableVisible : false,
|
||||
alipayPostData:{}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.fetchData();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page = val;
|
||||
this.fetchData();
|
||||
},
|
||||
fetchData() {
|
||||
this.list = null
|
||||
this.listLoading = true
|
||||
fetchDataList(this.page, this.pageSize).then(response => {
|
||||
if (response.code == 0) {
|
||||
this.list = response.data.result
|
||||
this.totalRow = response.data.totalRow
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
goBuy(key){
|
||||
buyResource(key).then(res => {
|
||||
// 弹框点击确定调整支付宝付款
|
||||
this.alipayPostData = res.data;
|
||||
this.dialogTableVisible = true;
|
||||
})
|
||||
},
|
||||
delResource(id){
|
||||
this.$confirm('删除无法恢复, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delResource(id).then(res => {
|
||||
Message({
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 1 * 1000,
|
||||
onClose: () => {
|
||||
this.fetchData()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<div class="dashboard-container">
|
||||
<div class="dashboard-text">name:{{name}}</div>
|
||||
<div class="dashboard-text">roles:<span v-for='role in roles' :key='role'>{{role}}</span></div>
|
||||
<div class="dashboard-text">登录成功!</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue