Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
9e66ada9
Commit
9e66ada9
authored
Jun 24, 2023
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
a63eec3b
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
48 deletions
+77
-48
AjaxResult.java
...rc/main/java/com/ruoyi/common/core/domain/AjaxResult.java
+31
-0
UUID.java
...ommon/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
+1
-1
SysPermissionService.java
...com/ruoyi/framework/web/service/SysPermissionService.java
+2
-1
index.vue
ruoyi-ui/src/components/DictTag/index.vue
+13
-13
js.js
ruoyi-ui/src/utils/generator/js.js
+3
-4
index.vue
ruoyi-ui/src/views/index.vue
+1
-1
vue.config.js
ruoyi-ui/vue.config.js
+26
-28
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
View file @
9e66ada9
package
com
.
ruoyi
.
common
.
core
.
domain
;
package
com
.
ruoyi
.
common
.
core
.
domain
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Objects
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
...
@@ -169,6 +170,36 @@ public class AjaxResult extends HashMap<String, Object>
...
@@ -169,6 +170,36 @@ public class AjaxResult extends HashMap<String, Object>
return
new
AjaxResult
(
code
,
msg
,
null
);
return
new
AjaxResult
(
code
,
msg
,
null
);
}
}
/**
* 是否为成功消息
*
* @return 结果
*/
public
boolean
isSuccess
()
{
return
Objects
.
equals
(
HttpStatus
.
SUCCESS
,
this
.
get
(
CODE_TAG
));
}
/**
* 是否为警告消息
*
* @return 结果
*/
public
boolean
isWarn
()
{
return
Objects
.
equals
(
HttpStatus
.
WARN
,
this
.
get
(
CODE_TAG
));
}
/**
* 是否为错误消息
*
* @return 结果
*/
public
boolean
isError
()
{
return
Objects
.
equals
(
HttpStatus
.
ERROR
,
this
.
get
(
CODE_TAG
));
}
/**
/**
* 方便链式调用
* 方便链式调用
*
*
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
View file @
9e66ada9
...
@@ -66,7 +66,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
...
@@ -66,7 +66,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
}
}
/**
/**
* 获取类型 4(伪随机生成的)UUID 的静态工厂。
使用加密的本地线程伪随机数生成器生成该 UUID。
* 获取类型 4(伪随机生成的)UUID 的静态工厂。
*
*
* @return 随机生成的 {@code UUID}
* @return 随机生成的 {@code UUID}
*/
*/
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java
View file @
9e66ada9
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
java.util.Set
;
import
java.util.Set
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
com.ruoyi.common.core.domain.entity.SysRole
;
import
com.ruoyi.common.core.domain.entity.SysRole
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.system.service.ISysMenuService
;
import
com.ruoyi.system.service.ISysMenuService
;
...
@@ -62,7 +63,7 @@ public class SysPermissionService
...
@@ -62,7 +63,7 @@ public class SysPermissionService
else
else
{
{
List
<
SysRole
>
roles
=
user
.
getRoles
();
List
<
SysRole
>
roles
=
user
.
getRoles
();
if
(!
roles
.
isEmpty
()
&&
roles
.
size
()
>
1
)
if
(!
CollectionUtils
.
isEmpty
(
roles
)
)
{
{
// 多角色设置permissions属性,以便数据权限匹配权限
// 多角色设置permissions属性,以便数据权限匹配权限
for
(
SysRole
role
:
roles
)
for
(
SysRole
role
:
roles
)
...
...
ruoyi-ui/src/components/DictTag/index.vue
View file @
9e66ada9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
:key=
"item.value"
:key=
"item.value"
:index=
"index"
:index=
"index"
:class=
"item.raw.cssClass"
:class=
"item.raw.cssClass"
>
{{
item
.
label
+
' '
}}
</span
>
{{
item
.
label
+
" "
}}
</span
>
>
<el-tag
<el-tag
v-else
v-else
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
:type=
"item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:type=
"item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:class=
"item.raw.cssClass"
:class=
"item.raw.cssClass"
>
>
{{
item
.
label
+
' '
}}
{{
item
.
label
+
" "
}}
</el-tag>
</el-tag>
</
template
>
</
template
>
</template>
</template>
...
@@ -49,39 +49,39 @@ export default {
...
@@ -49,39 +49,39 @@ export default {
},
},
computed
:
{
computed
:
{
values
()
{
values
()
{
if
(
this
.
value
!==
null
&&
typeof
this
.
value
!==
'undefined'
)
{
if
(
this
.
value
!==
null
&&
typeof
this
.
value
!==
"undefined"
)
{
return
Array
.
isArray
(
this
.
value
)
?
this
.
value
:
[
String
(
this
.
value
)];
return
Array
.
isArray
(
this
.
value
)
?
this
.
value
:
[
String
(
this
.
value
)];
}
else
{
}
else
{
return
[];
return
[];
}
}
},
},
unmatch
(){
unmatch
()
{
this
.
unmatchArray
=
[];
this
.
unmatchArray
=
[];
if
(
this
.
value
!==
null
&&
typeof
this
.
value
!==
'undefined'
)
{
if
(
this
.
value
!==
null
&&
typeof
this
.
value
!==
"undefined"
)
{
// 传入值为非数组
// 传入值为非数组
if
(
!
Array
.
isArray
(
this
.
value
))
{
if
(
!
Array
.
isArray
(
this
.
value
))
{
if
(
this
.
options
.
some
(
v
=>
v
.
value
==
this
.
value
))
return
false
;
if
(
this
.
options
.
some
((
v
)
=>
v
.
value
==
this
.
value
))
return
false
;
this
.
unmatchArray
.
push
(
this
.
value
);
this
.
unmatchArray
.
push
(
this
.
value
);
return
true
;
return
true
;
}
}
// 传入值为Array
// 传入值为Array
this
.
value
.
forEach
(
item
=>
{
this
.
value
.
forEach
((
item
)
=>
{
if
(
!
this
.
options
.
some
(
v
=>
v
.
value
==
item
))
this
.
unmatchArray
.
push
(
item
)
if
(
!
this
.
options
.
some
((
v
)
=>
v
.
value
==
item
))
this
.
unmatchArray
.
push
(
item
);
});
});
return
true
;
return
true
;
}
}
// 没有value不显示
// 没有value不显示
return
false
;
return
false
;
},
},
},
},
filters
:
{
filters
:
{
handleArray
(
array
)
{
handleArray
(
array
)
{
if
(
array
.
length
===
0
)
return
''
;
if
(
array
.
length
===
0
)
return
""
;
return
array
.
reduce
((
pre
,
cur
)
=>
{
return
array
.
reduce
((
pre
,
cur
)
=>
{
return
pre
+
' '
+
cur
;
return
pre
+
" "
+
cur
;
})
})
}
,
}
}
}
};
};
</
script
>
</
script
>
...
...
ruoyi-ui/src/utils/generator/js.js
View file @
9e66ada9
import
{
isArray
}
from
'util'
import
{
exportDefault
,
titleCase
}
from
'@/utils/index'
import
{
exportDefault
,
titleCase
}
from
'@/utils/index'
import
{
trigger
}
from
'./config'
import
{
trigger
}
from
'./config'
...
@@ -133,12 +132,12 @@ function buildRules(conf, ruleList) {
...
@@ -133,12 +132,12 @@ function buildRules(conf, ruleList) {
const
rules
=
[]
const
rules
=
[]
if
(
trigger
[
conf
.
tag
])
{
if
(
trigger
[
conf
.
tag
])
{
if
(
conf
.
required
)
{
if
(
conf
.
required
)
{
const
type
=
isArray
(
conf
.
defaultValue
)
?
'type:
\'
array
\'
,'
:
''
const
type
=
Array
.
isArray
(
conf
.
defaultValue
)
?
'type:
\'
array
\'
,'
:
''
let
message
=
isArray
(
conf
.
defaultValue
)
?
`请至少选择一个
${
conf
.
vModel
}
`
:
conf
.
placeholder
let
message
=
Array
.
isArray
(
conf
.
defaultValue
)
?
`请至少选择一个
${
conf
.
vModel
}
`
:
conf
.
placeholder
if
(
message
===
undefined
)
message
=
`
${
conf
.
label
}
不能为空`
if
(
message
===
undefined
)
message
=
`
${
conf
.
label
}
不能为空`
rules
.
push
(
`{ required: true,
${
type
}
message: '
${
message
}
', trigger: '
${
trigger
[
conf
.
tag
]}
' }`
)
rules
.
push
(
`{ required: true,
${
type
}
message: '
${
message
}
', trigger: '
${
trigger
[
conf
.
tag
]}
' }`
)
}
}
if
(
conf
.
regList
&&
isArray
(
conf
.
regList
))
{
if
(
conf
.
regList
&&
Array
.
isArray
(
conf
.
regList
))
{
conf
.
regList
.
forEach
(
item
=>
{
conf
.
regList
.
forEach
(
item
=>
{
if
(
item
.
pattern
)
{
if
(
item
.
pattern
)
{
rules
.
push
(
`{ pattern:
${
eval
(
item
.
pattern
)}
, message: '
${
item
.
message
}
', trigger: '
${
trigger
[
conf
.
tag
]}
' }`
)
rules
.
push
(
`{ pattern:
${
eval
(
item
.
pattern
)}
, message: '
${
item
.
message
}
', trigger: '
${
trigger
[
conf
.
tag
]}
' }`
)
...
...
ruoyi-ui/src/views/index.vue
View file @
9e66ada9
...
@@ -888,7 +888,7 @@
...
@@ -888,7 +888,7 @@
</div>
</div>
<div
class=
"body"
>
<div
class=
"body"
>
<img
<img
src=
"http
s://oscimg.oschina.net/oscnet/up-d6695f82666e5018f715c41cb7ee60d3b73
.png"
src=
"http
://ruoyi.vip/images/pay
.png"
alt=
"donate"
alt=
"donate"
width=
"100%"
width=
"100%"
/>
/>
...
...
ruoyi-ui/vue.config.js
View file @
9e66ada9
...
@@ -90,9 +90,7 @@ module.exports = {
...
@@ -90,9 +90,7 @@ module.exports = {
})
})
.
end
()
.
end
()
config
config
.
when
(
process
.
env
.
NODE_ENV
!==
'development'
,
config
=>
{
.
when
(
process
.
env
.
NODE_ENV
!==
'development'
,
config
=>
{
config
config
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
after
(
'html'
)
.
after
(
'html'
)
...
@@ -101,8 +99,8 @@ module.exports = {
...
@@ -101,8 +99,8 @@ module.exports = {
inline
:
/runtime
\.
.*
\.
js$/
inline
:
/runtime
\.
.*
\.
js$/
}])
}])
.
end
()
.
end
()
config
.
optimization
.
splitChunks
({
config
.
optimization
.
splitChunks
({
chunks
:
'all'
,
chunks
:
'all'
,
cacheGroups
:
{
cacheGroups
:
{
libs
:
{
libs
:
{
...
@@ -113,8 +111,8 @@ module.exports = {
...
@@ -113,8 +111,8 @@ module.exports = {
},
},
elementUI
:
{
elementUI
:
{
name
:
'chunk-elementUI'
,
// split elementUI into a single package
name
:
'chunk-elementUI'
,
// split elementUI into a single package
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
,
// in order to adapt to cnpm
priority
:
20
,
// the weight needs to be larger than libs and app or it will be packaged into libs or app
priority
:
20
,
// the weight needs to be larger than libs and app or it will be packaged into libs or app
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
// in order to adapt to cnpm
},
},
commons
:
{
commons
:
{
name
:
'chunk-commons'
,
name
:
'chunk-commons'
,
...
@@ -125,12 +123,12 @@ module.exports = {
...
@@ -125,12 +123,12 @@ module.exports = {
}
}
}
}
})
})
config
.
optimization
.
runtimeChunk
(
'single'
),
config
.
optimization
.
runtimeChunk
(
'single'
),
{
{
from
:
path
.
resolve
(
__dirname
,
'./public/robots.txt'
),
//防爬虫文件
from
:
path
.
resolve
(
__dirname
,
'./public/robots.txt'
),
//防爬虫文件
to
:
'./'
//到根目录下
to
:
'./'
//到根目录下
}
}
}
})
)
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment