搬迁代码【第二版】

This commit is contained in:
liaozetao
2023-09-22 22:16:19 +08:00
parent 35b74ff7b1
commit ab162f8e22
28 changed files with 15648 additions and 0 deletions

View File

@@ -0,0 +1,562 @@
/*!
* clipboard.js v1.7.1
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
*/
!function(t) {
var define;
if ("object" == typeof exports && "undefined" != typeof module)
module.exports = t();
else if ("function" == typeof define && define.amd)
define([], t);
else {
var e;
e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this,
e.Clipboard = t()
}
}(function() {
var t, e, n;
return function t(e, n, o) {
function i(a, c) {
if (!n[a]) {
if (!e[a]) {
var l = "function" == typeof require && require;
if (!c && l)
return l(a, !0);
if (r)
return r(a, !0);
var s = new Error("Cannot find module '" + a + "'");
throw s.code = "MODULE_NOT_FOUND",
s
}
var u = n[a] = {
exports: {}
};
e[a][0].call(u.exports, function(t) {
var n = e[a][1][t];
return i(n || t)
}, u, u.exports, t, e, n, o)
}
return n[a].exports
}
for (var r = "function" == typeof require && require, a = 0; a < o.length; a++)
i(o[a]);
return i
}({
1: [function(t, e, n) {
function o(t, e) {
for (; t && t.nodeType !== i; ) {
if ("function" == typeof t.matches && t.matches(e))
return t;
t = t.parentNode
}
}
var i = 9;
if ("undefined" != typeof Element && !Element.prototype.matches) {
var r = Element.prototype;
r.matches = r.matchesSelector || r.mozMatchesSelector || r.msMatchesSelector || r.oMatchesSelector || r.webkitMatchesSelector
}
e.exports = o
}
, {}],
2: [function(t, e, n) {
function o(t, e, n, o, r) {
var a = i.apply(this, arguments);
return t.addEventListener(n, a, r),
{
destroy: function() {
t.removeEventListener(n, a, r)
}
}
}
function i(t, e, n, o) {
return function(n) {
n.delegateTarget = r(n.target, e),
n.delegateTarget && o.call(t, n)
}
}
var r = t("./closest");
e.exports = o
}
, {
"./closest": 1
}],
3: [function(t, e, n) {
n.node = function(t) {
return void 0 !== t && t instanceof HTMLElement && 1 === t.nodeType
}
,
n.nodeList = function(t) {
var e = Object.prototype.toString.call(t);
return void 0 !== t && ("[object NodeList]" === e || "[object HTMLCollection]" === e) && "length"in t && (0 === t.length || n.node(t[0]))
}
,
n.string = function(t) {
return "string" == typeof t || t instanceof String
}
,
n.fn = function(t) {
return "[object Function]" === Object.prototype.toString.call(t)
}
}
, {}],
4: [function(t, e, n) {
function o(t, e, n) {
if (!t && !e && !n)
throw new Error("Missing required arguments");
if (!c.string(e))
throw new TypeError("Second argument must be a String");
if (!c.fn(n))
throw new TypeError("Third argument must be a Function");
if (c.node(t))
return i(t, e, n);
if (c.nodeList(t))
return r(t, e, n);
if (c.string(t))
return a(t, e, n);
throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")
}
function i(t, e, n) {
return t.addEventListener(e, n),
{
destroy: function() {
t.removeEventListener(e, n)
}
}
}
function r(t, e, n) {
return Array.prototype.forEach.call(t, function(t) {
t.addEventListener(e, n)
}),
{
destroy: function() {
Array.prototype.forEach.call(t, function(t) {
t.removeEventListener(e, n)
})
}
}
}
function a(t, e, n) {
return l(document.body, t, e, n)
}
var c = t("./is")
, l = t("delegate");
e.exports = o
}
, {
"./is": 3,
delegate: 2
}],
5: [function(t, e, n) {
function o(t) {
var e;
if ("SELECT" === t.nodeName)
t.focus(),
e = t.value;
else if ("INPUT" === t.nodeName || "TEXTAREA" === t.nodeName) {
var n = t.hasAttribute("readonly");
n || t.setAttribute("readonly", ""),
t.select(),
t.setSelectionRange(0, t.value.length),
n || t.removeAttribute("readonly"),
e = t.value
} else {
t.hasAttribute("contenteditable") && t.focus();
var o = window.getSelection()
, i = document.createRange();
i.selectNodeContents(t),
o.removeAllRanges(),
o.addRange(i),
e = o.toString()
}
return e
}
e.exports = o
}
, {}],
6: [function(t, e, n) {
function o() {}
o.prototype = {
on: function(t, e, n) {
var o = this.e || (this.e = {});
return (o[t] || (o[t] = [])).push({
fn: e,
ctx: n
}),
this
},
once: function(t, e, n) {
function o() {
i.off(t, o),
e.apply(n, arguments)
}
var i = this;
return o._ = e,
this.on(t, o, n)
},
emit: function(t) {
var e = [].slice.call(arguments, 1)
, n = ((this.e || (this.e = {}))[t] || []).slice()
, o = 0
, i = n.length;
for (o; o < i; o++)
n[o].fn.apply(n[o].ctx, e);
return this
},
off: function(t, e) {
var n = this.e || (this.e = {})
, o = n[t]
, i = [];
if (o && e)
for (var r = 0, a = o.length; r < a; r++)
o[r].fn !== e && o[r].fn._ !== e && i.push(o[r]);
return i.length ? n[t] = i : delete n[t],
this
}
},
e.exports = o
}
, {}],
7: [function(e, n, o) {
!function(i, r) {
if ("function" == typeof t && t.amd)
t(["module", "select"], r);
else if (void 0 !== o)
r(n, e("select"));
else {
var a = {
exports: {}
};
r(a, i.select),
i.clipboardAction = a.exports
}
}(this, function(t, e) {
"use strict";
function n(t) {
return t && t.__esModule ? t : {
default: t
}
}
function o(t, e) {
if (!(t instanceof e))
throw new TypeError("Cannot call a class as a function")
}
var i = n(e)
, r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
return typeof t
}
: function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
}
, a = function() {
function t(t, e) {
for (var n = 0; n < e.length; n++) {
var o = e[n];
o.enumerable = o.enumerable || !1,
o.configurable = !0,
"value"in o && (o.writable = !0),
Object.defineProperty(t, o.key, o)
}
}
return function(e, n, o) {
return n && t(e.prototype, n),
o && t(e, o),
e
}
}()
, c = function() {
function t(e) {
o(this, t),
this.resolveOptions(e),
this.initSelection()
}
return a(t, [{
key: "resolveOptions",
value: function t() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
this.action = e.action,
this.container = e.container,
this.emitter = e.emitter,
this.target = e.target,
this.text = e.text,
this.trigger = e.trigger,
this.selectedText = ""
}
}, {
key: "initSelection",
value: function t() {
this.text ? this.selectFake() : this.target && this.selectTarget()
}
}, {
key: "selectFake",
value: function t() {
var e = this
, n = "rtl" == document.documentElement.getAttribute("dir");
this.removeFake(),
this.fakeHandlerCallback = function() {
return e.removeFake()
}
,
this.fakeHandler = this.container.addEventListener("click", this.fakeHandlerCallback) || !0,
this.fakeElem = document.createElement("textarea"),
this.fakeElem.style.fontSize = "12pt",
this.fakeElem.style.border = "0",
this.fakeElem.style.padding = "0",
this.fakeElem.style.margin = "0",
this.fakeElem.style.position = "absolute",
this.fakeElem.style[n ? "right" : "left"] = "-9999px";
var o = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = o + "px",
this.fakeElem.setAttribute("readonly", ""),
this.fakeElem.value = this.text,
this.container.appendChild(this.fakeElem),
this.selectedText = (0,
i.default)(this.fakeElem),
this.copyText()
}
}, {
key: "removeFake",
value: function t() {
this.fakeHandler && (this.container.removeEventListener("click", this.fakeHandlerCallback),
this.fakeHandler = null,
this.fakeHandlerCallback = null),
this.fakeElem && (this.container.removeChild(this.fakeElem),
this.fakeElem = null)
}
}, {
key: "selectTarget",
value: function t() {
this.selectedText = (0,
i.default)(this.target),
this.copyText()
}
}, {
key: "copyText",
value: function t() {
var e = void 0;
try {
e = document.execCommand(this.action)
} catch (t) {
e = !1
}
this.handleResult(e)
}
}, {
key: "handleResult",
value: function t(e) {
this.emitter.emit(e ? "success" : "error", {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
})
}
}, {
key: "clearSelection",
value: function t() {
this.trigger && this.trigger.focus(),
window.getSelection().removeAllRanges()
}
}, {
key: "destroy",
value: function t() {
this.removeFake()
}
}, {
key: "action",
set: function t() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "copy";
if (this._action = e,
"copy" !== this._action && "cut" !== this._action)
throw new Error('Invalid "action" value, use either "copy" or "cut"')
},
get: function t() {
return this._action
}
}, {
key: "target",
set: function t(e) {
if (void 0 !== e) {
if (!e || "object" !== (void 0 === e ? "undefined" : r(e)) || 1 !== e.nodeType)
throw new Error('Invalid "target" value, use a valid Element');
if ("copy" === this.action && e.hasAttribute("disabled"))
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
if ("cut" === this.action && (e.hasAttribute("readonly") || e.hasAttribute("disabled")))
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
this._target = e
}
},
get: function t() {
return this._target
}
}]),
t
}();
t.exports = c
})
}
, {
select: 5
}],
8: [function(e, n, o) {
!function(i, r) {
if ("function" == typeof t && t.amd)
t(["module", "./clipboard-action", "tiny-emitter", "good-listener"], r);
else if (void 0 !== o)
r(n, e("./clipboard-action"), e("tiny-emitter"), e("good-listener"));
else {
var a = {
exports: {}
};
r(a, i.clipboardAction, i.tinyEmitter, i.goodListener),
i.clipboard = a.exports
}
}(this, function(t, e, n, o) {
"use strict";
function i(t) {
return t && t.__esModule ? t : {
default: t
}
}
function r(t, e) {
if (!(t instanceof e))
throw new TypeError("Cannot call a class as a function")
}
function a(t, e) {
if (!t)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function c(t, e) {
if ("function" != typeof e && null !== e)
throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}),
e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
function l(t, e) {
var n = "data-clipboard-" + t;
if (e.hasAttribute(n))
return e.getAttribute(n)
}
var s = i(e)
, u = i(n)
, f = i(o)
, d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
return typeof t
}
: function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
}
, h = function() {
function t(t, e) {
for (var n = 0; n < e.length; n++) {
var o = e[n];
o.enumerable = o.enumerable || !1,
o.configurable = !0,
"value"in o && (o.writable = !0),
Object.defineProperty(t, o.key, o)
}
}
return function(e, n, o) {
return n && t(e.prototype, n),
o && t(e, o),
e
}
}()
, p = function(t) {
function e(t, n) {
r(this, e);
var o = a(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this));
return o.resolveOptions(n),
o.listenClick(t),
o
}
return c(e, t),
h(e, [{
key: "resolveOptions",
value: function t() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
this.action = "function" == typeof e.action ? e.action : this.defaultAction,
this.target = "function" == typeof e.target ? e.target : this.defaultTarget,
this.text = "function" == typeof e.text ? e.text : this.defaultText,
this.container = "object" === d(e.container) ? e.container : document.body
}
}, {
key: "listenClick",
value: function t(e) {
var n = this;
this.listener = (0,
f.default)(e, "click", function(t) {
return n.onClick(t)
})
}
}, {
key: "onClick",
value: function t(e) {
var n = e.delegateTarget || e.currentTarget;
this.clipboardAction && (this.clipboardAction = null),
this.clipboardAction = new s.default({
action: this.action(n),
target: this.target(n),
text: this.text(n),
container: this.container,
trigger: n,
emitter: this
})
}
}, {
key: "defaultAction",
value: function t(e) {
return l("action", e)
}
}, {
key: "defaultTarget",
value: function t(e) {
var n = l("target", e);
if (n)
return document.querySelector(n)
}
}, {
key: "defaultText",
value: function t(e) {
return l("text", e)
}
}, {
key: "destroy",
value: function t() {
this.listener.destroy(),
this.clipboardAction && (this.clipboardAction.destroy(),
this.clipboardAction = null)
}
}], [{
key: "isSupported",
value: function t() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ["copy", "cut"]
, n = "string" == typeof e ? [e] : e
, o = !!document.queryCommandSupported;
return n.forEach(function(t) {
o = o && !!document.queryCommandSupported(t)
}),
o
}
}]),
e
}(u.default);
t.exports = p
})
}
, {
"./clipboard-action": 7,
"good-listener": 4,
"tiny-emitter": 6
}]
}, {}, [8])(8)
});

View File

@@ -0,0 +1,330 @@
<template>
<section class="content">
<div class="box box-primary">
<section class="content-header">
<h1 id="itemTitle">游戏白名单</h1>
</section>
<section class="content">
<div id="table"></div>
<div id="toolbar">
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>&nbsp;&nbsp;&nbsp;
<!--厂商id: <input type="text" id='channelId' placeholder=''>-->
访问路径: <input type="text" id='accessUrl' placeholder=''>
<button id="btnSearch" class="btn btn-sm btn-primary" data-id=" + accessUrl + ">查询</button>
</div>
</section>
</div>
</section>
<div class="modal fade" id="actModal" 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="addModalLabel">新增白名单</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="actForm">
<input type="hidden" name="id" id="actId" value="0">
<input type="hidden" name="status" id="actStatus">
<div class="form-group">
<div class="form-group">
<label for="accessUrl" class="col-sm-3 control-label">访问路径:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="accessUrl"
id="accessUrlName" style="width:400px">
</div>
</div>
<div class="form-group">
<label for="whiteList" class="col-sm-3 control-label">白名单列表:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="whiteList"
id="whiteList" style="width:400px">
</div>
</div>
<div class="form-group">
<label for="blackList" class="col-sm-3 control-label">黑名单列表:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="blackList"
id="blackList" style="width:400px">
</div>
</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="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 class="form-horizontal" id="editForm">
<input type="hidden" name="id" id="e_id">
<input type="hidden" name="status" id="editStatus">
<!--<div class="form-group">
<label for="channelId" class="col-sm-3 control-label">厂商渠道ID:</label>
<div class="col-sm-9">
<input type="hidden" class="form-control validate[required]" name="channelId" id="e_channelId"
style="width:400px">
</div>
</div>-->
<div class="form-group">
<label for="accessUrl" class="col-sm-3 control-label">访问路径:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="accessUrl" id="e_accessUrl"
style="width:400px">
</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="edit">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="sureModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="sure">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameAccessUrlView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
initTable();
// 查询刷新
$('#btnSearch').on('click', function () {
$('#table').bootstrapTable('destroy');
initTable();
});
$('#addBtn').on('click', function () {
cleanModal();
$("#actForm")[0].reset();
$('#actModal').modal('show');
});
$('#table').on('click', '.opt-edit', function () {
var id = $(this).attr("data-id-1");
var accessUrl = $(this).attr("data-id-2");
cleanModal();
$('#e_id').val(id);
$('#e_accessUrl').val(accessUrl);
$('#editModal').modal('show');
});
$('#save').on('click', function () {
if ($('#actForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameAccessUrl/add.action",
data: $('#actForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#actModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$('#edit').on('click', function () {
if ($('#editForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameAccessUrl/update.action",
data: $('#editForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#editModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("修改失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$("#table").on("click", '.opt-del', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除吗?")) {
$.ajax({
type: 'post',
url: '/admin/gameAccessUrl/delete.action',
data: { 'id': id },
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
function cleanModal() {
$('#actForm').find('input[type=text],input[type=hidden],input[type=file]').each(function () {
$(this).val('');
})
$('#actForm').find('img').attr('src', '');
}
function initTable() {
$('#table').bootstrapTable({
columns: [
{ field: 'id', title: 'id', align: 'center', valign: 'middle', width: '10%' },
{ field: 'accessUrl', title: '访问路径', align: 'center', valign: 'middle', width: '10%' },
{ field: 'whiteList', title: '白名单列表', align: 'center', valign: 'middle', width: '10%' },
{ field: 'blackList', title: '黑民单列表', align: 'center', valign: 'middle', width: '10%' },
{
field: 'updateTime',
title: '创建时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'createTime',
title: '创建时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'tmp',
title: '操作',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
var id = row.id;
var accessUrl = row.accessUrl;
return '<button class="btn btn-sm btn-success opt-edit" data-id-1 ="' + id + ' "data-id-2="' + accessUrl + '">' + '编辑</button>' + "&nbsp;&nbsp;&nbsp;" +
"<button class='btn btn-sm btn-danger opt-del' data-id=" + id + ">删除</button>";
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
accessUrl: $("#accessUrl").val()
};
// console.log(param);
return param;
},
uniqueId: 'accessUrl',
toolbar: '#toolbar',
url: '/admin/gameAccessUrl/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
})
}
},
};
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 250px;
height: 600px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
</style>

View File

@@ -0,0 +1,794 @@
<template>
<section class="content">
<div class="box box-primary">
<section class="content-header">
<h1 id="itemTitle">游戏榜单配置</h1>
</section>
<section class="content">
<div id="table"></div>
<div id="toolbar">
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>新增
</button>&nbsp;&nbsp;&nbsp;
<!--厂商id: <input type="text" id='channelId' placeholder=''>-->
活动名称: <input type="text" id='actName' placeholder=''> &nbsp;&nbsp;&nbsp;
游戏ID: <input type="text" id='gameId' placeholder=''>
<button id="btnSearch" class="btn btn-sm btn-primary" data-id=" + word + ">查询</button>
</div>
</section>
</div>
</section>
<div class="modal fade" id="actModal" 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="addModalLabel">榜单配置新增</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="actForm">
<input type="hidden" name="id" id="actId" value="0">
<div class="form-group">
<div class="form-group">
<label for="actName" class="col-sm-3 control-label">活动名称:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="actName" id="actName1"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="gameId" class="col-sm-3 control-label">游戏ID:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="gameId" id="gameId1"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="cycleType" class="col-sm-3 control-label">统计类型:</label>
<select name="cycleType" id="cycleType" class="col-sm-2">
<option value="week">week</option>
<option value="delta">delta</option>
<!-- <option value="dayn">dayn</option>
<option value="month">month</option>-->
</select>
</div>
<div class="form-group">
<label for="winType" class="col-sm-3 control-label">胜利类型:</label>
<select name="winType" id="winType" class="col-sm-2">
<option value="1">连胜</option>
<option value="2">累计获胜</option>
<option value="3">连胜和累积获胜</option>
</select>
</div>
<div class="form-group">
<label for="rankShow" class="col-sm-3 control-label">榜单入口是否展示:</label>
<select name="rankShow" id="rankShow" class="col-sm-2">
<option value="0"></option>
<option value="1"></option>
</select>
</div>
<!--<div class="form-group">-->
<!--<label for="code" class="col-sm-3 control-label">code:</label>-->
<!--<div class="col-sm-9">-->
<!--<input type="text" class="form-control validate[required]" name="code" id="code"-->
<!--style="width:400px">-->
<!--</div>-->
<!--</div>-->
<div class="form-group">
<label for="status" class="col-sm-3 control-label">状态:</label>
<select name="status" id="status" class="col-sm-2">
<option value="0">无效</option>
<option value="1">有效</option>
</select>
</div>
<div id="addCycleTypeDiv" style="display:none">
<div class="form-group">
<label for="scriptContent" class="col-sm-3 control-label">脚本内容:</label>
<div class="col-sm-9">
<textarea id="scriptContent" name="scriptContent" style="height:150px; width:400px"
class="form-control "></textarea>
</div>
</div>
<div class="form-group">
<label for="functionName" class="col-sm-3 control-label">调用的函数:</label>
<div class="col-sm-9">
<input type="text" class="form-control " name="functionName" id="functionName"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="functionParams" class="col-sm-3 control-label">函数的参数:</label>
<div class="col-sm-9">
<input type="text" class="form-control " name="functionParams" id="functionParams"
style="width:400px">
</div>
</div>
</div>
<div class="form-group">
<label for="expireTime" class="col-sm-3 control-label">榜单过期时间:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="expireTime"
id="expireTime" style="width:400px">
</div>
</div>
<!--<div class="form-group">
<label for="cronExpression" class="col-sm-3 control-label">表达式:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="cronExpression" id="cronExpression"
style="width:400px">
</div>
</div>-->
<!-- <div class="form-group">
<label for="rankType" class="col-sm-3 control-label">榜单类型:</label>
<select name="rankType" id="rankType" class="col-sm-2">
<option value="total">总量</option>
<option value="peak">峰值</option>
<option value="incr">增量</option>
</select>
</div>-->
<div class="form-group">
<label for="showType" class="col-sm-3 control-label">展示类型(多个用逗号隔开):</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="showType" id="showType"
placeholder="1连胜 2累计获胜 3连胜和累积获胜 4闯关数/分数 5所有类型" style="width:400px">
</div>
</div>
<form class="form-horizontal">
<div class="form-group">
<label for="startTime" class="col-sm-3 control-label">活动开始时间:</label>
<div class="col-sm-8">
<input id="startTime" type="date" name="startTime"
class="form-control validate[required]">
</div>
</div>
<div class="form-group">
<label for="endTime" class="col-sm-3 control-label">活动结束时间:</label>
<div class="col-sm-8">
<input id="endTime" type="date" name="endTime"
class="form-control validate[required]">
</div>
</div>
</form>
</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="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 class="form-horizontal" id="editForm">
<input type="hidden" name="id" id="id">
<!-- <input type="hidden" name="status" id="editStatus">-->
<!--<div class="form-group">
<label for="channelId" class="col-sm-3 control-label">厂商渠道ID:</label>
<div class="col-sm-9">
<input type="hidden" class="form-control validate[required]" name="channelId" id="e_channelId"
style="width:400px">
</div>
</div>-->
<div class="form-group">
<label for="actName" class="col-sm-3 control-label">活动名称:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="actName" id="e_actName"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="gameId" class="col-sm-3 control-label">游戏ID:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="gameId" id="e_gameId"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="cycleType" class="col-sm-3 control-label">统计类型:</label>
<select name="cycleType" id="e_cycleType" class="col-sm-2">
<option value="week">week</option>
<option value="delta">delta</option>
<!-- <option value="dayn">dayn</option>
<option value="month">month</option>-->
</select>
</div>
<div class="form-group">
<label for="winType" class="col-sm-3 control-label">胜利类型:</label>
<select name="winType" id="e_winType" class="col-sm-2">
<option value="1">连胜</option>
<option value="2">累计获胜</option>
<option value="3">连胜和累积获胜</option>
</select>
</div>
<div class="form-group">
<label for="rankShow" class="col-sm-3 control-label">榜单入口是否展示:</label>
<select name="rankShow" id="e_rankShow" class="col-sm-2">
<option value="0"></option>
<option value="1"></option>
</select>
</div>
<div class="form-group">
<label for="status" class="col-sm-3 control-label">状态:</label>
<select name="status" id="e_status" class="col-sm-2">
<option value="0">无效</option>
<option value="1">有效</option>
</select>
</div>
<div id="e_CycleTypeDiv" style="display:none">
<div class="form-group">
<label for="scriptContent" class="col-sm-3 control-label">脚本内容:</label>
<div class="col-sm-9">
<textarea id="e_scriptContent" name="scriptContent" style="height:150px; width:400px"
class="form-control validate[required]"></textarea>
</div>
</div>
<div class="form-group">
<label for="functionName" class="col-sm-3 control-label">调用的函数:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="functionName"
id="e_functionName" style="width:400px">
</div>
</div>
<div class="form-group">
<label for="functionParams" class="col-sm-3 control-label">函数的参数:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="functionParams"
id="e_functionParams" style="width:400px">
</div>
</div>
</div>
<div class="form-group">
<label for="expireTime" class="col-sm-3 control-label">榜单过期时间:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="expireTime"
id="e_expireTime" style="width:400px">
</div>
</div>
<!--<div class="form-group">
<label for="cronExpression" class="col-sm-3 control-label">表达式:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="cronExpression" id="e_cronExpression"
style="width:400px">
</div>
</div>-->
<!-- <div class="form-group">
<label for="rankType" class="col-sm-3 control-label">榜单类型:</label>
<select name="rankType" id="e_rankType" class="col-sm-2">
<option value="total">总量</option>
<option value="peak">峰值</option>
<option value="incr">增量</option>
</select>
</div>-->
<div class="form-group">
<label for="showType" class="col-sm-3 control-label">展示类型(多个用逗号隔开):</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="showType" id="e_showType"
style="width:400px">
</div>
</div>
<form class="form-horizontal">
<div class="form-group">
<label for="startTime" class="col-sm-3 control-label">活动开始时间:</label>
<div class="col-sm-8">
<input id="e_startTime" type="date" name="startTime"
class="form-control validate[required]">
</div>
</div>
<div class="form-group">
<label for="endTime" class="col-sm-3 control-label">活动结束时间:</label>
<div class="col-sm-8">
<input id="e_endTime" type="date" name="endTime"
class="form-control validate[required]">
</div>
</div>
</form>
</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="edit">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="sureModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="sure">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameActivityRankView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
initTable();
// 查询刷新
$('#btnSearch').on('click', function () {
$('#table').bootstrapTable('destroy');
initTable();
});
$('#addBtn').on('click', function () {
cleanModal();
$("#actForm")[0].reset();
$('#actModal').modal('show');
});
$("#cycleType").on('change', function (e) {
var value = $(this).val();
// console.log(value);
if (value == 'delta') {
$("#addCycleTypeDiv").show();
} else {
$("#addCycleTypeDiv").hide();
}
});
$("#e_cycleType").on('change', function (e) {
var value = $(this).val();
// console.log(value);
if (value == 'delta') {
$("#e_CycleTypeDiv").show();
} else {
$("#e_CycleTypeDiv").hide();
}
});
$('#table').on('click', '.opt-edit', function () {
cleanModal($("#editForm"));
var id = $(this).attr("data-id");
$.ajax({
type: "get",
url: "/admin/gameActivityRank/getById.action",
data: { "id": id },
dataType: "json",
success: function (json) {
if (json) {
var date = json.endTime ? new Date(json.endTime).format("yyyy-MM-dd hh:mm:ss") : '';
var startDate = new Date(json.startTime).format("yyyy-MM-dd hh:mm:ss");
$('#id').val(json.id);
$('#e_actName').val(json.actName);
$('#e_gameId').val(json.gameId);
$('#e_status').val(json.status);
$('#e_scriptContent').val(json.scriptContent);
$('#e_functionName').val(json.functionName);
$('#e_functionParams').val(json.functionParams);
$('#e_expireTime').val(json.expireTime);
$('#e_cronExpression').val(json.cronExpression);
$('#e_rankType').val(json.rankType);
$('#e_cycleType').val(json.cycleType);
$('#e_winType').val(json.winType);
$('#e_rankShow').val(json.rankShow);
$('#e_showType').val(json.showType);
$('#e_endTime').val(date);
$('#e_startTime').val(startDate);
$("#editModal").modal('show');
if (json.cycleType == 'delta') {
$("#e_CycleTypeDiv").show();
} else {
$("#e_CycleTypeDiv").hide();
}
picker1.datetimepicker('setStartDate', startDate);
} else {
$("#tipMsg").text("获取信息出错");
$("#tipModal").modal('show');
}
}
});
});
$('#save').on('click', function () {
if ($('#actForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameActivityRank/add.action",
data: $('#actForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#actModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$('#edit').on('click', function () {
if ($('#editForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameActivityRank/update.action",
data: $('#editForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#editModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("修改失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
$("#table").on("click", '.opt-del', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除吗?")) {
$.ajax({
type: 'post',
url: '/admin/gameActivityRank/delete.action',
data: { 'id': id },
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
var picker1 = $("#endTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker2 = $('#startTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker3 = $('#endTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
picker3.on('changeDate', function () {
var date = $('#endTime').datetimepicker('getDate');
console.log(date);
picker2.datetimepicker('setEndDate', date);
});
picker2.on('changeDate', function () {
var date = $('#startTime').datetimepicker('getDate');
picker3.datetimepicker('setStartDate', date);
});
picker3 = $("#e_endTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker4 = $('#e_startTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker5 = $('#e_endTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
picker5.on('changeDate', function () {
var date = $('#e_endTime').datetimepicker('getDate');
console.log(date);
picker4.datetimepicker('setEndDate', date);
});
picker4.on('changeDate', function () {
var date = $('#e_startTime').datetimepicker('getDate');
picker5.datetimepicker('setStartDate', date);
});
$('#table').on('mouseenter', 'img', function (e) {
console.log($(this), e.clientX);
var src = $(this).attr('src');
$('#imgMask img').attr('src', src);
$('#imgMask').show();
$('#imgMask').css({
top: e.clientY + 20,
left: e.clientX + 20
})
})
$('#table').on('mouseleave', 'img', function (e) {
console.log('移出');
$('#imgMask').hide();
})
function cleanModal() {
$('#actForm').find('input[type=text],input[type=hidden],input[type=file]').each(function () {
$(this).val('');
})
$('#actForm').find('img').attr('src', '');
}
function initTable() {
$('#table').bootstrapTable({
columns: [
/*{field: 'tmp1', title: 'id', align: 'center', checkbox: true, width: '5%'},*/
{ field: 'actName', title: '活动名称', align: 'center', valign: 'middle', width: '10%' },
{ field: 'gameId', title: '游戏ID', align: 'center', valign: 'middle', width: '10%' },
{
field: 'status',
title: '状态',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
console.log(val);
switch (val) {
case 0:
return '无效';
case 1:
return '有效';
}
}
},
/* {field: 'scriptContent', title: '脚本内容', align: 'center', valign: 'middle', width: '10%'},*/
{ field: 'functionName', title: '调用的函数', align: 'center', valign: 'middle', width: '10%' },
/*{
field: 'rankType',
title: '榜单类型',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
console.log(val);
switch (val) {
case 'total':
return '总量';
break;
case 'peak':
return '峰值';
break;
case 'incr':
return '增量';
break;
}
}
},*/
{ field: 'cycleType', title: '统计类型', align: 'center', valign: 'middle', width: '10%' },
{
field: 'winType',
title: '胜利类型',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
console.log(val);
switch (val) {
case 1:
return '连胜';
case 2:
return '累计获胜';
case 3:
return '连胜和累积获胜';
}
}
},
{ field: 'expireTime', title: '榜单的过期时间', align: 'center', valign: 'middle', width: '10%' },
{
field: 'rankShow',
title: '榜单入口是否展示',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
console.log(val);
switch (val) {
case 0:
return '否';
case 1:
return '是';
}
}
},
{
field: 'showType',
title: '展示类型',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
console.log(val);
switch (val) {
case "1":
return '连胜';
case "2":
return '累计获胜';
case "3":
return '连胜和累积获胜';
case "4":
return '闯关数或者分数';
case "5":
return '所有类型';
}
}
},
{
field: 'startTime',
title: '活动开始时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'endTime',
title: '活动结束时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'createTime',
title: '创建时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'tmp',
title: '操作',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
var id = row.id;
return '<button class="btn btn-sm btn-success opt-edit" data-id="' + id + '">' +
'编辑</button>' + "&nbsp;&nbsp;&nbsp;" +
"<button class='btn btn-sm btn-danger opt-del' data-id=" + id + ">删除</button>";
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
actName: $("#actName").val(),
gameId: $("#gameId").val()
};
// console.log(param);
return param;
},
uniqueId: 'id',
toolbar: '#toolbar',
url: '/admin/gameActivityRank/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
})
}
},
};
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 250px;
height: 600px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
</style>

View File

@@ -0,0 +1,357 @@
<template>
<section class="content">
<div class="box box-primary">
<section class="content-header">
<h1 id="itemTitle">游戏厂商</h1>
</section>
<section class="content">
<div id="table"></div>
<div id="toolbar">
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>&nbsp;&nbsp;&nbsp;
<!--厂商id: <input type="text" id='channelId' placeholder=''>-->
厂商名: <input type="text" id='channelName' placeholder=''>
<button id="btnSearch" class="btn btn-sm btn-primary" data-id=" + word + ">查询</button>
</div>
</section>
</div>
</section>
<div class="modal fade" id="actModal" 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="addModalLabel">游戏厂商新增</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="actForm">
<input type="hidden" name="id" id="actId" value="0">
<input type="hidden" name="status" id="actStatus">
<div class="form-group">
<div class="form-group">
<label for="channelId" class="col-sm-3 control-label">厂商渠道ID:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="channelId"
id="channelId" style="width:400px">
</div>
</div>
<div class="form-group">
<label for="domain" class="col-sm-3 control-label">IP或者域名:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="domain" id="domain"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="channelName" class="col-sm-3 control-label">厂商名:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="channelName" id="name"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="appKey" class="col-sm-3 control-label">appKey:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="appKey" id="appKey"
style="width:400px">
</div>
</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="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 class="form-horizontal" id="editForm">
<input type="hidden" name="channelId" id="e_channelId">
<input type="hidden" name="status" id="editStatus">
<!--<div class="form-group">
<label for="channelId" class="col-sm-3 control-label">厂商渠道ID:</label>
<div class="col-sm-9">
<input type="hidden" class="form-control validate[required]" name="channelId" id="e_channelId"
style="width:400px">
</div>
</div>-->
<div class="form-group">
<label for="domain" class="col-sm-3 control-label">IP或者域名:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="domain" id="e_domain"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="channelName" class="col-sm-3 control-label">厂商名:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="channelName"
id="e_channelName" style="width:400px">
</div>
</div>
<div class="form-group">
<label for="appKey" class="col-sm-3 control-label">appKey:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="appKey" id="e_appKey"
disabled="disabled" style="width:400px">
</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="edit">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="sureModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="sure">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameChannelView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
initTable();
// 查询刷新
$('#btnSearch').on('click', function () {
$('#table').bootstrapTable('destroy');
initTable();
});
$('#addBtn').on('click', function () {
cleanModal();
$("#actForm")[0].reset();
$('#actModal').modal('show');
});
$('#table').on('click', '.opt-edit', function () {
var channelId = $(this).attr("data-id-1");
var channelName = $(this).attr("data-id-2");
var domain = $(this).attr("data-id-3");
var appKey = $(this).attr("data-id-4");
cleanModal();
$('#e_channelId').val(channelId);
$('#e_channelName').val(channelName);
$('#e_appKey').val(appKey);
$('#e_domain').val(domain);
$('#editModal').modal('show');
});
$('#save').on('click', function () {
if ($('#actForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gamechannel/add.action",
data: $('#actForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#actModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$('#edit').on('click', function () {
if ($('#editForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gamechannel/update.action",
data: $('#editForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#editModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("修改失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$("#table").on("click", '.opt-del', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除吗?")) {
$.ajax({
type: 'post',
url: '/admin/gamechannel/delete.action',
data: { 'channelId': id },
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
$('#table').on('mouseenter', 'img', function (e) {
console.log($(this), e.clientX);
var src = $(this).attr('src');
$('#imgMask img').attr('src', src);
$('#imgMask').show();
$('#imgMask').css({
top: e.clientY + 20,
left: e.clientX + 20
})
})
$('#table').on('mouseleave', 'img', function (e) {
console.log('移出');
$('#imgMask').hide();
})
function cleanModal() {
$('#actForm').find('input[type=text],input[type=hidden],input[type=file]').each(function () {
$(this).val('');
})
$('#actForm').find('img').attr('src', '');
}
function initTable() {
$('#table').bootstrapTable({
columns: [
{ field: 'tmp1', title: '厂商渠道Id', align: 'center', checkbox: true, width: '5%' },
{ field: 'channelId', title: '厂商渠道Id', align: 'center', valign: 'middle', width: '10%' },
{ field: 'domain', title: 'IP或者域名', align: 'center', valign: 'middle', width: '10%' },
{ field: 'channelName', title: '厂商名', align: 'center', valign: 'middle', width: '10%' },
{ field: 'appKey', title: 'appKey', align: 'center', valign: 'middle', width: '10%' },
{
field: 'createTime',
title: '创建时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'tmp',
title: '操作',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
var channelId = row.channelId;
var channelName = row.channelName;
var domain = row.domain;
var appKey = row.appKey;
return '<button class="btn btn-sm btn-success opt-edit" data-id-1="' + channelId + ' "data-id-2="' + channelName + '" data-id-3="' + domain + '" data-id-4="' + appKey + '">' +
'编辑</button>' + "&nbsp;&nbsp;&nbsp;" +
"<button class='btn btn-sm btn-danger opt-del' data-id=" + channelId + ">删除</button>";
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
channelName: $("#channelName").val()
};
// console.log(param);
return param;
},
uniqueId: 'channelId',
toolbar: '#toolbar',
url: '/admin/gamechannel/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
})
}
},
};
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 250px;
height: 600px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
</style>

View File

@@ -0,0 +1,388 @@
<template>
<section class="content">
<div class="box box-primary">
<section class="content-header">
<h1 id="itemTitle">游戏表情</h1>
</section>
<section class="content">
<div id="table"></div>
<div id="toolbar">
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>&nbsp;&nbsp;&nbsp;
表情类型: <select name="type" id="searchType" class="input-m">
<option value="0">--全部--</option>
<option value="1">游戏</option>
</select>
<button id="btnSearch" class="btn btn-sm btn-primary">查询</button>
</div>
</section>
</div>
</section>
<div class="modal fade" id="actModal" 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="addModalLabel">新增</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="actForm">
<input type="hidden" name="id" id="actId" value="0">
<div class="form-group">
<div class="form-group">
<label for="faceUrl" class="col-sm-3 control-label">游戏表情:</label>
<div class="col-sm-9">
<img src="" id="faceImg" style="width:250px;height:90px;" alt="">
<input type="file" id="uploadGameFile" name="uploadGameFile"
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
<button class="btn btn-success" type="button" id="uploadGameBtn">上传</button>
<input type="hidden" class="form-control validate[required]" name="faceUrl" id="faceUrl"
style="width:400px">
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-3 control-label">类型:</label>
<select name="type" id="type" class="col-sm-2">
<option value="1">游戏</option>
</select>
</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="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 class="form-horizontal" id="editForm">
<input type="hidden" name="id" id="e_id">
<div class="form-group">
<label for="faceUrl" class="col-sm-3 control-label">游戏图标:</label>
<div class="col-sm-9">
<img src="" id="e_faceImg" style="width:90px;height:90px;" alt="">
<input type="file" id="adduploadGameFile" name="uploadGameFile"
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
<button class="btn btn-success" type="button" id="addGameUploadBtn">上传</button>
<input type="hidden" id="e_faceUrl" name="faceUrl"
class="form-control validate[required]" />
</div>
</div>
<div class="form-group">
<label for="e_type" class="col-sm-3 control-label">类型:</label>
<select name="type" id="e_type" class="col-sm-2">
<option value="1">游戏</option>
</select>
</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="edit">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="sureModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="sure">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameFaceView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
initTable();
// 查询刷新
$('#btnSearch').on('click', function () {
$('#table').bootstrapTable('destroy');
initTable();
});
$('#addBtn').on('click', function () {
cleanModal();
$("#actForm")[0].reset();
$('#actModal').modal('show');
});
$('#table').on('click', '.opt-edit', function () {
var id = $(this).attr("data-id-1");
var faceUrl = $(this).attr("data-id-2");
console.log(id);
console.log(faceUrl);
cleanModal();
$('#e_id').val(id);
$('#e_faceUrl').val(faceUrl);
$('#editModal').modal('show');
});
$('#uploadGameBtn').on('click', function () {
var options = {
type: 'post',
url: '/admin/gameFace/headimg.action',
dataType: 'json',
success: function (json) {
if (json.path) {
$('#faceUrl').val(json.path);
$('#faceImg').attr('src', json.path);
console.log(json.path);
} else {
$('#tipMsg').text(json.msg);
$('#tipModal').modal('show');
}
}
}
$('#actForm').ajaxSubmit(options);
});
$('#addGameUploadBtn').on('click', function () {
var options = {
type: 'post',
url: '/admin/gameFace/headimg.action',
dataType: 'json',
success: function (json) {
if (json.path) {
$('#e_faceUrl').val(json.path);
$('#e_faceImg').attr('src', json.path);
console.log(json.path);
} else {
$('#tipMsg').text(json.msg);
$('#tipModal').modal('show');
}
}
}
$('#editForm').ajaxSubmit(options);
});
$('#save').on('click', function () {
if ($('#actForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameFace/add.action",
data: $('#actForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#actModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$('#edit').on('click', function () {
if ($('#editForm').validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameFace/update.action",
data: $('#editForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#editModal").modal('hide');
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("修改失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
})
}
});
$("#table").on("click", '.opt-del', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除吗?")) {
$.ajax({
type: 'post',
url: '/admin/gameFace/delete.action',
data: { 'id': id },
dataType: 'json',
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败,错误码:" + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
function cleanModal() {
$('#actForm').find('input[type=text],input[type=hidden],input[type=file]').each(function () {
$(this).val('');
})
$('#actForm').find('img').attr('src', '');
}
function initTable() {
$('#table').bootstrapTable({
columns: [
{ field: 'id', title: 'id', align: 'center', valign: 'middle', width: '10%' },
{
field: 'faceUrl',
title: '游戏图标',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
return "<img src='" + val + "' width='60' height='50'>";
}
},
{
field: 'type',
title: '类型',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
console.log(val);
switch (val) {
case 1:
return '游戏';
}
}
},
{
field: 'updateTime',
title: '创建时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'createTime',
title: '创建时间',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{
field: 'tmp',
title: '操作',
align: 'center',
width: '10%',
valign: 'middle',
formatter: function (val, row, index) {
var id = row.id;
var faceUrl = row.faceUrl;
return '<button class="btn btn-sm btn-success opt-edit" data-id-1 ="' + id + ' "data-id-2="' + faceUrl + '">' + '编辑</button>' + "&nbsp;&nbsp;&nbsp;" +
"<button class='btn btn-sm btn-danger opt-del' data-id=" + id + ">删除</button>";
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
type: parseInt($("#searchType").val()),
};
console.log(param);
return param;
},
uniqueId: 'type',
toolbar: '#toolbar',
url: '/admin/gameFace/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
})
}
},
};
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 250px;
height: 600px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="table"></div>
<form id="form" action="" method="post" target="_blank">
<input type="hidden" id="exportplatformNo" name="platformNo">
<input type="hidden" id="exportBillType" name="billType">
<input type="hidden" id="exportStartTime" name="startDate">
<input type="hidden" id="exportEndTime" name="endDate">
</form>
<div id="toolbar">
平台号<input type="text" name="platformNo" id="platformNo" class="input-sm" />
账单类型<select name="billType" id="billType">
</select>
开始时间<input type="text" name="startDate" id="startDate" class="input-sm">
结束时间<input type="text" name="endDate" id="endDate" class="input-sm">
<button id="btnSearch" class="btn btn-sm btn-primary">查询</button>
<button id="btnExport" class="btn btn-sm btn-primary">导出</button>
</div>
</div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameBillRecordAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
// 所有账单类型
getObjTypes();
let tableLoaded = false;
let currParams = {};
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'nick', title: '用户昵称', align: 'center', valign: 'middle', width: '10%' },
{ field: 'platformNo', title: '平台号', align: 'center', valign: 'middle', width: '10%' },
{ field: 'objTypeDesc', title: '账单类型', align: 'center', valign: 'middle', width: '10%' },
{
field: '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: 'billTypeDesc', title: '收入支出', align: 'center', valign: 'middle', width: '10%' },
{ field: 'currencyDesc', title: '币种', align: 'center', valign: 'middle', width: '10%' },
{ field: 'amount', title: '充值币/奖励币', align: 'center', valign: 'middle', width: '5%' },
{ field: 'actualAmount', title: '金额(元)', align: 'center', valign: 'middle', width: '5%' },
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
platformNo: $('#platformNo').val(),
billType: $('#billType').val(),
startDate: $('#startDate').val(),
endDate: $('#endDate').val()
};
currParams = param;
return param;
},
uniqueId: 'code',
toolbar: '#toolbar',
url: '/admin/gameManage/billRecord/getList.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
tableLoaded = true;
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
tableLoaded = false;
}
})
$('#btnSearch').on('click', function () {
// if(!$('#platformNo').val() || !$('#startDate').val() || !$('#endDate').val()){
// $("#tipMsg").text("请输入必填的信息");
// $("#tipModal").modal('show');
// return;
// }
if ($('#startDate').val() && $('#endDate').val()) {
var dateStart = new Date($('#startDate').val().replace(/\-/g, "/"));
var dateEnd = new Date($('#endDate').val().replace(/\-/g, "/"));
var diffDays = parseInt((dateEnd.getTime() - dateStart.getTime()) / parseInt(1000 * 3600 * 24));
console.log(diffDays);
if (diffDays > 120) {
$("#tipMsg").text("开始时间与结束时间跨度不能超过3个月");
$("#tipModal").modal('show');
return;
}
}
if (tableLoaded || currParams.pageNumber > 1) {
TableHelper.doRefreshAndToPage1('#table');
} else {
TableHelper.doRefresh('#table');
}
})
var picker1 = $("#startDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker2 = $('#endDate').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
picker1.on('changeDate', function () {
var date = $('#startDate').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#endDate').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
// 导出excel
$('#btnExport').on('click', function () {
if (!$('#platformNo').val() || !$('#startDate').val() || !$('#endDate').val()) {
$("#tipMsg").text("请输入必填的信息");
$("#tipModal").modal('show');
return;
}
var dateStart = new Date($('#startDate').val().replace(/\-/g, "/"));
var dateEnd = new Date($('#endDate').val().replace(/\-/g, "/"));
var diffDays = parseInt((dateEnd.getTime() - dateStart.getTime()) / parseInt(1000 * 3600 * 24));
console.log(diffDays);
if (diffDays > 120) {
$("#tipMsg").text("开始时间与结束时间跨度不能超过3个月");
$("#tipModal").modal('show');
return;
}
var form = $("#form");
form.attr("action", "/admin/gameManage/billRecord/exportList.action");
$('#exportplatformNo').val($('#platformNo').val());
$('#exportBillType').val($('#billType').val());
$('#exportStartTime').val($('#startDate').val());
$('#exportEndTime').val($('#endDate').val());
form.submit();
})
// 通过接口获取所有账单类型
function getObjTypes() {
$.ajax({
url: "/admin/gameManage/billRecord/objTypeList.action",
type: 'GET',
async: false,
datatype: 'json',
success: function (res) {
console.log(res);
if (res) {
var data = res.data;
var options = [];
options.push('<option value="">全部</option>')
for (var i = 0, len = data.length; i < len; i++) {
var item = data[i];
//拼接成多个<option><option/>
options.push('<option value="' + item.value + '">' + item.desc + '</option>')
}
$("#billType").html(options.join(' ')); //填充到select标签中
}
},
error: function () {
alert('查询类型出错');
}
});
}
}
},
};
</script>
<style scoped>
#erbanNo,
#billType,
#startDate,
#endDate {
margin-right: 4px;
}</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,541 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<section class="content">
<div id="table"></div>
<div id="toolbar">
<button id="ticket-add" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>新增门票包
</button>
</div>
</section><!-- .content -->
</div>
</div>
</section>
<div class="modal fade" id="ticketModal" 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>
<h4 class="modal-title" id="modalLabel">新增/编辑渠道门票包</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="ticketForm">
<input type="hidden" name="id" id="id" />
<div class="form-group">
<label class="col-sm-3 control-label">门票id</label>
<div class="col-sm-4">
<input type="text" class="form-control validate[required]" name="ticketId" id="ticketId"
placeholder="门票id">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">总张数</label>
<div class="col-sm-4">
<input type="text" class="form-control validate[required]" name="stock" id="stock"
placeholder="总张数">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">每人可领取</label>
<div class="col-sm-4">
<input type="text" class="form-control validate[required]" name="limitNum" id="limitNum"
placeholder="每人可领取张数">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">截止领取时间</label>
<div class="col-sm-4">
<input type="text" class="input-sm form-control datetime validate[required]" name="endTime"
id="endTime" placeholder="选择时间">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">门票包文案</label>
<div class="col-sm-4">
<input type="text" class="form-control validate[required]" name="showText" id="showText"
placeholder="区分文案">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">渠道标</label>
<div class="col-sm-4">
<input type="text" class="form-control validate[required]" name="channel" id="channel"
placeholder="注意与渠道包保持一致">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">安卓渠道包:</label>
<div class="col-sm-10">
<!-- <img src="" id="picImage" style="width:250px;height:90px;" alt="">-->
<input type="file" id="picUploadFile" name="file" style="margin: auto;">
<button class="btn btn-success" type="button" id="picUploadBtn"
style="margin-left: 117px">上传</button>
<input type="hidden" id="packageUrl" name="packageUrl"
class="form-control validate[required]" />
<span id="picImgInfo" style="color:red;"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">门票包链接</label>
<div class="col-sm-3">
<span id="shareUrl">暂未生成链接</span>
</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 first fade" id="tipModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">提示信息</h4>
</div>
<div class="modal-body" id="tipMsg"></div>
</div>
</div>
</div>
<!-- 领取用户列表弹窗 -->
<div class="modal fade" id="joinedUserListModal" 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>
<h4 class="modal-title" id="joinedUserListModalTitle"></h4>
</div>
<div class="modal-body">
<div id="joinedUsersTable"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="exportJoinUserList">导出</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<!-- 注册用户列表弹窗 -->
<div class="modal fade" id="registerUserListModal" 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>
<h4 class="modal-title" id="registerUserListModalTitle"></h4>
</div>
<div class="modal-body">
<div id="registerUsersTable"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="exportRegisterUserList">导出</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import Clipboard from '@/assets/plugins/clipboard/js/clipboard.min.js';
export default {
name: "GameManageChannelTicketView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
let currShowedReceiveListPackageId;
let currShowedReceiveListChannel;
let pageList = [];
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'id', title: 'ID', align: 'center', width: '5%' },
{ field: 'showText', title: '门票包文案', align: 'center', width: '5%' },
{ field: 'endTime', title: '领取截止时间', align: 'center', width: '15%', formatter: formatTime },
{
field: 'status', title: '链接状态', align: 'center', width: '5%', formatter: function (val, row, index) {
if (val == 1) {
return '领取中';
} else if (val == 2) {
return '截止领取';
} else if (val == 3) {
return '已关闭';
}
}
},
{
field: 'tmp', title: '领取情况', align: 'center', width: '15%',
formatter: function (val, row, index) {
var total = row.stock + row.consumeNum
return `${row.consumeNum}/${total}<br><a href="javascript:void()" class="opt-show-received-users" data-id="${row.id}">查看&gt;</a>`
}
},
{
field: 'registerNum', title: '渠道包注册情况', align: 'center', width: '5%',
formatter: function (val, row, index) {
return `${row.registerNum}<br><a href="javascript:void()" class="opt-show-register-users" data-id="${row.channel}">查看&gt;</a>`
}
},
{
field: 'shareUrl', title: '门票包链接', align: 'center', width: '5%', formatter: function (val, row, index) {
return `${row.shareUrl}<br><a class="opt-copy-shareUrl" href="javascript:void()" data-clipboard-text = ${row.shareUrl}>复制链接</a>`
}
},
{
field: '', title: '操作', align: 'center', width: '15%', formatter: function (val, row, index) {
let id = row.id;
const actions = [];
actions.push('<button class="btn btn-sm btn-success opt-edit" data-id=' + id + '>' +
'<i class="glyphicon glyphicon-edit"></i>编辑</button>');
if (row.status == 1) {
actions.push('<button class="btn btn-sm btn-danger opt-change-status" data-id=' + id + ' data-status="0">' +
'<i class="glyphicon glyphicon-edit"></i>关闭链接</button>')
} else if (row.status == 3) {
actions.push('<button class="btn btn-sm btn-warning opt-change-status" disabled="true" data-id=' + id + ' data-status="1">' +
'<i class="glyphicon glyphicon-edit"></i>关闭链接</button>')
}
return actions.join(" ");
}
}
],
cache: false,
striped: true,
showRefresh: true,
pageSize: 10,
pagination: true,
pageList: [1, 10, 20, 30, 50],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
};
return param;
},
toolbar: '#toolbar',
url: '/admin/gamemanage/channelticket/list.action',
onLoadSuccess: function (data) { //加载成功时执行
console.log("load success", data);
pageList = data;
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 关闭链接
$("#table").on("click", '.opt-change-status', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
let tips = '';
if (confirm(`你确认关闭该门票包链接吗?`)) {
$.ajax({
type: 'get',
url: "/admin/gamemanage/channelticket/closeShare.action",
data: { 'id': id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text(`关闭成功`);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(`关闭失败`);
$("#tipModal").modal('show');
}
}
});
}
});
$("#ticket-add").click(function () {
// 打开弹窗
$("#ticketModal").modal('show');
$("#ticketForm")[0].reset();
$('#packageUrl').val('');
$("#picImgInfo").html('');
$("#picUploadFile").val('');
$("#ticketId").val('');
$("#limitNum").val('');
$("#id").val('');
$("#shareUrl").html('暂未生成链接');
$("#ticketId").removeAttr("disabled");
$("#limitNum").removeAttr("disabled");
});
// 上传
$('#picUploadBtn').on('click', function () {
var files = document.getElementById('picUploadFile').files;
console.log("----------files", files)
var data = new FormData();
data.append('file_' + 0, files[0]);
$.ajax({
type: "POST",
url: "/admin/upload/patch.action",
data: data,
cache: false,
contentType: false, //不可缺
processData: false, //不可缺
dataType: "json",
success: function (json) {
if (json.data) {
console.log(json.data);
// $('#picImage').attr("src", json.path);
$('#packageUrl').val(json.data);
if (json.data != '') {
$("#picImgInfo").html('已上传成功');
} else {
$("#picImgInfo").html('未上传成功');
}
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
})
function parseNum(val) {
if (val == undefined || val == 'false' || val == 0) {
return 0;
}
else {
return 1;
}
}
// 编辑
$("#table").on("click", '.opt-edit', function () {
console.log("btnEdit");
var id = $(this).attr("data-id");
$.ajax({
type: "get",
url: "/admin/gamemanage/channelticket/getById",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200 && json.data) {
$("#id").val(json.data.id);
$("#ticketId").attr("disabled", "disabled");
$("#ticketId").val(json.data.ticketId);
$("#stock").val(json.data.stock);
$("#limitNum").attr("disabled", "disabled");
$("#limitNum").val(json.data.limitNum);
$("#endTime").val(formatTime(json.data.endTime));
$("#showText").val(json.data.showText);
$("#channel").val(json.data.channel);
$("#shareUrl").html(json.data.shareUrl);
// 设置图片
$("#picUploadFile").val('');
$('#packageUrl').val(json.data.packageUrl);
// $('#picImage').attr("src", json.data.picUrl);
if (json.data.packageUrl != '') {
$("#picImgInfo").html('已上传');
} else {
$("#picImgInfo").html('未上传');
}
// 打开编辑弹窗
$("#ticketModal").modal('show');
} else {
$("#tipMsg").text("获取门票包信息出错");
$("#tipModal").modal('show');
}
}
});
});
// 领取详情
$("#table").on("click", '.opt-show-received-users', function () {
var id = $(this).attr("data-id");
console.log('-------------id', id)
currShowedReceiveListPackageId = id
$('#joinedUserListModal #joinedUserListModalTitle').text(`领取情况`)
$('#joinedUsersTable').bootstrapTable('destroy');
$('#joinedUsersTable').bootstrapTable({
columns: [
{ field: 'erbanNo', title: '66号', align: 'center', width: '5%' },
{ field: 'nick', title: '用户昵称', align: 'center', width: '15%' },
{ field: 'createTime', title: '领取时间', align: 'center', width: '15%', formatter: formatTime },
{ field: 'ticketName', title: '领取内容', align: 'center', width: '15%', },
{ field: 'ticketUid', title: '领取门票id', align: 'center', width: '15%', },
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
packagaId: id,
};
return param;
},
url: '/admin/gamemanage/channelticket/listReceiveRecord',
onLoadSuccess: function () { //加载成功时执行
$("#joinedUserListModal").modal('show');
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
});
// 注册用户详情
$("#table").on("click", '.opt-show-register-users', function () {
var channel = $(this).attr("data-id");
console.log('---------------channel', channel)
currShowedReceiveListChannel = channel
$('#registerUserListModal #registerUserListModalTitle').text(`渠道包注册情况`)
$('#registerUsersTable').bootstrapTable('destroy');
$('#registerUsersTable').bootstrapTable({
columns: [
{ field: 'nick', title: '注册昵称', align: 'center', width: '5%' },
{ field: 'erbanNo', title: '注册ID', align: 'center', width: '15%' },
{ field: 'registerTime', title: '注册时间', align: 'center', width: '15%', formatter: formatTime },
{ field: 'inviteCode', title: '填写的邀请码', align: 'center', width: '15%', },
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
channel: channel,
};
return param;
},
url: '/admin/gamemanage/channelticket/listRegisterUserByChannel',
onLoadSuccess: function () { //加载成功时执行
$("#registerUserListModal").modal('show');
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
});
$('.datetime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
// 新增门票包
$("#save").click(function () {
if ($("#ticketForm").validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gamemanage/channelticket/saveOrUpdate.action",
data: $('#ticketForm').serialize(),
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#ticketModal").modal('hide');
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败." + json.msg);
$("#tipModal").modal('show');
}
}
});
}
});
// 复制分享链接
$("#table").on("click", '.opt-copy-shareUrl', function () {
console.log("--------开始复制")
let clipboard = new Clipboard('.opt-copy-shareUrl')
clipboard.on('success', function (e) {
console.log(e);
$("#tipMsg").text("已复制");
$("#tipModal").modal('show');
e.clearSelection();
});
});
function formatTime(val) {
if (val) {
var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '';
}
}
// 导出领取用户
$("#exportJoinUserList").on("click", function () {
window.location.href = `/admin/gamemanage/channelticket/exportReceiveRecord?packageId=${currShowedReceiveListPackageId}`
});
// 导出注册用户
$("#exportRegisterUserList").on("click", function () {
window.location.href = `/admin/gamemanage/channelticket/exportRegisterUserByChannel?channel=${currShowedReceiveListChannel}`
});
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,106 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<section class="content">
<div id="toolbar">
<div class="col-sm-12">
<label for="erbanNos" class="">获赠约玩号多个用,分隔:</label>
<div class="">
<textarea class="form-control" name="erbanNos" id="erbanNos"
style="height:150px;"></textarea>
</div>
</div>
<div class="col-sm-12" style="margin-top: 8px;">
<label for="ticketId">门票ID:</label>
<input type="text" name="ticketId" id="ticketId" style="width: 600px" maxlength="100"
placeholder="门票基础ID">
</div>
<div class="col-sm-12" style="margin-top: 8px;">
<label for="num" class="">每人获赠数量:</label>
<input type="text" class="validate[required ]" name="num" id="num" style="margin-right: 10px;">
<button type="button" class="btn btn-primary" id="btnGive">确认</button>
</div>
</div>
<div id="table"></div>
</section>
</div>
</div>
<!--<div class="box box-primary">
<div class="box-body">
<table class="table table-bordered" id="table">
</table>
</div>
</div>-->
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameManageGiveTicketView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
// 赠送门票
$("#btnGive").click(function () {
const erbanNos = $("#erbanNos").val();
const num = $('#num').val();
let ticketId = $('#ticketId').val();
if (!$('#erbanNos').val()) {
$("#tipMsg").text("请输入约玩号");
$("#tipModal").modal('show');
return;
}
if (!ticketId) {
$("#tipMsg").text("请输入门票ID");
$("#tipModal").modal('show');
return;
}
if (!num) {
$("#tipMsg").text("请输入数量");
$("#tipModal").modal('show');
return;
}
$.ajax({
type: "get",
url: "/admin/gameManage/giveTicket.action",
data: { 'erbanNos': erbanNos, 'num': num, 'ticketId': ticketId },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
} else {
$("#tipMsg").text("提示: " + json.message);
$("#tipModal").modal('show');
}
},
error: function (json) {
$("#tipMsg").text("操作出错,网络出错");
}
});
});
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,396 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<div class="col-sm-12">
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>添加
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
<div class="modal fade" id="addGroupModal" 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>
<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" />
<div class="form-group">
<label for="modal_matchGroupName" class="col-sm-3 control-label">名称<font color="red">*</font>
:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="matchGroupName"
id="modal_matchGroupName">
</div>
</div>
<div class="form-group">
<label for="matchGroupType" class="col-sm-3 control-label">游戏分类:</label>
<div class="col-sm-9">
<select id="matchGroupType" name="matchGroupType" class="input-sm">
<option value="1">和平精英</option>
</select>
</div>
</div>
<div class="form-group">
<label for="module_seqNo" 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 validate[required]" name="seqNo"
id="module_seqNo" placeholder="请输入正整数,数字小在前面">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入口图片<font color="red">*</font>:</label>
<div class="col-sm-9">
<img src="" id="picImage" style="width:250px;height:90px;" alt="">
<input type="file" id="picUploadFile" name="file">
<button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
<input type="hidden" id="matchGroupUrl" name="matchGroupUrl"
class="form-control validate[required]" />
<span id="picImgInfo" style="color:red;"></span>
</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="add">确定</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="updateGroupModal" 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>
<h4 class="modal-title" id="updateModalLabel">编辑</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="updateForm">
<input type="hidden" name="matchGroupId" id="e_id" />
<div class="form-group">
<label for="modal_matchGroupName" class="col-sm-3 control-label">名称<font color="red">*</font>
:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required]" name="matchGroupName"
id="e_modal_matchGroupName">
</div>
</div>
<div class="form-group">
<label for="matchGroupType" class="col-sm-3 control-label">游戏分类:</label>
<div class="col-sm-9">
<select id="e_matchGroupType" name="matchGroupType" class="input-sm">
<option value="1">和平精英</option>
</select>
</div>
</div>
<div class="form-group">
<label for="module_seqNo" 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 validate[required]" name="seqNo"
id="e_module_seqNo" placeholder="请输入正整数,数字小在前面">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入口图片<font color="red">*</font>:</label>
<div class="col-sm-9">
<img src="" id="e_picImage" style="width:250px;height:90px;" alt="">
<input type="file" id="e_picUploadFile" name="file">
<button class="btn btn-success" type="button" id="e_picUploadBtn">上传</button>
<input type="hidden" id="e_matchGroupUrl" name="matchGroupUrl"
class="form-control validate[required]" />
<span id="e_picImgInfo" style="color:red;"></span>
</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="updateGroup">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameManageGroupAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'matchGroupId', title: '集合id', align: 'center', width: '5%' },
{ field: 'matchGroupName', title: '名称', align: 'center', width: '5%' },
{
field: 'matchGroupType', title: '游戏分类', align: 'center', width: '5%',
formatter: function (val) {
if (val == 1) {
return '和平精英'
}
}
},
{ field: 'seqNo', title: '排序', align: 'center', width: '5%' },
{
field: 'matchGroupUrl', title: '图片', align: 'center', width: '5%',
formatter: function (val) {
return "<img src='" + val + "' width='40' height='40'>";
}
},
{
field: 'clanId',
title: '操作',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
const matchGroupId = row.matchGroupId;
return '<button id="btnEdit" name="btnEdit" class="btn btn-sm btn-success opt-edit" matchGroupId=' + matchGroupId + '>' +
'<i class="glyphicon glyphicon-edit"></i> 编辑</button>' +
'<button class="btn btn-sm btn-danger opt-remove" matchGroupId=' + matchGroupId +
'><i class="glyphicon glyphicon-remove"></i>删除</button>';
}
}
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
};
return param;
},
toolbar: '#toolbar',
uniqueId: 'matchGroupId',
url: '/admin/gameManage/listGroupByPage.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
//新建标签
$("#addBtn").click(function () {
$("#modal_matchGroupName").val(""),
$("#matchGroupType").val(""),
$("#module_seqNo").val(""),
$("#matchGroupUrl").val(""),
$('#picImage').attr("src", '');
$("#picImgInfo").html('');
$("#picUploadFile").val('');
$("#addGroupModal").modal('show');
});
//编辑
$('#table').on('click', '.opt-edit', function () {
const matchGroupId = $(this).attr('matchGroupId');
console.log("param======", matchGroupId)
var data = $('#table').bootstrapTable('getRowByUniqueId', matchGroupId);
console.log("data======", data)
$("#e_id").val(matchGroupId);
$("#e_modal_matchGroupName").val(data.matchGroupName);
$("#e_matchGroupType").val(data.matchGroupType);
$("#e_module_seqNo").val(data.seqNo);
// 设置图片
$("#e_picUploadFile").val('');
$('#e_matchGroupUrl').val(data.matchGroupUrl);
$('#e_picImage').attr("src", data.matchGroupUrl);
if (data.matchGroupUrl != '') {
$("#e_picImgInfo").html('已上传');
} else {
$("#e_picImgInfo").html('未上传');
}
$("#updateGroupModal").modal('show');
});
// 删除
$('#table').on('click', '.opt-remove', function () {
if (confirm("确定删除?")) {
const matchGroupId = $(this).attr('matchGroupId');
console.log("param======", matchGroupId)
$.ajax({
type: 'get',
url: '/admin/gameManage/del',
data: {
matchGroupId: matchGroupId
},
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败." + res.msg);
$("#tipModal").modal('show');
}
}
});
}
});
// 编辑
$("#updateGroup").click(function () {
console.log("updateId", $("#updateId").val());
$.ajax({
type: "get",
url: "/admin/gameManage/saveOrUpdateGroup.action",
data: $("#updateForm").serialize(),
dataType: "json",
success: function (json) {
if (json.success) {
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
$("#roomTagEditModal").modal('hide');
} else {
$("#tipMsg").text("保存失败." + json.message);
$("#tipModal").modal('show');
}
}
});
});
// 新增
$("#add").click(function () {
$.ajax({
type: "get",
url: "/admin/gameManage/saveOrUpdateGroup.action",
data: $("#addForm").serialize(),
dataType: "json",
success: function (json) {
if (json.success) {
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败." + json.message);
$("#tipModal").modal('show');
}
}
});
});
$('#picUploadBtn').on('click', function () {
$.ajaxFileUpload({
fileElementId: 'picUploadFile', //需要上传的文件域的ID即<input type="file">的ID。
url: '/admin/luckySea/upload', //后台方法的路径
type: 'post', //当要提交自定义参数时这个参数要设置成post
dataType: 'json', //服务器返回的数据类型。可以为xml,script,json,html。如果不填写jQuery会自动判断。
secureuri: false, //是否启用安全提交默认为false。
async: true, //是否是异步
success: function (json) { //提交成功后自动执行的处理函数参数data就是服务器返回的数据。
if (json.path) {
$('#matchGroupUrl').val(json.path);
$('#picImage').attr("src", json.path);
if (json.path != '') {
$("#picImgInfo").html('已上传成功');
} else {
$("#picImgInfo").html('未上传成功');
}
console.log(json.path);
} else {
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数。
console.error(e);
}
});
})
$('#e_picUploadBtn').on('click', function () {
$.ajaxFileUpload({
fileElementId: 'e_picUploadFile', //需要上传的文件域的ID即<input type="file">的ID。
url: '/admin/luckySea/upload', //后台方法的路径
type: 'post', //当要提交自定义参数时这个参数要设置成post
dataType: 'json', //服务器返回的数据类型。可以为xml,script,json,html。如果不填写jQuery会自动判断。
secureuri: false, //是否启用安全提交默认为false。
async: true, //是否是异步
success: function (json) { //提交成功后自动执行的处理函数参数data就是服务器返回的数据。
if (json.path) {
$('#e_matchGroupUrl').val(json.path);
$('#e_picImage').attr("src", json.path);
if (json.path != '') {
$("#e_picImgInfo").html('已上传成功');
} else {
$("#e_picImgInfo").html('未上传成功');
}
console.log(json.path);
} else {
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数。
console.error(e);
}
});
})
});
}
},
};
</script>
<style scoped></style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
<div class="modal fade" id="updateAccessModal" 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>
<h4 class="modal-title" id="modalLabel">编辑</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="addForm">
<input type="hidden" name="type" id="modelType" />
<div class="form-group">
<label for="accessName" class="col-sm-3 control-label">路径:</label>
<div style="line-height: 37px" class="col-sm-6">
<span id="accessName"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">门票ID:</label>
<div class="col-sm-9" id="accessLists">
<input type="hidden" class="input-sm form-control datetime " name="id">
<input type="text" class="input-sm form-control datetime " name="ticketId"
placeholder="请输入门票ID">
<input type="text" class="input-sm form-control datetime " name="num" placeholder="请输入张数">
</div>
<div class="col-sm-9">
<button class="btn btn-success" type="button" id="addBtn">+</button>
</div>
</div>
<div class="form-group" id="limitNumDiv">
<div class="limitNumType" style="display: none">
<label for="limitNum" class="col-sm-3 control-label">可获赠次数:</label>
<div class="col-sm-9">
<input type="text" class="input-sm form-control datetime" name="limitNum" id="limitNum"
placeholder="请输入上限可获赠次数">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="saveOrUpdate">保存</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
let updateType;
export default {
name: "GameManageTicketAccessView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'type', title: '路径', align: 'center', width: '5%', formatter: formatAccessName },
{ field: 'status', title: 'status', align: 'center', width: '5%', visible: false },
{
field: '',
title: '操作',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
let type = row.type;
const actions = [];
actions.push('<button class="btn btn-sm btn-success opt-edit" data-id=' + type + '>' +
'<i class="glyphicon glyphicon-edit"></i>编辑</button>');
if (row.status == 1) {
actions.push('<button class="btn btn-sm btn-danger opt-change-status" data-id=' + type + ' data-status="2">' +
'<i class="glyphicon glyphicon-edit"></i>设为失效</button>')
} else {
actions.push('<button class="btn btn-sm btn-warning opt-change-status" data-id=' + type + ' data-status="1">' +
'<i class="glyphicon glyphicon-edit"></i>设为生效</button>')
}
return actions.join(" ");
}
}
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: true,
pageSize: 20,
pagination: false,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
url: '/admin/ticket/access/listAccessWithStatus.action',
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
toolbar: '#toolbar',
onLoadSuccess: function (res) { //加载成功时执行
console.log("-----------------load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
// 设置状态
$("#table").on("click", '.opt-change-status', function () {
var type = $(this).attr("data-id");
var status = $(this).attr("data-status");
if (type == 'undefined') {
$("#tipMsg").text("type参数有误");
$("#tipModal").modal('show');
return;
}
let tips = '';
if (status == 1) {
tips = "设为生效"
} else {
tips = "设为失效"
}
if (confirm(`你确认要${tips}吗?`)) {
$.ajax({
type: 'get',
url: "/admin/ticket/access/changeTicketAccessStatus.action",
data: { 'type': type, 'status': status },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text(`${tips}成功`);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(`${tips}失败`);
$("#tipModal").modal('show');
}
}
});
}
});
//编辑
$('#table').on('click', '.opt-edit', function () {
let type = $(this).attr('data-id');
$('#modelType').val(type)
$('#limitNumDiv').show()
$.ajax({
type: "get",
url: "/admin/ticket/access/listAccessTicketByType.action",
data: { type: type },
dataType: "json",
success: function (json) {
if (json.code == 200 && json.data) {
$('#accessLists input').remove();
// $('#accessLists input').remove();
$('#accessLists div').remove();
console.log("res", json)
var str = '';
json.data.forEach(res => {
str += `
<div class="col-sm-9" style="display: flex; justify-content: space-between;">
<input type="hidden" class="input-sm form-control datetime" value="${res.id}" name="id">
<input type="text" style="margin-right: 30px" value="${res.ticketId}" class="input-sm form-control datetime " name="ticketId" placeholder="请输入门票ID">
<input type="text" value="${res.ticketNum}" class="input-sm form-control datetime " name="num" placeholder="请输入张数">
<button style="margin-left: 30px" class="btn delBtn btn-success" type="button" id="">-</button>
</div>
`
})
$('#limitNum').val(json.data[0].limitNum);
console.log(json.data[0].limitNum)
console.log(type)
if (type == 1) {
$('#limitNumDiv').hide();
} else if ((type == 2) || (type == 3)) {
$('.limitNumType label').text('可获赠次数');
$('.limitNumType input').attr('placeholder', '请输上限可获赠次数');
} else if (type == 4) {
$('.limitNumType label').text('好友数量');
$('.limitNumType input').attr('placeholder', '请输入需要成功邀请好友数量');
}
$('#accessLists').append(str);
$('.limitNumType').show();
// 打开编辑弹窗
$("#accessName").html(formatAccessName(type))
$("#updateAccessModal").modal('show');
// 点击-事件
$('.delBtn').click(function () {
console.log($(this).parent())
$(this).parent().remove();
})
} else {
$("#tipMsg").text("获取送赠信息出错");
$("#tipModal").modal('show');
}
}
});
});
// 点击modal保存
$('#saveOrUpdate').click(function () {
console.log(1111111111111)
let tickets = []
$('#accessLists .col-sm-9').each(function (index, e) {
var ticket = {};
$(this).children("input").each(function (e) {
console.log($(this).attr("name"), $(this).val())
let ticketName = $(this).attr("name")
let ticketVal = $(this).val()
ticket[ticketName] = ticketVal;
})
tickets.push(ticket)
})
console.log(tickets)
$.ajax({
type: "post",
url: "/admin/ticket/access/saveOrUpdate.action",
data: {
type: $('#modelType').val(),
tickets: JSON.stringify(tickets),
limitNum: $('#limitNum').val()
},
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
} else {
$("#tipMsg").text("保存失败");
$("#tipModal").modal('show');
}
}
});
})
// 点击+事件
$('#addBtn').click(function () {
const str = `
<div class="col-sm-9 " style="display: flex; justify-content: space-between;">
<input type="hidden" class="input-sm form-control datetime" name="id">
<input type="text" style="margin-right: 30px" class="input-sm form-control datetime" name="ticketId" placeholder="请输入门票ID">
<input type="text" class="input-sm form-control datetime" name="num" placeholder="请输入张数">
<button style="margin-left: 30px" class="btn btn-success" type="button" id="delBtn">-</button>
</div>
`;
$('#accessLists').append(str);
// 点击-事件
$('#delBtn').click(function () {
console.log($(this).parent())
$(this).parent().remove();
})
})
// 点击-事件
$('#delBtn').click(function () {
console.log($(this).parent())
$(this).parent().remove();
})
});
}
},
};
// 根据type获取路径名称
function formatAccessName(type) {
if (type == 1) {
return '注册获赠';
} else if (type == 2) {
return '每日登录获赠';
} else if (type == 3) {
return '每周登录获赠';
} else if (type == 4) {
return '成功邀请好友报名参赛获赠';
}
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,231 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<div class="col-sm-12">
<form action="/admin/ticket/access/exportList.action" id="searchForm" method="GET">
门票ID<input type="text" name="ticketUid" id="ticketUid" class="input-sm" />
门票名称<input type="text" name="ticketName" id="ticketName" class="input-sm" />
平台号<input type="text" name="erbanNO" id="erbanNO" class="input-sm" />
类型及方式<select id="objType" name="objType" class="input-sm">
<option value="" selected="selected">请选择</option>
<option value="6">商城充值币购买</option>
<option value="1">注册获赠/</option>
<option value="2">每日登录获赠</option>
<option value="3">每周登录获赠</option>
<option value="4">成功邀请好友参赛获赠</option>
<option value="5">参赛使用</option>
<option value="7">退还</option>
<option value="8">后台赠送</option>
<option value="9">渠道门票包领取</option>
</select>
开始时间<input type="text" name="queryMatchStartTime" id="queryMatchStartTime" class="input-sm"
placeholder="">
结束时间<input type="text" name="queryMatchEndTime" id="queryMatchEndTime" class="input-sm"
placeholder="">
</form>
<button id="btnSearch" class="btn btn-sm btn-primary">查询</button>
<button id="btnExport" class="btn btn-sm btn-primary">导出</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
const groupIdObj = {};
const ticketIdObj = {};
const integer_max = 2147483647;
export default {
name: "GameManageTicketHistoryAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
const main = {
init: function () {
// this.getTicketDataFormBack();
},
// 获取游戏门票列表
getTicketDataFormBack: function () {
$.get('/admin/gameManage/listTicketByPage', { page: 1, pageSize: integer_max }, function (res) {
if (res) {
let str = '<option value="" selected= "selected" >请选择</option>';
for (let i = 0; i < res.rows.length; i++) {
// id对象存储
const id = '' + res.rows[i].ticketId;
ticketIdObj[id] = res.rows[i];
str += '<option value="' + res.rows[i].ticketId + '">' + res.rows[i].ticketName + '</option>';
}
$('#ticketId').html(str);
console.log('ticketIdObj', ticketIdObj);
}
});
},
};
// main.init();
$('.datetime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
$("#btnExport").on('click', function () {
$("#searchForm").submit();
})
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'ticketUid', title: '门票ID', align: 'center', width: '5%' },
{ field: 'ticketName', title: '名称', align: 'center', width: '8%' },
{ field: 'price', title: '价格', align: 'center', width: '5%' },
{
field: 'type', title: '类型', align: 'center', width: '5%',
formatter: function (val, row) {
if (val == 1) {
return '获取'
} else if (val == 2) {
return '消耗'
}
}
},
{
field: 'objType', title: '方式', align: 'center', width: '5%',
formatter: function (val, row) {
if (val == 1) {
return '注册获赠'
} else if (val == 2) {
return '每日登录获赠'
} else if (val == 3) {
return '每周登录获赠'
} else if (val == 4) {
return '成功邀请好友参赛获赠'
} else if (val == 5) {
return '参赛使用'
} else if (val == 6) {
return '商城充值币购买'
} else if (val == 7) {
return '退还'
} else if (val == 8) {
return '后台赠送'
} else if (val == 9) {
return '渠道门票包领取'
}
}
},
{ field: 'nick', title: '用户昵称', align: 'center', width: '5%' },
{ field: 'erbanNo', title: '用户平台号', align: 'center', width: '5%' },
{ field: 'createTime', title: '时间', align: 'center', valign: 'middle', width: '10%', formatter: formatTime },
],
undefinedText: "0",
cache: false,
striped: true,
showRefresh: true,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
ticketUid: $("#ticketUid").val(),
ticketName: $("#ticketName").val(),
objType: $("#objType").val(),
erbanNo: $("#erbanNO").val(),
startTime: $("#queryMatchStartTime").val(),
endTime: $("#queryMatchEndTime").val(),
};
return param;
},
url: '/admin/ticket/access/listTicketWalletHistory.action',
toolbar: '#toolbar',
onLoadSuccess: function (data) { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
function formatTime(val) {
if (val) {
var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '';
}
}
function serverError(req) {
$("#tipMsg").text(req.responseJSON.message);
$("#tipModal").modal('show');
}
function apiResult(json) {
if (json.code == 200 && json.message == 'success') {
return true;
}
$("#tipMsg").text("请求失败,错误信息:" + json.message);
$("#tipModal").modal('show');
return false;
}
var picker1 = $("#queryMatchStartTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker2 = $('#queryMatchEndTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
picker1.on('changeDate', function () {
var date = $('#queryMatchStartTime').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#queryMatchEndTime').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
});
}
},
};
</script>
<style scoped>
#awardListModal .modal-dialog {
width: 900px;
}
#awardListModal .fixed-table-body {
height: 80%;
}</style>

View File

@@ -0,0 +1,585 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<div id="table"></div>
<div id="toolbar">
<form id="searchForm" action="/admin/withdraw/export" method="get" target="_blank">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-1 control-label">平台号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="erbanNo" id="erbanNo"></div>
<label for="erbanNo" class="col-sm-1 control-label">手机号码:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="phone" id="phone"></div>
<label for="account" class="col-sm-1 control-label">支付宝账号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="account" id="account"></div>
<label for="accountName" class="col-sm-1 control-label">支付宝名称:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="accountName"
id="accountName"></div>
</div>
<div class="col-sm-12">
<label for="beginDate" class="col-sm-1 control-label">开始时间:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="beginDate" id="beginDate">
</div>
<label for="endDate" class="col-sm-1 control-label">结束时间:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="endDate" id="endDate"></div>
<label for="status" class="col-sm-1 control-label">状态:</label>
<div class="col-sm-2">
<select name="status" id="status" data-btn-class="btn-warning" class="form-control">
<option value="-1" selected="selected">全部</option>
<option value="0">已作废</option>
<option value="1">申请中</option>
<option value="2">已批准</option>
<option value="3">已驳回</option>
</select>
</div>
<label for="payStatus" class="col-sm-1 control-label">支付状态:</label>
<div class="col-sm-2">
<select name="payStatus" id="payStatus" data-btn-class="btn-warning" class="form-control">
<option value="all" selected="selected">全部</option>
<option value="scheduled">计划中</option>
<option value="pending">申请中</option>
<option value="paid">支付成功</option>
<option value="failed">支付失败</option>
</select>
</div>
</div>
<div class="col-sm-12">
<label for="blockStatus" class="col-sm-1 control-label">用户状态:</label>
<div class="col-sm-2">
<select name="blockStatus" id="blockStatus" data-btn-class="btn-warning"
class="form-control">
<option value="0" selected="selected">全部</option>
<option value="2">正常</option>
<option value="1">黑名单</option>
</select>
</div>
<label for="accountType" class="col-sm-1 control-label">账号类型:</label>
<div class="col-sm-2">
<select name="accountType" id="accountType" data-btn-class="btn-warning"
class="form-control">
<option value="0" selected="selected">全部</option>
<option value="1">支付宝</option>
<option value="3">银行卡</option>
</select>
</div>
</div>
</form>
<div class="pull-left">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
<button id="btnMultiApprove" class="btn btn-default">
<i class="glyphicon glyphicon-certificate"></i>批量批准
</button>
<!-- <button id="btnMultiTransfer" class="btn btn-default">-->
<!-- <i class="glyphicon glyphicon-bitcoin"></i>批量付款-->
<!-- </button>-->
<button id="btnMultiReject" class="btn btn-default">
<i class="glyphicon glyphicon-bitcoin"></i>批量驳回
</button>
<div class="pull-right">
<h4 id="totalNum"></h4>
</div>
</div>
</div>
</div>
</div>
</section>
<div class="modal fade" id="withdrawModal" 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>
<h4 class="modal-title" id="modalLabel">提现申请审批</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="rejectForm">
<input type="hidden" name="withdrawId" id="withdrawId" />
<div class="form-group">
<label for="remark" class="col-sm-2 control-label">驳回原因</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="remark" id="remark">
</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="reject">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="tipModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">提示信息</h4>
</div>
<div class="modal-body" id="tipMsg"></div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "GameManageWithdrawAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
//{field: 'id', title: 'id', align: 'center', width: '5%'},
{ field: 'tmp', title: 'id', align: 'center', checkbox: true, width: '5%' },
{ field: 'platformNo', title: '平台号', align: 'center', width: '5%' },
{
field: 'accountType',
title: '账号类型',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
return val ? ['支付宝', '微信', '银行卡'][val - 1] : '-';
}
},
{ field: 'account', title: '账号', align: 'center', width: '5%' },
{ field: 'accountName', title: '账号名', align: 'center', width: '5%' },
{ field: 'money', title: '折现金额', align: 'center', width: '5%' },
{ field: 'tax', title: '税额', align: 'center', width: '5%' },
{ field: 'phone', title: '手机号', align: 'center', width: '5%' },
{
field: 'status',
title: '提现状态',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (val == 0) {
return "作废";
} else if (val == 1) {
return "申请中";
} else if (val == 2) {
return "已批准";
} else if (val == 3) {
return "已驳回";
} else {
return "未知状态";
}
}
},
{
field: 'withDrawBlockStatus',
title: '用户黑名单状态',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
return val == 2 ? '正常' : '黑名单';
}
},
{ field: 'remark', title: '备注', align: 'center', width: '10%' },
{
field: 'payStatus',
title: '支付状态',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (val == 'pending') {
return "申请中";
} else if (val == 'paid') {
return "支付成功";
} else if (val == 'failed') {
return "支付失败";
} else {
return "-";
}
}
},
{ field: 'payResult', title: '支付结果', align: 'center', width: '5%' },
{
field: 'createTime',
title: '申请时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{
field: 'id',
title: '操作',
align: 'center',
width: '15%',
formatter: function (val, row, index) {
var disabledText = row.withDrawBlockStatus == 2 ? '' : 'disabled';
var actions = [];
if (row.status == 1) {
actions.push('<button id="btnApprove" ' + disabledText + ' name="btnApprove" class="btn btn-sm btn-success opt-approve" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-edit"></i> 批准</button> ');
actions.push('<button id="btnReject" name="btnReject" class="btn btn-sm btn-success opt-reject" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-warning-sign"></i> 驳回</button> ');
}
// else if(row.status == 2) {
// actions.push('<button id="btnTransfer" ' + disabledText + ' name="btnTransfer" class="btn btn-sm btn-success opt-transfer" data-id=' + val + '>' +
// '<i class="glyphicon glyphicon-transfer"></i> 付款</button> ');
// actions.push('<button id="btnTransferSearch" ' + disabledText + ' name="btnTransferSearch" class="btn btn-sm btn-success opt-transfer-search" data-id=' + val + '>' +
// '<i class="glyphicon glyphicon-search"></i> 查询</button> ');
// }
return actions.join('');
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNum: params.pageNumber,
pageSize: params.pageSize,
account: $('#account').val(),
accountName: $('#accountName').val(),
nick: $('#nick').val(),
phone: $('#phone').val(),
status: $('#status').val(),
payStatus: $('#payStatus').val(),
erbanNo: $('#erbanNo').val(),
beginDate: $('#beginDate').val(),
endDate: $('#endDate').val(),
blockStatus: $('#blockStatus').val(),
accountType: $('#accountType').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/gameManage/withdraw/list.action',
onLoadSuccess: function (json) { //加载成功时执行
var totalNum = json.totalNum;
if (totalNum != undefined) {
$("#totalNum").html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + '合计金额:' + '&nbsp;&nbsp;&nbsp;&nbsp;' + totalNum);
}
console.log(json);
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 导出EXCEL
$('#btnExport').on('click', function () {
$("#searchForm").submit();
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
var picker1 = $("#beginDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
todayBtn: true,
autoclose: true,
});
var picker2 = $("#endDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
todayBtn: true,
autoclose: true
});
picker1.on('changeDate', function () {
var date = $('#beginDate').datepicker('getDate');
picker2.datepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#endDate').datepicker('getDate');
picker1.datepicker('setEndDate', date);
});
// 批准提现申请
$("#table").on('click', '.opt-approve', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("确认批准提现吗?")) {
console.log("id: " + id);
$.ajax({
type: "post",
url: "/admin/gameManage/withdraw/approve.action",
//data: $('#withdrawForm').serialize(),
data: { id: id },
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#withdrawModal").modal('hide');
$("#tipMsg").text("已批准提现申请");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败[" + id + "]," + json.msg);
$("#tipModal").modal('show');
}
}
});
}
});
// 批量批准提现申请
$('#btnMultiApprove').on('click', function () {
var rows = $("#table").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要批准的记录");
return;
}
console.log("rows: " + rows.length);
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['id']);
}
console.log(idArr);
if (confirm("你确认批量批准提现吗?")) {
$.ajax({
type: 'post',
url: "/admin/gameManage/withdraw/batchApprove.action",
data: { 'ids': JSON.stringify(idArr) },
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("已批准提现申请");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
}
});
// 转账
$("#table").on('click', '.opt-transfer', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("确认转账吗?")) {
$.ajax({
type: "post",
url: "/admin/gameManage/withdraw/transfer.action",
//data: $('#withdrawForm').serialize(),
data: { id: id },
dataType: "json",
success: function (json) {
console.log(json);
if (json.success == 'true') {
$("#tipMsg").text("已转账成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("转账失败[withdrawId=" + id + "]: " + json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
}
},
error: function (json) {
if (json.status == 200) {
var result = JSON.parse(json.responseText.replace(/\n/, ""));
console.log(result);
if (result.success == 'true') {
$("#tipMsg").text("已转账成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("转账失败[withdrawId=" + id + "]: " + result.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
}
}
}
});
}
});
// 转账
$("#table").on('click', '.opt-transfer-search', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
$.ajax({
type: "post",
url: "/admin/gameManage/withdraw/transfer/search.action",
data: { id: id },
dataType: "json",
success: function (json) {
console.log(json);
if (json.success == 'true') {
$("#tipMsg").text("查询成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("查询失败[withdrawId=" + id + "]: " + json.msg);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
}
}
});
});
// 批量转账
$('#btnMultiTransfer').on('click', function () {
var rows = $("#table").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要转账的记录");
return;
}
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['id']);
}
if (confirm("你确认批量转账吗?")) {
$.ajax({
type: 'post',
url: "/admin/gameManage/withdraw/batchTransfer.action",
data: { 'ids': JSON.stringify(idArr) },
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');
TableHelper.doRefresh("#table");
}
}
});
}
});
// 批量驳回
$('#btnMultiReject').on('click', function () {
var rows = $("#table").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要驳回的记录");
return;
}
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['id']);
}
if (confirm("你确认批量驳回吗?")) {
$.ajax({
type: 'post',
url: "/admin/gameManage/withdraw/batchReject",
data: { 'ids': JSON.stringify(idArr) },
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');
TableHelper.doRefresh("#table");
}
}
});
}
});
// 驳回申请
$("#table").on("click", '.opt-reject', function () {
var id = $(this).attr("data-id");
$("#withdrawId").val(id);
$("#remark").val("");
$("#withdrawModal").modal('show');
});
$("#reject").click(function () {
var withdrawId = $('#withdrawId').val();
var remark = $('#remark').val();
if ($("#rejectForm").validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameManage/withdraw/reject.action",
//data: $('#rejectForm').serialize(),
data: { withdrawId: withdrawId, remark: remark },
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
$("#withdrawModal").modal('hide');
} else {
$("#tipMsg").text("保存失败." + json.msg);
$("#tipModal").modal('show');
}
}
});
}
});
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,384 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<section class="content">
<div id="table"></div>
<div id="toolbar">
<button id="ticket-add" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>新建门票
</button>
</div>
</section><!-- .content -->
</div>
</div>
</section>
<div class="modal fade" id="ticketModal" 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>
<h4 class="modal-title" id="modalLabel">门票信息</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="ticketForm">
<input type="hidden" name="ticketId" id="ticketId" />
<div class="form-group">
<label class="col-sm-2 control-label">状态</label>
<div class="col-sm-3">
<label class="radio-inline"><input type="radio" name="status" value="1" checked>上架</label>
<label class="radio-inline"><input type="radio" name="status" value="0">下架</label>
</div>
</div>
<div class="form-group">
<label for="ticketName" class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="ticketName"
id="ticketName">
</div>
</div>
<div class="form-group">
<label for="buyType" class="col-sm-2 control-label">购买方式</label>
<div class="col-sm-10">
<select name="buyType" id="buyType" data-btn-class="btn-warning">
<option value="1">充值币</option>
</select>
</div>
</div>
<div class="form-group">
<label for="price" class="col-sm-2 control-label">价格</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="price" id="price">
</div>
</div>
<div class="form-group">
<label for="seq" class="col-sm-2 control-label">排序</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" placeholder="请输入正整数,数字小的在前面"
name="seq" id="seq">
</div>
</div>
<div class="form-group">
<label for="description" class="col-sm-2 control-label">说明</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="description"
id="description">
</div>
</div>
<div class="form-group">
<label for="stock" class="col-sm-2 control-label">库存</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="stock" id="stock">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">图片:</label>
<div class="col-sm-10">
<img src="" id="picImage" style="width:250px;height:90px;" alt="">
<input type="file" id="picUploadFile" name="file">
<button class="btn btn-success" type="button" id="picUploadBtn">上传</button>
<input type="hidden" id="picUrl" name="picUrl" class="form-control validate[required]" />
<span id="picImgInfo" style="color:red;"></span>
</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 first fade" id="tipModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">提示信息</h4>
</div>
<div class="modal-body" id="tipMsg"></div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import ComboboxHelper from '@/assets/plugins/bootstrap-combobox/js/bootstrap-combobox-helper';
export default {
name: "TicketManageView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
ComboboxHelper.build(null, '#buyType');
$(function () {
let pageList = [];
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'ticketId', title: 'ID', align: 'center', width: '5%' },
{ field: 'ticketName', title: '名称', align: 'center', width: '5%' },
{
field: 'buyType', title: '购买方式', align: 'center', width: '15%',
formatter: function (val, row, index) {
if (val == 1) {
return '充值币';
} else {
return '-';
}
}
},
{ field: 'price', title: '价格', align: 'center', width: '5%' },
{
field: 'expireTime', title: '过期时间', align: 'center', width: '15%',
formatter: function (val) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{ field: 'stock', title: '剩余库存', align: 'center', width: '5%' },
{ field: 'saledCount', title: '累计消耗', align: 'center', width: '5%' },
{ field: 'seq', title: '排序', align: 'center', width: '5%' },
{
field: 'status',
title: '状态',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
if (val == 1) {
return '上架';
} else if (val == 0) {
return '下架';
} else {
return '-';
}
}
},
{
field: 'ticketId', title: '操作', align: 'center', width: '15%', formatter: function (val, row, index) {
const actions = [];
actions.push('<button class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-edit"></i>编辑</button>');
if (row.status == 1) {
actions.push('<button class="btn btn-sm btn-danger opt-change-status" data-id=' + val + ' data-status="0">' +
'<i class="glyphicon glyphicon-edit"></i>下架</button>')
} else if (row.status == 0) {
actions.push('<button class="btn btn-sm btn-warning opt-change-status" data-id=' + val + ' data-status="1">' +
'<i class="glyphicon glyphicon-edit"></i>上架</button>')
}
return actions.join(" ");
}
}
],
cache: false,
striped: true,
showRefresh: true,
pageSize: 10,
pagination: true,
pageList: [1, 10, 20, 30, 50],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
};
return param;
},
toolbar: '#toolbar',
url: '/admin/gameManage/listTicketByPage.action',
onLoadSuccess: function (data) { //加载成功时执行
console.log("load success", data);
pageList = data;
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
$("#table").on("click", '.opt-change-status', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
let tips = '';
if (status == 1) {
tips = "上架"
} else {
tips = "下架"
}
if (confirm(`你确认${tips}该门票吗?`)) {
$.ajax({
type: 'post',
url: "/admin/gameManage/changeTicketStatus.action",
data: { 'ticketId': id, 'newStatus': status },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text(`${tips}成功`);
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(`${tips}失败`);
$("#tipModal").modal('show');
}
}
});
}
});
$("#ticket-add").click(function () {
// 打开编辑弹窗
$("#ticketModal").modal('show');
$("#ticketForm")[0].reset();
$('#picUrl').val('');
$('#picImage').attr("src", '');
$("#picImgInfo").html('');
$("#picUploadFile").val('');
$("#seq").val('');
$("#ticketId").val('');
ComboboxHelper.setDef("#buyType", '2');
});
$('#picUploadBtn').on('click', function () {
$.ajaxFileUpload({
fileElementId: 'picUploadFile', //需要上传的文件域的ID即<input type="file">的ID。
url: '/admin/gift/upload', //后台方法的路径
type: 'post', //当要提交自定义参数时这个参数要设置成post
dataType: 'json', //服务器返回的数据类型。可以为xml,script,json,html。如果不填写jQuery会自动判断。
secureuri: false, //是否启用安全提交默认为false。
async: true, //是否是异步
success: function (json) { //提交成功后自动执行的处理函数参数data就是服务器返回的数据。
if (json.path) {
$('#picUrl').val(json.path);
$('#picImage').attr("src", json.path);
if (json.path != '') {
$("#picImgInfo").html('已上传成功');
} else {
$("#picImgInfo").html('未上传成功');
}
console.log(json.path);
} else {
$("#tipMsg").text(json.msg);
$("#tipModal").modal('show');
}
},
error: function (data, status, e) { //提交失败自动执行的处理函数。
console.error(e);
}
});
})
function parseNum(val) {
if (val == undefined || val == 'false' || val == 0) {
return 0;
}
else {
return 1;
}
}
$("#table").on("click", '.opt-edit', function () {
console.log("btnEdit");
var id = $(this).attr("data-id");
$.ajax({
type: "get",
url: "/admin/gameManage/getTicket.action",
data: { ticketId: id },
dataType: "json",
success: function (json) {
if (json.code == 200 && json.data) {
$("#ticketId").val(json.data.ticketId);
if (json.data.status == 1) {
$("input:radio[name='status']")[0].checked = true;
} else {
$("input:radio[name='status']")[1].checked = true;
}
ComboboxHelper.setDef("#buyType", json.data.buyType);
$("#ticketName").val(json.data.ticketName);
$("#price").val(json.data.price);
$("#seq").val(json.data.seq);
$("#description").val(json.data.description);
$("#stock").val(json.data.stock);
// 设置图片
$("#picUploadFile").val('');
$('#picUrl').val(json.data.picUrl);
$('#picImage').attr("src", json.data.picUrl);
if (json.data.picUrl != '') {
$("#picImgInfo").html('已上传');
} else {
$("#picImgInfo").html('未上传');
}
// 打开编辑弹窗
$("#ticketModal").modal('show');
} else {
$("#tipMsg").text("获取门票信息出错");
$("#tipModal").modal('show');
}
}
});
});
$("#save").click(function () {
if ($("#ticketForm").validationEngine('validate')) {
$.ajax({
type: "post",
url: "/admin/gameManage/saveTicket.action",
data: $('#ticketForm').serialize(),
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#ticketModal").modal('hide');
$("#tipMsg").text("保存成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("保存失败." + json.msg);
$("#tipModal").modal('show');
}
}
});
}
});
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,620 @@
<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">
礼物名称<input type="text" class="input-sm" name="selectGiftName" id="selectGiftName"
placeholder="礼物名称">
礼物分类<select id="sourceSelect" class="input-sm" name="sourceSelect"></select>
状态<select id="selectStatus" class="input-sm">
<option value="0">全部</option>
<option value="1">待上架</option>
<option value="2">上架中</option>
<option value="3">已下架</option>
</select>
<br />
上架时间<input type="text" name="startDate" id="timeBegin" class="input-sm" placeholder="上架时间">
下架时间<input type="text" name="endDate" id="timeEnd" class="input-sm" placeholder="下架时间">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>搜索
</button>
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>
</div>
</section>
</div>
</div>
</section>
<div class="modal fade" id="genAccountModal" 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>
<h4 class="modal-title" id="modalLabel">新增礼物</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="addForm">
<div class="form-group">
<label for="giftId" class="col-sm-3 control-label">礼物名称:</label>
<div class="col-sm-9">
<select id="giftId" name="giftId" class="form-control" data-live-search="true" title="请选择">
</select>
</div>
</div>
<div class="form-group">
<label for="typeId" class="col-sm-3 control-label">礼物分类:</label>
<div class="col-sm-9">
<select name="typeId" id="typeId" class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label for="tip" class="col-sm-3 control-label">礼物tip:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[maxSize[25]]" name="tip" id="tip"
placeholder="非必填最大不超过25字">
</div>
</div>
<div class="form-group">
<label for="status" class="col-sm-3 control-label">是否上架:</label>
<div id="status" class="col-sm-9">
<label class="radio-inline"><input type="radio" name="addStatus" value="1"
checked /></label>
<label class="radio-inline"><input type="radio" name="addStatus" value="0" /></label>
</div>
</div>
<div id="addFormTime">
<div class="form-group">
<label for="startValidTime" class="col-sm-3 control-label">上架时间:</label>
<div class="col-sm-9">
<input type="text" name="startValidTime" id="startValidTime" class="form-control"
placeholder="上架时间" />
</div>
</div>
<div class="form-group">
<label for="endValidTime" class="col-sm-3 control-label">下架时间:</label>
<div class="col-sm-9">
<input type="text" name="endValidTime" id="endValidTime" class="form-control"
placeholder="下架时间" />
</div>
</div>
</div>
<div class="form-group">
<label for="weight" class="col-sm-3 control-label">权重:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="weight" id="weight"
placeholder='填写1~999正整数不填写默认为1'>
</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="add">确定</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="updateAccountModal" 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>
<h4 class="modal-title">编辑礼物</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="updateForm">
<div class="form-group">
<label for="giftName" class="col-sm-3 control-label">礼物名称:</label>
<div class="col-sm-9">
<label id="giftName" class="control-label"></label>
<input hidden="true" id="achId" name="achId" value="">
</div>
</div>
<div class="form-group">
<label for="updateTypeId" class="col-sm-3 control-label">礼物分类:</label>
<div class="col-sm-9">
<select name="typeId" id="updateTypeId" class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label for="updateTip" class="col-sm-3 control-label">礼物tip:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[maxSize[25]]" name="tip" id="updateTip"
placeholder="非必填最大不超过25字">
</div>
</div>
<div class="form-group">
<label for="updateStatus" class="col-sm-3 control-label">是否上架:</label>
<div id="updateStatus" class="col-sm-9">
<label class="radio-inline"><input type="radio" name="status" value="1" checked /></label>
<label class="radio-inline"><input type="radio" name="status" value="0" /></label>
</div>
</div>
<div id="updateFormTime">
<div class="form-group">
<label for="updateStartValidTime" class="col-sm-3 control-label">上架时间:</label>
<div class="col-sm-9">
<input type="text" name="startValidTime" id="updateStartValidTime" class="form-control"
placeholder="上架时间" />
</div>
</div>
<div class="form-group">
<label for="updateEndValidTime" class="col-sm-3 control-label">下架时间:</label>
<div class="col-sm-9">
<input type="text" name="endValidTime" id="updateEndValidTime" class="form-control"
placeholder="下架时间" />
</div>
</div>
</div>
<div class="form-group">
<label for="updateWeight" class="col-sm-3 control-label">权重:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="weight" id="updateWeight"
placeholder='填写1~999正整数不填写默认为1'>
</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="edit">确定</button>
</div>
</div>
</div>
</div>
<div id="imgMask"><img src="" alt=""></div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { showLoading, hideLoading } from '@/utils/maintainer';
var picker1 = $('#timeBegin').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
var picker2 = $('#timeEnd').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
picker1.on('changeDate', function () {
var date = $('#timeBegin').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#timeEnd').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
var picker3 = $('#startValidTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
var picker4 = $('#endValidTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
picker3.on('changeDate', function () {
var date = $('#startValidTime').datetimepicker('getDate');
picker4.datetimepicker('setStartDate', date);
});
picker4.on('changeDate', function () {
var date = $('#endValidTime').datetimepicker('getDate');
picker3.datetimepicker('setEndDate', date);
});
var picker5 = $('#updateStartValidTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
var picker6 = $('#updateEndValidTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
picker5.on('changeDate', function () {
var date = $('#updateStartValidTime').datetimepicker('getDate');
picker6.datetimepicker('setStartDate', date);
});
picker6.on('changeDate', function () {
var date = $('#updateEndValidTime').datetimepicker('getDate');
picker5.datetimepicker('setEndDate', date);
});
export default {
name: "GiftAchievementAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
setSelectOption();
$('#table').bootstrapTable({
columns: [
{ field: 'achId', title: '序号', align: 'center', valign: 'middle', width: '5%' },
{ field: 'giftName', title: '礼物名称', align: 'center', valign: 'middle', width: '10%' },
{ field: 'typeName', title: '礼物分类', align: 'center', valign: 'middle', width: '10%' },
{ field: 'weight', title: '权重', align: 'center', valign: 'middle', width: '10%' },
{ field: 'tip', title: '礼物tip', align: 'center', valign: 'middle', width: '10%' },
{
field: 'startValidTime', 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: 'endValidTime', 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: 'status', title: '状态', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 1) {
return "待上架";
} else if (val == 2) {
return "上架中";
} else {
return '已下架';
}
}
},
{ field: 'operator', title: '操作人', align: 'center', valign: 'middle', width: '10%' },
{
field: 'updateTime', 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: 'achId',
title: '操作',
align: 'center',
width: '20%',
valign: 'middle',
formatter: function (val, row, index) {
return '<button class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-edit"></i>编辑</button>' +
'&nbsp;&nbsp;<button class="btn btn-sm btn-danger opt-remove" data-id=' + val +
'><i class="glyphicon glyphicon-remove"></i>删除</button>';
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
giftName: $('#selectGiftName').val(),
typeId: $('#sourceSelect').val(),
status: $('#selectStatus').val(),
startValidTime: $("#timeBegin").val(),
endValidTime: $("#timeEnd").val()
};
return param;
},
uniqueId: 'achId',
toolbar: '#toolbar',
url: '/admin/giftAchievement/getAchievementList',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
/*查询刷新*/
$('#btnSearch').on('click', function () {
console.log("refresh")
TableHelper.doRefresh('#table');
})
$('#addBtn').on('click', function () {
$("#addForm")[0].reset();
$('#addFormTime').css('display', 'block');
$('#giftId').val('');
$('#genAccountModal').modal('show');
});
$("#table").on("click", '.opt-edit', function () {
$("#updateForm")[0].reset();
var id = $(this).attr("data-id");
var data = $('#table').bootstrapTable('getRowByUniqueId', id);
$('#achId').val(id);
$('#giftName').text(data.giftName);
$('#updateTypeId').find("option").each(function () {
console.info($(this).val() + " = " + data.typeId)
//$(this).attr("selected",false);
if ($(this).val() == data.typeId) {
$(this).attr("selected", "selected");
}
});
if (data.status == 3) {
$('#updateStatus input[name="status"]').get(1).checked = true;
$('#updateFormTime').css('display', 'none');
} else {
$('#updateStatus input[name="status"]').get(0).checked = true;
$('#updateFormTime').css('display', 'block');
}
$('#updateTip').val(data.tip);
$('#updateStartValidTime').val(new Date(data.startValidTime).format("yyyy-MM-dd hh:mm:ss"));
$('#updateEndValidTime').val(new Date(data.endValidTime).format("yyyy-MM-dd hh:mm:ss"));
$('#updateWeight').val(data.weight);
$("#updateAccountModal").modal('show');
});
$('input[name="addStatus"]').click(function () {
var a = $('input[name="addStatus"]:checked').val();
if (a == 1) {
$('#addFormTime').css('display', 'block');
} else {
$('#addFormTime').css('display', 'none');
}
});
$('input[name="status"]').click(function () {
var a = $('input[name="status"]:checked').val();
if (a == 1) {
$('#updateFormTime').css('display', 'block');
} else {
$('#updateFormTime').css('display', 'none');
}
});
$("#add").click(function () {
if ($('#addForm').validationEngine('validate')) {
var giftId = $('#giftId').val();
if (!giftId) {
$("#tipMsg").text("请选择礼物");
$("#tipModal").modal('show');
return;
}
var a = $('input[name="addStatus"]:checked').val();
if (a == 1) {
var startValidTime = $('#startValidTime').val();
if (!startValidTime) {
$("#tipMsg").text("请填写上架时间");
$("#tipModal").modal('show');
return;
}
var endValidTime = $('#endValidTime').val();
if (!endValidTime) {
$("#tipMsg").text("请填写下架时间");
$("#tipModal").modal('show');
return;
}
} else {
$('#startValidTime').val('');
$('#endValidTime').val('')
}
showLoading();
$.ajax({
type: "post",
url: "/admin/giftAchievement/addAchievement",
data: $('#addForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.code == 200) {
$("#genAccountModal").modal('hide');
$("#tipMsg").text("添加成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
$('#giftId').selectpicker('deselectAll');
$('#giftId').selectpicker('refresh');
hideLoading();
} else {
$("#tipMsg").text("保存失败," + json.message);
$("#tipModal").modal('show');
hideLoading();
}
}
})
}
});
$("#edit").click(function () {
if ($('#updateForm').validationEngine('validate')) {
var a = $('input[name="status"]:checked').val();
if (a == 1) {
var startValidTime = $('#updateStartValidTime').val();
if (!startValidTime) {
$("#tipMsg").text("请填写上架时间");
$("#tipModal").modal('show');
return;
}
var endValidTime = $('#updateEndValidTime').val();
if (!endValidTime) {
$("#tipMsg").text("请填写下架时间");
$("#tipModal").modal('show');
return;
}
} else {
$('#updateStartValidTime').val('');
$('#updateEndValidTime').val('')
}
showLoading();
$.ajax({
type: "post",
url: "/admin/giftAchievement/updateAchievement",
data: $('#updateForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.code == 200) {
$("#updateAccountModal").modal('hide');
$("#tipMsg").text("修改成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
hideLoading();
} else {
$("#tipMsg").text("保存失败," + json.message);
$("#tipModal").modal('show');
hideLoading();
}
}
})
}
});
$("#table").on("click", '.opt-remove', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗?" +
"\r\n删除后再也不能找回请谨慎操作")) {
$.ajax({
type: 'post',
url: "/admin/giftAchievement/deleteAchievement",
data: { 'achId': id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败," + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
})
}
},
};
function setSelectOption() {
$.ajax({
type: "get",
url: '/admin/giftAchievement/getAchievementTypeList',
dataType: 'json',
success: function (json) {
if (json.data) {
makeOption(json.data);
}
}
});
$.ajax({
type: 'get',
url: '/admin/gift/getAllGiftList?consumeType=1&consumeType=2',
dataType: 'json',
success: function (res) {
if (res.code == 200) {
var data = res.data;
makeOption2(data);
}
}
})
}
function makeOption(data) {
var str = '<option value="0"> 全部' + '</option>';
var str2 = '';
for (var i = 0; i < data.length; i++) {
str2 += '<option value="' + data[i].typeId + '">' + data[i].typeName + '</option>';
}
$("#sourceSelect").html(str + str2);
$("#typeId").html(str2);
$('#updateTypeId').html(str2);
}
function makeOption2(data) {
var str = '';
for (var i = 0; i < data.length; i++) {
str += '<option value="' + data[i].giftId + '">' + data[i].giftName + '</option>';
}
$('#giftId').html(str);
$('#giftId').selectpicker({ size: 12 });
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 200px;
padding: 4px;
background: #fff;
z-index: 1000;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
/*input,select{
margin-left: 8px;
margin-right: 8px;
}*/
#btnSearch {
margin-left: 36px;
}</style>

View File

@@ -0,0 +1,218 @@
<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">
<form action="/admin/giftAchievement/export" id="searchForm" method="get">
用户ID<input type="text" class="input-sm" name="erbanNo" id="erbanNo">
&nbsp;&nbsp;礼物成就分类<select id="sourceSelect" class="input-sm" name="typeId"></select>
<br />
完成时间区间<input type="text" name="beginTime" id="timeBegin" class="input-sm">
<input type="text" name="endTime" id="timeEnd" class="input-sm">
<button id="btnSearch" type="button" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>搜索
</button>
<button id="export" type="button" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>导出
</button>
</form>
完成收集总人数<label id="count"></label>
</div>
</section>
</div>
</div>
</section>
<div id="imgMask"><img src="" alt=""></div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
var picker1 = $('#timeBegin').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
var picker2 = $('#timeEnd').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
picker1.on('changeDate', function () {
var date = $('#timeBegin').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#timeEnd').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
export default {
name: "GiftAchievementStatisticsAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
countCollectedUser();
setSelectOption();
$('#table').bootstrapTable({
columns: [
{ field: 'recordId', title: '序号', align: 'center', valign: 'middle', width: '5%' },
{ field: 'erbanNo', title: '用户ID', align: 'center', valign: 'middle', width: '10%' },
{ field: 'nick', title: '用户昵称', align: 'center', valign: 'middle', width: '10%' },
{
field: 'gender', title: '性别', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 1) {
return '男';
} else {
return '女';
}
}
},
{ field: 'typeName', title: '礼物成就分类', align: 'center', valign: 'middle', width: '10%' },
{
field: '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 '-';
}
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
typeId: $('#sourceSelect').val(),
erbanNo: $('#erbanNo').val(),
beginTime: $("#timeBegin").val(),
endTime: $("#timeEnd").val()
};
return param;
},
uniqueId: 'recordId',
toolbar: '#toolbar',
url: '/admin/giftAchievement/getCollectedList',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
/*查询刷新*/
$('#btnSearch').on('click', function () {
console.log("refresh");
TableHelper.doRefresh('#table');
countCollectedUser();
})
$('#export').on('click', function () {
console.log("export");
$("#searchForm").submit();
})
})
}
},
};
function countCollectedUser() {
$.ajax({
type: "get",
url: '/admin/giftAchievement/countCollectedUser',
dataType: 'json',
data: {
typeId: $('#sourceSelect').val(),
erbanNo: $('#erbanNo').val(),
beginTime: $("#timeBegin").val(),
endTime: $("#timeEnd").val()
},
success: function (json) {
if (json.code == 200) {
$('#count').text(json.data);
}
}
});
}
function setSelectOption() {
$.ajax({
type: "get",
url: '/admin/giftAchievement/getAchievementTypeList',
dataType: 'json',
success: function (json) {
if (json.data) {
makeOption(json.data);
}
}
});
}
function makeOption(data) {
var str = '<option value="0"> 全部' + '</option>';
var str2 = '';
for (var i = 0; i < data.length; i++) {
str2 += '<option value="' + data[i].typeId + '">' + data[i].typeName + '</option>';
}
$("#sourceSelect").html(str + str2);
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 200px;
padding: 4px;
background: #fff;
z-index: 1000;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
/*input,select{
margin-left: 8px;
margin-right: 8px;
}*/
#btnSearch {
margin-left: 36px;
}</style>

View File

@@ -0,0 +1,457 @@
<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">
分类名称<select id="sourceSelect" class="input-sm" name="sourceSelect"></select>
状态<select id="selectStatus" class="input-sm">
<option value="0">全部</option>
<option value="1">展示</option>
<option value="2">隐藏</option>
</select>
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>搜索
</button>
<button id="addBtn" class="btn btn-default">
<i class="glyphicon glyphicon-plus"></i>增加
</button>
</div>
</section>
</div>
</div>
</section>
<div class="modal fade" id="genAccountModal" 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>
<h4 class="modal-title" id="modalLabel">新增分类</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="addForm">
<div class="form-group">
<label for="typeName" class="col-sm-3 control-label">分类名称:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required,maxSize[4]]" name="typeName"
id="typeName" placeholder="不超过4个字符">
</div>
</div>
<div class="form-group">
<label for="status" class="col-sm-3 control-label">状态:</label>
<div id="status" class="col-sm-9">
<label class="radio-inline"><input type="radio" name="status" value="1" checked />展示</label>
<label class="radio-inline"><input type="radio" name="status" value="2" />隐藏</label>
</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:108px;height:45px;' alt="">
<input type="file" id="addUploadFile" name='uploadFile'
accept='image/gif,image/jpeg,image/jpg,image/png,image/svg'>
<button class="btn btn-success" type='button' id="addUploadBtn">上传</button>
<input type="hidden" id="addActPic" name='backgroundUrl' class="form-control">
</div>
</div>
<div class="form-group">
<label for="weight" class="col-sm-3 control-label">权重:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="weight" id="weight"
placeholder='填写1~999正整数不填写默认为1'>
</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="add">确定</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="updateAccountModal" 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>
<h4 class="modal-title">编辑礼物</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="updateForm">
<div class="form-group">
<label for="updateTypeName" class="col-sm-3 control-label">分类名称:</label>
<div class="col-sm-9">
<input type="text" class="form-control validate[required,maxSize[4]]" name="typeName"
id="updateTypeName" placeholder="不超过4个字符">
<input hidden="true" id="updateTypeId" name="typeId" value="">
</div>
</div>
<div class="form-group">
<label for="updateStatus" class="col-sm-3 control-label">状态:</label>
<div id="updateStatus" class="col-sm-9">
<label class="radio-inline"><input type="radio" name="status" value="1" checked />展示</label>
<label class="radio-inline"><input type="radio" name="status" value="2" />隐藏</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">卡片背景:</label>
<div class="col-sm-8">
<img src="" id="updateImgUrl" style='width:108px;height:45px;' alt="">
<input type="file" id="updateUploadFile" name='uploadFile'
accept='image/gif,image/jpeg,image/jpg,image/png,image/svg'>
<button class="btn btn-success" type='button' id="updateUploadBtn">上传</button>
<input type="hidden" id="updateActPic" name='backgroundUrl' class="form-control">
</div>
</div>
<div class="form-group">
<label for="updateWeight" class="col-sm-3 control-label">权重:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="weight" id="updateWeight"
placeholder='填写1~999正整数不填写默认为1'>
</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="edit">确定</button>
</div>
</div>
</div>
</div>
<div id="imgMask"><img src="" alt=""></div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { showLoading, hideLoading } from '@/utils/maintainer';
export default {
name: "GiftAchievementTypeAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
setSelectOption();
$('#table').bootstrapTable({
columns: [
{ field: 'typeId', title: '序号', align: 'center', valign: 'middle', width: '5%' },
{ field: 'typeName', title: '礼物名称', align: 'center', valign: 'middle', width: '10%' },
{
field: 'backgroundUrl', title: '卡片背景', align: 'center', width: '10%', valign: 'center',
formatter: function (val, row, index) {
if (null == val || val == '') {
return '-';
} else if (val.indexOf("https") == 0) {
return "<img src='" + val + "' width='50' >";
} else {
return val;
}
}
},
{ field: 'weight', title: '权重', align: 'center', valign: 'middle', width: '10%' },
{
field: 'status', title: '状态', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 1) {
return "展示";
} else {
return '隐藏';
}
}
},
{ field: 'operator', title: '操作人', align: 'center', valign: 'middle', width: '10%' },
{
field: 'updateTime', 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: 'typeId',
title: '操作',
align: 'center',
width: '20%',
valign: 'middle',
formatter: function (val, row, index) {
return '<button class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-edit"></i>编辑</button>' +
'&nbsp;&nbsp;<button class="btn btn-sm btn-danger opt-remove" data-id=' + val +
'><i class="glyphicon glyphicon-remove"></i>删除</button>';
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: false,
pageList: [10, 20, 30, 50],
sidePagination: "client", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
typeId: $('#sourceSelect').val(),
status: $('#selectStatus').val()
};
return param;
},
uniqueId: 'typeId',
toolbar: '#toolbar',
url: '/admin/giftAchievement/getAchievementTypeList',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
})
/*查询刷新*/
$('#btnSearch').on('click', function () {
console.log("refresh")
TableHelper.doRefresh('#table');
});
$('#addUploadBtn').on('click', function () {
if ($('#addUploadFile').val() == '') {
$('#tipMsg').text('上传图片为空');
$('#tipModal').modal('show');
return;
}
var options = {
type: 'post',
url: '/admin/upload/img',
dataType: 'json',
success: function (res) {
if (res.path) {
$('#addActPic').val(res.path);
$('#addImgUrl').attr('src', res.path);
console.log(res.path);
} else {
$('#tipMsg').text(res.msg);
$('#tipModal').modal('show');
}
}
}
$('#addForm').ajaxSubmit(options);
})
$('#updateUploadBtn').on('click', function () {
if ($('#updateUploadFile').val() == '') {
$('#tipMsg').text('上传图片为空');
$('#tipModal').modal('show');
return;
}
var options = {
type: 'post',
url: '/admin/upload/img',
dataType: 'json',
success: function (res) {
if (res.path) {
$('#updateActPic').val(res.path);
$('#updateImgUrl').attr('src', res.path);
console.log(res.path);
} else {
$('#tipMsg').text(res.msg);
$('#tipModal').modal('show');
}
}
}
$('#updateForm').ajaxSubmit(options);
})
$('#addBtn').on('click', function () {
$("#addForm")[0].reset();
$('#genAccountModal').modal('show');
});
$("#table").on("click", '.opt-edit', function () {
$("#updateForm")[0].reset();
$('#updateStatus input[name="status"]').removeAttr('checked');
var id = $(this).attr("data-id");
var data = $('#table').bootstrapTable('getRowByUniqueId', id);
$('#updateTypeId').val(id);
$('#updateTypeName').val(data.typeName);
$('#updateStatus input[name="status"]').get(parseInt(data.status) - 1).checked = true;
$('#updateWeight').val(data.weight);
$('#updateImgUrl').attr("src", data.backgroundUrl);
$('#updateActPic').val(data.backgroundUrl);
$("#updateAccountModal").modal('show');
});
$("#add").click(function () {
if ($('#addForm').validationEngine('validate')) {
var pic = $('#addActPic').val();
if (!pic) {
$("#tipMsg").text("请先上传图片");
$("#tipModal").modal('show');
return;
}
showLoading();
$.ajax({
type: "post",
url: "/admin/giftAchievement/addAchievementType",
data: $('#addForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.code == 200) {
$("#genAccountModal").modal('hide');
$("#tipMsg").text("添加成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
hideLoading();
} else {
$("#tipMsg").text("保存失败," + json.message);
$("#tipModal").modal('show');
hideLoading();
}
}
})
}
$("#edit").click(function () {
if ($('#updateForm').validationEngine('validate')) {
var pic = $('#updateActPic').val();
if (!pic) {
$("#tipMsg").text("请先上传图片");
$("#tipModal").modal('show');
return;
}
showLoading();
$.ajax({
type: "post",
url: "/admin/giftAchievement/updateAchievementType",
data: $('#updateForm').serialize(),
dataType: 'json',
success: function (json) {
if (json.code == 200) {
$("#updateAccountModal").modal('hide');
$("#tipMsg").text("修改成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
hideLoading();
} else {
$("#tipMsg").text("保存失败," + json.message);
$("#tipModal").modal('show');
hideLoading();
}
}
})
}
});
$("#table").on("click", '.opt-remove', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗?" +
"\r\n删除后再也不能找回请谨慎操作")) {
$.ajax({
type: 'post',
url: "/admin/giftAchievement/deleteAchievementType",
data: { 'typeId': id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败," + json.message);
$("#tipModal").modal('show');
}
}
});
}
});
});
}
},
};
function setSelectOption() {
$.ajax({
type: "get",
url: '/admin/giftAchievement/getAchievementTypeList',
dataType: 'json',
success: function (json) {
if (json.data) {
makeOption(json.data);
}
}
});
}
function makeOption(data) {
var str = '<option value="0"> 全部' + '</option>';
var str2 = '';
for (var i = 0; i < data.length; i++) {
str2 += '<option value="' + data[i].typeId + '">' + data[i].typeName + '</option>';
}
$("#sourceSelect").html(str + str2);
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 200px;
padding: 4px;
background: #fff;
z-index: 1000;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
/*input,select{
margin-left: 8px;
margin-right: 8px;
}*/
#btnSearch {
margin-left: 36px;
}</style>

View File

@@ -0,0 +1,673 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-1 control-label">创始人ID:</label>
<div class="col-sm-2"><input type="text" class="col-sm-2 form-control" name="erbanNo" id="erbanNo"
placeholder="请输入创始人ID"></div>
<label for="status" class="col-sm-1 control-label">状态:</label>
<select name="status" id="status" class="col-sm-1">
<option value="0">已解散</option>
<option value="1" selected="selected">有效</option>
</select>
<label for="createTimeStart" class="col-sm-1 control-label">创建时间:</label>
<div class="col-sm-2"><input type="text" class="input-sm" name="createTimeStart"
id="createTimeStart"></div>
<label for="createTimeEnd" class="col-sm-1 control-label">:</label>
<div class="col-sm-2"><input type="text" class="input-sm" name="createTimeEnd" id="createTimeEnd">
</div>
</div>
<div class="col-sm-12">
<label for="worldNumStart" class="col-sm-1 control-label">人数:</label>
<div class="col-sm-2"><input type="text" class="col-sm-1 form-control" name="worldNumStart"
id="worldNumStart" placeholder="请输入人数"></div>
<label for="worldNumEnd" class="col-sm-1 control-label">:</label>
<div class="col-sm-2"><input type="text" class="col-sm-1 form-control" name="worldNumEnd"
id="worldNumEnd" placeholder="请输入人数"></div>
<label for="typeId" class="col-sm-1 control-label">分类:</label>
<select name="typeId" id="typeId" class="col-sm-1">
<option value="">全部</option>
</select>
<label for="recommendStatus" class="col-sm-1 control-label">推荐状态:</label>
<select name="recommendStatus" id="recommendStatus" class="col-sm-1">
<option value="-1" selected="selected">全部</option>
<option value="0">未推荐</option>
<option value="1">推荐中</option>
<option value="2">待推荐</option>
</select>
</div>
<div class="col-sm-12">
<button class="btn btn-default" id="search">
<i class="glyphicon glyphicon-wrench"></i>查询
</button>
<button class="btn btn-primary" id="add">
<i class="glyphicon glyphicon-plus"></i>增加
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
<!-- 弹窗 -->
<div class="modal fade" id="worldModal" rabindex='-1' role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<div class="modal-title" id="worldModalLabel"></div>
</div>
<div class="modal-body">
<form action="" id="addForm" class="form-horizontal">
<input type="hidden" id="modal_id" name="id" />
<div class="form-group">
<label for="modal_name" class="col-sm-3 control-label">标题</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required,maxSize[7]]" name="name"
id="modal_name" placeholder="请输入内容限定7个字符内">
</div>
</div>
<div class="form-group">
<label for="modal_description" class="col-sm-3 control-label">描述</label>
<div class="col-sm-8">
<textarea rows="3" cols="20" class="form-control validate[maxSize[100]]" name="description"
id="modal_description"
placeholder="不填写则使用默认描述[最優話題,最熱時事,盡在話題!快與兔友們分享身邊有趣的靈魂吧~]限定100个字符内"></textarea>
</div>
</div>
<div class="form-group">
<label for="modal_notice" class="col-sm-3 control-label">公告</label>
<div class="col-sm-8">
<textarea rows="3" cols="20" class="form-control validate[maxSize[500]]" name="notice"
id="modal_notice" placeholder="非必填限定500个字符内"></textarea>
</div>
</div>
<div class="form-group">
<label for="modal_worldTypeId" class="col-sm-3 control-label">话题分类</label>
<div class="col-sm-8">
<select id="modal_worldTypeId" name="worldTypeId" class="form-control validate[required]">
<option value="">请选择...</option>
</select>
</div>
</div>
<div class="form-group">
<label for="modal_ownerErbanNo" class="col-sm-3 control-label">创始人ID</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required,integer]" name="ownerErbanNo"
id="modal_ownerErbanNo" placeholder="请输入创始人平台号">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">头像</label>
<div class="col-sm-8">
<img src="" alt="" id="modal_icon" style="width: 50px; height: 50px;">
<input type="file" id="uploadFile" name="uploadFile" accept="image/*">
<button class="btn btn-success" type="button" id="uploadBtn">上传</button>
<div class="tips">
<font color="red">请上传图片文件</font>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">标签</label>
<div class="col-sm-8">
<input type="checkbox" id="modal_worldTag_1" name="worldTag" value="1" />最新 &nbsp;&nbsp;
<input type="checkbox" id="modal_worldTag_2" name="worldTag" value="2" />最热 &nbsp;&nbsp;
<input type="checkbox" id="modal_worldTag_3" name="worldTag" value="3" />官方
</div>
</div>
<div class="form-group">
<label for="modal_seqNo" class="col-sm-3 control-label">排序</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[custom[integer]]" name="seqNo"
id="modal_seqNo" value="100" placeholder="请输入排序编号升序排序默认值100">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否推荐</label>
<div class="col-sm-8">
<div>
<input type="radio" name="recommend" value="0">不推荐
</div>
<div>
<input type="radio" name="recommend" value="1">推荐
<input type="text" class="input-sm" name="startTime" id="modal_startTime" size="16">
<label></label>
<input type="text" class="input-sm" name="endTime" id="modal_endTime" size="16">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">权限</label>
<div class="col-sm-8">
<input type="radio" name="agreeFlag" value="true" />申请同意后 &nbsp;&nbsp;
<input type="radio" name="agreeFlag" value="false" />所有人可进
</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" data-primary="addSave" id="save">保存</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
var worldTags = {
"1": "最新",
"2": "最热",
"3": "官方"
};
export default {
name: "WorldAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'id', title: 'ID', align: 'center', valign: 'middle', width: '10%' },
{ field: 'name', title: '名称', align: 'left', valign: 'middle', width: '10%' },
{
field: 'icon', title: '头像', align: 'left', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if (null != val && val != '') {
return '<img src="' + val + '" alt="" style="width: 30px; height: 30px;">';
}
return '-';
}
},
{ field: 'description', title: '描述', align: 'left', valign: 'middle', width: '10%' },
{
field: 'notice', title: '公告', align: 'left', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var len = val.length;
if (len > 50) {
return val.substring(0, 50) + '...<a class="pop" data-toggle="popover" data-container="body" data-placement="top" title="公告" data-content="' + val + '">更多>></a>';
}
return val;
}
},
{ field: 'ownerErbanNo', title: '创始人', align: 'left', valign: 'middle', width: '10%' },
{ field: 'memberNum', title: '人数', align: 'left', valign: 'middle', width: '10%' },
{
field: 'recommendStatus', title: '推荐状态', align: 'left', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if ((null == row.startTime || row.startTime == '')
&& (null == row.endTime || row.getTime == '')) {
return '未推荐';
}
var startTime = new Date(row.startTime).format('yyyy-MM-dd hh:mm');
var endTime = new Date(row.endTime).format('yyyy-MM-dd hh:mm');
var date = new Date().getTime();
if (date >= row.startTime && date < row.endTime) {
return '<a data-toggle="tooltip" data-placement="bottom" title="' + startTime + '~' + endTime + '">推荐中</a>';
} else if (date < row.startTime) {
return '<a data-toggle="tooltip" data-placement="bottom" title="' + startTime + '~' + endTime + '">待推荐</a>';
} else {
return '未推荐';
}
}
},
{ field: 'typeName', title: '分类', align: 'left', valign: 'middle', width: '10%' },
{
field: 'worldTag', title: '标签', align: 'left', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if (null != val && val != '') {
var tagArray = val.split(",");
var content = '';
for (var i = 0; i < tagArray.length; i++) {
var tagIndex = tagArray[i].trim();
if (tagIndex == null || tagIndex == '') {
continue;
}
content += worldTags[tagIndex] + ",";
}
if (content != '') {
content = content.substr(0, content.length - 1);
}
return content;
}
}
},
{ field: 'seqNo', title: '排序', align: 'center', valign: 'middle', width: '10%' },
{
field: 'agreeFlag', title: '权限', align: 'center', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if (val) {
return '申请同意后';
} else {
return '所有人可进';
}
}
},
{
field: 'createTime', title: '创建时间', align: 'center', valign: 'middle', width: '20%', formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
},
{
field: 'status', title: '状态', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 0) {
return '已删除';
} else if (val == 1) {
return '有效';
} else if (val == 2) {
return '无效';
} else {
return val;
}
}
},
{ field: 'createBy', title: '创建人', align: 'center', valign: 'middle', width: '20%' },
{
field: 'tmp', title: '操作', align: 'center', valign: 'middle', width: '20%', formatter: function (val, row, index) {
var str = '';
if (row.status != 0) {
str += '<button class="btn btn-primary btn-sm opt-edit" data-id="' + row.id + '">编辑</button>&nbsp;&nbsp;'
str += '<button class="btn btn-danger btn-sm opt-remove" data-id="' + row.id + '">删除</button>&nbsp;&nbsp;';
}
return str;
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: 'server',
queryParamsType: 'undefined',
queryParams: function queryParams(params) {
var status = $('#status').val();
if (null == status || status == '') {
status = 1;
}
var erbanNo = $('#erbanNo').val();
var createTimeStart = $('#createTimeStart').val();
var createTimeEnd = $('#createTimeEnd').val();
var worldNumStart = $('#worldNumStart').val();
var worldNumEnd = $('#worldNumEnd').val();
var recommendStatus = $('#recommendStatus').val();
var typeId = $('#typeId').val();
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
status: status,
erbanNo: erbanNo,
createTimeStart: createTimeStart,
createTimeEnd: createTimeEnd,
worldNumStart: worldNumStart,
worldNumEnd: worldNumEnd,
recommendStatus: recommendStatus,
typeId: typeId
};
return param;
},
uniqueId: 'id',
toolbar: '#toolbar',
url: '/admin/world/list.action',
onLoadSuccess: function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
console.log('load success');
},
onLoadError: function () {
console.log('load fail');
}
});
//点击页面空白处理关闭popover
$('body').click(function (event) {
var target = $(event.target); // 判断自己当前点击的内容
if (!target.hasClass('popover')
&& !target.hasClass('pop')
&& !target.hasClass('popover-content')
&& !target.hasClass('popover-title')
&& !target.hasClass('arrow')) {
$('.pop').popover('hide'); // 当点击body的非弹出框相关的内容的时候关闭所有popover
}
});
$.ajax({
type: 'get',
url: "/admin/world/type/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
$('#typeId').empty();
$('#typeId').append('<option value="">全部</option>');
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#typeId').append('<option value="' + rows[i].id + '">' + rows[i].typeName + '</option>');
}
}
}
});
// 编辑按钮点击事件
$('#table').on('click', '.opt-edit', function () {
clearModal();
var id = $(this).data('id');
$.ajax({
type: "get",
url: "/admin/world/getById.action",
data: { id: id },
dataType: "json",
success: function (json) {
if (json && json.code == 200) {
var data = json.data;
$('#modal_id').val(data.id);
//推荐与不推荐
var val = 0;
var date = new Date().getTime();
if (data.startTime != null && data.endTime != null
&& ((date > data.startTime && date < data.endTime) || date < data.startTime)) {
val = 1;
}
$('input[type="radio"][name="recommend"][value=' + val + ']').prop("checked", true);
if (val == 1) {
if (null != data.startTime) {
$('#modal_startTime').val(new Date(data.startTime).format('yyyy-MM-dd hh:mm:ss'));
}
if (null != data.endTime) {
$('#modal_endTime').val(new Date(data.endTime).format('yyyy-MM-dd hh:mm:ss'));
}
}
$('#modal_name').val(data.name);
$('#modal_description').val(data.description);
$('#modal_notice').val(data.notice);
//分类
$.ajax({
type: 'get',
url: "/admin/world/type/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
$('#modal_worldTypeId').empty();
$('#modal_worldTypeId').append('<option value="">请选择...</option>');
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
if (rows[i].id == data.worldTypeId) {
$('#modal_worldTypeId').append('<option value="' + rows[i].id + '" selected="selected">' + rows[i].typeName + '</option>');
} else {
$('#modal_worldTypeId').append('<option value="' + rows[i].id + '">' + rows[i].typeName + '</option>');
}
}
}
}
});
$('#modal_ownerErbanNo').val(data.ownerErbanNo);
$('#modal_icon').attr('src', data.icon);
//标签
var worldTag = data.worldTag;
if (null != worldTag) {
var tags = worldTag.split(",");
for (var i = 0; i < tags.length; i++) {
if (tags[i] == null || tags[i] == '') {
continue;
}
$('#modal_worldTag_' + tags[i]).prop("checked", true);
}
}
$('input[type="radio"][name="agreeFlag"][value=' + data.agreeFlag + ']').prop("checked", true);
$('#modal_seqNo').val(data.seqNo);
}
}
});
$('#worldModalLabel').text('编辑世界');
$('#worldModal').modal('show');
});
$("#table").on("click", '.opt-remove', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗? \r\n 删除后再也不能找回,请谨慎操作!")) {
$.ajax({
type: 'post',
url: "/admin/world/delete.action",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
}
});
// 添加事件
$('#add').on('click', function () {
clearModal();
$('#worldModalLabel').text('新增世界');
$.ajax({
type: 'get',
url: "/admin/world/type/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
$('#modal_worldTypeId').empty();
$('#modal_worldTypeId').append('<option value="">请选择...</option>');
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#modal_worldTypeId').append('<option value="' + rows[i].id + '">' + rows[i].typeName + '</option>');
}
}
}
});
$('#worldModal').modal('show');
});
// 保存
$('#save').on('click', function () {
if ($('#addForm').validationEngine('validate')) {
var param = {};
param.id = $('#modal_id').val();
//图片
var icon = $('#modal_icon').attr('src');
if (icon == null || icon.trim() == '') {
$('#tipMsg').text('失败,头像不能为空');
$('#tipModal').modal('show');
return;
}
param.icon = icon;
//权限
var agreeFlag = $("input[name='agreeFlag']:checked").val();
if (agreeFlag == null || agreeFlag.trim() == '') {
$('#tipMsg').text('失败,权限未设置');
$('#tipModal').modal('show');
return;
}
param.agreeFlag = agreeFlag;
//是否推荐
var recommend = $("input[type='radio'][name='recommend']:checked").val();
if (recommend == null || recommend.trim() == '') {
$('#tipMsg').text('失败,推荐状态未设置');
$('#tipModal').modal('show');
return;
}
if (recommend == 1) {
var startTime = $('#modal_startTime').val();
var endTime = $('#modal_endTime').val();
if (startTime == '') {
$('#tipMsg').text('失败,推荐开始时间不能为空');
$('#tipModal').modal('show');
return;
}
if (endTime == '') {
$('#tipMsg').text('失败,推荐结束时间不能为空');
$('#tipModal').modal('show');
return;
}
if (startTime != '' && endTime != '' && startTime > endTime) {
$('#tipMsg').text('失败,推荐开始时间不能大于推荐结束时间');
$('#tipModal').modal('show');
return;
}
param.startTime = startTime;
param.endTime = endTime;
}
param.recommend = recommend;
param.id = $('#modal_id').val();
param.name = $('#modal_name').val();
param.description = $('#modal_description').val();
param.notice = $('#modal_notice').val();
param.worldTypeId = $('#modal_worldTypeId').val();
param.ownerErbanNo = $('#modal_ownerErbanNo').val();
//标签
var worldTag = [];
$("#addForm").find('input[name="worldTag"]:checked').each(function () {
worldTag.push($(this).val());
});
param.worldTag = "," + worldTag.join(",") + ",";
//排序值
var seqNo = $('#modal_seqNo').val();
if (seqNo.trim() == '') {
seqNo = 100;
}
param.seqNo = seqNo;
$.ajax({
type: 'post',
url: '/admin/world/save',
data: param,
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$('#worldModal').modal('hide');
$('#tipMsg').text('保存成功');
$('#tipModal').modal('show');
TableHelper.doRefresh('#table')
} else {
$('#tipMsg').text('保存失败,错误码:' + res.message);
$('#tipModal').modal('show');
}
}
})
}
});
$("#search").on('click', function () {
TableHelper.doRefresh('#table');
});
$('#modal_startTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
$('#modal_endTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
$('#createTimeStart').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
$('#createTimeEnd').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
// 上传图片
$('#uploadBtn').on('click', function () {
if ($('#uploadFile').val() == '') {
$('#tipMsg').text('上传图片为空');
$('#tipModal').modal('show');
return;
}
var options = {
type: 'post',
url: '/admin/upload/img',
dataType: 'json',
success: function (res) {
if (res.path) {
$('#modal_icon').attr('src', res.path);
} else {
$('#tipMsg').text(res.msg);
$('#tipModal').modal('show');
}
}
}
$('#addForm').ajaxSubmit(options);
});
function clearModal() {
$('#addForm')[0].reset();
$('#addForm').validationEngine('hideAll');
$('#modal_id').val('');
$('#modal_icon').attr('src', '');
}
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,310 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-2 control-label">66ID:</label>
<div class="col-sm-2"><input type="text" class="col-sm-2 form-control" name="erbanNo" id="erbanNo"
placeholder="66ID"></div>
<label for="worldId" class="col-sm-2 control-label">世界ID:</label>
<div class="col-sm-2"><input type="text" class="col-sm-2 form-control" name="worldId" id="worldId"
placeholder="请输入世界ID"></div>
<label for="status" class="col-sm-1 control-label">状态:</label>
<select name="status" id="status" class="col-sm-2">
<option value="0">已删除</option>
<option value="1" selected="selected">有效</option>
</select>
</div>
<div class="col-sm-12">
<button class="btn btn-default" id="search">
<i class="glyphicon glyphicon-wrench"></i>查询
</button>
<button class="btn btn-primary" id="addBatch">
<i class="glyphicon glyphicon-plus"></i>添加成员
</button>
<button class="btn btn-danger" id="removeBatch">
<i class="glyphicon glyphicon-plus"></i>批量移除
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
<!-- 弹窗 -->
<div class="modal fade" id="worldMemberModal" rabindex='-1' role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<div class="modal-title" id="worldMemberModalLabel"></div>
</div>
<div class="modal-body">
<form action="" id="addForm" class="form-horizontal">
<div class="form-group">
<label for="modal_worldId" class="col-sm-3 control-label">世界id</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required,integer]" name="worldId"
id="modal_worldId" placeholder="请输入世界id">
</div>
</div>
<div class="form-group">
<label for="modal_erbanNos" class="col-sm-3 control-label">66Id</label>
<div class="col-sm-8">
<textarea rows="3" cols="20" class="form-control validate[required,maxSize[500]]"
name="erbanNos" id="modal_erbanNos" placeholder="请输入66id,多个使用“,”分开"></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" data-primary="addSave" id="save">保存</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "WorldMemberAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'tmp', title: '', align: 'center', checkbox: true, width: '5%' },
{ field: 'id', title: 'ID', align: 'center', valign: 'middle', width: '10%' },
{ field: 'erbanNo', title: '66ID', align: 'left', valign: 'middle', width: '10%' },
{ field: 'nick', title: '昵称', align: 'left', valign: 'middle', width: '10%' },
{ field: 'worldName', title: '所在世界', align: 'left', valign: 'middle', width: '10%' },
{
field: 'muteFlag', title: '禁言状态', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 0) {
return '正常';
} else if (val == 1) {
return '禁言';
} else {
return val;
}
}
},
{
field: 'promtFlag', title: '消息提醒', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 0) {
return '屏蔽';
} else if (val == 1) {
return '正常';
} else {
return val;
}
}
},
{
field: 'status', title: '状态', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 0) {
return '已删除';
} else if (val == 1) {
return '有效';
} else if (val == 2) {
return '无效';
} else {
return val;
}
}
},
{
field: '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: 'tmps', title: '操作', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var str = '';
// if(row.muteFlag == 0) {
// str += '<button class="btn btn-success btn-sm opt-cancel-mute" data-id="' + row.id + '">解禁</button>&nbsp;&nbsp;';
// } else if(row.muteFlag == 1) {
// str += '<button class="btn btn-warning btn-sm opt-mute" data-id="' + row.id + '">禁言</button>&nbsp;&nbsp;';
// }
if (row.status == 1) {
str += '<button class="btn btn-danger btn-sm opt-remove" data-id="' + row.id + '">移除</button>&nbsp;&nbsp;'
}
return str;
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: 'server',
queryParamsType: 'undefined',
queryParams: function queryParams(params) {
var status = $('#status').val();
if (null == status || status == '') {
status = 1;
}
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
status: status,
erbanNo: $('#erbanNo').val(),
worldId: $('#worldId').val()
};
return param;
},
uniqueId: 'id',
toolbar: '#toolbar',
url: '/admin/world/member/list.action',
onLoadSuccess: function () {
console.log('load success');
},
onLoadError: function () {
console.log('load fail');
}
});
$("#table").on("click", '.opt-remove', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗? \r\n 删除后再也不能找回,请谨慎操作!")) {
$.ajax({
type: 'post',
url: "/admin/world/member/delete.action",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
}
});
// 添加事件
$('#addBatch').on('click', function () {
clearModal();
$('#worldMemberModalLabel').text('添加成员');
$('#worldMemberModal').modal('show');
});
// 保存
$('#save').on('click', function () {
if ($('#addForm').validationEngine('validate')) {
var param = {};
param.worldId = $('#modal_worldId').val();
param.erbanNos = $('#modal_erbanNos').val();
$.ajax({
type: 'post',
url: '/admin/world/member/saveBatch',
data: param,
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$('#worldMemberModal').modal('hide');
$('#tipMsg').text('保存成功');
$('#tipModal').modal('show');
TableHelper.doRefresh('#table')
} else {
$('#tipMsg').text('保存失败,错误码:' + res.message);
$('#tipModal').modal('show');
}
}
})
}
});
$("#removeBatch").click(function () {
var rows = $("#table").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要删除的记录");
return;
}
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['id']);
}
console.log(idArr);
if (confirm("你确认批量删除该记录吗?" + "\r\n删除后再也不能找回请谨慎操作")) {
$.ajax({
type: 'post',
url: "/admin/world/member/deleteBatch.action",
data: { 'ids': idArr.join(",") },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
}
});
$("#search").on('click', function () {
TableHelper.doRefresh('#table');
});
function clearModal() {
$('#addForm')[0].reset();
$('#addForm').validationEngine('hideAll');
$('#modal_id').val('');
}
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,424 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<div class="col-sm-12">
<label for="typeNameLike" class="col-sm-1 control-label">标题:</label>
<div class="col-sm-2"><input type="text" class="col-sm-2 form-control" name="typeNameLike"
id="typeNameLike" placeholder="请输入标题"></div>
<label for="status" class="col-sm-1 control-label">状态:</label>
<select name="status" id="status" class="col-sm-1">
<option value="0">已删除</option>
<option value="1" selected="selected">有效</option>
</select>
<label for="createTimeStart" class="col-sm-1 control-label">创建时间:</label>
<div class="col-sm-2"><input type="text" class="input-sm" name="createTimeStart"
id="createTimeStart"></div>
<label for="createTimeEnd" class="col-sm-1 control-label">:</label>
<div class="col-sm-2"><input type="text" class="input-sm" name="createTimeEnd" id="createTimeEnd">
</div>
</div>
<div class="col-sm-12">
<button class="btn btn-default" id="search">
<i class="glyphicon glyphicon-wrench"></i>查询
</button>
<button class="btn btn-primary" id="add">
<i class="glyphicon glyphicon-plus"></i>增加
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
<!-- 弹窗 -->
<div class="modal fade" id="worldTypeModal" rabindex='-1' role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<div class="modal-title" id="worldTypeModalLabel"></div>
</div>
<div class="modal-body">
<form action="" id="addForm" class="form-horizontal">
<input type="hidden" id="modal_id" name="id" />
<div class="form-group">
<label for="modal_typeName" class="col-sm-3 control-label">标题</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required,maxSize[10]]" name="typeName"
id="modal_typeName" placeholder="请输入内容限定10个字符内">
</div>
</div>
<div class="form-group">
<label for="modal_seqNo" class="col-sm-3 control-label">排序</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[required,custom[integer]]" name="seqNo"
id="modal_seqNo" placeholder="请输入排序编号,越小越排前">
</div>
</div>
<div class="form-group">
<label for="modal_topShowFlag" class="col-sm-3 control-label">世界广场</label>
<div class="col-sm-8">
<select id="modal_topShowFlag" name="topShowFlag" class="form-control validate[required]">
<option value="">请选择...</option>
<option value="1">展示</option>
<option value="0">隐藏</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">标签</label>
<div class="col-sm-8">
<img src="" alt="" id="modal_tagPic" style="width: 50px; height: 50px;">
<input type="file" id="uploadTagPic" accept="image/*">
<button class="btn btn-success" type="button" id="uploadTagPicBtn">上传</button>
<div class="tips">
<i class="glyphicon glyphicon-info-sign"></i>
<font color="red">请上传图片文件</font>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">图标</label>
<div class="col-sm-8">
<img src="" alt="" id="modal_pict" style="width: 50px; height: 50px;">
<input type="file" id="uploadPict" accept="image/*">
<button class="btn btn-success" type="button" id="uploadPictBtn">上传</button>
<div class="tips">
<i class="glyphicon glyphicon-info-sign"></i>
<font color="red">请上传图片文件</font>
</div>
</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" data-primary="addSave" id="save">保存</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "WorldTypeAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'id', title: 'ID', align: 'center', valign: 'middle', width: '10%' },
{ field: 'typeName', title: '分类标题', align: 'left', valign: 'middle', width: '10%' },
{ field: 'worldNum', title: '世界数', align: 'left', valign: 'middle', width: '10%' },
{
field: 'topShowFlag', title: '世界广场', align: 'left', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if (val == 1) {
return '展示';
} else if (val == 0) {
return '隐藏';
} else {
return val;
}
}
},
{
field: 'pict', title: '图标', align: 'left', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if (null != val && val != '') {
return '<img src="' + val + '" alt="" style="width: 30px; height: 30px;">';
}
return '-';
}
},
{
field: 'tagPic', title: '标签', align: 'left', valign: 'middle', width: '10%',
formatter: function (val, row, index) {
if (null != val && val != '') {
return '<img src="' + val + '" alt="" style="width: 30px; height: 30px;">';
}
return '-';
}
},
{ field: 'seqNo', title: '排序', align: 'center', valign: 'middle', width: '10%' },
{
field: 'status', title: '状态', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
if (val == 0) {
return '已删除';
} else if (val == 1) {
return '有效';
} else if (val == 2) {
return '无效';
} else {
return val;
}
}
},
{
field: '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: 'tmp', title: '操作', align: 'center', valign: 'middle', width: '10%', formatter: function (val, row, index) {
var str = '';
if (row.status != 0) {
str += '<button class="btn btn-primary btn-sm opt-edit" data-id="' + row.id + '">编辑</button>&nbsp;&nbsp;'
if (row.worldNum <= 0) {
str += '<button class="btn btn-danger btn-sm opt-remove" data-id="' + row.id + '">删除</button>&nbsp;&nbsp;';
}
}
return str;
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: 'server',
queryParamsType: 'undefined',
queryParams: function queryParams(params) {
var status = $('#status').val();
if (null == status || status == '') {
status = 1;
}
var param = {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
status: status,
typeNameLike: $('#typeNameLike').val(),
createTimeStart: $('#createTimeStart').val(),
createTimeEnd: $('#createTimeEnd').val()
};
return param;
},
uniqueId: 'id',
toolbar: '#toolbar',
url: '/admin/world/type/list.action',
onLoadSuccess: function () {
console.log('load success');
},
onLoadError: function () {
console.log('load fail');
}
});
// 编辑按钮点击事件
$('#table').on('click', '.opt-edit', function () {
clearModal();
var id = $(this).data('id');
$.ajax({
type: "get",
url: "/admin/world/type/getById.action",
data: { id: id },
dataType: "json",
success: function (json) {
if (json && json.code == 200) {
var data = json.data;
$('#modal_id').val(data.id);
$('#modal_typeName').val(data.typeName);
$('#modal_seqNo').val(data.seqNo);
$('#modal_topShowFlag').val(data.topShowFlag);
$('#modal_tagPic').attr('src', data.tagPic);
$('#modal_pict').attr('src', data.pict);
}
}
});
$('#worldTypeModalLabel').text('编辑分类');
$('#worldTypeModal').modal('show');
});
$("#table").on("click", '.opt-remove', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗? \r\n 删除后再也不能找回,请谨慎操作!")) {
$.ajax({
type: 'post',
url: "/admin/world/type/delete.action",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
}
});
// 添加事件
$('#add').on('click', function () {
clearModal();
$('#worldTypeModalLabel').text('新增分类');
$('#worldTypeModal').modal('show');
});
// 保存
$('#save').on('click', function () {
if ($('#addForm').validationEngine('validate')) {
var param = {};
param.id = $('#modal_id').val();
//客户端标签
var tagPic = $('#modal_tagPic').attr('src');
if (null == tagPic || tagPic.trim() == '') {
$('#tipMsg').text('失败,标签未上传,请上传标签!');
$('#tipModal').modal('show');
return;
}
param.tagPic = tagPic;
//图标
var pict = $('#modal_pict').attr('src');
if (null == pict || pict.trim() == '') {
$('#tipMsg').text('失败,图标未上传,请上传图标!');
$('#tipModal').modal('show');
return;
}
param.pict = pict;
param.typeName = $('#modal_typeName').val();
param.seqNo = $('#modal_seqNo').val();
param.topShowFlag = $('#modal_topShowFlag').val();
$.ajax({
type: 'post',
url: '/admin/world/type/save',
data: param,
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$('#worldTypeModal').modal('hide');
$('#tipMsg').text('保存成功');
$('#tipModal').modal('show');
TableHelper.doRefresh('#table')
} else {
$('#tipMsg').text('保存失败,错误码:' + res.message);
$('#tipModal').modal('show');
}
}
})
}
});
$("#search").on('click', function () {
TableHelper.doRefresh('#table');
});
var chargeStart = $('#createTimeStart').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
var chargeEnd = $('#createTimeEnd').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
function clearModal() {
$('#addForm')[0].reset();
$('#addForm').validationEngine('hideAll');
$('#modal_id').val('');
$('#modal_tagPic').attr('src', '');
$('#modal_pict').attr('src', '');
}
// 上传标签
$('#uploadTagPicBtn').on('click', function () {
if ($('#uploadTagPic').val() == '') {
$('#tipMsg').text('上传图片为空');
$('#tipModal').modal('show');
return;
}
var options = {
type: 'post',
url: '/admin/upload/img',
dataType: 'json',
success: function (res) {
if (res.path) {
$('#modal_tagPic').attr('src', res.path);
} else {
$('#tipMsg').text(res.msg);
$('#tipModal').modal('show');
}
}
}
$('#uploadTagPic').attr('name', 'uploadFile');
$('#uploadPict').attr('name', '');
$('#addForm').ajaxSubmit(options);
});
// 上传图标
$('#uploadPictBtn').on('click', function () {
if ($('#uploadPict').val() == '') {
$('#tipMsg').text('上传图片为空');
$('#tipModal').modal('show');
return;
}
var options = {
type: 'post',
url: '/admin/upload/img',
dataType: 'json',
success: function (res) {
if (res.path) {
$('#modal_pict').attr('src', res.path);
} else {
$('#tipMsg').text(res.msg);
$('#tipModal').modal('show');
}
}
}
$('#uploadPict').attr('name', 'uploadFile');
$('#uploadTagPic').attr('name', '');
$('#addForm').ajaxSubmit(options);
});
});
}
},
};
</script>
<style scoped></style>

View File

@@ -0,0 +1,703 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<div id="table"></div>
<div id="toolbar" style="height: auto;">
<form id="searchForm" class="col-sm-pull-12" action="/admin/comment/verify/export" method="post"
target="_blank">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-1 control-label">平台号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="erbanNo" id="erbanNo"></div>
<label for="nick" class="col-sm-1 control-label">昵称:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="nick" id="nick"></div>
<label for="status" class="col-sm-1 control-label">状态:</label>
<div class="col-sm-2">
<select name="status" id="status" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
</select>
</div>
</div>
<div class="col-sm-12">
<label class="col-sm-1 control-label">发布时间:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="beginDate" id="beginDate">
</div><span class="col-sm-1"></span>
<div class="col-sm-2"><input type="text" class="form-control" name="endDate" id="endDate"></div>
<label for="wolrdId" class="col-sm-1 control-label">话题名称:</label>
<div class="col-sm-2">
<select name="wolrdId" id="wolrdId" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
<option value="-1">动态广场</option>
</select>
</div>
</div>
</form>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnReset" class="btn btn-default">
<i class="glyphicon glyphicon-remove"></i>重置
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
<button id="btnBatchNotPass" class="pull-right btn btn-danger opt-batch-not-pass">
<i class="glyphicon glyphicon-remove"></i>批量下架
</button>
</div>
</div>
</div>
</div>
</section>
<div class="modal fade" id="notPassModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe2">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe2">请选择下架原因</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="notPassForm">
<input type="hidden" name="id" id="comment1" />
<input type="hidden" name="status" id="status1" />
<input type="hidden" name="id" id="dynamicId1" />
<div class="form-group">
<div class="col-sm-10">
<select id="quick_reason" class="form-control" data-btn-class="btn-warning"
onchange="setReason()">
<option value="0">評論可能包含辱罵攻擊他人等不文明內容</option>
<option value="1">評論涉及色情暴力病毒等違規內容</option>
<option value="2">評論包含政治敏感信息</option>
<option value="3">評論包含廣告營銷內容</option>
<option value="4">評論可能包含個人隱私信息或涉及他人營私信息</option>
<option value="5">評論可能涉及線下交易</option>
<option value="6">評論內容無意義</option>
<option value="7">其他手動填寫</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<textarea name="reason" id="reason" class="form-control" rows="3"></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="not-pass-save">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="notPassBatchModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe2">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe3">请选择下架原因</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="notPassBatchModalForm">
<input type="hidden" name="notPassBatchIds" id="notPassBatchIds" />
<div class="form-group">
<div class="col-sm-10">
<select id="quick_reason1" class="form-control" data-btn-class="btn-warning"
onchange="setBatchReason()">
<option value="0">評論可能包含辱罵攻擊他人等不文明內容</option>
<option value="1">評論涉及色情暴力病毒等違規內容</option>
<option value="2">評論包含政治敏感信息</option>
<option value="3">評論包含廣告營銷內容</option>
<option value="4">評論可能包含個人隱私信息或涉及他人營私信息</option>
<option value="5">評論可能涉及線下交易</option>
<option value="6">評論內容無意義</option>
<option value="7">其他手動填寫</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<textarea name="reason1" id="reason1" class="form-control" rows="3"></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="not-pass-batch-save">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe1">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe1">评论详情</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="myFrom">
<div class="form-group">
<label class="col-sm-3 control-label">话题:</label>
<div class="col-sm-8">
<span class="control-span" id="worldName"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">动态内容:</label>
<div class="col-sm-8">
<ul class="sidebar-menu">
<li class="control-span" id="content" style="margin-bottom: 20px !important;"></li>
<li id="resUrl"></li>
</ul>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">相关评论:</label>
<div class="col-sm-8">
<ul class="sidebar-menu" id="ul-comment">
</ul>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { showLoading, hideLoading } from '@/utils/maintainer';
var picker1 = $("#beginDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
todayBtn: true
});
var picker2 = $("#endDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
todayBtn: true
});
picker1.on('changeDate', function () {
var date = $('#beginDate').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#endDate').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
export default {
name: "CommentVerifyView",
setup() {
function setBatchReason() {
if ($("#quick_reason1 option:selected").val() != 7) {
$("#reason1").val($("#quick_reason1 option:selected").text());
} else {
$("#reason1").val('');
}
}
function setReason() {
if ($("#quick_reason option:selected").val() != 7) {
$("#reason").val($("#quick_reason option:selected").text());
} else {
$("#reason").val('');
}
}
window.setBatchReason = setBatchReason;
window.setReason = setReason;
return {
setBatchReason,
setReason
};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
setStatusSelectOption();
setTypeSelectOption();
$('#table').bootstrapTable({
columns: [
//{field: 'id', title: 'id', align: 'center', width: '5%'},
{ field: 'id', title: 'id', align: 'center', width: '5%', visible: false },
{ field: 'checkbox', title: '', align: 'center', checkbox: true, width: '5%' },
{ field: 'worldName', title: '话题', align: 'center', width: '5%' },
{ field: 'erbanNo', title: '平台号', align: 'center', width: '5%' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%' },
{ field: 'content', title: '评论内容', align: 'center', width: '5%' },
{
field: 'createTime',
title: '发布时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{ field: 'statusStr', title: '状态', align: 'center', width: '5%' },
{ field: 'updateBy', title: '操作人', align: 'center', width: '5%' },
{
field: 'updateTime',
title: '操作时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{
field: 'commentId',
title: '操作',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
var details = '<button class="btn btn-sm btn-primary opt-detail" data-id=' + val + ' data-dynamic=' + row.dynamicId + '>查看详情</button>';
var unshelve = '<button class="btn btn-sm btn-danger opt-not-pass" data-id=' + val + ' data-status=3 data-dynamic=' + row.dynamicId + '>下&#12288;架</button>';
if (row.status == 0) {
return details + '</br>' + unshelve;
} else {
return details;
}
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 50, 100],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "-",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#erbanNo').val(),
nick: $('#nick').val(),
status: $('#status').val(),
beginDate: $('#beginDate').val(),
endDate: $('#endDate').val(),
wolrdId: $('#wolrdId').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/comment/verify/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
//重置
$('#btnReset').on('click', function () {
$('#erbanNo').val("");
$('#nick').val("");
$('#status').val("");
$('#beginDate').val("");
$('#endDate').val("");
});
//审核不通过/下架弹框
$("#table").on("click", '.opt-not-pass', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
var dynamicId = $(this).attr("data-dynamic");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (status == 'undefined') {
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
if (dynamicId == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
$("#comment1").val(id);
$("#status1").val(status);
$("#dynamicId1").val(dynamicId);
// 打开编辑弹窗
$("#notPassModal").modal('show');
window.setReason();
});
//下架弹窗
$("#not-pass-save").click(function () {
cleanModal();
var id = $("#comment1").val();
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
var status = $("#status1").val();
if (status == 'undefined') {
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
var dynamicId1 = $("#dynamicId1").val();
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
var reason = $("#reason").val();
if (reason.length <= 0) {
alert("请输入原因!");
return;
}
verify("下架", id, status, reason, dynamicId1);
});
//批量下架
$("#btnBatchNotPass").on('click', function () {
var rows = $("#table").bootstrapTable("getSelections");
console.log(rows);
if (rows.length == 0) {
alert("请勾选要下架的评论");
return;
}
var idArr = [];
for (var i = 0; i < rows.length; i++) {
if (rows[i]['status'] == 3) {
alert("请勾选状态为【正常】的评论");
return;
}
var obj = {};
obj.id = rows[i]['commentId'];
obj.dynamicId = rows[i]['dynamicId'];
idArr.push(obj);
}
console.log(idArr);
// 打开编辑弹窗
$("#notPassBatchModal").modal('show');
batchIds = idArr;
window.setBatchReason();
});
var batchIds = [];
//批量下架弹窗
$("#not-pass-batch-save").on('click', function () {
cleanModal();
var idArr = batchIds;
console.log(idArr);
var reason = $("#reason1").val();
console.log(reason);
if (reason.length <= 0) {
alert("请输入原因!");
return;
}
var reqData = {};
reqData.idAndDynamicIdList = idArr;
reqData.status = 3;
reqData.reason = reason;
console.log(reqData);
if (confirm("确认批量下架选中记录吗?")) {
$.ajax({
type: 'post',
url: "/admin/comment/verify/batchChangeStatus",
data: JSON.stringify(reqData),
dataType: "json",
contentType: "application/json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("批量下架成功");
batchIds = [];
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("批量下架失败");
$("#tipModal").modal('show');
}
},
error: function () {
$("#tipMsg").text("批量下架失败.");
$("#tipModal").modal('show');
}
});
}
$("#notPassBatchModal").modal('hide');
})
//查看详情
$("#table").on("click", '.opt-detail', function () {
cleanModal();
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
var dynamicId = $(this).attr("data-dynamic");
if (dynamicId == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
$.ajax({
type: "get",
url: "/admin/comment/verify/getDetail.action",
data: {
commentId: id,
dynamicId: dynamicId
},
dataType: "json",
success: function (json) {
if (json && json.code == 200) {
var data = json.data;
//世界名称
if (!isEmpty(data.worldName)) {
$('#worldName').text(data.worldName);
}
//动态内容
if (!isEmpty(data.dynamicContent)) {
$('ul #content').text(data.dynamicContent);
}
//动态资源
if (!isEmpty(data.resUrl)) {
let html = "";
if (data.type == 1) {
html = '<audio controls="controls"><source src="' + data.resUrl + '" type="audio/mpeg"></audio>';
} else if (data.type == 2) {
html = '<div style="width: 320px;">';
var resUrls = data.resUrl.split(",");
for (var i = 0; i < resUrls.length; i++) {
if (!isEmpty(resUrls[i])) {
html += '<img id="imgs" src="' + resUrls[i] + '" style="width: 100px;height: 100px;">';
}
}
html += '</div>';
} else if (data.type == 3) {
html = '<video width="320" height="240" controls autoplay><source src="' + data.resUrl + '" type="video/mp4"></video>';
}
$('ul #resUrl').html(html);
}
//评论内容
if (!isEmpty(data.commentVos)) {
let html = "";
var comment = data.commentVos;
for (let i = 0; i < comment.length; i++) {
if (!isEmpty(comment[i])) {
html += '<li class="ul-li"><span class="control-span"><i class="ul-i">' + comment[i].nick +
'</i><label>' + comment[i].createTime + '</label></span>' + '<span class="control-span">';
if (!isEmpty(comment[i].toNick)) {
html += '<i class="ul-i i-font">@' + comment[i].toNick + '</i>';
}
html += comment[i].content + '</span></li>';
}
}
$('#ul-comment').html(html);
}
}
}
});
$("#detailModal").modal('show');
});
//导出
$('#btnExport').on('click', function () {
var erbanNo = $('#erbanNo').val();
var nick = $('#nick').val();
var status = $('#status').val();
var beginDate = $('#beginDate').val();
var endDate = $('#endDate').val();
var wolrdId = $('#wolrdId').val();
if (isEmpty(erbanNo) && isEmpty(nick) && isEmpty(status) && isEmpty(beginDate) && isEmpty(endDate) && isEmpty(wolrdId)) {
$("#tipMsg").text("请输入导出条件!");
$("#tipModal").modal('show');
return;
}
$('#searchForm').submit();
});
});
}
},
};
//清空模态框
function cleanModal() {
$('ul #resUrl').html("");
$('ul #content').text("");
$('#worldName').text("");
$('#ul-comment').html("");
}
//判断空值
function isEmpty(data) {
if (data == null || data == undefined || data == "") {
return true;
}
return false;
}
//审核
function verify(text, id, status, reason, dynamicId) {
if (confirm("你确认【" + text + "】该评论吗?")) {
showLoading();
$.ajax({
type: 'post',
url: "/admin/comment/verify/changeStatus.action",
data: {
commentId: id,
status: status,
reason: reason,
dynamicId: dynamicId
},
dataType: "json",
success: function (json) {
hideLoading();
if (status == 3) {
$("#notPassModal").modal('hide');
}
if (json.success == 'true') {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
}
}
function setStatusSelectOption() {
$.ajax({
type: 'get',
url: "/admin/comment/verify/getStatus.action",
success: function (json) {
if (json != null && json != undefined) {
var rows = json;
for (var i = 0; i < rows.length; i++) {
$('#status').append('<option value="' + rows[i].value + '">' + rows[i].key + '</option>');
}
}
}
});
}
function setTypeSelectOption() {
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#wolrdId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
});
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
width: 450px;
height: 450px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
width: 100%;
height: 100%;
vertical-align: top;
}
.control-span {
padding-top: 7px;
margin-bottom: 0;
font-weight: 400;
display: block;
}
.ul-li {
margin-bottom: 20px !important;
}
.ul-i {
margin-right: 10px !important;
}
.i-font {
color: #00acd6;
}
.ul-li label {
color: #c9cccf;
}
.fixed-table-body {
height: auto !important;
}</style>

View File

@@ -0,0 +1,883 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<div id="table"></div>
<div id="toolbar" style="height: auto;">
<form id="searchForm" class="col-sm-pull-12" action="/admin/dynamic/data/export" method="post"
target="_blank">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-1 control-label">平台号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="erbanNo" id="erbanNo"></div>
<label for="nick" class="col-sm-1 control-label">昵称:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="nick" id="nick"></div>
<label for="wolrdId" class="col-sm-1 control-label">话题类型:</label>
<div class="col-sm-2">
<select name="wolrdId" id="wolrdId" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
<option value="-1">非话题动态</option>
</select>
</div>
<label for="wolrdId" class="col-sm-1 control-label">是否置顶:</label>
<div class="col-sm-2">
<select name="topStatus" id="topStatus" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
<option value="1">广场置顶</option>
<option value="2">话题置顶</option>
<option value="-1"></option>
</select>
</div>
</div>
<div class="col-sm-12">
<label class="col-sm-1 control-label">发布时间:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="beginDate" id="beginDate">
</div><span class="col-sm-1"></span>
<div class="col-sm-2"><input type="text" class="form-control" name="endDate" id="endDate"></div>
<!--<label class="col-sm-1 control-label">热度值:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="hotValueStart"
id="hotValueStart" placeholder="请输入热度值"></div><span class="col-sm-1"></span>
<div class="col-sm-2"><input type="text" class="form-control" name="hotValueEnd" id="hotValueEnd" placeholder="请输入热度值"></div>-->
<label for="wolrdId" class="col-sm-1 control-label">标签类型:</label>
<div class="col-sm-2">
<select name="dynamicLab" id="dynamicLab" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
<option value="1">官方</option>
<option value="2">活动</option>
<option value="3">互动</option>
<option value="4">热门</option>
<option value="5">推荐</option>
<option value="6"></option>
<option value="-1"></option>
</select>
</div>
</div>
</form>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnReset" class="btn btn-default">
<i class="glyphicon glyphicon-remove"></i>重置
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
</div>
<!--<div class="col-sm-12">
热度值规则分享人数 * <span id="shareRule">0</span> + 评论人数 * <span id="commentRule">0</span> + 点赞人数 * <span id="likeRule">0</span>
<button id="btnEdit" class="btn btn-default">修改规则</button>
</div>-->
</div>
</div>
</div>
</section>
<div class="modal fade" id="showModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 500px;">
<div class="modal-header">
<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>
</div>
<div class="modal-body">
<div class="show" style="margin-left: 60px">
</div>
</div>
<div id="imgMask"><img src="" alt=""></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe2">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe2">修改热度值</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="editForm">
<input type="hidden" name="id" id="dynamicId" />
<!--<input type="hidden" name="status" id="status1"/>
<div class="form-group">
<label class="col-sm-3 control-label">自然热度值:</label>
<div class="col-sm-8">
<span class="control-span" id="cusHotValue"></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label"></label>
<div class="col-sm-8">
<input type="text" name="hotValue" id="hotValueChange" class="form-control" placeholder="请输入热度值" />
</div>
</div>-->
<label class="col-sm-3 control-label">标签</label>
<div class="col-sm-8">
<input type="checkbox" id="dynamic_lab_1" name="dynamicLab" value="1" />官方&nbsp;&nbsp;
<input type="checkbox" id="dynamic_lab_2" name="dynamicLab" value="2" />活动&nbsp;&nbsp;
<input type="checkbox" id="dynamic_lab_3" name="dynamicLab" value="3" />互动<br /><br />
<input type="checkbox" id="dynamic_lab_4" name="dynamicLab" value="4" />热门&nbsp;&nbsp;
<input type="checkbox" id="dynamic_lab_5" name="dynamicLab" value="5" />推荐&nbsp;&nbsp;
<input type="checkbox" id="dynamic_lab_6" name="dynamicLab" value="6" />
</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="editLabSave">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="editRuleModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe3">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe3">修改规则</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="ruleForm">
<div class="form-group">
<label class="control-label">热度值 = 分享人数*</label>
<input type="text" name="hotValue" id="shareNum" placeholder="请输入整数" />
<label class=" control-label"> + 评论人数 * </label>
<input type="text" name="hotValue" id="commentNum" placeholder="请输入整数" />
<label class="control-label" style="margin-left: 45px"> + 点赞人数 * </label>
<input type="text" name="hotValue" id="likeNum" placeholder="请输入整数" />
</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_rule">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="showContentModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe4">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 500px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe4">查看动态内容详情</h4>
</div>
<div class="modal-body">
<span id="dynamic-content"></span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { showLoading, hideLoading } from '@/utils/maintainer';
var picker1 = $("#beginDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
todayBtn: true
});
var picker2 = $("#endDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
todayBtn: true
});
picker1.on('changeDate', function () {
var date = $('#beginDate').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#endDate').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
export default {
name: "DynamicDataView",
setup() {
function showVideo(resUrl, id) {
var html = '<video width="320" height="240" controls autoplay><source src="' + resUrl + '" type="video/mp4"></video>';
// 打开编辑弹窗
$("#showModal").modal('show');
$("#dynamicId").val(id);
$(".show").html(html);
}
function showPic(resUrl, id) {
var html = '<div style="width: 320px;">';
console.log(resUrl);
if (resUrl != null && resUrl != '' && resUrl != undefined) {
var resUrls = resUrl.split(",");
for (var i = 0; i < resUrls.length; i++) {
if (resUrls[i] != null && resUrls[i] != undefined && resUrls[i] != "") {
html += '<img id="imgs" src="' + resUrls[i] + '" style="width: 100px;height: 100px;">';
}
}
}
html += '</div>';
// 打开编辑弹窗
$("#showModal").modal('show');
$("#dynamicId").val(id);
$(".show").html(html);
}
function showContent(note) {
var content = $(note).parent().find('input').val();
$('#dynamic-content').text(content);
$('#showContentModal').modal('show');
}
window.showVideo = showVideo;
window.showPic = showPic;
window.showContent = showContent;
return {
showVideo,
showPic,
showContent
};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
setTypeSelectOption();
getHotValueRule();
$('#table').bootstrapTable({
columns: [
//{field: 'id', title: 'id', align: 'center', width: '5%'},
{ field: 'tmp', title: 'id', align: 'center', checkbox: true, width: '5%' },
{ field: 'erbanNo', title: '平台号', align: 'center', width: '5%' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%' },
{ field: 'gender', title: '性别', align: 'center', width: '5%' },
{ field: 'worldName', title: '话题', align: 'center', width: '5%' },
{
field: 'content',
title: '动态内容',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (isEmpty(val)) {
return "-";
} else {
if (val.length > 50) {
var content = "<input type='hidden' id='input-content' value='" + val + "'>";
return val.substring(0, 50) + "..." + content + "<button href='#' class='btn btn-sm' style='color: #00acd6;background:none' onclick=showContent(this) style='margin-left: 10px;'>查看更多</a>";
} else {
return val;
}
}
}
},
{ field: 'dynamicLab', title: '标签', align: 'center', width: '5%' },
{
field: 'resUrl',
title: '图片/视频/语音',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (row.type == 1) {
return '<audio controls="controls"><source src="' + val + '" type="audio/mpeg"></audio>';
} else if (row.type == 2) {
return "<button href='#' class='btn btn-sm' style='color: #00acd6;background:none' onclick=showPic('" + row.resUrl + "'," + row.id + ")>查看图片</button>";
} else if (row.type == 3) {
return "<button href='#' class='btn btn-sm' style='color: #00acd6;background:none' onclick=showVideo('" + row.resUrl + "'," + row.id + ")>查看视频</button>";
}
}
},
/*{field: 'share', title: '分享人数/次数', align: 'center', width: '5%'},
{field: 'commment', title: '评论人数/次数', align: 'center', width: '5%'},
{field: 'like', title: '点赞人数/次数', align: 'center', width: '5%'},
{field: 'readNum', title: '阅读数', align: 'center', width: '5%'},
{field: 'hotValue', title: '热度值', align: 'center', width: '5%'},*/
{
field: 'createTime',
title: '发布时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{
field: 'id',
title: '操作',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
var editLabel = '<button class="btn btn-sm btn-info opt-label-edit" data-id=' + val + ' data-status=1 data-value=' + row.hotValue + ' data-tip=' + row.hotChangeFlag + '>编辑标签</button>';
var openSquareTop;
if (row.squareTop == null || row.squareTop == undefined || row.squareTop == 0) {
openSquareTop = '<button class="btn btn-sm btn-success square_top_switch" data-id=' + val + ' data-status=1 data-value=' + row.hotValue + ' data-squareTop=' + row.squareTop + '>开启广场置顶</button>';
} else if (row.squareTop == 1) {
openSquareTop = '<button class="btn btn-sm btn-info square_top_switch" data-id=' + val + ' data-status=1 data-value=' + row.hotValue + ' data-squareTop=' + row.squareTop + '>关闭广场置顶</button>';
}
var openTopicTop = '';
if (row.isHaveTopic) {
if (row.topicTop == null || row.topicTop == undefined || row.topicTop == 0) {
openTopicTop = '<button class="btn btn-sm btn-success topic_top_switch" data-id=' + val + ' data-status=1 data-value=' + row.hotValue + ' data-topicTop=' + row.topicTop + '>开启话题置顶</button>';
} else if (row.topicTop == 1) {
openTopicTop = '<button class="btn btn-sm btn-info topic_top_switch" data-id=' + val + ' data-status=1 data-value=' + row.hotValue + ' data-topicTop=' + row.topicTop + '>关闭话题置顶</button>';
}
}
/*var edit = '<button class="btn btn-sm btn-danger opt-edit" data-id=' + val + ' data-status=1 data-value=' + row.hotValue +' data-tip=' + row.hotChangeFlag +'>修改热度值</button>';
var recovery = '<button class="btn btn-sm btn-primary opt-recovery" data-id=' + val + ' data-status=0>恢复</button>';*/
return editLabel + "</br>" + openSquareTop + "</br>" + openTopicTop;
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 50, 100],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "-",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#erbanNo').val(),
nick: $('#nick').val(),
beginDate: $('#beginDate').val(),
endDate: $('#endDate').val(),
wolrdId: $('#wolrdId').val(),
dynamicLab: $('#dynamicLab').val(),
/*hotValueStart : $('#hotValueStart').val(),
hotValueEnd : $('#hotValueEnd').val(),*/
topStatus: $('#topStatus').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/dynamic/data/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
//重置
$('#btnReset').on('click', function () {
$('#erbanNo').val("");
$('#nick').val("");
$('#beginDate').val("");
$('#endDate').val("");
$('#wolrdId').val("");
/*$('#hotValueStart').val("");
$('#hotValueEnd').val("");*/
$('#topStatus').val("");
$('#dynamicLab').val("");
});
//导出
$('#btnExport').on('click', function () {
var erbanNo = $('#erbanNo').val();
var nick = $('#nick').val();
var beginDate = $('#beginDate').val();
var endDate = $('#endDate').val();
var wolrdId = $('#wolrdId').val();
var topStatus = $('#topStatus').val();
var dynamicLab = $('#dynamicLab').val();
if (isEmpty(erbanNo) && isEmpty(nick) && isEmpty(beginDate) && isEmpty(endDate) && isEmpty(wolrdId) && isEmpty(topStatus) && isEmpty(dynamicLab)) {
$("#tipMsg").text("请输入导出条件!");
$("#tipModal").modal('show');
return;
}
$('#searchForm').submit();
});
//图片放大
$('#showModal').on('mouseenter', '#imgs', function (e) {
//console.log($(this), e.clientX);
var src = $(this).attr('src');
$('#imgMask img').attr('src', src);
$('#imgMask').show();
$('#imgMask').css({
top: e.clientY + 20,
})
});
$('#showModal').on('mouseleave', '#imgs', function (e) {
console.log('移出');
$('#imgMask').hide();
});
/*$("#table").on("click", '.opt-edit', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
var cusValue = $(this).attr("data-value");
var tip = $(this).attr("data-tip");
if(id == 'undefined'){
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if(status == 'undefined'){
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
$("#dynamicId1").val(id);
$("#status1").val(status);
if (!isEmpty(cusValue) && tip == 2) {
$("#cusHotValue").text(cusValue);
}else if (tip != 2) {
//不是自动更新的时候,查询热度值
$.ajax({
type: 'post',
url: "/admin/dynamic/data/getHotValue.action",
data: {
id: id,
},
dataType: "json",
success: function (json) {
$("#cusHotValue").text(json);
}
});
}else{
$("#cusHotValue").text("-");
}
// 打开编辑弹窗
$("#editModal").modal('show');
$("#hotValueChange").val("");
});*/
//恢复热度值
$("#table").on("click", '.opt-recovery', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (status == 'undefined') {
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
editHotValue(null, status, id, "恢复");
});
$('#btnEdit').click(function () {
// 打开编辑弹窗
$("#editRuleModal").modal('show');
});
/**
* 保存动态热度值规则
*/
$('#save_rule').click(function () {
var shareNum = $('#shareNum').val();
var likeNum = $('#likeNum').val();
var commentNum = $('#commentNum').val();
var shareNum1 = parseInt(shareNum);
var likeNum1 = parseInt(likeNum);
var commentNum1 = parseInt(commentNum);
if (isEmpty(shareNum) || isEmpty(likeNum) || isEmpty(commentNum)) {
$("#tipMsg").text("规则参数有误");
$("#tipModal").modal('show');
return;
}
if (isNaN(shareNum1) || isNaN(likeNum1) || isNaN(commentNum1)) {
$("#tipMsg").text("规则参数必须为数字");
$("#tipModal").modal('show');
return;
}
var value = shareNum + "," + commentNum + "," + likeNum;
if (confirm("你确认修改热度值规则吗?")) {
showLoading();
$.ajax({
type: 'post',
url: "/admin/dynamic/data/setHotValueRule.action",
data: {
rule: 'dynamic_hot_value_rule',
value: value,
},
dataType: "json",
success: function (json) {
hideLoading();
if (json.success == 'true') {
$("#editRuleModal").modal('hide');
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
getHotValueRule();
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
}
});
$("#table").on("click", '.opt-label-edit', function () {
var id = $(this).attr("data-id");
$("#dynamicId").val(id)
//查询并渲染标签
$.ajax({
type: 'post',
url: "/admin/dynamic/data/getDynamicLabById.action",
data: {
id: id,
},
dataType: "json",
success: function (json) {
//清空checkbox
$("#editForm").find('input[name="dynamicLab"]').each(function () {
//$("#chk1").find('input:checkbox').eq(0).prop("checked",true);
$(this).prop("checked", false);
});
if (json != null && json != undefined) {
var labArr = json.labStr.split(",");
var len = labArr.length;
for (var i = 0; i < len; i++) {
$("#editForm").find('input[name="dynamicLab"]').each(function () {
if ($(this).val() == labArr[i]) $(this).prop("checked", true);
});
}
}
}
});
// 打开编辑弹窗
$("#editModal").modal('show');
});
//标签编辑保存
$("#editLabSave").click(function () {
var id = $("#dynamicId").val();
var dynamicLab = [];
$("#editForm").find('input[name="dynamicLab"]:checked').each(function () {
dynamicLab.push($(this).val());
});
if (dynamicLab.length > 3) {
$("#tipMsg").text("动态最多只能拥有3个标签");
$("#tipModal").modal('show');
return;
}
var dynamicStr = dynamicLab.join(",");
editLabSave(id, dynamicStr);
});
//广场置顶
$("#table").on("click", '.square_top_switch', function () {
var id = $(this).attr("data-id");
var oldSquareTop = $(this).attr("data-squareTop");
var squareTop;
if (oldSquareTop == 0) {
squareTop = 1;
} else {
squareTop = 0;
}
//$("#dynamicId").val(id)
//查询并渲染标签
$.ajax({
type: 'post',
url: "/admin/dynamic/data/getTopInfo.action",
data: {
id: id,
topType: 1
},
dataType: "json",
success: function (json) {
if (json.success == 'true') {
if (json.data != undefined && json.data != null && json.data != '' && json.data != 'null') {
if (confirm("广场已存在置顶动态(平台号:" + json.data + ")\n是否要更换置顶状态?")) {
switchSquareTop(id, squareTop);
}
} else {
switchSquareTop(id, squareTop);
}
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
//查询并渲染标签
});
//话题置顶
$("#table").on("click", '.topic_top_switch', function () {
var id = $(this).attr("data-id");
var oldTopicTop = $(this).attr("data-topicTop");
var topicTop;
if (oldTopicTop == 0) {
topicTop = 1;
} else {
topicTop = 0;
}
$.ajax({
type: 'post',
url: "/admin/dynamic/data/getTopInfo.action",
data: {
id: id,
topType: 2
},
dataType: "json",
success: function (json) {
if (json.success == 'true') {
if (json.data != undefined && json.data != null && json.data != '' && json.data != 'null') {
if (confirm("话题已存在置顶动态(平台号:" + json.data + ")\n是否要更换置顶状态?")) {
switchTopicTop(id, topicTop);
}
} else {
switchTopicTop(id, topicTop);
}
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
});
});
}
},
};
//修改/恢复热度值
function editHotValue(value, status, id, text) {
if (confirm("你确认" + text + "该动态的热度值吗?")) {
showLoading();
$.ajax({
type: 'post',
url: "/admin/dynamic/data/changeHotValue.action",
data: {
dynamicId: id,
status: status,
value: value
},
dataType: "json",
success: function (json) {
hideLoading();
$("#editModal").modal('hide');
if (json.success == 'true') {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
}
}
//判断空值
function isEmpty(data) {
if (data == null || data == undefined || data == "" || data == 'undefined') {
return true;
}
return false;
}
function setTypeSelectOption() {
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#wolrdId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
});
}
/**
* 获取动态热度值规则
*/
function getHotValueRule() {
$.ajax({
type: 'get',
url: "/admin/dynamic/data/getHotValueRule.action",
data: {
rule: 'dynamic_hot_value_rule'
},
dataType: "json",
success: function (json) {
if (!isEmpty(json)) {
var value = json;
if (value.length == 3) {
for (var i = 0; i < value.length; i++) {
$('#shareRule').text(value[0]);
$('#commentRule').text(value[1]);
$('#likeRule').text(value[2]);
}
}
}
}
});
}
function editLabSave(id, labStr) {
$.ajax({
type: 'post',
url: "/admin/dynamic/data/editLabel.action",
data: {
id: id,
labStr: labStr
},
dataType: "json",
success: function (json) {
$("#editModal").modal('hide');
if (json.success == 'true') {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
}
function switchSquareTop(id, squareTop) {
$.ajax({
type: 'post',
url: "/admin/dynamic/data/switchSquareTop.action",
data: {
id: id,
squareTop: squareTop
},
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
}
function switchTopicTop(id, topicTop) {
debugger
$.ajax({
type: 'post',
url: "/admin/dynamic/data/switchTopicTop.action",
data: {
id: id,
topicTop: topicTop
},
dataType: "json",
success: function (json) {
if (json.success == 'true') {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败:" + json.message);
$("#tipModal").modal('show');
}
}
});
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
min-width: 150px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
max-height: 600px;
max-width: 600px;
vertical-align: top;
}
.fixed-table-body {
height: auto !important;
}</style>

View File

@@ -0,0 +1,405 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<div id="table"></div>
<div id="toolbar" style="height: auto;">
<div class="col-sm-12">
<label for="worldId" class="col-sm-1 control-label">话题:</label>
<div class="col-sm-2">
<select name="worldId" id="worldId" class="form-control">
<option value="" selected="selected">所有</option>
<option value="0">全部</option>
<option value="-1">动态广场</option>
</select>
</div>
<label class="col-sm-1 control-label">时间:</label>
<div class="col-sm-2">
<input type="text" class="form-control" name="statDateStart" id="statDateStart"
placeholder="请输入开始日期">
</div>
<span class="col-sm-1"></span>
<div class="col-sm-2">
<input type="text" class="form-control" name="statDateEnd" id="statDateEnd"
placeholder="请输入结束日期">
</div>
<div class="col-sm-2">
<input type="checkbox" id="isToday" value="1" />
<label for="isToday">今日</label>
</div>
</div>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnReset" class="btn btn-default">
<i class="glyphicon glyphicon-remove"></i>重置
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
</div>
<div class="col-sm-12">
发布总数/总用户数<span id="totalDynamicNum">0</span> /<span
id="totalDynamicUidNum">0</span>&nbsp;&nbsp;&nbsp;
点赞总数/总用户数<span id="totalLikeNum">0</span> /<span id="totalLikeUidNum">0</span>&nbsp;&nbsp;&nbsp;
评论总数/总用户数<span id="totalCommentNum">0</span> /<span
id="totalCommentUidNum">0</span>&nbsp;&nbsp;&nbsp;
分享总数/总用户数<span id="totalShareNum">0</span> /<span id="totalShareUidNum">0</span>&nbsp;&nbsp;&nbsp;
阅读总数/总用户数<span id="totalReadNum">0</span> /<span id="totalReadUidNum">0</span>
</div>
</div>
</div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
var picker1 = $("#statDateStart").datetimepicker({
format: 'yyyy-mm-dd',
minView: 'month',
endDate: new Date(Date.now() - 24 * 60 * 60 * 1000),
autoclose: true
});
var picker2 = $("#statDateEnd").datetimepicker({
format: 'yyyy-mm-dd',
minView: 'month',
endDate: new Date(Date.now() - 24 * 60 * 60 * 1000),
autoclose: true
});
setTypeSelectOption();
var columns = [
{ field: 'id', title: 'id', align: 'center', width: '5%', visible: false },
{
field: 'statDate', title: '日期', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd");
} else {
return '-';
}
}
},
{ field: 'worldName', title: '话题', align: 'center', width: '5%' },
{ field: 'dynamicNumPass', title: '审核通过动态数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'dynamicNumUnshelve', title: '后台下架的动态数', align: 'center', width: '5%', formatter: convertNullToZero },
{
field: 'dynamicUidNum', title: '发布用户数', align: 'center', width: '5%',
formatter: function (val, row, index) {
return parseInt(convertNullToZero(row.dynamicUidNumPass)) + parseInt(convertNullToZero(row.dynamicUidNumUnshelve));
}
},
{ field: 'likeNum', title: '点赞数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'likeUidNum', title: '点赞用户数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'commentNum', title: '评论数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'commentUidNum', title: '评论用户数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'shareNum', title: '分享数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'shareUidNum', title: '分享用户数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'readNum', title: '阅读数', align: 'center', width: '5%', formatter: convertNullToZero },
{ field: 'readUidNum', title: '阅读用户数', align: 'center', width: '5%', formatter: convertNullToZero }
];
var isTodayData = false;
export default {
name: "DynamicStatView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
buildHistoryTable();
// 查询刷新
$('#btnSearch').on('click', function () {
var todayChecked = $('#isToday').is(':checked');
var startDate = $('#statDateStart').val();
var endDate = $('#statDateEnd').val();
if (!todayChecked) {
if (null == startDate || startDate.trim() == '') {
$("#tipMsg").text("开始日期不能为空");
$("#tipModal").modal('show');
return;
}
if (null == endDate || endDate.trim() == '') {
$("#tipMsg").text("结束日期不能为空");
$("#tipModal").modal('show');
return;
}
if (startDate > endDate) {
$("#tipMsg").text("开始日期不能大于结束日期");
$("#tipModal").modal('show');
return;
}
}
if (todayChecked == isTodayData) {
TableHelper.doRefresh('#table');
} else {
if (todayChecked) {
buildTodayTable();
} else {
buildHistoryTable();
}
isTodayData = todayChecked;
}
var statDateStart = '';
var statDateEnd = '';
if (null != startDate && startDate.trim() != '') {
statDateStart = startDate + " 00:00:00";
}
if (null != endDate && endDate.trim() != '') {
statDateEnd = endDate + " 23:59:59";
}
$.ajax({
type: 'get',
url: "/admin/dynamic/stat/total",
data: {
isToday: todayChecked,
worldId: $('#worldId').val(),
statDateStart: statDateStart,
statDateEnd: statDateEnd
},
dataType: "json",
success: function (json) {
if (json.code == 200 && null != json.data) {
var data = json.data;
$('#totalDynamicNum').html(parseInt(convertNullToZero(data.dynamicNumPass))
+ parseInt(convertNullToZero(data.dynamicNumUnshelve)));
$('#totalDynamicUidNum').html(parseInt(convertNullToZero(data.dynamicUidNumPass))
+ parseInt(convertNullToZero(data.dynamicUidNumUnshelve)));
$('#totalLikeNum').html(convertNullToZero(data.likeNum));
$('#totalLikeUidNum').html(convertNullToZero(data.likeUidNum));
$('#totalCommentNum').html(convertNullToZero(data.commentNum));
$('#totalCommentUidNum').html(convertNullToZero(data.commentUidNum));
$('#totalShareNum').html(convertNullToZero(data.shareNum));
$('#totalShareUidNum').html(convertNullToZero(data.shareUidNum));
$('#totalReadNum').html(convertNullToZero(data.readNum));
$('#totalReadUidNum').html(convertNullToZero(data.readUidNum));
}
}
});
});
//重置
$('#btnReset').on('click', function () {
$('#worldId').val("");
$('#statDateStart').val("");
$('#statDateEnd').val("");
$('#statDateStart').removeAttr('disabled');
$('#statDateEnd').removeAttr('disabled');
$("#isToday").prop("checked", false);
});
//导出
$('#btnExport').on('click', function () {
var todayChecked = $('#isToday').is(':checked');
var startDate = $('#statDateStart').val();
var endDate = $('#statDateEnd').val();
if (!todayChecked) {
if (null == startDate || startDate.trim() == '') {
$("#tipMsg").text("开始日期不能为空");
$("#tipModal").modal('show');
return;
}
if (null == endDate || endDate.trim() == '') {
$("#tipMsg").text("结束日期不能为空");
$("#tipModal").modal('show');
return;
}
if (startDate > endDate) {
$("#tipMsg").text("开始日期不能大于结束日期");
$("#tipModal").modal('show');
return;
}
}
var statDateStart = '';
var statDateEnd = '';
if (null != startDate && startDate.trim() != '') {
statDateStart = startDate + " 00:00:00";
}
if (null != endDate && endDate.trim() != '') {
statDateEnd = endDate + " 23:59:59";
}
var param = {
isToday: todayChecked,
worldId: $('#worldId').val(),
statDateStart: statDateStart,
statDateEnd: statDateEnd,
pageNumber: 1,
pageSize: 65535
};
var url = "/admin/dynamic/stat/export.action?isToday=" + todayChecked
+ "&worldId=" + $('#worldId').val()
+ "&statDateStart=" + statDateStart
+ "&statDateEnd=" + statDateEnd
+ "&pageNumber=1&pageSize=65535";
console.log(url);
window.open(url);
});
/**
* 历史数据
* 从数据库中查询统计好的记录,分页
*/
function buildHistoryTable() {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: columns,
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 50, 100],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "-",
queryParams: function queryParams(params) { //设置查询参数
var start = $('#statDateStart').val();
if (null != start && start != '') {
start = start + ' 00:00:00';
}
var end = $('#statDateEnd').val();
if (null != end && end != '') {
end = end + " 23:59:59";
}
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
worldId: $('#worldId').val(),
statDateStart: start,
statDateEnd: end
};
return param;
},
toolbar: '#toolbar',
url: '/admin/dynamic/stat/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
}
/**
* 今日数据
* 实时统计,不分页
*/
function buildTodayTable() {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: columns,
cache: false,
striped: true,
showRefresh: false,
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "-",
queryParams: function queryParams(params) { //设置查询参数
var param = {
worldId: $('#worldId').val(),
isToday: true
};
return param;
},
toolbar: '#toolbar',
url: '/admin/dynamic/stat/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
}
$("#isToday").change(function () {
if (this.checked) {
$('#statDateStart').attr('disabled', 'disabled');
$('#statDateEnd').attr('disabled', 'disabled');
} else {
$('#statDateStart').removeAttr('disabled');
$('#statDateEnd').removeAttr('disabled');
}
});
});
}
},
};
function setTypeSelectOption() {
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#worldId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
});
}
function convertNullToZero(val) {
if (null == val || val == '') {
return 0;
}
return val;
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
min-width: 150px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
vertical-align: top;
}
.fixed-table-body {
height: auto !important;
}</style>

View File

@@ -0,0 +1,577 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<div id="table"></div>
<div id="toolbar" style="height: auto;">
<form id="searchForm" class="col-sm-pull-12" action="/admin/dynamic/verify/export" method="post"
target="_blank">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-1 control-label">平台号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="erbanNo" id="erbanNo"></div>
<label for="nick" class="col-sm-1 control-label">昵称:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="nick" id="nick"></div>
<label for="status" class="col-sm-1 control-label">状态:</label>
<div class="col-sm-2">
<select name="status" id="status" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
</select>
</div>
</div>
<div class="col-sm-12">
<label class="col-sm-1 control-label">发布时间:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="beginDate" id="beginDate">
</div><span class="col-sm-1"></span>
<div class="col-sm-2"><input type="text" class="form-control" name="endDate" id="endDate"></div>
<label for="wolrdId" class="col-sm-1 control-label">话题名称:</label>
<div class="col-sm-2">
<select name="wolrdId" id="wolrdId" data-btn-class="btn-warning" class="form-control">
<option value="" selected="selected">全部</option>
<option value="-1">动态广场</option>
</select>
</div>
</div>
</form>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnReset" class="btn btn-default">
<i class="glyphicon glyphicon-remove"></i>重置
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
</div>
</div>
</div>
</div>
</section>
<div class="modal fade" id="showModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 500px;">
<div class="modal-header">
<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>
</div>
<div class="modal-body">
<input type="hidden" name="id" id="dynamicId" />
<div class="show" style="margin-left: 60px">
</div>
</div>
<div id="imgMask"><img src="" alt=""></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="notPassModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe2">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 600px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe2">请选择原因</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="notPassForm">
<input type="hidden" name="id" id="dynamicId1" />
<input type="hidden" name="status" id="status1" />
<div class="form-group">
<div class="col-sm-10">
<select id="quick_reason" class="form-control" data-btn-class="btn-warning"
onchange="setReason()">
<option value="0">動態可能包含抽煙喝酒辱罵攻擊他人等不文明內容</option>
<option value="1">動態涉及色情暴力病毒等違規內容</option>
<option value="2">動態包含政治敏感信息</option>
<option value="3">動態包含廣告營銷內容</option>
<option value="4">動態可能包含個人隱私信息或涉及他人營私信息</option>
<option value="5">動態可能涉及線下交易</option>
<option value="6">動態內容無意義</option>
<option value="7">動態內容與世界主題無關</option>
<option value="8">動態可能涉嫌侵犯他人版權</option>
<option value="9">其他</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<textarea name="reason" id="reason" class="form-control" rows="3"></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="not-pass-save">保存</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="showContentModal" tabindex="-1" role="dialog" aria-labelledby="modalLabe3">
<div class="modal-dialog" role="document">
<div class="modal-content" style="width: 500px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalLabe3">查看动态内容详情</h4>
</div>
<div class="modal-body">
<span id="dynamic-content"></span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { showLoading, hideLoading } from '@/utils/maintainer';
var picker1 = $("#beginDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
todayBtn: true
});
var picker2 = $("#endDate").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true,
todayBtn: true
});
picker1.on('changeDate', function () {
var date = $('#beginDate').datetimepicker('getDate');
picker2.datetimepicker('setStartDate', date);
});
picker2.on('changeDate', function () {
var date = $('#endDate').datetimepicker('getDate');
picker1.datetimepicker('setEndDate', date);
});
export default {
name: "DynamicVerifyView",
setup() {
function setReason() {
if ($("#quick_reason option:selected").val() != 9) {
$("#reason").val($("#quick_reason option:selected").text());
} else {
$("#reason").val('');
}
}
function showContent(note) {
var content = $(note).parent().find('input').val();
$('#dynamic-content').text(content);
$('#showContentModal').modal('show');
}
function showPic(resUrl, id) {
var html = '<div style="width: 320px;">';
console.log(resUrl);
if (resUrl != null && resUrl != '' && resUrl != undefined) {
var resUrls = resUrl.split(",");
for (var i = 0; i < resUrls.length; i++) {
if (resUrls[i] != null && resUrls[i] != undefined && resUrls[i] != "") {
html += '<img id="imgs" src="' + resUrls[i] + '" style="width: 100px;height: 100px;">';
}
}
}
html += '</div>';
// 打开编辑弹窗
$("#showModal").modal('show');
$("#dynamicId").val(id);
$(".show").html(html);
}
function showVideo(resUrl, id) {
var html = '<video width="320" height="240" controls autoplay><source src="' + resUrl + '" type="video/mp4"></video>';
// 打开编辑弹窗
$("#showModal").modal('show');
$("#dynamicId").val(id);
$(".show").html(html);
}
window.setReason = setReason;
window.showContent = showContent;
window.showPic = showPic;
window.showVideo = showVideo;
return {
setReason,
showContent,
showPic,
showVideo
};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
setStatusSelectOption();
setTypeSelectOption();
$('#table').bootstrapTable({
columns: [
//{field: 'id', title: 'id', align: 'center', width: '5%'},
{ field: 'tmp', title: 'id', align: 'center', checkbox: true, width: '5%' },
{ field: 'erbanNo', title: '平台号', align: 'center', width: '5%' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%' },
{ field: 'gender', title: '性别', align: 'center', width: '5%' },
{ field: 'worldName', title: '话题', align: 'center', width: '5%' },
{
field: 'content',
title: '动态内容',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (isEmpty(val)) {
return "-";
} else {
if (val.length > 50) {
var content = "<input type='hidden' id='input-content' value='" + val + "'>";
return val.substring(0, 50) + "..." + content + "<button href='#' class='btn btn-sm' style='color: #00acd6;background:none' onclick=showContent(this) style='margin-left: 10px;'>查看更多</a>";
} else {
return val;
}
}
}
},
{
field: 'resUrl',
title: '图片/视频/语音',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
if (row.type == 1) {
return '<audio controls="controls"><source src="' + val + '" type="audio/mpeg"></audio>';
} else if (row.type == 2) {
return "<button href='#' class='btn btn-sm' style='color: #00acd6;background:none' onclick=showPic('" + row.resUrl + "'," + row.id + ")>查看图片</button>";
} else if (row.type == 3) {
return "<button href='#' class='btn btn-sm' style='color: #00acd6;background:none' onclick=showVideo('" + row.resUrl + "'," + row.id + ")>查看视频</button>";
}
}
},
{
field: 'createTime',
title: '发布时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{ field: 'statusStr', title: '状态', align: 'center', width: '5%' },
{ field: 'updateBy', title: '操作人', align: 'center', width: '5%' },
{
field: 'updateTime',
title: '操作时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{
field: 'id',
title: '操作',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
var pass = '<button class="btn btn-sm btn-primary opt-pass" data-id=' + val + ' data-status=1>通&#12288;过</button>';
var noPass = '<button class="btn btn-sm btn-danger opt-not-pass" data-id=' + val + ' data-status=2>不通过</button>';
var shelve = '<button class="btn btn-sm btn-primary opt-pass" data-id=' + val + ' data-status=4>上&#12288;架</button>';
var unshelve = '<button class="btn btn-sm btn-danger opt-not-pass" data-id=' + val + ' data-status=5>下&#12288;架</button>';
if (row.status == 0) {
return pass + '</br>' + noPass;
} else if (row.status == 1 || row.status == 6 || row.status == 4) {
return unshelve;
} else if (row.status == 2 || row.status == 5 || row.status == 7) {
return shelve;
}
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 50, 100],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "-",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#erbanNo').val(),
nick: $('#nick').val(),
status: $('#status').val(),
beginDate: $('#beginDate').val(),
endDate: $('#endDate').val(),
wolrdId: $('#wolrdId').val(),
};
return param;
},
toolbar: '#toolbar',
url: '/admin/dynamic/verify/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
//重置
$('#btnReset').on('click', function () {
$('#erbanNo').val("");
$('#nick').val("");
$('#status').val("");
$('#beginDate').val("");
$('#endDate').val("");
$('#wolrdId').val("");
});
//审核不通过/下架弹框
$("#table").on("click", '.opt-not-pass', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (status == 'undefined') {
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
$("#dynamicId1").val(id);
$("#status1").val(status);
// 打开编辑弹窗
$("#notPassModal").modal('show');
$("#modalLabe2").text("请选择不通过的原因");
status = 5;
if (status) {
$("#modalLabe2").text("请选择下架的原因");
}
window.setReason();
});
//审核不通过/下架弹窗
$("#not-pass-save").click(function () {
var id = $("#dynamicId1").val();
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
var status = $("#status1").val();
if (status == 'undefined') {
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
var reason = $("#reason").val();
if (reason.length <= 0) {
alert("请输入原因!");
return;
}
var text = "不通过";
if (status == 5) {
text = "下架";
}
verify(text, id, status, reason);
});
$("#table").on("click", '.opt-pass', function () {
var id = $(this).attr("data-id");
var status = $(this).attr("data-status");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (status == 'undefined') {
$("#tipMsg").text("状态参数有误");
$("#tipModal").modal('show');
return;
}
var text = "通过";
if (status == 4) {
text = "上架";
}
verify(text, id, status, "");
});
//导出
$('#btnExport').on('click', function () {
var erbanNo = $('#erbanNo').val();
var nick = $('#nick').val();
var status = $('#status').val();
var beginDate = $('#beginDate').val();
var endDate = $('#endDate').val();
var wolrdId = $('#wolrdId').val();
if (isEmpty(erbanNo) && isEmpty(nick) && isEmpty(status) && isEmpty(beginDate) && isEmpty(endDate) && isEmpty(wolrdId)) {
$("#tipMsg").text("请输入导出条件!");
$("#tipModal").modal('show');
return;
}
$('#searchForm').submit();
});
//图片放大
$('#showModal').on('mouseenter', '#imgs', function (e) {
var src = $(this).attr('src');
$('#imgMask img').attr('src', src);
$('#imgMask').show();
$('#imgMask').css({
top: e.clientY + 20,
})
})
$('#showModal').on('mouseleave', '#imgs', function (e) {
console.log('移出');
$('#imgMask').hide();
})
});
}
},
};
//判断空值
function isEmpty(data) {
if (data == null || data == undefined || data == "") {
return true;
}
return false;
}
//审核
function verify(text, id, status, reason) {
//if (confirm("你确认【"+ text + "】该动态吗?")) {
showLoading();
$.ajax({
type: 'post',
url: "/admin/dynamic/verify/changeStatus.action",
data: {
dynamicId: id,
status: status,
reason: reason
},
dataType: "json",
success: function (json) {
hideLoading();
if (status == 2 || status == 5) {
$("#notPassModal").modal('hide');
}
if (json.success == 'true') {
$("#tipMsg").text("操作成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("操作失败");
$("#tipModal").modal('show');
}
}
});
//}
}
function setTypeSelectOption() {
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#wolrdId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
});
}
function setStatusSelectOption() {
$.ajax({
type: 'get',
url: "/admin/dynamic/verify/getStatus.action",
success: function (json) {
if (json != null && json != undefined) {
var rows = json;
for (var i = 0; i < rows.length; i++) {
$('#status').append('<option value="' + rows[i].value + '">' + rows[i].key + '</option>');
}
}
}
});
}
</script>
<style scoped>
#imgMask {
position: absolute;
top: 0;
left: 0;
min-width: 150px;
padding: 4px;
background: #fff;
z-index: 999;
display: none;
}
#imgMask img {
max-height: 600px;
max-width: 600px;
vertical-align: top;
}
.fixed-table-body {
height: auto !important;
}
</style>

View File

@@ -0,0 +1,533 @@
<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<!-- .content -->
<div id="toolbar" style="height: auto;">
<div class="col-sm-12">
<label for="worldId" class="col-sm-1 control-label">话题:</label>
<div class="col-sm-2">
<select name="worldId" id="worldId" class="form-control">
<option value="" selected="selected">请选择</option>
</select>
</div>
<label class="col-sm-2 control-label">上架时间:</label>
<div class="col-sm-2">
<input type="text" class="form-control date-time-day" name="recommendStartMin"
id="recommendStartMin" placeholder="请输入上架日期">
</div>
<span class="col-sm-2">下架时间</span>
<div class="col-sm-2">
<input type="text" class="form-control date-time-day" name="recommendEndMax"
id="recommendEndMax" placeholder="请输入下架日期">
</div>
</div>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnAdd" class="btn btn-default">
<i class="glyphicon glyphicon-add"></i>新增
</button>
<button id="btnTakeOff" class="btn btn-default">
<i class="glyphicon glyphicon-remove"></i>批量下架
</button>
</div>
</div>
<div id="table"></div>
</div>
</div>
</section>
<!-- 弹窗 -->
<div class="modal fade" id="worldModal" rabindex='-1' role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
<div class="modal-title" id="worldModalLabel"></div>
</div>
<div class="modal-body">
<form action="" id="addForm" class="form-horizontal">
<input type="hidden" id="modal_id" name="id" />
<div class="form-group">
<label for="modal_worldId" class="col-sm-3 control-label">话题名称</label>
<div class="col-sm-8">
<select id="modal_worldId" name="worldId" class="form-control validate[required]">
<option value="">请选择...</option>
</select>
</div>
</div>
<div class="form-group">
<label for="modal_recommendStart" class="col-sm-3 control-label">上架时间</label>
<div class="col-sm-8">
<input type="text" class="form-control date-time-minute" name="recommendStart"
id="modal_recommendStart" placeholder="请输入上架时间">
</div>
</div>
<div class="form-group">
<label for="modal_recommendEnd" class="col-sm-3 control-label">下架时间</label>
<div class="col-sm-8">
<input type="text" class="form-control date-time-minute validate[required]"
name="recommendEnd" id="modal_recommendEnd" placeholder="请输入下架时间">
</div>
</div>
<div class="form-group">
<label for="modal_seqNo" class="col-sm-3 control-label">权重</label>
<div class="col-sm-8">
<input type="text" class="form-control validate[integer]" name="seqNo" id="modal_seqNo"
placeholder="数字越大排序越前不填写默认1">
</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" data-primary="addSave" id="save">保存</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "RecommendWorldAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
setWorldSelectOption();
$('#table').bootstrapTable({
columns: [
{ field: 'checkbox', title: '', align: 'center', width: '3%', checkbox: true },
{ field: 'id', title: 'id', width: '5%' },
{ field: 'worldName', title: '话题名称', width: '5%' },
{
field: 'recommendStart',
title: '上架时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{
field: 'recommendEnd',
title: '下架时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{ field: 'seqNo', title: '权重', align: 'center', width: '5%' },
{
field: 'status', title: '状态', align: 'center', width: '5%',
formatter: function (val, row, index) {
console.log(val);
if (null == val) {
return '-';
}
if (val == 0) {
return '<span class="label label-danger">已下架</span>';
}
var date = new Date().getTime();
if (date >= row.recommendStart && date < row.recommendEnd) {
return '<span class="label label-success">上架中</span>';
} else if (date < row.recommendStart) {
return '<span class="label label-primary">待上架</span>';
} else if (date >= row.recommendEnd) {
return '<span class="label label-danger">已下架</span>';
} else {
return '无效';
}
}
},
{
field: 'updateTime',
title: '更新时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
} else {
return '-';
}
}
},
{ field: 'updateBy', title: '操作人', align: 'center', width: '5%' },
{
field: 'tmp',
title: '操作',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
var actions = [];
actions.push('<button class="btn btn-primary btn-sm opt-edit" data-id="' + row.id + '">编辑</button> ');
// 上架状态
var date = new Date().getTime();
if (row.status == 1) {
// 上架中或待上架
if ((date >= row.recommendStart && date < row.recommendEnd) || (date < row.recommendStart)) {
actions.push('<button class="btn btn-warning btn-sm opt-take-off" data-id="' + row.id + '">下架</button> ');
}
}
if (row.status != 1 || date >= row.recommendEnd) {
actions.push('<button class="btn btn-danger btn-sm opt-delete" data-id="' + row.id + '">删除</button> ');
}
return actions.join('');
}
}
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 50, 100],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "-",
queryParams: function queryParams(params) { //设置查询参数
var startTime = $('#recommendStartMin').val();
var endTime = $('#recommendEndMax').val();
if (null != startTime && startTime.trim() != '') {
startTime = startTime + ' 00:00:00';
}
if (null != endTime && endTime.trim() != '') {
endTime = endTime + ' 23:59:59';
}
var param = {
pageNum: params.pageNumber,
pageSize: params.pageSize,
recommendStartMin: startTime,
recommendEndMax: endTime,
worldId: $('#worldId').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/dynamic/recommendWorld/list.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
// 添加事件
$('#btnAdd').on('click', function () {
clearModal();
$('#worldModalLabel').text('新增推荐世界');
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
$('#modal_worldId').empty();
$('#modal_worldId').append('<option value="">请选择...</option>');
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#modal_worldId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
});
$('#worldModal').modal('show');
});
// 编辑按钮点击事件
$('#table').on('click', '.opt-edit', function () {
clearModal();
$('#modal_worldId').attr('disabled', 'disabled');
var id = $(this).data('id');
$.ajax({
type: "get",
url: "/admin/dynamic/recommendWorld/get",
data: { id: id },
dataType: "json",
success: function (json) {
if (json && json.code == 200) {
var data = json.data;
$('#modal_id').val(data.id);
$('#modal_recommendStart').val(new Date(data.recommendStart).format('yyyy-MM-dd hh:mm:ss'));
$('#modal_recommendEnd').val(new Date(data.recommendEnd).format('yyyy-MM-dd hh:mm:ss'));
$('#modal_seqNo').val(data.seqNo);
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
$('#modal_worldId').empty();
$('#modal_worldId').append('<option value="">请选择...</option>');
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
if (rows[i].id == data.worldId) {
$('#modal_worldId').append('<option selected="selected" value="' + rows[i].id + '">' + rows[i].name + '</option>');
} else {
$('#modal_worldId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
}
});
}
}
});
$('#worldModalLabel').text('编辑推荐世界');
$('#worldModal').modal('show');
});
$("#table").on("click", '.opt-take-off', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认下架该记录吗? ")) {
$.ajax({
type: 'post',
url: "/admin/dynamic/recommendWorld/takeOff",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("下架成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
}
});
$("#table").on("click", '.opt-delete', function () {
var id = $(this).attr("data-id");
if (id == 'undefined') {
$("#tipMsg").text("id参数有误");
$("#tipModal").modal('show');
return;
}
if (confirm("你确认删除该记录吗?删除后记录无法找回,请谨慎操作! ")) {
$.ajax({
type: 'post',
url: "/admin/dynamic/recommendWorld/delete",
data: { id: id },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text(json.message);
$("#tipModal").modal('show');
}
}
});
}
});
//批量下架
$("#btnTakeOff").on('click', function () {
var rows = $("#table").bootstrapTable("getSelections");
if (rows.length == 0) {
alert("请先选择要下架的记录");
return;
}
var idArr = [];
for (var i = 0; i < rows.length; i++) {
idArr.push(rows[i]['id']);
}
if (confirm("确认批量下架选中记录吗?")) {
$.ajax({
type: 'post',
url: "/admin/dynamic/recommendWorld/takeOffForBatch",
data: { 'ids': idArr.join(',') },
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("批量下架成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("批量下架失败");
$("#tipModal").modal('show');
}
},
error: function () {
$("#tipMsg").text("批量下架失败.");
$("#tipModal").modal('show');
}
});
}
})
// 保存
$('#save').on('click', function () {
if ($('#addForm').validationEngine('validate')) {
var param = {};
// id
param.id = $('#modal_id').val();
// 上下架
var startTime = $('#modal_recommendStart').val();
var endTime = $('#modal_recommendEnd').val();
if (startTime == '') {
$('#tipMsg').text('失败,上架时间不能为空');
$('#tipModal').modal('show');
return;
}
if (endTime == '') {
$('#tipMsg').text('失败,下架时间不能为空');
$('#tipModal').modal('show');
return;
}
if (startTime != '' && endTime != '' && startTime > endTime) {
$('#tipMsg').text('失败,上架时间不能大于下架时间');
$('#tipModal').modal('show');
return;
}
param.recommendStart = startTime;
param.recommendEnd = endTime;
// 排序
var seqNo = $('#modal_seqNo').val();
if (seqNo.trim() == '') {
seqNo = 1;
}
param.seqNo = seqNo;
// 话题id
param.worldId = $('#modal_worldId').val();
$.ajax({
type: 'post',
url: '/admin/dynamic/recommendWorld/save',
data: param,
dataType: 'json',
success: function (res) {
if (res.code == 200) {
$('#worldModal').modal('hide');
$('#tipMsg').text('保存成功');
$('#tipModal').modal('show');
TableHelper.doRefresh('#table')
} else {
$('#tipMsg').text('保存失败,错误码:' + res.message);
$('#tipModal').modal('show');
}
}
})
}
});
$(".date-time-day").datetimepicker({
format: 'yyyy-mm-dd',
minView: 'month',
autoclose: true
});
$(".date-time-minute").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
minView: 'day',
autoclose: true
});
});
}
},
};
function setWorldSelectOption() {
$.ajax({
type: 'get',
url: "/admin/world/list.action",
data: {
status: 1,
pageNumber: 1,
pageSize: 1000
},
dataType: "json",
success: function (json) {
if (json.total > 0) {
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
$('#worldId').append('<option value="' + rows[i].id + '">' + rows[i].name + '</option>');
}
}
}
});
}
function clearModal() {
$('#addForm')[0].reset();
$('#addForm').validationEngine('hideAll');
$('#modal_id').val('');
$('#modal_worldId').removeAttr('disabled');
}
</script>
<style scoped>.fixed-table-body {
height: auto !important;
}</style>