Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
mongo-ui
Commits
ada543f6
Commit
ada543f6
authored
Aug 04, 2020
by
郭志伟
Committed by
郝聪敏
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 联调
parent
1abb06c4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
26 deletions
+21
-26
App.vue
src/App.vue
+4
-4
AuthFromXyqb.vue
src/components/AuthFromXyqb.vue
+1
-10
index.js
src/router/index.js
+11
-1
validation.js
src/service/validation.js
+2
-8
index.js
src/store/index.js
+3
-3
No files found.
src/App.vue
View file @
ada543f6
...
...
@@ -5,17 +5,17 @@
<cr-loading
class=
"loading"
size=
"24px"
>
加载中...
</cr-loading>
</div>
<login-modal
/>
<
auth-from-xyqb
/
>
<
!--
<auth-from-xyqb
/>
--
>
</div>
</
template
>
<
script
>
import
{
mapState
,
mapActions
}
from
"
vuex
"
;
import
LoginModal
from
"
@/components/LoginModal
"
;
import
AuthFromXyqb
from
"
@/components/AuthFromXyqb
"
;
//
import AuthFromXyqb from "@/components/AuthFromXyqb";
export
default
{
components
:
{
LoginModal
,
AuthFromXyqb
LoginModal
//
AuthFromXyqb
},
computed
:
{
...
mapState
([
"
isLoading
"
])
...
...
src/components/AuthFromXyqb.vue
View file @
ada543f6
...
...
@@ -13,8 +13,6 @@
<
script
>
import
{
mapState
,
mapActions
}
from
"
vuex
"
;
import
localStorage
from
"
@/service/localStorage
"
;
import
{
authByxyqb
}
from
"
@/api/user
"
;
export
default
{
name
:
"
AuthFromXyqb
"
,
data
()
{
...
...
@@ -24,14 +22,7 @@ export default {
...
mapState
([
"
showAuthXyqb
"
])
},
methods
:
{
...
mapActions
([
"
setShowAuthXyqb
"
]),
async
getAuthInfo
()
{
const
res
=
await
authByxyqb
();
if
(
res
)
{
localStorage
.
set
(
"
mongoToken
"
,
res
.
token
);
localStorage
.
set
(
"
xyqbUserInfo
"
,
res
);
}
}
...
mapActions
([
"
setShowAuthXyqb
"
])
}
};
</
script
>
...
...
src/router/index.js
View file @
ada543f6
...
...
@@ -3,6 +3,7 @@ import VueRouter from "vue-router";
import
routes
from
"
./routes
"
;
import
{
parseSearch
}
from
"
@/service/utils
"
;
import
{
isXyqb
}
from
"
@/service/validation
"
;
// import cfg from "@/config";
import
{
authByxyqb
}
from
"
@/api/user
"
;
import
localStorage
from
"
@/service/localStorage
"
;
Vue
.
use
(
VueRouter
);
...
...
@@ -23,11 +24,13 @@ const router = new VueRouter({
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
const
urlParams
=
parseSearch
(
window
.
location
.
href
);
if
(
isXyqb
())
getAuthInfo
(
urlParams
.
token
);
if
(
isXyqb
)
getAuthInfo
(
urlParams
.
token
);
// if (isWeixinBrower) getWxOpenId(urlParams.code);
next
();
});
async
function
getAuthInfo
(
xyqbToken
)
{
if
(
localStorage
.
get
(
"
xyqbToken
"
))
return
;
const
res
=
await
authByxyqb
({
xyqbToken
});
if
(
res
)
{
localStorage
.
set
(
"
mongoToken
"
,
res
.
token
);
...
...
@@ -35,6 +38,13 @@ async function getAuthInfo(xyqbToken) {
localStorage
.
set
(
"
xyqbToken
"
,
xyqbToken
);
}
}
// async function getWxOpenId(code) {
// if (localStorage.get("openId")) return;
// const res = await getwxOpenId({ code, appId: cfg.wxAppId });
// this.openId = res.openId;
// localStorage.set("openId", res.openId);
// }
// router.afterEach(() => {});
export
default
router
;
src/service/validation.js
View file @
ada543f6
...
...
@@ -250,12 +250,6 @@ export function isBankNumber(str) {
}
// 判断微信环境
export
function
isWeixinBrower
()
{
const
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
match
(
/MicroMessenger/i
)
===
"
micromessenger
"
;
}
export
const
isWeixinBrower
=
window
.
navigator
.
userAgent
.
toLowerCase
().
match
(
/MicroMessenger/i
)
==
"
micromessenger
"
;
// 判断信用钱包环境
export
function
isXyqb
()
{
const
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
match
(
/xyqb/i
)
===
"
xyqb
"
;
}
export
const
isXyqb
=
window
.
navigator
.
userAgent
.
toLowerCase
().
match
(
/xyqb/i
)
==
"
xyqb
"
;
src/store/index.js
View file @
ada543f6
...
...
@@ -9,7 +9,7 @@ export default new Vuex.Store({
activeIdx
:
0
,
isLoading
:
false
,
isShowLogin
:
false
,
showAuthXyqb
:
true
showAuthXyqb
:
"
init
"
// init 已获取信息未授权,pending 授权弹框
},
mutations
:
{
setActiveIdx
(
state
,
value
)
{
...
...
@@ -21,7 +21,7 @@ export default new Vuex.Store({
setIsShowLogin
(
state
,
value
)
{
state
.
isShowLogin
=
value
;
},
setShowA
uthXyqb
(
state
,
value
)
{
a
uthXyqb
(
state
,
value
)
{
state
.
showAuthXyqb
=
value
;
}
},
...
...
@@ -35,7 +35,7 @@ export default new Vuex.Store({
setIsShowLogin
({
commit
},
args
)
{
commit
(
"
setIsShowLogin
"
,
args
);
},
set
ShowA
uthXyqb
({
commit
},
args
)
{
set
s
uthXyqb
({
commit
},
args
)
{
commit
(
"
setShowAuthXyqb
"
,
args
);
}
},
...
...
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