Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bigwood
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
罗超
bigwood
Commits
597da35f
Commit
597da35f
authored
Jun 28, 2023
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据域名渲染菜单
parent
59741d29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1594 additions
and
135 deletions
+1594
-135
App.vue
src/App.vue
+6
-1
home-hp.png
src/assets/images/home-hp.png
+0
-0
i18n.ts
src/boot/i18n.ts
+8
-3
CompositionComponent.vue
src/components/CompositionComponent.vue
+12
-3
Notifications.vue
src/components/layout/Notifications.vue
+9
-2
navs.vue
src/components/layout/navs.vue
+8
-2
dictionary.ts
src/config/dictionary.ts
+5
-1
index.ts
src/i18n/zh-SW/index.ts
+1490
-99
MainLayout.vue
src/layouts/MainLayout.vue
+13
-8
login.vue
src/pages/auth/login.vue
+11
-3
tools.ts
src/utils/tools.ts
+10
-3
validate.ts
src/utils/validate.ts
+22
-10
No files found.
src/App.vue
View file @
597da35f
...
...
@@ -3,11 +3,12 @@
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
onBeforeUnmount
}
from
'vue'
;
import
{
defineComponent
,
onBeforeUnmount
,
provide
}
from
'vue'
;
import
{
useQuasar
,
QSpinnerFacebook
}
from
'quasar'
import
{
useI18n
}
from
'vue-i18n'
import
axios
from
'axios'
;
import
{
DirtionmaryHelper
}
from
'./config/dictionary'
;
import
{
getDomainName
}
from
'./utils/validate'
export
default
defineComponent
({
name
:
'App'
,
setup
(
props
,
context
)
{
...
...
@@ -17,6 +18,10 @@ export default defineComponent({
if
(
localStorage
.
vuex
)
{
localStorage
.
clear
()
}
// 存储当前域名
provide
(
DirtionmaryHelper
.
DOMAIN_NAME
,
getDomainName
())
onBeforeUnmount
(()
=>
{
if
(
timer
!==
void
0
)
{
clearTimeout
(
timer
)
...
...
src/assets/images/home-hp.png
0 → 100644
View file @
597da35f
74.4 KB
src/boot/i18n.ts
View file @
597da35f
import
{
boot
}
from
'quasar/wrappers'
import
{
createI18n
}
from
'vue-i18n'
import
{
getDomainName
}
from
'../utils/validate'
import
messages
from
'src/i18n'
export
type
MessageLanguages
=
keyof
typeof
messages
;
...
...
@@ -20,9 +20,14 @@ declare module 'vue-i18n' {
// define the number format schema
export
interface
DefineNumberFormat
{}
}
let
Language
if
(
getDomainName
()){
Language
=
localStorage
.
getItem
(
'lanuage'
)
??
'zhTW'
}
else
{
Language
=
localStorage
.
getItem
(
'lanuage'
)
??
'zhSW'
}
const
i18n
=
createI18n
({
locale
:
localStorage
.
getItem
(
'lanuage'
)
??
'zhTW'
,
locale
:
Language
,
legacy
:
false
,
warnHtmlInMessage
:
false
,
warnHtmlMessage
:
false
,
...
...
src/components/CompositionComponent.vue
View file @
597da35f
<
template
>
<div
class=
"text-center"
>
<!--
<img
src=
"../assets/images/lg-logo.png"
style=
"height:200px;"
/>
-->
<img
src=
"../assets/images/home.png"
style=
"width: 50%;"
/>
<img
v-if=
"isDomainName_PIC"
src=
"../assets/images/home.png"
style=
"width: 50%;"
/>
<img
v-else
src=
"../assets/images/home-hp.png"
style=
"width: 50%;"
/>
<!--
<div
class=
"q-mt-lg text-h3 text-grey-4 text-center"
>
歡迎使用PIC同業預定系統
</div>
-->
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
PropType
,
computed
,
re
f
,
toRef
,
Ref
}
from
'vue'
import
{
defineComponent
,
PropType
,
computed
,
re
active
,
toRefs
,
ref
,
toRef
,
Ref
,
inject
}
from
'vue'
import
{
Todo
,
Meta
}
from
'./models'
import
{
DirtionmaryHelper
}
from
'../config/dictionary'
function
useClickCount
()
{
const
clickCount
=
ref
(
0
)
...
...
@@ -45,7 +47,14 @@ export default defineComponent({
}
},
setup
(
props
)
{
return
{
...
useClickCount
(),
...
useDisplayTodo
(
toRef
(
props
,
'todos'
))
}
const
data
=
reactive
({
isDomainName_PIC
:
true
})
// 根据域名渲染logo
data
.
isDomainName_PIC
=
inject
(
DirtionmaryHelper
.
DOMAIN_NAME
)
return
{
...
useClickCount
(),
...
useDisplayTodo
(
toRef
(
props
,
'todos'
)),...
toRefs
(
data
),
}
}
})
</
script
>
src/components/layout/Notifications.vue
View file @
597da35f
...
...
@@ -37,7 +37,7 @@
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
reactive
,
toRefs
,
provide
,
onMounted
}
from
'vue'
import
{
defineComponent
,
ref
,
reactive
,
toRefs
,
provide
,
onMounted
,
inject
}
from
'vue'
import
{
useMenus
,
Menu
}
from
'../../utils/menus'
import
{
getLangs
}
from
"../../utils/tools"
;
import
{
SitLang
}
from
'../../@types'
;
...
...
@@ -46,6 +46,7 @@
import
{
UserActionsType
}
from
'../../store/modules/user/actions'
;
import
useScrollModule
from
'../../module/scrollbar/scrollModule'
import
svgIcon
from
'../global/svg-icon.vue'
import
{
DirtionmaryHelper
}
from
'../../config/dictionary'
;
export
default
defineComponent
({
components
:
{
svgIcon
},
name
:
'user-info'
,
...
...
@@ -64,7 +65,13 @@
scrollStyle
:
{}
as
any
,
})
data
.
scrollStyle
=
useScrollModule
().
scrollStyle
data
.
menus
=
useMenus
.
getMenus
()
// 根据域名渲染菜单
const
menList
=
useMenus
.
getMenus
().
filter
(
x
=>
{
return
x
.
id
==
16
})
data
.
menus
=
!
inject
(
DirtionmaryHelper
.
DOMAIN_NAME
)?
menList
:
useMenus
.
getMenus
()
data
.
langs
=
getLangs
()
if
(
data
.
langs
&&
data
.
langs
.
length
>
0
){
data
.
currentLang
=
data
.
langs
.
find
(
x
=>
x
.
langLocale
==
locale
.
value
)
??
{};
...
...
src/components/layout/navs.vue
View file @
597da35f
...
...
@@ -5,9 +5,10 @@
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
reactive
,
toRefs
}
from
'vue'
import
{
defineComponent
,
ref
,
reactive
,
toRefs
,
inject
}
from
'vue'
import
navItem
from
'./nav-item.vue'
import
{
useMenus
,
Menu
}
from
'../../utils/menus'
import
{
DirtionmaryHelper
}
from
'../../config/dictionary'
;
export
default
defineComponent
({
components
:
{
navItem
},
name
:
'navs'
,
...
...
@@ -15,7 +16,12 @@ export default defineComponent({
const
data
=
reactive
({
menus
:
[]
as
Menu
[]
})
data
.
menus
=
useMenus
.
getMenus
()
// 根据域名渲染菜单
const
menList
=
useMenus
.
getMenus
().
filter
(
x
=>
{
return
x
.
id
==
16
})
data
.
menus
=
!
inject
(
DirtionmaryHelper
.
DOMAIN_NAME
)?
menList
:
useMenus
.
getMenus
()
return
{...
toRefs
(
data
)}
}
...
...
src/config/dictionary.ts
View file @
597da35f
...
...
@@ -100,6 +100,10 @@ class DirtionmaryHelper {
/**
* 幸福存折详情
*/
static
readonly
PASSBOOK_DETAILS
=
"passbookDetails"
static
readonly
PASSBOOK_DETAILS
=
"passbookDetails"
/**
* 域名
*/
static
readonly
DOMAIN_NAME
=
"domainName"
}
export
{
userDictionmary
,
DirtionmaryHelper
}
src/i18n/zh-SW/index.ts
View file @
597da35f
This diff is collapsed.
Click to expand it.
src/layouts/MainLayout.vue
View file @
597da35f
<
template
>
<q-layout
view=
"lHh lpr lFf"
style=
"background: #f5f8fa"
>
<q-header
reveal
class=
"bg-white text-white q-px-md q-py-sm"
>
<q-toolbar>
...
...
@@ -37,7 +37,8 @@
<q-drawer
show-if-above
v-model=
"leftDrawerOpen"
style=
"background: #1e1e2d; width: 265px"
side=
"left"
class=
"column"
>
<div
style=
"box-sizing: border-box; height: 66px; border-bottom: 1px dashed #444"
class=
"row items-center q-px-md desktop-only"
>
<img
src=
"../assets/images/pic-log.png"
alt=
""
style=
"height: 30px"
/>
<img
v-if=
"isDomainName_PIC"
src=
"../assets/images/pic-log.png"
alt=
""
style=
"height: 30px"
/>
<img
v-else
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1679454107000_656.png"
alt=
""
style=
"height: 30px"
/>
<!--
<div
class=
"text-white text-weight-bold text-subtitle1 q-ml-md"
>
{{
$t
(
'siteName'
)
}}
</div>
-->
</div>
<q-scroll-area
:thumb-style=
"scrollStyle.thumbStyle"
:bar-style=
"scrollStyle.barStyle"
class=
"col nav-list q-pl-lg"
>
...
...
@@ -81,8 +82,8 @@ export default {
components
:
{
svgIcon
,
Navs
,
userInfo
,
Notifications
},
setup
()
{
const
leftDrawerOpen
=
ref
(
false
)
const
data
=
reactive
({
userInfo
:
{}
as
any
,
leftDrawerOpen
:
false
,
...
...
@@ -90,8 +91,12 @@ export default {
timer
:
0
,
isDadge
:
true
,
version
:
''
,
isDomainName_PIC
:
true
})
// 根据域名渲染logo
data
.
isDomainName_PIC
=
inject
(
DirtionmaryHelper
.
DOMAIN_NAME
)
const
childPageTitle
=
ref
(
''
)
provide
(
DirtionmaryHelper
.
PAGE_TITLE_KEY
,
childPageTitle
)
const
activeMenu
=
ref
(
0
)
...
...
@@ -101,9 +106,9 @@ export default {
// //console.log(getStoreGetter
<
UserGetter
>
(
'user'
,
'getUser'
),
'....'
)
// return getStoreGetter
<
UserGetter
>
(
'user'
,
'getUser'
)
// })
data
.
scrollStyle
=
useScrollModule
().
scrollStyle
const
scrollAreaRef
=
ref
()
const
scrollArea
=
reactive
({
pagesTop
:
0
...
...
@@ -114,7 +119,7 @@ export default {
scrollAreaRef
.
value
.
setScrollPosition
(
'vertical'
,
n
,
100
)
}
)
const
methods
=
{
toggleLeftDrawer
()
{
data
.
leftDrawerOpen
=
!
data
.
leftDrawerOpen
...
...
src/pages/auth/login.vue
View file @
597da35f
...
...
@@ -4,7 +4,8 @@
<div
style=
"width:450px;"
class=
"column justify-between content-between"
>
<div
:class=
"
{'row':$q.platform.is.desktop,'column':$q.platform.is.mobile}">
<div
class=
"col"
:class=
"
{'text-center q-mb-md':$q.platform.is.mobile}">
<img
src=
"../../assets/images/jvs-log.png"
style=
"width:80%;"
/>
<img
v-if=
"isDomainName_PIC"
src=
"../../assets/images/jvs-log.png"
style=
"width:80%;"
/>
<img
v-else
src=
"http://imgfile.oytour.com/Upload/WebSite/202303170746500900000000054.png"
style=
"width:80%;"
/>
</div>
</div>
<div
class=
"q-py-xxl full-width"
>
...
...
@@ -65,16 +66,18 @@
</template>
<
script
lang=
"ts"
>
import
{
defineComponent
,
reactive
,
ref
}
from
'vue'
import
{
defineComponent
,
reactive
,
ref
,
inject
}
from
'vue'
import
useLgoinModule
from
'../../module/user/loginModule'
import
useMetaModule
from
'../../module/meta/metaModule'
import
{
useI18n
}
from
'vue-i18n'
import
{
getLangs
}
from
"../../utils/tools"
;
import
{
SitLang
}
from
'../../@types'
;
import
{
useQuasar
}
from
'quasar'
;
import
{
DirtionmaryHelper
}
from
'../../config/dictionary'
export
default
defineComponent
({
setup
()
{
//TODO: 缺陷,验证与提交应该使用Form表单来完成,不应该进行单个验证
let
{
userModel
,
usernameRef
,
passwordRef
,
userValidateRule
,
loginSubmit
,
stateManager
}
=
useLgoinModule
()
let
{
setTitle
}
=
useMetaModule
()
...
...
@@ -83,8 +86,13 @@ export default defineComponent({
setTitle
(
t
(
"login.pageTitle"
))
const
data
=
reactive
({
currentLang
:
{}
as
SitLang
,
langs
:[]
as
SitLang
[]
langs
:[]
as
SitLang
[],
isDomainName_PIC
:
true
})
// 根据域名渲染logo
data
.
isDomainName_PIC
=
inject
(
DirtionmaryHelper
.
DOMAIN_NAME
)
data
.
langs
=
getLangs
()
if
(
data
.
langs
&&
data
.
langs
.
length
>
0
){
data
.
currentLang
=
data
.
langs
.
find
(
x
=>
x
.
langLocale
==
locale
.
value
)
??
{};
...
...
src/utils/tools.ts
View file @
597da35f
import
{
SitLang
,
StandardStatus
,
RoomType
,
OrderType
,
DinnerType
,
HotelType
,
SendType
}
from
'./../@types/index'
;
import
{
i18n
}
from
'../boot/i18n'
import
{
getDomainName
}
from
'../utils/validate'
const
{
t
}
=
i18n
.
global
/**
* @description 按照需要写入 必要可以注入全局
...
...
@@ -356,7 +357,7 @@ export function moneyFormat (num:any, decimal = 2, split = ','):any {
var
res
=
''
var
dotIndex
=
String
(
num
).
indexOf
(
'.'
)
if
(
dotIndex
===
-
1
)
{
// 整数
res
=
thousandFormat
(
String
(
num
))
+
'.'
+
'0'
.
repeat
(
decimal
)
res
=
thousandFormat
(
String
(
num
))
+
'.'
+
'0'
.
repeat
(
decimal
)
}
else
{
const
numStr
=
String
((
Math
.
round
(
num
*
Math
.
pow
(
10
,
decimal
))
/
Math
.
pow
(
10
,
decimal
)).
toFixed
(
decimal
))
// 四舍五入,然后固定保留2位小数
const
decimals
=
numStr
.
slice
(
dotIndex
,
dotIndex
+
decimal
+
1
)
// 截取小数位
...
...
@@ -469,7 +470,13 @@ export function getLangs() {
quasarLang
:
'zh-TW'
}
let
langs
:
SitLang
[]
=
[]
// zhSw,enUs
langs
.
push
(
zhTw
,
koHG
,
jaRB
)
// 根据域名渲染简体
if
(
!
getDomainName
()){
langs
.
push
(
zhSw
)
}
else
{
langs
.
push
(
zhTw
,
koHG
,
jaRB
)
}
return
langs
}
src/utils/validate.ts
View file @
597da35f
...
...
@@ -33,19 +33,19 @@ export function validatAlphabetsName(str: string) {
return
reg
.
test
(
str
)
}
export
function
isEmail
(
account
:
string
):
boolean
{
let
serchfind
:
boolean
;
let
regexp
=
new
RegExp
(
/^
(([^
<>()
\[\]\\
.,;:
\[
email protected
]
"]+
(\.[^
<>()
\[\]\\
.,;:
\[
email protected
]
"]+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}
]
)
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
);
serchfind
=
regexp
.
test
(
account
);
return
serchfind
export
function
isEmail
(
account
:
string
):
boolean
{
let
serchfind
:
boolean
;
let
regexp
=
new
RegExp
(
/^
(([^
<>()
\[\]\\
.,;:
\[
email protected
]
"]+
(\.[^
<>()
\[\]\\
.,;:
\[
email protected
]
"]+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}
]
)
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
);
serchfind
=
regexp
.
test
(
account
);
return
serchfind
}
export
function
isPhone
(
account
:
string
):
boolean
{
let
serchfind
:
boolean
;
export
function
isPhone
(
account
:
string
):
boolean
{
let
serchfind
:
boolean
;
let
regexp
=
new
RegExp
(
/^
((
13|14|15|16|17|18|19
)[
0-9
]{1}\d{8})
$/
);
serchfind
=
regexp
.
test
(
account
);
return
serchfind
}
serchfind
=
regexp
.
test
(
account
);
return
serchfind
}
/** 比对数组是否相同 */
export
function
compareArray
(
arrA
:
any
[],
arrB
:
any
[])
{
...
...
@@ -62,3 +62,15 @@ export function compareArray(arrA: any[], arrB: any[]) {
}
return
isSame
}
/** 获取当前域名 localhost、pic.oytour.com、sell.oytour.com*/
export
function
getDomainName
()
{
let
domainNameUrl
=
window
.
location
.
hostname
;
if
(
domainNameUrl
==
'localhost'
){
return
true
}
else
if
(
domainNameUrl
==
'pic.oytour.com'
){
return
true
}
else
if
(
domainNameUrl
==
'sell.oytour.com'
){
return
false
}
}
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