fix: 修复bug:柱状图导入数据问题; 直接访问工具收藏栏报错问题

This commit is contained in:
osiris
2024-03-26 18:47:51 +08:00
parent 4631227f9a
commit df8ed7f9c8
5 changed files with 16 additions and 6 deletions
+2 -2
View File
@@ -229,7 +229,7 @@ function getTools() {
{ {
id: 1, id: 1,
title: '柱状图', title: '柱状图',
logo: '/src/assets/logo/bar.png', logo: '/images/logo/bar.png',
desc: '在线制作柱状图,像做表格一样制作可视化图表,支持导出静态或动态图表', desc: '在线制作柱状图,像做表格一样制作可视化图表,支持导出静态或动态图表',
url: '/bar', url: '/bar',
cateId: 8, cateId: 8,
@@ -473,7 +473,7 @@ function getToolsCate() {
{ {
id: 1, id: 1,
title: '柱状图', title: '柱状图',
logo: '/src/assets/logo/bar.png', logo: '/images/logo/bar.png',
desc: '在线制作柱状图,像做表格一样制作可视化图表,支持导出静态或动态图表', desc: '在线制作柱状图,像做表格一样制作可视化图表,支持导出静态或动态图表',
url: '/bar', url: '/bar',
cateId: 8, cateId: 8,
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+4 -2
View File
@@ -272,10 +272,12 @@ const updateDataFile = async (params) => {
if(sheetArray.length == 0){ if(sheetArray.length == 0){
continue; continue;
} }
for(let item in sheetArray){ for(let item in sheetArray){
if (sheetArray[item] != undefined) { if (sheetArray[item] != undefined) {
tmpColumnData.push(sheetArray[item][0]) let tmp1 = sheetArray as []
tmpValueData.push(sheetArray[item][1]) tmpColumnData.push(tmp1[item][0])
tmpValueData.push(tmp1[item][1])
} }
} }
useCount++ useCount++
@@ -5,6 +5,7 @@ import { useRoute } from 'vue-router'
import { useToolsStore } from '@/store/modules/tools' import { useToolsStore } from '@/store/modules/tools'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import {rtrim} from '@/utils/string'
const props = defineProps({ const props = defineProps({
title: String, title: String,
id: Number id: Number
@@ -22,7 +23,8 @@ const userStore = useUserStore()
//根据路由查询tool id //根据路由查询tool id
const getToolInfo = async () => { const getToolInfo = async () => {
searchParam.route = route.path let routeStr = route.path
searchParam.route = rtrim(routeStr, '/')
await toolsStore.getToolInfo(searchParam) await toolsStore.getToolInfo(searchParam)
} }
+7 -1
View File
@@ -113,11 +113,17 @@ export function numberToChinese(num: number): string {
return chinese; return chinese;
} }
//rtrim: 删除右侧指定字符, 默认删除空格
export function rtrim(str, char = ' ') {
return str.replace(new RegExp('\\'+char+'+$', 'g'), '');
}
const StringUtils = { const StringUtils = {
transferred, transferred,
copy, copy,
genRandomStrByChars, genRandomStrByChars,
numberToChinese numberToChinese,
rtrim,
} }
export default StringUtils export default StringUtils