Added account management
This commit is contained in:
parent
dcd90e2c6b
commit
ef1e820c01
|
@ -0,0 +1,114 @@
|
||||||
|
import Mock from 'mockjs'
|
||||||
|
|
||||||
|
const List = []
|
||||||
|
const count = 100
|
||||||
|
|
||||||
|
const baseContent = '<p>I am testing data, I am testing data.</p><p><img src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>'
|
||||||
|
const image_uri = 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3'
|
||||||
|
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
List.push(Mock.mock({
|
||||||
|
id: '@increment',
|
||||||
|
timestamp: +Mock.Random.date('T'),
|
||||||
|
author: '@first',
|
||||||
|
reviewer: '@first',
|
||||||
|
title: '@title(5, 10)',
|
||||||
|
content_short: 'mock data',
|
||||||
|
content: baseContent,
|
||||||
|
forecast: '@float(0, 100, 2, 2)',
|
||||||
|
importance: '@integer(1, 3)',
|
||||||
|
'type|1': ['CN', 'US', 'JP', 'EU'],
|
||||||
|
'status|1': ['published', 'draft', 'deleted'],
|
||||||
|
display_time: '@datetime',
|
||||||
|
comment_disabled: true,
|
||||||
|
pageviews: '@integer(300, 5000)',
|
||||||
|
image_uri,
|
||||||
|
platforms: ['a-platform']
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
url: '/account/list',
|
||||||
|
type: 'get',
|
||||||
|
response: config => {
|
||||||
|
const { type, page = 1, limit = 20, sort } = config.query
|
||||||
|
|
||||||
|
let mockList = List.filter(item => {
|
||||||
|
if (type && item.type !== type) return false
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
if (sort === '-id') {
|
||||||
|
mockList = mockList.reverse()
|
||||||
|
}
|
||||||
|
|
||||||
|
const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: 20000,
|
||||||
|
data: {
|
||||||
|
total: mockList.length,
|
||||||
|
items: pageList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
url: '/article/detail',
|
||||||
|
type: 'get',
|
||||||
|
response: config => {
|
||||||
|
const { id } = config.query
|
||||||
|
for (const article of List) {
|
||||||
|
if (article.id === +id) {
|
||||||
|
return {
|
||||||
|
code: 20000,
|
||||||
|
data: article
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
url: '/article/pv',
|
||||||
|
type: 'get',
|
||||||
|
response: _ => {
|
||||||
|
return {
|
||||||
|
code: 20000,
|
||||||
|
data: {
|
||||||
|
pvData: [
|
||||||
|
{ key: 'PC', pv: 1024 },
|
||||||
|
{ key: 'mobile', pv: 1024 },
|
||||||
|
{ key: 'ios', pv: 1024 },
|
||||||
|
{ key: 'android', pv: 1024 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
url: '/article/create',
|
||||||
|
type: 'post',
|
||||||
|
response: _ => {
|
||||||
|
return {
|
||||||
|
code: 20000,
|
||||||
|
data: 'success'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
url: '/article/update',
|
||||||
|
type: 'post',
|
||||||
|
response: _ => {
|
||||||
|
return {
|
||||||
|
code: 20000,
|
||||||
|
data: 'success'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
|
@ -5,8 +5,10 @@ import user from './user'
|
||||||
import role from './role'
|
import role from './role'
|
||||||
import article from './article'
|
import article from './article'
|
||||||
import search from './remote-search'
|
import search from './remote-search'
|
||||||
|
import account from './account'
|
||||||
|
|
||||||
const mocks = [
|
const mocks = [
|
||||||
|
...account,
|
||||||
...user,
|
...user,
|
||||||
...role,
|
...role,
|
||||||
...article,
|
...article,
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
export function fetchList(query) {
|
||||||
|
return axios.get('https://users.service.development.therig.onlinefuelslabs.io/account/search', { params: query })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchAccount(id) {
|
||||||
|
return axios.get(`https://users.service.development.therig.onlinefuelslabs.io/account/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createAccount(data) {
|
||||||
|
const dto = {
|
||||||
|
'name': data.name,
|
||||||
|
'type': data.type,
|
||||||
|
'email': data.email,
|
||||||
|
'platform': data.platform || 'OLFDE',
|
||||||
|
'phone': data.phone,
|
||||||
|
'status': parseInt(data.status),
|
||||||
|
'orderConfirmationEmail': data.orderConfirmationEmail,
|
||||||
|
'addressLine1': data.address.addressLine1,
|
||||||
|
'addressLine2': data.address.addressLine2,
|
||||||
|
'county': data.address.county,
|
||||||
|
'country': data.address.country,
|
||||||
|
'postCode': data.address.postCode
|
||||||
|
}
|
||||||
|
|
||||||
|
return axios.post(`https://users.service.development.therig.onlinefuelslabs.io/account/create`, dto)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateAccount(data) {
|
||||||
|
const dto = {
|
||||||
|
'name': data.name,
|
||||||
|
'type': data.type,
|
||||||
|
'email': data.email,
|
||||||
|
'platform': data.platform,
|
||||||
|
'phone': data.phone,
|
||||||
|
'status': parseInt(data.status),
|
||||||
|
'orderConfirmationEmail': data.orderConfirmationEmail,
|
||||||
|
'addressLine1': data.address.addressLine1,
|
||||||
|
'addressLine2': data.address.addressLine2,
|
||||||
|
'county': data.address.county,
|
||||||
|
'country': data.address.country,
|
||||||
|
'postCode': data.address.postCode
|
||||||
|
}
|
||||||
|
|
||||||
|
return axios.put(`https://users.service.development.therig.onlinefuelslabs.io/account/${data.id}`, dto)
|
||||||
|
}
|
|
@ -8,9 +8,7 @@ import Layout from '@/layout'
|
||||||
|
|
||||||
/* Router Modules */
|
/* Router Modules */
|
||||||
import componentsRouter from './modules/components'
|
import componentsRouter from './modules/components'
|
||||||
import chartsRouter from './modules/charts'
|
|
||||||
import tableRouter from './modules/table'
|
import tableRouter from './modules/table'
|
||||||
import nestedRouter from './modules/nested'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: sub-menu only appear when route children.length >= 1
|
* Note: sub-menu only appear when route children.length >= 1
|
||||||
|
@ -146,38 +144,42 @@ export const asyncRoutes = [
|
||||||
|
|
||||||
/** when your routing map is too long, you can split it into small modules **/
|
/** when your routing map is too long, you can split it into small modules **/
|
||||||
componentsRouter,
|
componentsRouter,
|
||||||
chartsRouter,
|
|
||||||
nestedRouter,
|
|
||||||
tableRouter,
|
tableRouter,
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/example',
|
path: '/accounts',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/example/list',
|
redirect: '/accounts/list',
|
||||||
name: 'Example',
|
name: 'Accounts',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Example',
|
title: 'Accounts',
|
||||||
icon: 'example'
|
icon: 'example'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'create',
|
path: 'create',
|
||||||
component: () => import('@/views/example/create'),
|
component: () => import('@/views/accounts/create'),
|
||||||
name: 'CreateArticle',
|
name: 'CreateAccount',
|
||||||
meta: { title: 'Create Article', icon: 'edit' }
|
meta: { title: 'Create Account', icon: 'edit' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'edit/:id(\\d+)',
|
path: 'edit/:id',
|
||||||
component: () => import('@/views/example/edit'),
|
component: () => import('@/views/accounts/edit'),
|
||||||
name: 'EditArticle',
|
name: 'EditAccount',
|
||||||
meta: { title: 'Edit Article', noCache: true, activeMenu: '/example/list' },
|
meta: { title: 'Edit Account', noCache: true, activeMenu: '/accounts/list' },
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'list',
|
path: 'buyer-list',
|
||||||
component: () => import('@/views/example/list'),
|
component: () => import('@/views/accounts/list'),
|
||||||
name: 'ArticleList',
|
name: 'BuyerAccountList',
|
||||||
meta: { title: 'Article List', icon: 'list' }
|
meta: { title: 'Buyer Account List', icon: 'list', type: 'buyer' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'seller-list',
|
||||||
|
component: () => import('@/views/accounts/list'),
|
||||||
|
name: 'SellerAccountList',
|
||||||
|
meta: { title: 'Seller Account List', icon: 'list', type: 'seller' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
<template>
|
||||||
|
<div class="createAccount-container">
|
||||||
|
<el-form ref="postForm" :model="postForm" :rules="rules" class="form-container">
|
||||||
|
|
||||||
|
<sticky :z-index="10" :class-name="'sub-navbar '+postForm.status">
|
||||||
|
<el-button v-loading="loading" style="margin-left: 10px;" type="success" @click="submitForm">
|
||||||
|
Save
|
||||||
|
</el-button>
|
||||||
|
</sticky>
|
||||||
|
|
||||||
|
<div class="createPost-main-container">
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="20">
|
||||||
|
<div class="postInfo-container">
|
||||||
|
<el-row v-if="isEdit">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Id" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.id" placeholder="Id" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Name" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.name" placeholder="Account Name" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Email" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.email" placeholder="Account Email" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Phone" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.phone" placeholder="Account Phone" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Address Line 1" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.address.addressLine1" placeholder="Address Line 1" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Address Line 2" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.address.addressLine2" placeholder="Address Line 2" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="County" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.address.county" placeholder="County" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Post Code" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.address.postCode" placeholder="Post Code" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Country" class="postInfo-container-item">
|
||||||
|
<el-input v-model="postForm.address.country" placeholder="Country" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Type" class="postInfo-container-item">
|
||||||
|
<el-radio-group v-model="postForm.type">
|
||||||
|
<el-radio-button label="buyer">Buyer</el-radio-button>
|
||||||
|
<el-radio-button label="seller">Seller</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="120px" label="Status" class="postInfo-container-item">
|
||||||
|
<el-radio-group v-model="postForm.status">
|
||||||
|
<el-radio-button label="100">Enabled</el-radio-button>
|
||||||
|
<el-radio-button label="200">Disabled</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Sticky from '@/components/Sticky' // 粘性header组件
|
||||||
|
import { fetchAccount, updateAccount, createAccount } from '@/api/account'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
orderConfirmationEmail: '',
|
||||||
|
address: {
|
||||||
|
addressLine1: '',
|
||||||
|
addressLine2: '',
|
||||||
|
county: '',
|
||||||
|
postCode: '',
|
||||||
|
country: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AccountDetail',
|
||||||
|
components: { Sticky },
|
||||||
|
props: {
|
||||||
|
isEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
const validateRequire = (rule, value, callback) => {
|
||||||
|
if (value === '') {
|
||||||
|
this.$message({
|
||||||
|
message: rule.field + 'Epic Success brudda',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
callback(new Error(rule.field + ' ERRRR'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
postForm: Object.assign({}, defaultForm),
|
||||||
|
loading: false,
|
||||||
|
userListOptions: [],
|
||||||
|
rules: {
|
||||||
|
// image_uri: [{ validator: validateRequire }],
|
||||||
|
name: [{ validator: validateRequire }]
|
||||||
|
// content: [{ validator: validateRequire }],
|
||||||
|
// source_uri: [{ validator: validateSourceUri, trigger: 'blur' }]
|
||||||
|
},
|
||||||
|
tempRoute: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
displayTime: {
|
||||||
|
// set and get is useful when the data
|
||||||
|
// returned by the back end api is different from the front end
|
||||||
|
// back end return => "2013-06-25 06:59:25"
|
||||||
|
// front end need timestamp => 1372114765000
|
||||||
|
get() {
|
||||||
|
return (+new Date(this.postForm.display_time))
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.postForm.display_time = new Date(val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (this.isEdit) {
|
||||||
|
const id = this.$route.params && this.$route.params.id
|
||||||
|
this.fetchData(id)
|
||||||
|
} else {
|
||||||
|
this.postForm = Object.assign({}, defaultForm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Why need to make a copy of this.$route here?
|
||||||
|
// Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page
|
||||||
|
// https://github.com/PanJiaChen/vue-element-admin/issues/1221
|
||||||
|
this.tempRoute = Object.assign({}, this.$route)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchData(id) {
|
||||||
|
fetchAccount(id).then(response => {
|
||||||
|
this.postForm = response.data
|
||||||
|
|
||||||
|
// // set tagsview title
|
||||||
|
this.setTagsViewTitle()
|
||||||
|
|
||||||
|
// // set page title
|
||||||
|
this.setPageTitle()
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
setTagsViewTitle() {
|
||||||
|
const title = 'Edit Account'
|
||||||
|
const route = Object.assign({}, this.tempRoute, { title: `${title} - ${this.postForm.name}` })
|
||||||
|
this.$store.dispatch('tagsView/updateVisitedView', route)
|
||||||
|
},
|
||||||
|
setPageTitle() {
|
||||||
|
const title = 'Edit Account'
|
||||||
|
document.title = `${title} - ${this.postForm.id}`
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs.postForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.loading = true
|
||||||
|
|
||||||
|
// Save the account
|
||||||
|
const methodToCall = this.isEdit ? updateAccount : createAccount
|
||||||
|
methodToCall(this.postForm).then((r) => {
|
||||||
|
this.$notify({
|
||||||
|
title: 'Success',
|
||||||
|
message: 'Account Saved',
|
||||||
|
type: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
|
||||||
|
// Redirect to the edit page when we create a new one
|
||||||
|
if (!this.isEdit) { this.$router.push(`/accounts/edit/${r.data.id}`) }
|
||||||
|
|
||||||
|
this.loading = false
|
||||||
|
}).catch((e) => {
|
||||||
|
console.dir(e)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('error submit!!')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "~@/styles/mixin.scss";
|
||||||
|
|
||||||
|
.createPost-container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.createPost-main-container {
|
||||||
|
padding: 40px 45px 20px 50px;
|
||||||
|
|
||||||
|
.postInfo-container {
|
||||||
|
position: relative;
|
||||||
|
@include clearfix;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.postInfo-container-item {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.word-counter {
|
||||||
|
width: 40px;
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-textarea /deep/ {
|
||||||
|
textarea {
|
||||||
|
padding-right: 40px;
|
||||||
|
resize: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0px;
|
||||||
|
border-bottom: 1px solid #bfcbd9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<template>
|
||||||
|
<account-detail :is-edit="false" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AccountDetail from './components/AccountDetail'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CreateForm',
|
||||||
|
components: { AccountDetail }
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<template>
|
||||||
|
<account-detail :is-edit="true" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AccountDetail from './components/AccountDetail'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'EditForm',
|
||||||
|
components: { AccountDetail }
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
|
||||||
|
<el-table-column align="center" label="Name" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.name }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="Email" width="250">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.email }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="Order Confirmation Email" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.orderConfirmationEmail }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="Phone" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.phone }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="Actions" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<router-link :to="'/accounts/edit/' + scope.row.id">
|
||||||
|
<el-button type="primary" size="small" icon="el-icon-edit">
|
||||||
|
Edit
|
||||||
|
</el-button>
|
||||||
|
</router-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { fetchList } from '@/api/account'
|
||||||
|
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ArticleList',
|
||||||
|
components: { Pagination },
|
||||||
|
filters: {
|
||||||
|
statusFilter(status) {
|
||||||
|
const statusMap = {
|
||||||
|
published: 'success',
|
||||||
|
draft: 'info',
|
||||||
|
deleted: 'danger'
|
||||||
|
}
|
||||||
|
return statusMap[status]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: null,
|
||||||
|
total: 0,
|
||||||
|
listLoading: true,
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// Set the type for the query
|
||||||
|
this.listQuery.type = this.$route.meta.type
|
||||||
|
this.listQuery.platform = 'OLFDE'
|
||||||
|
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true
|
||||||
|
fetchList(this.listQuery).then(response => {
|
||||||
|
this.list = response.data.docs
|
||||||
|
this.total = response.data.total
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.edit-input {
|
||||||
|
padding-right: 100px;
|
||||||
|
}
|
||||||
|
.cancel-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 15px;
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,49 +1,33 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
|
<el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
|
||||||
<el-table-column align="center" label="ID" width="80">
|
<el-table-column align="center" label="Name" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.id }}</span>
|
<span>{{ scope.row.name }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="180px" align="center" label="Date">
|
<el-table-column align="center" label="Email" width="250">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
<span>{{ scope.row.email }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="120px" align="center" label="Author">
|
<el-table-column align="center" label="Order Confirmation Email" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.author }}</span>
|
<span>{{ scope.row.orderConfirmationEmail }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="100px" label="Importance">
|
<el-table-column align="center" label="Phone" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon v-for="n in +scope.row.importance" :key="n" icon-class="star" class="meta-item__icon" />
|
<span>{{ scope.row.phone }}</span>
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column class-name="status-col" label="Status" width="110">
|
|
||||||
<template slot-scope="{row}">
|
|
||||||
<el-tag :type="row.status | statusFilter">
|
|
||||||
{{ row.status }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column min-width="300px" label="Title">
|
|
||||||
<template slot-scope="{row}">
|
|
||||||
<router-link :to="'/example/edit/'+row.id" class="link-type">
|
|
||||||
<span>{{ row.title }}</span>
|
|
||||||
</router-link>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="Actions" width="120">
|
<el-table-column align="center" label="Actions" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<router-link :to="'/example/edit/'+scope.row.id">
|
<router-link :to="'/accounts/edit/' + scope.row.id">
|
||||||
<el-button type="primary" size="small" icon="el-icon-edit">
|
<el-button type="primary" size="small" icon="el-icon-edit">
|
||||||
Edit
|
Edit
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -57,7 +41,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fetchList } from '@/api/article'
|
import { fetchList } from '@/api/account'
|
||||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -85,13 +69,17 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
// Set the type for the query
|
||||||
|
this.listQuery.type = this.$route.meta.type
|
||||||
|
this.listQuery.platform = 'OLFDE'
|
||||||
|
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
fetchList(this.listQuery).then(response => {
|
fetchList(this.listQuery).then(response => {
|
||||||
this.list = response.data.items
|
this.list = response.data.docs
|
||||||
this.total = response.data.total
|
this.total = response.data.total
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue