@@ -24,6 +24,7 @@ | |||||
"echarts": "^5.2.2", | "echarts": "^5.2.2", | ||||
"element-plus": "^2.3.1", | "element-plus": "^2.3.1", | ||||
"js-audio-recorder": "^1.0.7", | "js-audio-recorder": "^1.0.7", | ||||
"js-cookie": "^3.0.5", | |||||
"nprogress": "^0.2.0", | "nprogress": "^0.2.0", | ||||
"path-browserify": "^1.0.1", | "path-browserify": "^1.0.1", | ||||
"path-to-regexp": "^6.2.0", | "path-to-regexp": "^6.2.0", | ||||
@@ -0,0 +1,13 @@ | |||||
import request from "@/utils/request.js"; | |||||
/** | |||||
* @description:全查询导航菜单 | |||||
* @param | |||||
* @return: | |||||
*/ | |||||
export function getMenuNavApi() { | |||||
return request({ | |||||
url: `/menu/nav`, | |||||
method: 'get', | |||||
}) | |||||
} |
@@ -1,119 +0,0 @@ | |||||
<template> | |||||
<div> | |||||
<!-- 侧边栏 --> | |||||
<div><Sidebar class="sidebar-container" /></div> | |||||
<!-- 页面主体 --> | |||||
<div> | |||||
<!-- nav --> | |||||
<div><navbar /></div> | |||||
<!-- 页面主体 --> | |||||
<div><app-main /></div> | |||||
</div> | |||||
</div> | |||||
</template> | |||||
<script setup lang="ts"> | |||||
import { computed, watchEffect } from "vue"; | |||||
import { useWindowSize } from "@vueuse/core"; | |||||
import { AppMain, Navbar } from "./components/index"; | |||||
import SignSucceed from "../views/signSucceed/index.vue"; | |||||
import Sidebar from "./components/Sidebar/index.vue"; | |||||
import { useAppStore } from "@/store/modules/app"; | |||||
import { useSettingsStore } from "@/store/modules/settings"; | |||||
import { useRoute, useRouter } from "vue-router"; | |||||
const route = useRoute(); | |||||
const { params } = route; | |||||
const { width } = useWindowSize(); | |||||
/** | |||||
* 响应式布局容器固定宽度 | |||||
* | |||||
* 大屏(>=1200px) | |||||
* 中屏(>=992px) | |||||
* 小屏(>=768px) | |||||
*/ | |||||
const WIDTH = 992; | |||||
const appStore = useAppStore(); | |||||
const settingsStore = useSettingsStore(); | |||||
const fixedHeader = computed(() => settingsStore.fixedHeader); | |||||
const showTagsView = computed(() => settingsStore.tagsView); | |||||
const showSettings = computed(() => settingsStore.showSettings); | |||||
const classObj = computed(() => ({ | |||||
hideSidebar: !appStore.sidebar.opened, | |||||
openSidebar: appStore.sidebar.opened, | |||||
withoutAnimation: appStore.sidebar.withoutAnimation, | |||||
mobile: appStore.device === "mobile", | |||||
})); | |||||
watchEffect(() => { | |||||
if (width.value < WIDTH) { | |||||
appStore.toggleDevice("mobile"); | |||||
appStore.closeSideBar(true); | |||||
} else { | |||||
appStore.toggleDevice("desktop"); | |||||
if (width.value >= 1200) { | |||||
//大屏 | |||||
appStore.openSideBar(true); | |||||
} else { | |||||
appStore.closeSideBar(true); | |||||
} | |||||
} | |||||
}); | |||||
function handleOutsideClick() { | |||||
appStore.closeSideBar(false); | |||||
} | |||||
onMounted(() => {}); | |||||
</script> | |||||
<style lang="scss" scoped> | |||||
.app-wrapper { | |||||
&::after { | |||||
display: table; | |||||
clear: both; | |||||
content: ""; | |||||
} | |||||
position: relative; | |||||
width: 100%; | |||||
height: 100%; | |||||
e &.mobile.openSidebar { | |||||
position: fixed; | |||||
top: 0; | |||||
} | |||||
} | |||||
.fixed-header { | |||||
position: fixed; | |||||
top: 0; | |||||
right: 0; | |||||
z-index: 9; | |||||
width: calc(100% - #{$sideBarWidth}); | |||||
transition: width 0.28s; | |||||
} | |||||
.hideSidebar .fixed-header { | |||||
width: calc(100% - 54px); | |||||
} | |||||
.mobile .fixed-header { | |||||
width: 100%; | |||||
} | |||||
.drawer-bg { | |||||
position: absolute; | |||||
top: 0; | |||||
z-index: 999; | |||||
width: 100%; | |||||
height: 100%; | |||||
// background: #1b213a; | |||||
background: #000; | |||||
opacity: 0.3; | |||||
} | |||||
</style> |
@@ -1,131 +0,0 @@ | |||||
<template> | |||||
<div :class="classObj" class="app-wrapper"> | |||||
<!-- 手机设备侧边栏打开遮罩层 --> | |||||
<div | |||||
v-if="classObj.mobile && classObj.openSidebar" | |||||
class="drawer-bg" | |||||
@click="handleOutsideClick" | |||||
></div> | |||||
<Sidebar class="sidebar-container" /> | |||||
<div :class="{ hasTagsView: showTagsView }" class="main-container"> | |||||
<div | |||||
:class="{ 'fixed-header': fixedHeader }" | |||||
style="box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 4px; height: 80px" | |||||
> | |||||
<navbar /> | |||||
<tags-view v-if="showTagsView" /> | |||||
</div> | |||||
<!-- 主页面 --> | |||||
<app-main /> | |||||
</div> | |||||
</div> | |||||
</template> | |||||
<script setup lang="ts"> | |||||
import { computed, watchEffect } from "vue"; | |||||
import { useWindowSize } from "@vueuse/core"; | |||||
import { AppMain, Navbar } from "./components/index"; | |||||
import SignSucceed from "../views/signSucceed/index.vue"; | |||||
import Sidebar from "./components/Sidebar/index.vue"; | |||||
import { useAppStore } from "@/store/modules/app"; | |||||
import { useSettingsStore } from "@/store/modules/settings"; | |||||
import { useRoute, useRouter } from "vue-router"; | |||||
const route = useRoute(); | |||||
const { params } = route; | |||||
const { width } = useWindowSize(); | |||||
/** | |||||
* 响应式布局容器固定宽度 | |||||
* | |||||
* 大屏(>=1200px) | |||||
* 中屏(>=992px) | |||||
* 小屏(>=768px) | |||||
*/ | |||||
const WIDTH = 992; | |||||
const appStore = useAppStore(); | |||||
const settingsStore = useSettingsStore(); | |||||
const fixedHeader = computed(() => settingsStore.fixedHeader); | |||||
const showTagsView = computed(() => settingsStore.tagsView); | |||||
const showSettings = computed(() => settingsStore.showSettings); | |||||
const classObj = computed(() => ({ | |||||
hideSidebar: !appStore.sidebar.opened, | |||||
openSidebar: appStore.sidebar.opened, | |||||
withoutAnimation: appStore.sidebar.withoutAnimation, | |||||
mobile: appStore.device === "mobile", | |||||
})); | |||||
watchEffect(() => { | |||||
if (width.value < WIDTH) { | |||||
appStore.toggleDevice("mobile"); | |||||
appStore.closeSideBar(true); | |||||
} else { | |||||
appStore.toggleDevice("desktop"); | |||||
if (width.value >= 1200) { | |||||
//大屏 | |||||
appStore.openSideBar(true); | |||||
} else { | |||||
appStore.closeSideBar(true); | |||||
} | |||||
} | |||||
}); | |||||
function handleOutsideClick() { | |||||
appStore.closeSideBar(false); | |||||
} | |||||
onMounted(() => {}); | |||||
</script> | |||||
<style lang="scss" scoped> | |||||
.app-wrapper { | |||||
&::after { | |||||
display: table; | |||||
clear: both; | |||||
content: ""; | |||||
} | |||||
position: relative; | |||||
width: 100%; | |||||
height: 100%; | |||||
e &.mobile.openSidebar { | |||||
position: fixed; | |||||
top: 0; | |||||
} | |||||
} | |||||
.fixed-header { | |||||
position: fixed; | |||||
top: 0; | |||||
right: 0; | |||||
z-index: 9; | |||||
width: calc(100% - #{$sideBarWidth}); | |||||
transition: width 0.28s; | |||||
} | |||||
.hideSidebar .fixed-header { | |||||
width: calc(100% - 54px); | |||||
} | |||||
.mobile .fixed-header { | |||||
width: 100%; | |||||
} | |||||
.drawer-bg { | |||||
position: absolute; | |||||
top: 0; | |||||
z-index: 999; | |||||
width: 100%; | |||||
height: 100%; | |||||
// background: #1b213a; | |||||
background: #000; | |||||
opacity: 0.3; | |||||
} | |||||
</style> |
@@ -11,35 +11,35 @@ | |||||
</div> | </div> | ||||
<!-- 侧边路由列表 --> | <!-- 侧边路由列表 --> | ||||
<div class="myRouter"> | <div class="myRouter"> | ||||
<div class="myRouter-item" @click="router.push('/createVideo')"> | |||||
<div class="myRouter-item" @click="router.push('/model')"> | |||||
<div class="icon"> | <div class="icon"> | ||||
<el-icon><i-ep-edit /></el-icon> | <el-icon><i-ep-edit /></el-icon> | ||||
</div> | </div> | ||||
{{ $t("modelMangage.title") }} | {{ $t("modelMangage.title") }} | ||||
</div> | </div> | ||||
<div class="myRouter-item" @click="router.push('/createVideo')"> | |||||
<div class="myRouter-item" @click="router.push('/model')"> | |||||
<div class="icon"> | <div class="icon"> | ||||
<el-icon><i-ep-edit /></el-icon> | <el-icon><i-ep-edit /></el-icon> | ||||
</div> | </div> | ||||
{{ $t("businessMangage.title") }} | {{ $t("businessMangage.title") }} | ||||
</div> | </div> | ||||
<div class="myRouter-item" @click="router.push('/createVideo')"> | |||||
<div class="myRouter-item" @click="router.push('/keyCheck')"> | |||||
<div class="icon"> | <div class="icon"> | ||||
<el-icon><i-ep-edit /></el-icon> | <el-icon><i-ep-edit /></el-icon> | ||||
</div> | </div> | ||||
{{ $t("keyMangage.title") }} | {{ $t("keyMangage.title") }} | ||||
</div> | </div> | ||||
<div class="myRouter-item" @click="router.push('/createVideo')"> | |||||
<div class="myRouter-item" @click="router.push('/model')"> | |||||
<div class="icon"> | <div class="icon"> | ||||
<el-icon><i-ep-edit /></el-icon> | <el-icon><i-ep-edit /></el-icon> | ||||
</div> | </div> | ||||
{{ $t("priceMangage.title") }} | {{ $t("priceMangage.title") }} | ||||
</div> | </div> | ||||
<div class="myRouter-item" @click="router.push('/createVideo')"> | |||||
<div class="myRouter-item" @click="router.push('/model')"> | |||||
<div class="icon"> | <div class="icon"> | ||||
<el-icon><i-ep-edit /></el-icon> | <el-icon><i-ep-edit /></el-icon> | ||||
</div> | </div> | ||||
@@ -47,7 +47,7 @@ | |||||
</div> | </div> | ||||
<div class="bottomBtx"> | <div class="bottomBtx"> | ||||
<div class="myRouter-item" @click="router.push('/myAPI')"> | |||||
<div class="myRouter-item" @click="router.push('/model')"> | |||||
<div class="icon"> | <div class="icon"> | ||||
<el-icon><i-ep-DocumentAdd /></el-icon> | <el-icon><i-ep-DocumentAdd /></el-icon> | ||||
</div> | </div> | ||||
@@ -105,7 +105,7 @@ import { useAppStore } from "@/store/modules/app"; | |||||
// import { useSettingsStore } from "@/store/modules/settings"; | // import { useSettingsStore } from "@/store/modules/settings"; | ||||
import { useRoute, useRouter } from "vue-router"; | import { useRoute, useRouter } from "vue-router"; | ||||
import { useI18n } from "vue-i18n"; | import { useI18n } from "vue-i18n"; | ||||
import { getMenuNavApi } from "@/apis/Permission.js"; | |||||
import { userInfoModules } from "@/store/modules/userInfo"; | import { userInfoModules } from "@/store/modules/userInfo"; | ||||
const userInfoPinia = userInfoModules(); | const userInfoPinia = userInfoModules(); | ||||
@@ -166,13 +166,27 @@ function handleOutsideClick() { | |||||
appStore.closeSideBar(false); | appStore.closeSideBar(false); | ||||
} | } | ||||
onMounted(() => {}); | |||||
onMounted(() => { | |||||
getMenuNavFunc(); | |||||
}); | |||||
//#region 联系我们弹窗 | //#region 联系我们弹窗 | ||||
const showTalkUsDialog = ref(false); | const showTalkUsDialog = ref(false); | ||||
const updateShowTalkUsDialog = (newValue: any) => { | const updateShowTalkUsDialog = (newValue: any) => { | ||||
showTalkUsDialog.value = newValue; | showTalkUsDialog.value = newValue; | ||||
}; | }; | ||||
//#endregion ------------------------------------ | //#endregion ------------------------------------ | ||||
//#region 获取路由列表 | |||||
const MenuList = ref([]); | |||||
async function getMenuNavFunc() { | |||||
try { | |||||
const res = await getMenuNavApi(); | |||||
MenuList.value = res.data.menuList; | |||||
} catch (error) { | |||||
console.log(error); | |||||
} | |||||
} | |||||
//#endregion ------------------------------------ | |||||
</script> | </script> | ||||
<!-- 新样式 --> | <!-- 新样式 --> | ||||
@@ -9,35 +9,36 @@ NProgress.configure({ showSpinner: false }); // 进度条 | |||||
const permissionStore = usePermissionStoreHook(); | const permissionStore = usePermissionStoreHook(); | ||||
// 白名单路由 | // 白名单路由 | ||||
const whiteList = ["/login", "/signSucceed",'/createVideo','/moveImg']; | |||||
const whiteList = ["/login", "/signSucceed", "/createVideo", "/moveImg"]; | |||||
router.beforeEach(async (to, from, next) => { | router.beforeEach(async (to, from, next) => { | ||||
NProgress.start(); | NProgress.start(); | ||||
const AccessToken = localStorage.getItem("AccessToken"); | const AccessToken = localStorage.getItem("AccessToken"); | ||||
next(); | |||||
// 已登录 | // 已登录 | ||||
if (AccessToken) { | |||||
// 重置密码时可以去往login页面 | |||||
if ((to.params.type as string) == "4") { | |||||
next(); | |||||
} | |||||
if (to.query.resetPwd) { | |||||
next(); | |||||
} | |||||
if (to.path === "/login") { | |||||
next({ path: "/createVideo" }); | |||||
} else { | |||||
next(); | |||||
} | |||||
// 未登录 | |||||
} else { | |||||
// 未登录可以访问白名单页面 | |||||
if (whiteList.indexOf(to.path) !== -1) { | |||||
next(); | |||||
} else { | |||||
// 不在白名单内,跳转登录页 | |||||
next({ path: "/login" }); | |||||
} | |||||
} | |||||
// if (AccessToken) { | |||||
// // 重置密码时可以去往login页面 | |||||
// if ((to.params.type as string) == "4") { | |||||
// next(); | |||||
// } | |||||
// if (to.query.resetPwd) { | |||||
// next(); | |||||
// } | |||||
// if (to.path === "/login") { | |||||
// next({ path: "/createVideo" }); | |||||
// } else { | |||||
// next(); | |||||
// } | |||||
// // 未登录 | |||||
// } else { | |||||
// // 未登录可以访问白名单页面 | |||||
// if (whiteList.indexOf(to.path) !== -1) { | |||||
// next(); | |||||
// } else { | |||||
// // 不在白名单内,跳转登录页 | |||||
// next({ path: "/login" }); | |||||
// } | |||||
// } | |||||
}); | }); | ||||
router.afterEach(() => { | router.afterEach(() => { | ||||
@@ -5,87 +5,34 @@ export const Layout = () => import("@/layout/index.vue"); | |||||
// 静态路由 | // 静态路由 | ||||
export const constantRoutes: RouteRecordRaw[] = [ | export const constantRoutes: RouteRecordRaw[] = [ | ||||
// 登录 | // 登录 | ||||
{ | { | ||||
path: "/login", | path: "/login", | ||||
component: () => import("@/views/login/index.vue"), | component: () => import("@/views/login/index.vue"), | ||||
meta: { hidden: true }, | meta: { hidden: true }, | ||||
name:'login' | |||||
name: "login", | |||||
}, | }, | ||||
{ | { | ||||
path: "/signSucceed", | path: "/signSucceed", | ||||
component: () => import("@/views/signSucceed/index.vue"), | component: () => import("@/views/signSucceed/index.vue"), | ||||
meta: { hidden: true }, | meta: { hidden: true }, | ||||
}, | }, | ||||
// 创建视频 | |||||
{ | |||||
path: "/", | |||||
component: Layout, | |||||
redirect: "/createVideo", | |||||
children: [ | |||||
{ | |||||
path: "createVideo", | |||||
component: () => import("@/views/createVideo/index.vue"), | |||||
name: "createVideo", | |||||
meta: { | |||||
title: "createVideo", | |||||
icon: "homepage", | |||||
affix: true, | |||||
name: "createVideo.title", | |||||
}, | |||||
}, | |||||
], | |||||
}, | |||||
// 视频列表 | |||||
{ | { | ||||
path: "/", | path: "/", | ||||
component: Layout, | component: Layout, | ||||
redirect: "/myCreating", | |||||
children: [ | |||||
{ | |||||
path: "myCreating", | |||||
component: () => import("@/views/myCreating/index.vue"), | |||||
name: "myCreating", | |||||
meta: { | |||||
title: "myCreating", | |||||
icon: "homepage", | |||||
affix: true, | |||||
name: "myCreating.title", | |||||
}, | |||||
}, | |||||
], | |||||
}, { | |||||
path: "/", | |||||
component: Layout, | |||||
redirect: "/myStore", | |||||
children: [ | |||||
{ | |||||
path: "myStore", | |||||
component: () => import("@/views/myStore/index.vue"), | |||||
name: "myStore", | |||||
meta: { | |||||
title: "myStore", | |||||
icon: "homepage", | |||||
affix: true, | |||||
name: "myStore.title", | |||||
}, | |||||
}, | |||||
], | |||||
}, { | |||||
path: "/", | |||||
component: Layout, | |||||
redirect: "/myAPI", | |||||
redirect: "/model", | |||||
children: [ | children: [ | ||||
{ | { | ||||
path: "myAPI", | |||||
component: () => import("@/views/myAPI/index.vue"), | |||||
name: "myAPI", | |||||
path: "model", | |||||
component: () => import("@/views/mangage/model.vue"), | |||||
name: "model", | |||||
meta: { | meta: { | ||||
title: "myAPI", | |||||
title: "model", | |||||
icon: "homepage", | icon: "homepage", | ||||
affix: true, | affix: true, | ||||
name: "API.title", | |||||
name: "modelMangage.title", | |||||
}, | }, | ||||
}, | }, | ||||
], | ], | ||||
@@ -93,22 +40,21 @@ export const constantRoutes: RouteRecordRaw[] = [ | |||||
{ | { | ||||
path: "/", | path: "/", | ||||
component: Layout, | component: Layout, | ||||
redirect: "/moveImg", | |||||
redirect: "/keyCheck", | |||||
children: [ | children: [ | ||||
{ | { | ||||
path: "moveImg", | |||||
component: () => import("@/views/moveImg/index.vue"), | |||||
name: "moveImg", | |||||
path: "keyCheck", | |||||
component: () => import("@/views/mangage/keyCheck.vue"), | |||||
name: "keyCheck", | |||||
meta: { | meta: { | ||||
title: "moveImg", | |||||
title: "keyCheck", | |||||
icon: "homepage", | icon: "homepage", | ||||
affix: true, | affix: true, | ||||
name: "moveImg.title", | |||||
name: "keyMangage.title", | |||||
}, | }, | ||||
}, | }, | ||||
], | ], | ||||
}, | }, | ||||
]; | ]; | ||||
/** | /** | ||||
@@ -2,7 +2,6 @@ | |||||
export {} | export {} | ||||
declare global { | declare global { | ||||
const EffectScope: typeof import('vue')['EffectScope'] | const EffectScope: typeof import('vue')['EffectScope'] | ||||
const ElForm: typeof import('element-plus/es')['ElForm'] | |||||
const ElMessage: typeof import('element-plus/es')['ElMessage'] | const ElMessage: typeof import('element-plus/es')['ElMessage'] | ||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] | const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] | ||||
const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] | const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] | ||||
@@ -271,7 +270,6 @@ import { UnwrapRef } from 'vue' | |||||
declare module 'vue' { | declare module 'vue' { | ||||
interface ComponentCustomProperties { | interface ComponentCustomProperties { | ||||
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']> | readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']> | ||||
readonly ElForm: UnwrapRef<typeof import('element-plus/es')['ElForm']> | |||||
readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']> | readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']> | ||||
readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']> | readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']> | ||||
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']> | readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']> | ||||
@@ -1,67 +0,0 @@ | |||||
import axios from 'axios' | |||||
import router from '@/router/index' | |||||
import { ElMessage } from 'element-plus' | |||||
// ElMessage | |||||
import { userInfoModules } from "@/store/modules/userInfo"; | |||||
// import stores from '@/store/index' | |||||
import { store } from '@/store/index'; // 因为不是在setup环境而是js中,必须重新初始化加载store | |||||
const userInfoPinia = userInfoModules(store); //pinia | |||||
// 开发环境需以 "/api" 拼接,其他环境需以 "/C" 拼接 | |||||
const env = process.env.NODE_ENV == 'development' ? "/api" : "/C" | |||||
// console.log(process.env.NODE_ENV, 'env') | |||||
/** | |||||
* @description:发送Axios请求 | |||||
*/ | |||||
const request = axios.create({ | |||||
baseURL: env, | |||||
timeout: 15000 | |||||
}) | |||||
// 请求拦截器 | |||||
request.interceptors.request.use( | |||||
function (config) { | |||||
// 给所有授权的请求提供token | |||||
const AccessToken = localStorage.getItem("AccessToken") | |||||
if (AccessToken) { | |||||
config.headers.token = AccessToken | |||||
} | |||||
return config | |||||
}, | |||||
function (error) { | |||||
// 操作 | |||||
return Promise.reject(error) | |||||
} | |||||
) | |||||
// 响应拦截器 | |||||
request.interceptors.response.use( | |||||
function (response) { | |||||
let code = response.data.code | |||||
// 当token无效(过期或损坏)时 1053为未登录 | |||||
if (code == 1052 || code == 1053) { | |||||
localStorage.removeItem("AccessToken"); | |||||
router.push("/login"); | |||||
ElMessage.error("登录过期,请重新登录!"); | |||||
return | |||||
// 弹出错误 | |||||
} else if (code != 200) { | |||||
if (code == 500) { | |||||
ElMessage.error("系统异常,请稍后再试"); | |||||
// 其他错误 | |||||
} else { | |||||
return Promise.reject(response.data) | |||||
} | |||||
} else { | |||||
// 正常返回 | |||||
return response.data | |||||
} | |||||
}, | |||||
function (error) { | |||||
} | |||||
) | |||||
export default request |
@@ -60,7 +60,7 @@ request.interceptors.response.use( | |||||
let code = response.data.code | let code = response.data.code | ||||
// 当token无效(过期或损坏)时 1053为未登录 | // 当token无效(过期或损坏)时 1053为未登录 | ||||
if (code == 1052 || code == 1053) { | if (code == 1052 || code == 1053) { | ||||
localStorage.removeItem("AccessToken"); | |||||
// localStorage.removeItem("AccessToken"); | |||||
router.push("/login"); | router.push("/login"); | ||||
// ElMessage.error("登录过期,请重新登录!"); | // ElMessage.error("登录过期,请重新登录!"); | ||||
// ElMessage.error($t('tips.tokenExpired')); | // ElMessage.error($t('tips.tokenExpired')); | ||||
@@ -757,8 +757,8 @@ const soundStyle = ref(""); //选择的风格 | |||||
// 语言下拉框内容 | // 语言下拉框内容 | ||||
const languageOptions = ref([]); | const languageOptions = ref([]); | ||||
async function voiceTotal() { | async function voiceTotal() { | ||||
const res = await voiceTotalApi(); | |||||
languageOptions.value = res.data; | |||||
// const res = await voiceTotalApi(); | |||||
// languageOptions.value = res.data; | |||||
} | } | ||||
// 声音下拉框内容 | // 声音下拉框内容 | ||||
const soundOptions = ref([]); | const soundOptions = ref([]); | ||||
@@ -612,6 +612,7 @@ import { | |||||
doFindInviteCode, | doFindInviteCode, | ||||
doUpdateInviteCode, | doUpdateInviteCode, | ||||
} from "@/apis/login"; | } from "@/apis/login"; | ||||
import { getMenuNavApi } from "@/apis/Permission.js"; | |||||
import axios from "axios"; | import axios from "axios"; | ||||
// 状态管理依赖 | // 状态管理依赖 | ||||
@@ -911,28 +912,6 @@ function confirmPasswordValidator5(rule: any, value: any, callback: any) { | |||||
} | } | ||||
//#endregion ---------------------------- | //#endregion ---------------------------- | ||||
// 登录行为 | |||||
function handleLogin() { | |||||
loginFormRef.value.validate((val: any) => { | |||||
if (val) { | |||||
const data = { | |||||
username: loginData.value.username, | |||||
password: loginData.value.password, | |||||
captcha: loginData.value.captcha, | |||||
}; | |||||
isLogining.value = true; | |||||
doLogin(data); | |||||
} else { | |||||
const msg = | |||||
currentLan.value == "zh-cn" | |||||
? "请检查信息格式!" | |||||
: "Please check the format !"; | |||||
ElMessage.error(msg); | |||||
return; | |||||
} | |||||
}); | |||||
} | |||||
// 注册行为 | // 注册行为 | ||||
//#region 忘记密码 表单3 | //#region 忘记密码 表单3 | ||||
@@ -1130,7 +1109,7 @@ async function checkInviteCode() { | |||||
isLogin.value = 8; | isLogin.value = 8; | ||||
// 有邀请码直接前往我的页面 | // 有邀请码直接前往我的页面 | ||||
} else if (status == 1) { | } else if (status == 1) { | ||||
userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||||
// userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||||
ElMessage.success( | ElMessage.success( | ||||
'currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"' | 'currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"' | ||||
); | ); | ||||
@@ -1152,7 +1131,7 @@ async function handleInvitatioCode() { | |||||
}; | }; | ||||
try { | try { | ||||
const res = await doUpdateInviteCode(data); | const res = await doUpdateInviteCode(data); | ||||
userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||||
// userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||||
ElMessage.success( | ElMessage.success( | ||||
'currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"' | 'currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"' | ||||
); | ); | ||||
@@ -1182,6 +1161,49 @@ function getCode() { | |||||
* @param {Object} data | * @param {Object} data | ||||
* @return: data | * @return: data | ||||
*/ | */ | ||||
/** | |||||
* @description:重新发送邮件 | |||||
* @param {string} email | |||||
* @return: data | |||||
*/ | |||||
async function reSendEmail(email: string) { | |||||
const msg = | |||||
currentLan.value == "zh-cn" | |||||
? "确认信息已发送至您的邮箱,请注意查收!" | |||||
: "An email has been send to you, Please pay attention to confirm !"; | |||||
await sendRegisterEmail(email) | |||||
.then((res) => { | |||||
console.log(res, "res"); | |||||
ElMessage.success(msg); | |||||
}) | |||||
.catch((err) => { | |||||
console.log(err, "err"); | |||||
ElMessage.error(err.message); | |||||
}); | |||||
} | |||||
//#region 新登录 | |||||
// 登录行为 | |||||
function handleLogin() { | |||||
loginFormRef.value.validate((val: any) => { | |||||
if (val) { | |||||
const data = { | |||||
username: loginData.value.username, | |||||
password: loginData.value.password, | |||||
captcha: loginData.value.captcha, | |||||
}; | |||||
isLogining.value = true; | |||||
doLogin(data); | |||||
} else { | |||||
const msg = | |||||
currentLan.value == "zh-cn" | |||||
? "请检查信息格式!" | |||||
: "Please check the format !"; | |||||
ElMessage.error(msg); | |||||
return; | |||||
} | |||||
}); | |||||
} | |||||
async function doLogin(data: any) { | async function doLogin(data: any) { | ||||
const msg = | const msg = | ||||
currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"; | currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"; | ||||
@@ -1191,11 +1213,12 @@ async function doLogin(data: any) { | |||||
// localStorage.setItem("AccessToken", res.data.token); | // localStorage.setItem("AccessToken", res.data.token); | ||||
// 注册成功将账号密码保存到本地 | // 注册成功将账号密码保存到本地 | ||||
saveInfo(data); | saveInfo(data); | ||||
await getMenuNavFunc(); | |||||
isLogining.value = false; | isLogining.value = false; | ||||
// await checkInviteCode(); | // await checkInviteCode(); | ||||
userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||||
// userInfoPinia.getUserInfo(); //保存邮箱到pinia | |||||
ElMessage.success(msg); | ElMessage.success(msg); | ||||
router.push("/createVideo"); | |||||
router.push("/model"); | |||||
}) | }) | ||||
.catch((err) => { | .catch((err) => { | ||||
console.log(err, "err"); | console.log(err, "err"); | ||||
@@ -1208,28 +1231,17 @@ async function doLogin(data: any) { | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
//#endregion | |||||
/** | |||||
* @description:重新发送邮件 | |||||
* @param {string} email | |||||
* @return: data | |||||
*/ | |||||
async function reSendEmail(email: string) { | |||||
const msg = | |||||
currentLan.value == "zh-cn" | |||||
? "确认信息已发送至您的邮箱,请注意查收!" | |||||
: "An email has been send to you, Please pay attention to confirm !"; | |||||
await sendRegisterEmail(email) | |||||
.then((res) => { | |||||
console.log(res, "res"); | |||||
ElMessage.success(msg); | |||||
}) | |||||
.catch((err) => { | |||||
console.log(err, "err"); | |||||
ElMessage.error(err.message); | |||||
}); | |||||
//#region 获取菜单导航路由 | |||||
async function getMenuNavFunc() { | |||||
try { | |||||
const res = await getMenuNavApi(); | |||||
} catch (error) { | |||||
console.log(error); | |||||
} | |||||
} | } | ||||
//#endregion -------------------------------- | |||||
onMounted(() => { | onMounted(() => { | ||||
getCode(); | getCode(); | ||||
getInfo(); | getInfo(); | ||||
@@ -0,0 +1,171 @@ | |||||
<template> | |||||
<div class="page flex justify-around"> | |||||
<div class="card"> | |||||
<div class="title">密钥管理</div> | |||||
<div class="key"> | |||||
<span class="text">密钥:{{ showCode }}</span> | |||||
<span class="showOrHide" @click="showHideCode">{{ showText }}</span> | |||||
<span v-if="showText == '隐藏'" class="copy" @click="copyKey" | |||||
>复制</span | |||||
> | |||||
</div> | |||||
<div class="keyStatus"> | |||||
<span class="text" | |||||
>密钥状态:{{ keyStatus == 1 ? "正常" : "作废" }}</span | |||||
> | |||||
<span v-if="keyStatus == 1" class="success" @click="changeStatus(2)" | |||||
>恢复</span | |||||
> | |||||
<span v-if="keyStatus == 2" class="fail" @click="changeStatus(1)" | |||||
>作废</span | |||||
> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</template> | |||||
<!-- videoType==1为竖,==2为横 --> | |||||
<script setup> | |||||
//#region 导入 | |||||
import { linkEmits } from "element-plus"; | |||||
import { getCurrentInstance } from "vue"; | |||||
import { useI18n } from "vue-i18n"; | |||||
import { useRoute, useRouter } from "vue-router"; | |||||
const route = useRoute(); | |||||
const router = useRouter(); | |||||
const { locale } = useI18n(); | |||||
const lanChange = ref(locale); | |||||
const AccessToken = localStorage.getItem("AccessToken"); // 判断有没有登录 | |||||
const key = ref("AE0DVHDWMDOURSBCAP"); | |||||
const hideCode = ref(""); | |||||
const showCode = ref(""); | |||||
const showText = ref("查看"); | |||||
const getKey = () => { | |||||
const len = key.value.length; | |||||
let code = ""; | |||||
for (let index = 0; index < len; index++) { | |||||
code += "*"; | |||||
} | |||||
hideCode.value = code; | |||||
showCode.value = code; | |||||
}; | |||||
const showHideCode = () => { | |||||
if (showText.value == "查看") { | |||||
showText.value = "隐藏"; | |||||
showCode.value = key.value; | |||||
} else { | |||||
showText.value = "查看"; | |||||
showCode.value = hideCode.value; | |||||
} | |||||
}; | |||||
const copyKey = () => { | |||||
navigator.clipboard | |||||
.writeText(key.value) | |||||
.then(() => { | |||||
ElMessage.success("复制成功!"); | |||||
}) | |||||
.catch(() => { | |||||
ElMessage.error("复制失败!"); | |||||
}); | |||||
}; | |||||
const keyStatus = ref(""); | |||||
const getStatus = () => { | |||||
// 1:正常;2:作废 | |||||
const status = 1; | |||||
keyStatus.value = status; | |||||
}; | |||||
const changeStatus = (num) => { | |||||
keyStatus.value = num; | |||||
}; | |||||
onMounted(() => { | |||||
getKey(); | |||||
getStatus(); | |||||
}); | |||||
</script> | |||||
<style lang="scss" scoped> | |||||
.page { | |||||
height: calc(100vh - 80px); | |||||
// height: calc(100vh - 80px); | |||||
background-color: #ffffff; | |||||
border-radius: 30px 0 0 0; | |||||
overflow: hidden; | |||||
.card { | |||||
width: 70%; | |||||
height: 70%; | |||||
background-color: #f8f8f8; | |||||
margin-top: 10vh; | |||||
border-radius: 5vh; | |||||
box-shadow: #0000002e 1px 1px 1px 1px; | |||||
.title { | |||||
text-align: center; | |||||
font-size: 4vh; | |||||
padding: 5vh; | |||||
} | |||||
.key { | |||||
text-align: center; | |||||
font-size: 4vh; | |||||
padding: 5vh; | |||||
.copy { | |||||
color: #ffffff; | |||||
margin-left: 2vh; | |||||
cursor: pointer; | |||||
transition: all 0.3s; | |||||
background-color: #3a57b6; | |||||
padding: 0.7vh; | |||||
border-radius: 15px; | |||||
&:hover { | |||||
background-color: #1ceedc; | |||||
} | |||||
} | |||||
.showOrHide { | |||||
color: #20b4a8; | |||||
margin-left: 2vh; | |||||
cursor: pointer; | |||||
transition: all 0.3s; | |||||
&:hover { | |||||
color: #476ad9; | |||||
} | |||||
} | |||||
} | |||||
.keyStatus { | |||||
text-align: center; | |||||
font-size: 4vh; | |||||
padding: 5vh; | |||||
.success { | |||||
color: #ff0000; | |||||
margin-left: 2vh; | |||||
cursor: pointer; | |||||
transition: all 0.3s; | |||||
&:hover { | |||||
color: #36db43; | |||||
} | |||||
} | |||||
.fail { | |||||
color: #36db43; | |||||
margin-left: 2vh; | |||||
cursor: pointer; | |||||
transition: all 0.3s; | |||||
&:hover { | |||||
color: #ff0000; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,16 @@ | |||||
<template> | |||||
<div class="page flex justify-around"></div> | |||||
</template> | |||||
<!-- videoType==1为竖,==2为横 --> | |||||
<script setup></script> | |||||
<style lang="scss" scoped> | |||||
.page { | |||||
height: calc(100vh - 80px); | |||||
// height: calc(100vh - 80px); | |||||
background-color: #fff; | |||||
border-radius: 30px 0 0 0; | |||||
overflow: hidden; | |||||
} | |||||
</style> |