Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jiaxiu-miniapp
Project
Project
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
蔡亮华(贵阳日报)
jiaxiu-miniapp
Commits
d9dae14a
Commit
d9dae14a
authored
Jan 02, 2025
by
彭佳妮(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录逻辑修改
parent
56979060
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
8 deletions
+41
-8
components.d.ts
components.d.ts
+3
-0
App.vue
src/App.vue
+7
-7
login.vue
src/pages/account/login.vue
+31
-1
No files found.
components.d.ts
View file @
d9dae14a
...
...
@@ -16,10 +16,13 @@ declare module 'vue' {
VanForm
:
typeof
import
(
'vant/es'
)[
'Form'
]
VanIcon
:
typeof
import
(
'vant/es'
)[
'Icon'
]
VanList
:
typeof
import
(
'vant/es'
)[
'List'
]
VanNoticeBar
:
typeof
import
(
'vant/es'
)[
'NoticeBar'
]
VanPopup
:
typeof
import
(
'vant/es'
)[
'Popup'
]
VanPullRefresh
:
typeof
import
(
'vant/es'
)[
'PullRefresh'
]
VanSearch
:
typeof
import
(
'vant/es'
)[
'Search'
]
VanSticky
:
typeof
import
(
'vant/es'
)[
'Sticky'
]
VanSwipe
:
typeof
import
(
'vant/es'
)[
'Swipe'
]
VanSwipeItem
:
typeof
import
(
'vant/es'
)[
'SwipeItem'
]
VanTab
:
typeof
import
(
'vant/es'
)[
'Tab'
]
VanTabs
:
typeof
import
(
'vant/es'
)[
'Tabs'
]
VanTextEllipsis
:
typeof
import
(
'vant/es'
)[
'TextEllipsis'
]
...
...
src/App.vue
View file @
d9dae14a
...
...
@@ -6,13 +6,13 @@ import { loginBySgy } from '@/api/account'
const
userStore
=
useUserStore
()
onLaunch
(
async
()
=>
{
// #ifdef H5-SGY
if
(
import
.
meta
.
env
.
VITE_APP_ENV
===
'production'
)
{
userStore
.
logout
()
fastLoginBySgy
()
return
}
else
{
if
(
userStore
.
logout
)
await
signIn2
();
}
//
if (import.meta.env.VITE_APP_ENV === 'production') {
//
userStore.logout()
//
fastLoginBySgy()
//
return
//
} else {
//
if (userStore.logout) await signIn2();
//
}
// #endif
});
...
...
src/pages/account/login.vue
View file @
d9dae14a
...
...
@@ -75,6 +75,7 @@
import
{
showToast
,
showLoadingToast
,
closeToast
}
from
'vant'
import
{
loginByPassword
,
loginBySgy
}
from
'@/api/account'
import
useUserStore
from
'@/store/user'
import
testJson
from
'@/utils/test.json'
;
const
router
=
useRouter
()
const
userStore
=
useUserStore
()
...
...
@@ -85,6 +86,19 @@ const formData = ref({
account
:
''
,
password
:
''
})
onLoad
(
async
()
=>
{
if
(
import
.
meta
.
env
.
VITE_APP_ENV
===
'development'
)
{
if
(
userStore
.
logout
)
await
signIn2
();
return
}
if
(
xma
.
xh
.
isMediaConvergenceXinhuaApp
())
{
userStore
.
logout
()
fastLoginBySgy
()
}
})
const
login
=
async
()
=>
{
if
(
!
formData
.
value
.
account
)
{
showToast
(
'请输入用户名'
)
...
...
@@ -133,10 +147,26 @@ const fastLoginBySgy = () => {
icon
:
'success'
})
// router.pushTab({ name: 'home' })
router
.
back
()
// router.back()
router
.
push
({
name
:
'home'
})
}
});
}
// 登录
const
signIn2
=
async
()
=>
{
showLoadingToast
({
title
:
'加载中...'
,
mask
:
true
,
});
sgyLoginParams
.
value
.
encryptDataMap
=
testJson
const
res
=
await
loginBySgy
(
sgyLoginParams
.
value
)
console
.
log
(
res
)
userStore
.
login
(
res
)
closeToast
()
// router.pushTab({ name: 'home' })
router
.
push
({
name
:
'mine'
})
};
</
script
>
<
style
scoped
>
...
...
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