国际化
This commit is contained in:
@@ -2,7 +2,9 @@ import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router';
|
||||
import {useUserStore} from "@/store/modules/user";
|
||||
import {domainStoreWidthOut} from "@/store/modules/domain";
|
||||
import {getDomainList} from "@/api/login";
|
||||
import { i18n } from '@/lang';
|
||||
|
||||
const { t } = i18n.global
|
||||
export const constantRouter: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: '/',
|
||||
@@ -17,7 +19,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'index',
|
||||
component: () => import('@/views/index/index.vue'),
|
||||
meta: {
|
||||
title: '首页',
|
||||
title: t('router.home'),
|
||||
},
|
||||
children: [
|
||||
{
|
||||
@@ -25,7 +27,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'Home',
|
||||
component: () => import('@/views/index/home/index.vue'),
|
||||
meta: {
|
||||
title: '首页',
|
||||
title: t('router.home'),
|
||||
showBar: false
|
||||
},
|
||||
},
|
||||
@@ -35,7 +37,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
component: () => import('@/views/index/serveList/index.vue'),
|
||||
meta: {
|
||||
isPermissions: true,
|
||||
title: '钱包',
|
||||
title: t('router.serveList'),
|
||||
showBar: false
|
||||
},
|
||||
},
|
||||
@@ -45,7 +47,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
component: () => import('@/views/index/message/index.vue'),
|
||||
meta: {
|
||||
isPermissions: true,
|
||||
title: '聊天',
|
||||
title: t('router.message'),
|
||||
showBar: false
|
||||
},
|
||||
},
|
||||
@@ -55,7 +57,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
component: () => import('@/views/index/my/index.vue'),
|
||||
meta: {
|
||||
isPermissions: true,
|
||||
title: '我的',
|
||||
title: t('router.my'),
|
||||
showBar: false
|
||||
},
|
||||
}
|
||||
@@ -66,7 +68,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'userInfo',
|
||||
component: () => import('@/views/my/userInfo/index.vue'),
|
||||
meta: {
|
||||
title: '我的资料',
|
||||
title: t('router.userInfo'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -76,7 +78,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'userInfo1',
|
||||
component: () => import('@/views/my/userInfo1/index.vue'),
|
||||
meta: {
|
||||
title: '基本信息',
|
||||
title: t('router.userInfo1'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -86,7 +88,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'signature',
|
||||
component: () => import('@/views/my/signature/index.vue'),
|
||||
meta: {
|
||||
title: '签名',
|
||||
title: t('router.signature'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -96,7 +98,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'contract',
|
||||
component: () => import('@/views/my/contract/index.vue'),
|
||||
meta: {
|
||||
title: '合同',
|
||||
title: t('router.contract'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -106,7 +108,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'userInfo2',
|
||||
component: () => import('@/views/my/userInfo2/index.vue'),
|
||||
meta: {
|
||||
title: '提交资料',
|
||||
title: t('router.userInfo2'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -116,7 +118,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'userInfo3',
|
||||
component: () => import('@/views/my/userInfo3/index.vue'),
|
||||
meta: {
|
||||
title: '收款银行卡',
|
||||
title: t('router.userInfo3'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -126,7 +128,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'loansInfo',
|
||||
component: () => import('@/views/loans/info/index.vue'),
|
||||
meta: {
|
||||
title: '借款详情',
|
||||
title: t('router.loansInfo'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -136,7 +138,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'loansInfo1',
|
||||
component: () => import('@/views/loans/info1/index.vue'),
|
||||
meta: {
|
||||
title: '提现',
|
||||
title: t('router.loansInfo1'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -146,7 +148,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'myLoan',
|
||||
component: () => import('@/views/my/myLoan/index.vue'),
|
||||
meta: {
|
||||
title: '我的借款',
|
||||
title: t('router.myLoan'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -156,7 +158,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'myRepayment',
|
||||
component: () => import('@/views/my/myRepayment/index.vue'),
|
||||
meta: {
|
||||
title: '我的还款',
|
||||
title: t('router.myRepayment'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -167,7 +169,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'borrowInfo',
|
||||
component: () => import('@/views/borrowInfo/index.vue'),
|
||||
meta: {
|
||||
title: '贷款详情',
|
||||
title: t('router.borrowInfo'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -177,7 +179,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'uploadPassword',
|
||||
component: () => import('@/views/uploadPassword/index.vue'),
|
||||
meta: {
|
||||
title: '修改密码',
|
||||
title: t('router.uploadPassword'),
|
||||
isPermissions: true,
|
||||
showBar: true
|
||||
},
|
||||
@@ -190,7 +192,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'login',
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
meta: {
|
||||
title: '登录',
|
||||
title: t('router.login'),
|
||||
showBar: false
|
||||
},
|
||||
},
|
||||
@@ -199,7 +201,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'register',
|
||||
component: () => import('@/views/register/index.vue'),
|
||||
meta: {
|
||||
title: '注册',
|
||||
title: t('router.register'),
|
||||
showBar: true
|
||||
},
|
||||
},
|
||||
@@ -208,7 +210,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'forget',
|
||||
component: () => import('@/views/forget/index.vue'),
|
||||
meta: {
|
||||
title: '忘记密码',
|
||||
title: t('router.forget'),
|
||||
showBar: true
|
||||
},
|
||||
},
|
||||
@@ -217,7 +219,7 @@ export const constantRouter: Array<RouteRecordRaw> = [
|
||||
name: 'agreement',
|
||||
component: () => import('@/views/agreement/agreement.vue'),
|
||||
meta: {
|
||||
title: '协议',
|
||||
title: t('router.agreement'),
|
||||
showBar: true
|
||||
},
|
||||
}
|
||||
@@ -238,6 +240,7 @@ const router = createRouter({
|
||||
// @ts-ignore
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const dsw = domainStoreWidthOut()
|
||||
|
||||
if (!dsw.getDomain || dsw.getDomain.length == 0) {
|
||||
const response = await getDomainList()
|
||||
if (response && response.data) {
|
||||
@@ -245,9 +248,11 @@ router.beforeEach(async (to, from, next) => {
|
||||
dsw.setDomain(domain)
|
||||
}
|
||||
}
|
||||
if (to.meta.title) { // 判断是否有标题
|
||||
document.title = to.meta.title as string;
|
||||
}
|
||||
// if (to.meta.titleI18n) { // 判断是否有标题
|
||||
// console.log('sssssss', to.meta.titleI18n)
|
||||
// // document.title = to.meta.title as string;
|
||||
// document.title = t(to.meta.titleI18n as string);
|
||||
// }
|
||||
if (to.meta.isPermissions) {
|
||||
const userStore = useUserStore()
|
||||
if (!userStore.getToken) {
|
||||
|
||||
Reference in New Issue
Block a user