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
3316cf3e
Commit
3316cf3e
authored
Sep 03, 2024
by
彭佳妮(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
d250007c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
14 deletions
+56
-14
App.vue
src/App.vue
+55
-5
pages.json
src/pages.json
+0
-8
login.vue
src/pages/account/login.vue
+1
-1
No files found.
src/App.vue
View file @
3316cf3e
<
script
setup
lang=
"ts"
>
onLaunch
(()
=>
{
console
.
log
(
'App Launch'
);
<
script
setup
>
import
useUserStore
from
'@/store/user'
import
{
showToast
,
showLoadingToast
,
closeToast
}
from
'vant'
import
testJson
from
'@/utils/test.json'
;
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
();
}
// #endif
});
onShow
(()
=>
{
console
.
log
(
'App Show'
);
console
.
log
(
'App Show'
);
});
onHide
(()
=>
{
console
.
log
(
'App Hide'
);
console
.
log
(
'App Hide'
);
});
const
sgyLoginParams
=
ref
({
appid
:
import
.
meta
.
env
.
VITE_APP_SGY_APPID
,
type
:
"sgy"
,
encryptDataMap
:
{},
systemcode
:
import
.
meta
.
env
.
VITE_APP_SYSTEM_CODE
})
// 登录
const
signIn2
=
async
()
=>
{
showLoadingToast
({
title
:
'加载中...'
,
mask
:
true
,
});
sgyLoginParams
.
value
.
encryptDataMap
=
testJson
const
res
=
await
loginBySgy
(
sgyLoginParams
.
value
)
console
.
log
(
res
)
userStore
.
login
(
res
)
closeToast
()
};
const
fastLoginBySgy
=
()
=>
{
xma
.
xh
.
getUserProfile
({
range
:
[
'ACCOUNT'
,
'MOBILE'
],
async
success
(
info
)
{
showLoadingToast
({
message
:
'登录中'
,
forbidClick
:
true
,
duration
:
0
})
sgyLoginParams
.
value
.
encryptDataMap
=
info
.
data
const
res
=
await
loginBySgy
(
sgyLoginParams
.
value
)
userStore
.
login
(
res
)
closeToast
()
}
});
}
</
script
>
<
style
></
style
>
src/pages.json
View file @
3316cf3e
...
...
@@ -6,14 +6,6 @@
}
},
"pages"
:
[
//
pages
数组中第一项表示应用启动页
{
"path"
:
"pages/home/loading"
,
"name"
:
"loading"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/home/indexNew"
,
"name"
:
"home"
,
...
...
src/pages/account/login.vue
View file @
3316cf3e
...
...
@@ -114,7 +114,7 @@ const sgyLoginParams = ref({
})
const
fastLoginBySgy
=
()
=>
{
xma
.
xh
.
getUserProfile
({
range
:
[
'ACCOUNT'
,
'MOBILE'
,
'CITIZEN'
],
range
:
[
'ACCOUNT'
,
'MOBILE'
],
async
success
(
info
)
{
console
.
log
(
info
)
showLoadingToast
({
...
...
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