Commit 6de47016 authored by yaobeibei's avatar yaobeibei

merge merge oem_master

parent df4a32fe
<template>
<el-date-picker
v-model="valueRange"
type="daterange"
unlink-panelss
@change="callback"
range-separator="至"
:start-placeholder="startTime"
:end-placeholder="endTime"
value-format='yyyy-MM-dd'
format='yyyy-MM-dd'
:picker-options="pickerOptions"
>
</el-date-picker>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
export default {
name: "DatePicker",
props: [
'startTime',
'endTime'
],
data() {
return {
valueRange: [],
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]);
}
},
{
text: "最近一个月",
onClick(picker) {
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]);
}
}
]
}
};
},
computed() {},
methods: {
callback() {
console.log('to')
this.$emit('timeChange', this.valueRange);
}
}
};
</script>
<style scpoed>
</style>
<template>
<el-pagination
class="pagination"
:current-page="currentPage"
:page-size="pageSize"
:page-sizes="[10, 20, 50 ,100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change='sizeChange'
@current-change='currentChange'
>
</el-pagination>
</template>
<script>
export default {
name: 'Pagination',
props: [
'currentPage',
'pageSize',
'total'
],
data () {
return {
}
},
methods: {
currentChange (value) {
console.log(value)
this.currentPage = value
this.$emit('currentChange', this.currentPage)
},
sizeChange (value) {
console.log(value)
this.pageSize = value
this.$emit('sizeChange', this.pageSize)
}
}
}
</script>
<style>
.pagination {
float: right;
margin-top: 20px;
}
</style>
<template>
<el-main>
<h4>url审核</h4>
<el-row>
<DatePicker :startTime='startTime' :endTime='endTime' :change='timeChange'></DatePicker>
<Drop :dropChange='dropChange' :chooseArray='chooseArray'></Drop>
</el-row>
<el-table :data="datas" border style="width:100%">
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column v-for="(value, key) in tables" :label="value" :prop="key"></el-table-column>
<el-table-column>
<template slot-scope="scope">
<el-button type="text" :disabled="disabled">通过</el-button>
<el-button type="text">拒绝</el-button>
</template>
</el-table-column>
</el-table>
<Pagination :currentPage='currentPage' :pageSize='pageSize' :total='total' :sizeChange='sizeChange' :currentChange='currentChange'></Pagination>
</el-main>
</template>
<script>
import DatePicker from './DatePicker'
import Pagination from './Pagination'
import Drop from './dropDown'
import { mapActions, mapGetters } from 'vuex'
export default {
name: 'checkUrl',
components: {
DatePicker,
Pagination,
Drop
},
data () {
return {
url: '/api/checkUrl',
tables: {
slotId: 'ID',
email: '账户名称',
company: '公司名称',
slotName: 'Url名称',
slot: 'Url位置',
time: 'Url创建时间',
status: 'Url状态'
},
chooseArray: {
all: '全部状态',
zero: '未审核',
one: '已拒绝',
two: '已通过'
},
datas: null,
currentPage: 1,
pageSize: 10,
total: 1000,
startTime: null,
endTime: null,
status: null
}
},
mounted () {
this.getTime()
},
methods: {
...mapActions({
getData: 'GET_DATA',
send: 'SEND'
}),
getTime () {
this.endTime = moment().format('YYYY-MM-DD')
this.startTime = moment().subtract(7, 'days').format('YYYY-MM-DD')
},
sizechange (value) {
console.log(value)
this.pageSize = value
},
currentPage (value) {
console.log(value)
this.currentPage = value
},
dropChange (value) {
console.log(value)
this.status = value
},
timeChange (value) {
console.log(value)
this.startTime = value[0]
this.endTime = value[1]
this.getData({
url: this.url,
choose: {
startTime: this.startTime,
endTime: this.endTime,
pageSize: this.pageSize,
currentPage: this.currentPage,
total: this.total,
status: this.status
},
callback: this.formatData
})
},
formatData (err, data) {
if (err) {
return console.log(err)
}
this.datas = data.datas
this.totat = data.total
}
}
}
</script>
<style>
</style>
<template>
<el-main>
<el-dropdown style='float: right' @command='handleCommand'>
<el-button class="el-dropdown-link">
{{choose}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(value, key) in chooseArray" :command='key'>{{value}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-main>
</template>
<script>
export default {
name: 'Drop',
props: [
'chooseArray'
],
data () {
return {
choose: '状态选择'
}
},
methods: {
handleCommand (value) {
console.log(value)
this.$emit('dropChange', value)
}
}
}
</script>
<style>
.el-dropdown {
vertical-align: top;
}
.el-dropdown + .el-dropdown {
margin-left: 15px;
}
.el-icon-arrow-down {
font-size: 12px;
}
</style>
...@@ -18,6 +18,8 @@ import leadPoolTask from '@/components/leadPoolTask' ...@@ -18,6 +18,8 @@ import leadPoolTask from '@/components/leadPoolTask'
import exportPoolTask from '@/components/exportPoolTask' import exportPoolTask from '@/components/exportPoolTask'
import agent from '@/components/agent' import agent from '@/components/agent'
import welcome from '@/components/welcome' import welcome from '@/components/welcome'
import checkUrl from '@/components/checkUrl'
Vue.use(Router) Vue.use(Router)
...@@ -44,7 +46,8 @@ export default new Router({ ...@@ -44,7 +46,8 @@ export default new Router({
{name: 'leadPoolTask', path: '/leadPoolTask', meta: {requiresId: false}, component: leadPoolTask}, {name: 'leadPoolTask', path: '/leadPoolTask', meta: {requiresId: false}, component: leadPoolTask},
{name: 'exportPoolTask', path: '/exportPoolTask', meta: {requiresId: false}, component: exportPoolTask}, {name: 'exportPoolTask', path: '/exportPoolTask', meta: {requiresId: false}, component: exportPoolTask},
{name: 'distributor', path: '/distributor', meta: {requiresId: false}, component: distributor}, {name: 'distributor', path: '/distributor', meta: {requiresId: false}, component: distributor},
{name: 'agent', path: '/agent', meta: {requiresId: false}, component: agent} {name: 'agent', path: '/agent', meta: {requiresId: false}, component: agent},
{name: 'checkUrl', path: '/checkUrl', meta: {requiresId: false}, component: checkUrl},
] ]
}, },
{ {
......
const type = {
GET_DATA: 'GET_DATA',
SEND: 'SEND',
GET_EMAIL: 'GET_EMAIL'
}
const state = {
datas: [],
allDatas: [],
emails: []
}
const getters = {
getDatas () {
return state.datas
},
getAccount () {
return state.emails
}
}
const mutations = {
[type.GET_DATA] (state, data) {
state.datas = data
},
[type.GET_EMAIL] (state, data) {
state.emails = data
}
}
const actions = {
[type.GET_DATA] ({commit}, {url, choose, callback}) {
console.log(url, choose)
fetch(url, {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify(choose)
}).then(res => {
return res.json()
}).then(data => {
commit(type.GET_DATA, data)
callback(null, data)
}).catch(err => {
callback(err, null)
})
},
[type.SEND] ({commit}, {url, choose, callback}) {
console.log(url, choose)
fetch(url, {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify(choose)
}).then(res => {
return res.json()
}).then(data => {
console.log(data)
if (data.status === 0) {
this.$message({
message: data.message,
type: 'error'
})
}
if (data.status === 1) {
this.$message({
message: data.message,
type: 'success'
})
}
callback(null, data)
}).catch(err => {
this.message({
message: err,
type: 'error'
})
callback(err, null)
})
},
[type.GET_EMAIL] ({commit}) {
fetch('/api/getEmail', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: null
}).then(res => {
return res.json()
}).then(data => {
console.log(data)
commit(type.GET_EMAIL, data.emailArr)
}).catch(err => {
return console.log(err)
})
}
}
export default {
state,
getters,
mutations,
actions
}
import Vue from 'vue' import Vue from 'vue'
import vuex from 'vuex' import vuex from 'vuex'
import dataList from './dataList' import data from './data'
import login from './login' import login from './login'
...@@ -8,7 +8,7 @@ Vue.use(vuex) ...@@ -8,7 +8,7 @@ Vue.use(vuex)
export default new vuex.Store({ export default new vuex.Store({
modules: { modules: {
dataList, data,
login login
} }
}) })
......
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