1361 lines
47 KiB
Vue
1361 lines
47 KiB
Vue
<template>
|
||
<section class="content">
|
||
<div class="box box-primary">
|
||
<div class="box-body">
|
||
<section class="content-header">
|
||
<h1 id="itemTitle"></h1>
|
||
</section>
|
||
<section class="content">
|
||
<div id="table"></div>
|
||
<div id="toolbar">
|
||
<div class="col-sm-12">
|
||
<label for="erbanNo"
|
||
class="col-sm-1 control-label">平台号:</label>
|
||
<div class="col-sm-2">
|
||
<input type="text"
|
||
name="erbanNo"
|
||
id="erbanNo"
|
||
placeholder="请输入平台号"
|
||
class="form-control">
|
||
</div>
|
||
|
||
<label for="sort"
|
||
class="col-sm-1 control-label">排序:</label>
|
||
<div class="col-sm-2">
|
||
<select name="sort"
|
||
id="sort"
|
||
class="form-control">
|
||
<option value="0">默认</option>
|
||
<option value="1">创建时间</option>
|
||
</select>
|
||
</div>
|
||
|
||
<label for="roomPermitType"
|
||
class="col-sm-1 control-label">房间类型:</label>
|
||
<div class="col-sm-2">
|
||
<select name="roomPermitType"
|
||
id="roomPermitType"
|
||
class="form-control">
|
||
<option value="0"></option>
|
||
<option value="1">牌照房</option>
|
||
<option value="2">非牌照房</option>
|
||
<option value="4">个播房</option>
|
||
</select>
|
||
</div>
|
||
|
||
<label for="partitionId"
|
||
class="col-sm-1 control-label">地区:</label>
|
||
<div class="col-sm-2">
|
||
<select name="partitionId"
|
||
id="partitionId"
|
||
class="form-control"></select>
|
||
</div>
|
||
</div>
|
||
|
||
<button id="btnSearch"
|
||
class="btn btn-sm btn-primary">查询</button>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<div class="modal fade"
|
||
id="robotModal"
|
||
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">x</span></button>
|
||
<h4 class="modal-title"
|
||
id="robotModalLabel">机器人管理</h4>
|
||
<h5 id="robotUsingNum">当前房间机器人配置数量:</h5>
|
||
<h5 id="robotOnlineNum">当前房间机器人在线数量:</h5>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form id="editRobot"
|
||
class="form-horizontal">
|
||
人数: <input type="text"
|
||
name="count"
|
||
id="addRobotCount" /><span style="color: red;">(人数不能超过100)</span>
|
||
<input type="hidden"
|
||
name="uid"
|
||
id="addRobotUid" />
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button"
|
||
class="btn btn-primary"
|
||
id="robot-sync">同步房间机器人</button>
|
||
<button type="button"
|
||
class="btn btn-primary"
|
||
id="robot-save">新增</button>
|
||
<button type="button"
|
||
class="btn btn-primary"
|
||
id="robot-remove">移除</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal fade"
|
||
id="roomTypeModal"
|
||
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">x</span></button>
|
||
<h4 class="modal-title"
|
||
id="roomTypeModalLabel">房间类型管理</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form id="roomType"
|
||
class="form-horizontal">
|
||
房间类型:
|
||
<select id="permitType"
|
||
name="permitType"
|
||
class="form-control"
|
||
data-btn-class="btn-warning">
|
||
<option value="1">牌照房</option>
|
||
<option value="2">普通房</option>
|
||
<option value="4">个播房</option>
|
||
</select>
|
||
<input type="hidden"
|
||
name="uid"
|
||
id="roomTypeUid" />
|
||
</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="room-type-update">保存</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal fade"
|
||
id="editModal"
|
||
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">x</span></button>
|
||
<h4 class="modal-title"
|
||
id="editModalLabel">修改房间信息</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form id="editRoom"
|
||
class="form-horizontal">
|
||
<input type="hidden"
|
||
name="uid"
|
||
id="uid">
|
||
<div class="form-group">
|
||
<label for="tag"
|
||
class="col-sm-3 control-label">标签:</label>
|
||
<div class="col-sm-8 control-label">
|
||
<select name="tag"
|
||
id="tag"
|
||
class="col-sm-5">
|
||
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group"
|
||
id="close_single_sort">
|
||
<label for="sortId"
|
||
class="col-sm-3 control-label">房间分类:</label>
|
||
<div class="col-sm-8 control-label">
|
||
<select name="sortId"
|
||
id="sortId"
|
||
class="col-sm-5">
|
||
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">角标图:</label>
|
||
<div class="col-sm-8">
|
||
<img src=""
|
||
id="addImgUrl"
|
||
style="width:70px;height:20px;"
|
||
alt="">
|
||
<input type="file"
|
||
id="addUploadFile"
|
||
name="uploadBadge"
|
||
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
|
||
<button class="btn btn-success"
|
||
type="button"
|
||
id="uploadBtn">上传</button>
|
||
<input type="hidden"
|
||
id="badge"
|
||
name="badge"
|
||
class="form-control" />
|
||
<a href="javascript:void(0)"
|
||
id="removeBadge">下角标</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">头像:</label>
|
||
<div class="col-sm-8">
|
||
<img src=""
|
||
id="addAvatarImg"
|
||
style="width:60px;height:90px"
|
||
alt="">
|
||
<input type="file"
|
||
id="addAvatar"
|
||
name="uploadAvatar"
|
||
accept="image/gif,image/jpeg,image/jpg,image/png">
|
||
<button class="btn btn-success"
|
||
type="button"
|
||
id="uploadAvatar">上传</button>
|
||
<input type="hidden"
|
||
id="avatar"
|
||
name="avatar"
|
||
class="form-control" />
|
||
<a href="javascript:void(0)"
|
||
id="removeAvatar">去除头像</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">房间背景图:</label>
|
||
<div class="col-sm-8">
|
||
<img src=""
|
||
id="addBackPic"
|
||
style="width:60px;height:90px"
|
||
alt="">
|
||
<input type="file"
|
||
id="addBackground"
|
||
name="uploadBackground"
|
||
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
|
||
<button class="btn btn-success"
|
||
type="button"
|
||
id="uploadBtn2">上传</button>
|
||
<input type="hidden"
|
||
id="backPic"
|
||
name="backPic"
|
||
class="form-control" />
|
||
<a href="javascript:void(0)"
|
||
id="removeBackground">去除背景</a>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <div class="form-group">
|
||
<label class="col-sm-3 control-label">是否有龙珠游戏:</label>
|
||
<div class="col-sm-8">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="hasDragonGame"
|
||
value="0" />否</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="hasDragonGame"
|
||
value="1" />是</label>
|
||
</div>
|
||
</div> -->
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">是否开启纯净模式:</label>
|
||
<div class="col-sm-8">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="isPureMode"
|
||
value="0" />否</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="isPureMode"
|
||
value="1" />是</label>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <div class="form-group"
|
||
id="close_box_group">
|
||
<label class="col-sm-3 control-label">是否关闭转盘入口:</label>
|
||
<div class="col-sm-8">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="closeBox"
|
||
value="0" />否</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="closeBox"
|
||
value="1" />是</label>
|
||
</div>
|
||
</div> -->
|
||
<!-- <div class="form-group">
|
||
<label class="col-sm-3 control-label">是否有KTV权限:</label>
|
||
<div class="col-sm-8">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="hasKTVPriv"
|
||
value="0" />否</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="hasKTVPriv"
|
||
value="1" />是</label>
|
||
</div>
|
||
</div> -->
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">是否有相亲房权限:</label>
|
||
<div class="col-sm-8">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="hasBlindDateRoomPri"
|
||
value="0" />否</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="hasBlindDateRoomPri"
|
||
value="1" />是</label>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <div class="form-group"
|
||
id="close_recommend">
|
||
<label class="col-sm-3 control-label">是否设置为卡片推荐位:</label>
|
||
<div class="col-sm-8">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="recommendStatus"
|
||
value="0" />否</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="recommendStatus"
|
||
value="1" />是</label>
|
||
</div>
|
||
</div> -->
|
||
</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="save">保存</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal fade"
|
||
id="editRoomTitleModal"
|
||
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">x</span></button>
|
||
<h4 class="modal-title"
|
||
id="editRoomTitleModalLabel">修改房间标题</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form id="editRoomTitleForm"
|
||
class="form-horizontal">
|
||
<input type="hidden"
|
||
name="uid"
|
||
id="editRoomTitleUid">
|
||
<input type="hidden"
|
||
name="erbanId"
|
||
id="erbanId">
|
||
<div class="form-group">
|
||
<label for="titleInput"
|
||
class="col-sm-2 control-label">标题:</label>
|
||
<div class="col-sm-10">
|
||
<input type="text"
|
||
class="form-control validate[required]"
|
||
name="title"
|
||
id="titleInput">
|
||
<button class="btn btn-warning pull-left"
|
||
type="button"
|
||
id="default_title">恢复默认</button>
|
||
</div>
|
||
<div class="col-sm-10">
|
||
<div id="msgDiv"
|
||
style="color: #ee0101;float: right">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="modal-roomDesc"
|
||
class="col-sm-2 control-label">公告标题:</label>
|
||
<div class="col-sm-10">
|
||
<input type="text"
|
||
class="form-control"
|
||
name="roomDesc"
|
||
id="modal-roomDesc"
|
||
placeholder="公告标题仅限输入15字">
|
||
<button class="clear-content"
|
||
id="clear-roomDesc"
|
||
type="button">清空</button>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="modal-roomDesc"
|
||
class="col-sm-2 control-label">公告内容:</label>
|
||
<div class="col-sm-10">
|
||
<textarea type=""
|
||
class="form-control"
|
||
name="introduction"
|
||
id="modal-introduction"
|
||
placeholder="公告内容仅限输入300字"></textarea>
|
||
<button class="clear-content"
|
||
id="clear-introduction"
|
||
type="button">清空</button>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">是否发送通知:</label>
|
||
<div class="col-sm-9">
|
||
<label class="radio-inline"><input type="radio"
|
||
name="sendMsg"
|
||
id="needSend"
|
||
value="1"
|
||
checked>是</label>
|
||
<label class="radio-inline"><input type="radio"
|
||
name="sendMsg"
|
||
id="notSend"
|
||
value="0">否</label>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label"> </label>
|
||
<div class="col-sm-9"
|
||
id="msgContentDiv">
|
||
<textarea type="text"
|
||
class="form-control"
|
||
name="msgContent"
|
||
id="msgContent"
|
||
maxlength="100"
|
||
placeholder="请填写通知书内容,100字符内"></textarea>
|
||
</div>
|
||
|
||
</div>
|
||
</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="saveRoomTitle">保存</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import TableHelper from '@/utils/bootstrap-table-helper';
|
||
import { getPartitionInfoList } from '@/api/partition/partitionInfo';
|
||
import { buildSelectOption } from '@/utils/system-helper';
|
||
|
||
export default {
|
||
name: "RoomSearchAdminView",
|
||
setup () {
|
||
return {};
|
||
},
|
||
created () {
|
||
this.$nextTick(function () {
|
||
this.initPartition();
|
||
this.initData();
|
||
});
|
||
},
|
||
methods: {
|
||
initData () {
|
||
$(function () {
|
||
//选择select时触发
|
||
$("#sendDays").change(function () {
|
||
var val = $(this).val();
|
||
if (val == "999") {
|
||
$('.sortId').show();
|
||
} else {
|
||
$('.sortId').hide();
|
||
$('.sortId input').val('');
|
||
}
|
||
});
|
||
|
||
$('#table').bootstrapTable('destroy');
|
||
getRoomTag();
|
||
getSingleRoomSort();
|
||
$('#table').bootstrapTable({
|
||
cache: false,
|
||
striped: true,
|
||
showRefresh: false,
|
||
pageSize: 10,
|
||
pagination: true,
|
||
pageList: [10, 20, 30, 50],
|
||
sidePagination: "server", //表示服务端请求
|
||
//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
|
||
//设置为limit可以获取limit, offset, search, sort, order
|
||
queryParamsType: "undefined",
|
||
queryParams: function queryParams (params) { //设置查询参数
|
||
var param = {
|
||
pageSize: params.pageSize,
|
||
pageNumber: params.pageNumber,
|
||
sort: $('#sort').val(),
|
||
roomPermitType: $('#roomPermitType').val(),
|
||
erbanNo: $('#erbanNo').val(),
|
||
partitionId: $('#partitionId').val(),
|
||
};
|
||
return param;
|
||
},
|
||
uniqueId: 'erbanNo',
|
||
toolbar: '#toolbar',
|
||
url: '/admin/roomAdmin/getAll',
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
console.log("load success");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.log("load fail");
|
||
},
|
||
columns: [
|
||
{ field: 'room.uid', title: 'Uid', align: 'center', valign: 'middle' },
|
||
{ field: 'erbanNo', title: '平台号', align: 'center', valign: 'middle' },
|
||
{ field: 'room.title', title: '标题', align: 'center', valign: 'middle' },
|
||
{ field: 'partitionDesc', title: '地区', align: 'center', valign: 'middle' },
|
||
{
|
||
field: 'room.avatar',
|
||
title: '房间头像',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if ('' == val || undefined == val || null == val) {
|
||
return '';
|
||
}
|
||
return "<img src='" + val + "' width='40' height='40'>"
|
||
+ (row.isReview ? "<br>审核中" : "");
|
||
}
|
||
},
|
||
{ field: 'room.roomPwd', title: '房间密码', align: 'center', valign: 'middle' },
|
||
{ field: 'room.roomTag', title: '房间标签', align: 'center', valign: 'middle' },
|
||
{
|
||
field: 'room.badge',
|
||
title: '角标',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (val, row, index) {
|
||
if (val) {
|
||
return "<img src='" + val + "' width='60' height='20'>";
|
||
} else {
|
||
return '-';
|
||
}
|
||
|
||
}
|
||
},
|
||
{
|
||
field: 'room.type',
|
||
title: '房间类型',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '5%',
|
||
formatter: function (val, row, index) {
|
||
switch (val) {
|
||
case 3:
|
||
return '普通房间';
|
||
case 6:
|
||
return '个播房间';
|
||
case 7:
|
||
return '游戏房间';
|
||
case 8:
|
||
return '聚会房间';
|
||
case 9:
|
||
return '狂欢房间';
|
||
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: 'room.backPic',
|
||
title: '房间背景',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (val) {
|
||
return "<img src='" + val + "' width='60' height='100'>";
|
||
} else {
|
||
return '-';
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: 'room.isPermitRoom',
|
||
title: '牌照类型',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (val, row, index) {
|
||
switch (val) {
|
||
case 1:
|
||
return '牌照房';
|
||
|
||
case 2:
|
||
return '非牌照房';
|
||
|
||
case 4:
|
||
return '个播房';
|
||
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: 'room.createTime',
|
||
title: '创建时间',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '10%',
|
||
formatter: function (val, row, index) {
|
||
if (val) {
|
||
var date = new Date(val);
|
||
return date.format("yyyy-MM-dd hh:mm:ss");
|
||
} else {
|
||
return '-';
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: 'room.canShow',
|
||
title: '展示状态',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (val, row, index) {
|
||
if (val) {
|
||
return '展示';
|
||
} else {
|
||
return '不展示';
|
||
}
|
||
}
|
||
},
|
||
// {
|
||
// field: 'room.hasDragonGame',
|
||
// title: '龙珠游戏',
|
||
// align: 'center',
|
||
// valign: 'middle',
|
||
// formatter: function (val, row, index) {
|
||
// if (val) {
|
||
// return '有';
|
||
// } else {
|
||
// return '没有';
|
||
// }
|
||
// }
|
||
// },
|
||
// {
|
||
// field: 'room.hasKTVPriv',
|
||
// title: 'KTV权限',
|
||
// align: 'center',
|
||
// valign: 'middle',
|
||
// formatter: function (val, row, index) {
|
||
// if (val) {
|
||
// return '有';
|
||
// } else {
|
||
// return '没有';
|
||
// }
|
||
// }
|
||
// },
|
||
{
|
||
field: 'room.canOpenBlindDate',
|
||
title: '相亲房权限',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (val, row, index) {
|
||
if (val) {
|
||
return '有';
|
||
} else {
|
||
return '没有';
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: 'tmp',
|
||
title: '操作',
|
||
align: 'center',
|
||
width: '12%',
|
||
valign: 'middle',
|
||
formatter: function (val, row, index) {
|
||
var key = row.erbanNo;
|
||
var canShow = row.room.canShow;
|
||
var str = "<button class='btn btn-sm btn-success opt-edit' style='margin-right: 4px;' data-id=" + key + ">编辑</button>";
|
||
if (canShow) {
|
||
str += "<button class='btn btn-sm btn-warning opt-show' data-id=" + key + ">不显示</button>";
|
||
} else {
|
||
str += "<button class='btn btn-sm btn-success opt-show' data-id=" + key + ">显示</button>";
|
||
}
|
||
str += "<button class='btn btn-sm btn-success opt-set-room' data-id=" + key + ">设为房间类型</button>";
|
||
str += "<button class='btn btn-sm btn-success opt-set-room-title' data-id=" + key + ">设置房间标题公告</button>";
|
||
str += "<button class='btn btn-sm btn-success opt-add-robot' data-id=" + key + ">机器人管理</button>";
|
||
str += "<button class='btn btn-sm btn-success opt-update-onlinenum' data-id=" + key + ">同步房间人数</button>";
|
||
return str;
|
||
}
|
||
}
|
||
|
||
]
|
||
})
|
||
|
||
$("#table").on('click', '.opt-set-room', function () {
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined' || !erbanNo) {
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
$("#roomTypeUid").val(data.room.uid);
|
||
$('#permitType').val(data.room.isPermitRoom);
|
||
$("#roomTypeModal").modal('show');
|
||
});
|
||
|
||
$('#clear-roomDesc').on('click', function () {
|
||
$('#modal-roomDesc').val('');
|
||
})
|
||
|
||
$('#clear-introduction').on('click', function () {
|
||
$('#modal-introduction').val('');
|
||
})
|
||
|
||
|
||
$('#table').on('click', '.opt-add-robot', function () {
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined' || !erbanNo) {
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
$("#addRobotUid").val(data.room.uid);
|
||
$("#addRobotCount").val('');
|
||
$("#robotModal").modal('show');
|
||
// 查询房间机器人配置数量和在线数量
|
||
getRoomRobotNum();
|
||
getOnlineRobotNum();
|
||
})
|
||
|
||
$('#robot-save').on('click', function () {
|
||
if ($('#editRobot').validationEngine('validate')) {
|
||
if ($("#addRobotCount").val() > 100) {
|
||
alert('人数不能超过100');
|
||
return;
|
||
}
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/addRobot',
|
||
dataType: 'json',
|
||
data: {
|
||
uid: $('#addRobotUid').val(),
|
||
count: $('#addRobotCount').val()
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#robotModal").modal('hide');
|
||
$("#tipMsg").text("保存成功");
|
||
$("#tipModal").modal('show');
|
||
} else {
|
||
$("#tipMsg").text("保存失败,错误码:" + res.code + res.message);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
}
|
||
})
|
||
|
||
// 同步机器人
|
||
$('#robot-sync').on('click', function () {
|
||
$.ajax({
|
||
type: 'get',
|
||
url: '/admin/roomAdmin/syncRobot',
|
||
dataType: 'json',
|
||
data: {
|
||
uid: $('#addRobotUid').val(),
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#robotModal").modal('hide');
|
||
$("#tipMsg").text("同步成功");
|
||
$("#tipModal").modal('show');
|
||
} else {
|
||
$("#tipMsg").text("同步失败,错误码:" + res.code + res.message);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
})
|
||
|
||
$("#room-type-update").on('click', function () {
|
||
if ($('#roomPermitType').validationEngine('validate')) {
|
||
let roomUid = $('#roomTypeUid').val();
|
||
let permitType = $('#permitType').val();
|
||
let roomType = 3;
|
||
//牌照房
|
||
if (permitType == 1) {
|
||
|
||
// 普通房
|
||
} else if (permitType == 2) {
|
||
|
||
// 个播房
|
||
} else if (permitType == 4) {
|
||
roomType = 6;
|
||
}
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/resetRoom',
|
||
dataType: 'json',
|
||
data: {
|
||
uid: roomUid,
|
||
roomType: roomType,
|
||
permitType: permitType,
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#roomTypeModal").modal('hide');
|
||
$("#tipMsg").text("保存成功");
|
||
$("#tipModal").modal('show');
|
||
TableHelper.doRefresh("#table");
|
||
} else {
|
||
$("#tipMsg").text("保存失败,错误码:" + res.code + ",错误信息:" + res.message);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
}
|
||
});
|
||
|
||
$('#robot-remove').on('click', function () {
|
||
if ($('#editRobot').validationEngine('validate')) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/removeRobot',
|
||
dataType: 'json',
|
||
data: {
|
||
uid: $('#addRobotUid').val(),
|
||
count: $('#addRobotCount').val()
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#robotModal").modal('hide');
|
||
$("#tipMsg").text("保存成功");
|
||
$("#tipModal").modal('show');
|
||
} else {
|
||
$("#tipMsg").text("保存失败,错误码:" + res.code);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
}
|
||
})
|
||
|
||
$('#table').on('click', '.opt-edit', function () {
|
||
cleanModal();
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined' || !erbanNo) {
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/single/room/sort/getSingRoomSortRecommend',
|
||
dataType: 'json',
|
||
data: {
|
||
roomUid: data.room.uid,
|
||
},
|
||
success: function (res) {
|
||
var recommendStatus = parseNum(res)
|
||
console.log("recommendStatus", recommendStatus)
|
||
$("input:radio[name='recommendStatus']")[recommendStatus].checked = true;
|
||
}
|
||
})
|
||
// 仅个播房展示
|
||
if (data.room.isPermitRoom == 4) {
|
||
$('#close_recommend').show();
|
||
$('#close_single_sort').show();
|
||
} else {
|
||
$('#close_recommend').hide();
|
||
$('#close_single_sort').hide();
|
||
}
|
||
|
||
//纯净模式隐藏砸蛋设置
|
||
if (data.room.isPureMode) {
|
||
$('#close_box_group').hide();
|
||
} else {
|
||
$('#close_box_group').show();
|
||
}
|
||
$('#uid').val(data.room.uid);
|
||
if (data.room.tagId) {
|
||
$('#tag').val(data.room.tagId);
|
||
} else {
|
||
$('#tag').val(8);
|
||
}
|
||
if (data.room.singleRoomSortId) {
|
||
$('#sortId').val(data.room.singleRoomSortId);
|
||
} else {
|
||
$('#sortId').val(999);
|
||
}
|
||
if (data.room.badge) {
|
||
$('#badge').val(data.room.badge);
|
||
$('#addImgUrl').attr('src', data.room.badge);
|
||
}
|
||
if (data.room.avatar) {
|
||
$('#avatar').val(data.room.avatar);
|
||
$('#addAvatarImg').attr('src', data.room.avatar);
|
||
}
|
||
if (data.room.backPic) {
|
||
$('#backPic').val(data.room.backPic);
|
||
$('#addBackPic').attr('src', data.room.backPic);
|
||
}
|
||
//var hasDragonGame = parseNum(data.room.hasDragonGame);
|
||
//$("input:radio[name='hasDragonGame']")[hasDragonGame].checked = true;
|
||
|
||
var isPureMode = parseNum(data.room.isPureMode);
|
||
console.log("isPureMode", isPureMode)
|
||
$("input:radio[name='isPureMode']")[isPureMode].checked = true;
|
||
|
||
//var closeBox = parseNum(data.room.closeBox);
|
||
//$("input:radio[name='closeBox']")[closeBox].checked = true;
|
||
|
||
//var hasKTVPriv = parseNum(data.room.hasKTVPriv);
|
||
//$("input:radio[name='hasKTVPriv']")[hasKTVPriv].checked = true;
|
||
|
||
var hasBlindDateRoomPri = parseNum(data.room.canOpenBlindDate);
|
||
$("input:radio[name='hasBlindDateRoomPri']")[hasBlindDateRoomPri].checked = true;
|
||
|
||
$('#editModal').modal('show');
|
||
})
|
||
|
||
function parseNum (val) {
|
||
if (val == undefined || val == 'false' || val == 0) {
|
||
return 0;
|
||
}
|
||
else {
|
||
return 1;
|
||
}
|
||
}
|
||
|
||
$('#table').on('click', '.opt-show', function () {
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined' || !erbanNo) {
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
var status = (data.room.canShow) ? 0 : 1;
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/changeRoomStatus',
|
||
data: {
|
||
status: status,
|
||
uid: data.room.uid
|
||
},
|
||
dataType: 'json',
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#tipMsg").text("修改状态成功");
|
||
$("#tipModal").modal('show');
|
||
TableHelper.doRefresh("#table");
|
||
} else {
|
||
$("#tipMsg").text("修改失败,错误码:" + res.code);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
});
|
||
|
||
$("#table").on("click", '.opt-update-onlinenum', function () {
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined') {
|
||
$("#tipMsg").text("参数有误");
|
||
$("#tipModal").modal('show');
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
if (confirm("你确认同步吗?")) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/roomOnlineNum/update',
|
||
data: {
|
||
uid: data.room.uid
|
||
},
|
||
dataType: 'json',
|
||
success: function (json) {
|
||
if (json.success == 'true') {
|
||
$("#tipMsg").text("同步成功");
|
||
$("#tipModal").modal('show');
|
||
//TableHelper.doRefresh("#table");
|
||
} else {
|
||
$("#tipMsg").text("同步失败,错误码:" + json.msg);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
|
||
$("#table").on('click', '.opt-set-new-room', function () {
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined' || !erbanNo) {
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/resetNewRoom',
|
||
data: {
|
||
uid: data.room.uid
|
||
},
|
||
dataType: 'json',
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#tipMsg").text("修改状态成功");
|
||
$("#tipModal").modal('show');
|
||
TableHelper.doRefresh("#table");
|
||
} else {
|
||
$("#tipMsg").text("修改失败,错误码:" + res.code);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
});
|
||
$('#btnSearch').on('click', function () {
|
||
TableHelper.doRefresh('#table');
|
||
})
|
||
$('#uploadBtn').on('click', function () {
|
||
var options = {
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/uploadBadge',
|
||
dataType: 'json',
|
||
success: function (json) {
|
||
if (json.path) {
|
||
$('#badge').val(json.path);
|
||
$('#addImgUrl').attr("src", json.path);
|
||
console.log(json.path);
|
||
} else {
|
||
$("#tipMsg").text(json.msg);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
}
|
||
$("#editRoom").ajaxSubmit(options);
|
||
})
|
||
$('#uploadBtn2').on('click', function () {
|
||
var options = {
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/uploadBackground',
|
||
dataType: 'json',
|
||
success: function (json) {
|
||
if (json.path) {
|
||
$('#backPic').val(json.path);
|
||
$('#addBackPic').attr("src", json.path);
|
||
console.log(json.path);
|
||
} else {
|
||
$("#tipMsg").text(json.msg);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
}
|
||
$("#editRoom").ajaxSubmit(options);
|
||
})
|
||
$('#uploadAvatar').on('click', function () {
|
||
var options = {
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/uploadAvatar',
|
||
dataType: 'json',
|
||
success: function (json) {
|
||
if (json.path) {
|
||
$('#avatar').val(json.path);
|
||
$('#addAvatarImg').attr("src", json.path);
|
||
console.log(json.path);
|
||
} else {
|
||
$("#tipMsg").text(json.msg);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
}
|
||
$("#editRoom").ajaxSubmit(options);
|
||
})
|
||
$('#save').on('click', function () {
|
||
if ($('#editRoom').validationEngine('validate')) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/saveRoom',
|
||
dataType: 'json',
|
||
data: {
|
||
uid: $('#uid').val(),
|
||
tagId: $('#tag').val(),
|
||
singleRoomSortId: $('#sortId').val(),
|
||
badge: $('#badge').val(),
|
||
avatar: $('#avatar').val(),
|
||
backPic: $('#backPic').val(),
|
||
//hasDragonGame: $("input[name='hasDragonGame']:checked").val(),
|
||
isPureMode: $("input[name='isPureMode']:checked").val(),
|
||
//hasKTVPriv: $("input[name='hasKTVPriv']:checked").val(),
|
||
hasBlindDateRoomPri: $("input[name='hasBlindDateRoomPri']:checked").val(),
|
||
//closeBox: $("input[name='closeBox']:checked").val(),
|
||
//recommendStatus: $("input[name='recommendStatus']:checked").val(),
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#editModal").modal('hide');
|
||
$("#tipMsg").text("保存成功");
|
||
$("#tipModal").modal('show');
|
||
TableHelper.doRefresh("#table");
|
||
} else {
|
||
$("#tipMsg").text("保存失败,错误码:" + res.code);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
}
|
||
})
|
||
$('#removeBadge').on('click', function () {
|
||
$('#addImgUrl').attr('src', '');
|
||
$('#addUploadFile').val('');
|
||
$('#badge').val('');
|
||
})
|
||
$('#removeAvatar').on('click', function () {
|
||
$('#addAvatarImg').attr('src', '');
|
||
$('#avatar').val('');
|
||
$('#addAvatar').val('');
|
||
})
|
||
$('#removeBackground').on('click', function () {
|
||
$('#addBackPic').attr('src', '');
|
||
$('#backPic').val('');
|
||
$('#addBackground').val('');
|
||
})
|
||
function cleanModal () {
|
||
$('#uid').val('');
|
||
$('#tag').val('');
|
||
$('#sortId').val('');
|
||
$('#badge').val('');
|
||
$('#addUploadFile').val('');
|
||
$('#addImgUrl').attr('src', '');
|
||
$('#addBackPic').attr('src', '');
|
||
$('#backPic').val('');
|
||
$('#addBackground').val('');
|
||
}
|
||
function getRoomTag () {
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: '/admin/roomAdmin/getRoomTags',
|
||
dataType: 'json',
|
||
success: function (res) {
|
||
var data = res.data;
|
||
var $select = $('#editModal #tag');
|
||
for (var i = 0; i < data.length; i++) {
|
||
var $option = $('<option />');
|
||
$option.html(data[i].name);
|
||
$option.attr('value', data[i].id);
|
||
$select.append($option);
|
||
}
|
||
$select.append($('<option value="">其他</option>'));
|
||
}
|
||
})
|
||
}
|
||
function getSingleRoomSort () {
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: '/admin/single/room/sort/sortList',
|
||
dataType: 'json',
|
||
success: function (res) {
|
||
var data = res.data;
|
||
var $select = $('#editModal #sortId');
|
||
for (var i = 0; i < data.length; i++) {
|
||
var $option = $('<option />');
|
||
$option.html(data[i].sortName);
|
||
$option.attr('value', data[i].id);
|
||
$select.append($option);
|
||
}
|
||
$select.append($('<option value="">推荐(默认)</option>'));
|
||
}
|
||
})
|
||
}
|
||
|
||
$('input[name="sendMsg"]').change(function () {
|
||
if ($("#needSend").is(":checked")) {
|
||
$('#msgContentDiv').show();
|
||
} else if ($("#notSend").is(":checked")) {
|
||
$('#msgContentDiv').hide();
|
||
}
|
||
});
|
||
})
|
||
|
||
$('#table').on('click', '.opt-set-room-title', function () {
|
||
$("#erbanId").val($(this).data('id'));
|
||
$('#editRoomTitleUid').val('');
|
||
$('#titleInput').val('');
|
||
var erbanNo = $(this).data('id');
|
||
if (erbanNo == 'undefined' || !erbanNo) {
|
||
return;
|
||
}
|
||
var data = $('#table').bootstrapTable('getRowByUniqueId', erbanNo);
|
||
$('#editRoomTitleUid').val(data.room.uid);
|
||
$('#titleInput').val(data.room.title);
|
||
$('#modal-roomDesc').val(data.room.roomDesc);
|
||
$('#modal-introduction').val(data.room.introduction);
|
||
$("#needSend").prop("checked", true);
|
||
$('#msgContent').val('');
|
||
$('#msgContentDiv').show();
|
||
|
||
$('#editRoomTitleModal').modal('show');
|
||
})
|
||
|
||
$("#saveRoomTitle").on('click', function () {
|
||
if ($('#modal-roomDesc').val().length > 15) {
|
||
$("#tipMsg").text("公告标题仅限输入15字");
|
||
$("#tipModal").modal('show');
|
||
return;
|
||
}
|
||
if ($('#modal-introduction').val().length > 300) {
|
||
$("#tipMsg").text("公告内容仅限输入300字");
|
||
$("#tipModal").modal('show');
|
||
return;
|
||
}
|
||
var sendMsg = $('input[name="sendMsg"]:checked').val();
|
||
if (sendMsg == 1 && !$("#msgContent").val()) {
|
||
$("#tipMsg").text("请填写通知内容");
|
||
$("#tipModal").modal('show');
|
||
return;
|
||
}
|
||
|
||
if ($('#editRoomTitleForm').validationEngine('validate')) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: '/admin/roomAdmin/resetRoomTitle',
|
||
dataType: 'json',
|
||
data: {
|
||
uid: $('#editRoomTitleUid').val(),
|
||
title: $('#titleInput').val(),
|
||
roomDesc: $('#modal-roomDesc').val(),
|
||
introduction: $('#modal-introduction').val(),
|
||
msg: $('#msgContent').val(),
|
||
sendMsg: sendMsg
|
||
},
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#editRoomTitleModal").modal('hide');
|
||
$("#tipMsg").text("保存成功");
|
||
$("#tipModal").modal('show');
|
||
TableHelper.doRefresh("#table");
|
||
} else {
|
||
$("#tipMsg").text("保存失败," + res.message);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
}
|
||
})
|
||
}
|
||
});
|
||
$("#titleInput").bind('input propertychange', function () {
|
||
if ($('#titleInput').val().length > 15) {
|
||
$('#msgDiv').html("不能超过15个字");
|
||
} else {
|
||
$('#msgDiv').html("");
|
||
}
|
||
|
||
});
|
||
|
||
$("input[name=isPureMode]").click(function () {
|
||
switch ($(this).val()) {
|
||
case "0":
|
||
$('#close_box_group').show();
|
||
break;
|
||
case "1":
|
||
$('#close_box_group').hide();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
});
|
||
$('#default_title').on('click', function () {
|
||
var erbanNo = $("#erbanId").val();
|
||
|
||
$.ajax({
|
||
type: "post",
|
||
url: "/admin/roomAdmin/getDefaultRoomTitle",
|
||
data: {
|
||
erbanNo: erbanNo
|
||
},
|
||
dataType: 'json',
|
||
success: function (res) {
|
||
if (res.code == 200) {
|
||
$("#titleInput").val(res.data);
|
||
}
|
||
}
|
||
})
|
||
})
|
||
},
|
||
initPartition () {
|
||
getPartitionInfoList().then(res => {
|
||
let data = res.data;
|
||
buildSelectOption(
|
||
"#partitionId",
|
||
null,
|
||
[{
|
||
value: '',
|
||
text: '全部',
|
||
}].concat(data.map((v) => {
|
||
return {
|
||
value: v.id,
|
||
text: v.desc,
|
||
};
|
||
}))
|
||
);
|
||
});
|
||
},
|
||
},
|
||
|
||
};
|
||
|
||
// 通过接口获取所有房间配置机器人数量
|
||
function getRoomRobotNum () {
|
||
$.ajax({
|
||
url: "/admin/roomAdmin/roomRobotNum", //后台controller中的请求路径
|
||
type: 'GET',
|
||
data: {
|
||
uid: $('#addRobotUid').val(),
|
||
},
|
||
datatype: 'json',
|
||
success: function (res) {
|
||
console.log(res);
|
||
if (res) {
|
||
$("#robotUsingNum").html('当前房间机器人配置数量:' + res.data);
|
||
}
|
||
},
|
||
error: function () {
|
||
alert('查询房间机器人配置数量出错');
|
||
}
|
||
});
|
||
}
|
||
|
||
// 通过接口获取房间在线机器人数量
|
||
function getOnlineRobotNum () {
|
||
$.ajax({
|
||
url: "/admin/roomAdmin/countRobot", //后台controller中的请求路径
|
||
type: 'GET',
|
||
data: {
|
||
uid: $('#addRobotUid').val(),
|
||
},
|
||
datatype: 'json',
|
||
success: function (res) {
|
||
console.log(res);
|
||
if (res) {
|
||
$("#robotOnlineNum").html('当前房间机器人在线数量:' + res.data);
|
||
}
|
||
},
|
||
error: function () {
|
||
alert('查询房间在线机器人数量出错');
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
#removeBadge {
|
||
margin-left: 10px;
|
||
}
|
||
</style> |