This commit is contained in:
王创世 2024-06-12 09:26:27 +08:00
parent ffb4e76dce
commit 59070e946f
11 changed files with 100 additions and 191 deletions

View File

@ -81,6 +81,7 @@ import LogoFull from '@/assets/assets-logo-full.svg';
import Notice from './Notice.vue'; import Notice from './Notice.vue';
import Search from './Search.vue'; import Search from './Search.vue';
import MenuContent from './MenuContent.vue'; import MenuContent from './MenuContent.vue';
import {resetRouter} from "@/router";
export default Vue.extend({ export default Vue.extend({
components: { components: {
@ -170,11 +171,13 @@ export default Vue.extend({
toggleSettingPanel() { toggleSettingPanel() {
this.$store.commit('setting/toggleSettingPanel', true); this.$store.commit('setting/toggleSettingPanel', true);
}, },
handleLogout() { async handleLogout() {
this.$store.commit('user/removeAssociation'); await store.commit('user/removeAssociation');
this.$store.commit('user/removeToken'); await store.commit('user/removeToken');
this.$router.push(`/login?id=`+this.association.id); await store.commit('user/setUserInfo',[]);
this.$store.commit('user/setUserInfo',[]); this.$router.replace('/').catch(() => '');
localStorage.removeItem('reload');
this.$router.push('/login');
//this.$router.push(`/login?redirect=${this.$router.history.current.fullPath}`); //this.$router.push(`/login?redirect=${this.$router.history.current.fullPath}`);
}, },
changeCollapsed() { changeCollapsed() {

View File

@ -78,7 +78,7 @@
<t-dialog header="报名详情" :confirmBtn="null" :visible="infoMode" :onClose="onCloseMy" width="65%" top="50px"> <t-dialog header="报名详情" :confirmBtn="null" :visible="infoMode" :onClose="onCloseMy" width="65%" top="50px">
<div style="height: 600px;overflow-y: scroll;"> <div style="height: 600px;overflow-y: scroll;">
<div style="text-align: right"> <div style="text-align: right">
<t-button @click="exportList"><CloudDownloadIcon slot="icon" />导出</t-button> <t-button @click="exportList(0)"><CloudDownloadIcon slot="icon" />导出</t-button>
</div> </div>
<t-table <t-table
rowKey="index" rowKey="index"
@ -107,7 +107,12 @@
</t-dialog> </t-dialog>
<t-dialog header="问卷统计" :confirmBtn="null" :visible="QuestionnaireMode" :onClose="onCloseMy" width="65%" top="50px"> <t-dialog header="问卷统计" :confirmBtn="null" :visible="QuestionnaireMode" :onClose="onCloseMy" width="65%" top="50px">
<div style="height: 600px;overflow-y: scroll;"> <div style="height: 600px;overflow-y: scroll;">
<div style="font-size: 18px;font-weight: 600;color: #e60000;margin: 15px 0px">总参与人数1人</div> <div style="display: flex; justify-content: space-between;">
<div style="font-size: 18px;font-weight: 600;color: #e60000;margin: 15px 0px"></div>
<div>
<t-button @click="exportList(1)"><CloudDownloadIcon slot="icon" />导出</t-button>
</div>
</div>
<table class="layui-table" v-for="(item,index) in questionnaireDaAnList" style="margin: 10px 0px"> <table class="layui-table" v-for="(item,index) in questionnaireDaAnList" style="margin: 10px 0px">
<thead> <thead>
<tr> <tr>
@ -254,7 +259,7 @@
</t-form> </t-form>
</t-dialog> </t-dialog>
<t-dialog header="新增题目" :visible="questionnaireMode" :onClose="onCloseMy" @confirm="onSubmitQuestionnaire" <t-dialog header="新增题目" :visible="questionnaireAddMode" :onClose="onCloseMy" @confirm="onSubmitQuestionnaire"
width="45%" top="20px"> width="45%" top="20px">
<div style="height: 600px;overflow-y: scroll;"> <div style="height: 600px;overflow-y: scroll;">
<t-form> <t-form>
@ -435,7 +440,7 @@ export default {
} }
} }
}, },
questionnaireMode: false,// questionnaireAddMode: false,//
questionnaire: [],// questionnaire: [],//
questionnaireId:0, questionnaireId:0,
questionnaireUpdateMode:false, questionnaireUpdateMode:false,
@ -649,7 +654,7 @@ export default {
}, },
openQuestionnairefind(d) { openQuestionnairefind(d) {
this.questionnaireId=d.id; this.questionnaireId=d.id;
this.questionnaireMode = true; this.questionnaireAddMode = true;
}, },
onCurrentChangeInfo(d) { onCurrentChangeInfo(d) {
this.info_pagination.page = d; this.info_pagination.page = d;
@ -837,14 +842,20 @@ export default {
onCloseMy() { onCloseMy() {
this.addMode = false; this.addMode = false;
this.infoMode = false; this.infoMode = false;
this.questionnaireMode = false; this.questionnaireAddMode = false;
this.questionnaireUpdateMode=false; this.questionnaireUpdateMode=false;
this.QuestionnaireMode=false; this.QuestionnaireMode=false;
this.JuanMode=false; this.JuanMode=false;
}, },
exportList(){ exportList(d){
const token = store.state.user.token; const token = store.state.user.token;
if(d==0){
window.open(store.state.user.apiUrl + '/api/excel_controller/applicationexport?id='+this.infoId+"&token="+token); window.open(store.state.user.apiUrl + '/api/excel_controller/applicationexport?id='+this.infoId+"&token="+token);
}
if(d==1){
window.open(store.state.user.apiUrl + '/api/excel_controller/activityexport?id='+this.QuestionnaireModeId+"&token="+token);
}
}, },
} }
} }

View File

@ -32,8 +32,8 @@
<t-form-item label="管理员帐号" name="name"> <t-form-item label="管理员帐号" name="name">
<t-input placeholder="请输入管理员帐号" v-model="modData.zhanghu"/> <t-input placeholder="请输入管理员帐号" v-model="modData.zhanghu"/>
</t-form-item> </t-form-item>
<t-form-item label="管理员密码" name="password"> <t-form-item help="长度8位以上包含大小写英文字符数字特殊字符" label="管理员密码" name="password">
<t-input placeholder="请输入管理员密码" v-model="modData.password"/> <t-input placeholder="请输入管理员密码" type="password" v-model="modData.password"/>
</t-form-item> </t-form-item>
<t-form-item label="绑定会员" name="password"> <t-form-item label="绑定会员" name="password">
<t-select <t-select
@ -169,6 +169,12 @@ export default {
this.$message.error('请选择权限类型'); this.$message.error('请选择权限类型');
return; return;
} }
const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#_-])[A-Za-z\d@$!%*?&#_-]{8,}$/;
var pwd_check=regex.test(this.modData.password);
if(!pwd_check){
this.$message.error('密码不符合要求!');
return;
}
var url='/association/addAdmin'; var url='/association/addAdmin';
if(this.isEdit){ if(this.isEdit){
url='/association/updateAdmin'; url='/association/updateAdmin';

View File

@ -1,8 +1,8 @@
<template> <template>
<div> <div>
<t-row :gutter="[16, 16]"> <t-row :gutter="[16, 16]">
<t-col :xs="12" :xl="3"> <t-col :xs="12" :xl="6">
<t-card title="空间使用情况" :subtitle="currentMonth" class="dashboard-chart-card" :bordered="false"> <t-card title="空间使用情况" subtitle="(GB)" class="dashboard-chart-card" :bordered="false">
<div <div
id="countContainer" id="countContainer"
ref="countContainer" ref="countContainer"
@ -10,12 +10,12 @@
></div> ></div>
</t-card> </t-card>
</t-col> </t-col>
<t-col :xs="12" :xl="9"> <t-col :xs="12" :xl="6">
<t-card title="流量统计" subtitle="(GB)" class="dashboard-chart-card" :bordered="false"> <t-card title="流量统计" subtitle="(GB)" class="dashboard-chart-card" :bordered="false">
<div <div
id="monitorContainer" id="LLContainer"
ref="monitorContainer" ref="LLContainer"
:style="{ width: '100%', height: `${resizeTime * 326}px` }" :style="{ width: `${resizeTime * 326}px`, height: `${resizeTime * 326}px`, margin: '0 auto' }"
></div> ></div>
</t-card> </t-card>
</t-col> </t-col>
@ -53,13 +53,13 @@ import * as echarts from "echarts/core";
import {GridComponent} from "echarts/components"; import {GridComponent} from "echarts/components";
import {LineChart, PieChart} from "echarts/charts"; import {LineChart, PieChart} from "echarts/charts";
import {CanvasRenderer} from "echarts/renderers"; import {CanvasRenderer} from "echarts/renderers";
import { TooltipComponent, LegendComponent, GridComponent } from 'echarts/components';
echarts.use([TooltipComponent, LegendComponent, PieChart, GridComponent, LineChart, CanvasRenderer]);
echarts.use([PieChart, GridComponent, LineChart, CanvasRenderer]);
export default { export default {
data() { data() {
return { return {
resizeTime: 1, resizeTime: 1,
currentMonth: this.getThisMonth(),
subject: '', subject: '',
association: '', association: '',
pay: { pay: {
@ -67,89 +67,9 @@ export default {
appkey: '', appkey: '',
serial: '', serial: '',
}, },
dataSet: {
tooltip: {
trigger: 'item',
},
grid: {
left: '0',
right: '20px',
top: '5px',
bottom: '36px',
containLabel: true,
},
legend: {
left: 'center',
bottom: '0',
orient: 'horizontal', // legend
data: ['本月', '上月'],
textStyle: {
fontSize: 12,
color: "#000000",
},
},
xAxis: {
type: 'category',
data: ["05-20", "05-21", "05-22", "05-23", "05-24", "05-25", "05-26", "05-27", "05-28", "05-29","05-30"],
boundaryGap: false,
axisLabel: {
color: "#000000",
},
axisLine: {
lineStyle: {
width: 1,
},
},
},
yAxis: {
type: 'value',
axisLabel: {
color: "#000000",
},
splitLine: {
lineStyle: {},
},
},
series: [
{
name: '本月',
data: ["10", "93", "2", "24", "30", "68", "42", "57", "50", "23","10"],
type: 'line',
smooth: false,
showSymbol: true,
symbol: 'circle',
symbolSize: 8,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: "#0052D9",
},
},
areaStyle: {
normal: {
opacity: 0.1,
},
},
},
{
name: '上月',
data:["84", "10", "33", "24", "37", "30", "72", "1", "78", "50","10"],
type: 'line',
smooth: false,
showSymbol: true,
symbol: 'circle',
symbolSize: 8,
itemStyle: {
normal: {
borderWidth: 1,
},
},
},
],
},
One_data: { One_data: {
tooltip: { tooltip: {
show: false, show: true,
trigger: 'axis', trigger: 'axis',
position: null, position: null,
}, },
@ -185,7 +105,7 @@ export default {
label: { label: {
show: true, show: true,
position: 'center', position: 'center',
formatter: ['{value|{d}%}', '{name|{b}剩余}'].join('\n'), formatter: '{value|{d}%} \n {name|{b}剩余}',
rich: { rich: {
value: { value: {
color: "#000000", color: "#000000",
@ -201,7 +121,7 @@ export default {
}, },
}, },
labelLine: { labelLine: {
show: false, show: true,
}, },
data: [ data: [
{ {
@ -225,21 +145,7 @@ export default {
}, },
methods: { methods: {
onCurrencyChange(checkedValues) {
const {chartColors} = this.$store.state.setting;
this.currentMonth = this.getThisMonth(checkedValues);
this.monitorChart.setOption(this.dataSet);
},
renderCharts() { renderCharts() {
const {chartColors} = this.$store.state.setting;
//
if (!this.monitorContainer) {
this.monitorContainer = document.getElementById('monitorContainer');
}
this.monitorChart = echarts.init(this.monitorContainer);
this.monitorChart.setOption(this.dataSet);
// //
if (!this.countContainer) { if (!this.countContainer) {
this.countContainer = document.getElementById('countContainer'); this.countContainer = document.getElementById('countContainer');
@ -247,25 +153,17 @@ export default {
this.countChart = echarts.init(this.countContainer); this.countChart = echarts.init(this.countContainer);
const option = this.One_data; const option = this.One_data;
this.countChart.setOption(option); this.countChart.setOption(option);
},
/** 获取当前选中时间的短时间表达法 */
getThisMonth(checkedValues = '') {
let date;
if (!checkedValues || checkedValues.length === 0) {
date = new Date();
return `${date.getFullYear()}-${date.getMonth() + 1}`;
}
date = new Date(checkedValues[0]);
const date2 = new Date(checkedValues[1]);
const startMonth = date.getMonth() + 1 > 9 ? date.getMonth() + 1 : `0${date.getMonth() + 1}`;
const endMonth = date2.getMonth() + 1 > 9 ? date2.getMonth() + 1 : `0${date2.getMonth() + 1}`;
return `${date.getFullYear()}-${startMonth}${date2.getFullYear()}-${endMonth}`;
if (!this.LLContainer) {
this.LLContainer = document.getElementById('LLContainer');
}
this.LLContainer = echarts.init(this.LLContainer);
const lloption = this.One_data;
this.LLContainer.setOption(lloption);
}, },
}
} }
,
}
;
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import '@/style/variables.less'; @import '@/style/variables.less';

View File

@ -32,6 +32,15 @@ export default {
RankList, RankList,
OutputOverview, OutputOverview,
}, },
mounted() {
// var reload=localStorage.getItem('reload');
// if(!reload){
// localStorage.setItem('reload', 1);
// setTimeout(() => {
// window.location.reload();
// }, 50);
// }
},
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -120,17 +120,21 @@ export default {
console.log(e); console.log(e);
}); });
}, },
async onSubmit({ validateResult }) { onSubmit({ validateResult }) {
if (validateResult === true) { if (validateResult === true) {
this.$request this.$request
.post("/login/login",this.formData) .post("/login/login",this.formData)
.then( (res) => { .then( async (res) => {
console.log(res); console.log(res);
if(res.code === 0){ if(res.code === 0){
this.$message.error('帐号或密码错误!'); this.$message.error('帐号或密码错误!');
}else{ }else{
this.$store.dispatch('user/login', res.data); await this.$store.dispatch('user/login', res.data);
this.$message.success('登录成功'); this.$message.success('登录成功');
setTimeout(() => {
window.location.reload();
}, 0);
setTimeout(() => { setTimeout(() => {
this.$router.push('/dashboard/base'); this.$router.push('/dashboard/base');
}, 1000); }, 1000);

View File

@ -3,18 +3,12 @@ import 'nprogress/nprogress.css'; // progress bar style
import store from '@/store'; import store from '@/store';
import router from '@/router'; import router from '@/router';
NProgress.configure({ showSpinner: false });
const whiteListRouters = store.getters['permission/whiteListRouters']; const whiteListRouters = store.getters['permission/whiteListRouters'];
NProgress.configure({ showSpinner: false });
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
NProgress.start(); NProgress.start();
document.title = '智慧云商协-'+to.meta.title; document.title = '智慧云商协-'+to.meta.title;
const token = localStorage.getItem('associationToken'); const token = localStorage.getItem('associationToken');
console.log(token);
console.log(to.path);
console.log(to.path);
if(store.state.user.association!=''){ if(store.state.user.association!=''){
if(typeof (store.state.user.association)=='object'){ if(typeof (store.state.user.association)=='object'){
var association=store.state.user.association; var association=store.state.user.association;
@ -24,38 +18,35 @@ if(store.state.user.association!=''){
} }
if (token) { if (token) {
if (to.path === '/login') { if (to.path === '/login') {
next(); next('/dashboard/base');
return; return;
} }
await store.dispatch('user/getUserInfo');
await store.dispatch('permission/initRoutes', store.getters['user/roles']);
const roles = store.getters['user/roles']; const roles = store.getters['user/roles'];
console.log(roles);
if (roles && roles.length > 0) { if (roles && roles.length > 0) {
if(roles[0]==='ALL_ROUTERS'){
next();
}else{
if (roles.indexOf(to.name) !== -1) {
next(); next();
} else { } else {
try { next('/dashboard/base');
await store.dispatch('user/getUserInfo'); }
}
await store.dispatch('permission/initRoutes', store.getters['user/roles']); } else {
try {
next({ ...to }); next({ ...to , replace: true });
} catch (error) { } catch (error) {
await store.commit('user/removeToken'); await store.commit('user/removeToken');
next(`/login?id=`+association.id?association.id:1); next(`/login`);
NProgress.done();
} }
} }
} else { } else {
/* white list router */
if (whiteListRouters.indexOf(to.path) !== -1) { if (whiteListRouters.indexOf(to.path) !== -1) {
next(); next();
} else { } else {
console.log(association);
if(typeof (association)!='undefined'){
next(`/login`); next(`/login`);
}else{
next(`/login`);
}
} }
NProgress.done(); NProgress.done();
} }

View File

@ -17,19 +17,19 @@ export default [
meta: { title: '会员列表' }, meta: { title: '会员列表' },
}, },
{ {
path: 'user_plan', path: 'plan',
name: 'userPlan', name: 'userPlan',
component: () => import('@/pages/user/user_plan.vue'), component: () => import('@/pages/user/user_plan.vue'),
meta: { title: '职位管理' }, meta: { title: '职位管理' },
}, },
{ {
path: 'user_line', path: 'line',
name: 'userLine', name: 'userLine',
component: () => import('@/pages/user/user_line.vue'), component: () => import('@/pages/user/user_line.vue'),
meta: { title: '行业管理' }, meta: { title: '行业管理' },
}, },
{ {
path: 'user_region', path: 'region',
name: 'userRegion', name: 'userRegion',
component: () => import('@/pages/user/user_region.vue'), component: () => import('@/pages/user/user_region.vue'),
meta: { title: '区域管理' }, meta: { title: '区域管理' },

View File

@ -37,7 +37,6 @@ const getters = {
const actions = { const actions = {
async initRoutes({ commit }, roles) { async initRoutes({ commit }, roles) {
let accessedRouters; let accessedRouters;
// special token // special token
if (roles.includes('ALL_ROUTERS')) { if (roles.includes('ALL_ROUTERS')) {
accessedRouters = asyncRouterList; accessedRouters = asyncRouterList;

View File

@ -38,6 +38,7 @@ const getters = {
roles: (state) => state.userInfo?.roles, roles: (state) => state.userInfo?.roles,
}; };
const actions = { const actions = {
async login({commit}, userInfo) { async login({commit}, userInfo) {
const mockLogin = async (userInfo) => { const mockLogin = async (userInfo) => {
@ -51,10 +52,9 @@ const actions = {
const res = await mockLogin(userInfo); const res = await mockLogin(userInfo);
if (res.code === 200) { if (res.code === 200) {
console.log('token', userInfo.token);
commit('setToken', userInfo.token); commit('setToken', userInfo.token);
} else { } else {
return res; throw res;
} }
}, },
async getUserInfo({commit, state}) { async getUserInfo({commit, state}) {
@ -72,21 +72,11 @@ const actions = {
} else { } else {
return { return {
name: 'td_dev', name: 'td_dev',
roles: ['newsIndex', 'login', 'activityIndex', 'userEditShen', 'userIndex', 'userInfo', 'userEdit'], roles: ['DashboardBase','newsIndex', 'login', 'activityIndex', 'userEditShen', 'userIndex', 'userInfo', 'userEdit'],
}; };
} }
// if (token === 'main_token') {
// return {
// name: 'td_main',
// roles: ['ALL_ROUTERS'],
// };
// }
}; };
const res = await mockRemoteUserInfo(state.association); const res = await mockRemoteUserInfo(state.association);
commit('setUserInfo', res); commit('setUserInfo', res);
}, },
async logout({commit}) { async logout({commit}) {

View File

@ -35,8 +35,6 @@ instance.interceptors.request.use((config) => {
} }
config.data = { ...config.data, association_id: association.association_id}; config.data = { ...config.data, association_id: association.association_id};
} }
console.log(config.data);
return config; return config;
}); });