# Conflicts:
#	backend/src/main/resources/application.yaml
This commit is contained in:
那些花儿
2025-05-06 18:06:22 +08:00
21 changed files with 797 additions and 200 deletions
-158
View File
@@ -1,158 +0,0 @@
nutz:
application:
name: budwk-v5-mini-plus
mvc:
ignore: ^(.+[.])(jsp|png|gif|jpg|js|css|jspx|jpeg|html|mp3|mp4|ico|svg|vue)$
exclusions: /favicon/*,/assets/*,/druid/*,/upload/*
server:
port: 9090
host: 0.0.0.0
jetty:
contextPath: /
threadpool:
idleTimeout: 60000
minThreads: 10
maxThreads: 200
gzip:
enable: true
page:
403: /error/403.html
404: /error/404.html
500: /error/500.html
#结合ftp使用,或用nginx代理ftp路径
#staticPath: E:/project/NutzWk/upload
#开发模式静态资源
staticPathLocal: E:/project/company/hmc_gbhd/src/main/resources/static
security:
tokenName: token
timeout: 36000
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
isConcurrent: true
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
isShare: true
redis:
host: 192.168.21.207
port: 6379
timeout: 2000
max_redir: 10
database: 10
maxTotal: 150
pool:
maxTotal: 150
maxIdle: 50
minIdle: 10
#password: test123
mode:
normal
#cluster
#nodes=192.168.6.31:6377,192.168.6.31:6378,192.168.6.28:6377,192.168.6.28:6378,192.168.6.34:6377,192.168.6.34:6378
jdbc:
url: jdbc:mysql://192.168.21.207:3306/hmc_gbhd?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root
password: root
validationQuery: select 1
maxActive: 150
testWhileIdle: true
connectionProperties: druid.stat.slowSqlMillis=2000
defaultAutoCommit: true
xsssql:
ignore:
urls: /platform/cms/content/article/addDo,/platform/sys/app/conf/addDo,/platform/sys/app/conf/editDo
beetl:
RESOURCE:
#本地路径,开发时设置本地路径,便于调试
rootLocal: E:/project/company/hmc_gbhd/src/main/resources/views/
root: views/
DELIMITER_STATEMENT_START: '<!--#'
DELIMITER_STATEMENT_END: '#-->'
FT:
#用法: ${"wizzer",escape}
escape: com.budwk.app.web.commons.ext.beetl.HtmlEscapeFormat
#用法: ${10241024,filesize}
filesize: com.budwk.app.web.commons.ext.beetl.FileSizeFormat
#用法: ${"",html2txt="100"} 截取100字符
html2txt: com.budwk.app.web.commons.ext.beetl.Html2TxtFormat
#用法: ${"",strlen="100"} 截取100字符
strlen: com.budwk.app.web.commons.ext.beetl.StrlenFormat
#==============================================================
#Configure Main Scheduler Properties
#==============================================================
#quartz延迟启动秒数
quartz:
startupDelay: 10
scheduler:
instanceName: defaultScheduler
instanceId: AUTO
#==============================================================
#Skip Check Update
#update:true
#not update:false
#==============================================================
skipUpdateCheck: true
#==============================================================
#Configure JobStore isClustered=启用集群模式
#==============================================================
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#driverDelegateClass: org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
#Other delegates can see: http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-09.html
dataSource: myDS
tablePrefix: SYS_QRTZ_
isClustered: false
clusterCheckinInterval: 20000
maxMisfiresToHandleAtATime: 120
misfireThreshold: 120000
txIsolationLevelSerializable: false
#==============================================================
#Configure ThreadPool
#==============================================================
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 2
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
#============================================================================
# Configure Plugins
#============================================================================
plugin:
triggHistory:
class: org.quartz.plugins.history.LoggingJobHistoryPlugin
shutdownhook:
class: org.quartz.plugins.management.ShutdownHookPlugin
cleanShutdown: true
#============================================================================
# NutDao dataSource
#============================================================================
dataSource:
myDS:
connectionProvider:
class: com.budwk.app.task.conn.NutConnectionProvider
sms:
enabled: false
#腾讯云短信配置
tencent:
secret-id: 1
secret-key: 2
appid: 1 #应用ID
sign: '萌发开源' #短信签名
tpl:
#验证码模板ID
code: 1
#短信通知模板ID
msg: 2
@@ -14,6 +14,8 @@ public class ClientActivitySignVO {
private Long activityId;
private Long itemId;
private String unitId;
private String unitName;
private String contactName;
@@ -105,6 +105,7 @@ public class ActUserController {
user.setId(actUser.getId());
}
user.setUserId(user.getUserId());
user.setUnitId(vo.getUnitId());
user.setSignUpTime(localDateTime);
user.setSignUpContacts(vo.getContactName());
user.setSignUpMobile(vo.getContactPhone());
@@ -115,6 +116,7 @@ public class ActUserController {
} else {
for (ActUser user : doSignUserList) {
user.setUserId(user.getUserId());
user.setUnitId(vo.getUnitId());
user.setSignUpTime(localDateTime);
user.setSignUpContacts(vo.getContactName());
user.setSignUpMobile(vo.getContactPhone());
@@ -134,6 +136,7 @@ public class ActUserController {
dao.insert(clientUser);
user.setUserId(clientUser.getId());
user.setUnitId(vo.getUnitId());
user.setSignUpTime(localDateTime);
user.setSignUpContacts(vo.getContactName());
user.setSignUpMobile(vo.getContactPhone());
@@ -171,8 +174,8 @@ public class ActUserController {
@At
@SaCheckPermission("activity.user")
public Result findSignUserInfo(String userId){
return Result.success(dao.fetch(ActUser.class, Cnd.where(ActUser::getUserId, "=", userId)));
public Result findSignUserInfo(String id){
return Result.success(dao.fetch(ActUser.class, Cnd.where(ActUser::getId, "=", id)));
}
@@ -182,7 +185,7 @@ public class ActUserController {
@At
@SaCheckPermission("activity.user")
public Result getActivityList(String year){
List<Activity> activityList = dao.query(Activity.class, Cnd.where("YEAR(startTime)", "=", year).and(Activity::getDelFlag, "=", false));
List<Activity> activityList = dao.query(Activity.class, Cnd.NEW().andEX("YEAR(startTime)", "=", year).and(Activity::getDelFlag, "=", false));
return Result.success(activityList);
}
@@ -0,0 +1,123 @@
package com.budwk.app.module.activity.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.PageForm;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.module.activity.models.ActWonderfulMoment;
import com.budwk.app.module.activity.models.Activity;
import com.budwk.app.module.activity.service.ActWonderfulMomentService;
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName ActWonderfulMomentController
* @Author JyuHsin
* @Date 2025/5/6 15:30
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/activity/wonderfulMoment")
public class ActWonderfulMomentController {
@Inject
private ActWonderfulMomentService wonderfulMomentService;
@At("")
@SaCheckPermission("activity.wonderfulMoment")
@Ok("beetl:/platform/activity/wonderfulMoment/index.html")
public void index() {
}
@At
@SaCheckPermission("activity.wonderfulMoment")
public Result pageData(PageForm pageForm, String startTime, String endTime){
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and("title", "like", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.andEX("publishTime", ">=", startTime);
cnd.andEX("publishTime", "<=", endTime);
cnd.desc("publishTime");
Pagination pagination = wonderfulMomentService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("activity.wonderfulMoment")
public Result onHandle(@Param("wonderfulMoment") ActWonderfulMoment wonderfulMoment) {
if(wonderfulMoment.getId() == null) {
wonderfulMoment.setPublishTime(DateUtil.now());
}
wonderfulMomentService.insertOrUpdate(wonderfulMoment);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("activity.wonderfulMoment")
public Result onDelete(Long id) {
wonderfulMomentService.delete(id);
return Result.success();
}
@At
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result getWonderfulMoment(@Param("id") Long id) {
Cnd cnd = Cnd.where("published", "=", true).andEX("id", "=", id);
cnd.desc("publishTime");
List<ActWonderfulMoment> momentList = wonderfulMomentService.query(cnd);
List<NutMap> result = new ArrayList<>();
for (ActWonderfulMoment wonderfulMoment : momentList) {
NutMap nutMap = Lang.obj2map(wonderfulMoment, NutMap.class);
DateTime dateTime = DateUtil.parse(wonderfulMoment.getPublishTime());
//如果是今天
if(DateUtil.isSameDay(dateTime, new Date())) {
nutMap.put("time", "今天" + DateUtil.format(dateTime, "HH:mm"));
} else {
nutMap.put("time", DateUtil.betweenDay(dateTime, new Date(), false) + "天前");
}
result.add(nutMap);
}
return Result.success(result);
}
@At("/getWonderfulMomentById/?")
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result getWonderfulMomentById(Long id) {
ActWonderfulMoment moment = wonderfulMomentService.fetch(id);
return Result.success(moment);
}
@At("/handleWonderfulMoment/?")
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result handleWonderfulMoment(Long id) {
ActWonderfulMoment moment = wonderfulMomentService.fetch(id);
moment.setReadCount(moment.getReadCount() + 1);
wonderfulMomentService.update(moment);
return Result.success();
}
}
@@ -1,5 +1,6 @@
package com.budwk.app.module.activity.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import com.budwk.app.base.page.PageForm;
@@ -8,6 +9,7 @@ import com.budwk.app.base.result.Result;
import com.budwk.app.module.activity.models.Activity;
import com.budwk.app.module.activity.models.ActivityItem;
import com.budwk.app.module.activity.service.ActivityManageService;
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
@@ -163,4 +165,11 @@ public class ActivityManageController {
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result getActivity() {
List<Activity> activityList = activityService.query(Cnd.NEW());
return Result.success(activityList);
}
}
@@ -15,6 +15,7 @@ import com.budwk.app.module.activity.service.ActivitySignInQueryService;
import com.budwk.app.module.activity.vo.page.ActSignInUserPageForm;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
@@ -87,6 +88,17 @@ public class ActivitySignInQueryController {
}
@At
@SaCheckPermission("activity.signInUserQuery")
public Result doGrant(String id, Boolean isGrant) {
if (StrUtil.isBlank(id)) {
return Result.error("参数错误");
}
activitySignInQueryService.update(Chain.make("isGrant", isGrant), Cnd.where("id", "=", id));
return Result.success();
}
@At
@Ok("void")
@SaCheckPermission("activity.signInUserQuery")
@@ -70,6 +70,11 @@ public class ActUser extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 30)
private String phone;
@Column
@Comment("参加单位Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("参加单位名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
@@ -95,6 +100,12 @@ public class ActUser extends BaseModel {
@ColDefine(type = ColType.BOOLEAN)
private Boolean isStay;
@Column
@Comment("是否联系人")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isContacts;
@Column
@Comment("是否签到")
@ColDefine(type = ColType.BOOLEAN)
@@ -105,4 +116,10 @@ public class ActUser extends BaseModel {
@Comment("签到时间")
@ColDefine(type = ColType.DATETIME)
private LocalDateTime signInTime;
@Column
@Comment("是否发放物资")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isGrant;
}
@@ -0,0 +1,56 @@
package com.budwk.app.module.activity.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
/**
* @ClassName ActWonderfulMoment
* @Author JyuHsin
* @Date 2025/5/6 15:28
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("活动项目队伍得分表")
@Table("act_wonderful_moment")
@EqualsAndHashCode(callSuper = true)
@TableMeta("{'mysql-charset':'utf8mb4'}")
public class ActWonderfulMoment extends BaseModel {
@Id
@Comment("ID")
private Long id;
@Column
@Comment("标题")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String title;
@Column
@Comment("发布内容")
@ColDefine(type = ColType.TEXT)
private String content;
@Column
@Comment("发布时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String publishTime;
@Column
@Comment("封面图")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String cover;
@Column
@Comment("是否发布")
@ColDefine(type = ColType.BOOLEAN)
private Boolean published;
@Column
@Comment("阅读次数")
@Default(value = "0")
@ColDefine(type = ColType.INT)
private Integer readCount;
}
@@ -0,0 +1,14 @@
package com.budwk.app.module.activity.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.module.activity.models.ActWonderfulMoment;
/**
* @ClassName ActWonderfulMomentService
* @Author JyuHsin
* @Date 2025/5/6 15:30
* @Version 1.0
* @Description TODO
*/
public interface ActWonderfulMomentService extends BaseService<ActWonderfulMoment> {
}
@@ -0,0 +1,21 @@
package com.budwk.app.module.activity.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.module.activity.models.ActWonderfulMoment;
import com.budwk.app.module.activity.service.ActWonderfulMomentService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName ActWonderfulMomentServiceImpl
* @Author JyuHsin
* @Date 2025/5/6 15:31
* @Version 1.0
* @Description TODO
*/
@IocBean(args = {"refer:dao"})
public class ActWonderfulMomentServiceImpl extends BaseServiceImpl<ActWonderfulMoment> implements ActWonderfulMomentService {
public ActWonderfulMomentServiceImpl(Dao dao) {
super(dao);
}
}
@@ -1,5 +1,6 @@
package com.budwk.app.web.commons.ext.sms;
import cn.hutool.json.JSONUtil;
import com.budwk.app.base.exception.BaseException;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
@@ -48,20 +49,21 @@ public class SmsService {
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
SmsClient client = new SmsClient(cred, "", clientProfile);
SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
SendSmsRequest req = new SendSmsRequest();
String[] phoneNumberSet1 = {"+86" + mobile};
req.setPhoneNumberSet(phoneNumberSet1);
String[] templateParamSet1 = {text, "5"};
req.setTemplateParamSet(templateParamSet1);
req.setTemplateID(conf.get("sms.tencent.tpl.login_code"));
req.setSmsSdkAppid(conf.get("sms.tencent.appid"));
req.setSign(conf.get("sms.tencent.sign"));
req.setTemplateID(conf.get("sms.tencent.tpl.login_code"));
String[] phoneNumberSet1 = {"+86" + mobile};
req.setPhoneNumberSet(phoneNumberSet1);
String[] templateParamSet1 = {text};
req.setTemplateParamSet(templateParamSet1);
SendSmsResponse resp = client.SendSms(req);
log.debug(SendSmsResponse.toJsonString(resp));
return true;
} catch (TencentCloudSDKException tencentCloudSDKException) {
log.error(String.valueOf(tencentCloudSDKException));
throw new BaseException(tencentCloudSDKException.getMessage());
}
}
@@ -86,12 +88,12 @@ public class SmsService {
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
SmsClient client = new SmsClient(cred, "", clientProfile);
SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
SendSmsRequest req = new SendSmsRequest();
String[] phoneNumberSet1 = {"+86" + mobile};
req.setPhoneNumberSet(phoneNumberSet1);
String[] templateParamSet1 = {text, "5"};
String[] templateParamSet1 = {text};
req.setTemplateParamSet(templateParamSet1);
req.setTemplateID(conf.get("sms.tencent.tpl.reg_code"));
req.setSmsSdkAppid(conf.get("sms.tencent.appid"));
@@ -126,7 +128,7 @@ public class SmsService {
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
SmsClient client = new SmsClient(cred, "", clientProfile);
SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
SendSmsRequest req = new SendSmsRequest();
req.setPhoneNumberSet(mobile);
+3 -3
View File
@@ -147,11 +147,11 @@ swagger:
description: 趣味运动会系统
sms:
enabled: false
enabled: true
#腾讯云短信配置
tencent:
secret-id: 1301383032
secret-key: AKIDMZWDepjNnxqSotiHZeU6SYOyIMAj24rO
secret-id: AKID3vYx5xYu0pVwDIAm9F4ey74mEPJwJQGp
secret-key: LPDl5AyV4NQM3TdW9VaOvCE0VkjSu5zc
appid: 1400934413 #应用ID
sign: '武汉地大三思科技' #短信签名
tpl:
@@ -12,10 +12,22 @@
:on-exceed="handleExceed"
:file-list="fileList"
>
<i class="el-icon-plus"></i>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img class="el-upload-list__item-thumbnail" :src="'/open/file/upload/download?filepath=' + file.url" alt=""
style="var(--box-width, '100px') !important;height: var(--box-height, '100px') !important">
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in"></i>
</span>
<span class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
<el-dialog :visible.sync="dialogVisible" append-to-body>
<img width="100%" :src="dialogImageUrl" alt="">
<img width="100%" :src="'/open/file/upload/download?filepath=' + dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
@@ -124,4 +136,4 @@ module.exports = {
<style scoped>
</style>
</style>
@@ -78,6 +78,9 @@ const addOrUpdate = {
{{form.files}}
<file-upload v-model="form.files" accept=".pdf"></file-upload>
</el-form-item>
<el-form-item label="封面图" prop="cover">
<image-upload v-model="form.cover" :max-count="1"></image-upload>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
@@ -62,6 +62,18 @@ layout("/layouts/platform_1.html"){
<el-table-column label="联系方式" prop="mobile"></el-table-column>
<el-table-column label="参加单位名称" prop="unitName"></el-table-column>
<el-table-column label="签到时间" prop="signInTime"></el-table-column>
<el-table-column label="物资发放" prop="isGrant">
<template slot-scope="scope">
<el-tag v-if="scope.row.isGrant" type="success">已发放</el-tag>
<el-tag v-else type="danger">未发放</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="200">
<template #default="{row}">
<el-button v-if="!row.isGrant || row.isGrant === 0" type="primary" size="mini" @click="doGrant(row, true)">设为已发放物资</el-button>
<el-button v-else type="danger" size="mini" @click="doGrant(row, false)">设为未发放物资</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
@@ -82,6 +94,24 @@ layout("/layouts/platform_1.html"){
}
},
methods: {
async doGrant(row, isGrant) {
this.$confirm('您确定要设置成' + (isGrant ? '已发放' : '未发放') + '状态吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post("/platform/activity/signInUserQuery/doGrant", {
id: row.id,
isGrant: isGrant
})
if (resp.code === 0) {
this.doSearch()
this.$message.success(resp.msg)
} else {
this.$message.error(resp.msg)
}
})
},
doExport() {
window.open("/platform/activity/signInUserQuery/doExport?activityId=" + this.pageForm.activityId + "&searchKeyword=" + this.pageForm.searchKeyword)
},
@@ -111,4 +141,4 @@ layout("/layouts/platform_1.html"){
<!--#
}
#-->
#-->
@@ -39,6 +39,20 @@ layout("/layouts/platform_1.html"){
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位</div>
<div class="search-item-option">
<el-select placeholder="请选择所属单位"
style="width: 100%;" clearable
@change="setModifyFormUnit"
v-model="modifyForm.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
@@ -62,8 +76,8 @@ layout("/layouts/platform_1.html"){
<el-table-column label="报名时间" prop="signUpTime"></el-table-column>
<el-table-column label="操作" fixed="right" width="250">
<template #default="scope">
<el-button type="text" @click="openModify">修改</el-button>
<el-button type="text" class="text-danger" @click="onTableRowDelete(scope.row.id)">删除</el-button>
<el-button type="primary" size="mini" @click="openModify(scope.row)">修改</el-button>
<el-button type="danger" size="mini" @click="doRemove(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -76,7 +90,14 @@ layout("/layouts/platform_1.html"){
<el-input v-model="formData.activityName" readonly></el-input>
</el-form-item>
<el-form-item label="参加单位" prop="unitName">
<el-input v-model="formData.unitName" placeholder="请输入参加单位"></el-input>
<el-select placeholder="请选择所属单位"
style="width: 100%;" clearable
@change="setFormDataUnit"
v-model="formData.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
<!-- <el-input v-model="formData.unitName" placeholder="请输入参加单位"></el-input>-->
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="formData.contactName" placeholder="请输入联系人"></el-input>
@@ -175,7 +196,14 @@ layout("/layouts/platform_1.html"){
<el-input v-model="modifyForm.position"></el-input>
</el-form-item>
<el-form-item label="所属单位" prop="unitName">
<el-input v-model="modifyForm.unitName"></el-input>
<el-select placeholder="请选择所属单位"
style="width: 100%;" clearable
@change="setModifyFormUnit"
v-model="modifyForm.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
<!-- <el-input v-model="modifyForm.unitName"></el-input>-->
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -265,9 +293,40 @@ layout("/layouts/platform_1.html"){
contactPhone: [{required: true, message: '请填写联系电话', trigger: ['blur', 'change']}],
userList: [{required: true, message: '请添加报名人员', trigger: ['blur', 'change']}]
},
units: [],
}
},
methods: {
setFormDataUnit(val) {
if (!val) {
this.formData.unitName = ''
return
}
this.formData.unitName = this.units.find(item => item.id === this.formData.unitId).name
},
setModifyFormUnit(val) {
if (!val) {
this.modifyForm.unitName = ''
return
}
this.modifyForm.unitName = this.units.find(item => item.id === this.modifyForm.unitId).name
},
doRemove(id) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post('/platform/activity/user/doDeleteActUser', {id})
if (resp.code === 0) {
this.doSearch()
this.$message.success(resp.msg)
} else {
this.$message.warning('操作失败')
}
})
},
doExport() {
window.open("/platform/activity/user/doExport?activityId=" + this.pageForm.activityId + "&searchKeyword=" + this.pageForm.searchKeyword)
},
@@ -390,10 +449,17 @@ layout("/layouts/platform_1.html"){
this.$set(this.pageForm, 'activityId', '')
}
this.pageData()
},
async getUnits(){
const resp = await $.post('/open/common/units')
if (resp.code === 0) {
this.units = resp.data
}
}
},
created() {
this.getActivityList()
this.getUnits()
}
})
</script>
@@ -0,0 +1,78 @@
const addOrUpdate = {
template: /*language=HTML*/ `
<el-dialog :title="form.id ? '修改' : '新增'" :visible.sync="visible" width="70%">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<text-editor v-model="form.content" :height="300"></text-editor>
</el-form-item>
<el-form-item label="是否发布" prop="published">
<el-switch
v-model="form.published"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="封面图" prop="cover">
<image-upload v-model="form.cover" :max-count="1"></image-upload>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button>
</template>
</el-dialog>
`,
data() {
return {
title: '',
visible: false,
form: {
published: true,
},
rules: {
title: [{required: true, message: '请输入标题', trigger: ['blur', 'change']}],
content: [{required: true, message: '请输入内容', trigger: ['blur', 'change']}],
cover: [{required: true, message: '请上传封面图', trigger: ['blur', 'change']}],
},
}
},
methods: {
onOpen(row) {
this.visible = true
if (row?.id) {
this.$nextTick(() => {
this.form = JSON.parse(JSON.stringify(row))
})
} else {
this.form = {published: true}
}
},
onSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.$confirm('您确定要提交吗?', '提示', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
$.post('/platform/activity/wonderfulMoment/onHandle', {"wonderfulMoment": JSON.stringify(this.form)}).then(res => {
if (res.code === 0) {
this.$message.success(this.form.id ? '修改成功' : '新增成功')
this.$emit('refresh')
this.visible = false
} else {
this.$message.error(res.msg)
}
})
}).catch(() => {
})
}
})
}
}
}
@@ -0,0 +1,139 @@
<!--#
layout("/layouts/platform_1.html"){
#-->
<style>
</style>
<div id="app">
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">标题</div>
<div class="search-item-option">
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入标题"></el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">开始时间</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.startTime"
type="date"
placeholder="请选择发布开始时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">结束时间</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.endTime"
type="date"
placeholder="请选择发布结束时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt-3">
<el-row type="flex" style="justify-content: flex-end" class="mb-3">
<el-button icon="el-icon-plus" type="primary" size="small" @click="$refs.addOrUpdateRef.onOpen()">新增精彩瞬间</el-button>
</el-row>
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
<el-table-column label="序号" type="index" header-align="center" align="center" width="50"></el-table-column>
<el-table-column label="标题" prop="title"></el-table-column>
<el-table-column label="发布时间" prop="publishTime"></el-table-column>
<el-table-column label="阅读次数" prop="readCount"></el-table-column>
<el-table-column label="发布状态" prop="published">
<template #default="{ row }">
<el-switch
@change="(val) => {publishedChange(val, row)}"
v-model="row.published"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="250">
<template #default="{ row }">
<el-button type="text" @click="$refs.addOrUpdateRef.onOpen(row)">修改</el-button>
<el-button type="text" class="text-danger" @click="onTableRowDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update>
</div>
<script>
<!--#include('addOrUpdate.js'){}#-->
new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"add-or-update": addOrUpdate,
},
data() {
return {
pageForm: {
activityId: '',
},
activityList: [],
tableDeleteUrl: "/platform/activity/wonderfulMoment/onDelete"
}
},
methods: {
onTableRowDelete(id) {
if (!id) {
return
}
this.$confirm('确定删除该数据吗?', '提示', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
$.post(this.tableDeleteUrl, {id}).then((res) => {
if (res.code === 0) {
this.$message.success("删除成功")
this.pageData()
} else {
this.$message.error(res.msg)
}
})
}).catch(() => {})
},
publishedChange(val, row) {
const params = JSON.parse(JSON.stringify(row))
this.$set(params, 'published', val)
$.post('/platform/activity/wonderfulMoment/onHandle', {"wonderfulMoment": JSON.stringify(params)}).then((res) => {
if (res.code === 0) {
this.$message.success("修改成功")
} else {
this.$message.error(res.msg)
}
})
},
async getActivityList(){
const resp = await $.post('/platform/activity/user/getActivityList')
this.activityList = resp.data
},
},
async created() {
this.getActivityList()
await this.pageData()
}
})
</script>
<!--#
}
#-->
+6
View File
@@ -91,6 +91,12 @@
"style": {
"navigationBarTitleText": "精彩瞬间"
}
},
{
"path": "pages/activity/wonderfulMoment/index",
"style": {
"navigationBarTitleText": "精彩瞬间"
}
}
],
"globalStyle": {
@@ -0,0 +1,56 @@
<template>
<view class="container">
<h3 class="container-title">{{ viewData?.title }}</h3>
<view class="container-sub-title">
<span>阅读 {{ viewData?.readCount }}</span>
<span style="margin-left: 30px">{{ moment(viewData?.publishTime).format('YYYY年MM月DD日 HH:mm') }}</span>
</view>
<view v-html="viewData?.content"></view>
</view>
</template>
<script setup>
import {ref, reactive, onMounted, computed, h} from 'vue';
import {onLoad} from "@dcloudio/uni-app";
import {Toast} from "tdesign-mobile-vue";
import {useRequest} from "@/utils/request";
import moment from "moment";
const request = useRequest()
const momentId = ref(null);
const viewData = ref(null);
function getWonderfulMoment() {
request.post('/platform/activity/wonderfulMoment/getWonderfulMomentById/' + momentId.value).then(res=>{
if(res.code === 0){
viewData.value = res.data
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
onLoad((option) => {
if (option.id) {
momentId.value = Number(option.id);
getWonderfulMoment()
}
});
onMounted(() => {
});
</script>
<style scoped lang="less">
.container {
padding: 10px;
background-color: white !important;
min-height: 100%;
}
.container-sub-title {
margin-top: 20px;
color: #C9C9C9;
margin-bottom: 20px;
}
</style>
+125 -19
View File
@@ -32,41 +32,90 @@
</view>
<view class="menu-text">项目报名</view>
</view>
<view class="menu-item" @click="navigateTo('/pages/activity/dynamic/index')">
<view class="menu-icon-wrapper blue-bg">
<view class="menu-icon star-icon"></view>
</view>
<view class="menu-text">精彩瞬间</view>
</view>
<!-- <view class="menu-item" @click="navigateTo('/pages/activity/dynamic/index')">-->
<!-- <view class="menu-icon-wrapper blue-bg">-->
<!-- <view class="menu-icon star-icon"></view>-->
<!-- </view>-->
<!-- <view class="menu-text">精彩瞬间</view>-->
<!-- </view>-->
</view>
<!-- 精选内容区 -->
<view class="content-section">
<view class="section-header">
<view class="section-title">精选活动</view>
<view class="section-more" @click="navigateTo('/pages/activity/index')">更多</view>
<view class="section-title">近期活动</view>
<view class="section-more" @click="navigateTo('/pages/activity/list/index')">更多</view>
</view>
<view class="activity-list">
<view class="activity-item" @click="navigateTo('/pages/process/index')">
<image class="activity-image"
src="https://erp-bucket.pek3b.qingstor.com/assistant/746c37d6-018d-4c64-8a98-ea9ec8b0b3b5.png"
<t-swiper
v-if="actList.length > 0"
:autoplay="actList.length > 1"
:navigation="{ type: 'fraction', paginationPosition: 'bottom-right', showControls: true }"
>
<t-swiper-item v-for="(item, index) in actList" :key="index" style="height: 192px">
<view class="activity-list" @click="navigateTo('/pages/activity/detail/index?id=' + item.id)">
<view class="activity-item">
<image class="activity-image"
:src="item.cover"
mode="widthFix"></image>
<view class="activity-info">
<view class="activity-title">{{ item.title }}</view>
<view class="activity-meta">
<text class="activity-time">{{ moment(item.startTime).format('M月DD日') + '-' + moment(item.endTime).format('DD日') }}</text>
<text class="activity-location">{{ item.address }}</text>
</view>
</view>
</view>
</view>
</t-swiper-item>
</t-swiper>
<t-empty
v-if="actList.length === 0"
description="暂无精彩瞬间"
/>
</view>
<view class="content-section">
<view class="section-header">
<view class="section-title">精彩瞬间</view>
</view>
<view class="activity-list" v-if="wonderfulMomentList.length > 0">
<view class="moment-item" v-for="item in wonderfulMomentList" :key="item.id"
@click="handleWonderfulMoment(item)">
<image class="moment-image"
:src="item.cover"
mode="widthFix"></image>
<view class="activity-info">
<view class="activity-title">一分钟了解运动会流程</view>
<view class="activity-meta">
<text class="activity-time">6月15日-20日</text>
<text class="activity-location">江苏省体育中心</text>
<view class="moment-content">
<view class="moment-title">{{ item.title }}</view>
<view class="moment-sub-content">
<view style="float: right;">{{ item.time }}</view>
<view>阅读 {{ item.readCount }}</view>
</view>
</view>
</view>
</view>
<t-empty
v-if="wonderfulMomentList.length === 0"
description="暂无精彩瞬间"
/>
</view>
</view>
</template>
<script setup>
import {onMounted} from "vue";
import {onMounted, ref} from "vue";
import {Toast} from "tdesign-mobile-vue";
import {useRequest} from "@/utils/request";
import moment from "moment";
const request = useRequest()
const actList = ref([])
const wonderfulMomentList = ref([])
function navigateTo(url) {
uni.navigateTo({
@@ -74,8 +123,39 @@ function navigateTo(url) {
})
}
function getActivity() {
request.post('/platform/activity/manage/getActivity').then(res=>{
if(res.code === 0){
actList.value = res.data
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
function getWonderfulMoment() {
request.post('/platform/activity/wonderfulMoment/getWonderfulMoment').then(res=>{
if(res.code === 0){
wonderfulMomentList.value = res.data
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
function handleWonderfulMoment(row) {
request.post('/platform/activity/wonderfulMoment/handleWonderfulMoment/' + row.id).then(res=>{
if(res.code === 0){
getWonderfulMoment()
navigateTo('/pages/activity/wonderfulMoment/index?id=' + row.id)
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
onMounted(() => {
console.log('...........')
getActivity()
getWonderfulMoment()
uni.showToast({
title: '欢迎使用',
icon: 'none',
@@ -87,6 +167,9 @@ onMounted(() => {
</script>
<style lang="less" scoped>
uni-page-body {
height: auto;
}
// 头部区域样式
.header {
position: relative;
@@ -272,4 +355,27 @@ onMounted(() => {
.activity-time {
margin-right: 15px;
}
.moment-image {
width: 180px;
height: 160px;
margin-right: 8px;
}
.moment-item {
width: 100%;
display: flex;
margin-bottom: 16px;
}
.moment-title {
font-weight: bold;
}
.moment-content {
display: flex;
width: 100%;
justify-content: space-between;
flex-direction: column;
}
.moment-sub-content {
font-size: 12px;
color: grey;
}
</style>