Commit b8991837 authored by zhengke's avatar zhengke

路由白名单

parents 59d6c607 764b9311
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const { handleElement, handleElementId } = storeToRefs(mainStore) const { handleElement, handleElementId } = storeToRefs(mainStore)
const dialogFormVisible = ref(true) const dialogFormVisible = ref(true)
const dialogTitle = ref('原图/清晰图对比') const dialogTitle = ref('原图/高清图对比')
const setLoading = ref(false) const setLoading = ref(false)
const props = defineProps({ const props = defineProps({
width: { type: String, default: "500" }, width: { type: String, default: "500" },
...@@ -147,7 +147,6 @@ ...@@ -147,7 +147,6 @@
position: relative; position: relative;
display: inline-block; display: inline-block;
margin: 0 auto; margin: 0 auto;
min-height: 273px;
overflow: hidden; overflow: hidden;
} }
.before-image { .before-image {
......
...@@ -14,7 +14,8 @@ export enum ApiResult{ ...@@ -14,7 +14,8 @@ export enum ApiResult{
'FAILED' = 0, 'FAILED' = 0,
'TOKEN_INVALID' = 10000, 'TOKEN_INVALID' = 10000,
'TOKEN_ILLEGAL' = 10001, 'TOKEN_ILLEGAL' = 10001,
'REMOTE_LOGIN' = 10010 'REMOTE_LOGIN' = 10010,
'STATIC_ACCESS' = 20005
} }
export enum VipType{ export enum VipType{
...@@ -116,6 +117,14 @@ service.interceptors.response.use( ...@@ -116,6 +117,14 @@ service.interceptors.response.use(
useUserStore().setUserLoginOut() useUserStore().setUserLoginOut()
}, 1000); }, 1000);
} }
const currentDeniedStatus = useUserStore().getDenied
if(response.data.resultCode == ApiResult.STATIC_ACCESS){
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){
useUserStore().setOnlyUserInfo(response.data.attach.userinfo) useUserStore().setOnlyUserInfo(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','/BindToWechat'] 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');
} }
......
...@@ -88,6 +88,13 @@ const routes: RouteRecordRaw[] = [ ...@@ -88,6 +88,13 @@ const routes: RouteRecordRaw[] = [
title:'下载行程设计' title:'下载行程设计'
} }
}, },
{
path: '/denyAccess',
component: () => import('@/views/Auth/DenyAccess.vue'),
meta:{
title:'禁止访问'
}
},
{ {
path: '/notsupported', path: '/notsupported',
component: () => import('@/views/Mobile/NotSupported.vue'), component: () => import('@/views/Mobile/NotSupported.vue'),
......
...@@ -19,7 +19,7 @@ const menus:{menu:Menu,owner:MenuOwner}[] = [ ...@@ -19,7 +19,7 @@ const menus:{menu:Menu,owner:MenuOwner}[] = [
{menu:{name:'水印设置',icon:'IconTag',url:'/u/w'},owner:'*'}, {menu:{name:'水印设置',icon:'IconTag',url:'/u/w'},owner:'*'},
{menu:{name:'订单/发票',icon:'IconCurrency',url:'/u/order'},owner:'*'}, {menu:{name:'订单/发票',icon:'IconCurrency',url:'/u/order'},owner:'*'},
{menu:{name:'账户设置',icon:'IconProtect',url:'/u/setting'},owner:'*'}, {menu:{name:'账户设置',icon:'IconProtect',url:'/u/setting'},owner:'*'},
// {menu:{name:'云盘空间',icon:'IconCloudStorage',url:'/u/cloudDiskSpace'},owner:'*'}, {menu:{name:'云盘空间',icon:'IconCloudStorage',url:'/u/cloudDiskSpace'},owner:'*'},
{menu:{name:'模版管理',icon:'IconPageTemplate',url:'/m'},owner:'M'}, {menu:{name:'模版管理',icon:'IconPageTemplate',url:'/m'},owner:'M'},
{menu:{name:'国家',icon:'IconWorld',url:'/m/nation'},owner:'M'}, {menu:{name:'国家',icon:'IconWorld',url:'/m/nation'},owner:'M'},
{menu:{name:'颜色',icon:'IconPlatte',url:'/m/colour'},owner:'M'}, {menu:{name:'颜色',icon:'IconPlatte',url:'/m/colour'},owner:'M'},
...@@ -28,7 +28,7 @@ const menus:{menu:Menu,owner:MenuOwner}[] = [ ...@@ -28,7 +28,7 @@ const menus:{menu:Menu,owner:MenuOwner}[] = [
{menu:{name:'成员管理',icon:'IconPeoples',url:'/a/u'},owner:'A'}, {menu:{name:'成员管理',icon:'IconPeoples',url:'/a/u'},owner:'A'},
{menu:{name:'数据统计',icon:'IconDashBoard',url:'/a/d'},owner:'A'}, {menu:{name:'数据统计',icon:'IconDashBoard',url:'/a/d'},owner:'A'},
{menu:{name:'水印设置',icon:'IconTag',url:'/a/w'},owner:'A'}, {menu:{name:'水印设置',icon:'IconTag',url:'/a/w'},owner:'A'},
// {menu:{name:'云盘空间',icon:'IconCloudStorage',url:'/a/c'},owner:'A'}, {menu:{name:'云盘空间',icon:'IconCloudStorage',url:'/a/c'},owner:'A'},
{menu:{name:'订单/发票',icon:'IconCurrency',url:'/a/order'},owner:'E'}, {menu:{name:'订单/发票',icon:'IconCurrency',url:'/a/order'},owner:'E'},
{ {
menu:{ menu:{
......
...@@ -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'
...@@ -156,6 +160,9 @@ export const useUserStore = defineStore('user', { ...@@ -156,6 +160,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
...@@ -87,10 +87,11 @@ ...@@ -87,10 +87,11 @@
@success="DefinitionDatas=null"> @success="DefinitionDatas=null">
<template #left> <template #left>
<span style="position: absolute;left: 10px;top:10px;background: #fff;border-radius: 3px;padding:0 5px;width: 38px;">原图</span> <span style="position: absolute;left: 10px;top:10px;background: #fff;border-radius: 3px;padding:0 5px;width: 38px;">原图</span>
<img :src="handleImageElement.src" class="images" :style="{width: imgWidth+'px'}" /> <img :src="handleImageElement.src" class="images" :style="{width: imgWidth+'px',height: imgHeigth+'px'}" />
</template> </template>
<template #right> <template #right>
<img :src="'data:image/png;base64,'+DefinitionDatas" class="images" :style="{width: imgWidth+'px'}" /> <span style="position: absolute;right: 10px;top:10px;background: #fff;border-radius: 3px;padding:0 5px;width: 53px;">高清图</span>
<img :src="'data:image/png;base64,'+DefinitionDatas" class="images" :style="{width: imgWidth+'px',height: imgHeigth+'px'}" />
</template> </template>
</imgArticContr> </imgArticContr>
</div> </div>
...@@ -190,6 +191,7 @@ const imgWidth = ref(500) ...@@ -190,6 +191,7 @@ const imgWidth = ref(500)
const imgHeigth = ref(0) const imgHeigth = ref(0)
const getPictDef = async () =>{ const getPictDef = async () =>{
await getImgSize()
if(handleImageElement.value.src.startsWith("data:image")){ if(handleImageElement.value.src.startsWith("data:image")){
let name = new Date().getTime()+".jpg" let name = new Date().getTime()+".jpg"
const file = dataURLtoFile(handleImageElement.value.src, name) const file = dataURLtoFile(handleImageElement.value.src, name)
...@@ -226,7 +228,7 @@ const getImgSize = async () => { ...@@ -226,7 +228,7 @@ const getImgSize = async () => {
let ratio = TempSize.width/imgWidth.value let ratio = TempSize.width/imgWidth.value
imgHeigth.value = TempSize.height/ratio imgHeigth.value = TempSize.height/ratio
} }
getImgSize()
const getLockCutRatio = () =>{ const getLockCutRatio = () =>{
keyboardStore.setCtrlKeyState(ctrlKeyState.value) keyboardStore.setCtrlKeyState(ctrlKeyState.value)
} }
......
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