Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-Mob-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-Mob-R7-Res
提交
94399679
提交
94399679
编写于
5月 24, 2021
作者:
KK
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "更新"
This reverts commit
cb71c3c5
.
上级
cb71c3c5
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
7 行增加
和
238 行删除
+7
-238
app-register.ts
src/app-register.ts
+0
-1
app-redirect-view.less
src/components/app-redirect-view/app-redirect-view.less
+0
-12
app-redirect-view.vue
src/components/app-redirect-view/app-redirect-view.vue
+0
-77
pluralizeRule.ts
src/ibiz-core/utils/util/pluralizeRule.ts
+0
-117
util.ts
src/ibiz-core/utils/util/util.ts
+7
-31
未找到文件。
src/app-register.ts
浏览文件 @
94399679
...
...
@@ -47,7 +47,6 @@ export const AppComponents = {
v
.
component
(
'app-form-group'
,
()
=>
import
(
'@/components/app-form-group/app-form-group.vue'
));
v
.
component
(
'app-list-default'
,
()
=>
import
(
'@/components/app-list-default/app-list-default.vue'
));
v
.
component
(
'app-list-swipe'
,
()
=>
import
(
'@/components/app-list-swipe/app-list-swipe.vue'
));
v
.
component
(
'app-redirect-view'
,
()
=>
import
(
'@/components/app-redirect-view/app-redirect-view.vue'
));
// 日历组件
v
.
component
(
'app-calendar'
,()
=>
import
(
'@/components/app-calendar/app-calendar.vue'
));
v
.
component
(
'app-vcalendar'
,()
=>
import
(
'@/components/app-vcalendar/app-vcalendar.vue'
));
...
...
src/components/app-redirect-view/app-redirect-view.less
已删除
100644 → 0
浏览文件 @
cb71c3c5
.app-redirect-view{
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
.context {
margin-left: 1em;
font-size: 24px;
font-family: ui-monospace;
}
}
\ No newline at end of file
src/components/app-redirect-view/app-redirect-view.vue
已删除
100644 → 0
浏览文件 @
cb71c3c5
<
template
>
<div
class=
"app-redirect-view"
>
<div
class=
"context"
>
跳转中......
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
Util
}
from
'@/ibiz-core/utils'
;
import
qs
from
'qs'
;
import
{
Vue
,
Component
}
from
'vue-property-decorator'
;
@
Component
({
})
export
default
class
AppRedirectView
extends
Vue
{
/**
* vue生命周期
*
* @type {*}
* @memberof AppRedirectView
*/
public
created
(){
let
tempViewParam
=
this
.
parseViewParam
(
window
.
location
.
href
);
this
.
executeRedirectLogic
(
tempViewParam
);
}
/**
* 处理路径数据
*
* @param {*} [urlStr] 路径
*
* @memberof AppRedirectView
*/
public
parseViewParam
(
urlStr
:
string
):
any
{
let
tempViewParam
:
any
=
{};
const
tempViewparam
:
any
=
urlStr
.
slice
(
urlStr
.
lastIndexOf
(
'?'
)
+
1
);
const
viewparamArray
:
Array
<
string
>
=
decodeURIComponent
(
tempViewparam
).
split
(
';'
);
if
(
viewparamArray
.
length
>
0
)
{
viewparamArray
.
forEach
((
item
:
any
)
=>
{
Object
.
assign
(
tempViewParam
,
qs
.
parse
(
item
));
});
}
return
tempViewParam
;
}
/**
* 执行数据重定向数据逻辑
*
*
* @memberof AppRedirectView
*/
public
executeRedirectLogic
(
viewparam
:
any
){
let
tempViewParam
:
any
=
Util
.
deepCopy
(
viewparam
);
const
{
srfdename
,
srfindexname
}:{
srfdename
:
string
,
srfindexname
:
string
}
=
viewparam
;
if
(
!
viewparam
||
!
srfdename
||
!
srfindexname
){
console
.
log
(
'跳转参数不足,无法完成跳转操作!'
,
'executeRedirectLogic'
);
return
;
}
// 避免数据污染
delete
tempViewParam
[
'srfdename'
];
delete
tempViewParam
[
'srfindexname'
];
delete
tempViewParam
[
srfdename
];
// 计算路径
let
viewPath
:
string
=
`/
${
srfindexname
}
/
${
Util
.
srfpluralize
(
srfdename
)}
/
${
viewparam
[
srfdename
]}
/views/redirectview`
;
if
(
Object
.
keys
(
tempViewParam
).
length
>
0
)
{
viewPath
=
`
${
viewPath
}
?
${
qs
.
stringify
(
tempViewParam
,
{
delimiter
:
';'
})}
`
;
}
this
.
$router
.
push
({
path
:
viewPath
});
}
}
</
script
>
<
style
lang=
'less'
>
@import './app-redirect-view.less';
</
style
>
\ No newline at end of file
src/ibiz-core/utils/util/pluralizeRule.ts
已删除
100644 → 0
浏览文件 @
cb71c3c5
/**
* 复数变化规则
*
*
*/
export
class
PluralizeRule
{
/**
* 不规则
*
* @protected
* @type {string[]}
* @memberof PluralizeRule
*/
protected
irregular
:
Map
<
string
,
string
>
=
new
Map
();
/**
* 不可数
*
* @protected
* @type {string[]}
* @memberof PluralizeRule
*/
protected
uncountable
:
string
[]
=
[
"equipment"
,
"information"
,
"rice"
,
"money"
,
"species"
,
"series"
,
"fish"
,
"sheep"
,
"people"
,
"men"
,
"children"
,
"sexes"
,
"moves"
,
"stadiums"
,
"oxen"
,
"octopi"
,
"viri"
,
"aliases"
,
"quizzes"
,
];
/**
* 初始化pluralizeRule对象
*
* @param opts 额外参数
* @memberof PluralizeRule
*/
public
constructor
(
opts
:
any
=
{})
{
this
.
initIrregular
();
}
/**
* 初始化不规则变化
*
* @param opts 额外参数
* @memberof PluralizeRule
*/
protected
initIrregular
(){
this
.
irregular
.
set
(
"person"
,
"people"
);
this
.
irregular
.
set
(
"man"
,
"men"
);
this
.
irregular
.
set
(
"child"
,
"children"
);
this
.
irregular
.
set
(
"sex"
,
"sexes"
);
this
.
irregular
.
set
(
"move"
,
"moves"
);
this
.
irregular
.
set
(
"stadium"
,
"stadiums"
);
}
/**
* 是否为不可数
*
* @param word 单词
* @returns 返回判断
* @memberof PluralizeRule
*/
public
isUncountable
(
word
:
string
){
const
index
:
number
=
this
.
uncountable
.
findIndex
((
wordStr
:
string
)
=>
{
return
Object
.
is
(
word
,
wordStr
);
})
if
(
index
==
-
1
)
{
return
false
;
}
else
{
return
true
;
}
}
/**
* 不规则变化
*
* @param word 单词
* @returns 返回变化值
* @memberof PluralizeRule
*/
public
irregularChange
(
word
:
string
){
for
(
let
item
of
this
.
irregular
.
entries
()){
if
(
word
&&
(
word
.
indexOf
(
item
[
0
])
!==
-
1
)){
return
word
.
replace
(
new
RegExp
(
item
[
0
],
'g'
),
item
[
1
]);
}
}
return
this
.
irregular
.
get
(
word
);
}
/**
* 规则变化
*
* @param word 单词
* @returns 返回变化值
* @memberof PluralizeRule
*/
public
ruleChange
(
word
:
string
){
if
(
/
(
ax|test
)
is$/
.
test
(
word
))
return
word
.
replace
(
/is$/
,
"es"
);
if
(
/
(
octop|vir
)
us$/
.
test
(
word
))
return
word
.
replace
(
/us$/
,
"i"
);
if
(
/
(
octop|vir
)
i$/
.
test
(
word
))
return
word
;
if
(
/
(
alias|status
)
$/
.
test
(
word
))
return
word
+
"es"
;
if
(
/
(
bu
)
s$/
.
test
(
word
))
return
word
.
replace
(
/s$/
,
"ses"
);
if
(
/
(
buffal|tomat
)
o$/
.
test
(
word
))
return
word
.
replace
(
/o$/
,
"oes"
);
if
(
/
([
ti
])
um$/
.
test
(
word
))
return
word
.
replace
(
/um$/
,
"a"
);
if
(
/
([
ti
])
a$/
.
test
(
word
))
return
word
;
if
(
/sis$/
.
test
(
word
))
return
word
.
replace
(
/sis$/
,
"ses"
);
if
(
/
(?:([^
f
])
fe|
([
lr
])
f
)
$/
.
test
(
word
))
return
word
.
substring
(
0
,
word
.
length
-
1
)
+
"ves"
;
if
(
/
(
hive
)
$/
.
test
(
word
))
return
word
+
"s"
;
if
(
/
([^
aeiouy
]
|qu
)
y$/
.
test
(
word
))
return
word
.
replace
(
/y$/
,
"ies"
);
if
(
/
(
x|ch|ss|sh
)
$/
.
test
(
word
))
return
word
+
"es"
;
if
(
/
(
matr|vert|ind
)
ix|ex$/
.
test
(
word
))
return
word
.
replace
(
/ix|ex$/
,
"ices"
);
if
(
/
([
m|l
])
ouse$/
.
test
(
word
))
return
word
.
replace
(
/ouse$/
,
"ice"
);
if
(
/
([
m|l
])
ice$/
.
test
(
word
))
return
word
;
if
(
/^
(
ox
)
$$/
.
test
(
word
))
return
word
+
"en"
;
if
(
/
(
quiz
)
$/
.
test
(
word
))
return
word
+
"zes"
;
if
(
/s$/
.
test
(
word
))
return
word
.
replace
(
/s$/
,
"s"
);
return
word
+
"s"
;
}
}
\ No newline at end of file
src/ibiz-core/utils/util/util.ts
浏览文件 @
94399679
import
Schema
from
"async-validator"
;
import
{
PluralizeRule
}
from
"./pluralizeRule"
;
/**
* 平台工具类
*
...
...
@@ -281,7 +280,7 @@ export class Util {
_str
=
_str
.
replace
(
/---/g
,
'-'
).
replace
(
/--/g
,
'-'
);
return
_str
;
}
/**
* 深度合并对象
*
...
...
@@ -290,7 +289,7 @@ export class Util {
* @returns {Object}
* @memberof Util
*/
public
static
deepObjectMerge
(
FirstOBJ
:
any
,
SecondOBJ
:
any
)
{
public
static
deepObjectMerge
(
FirstOBJ
:
any
,
SecondOBJ
:
any
)
{
for
(
var
key
in
SecondOBJ
)
{
FirstOBJ
[
key
]
=
FirstOBJ
[
key
]
&&
FirstOBJ
[
key
].
toString
()
===
"[object Object]"
?
this
.
deepObjectMerge
(
FirstOBJ
[
key
],
SecondOBJ
[
key
])
:
FirstOBJ
[
key
]
=
SecondOBJ
[
key
];
...
...
@@ -308,7 +307,7 @@ export class Util {
* @returns {Promise}
* @memberof Util
*/
public
static
validateItem
(
property
:
string
,
data
:
any
,
rules
:
any
)
{
public
static
validateItem
(
property
:
string
,
data
:
any
,
rules
:
any
)
{
// 1.获取数值和规则
const
value
=
data
;
const
rule
=
rules
;
...
...
@@ -324,9 +323,9 @@ export class Util {
* @returns {boolean}
* @memberof Util
*/
public
static
isAndroid
()
:
boolean
{
let
u
:
any
=
navigator
.
userAgent
;
return
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
;
public
static
isAndroid
()
:
boolean
{
let
u
:
any
=
navigator
.
userAgent
;
return
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
;
}
...
...
@@ -339,7 +338,7 @@ export class Util {
* @returns {string}
* @memberof Util
*/
public
static
dateFormat
(
date
:
any
,
fmt
:
string
=
"YYYY-mm-dd HH:MM:SS"
):
string
{
public
static
dateFormat
(
date
:
any
,
fmt
:
string
=
"YYYY-mm-dd HH:MM:SS"
):
string
{
let
ret
;
const
opt
:
any
=
{
"Y+"
:
date
.
getFullYear
().
toString
(),
// 年
...
...
@@ -359,27 +358,4 @@ export class Util {
return
fmt
;
}
/**
* 计算单词复数
*
* @static
* @returns {string}
* @memberof Util
*/
public
static
srfpluralize
(
word
:
string
)
{
let
wordStr
=
word
.
trim
().
toLowerCase
();
if
(
wordStr
.
length
==
0
)
{
return
wordStr
;
}
const
pluralizeRule
=
new
PluralizeRule
();
if
(
pluralizeRule
.
isUncountable
(
wordStr
))
{
return
wordStr
;
}
const
newWordStr
=
pluralizeRule
.
irregularChange
(
wordStr
);
if
(
newWordStr
)
{
return
newWordStr
;
}
else
{
return
pluralizeRule
.
ruleChange
(
wordStr
);;
}
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录