Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
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
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
bp
op-web-service
Commits
f3830937
Commit
f3830937
authored
Aug 18, 2021
by
liwenhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:刷新丢失权限
parent
dfafbc36
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
23 deletions
+28
-23
.gitignore
.gitignore
+1
-1
App.vue
src/App.vue
+11
-0
main.js
src/main.js
+1
-1
index.vue
src/pages/Login/index.vue
+15
-21
No files found.
.gitignore
View file @
f3830937
.DS_Store
.DS_Store
node_modules
node_modules
*.lock
*.lock
package-lock.json
*
package-lock.json
*.log
*.log
dist
dist
...
...
src/App.vue
View file @
f3830937
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<
script
>
<
script
>
import
{
getCookie
,
redirectToLogin
}
from
"@/utils/util"
;
import
{
getCookie
,
redirectToLogin
}
from
"@/utils/util"
;
import
{
fetchCurrentUser
}
from
"./service/user"
;
export
default
{
export
default
{
async
mounted
()
{
async
mounted
()
{
...
@@ -19,6 +20,16 @@ export default {
...
@@ -19,6 +20,16 @@ export default {
this
.
$message
(
'请先登录'
);
this
.
$message
(
'请先登录'
);
return
redirectToLogin
();
return
redirectToLogin
();
}
}
if
(
!
this
.
$store
.
state
.
permissions
)
{
const
{
status
,
user
}
=
await
fetchCurrentUser
();
if
(
status
===
"success"
)
{
this
.
$store
.
commit
(
"updateUserInfo"
,
user
);
await
this
.
$store
.
dispatch
(
"updateUserPermission"
,
{
email
:
user
.
email
});
this
.
$store
.
dispatch
(
"fetchPermission"
,
{
appId
:
"merchant-op-auditing"
,
});
}
}
},
},
};
};
</
script
>
</
script
>
...
...
src/main.js
View file @
f3830937
src/pages/Login/index.vue
View file @
f3830937
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<
script
>
<
script
>
import
{
createNamespacedHelpers
}
from
'vuex'
import
{
createNamespacedHelpers
}
from
'vuex'
const
{
mapActions
}
=
createNamespacedHelpers
(
'login'
)
const
{
mapActions
}
=
createNamespacedHelpers
(
'login'
)
//
import { fetchCurrentUser } from "@/service/user";
import
{
fetchCurrentUser
}
from
"@/service/user"
;
import
{
redirectPage
}
from
"@/utils/util"
;
import
{
redirectPage
}
from
"@/utils/util"
;
import
{
import
{
// getAll_role_list as reqGetAll_role_list,
// getAll_role_list as reqGetAll_role_list,
...
@@ -62,27 +62,21 @@ export default {
...
@@ -62,27 +62,21 @@ export default {
}
}
this
.
userInfo
.
email
=
email
.
indexOf
(
"@"
)
===
-
1
?
email
+
"@yidian-inc.com"
:
email
;
this
.
userInfo
.
email
=
email
.
indexOf
(
"@"
)
===
-
1
?
email
+
"@yidian-inc.com"
:
email
;
const
res
=
await
this
.
userLogin
({
payload
:
this
.
userInfo
});
const
res
=
await
this
.
userLogin
({
payload
:
this
.
userInfo
});
// res && await this.fentchUser()
res
&&
await
this
.
fentchUser
()
res
&&
redirectPage
()
redirectPage
()
// reqGetAll_role_list(email).then(res => {
// this.permissionsAll = res
// console.log('permissionsAll',this.permissionsAll)
// })
// this.$router.push('/')
},
},
//
async fentchUser() {
async
fentchUser
()
{
// if (this.$store.state.permissions && this.$store.state.userInfo) return;
if
(
!
this
.
$store
.
state
.
permissions
)
{
// //
const { status, user } = await fetchCurrentUser();
const
{
status
,
user
}
=
await
fetchCurrentUser
();
// //
if (status === "success") {
if
(
status
===
"success"
)
{
// this.$store.commit("updateUserInfo", this.userInfo
);
this
.
$store
.
commit
(
"updateUserInfo"
,
user
);
// this.$store.dispatch("updateUserPermission", { email: this.userInfo
.email });
await
this
.
$store
.
dispatch
(
"updateUserPermission"
,
{
email
:
user
.
email
});
// // 无奈之举,后期需要重构到提现管理中
this
.
$store
.
dispatch
(
"fetchPermission"
,
{
// this.$store.dispatch("fetchPermission", {
appId
:
"merchant-op-auditing"
,
// appId: "merchant-op-auditing",
});
// });
}
// //
}
}
//
}
}
},
},
};
};
</
script
>
</
script
>
...
...
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