Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhouqian
vue-gjjs
Commits
a3906e5d
Commit
a3906e5d
authored
Apr 14, 2022
by
liuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
切换语种
parent
f055bcc6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletions
+30
-1
index.js
src/lang/index.js
+12
-0
lang.js
src/service/business/lang.js
+6
-0
Header.vue
src/views/Layout/Header.vue
+12
-1
No files found.
src/lang/index.js
View file @
a3906e5d
...
@@ -3,8 +3,12 @@ import VueI18n from "vue-i18n";
...
@@ -3,8 +3,12 @@ import VueI18n from "vue-i18n";
import
Cookies
from
"js-cookie"
;
import
Cookies
from
"js-cookie"
;
import
elementEnLocale
from
"element-ui/lib/locale/lang/en"
;
// element-ui lang
import
elementEnLocale
from
"element-ui/lib/locale/lang/en"
;
// element-ui lang
import
elementZhLocale
from
"element-ui/lib/locale/lang/zh-CN"
;
// element-ui lang
import
elementZhLocale
from
"element-ui/lib/locale/lang/zh-CN"
;
// element-ui lang
import
elementThLocale
from
"element-ui/lib/locale/lang/th"
;
// element-ui lang
import
elementViLocale
from
"element-ui/lib/locale/lang/vi"
;
// element-ui lang
import
enLocale
from
"./local/en/"
;
import
enLocale
from
"./local/en/"
;
import
zhLocale
from
"./local/zh/"
;
import
zhLocale
from
"./local/zh/"
;
import
thLocale
from
"./local/en/"
;
//TODO 本地th暂无
import
viLocale
from
"./local/en/"
;
//TODO 本地vi暂无
/**
/**
* 详细文档
* 详细文档
...
@@ -21,6 +25,14 @@ const messages = {
...
@@ -21,6 +25,14 @@ const messages = {
...
zhLocale
,
...
zhLocale
,
...
elementZhLocale
,
...
elementZhLocale
,
},
},
th
:
{
...
thLocale
,
...
elementThLocale
,
},
vi
:
{
...
viLocale
,
...
elementViLocale
,
},
};
};
export
function
getLanguage
()
{
export
function
getLanguage
()
{
const
chooseLanguage
=
Cookies
.
get
(
"language"
);
const
chooseLanguage
=
Cookies
.
get
(
"language"
);
...
...
src/service/business/lang.js
0 → 100644
View file @
a3906e5d
import
Api
from
"~/service/Api"
export
function
changeLang
(
data
)
{
return
Api
.
post
(
'/business/lang/changeLang'
,
data
)
}
\ No newline at end of file
src/views/Layout/Header.vue
View file @
a3906e5d
...
@@ -122,6 +122,9 @@
...
@@ -122,6 +122,9 @@
<
script
>
<
script
>
import
cPage
from
"../../components/c-page.vue"
;
import
cPage
from
"../../components/c-page.vue"
;
import
Api
from
"~/service/Api"
;
import
{
changeLang
}
from
"~/service/business/lang"
;
export
default
{
export
default
{
components
:
{
cPage
},
components
:
{
cPage
},
data
()
{
data
()
{
...
@@ -146,6 +149,8 @@ export default {
...
@@ -146,6 +149,8 @@ export default {
languageOptions
:
[
languageOptions
:
[
{
lang
:
"zh"
,
shortName
:
"中文"
,
fullName
:
"中文"
},
{
lang
:
"zh"
,
shortName
:
"中文"
,
fullName
:
"中文"
},
{
lang
:
"en"
,
shortName
:
"En"
,
fullName
:
"English"
},
{
lang
:
"en"
,
shortName
:
"En"
,
fullName
:
"English"
},
{
lang
:
"th"
,
shortName
:
"ไทย"
,
fullName
:
"ภาษาไทย"
},
{
lang
:
"vi"
,
shortName
:
"Tiếng Việt"
,
fullName
:
"Tiếng Việt"
},
],
],
};
};
},
},
...
@@ -175,10 +180,16 @@ export default {
...
@@ -175,10 +180,16 @@ export default {
this
.
$router
.
push
(
"/login"
);
this
.
$router
.
push
(
"/login"
);
// window.location.href = "/#/login"
// window.location.href = "/#/login"
},
},
handleLang
(
lang
)
{
async
handleLang
(
lang
)
{
const
data
=
{
lang
:
lang
}
let
rtnmsg
=
await
changeLang
(
data
)
if
(
rtnmsg
.
respCode
==
SUCCESS
)
{
this
.
$i18n
.
locale
=
lang
;
this
.
$i18n
.
locale
=
lang
;
this
.
$store
.
dispatch
(
"I18n/setLang"
,
lang
);
this
.
$store
.
dispatch
(
"I18n/setLang"
,
lang
);
this
.
langSelectVisible
=
false
;
this
.
langSelectVisible
=
false
;
}
},
},
showLogoutDialog
(
flg
)
{
showLogoutDialog
(
flg
)
{
// this.$refs.logoutform.show(flg);
// this.$refs.logoutform.show(flg);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment