提交 cae30cf4 编写于 作者: 陈琦

fix path issue

上级 cf8ab3ee
......@@ -2,12 +2,12 @@ package serverUtils
import (
"encoding/json"
"fmt"
"github.com/easysoft/zendata/src/model"
constant "github.com/easysoft/zendata/src/utils/const"
fileUtils "github.com/easysoft/zendata/src/utils/file"
"github.com/easysoft/zendata/src/utils/vari"
"io/ioutil"
"regexp"
"strings"
)
......@@ -112,7 +112,8 @@ func AddExt(pth, ext string) string {
}
func GetDirs(dir string, dirs *[]model.Dir) {
if strings.Contains(dir, fmt.Sprintf("yaml%sarticle", constant.PthSep)) {
isArticleFiles, _ := regexp.MatchString("yaml.article", dir)
if isArticleFiles {
return
}
......
......@@ -13,6 +13,7 @@ import (
"gopkg.in/yaml.v3"
"io/ioutil"
"path"
"regexp"
"sort"
"strings"
)
......@@ -54,7 +55,7 @@ func LoadRes(resSrc string) (res map[string][]model.ResFile, nameWidth, titleWid
if key == constant.ResDirData { // data dir contains excel
title, desc, tp = ReadExcelInfo(pth)
} else if key == constant.ResDirYaml || key == constant.ResDirUsers {
isArticleFiles = strings.Contains(pth, fmt.Sprintf("yaml%sarticle", constant.PthSep))
isArticleFiles, _ = regexp.MatchString("yaml.article", pth)
if fileExt == ".txt" { // ignore packaged article text file
title, desc, tp = ReadTextInfo(pth, key)
......
......@@ -49,9 +49,15 @@ export function checkDirIsUsers (rule, value, callback){
callback()
}
export function replacePathSep (path){
const pth = path.replaceAll('\\', "/")
return pth
}
export function pathToRelated (path){
if (!config.workDir) return ''
const name = path.substr(config.workDir.length)
let name = path.substr(config.workDir.length)
name = replacePathSep(name)
return name
}
......
......@@ -10,7 +10,7 @@ const request = axios.create({
function getUrl() {
let url = ''
if (process.env.NODE_ENV === "development") {
url = 'http://localhost:8848'
url = 'http://172.16.13.3:8848'
console.log('dev env, url is ' + url)
} else {
const location = unescape(window.location.href);
......
......@@ -4,7 +4,7 @@
<span slot="folderWithPath" slot-scope="text, record">
<a-tooltip placement="top" overlayClassName="tooltip-light">
<template slot="title">
<span>{{record.path}}</span>
<span>{{record.path | replacePathSep}}</span>
</template>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
......@@ -74,7 +74,7 @@
<script>
import {listConfig, removeConfig} from "../../../../api/manage";
import {PageSize, pathToRelated} from "../../../../api/utils";
import {PageSize, pathToRelated, replacePathSep} from "../../../../api/utils";
import { DesignComponent } from '../../../../components'
import debounce from "lodash.debounce"
import Edit from './Edit';
......@@ -151,6 +151,9 @@ export default {
}
},
filters: {
replacePathSep: function (path) {
return replacePathSep(path)
},
pathToRelated: function (path) {
return pathToRelated(path)
}
......
......@@ -4,7 +4,7 @@
<span slot="folderWithPath" slot-scope="text, record">
<a-tooltip placement="top" overlayClassName="tooltip-light">
<template slot="title">
<span>{{record.path}}</span>
<span>{{record.path | replacePathSep}}</span>
</template>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
......@@ -62,7 +62,7 @@
<script>
import {listExcel, removeExcel} from "../../../../api/manage";
import {PageSize, pathToRelated} from "../../../../api/utils";
import {PageSize, pathToRelated, replacePathSep} from "../../../../api/utils";
import debounce from "lodash.debounce"
import Edit from './Edit';
......@@ -137,6 +137,9 @@ export default {
this.loadData()
},
filters: {
replacePathSep: function (path) {
return replacePathSep(path)
},
pathToRelated: function (path) {
return pathToRelated(path)
}
......
......@@ -4,7 +4,7 @@
<span slot="folderWithPath" slot-scope="text, record">
<a-tooltip placement="top" overlayClassName="tooltip-light">
<template slot="title">
<span>{{record.path}}</span>
<span>{{record.path | replacePathSep}}</span>
</template>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
......@@ -75,7 +75,7 @@
import {listInstances, removeInstances} from "../../../../api/manage";
import { DesignComponent } from '../../../../components'
import {PageSize, ResTypeInstances, pathToRelated} from "../../../../api/utils";
import {PageSize, ResTypeInstances, pathToRelated, replacePathSep} from "../../../../api/utils";
import debounce from "lodash.debounce"
import Edit from './Edit';
......@@ -154,6 +154,9 @@ export default {
mounted () {
},
filters: {
replacePathSep: function (path) {
return replacePathSep(path)
},
pathToRelated: function (path) {
return pathToRelated(path)
}
......
......@@ -4,7 +4,7 @@
<span slot="folderWithPath" slot-scope="text, record">
<a-tooltip placement="top" overlayClassName="tooltip-light">
<template slot="title">
<span>{{record.path}}</span>
<span>{{record.path | replacePathSep}}</span>
</template>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
......@@ -77,7 +77,7 @@
import {listRanges, removeRanges} from "../../../../api/manage";
import { DesignComponent } from '../../../../components'
import {PageSize, pathToRelated} from "../../../../api/utils";
import {PageSize, pathToRelated, replacePathSep} from "../../../../api/utils";
import debounce from "lodash.debounce"
import Edit from './Edit';
......@@ -155,6 +155,9 @@ export default {
mounted () {
},
filters: {
replacePathSep: function (path) {
return replacePathSep(path)
},
pathToRelated: function (path) {
return pathToRelated(path)
}
......
......@@ -4,7 +4,7 @@
<span slot="folderWithPath" slot-scope="text, record">
<a-tooltip placement="top" overlayClassName="tooltip-light">
<template slot="title">
<span>{{record.path}}</span>
<span>{{record.path | replacePathSep}}</span>
</template>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
......@@ -62,7 +62,7 @@
<script>
import {listText, removeText} from "../../../../api/manage";
import {PageSize, pathToRelated} from "../../../../api/utils";
import {PageSize, pathToRelated, replacePathSep} from "../../../../api/utils";
import debounce from "lodash.debounce"
import Edit from './Edit';
......@@ -139,6 +139,9 @@ export default {
mounted () {
},
filters: {
replacePathSep: function (path) {
return replacePathSep(path)
},
pathToRelated: function (path) {
return pathToRelated(path)
}
......
......@@ -19,7 +19,7 @@
<span slot="folderWithPath" slot-scope="text, record">
<a-tooltip placement="top" overlayClassName="tooltip-light">
<template slot="title">
<span>{{record.path}}</span>
<span>{{record.path | replacePathSep}}</span>
</template>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
......@@ -76,7 +76,7 @@
import {Icon, Modal} from 'ant-design-vue'
import {listDef, removeDef} from "../../../api/manage";
import {DesignComponent} from '../../../components'
import {PageSize, ResTypeDef, pathToRelated} from "../../../api/utils";
import {PageSize, ResTypeDef, replacePathSep, pathToRelated} from "../../../api/utils";
import debounce from "lodash.debounce"
import Preview from './Preview';
import Edit from './Edit';
......@@ -144,6 +144,9 @@ export default {
mounted () {
},
filters: {
replacePathSep: function (path) {
return replacePathSep(path)
},
pathToRelated: function (path) {
return pathToRelated(path)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册