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 Search from './Search.vue';
import MenuContent from './MenuContent.vue';
import {resetRouter} from "@/router";
export default Vue.extend({
components: {
@ -170,11 +171,13 @@ export default Vue.extend({
toggleSettingPanel() {
this.$store.commit('setting/toggleSettingPanel', true);
},
handleLogout() {
this.$store.commit('user/removeAssociation');
this.$store.commit('user/removeToken');
this.$router.push(`/login?id=`+this.association.id);
this.$store.commit('user/setUserInfo',[]);
async handleLogout() {
await store.commit('user/removeAssociation');
await store.commit('user/removeToken');
await 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}`);
},
changeCollapsed() {

View File

@ -78,7 +78,7 @@
<t-dialog header="报名详情" :confirmBtn="null" :visible="infoMode" :onClose="onCloseMy" width="65%" top="50px">
<div style="height: 600px;overflow-y: scroll;">
<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>
<t-table
rowKey="index"
@ -107,7 +107,12 @@
</t-dialog>
<t-dialog header="问卷统计" :confirmBtn="null" :visible="QuestionnaireMode" :onClose="onCloseMy" width="65%" top="50px">
<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">
<thead>
<tr>
@ -254,7 +259,7 @@
</t-form>
</t-dialog>
<t-dialog header="新增题目" :visible="questionnaireMode" :onClose="onCloseMy" @confirm="onSubmitQuestionnaire"
<t-dialog header="新增题目" :visible="questionnaireAddMode" :onClose="onCloseMy" @confirm="onSubmitQuestionnaire"
width="45%" top="20px">
<div style="height: 600px;overflow-y: scroll;">
<t-form>
@ -435,7 +440,7 @@ export default {
}
}
},
questionnaireMode: false,//
questionnaireAddMode: false,//
questionnaire: [],//
questionnaireId:0,
questionnaireUpdateMode:false,
@ -649,7 +654,7 @@ export default {
},
openQuestionnairefind(d) {
this.questionnaireId=d.id;
this.questionnaireMode = true;
this.questionnaireAddMode = true;
},
onCurrentChangeInfo(d) {
this.info_pagination.page = d;
@ -837,14 +842,20 @@ export default {
onCloseMy() {
this.addMode = false;
this.infoMode = false;
this.questionnaireMode = false;
this.questionnaireAddMode = false;
this.questionnaireUpdateMode=false;
this.QuestionnaireMode=false;
this.JuanMode=false;
},
exportList(){
exportList(d){
const token = store.state.user.token;
if(d==0){
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-input placeholder="请输入管理员帐号" v-model="modData.zhanghu"/>
</t-form-item>
<t-form-item label="管理员密码" name="password">
<t-input placeholder="请输入管理员密码" v-model="modData.password"/>
<t-form-item help="长度8位以上包含大小写英文字符数字特殊字符" label="管理员密码" name="password">
<t-input placeholder="请输入管理员密码" type="password" v-model="modData.password"/>
</t-form-item>
<t-form-item label="绑定会员" name="password">
<t-select
@ -169,6 +169,12 @@ export default {
this.$message.error('请选择权限类型');
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';
if(this.isEdit){
url='/association/updateAdmin';

View File

@ -1,8 +1,8 @@
<template>
<div>
<t-row :gutter="[16, 16]">
<t-col :xs="12" :xl="3">
<t-card title="空间使用情况" :subtitle="currentMonth" class="dashboard-chart-card" :bordered="false">
<t-col :xs="12" :xl="6">
<t-card title="空间使用情况" subtitle="(GB)" class="dashboard-chart-card" :bordered="false">
<div
id="countContainer"
ref="countContainer"
@ -10,12 +10,12 @@
></div>
</t-card>
</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">
<div
id="monitorContainer"
ref="monitorContainer"
:style="{ width: '100%', height: `${resizeTime * 326}px` }"
id="LLContainer"
ref="LLContainer"
:style="{ width: `${resizeTime * 326}px`, height: `${resizeTime * 326}px`, margin: '0 auto' }"
></div>
</t-card>
</t-col>
@ -53,13 +53,13 @@ import * as echarts from "echarts/core";
import {GridComponent} from "echarts/components";
import {LineChart, PieChart} from "echarts/charts";
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 {
data() {
return {
resizeTime: 1,
currentMonth: this.getThisMonth(),
subject: '',
association: '',
pay: {
@ -67,89 +67,9 @@ export default {
appkey: '',
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: {
tooltip: {
show: false,
show: true,
trigger: 'axis',
position: null,
},
@ -185,7 +105,7 @@ export default {
label: {
show: true,
position: 'center',
formatter: ['{value|{d}%}', '{name|{b}剩余}'].join('\n'),
formatter: '{value|{d}%} \n {name|{b}剩余}',
rich: {
value: {
color: "#000000",
@ -201,7 +121,7 @@ export default {
},
},
labelLine: {
show: false,
show: true,
},
data: [
{
@ -225,21 +145,7 @@ export default {
},
methods: {
onCurrencyChange(checkedValues) {
const {chartColors} = this.$store.state.setting;
this.currentMonth = this.getThisMonth(checkedValues);
this.monitorChart.setOption(this.dataSet);
},
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) {
this.countContainer = document.getElementById('countContainer');
@ -247,25 +153,17 @@ export default {
this.countChart = echarts.init(this.countContainer);
const option = this.One_data;
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>
<style scoped lang="less">
@import '@/style/variables.less';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,6 +38,7 @@ const getters = {
roles: (state) => state.userInfo?.roles,
};
const actions = {
async login({commit}, userInfo) {
const mockLogin = async (userInfo) => {
@ -51,10 +52,9 @@ const actions = {
const res = await mockLogin(userInfo);
if (res.code === 200) {
console.log('token', userInfo.token);
commit('setToken', userInfo.token);
} else {
return res;
throw res;
}
},
async getUserInfo({commit, state}) {
@ -72,21 +72,11 @@ const actions = {
} else {
return {
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);
commit('setUserInfo', res);
},
async logout({commit}) {

View File

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