Commit deabd65c authored by yaobeibei's avatar yaobeibei

add

parent 087612eb
### Health check 'curl /ping'
FROM hub.c.163.com/library/node:latest
WORKDIR /app
ADD ./package.json /app/
#front end
ADD ./dist /app/dist
#server
ADD ./server.js /app/
#api
ADD ./api /app/api
RUN \
rm /etc/localtime && \
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN npm i --only=production --registry https://registry.npm.taobao.org
ENV SERVICE_PORT=8082
ENV PROJECT_LEVEL=production
ENV MONGO='mongodb://mongo-adpro-ssp-v2-rs-1.localhost:1301/remarketing?replicaSet=adpro_ssp_v2_rs'
ENV NODE_ENV='production'
EXPOSE 8082
CMD node server.js
This diff is collapsed.
......@@ -37,6 +37,6 @@ app.get('/file/:fileName', function(req, res, next) {
}
});
server.listen(8080, function() {
server.listen(8082, function() {
console.log('server started');
});
<template>
<el-container>
<el-header>
<h4>账户权限控制</h4>
</el-header>
<el-main>
<el-table :data='datas' border width=100%>
<el-table-column label='序号' width=50>
<template slot-scope='scope'>
{{scope.$index + (currentPage - 1) * pageSize + 1}}
</template>
</el-table-column>
<el-table-column label='ID' prop='_id'></el-table-column>
<el-table-column label='公司名称' prop='company'></el-table-column>
<el-table-column label='账户名称' prop='email'></el-table-column>
<el-table-column label='电话' prop='phone'></el-table-column>
<el-table-column label='自动备案'>
<template slot-scope='scope'>
<el-switch
style="display: block"
v-model="scope.row.isCloseAuto"
active-color="#ff4949"
inactive-color="#13ce66"
active-text="关闭"
@change='AutoChange(scope.row)'
inactive-text="开启">
</el-switch>
</template>
</el-table-column>
<el-table-column label='账户操作'>
<template slot-scope='scope'>
<el-switch
style="display: block"
v-model="scope.row.isAccountDelete"
active-color="#ff4949"
inactive-color="#13ce66"
active-text="注销"
@change='accountChange(scope.row)'
inactive-text="启用">
</el-switch>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="float: right;margin-top: 15px">
</el-pagination>
</el-main>
</el-container>
</template>
<script>
export default {
name: 'account',
data () {
return {
datas: null,
isCloseAuto: false,
isAccountDelete: false,
currentPage: 1,
pageSize: 10,
total: 100
}
},
mounted () {
this.getData(this.currentPage, this.pageSize)
},
methods: {
AutoChange (row) {
console.log(row.isCloseAuto)
console.log(row)
if (row.isCloseAuto) {
this.closeAuto(row, 0)
} else {
this.closeAuto(row, 1)
}
},
accountChange (row) {
console.log(row.isAccountDelete)
console.log(row)
if (row.isAccountDelete) {
this.deleteAccount(row, 0)
} else {
this.deleteAccount(row, 1)
}
},
getData (currentPage, pageSize) {
let self = this
fetch('/api/getAccount', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({currentPage: currentPage, pageSize: pageSize})
}).then(res => { return res.json() }).then(data => {
console.log(data)
self.datas = data.data
self.total = data.dataTotal
})
},
handleSizeChange (val) {
this.pageSize = val
this.getData(this.currentPage, this.pageSize)
},
handleCurrentChange (val) {
this.currentPage = val
this.getData(this.currentPage, this.pageSize)
},
deleteAccount (row, status) {
let accountId = row._id
fetch('/api/deleteAccount', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({accountId: accountId, status: status})
}).then(res => { return res.json() }).then(data => {
console.log(data)
if (status === 0) {
this.$message({
message: data.data,
type: 'error'
})
}
if (status === 1) {
this.$message({
message: data.data,
type: 'success'
})
}
})
},
closeAuto (row, status) {
let accountId = row._id
fetch('/api/closeBtn', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({accountId: accountId, status: status})
}).then(res => { return res.json() }).then(data => {
console.log(data)
if (status === 0) {
this.$message({
message: data.data,
type: 'error'
})
}
if (status === 1) {
this.$message({
message: data.data,
type: 'success'
})
}
})
}
}
}
</script>
<style scoped>
</style>
This diff is collapsed.
<template>
<el-container>
<el-header>消费记录</el-header>
<el-header><h2>消费记录</h2></el-header>
<el-main>
<TableTmp :header="dataHeader" ref='TableTmp' consume='ok' :url='url'></TableTmp>
</el-main>
......
......@@ -2,7 +2,7 @@
<el-container>
<el-header><h2>数据统计</h2></el-header>
<el-main>
<TableTmp :header="dataHeader" ref='TableTmp' :url='url'>
<TableTmp :header="dataHeader" ref='TableTmp' :url='url' :datalist='datalist'>
</TableTmp>
</el-main>
</el-container>
......@@ -26,7 +26,8 @@
getCount: '备案用户',
msgCount: '短信营销',
callCount: '云呼营销'
}
},
datalist: 'ok'
}
},
mounted () {
......
<template>
<el-container>
<el-header>充值记录</el-header>
<el-header><h2>充值记录</h2></el-header>
<el-main>
<TableTmp :header="dataHeader" ref='TableTmp' :url='url' finance='ok'>
......@@ -25,7 +25,7 @@
dataHeader: {
time: '日期',
email: '邮箱',
company: '渠道',
company: '公司',
number: '金额'
}
}
......
......@@ -36,20 +36,48 @@
</el-menu-item>
<el-menu-item index="/consume" @click="routeTo">消费记录
</el-menu-item>
<el-menu-item index="/surplus" @click="routeTo">余额记录
</el-menu-item>
</el-menu-item-group>
</el-submenu>
<!--<el-submenu index="3">-->
<!--<template slot="title">-->
<!--<i class="el-icon-tickets"></i>-->
<!--<span>分销管理</span>-->
<!--</template>-->
<!--<el-menu-item-group>-->
<!--<el-menu-item index="/check" @click="routeTo">审核管理-->
<!--</el-menu-item>-->
<!--</el-menu-item-group>-->
<!--</el-submenu>-->
<a class="btn-toggle" @click="toggle"><i
<el-submenu index=3>
<template slot='title'>
<i class='el-icon-info'></i>
<span>公告信息</span>
</template>
<el-menu-item index='/releaseInfo' @click="routeTo">
发布信息
</el-menu-item>
<el-menu-item index='/info' @click="routeTo">
过往信息
</el-menu-item>
</el-submenu>
<el-submenu index=4>
<template slot='title'>
<i class='el-icon-success'></i>
<span>业务审核</span>
</template>
<el-menu-item index='/checkCall' @click="routeTo">
云呼审核
</el-menu-item>
</el-submenu>
<el-submenu index=5>
<template slot='title'>
<i class='el-icon-setting'></i>
<span>权限控制</span>
</template>
<el-menu-item index='/account' @click="routeTo">
账户控制
</el-menu-item>
<el-menu-item index='/slot' @click="routeTo">
代码位控制
</el-menu-item>
</el-submenu>
<a class="btn-toggle" @click="toggle"><i
:class="[isCollapse? 'el-icon-d-arrow-right' : 'el-icon-d-arrow-left']"></i></a>
</el-menu>
</el-aside>
......
<template>
<el-container>
<el-header>
公告历史
</el-header>
<div style='margin: 10px 50px'>
<el-table
:data='datas'
border>
<el-table-column label='发布时间' prop='time' width=260></el-table-column>
<el-table-column label='标题' prop='title' width=260></el-table-column>
<el-table-column label='发布者' prop='releaseMen' width=120></el-table-column>
<el-table-column label='内容' prop='content' min-width=800></el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="float: right;margin-top: 15px">
</el-pagination>
</div>
</el-container>
</template>
<script>
export default {
name: 'info',
data () {
return {
datas: [],
currentPage: 1,
pageSize: 10,
total: 100
}
},
mounted () {
this.getData(this.currentPage, this.pageSize)
},
methods: {
handleSizeChange (val) {
this.pageSize = val
this.getData(this.currentPage, this.pageSize)
},
handleCurrentChange (val) {
this.currentPage = val
this.getData(this.currentPage, this.pageSize)
},
getData (currentPage, pageSize) {
let self = this
fetch('/api/getInfo', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({currentPage: currentPage, pageSize: pageSize})
}).then(res => { return res.json() }).then(data => {
console.log(data)
self.datas = data.data
self.total = data.dataTotal
})
}
}
}
</script>
<style scoped>
</style>
<template>
<el-container>
<el-main>
<div style='margin: 100px auto'>
<el-row type="flex" justify="center" style="width: 100%;height: 100%">
<el-col :span="12">
<el-form label-position="top" :model="from" ref="from">
<el-form-item label="账号" prop="name">
<el-input v-model="from.userName"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model.trim="from.password" type="password" auto-complete="off"></el-input>
</el-form-item>
<el-button type="primary" @click="onSubmit" style="margin: 0 auto">确定登陆</el-button>
</el-form>
</el-col>
</el-row>
</div>
</el-main>
</el-container>
</template>
<script>
export default {
name: 'login',
data () {
return {
from: {
userName: '',
password: ''
}
}
},
computed: {
},
mounted () {
const self = this
if (localStorage.getItem('sureLogin')) {
self.onSubmit()
}
},
methods: {
onSubmit () {
let self = this
if (self.from.userName && self.from.password) {
fetch('/api/login', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify(self.from)
}).then(res => { return res.json() }).then(data => {
console.log(data)
if (data.status === 230) {
sessionStorage.setItem('sureLogin', 'admin')
this.$router.push({path: '/'})
} else {
this.$message({
showClose: true,
message: data.message,
type: 'error'
})
}
})
} else {
this.$message({
showClose: true,
message: '请输入账号密码',
type: 'error'
})
}
}
}
}
</script>
<style scoped>
</style>
<template>
<el-container>
<el-header>
<h3>信息发布</h3>
</el-header>
<el-main style='width: 80%; margin: 20px auto'>
<div class='input'>
<p>标题:</p>
<el-input label='标题' placeholder='请输入标题名称' v-model='title'></el-input>
</div>
<div class='input'>
<p>发布人:</p>
<el-input label='发布人' placeholder='请输入发布者名称' v-model='releaseMen' ></el-input>
</div>
<div class='input'>
<p>内容:</p>
<el-input label='内容' placeholder='请输入要发布的信息内容' type='textarea' v-model='content' :autosize="{ minRows: 4, maxRows: 8}" style='vertical-align: top'></el-input>
</div>
<el-button type='primary' @click='sure()' style='width: 100px;margin: 10px auto'>确认发布</el-button>
</el-main>
</el-container>
</template>
<script>
export default {
name: 'releaseInfo',
data () {
return {
centerDialogVisible: false,
title: '',
content: '',
releaseMen: ''
}
},
methods: {
sure () {
let self = this
let data = {'title': this.title, 'content': this.content, 'releaseMen': this.releaseMen}
console.log(data)
if (this.title && this.content && this.releaseMen) {
fetch('/api/releaseInfo', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify(data)
}).then(res => { return res.json() }).then(data => {
console.log(data)
if (data.status === 200) {
self.title = ''
self.content = ''
self.releaseMen = ''
this.$alert('消息发送成功', '提示', {
confirmButtonText: '确定',
callback: action => {
this.$message({
showClose: true,
message: '信息发布成功',
type: 'success'
})
}
})
}
})
} else {
this.$message({
showClose: true,
message: '请输入全部所需的内容',
type: 'warning'
})
}
}
}
}
</script>
<style scoped>
.input {
margin: 15px 0;
}
.input:nth-child(1) , .input:nth-child(2){
width: 40%;
}
.input:nth-child(3) {
width: 60%;
}
</style>
<template>
<el-container>
<el-header>
<h4>代码位控制</h4>
</el-header>
<el-main>
<el-row>
<el-select v-model="inputValue" filterable placeholder="请选择" @change='change' clearable @clear='clear' style='width: 300px;margin-bottom: 10px'>
<el-option
v-for="item in emailOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-row>
<el-table :data='datas' border width=100%>
<el-table-column width=50 label='序号'>
<template slot-scope='scope'>
{{scope.$index + (currentPage - 1) * pageSize + 1}}
</template>
</el-table-column>
<el-table-column label='ID' prop='slotId'></el-table-column>
<el-table-column label='账户名称' prop='email'></el-table-column>
<el-table-column label='公司名称' prop='company'></el-table-column>
<el-table-column label='代码位名称' prop='slotName'></el-table-column>
<el-table-column label='代码位位置' prop='slot'></el-table-column>
<el-table-column label='代码位操作'>
<template slot-scope='scope'>
<el-switch
style="display: block"
v-model="scope.row.isDelete"
active-color="#ff4949"
inactive-color="#13ce66"
active-text="注销"
@change='slotChange(scope.row)'
inactive-text="启用">
</el-switch>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="float: right;margin-top: 15px">
</el-pagination>
</el-main>
</el-container>
</template>
<script>
export default {
name: 'slot',
data () {
return {
datas: null,
isDelete: false,
inputValue: null,
currentPage: 1,
pageSize: 10,
total: 100,
emailOptions: []
}
},
mounted () {
this.getData(this.currentPage, this.pageSize, this.inputValue)
},
methods: {
change () {
console.log('进入筛选')
console.log(this.inputValue)
this.getData(this.currentPage, this.pageSize, this.inputValue)
},
clear () {
this.getData(this.currentPage, this.pageSize, null)
},
getData (currentPage, pageSize, choose) {
let self = this
fetch('/api/getSlot', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({currentPage: currentPage, pageSize: pageSize, choose: choose})
}).then(res => { return res.json() }).then(data => {
console.log(data)
self.datas = data.data
self.total = data.dataTotal
self.emailOptions = data.emailArr
})
},
handleSizeChange (val) {
this.pageSize = val
this.getData(this.currentPage, this.pageSize, this.inputValue)
},
handleCurrentChange (val) {
this.currentPage = val
this.getData(this.currentPage, this.pageSize, this.inputValue)
},
slotChange (row) {
console.log(row.isDelete)
console.log(row)
if (row.isDelete) {
this.deleteSlot(row, 0)
} else {
this.deleteSlot(row, 1)
}
},
deleteSlot (row, status) {
let slotId = row.slotId
fetch('/api/deleteSlot', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({slotId: slotId, status: status})
}).then(res => { return res.json() }).then(data => {
console.log(data)
if (status === 0) {
this.$message({
message: data.data,
type: 'error'
})
}
if (status === 1) {
this.$message({
message: data.data,
type: 'success'
})
}
})
}
}
}
</script>
<style scoped>
</style>
<template>
<el-container>
<el-header><h2>余额记录</h2></el-header>
<el-main>
<TableTmp :header="dataHeader" ref='TableTmp' :url='url' surplus='ok'>
</TableTmp>
</el-main>
</el-container>
</template>
<style scoped>
</style>
<script>
import TableTmp from './tableTmp'
export default {
name: 'surplus',
components: {TableTmp},
data () {
return {
url: '/api/surplus',
dataHeader: {
time: '日期',
createdAt: '开户时间',
email: '邮箱',
company: '公司',
surplus: '余额'
}
}
},
mounted () {
this.$refs.TableTmp.change()
}
}
</script>
<template>
<el-main>
<el-row :gutter="40" type='flex' justify='end' align='middle' style="margin-bottom: 20px">
<el-col :span='4'>
<el-button type='primary' @click='dateToXlsx'>下载文件</el-button>
<el-col :span='5'>
<el-button type='primary' @click='dateToXlsx'>下载当前统计文件</el-button>
</el-col>
<el-col v-if="consume === 'ok' || finance === 'ok'" :span='5' style='background-color: rgb(115,177,240);padding: 8px 10px;font-weight: 700;text-align:center;color:white;border-radius: 4px;margin-right: 20px'>
<span>总计:{{dataSum}}</span>
<el-col v-if="consume === 'ok' || finance === 'ok' || surplus === 'ok'" :span='5' style='background-color: rgb(115,177,240);padding: 8px 10px;font-weight: 700;text-align:center;color:white;border-radius: 4px;margin-right: 20px'>
<span>总计:{{dataSum}}{{financeNumber}}{{surplusTotal}}</span>
</el-col>
<el-col v-if="consume === 'ok'" :span='4' style='background-color: rgb(115,177,240);padding: 8px 10px;font-weight: 700;text-align:center;color:white;border-radius: 4px'>
<el-col v-if="consume === 'ok'" :span='5' style='background-color: rgb(115,177,240);padding: 8px 10px;font-weight: 700;text-align:center;color:white;border-radius: 4px'>
<span>预扣总计:{{dataPreSum}}</span>
</el-col>
<el-col :span='9'>
......@@ -21,7 +21,8 @@
:end-placeholder="endTime"
value-format='yyyy-MM-dd'
format='yyyy-MM-dd'
:picker-options="pickerOptions">
:picker-options="pickerOptions"
>
</el-date-picker>
</el-col>
</el-row>
......@@ -35,7 +36,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-sizes="[10, 20, 50, 100, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
......@@ -47,51 +48,63 @@
<script>
import moment from 'moment'
const json2xlsx = require('../csv/csv')
import _ from 'lodash'
export default {
name: 'TableTmp',
props: [
'header',
'finance',
'consume',
'url'
'url',
'surplus',
'datalist'
],
data () {
return {
datas: '',
datas: [],
data: [],
allDate: [],
currentPage: 1,
pageSize: 100,
pageSize: 10,
total: 1000,
dataSum: 0,
dataPreSum: 0,
financeNumber: 0,
surplusTotal: 0,
valueRange: [],
startTime: '',
endTime: '2018-4-9',
pickerOptions: {
shortcuts: [{
text: '昨天',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一周',
onClick (picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick (picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick (picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
}
......@@ -105,10 +118,13 @@
getTime () {
this.endTime = moment().format('YYYY-MM-DD')
this.startTime = moment().subtract(1, 'days').format('YYYY-MM-DD')
if (this.surplus) {
this.startTime = '2018-01-01'
}
},
dateToXlsx () {
var self = this
var list = []
let self = this
let list = []
let tHeader = []
console.log(self.header)
for (let x in self.header) {
......@@ -116,20 +132,26 @@
}
list.push(tHeader)
if (self.consume === 'ok') {
for (let i = 0; i < self.datas.length; i++) {
list.push([self.datas[i].time, self.datas[i].email, self.datas[i].company, self.datas[i].number, self.datas[i].preNumber])
for (let i = 0; i < self.allDate.length; i++) {
list.push([self.allDate[i].time, self.allDate[i].email, self.allDate[i].company, self.allDate[i].number, self.allDate[i].preNumber])
}
list.push(['扣款合计', self.dataSum, '预扣合计', self.dataPreSum])
console.log(list)
} else if (self.finance === 'ok') {
for (let i = 0; i < self.datas.length; i++) {
list.push([self.datas[i].time, self.datas[i].email, self.datas[i].company, self.datas[i].number])
for (let i = 0; i < self.allDate.length; i++) {
list.push([self.allDate[i].time, self.allDate[i].email, self.allDate[i].company, self.allDate[i].number])
}
list.push(['充值合计', self.dataSum])
console.log(list)
} else if (self.surplus === 'ok') {
for (let i = 0; i < self.allDate.length; i++) {
list.push([self.allDate[i].time, self.allDate[i].createdAt, self.allDate[i].email, self.allDate[i].company, self.allDate[i].surplus])
}
list.push(['余额合计', self.surplusTotal])
console.log(list)
} else {
for (let i = 0; i < self.datas.length; i++) {
list.push([self.datas[i].time, self.datas[i].email, self.datas[i].company, self.datas[i].pv, self.datas[i].uid, self.datas[i].touchCount, self.datas[i].getCount, self.datas[i].msgCount, self.datas[i].callCount])
for (let i = 0; i < self.allDate.length; i++) {
list.push([self.allDate[i].time, self.allDate[i].email, self.allDate[i].company, self.allDate[i].pv, self.allDate[i].uid, self.allDate[i].touchCount, self.allDate[i].getCount, self.allDate[i].msgCount, self.allDate[i].callCount])
}
}
console.log(list)
......@@ -152,31 +174,21 @@
},
change (type = 'POST', startTime = this.startTime, endTime = this.endTime, total = this.total, pageSize = this.pageSize, currentPage = this.currentPage) {
let self = this
let skip = currentPage
console.log(self.url, type, startTime, endTime, total, pageSize, skip)
console.log(self.url, type, startTime, endTime, total, pageSize, currentPage)
fetch(self.url, {
method: type,
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({startTime, endTime, total, pageSize, currentPage})
}).then(res => { return res.json() }).then(data => {
self.datas = []
console.log(data)
self.datas = data.data
self.allDate = data.data
self.datas = data.data.slice((currentPage - 1) * pageSize, pageSize * currentPage)
self.total = data.total
self.dataSum = data.consumeTotalNumber || data.financeNumber
self.dataSum = data.consumeTotalNumber
self.dataPreSum = data.preTotalNumber
console.log(data.data)
console.log(self.total)
console.log(self.dataSum)
console.log(self.dataPreSum)
for (let i = 0; i < self.datas.length; i++) {
if (self.datas[i].pv == 'undefined') {
self.datas[i].pv = 0
}
}
}).catch(err => {
console.log(err)
})
self.financeNumber = data.financeNumber
self.surplusTotal = data.surplusTotal
}).catch(err => { console.log(err) })
}
}
}
......
......@@ -9,6 +9,30 @@ import 'element-ui/lib/theme-chalk/index.css'
Vue.config.productionTip = false
Vue.use(ElemetnUI)
/* eslint-disable no-new */
router.beforeEach((to, from, next) => {
let sureSession = sessionStorage.getItem('sureLogin')
console.log(sureSession)
if (to.matched.some(record => record.meta.requiresId)) {
if (sureSession !== 'admin') {
next({path: '/login'})
console.log(1)
} else {
next()
}
if (sureSession === 'admin') {
next()
} else {
next({path: '/login'})
console.log(2)
}
} else {
next()
}
})
new Vue({
el: '#app',
router,
......
......@@ -4,6 +4,13 @@ import home from '@/components/home'
import dataList from '@/components/dataList'
import finance from '@/components/finance'
import consume from '@/components/consume'
import surplus from '@/components/surplus'
import releaseInfo from '@/components/releaseInfo'
import info from '@/components/info'
import login from '@/components/login'
import checkCall from '@/components/checkCall'
import account from '@/components/account'
import slot from '@/components/slot'
Vue.use(Router)
......@@ -13,12 +20,25 @@ export default new Router({
path: '/',
name: 'home',
component: home,
meta: {requiresId: true},
children: [
{name: 'data', path: '', component: dataList},
{name: 'dataList', path: '/dataList', component: dataList},
{name: 'finance', path: '/finance', component: finance},
{name: 'consume', path: '/consume', component: consume}
{name: 'data', path: '', meta: {requiresId: false}, component: dataList},
{name: 'dataList', path: '/dataList', meta: {requiresId: false}, component: dataList},
{name: 'finance', path: '/finance', meta: {requiresId: false}, component: finance},
{name: 'consume', path: '/consume', meta: {requiresId: false}, component: consume},
{name: 'surplus', path: '/surplus', meta: {requiresId: false}, component: surplus},
{name: 'releaseInfo', path: '/releaseInfo', meta: {requiresId: false}, component: releaseInfo},
{name: 'info', path: '/info', meta: {requiresId: false}, component: info},
{name: 'checkCall', path: '/checkCall', meta: {requiresId: false}, component: checkCall},
{name: 'account', path: '/account', meta: {requiresId: false}, component: account},
{name: 'slot', path: '/slot', meta: {requiresId: false}, component: slot}
]
},
{
path: '/login',
name: 'login',
component: login,
meta: {requiresId: false}
}
]
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment