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

@@ -499,9 +499,12 @@
<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 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> </span>
</div> </div>
<transition-group appear tag="div" name="el-zoom-in-top"> <transition-group appear tag="div" name="el-zoom-in-top">
@@ -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

@@ -452,9 +452,12 @@
<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 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> </span>
</div> </div>
<transition-group appear tag="div" name="el-zoom-in-top"> <transition-group appear tag="div" name="el-zoom-in-top">
@@ -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)
if (localStorage.getItem('nz-user-id')) {
const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light' const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light'
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-' + theme) 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 {
if (localStorage.getItem('nz-user-id')) {
const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light' const theme = localStorage.getItem(`nz-user-${localStorage.getItem('nz-user-id')}-theme`) || 'light'
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-' + theme) 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')
} }
} }
} }