Commit c46469b4 authored by daniel's avatar daniel

feat(func): 功能菜单+外面模块完善+上传改造

parent 9afd7b78
package com.dlbridge.jadp.plugins.cmpt.bean; package com.dlbridge.jadp.plugins.cmpt.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.Date;
@Setter @Setter
@Getter @Getter
@ApiModel(value = "功能模块", description = "功能模板") @ApiModel(value = "功能模块", description = "功能模板")
...@@ -25,7 +28,6 @@ public class Func { ...@@ -25,7 +28,6 @@ public class Func {
private String appId; private String appId;
private String url; private String url;
private Integer type; private Integer type;
@ApiModelProperty(value = "可见性") @ApiModelProperty(value = "可见性")
...@@ -37,14 +39,22 @@ public class Func { ...@@ -37,14 +39,22 @@ public class Func {
private Integer status; private Integer status;
private String style; private String style;
// 打开方式配置(0 默认 1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png) // 类型配置(0文本 1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
private Integer openType; private Integer openType;
// 图标 // 图标
private String icon; private String icon;
// 小程序路径,图片路径,文档路径,短连接路径,页面路径 // 小程序路径,图片路径,文档路径,短连接路径,页面路径
private String path; private String path;
// 模块失效时间 // 模块失效时间
private String deadTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date deadTime;
// 模块开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date startTime;
// 是否需要开启有效时间
private Integer needTime;
// 富文本
private String content;
} }
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
del_flag AS "delFlag", del_flag AS "delFlag",
icon, icon,
dead_time AS deadTime, dead_time AS deadTime,
open_type AS openType open_type AS openType,
start_time AS startTime,
need_time AS needTime
FROM `gk_cmptsetting` FROM `gk_cmptsetting`
WHERE cmptid = #{cmptId} order by seq WHERE cmptid = #{cmptId} order by seq
</select> </select>
...@@ -114,15 +116,23 @@ ...@@ -114,15 +116,23 @@
<if test="func.url != null"> <if test="func.url != null">
url = #{func.url}, url = #{func.url},
</if> </if>
<if test="func.openType != null"> <if test="func.openType != null">
open_type = #{func.openType}, open_type = #{func.openType},
</if> </if>
<if test="func.icon != null"> <if test="func.icon != null">
icon = #{func.icon} icon = #{func.icon},
</if> </if>
<if test="func.deadTime != null"> <if test="func.deadTime != null">
dead_time = #{func.deadTime} dead_time = #{func.deadTime,jdbcType=TIMESTAMP},
</if>
<if test="func.content != null">
content = #{func.content},
</if>
<if test="func.needTime != null">
need_time = #{func.needTime},
</if>
<if test="func.startTime != null">
start_time = #{func.startTime,jdbcType=TIMESTAMP}
</if> </if>
</set> </set>
WHERE id = #{func.id} WHERE id = #{func.id}
...@@ -143,7 +153,10 @@ ...@@ -143,7 +153,10 @@
url, url,
open_type, open_type,
icon, icon,
dead_time) dead_time,
content,
need_time,
start_time)
VALUES (#{func.id}, VALUES (#{func.id},
#{func.cmptId}, #{func.cmptId},
#{func.nameWeb}, #{func.nameWeb},
...@@ -159,7 +172,10 @@ ...@@ -159,7 +172,10 @@
#{func.url}, #{func.url},
#{func.openType}, #{func.openType},
#{func.icon}, #{func.icon},
#{func.deadTime}) now(),
#{func.content},
#{func.needTime},
now())
</insert> </insert>
<update id="updateById"> <update id="updateById">
...@@ -176,8 +192,17 @@ ...@@ -176,8 +192,17 @@
<if test="openType != null"> <if test="openType != null">
open_type = #{openType}, open_type = #{openType},
</if> </if>
<if test="deadTime != null"> <if test="func.deadTime != null">
dead_time = #{deadTime} dead_time = #{func.deadTime,jdbcType=TIMESTAMP},
</if>
<if test="func.startTime != null">
start_time = #{func.startTime,jdbcType=TIMESTAMP}
</if>
<if test="needTime != null">
need_time = #{needTime},
</if>
<if test="content != null">
content = #{content}
</if> </if>
create_by = #{createBy}, create_by = #{createBy},
create_date = #{createDate}, create_date = #{createDate},
...@@ -202,14 +227,23 @@ ...@@ -202,14 +227,23 @@
open_type = #{openType}, open_type = #{openType},
</if> </if>
<if test="deadTime != null"> <if test="deadTime != null">
dead_time = #{deadTime} dead_time = #{deadTime,jdbcType=TIMESTAMP},
</if>
<if test="startTime!= null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="needTime!= null">
need_time = #{needTime},
</if>
<if test="content!= null">
content = #{content},
</if> </if>
update_date = now() update_date = now()
WHERE cmptId=#{setting.cmptId} and type = #{setting.type} and del_flag = 0 WHERE cmptId=#{setting.cmptId} and type = #{setting.type} and del_flag = 0
</update> </update>
<select id="queryFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="queryFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType,dead_time deadTime select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType,dead_time deadTime,start_time startTime,need_time needTime
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status>0 where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status>0
order by seq order by seq
...@@ -217,7 +251,7 @@ ...@@ -217,7 +251,7 @@
</select> </select>
<select id="queryAllFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="queryAllFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType,dead_time deadTime select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType,dead_time deadTime,start_time startTime,need_time needTime
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status=1 where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status=1
order by seq order by seq
...@@ -271,7 +305,7 @@ ...@@ -271,7 +305,7 @@
</select> </select>
<select id="queryAllThirdMicros" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="queryAllThirdMicros" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType,dead_time deadTime select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType,dead_time deadTime,start_time startTime,need_time needTime
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and type=19 where cmptid = #{cmptId} and type=19
</select> </select>
...@@ -280,7 +314,7 @@ ...@@ -280,7 +314,7 @@
delete from gk_cmptsetting where id = #{id} delete from gk_cmptsetting where id = #{id}
</delete> </delete>
<select id="getFuncById" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="getFuncById" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType,dead_time deadTime select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType,dead_time deadTime,start_time startTime,need_time needTime
from gk_cmptsetting from gk_cmptsetting
where id=#{id} where id=#{id}
</select> </select>
......
package com.dlbridge.jadp.plugins.cmpt.dao.model; package com.dlbridge.jadp.plugins.cmpt.dao.model;
import com.dlbridge.jadp.common.persistence.JaapRecord; import com.dlbridge.jadp.common.persistence.JaapRecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class CmptSetting extends JaapRecord<CmptSetting> { public class CmptSetting extends JaapRecord<CmptSetting> {
...@@ -22,13 +25,35 @@ public class CmptSetting extends JaapRecord<CmptSetting> { ...@@ -22,13 +25,35 @@ public class CmptSetting extends JaapRecord<CmptSetting> {
// 图标 // 图标
private String icon; private String icon;
// 模块失效时间 // 模块失效时间
private String deadTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date deadTime;
// 模块开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date startTime;
// 是否需要开启有效时间
private Integer needTime;
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Integer getNeedTime() {
return needTime;
}
public void setNeedTime(Integer needTime) {
this.needTime = needTime;
}
public String getDeadTime() { public Date getDeadTime() {
return deadTime; return deadTime;
} }
public void setDeadTime(String deadTime) { public void setDeadTime(Date deadTime) {
this.deadTime = deadTime; this.deadTime = deadTime;
} }
......
...@@ -108,6 +108,8 @@ public class ResourcesController { ...@@ -108,6 +108,8 @@ public class ResourcesController {
response.addHeader("Content-Disposition", "attachment; filename=qrcode.jpg"); response.addHeader("Content-Disposition", "attachment; filename=qrcode.jpg");
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("scene", "raceId=" + cmptid); obj.put("scene", "raceId=" + cmptid);
// 修改为小程序页面路径 by 2025-06-12
obj.put("page", "pages/race/raceHome");
obj.put("width", "1280"); obj.put("width", "1280");
String partnerId = cmptService.getPartnerId(cmptid); String partnerId = cmptService.getPartnerId(cmptid);
try { try {
......
...@@ -8,10 +8,7 @@ import com.dlbridge.jadp.plugins.cmpt.service.CmptSettingService; ...@@ -8,10 +8,7 @@ import com.dlbridge.jadp.plugins.cmpt.service.CmptSettingService;
import com.neusoft.www.utils.web.Result; import com.neusoft.www.utils.web.Result;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
...@@ -58,7 +55,7 @@ public class SureLetterController { ...@@ -58,7 +55,7 @@ public class SureLetterController {
@RequestMapping("/updateName") @RequestMapping("/updateName")
@ResponseBody @ResponseBody
public Result updateName(Func func) { public Result updateName(@RequestBody Func func) {
cmptSettingService.saveOrUpdate(func); cmptSettingService.saveOrUpdate(func);
return Result.success().setContent(1); return Result.success().setContent(1);
} }
......
...@@ -396,6 +396,7 @@ ...@@ -396,6 +396,7 @@
</div> </div>
<script src="${ctxStatic}/vue/vue.js"></script> <script src="${ctxStatic}/vue/vue.js"></script>
<script> <script>
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/module' + '&cmptId=' + getCId()
var app = new Vue({ var app = new Vue({
el: '#module', el: '#module',
data: { data: {
...@@ -553,19 +554,19 @@ ...@@ -553,19 +554,19 @@
}, },
//文件上传处理 //文件上传处理
uploadFile(obj) { uploadFile(obj) {
logoFile = obj.target.files[0]; file = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) { if (logoFile.type && file.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 }) return layer.msg('请上传图片', { icon: 5 })
} }
var reads = new FileReader(); var reads = new FileReader();
reads.readAsDataURL(logoFile); reads.readAsDataURL(file);
reads.onload = function () { reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", formData);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
...@@ -573,9 +574,7 @@ ...@@ -573,9 +574,7 @@
success: function (res) { success: function (res) {
if (res.code == "1") { if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 }); layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.module.icon = res.result app.$data.module.icon = res.content
} else {
console.log(res);
} }
}, },
beforeSend: () => { beforeSend: () => {
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>"> 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" href="${ctxStatic}/leaflet/css/leaflet_label.css" />
<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script> <script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script> <script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
...@@ -524,6 +521,7 @@ ...@@ -524,6 +521,7 @@
</div> </div>
<script src="${ctxStatic}/vue/vue.js"></script> <script src="${ctxStatic}/vue/vue.js"></script>
<script> <script>
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/service' + '&cmptId=' + getCId()
var app = new Vue({ var app = new Vue({
el: '#service', el: '#service',
data: { data: {
...@@ -880,19 +878,19 @@ ...@@ -880,19 +878,19 @@
}, },
//文件上传处理 //文件上传处理
uploadFile(obj) { uploadFile(obj) {
logoFile = obj.target.files[0]; file = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) { if (file.type && file.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 }) return layer.msg('请上传图片', { icon: 5 })
} }
var reads = new FileReader(); var reads = new FileReader();
reads.readAsDataURL(logoFile); reads.readAsDataURL(file);
reads.onload = function () { reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", file);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
...@@ -901,10 +899,7 @@ ...@@ -901,10 +899,7 @@
console.log({ res }); console.log({ res });
if (res.code == "1") { if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 }); layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.service.imgUrl = res.result app.$data.service.imgUrl = res.content
console.log(app.$data.service.imgUrl)
} else {
console.log(res);
} }
}, },
beforeSend: () => { beforeSend: () => {
...@@ -918,19 +913,19 @@ ...@@ -918,19 +913,19 @@
}, },
//文件上传处理 //文件上传处理
uploadIconFile(obj) { uploadIconFile(obj) {
logoFile = obj.target.files[0]; file = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) { if (file.type && file.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 }) return layer.msg('请上传图片', { icon: 5 })
} }
var reads = new FileReader(); var reads = new FileReader();
reads.readAsDataURL(logoFile); reads.readAsDataURL(file);
reads.onload = function () { reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", file);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
...@@ -938,9 +933,7 @@ ...@@ -938,9 +933,7 @@
success: function (res) { success: function (res) {
if (res.code == "1") { if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 }); layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.service.iconUrl = res.result app.$data.service.iconUrl = res.content
} else {
console.log(res);
} }
}, },
beforeSend: () => { beforeSend: () => {
......
...@@ -433,6 +433,7 @@ ...@@ -433,6 +433,7 @@
</div> </div>
<script src="${ctxStatic}/vue/vue.js"></script> <script src="${ctxStatic}/vue/vue.js"></script>
<script> <script>
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/swiper' + '&cmptId=' + getCId()
var app = new Vue({ var app = new Vue({
el: '#swiper', el: '#swiper',
data: { data: {
...@@ -609,7 +610,7 @@ ...@@ -609,7 +610,7 @@
} }
setTimeout(() => { setTimeout(() => {
layer.closeAll() layer.closeAll()
},1500) }, 1500)
}, },
complete: () => { complete: () => {
...@@ -641,19 +642,19 @@ ...@@ -641,19 +642,19 @@
}, },
//文件上传处理 //文件上传处理
uploadFile(obj) { uploadFile(obj) {
logoFile = obj.target.files[0]; file = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) { if (file.type && file.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 }) return layer.msg('请上传图片', { icon: 5 })
} }
var reads = new FileReader(); var reads = new FileReader();
reads.readAsDataURL(logoFile); reads.readAsDataURL(file);
reads.onload = function () { reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", file);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
...@@ -661,7 +662,7 @@ ...@@ -661,7 +662,7 @@
success: function (res) { success: function (res) {
if (res.code == "1") { if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 }); layer.msg('上传成功', { icon: 1, time: 1500 });
app.$data.service.imgUrl = res.result app.$data.service.imgUrl = res.content
} }
}, },
beforeSend: () => { beforeSend: () => {
......
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
<span class="menu-txt">分类管理</span> <span class="menu-txt">分类管理</span>
</a> </a>
</li> </li>
<li class="swiper menu-sub-item" > <li class="swiper menu-sub-item">
<a <a
href="/gk/swiper/index/${cmpt.cmptId}?uId=${uId}&cId=${cId}&timestamp=${timestamp}&sign=${sign}"> href="/gk/swiper/index/${cmpt.cmptId}?uId=${uId}&cId=${cId}&timestamp=${timestamp}&sign=${sign}">
<span class="left-arrow"></span> <span class="left-arrow"></span>
...@@ -415,7 +415,6 @@ ...@@ -415,7 +415,6 @@
var done = false; var done = false;
for (var i in classes) { for (var i in classes) {
if (url.indexOf(classes[i]) > -1) { if (url.indexOf(classes[i]) > -1) {
console.log(classes[i])
document.getElementsByClassName(classes[i])[0].classList.add('active'); document.getElementsByClassName(classes[i])[0].classList.add('active');
if (classes[i] != 'cmptSetting') { if (classes[i] != 'cmptSetting') {
let classesStr = document.getElementsByClassName(classes[i])[0].parentNode.parentNode.firstElementChild.classList; let classesStr = document.getElementsByClassName(classes[i])[0].parentNode.parentNode.firstElementChild.classList;
......
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/banner' + '&cmptId=' + getCId()
$(document).ready(function () { $(document).ready(function () {
$('.addTempalte').click(function () { $('.addTempalte').click(function () {
var length = $('#sortable .banner-item').length; var length = $('#sortable .banner-item').length;
if(length >= 5){ if (length >= 5) {
layer.msg('图片最多只能上传五张') layer.msg('图片最多只能上传五张')
return ; return;
} }
$('.template .pic').trigger('click'); $('.template .pic').trigger('click');
}); });
$('body').on('click','.save',function () { $('body').on('click', '.save', function () {
var obj = $(this).parents('.banner-item'); var obj = $(this).parents('.banner-item');
$.ajax({ $.ajax({
url : '/gk/banner/saveOrUpdate', url: '/gk/banner/saveOrUpdate',
type:'post', type: 'post',
data:{url:obj.find('input').attr('data-file-url'),cmptId:getCmptId()}, data: { url: obj.find('input').attr('data-file-url'), cmptId: getCmptId() },
success:function(data){ success: function (data) {
if(data.code == 200){ if (data.code == 200) {
$(obj).attr('data-id',data.content.id) $(obj).attr('data-id', data.content.id)
} }
} }
}) })
...@@ -31,14 +32,14 @@ $(document).ready(function () { ...@@ -31,14 +32,14 @@ $(document).ready(function () {
sort(sortIds.join(",")); sort(sortIds.join(","));
} }
}); });
$('body').on('click','.delOpt',function () { $('body').on('click', '.delOpt', function () {
var obj = $(this); var obj = $(this);
qikoo.dialog.confirm('确认要删除?', qikoo.dialog.confirm('确认要删除?',
function () { function () {
$.ajax({ $.ajax({
url : '/gk/banner/del/'+obj.parents(".banner-item").attr("data-id"), url: '/gk/banner/del/' + obj.parents(".banner-item").attr("data-id"),
type:'get', type: 'get',
success:function(data){ success: function (data) {
obj.parents('.banner-item').remove(); obj.parents('.banner-item').remove();
} }
}) })
...@@ -52,36 +53,33 @@ $(document).ready(function () { ...@@ -52,36 +53,33 @@ $(document).ready(function () {
function uploadFile(obj) { function uploadFile(obj) {
var reads = new FileReader(); var reads = new FileReader();
logoFile = obj.files[0]; file = obj.files[0];
var dataId = $(obj).parent().parent().attr('data-id'); var dataId = $(obj).parent().parent().attr('data-id');
reads.readAsDataURL(logoFile); reads.readAsDataURL(file);
reads.onload = function (e) { reads.onload = function (e) {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", file);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
processData: false, processData: false,
success: function (res) { success: function (res) {
console.log(res);
if (res.code == "1") { if (res.code == "1") {
var template = $('.template').clone().clone(); var template = $('.template').clone().clone();
layer.msg('上传成功', {icon: 1, time: 1500}); layer.msg('上传成功', { icon: 1, time: 1500 });
$(template).find('input').attr('data-file-name', logoFile.name); $(template).find('input').attr('data-file-name', file.name);
$(template).find('input').attr('data-file-url', res.result); $(template).find('input').attr('data-file-url', res.content);
$(template).find('input').attr('data-file-size', logoFile.size / 1024); $(template).find('input').attr('data-file-size', file.size / 1024);
$(template).find('.banner-img').attr('src',res.result); $(template).find('.banner-img').attr('src', res.content);
$(template).appendTo($('.equip-container-new')) $(template).appendTo($('.equip-container-new'))
$(template).removeClass('template') $(template).removeClass('template')
$(template).show(); $(template).show();
$(template).find('.save').trigger('click'); $(template).find('.save').trigger('click');
$(template).find('.save').remove(); $(template).find('.save').remove();
} else {
console.log(res);
} }
} }
}) })
...@@ -90,13 +88,13 @@ function uploadFile(obj) { ...@@ -90,13 +88,13 @@ function uploadFile(obj) {
function sort(ids) { function sort(ids) {
$.ajax({ $.ajax({
url:'/gk/banner/order', url: '/gk/banner/order',
data:{ids:ids}, data: { ids: ids },
success:function (data) { success: function (data) {
console.log(data); console.log(data);
} }
}) })
} }
function del() { function del() {
} }
\ No newline at end of file
//文件上传处理 //文件上传处理
var obj = null; var obj = null;
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/manual' + '&cmptId=' + getCId()
function changeImg(e) { function changeImg(e) {
let reads = new FileReader(); let reads = new FileReader();
reads.readAsDataURL($(e).get(0).files[0]); reads.readAsDataURL($(e).get(0).files[0]);
if ($(e).get(0).files[0].size / 1000 > 500) { if ($(e).get(0).files[0].size / 1000 > 500) {
layer.alert('上传的图片文件不能超过500KB。', {icon: 5}); layer.alert('上传的图片文件不能超过500KB。', { icon: 5 });
return; return;
} }
reads.onload = function (ee) { reads.onload = function (ee) {
...@@ -13,29 +13,26 @@ function changeImg(e) { ...@@ -13,29 +13,26 @@ function changeImg(e) {
image.src = ee.target.result; image.src = ee.target.result;
image.onload = function () { image.onload = function () {
if (this.width > this.height) { if (this.width > this.height) {
layer.alert("请上传竖图!", {icon: 5}); layer.alert("请上传竖图!", { icon: 5 });
return; return;
} else { } else {
var img = $(e).prev().get(0); var img = $(e).prev().get(0);
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", $(e).get(0).files[0]); formData.append("file", $(e).get(0).files[0]);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
processData: false, processData: false,
success: function (res) { success: function (res) {
console.log(res);
if (res.code == "1") { if (res.code == "1") {
// 获取返回URL // 获取返回URL
img.src = res.result; img.src = res.content
$(img).parent().attr('data-file', res.result); $(img).parent().attr('data-file', res.content);
setTimeout(function () { setTimeout(function () {
$(img).removeClass('add'); $(img).removeClass('add');
}, 500) }, 500)
} else {
console.log(res);
} }
} }
}) })
...@@ -61,11 +58,8 @@ $(function () { ...@@ -61,11 +58,8 @@ $(function () {
url: '/gk/cmpt/manual/delManual?id=' + id, /*接口域名地址*/ url: '/gk/cmpt/manual/delManual?id=' + id, /*接口域名地址*/
success: function (res) { success: function (res) {
parent.remove(); parent.remove();
console.log(res);
if (res.code == "1") { if (res.code == "1") {
layer.msg('保存成功', {icon: 1, time: 1500}); layer.msg('保存成功', { icon: 1, time: 1500 });
} else {
console.log(res);
} }
} }
}); });
...@@ -92,7 +86,7 @@ $(function () { ...@@ -92,7 +86,7 @@ $(function () {
let filedata = parent.find('.file').attr('data-file'); let filedata = parent.find('.file').attr('data-file');
if (!filedata || !catalogPhotoURL) { if (!filedata || !catalogPhotoURL) {
layer.msg('请选择上传的文件', {icon: 1, time: 1500}); layer.msg('请选择上传的文件', { icon: 1, time: 1500 });
return; return;
} }
...@@ -107,14 +101,11 @@ $(function () { ...@@ -107,14 +101,11 @@ $(function () {
contentType: 'application/json', contentType: 'application/json',
processData: false, processData: false,
success: function (res) { success: function (res) {
console.log(res);
if (res.code == 200) { if (res.code == 200) {
layer.msg('保存成功', {icon: 1, time: 1500}); layer.msg('保存成功', { icon: 1, time: 1500 });
if (!id) { if (!id) {
parent.find('.manualId').val(res.id); parent.find('.manualId').val(res.id);
} }
} else {
console.log(res);
} }
} }
}); });
......
$(function () { $(function () {
// 检查是否有修改banner的权限 // 检查是否有修改banner的权限
$(function () { $(function () {
...@@ -40,13 +41,13 @@ $(function () { ...@@ -40,13 +41,13 @@ $(function () {
data: param, data: param,
success: function (data) { success: function (data) {
console.log(data); console.log(data);
if(data.code == -201){ if (data.code == -201) {
window.location.href="/gk/banner/index/"+getCmptId()+"?"+window.location.search; window.location.href = "/gk/banner/index/" + getCmptId() + "?" + window.location.search;
}else if(data.code == -301){ } else if (data.code == -301) {
window.location.href="/gk/customer/index/"+getCmptId()+"?"+window.location.search; window.location.href = "/gk/customer/index/" + getCmptId() + "?" + window.location.search;
}else if(data.code == -401){ } else if (data.code == -401) {
layer.msg("还没设置公告!") layer.msg("还没设置公告!")
window.location.href="/gk/news/index/"+getCmptId()+"?"+window.location.search; window.location.href = "/gk/news/index/" + getCmptId() + "?" + window.location.search;
} }
} }
}) })
...@@ -67,7 +68,7 @@ $(function () { ...@@ -67,7 +68,7 @@ $(function () {
if (param.visibility == 1) { if (param.visibility == 1) {
$.ajax({ $.ajax({
url: '/gk/cmpt/cmptSetting/check', url: '/gk/cmpt/cmptSetting/check',
data: {'cmptId': getCmptId(), "type": type}, data: { 'cmptId': getCmptId(), "type": type },
async: false, async: false,
success: function (data) { success: function (data) {
if (data.code == -1) { if (data.code == -1) {
...@@ -85,18 +86,18 @@ $(function () { ...@@ -85,18 +86,18 @@ $(function () {
layer.alert("要启用此功能,需要先上传比赛路线"); layer.alert("要启用此功能,需要先上传比赛路线");
} else if (type == 11) { } else if (type == 11) {
layer.alert("要启用此功能,需要先联系管理员通过赛事审核"); layer.alert("要启用此功能,需要先联系管理员通过赛事审核");
} else if (type == 12){ } else if (type == 12) {
layer.alert("要启用此功能,请先在计时管理页面完成名单导入"); layer.alert("要启用此功能,请先在计时管理页面完成名单导入");
}else if (type == 15){ } else if (type == 15) {
layer.alert("要启用此功能,请先导入路线,且路线上至少有2个标注点"); layer.alert("要启用此功能,请先导入路线,且路线上至少有2个标注点");
setTimeout(function () { setTimeout(function () {
window.location.href="/gk/road/index/"+getCmptId()+"?"+window.location.search; window.location.href = "/gk/road/index/" + getCmptId() + "?" + window.location.search;
},3000) }, 3000)
} else if (type == 16){ } else if (type == 16) {
layer.alert("要启用此功能,请先导入路线,且路线上至少有2个标注点"); layer.alert("要启用此功能,请先导入路线,且路线上至少有2个标注点");
setTimeout(function () { setTimeout(function () {
window.location.href="/gk/road/index/"+getCmptId()+"?"+window.location.search; window.location.href = "/gk/road/index/" + getCmptId() + "?" + window.location.search;
},3000) }, 3000)
} }
} else { } else {
...@@ -115,8 +116,8 @@ $(function () { ...@@ -115,8 +116,8 @@ $(function () {
} }
} }
}) })
} else if(type == 15 || type == 12 || type == 16){ } else if (type == 15 || type == 12 || type == 16) {
if($('#autoscore').val() != '1'){ if ($('#autoscore').val() != '1') {
layer.msg("建议启动自动成绩审核,无需组委会操作,选手可以在提交成绩后马上查看完赛证书"); layer.msg("建议启动自动成绩审核,无需组委会操作,选手可以在提交成绩后马上查看完赛证书");
} }
...@@ -157,7 +158,7 @@ $(function () { ...@@ -157,7 +158,7 @@ $(function () {
let status = $(this).parents('.public').attr('data-status'); let status = $(this).parents('.public').attr('data-status');
if (status == 2) return; if (status == 2) return;
let id = $(this).parents('.public').parents('.wzm-content-item').attr('data-id'); let id = $(this).parents('.public').parents('.wzm-content-item').attr('data-id');
let param = {id: id}; let param = { id: id };
if (status == 1) { if (status == 1) {
param.status = 0; param.status = 0;
} else { } else {
...@@ -166,6 +167,9 @@ $(function () { ...@@ -166,6 +167,9 @@ $(function () {
editSettingStatus(param); editSettingStatus(param);
}) })
initEvent()
}); });
function sort(param) { function sort(param) {
...@@ -191,3 +195,58 @@ function editSettingStatus(param) { ...@@ -191,3 +195,58 @@ function editSettingStatus(param) {
} }
}) })
} }
// 初始化事件
function initEvent() {
// 为需要设置有效期的元素添加点击事件
$('.wzm-content-item').on('dblclick', function () {
let id = $(this).data('id')
const func = cmptFuncs.find(v => v.id == id);
if (func?.needTime) {
showTimeSetting(func);
}
});
}
function showTimeSetting(func) {
const index = layer.open({
type: 1,
title: '设置有效期',
content: `
<div style="padding:20px;">
<div class="form-group">
<label>开始时间</label>
<input type="text" class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="startTime" value="${func?.startTime || ''}">
</div>
<div class="form-group">
<label>结束时间</label>
<input type="text" class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="endTime" value="${func?.deadTime || ''}">
</div>
</div>
`,
btn: ['确定', '取消'],
yes: () => {
let loadIndex = 0
var startTime = $('#startTime').val();
var deadTime = $('#endTime').val();
$.ajax({
url: '/gk/sure-letter/updateName',
data: JSON.stringify({
startTime,
deadTime,
id: func.id
}),
contentType: 'application/json',
type: 'post',
beforeSend: function () {
loadIndex = layer.load()
},
success: () => {
layer.close(loadIndex);
layer.msg('有效期设置成功', () => { layer.close(index) });
}
})
}
});
}
\ No newline at end of file
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/cmptLogo' + '&cmptId=' + getCId()
$(function () { $(function () {
$('#cmptBgColorInput').bind('keyup', function () { $('#cmptBgColorInput').bind('keyup', function () {
...@@ -30,28 +33,28 @@ $(function () { ...@@ -30,28 +33,28 @@ $(function () {
let detailStyle = $('#detailStyle').val(); let detailStyle = $('#detailStyle').val();
let isShowTab = $('#isShowInput').val(); let isShowTab = $('#isShowInput').val();
let cmptId = getCId(); let cmptId = getCId();
if(bg.length != 6){ if (bg.length != 6) {
layer.msg('请输入6位合法字符!'); layer.msg('请输入6位合法字符!');
return ; return;
} }
const param = { const param = {
detailStyle:detailStyle??'style-1', detailStyle: detailStyle ?? 'style-1',
cmptId, cmptId,
logo, logo,
cmptbgColor: "#"+bg, cmptbgColor: "#" + bg,
isShowTab isShowTab
}; };
$.ajax({ $.ajax({
url: '/gk/cmpt/saveCmpt', url: '/gk/cmpt/saveCmpt',
data: JSON.stringify(param), data: JSON.stringify(param),
contentType:"application/json", contentType: "application/json",
type: 'post', type: 'post',
success: function (data) { success: function (data) {
if (data.status) { if (data.status) {
window.location.reload(); window.location.reload();
layer.msg('保存成功', {icon: 1, time: 1500}); layer.msg('保存成功', { icon: 1, time: 1500 });
} else { } else {
layer.msg('保存失败', {icon: 5, time: 1500}); layer.msg('保存失败', { icon: 5, time: 1500 });
} }
} }
}) })
...@@ -60,7 +63,7 @@ $(function () { ...@@ -60,7 +63,7 @@ $(function () {
$('#download').click(function () { $('#download').click(function () {
$.ajax({ $.ajax({
url: "/gk/cmpt/getCmpt", url: "/gk/cmpt/getCmpt",
data: {'cmptId': getCmptId()}, data: { 'cmptId': getCmptId() },
success: function (data) { success: function (data) {
if (data.content && data.content.logo) { if (data.content && data.content.logo) {
window.open(window.location.origin + "/img/download/" + getCmptId()) window.open(window.location.origin + "/img/download/" + getCmptId())
...@@ -128,11 +131,11 @@ function changeLogoImg(imgDomNName, inputDomName, top, left, width, height) { ...@@ -128,11 +131,11 @@ function changeLogoImg(imgDomNName, inputDomName, top, left, width, height) {
var reads = new FileReader(); var reads = new FileReader();
logoFile = document.getElementById(inputDomName).files[0]; logoFile = document.getElementById(inputDomName).files[0];
if (logoFile.fileSize / 1000 > 500) { if (logoFile.fileSize / 1000 > 500) {
layer.msg('上传的图片文件不能超过500KB。', {icon: 5, time: 1500}); layer.msg('上传的图片文件不能超过500KB。', { icon: 5, time: 1500 });
return; return;
} }
if (logoFile.size / 1000 > 500) { if (logoFile.size / 1000 > 500) {
layer.alert('上传的图片文件不能超过500KB。', {icon: 5}); layer.alert('上传的图片文件不能超过500KB。', { icon: 5 });
return; return;
} }
reads.readAsDataURL(logoFile); reads.readAsDataURL(logoFile);
...@@ -143,24 +146,21 @@ function changeLogoImg(imgDomNName, inputDomName, top, left, width, height) { ...@@ -143,24 +146,21 @@ function changeLogoImg(imgDomNName, inputDomName, top, left, width, height) {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", logoFile);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadUrl, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
processData: false, processData: false,
success: function (res) { success: function (res) {
console.log(res);
if (res.code == "1") { // 获取返回URL if (res.code == "1") { // 获取返回URL
document.getElementById(imgDomNName).src = res.result; document.getElementById(imgDomNName).src = res.content;
$('.logo-div').css('background', 'none'); $('.logo-div').css('background', 'none');
$("[name='hdcmptLogo']").val(res.result); $("[name='hdcmptLogo']").val(res.content);
$("#cmptLogoSpan").html("已上传"); $("#cmptLogoSpan").html("已上传");
$('#cmptLogo').addClass('cmpt-logo'); $('#cmptLogo').addClass('cmpt-logo');
$('#cmptLogo').removeClass("logo"); $('#cmptLogo').removeClass("logo");
} else {
console.log(res);
} }
} }
}) })
......
const uploadUrl = '/api-common/v1/upload?folder=' + 'gk/news' + '&cmptId=' + getCId()
// 定义 typeDesc 映射 // 定义 typeDesc 映射
const typeDesc = { const typeDesc = {
0: { 0: {
...@@ -59,11 +60,11 @@ $(document).ready(function () { ...@@ -59,11 +60,11 @@ $(document).ready(function () {
url: "/gk/news/save", url: "/gk/news/save",
type: 'post', type: 'post',
contentType: 'application/json', contentType: 'application/json',
data: JSON.stringify({ data: JSON.stringify({
linkUrl, linkUrl,
id: $('.edit-container').attr('data-id'), id: $('.edit-container').attr('data-id'),
title: title, title: title,
appId:appId, appId: appId,
content: editor.getContent(), content: editor.getContent(),
userId: getUId(), userId: getUId(),
cmptId: getCId(), cmptId: getCId(),
...@@ -72,8 +73,8 @@ $(document).ready(function () { ...@@ -72,8 +73,8 @@ $(document).ready(function () {
// 新增的字段 // 新增的字段
openType: openType, openType: openType,
path: path, path: path,
lat: lat??0, lat: lat ?? 0,
lng: lng??0 lng: lng ?? 0
}), }),
success: function (data) { success: function (data) {
layer.msg('保存成功') layer.msg('保存成功')
...@@ -142,16 +143,16 @@ $(document).ready(function () { ...@@ -142,16 +143,16 @@ $(document).ready(function () {
$('.sure').click(function () { $('.sure').click(function () {
var val = $('#newsAlias').val(); var val = $('#newsAlias').val();
if(val.length > 10){ if (val.length > 10) {
layer.msg("不能超过10个字"); layer.msg("不能超过10个字");
return ; return;
} }
$.ajax({ $.ajax({
url : '/setting/update', url: '/setting/update',
type:"post", type: "post",
data:{cmptId:getCmptId(),newsAlias:val}, data: { cmptId: getCmptId(), newsAlias: val },
success:function (data) { success: function (data) {
if(data.code == 200){ if (data.code == 200) {
layer.msg('保存成功'); layer.msg('保存成功');
window.location.reload(); window.location.reload();
$('.edit-mask,.edit-dialog').fadeOut(); $('.edit-mask,.edit-dialog').fadeOut();
...@@ -161,20 +162,20 @@ $(document).ready(function () { ...@@ -161,20 +162,20 @@ $(document).ready(function () {
}); });
$('.edit-btn').click(function () { $('.edit-btn').click(function () {
var text = $.trim($('.news-title span').text()) == '未命名'? $.trim($('.news-title').text()): ''; var text = $.trim($('.news-title span').text()) == '未命名' ? $.trim($('.news-title').text()) : '';
$('#newsAlias').val(); $('#newsAlias').val();
$('.edit-mask,.edit-dialog').fadeIn(); $('.edit-mask,.edit-dialog').fadeIn();
}) })
// 监听select选项 // 监听select选项
// 监听 openType 变化 // 监听 openType 变化
$('#openType').change(function() { $('#openType').change(function () {
const openType = $(this).val(); const openType = $(this).val();
updateViews(openType); updateViews(openType);
}); });
}); });
// 显示/隐藏必要的参数 // 显示/隐藏必要的参数
function updateViews(openType=0){ function updateViews(openType = 0) {
const desc = typeDesc[openType]; const desc = typeDesc[openType];
if (desc) { if (desc) {
// 修改 path 的 label 和 placeholder // 修改 path 的 label 和 placeholder
...@@ -205,33 +206,30 @@ function updateViews(openType=0){ ...@@ -205,33 +206,30 @@ function updateViews(openType=0){
//文件上传处理 //文件上传处理
function uploadFile(obj) { function uploadFile(obj) {
var reads = new FileReader(); var reads = new FileReader();
logoFile = obj.files[0]; file = obj.files[0];
if(logoFile.type && logoFile.type.indexOf("image") == -1){ if (file.type && file.type.indexOf("image") == -1) {
layer.msg('请上传图片',{icon:5}) layer.msg('请上传图片', { icon: 5 })
return; return;
} }
reads.readAsDataURL(logoFile); reads.readAsDataURL(file);
reads.onload = function (e) { reads.onload = function (e) {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
//上传LOGO图片 //上传LOGO图片
var formData = new FormData(); var formData = new FormData();
formData.append("uploadImg", logoFile); formData.append("file", file);
$.ajax({ $.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/ url: uploadFile, /*接口域名地址*/
type: 'post', type: 'post',
data: formData, data: formData,
contentType: false, contentType: false,
processData: false, processData: false,
success: function (res) { success: function (res) {
console.log(res);
if (res.code == "1") { if (res.code == "1") {
layer.msg('上传成功', {icon: 1, time: 1500}); layer.msg('上传成功', { icon: 1, time: 1500 });
$('#file-cover').attr('data-src', res.result); $('#file-cover').attr('data-src', res.content);
$('#file-cover').attr('data-src', res.result); $('#file-cover').attr('data-src', res.content);
$('.cover').css('background-image', 'url(' + res.result + ')') $('.cover').css('background-image', 'url(' + res.content + ')')
$('.icon-cover').remove(); $('.icon-cover').remove();
} else {
console.log(res);
} }
} }
}) })
......
This diff is collapsed.
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