Commit dec35184 authored by 刘松's avatar 刘松

modify

parent 65f2b519
### Health check 'curl /ping'
FROM reg.yunpro.cn/library/node:9.11.1
WORKDIR /app
ADD ./package.json /app/
#front end
ADD ./dist /app/dist
ADD ./public /app/public
#server
ADD ./app.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=8081
ENV PROJECT_LEVEL=production
ENV MONGO='mongodb://wkf-mongo:8199/addwechat'
ENV DEVICE='http://wk-center-ctrller-go:9911'
ENV GO='http://wk_tag_to_wechat:9912'
ENV NODE_ENV='production'
ENV BUILD_ENV=''
EXPOSE 8081
CMD node app.js
This diff is collapsed.
...@@ -14,10 +14,14 @@ app.use(bodyParser.urlencoded({ ...@@ -14,10 +14,14 @@ app.use(bodyParser.urlencoded({
})); }));
app.use(cookieParser()); app.use(cookieParser());
app.use(express.static(__dirname + '/dist')); app.use(express.static(__dirname + '/dist'));
app.use('/api', api.router);
app.get('/*',function(req,res) { app.get('/*',function(req,res) {
res.sendFile(path.resolve(__dirname , 'dist/index.html')); res.sendFile(path.resolve(__dirname , 'dist/index.html'));
}) });
app.use('/api', api.router);
server.listen(process.env.PORT || 8081, function() { server.listen(process.env.PORT || 8081, function() {
......
This diff is collapsed.
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
"axios": "^0.18.0", "axios": "^0.18.0",
"body-parser": "^1.18.3", "body-parser": "^1.18.3",
"cookie-parser": "^1.4.3", "cookie-parser": "^1.4.3",
"element-ui": "^2.4.5", "element-ui": "^2.4.7",
"express": "^4.16.3", "express": "^4.16.3",
"jsonwebtoken": "^8.3.0", "lodash": "^4.17.11",
"moment": "^2.22.2", "moment": "^2.22.2",
"mongodb": "^3.1.6", "mongodb": "^3.1.6",
"qs": "^6.5.2",
"vue": "^2.5.17", "vue": "^2.5.17",
"vue-class-component": "^6.0.0", "vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0", "vue-property-decorator": "^7.0.0",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>wk_add_wehcat</title> <title>联通微信加粉</title>
</head> </head>
<body> <body>
<noscript> <noscript>
......
import axios from 'axios';
axios.defaults.withCredentials = true;
const getTaskList = (size: number, page?: number) => {
return axios.get(`/api/tasks?page=${page}&size=${size}`);
};
const getDetailList = (size: number, page: number, taskWrapID: string) => {
return axios.get(`/api/task/detail?page=${page}&size=${size}&taskWrapID=${taskWrapID}`);
};
const createTask = (
form: {
count: number,
id: string,
user_id: string,
greet: string,
}) => {
return axios.post(`api/task`, form);
};
export {
getTaskList,
createTask,
getDetailList,
};
import axios from 'axios';
axios.defaults.withCredentials = true;
const getDeviceList = () => {
return axios.get(`/api/devices`);
};
const getQrcode = (sn: string, type: string) => {
return axios.get(`/api/qrcode?sn=${sn}&type=${type}`);
};
const getDeviceStatus = (sn: string) => {
return axios.get(`/api/is_login_wechat?sn=${sn}`);
};
export {
getDeviceList,
getQrcode,
getDeviceStatus,
};
...@@ -3,19 +3,38 @@ import axios from 'axios'; ...@@ -3,19 +3,38 @@ import axios from 'axios';
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
const getFilterList = (size: number, page?: number) => { const getFilterList = (size: number, page?: number) => {
return axios.get(`/api/permission?page=${page}&size=${size}`); return axios.get(`/api/search?page=${page}&size=${size}`);
}; };
const createFilterList = ( const createFilterList = (
form: {
ageEnd: string,
ageStart: string,
consumptionDuring: string,
consumptionEnd: string,
consumptionStart: string,
districts: any,
dsgroup: string,
flow: string,
flowDuring: string,
flowEnd: string,
flowStart: string,
sexlist: string,
}) => {
return axios.post(`api/model/query`, form);
};
const filterCount = (
form: { form: {
name: string, name: string,
desc: string, desc: string,
code: string, code: string,
}) => { }) => {
return axios.post(`api/search`, form); return axios.post(`api/model/count`, form);
}; };
export { export {
getFilterList, getFilterList,
createFilterList, createFilterList,
filterCount,
}; };
...@@ -140,19 +140,19 @@ export default class CommonTable extends Vue { ...@@ -140,19 +140,19 @@ export default class CommonTable extends Vue {
let str = ''; let str = '';
switch (num) { switch (num) {
case 0: case 0:
str = '没有微信'; str = '添加成功';
break; break;
case 1: case 1:
str = '等待通过'; str = '已是好友';
break; break;
case 2: case 2:
str = '添加失败'; str = '没有该用户';
break; break;
case 3: case 3:
str = '已是好友'; str = '其他异常';
break; break;
case 4: case 100:
str = '添加成功'; str = '未执行';
break; break;
} }
return str; return str;
......
...@@ -6,8 +6,32 @@ import './plugins/element.js'; ...@@ -6,8 +6,32 @@ import './plugins/element.js';
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ store.dispatch('LOGIN', {
router, sessionID: localStorage.getItem('__sessionID'),
store, callback(err: any) {
render: (h) => h(App), const State: any = store.state;
}).$mount('#app'); router.beforeEach((to, from, next) => {
if (to.matched.some((record) => record.meta.requiresAuth)) {
if (!State.login.isLogin) {
next({ path: '/login', query: { redirect: to.fullPath } });
} else {
next();
}
} else {
if (to.path === '/login' && State.login.isLogin) {
next({ path: '/' });
} else {
next(); // 确保一定要调用 next()
}
}
});
/* eslint-disable no-new */
new Vue({
router,
store,
render: (h) => h(App),
}).$mount('#app');
},
});
...@@ -16,6 +16,7 @@ export default new Router({ ...@@ -16,6 +16,7 @@ export default new Router({
path: '/', path: '/',
name: 'home', name: 'home',
component: Home, component: Home,
meta: { requiresAuth: true },
children: [ children: [
{ {
path: '/filternumber', path: '/filternumber',
...@@ -31,6 +32,7 @@ export default new Router({ ...@@ -31,6 +32,7 @@ export default new Router({
}, },
{ {
path: '/login', path: '/login',
meta: { requiresAuth: false },
name: 'login', name: 'login',
component: Login, component: Login,
}, },
......
...@@ -4,7 +4,7 @@ import Vuex from 'vuex'; ...@@ -4,7 +4,7 @@ import Vuex from 'vuex';
import login from './modules/login'; import login from './modules/login';
import filterNumber from './modules/filterNumber'; import filterNumber from './modules/filterNumber';
import addTask from './modules/addTask'; import addTask from './modules/addTask';
import device from './modules/device';
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
...@@ -12,5 +12,6 @@ export default new Vuex.Store({ ...@@ -12,5 +12,6 @@ export default new Vuex.Store({
login, login,
filterNumber, filterNumber,
addTask, addTask,
device
}, },
}); });
This diff is collapsed.
import { Commit } from 'vuex';
import { Message } from 'element-ui';
import { GET_DEVICELIST, GET_QRCODE, GET_WECHAT, RESET_QRCODE, RESET_WECHATINFO } from '../types';
import { getDeviceList, getQrcode, getDeviceStatus } from '@/api/device';
export interface State {
deviceList: any[];
qrcode: string;
weChatInfo: any;
taskID: any;
}
const deviceState: State = {
deviceList: [],
qrcode: '',
weChatInfo: {},
taskID: null,
};
const actions = {
[GET_DEVICELIST](
context: { commit: Commit, state: State },
payload: {},
) {
getDeviceList().then((data) => {
const result = data.data;
if (result) {
context.commit(GET_DEVICELIST, result);
} else {
Message.error(`获取设备失败`);
}
}).catch((err: any) => {
throw(err);
});
},
[GET_QRCODE](
context: { commit: Commit, state: State },
payload: { sn: string, type: string}) {
// 获取二维码
getQrcode(payload.sn, payload.type).then((_data) => {
const result = _data.data;
if (result) {
const taskID = setInterval(() => {
getDeviceStatus(payload.sn).then((data) => {
if( data.data && data.data.WeChat && data.data.status === '1' ) {
window.clearInterval(context.state.taskID);
context.commit(GET_WECHAT, data.data.WeChat);
}
});
}, 1000);
result.taskID = taskID;
context.commit(GET_QRCODE, result);
} else {
Message.error(`获取二维码失败`);
}
}).catch((err) => {
throw(err);
});
},
[RESET_QRCODE](
context: { commit: Commit, state: State }) {
// 获取二维码
context.commit(RESET_QRCODE, '');
},
[RESET_WECHATINFO](
context: { commit: Commit, state: State }, data: any) {
// 获取二维码
context.commit(RESET_WECHATINFO, data);
},
};
const mutations = {
[GET_DEVICELIST](state: State, data: { list: any[]}) {
state.deviceList = data.list.map( (x: any) => {
const wechat = x.weChatInfo && x.weChatInfo.nickname ? x.weChatInfo.nickname : '未登录';
return {
label: x.deviceSN + '[' + wechat + ']',
value: x.deviceSN + '[' + wechat + ']',
weChatInfo: x.weChatInfo,
};
});
},
[GET_QRCODE](state: State, data: { qrcode: string, taskID: any }) {
state.qrcode = data.qrcode;
state.taskID = data.taskID;
},
[GET_WECHAT](state: State, data: any) {
state.weChatInfo = data;
},
[RESET_QRCODE](state: State, data: any) {
state.qrcode = data;
},
[RESET_WECHATINFO](state: State, data: any) {
state.weChatInfo = data;
},
};
export default {
state: deviceState,
actions,
mutations,
};
import { Commit } from 'vuex'; import { Commit } from 'vuex';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import { GET_FILTERLIST, CREATE_FILTERLIST } from '../types'; import { GET_FILTERLIST, CREATE_FILTERLIST, FILTERLIST_COUNT } from '../types';
import { getFilterList, createFilterList } from '@/api/filterNumber'; import { getFilterList, createFilterList, filterCount } from '@/api/filterNumber';
interface PermissionAttribute { interface PermissionAttribute {
id?: string; id?: string;
...@@ -17,84 +17,17 @@ interface PermissionAttribute { ...@@ -17,84 +17,17 @@ interface PermissionAttribute {
export interface State { export interface State {
dataList: any[]; dataList: any[];
count: number; count: number;
page: number;
size: number;
deviceList: any[];
} }
const filterNumberState: State = { const filterNumberState: State = {
dataList: [ dataList: [],
{ deviceList: [{ label: '1', value: '1'}],
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
{
name: '0001',
total: 5000,
used: 3000,
createdAt: '1536549529672',
numberGroup: '某某号码组',
filterList: '男, 女, 12-16; 北京,天津,山东,河北,张家口,石家庄,太原,深圳,广州,吉林,桂林,张家口,石家庄,太原,深圳,广州,吉林,桂林',
},
],
count: 0, count: 0,
page: 0,
size: 10,
}; };
const actions = { const actions = {
...@@ -102,13 +35,12 @@ const actions = { ...@@ -102,13 +35,12 @@ const actions = {
context: { commit: Commit, state: State }, context: { commit: Commit, state: State },
payload: { size: number, page?: number }, payload: { size: number, page?: number },
) { ) {
// 获取角色列表
getFilterList(payload.size, payload.page).then((data) => { getFilterList(payload.size, payload.page).then((data) => {
const result = data.data.result; const result = data.data;
if (result) { if (result) {
context.commit(GET_FILTERLIST, result); context.commit(GET_FILTERLIST, result);
} else { } else {
Message.error(`获取数据失败错误原因是${data.data.msg}`); Message.error(`获取数据失败`);
} }
}).catch((err) => { }).catch((err) => {
throw(err); throw(err);
...@@ -116,18 +48,46 @@ const actions = { ...@@ -116,18 +48,46 @@ const actions = {
}, },
[CREATE_FILTERLIST]( [CREATE_FILTERLIST](
context: { commit: Commit, state: State },
payload: {
ageEnd: string,
ageStart: string,
consumptionDuring: string,
consumptionEnd: string,
consumptionStart: string,
districts: any,
dsgroup: string,
flow: string,
flowDuring: string,
flowEnd: string,
flowStart: string,
sexlist: string,
callback: any,
}) {
// 筛选
createFilterList(payload).then((data: any) => {
Message.success('创建成功');
// payload.callback && payload.callback();
}).catch((err: any) => {
Message.success('创建失败');
// payload.callback && payload.callback();
throw(err);
});
},
[FILTERLIST_COUNT](
context: { commit: Commit, state: State }, context: { commit: Commit, state: State },
payload: { payload: {
name: string, name: string,
desc: string, desc: string,
code: string, code: string,
}) { }) {
// 创建角色 // 筛选
createFilterList(payload).then((data) => { filterCount(payload).then((data) => {
const result = data.data.result; const result = data.data;
if (result) { if (result) {
context.commit(CREATE_FILTERLIST, result); context.commit(FILTERLIST_COUNT, result);
Message.success('角色创建成功'); Message.success('筛选数量成功');
} else { } else {
Message.error(data.data.msg); Message.error(data.data.msg);
} }
...@@ -138,15 +98,54 @@ const actions = { ...@@ -138,15 +98,54 @@ const actions = {
}; };
const mutations = { const mutations = {
[GET_FILTERLIST](state: State, data: { rows: PermissionAttribute[], count: number }) { [GET_FILTERLIST](state: State, data: { list: any, count: number }) {
state.dataList = data.rows; state.dataList = data.list.map( (x: any) => {
let filter = '';
if( x.sexlist ) {
filter += (x.sexlist.join('、') + ',');
}
if( x.ageStart && x.ageEnd ) {
filter += ((x.ageStart + '-' + x.ageEnd) + ',');
}
if( x.districts ) {
let cities:any = [];
x.districts.forEach((x:any) => {
cities = cities.concat(x.cities)
})
filter += (cities.join('、') + ',')
}
if( x.flowStart && x.flowEnd ) {
filter += ((x.flowStart + '-' + x.flowEnd) + 'M,');
}
if( x.consumptionStart && x.consumptionEnd ) {
filter += ((x.consumptionStart + '-' + x.consumptionEnd) + '元');
}
let total = x.respData && x.respData.total ? x.respData.total : 0;
let count = x.respData && x.respData.customers ? x.respData.customers.length : 0;
return {
numberGroup: x.dsgroup,
total: total,
used: x.used || 0,
count: count,
_id: x._id,
createdAt: x.createdAt || Date.now(),
filterList: filter,
};
});
state.count = data.count; state.count = data.count;
state.page = parseInt(data.page);
state.size = parseInt(data.size || 10);
}, },
[CREATE_FILTERLIST](state: State, data: PermissionAttribute) { /*[CREATE_FILTERLIST](state: State, data: PermissionAttribute) {
state.dataList.unshift(data); state.dataList.unshift(data);
state.count += 1; state.count += 1;
}, },
[FILTERLIST_COUNT](state: State, data: PermissionAttribute) {
state.dataList.unshift(data);
state.count += 1;
},*/
}; };
export default { export default {
......
import { Commit } from 'vuex'; import { Commit } from 'vuex';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import { GET_TOKEN } from '../types'; import { LOGIN } from '../types';
import { getUser } from '@/api/login'; import { getUser } from '@/api/login';
export interface State { export interface State {
isLogin: boolean; isLogin: boolean;
account: { username: string };
} }
const loginState: State = { const loginState: State = {
isLogin: false, isLogin: false,
account: { username: '' }
}; };
const actions = { const actions = {
[GET_TOKEN]( [LOGIN](
context: { commit: Commit, state: State }, context: { commit: Commit, state: State },
payload: { username: string, password: string }, payload: { username: string, password: string, callback: any },
) { ) {
// 获取角色列表 // 获取角色列表
getUser(payload).then((data) => { getUser(payload).then((result) => {
const result = data.data.result; console.dir(result.data);
if (result) { if (result.data && result.data.account) {
context.commit(GET_TOKEN, result); context.commit(LOGIN, result.data.account);
if(payload.callback) payload.callback(null, result.data.account);
} else { } else {
Message.error(`获取数据失败错误原因是${data.data.msg}`); Message.error(`获取数据失败错误`);
} }
}).catch((err) => { }).catch((data) => {
throw(err); Message.error(data.error ? data.error : `账户或密码错误`)
if(payload.callback) payload.callback(data.error ? data.error : `账户或密码错误`);
}); });
}, },
...@@ -35,8 +39,10 @@ const actions = { ...@@ -35,8 +39,10 @@ const actions = {
}; };
const mutations = { const mutations = {
[GET_TOKEN](state: State, data: { username: string, password: string }) { [LOGIN](state: State, data: { username: string, sessionID: string }) {
state.isLogin = true; state.isLogin = true;
localStorage.setItem('__sessionID', data.sessionID);
state.account.username = data.username;
// state.dataList = data.rows; // state.dataList = data.rows;
// state.count = data.count; // state.count = data.count;
}, },
......
// 获取用户列表
export const GET_PASSPORTS = 'GET_PASSPORTS';
// 添加用户
export const CREATE_PASSPORT = 'CREATE_PASSPORT';
// 编辑用户
export const UPDATE_PASSPORT = 'UPDATE_PASSPORT';
// 删除用户
export const DELETE_PASSPORT = 'DELETE_PASSPORT';
// 获取角色权限
export const GET_ROLES = 'GET_ROLES';
// 设置用户角色
export const SET_ROLE = 'SET_ROLE';
// 添加角色
export const CREATE_ROLE = 'CREATE_ROLE';
// 更新角色
export const UPDATE_ROLE = 'UPDATE_ROLE';
// 删除角色
export const DELETE_ROLE = 'DELETE_ROLE';
// 获取权限列表
export const GET_PERMISSIONS = 'GET_PERMISSIONS';
// 设置角色权限
export const SET_PERMISSION = 'SET_PERMISSION';
// 添加权限
export const CREATE_PERMISSION = 'CREATE_PERMISSION';
// 更新权限
export const UPDATE_PERMISSION = 'UPDATE_PERMISSION';
// 删除权限
export const DELETE_PERMISSION = 'DELETE_PERMISSION';
// 获取筛选列表 // 获取筛选列表
export const GET_FILTERLIST = 'GET_FILTERLIST'; export const GET_FILTERLIST = 'GET_FILTERLIST';
// 创建筛选条件 // 创建筛选条件
export const CREATE_FILTERLIST = 'CREATE_FILTERLIST'; export const CREATE_FILTERLIST = 'CREATE_FILTERLIST';
// 查询筛选条件用户
export const FILTERLIST_COUNT = 'FILTERLIST_COUNT';
// 登录 // 登录
export const GET_TOKEN = 'GET_TOKEN'; export const LOGIN = 'LOGIN';
export const CREATE_TASK = 'CREATE_TASK';
export const GET_TASKLIST = 'GET_TASKLIST';
export const GET_QRCODE = 'GET_QRCODE';
export const GET_DEVICELIST = 'GET_DEVICELIST';
export const GET_WECHAT = 'GET_WECHAT';
export const RESET_QRCODE = 'RESET_QRCODE';
export const RESET_WECHATINFO = 'RESET_WECHATINFO';
export const GET_DETAILLIST = 'GET_DETAILLIST';
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
/> />
<div class="pagination"> <div class="pagination">
<Pagination <Pagination
:page='page' :page='addTaskState.page'
:size='size' :size='addTaskState.size'
:total='addTaskState.count' :total='addTaskState.count'
:paginationSizeChange='paginationSizeChange' :paginationSizeChange='paginationSizeChange'
:paginationPageChange='paginationPageChange'/> :paginationPageChange='paginationPageChange'/>
...@@ -25,16 +25,16 @@ ...@@ -25,16 +25,16 @@
<div class="dialog-body"> <div class="dialog-body">
<!-- 此处借用了filterState的数据 --> <!-- 此处借用了filterState的数据 -->
<CommonTable <CommonTable
:dataList='addTaskState.dataList[dialog.index].taskList' :dataList='addTaskState.detailData.dataList'
:tHeadList='tHeadLists' :tHeadList='tHeadLists'
/> />
<div class="dialog-pagination"> <div class="dialog-pagination">
<Pagination <Pagination
:page='page' :page='addTaskState.detailData.page'
:size='size' :size='addTaskState.detailData.size'
:total='addTaskState.count' :total='addTaskState.detailData.count'
:paginationSizeChange='paginationSizeChange' :paginationSizeChange='detailSizeChange'
:paginationPageChange='paginationPageChange'/> :paginationPageChange='detailPageChange'/>
</div> </div>
</div> </div>
<div class="dialog-footer" slot='footer'> <div class="dialog-footer" slot='footer'>
...@@ -54,7 +54,7 @@ import { Component, Vue } from 'vue-property-decorator'; ...@@ -54,7 +54,7 @@ import { Component, Vue } from 'vue-property-decorator';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { Action, State } from 'vuex-class'; import { Action, State } from 'vuex-class';
import { GET_FILTERLIST, CREATE_FILTERLIST } from '@/store/types'; import { GET_TASKLIST, CREATE_TASK, GET_DETAILLIST } from '@/store/types';
import CommonTable from '@/components/CommonTable.vue'; import CommonTable from '@/components/CommonTable.vue';
import Pagination from '@/components/Pagination.vue'; import Pagination from '@/components/Pagination.vue';
...@@ -71,8 +71,10 @@ export default class AddTask extends Vue { ...@@ -71,8 +71,10 @@ export default class AddTask extends Vue {
}; };
@State('addTask') public addTaskState: any; @State('addTask') public addTaskState: any;
@Action(GET_FILTERLIST) public getFilterlist: any; @Action(GET_TASKLIST) public getTasklist: any;
@Action(CREATE_FILTERLIST) public createFilter: any; @Action(CREATE_TASK) public createTask: any;
@Action(GET_DETAILLIST) public getDetailList: any;
// 初始化数据 // 初始化数据
// 表格 // 表格
...@@ -103,7 +105,7 @@ export default class AddTask extends Vue { ...@@ -103,7 +105,7 @@ export default class AddTask extends Vue {
label: '目标号码', label: '目标号码',
width: '120', width: '120',
}, { }, {
prop: 'createdAt', prop: 'date',
label: '创建时间', label: '创建时间',
width: 'auto', width: 'auto',
}, { }, {
...@@ -131,7 +133,11 @@ export default class AddTask extends Vue { ...@@ -131,7 +133,11 @@ export default class AddTask extends Vue {
// 表格 // 表格
public detailRow(index: number) { public detailRow(index: number) {
// 点击表格进行编辑 // 点击表格进行编辑
this.setDialogData('taskDetail', index); this.dialog.name = 'taskDetail';
this.$data.isDialogShow = true;
this.getDetailList({ page:1, size:10 ,taskWrapID: this.addTaskState.dataList[index]._id });
//this.setDialogData('taskDetail', index);
} }
public setDialogData(name: string, index: number) { public setDialogData(name: string, index: number) {
...@@ -215,10 +221,10 @@ export default class AddTask extends Vue { ...@@ -215,10 +221,10 @@ export default class AddTask extends Vue {
} }
// // 生命周期 // 生命周期
// public mounted() { public mounted() {
// // this.getPermission({ size: this.size, page: this.page }); this.getTasklist({ size: this.size, page: this.page });
// } }
} }
</script> </script>
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import { getUser } from '../api/login'; import { getUser } from '../api/login';
import { Action, State } from 'vuex-class'; import { Action, State } from 'vuex-class';
import { GET_TOKEN } from '@/store/types'; import { LOGIN } from '@/store/types';
@Component({ @Component({
...@@ -30,7 +30,7 @@ import { GET_TOKEN } from '@/store/types'; ...@@ -30,7 +30,7 @@ import { GET_TOKEN } from '@/store/types';
export default class Overview extends Vue { export default class Overview extends Vue {
@State('login') public loginState: any; @State('login') public loginState: any;
@Action(GET_TOKEN) public getToken: any; @Action(LOGIN) public getToken: any;
public loginForm = { public loginForm = {
username: '', username: '',
password: '', password: '',
...@@ -46,11 +46,11 @@ export default class Overview extends Vue { ...@@ -46,11 +46,11 @@ export default class Overview extends Vue {
} }
const sumbitBtn = this.$refs.sumbitBtn; const sumbitBtn = this.$refs.sumbitBtn;
this.getToken(this.loginForm).then(() => { this.getToken(this.loginForm).then(() => {
const islogin = this.loginState.islogin; const isLogin = this.loginState.isLogin;
if (!islogin) { if (!isLogin) {
sumbitBtn.disabled = islogin; sumbitBtn.disabled = isLogin;
} else { } else {
sumbitBtn.disabled = islogin; sumbitBtn.disabled = isLogin;
this.$router.push('/filterNumber'); this.$router.push('/filterNumber');
} }
}); });
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<!-- 头部 --> <!-- 头部 -->
<el-header class="app-header"> <el-header class="app-header">
<span style="font-weight: bold; font-size: 20px; margin-left: 70px;"> <span style="font-weight: bold; font-size: 20px; margin-left: 70px;">
<img src="../../assets/logo.png" alt="" width="201px" style="margin-top:8px"> <img src="../../assets/logo.png" alt="" width="201px" style="margin-top:8px"/>
</span> </span>
<el-dropdown style="line-height: 60px;float: right;margin: 0px 30px;"> <el-dropdown style="line-height: 60px;float: right;margin: 0px 30px;">
<span class="theme-text"> <span class="theme-text">
{{ currentUser.username }}<i class="el-icon-arrow-down el-icon--right"></i> {{ currentUser }}<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item> <el-dropdown-item>
...@@ -26,10 +26,11 @@ ...@@ -26,10 +26,11 @@
style="height: 100%;" style="height: 100%;"
text-color="#888888" text-color="#888888"
:router=true :router=true
default-active="/filternumber"
:unique-opened=true> :unique-opened=true>
<li class="welcome"> <li class="welcome">
<i class="el-icon-people"></i> <i class="el-icon-people"></i>
<span slot="title">Welcome Vincent</span> <span slot="title">Welcome {{ currentUser }}</span>
</li> </li>
<el-menu-item v-for="item in menuItems" :key=item.index @click=routeTo :route=item.index :index=item.index> <el-menu-item v-for="item in menuItems" :key=item.index @click=routeTo :route=item.index :index=item.index>
<i :class=item.icon></i> <i :class=item.icon></i>
...@@ -60,14 +61,17 @@ import { Component, Vue } from 'vue-property-decorator'; ...@@ -60,14 +61,17 @@ import { Component, Vue } from 'vue-property-decorator';
index: '/addtask', index: '/addtask',
icon: 'el-icon-tickets', icon: 'el-icon-tickets',
}], }],
currentUser: {
username: 'wangzezhi',
},
}; };
}, },
computed: {
currentUser() {
return 'username';
},
},
methods: { methods: {
routeTo() { routeTo() {
// TODO // TODO
console.dir('in routeto');
}, },
logout() { logout() {
// TODO // TODO
......
This diff is collapsed.
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