Commit d994fb19 authored by daniel's avatar daniel

perf(cmpt): 优化公告+外链

parent 8dd08610
...@@ -35,7 +35,7 @@ public class News implements Serializable { ...@@ -35,7 +35,7 @@ public class News implements Serializable {
private String path; private String path;
private String appId; private String appId;
private String lat; private Double lat;
private String lng; private Double lng;
private int openType; private int openType;
} }
\ No newline at end of file
...@@ -37,5 +37,12 @@ public class Func { ...@@ -37,5 +37,12 @@ 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)
private Integer openType;
// 图标
private String icon;
// 小程序路径,图片路径,文档路径,短连接路径,页面路径
private String path;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptSettingMapper"> <mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptSettingMapper">
<select id="getCmptSettingById" resultType="CmptSetting"> <select id="getCmptSettingById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.CmptSetting">
SELECT SELECT
id, id,
cmptid as cmptId, cmptid as cmptId,
...@@ -15,13 +15,15 @@ ...@@ -15,13 +15,15 @@
create_date AS "createDate", create_date AS "createDate",
update_by AS "updateBy", update_by AS "updateBy",
update_date AS "updateDate", update_date AS "updateDate",
del_flag AS "delFlag" del_flag AS "delFlag",
icon,
open_type AS openType
FROM gk_cmptsetting a FROM gk_cmptsetting a
WHERE a.id = #{id} WHERE a.id = #{id}
and a.del_flag = '0' and a.del_flag = '0'
</select> </select>
<select id="queryCmptSettingsByCmptId" resultType="CmptSetting"> <select id="queryCmptSettingsByCmptId" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.CmptSetting">
SELECT SELECT
id, id,
cmptid as cmptId, cmptid as cmptId,
...@@ -34,7 +36,9 @@ ...@@ -34,7 +36,9 @@
create_date AS "createDate", create_date AS "createDate",
update_by AS "updateBy", update_by AS "updateBy",
update_date AS "updateDate", update_date AS "updateDate",
del_flag AS "delFlag" del_flag AS "delFlag",
icon,
open_type AS openType
FROM `gk_cmptsetting` FROM `gk_cmptsetting`
WHERE cmptid = #{cmptId} order by seq WHERE cmptid = #{cmptId} order by seq
</select> </select>
...@@ -42,7 +46,9 @@ ...@@ -42,7 +46,9 @@
<select id="queryHomePageSettingByCmptId" resultType="java.util.HashMap" parameterType="java.lang.String"> <select id="queryHomePageSettingByCmptId" resultType="java.util.HashMap" parameterType="java.lang.String">
SELECT SELECT
id, id,
type type,
icon,
open_type AS openType
FROM `gk_cmptsetting` FROM `gk_cmptsetting`
WHERE 1 = 1 WHERE 1 = 1
AND visibility = 1 AND visibility = 1
...@@ -63,7 +69,9 @@ ...@@ -63,7 +69,9 @@
style, style,
seq, seq,
create_date, create_date,
del_flag del_flag,
icon,
open_type
) VALUES ( ) VALUES (
#{id}, #{id},
#{cmptId}, #{cmptId},
...@@ -75,7 +83,9 @@ ...@@ -75,7 +83,9 @@
#{style}, #{style},
#{seq}, #{seq},
now(), now(),
0 0,
#{icon},
#{openType}
) )
</insert> </insert>
...@@ -98,7 +108,14 @@ ...@@ -98,7 +108,14 @@
app_id = #{func.appId}, app_id = #{func.appId},
</if> </if>
<if test="func.url != null"> <if test="func.url != null">
url = #{func.url} url = #{func.url},
</if>
<if test="func.openType != null">
open_type = #{func.openType},
</if>
<if test="func.icon != null">
icon = #{func.icon}
</if> </if>
</set> </set>
WHERE id = #{func.id} WHERE id = #{func.id}
...@@ -117,7 +134,9 @@ ...@@ -117,7 +134,9 @@
create_date, create_date,
del_flag, del_flag,
app_id, app_id,
url url,
open_type,
icon
) VALUES ( ) VALUES (
#{func.id}, #{func.id},
#{func.cmptId}, #{func.cmptId},
...@@ -131,7 +150,9 @@ ...@@ -131,7 +150,9 @@
now(), now(),
0, 0,
#{func.appId}, #{func.appId},
#{func.url} #{func.url},
#{func.openType},
#{func.icon}
) )
</insert> </insert>
...@@ -143,7 +164,12 @@ ...@@ -143,7 +164,12 @@
<if test="status != null and status >=0"> <if test="status != null and status >=0">
status = #{status}, status = #{status},
</if> </if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="openType != null">
open_type = #{openType},
</if>
create_by = #{createBy}, create_by = #{createBy},
create_date = #{createDate}, create_date = #{createDate},
update_by = #{updateBy}, update_by = #{updateBy},
...@@ -160,12 +186,18 @@ ...@@ -160,12 +186,18 @@
<if test="setting.status != null and setting.status >=0"> <if test="setting.status != null and setting.status >=0">
status = #{setting.status}, status = #{setting.status},
</if> </if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="openType != null">
open_type = #{openType},
</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` select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType
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
...@@ -173,7 +205,7 @@ ...@@ -173,7 +205,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` select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType
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
...@@ -208,7 +240,7 @@ ...@@ -208,7 +240,7 @@
</collection> </collection>
</resultMap> </resultMap>
<select id="queryAllCmptSetting" resultMap="cmptSettingMap"> <select id="queryAllCmptSetting" resultMap="cmptSettingMap">
select cmptid,name cmpt_name,type cmpt_type select cmptid,name cmpt_name,type cmpt_type,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
</select> </select>
...@@ -220,14 +252,14 @@ ...@@ -220,14 +252,14 @@
</select> </select>
<select id="getCmptSettingsByCmptIdAndType" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="getCmptSettingsByCmptIdAndType" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and type=#{type} where cmptid = #{cmptId} and type=#{type}
limit 1 limit 1
</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 select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and type=19 where cmptid = #{cmptId} and type=19
</select> </select>
...@@ -236,7 +268,7 @@ ...@@ -236,7 +268,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 select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where id=#{id} where id=#{id}
</select> </select>
......
...@@ -17,6 +17,28 @@ public class CmptSetting extends JaapRecord<CmptSetting> { ...@@ -17,6 +17,28 @@ public class CmptSetting extends JaapRecord<CmptSetting> {
private int status; private int status;
private String updateById; private String updateById;
// 打开方式配置(0 默认 1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
private Integer openType;
// 图标
private String icon;
public Integer getOpenType() {
return openType;
}
public void setOpenType(Integer openType) {
this.openType = openType;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getNameWeb() { public String getNameWeb() {
return nameWeb; return nameWeb;
} }
......
...@@ -10,10 +10,7 @@ import com.dlbridge.jadp.plugins.cmpt.service.FuncSettingService; ...@@ -10,10 +10,7 @@ import com.dlbridge.jadp.plugins.cmpt.service.FuncSettingService;
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.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -66,11 +63,11 @@ public class NewsController { ...@@ -66,11 +63,11 @@ public class NewsController {
} }
} }
@RequestMapping(value = "/save", method = RequestMethod.POST) @PostMapping(value = "/save")
@ResponseBody @ResponseBody
public Result save(News news) { public Result save(@RequestBody News news) {
log.info("保存数据 {}",news.toString());
News newDb = newsService.save(news); News newDb = newsService.save(news);
log.info("保存数据 ",newDb.toString());
return Result.success().setContent(newDb); return Result.success().setContent(newDb);
} }
......
...@@ -434,7 +434,7 @@ ...@@ -434,7 +434,7 @@
<option value="0">文本</option> <option value="0">文本</option>
<option value="1">h5</option> <option value="1">h5</option>
<option value="2">小程序</option> <option value="2">小程序</option>
<option value="3">短连接</option> <option value="3">短链接</option>
<option value="4">内部页面</option> <option value="4">内部页面</option>
<option value="5">文档</option> <option value="5">文档</option>
<option value="6">图片</option> <option value="6">图片</option>
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
<!-- 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">
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
<link rel="stylesheet" href="/static/cmpt/score.css?<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="/static/cmpt/score.css?<%=System.currentTimeMillis()%>">
<style> <style>
.submit{ .submit {
display: inline-block; display: inline-block;
width: 120px; width: 120px;
height: 45px; height: 45px;
...@@ -48,7 +49,56 @@ ...@@ -48,7 +49,56 @@
cursor: pointer; cursor: pointer;
font-size: 16px; font-size: 16px;
} }
.cancel{ .label-box {
display: flex;
flex-direction: row;
align-items: center;
}
label {
/* width: auto; */
/* width: 200px; */
display: flex;
flex-direction: row;
align-items: center;
}
.cover {
width: 100%;
height: 100px;
background: rgba(247, 247, 247, 1);
border-radius: 4px;
border: 1px solid rgba(238, 238, 238, 1);
display: flex;
justify-content: center;
align-items: center;
}
.cover-img {
width: 300px;
cursor: pointer;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
height: 300px;
}
.rule-field tbody tr td {
height: auto !important;
font-size: 16px !important;
line-height: 1.2 !important;
}
.icon-cover {
width: 34px;
height: 34px;
background-image: url("/static/images/icon_cover.png");
background-size: 100%;
background-repeat: no-repeat;
}
.cancel {
width: 120px; width: 120px;
height: 45px; height: 45px;
background: #949494; background: #949494;
...@@ -59,62 +109,76 @@ ...@@ -59,62 +109,76 @@
text-align: center; text-align: center;
margin-right: 20px; margin-right: 20px;
} }
.input{ .dialog label input {
width:377px; width: 20px !important;
height: 40px!important; height: 20px !important;
line-height: 40px!important;; margin: 0 10px !important;
}
.input {
width: 100%;
height: 40px !important;
line-height: 40px !important;
border: 2px solid #F4F4F4; border: 2px solid #F4F4F4;
border-radius:4px; border-radius: 4px;
margin-right: 30px; margin-right: 30px;
margin-left: 0px; margin-left: 0px;
padding-left: 12px; padding-left: 12px;
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);
} }
.title{
font-size:24px; .title {
font-size: 24px;
width: 300px; width: 300px;
font-weight: 500; font-weight: 500;
color: rgba(51,51,51,1); color: rgba(51, 51, 51, 1);
} }
.title-new{
font-size:20px; .title-new {
color:rgba(51,51,51,1); font-size: 20px;
color: rgba(51, 51, 51, 1);
margin-right: 15px; margin-right: 15px;
width: 80px; width: 80px;
} }
.section{
.section {
display: flex; display: flex;
background: rgba(255,255,255,1); background: rgba(255, 255, 255, 1);
border-radius: 4px; border-radius: 4px;
flex-direction: column; flex-direction: column;
} }
.func{
.func {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 90px; padding: 5px 0;
/*height: 90px;*/
} }
.tip{ .tip {
font-size: 16px; font-size: 16px;
color: rgba(51,51,51,1); color: rgba(51, 51, 51, 1);
position: absolute; position: absolute;
right: 45px; right: 45px;
top: 10px; top: 10px;
} }
.road-notice{
.road-notice {
top: 16px; top: 16px;
height: 15px; height: 15px;
width: 15px; width: 15px;
} }
.road-notice-txt{
.road-notice-txt {
color: rgb(206, 57, 57); color: rgb(206, 57, 57);
font-size: 16px; font-size: 16px;
width: 430px; /*width: 430px;*/
display: inline-block; display: inline-block;
} }
.saveDiv{
.saveDiv {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin: 30px 20px; margin: 30px 20px;
...@@ -129,7 +193,7 @@ ...@@ -129,7 +193,7 @@
<div class="rght" id="letter"> <div class="rght" id="letter">
<div class="section"> <div class="section">
<h3 class="title">外链功能</h3> <h3 class="title">外链功能</h3>
<div class="add-btn" @click="switchDialog" > <div class="add-btn" @click="switchDialog">
<span>+</span> <span>+</span>
<span>添加外链项</span> <span>添加外链项</span>
</div> </div>
...@@ -138,27 +202,40 @@ ...@@ -138,27 +202,40 @@
<div style="margin-top: -10px;margin-bottom: 50px"> <div style="margin-top: -10px;margin-bottom: 50px">
<table style="width: 100%" class="rule-field"> <table style="width: 100%" class="rule-field">
<colgroup> <colgroup>
<col width="40%"> <col style="width:25%">
<col width="40%"> <col style="width:10%">
<col width="20%"> <col style="width:10%">
<col style="width:35%">
<col style="width:20%">
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th style="padding-left: 25px">功能名称</th> <th style="text-align: center">功能名称</th>
<th style="text-align: left">外部链接ID</th> <th style="text-align: center">图标</th>
<th style="text-align: center">类型</th>
<th style="text-align: center">外部链接</th>
<th style="text-align: center">操作</th> <th style="text-align: center">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-if="" v-for="item in list" :data-id="item.id"> <tr v-if="" v-for="item in list" :data-id="item.id">
<td class="name" v-text="item.nameWeb"></td> <td class="name" v-text="item.nameWeb" style="text-align: center"></td>
<td style="text-align: center">
<span v-if="!item.icon">未设置</span>
<img v-else :src="item.icon"
style="width:80px;height:80px;object-fit:cover;" />
</td>
<td style="text-align: center">
<span v-if="item.openType" v-text="typeOptions[item.openType].name"></span>
<span v-else>未设置</span>
</td>
<td style="text-align: left;position: relative;"> <td style="text-align: left;position: relative;">
<span v-text="item.appId"></span> <span v-text="item.appId"></span>
</td> </td>
<td style="text-align: center"> <td style="text-align: center">
<div> <div style="display: flex;flex-direction: row;align-items: center;width:100%;justify-content: space-around;">
<div class="opt edit.opt" @click="edit(item.id)"> <div class="opt edit.opt" @click="edit(item.id)">
<span class="icon-edit"></span><span class="edit">编辑</span> <span class="icon-edit"></span><span class="edit">编辑</span>
</div> </div>
...@@ -171,7 +248,7 @@ ...@@ -171,7 +248,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="dialog" v-show="dialog" style="width: 710px ;height: 460px;z-index: 99;"> <div class="dialog" v-show="dialog" style="width: 710px ;height: 680px;z-index: 99;">
<div> <div>
<span class="title" style="margin-bottom: 10px;color: #CE3939">外链功能设置</span> <span class="title" style="margin-bottom: 10px;color: #CE3939">外链功能设置</span>
</div> </div>
...@@ -179,32 +256,58 @@ ...@@ -179,32 +256,58 @@
<div style="position: relative;"> <div style="position: relative;">
<span class="title-new">功能名称</span> <span class="title-new">功能名称</span>
<span class="road-notice"></span> <span class="road-notice-txt">此名称用于展示给选手,只能使用中文,且不能超过10个字。</span> <span class="road-notice"></span> <span
class="road-notice-txt">此名称用于展示给选手,只能使用中文,且不能超过10个字。</span>
</div> </div>
<div style="position: relative;"> <div style="position: relative;">
<input @input="count" class="input" type="text" v-model="letter.nameWeb" placeholder="请输入功能名称,最多10个字符"> <input @input="count" class="input" type="text" v-model="letter.nameWeb"
placeholder="请输入功能名称,最多10个字符">
<span class="tip">{{letter.nameWeb.length}}/10</span> <span class="tip">{{letter.nameWeb.length}}/10</span>
</div> </div>
</div> </div>
<!-- 类型 (type) -->
<div class="func">
<span class="title-new">类型</span>
<div class="label-box">
<label v-for="item in typeOptions" :key="item.value">
<input type="radio" v-model="letter.openType" :value="item.value">
{{item.name}}
</label>
</div>
</div>
<div class="func">
<span class="title-new">图标</span>
<span style="font-size: 16px;color: #ce3939;margin:10px 0;">
<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">建议分辨率80*80</span>
</span>
<div>
<label for="icon">
<div v-if="!letter.icon" class="cover">
<span class="icon-cover"></span>
</div>
<img v-else class="cover cover-img" :src="letter.icon"/>
</label>
<input id="icon" type="file" style="display: none"
@change="uploadIconFile">
</div>
</div>
<div class="func"> <div class="func">
<span class="title-new">APP ID</span> <span class="title-new">APP ID</span>
<div style="position: relative;width: 400px"> <div style="position: relative;width: 400px">
<input class="input" type="text" v-model="letter.appId" placeholder="请输入目标小程序的ID"> <input class="input" type="text" v-model="letter.appId" placeholder="请输入目标小程序的ID">
</div> </div>
<div style="position: relative;width: 440px"> <div style="position: relative;width: 440px">
</span> </span>
</div> </div>
</div> </div>
<div class="func"> <div class="func">
<span class="title-new" style="line-height: 20px;"> <span class="title-new">{{typeDesc[letter.openType].label}}</span>
<span>PATH</span>
<br>
<span style="font-size:14px;color: #999">(选填)</span>
</span>
<div style="position: relative;width: 400px"> <div style="position: relative;width: 400px">
<input class="input" type="text" v-model="letter.url" placeholder="请输入目标页面的达到路径"> <input class="input" type="text" v-model="letter.url"
:placeholder="typeDesc[letter.openType].placeholder">
</div> </div>
<div style="position: relative;width: 440px"></div>
</div> </div>
<div class="saveDiv"> <div class="saveDiv">
<span v-on:click="cancel" class="cancel">取消</span> <span v-on:click="cancel" class="cancel">取消</span>
...@@ -212,102 +315,196 @@ ...@@ -212,102 +315,196 @@
</div> </div>
</div> </div>
<div v-show="dialog" style="position: fixed;height: 100%;width: 100%;background: black;z-index: 10;opacity: 0.5;top:0px;left:0px"> <div v-show="dialog"
style="position: fixed;height: 100%;width: 100%;background: black;z-index: 10;opacity: 0.5;top:0px;left:0px">
</div> </div>
</div> </div>
<script src="${ctxStatic}/vue/vue.js"></script> <script src="${ctxStatic}/vue/vue.js"></script>
<script> <script>
var customerV = new Vue({ var customerV = new Vue({
el : '#letter', el: '#letter',
data : { data: {
letter : {id:'',nameWeb:'',cmptId:getCId()}, letter: {id: '', nameWeb: '', cmptId: getCId(), icon: '', openType: 1, appId: '', path: ''},
list:[], list: [],
dialog:false dialog: false,
// 子类目 类型配置(1 网页 2 小程序(appId,path) 3 短链接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
typeDesc: {
1: {
label: '网页',
placeholder: '请输入网页地址',
},
2: {
label: '小程序',
placeholder: '请输入小程序地址',
},
3: {
label: '短链接',
placeholder: '请输入短链接地址',
},
4: {
label: '页面',
placeholder: '请输入页面地址',
},
5: {
label: '文档',
placeholder: '请输入文档地址',
},
6: {
label: '图片',
placeholder: '请输入图片地址',
}
},
typeOptions: [
{
name: 'H5',
value: 1,
},
{
name: '小程序',
value: 2,
},
{
name: '短链接',
value: 3,
},
{
name: '内部页面',
value: 4,
},
{
name: '文档',
value: 5,
},
{
name: '图片',
value: 6,
}
],
}, },
methods:{ methods: {
switchDialog : function(){ switchDialog: function () {
customerV.$data.letter.nameWeb = ""; customerV.$data.letter.nameWeb = "";
customerV.$data.letter.id=""; customerV.$data.letter.id = "";
customerV.$data.letter.appId=""; customerV.$data.letter.appId = "";
customerV.$data.letter.url=""; customerV.$data.letter.url = "";
customerV.$data.letter.path = "";
customerV.$data.letter.openType = 1;
customerV.$data.letter.icon = 1;
customerV.$data.dialog = !customerV.$data.dialog; customerV.$data.dialog = !customerV.$data.dialog;
}, },
count:function(){ count: function () {
if(customerV.$data.letter.nameWeb.length > 10){ if (customerV.$data.letter.nameWeb.length > 10) {
customerV.$data.letter.nameWeb = customerV.$data.letter.nameWeb.substr(0,10) customerV.$data.letter.nameWeb = customerV.$data.letter.nameWeb.substr(0, 10)
} }
}, },
edit:function(id){ edit: function (id) {
customerV.getFunc(id); customerV.getFunc(id);
}, },
del:function(id){ del: function (id) {
layer.confirm("确认要删除吗?",function () { layer.confirm("确认要删除吗?", function () {
$.ajax({ $.ajax({
url : '/gk/sure-letter/delFunc/'+id, url: '/gk/sure-letter/delFunc/' + id,
beforeSend:function(){ beforeSend: function () {
var index = layer.load() var index = layer.load()
setTimeout(function () { setTimeout(function () {
layer.close(index); layer.close(index);
},1500) }, 1500)
}, },
success:function (data) { success: function (data) {
layer.msg('删除成功!'); layer.msg('删除成功!');
customerV.queryAll(); customerV.queryAll();
} }
}); });
}); });
}, },
save : function () { save: function () {
if(customerV.$data.letter.nameWeb.length == 0){ if (customerV.$data.letter.nameWeb.length == 0) {
layer.msg("功能名称不能为空!",{icon:5,duration:1500}); layer.msg("功能名称不能为空!", {icon: 5, duration: 1500});
return ; return;
} }
if(customerV.$data.letter.appId.length == 0){ if (customerV.$data.letter.appId.length == 0) {
layer.msg("AppId不能为空!",{icon:5,duration:1500}); layer.msg("AppId不能为空!", {icon: 5, duration: 1500});
return ; return;
} }
$.ajax({ $.ajax({
url : '/gk/sure-letter/updateName', url: '/gk/sure-letter/updateName',
data : customerV.$data.letter, data: customerV.$data.letter,
type:'post', type: 'post',
beforeSend:function(){ beforeSend: function () {
var index = layer.load() var index = layer.load()
setTimeout(function () { setTimeout(function () {
layer.close(index); layer.close(index);
},1500) }, 1500)
}, },
success:function (data) { success: function (data) {
layer.msg('保存成功!'); layer.msg('保存成功!');
customerV.$data.dialog = false; customerV.$data.dialog = false;
customerV.queryAll(); customerV.queryAll();
} }
}) })
}, },
cancel:function(){ cancel: function () {
customerV.$data.dialog = false; customerV.$data.dialog = false;
}, },
queryAll:function(){ queryAll: function () {
if(getCId()){ if (getCId()) {
$.ajax({ $.ajax({
url : '/gk/sure-letter/queryAllThirdMicros?cmptId='+getCId(), url: '/gk/sure-letter/queryAllThirdMicros?cmptId=' + getCId(),
success:function (data) { success: function (data) {
customerV.$data.list = data.content; customerV.$data.list = data.content;
} }
}) })
} }
}, },
getFunc : function (id){ getFunc: function (id) {
$.ajax({ $.ajax({
url : '/gk/sure-letter/getFunc/'+id, url: '/gk/sure-letter/getFunc/' + id,
success:function (data) { success: function (data) {
if(data.content){ if (data.content) {
customerV.$data.letter = data.content; customerV.$data.letter = data.content;
customerV.$data.dialog = true; customerV.$data.dialog = true;
} }
} }
}); });
},
//文件上传处理
uploadIconFile(obj) {
logoFile = obj.target.files[0];
if (logoFile.type && logoFile.type.indexOf("image") == -1) {
return layer.msg('请上传图片', { icon: 5 })
}
var reads = new FileReader();
reads.readAsDataURL(logoFile);
reads.onload = function () {
//将处理完的图片文件上传到阿里云服务器
//上传LOGO图片
var formData = new FormData();
formData.append("uploadImg", logoFile);
$.ajax({
url: 'https://event.geexek.com/upload/file.do', /*接口域名地址*/
type: 'post',
data: formData,
contentType: false,
processData: false,
success: function (res) {
if (res.code == "1") {
layer.msg('上传成功', { icon: 1, time: 1500 });
customerV.$data.letter.icon = res.result
} else {
console.log(res);
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
})
};
} }
} }
}); });
......
...@@ -535,7 +535,7 @@ ...@@ -535,7 +535,7 @@
"id": null, "id": null,
"userId": getUId(), // 用户id "userId": getUId(), // 用户id
"cmptId": getCId(), // 赛事id "cmptId": getCId(), // 赛事id
"type": 4, // 类型配置(1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png 7 定位) "type": 4, // 类型配置(1 网页 2 小程序(appId,path) 3 短链接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png 7 定位)
"moduleId": null, // "moduleId": null, //
"title": null, // 标题 "title": null, // 标题
"address": null, // 地址 "address": null, // 地址
...@@ -561,7 +561,7 @@ ...@@ -561,7 +561,7 @@
moduleOptions: {}, moduleOptions: {},
modules: [], modules: [],
// 子类目 类型配置(1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png) // 子类目 类型配置(1 网页 2 小程序(appId,path) 3 短链接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
typeDesc: { typeDesc: {
1: { 1: {
label: '网页', label: '网页',
...@@ -572,8 +572,8 @@ ...@@ -572,8 +572,8 @@
placeholder: '请输入小程序地址', placeholder: '请输入小程序地址',
}, },
3: { 3: {
label: '短连接', label: '短链接',
placeholder: '请输入短连接地址', placeholder: '请输入短链接地址',
}, },
4: { 4: {
label: '页面', label: '页面',
...@@ -602,7 +602,7 @@ ...@@ -602,7 +602,7 @@
value: 2, value: 2,
}, },
{ {
name: '短连接', name: '短链接',
value: 3, value: 3,
}, },
{ {
......
...@@ -58,22 +58,23 @@ $(document).ready(function () { ...@@ -58,22 +58,23 @@ $(document).ready(function () {
$.ajax({ $.ajax({
url: "/gk/news/save", url: "/gk/news/save",
type: 'post', type: 'post',
data: { contentType: 'application/json',
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: 1, userId: getUId(),
cmptId: getCId(), cmptId: getCId(),
cover: $('#file-cover').attr('data-src'), cover: $('#file-cover').attr('data-src'),
type: $('input[name="type"]:checked').val(), type: $('input[name="type"]:checked').val(),
// 新增的字段 // 新增的字段
openType: openType, openType: openType,
path: path, path: path,
lat: lat, lat: lat??0,
lng: lng lng: lng??0
}, }),
success: function (data) { success: function (data) {
layer.msg('保存成功') layer.msg('保存成功')
window.location.reload(); window.location.reload();
...@@ -273,6 +274,11 @@ function clearInput() { ...@@ -273,6 +274,11 @@ function clearInput() {
$($('input[name="type"]')[0]).attr('checked', "checked") $($('input[name="type"]')[0]).attr('checked', "checked")
$('.cover').css('background-image', '') $('.cover').css('background-image', '')
editor.setContent(''); editor.setContent('');
$('#openType').val(0);
$('#path').val("");
$('#lat').val("");
$('#lng').val("");
$('#appId').val("");
} }
function delNews(id, callback) { function delNews(id, callback) {
......
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