fix:修复切换用户主题错误

This commit is contained in:
zyh
2022-07-25 16:18:44 +08:00
parent 124637a303
commit db3d59c6b1
5 changed files with 60 additions and 48 deletions

View File

@@ -175,6 +175,7 @@ export default {
.style('font-size', function (d) { .style('font-size', function (d) {
return d.r / 3 > 10 ? d.r / 3 : 0 return d.r / 3 > 10 ? d.r / 3 : 0
}) })
.style('border-radius', '50%')
.html((d) => { .html((d) => {
return this.bubbleFormatterLabel(d) return this.bubbleFormatterLabel(d)
}) })
@@ -237,19 +238,19 @@ export default {
this.drawBubbleChart() this.drawBubbleChart()
}, 50) }, 50)
}, },
bubbleEnter (e, node) { // 移入六边形 bubbleEnter (e, node) { // 移入气泡
this.tooltip.title = node.data.alias this.tooltip.title = node.data.alias
this.tooltip.value = node.data.showValue this.tooltip.value = node.data.showValue
this.tooltip.mapping = node.data.mapping this.tooltip.mapping = node.data.mapping
this.tooltip.show = true this.tooltip.show = true
this.setPosition(e) this.setPosition(e)
}, },
bubbleMove (e) { // 六边形内移动 bubbleMove (e) { // 气泡内移动
if (this.tooltip.show) { if (this.tooltip.show) {
this.setPosition(e) this.setPosition(e)
} }
}, },
bubbleLeave () { bubbleLeave () { // 移出气泡
this.tooltip.show = false this.tooltip.show = false
}, },
setPosition (e) { setPosition (e) {

View File

@@ -484,25 +484,28 @@
</div> </div>
<div v-for="(item,index) in chartConfig.param.columns" :key="index" :class="item.error? 'is-item-box-error' : ''"> <div v-for="(item,index) in chartConfig.param.columns" :key="index" :class="item.error? 'is-item-box-error' : ''">
<div class="chart-title chart-title-config"> <div class="chart-title chart-title-config">
<span class="chart-title-content"> <span class="chart-title-content">
<i class="nz-icon nz-icon-arrow-down" :class="item.show?'':'is-active'" @click="showColumns(index)"></i> <i class="nz-icon nz-icon-arrow-down" :class="item.show?'':'is-active'" @click="showColumns(index)"></i>
<span v-show="!item.show" class="title-content-left"> <span v-show="!item.show" class="title-content-left">
<span> <span>
{{item.value}} {{item.value}}
</span>
</span>
</span> </span>
</span>
</span>
<span> <span>
<span @click="addColumns('')" :title="$t('tip.add')"> <span @click="addColumns('')" :title="$t('tip.add')">
<i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i> <i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i>
</span> </span>
<span style="margin-right: 5px" :title="$t('overall.duplicate')"> <span style="margin-right: 5px" :title="$t('overall.duplicate')">
<i @click="copyColumns(index)" class="nz-icon nz-icon-override"></i> <i @click="copyColumns(index)" class="nz-icon nz-icon-override"></i>
</span> </span>
<span class="nz-icon-minus-medium" :title="$t('overall.delete')"> <span style="margin-right: 5px" class="nz-icon-minus-medium" :title="$t('overall.delete')">
<i @click="removeColumns(index)" class="nz-icon nz-icon-minus"></i> <i @click="removeColumns(index)" class="nz-icon nz-icon-minus"></i>
</span> </span>
</span> <span style="margin-right: 5px;fontSize:17px;cursor: pointer;" class="draggable-sort" :title="$t('dashboard.panel.chartForm.sort')">
<i class="el-icon-sort"></i>
</span>
</span>
</div> </div>
<transition-group appear tag="div" name="el-zoom-in-top"> <transition-group appear tag="div" name="el-zoom-in-top">
<el-row class="thresholds-item" v-show="item.show" :key="1"> <el-row class="thresholds-item" v-show="item.show" :key="1">
@@ -542,7 +545,7 @@
</div> </div>
</div> </div>
<el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.display" style="margin-right: 10px" size="small" @change="change('columns',index)"/> <el-input v-model="item.display" size="small" @change="change('columns',index)"/>
</el-form-item> </el-form-item>
</el-row> </el-row>
</transition-group> </transition-group>

View File

@@ -437,25 +437,28 @@
</div> </div>
<div v-for="(item,index) in chartConfig.param.columns" :key="index" :class="item.error? 'is-item-box-error' : ''"> <div v-for="(item,index) in chartConfig.param.columns" :key="index" :class="item.error? 'is-item-box-error' : ''">
<div class="chart-title chart-title-config"> <div class="chart-title chart-title-config">
<span class="chart-title-content"> <span class="chart-title-content">
<i class="nz-icon nz-icon-arrow-down" :class="item.show?'':'is-active'" @click="showColumns(index)"></i> <i class="nz-icon nz-icon-arrow-down" :class="item.show?'':'is-active'" @click="showColumns(index)"></i>
<span v-show="!item.show" class="title-content-left"> <span v-show="!item.show" class="title-content-left">
<span> <span>
{{item.value}} {{item.value}}
</span>
</span>
</span> </span>
</span>
</span>
<span> <span>
<span @click="addColumns('')" :title="$t('tip.add')"> <span @click="addColumns('')" :title="$t('tip.add')">
<i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i> <i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i>
</span> </span>
<span style="margin-right: 5px" :title="$t('overall.duplicate')"> <span style="margin-right: 5px" :title="$t('overall.duplicate')">
<i @click="copyColumns(index)" class="nz-icon nz-icon-override"></i> <i @click="copyColumns(index)" class="nz-icon nz-icon-override"></i>
</span> </span>
<span class="nz-icon-minus-medium" :title="$t('overall.delete')"> <span style="margin-right: 5px" class="nz-icon-minus-medium" :title="$t('overall.delete')">
<i @click="removeColumns(index)" class="nz-icon nz-icon-minus"></i> <i @click="removeColumns(index)" class="nz-icon nz-icon-minus"></i>
</span> </span>
</span> <span style="margin-right: 5px;fontSize:17px;cursor: pointer;" class="draggable-sort" :title="$t('dashboard.panel.chartForm.sort')">
<i class="el-icon-sort"></i>
</span>
</span>
</div> </div>
<transition-group appear tag="div" name="el-zoom-in-top"> <transition-group appear tag="div" name="el-zoom-in-top">
<el-row class="thresholds-item" v-show="item.show" :key="1"> <el-row class="thresholds-item" v-show="item.show" :key="1">
@@ -469,11 +472,11 @@
<div class='mapping-display'>{{$t('dashboard.panel.chartForm.unit')}}</div> <div class='mapping-display'>{{$t('dashboard.panel.chartForm.unit')}}</div>
</div> </div>
<el-cascader :id="'columns-unit' + index" v-model="item.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable <el-cascader :id="'columns-unit' + index" v-model="item.unit" :options="unitOptions" :props="{ expandTrigger: 'hover',emitPath:false }" :show-all-levels="false" filterable
placeholder="" placeholder=""
popper-class="dc-dropdown right-box-select-top right-public-box-dropdown-top prevent-clickoutside chart-box-unit" popper-class="dc-dropdown right-box-select-top right-public-box-dropdown-top prevent-clickoutside chart-box-unit"
size="small" size="small"
style="flex: 1" style="flex: 1"
@change="unitSelected" @change="unitSelected"
> >
</el-cascader> </el-cascader>
</el-row> </el-row>
@@ -495,7 +498,7 @@
</div> </div>
</div> </div>
<el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item"> <el-form-item :prop="'param.columns.' + index + '.display'" :rules="{ required: true, message: $t('validate.required'), trigger: 'blur'}" class="thresholds-from-item">
<el-input v-model="item.display" style="margin-right: 10px" size="small" @change="change('columns',index)"/> <el-input v-model="item.display" size="small" @change="change('columns',index)"/>
</el-form-item> </el-form-item>
</el-row> </el-row>
</transition-group> </transition-group>

View File

@@ -142,8 +142,10 @@ router.beforeEach((to, from, next) => {
returnMenuCode(res.data.menus, arr) returnMenuCode(res.data.menus, arr)
store.commit('setButtonList', arr) store.commit('setButtonList', arr)
store.commit('setRoleList', res.data.roles) store.commit('setRoleList', res.data.roles)
const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light' if (localStorage.getItem('nz-user-id')) {
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-' + theme) const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light'
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-' + theme)
}
resolve() resolve()
} else { } else {
localStorage.removeItem('nz-token') localStorage.removeItem('nz-token')
@@ -152,8 +154,10 @@ router.beforeEach((to, from, next) => {
}) })
}) })
} else { } else {
const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light' if (localStorage.getItem('nz-user-id')) {
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-' + theme) const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light'
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-' + theme)
}
resolve() resolve()
} }
}) })

View File

@@ -168,6 +168,7 @@ const user = {
localStorage.removeItem('nz-username') localStorage.removeItem('nz-username')
localStorage.removeItem('nz-username') localStorage.removeItem('nz-username')
localStorage.removeItem('nz-token') localStorage.removeItem('nz-token')
localStorage.removeItem('nz-user-id')
} }
} }
} }