记得上下班打卡 | git大法好,push需谨慎

Commit 50070970 authored by wangyifan's avatar wangyifan

admin后台 增加查询 占位查询接口

parent 568cbd03
...@@ -156,6 +156,27 @@ public class GoblinArtistTopicAdminController extends BaseController { ...@@ -156,6 +156,27 @@ public class GoblinArtistTopicAdminController extends BaseController {
return toAjax(topicAdminService.setRecommend(topicId, position)); return toAjax(topicAdminService.setRecommend(topicId, position));
} }
/** 查询推荐位当前占用专题(用于替换确认提示) */
@RequiresPermissions("goblin:artist:topic:recommend")
@GetMapping("recommendOwner")
@ResponseBody
public AjaxResult recommendOwner(@RequestParam int position) {
if (position <= 0) {
return AjaxResult.success();
}
GoblinArtistTopic owner = topicAdminService.getOne(new LambdaQueryWrapper<GoblinArtistTopic>()
.eq(GoblinArtistTopic::getRecommendPosition, position)
.eq(GoblinArtistTopic::getDelFlg, 0)
.last("limit 1"));
if (owner == null) {
return AjaxResult.success();
}
Map<String, Object> data = new LinkedHashMap<>();
data.put("topicId", owner.getTopicId());
data.put("topicName", owner.getTopicName());
return AjaxResult.success(data);
}
@Log(title = "艺人专题:上下架", businessType = BusinessType.UPDATE) @Log(title = "艺人专题:上下架", businessType = BusinessType.UPDATE)
@RequiresPermissions("goblin:artist:topic:status") @RequiresPermissions("goblin:artist:topic:status")
@PostMapping("status") @PostMapping("status")
......
...@@ -112,6 +112,15 @@ ...@@ -112,6 +112,15 @@
} }
.rec-menu a:hover { background: #f5f7fa; color: #1890ff; } .rec-menu a:hover { background: #f5f7fa; color: #1890ff; }
.rec-menu a.active { color: #1890ff; font-weight: bold; } .rec-menu a.active { color: #1890ff; font-weight: bold; }
/* 推荐位替换确认弹框 */
.replace-confirm { padding: 24px 28px 18px; }
.replace-confirm p { margin: 0 0 24px; font-size: 13px; color: #333; line-height: 1.9; }
.replace-btns { text-align: right; }
.replace-btns a { display: inline-block; margin-left: 10px; padding: 8px 20px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.replace-btns .btn-cancel { background: #e8e8e8; color: #333; }
.replace-btns .btn-cancel:hover { background: #dcdcdc; }
.replace-btns .btn-ok { background: #1890ff; color: #fff; }
.replace-btns .btn-ok:hover { background: #40a9ff; }
</style> </style>
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
...@@ -255,10 +264,56 @@ ...@@ -255,10 +264,56 @@
function setRecommend(topicId, position) { function setRecommend(topicId, position) {
closeRecMenu(); closeRecMenu();
if (position == 0) {
doSetRecommend(topicId, position);
return;
}
// 先查推荐位是否被其他专题占用,占用则弹替换确认框
$.get(prefix + "/recommendOwner", { position: position }, function(res) {
var owner = res.data;
if (owner && owner.topicId != topicId) {
openReplaceConfirm(topicId, position, owner.topicName);
} else {
doSetRecommend(topicId, position);
}
});
}
function openReplaceConfirm(topicId, position, ownerName) {
var html = '<div class="replace-confirm">'
+ '<p>推荐' + position + '号位已被「' + ownerName + '」占用,是否替换为当前专题使用该推荐位?如果替换,原推荐位专题将更新为无推荐位,按排序规则展示。</p>'
+ '<div class="replace-btns"><a class="btn-cancel">取消</a><a class="btn-ok">确认替换</a></div></div>';
var idx = layer.open({
type: 1,
title: '推荐位替换确认',
shade: 0.3,
area: ['440px'],
content: html,
success: function(layero) {
layero.find('.btn-cancel').on('click', function() { layer.close(idx); });
layero.find('.btn-ok').on('click', function() {
layer.close(idx);
doSetRecommend(topicId, position);
});
}
});
}
function doSetRecommend(topicId, position) {
$.modal.loading(position == 0 ? "正在取消推荐..." : "正在设置推荐" + position + "号位...");
$.ajax({ $.ajax({
type: 'post', url: prefix + "/recommend", type: 'post', url: prefix + "/recommend",
data: { topicId: topicId, position: position }, data: { topicId: topicId, position: position },
success: function() { $.table.refresh(); } success: function(res) {
$.modal.closeLoading();
if (res.code == 0) {
$.modal.msgSuccess(position == 0 ? "已取消推荐" : "推荐" + position + "号位设置成功");
$.table.refresh();
} else {
$.modal.alertError(res.msg);
}
},
error: function() { $.modal.closeLoading(); }
}); });
} }
</script> </script>
......
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