可以对资源进行增删改
This commit is contained in:
@@ -52,13 +52,13 @@
|
||||
<div id="blog-content">
|
||||
<div id="editor-toolbar"></div>
|
||||
<div id="editor-text-area" style="height: 400px;border: 1px solid lightgrey"></div>
|
||||
<textarea id="blog-textarea" name="content" th:text="${blog.getContent()}" style="display: none;"></textarea>
|
||||
<textarea id="content-textarea" name="content" th:text="${blog.getContent()}" style="display: none;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit">提交修改</button>
|
||||
<button class="btn btn-primary btn-lg btn-block" onclick="this.disabled=true; this.form.submit();" type="submit">提交修改</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,57 +75,8 @@
|
||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
||||
|
||||
<script th:src="@{/wangedit/js/wang.min.js}"></script>
|
||||
<script type="text/javascript">
|
||||
const E = window.wangEditor
|
||||
|
||||
// 切换语言
|
||||
const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
|
||||
E.i18nChangeLanguage(LANG)
|
||||
|
||||
const editorConfig = {
|
||||
placeholder: '请输入...',
|
||||
scroll: true, // 禁止编辑器滚动
|
||||
MENU_CONF: {
|
||||
uploadImage: {
|
||||
fieldName: 'your-fileName',
|
||||
base64LimitSize: 10 * 1024 * 1024 // 10M 以下插入 base64
|
||||
}
|
||||
},
|
||||
onChange(editor) {
|
||||
// console.log(editor.getHtml())
|
||||
// $('#blog-textarea').value = editor.getHtml()
|
||||
const content = editor.children
|
||||
// const contentStr = JSON.stringify(content)
|
||||
// document.getElementById('blog-textarea').value = contentStr
|
||||
const html = editor.getHtml()
|
||||
$('#blog-textarea').val(html)
|
||||
}
|
||||
}
|
||||
|
||||
// 先创建 editor
|
||||
const editor = E.createEditor({
|
||||
selector: '#editor-text-area',
|
||||
// content: [],
|
||||
html: $('#blog-textarea').val(),
|
||||
config: editorConfig
|
||||
})
|
||||
|
||||
// 创建 toolbar
|
||||
const toolbar = E.createToolbar({
|
||||
editor,
|
||||
selector: '#editor-toolbar',
|
||||
config: {
|
||||
excludeKeys: 'fullScreen',
|
||||
}
|
||||
})
|
||||
|
||||
// 点击空白处 focus 编辑器
|
||||
$('#editor-text-area').addEventListener('click', e => {
|
||||
if (e.target.id === 'editor-text-area') {
|
||||
editor.blur()
|
||||
editor.focus(true) // focus 到末尾
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script th:src="@{/wangedit/js/wang.init.js}"></script>
|
||||
<script th:src="@{/layer/layer.js}"></script>
|
||||
<script th:src="@{/js/axios.js}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<div class="form-group">
|
||||
<textarea name="content" class="form-control" rows="3" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary float-right">提交评论</button>
|
||||
<button type="submit" onclick="this.disabled=true; this.form.submit();" class="btn btn-primary float-right">提交评论</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -53,19 +53,18 @@
|
||||
<div id="blog-content">
|
||||
<div id="editor-toolbar"></div>
|
||||
<div id="editor-text-area" style="height: 400px;border: 1px solid lightgrey"></div>
|
||||
<textarea id="blog-textarea" name="content" style="display: none;"></textarea>
|
||||
<textarea id="content-textarea" name="content" style="display: none;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit">发布文章</button>
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="this.disabled=true; this.form.submit();" >发布文章</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div th:replace="~{common/footer::footer}"></div>
|
||||
|
||||
<a class="to-top">返回顶部</a>
|
||||
@@ -76,58 +75,9 @@
|
||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
||||
|
||||
<script th:src="@{/wangedit/js/wang.min.js}"></script>
|
||||
<script type="text/javascript">
|
||||
const E = window.wangEditor
|
||||
|
||||
// 切换语言
|
||||
const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
|
||||
E.i18nChangeLanguage(LANG)
|
||||
|
||||
const editorConfig = {
|
||||
placeholder: '请输入...',
|
||||
scroll: true, // 禁止编辑器滚动
|
||||
MENU_CONF: {
|
||||
uploadImage: {
|
||||
fieldName: 'your-fileName',
|
||||
base64LimitSize: 10 * 1024 * 1024 // 10M 以下插入 base64
|
||||
}
|
||||
},
|
||||
onChange(editor) {
|
||||
// console.log(editor.getHtml())
|
||||
// $('#blog-textarea').value = editor.getHtml()
|
||||
const content = editor.children
|
||||
// const contentStr = JSON.stringify(content)
|
||||
// document.getElementById('blog-textarea').value = contentStr
|
||||
const html = editor.getHtml()
|
||||
$('#blog-textarea').val(html)
|
||||
}
|
||||
}
|
||||
|
||||
// 先创建 editor
|
||||
const editor = E.createEditor({
|
||||
selector: '#editor-text-area',
|
||||
content: [],
|
||||
// html: '',
|
||||
config: editorConfig
|
||||
})
|
||||
|
||||
// 创建 toolbar
|
||||
const toolbar = E.createToolbar({
|
||||
editor,
|
||||
selector: '#editor-toolbar',
|
||||
config: {
|
||||
excludeKeys: 'fullScreen',
|
||||
}
|
||||
})
|
||||
|
||||
// 点击空白处 focus 编辑器
|
||||
$('#editor-text-area').addEventListener('click', e => {
|
||||
if (e.target.id === 'editor-text-area') {
|
||||
editor.blur()
|
||||
editor.focus(true) // focus 到末尾
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script th:src="@{/wangedit/js/wang.init.js}"></script>
|
||||
<script th:src="@{/layer/layer.js}"></script>
|
||||
<script th:src="@{/js/axios.js}"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<li th:class="${activeUrl=='index.html'?'nav-item active':'nav-item'}">
|
||||
<a class="nav-link" th:href="@{/index}">首页 </a>
|
||||
</li>
|
||||
<li th:class="${activeUrl=='question'?'nav-item active':'nav-item'}">
|
||||
<a class="nav-link" th:href="@{/question}">问答 </a>
|
||||
</li>
|
||||
<!-- <li th:class="${activeUrl=='question'?'nav-item active':'nav-item'}">-->
|
||||
<!-- <a class="nav-link" th:href="@{/question}">问答 </a>-->
|
||||
<!-- </li>-->
|
||||
<li th:class="${activeUrl=='blog'?'nav-item active':'nav-item'}">
|
||||
<a class="nav-link" th:href="@{/blog}">论坛 </a>
|
||||
</li>
|
||||
|
||||
18
src/main/resources/templates/error/check.html
Normal file
18
src/main/resources/templates/error/check.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>ERROR-Quinn</title>
|
||||
<link rel="stylesheet" th:href="@{/css/error.css}">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="NotPage">
|
||||
<div class="message"><a th:href="@{/index}" style="color: white">请使用浏览器后退,或者点此处【主页】</a></div>
|
||||
<div class="message2" style="text-align: center"><a style="color: white">Quinn-管理员密码错误,请关注公众号寻找密码!</a></div>
|
||||
<img th:src="@{/images/logo/logo.png}">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -23,7 +23,7 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit">登 录</button>
|
||||
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" onclick="this.disabled=true; this.form.submit();">登 录</button>
|
||||
|
||||
<p class="clearfix">
|
||||
<a th:href="@{/register}" class="float-right">没有账号?去注册</a>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit">提交修改</button>
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="this.disabled=true; this.form.submit();">提交修改</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<div class="form-group">
|
||||
<textarea required name="content" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary float-right">提交评论</button>
|
||||
<button type="submit" onclick="this.disabled=true; this.form.submit();" class="btn btn-primary float-right">提交评论</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit">发布问题</button>
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="this.disabled=true; this.form.submit();">发布问题</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<input type="password" name="repassword" class="form-control" placeholder="确认密码" required="">
|
||||
<input type="text" name="code" class="form-control" placeholder="社区邀请码" required="">
|
||||
|
||||
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit">注 册</button>
|
||||
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" onclick="this.disabled=true; this.form.submit();">注 册</button>
|
||||
|
||||
<p class="clearfix">
|
||||
<a th:href="@{/toLogin}" class="float-right">已有账号?去登录</a>
|
||||
|
||||
151
src/main/resources/templates/source/editorSource.html
Normal file
151
src/main/resources/templates/source/editorSource.html
Normal file
@@ -0,0 +1,151 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>论坛-Quinn</title>
|
||||
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/wangedit/css/wang.style.css}"/>
|
||||
</head>
|
||||
<body style="background: #f2f2f2;">
|
||||
|
||||
<!-- 导航栏 -->
|
||||
<main role="main" class="container mt-3 p-3 bg-white rounded">
|
||||
<div class="row">
|
||||
<div class="col-md-12 blog-main">
|
||||
<div class="col-md-12 order-md-1">
|
||||
<div class="row mb-4">
|
||||
<h4 class="col-md-11">修改资源</h4>
|
||||
<a href="javascript:deleteFile(this);" class="btn btn-outline-danger col-md-1">删除资源</a>
|
||||
</div>
|
||||
<form class="needs-validation" th:action="@{/tracy/mcgrady/lmq/love/wn/update}" enctype="multipart/form-data" method="post">
|
||||
<input type="hidden" id="sid" name="sid" th:value="${source.getSid()}">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-8">
|
||||
<label for="title">资源标题</label>
|
||||
<input type="text" name="sourceName" class="form-control" id="title" th:value="${source.getSourceName()}" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="enName">英文名</label>
|
||||
<input type="text" name="enName" class="form-control" id="enName" th:value="${source.getEnName()}" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="sType">资源标签</label>
|
||||
<select name="categoryId" class="custom-select d-block w-100" id="sType">
|
||||
<option th:each="category:${categoryList}"
|
||||
th:selected="${source.getCategoryId() == category.getId()}"
|
||||
th:value="${category.getId()}" th:text="${category.getCategory()}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="keyWords">摘要</label>
|
||||
<input type="text" name="keyWords" class="form-control" id="keyWords" th:value="${source.getKeyWord1()}" required>
|
||||
</div>
|
||||
|
||||
<div id="uploadPassWordDiv" class="form-group col-md-4">
|
||||
<label for="uploadPassWord">管理员密码(*重要*)</label>
|
||||
<input type="text" name="uploadPassWord" class="form-control" id="uploadPassWord" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subContent">简介</label>
|
||||
<textarea name="detail" class="form-control" id="subContent" th:text="${source.getDetail()}" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sourceType">下载方式</label>
|
||||
<select name="sourceType" class="custom-select d-block w-100" id="sourceType" required>
|
||||
<option value="">请选择...</option>
|
||||
<option th:selected="${source.getSourceType() != 'OSS'}" value="BAIDU">百度云</option>
|
||||
<option th:selected="${source.getSourceType() == 'OSS'}" value="OSS" >服务器</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="baiduSourceTypeDiv" style="display: none" class="form-group col-md-6">
|
||||
<label for="sourceLink">百度云URL</label>
|
||||
<input type="text" name="sourceLink" class="form-control" id="sourceLink" th:value="${source.getSourceType()} == 'OSS' ? '' : ${source.getSourceLink()}" />
|
||||
</div>
|
||||
|
||||
<div id="uploadData" style="display: none" class="form-group col-md-12">
|
||||
<label for="uploadDataDiv" style="color: darkgreen">注意:如果没有修改文件,则无需重复上传!</label>
|
||||
<input type="file" class="btn" name="file" id="uploadDataDiv" value="选择本地文件" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<hr/>
|
||||
<div id="blog-content">
|
||||
<div id="editor-toolbar"></div>
|
||||
<div id="editor-text-area" style="height: 400px;border: 1px solid lightgrey"></div>
|
||||
<textarea id="content-textarea" name="sourceContent" style="display: none;" th:text="${source.getSourceContent()}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="this.disabled=true; this.form.submit();">修改资源</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<div th:replace="~{common/footer::footer}"></div>
|
||||
|
||||
<a class="to-top">返回顶部</a>
|
||||
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
|
||||
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
|
||||
<script th:src="@{/js/toTop.js}"></script>
|
||||
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
||||
|
||||
<script th:src="@{/wangedit/js/wang.min.js}"></script>
|
||||
<script th:src="@{/wangedit/js/wang.init.js}"></script>
|
||||
<script th:src="@{/layer/layer.js}"></script>
|
||||
<script th:src="@{/js/axios.js}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {// 初始化内容
|
||||
const jSourceType = $('#sourceType').val();
|
||||
if (jSourceType == 'OSS') {
|
||||
$("#uploadData").show();
|
||||
}else {
|
||||
$("#baiduSourceTypeDiv").show();
|
||||
}
|
||||
});
|
||||
|
||||
function deleteFile(btn) {
|
||||
btn.disabled=true;
|
||||
if(!confirm('你确认要删除吗?')) {
|
||||
return false;
|
||||
}
|
||||
var sid = $('#sid').val();
|
||||
var uploadPassWord = $('#uploadPassWord').val();
|
||||
$.ajax({
|
||||
url: "/tracy/mcgrady/lmq/love/wn/del",
|
||||
async: false,
|
||||
type: "post",
|
||||
data: {"sid":sid,"uploadPassWord":uploadPassWord},
|
||||
success: function (res) {
|
||||
location.href=res;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#sourceType").change(function(){
|
||||
const jSourceType = $('#sourceType').val();
|
||||
if (jSourceType == 'BAIDU') {
|
||||
$("#uploadData").hide();
|
||||
$("#baiduSourceTypeDiv").show();
|
||||
}
|
||||
if (jSourceType == 'OSS') {
|
||||
$("#baiduSourceTypeDiv").hide();
|
||||
$("#uploadData").show();
|
||||
}
|
||||
if (jSourceType != 'OSS' && jSourceType != 'BAIDU'){
|
||||
$("#baiduSourceTypeDiv").hide();
|
||||
$("#uploadData").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p th:text="${source.getDetail()}"></p>
|
||||
<a th:href="@{'/source/view/'+${source.getId()}}" style="color: white" class="btn btn-sm btn-primary">查看详情</a>
|
||||
<a th:href="@{'/source/view/'+${source.getSid()}}" class="btn btn-sm btn-outline-success">查看详情</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,21 +48,21 @@
|
||||
<table class="table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">资源名</th>
|
||||
<th scope="col">资源简介</th>
|
||||
<th scope="col">资源类型</th>
|
||||
<th scope="col">热度</th>
|
||||
<th scope="col">去下载</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="source:${sourceList}">
|
||||
<td th:text="${source.getId()}"></td>
|
||||
<td th:text="${source.getSourceName()}"></td>
|
||||
<td th:text="${source.getDetail()}"></td>
|
||||
<td th:text="${source.getCategoryName()}"></td>
|
||||
<td th:name="${source.getId()}">
|
||||
<a style="color: white" th:href="@{'/source/view/'+${source.getId()}}" class="btn btn-sm btn-primary">详情</a>
|
||||
<td th:text="${source.getDownRecord()}"></td>
|
||||
<td th:name="${source.getSid()}">
|
||||
<a style="color: white" th:href="@{'/source/view/'+${source.getSid()}}" class="btn btn-sm btn-secondary">详情</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
124
src/main/resources/templates/source/uploadSource.html
Normal file
124
src/main/resources/templates/source/uploadSource.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>资源-Quinn</title>
|
||||
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/wangedit/css/wang.style.css}"/>
|
||||
</head>
|
||||
<body style="background: #f2f2f2;">
|
||||
<main role="main" class="container mt-3 p-3 bg-white rounded">
|
||||
<div class="row">
|
||||
<div class="col-md-12 blog-main">
|
||||
<div class="col-md-12 order-md-1">
|
||||
<h4 class="mb-3">发布新资源</h4>
|
||||
|
||||
<form class="needs-validation" th:action="@{/tracy/mcgrady/lmq/love/wn}" enctype="multipart/form-data" method="post">
|
||||
<!-- 隐藏域 -->
|
||||
<!-- <input type="hidden" name="authorId" th:value="${session.loginUser.getUid()}">-->
|
||||
<!-- <input type="hidden" name="authorName" th:value="${session.loginUser.getUsername()}">-->
|
||||
<!-- <input type="hidden" name="authorAvatar" th:value="${session.loginUser.getAvatar()}">-->
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-8">
|
||||
<label for="title">资源标题</label>
|
||||
<input type="text" name="title" class="form-control" id="title" value="" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="enName">英文名</label>
|
||||
<input type="text" name="enName" class="form-control" id="enName" value="" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="sType">资源标签</label>
|
||||
<select name="categoryId" class="custom-select d-block w-100" id="sType">
|
||||
<option th:each="category:${categoryList}"
|
||||
th:value="${category.getId()}" th:text="${category.getCategory()}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="keyWords">摘要</label>
|
||||
<input type="text" name="keyWords" class="form-control" id="keyWords" value="" required>
|
||||
</div>
|
||||
|
||||
<div id="uploadPassWordDiv" class="form-group col-md-4">
|
||||
<label for="uploadPassWord">管理员密码(*重要*)</label>
|
||||
<input type="text" class="form-control" id="uploadPassWord" name="uploadPassWord" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="subContent">简介</label>
|
||||
<textarea name="subContent" class="form-control" id="subContent" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sourceType">下载方式</label>
|
||||
<select name="sourceType" class="custom-select d-block w-100" id="sourceType" required>
|
||||
<option value="">请选择...</option>
|
||||
<option value="BAIDU">百度云</option>
|
||||
<option value="OSS" >服务器</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="baiduSourceTypeDiv" style="display: none" class="form-group col-md-6">
|
||||
<label for="sourceLink">百度云URL</label>
|
||||
<input type="text" name="sourceLink" class="form-control" id="sourceLink" />
|
||||
</div>
|
||||
|
||||
<div id="uploadData" style="display: none" class="form-group col-md-12">
|
||||
<label for="toUploadFile" style="color: darkgreen">穷~文件请不要大于20M,否则会报错</label>
|
||||
<input type="file" id="toUploadFile" class="btn" name="file" value="请选择文件" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<hr/>
|
||||
<div id="blog-content">
|
||||
<div id="editor-toolbar"></div>
|
||||
<div id="editor-text-area" style="height: 400px;border: 1px solid lightgrey"></div>
|
||||
<textarea id="content-textarea" name="content" style="display: none;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" onclick="this.disabled=true; this.form.submit();">发布资源</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<a class="to-top">返回顶部</a>
|
||||
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
|
||||
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
|
||||
<script th:src="@{/js/toTop.js}"></script>
|
||||
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
||||
|
||||
<script th:src="@{/wangedit/js/wang.min.js}"></script>
|
||||
<script th:src="@{/wangedit/js/wang.init.js}"></script>
|
||||
<script th:src="@{/layer/layer.js}"></script>
|
||||
<script th:src="@{/js/axios.js}"></script>
|
||||
<script type="text/javascript">
|
||||
$("#sourceType").change(function(){
|
||||
const jSourceType = $('#sourceType').val();
|
||||
if (jSourceType == 'BAIDU') {
|
||||
$("#uploadData").hide();
|
||||
$("#baiduSourceTypeDiv").show();
|
||||
}
|
||||
if (jSourceType == 'OSS') {
|
||||
$("#baiduSourceTypeDiv").hide();
|
||||
$("#uploadData").show();
|
||||
}
|
||||
if (jSourceType != 'OSS' && jSourceType != 'BAIDU'){
|
||||
$("#baiduSourceTypeDiv").hide();
|
||||
$("#uploadData").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -22,10 +22,15 @@
|
||||
<span th:text="${#dates.format(source.getGmtUpdate(),'yyyy-MM-dd')}"></span>
|
||||
类别-
|
||||
<span th:text="${source.getCategoryName()}"></span>
|
||||
<a th:href="@{'/source/download/' + ${source.getId()}}" class="btn btn-outline-success col-md-2 float-right">下载</a>
|
||||
<a href="javascript:downloadFile(this);" class="btn btn-outline-success col-md-2 float-right">下载</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style="display: none">
|
||||
<form th:action="@{'/source/download/'+${source.getSid()}}" method="post">
|
||||
<input type="submit" id="downloadTrans" />
|
||||
</form>
|
||||
</div>
|
||||
<input type="hidden" id="sourceDType" name="sourceDType" th:value="${source.getSourceType()}">
|
||||
<hr style="margin-top: 18px">
|
||||
|
||||
<!--文章主体内容-->
|
||||
@@ -40,15 +45,15 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 source-main" style="margin-top: 20px">
|
||||
<form th:action="@{'/source/comment/'+${source.getId()}}" method="post">
|
||||
<form th:action="@{'/source/comment/'+${source.getSid()}}" method="post">
|
||||
<input type="hidden" name="userId" th:value="${session.loginUser.getUid()}">
|
||||
<input type="hidden" name="userName" th:value="${session.loginUser.getUsername()}">
|
||||
<input type="hidden" name="userAvatar" th:value="${session.loginUser.getAvatar()}">
|
||||
<input type="hidden" name="topicId" th:value="${source.getId()}">
|
||||
<input type="hidden" id="topicId" name="topicId" th:value="${source.getSid()}">
|
||||
<div class="form-group">
|
||||
<textarea name="content" class="form-control" rows="3" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary float-right">提交评论</button>
|
||||
<button type="submit" onclick="this.disabled=true; this.form.submit();" class="btn btn-primary float-right">提交评论</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -96,6 +101,26 @@
|
||||
<script th:src="@{/editormd/lib/jquery.flowchart.min.js}"></script>
|
||||
<script th:src="@{/editormd/editormd.js}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function downloadFile(btn){
|
||||
btn.disabled=true;
|
||||
var sid = $('#topicId').val();
|
||||
var sourceDType = $('#sourceDType').val();
|
||||
if (sourceDType == 'OSS'){
|
||||
$('#downloadTrans').click();
|
||||
}else {
|
||||
$.ajax({
|
||||
url: "/source/download/" + sid,
|
||||
async: false,
|
||||
type: "post",
|
||||
data: '',
|
||||
success: function (res) {
|
||||
window.open(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var testEditor;
|
||||
$(function () {
|
||||
@@ -109,7 +134,6 @@
|
||||
sequenceDiagram: true, // 默认不解析
|
||||
codeFold: true
|
||||
});});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
<hr class="mb-4">
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit"> 更新资料 </button>
|
||||
<button class="btn btn-primary btn-lg btn-block" type="submit" > 更新资料 </button>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user