From e689c750f4390575ff619c212573be2f12e64618 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Thu, 23 Jan 2025 11:33:11 +0800
Subject: [PATCH] refactor(mall): 重构小程序定时任务获取 access_token 方式 - 移除 XcxProperties 类的使用 - 使用 @Value 注解直接注入小程序 appid 和 secret - 优化代码结构,提高可读性和维护性
---
src/main/resources/templates/febs/views/modules/activity/list.html | 111 ++++++++++++++++++++++++++++---------------------------
1 files changed, 57 insertions(+), 54 deletions(-)
diff --git a/src/main/resources/templates/febs/views/modules/activity/list.html b/src/main/resources/templates/febs/views/modules/activity/list.html
index 5e42bc8..0a1b66a 100644
--- a/src/main/resources/templates/febs/views/modules/activity/list.html
+++ b/src/main/resources/templates/febs/views/modules/activity/list.html
@@ -1,4 +1,4 @@
-<div class="layui-fluid layui-anim febs-anim" id="febs-activity" lay-title="首页活动">
+<div class="layui-fluid layui-anim febs-anim" id="febs-activity" lay-title="活动列表">
<div class="layui-row febs-container">
<div class="layui-col-md12">
<div class="layui-card">
@@ -28,18 +28,12 @@
</div>
</form>
<table lay-filter="activityTable" lay-data="{id: 'activityTable'}"></table>
- <style type="text/css">
- .layui-table-cell{
- text-align:center;
- height: auto;
- white-space: nowrap; /*文本不会换行,在同一行显示*/
- overflow: hidden; /*超出隐藏*/
- text-overflow: ellipsis; /*省略号显示*/
- }
- .layui-table img{
- max-width:100px
- }
- </style>
+<!-- <style type="text/css">-->
+<!-- ::-webkit-scrollbar {-->
+<!-- height: 20px !important;-->
+<!-- background-color: #f4f4f4;-->
+<!-- }-->
+<!-- </style>-->
</div>
</div>
</div>
@@ -56,6 +50,8 @@
<script type="text/html" id="activityStateSwitch">
{{# if(d.state === 1) { }}
<input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="activityStateSwitch">
+ {{# } else if(d.state === 2) { }}
+ <input type="checkbox" value={{d.id}} lay-text="进行中|关闭" checked lay-skin="switch" lay-filter="activityStateSwitch">
{{# } else { }}
<input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="activityStateSwitch">
{{# } }}
@@ -97,17 +93,7 @@
table.on('tool(activityTable)', function (obj) {
var data = obj.data,
layEvent = obj.event;
- if (layEvent === 'closeAct') {
- febs.modal.confirm('关闭', '确认关闭该活动?', function () {
- closeAct(data.id);
- });
- }
- if (layEvent === 'startAct') {
- febs.modal.confirm('开启', '确认开启该活动?', function () {
- startAct(data.id);
- });
- }
- if (layEvent === 'delAct') {
+ if (layEvent === 'activityDeleteEvent') {
febs.modal.confirm('删除', '确认删除该活动?', function () {
delAct(data.id);
});
@@ -140,21 +126,15 @@
});
}
});
- function closeAct(id) {
- febs.get(ctx + 'admin/act/closeMallAct/' + id, null, function () {
- febs.alert.success('关闭成功');
- $query.click();
- });
- }
- function startAct(id) {
- febs.get(ctx + 'admin/act/startMallAct/' + id, null, function () {
- febs.alert.success('开启成功');
+ function changeState(id,state) {
+ febs.get(ctx + 'admin/activity/changeState/' + id+'/' + state, null, function (data) {
+ febs.alert.success(data.message);
$query.click();
});
}
function delAct(id) {
- febs.get(ctx + 'admin/act/delMallAct/' + id, null, function () {
- febs.alert.success('删除成功');
+ febs.get(ctx + 'admin/activity/delActivity/' + id, null, function (data) {
+ febs.alert.success(data.message);
$query.click();
});
}
@@ -173,7 +153,7 @@
});
$add.on('click', function () {
- febs.modal.open('新增活动', 'modules/act/actAddNew/', {
+ febs.modal.open('新增活动', 'modules/activity/add/', {
btn: ['提交', '取消'],
area:['100%','100%'],
yes: function (index, layero) {
@@ -204,30 +184,53 @@
{field: 'startTime', title: '开始时间', minWidth: 150,align:'left'},
{field: 'endTime', title: '结束时间', minWidth: 150,align:'left'},
{field: 'state', title: '状态', templet: '#activityStateSwitch', minWidth: 130,align:'center'},
- {field: 'actRemark', title: '活动说明', minWidth: 150,align:'left'},
- {title: '操作', toolbar: '#activityOption', minWidth: 200},
- ]],
- done: function(res, curr, count) {
- // 遍历每一行数据
- res.data.forEach(function(item, index) {
- // 根据状态值控制按钮显示
- if (item.state === 2) {
- // 如果状态为1,显示
- $('#commissionOption' + index).show();
- } else {
- // 否则,隐藏
- $('#commissionOption' + index).hide();
- }
- });
- }
+ ]]
});
}
+ // function initTable() {
+ // tableIns = febs.table.init({
+ // elem: $view.find('table'),
+ // id: 'activityTable',
+ // url: ctx + 'admin/activity/list',
+ // cols: [[
+ // {field: 'name', title: '名称', minWidth: 150,align:'left'},
+ // {field: 'code', title: '编码', minWidth: 150,align:'left'},
+ // {field: 'maxImage', title: '大图',
+ // templet: function (d) {
+ // return '<a lay-event="seeImgThumb"><img id="seeImgThumb'+d.id+'" src="'+d.maxImage+'" alt=""></a>';
+ // }, minWidth: 150,align:'center'},
+ // {field: 'minImage', title: '小图',
+ // templet: function (d) {
+ // return '<a lay-event="seeImgThumb"><img id="seeImgThumb'+d.id+'" src="'+d.minImage+'" alt=""></a>';
+ // }, minWidth: 150,align:'center'},
+ // {field: 'startTime', title: '开始时间', minWidth: 150,align:'left'},
+ // {field: 'endTime', title: '结束时间', minWidth: 150,align:'left'},
+ // {field: 'state', title: '状态', templet: '#activityStateSwitch', minWidth: 130,align:'center'},
+ // {field: 'actRemark', title: '活动说明', minWidth: 150,align:'left'},
+ // {title: '操作', toolbar: '#activityOption', minWidth: 200},
+ // ]],
+ // done: function(res, curr, count) {
+ // // 遍历每一行数据
+ // res.data.forEach(function(item, index) {
+ // // 根据状态值控制按钮显示
+ // if (item.state === 2) {
+ // // 如果状态为1,显示
+ // $('#activityOption' + index).show();
+ // } else {
+ // // 否则,隐藏
+ // $('#activityOption' + index).hide();
+ // }
+ // });
+ // }
+ // });
+ // }
+
form.on('switch(activityStateSwitch)', function (data) {
if (data.elem.checked) {
- startAct(data.value);
+ changeState(data.value,1);
} else {
- closeAct(data.value);
+ changeState(data.value,0);
}
})
--
Gitblit v1.9.1