Commit 41fe0800 authored by 罗超's avatar 罗超

新增前端账号冻结功能

parent f422d8ef
...@@ -117,8 +117,13 @@ service.interceptors.response.use( ...@@ -117,8 +117,13 @@ service.interceptors.response.use(
useUserStore().setUserLoginOut() useUserStore().setUserLoginOut()
}, 1000); }, 1000);
} }
const currentDeniedStatus = useUserStore().getDenied
if(response.data.resultCode == ApiResult.STATIC_ACCESS){ if(response.data.resultCode == ApiResult.STATIC_ACCESS){
window.location.href='/denyAccess' useUserStore().setUserDeniedStatus(true)
if(!currentDeniedStatus) window.location.href='/denyAccess'
}else{
useUserStore().setUserDeniedStatus(false)
if(currentDeniedStatus) window.location.href='/login'
} }
if(response.data.attach){ if(response.data.attach){
if(response.data.attach.userinfo){ if(response.data.attach.userinfo){
......
...@@ -10,7 +10,7 @@ const router = createRouter({ ...@@ -10,7 +10,7 @@ const router = createRouter({
}) })
const whiteList = ['/autoLogin','/login','/notfound','/regist','/','/forgot','/newpass','/notsupported'] const whiteList = ['/autoLogin','/login','/notfound','/regist','/','/forgot','/newpass','/notsupported','/denyAccess']
const managerMenu = ['/market','/editor_admin'] const managerMenu = ['/market','/editor_admin']
let loadingInstance:any = null let loadingInstance:any = null
...@@ -32,7 +32,9 @@ router.beforeEach((to:any, from:any, next:any) => { ...@@ -32,7 +32,9 @@ router.beforeEach((to:any, from:any, next:any) => {
} }
const path = `/${to.path.split('/')[1]}` const path = `/${to.path.split('/')[1]}`
if ((whiteList.includes(path) || user.getUserToken!='' || to.path.includes('/j/')) && !to.query.uid) { if(useUserStore().getDenied && path!='/denyAccess') next('/denyAccess')
else if(!useUserStore().getDenied && path=='/denyAccess') next('/space')
else if ((whiteList.includes(path) || user.getUserToken!='' || to.path.includes('/j/')) && !to.query.uid) {
if(managerMenu.includes(to.path) && user.getUser.isTemplate!=1){ if(managerMenu.includes(to.path) && user.getUser.isTemplate!=1){
next('/notfound'); next('/notfound');
} }
......
...@@ -83,7 +83,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -83,7 +83,7 @@ const routes: RouteRecordRaw[] = [
}, },
{ {
path: '/denyAccess', path: '/denyAccess',
component: () => import('@/views/SellTemplate/DenyAccess.vue'), component: () => import('@/views/Auth/DenyAccess.vue'),
meta:{ meta:{
title:'禁止访问' title:'禁止访问'
} }
......
...@@ -32,7 +32,8 @@ export interface AutoLoginResult{ ...@@ -32,7 +32,8 @@ export interface AutoLoginResult{
export const useUserStore = defineStore('user', { export const useUserStore = defineStore('user', {
state:()=>({ state:()=>({
token:'' as string, token:'' as string,
userInfo:{} as any userInfo:{} as any,
denied: false,
}), }),
getters: { getters: {
getUserToken: (state) => { getUserToken: (state) => {
...@@ -41,6 +42,9 @@ export const useUserStore = defineStore('user', { ...@@ -41,6 +42,9 @@ export const useUserStore = defineStore('user', {
getUser: (state) => { getUser: (state) => {
return state.userInfo; return state.userInfo;
}, },
getDenied:(state) =>{
return state.denied
},
getUserTheme: (state) => { getUserTheme: (state) => {
let rate:CustomerRate = 'FREE' let rate:CustomerRate = 'FREE'
if(state.userInfo.it) rate = 'EN' if(state.userInfo.it) rate = 'EN'
...@@ -134,6 +138,9 @@ export const useUserStore = defineStore('user', { ...@@ -134,6 +138,9 @@ export const useUserStore = defineStore('user', {
setOldSaPermission(ia:boolean){ setOldSaPermission(ia:boolean){
this.userInfo.ia = ia this.userInfo.ia = ia
this.userInfo.ic = false this.userInfo.ic = false
},
setUserDeniedStatus(status:boolean){
this.denied = status
} }
}, },
persist: { persist: {
......
...@@ -18,6 +18,11 @@ export interface Result { ...@@ -18,6 +18,11 @@ export interface Result {
class Api{ class Api{
constructor(){ } constructor(){ }
static Post = (cmd:string,msg:any): Promise<HttpResponse>=>{ static Post = (cmd:string,msg:any): Promise<HttpResponse>=>{
if(useUserStore().getDenied && cmd!='triptemplate_GetFontList'){
return new Promise((resolve, reject) => {
reject('Access Denied')
})
}
let datas: any let datas: any
let language = 'zh_CN' let language = 'zh_CN'
let currencyCode = 'CNY' let currencyCode = 'CNY'
......
<template>
<div class="window-width window-height column flex-center items-center" style="background-color: #f1f2f4">
<div class="rounded bg-white q-pa-xl light-shadow column flex-center items-center" style="width: 650px">
<div style="width: 100%">
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/pptTD.png" style="height: 27px" />
</div>
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638533817842486720.png"
style="width: 300px" class="q-mt-xl" />
<div class="row items-center q-mt-xl">
<div class="pingfangr q-ml-xl" style="font-size: 18px">
Access Denied
</div>
</div>
<div class="q-mt-lg text-info text-small text-center" style="font-size: 14px">
系统判定你进行了恶意访问,当前无法进行系统使用,封禁剩余时间:
<el-countdown title="" v-if="countValue" format="HH[小时]mm[分]ss[秒]" :value="countValue" value-style="font-size:13px;color:red;"
class="q-mt-md" @finish="liftingHandler" />
</div>
<div class="q-mt-xl text-center" style="font-size: 14px">
<el-button type="info" size="large" class="ppt-button text-weight-bold" @click="
redicetTo('https://work.weixin.qq.com/kfid/kfc378aada578ca8b0e')
">点击申诉</el-button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ApiResult } from "@/configs/axios";
import FontService from "@/services/FontService";
import { useUserStore } from "@/store";
import { openNewBlank } from "@/utils/common";
import { ref } from "vue";
import { useRouter } from "vue-router";
const countValue = ref();
const router = useRouter()
const redicetTo = (url: string) => openNewBlank(url);
const navigationTo = (path:string) => router.push({path})
const validator = async () => {
try {
let response = await FontService.GetAllFontsAsync();
if (response.data.resultCode == ApiResult.STATIC_ACCESS) {
countValue.value = new Date(
response.data.attach.replaceAll("-", "/")
).getTime();
}
} catch (error) { }
};
const liftingHandler= ()=>{
useUserStore().setUserDeniedStatus(false)
navigationTo('/login')
}
validator();
</script>
<style></style>
\ No newline at end of file
<template>
<div class="window-width window-height column flex-center items-center" style="background-color: #f1f2f4">
<div class="rounded bg-white q-pa-xl light-shadow column flex-center items-center" style="width: 650px;">
<div style="width: 100%;">
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/pptTD.png" style="height: 27px;">
</div>
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638533817842486720.png" style="width: 300px;" class="q-mt-xl">
<div class="row items-center q-mt-xl ">
<div class="pingfangr q-ml-xl" style="font-size: 18px;">Access Denied</div>
</div>
<div class="q-mt-lg text-info text-small text-center" style="font-size: 14px;">系统判定你进行了恶意访问,当前无法进行系统使用,需等待xx小时xx分钟xx秒以后才能使用。</div>
<div class="q-mt-xl text-center" style="font-size: 14px;">
<el-button type="info" size="large" class="ppt-button text-weight-bold" @click="redicetTo('https://work.weixin.qq.com/kfid/kfc378aada578ca8b0e')">点击申诉</el-button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ApiResult } from "@/configs/axios";
import ConfigService from "@/services/ConfigService";
import FileService from "@/services/FileService";
import { ref } from "vue";
import { useRouter } from "vue-router";
import { openNewBlank } from '@/utils/common'
const redicetTo = (url:string)=>openNewBlank(url)
</script>
<style>
</style>
\ No newline at end of file
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