版本功能

This commit is contained in:
dragon
2024-11-15 10:19:22 +08:00
parent ed618598c2
commit 559fea9300

View File

@@ -8,36 +8,39 @@
</section>
<div id="toolbar">
<div class="col-sm-12">
<label for="erbanNo"
class="col-sm-2 control-label">房主平台号:</label>
<label for="erbanNo" class="col-sm-2 control-label"
>房主平台号:</label
>
<div class="col-sm-2">
<input type="text"
class="form-control"
name="erbanNo"
id="erbanNo"
placeholder="">
<input
type="text"
class="form-control"
name="erbanNo"
id="erbanNo"
placeholder=""
/>
</div>
<label for="roomTitle"
class="col-sm-2 control-label">房间标题:</label>
<label for="roomTitle" class="col-sm-2 control-label"
>房间标题:</label
>
<div class="col-sm-2">
<input type="text"
class="form-control"
name="roomTitle"
id="roomTitle"
placeholder="">
<input
type="text"
class="form-control"
name="roomTitle"
id="roomTitle"
placeholder=""
/>
</div>
<label for="partitionId"
class="col-sm-1 control-label">地区:</label>
<label for="partitionId" class="col-sm-1 control-label"
>地区:</label
>
<div class="col-sm-2">
<select name="partitionId"
id="partitionId"
class="form-control">
<option value="4"
selected>华语区</option>
<select name="partitionId" id="partitionId" class="form-control">
<option value="4" selected>华语区</option>
</select>
</div>
<button id="btnSearch"
class="btn btn-default">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
</div>
@@ -46,44 +49,40 @@
<!-- .content -->
<div id="table"></div>
</div>
</section>
<!-- 编辑弹框 -->
<div class="modal fade"
id="roomTabHomeModal"
tabindex="-1"
role="dialog"
aria-labelledby="modalLabel">
<div class="modal-dialog"
role="document">
<div
class="modal fade"
id="roomTabHomeModal"
tabindex="-1"
role="dialog"
aria-labelledby="modalLabel"
>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title"
id="modalLabel">编辑</h4>
<h4 class="modal-title" id="modalLabel">编辑</h4>
</div>
<div class="modal-body">
<form class="form-horizontal"
id="addForm">
<input type="hidden"
name="id"
id="id" />
<input type="hidden"
name="roomUid"
id="roomUid" />
<form class="form-horizontal" id="addForm">
<input type="hidden" name="id" id="id" />
<input type="hidden" name="roomUid" id="roomUid" />
<div class="form-group">
<label for="modal_isTop"
class="col-sm-3 control-label">是否置顶<font color="red">*</font></label>
<label for="modal_isTop" class="col-sm-3 control-label"
>是否置顶<font color="red">*</font></label
>
<div class="col-sm-9">
<select name="isTop"
id="modal_isTop"
class="form-control">
<select name="isTop" id="modal_isTop" class="form-control">
<option value=""></option>
<option value="1"></option>
<option value="0"></option>
@@ -91,45 +90,69 @@
</div>
</div>
<div class="form-group">
<label for="modal_seq"
class="col-sm-3 control-label">置顶排序<font color="red">*</font>:</label>
<label for="modal_type" class="col-sm-3 control-label"
>房间类型<font color="red">*</font></label
>
<div class="col-sm-9">
<input type="text"
class="form-control"
name="seq"
id="modal_seq"
placeholder="数字小的排前面,必填">
<select name="type" id="modal_type" class="form-control">
<option value="1">客服房间</option>
<option value="2">热门房间</option>
</select>
</div>
</div>
<div class="form-group">
<label for="modal_topStart"
class="col-sm-3 control-label">置顶开始时间<font color="red">*</font>
:</label>
<label for="modal_seq" class="col-sm-3 control-label"
>置顶排序调整为位置排序<font color="red">*</font>:</label
>
<div class="col-sm-9">
<input type="text"
class="input-sm form-control datetime"
name="topStart"
id="modal_topStart">
<input
type="number"
class="form-control"
name="seq"
id="modal_seq"
min="1"
max="5"
placeholder="填入的数字=在首页的第几个位置"
oninput="this.value = Math.min(Math.max(this.value, 1), 5)"
/>
</div>
</div>
<div class="form-group">
<label for="modal_topEnd"
class="col-sm-3 control-label">置顶结束时间<font color="red">*</font>
:</label>
<label for="modal_topStart" class="col-sm-3 control-label"
>置顶开始时间<font color="red">*</font> :</label
>
<div class="col-sm-9">
<input type="text"
class="input-sm form-control datetime"
name="topEnd"
id="modal_topEnd">
<input
type="text"
class="input-sm form-control datetime"
name="topStart"
id="modal_topStart"
/>
</div>
</div>
<div class="form-group">
<label for="modal_isShow"
class="col-sm-3 control-label">是否在App首页展示<font color="red">*</font></label>
<label for="modal_topEnd" class="col-sm-3 control-label"
>置顶结束时间<font color="red">*</font> :</label
>
<div class="col-sm-9">
<select name="isShow"
id="modal_isShow"
class="form-control validate[required]">
<input
type="text"
class="input-sm form-control datetime"
name="topEnd"
id="modal_topEnd"
/>
</div>
</div>
<div class="form-group">
<label for="modal_isShow" class="col-sm-3 control-label"
>是否在App首页展示<font color="red">*</font></label
>
<div class="col-sm-9">
<select
name="isShow"
id="modal_isShow"
class="form-control validate[required]"
>
<option value="1"></option>
<option value="0"></option>
</select>
@@ -138,24 +161,23 @@
</form>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">关闭</button>
<button type="button"
class="btn btn-primary"
id="btnConfirm">确定</button>
<button type="button" class="btn btn-default" data-dismiss="modal">
关闭
</button>
<button type="button" class="btn btn-primary" id="btnConfirm">
确定
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { formatTime } from '@/utils/maintainer';
import { getPartitionInfoList } from '@/api/partition/partitionInfo';
import { buildSelectOption } from '@/utils/system-helper';
import TableHelper from "@/utils/bootstrap-table-helper";
import { formatTime } from "@/utils/maintainer";
import { getPartitionInfoList } from "@/api/partition/partitionInfo";
import { buildSelectOption } from "@/utils/system-helper";
// tab类型选择变化查询
/*function selectOnTabChange(obj){
@@ -164,115 +186,173 @@ import { buildSelectOption } from '@/utils/system-helper';
}*/
export default {
name: "RoomTabHomeView",
setup () {
setup() {
return {};
},
created () {
created() {
this.$nextTick(function () {
this.initPartition();
this.initData();
});
},
methods: {
initData () {
initData() {
$(function () {
$('.datetime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
$(".datetime").datetimepicker({
format: "yyyy-mm-dd hh:ii:00",
autoclose: true,
});
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
$("#table").bootstrapTable("destroy");
$("#table").bootstrapTable({
columns: [
{ field: 'erbanNo', title: '房主平台号', align: 'center', width: '5%' },
{ field: 'roomUid', title: '房主Uid', align: 'center', width: '5%' },
{ field: 'roomTitle', title: '房间标题', align: 'center', width: '8%' },
{ field: 'roomTag', title: '房间标签', align: 'center', width: '5%' },
{
field: 'isPermitRoom',
title: '房间类型',
align: 'center',
width: '5%',
field: "erbanNo",
title: "房主平台号",
align: "center",
width: "5%",
},
{
field: "roomUid",
title: "房主Uid",
align: "center",
width: "5%",
},
{
field: "roomTitle",
title: "房间标题",
align: "center",
width: "8%",
},
{
field: "roomTag",
title: "房间标签",
align: "center",
width: "5%",
},
{
field: "isPermitRoom",
title: "房间类型",
align: "center",
width: "5%",
formatter: function (val, row, index) {
let value = '';
let value = "";
if (val == 1) {
value = '牌照房';
value = "牌照房";
} else if (val == 4) {
value = '个播房';
value = "个播房";
} else {
value = '非牌照房';
value = "非牌照房";
}
return value;
}
},
},
{
field: 'avatar',
title: '图标内容',
align: 'center',
width: '5%',
field: "avatar",
title: "图标内容",
align: "center",
width: "5%",
formatter: function (val, row, index) {
return "<img src='" + val + "' width='40' height='40'>";
}
},
},
{
field: 'isTop',
title: '是否置顶',
align: 'center',
valign: 'middle',
width: '5%',
field: "isTop",
title: "是否置顶",
align: "center",
valign: "middle",
width: "5%",
formatter: function (val, row, index) {
if (val == 1) {
return '是';
return "是";
} else if (val == 0) {
return '否';
return "否";
}
return '否';
}
return "否";
},
},
{
field: 'isShow',
title: '是否在App首页展示',
align: 'center',
valign: 'middle',
width: '5%',
field: "isShow",
title: "是否在App首页展示",
align: "center",
valign: "middle",
width: "5%",
formatter: function (val, row, index) {
if (val == 1) {
return '是';
return "是";
} else if (val == 0) {
return '否';
return "否";
}
return '是';
}
return "是";
},
},
{ field: 'seq', title: '置顶排序', align: 'center', width: '5%' },
{ field: 'topStart', title: '置顶开始时间', align: 'center', valign: 'middle', width: '10%', formatter: formatTime },
{ field: 'topEnd', title: '置顶结束时间', align: 'center', valign: 'middle', width: '10%', formatter: formatTime },
{ field: "seq", title: "置顶排序", align: "center", width: "5%" },
{
field: 'isHourTop1', title: '小时榜top1', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
return val ? '是' : '否';
}
field: "topStart",
title: "置顶开始时间",
align: "center",
valign: "middle",
width: "10%",
formatter: formatTime,
},
{
field: 'isHourTop1', title: '周榜top1', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
return val ? '是' : '否';
}
field: "topEnd",
title: "置顶结束时间",
align: "center",
valign: "middle",
width: "10%",
formatter: formatTime,
},
{
field: 'micUserCount', title: '麦上人数', align: 'center', valign: 'middle', width: '10%'
},
{
field: 'onlineNum', title: '房间人数', align: 'center', valign: 'middle', width: '10%'
},
{
field: 'id',
title: '操作',
align: 'center',
width: '10%',
field: "isHourTop1",
title: "小时榜top1",
align: "center",
valign: "middle",
width: "10%",
formatter: function (val, row, index) {
return '<button id="btnEdit" name="btnEdit" class="btn btn-sm btn-success opt-edit" data-id="' + val + '" data-index="' + index + '">' +
'<i class="glyphicon glyphicon-edit"></i> 编辑</button>';
}
}
return val ? "是" : "否";
},
},
{
field: "isHourTop1",
title: "周榜top1",
align: "center",
valign: "middle",
width: "10%",
formatter: function (val, row, index) {
return val ? "是" : "否";
},
},
{
field: "micUserCount",
title: "麦上人数",
align: "center",
valign: "middle",
width: "10%",
},
{
field: "onlineNum",
title: "房间人数",
align: "center",
valign: "middle",
width: "10%",
},
{
field: "id",
title: "操作",
align: "center",
width: "10%",
formatter: function (val, row, index) {
return (
'<button id="btnEdit" name="btnEdit" class="btn btn-sm btn-success opt-edit" data-id="' +
val +
'" data-index="' +
index +
'">' +
'<i class="glyphicon glyphicon-edit"></i> 编辑</button>'
);
},
},
],
undefinedText: "",
cache: false,
@@ -281,51 +361,55 @@ export default {
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams (params) { //设置查询参数
queryParams: function queryParams(params) {
//设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#erbanNo').val(),
roomTitle: $('#roomTitle').val(),
partitionId: $('#partitionId').val(),
erbanNo: $("#erbanNo").val(),
roomTitle: $("#roomTitle").val(),
partitionId: $("#partitionId").val(),
};
console.log(param);
return param;
},
url: '/admin/roomTabHome/list',
url: "/admin/roomTabHome/list",
responseHandler: function (data) {
console.info(111, data)
console.info(111, data);
if (data.code === 200) {
return { "rows": data.data, "total": data.data.length };
return { rows: data.data, total: data.data.length };
} else {
return { "rows": [], "total": 0 };
return { rows: [], total: 0 };
}
},
toolbar: '#toolbar',
onLoadSuccess: function () { //加载成功时执行
toolbar: "#toolbar",
onLoadSuccess: function () {
//加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
onLoadError: function () {
//加载失败时执行
console.log("load fail");
}
},
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
$("#btnSearch").on("click", function () {
TableHelper.doRefresh("#table");
});
// 编辑或者新增
$("#btnConfirm").click(function () {
var id = $("#id").val();
var roomUid = $('#roomUid').val();
var roomUid = $("#roomUid").val();
var seq = $("#modal_seq").val();
var isTop = $("#modal_isTop").val();
var type = $("#modal_type").val();
var iconContent = $("#modal_iconContent").val();
var topStart = $("#modal_topStart").val();
var topEnd = $("#modal_topEnd").val();
var isShow = $('#modal_isShow').val();
if ($("#addForm").validationEngine('validate')) {
var isShow = $("#modal_isShow").val();
if ($("#addForm").validationEngine("validate")) {
$.ajax({
type: "post",
url: "/admin/roomTabHome/save",
@@ -343,34 +427,34 @@ export default {
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
$("#tipModal").modal("show");
TableHelper.doRefresh("#table");
$("#roomTabHomeModal").modal('hide');
$("#roomTabHomeModal").modal("hide");
} else {
$("#tipMsg").text("保存失败." + json.msg);
$("#tipModal").modal('show');
$("#tipModal").modal("show");
TableHelper.doRefresh("#table");
$("#roomTabHomeModal").modal('hide');
$("#roomTabHomeModal").modal("hide");
}
}
},
});
}
});
// 获取信息
$("#table").on("click", '.opt-edit', function () {
$("#table").on("click", ".opt-edit", function () {
var id = $(this).attr("data-id");
const index = $(this).data('index');
const record = TableHelper.getData('#table')[index];
const index = $(this).data("index");
const record = TableHelper.getData("#table")[index];
$("#id").val(null);
$("#modal_seq").val(0);
$("#modal_isTop").val(0);
$("#modal_topStart").val('');
$("#modal_topEnd").val('');
$("#modal_type").val(0);
$("#modal_topStart").val("");
$("#modal_topEnd").val("");
$("#modal_isShow").val(0);
$('#roomUid').val(record.roomUid);
if (id && id != 'null') {
$("#roomUid").val(record.roomUid);
if (id && id != "null") {
$.ajax({
type: "get",
url: "/admin/roomTabHome/get",
@@ -382,53 +466,53 @@ export default {
$("#id").val(id);
$("#modal_seq").val(json.seq);
$("#modal_isTop").val(json.isTop ? 1 : 0);
$("#modal_type").val(json.type);
$("#modal_topStart").val(formatTime(json.topStart));
$("#modal_topEnd").val(formatTime(json.topEnd));
$("#modal_isShow").val(json.isShow ? 1 : 0);
} else {
$("#tipMsg").text("获取菜单信息出错");
$("#tipModal").modal('show');
$("#tipModal").modal("show");
}
}
},
});
}
// 打开编辑弹窗
$("#roomTabHomeModal").modal('show');
$("#roomTabHomeModal").modal("show");
$("#modalLabel").text("编辑");
});
// 删除操作
$("#table").on("click", '.opt-remove', function () {
$("#table").on("click", ".opt-remove", function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
if (id == "undefined") {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
$("#tipModal").modal("show");
return;
}
if (confirm("你确认删除吗? \r\n 删除后不会恢复,请谨慎操作!")) {
$.ajax({
type: 'post',
type: "post",
url: "/admin/roomTabHome/delete",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
$("#tipModal").modal("show");
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败");
$("#tipModal").modal('show');
$("#tipModal").modal("show");
}
}
},
});
}
});
});
},
initPartition () {
getPartitionInfoList().then(res => {
initPartition() {
getPartitionInfoList().then((res) => {
let data = res.data;
buildSelectOption(
"#partitionId",