Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mocp-uniapp
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
pangchong
mocp-uniapp
Commits
4fff4973
Commit
4fff4973
authored
Aug 22, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 接入amms
parent
eedbab76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
6 deletions
+38
-6
src/pages/modules/mocp/login/constants/index.compositions.js
+3
-2
src/pages/modules/mocp/login/constants/index.functionals.js
+29
-1
src/pages/modules/mocp/login/index.vue
+6
-3
No files found.
src/pages/modules/mocp/login/constants/index.compositions.js
View file @
4fff4973
...
...
@@ -2,10 +2,11 @@ import { ref, reactive } from 'vue'
export
const
loginFormRef
=
ref
()
//表单数据
export
const
loginForm
=
reactive
({
username
:
'
devzj3'
,
password
:
'
Ifar_9527008'
,
username
:
'
'
,
//devzj3
password
:
'
'
,
//Ifar_9527008
verifyCode
:
''
})
export
const
showLoad
=
ref
(
false
)
export
const
loginCode
=
ref
(
''
)
//表单规则
export
const
rules
=
reactive
({
...
...
src/pages/modules/mocp/login/constants/index.functionals.js
View file @
4fff4973
import
{
loginCode
,
loginForm
}
from
'./index.compositions'
import
{
loginCode
,
loginForm
,
showLoad
}
from
'./index.compositions'
import
{
getGifCaptchaApi
}
from
'mocp/api/user'
//获取验证码
...
...
@@ -11,3 +11,31 @@ export const getGifCaptcha = async () => {
loginCode
.
value
=
'data:image/png;base64,'
+
uni
.
arrayBufferToBase64
(
res
)
}
}
//接入amms
export
const
loginAmms
=
()
=>
{
const
ammsToken
=
uni
.
getStorageSync
(
'access_token'
)
if
(
ammsToken
)
{
showLoad
.
value
=
true
uni
.
request
({
url
:
`http://10.72.63.191:8080/mroapi/auth/oauth/check_token?token=
${
ammsToken
}
`
,
method
:
'GET'
,
header
:
{
Authorization
:
'Basic YXBwOmVraW5n'
}
})
.
then
(
function
(
res
)
{
showLoad
.
value
=
false
if
(
res
.
username
)
{
loginForm
.
username
=
res
.
username
loginForm
.
verifyCode
=
'Mocp_DebuG_9527_8341'
loginForm
.
password
=
'Ifar2016_0525'
handleLogin
()
}
})
.
catch
(
function
(
reason
)
{
showLoad
.
value
=
false
console
.
log
(
'AMMS跳转登录出现错误'
,
reason
)
})
}
}
src/pages/modules/mocp/login/index.vue
View file @
4fff4973
<
template
>
<global-page
:showNavbar=
"false"
>
<up-loading-page
:loading=
"showLoad"
loading-text=
"跳转中,请耐心等待..."
font-size=
"14"
></up-loading-page>
<global-page
:showNavbar=
"false"
v-if=
"!showLoad"
>
<view
class=
"login-wrap"
>
<view
class=
"login-header"
>
<image
src=
"/static/mocp/image/login/Vector.png"
/>
...
...
@@ -39,8 +40,8 @@
<
script
setup
>
import
{
debounce
}
from
'lodash'
import
{
loginCode
,
loginForm
,
rules
,
loginFormRef
}
from
'./constants/index.compositions'
import
{
getGifCaptcha
}
from
'./constants/index.functionals'
import
{
loginCode
,
loginForm
,
rules
,
loginFormRef
,
showLoad
}
from
'./constants/index.compositions'
import
{
getGifCaptcha
,
loginAmms
}
from
'./constants/index.functionals'
import
{
onLoad
}
from
'@dcloudio/uni-app'
import
{
ref
,
toRaw
,
watch
}
from
'vue'
import
useUserStore
from
'mocp/store/user'
...
...
@@ -54,9 +55,11 @@ watch(
}
},
500
)
)
onLoad
(()
=>
{
loginForm
.
verifyCode
=
''
getGifCaptcha
()
loginAmms
()
})
//登录
...
...
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