Commit 70616aef authored by daniel's avatar daniel

perf(公告模块优化): 公告模块优化

parent 5622bf4a
...@@ -33,5 +33,9 @@ public class News implements Serializable { ...@@ -33,5 +33,9 @@ public class News implements Serializable {
@JsonIgnore @JsonIgnore
private Date updateDate; private Date updateDate;
private String path;
private String appId;
private String lat;
private String lng;
private int openType;
} }
\ No newline at end of file
...@@ -257,6 +257,7 @@ ...@@ -257,6 +257,7 @@
<select id="getCmptFromEnroll" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt"> <select id="getCmptFromEnroll" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt">
select cmptName,date_format(startTime,'%Y-%m-%d %H:%i:%s') startTime, select cmptName,date_format(startTime,'%Y-%m-%d %H:%i:%s') startTime,
date_format(ifnull(endTime,now()),'%Y-%m-%d %H:%i:%s') endTime,type as cmptType, date_format(ifnull(endTime,now()),'%Y-%m-%d %H:%i:%s') endTime,type as cmptType,
logo,
b.city as city, b.city as city,
b.province as province, b.province as province,
b.area as area, b.area as area,
......
...@@ -70,6 +70,7 @@ public class NewsController { ...@@ -70,6 +70,7 @@ public class NewsController {
@ResponseBody @ResponseBody
public Result save(News news) { public Result save(News news) {
News newDb = newsService.save(news); News newDb = newsService.save(news);
log.info("保存数据 ",newDb.toString());
return Result.success().setContent(newDb); return Result.success().setContent(newDb);
} }
......
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %> <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html> <!doctype html>
<html> <html>
<head>
<head>
<title>资讯</title> <title>资讯</title>
<!-- Bootstrap CSS--> <!-- Bootstrap CSS-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
...@@ -15,31 +16,43 @@ ...@@ -15,31 +16,43 @@
<!-- Google fonts - Poppins --> <!-- Google fonts - Poppins -->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css">
<!-- theme stylesheet--> <!-- theme stylesheet-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>" id="theme-stylesheet"> <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>"
id="theme-stylesheet">
<!-- Custom stylesheet - for your changes--> <!-- Custom stylesheet - for your changes-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css"> <link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css">
<!-- Favicon--> <!-- Favicon-->
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico"> <link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>"/> <link rel="stylesheet"
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css"/> href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>" />
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css" />
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script> <script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/leaflet/leaflet.js"></script> <script type="text/javascript" src="${ctxStatic}/leaflet/leaflet.js"></script>
<script type="text/javascript" src="${ctxStatic}/leaflet/label.js"></script> <script type="text/javascript" src="${ctxStatic}/leaflet/label.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script> <script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script>
<link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css"> <link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css">
<script src="https://enroll.geexek.com/js/ueditor/ueditor.config-zs.js?v=<%=System.currentTimeMillis()%>"></script> <script
<script src="https://enroll.geexek.com/js/ueditor/ueditor.all.js?v=<%=System.currentTimeMillis()%>"></script> src="https://enroll.geexek.com/js/ueditor/ueditor.config-zs.js?v=<%=System.currentTimeMillis()%>"></script>
<script
src="https://enroll.geexek.com/js/ueditor/ueditor.all.js?v=<%=System.currentTimeMillis()%>"></script>
<script src="${ctxStatic}/newdermon/vendor/popper.js/umd/popper.min.js"></script> <script src="${ctxStatic}/newdermon/vendor/popper.js/umd/popper.min.js"></script>
<script src="${ctxStatic}/js/qikoo.js"></script> <script src="${ctxStatic}/js/qikoo.js"></script>
<style> <style>
.container { .container {
position: relative position: relative
} }
.hidden {
display: none !important;
}
.data-title { .data-title {
width: 100%; width: 100%;
height: 60px; height: 60px;
...@@ -47,6 +60,7 @@ ...@@ -47,6 +60,7 @@
display: flex; display: flex;
margin-top: 30px; margin-top: 30px;
} }
.add { .add {
width: 146px; width: 146px;
height: 40px; height: 40px;
...@@ -59,11 +73,13 @@ ...@@ -59,11 +73,13 @@
cursor: pointer; cursor: pointer;
border-radius: 4px; border-radius: 4px;
} }
.data-title > span {
.data-title>span {
display: inline-block; display: inline-block;
color: #9A9A9A; color: #9A9A9A;
font-size: 20px; font-size: 20px;
} }
.item { .item {
display: flex; display: flex;
background: white; background: white;
...@@ -74,6 +90,7 @@ ...@@ -74,6 +90,7 @@
box-shadow: 0px 0px 10px 0px rgba(238, 235, 235, 1); box-shadow: 0px 0px 10px 0px rgba(238, 235, 235, 1);
border-radius: 4px; border-radius: 4px;
} }
.title { .title {
padding-left: 40px; padding-left: 40px;
font-size: 20px; font-size: 20px;
...@@ -89,16 +106,20 @@ ...@@ -89,16 +106,20 @@
line-clamp: 2; line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.type { .type {
line-height: 90px; line-height: 90px;
text-align: left; text-align: left;
} }
.opt-text { .opt-text {
font-size: 14px; font-size: 14px;
color: rgba(153, 153, 153, 1); color: rgba(153, 153, 153, 1);
height: 20px; height: 20px;
} }
.del, .edit {
.del,
.edit {
display: inline-block; display: inline-block;
background-position: center; background-position: center;
...@@ -179,7 +200,8 @@ ...@@ -179,7 +200,8 @@
background-color: rgba(85, 85, 85, 0.4); background-color: rgba(85, 85, 85, 0.4);
} }
#edui1, #edui1_iframeholder { #edui1,
#edui1_iframeholder {
width: 682px !important; width: 682px !important;
} }
...@@ -190,11 +212,12 @@ ...@@ -190,11 +212,12 @@
border-radius: 4px; border-radius: 4px;
border: 1px solid rgba(238, 238, 238, 1); border: 1px solid rgba(238, 238, 238, 1);
} }
.input-group{
.input-group {
display: block; display: block;
} }
.input-group > label { .input-group>label {
color: #333; color: #333;
font-size: 20px; font-size: 20px;
float: left; float: left;
...@@ -215,7 +238,8 @@ ...@@ -215,7 +238,8 @@
background-size: auto; background-size: auto;
} }
input, textarea { input,
textarea {
outline: none; outline: none;
padding: 5px; padding: 5px;
} }
...@@ -304,7 +328,8 @@ ...@@ -304,7 +328,8 @@
font-size: 20px; font-size: 20px;
line-height: 40px; line-height: 40px;
} }
.edit-btn{
.edit-btn {
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -313,20 +338,25 @@ ...@@ -313,20 +338,25 @@
float: left; float: left;
margin-top: 3px; margin-top: 3px;
} }
.news-title{
.news-title {
font-size: 24px; font-size: 24px;
color: #333; color: #333;
float: left; float: left;
margin-right: 25px; margin-right: 25px;
} }
.no-name{
color: #ABABAB;font-size: 24px;margin-right: 25px .no-name {
color: #ABABAB;
font-size: 24px;
margin-right: 25px
} }
</style> </style>
</head> </head>
<body style="background:rgba(246,246,246,1);">
<jsp:include page="../common/header.jsp"></jsp:include> <body style="background:rgba(246,246,246,1);">
<div class="page-content d-flex align-items-stretch main-body"> <jsp:include page="../common/header.jsp"></jsp:include>
<div class="page-content d-flex align-items-stretch main-body">
<jsp:include page="../common/menu.jsp"></jsp:include> <jsp:include page="../common/menu.jsp"></jsp:include>
<div class="container rght"> <div class="container rght">
<span class="route-title-main news-title" style="font-size: 24px;color: #333"> <span class="route-title-main news-title" style="font-size: 24px;color: #333">
...@@ -352,13 +382,13 @@ ...@@ -352,13 +382,13 @@
</div> </div>
<div class="data-title"> <div class="data-title">
<span style="flex: 12.3;">标题</span> <span style="flex: 12.3;">标题</span>
<span style="flex:2;text-align: left;visibility: hidden">类型</span> <span style="flex:2;text-align: left;">类型</span>
<span style="flex:2">操作</span> <span style="flex:2">操作</span>
</div> </div>
<c:forEach var="item" items="${list}"> <c:forEach var="item" items="${list}">
<div class="item" data-id="${item.id}"> <div class="item" data-id="${item.id}">
<span class="title" style="flex:11.6">${item.title}</span> <span class="title" style="flex:11.6">${item.title}</span>
<span class="type" style="flex:2;visibility: hidden">${item.type == 1 ? '通知':'赛讯' }</span> <span class="type" style="flex:2;">${typeDesc[item.openType]}</span>
<div style="flex:2;display: flex;flex-direction: column"> <div style="flex:2;display: flex;flex-direction: column">
<div class="opt edit"> <div class="opt edit">
<span class="icon-edit"></span> <span class="icon-edit"></span>
...@@ -375,25 +405,80 @@ ...@@ -375,25 +405,80 @@
<div style="margin-left: 40px;margin-top: 40px; display: none" class="edit-context"> <div style="margin-left: 40px;margin-top: 40px; display: none" class="edit-context">
<div style="margin-bottom: 15px;margin-right: 10px;cursor: pointer" class="back"><span class="icon-back"></span><span <div style="margin-bottom: 15px;margin-right: 10px;cursor: pointer" class="back"><span
style="font-size: 20px;color: #333">返回</span></div> class="icon-back"></span><span style="font-size: 20px;color: #333">返回</span></div>
<div class="edit-container"> <div class="edit-container">
<div class="input-group" style="height: 120px"> <div class="input-group" style="height: 120px;margin-bottom: 10px;">
<label for="">标题 <span style="color: #ce3939">*</span></label> <label for="">标题 <span style="color: #ce3939">*</span></label>
<div> <div>
<textarea style="float: right;" class="title-area" type="text" placeholder="标题" id="title" cols="50" rows="10"></textarea> <textarea style="float: right;" class="title-area" type="text" placeholder="标题"
id="title" cols="50" rows="10"></textarea>
</div> </div>
</div> </div>
<div class="input-group" style="height: 80px; align-items: center;display: none"> <div class="input-group" style="height: 80px; align-items: center;display: none">
<label for="" style="float: left;height: 80px;align-items: center;line-height: 80px;">类型 <span style="color:#ce3939;">*</span></label> <label for=""
style="float: left;height: 80px;align-items: center;line-height: 80px;">类型 <span
style="color:#ce3939;">*</span></label>
<div style="float: left; margin-left: 57px;margin-top: 20px;"> <div style="float: left; margin-left: 57px;margin-top: 20px;">
<input type="radio" name="type" value="1" checked><span class="notice" style="margin-right: 180px;">通知</span> <input type="radio" name="type" value="1" checked><span class="notice"
style="margin-right: 180px;">通知</span>
<input type="radio" name="type" value="2"><span class="info">赛讯</span> <input type="radio" name="type" value="2"><span class="info">赛讯</span>
</div> </div>
</div> </div>
<div class="input-group"
style="height: 80px; align-items: center;display: flex;flex-direction: row">
<span class="title-new">跳转类型</span><span style="color:#ce3939;">*</span></label>
<div class="label-box"
style="margin-left: 40px;margin-top: 20px;margin-bottom: 20px;">
<select id="openType">
<option value="0">文本</option>
<option value="1">h5</option>
<option value="2">小程序</option>
<option value="3">短连接</option>
<option value="4">内部页面</option>
<option value="5">文档</option>
<option value="6">图片</option>
<option value="7">地图</option>
</select>
</div>
</div>
<div class="input-group hidden" id="path-input" style="height: 120px;margin-bottom: 10px;">
<label for="">路径</label>
<div>
<textarea style="float: right;" class="title-area" type="text"
placeholder="外链填写后,优先展示外链信息公众号必选绑定小程序" id="path" cols="50"
rows="10"></textarea>
</div>
</div>
<div class="input-group hidden" id="appId-input"
style="height: 120px;margin-bottom: 10px;">
<label for="">appId</label>
<div>
<textarea style="float: right;" class="title-area" type="text"
placeholder="小程序appId" id="appId" cols="50" rows="10"></textarea>
</div>
</div>
<div class="input-group hidden" id="lat-input"
style="height: 120px;margin-bottom: 10px;">
<label for="">经度</label>
<div>
<textarea style="float: right;" class="title-area" type="text" placeholder="经度"
id="lat" cols="50" rows="10"></textarea>
</div>
</div>
<div class="input-group hidden" id="lng-input"
style="height: 120px;margin-bottom: 10px;">
<label for="">纬地</label>
<div>
<textarea style="float: right;" class="title-area" type="text" placeholder="维度"
id="lng" cols="50" rows="10"></textarea>
</div>
</div>
<div class="input-group" style="margin-top: 8px;margin-bottom: 30px;height: 240px"> <div class="input-group" style="margin-top: 8px;margin-bottom: 30px;height: 240px">
<label id="file-cover">封面<br><span style="font-size: 16px;color: #ce3939;margin-top: 20px"> <label id="file-cover">封面<br><span
<span style="font-size: 12px;display: inline-block;border-radius: 50%;height: 18px;width: 18px;background: #ce3939;color: white;text-align: center;">注</span> style="font-size: 16px;color: #ce3939;margin-top: 20px">
<span
style="font-size: 12px;display: inline-block;border-radius: 50%;height: 18px;width: 18px;background: #ce3939;color: white;text-align: center;">注</span>
<span style="display: inline">建议分辨<br>率710*242</span></span></label> <span style="display: inline">建议分辨<br>率710*242</span></span></label>
<div style="float: right;"> <div style="float: right;">
<div class="cover"> <div class="cover">
...@@ -402,10 +487,12 @@ ...@@ -402,10 +487,12 @@
<input id="file" type="file" style="display: none" onchange="uploadFile(this)"> <input id="file" type="file" style="display: none" onchange="uploadFile(this)">
</div> </div>
</div> </div>
<div class="input-group" style="height: 120px"> <div class="input-group" style="height: 120px;margin-bottom: 10px;">
<label for="">外链</label> <label for="">外链</label>
<div> <div>
<textarea style="float: right;" class="title-area" type="text" placeholder="外链填写后,优先展示外链信息公众号必选绑定小程序" id="linkUrl" cols="50" rows="10"></textarea> <textarea style="float: right;" class="title-area" type="text"
placeholder="外链填写后,优先展示外链信息公众号必选绑定小程序" id="linkUrl" cols="50"
rows="10"></textarea>
</div> </div>
</div> </div>
<div class="input-group"> <div class="input-group">
...@@ -418,9 +505,9 @@ ...@@ -418,9 +505,9 @@
</div> </div>
<script src="${ctxStatic}/js/news.js"></script> <script src="${ctxStatic}/js/news.js"></script>
</div> </div>
<div class="item copy" style="display: none"> <div class="item copy" style="display: none">
<span class="title" style="flex:11.6">${item.title}</span> <span class="title" style="flex:11.6">${item.title}</span>
<%--<span class="type" style="flex:2">${item.type == 1 ? '通知':'赛训' }</span>--%> <%--<span class="type" style="flex:2">${item.type == 1 ? '通知':'赛训' }</span>--%>
<div style="flex:2;display: flex;flex-direction: column"> <div style="flex:2;display: flex;flex-direction: column">
...@@ -433,9 +520,9 @@ ...@@ -433,9 +520,9 @@
<span class="opt-text">删除</span> <span class="opt-text">删除</span>
</div> </div>
</div> </div>
</div> </div>
<div class="edit-dialog"> <div class="edit-dialog">
<div style="height: 50px;"> <div style="height: 50px;">
<span style="font-size: 22px;color: #ce3939;">编辑</span> <span style="font-size: 22px;color: #ce3939;">编辑</span>
</div> </div>
...@@ -453,10 +540,10 @@ ...@@ -453,10 +540,10 @@
<div style="padding: 30px 0px;"> <div style="padding: 30px 0px;">
<img width="450px" src="/static/images/demo.png" alt=""> <img width="450px" src="/static/images/demo.png" alt="">
</div> </div>
</div> </div>
<div class="edit-mask"></div> <div class="edit-mask"></div>
<style> <style>
.zhu{ .zhu {
height: 18px; height: 18px;
width: 19px; width: 19px;
background: #ce3939; background: #ce3939;
...@@ -468,64 +555,69 @@ ...@@ -468,64 +555,69 @@
line-height: 18px; line-height: 18px;
margin: 1px 3px 0px 0px; margin: 1px 3px 0px 0px;
} }
.edit-mask{
width:1920px; .edit-mask {
height:1069px; width: 1920px;
background:rgba(246,246,246,1); height: 1069px;
background: rgba(246, 246, 246, 1);
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 99; z-index: 99;
background:rgba(0,0,0,1); background: rgba(0, 0, 0, 1);
opacity:0.8; opacity: 0.8;
left: 0px; left: 0px;
top: 0px; top: 0px;
display: none; display: none;
} }
.sure{
.sure {
width: 146px; width: 146px;
height: 42px; height: 42px;
background: rgba(206,57,57,1); background: rgba(206, 57, 57, 1);
border-radius: 4px; border-radius: 4px;
font-size: 20px; font-size: 20px;
color: rgba(255,255,255,1); color: rgba(255, 255, 255, 1);
line-height: 42px; line-height: 42px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
.cancel{
.cancel {
width: 146px; width: 146px;
height: 42px; height: 42px;
background: rgba(148,148,148,1); background: rgba(148, 148, 148, 1);
border-radius: 4px; border-radius: 4px;
font-size: 20px; font-size: 20px;
color: rgba(255,255,255,1); color: rgba(255, 255, 255, 1);
margin-right: 20px; margin-right: 20px;
line-height: 42px; line-height: 42px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
.edit-dialog{
.edit-dialog {
padding: 40px; padding: 40px;
width:600px; width: 600px;
height:540px; height: 540px;
background:rgba(255,255,255,1); background: rgba(255, 255, 255, 1);
border-radius:4px; border-radius: 4px;
position: absolute; position: absolute;
top: 100px; top: 100px;
left: 50%; left: 50%;
margin-left: -300px ; margin-left: -300px;
z-index: 100; z-index: 100;
display: none; display: none;
} }
.edit-dialog input{
.edit-dialog input {
width: 518px; width: 518px;
height: 50px; height: 50px;
background: rgba(247,247,247,1); background: rgba(247, 247, 247, 1);
border-radius: 4px; border-radius: 4px;
border: 1px solid rgba(229,229,229,1); border: 1px solid rgba(229, 229, 229, 1);
} }
</style> </style>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -586,6 +586,10 @@ ...@@ -586,6 +586,10 @@
6: { 6: {
label: '图片', label: '图片',
placeholder: '请输入图片地址', placeholder: '请输入图片地址',
},
7: {
label: '地图',
placeholder: '请输入地址和经纬度',
} }
}, },
typeOptions: [ typeOptions: [
...@@ -612,6 +616,10 @@ ...@@ -612,6 +616,10 @@
{ {
name: '图片', name: '图片',
value: 6, value: 6,
},
{
name: '地图',
value: 7,
} }
], ],
statusType: { statusType: {
......
// 定义 typeDesc 映射
const typeDesc = {
0: {
label: '文本',
placeholder: '请输入文本内容',
},
1: {
label: '网页',
placeholder: '请输入网页地址',
},
2: {
label: '小程序',
placeholder: '请输入小程序地址',
},
3: {
label: '短连接',
placeholder: '请输入短连接地址',
},
4: {
label: '页面',
placeholder: '请输入页面地址',
},
5: {
label: '文档',
placeholder: '请输入文档地址',
},
6: {
label: '图片',
placeholder: '请输入图片地址',
},
7: {
label: '地图',
placeholder: '请输入地址和经纬度',
}
};
$(document).ready(function () { $(document).ready(function () {
editor = UE.getEditor('container'); editor = UE.getEditor('container');
...@@ -10,6 +45,12 @@ $(document).ready(function () { ...@@ -10,6 +45,12 @@ $(document).ready(function () {
} }
let linkUrl = $('#linkUrl').val(); let linkUrl = $('#linkUrl').val();
var content = editor.getContent(); var content = editor.getContent();
// 新增字段
const openType = $('#openType').val();
const path = $('#path').val();
const lat = $('#lat').val();
const lng = $('#lng').val();
const appId = $('#appId').val();
if (!content) { if (!content) {
layer.alert("内容不能为空!"); layer.alert("内容不能为空!");
return; return;
...@@ -19,29 +60,37 @@ $(document).ready(function () { ...@@ -19,29 +60,37 @@ $(document).ready(function () {
type: 'post', type: 'post',
data: { data: {
linkUrl, linkUrl,
id: $('.edit-container').attr('data-id'), title: title, content: editor.getContent(), userId: 1, id: $('.edit-container').attr('data-id'),
cmptId: getCId(), cover: $('#file-cover').attr('data-src'), type: $('input[name="type"]:checked').val() title: title,
appId:appId,
content: editor.getContent(),
userId: 1,
cmptId: getCId(),
cover: $('#file-cover').attr('data-src'),
type: $('input[name="type"]:checked').val(),
// 新增的字段
openType: openType,
path: path,
lat: lat,
lng: lng
}, },
success: function (data) { success: function (data) {
layer.msg('保存成功') layer.msg('保存成功')
console.log(data); window.location.reload();
$('.edit-container').attr('data-id', data.content.id); // $('.edit-container').attr('data-id', data.content.id);
// var length = $('.container .item').length;
// var copy = null;
var length = $('.container .item').length; // if (length == 0) {
var copy = null; // copy = $('.copy').clone().clone();
if (length == 0) { // } else {
copy = $('.copy').clone().clone(); // copy = $('.item').last().clone();
} else { // $('.item[data-id="' + data.content.id + '"]').remove();
copy = $('.item').last().clone(); // }
$('.item[data-id="' + data.content.id + '"]').remove(); // $(copy).find('.title').text(data.content.title);
// $(copy).find('.type').text(data.content.type == 1 ? '通知' : "赛训");
} // $(copy).attr('data-id', data.content.id);
$(copy).find('.title').text(data.content.title); // $(copy).show()
$(copy).find('.type').text(data.content.type == 1 ? '通知' : "赛训"); // $('.container').append($(copy));
$(copy).attr('data-id', data.content.id);
$(copy).show()
$('.container').append($(copy));
} }
}) })
}); });
...@@ -79,6 +128,7 @@ $(document).ready(function () { ...@@ -79,6 +128,7 @@ $(document).ready(function () {
function () { function () {
delNews(id, function () { delNews(id, function () {
obj.remove(); obj.remove();
window.location.reload();
}); });
}, function () { }, function () {
...@@ -102,12 +152,7 @@ $(document).ready(function () { ...@@ -102,12 +152,7 @@ $(document).ready(function () {
success:function (data) { success:function (data) {
if(data.code == 200){ if(data.code == 200){
layer.msg('保存成功'); layer.msg('保存成功');
if($('#newsAlias').val() == '' || $('#newsAlias').val() == undefined){ window.location.reload();
$('.news-title').empty();
$('.news-title').append("<span class=\"no-name\">未命名</span>");
}else{
$('.news-title').text($('#newsAlias').val());
}
$('.edit-mask,.edit-dialog').fadeOut(); $('.edit-mask,.edit-dialog').fadeOut();
} }
} }
...@@ -119,7 +164,42 @@ $(document).ready(function () { ...@@ -119,7 +164,42 @@ $(document).ready(function () {
$('#newsAlias').val(); $('#newsAlias').val();
$('.edit-mask,.edit-dialog').fadeIn(); $('.edit-mask,.edit-dialog').fadeIn();
}) })
// 监听select选项
// 监听 openType 变化
$('#openType').change(function() {
const openType = $(this).val();
updateViews(openType);
});
}); });
// 显示/隐藏必要的参数
function updateViews(openType=0){
const desc = typeDesc[openType];
if (desc) {
// 修改 path 的 label 和 placeholder
$('#path').prev('label').text(desc.label);
$('#path').attr('placeholder', desc.placeholder);
if (openType == '0') { // 地图类型
$('#path-input').addClass('hidden');
} else {
$('#path-input').removeClass('hidden');
}
if (openType == '2') { // 地图类型
$('#appId-input').removeClass('hidden');
} else {
$('#appId-input').addClass('hidden');
}
// 根据类型显示/隐藏经纬度输入框
if (openType == '7') { // 地图类型
$('#lat-input').removeClass('hidden');
$('#lng-input').removeClass('hidden');
} else {
$('#lat-input').addClass('hidden');
$('#lng-input').addClass('hidden');
}
}
}
//文件上传处理 //文件上传处理
function uploadFile(obj) { function uploadFile(obj) {
...@@ -167,12 +247,17 @@ function getNews(id) { ...@@ -167,12 +247,17 @@ function getNews(id) {
$('#title').val(data.content.title) $('#title').val(data.content.title)
$('#linkUrl').val(data.content.linkUrl) $('#linkUrl').val(data.content.linkUrl)
$('input[name="type"][value=' + data.content.type + ']').attr('checked', true) $('input[name="type"][value=' + data.content.type + ']').attr('checked', true)
$('#openType').val(data.content.openType);
$('#path').val(data.content.path);
$('#lat').val(data.content.lat);
$('#lng').val(data.content.lng);
$('#appId').val(data.content.appId);
updateViews(data.content.openType)
if (data.content.cover) { if (data.content.cover) {
$('.cover').css('background-image', "url(" + data.content.cover + ")") $('.cover').css('background-image', "url(" + data.content.cover + ")")
$('.icon-cover').remove(); $('.icon-cover').remove();
$('#file-cover').attr('data-src', data.content.cover) $('#file-cover').attr('data-src', data.content.cover)
} }
editor.setContent(data.content.content) editor.setContent(data.content.content)
} }
layer.closeAll(); layer.closeAll();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment