Commit 9c25c602 authored by daniel's avatar daniel

feat(module): 自助服务模块配置

parent cdbfa57e
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface JoyfunModuleMapper {
int insertModule(JoyfunModule joyfunModule);
int logicDeleteModule(JoyfunModule joyfunModule);
List<JoyfunModule> selectModuleList(@Param("status") Integer status);
int updateModuleStatus(JoyfunModule joyfunModule);
int updateModuleSort(JoyfunModule joyfunModule);
JoyfunModule getModuleById(Integer moduleId);
JoyfunModule getModuleByName(String name);
int updateModule(JoyfunModule joyfunModule);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!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.JoyfunModuleMapper">
<insert id="insertModule">
INSERT INTO joyfun_module (
icon, name, sort, path, is_deleted, status, create_time, update_time
) VALUES (
#{icon}, #{name}, #{sort}, #{path}, #{isDeleted}, #{status}, NOW(), NOW()
)
</insert>
<update id="logicDeleteModule">
UPDATE joyfun_module
SET is_deleted = true
WHERE id = #{id}
</update>
<select id="selectModuleList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
FROM joyfun_module
WHERE is_deleted = 0
<if test="status!= null">
AND status = #{status}
</if>
ORDER BY sort ASC
</select>
<select id="getModuleById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
FROM joyfun_module
WHERE id = #{id} AND is_deleted = 0
</select>
<select id="getModuleByName" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
FROM joyfun_module
WHERE name = #{name} AND is_deleted = 0
</select>
<update id="updateModuleStatus">
UPDATE joyfun_module
SET status = #{status}, update_time = NOW()
WHERE id = #{id}
</update>
<update id="updateModuleSort">
UPDATE joyfun_module
SET sort = #{sort}, update_time = NOW()
WHERE id = #{id}
</update>
<update id="updateModule">
UPDATE joyfun_module
<set>
<if test="icon != null and icon != ''">
icon = #{icon},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="sort != null">
sort = #{sort},
</if>
<if test="path != null and path != ''">
path = #{path},
</if>
<if test="status != null">
status = #{status},
</if>
update_time = NOW()
</set>
WHERE id = #{id}
</update>
</mapper>
package com.dlbridge.jadp.plugins.cmpt.dao.model;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class JoyfunModule {
private Long id;
// 图标URL
private String icon;
// 服务名称
private String name;
// 跳转路径
private String path;
//排序序号
private Integer sort;
// 是否删除
private Integer isDeleted;
// 状态(0:无效,1:有效)
private Integer status;
// 创建时间
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp createTime;
// 更新时间
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp updateTime;
}
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfunModuleMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfunModule;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class JoyfunModuleService {
@Resource
private JoyfunModuleMapper joyfunModuleMapper;
public int addModule(JoyfunModule joyfunModule) {
return joyfunModuleMapper.insertModule(joyfunModule);
}
public int deleteModule(JoyfunModule joyfunModule) {
return joyfunModuleMapper.logicDeleteModule(joyfunModule);
}
public List<JoyfunModule> listModules(Integer status) {
return joyfunModuleMapper.selectModuleList(status);
}
public int updateModuleStatus(JoyfunModule joyfunModule) {
return joyfunModuleMapper.updateModuleStatus(joyfunModule);
}
public int updateModuleSort(JoyfunModule joyfunModule) {
return joyfunModuleMapper.updateModuleSort(joyfunModule);
}
public JoyfunModule getModuleByName(String name) {
return joyfunModuleMapper.getModuleByName(name);
}
public JoyfunModule getModuleById(Integer id) {
return joyfunModuleMapper.getModuleById(id);
}
public int updateModule(JoyfunModule joyfunModule) {
return joyfunModuleMapper.updateModule(joyfunModule);
}
}
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.plugins.cmpt.bean.JoyfulRichTextBean;
import com.dlbridge.jadp.plugins.cmpt.dao.model.CmptSetting;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText;
import com.dlbridge.jadp.plugins.cmpt.dao.model.UserPoint;
import com.dlbridge.jadp.plugins.cmpt.dao.model.*;
import com.dlbridge.jadp.plugins.cmpt.service.*;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.*;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -44,6 +42,8 @@ public class JoyfulRoadController {
@Resource
private WeatherService weatherService;
@Resource
private JoyfunModuleService joyfunModuleService;
@PostMapping(value = "/updCmptsettingName")
@ResponseBody
......@@ -200,4 +200,97 @@ public class JoyfulRoadController {
List<JoyfulCheckinRecords> joyfulCheckinRecordsList = joyfulCheckinRecordsService.getJoyfulCheckinRecordsList(userId, pageNo, pageCount);
return Result.success().setContent(joyfulCheckinRecordsList);
}
//-------------------------自助服务模块-----------------------
@PostMapping("/addModule")
@ApiOperation(value = "新增服务模块", notes = "新增一个新的服务模块")
public Result addModule(@RequestBody JoyfunModule joyfunModule) {
// 判断内容
if (StringUtils.isBlank(joyfunModule.getName())) {
return Result.fail().setMsg("服务模块名称不能为空!");
}
if (StringUtils.isBlank(joyfunModule.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
if (StringUtils.isBlank(joyfunModule.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
JoyfunModule exitModule = joyfunModuleService.getModuleByName(joyfunModule.getName());
if(exitModule != null){
return Result.fail().setMsg("服务模块已存在!");
}
int result = joyfunModuleService.addModule(joyfunModule);
if (result != 1) {
return Result.fail().setMsg("新增失败!");
}
return Result.success().setMsg("新增成功。");
}
@PostMapping("/updateModule")
@ApiOperation(value = "更新服务模块", notes = "更新服务模块")
public Result updateModule(@RequestBody JoyfunModule joyfunModule) {
// 判断内容
if (StringUtils.isBlank(joyfunModule.getName())) {
return Result.fail().setMsg("服务模块名称不能为空!");
}
if (StringUtils.isBlank(joyfunModule.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
if (StringUtils.isBlank(joyfunModule.getPath())) {
return Result.fail().setMsg("跳转路径不能为空!");
}
int result = joyfunModuleService.updateModule(joyfunModule);
if (result != 1) {
return Result.fail().setMsg("更新失败!");
}
return Result.success().setMsg("更新成功。");
}
@PostMapping("/delModule")
@ApiOperation(value = "逻辑删除服务模块", notes = "逻辑删除一个服务模块")
public Result deleteModule(@RequestBody JoyfunModule joyfunModule) {
int result = joyfunModuleService.deleteModule(joyfunModule);
if (result != 1) {
return Result.fail().setMsg("删除失败!");
}
return Result.success().setMsg("删除成功。");
}
@GetMapping("/getModule/{id}")
@ApiOperation(value = "获取服务模块详情", notes = "获取服务模块详情")
public Result getModule(@PathVariable("id") Integer id) {
JoyfunModule data = joyfunModuleService.getModuleById(id);
return Result.success().setContent(data);
}
@GetMapping("/modules")
@ApiOperation(value = "获取服务模块列表", notes = "获取所有服务模块列表")
public Result<List<JoyfunModule>> listModules(@RequestParam(value = "status", required = false) Integer status) {
List<JoyfunModule> serviceModules = joyfunModuleService.listModules(status);
return Result.success().setContent(serviceModules);
}
@PostMapping("/updateModuleStatus")
@ApiOperation(value = "修改服务模块状态", notes = "修改服务模块的状态")
public Result updateModuleStatus(@RequestBody JoyfunModule joyfunModule) {
int result = joyfunModuleService.updateModuleStatus(joyfunModule);
if (result != 1) {
return Result.fail().setMsg("状态修改失败!");
}
return Result.success().setMsg("状态修改成功。");
}
@PostMapping("/updateModuleSort")
@ApiOperation(value = "更新服务模块排序", notes = "更新服务模块的排序序号")
public Result updateModuleSort(@RequestBody JoyfunModule joyfunModule) {
int result = joyfunModuleService.updateModuleSort(joyfunModule);
if (result != 1) {
return Result.fail().setMsg("排序更新失败!");
}
return Result.success().setMsg("排序更新成功。");
}
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.common.interceptor.PageView;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import com.dlbridge.jadp.plugins.cmpt.service.CmptService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
@Controller
@Log4j2
@RequestMapping("gk/module/")
@ApiIgnore
public class ModuleSettingController {
@Resource
private CmptService cmptService;
@RequestMapping("index/{cmptId}")
@PageView
public ModelAndView outterLink(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
Cmpt cmpt = cmptService.queryCmptBycmptId(cmptId);
mv.addObject("cmpt", cmpt);
mv.setViewName("cmpt/module");
return mv;
}
}
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html>
<head>
<title>自助服务模块</title>
<!-- Bootstrap CSS-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome CSS-->
<link rel="stylesheet"
href="${ctxStatic}/newdermon/vendor/font-awesome/css/font-awesome.min.css">
<!-- Fontastic Custom icon font-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/fontastic.css">
<!-- Google fonts - Poppins -->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css">
<!-- theme stylesheet-->
<link rel="stylesheet"
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>"
id="theme-stylesheet">
<!-- Custom stylesheet - for your changes-->
<link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css">
<!-- Favicon-->
<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/main.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}/newdermon/vendor/jquery/jquery.min.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="/static/cmpt/score.css?<%=System.currentTimeMillis()%>">
<style>
.action {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
}
.action div {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
user-select: none;
}
.submit {
display: inline-block;
width: 120px;
height: 45px;
text-align: center;
line-height: 45px;
color: white;
background: #ce3939;
border-radius: 4px;
letter-spacing: 1px;
cursor: pointer;
font-size: 16px;
}
.cancel {
width: 120px;
height: 45px;
background: #949494;
border-radius: 4px;
font-size: 16px;
color: #FFFFFF;
line-height: 45px;
text-align: center;
margin-right: 20px;
}
.input {
width: 100%;
height: 40px !important;
line-height: 40px !important;
;
border: 2px solid #F4F4F4;
border-radius: 4px;
margin-right: 30px;
margin-left: 0px;
padding-left: 12px;
background: rgba(247, 247, 247, 1);
border-radius: 4px;
border: 1px solid rgba(229, 229, 229, 1);
}
.title {
font-size: 24px;
font-weight: 500;
color: rgba(51, 51, 51, 1);
}
.title-new {
font-size: 20px;
color: rgba(51, 51, 51, 1);
margin-right: 15px;
margin-bottom: 15px;
width: auto;
}
.section {
display: flex;
background: rgba(255, 255, 255, 1);
border-radius: 4px;
flex-direction: column;
}
.func {
display: flex;
flex-direction: column;
/* height: 90px; */
padding: 5px 0;
}
.tip {
font-size: 16px;
color: rgba(51, 51, 51, 1);
position: absolute;
right: 45px;
top: 10px;
}
.road-notice {
top: 16px;
height: 15px;
width: 15px;
}
.road-notice-txt {
color: rgb(206, 57, 57);
font-size: 16px;
width: 430px;
display: inline-block;
}
.saveDiv {
display: flex;
justify-content: flex-end;
margin: 0 20px;
padding-top: 10px;
}
label {
/* width: auto; */
/* width: 200px; */
display: flex;
flex-direction: row;
align-items: center;
}
.label-box {
display: flex;
flex-direction: row;
align-items: center;
}
.dialog input {
width: 50vw !important;
}
.dialog label input {
width: 20px !important;
height: 20px !important;
margin: 0 10px !important;
}
.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;
}
.icon-cover {
width: 34px;
height: 34px;
background-image: url("/static/images/icon_cover.png");
background-size: 100%;
background-repeat: no-repeat;
}
.section {
width: 100% !important;
display: flex;
flex-direction: column;
}
.section-box {
width: 100% !important;
display: flex;
flex-direction: row;
align-items: center;
}
.rule-field tbody tr td:first-child {
padding-left: 0 !important;
height: auto !important;
}
tbody tr td {
font-size: 15px !important;
}
input[type=checkbox]::before {
border: none !important;
background: none !important;
}
input[type=checkbox]:checked::before {
border: none !important;
background: none !important;
}
input[type=checkbox] {
top: 0;
left: 0;
}
</style>
</head>
<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>
<div class="rght" id="module">
<div class="section">
<div>
<h3 class="title">服务模块</h3>
<div class="add-btn" @click="addModule">
<span>+</span>
<span>添加服务模块</span>
</div>
</div>
</div>
<div style="margin-top: -10px;margin-bottom: 50px">
<table style="width: 100%" class="rule-field">
<colgroup>
<col style="width:15%;">
<col style="width:20%;">
<col style="width:10%;">
<col style="width:20%;">
<col style="width:10%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th style="text-align: center">图标</th>
<th style="text-align: left">模块名</th>
<th style="text-align: left">排序</th>
<th style="text-align: left">路径</th>
<th style="text-align: center">状态</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
<tr v-if="" v-for="item in list" :data-id="item.id">
<td style="text-align: center">
<img :src="item.icon" style="width:80px;height:80px;" />
</td>
<td class="name" style="text-align: left;">
<span v-text="item.name"></span>
</td>
<td class="name" style="text-align: left;">
<span v-text="item.sort"></span>
</td>
<td class="name" style="text-align: left;">
<span v-text="item.path"></span>
</td>
<td style="text-align: center">
<span class="badge badge-pill"
:class="[item.status==1?'badge-success':'badge-danger']"
v-text="statusType[item.status]">
</span>
</td>
<td style="text-align: center">
<div class="action">
<div class="opt edit.opt" @click="showEdit(item.id)">
<span class="icon-edit"></span>
<span class="edit">
编辑
</span>
</div>
<div class="opt del" @click="delModule(item)">
<span class="icon-del"></span>
<span class="del">
删除
</span>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="dialog" v-show="dialog" style="width:40vw;height: 80vh; z-index: 99;display: flex;flex-direction: column;left: 50%;
transform: translateX(-50%);margin-left:0;">
<div>
<span class="title" style="margin-bottom: 10px; color: #CE3939">{{title}}</span>
</div>
<div style="display: flex;flex-direction: column;flex:1;overflow-y: auto;">
<div class="func">
<div>
<span class="title-new">模块名称</span>
</div>
<div>
<input class="input" type="text" v-model="module.name"
placeholder="请输入功能名称,最多五个字符">
</div>
</div>
<div class="func">
<div>
<span class="title-new">跳转地址</span>
</div>
<div>
<input class="input" type="text" v-model="module.path"
placeholder="请输入跳转路径">
</div>
</div>
<div class="func">
<div>
<span class="title-new">排序(越小越靠前)</span>
</div>
<div>
<input class="input" type="number" v-model="module.sort"
placeholder="请输入排序">
</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">建议分辨率500*500</span>
</span>
<div>
<label for="file">
<div v-if="!module.icon" class="cover">
<span class="icon-cover"></span>
</div>
<img v-else class="cover cover-img" :src="module.icon" />
</label>
<input id="file" type="file" style="display: none" @change="uploadFile">
</div>
</div>
<!-- 状态 (status) -->
<div class="func">
<span class="title-new">状态</span>
<div class="label-box">
<label>
<input type="radio" v-model="module.status" value="0"> 关闭
</label>
<label>
<input type="radio" v-model="module.status" value="1"> 开启
</label>
</div>
</div>
</div>
<div class="saveDiv">
<span @click="cancel" class="cancel">取消</span>
<span @click="submit" class="submit">保存</span>
</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>
</div>
<script src="${ctxStatic}/vue/vue.js"></script>
<script>
var app = new Vue({
el: '#module',
data: {
list: [],
dialog: false,
title: '新增服务模块',
module: {
"id": null,
"name": null,
"sort": 10,
"path": null,
"icon": null,
"status": 1, // 状态(0:关闭 1:开启)
"isDeleted": 0 // 删除状态(0:未删除 1:已删除)
},
statusType: {
0: '关闭',
1: '开启'
}
},
methods: {
// 展示dialog
addModule() {
this.dialog = !this.dialog;
this.resetForm();
},
changePage(page) {
this.page = page
this.queryAll()
},
changeType(index) {
this.page = 1
this.typeIndex = index
this.queryAll()
},
next() {
this.page += 1
this.queryAll()
},
preview() {
this.page -= 1
this.queryAll()
},
// 重置表单
resetForm() {
this.module = {
"id": null,
"name": null,
"icon": null,
"path": null,
"sort":10,
"status": 1, // 状态(0:关闭 1:开启)
"isDeleted": 0 // 删除状态(0:未删除 1:已删除)
};
},
// 编辑
showEdit(id) {
this.getDetail(id);
},
// 删除
delModule(data) {
layer.confirm("确认要删除吗?", function () {
$.ajax({
url: '/api/joyfulRoad/delModule',
data: JSON.stringify(data), // 将 data 转换为 JSON 字符串
type: 'post',
contentType: 'application/json',
beforeSend: () => {
layer.load()
},
success: () => {
layer.msg('删除成功!');
},
complete: () => {
layer.closeAll()
app.queryAll();
}
});
});
},
// 保存
submit() {
const module = { ...this.module,status:Number(this.module.status),sort:Number(this.module.sort) }
// 假设 service 对象已经定义并初始化
if (!module.icon) {
layer.msg("图标图片!", { icon: 5, duration: 1500 });
return;
}
if (!module.name) {
layer.msg("模块标题不能为空!", { icon: 5, duration: 1500 });
return;
}
if (!module.path) {
layer.msg("跳转路径不能为空!", { icon: 5, duration: 1500 });
return;
}
const url = this.module.id ? '/api/joyfulRoad/updateModule' : '/api/joyfulRoad/addModule'
$.ajax({
url: url,
data: JSON.stringify(module), // 将 data 转换为 JSON 字符串
type: 'post',
contentType: 'application/json',
beforeSend: () => {
layer.load()
},
success: () => {
layer.msg('保存成功!');
app.$data.dialog = false;
app.queryAll();
},
complete: () => {
layer.closeAll()
}
})
},
// 返回
cancel() {
this.dialog = false;
},
// 查询所有
queryAll() {
if (!getCId) return
const url = '/api/joyfulRoad/modules'
$.ajax({
type: 'GET',
contentType: 'application/json',
url,
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
success: (data) => {
this.list = data.content
}
})
},
// 获取详情
getDetail(id) {
$.ajax({
url: '/api/joyfulRoad/getModule/' + id,
success: (data) => {
if (data.content) {
this.module = data.content;
this.dialog = true;
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
});
},
//文件上传处理
uploadFile(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 });
app.$data.module.icon = res.result
} else {
console.log(res);
}
},
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
})
};
}
}
});
app.queryAll();
</script>
</body>
</html>
\ No newline at end of file
......@@ -331,7 +331,7 @@
</td>
<td style="text-align: center">
<span class="badge badge-pill"
:class="[item.status==1?'badge-success':'badge-default']"
:class="[item.status==1?'badge-success':'badge-danger']"
v-text="statusType[item.status]"></span>
</td>
<td style="text-align: center">
......@@ -387,27 +387,8 @@
<span class="title-new">服务类型</span>
<div class="label-box">
<label>
<input type="radio" v-model="service.type" :value="3"> 特色民宿
</label>
<label>
<input type="radio" v-model="service.type" :value="4"> 旅游景点
</label>
<label>
<input type="radio" v-model="service.type" :value="5"> 特色餐饮
</label>
<label>
<input type="radio" v-model="service.type" :value="6"> 当地特产
</label>
<label>
<input type="radio" v-model="service.type" :value="7"> 应急避险
</label>
<label>
<input type="radio" v-model="service.type" :value="8"> 医疗点位
</label>
<label>
<input type="radio" v-model="service.type" :value="9"> 运动产品
<label v-for="item in modules" :key="item.value">
<input type="radio" v-model="service.type" :value="item.value"> {{item.name}}
</label>
</div>
</div>
......@@ -415,20 +396,8 @@
<div class="func">
<span class="title-new">子类型</span>
<div class="label-box">
<label>
<input type="checkbox" v-model="service.category" :value="1"> 打卡点
</label>
<label>
<input type="checkbox" v-model="service.category" :value="2"> 服务驿站
</label>
<label>
<input type="checkbox" v-model="service.category" :value="3"> 民宿
</label>
<label>
<input type="checkbox" v-model="service.category" :value="4"> 景点
</label>
<label>
<input type="checkbox" v-model="service.category" :value="5"> 餐饮
<label v-for="item in categoryOptions" :key="item.value">
<input type="checkbox" v-model="service.category" :value="item.value"> {{item.name}}
</label>
</div>
</div>
......@@ -558,40 +527,8 @@
pageSize: 10,
totalPage: 1,
// 3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品
serviceTypes: {
0: {
name: '全部',
value: 0,
},
3: {
name: '特色民宿',
value: 3,
},
4: {
name: '旅游景点',
value: 4,
},
5: {
name: '特色餐饮',
value: 5,
},
6: {
name: '当地特产',
value: 6,
},
7: {
name: '应急避险',
value: 7,
},
8: {
name: '医疗点位',
value: 8,
},
9: {
name: '运动产品',
value: 9,
},
},
serviceTypes: {},
modules: [],
// 子类目
categoryOptions: [
{
......@@ -748,6 +685,41 @@
cancel() {
this.dialog = false;
},
queryModules() {
if (!getCId) return
const url = '/api/joyfulRoad/modules'
$.ajax({
type: 'GET',
contentType: 'application/json',
url,
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
},
success: (data) => {
const filters = data.content.filter(v=>v.name!=='天气服务')
let list = filters.map(item => {
return {
[item.id]: {
value: item.id,
name: item.name
}
};
});
this.modules = filters
list.unshift({
0:{
value: 0,
name: '全部'
}
})
this.serviceTypes = Object.assign({}, ...list);
this.queryAll()
}
})
},
// 查询所有
queryAll() {
if (!getCId) return
......@@ -841,7 +813,7 @@
}
}
});
app.queryAll();
app.queryModules();
</script>
</body>
......
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