diff --git a/src/api/system/ossLogin.js b/src/api/system/ossLogin.js new file mode 100644 index 0000000..70c47d5 --- /dev/null +++ b/src/api/system/ossLogin.js @@ -0,0 +1,13 @@ +import request from "@/utils/request"; +import store from '@/store'; +export function ossLogin(){ + return request({ + isLoading:false, + method:'post', + url:'/api/admin/auth/oss-login', + data:{ + id:store.state.user.userId, + username:store.state.user.username + } + }) +} diff --git a/src/layout/components/worker/index.vue b/src/layout/components/worker/index.vue index d60db1b..3cec04d 100644 --- a/src/layout/components/worker/index.vue +++ b/src/layout/components/worker/index.vue @@ -80,7 +80,7 @@ export default { }) return item }) - } + }, } diff --git a/src/layout/index.vue b/src/layout/index.vue index 00fd01d..dc1faf5 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -2,11 +2,21 @@
@@ -17,31 +27,40 @@
- - 系统首页 - + 系统首页 - - 退出 + + 退出
-
+
diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 7967536..51b0dd2 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -16,7 +16,9 @@ import { const getDefaultState = () => { return { token: getToken(), + userId:'', name: '', + username:'', avatar: '', roles: [] } @@ -34,6 +36,12 @@ const mutations = { SET_NAME: (state, name) => { state.name = name }, + SET_USERNAME:(state,username) => { + state.username = username + }, + SET_USERID:(state,id) => { + state.userId = id + }, SET_AVATAR: (state, avatar) => { state.avatar = avatar }, @@ -58,7 +66,7 @@ const actions = { }).then(response => { //console.log(response) - + const { data } = response; @@ -111,13 +119,15 @@ const actions = { } response["roles"] = ["admin"]; const { + id, roles, name, + username, avatar } = response - - + commit('SET_USERNAME',username) + commit('SET_USERID',id) commit('SET_ROLES', roles) commit('SET_NAME', name) commit('SET_AVATAR', avatar) diff --git a/src/utils/auth.js b/src/utils/auth.js index a19f6cd..6318e8e 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,8 +1,8 @@ import Cookies from 'js-cookie' -const TokenKey = 'HeTongGuanli_hjjc_token' +//const TokenKey = 'HeTongGuanli_hjjc_token' -export function getToken() { +export function getToken(TokenKey = 'hjjc_workerbench_web_token') { //return Cookies.get(TokenKey) if (Cookies.get(TokenKey)) { @@ -12,12 +12,12 @@ export function getToken() { } } -export function setToken(token) { +export function setToken(token,TokenKey = 'hjjc_workerbench_web_token') { sessionStorage.setItem(TokenKey, token); return Cookies.set(TokenKey, token) } -export function removeToken() { +export function removeToken(TokenKey = 'hjjc_workerbench_web_token') { sessionStorage.clear(); return Cookies.remove(TokenKey) diff --git a/src/views/system/worker.vue b/src/views/system/worker.vue index bec233a..b1ab30c 100644 --- a/src/views/system/worker.vue +++ b/src/views/system/worker.vue @@ -2,7 +2,7 @@
- + @@ -11,10 +11,11 @@ :class="{ 'cpn-name__item--disable': statusFormat(item.i) }" v-for="item in layout" :draggable="!statusFormat(item.i)" + @dragstart="isDrag = true" @dragend="dragEnd(item, $event)" > - {{ item.i }} + {{ item.component.name }}