xjc 3 anni fa
parent
commit
a8ff6794d0
4 ha cambiato i file con 795 aggiunte e 407 eliminazioni
  1. 279 263
      src/api.js
  2. 148 120
      src/router.js
  3. 6 24
      src/views/comments/comments.vue
  4. 362 0
      src/views/comments/stockComments.vue

+ 279 - 263
src/api.js

@@ -2,270 +2,286 @@ import axios from 'axios';
 // var baseURL='https://www.scxjc.club'
 var baseURL = ''
 axios.interceptors.request.use(
-	config => {
-		const token = localStorage.getItem('token');
-		// if (config.url.indexOf('downloadzip') >= 0) {
-		// if (token) { // 判断是否存在token,如果存在的话,则每个http header都加上token                      
-		// 	config.headers.Authorization = `${token}`;   
-		// } else {
-		// 	//未登录
-		// 	window.location.hash = "/login";
-		// }
-		// } 
-		return config;
-	},
-	err => {
-		return Promise.reject(err);
-	});
-axios.interceptors.response.use(function (response) {
-	// console.log(response.headers)
-	// IE 8-9 
-	if (response.data == null && response.config.responseType === 'json' && response.request.responseText != null) {
-		try {
-			// eslint-disable-next-line no-param-reassign
-			response.data = JSON.parse(response.request.responseText);
-		} catch (e) {
-			// ignored
-		}
-	}
-	// 对响应数据做点什么
-	if (response.data.code == 401) {
-		// window.location.hash = "/login";
-		// window.location.hash = "/";
-	}
-	if (response.data.code == 305) {
-		// window.location.hash = "/";
-	}
-	return response;
-}, function (error) {
-	// 对响应错误做点什么
-	if (error.request.status == 403) {
-		// window.location.hash = "/login";
-		window.location.hash = "/";
-	}
-	// console.log(Object.getOwnPropertyNames(error))
-	// console.log(error.request,error.message)
-	return Promise.reject(error);
+    config => {
+        const token = localStorage.getItem('token');
+        // if (config.url.indexOf('downloadzip') >= 0) {
+        // if (token) { // 判断是否存在token,如果存在的话,则每个http header都加上token                      
+        // 	config.headers.Authorization = `${token}`;   
+        // } else {
+        // 	//未登录
+        // 	window.location.hash = "/login";
+        // }
+        // } 
+        return config;
+    },
+    err => {
+        return Promise.reject(err);
+    });
+axios.interceptors.response.use(function(response) {
+    // console.log(response.headers)
+    // IE 8-9 
+    if (response.data == null && response.config.responseType === 'json' && response.request.responseText != null) {
+        try {
+            // eslint-disable-next-line no-param-reassign
+            response.data = JSON.parse(response.request.responseText);
+        } catch (e) {
+            // ignored
+        }
+    }
+    // 对响应数据做点什么
+    if (response.data.code == 401) {
+        // window.location.hash = "/login";
+        // window.location.hash = "/";
+    }
+    if (response.data.code == 305) {
+        // window.location.hash = "/";
+    }
+    return response;
+}, function(error) {
+    // 对响应错误做点什么
+    if (error.request.status == 403) {
+        // window.location.hash = "/login";
+        window.location.hash = "/";
+    }
+    // console.log(Object.getOwnPropertyNames(error))
+    // console.log(error.request,error.message)
+    return Promise.reject(error);
 });
 export default {
-	//登录
-	login: params => {
-		return axios.post(`${baseURL}/api/account/login`, params);
-	},
-	logout: params => {
-		return axios.post(`${baseURL}/api/account/logout`, params);
-	},
-	reset: params => {
-		return axios.put(`${baseURL}/api/account/pwd/reset`, params);
-	},
-	// 全局账号信息
-	getAccountInfo: params => {
-		return axios.get(`${baseURL}/api/account/info`)
-	},
-	// 验证码
-	getCode: params => {
-		return axios.get(`${baseURL}/api/account/imgcode`)
-	},
-	// 账号
-	getUserList: params => {
-		return axios.get(`${baseURL}/api/admin/user/list`, { params: params })
-	},
-	getAllSysUserList: params => {
-		return axios.get(`${baseURL}/api/admin/user/all`, { params: params })
-	},
-	getUserinfoList: params => {
-		return axios.get(`${baseURL}/api/admin/userinfo/list`, { params: params })
-	},
-	// 获取用户待选期刊列表
-	getUserJournals: () => {
-		return axios.get(`${baseURL}/api/admin/user/journals`)
-	},
-	// 获取用户待选角色列表
-	getUserRoles: () => {
-		return axios.get(`${baseURL}/api/admin/user/roles`)
-	},
+    //登录
+    login: params => {
+        return axios.post(`${baseURL}/api/account/login`, params);
+    },
+    logout: params => {
+        return axios.post(`${baseURL}/api/account/logout`, params);
+    },
+    reset: params => {
+        return axios.put(`${baseURL}/api/account/pwd/reset`, params);
+    },
+    // 全局账号信息
+    getAccountInfo: params => {
+        return axios.get(`${baseURL}/api/account/info`)
+    },
+    // 验证码
+    getCode: params => {
+        return axios.get(`${baseURL}/api/account/imgcode`)
+    },
+    // 账号
+    getUserList: params => {
+        return axios.get(`${baseURL}/api/admin/user/list`, { params: params })
+    },
+    getAllSysUserList: params => {
+        return axios.get(`${baseURL}/api/admin/user/all`, { params: params })
+    },
+    getUserinfoList: params => {
+        return axios.get(`${baseURL}/api/admin/userinfo/list`, { params: params })
+    },
+    // 获取用户待选期刊列表
+    getUserJournals: () => {
+        return axios.get(`${baseURL}/api/admin/user/journals`)
+    },
+    // 获取用户待选角色列表
+    getUserRoles: () => {
+        return axios.get(`${baseURL}/api/admin/user/roles`)
+    },
 
-	//新增管理员
-	addUser: params => {
-		return axios.post(`${baseURL}/api/admin/user`, params);
-	},
-	// 修改管理员
-	editUser: params => {
-		return axios.put(`${baseURL}/api/admin/user`, params);
-	},
-	// 删除管理员
-	delUser: params => {
-		return axios.delete(`${baseURL}/api/admin/user`, { params: params });
-	},
-	// 删除管理员
-	getUserInfo: params => {
-		return axios.get(`${baseURL}/api/admin/user`, { params: params });
-	},
-	// 获取数据
-	getPlayerRecord: params => {
-		return axios.get(`${baseURL}/api/admin/player/record/list`, { params: params });
-	},
-	addRecord: params => {
-		return axios.post(`${baseURL}/api/admin/player/record`, params);
-	},
-	getRecordInfo: params => {
-		return axios.get(`${baseURL}/api/admin/player/record`, { params: params });
-	},
-	editRecord: params => {
-		return axios.put(`${baseURL}/api/admin/player/record`, params);
-	},
-	delRecord: params => {
-		return axios.delete(`${baseURL}/api/admin/player/record`, { params: params });
-	},
-	downloadRecords: params => {
-		return axios.get(`${baseURL}/api/admin/player/record/download`, {params: params, responseType: "blob"})
-	},
-	// 比赛搜索列表
-	getMatchList: params => {
-		return axios.get(`${baseURL}/api/admin/match/search`, { params: params })
-	},
-	// 选手列表
-	getPlayerList: params => {
-		return axios.get(`${baseURL}/api/admin/player/search`, { params: params })
-	},
-	// 分组列表
-	getGroupList: params => {
-		return axios.get(`${baseURL}/api/admin/match/group/search`, { params: params })
-	},
-	// 股票列表
-	getStockList: params => {
-		return axios.get(`${baseURL}/api/admin/stock/search`, { params: params })
-	},
-	//获取所有模板列表
-	getAllTemplateList: params => {
-		return axios.get(`${baseURL}/api/admin/message/template/all`, { params: params })
-	},
-	// 新增角色
-	addRole: params => {
-		return axios.post(`${baseURL}/api/admin/role`, params);
-	},
-	// 修改角色
-	editRole: params => {
-		return axios.put(`${baseURL}/api/admin/role`, params);
-	},
-	delRole: params => {
-		return axios.delete(`${baseURL}/api/admin/role`, { params: params });
-	},
-	// 获取角色列表
-	getRoleList: params => {
-		return axios.get(`${baseURL}/api/admin/role/list`, { params: params });
-	},
-	// 获取角色详情
-	getRoleInfo: params => {
-		return axios.get(`${baseURL}/api/admin/role`, { params: params });
-	},
-	// 选手列表
-	getPlayers: params => {
-		return axios.get(`${baseURL}/api/admin/player/list`, { params: params })
-	},
-	// 新增选手
-	addPlayer: params => {
-		return axios.post(`${baseURL}/api/admin/player`, params)
-	},
-	// 编辑选手
-	updatePlayer: params => {
-		return axios.put(`${baseURL}/api/admin/player`, params)
-	},
-	// 删除选手
-	delPlayer: params => {
-		return axios.delete(`${baseURL}/api/admin/player`, { params: params })
-	},
-	// 选手详情
-	getPlayerInfo: params => {
-		return axios.get(`${baseURL}/api/admin/player`, { params: params })
-	},
-	// 用户搜索
-	getUserSearch: params => {
-		return axios.get(`${baseURL}/api/admin/user/search`, { params: params })
-	},
-	// 赛事列表
-	getMatchs: params => {
-		return axios.get(`${baseURL}/api/admin/match/list`, { params: params })
-	},
-	// 分组管理
-	getGroups: params => {
-		return axios.get(`${baseURL}/api/admin/match/group/list`, { params: params })
-	},
-	// 新增赛事
-	addMatch: params => {
-		return axios.post(`${baseURL}/api/admin/match`, params);
-	},
-	// 修改赛事
-	updateMatch: params => {
-		return axios.put(`${baseURL}/api/admin/match`, params);
-	},
-	delMatch: params => {
-		return axios.delete(`${baseURL}/api/admin/match`, { params: params })
-	},
-	// 新增分组
-	addGroup: params => {
-		return axios.post(`${baseURL}/api/admin/match/group`, params);
-	},
-	// 修改分组
-	updateGroup: params => {
-		return axios.put(`${baseURL}/api/admin/match/group`, params);
-	},
-	delGroup: params => {
-		return axios.delete(`${baseURL}/api/admin/match/group`, { params: params });
-	},
-	// 快速新增选手
-	fastSavePlayer: params => {
-		return axios.post(`${baseURL}/api/admin/player/fast`, params);
-	},
-	// 自动填充数据
-	autoCompleteData: params => {
-		return axios.post(`${baseURL}/api/admin/player/autorecord`, params);
-	},
-	// 文章
-	addArticle: params => {
-		return axios.post(`${baseURL}/api/admin/article`, params);
-	},
-	editArticle: params => {
-		return axios.put(`${baseURL}/api/admin/article`, params);
-	},
-	delArticle: params => {
-		return axios.delete(`${baseURL}/api/admin/article`, { params: params });
-	},
-	getArticleById: params => {
-		return axios.get(`${baseURL}/api/admin/article`, { params: params })
-	},
-	getArticleList: params => {
-		return axios.get(`${baseURL}/api/admin/article/list`, { params: params })
-	},
-	// 更新排名
-	updateRank: params => {
-		return axios.get(`${baseURL}/api/admin/flushrank`, { params: params })
-	},
-	updateComment: params => {
-		return axios.put(`${baseURL}/api/admin/player/record/comment`, params);
-	},
-	// 股票
-	getStockList: params => {
-		return axios.get(`${baseURL}/api/admin/stock/list`, { params: params })
-	},
-	getStockInfo: params => {
-		return axios.get(`${baseURL}/api/admin/stock`, { params: params })
-	},
-	updateStock: params => {
-		return axios.put(`${baseURL}/api/admin/stock`, params)
-	},
-	addStock: params => {
-		return axios.post(`${baseURL}/api/admin/stock`, params)
-	},
-	delStock: params => {
-		return axios.delete(`${baseURL}/api/admin/stock`, { params: params });
-	},
-	// 重置选手初始资金
-	resetInitFund: params => {
-		return axios.post(`${baseURL}/api/admin/reset/initfund`, params)
-	},
-	// 订单列表
-	getSignupList: params => {
-		return axios.get(`${baseURL}/api/admin/signup/list`, { params: params })
-	},
+    //新增管理员
+    addUser: params => {
+        return axios.post(`${baseURL}/api/admin/user`, params);
+    },
+    // 修改管理员
+    editUser: params => {
+        return axios.put(`${baseURL}/api/admin/user`, params);
+    },
+    // 删除管理员
+    delUser: params => {
+        return axios.delete(`${baseURL}/api/admin/user`, { params: params });
+    },
+    // 删除管理员
+    getUserInfo: params => {
+        return axios.get(`${baseURL}/api/admin/user`, { params: params });
+    },
+    // 获取数据
+    getPlayerRecord: params => {
+        return axios.get(`${baseURL}/api/admin/player/record/list`, { params: params });
+    },
+    addRecord: params => {
+        return axios.post(`${baseURL}/api/admin/player/record`, params);
+    },
+    getRecordInfo: params => {
+        return axios.get(`${baseURL}/api/admin/player/record`, { params: params });
+    },
+    editRecord: params => {
+        return axios.put(`${baseURL}/api/admin/player/record`, params);
+    },
+    delRecord: params => {
+        return axios.delete(`${baseURL}/api/admin/player/record`, { params: params });
+    },
+    downloadRecords: params => {
+        return axios.get(`${baseURL}/api/admin/player/record/download`, { params: params, responseType: "blob" })
+    },
+    // 比赛搜索列表
+    getMatchList: params => {
+        return axios.get(`${baseURL}/api/admin/match/search`, { params: params })
+    },
+    // 选手列表
+    getPlayerList: params => {
+        return axios.get(`${baseURL}/api/admin/player/search`, { params: params })
+    },
+    // 分组列表
+    getGroupList: params => {
+        return axios.get(`${baseURL}/api/admin/match/group/search`, { params: params })
+    },
+    // 股票列表
+    getStockList: params => {
+        return axios.get(`${baseURL}/api/admin/stock/search`, { params: params })
+    },
+    //获取所有模板列表
+    getAllTemplateList: params => {
+        return axios.get(`${baseURL}/api/admin/message/template/all`, { params: params })
+    },
+    // 新增角色
+    addRole: params => {
+        return axios.post(`${baseURL}/api/admin/role`, params);
+    },
+    // 修改角色
+    editRole: params => {
+        return axios.put(`${baseURL}/api/admin/role`, params);
+    },
+    delRole: params => {
+        return axios.delete(`${baseURL}/api/admin/role`, { params: params });
+    },
+    // 获取角色列表
+    getRoleList: params => {
+        return axios.get(`${baseURL}/api/admin/role/list`, { params: params });
+    },
+    // 获取角色详情
+    getRoleInfo: params => {
+        return axios.get(`${baseURL}/api/admin/role`, { params: params });
+    },
+    // 选手列表
+    getPlayers: params => {
+        return axios.get(`${baseURL}/api/admin/player/list`, { params: params })
+    },
+    // 新增选手
+    addPlayer: params => {
+        return axios.post(`${baseURL}/api/admin/player`, params)
+    },
+    // 编辑选手
+    updatePlayer: params => {
+        return axios.put(`${baseURL}/api/admin/player`, params)
+    },
+    // 删除选手
+    delPlayer: params => {
+        return axios.delete(`${baseURL}/api/admin/player`, { params: params })
+    },
+    // 选手详情
+    getPlayerInfo: params => {
+        return axios.get(`${baseURL}/api/admin/player`, { params: params })
+    },
+    // 用户搜索
+    getUserSearch: params => {
+        return axios.get(`${baseURL}/api/admin/user/search`, { params: params })
+    },
+    // 赛事列表
+    getMatchs: params => {
+        return axios.get(`${baseURL}/api/admin/match/list`, { params: params })
+    },
+    // 分组管理
+    getGroups: params => {
+        return axios.get(`${baseURL}/api/admin/match/group/list`, { params: params })
+    },
+    // 新增赛事
+    addMatch: params => {
+        return axios.post(`${baseURL}/api/admin/match`, params);
+    },
+    // 修改赛事
+    updateMatch: params => {
+        return axios.put(`${baseURL}/api/admin/match`, params);
+    },
+    delMatch: params => {
+        return axios.delete(`${baseURL}/api/admin/match`, { params: params })
+    },
+    // 新增分组
+    addGroup: params => {
+        return axios.post(`${baseURL}/api/admin/match/group`, params);
+    },
+    // 修改分组
+    updateGroup: params => {
+        return axios.put(`${baseURL}/api/admin/match/group`, params);
+    },
+    delGroup: params => {
+        return axios.delete(`${baseURL}/api/admin/match/group`, { params: params });
+    },
+    // 快速新增选手
+    fastSavePlayer: params => {
+        return axios.post(`${baseURL}/api/admin/player/fast`, params);
+    },
+    // 自动填充数据
+    autoCompleteData: params => {
+        return axios.post(`${baseURL}/api/admin/player/autorecord`, params);
+    },
+    // 文章
+    addArticle: params => {
+        return axios.post(`${baseURL}/api/admin/article`, params);
+    },
+    editArticle: params => {
+        return axios.put(`${baseURL}/api/admin/article`, params);
+    },
+    delArticle: params => {
+        return axios.delete(`${baseURL}/api/admin/article`, { params: params });
+    },
+    getArticleById: params => {
+        return axios.get(`${baseURL}/api/admin/article`, { params: params })
+    },
+    getArticleList: params => {
+        return axios.get(`${baseURL}/api/admin/article/list`, { params: params })
+    },
+    // 更新排名
+    updateRank: params => {
+        return axios.get(`${baseURL}/api/admin/flushrank`, { params: params })
+    },
+    updateComment: params => {
+        return axios.put(`${baseURL}/api/admin/player/record/comment`, params);
+    },
+    // 股票
+    getStockList: params => {
+        return axios.get(`${baseURL}/api/admin/stock/list`, { params: params })
+    },
+    getStockInfo: params => {
+        return axios.get(`${baseURL}/api/admin/stock`, { params: params })
+    },
+    updateStock: params => {
+        return axios.put(`${baseURL}/api/admin/stock`, params)
+    },
+    addStock: params => {
+        return axios.post(`${baseURL}/api/admin/stock`, params)
+    },
+    delStock: params => {
+        return axios.delete(`${baseURL}/api/admin/stock`, { params: params });
+    },
+    // 重置选手初始资金
+    resetInitFund: params => {
+        return axios.post(`${baseURL}/api/admin/reset/initfund`, params)
+    },
+    // 订单列表
+    getSignupList: params => {
+        return axios.get(`${baseURL}/api/admin/signup/list`, { params: params })
+    },
+    // 股票评论
+    getStockCommentsList: params => {
+        return axios.get(`${baseURL}/api/admin/stock/comments/list`, { params: params })
+    },
+    // 作业评论
+    getRecordCommentsList: params => {
+        return axios.get(`${baseURL}/api/admin/record/comments/list`, { params: params })
+    },
+    // 顽主咨询
+    getWanzhuConsultList: params => {
+        return axios.get(`${baseURL}/api/admin/consult/list`, { params: params })
+    },
+    // 顽主咨询详情
+    getWanzhuConsultDetail: params => {
+        return axios.get(`${baseURL}/api/admin/consult`, { params: params })
+    },
 }

+ 148 - 120
src/router.js

@@ -3,126 +3,154 @@ import Router from 'vue-router'
 
 Vue.use(Router)
 export default new Router({
-  routes: [{
-      path: '/',
-      name: 'login',
-      component: () => import('./views/Login.vue'),
-      show: 0,
-    },
-    {
-      path: '/data',
-      name: '参赛数据',
-      icon: 'el-icon-pie-chart',
-      component: () => import('./views/Home.vue'),
-      show: 1,
-      isLeaf: 0,
-      children: [{
-        path: '/data',
-        component: () => import('./views/data/index.vue'),
-        name: '数据统计'
-      }, ]
-    },
-    {
-      path: '/signup',
-      name: '报名管理',
-      icon: 'el-icon-pie-chart',
-      component: () => import('./views/Home.vue'),
-      show: 1,
-      isLeaf: 0,
-      children: [{
-        path: '/signup/list',
-        component: () => import('./views/signup/index.vue'),
-        name: '订单管理'
-      }, ]
-    },
-    {
-      path: '/comments',
-      name: '咨询/评论',
-      icon: 'el-icon-pie-chart',
-      component: () => import('./views/Home.vue'),
-      show: 1,
-      isLeaf: 0,
-      children: [{
-        path: '/comments/list',
-        component: () => import('./views/comments/comments.vue'),
-        name: '评论管理'}, 
+    routes: [{
+            path: '/',
+            name: 'login',
+            component: () =>
+                import ('./views/Login.vue'),
+            show: 0,
+        },
         {
-          path: '/consult/list',
-          component: () => import('./views/comments/consult.vue'),
-          name: '顽主咨询'}
-      ]
-    },
-    {
-      path: '/match',
-      name: '赛事管理',
-      icon: 'el-icon-trophy-1',
-      component: () => import('./views/Home.vue'),
-      show: 1,
-      isLeaf: 0,
-      children: [{
-        path: '/match',
-        component: () => import('./views/match/index.vue'),
-        name: '赛事管理'
-      },{
-        path: '/group',
-        component: () => import('./views/match/group.vue'),
-        name: '赛事分组'
-      },{
-        path: '/notice',
-        component: () => import('./views/match/notice.vue'),
-        name: '赛事公告'
-      },
-      {
-        path: '/addNotice',
-        component: () => import('./views/match/addArticle.vue'),
-        name: '新增公告',
-        hide:1,
-        isLeaf:1
-      },
-      {
-        path: '/championsay',
-        component: () => import('./views/match/championSay.vue'),
-        name: '冠军心得'
-      },
-      {
-        path: '/addChampionSay',
-        component: () => import('./views/match/addChampionSay.vue'),
-        name: '新增冠军心得',
-        hide:1,
-        isLeaf:1
-      },
-      {
-        path: '/stock',
-        component: () => import('./views/match/stock.vue'),
-        name: '股票仓库'
-      }
+            path: '/data',
+            name: '参赛数据',
+            icon: 'el-icon-pie-chart',
+            component: () =>
+                import ('./views/Home.vue'),
+            show: 1,
+            isLeaf: 0,
+            children: [{
+                path: '/data',
+                component: () =>
+                    import ('./views/data/index.vue'),
+                name: '数据统计'
+            }, ]
+        },
+        {
+            path: '/signup',
+            name: '报名管理',
+            icon: 'el-icon-pie-chart',
+            component: () =>
+                import ('./views/Home.vue'),
+            show: 1,
+            isLeaf: 0,
+            children: [{
+                path: '/signup/list',
+                component: () =>
+                    import ('./views/signup/index.vue'),
+                name: '订单管理'
+            }, ]
+        },
+        {
+            path: '/comments',
+            name: '咨询/评论',
+            icon: 'el-icon-pie-chart',
+            component: () =>
+                import ('./views/Home.vue'),
+            show: 1,
+            isLeaf: 0,
+            children: [{
+                    path: '/stock/comments/list',
+                    component: () =>
+                        import ('./views/comments/stockComments.vue'),
+                    name: '股票评论'
+                },
+                {
+                    path: '/record/comments/list',
+                    component: () =>
+                        import ('./views/comments/recordComments.vue'),
+                    name: '作业评论'
+                },
+                {
+                    path: '/consult/list',
+                    component: () =>
+                        import ('./views/comments/consult.vue'),
+                    name: '顽主咨询'
+                }
+            ]
+        },
+        {
+            path: '/match',
+            name: '赛事管理',
+            icon: 'el-icon-trophy-1',
+            component: () =>
+                import ('./views/Home.vue'),
+            show: 1,
+            isLeaf: 0,
+            children: [{
+                    path: '/match',
+                    component: () =>
+                        import ('./views/match/index.vue'),
+                    name: '赛事管理'
+                }, {
+                    path: '/group',
+                    component: () =>
+                        import ('./views/match/group.vue'),
+                    name: '赛事分组'
+                }, {
+                    path: '/notice',
+                    component: () =>
+                        import ('./views/match/notice.vue'),
+                    name: '赛事公告'
+                },
+                {
+                    path: '/addNotice',
+                    component: () =>
+                        import ('./views/match/addArticle.vue'),
+                    name: '新增公告',
+                    hide: 1,
+                    isLeaf: 1
+                },
+                {
+                    path: '/championsay',
+                    component: () =>
+                        import ('./views/match/championSay.vue'),
+                    name: '冠军心得'
+                },
+                {
+                    path: '/addChampionSay',
+                    component: () =>
+                        import ('./views/match/addChampionSay.vue'),
+                    name: '新增冠军心得',
+                    hide: 1,
+                    isLeaf: 1
+                },
+                {
+                    path: '/stock',
+                    component: () =>
+                        import ('./views/match/stock.vue'),
+                    name: '股票仓库'
+                }
+            ]
+        },
+        {
+            path: '/player',
+            name: '选手管理',
+            icon: 'el-icon-trophy-1',
+            component: () =>
+                import ('./views/Home.vue'),
+            show: 1,
+            isLeaf: 0,
+            children: [{
+                path: '/player',
+                component: () =>
+                    import ('./views/player/index.vue'),
+                name: '参赛选手'
+            }]
+        },
+        {
+            path: '/user',
+            name: '用户管理',
+            icon: 'el-icon-s-tools',
+            component: () =>
+                import ('./views/Home.vue'),
+            show: 1,
+            isLeaf: 1,
+            children: [{
+                path: '/user',
+                component: () =>
+                    import ('./views/user/index.vue'),
+                name: '用户管理'
+            }, ]
+        },
     ]
-    },
-    {
-      path: '/player',
-      name: '选手管理',
-      icon: 'el-icon-trophy-1',
-      component: () => import('./views/Home.vue'),
-      show: 1,
-      isLeaf: 0,
-      children: [{
-        path: '/player',
-        component: () => import('./views/player/index.vue'),
-        name: '参赛选手'
-      } ]
-    },
-    {
-      path: '/user',
-      name: '用户管理',
-      icon: 'el-icon-s-tools',
-      component: () => import('./views/Home.vue'),
-      show: 1,
-      isLeaf: 1,
-      children: [{
-        path: '/user',
-        component: () => import('./views/user/index.vue'),
-        name: '用户管理'
-      }, ]
-    },
-  ]
 })

+ 6 - 24
src/views/comments/comments.vue

@@ -11,7 +11,7 @@
 </style>
 <template>
     <section class="content data">
-        <h4>评论管理</h4>
+        <h4>作业评论</h4>
         <el-divider></el-divider>
         <el-form label-width="80px" class="filter-form">
             <el-row>
@@ -40,31 +40,13 @@
         </el-form>
         <el-table :data="list" height='55vh' style="width: 100%;margin-top:10px;" v-loading='loading'>
                 <el-table-column prop="user_name" label="选手名称"/>
-                <el-table-column prop="user_phone" label="手机号"/>
-                <el-table-column prop="match_name" label="报名赛事"/>
-                <el-table-column prop="signup_type" label="报名类型">
+                <el-table-column prop="content" label="评论内容"/>
+                <el-table-column prop="scope_info" label="作业">
                     <template slot-scope="scope">
-                        <span v-if="scope.row.signup_type==2" style="color:red;">选手</span>
-                        <span v-else>游客</span>
+                        <span>{{scope.row.record_info.username}}-{{scope.row.record_info.stock_date}}</span>
                     </template>
                 </el-table-column>
-                <el-table-column prop="total_fee" label="报名费用"/>
-                <el-table-column prop="order_status" label="订单状态" width="150">
-                    <template slot-scope="scope">
-                        <!-- <span v-if="scope.row.order_status==1" style="color:#67c23a;">已支付</span> -->
-                        <el-button v-if="scope.row.order_status==1" type="success" size="mini">已支付</el-button>
-                        <span v-else>未支付</span>
-                    </template>
-                </el-table-column>
-                <el-table-column prop="pay_status" label="支付状态" width="150">
-                    <template slot-scope="scope">
-                        <!-- <span v-if="scope.row.pay_status==1" class="color:green;">已支付</span> -->
-                        <el-button v-if="scope.row.order_status==1" type="success" size="mini">已支付</el-button>
-                        <span v-else>未支付</span>
-                    </template>
-                </el-table-column>
-                <el-table-column prop="pay_time" label="支付时间" width="160" show-overflow-tooltip />
-                <el-table-column prop="ctime" label="下单时间" width="160"/>
+                <el-table-column prop="ctime" label="评论时间" width="160"/>
                 <el-table-column prop="date" label="操作" fixed="right" width="220">
                     <template slot-scope="scope">
                         <el-button @click="edit(scope.row.id)" size="mini" type="warning">编辑</el-button>
@@ -288,7 +270,7 @@ export default {
         },
         getData(){
             this.loading = true;
-            this.$api.getSignupList(this.queryParams).then(res=>{
+            this.$api.getRecordCommentsList(this.queryParams).then(res=>{
                 this.list=res.data.data.list
                 this.total = res.data.data.total;
                 this.loading = false;

+ 362 - 0
src/views/comments/stockComments.vue

@@ -0,0 +1,362 @@
+<style lang="scss">
+    .del{
+            display: inline-block;
+            vertical-align: top;
+            font-size: 28px;
+            font-weight: 500;
+            margin-left: 10px;
+            color: #000;
+            cursor: pointer;
+    }
+</style>
+<template>
+    <section class="content data">
+        <h4>股票评论</h4></h4>
+        <el-divider></el-divider>
+        <el-form label-width="80px" class="filter-form">
+            <el-row>
+                <el-col :span="3">
+                    <el-form-item label="选手名字">
+                        <el-input clearable @clear="getData()" v-model="queryParams.user_name" placeholder="请输入选手名字/代码" size="mini"></el-input>
+                    </el-form-item>
+                </el-col>
+                <el-col :span="4">
+                    <el-form-item label="股票名称">
+                        <el-input clearable @clear="getData()" v-model="queryParams.stock_name" placeholder="请输入股票名称/代码" size="mini"></el-input>
+                    </el-form-item>
+                </el-col>
+                <el-col :span="4">
+                    <el-form-item style="margin-left:10px;" label-width="10">
+                        <el-button type="primary" @click="getData" size="mini">筛选</el-button>
+                        <el-button type="normal" @click="queryParams={},getData()" size="mini">重置</el-button>
+                    </el-form-item>
+                </el-col>
+            </el-row>
+            <el-row :gutter="10">
+                <el-col :span="6"></el-col>
+            </el-row>
+        </el-form>
+        <el-table :data="list" height='55vh' style="width: 100%;margin-top:10px;" v-loading='loading'>
+                <el-table-column prop="user_name" label="选手名称"/>
+                <el-table-column prop="content" label="评论内容"/>
+                <el-table-column prop="stock_name" label="股票名称"/>
+                <el-table-column prop="ctime" label="评论时间" width="160"/>
+                <el-table-column prop="date" label="操作" fixed="right" width="220">
+                    <template slot-scope="scope">
+                        <el-button @click="edit(scope.row.id)" size="mini" type="warning">编辑</el-button>
+                        <el-button @click="del(scope.row.id)" size="mini" type="danger">删除</el-button>
+                    </template>
+                </el-table-column>
+        </el-table>
+        <Page
+            ref="pageButton"
+            :current="form.page"
+            :page_size="form.page_size"
+            :total="total"
+            @pageChange="gopage"
+        />
+        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+            <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+                <el-form-item label="赛事名称" prop="match_id">
+                        <el-select v-model="form.match_id" placeholder="请选择比赛">
+                            <el-option v-for="item in matchList" :key='item.id' :label="item.name" :value="item.id"></el-option>
+                        </el-select>
+                </el-form-item>
+                <el-form-item label="参赛选手" prop="player_id">
+                    <el-select filterable v-model="form.player_id" placeholder="请选择用户代码">
+                        <el-option v-for="item in playerList" :key='item.id' :label="item.label" :value="item.id"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="持仓日期" prop="stock_date">
+                        <el-date-picker
+                        v-model="form.stock_date"
+                        type="date" style="width:100%"
+                        placeholder="选择日期"
+                        format="yyyy-MM-dd"
+                        value-format="yyyy-MM-dd">
+                        </el-date-picker>
+                </el-form-item>
+                <el-form-item label="今日资产" prop="today_fund">
+                    <el-input clearable v-model="form.today_fund" placeholder="请输入今日资产" type="number">
+                        <template slot="append">万元</template>
+                    </el-input>
+                </el-form-item>
+                <el-form-item v-if="form.id" label="昨日资产" prop="yesterday_fund">
+                    <el-input clearable v-model="form.yesterday_fund" placeholder="请输入昨日资产" type="number">
+                        <template slot="append">万元</template>
+                    </el-input>
+                </el-form-item>
+                <el-form-item v-if="form.id" label="初始资产" prop="init_fund">
+                    <el-input clearable v-model="form.init_fund" placeholder="请输入初始资产" type="number">
+                        <template slot="append">万元</template>
+                    </el-input>
+                </el-form-item>
+                <el-form-item label="开超市" prop="is_markt">
+                    <el-switch
+                        v-model="form.is_markt">
+                    </el-switch>
+                </el-form-item>
+                <el-form-item label="股票名称" prop="today_stock">
+                    <div v-for="(item,index) in form.today_stock" :key='index' style="margin-bottom:5px;">
+                        <!-- <el-select  filterable v-model="item.name" placeholder="请选择股票" style="width:48%;display:inline-block">
+                            <el-option v-for="item in stockList" :key='item.id' :label="item.label" :value="item.label"></el-option>
+                        </el-select> -->
+                        <el-input style="width:48%;display:inline-block" v-model="item.name" placeholder="请输入股票名称" :disabled="form.is_markt==true"></el-input>
+                        &nbsp;<el-input style="width:39%" clearable v-model="item.fund" placeholder="资金" :disabled="form.is_markt==true">
+                            <template slot="append">万元</template>
+                        </el-input>
+                        <i @click="form.today_stock.splice(index,1)" style="margin-top:5px;" class="el-icon-circle-close del"></i>
+                    </div>
+                    <el-button @click="addCode" type="primary" size="small" plain>新增股票</el-button>
+                </el-form-item>
+                <el-form-item label="股票截图" prop="today_stock_img">
+                    <div class="imgs" v-for="(item,index) in form.today_stock_img" :key='index'>
+                        <img  width="150" :src="item" alt="">
+                        <i @click="form.today_stock_img.splice(index,1)" class="el-icon-circle-close del"></i>
+                    </div>
+                    <el-upload
+                        class="upload-demo"
+                        :show-file-list	='false'
+                        :on-success="handleSuccess"
+                        action="/api/admin/uploadfile">
+                        <el-button size="small" type="primary" plain>上传股票截图</el-button>
+                    </el-upload>
+                </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="submitForm">确 定</el-button>
+                <el-button @click="open=false">取 消</el-button>
+            </div>
+        </el-dialog>
+        <!-- 点评 -->
+        <el-dialog :title="title" :visible.sync="open1" width="500px" append-to-body>
+            <el-form ref="form1" :model="form1" label-width="80px">
+                <el-form-item label="顽主点评">
+                    <el-input v-model="form1.wanzhu_comment" placeholder="" type="textarea" rows="10"></el-input>
+                </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="saveComment" size="mini">确 定</el-button>
+                <el-button @click="open1=false" size="mini">取 消</el-button>
+            </div>
+        </el-dialog>
+    </section>
+</template>
+<script>
+import Page from "../../components/Page";
+export default {
+    components: {
+        Page,
+    },
+    data(){
+        return{
+            loading:false,
+            queryParams:{
+                match_id:0,
+                page:1,
+                stock_date:this.getNowDate()
+            },
+            form:{
+                stock_date:this.getNowDate()
+            },
+            form1:{},
+            list:[{},{}],
+            total:0,
+            title:'新增用户',
+            open:false,
+            open1:false,
+            rules:{
+                match_id: [
+                    { required: true, message: '请选择比赛', trigger: 'change' }
+                ],
+                player_id: [
+                    { required: true, message: '请输入用户代码', trigger: 'blur' }
+                ],
+                stock_date: [
+                    { required: true, message: '请选择持仓日期', trigger: 'blur' }
+                ],
+                today_fund: [
+                    { required: true, message: '请输入今日资产', trigger: 'blur' }
+                ],
+                is_markt: [
+                    { required: false, message: '请选择', trigger: 'change' }
+                ]
+            },
+            matchList:[],
+            playerList:[],
+            groupList:[],
+            stockList:[],
+            missDayList:[
+                {id:0,name:"否"},
+                {id:1,name:"是"}
+            ],
+            orderStatusList:[
+                {id:0,name:"未支付"},
+                {id:1,name:"已支付"}
+            ],
+            signupTypeList:[
+                {id:1,name:"选手"},
+                {id:2,name:"游客"}
+            ]
+        }
+    },
+    methods:{
+        updateRank(){
+            this.loading = true
+            this.$api.updateRank(this.queryParams).then((res)=>{
+                this.loading = false
+                this.$message({
+                    message: "更新成功!",
+                    type: "success",
+                });
+            })
+        },
+        getNowDate(){
+            var y=new Date().getFullYear() 
+            var m=Number(new Date().getMonth() + 1)
+            var d = new Date().getDate()
+            m=m>9?m:'0'+m;
+            d=d>9?d:'0'+d
+            return y+'-'+m+'-'+d;
+        },
+        autoCompleteData(){
+            this.loading = true
+            this.$api.autoCompleteData(this.queryParams).then((res)=>{
+                this.getData();
+                this.loading = false;
+            })
+        },
+        downloadExcel(){
+            this.$api.downloadRecords(this.queryParams).then((res)=>{
+                var elink = document.createElement('a');
+                let blob=new Blob([res.data], {type: 'application/vnd.ms-excel,charset=UTF-8'});
+                let objUrl=URL.createObjectURL(blob);
+                let file_name=decodeURIComponent(res.headers['content-disposition'].split('=')[1]);
+                console.log(file_name)
+                elink.download = "参赛数据";
+                elink.style.display = 'none';                
+                elink.href = objUrl;
+                document.body.appendChild(elink);
+                elink.click();
+                document.body.removeChild(elink);      
+                this.download_loading = false;
+            })
+        },
+        del(id) {
+        this.$confirm("确定删除吗?", "提示", {
+            type: "warning",
+        }).then(() => {
+            this.$api.delRecord({ id: id }).then((res) => {
+            this.$message({
+                message: "删除成功",
+                type: "success",
+            });
+            this.getData();
+            });
+        });
+        },
+        gopage(size) {
+            if (size) {
+                this.queryParams.page_size = size;
+            }
+            this.queryParams.page = this.$refs.pageButton.page;
+            this.getData();
+        },
+        getData(){
+            this.loading = true;
+            this.$api.getStockCommentsList(this.queryParams).then(res=>{
+                this.list=res.data.data.list
+                this.total = res.data.data.total;
+                this.loading = false;
+            })
+        },
+        edit(id){
+            this.title = "编辑数据"
+            this.$api.getRecordInfo({id:id}).then(res=>{
+                this.form = res.data.data
+                this.open = true
+            })
+        },
+        editComment(id){
+            this.title = "顽主点评"
+            this.$api.getRecordInfo({id:id}).then(res=>{
+                this.form1 = res.data.data
+                this.open1 = true
+            })
+        },
+        saveComment(){
+            this.$api.updateComment({id:this.form1.id,wanzhu_comment:this.form1.wanzhu_comment}).then(response => {
+                if(response.data.code != 0){
+                    this.msgError(response.data.message);
+                    return
+                }
+                this.msgSuccess("修改成功");
+                this.open1 = false;
+                this.getData();
+            });
+        },
+        handleAdd(){
+            this.open=true;
+            this.title='新增数据';
+            this.form={
+                match_id:this.matchList[0].id,
+                today_stock:[{code: "", name:"",fund:''}],
+                today_stock_img:[],
+                stock_date:this.getNowDate()
+            }
+        },
+        addCode(){
+             this.form.today_stock.push({code: "", name:"",fund:''})
+        },
+        handleSuccess(res, file) {
+            console.log(res)
+            this.form.today_stock_img.push(res.data.url);
+        },
+        /** 提交按钮 */
+        submitForm() {
+            console.log(this.form)
+            this.$refs["form"].validate(valid => {
+                if (valid) {
+                // if(this.form.today_stock.length<=0){
+                //     this.msgError('请添加股票');
+                //     return
+                // }else{
+                //     if((!this.form.today_stock[0].name || !this.form.today_stock[0].fund) && !this.form.is_markt){
+                //         this.msgError('请选择股票并输入资金额');
+                //         return
+                //     }
+                // }
+                if (this.form.id != null) {
+                    this.$api.editRecord(this.form).then(response => {
+                        if(response.data.code != 0){
+                            this.msgError(response.data.message);
+                            return
+                        }
+                        this.msgSuccess("修改成功");
+                        this.open = false;
+                        this.getData();
+                    });
+                } else {
+                    this.$api.addRecord(this.form).then(response => {
+                        if(response.data.code != 0){
+                            this.msgError(response.data.message);
+                            return
+                        }
+                        this.msgSuccess("新增成功");
+                        this.open = false;
+                        this.getData();
+                    });
+                }
+        }
+      });
+    },
+    },
+    created(){
+       this.$api.getMatchList().then(res=>{
+           this.matchList=res.data.data
+           this.queryParams.match_id = this.matchList[0].id
+           this.getData()
+       })
+    }
+}
+</script>