Browse Source

getLoginName

noToken
安虹睿 1 year ago
parent
commit
f6e0113614
  1. 5
      PC/InterFace.Dash/src/components/rowDrop/index.vue
  2. 6
      PC/InterFace.Dash/src/mixins/mixins.js
  3. 6
      PC/InterFace.Dash/src/utils/auth.js
  4. 3
      PC/InterFace.Dash/src/utils/defaultButtons.js

5
PC/InterFace.Dash/src/components/rowDrop/index.vue

@ -47,6 +47,7 @@
<script> <script>
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import Sortable from "sortablejs"; import Sortable from "sortablejs";
import { getLoginName } from "@/utils/auth"
export default { export default {
components: { components: {
draggable, draggable,
@ -61,7 +62,7 @@ export default {
dataList: [], dataList: [],
// allSelect hasSelect NoSelect // allSelect hasSelect NoSelect
allSeletType:'NoSelect', allSeletType:'NoSelect',
userName:this.$store.getters.currentUserInfo.userName userName: getLoginName()
} }
}, },
props: { props: {
@ -100,7 +101,7 @@ export default {
type: 'warning', type: 'warning',
cancelButtonClass:'rowDropNotHideItem' cancelButtonClass:'rowDropNotHideItem'
}).then(() => { }).then(() => {
// set this.$store.getters.currentUserInfo.userName // set
localStorage.setItem('file_Columns_' + this.source + '_' + this.userName + '_' + this.$route.name, JSON.stringify([])) localStorage.setItem('file_Columns_' + this.source + '_' + this.userName + '_' + this.$route.name, JSON.stringify([]))
localStorage.removeItem('file_Columns_' + this.source + '_' +this.userName + '_' + this.$route.name) localStorage.removeItem('file_Columns_' + this.source + '_' +this.userName + '_' + this.$route.name)
// let _resetCol = this.$isTableColumns[this.$route.name] // let _resetCol = this.$isTableColumns[this.$route.name]

6
PC/InterFace.Dash/src/mixins/mixins.js

@ -3,6 +3,8 @@ import {
postImport, postImport,
} from '@/api/wms-api' } from '@/api/wms-api'
import * as allUrlOption from '@/utils/baseData/urlOption' import * as allUrlOption from '@/utils/baseData/urlOption'
import { getLoginName } from "@/utils/auth"
export const mixins = { export const mixins = {
data() { data() {
return { return {
@ -74,8 +76,8 @@ export const mixins = {
let _list_defalut = columnsData ? columnsData : this.$isTableColumns[this.$route.name] let _list_defalut = columnsData ? columnsData : this.$isTableColumns[this.$route.name]
let _type = type ? type : 'list_api' let _type = type ? type : 'list_api'
if(!_list_defalut)return if(!_list_defalut)return
let _local = localStorage.getItem('file_Columns_' + _type + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name) let _local = localStorage.getItem('file_Columns_' + _type + '_' + getLoginName() + '_' + this.$route.name)
let _list_local = JSON.parse(localStorage.getItem('file_Columns_' + _type + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name)) let _list_local = JSON.parse(localStorage.getItem('file_Columns_' + _type + '_' + getLoginName() + '_' + this.$route.name))
let _new_list = [] //格式化后的数据 let _new_list = [] //格式化后的数据
// 如果没有缓存则直接为默认值 // 如果没有缓存则直接为默认值
if(!_local){ if(!_local){

6
PC/InterFace.Dash/src/utils/auth.js

@ -1,4 +1,5 @@
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import store from '@/store'
const TokenKey = 'Admin-Token' const TokenKey = 'Admin-Token'
@ -13,3 +14,8 @@ export function setToken(token) {
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) return Cookies.remove(TokenKey)
} }
// fast-new
export function getLoginName() {
return (store.getters.currentUserInfo && store.getters.currentUserInfo.name) ? store.getters.currentUserInfo.name : localStorage.getItem('isLoginName')
}

3
PC/InterFace.Dash/src/utils/defaultButtons.js

@ -1,5 +1,6 @@
// 页面基础按钮样式 // 页面基础按钮样式
import i18n from "@/lang" import i18n from "@/lang"
import { getLoginName } from "@/utils/auth"
/** /**
* 如果需要更改配置格式如defaultExportBtn({label:'自定义'}) * 如果需要更改配置格式如defaultExportBtn({label:'自定义'})
* @param {*} option * @param {*} option
@ -44,7 +45,7 @@ export function defaultExportBtn(option) {
export function defaultFieldSettingBtn(option,source) { export function defaultFieldSettingBtn(option,source) {
let _source = source ? source : 'list_api' let _source = source ? source : 'list_api'
// todo:监听已经配置过的字段按钮更改状态特殊显示 // todo:监听已经配置过的字段按钮更改状态特殊显示
let _local = localStorage.getItem('file_Columns_' + _source + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name) let _local = localStorage.getItem('file_Columns_' + _source + '_' + getLoginName() + '_' + this.$route.name)
let _type = '' let _type = ''
let _num = 0 let _num = 0
if(_local){ if(_local){

Loading…
Cancel
Save