Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
ruoyi
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
范晓龙
ruoyi
Commits
334d93d5
提交
334d93d5
authored
10月 24, 2022
作者:
dingtalk_nnkplh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改学校图册,增加封面字段
上级
b81a75bb
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
114 行增加
和
44 行删除
+114
-44
add.html
...-admin/src/main/resources/templates/system/atlas/add.html
+21
-1
edit.html
...admin/src/main/resources/templates/system/atlas/edit.html
+78
-42
TbSchoolAtlas.java
.../src/main/java/com/ruoyi/system/domain/TbSchoolAtlas.java
+10
-0
TbSchoolAtlasMapper.xml
.../src/main/resources/mapper/system/TbSchoolAtlasMapper.xml
+5
-1
没有找到文件。
ruoyi-admin/src/main/resources/templates/system/atlas/add.html
浏览文件 @
334d93d5
...
...
@@ -10,7 +10,6 @@
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label is-required"
>
学校:
</label>
<div
class=
"col-sm-8"
>
<!-- <input name="schoolId" class="form-control" type="text" required>-->
<select
id=
"schoolId"
class=
"form-control select2-multiple"
>
<option>
请选择学校
</option>
</select>
...
...
@@ -22,6 +21,15 @@
<input
name=
"atlasName"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label is-required"
>
图册封面:
</label>
<input
id=
"atlasCover"
type=
"hidden"
name=
"atlasCover"
>
<div
class=
"col-sm-8"
>
<div
class=
"file-loading"
>
<input
id=
"singleFile"
name=
"files"
type=
"file"
>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label is-required"
>
图册内容:
</label>
<input
id=
"atlasContent"
type=
"hidden"
name=
"atlasContent"
>
...
...
@@ -76,6 +84,18 @@
}).
on
(
'fileremoved'
,
function
(
event
,
id
,
index
)
{
$
(
"input[name='"
+
event
.
currentTarget
.
id
+
"']"
).
val
(
''
)
})
// 单图上传
$
(
"#singleFile"
).
fileinput
({
uploadUrl
:
ctx
+
'common/upload'
,
maxFileCount
:
1
,
autoReplace
:
true
}).
on
(
'fileuploaded'
,
function
(
event
,
data
,
previewId
,
index
)
{
var
rsp
=
data
.
response
;
$
(
"#atlasCover"
).
val
(
rsp
.
fileName
);
}).
on
(
'fileremoved'
,
function
(
event
,
id
,
index
)
{
$
(
"input[name='"
+
event
.
currentTarget
.
id
+
"']"
).
val
(
''
)
})
});
</script>
</body>
...
...
ruoyi-admin/src/main/resources/templates/system/atlas/edit.html
浏览文件 @
334d93d5
...
...
@@ -21,12 +21,19 @@
<input
name=
"atlasName"
th:field=
"*{atlasName}"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label is-required"
>
图册封面:
</label>
<div
class=
"col-sm-8"
>
<input
type=
"hidden"
class=
"form-control"
th:field=
"*{atlasCover}"
>
<div
class=
"file-loading"
>
<input
id=
"singleFile"
name=
"files"
type=
"file"
>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label is-required"
>
图册内容:
</label>
<!-- <input id="atlasContent" type="hidden" name="atlasContent">-->
<div
class=
"col-sm-8"
>
<input
type=
"hidden"
class=
"form-control"
th:field=
"*{atlasContent}"
>
<!-- <div class="summernote" id="atlasContent"></div>-->
<div
class=
"file-loading"
>
<input
id=
"multipleFile"
name=
"files"
type=
"file"
multiple
>
</div>
...
...
@@ -49,48 +56,9 @@
}
}
// $(function() {
// $('.summernote').each(function(i) {
// $('#' + this.id).summernote({
// lang: 'zh-CN',
// dialogsInBody: true,
// callbacks: {
// onChange: function(contents, $edittable) {
// $("input[name='" + this.id + "']").val(contents);
// },
// onImageUpload: function(files) {
// var obj = this;
// var data = new FormData();
// data.append("file", files[0]);
// $.ajax({
// type: "post",
// url: ctx + "common/upload",
// data: data,
// cache: false,
// contentType: false,
// processData: false,
// dataType: 'json',
// success: function(result) {
// if (result.code == web_status.SUCCESS) {
// $('#' + obj.id).summernote('insertImage', result.url);
// } else {
// $.modal.alertError(result.msg);
// }
// },
// error: function(error) {
// $.modal.alertWarning("图片上传失败。");
// }
// });
// }
// }
// });
// var content = $("input[name='" + this.id + "']").val();
// $('#' + this.id).summernote('code', content);
// })
// });
//初始化文件预览数据和文件上传附件
initUpload
();
initUpload1
();
//初始化方法
function
initUpload
()
{
...
...
@@ -167,6 +135,73 @@
$
(
"#atlasContent"
).
val
(
urlLinkNew
);
console
.
log
(
$
(
"#atlasContent"
).
val
())
});
function
initUpload1
()
{
var
logoUrl
=
$
(
"#atlasCover"
).
val
();
//拿到图片路径
var
preList
=
new
Array
();
var
initialPreviewConfig
=
new
Array
();
//设置初始化区域值
if
(
logoUrl
!=
null
&&
logoUrl
!=
''
){
var
a
=
{
// caption : '主图'+(i+1),
// width: '120px',
url
:
'/common/del'
,
// key: i,
extra
:
{
url
:
logoUrl
}
}
preList
.
push
(
logoUrl
);
initialPreviewConfig
.
push
(
a
);
}
$
(
"#singleFile"
).
fileinput
({
language
:
'zh'
,
//设置语言
uploadUrl
:
"/common/upload"
,
//上传的地址,改成自己的
allowedFileExtensions
:[
'bmp'
,
'gif'
,
'jpg'
,
'jpeg'
,
'png'
],
//接收的文件后缀
initialPreviewAsData
:
true
,
initialPreview
:
preList
,
//预览图片
uploadAsync
:
true
,
//默认异步上传
showUpload
:
true
,
//是否显示上传按钮
showRemove
:
false
,
//显示移除按钮
showPreview
:
true
,
//是否显示预览
showCaption
:
false
,
//是否显示标题
browseClass
:
"btn btn-primary"
,
//按钮样式
dropZoneEnabled
:
false
,
//是否显示拖拽区域
maxFileCount
:
1
,
//表示允许同时上传的最大文件个数
maxFileSize
:
10
*
1024
*
1024
,
messages
:
{
maxFileSize
:
'文件上传的最大大小为 10MB'
,
acceptFileTypes
:
'此文件是不支持的图片格式'
},
enctype
:
'multipart/form-data'
,
validateInitialCount
:
true
,
msgFilesTooMany
:
5
,
autoReplace
:
false
,
initialPreviewConfig
:
initialPreviewConfig
});
$
(
"#singleFile"
).
on
(
'fileuploaded'
,
function
(
event
,
data
,
previewId
,
index
)
{
var
rsp
=
data
.
response
;
$
(
"#atlasCover"
).
val
(
rsp
.
fileName
);
$
(
"#singleFile"
).
fileinput
(
'destroy'
);
//销毁fileUploadFileInput
initUpload1
();
//重新初始化文件预览数据和文件上传附件
$
(
'#singleFile'
).
fileinput
(
'enable'
);
//enable作用:destroy并重新初始化fileinput插件后,插件会处于disable状态
});
$
(
'#singleFile'
).
on
(
'filepredelete'
,
function
(
event
,
key
,
jqXHR
,
data
)
{
//就是在删除原图片之前触发,而新选择的图片不会触发。能满足我们的要求。
console
.
log
(
'Key = '
+
key
);
var
logoUrl
=
$
(
"#atlasCover"
).
val
();
var
urlLinkNew
=
''
;
var
imgArr
=
logoUrl
.
split
(
","
);
for
(
var
i
=
0
;
i
<
imgArr
.
length
;
i
++
)
{
if
(
i
==
key
)
continue
;
if
(
urlLinkNew
!=
''
){
urlLinkNew
=
urlLinkNew
+
","
+
imgArr
[
i
];
}
else
{
urlLinkNew
=
imgArr
[
i
];
}
}
$
(
"#atlasCover"
).
val
(
urlLinkNew
);
console
.
log
(
$
(
"#atlasCover"
).
val
())
});
}
</script>
</body>
</html>
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/domain/TbSchoolAtlas.java
浏览文件 @
334d93d5
...
...
@@ -29,6 +29,8 @@ public class TbSchoolAtlas extends BaseEntity
@Excel
(
name
=
"图册名称"
)
private
String
atlasName
;
private
String
atlasCover
;
/** 图册内容 */
@Excel
(
name
=
"图册内容"
)
private
String
atlasContent
;
...
...
@@ -100,6 +102,14 @@ public class TbSchoolAtlas extends BaseEntity
this
.
modifiedByDesc
=
modifiedByDesc
;
}
public
String
getAtlasCover
()
{
return
atlasCover
;
}
public
void
setAtlasCover
(
String
atlasCover
)
{
this
.
atlasCover
=
atlasCover
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
ruoyi-system/src/main/resources/mapper/system/TbSchoolAtlasMapper.xml
浏览文件 @
334d93d5
...
...
@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"schoolId"
column=
"school_id"
/>
<result
property=
"atlasName"
column=
"atlas_name"
/>
<result
property=
"atlasCover"
column=
"atlas_cover"
/>
<result
property=
"atlasContent"
column=
"atlas_content"
/>
<result
property=
"creator"
column=
"creator"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
...
@@ -16,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql
id=
"selectTbSchoolAtlasVo"
>
select id, school_id, atlas_name, atlas_content, creator, create_time,
select id, school_id, atlas_name, atlas_co
ver, atlas_co
ntent, creator, create_time,
modified_by,update_time from tb_school_atlas
</sql>
...
...
@@ -38,12 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"schoolId != null"
>
school_id,
</if>
<if
test=
"atlasName != null and atlasName != ''"
>
atlas_name,
</if>
<if
test=
"atlasCover != null and atlasCover != ''"
>
atlas_cover,
</if>
<if
test=
"atlasContent != null and atlasContent != ''"
>
atlas_content,
</if>
create_time,creator
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"schoolId != null"
>
#{schoolId},
</if>
<if
test=
"atlasName != null and atlasName != ''"
>
#{atlasName},
</if>
<if
test=
"atlasCover != null and atlasCover != ''"
>
#{atlasCover},
</if>
<if
test=
"atlasContent != null and atlasContent != ''"
>
#{atlasContent},
</if>
sysdate(),#{creator}
</trim>
...
...
@@ -54,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"schoolId != null"
>
school_id = #{schoolId},
</if>
<if
test=
"atlasName != null and atlasName != ''"
>
atlas_name = #{atlasName},
</if>
<if
test=
"atlasCover != null and atlasCover != ''"
>
atlas_cover = #{atlasCover},
</if>
<if
test=
"atlasContent != null and atlasContent != ''"
>
atlas_content = #{atlasContent},
</if>
modified_by=#{modifiedBy},
update_time=sysdate()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论