fix: 修改TS报错问题,抽离水印文案

This commit is contained in:
奔跑的面条 2022-04-07 14:20:18 +08:00
parent b5ea97e239
commit be0c0566df
20 changed files with 40 additions and 40 deletions

View File

@ -6,8 +6,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
dur: 0.5, dur: 0.5,
colors: ['#4fd2dd', '#235fa7'], colors: ['#4fd2dd', '#235fa7'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#6586ec', '#2cf7fe'], colors: ['#6586ec', '#2cf7fe'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig export default class Config extends publicConfig

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#6586ec', '#2cf7fe'], colors: ['#6586ec', '#2cf7fe'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -10,8 +10,7 @@ export const option = {
borderTitleSize: 18, borderTitleSize: 18,
borderTitleColor: '#fff', borderTitleColor: '#fff',
colors: ['#8aaafb', '#1f33a2'], colors: ['#8aaafb', '#1f33a2'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#1d48c4', '#d3e1f8'], colors: ['#1d48c4', '#d3e1f8'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#3140ad', '#1089ff'], colors: ['#3140ad', '#1089ff'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#11eefd', '#0078d2'], colors: ['#11eefd', '#0078d2'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -7,8 +7,7 @@ export const option = {
colors: ['#235fa7', '#4fd2dd'], colors: ['#235fa7', '#4fd2dd'],
dur: 3, dur: 3,
reverse: false, reverse: false,
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#3140ad', '#235fa7'], colors: ['#3140ad', '#235fa7'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#1089ff', '#0000ff'], colors: ['#1089ff', '#0000ff'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#2862b7', '#2862b7'], colors: ['#2862b7', '#2862b7'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#2862b7', '#2862b7'], colors: ['#2862b7', '#2862b7'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,8 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#2862b7', '#4b77b7'], colors: ['#2862b7', '#4b77b7'],
backgroundColor: '#00000000', backgroundColor: '#00000000'
dataset: null
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -6,7 +6,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#ffffff4d', '#ffffff4d'], colors: ['#ffffff4d', '#ffffff4d'],
dur: 3, dur: 3,
lineHeight: 3, lineHeight: 3
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -5,7 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
colors: ['#00c2ff', '#00c2ff4d'], colors: ['#00c2ff', '#00c2ff4d'],
dur: 3, dur: 3
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends publicConfig implements CreateComponentType {

View File

@ -52,21 +52,29 @@ const { rowNum, unit, color, textColor, borderColor } = toRefs(
const status = reactive({ const status = reactive({
mergedConfig: props.chartConfig.option, mergedConfig: props.chartConfig.option,
rowsData: [], rowsData: [],
rows: [], rows: [{
heights: [], scroll: 0,
ranking: 1,
name: '',
value: '',
percent: 0
}],
heights: [0],
animationIndex: 0, animationIndex: 0,
animationHandler: '', animationHandler: 0,
updater: 0, updater: 0,
avgHeight: 0
}) })
const calcRowsData = () => { const calcRowsData = () => {
let { dataset, rowNum, sort } = status.mergedConfig let { dataset, rowNum, sort } = status.mergedConfig
sort && // @ts-ignore
dataset.sort(({ value: a }, { value: b }) => { sort && dataset.sort(({ value: a }, { value: b }) => {
if (a > b) return -1 if (a > b) return -1
if (a < b) return 1 if (a < b) return 1
if (a === b) return 0 if (a === b) return 0
}) })
// @ts-ignore
const value = dataset.map(({ value }) => value) const value = dataset.map(({ value }) => value)
const min = Math.min(...value) || 0 const min = Math.min(...value) || 0
// abs of min // abs of min
@ -75,7 +83,7 @@ const calcRowsData = () => {
// abs of max // abs of max
const maxAbs = Math.abs(max) const maxAbs = Math.abs(max)
const total = max + minAbs const total = max + minAbs
dataset = dataset.map((row, i) => ({ dataset = dataset.map((row: any, i:number) => ({
...row, ...row,
ranking: i + 1, ranking: i + 1,
percent: ((row.value + minAbs) / total) * 100, percent: ((row.value + minAbs) / total) * 100,
@ -84,7 +92,7 @@ const calcRowsData = () => {
if (rowLength > rowNum && rowLength < 2 * rowNum) { if (rowLength > rowNum && rowLength < 2 * rowNum) {
dataset = [...dataset, ...dataset] dataset = [...dataset, ...dataset]
} }
dataset = dataset.map((d, i) => ({ ...d, scroll: i })) dataset = dataset.map((d:any, i:number) => ({ ...d, scroll: i }))
status.rowsData = dataset status.rowsData = dataset
status.rows = dataset status.rows = dataset
} }
@ -118,7 +126,7 @@ const animation = async (start = false) => {
if (back >= 0) animationIndex = back if (back >= 0) animationIndex = back
status.animationIndex = animationIndex status.animationIndex = animationIndex
status.animationHandler = setTimeout(animation, waitTime * 1000 - 300) status.animationHandler = setTimeout(animation, waitTime * 1000 - 300) as any
} }
const stopAnimation = () => { const stopAnimation = () => {

View File

@ -85,7 +85,7 @@ export const chartColorsSearch = {
// 默认主题详细配置 // 默认主题详细配置
type ThemeJsonType = typeof themeJson type ThemeJsonType = typeof themeJson
export interface GlobalThemeJsonType extends Partial<ThemeJsonType> { export interface GlobalThemeJsonType extends Partial<ThemeJsonType> {
dataset: any, dataset?: any,
[T:string]: any [T:string]: any
} }
export const globalThemeJson = themeJson export const globalThemeJson = {...themeJson, dataset: null,}

View File

@ -4,7 +4,10 @@ import designColor from './designColor.json'
// 默认语言 // 默认语言
export const lang = LangEnum.zh export const lang = LangEnum.zh
// 水印文字
export const watermarkText = "GoView 低代码平台"
// 主题配置
export const theme = { export const theme = {
// 默认是否开启深色主题 // 默认是否开启深色主题
darkTheme: true, darkTheme: true,

View File

@ -1,3 +1,4 @@
import type { WritableComputedRef } from 'vue'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { lang } from '@/settings/designSetting' import { lang } from '@/settings/designSetting'
import { LangStateType } from './langStore.d' import { LangStateType } from './langStore.d'
@ -28,7 +29,7 @@ export const useLangStore = defineStore({
changeLang(lang: LangEnum): void { changeLang(lang: LangEnum): void {
if (this.lang === lang) return if (this.lang === lang) return
this.lang = lang this.lang = lang
i18n.global.locale = lang i18n.global.locale = (lang as unknown) as WritableComputedRef<LangEnum>
setLocalStorage(GO_LANG_STORE, this.$state) setLocalStorage(GO_LANG_STORE, this.$state)
if (settingStore.getChangeLangReload) { if (settingStore.getChangeLangReload) {

View File

@ -6,7 +6,7 @@
> >
<n-watermark <n-watermark
id="go-edit-watermark" id="go-edit-watermark"
content="GoView 低代码平台" :content="watermarkText"
cross cross
selectable selectable
:font-size="16" :font-size="16"
@ -33,6 +33,7 @@ import { mousedownHandleUnStop } from '../../hooks/useDrag.hook'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { EditAlignLine } from '../EditAlignLine' import { EditAlignLine } from '../EditAlignLine'
import { EditRule } from '../EditRule' import { EditRule } from '../EditRule'
import { watermarkText } from '@/settings/designSetting'
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()