|
|
@@ -1,28 +1,42 @@
|
|
|
let tableIns;
|
|
|
-let tablePlayerLog;
|
|
|
-let tablePlayerProfit;
|
|
|
-let tree;
|
|
|
-let userId;
|
|
|
-let bHasData = false;
|
|
|
let openIndex;
|
|
|
+let multiSelectTag;
|
|
|
+
|
|
|
let mainTableUrl = "/backstage_game/findAll";
|
|
|
-let mainSaveUrl = "/backstage_game/save";
|
|
|
+let mainSaveUrl = "/backstage_game/saveBaseInfo";
|
|
|
let mainDeleteUrl = "/backstage_game/delete";
|
|
|
-// let mainUnbindUrl = "/backstage_game/unbind";
|
|
|
-
|
|
|
-layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'upload'], function () {
|
|
|
+let mainUploadUrl = "/backstage_game/uploadImg";
|
|
|
+let mainGameDetailUrl = "/backstage_game/findGameDetail";
|
|
|
+
|
|
|
+
|
|
|
+layui.config({
|
|
|
+ base: ctx + '/common/'
|
|
|
+}).extend({
|
|
|
+ xmSelect: 'layui/xm-select',
|
|
|
+ step: 'step-lay/step',
|
|
|
+ dragMove: 'dragMove/dragMove'
|
|
|
+})
|
|
|
+layui.use(['element', 'form', 'table', 'layer', 'laydate', 'util', 'upload', 'xmSelect', 'step', 'dragMove'], function () {
|
|
|
+ let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
|
|
|
+ let laydate = layui.laydate;
|
|
|
let table = layui.table, upload = layui.upload, form = layui.form;//select、单选、复选等依赖form
|
|
|
-
|
|
|
+ let step = layui.step, xmSelect = layui.xmSelect, dragMove = layui.dragMove;//引入工具
|
|
|
+ let layer = layui.layer;
|
|
|
form.verify({
|
|
|
// positiveInteger: [/^(([0-9]+[\.]?[0-9]+)|[1-9])$/, '只能填写正整数'],//必填,且只能输入正整数
|
|
|
positiveInteger: [/^[1-9]\d*$/, '只能填写正整数'],//必填,且只能输入正整数
|
|
|
});
|
|
|
-
|
|
|
- let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
|
|
|
- let laydate = layui.laydate;
|
|
|
- tree = layui.tree;
|
|
|
- // let height = document.documentElement.clientHeight;
|
|
|
- //用户列表
|
|
|
+ /**
|
|
|
+ * 渲染图片查看
|
|
|
+ */
|
|
|
+ dragMove.render({
|
|
|
+ elem: "#cardBody", //指向图片的父容器
|
|
|
+ layerArea: ["960px", "720px"], //弹窗的宽高,同layer的area,默认["960px","720px"]
|
|
|
+ layerShade: 0.6, //遮罩的透明度,同layer的shade,默认0.6
|
|
|
+ layerMove: false, //触发拖动的元素,同layer的move,这里默认禁止,可设置为'.layui-layer-title'
|
|
|
+ maxZoom: 1 //图片能放大的最大倍数,默认1倍
|
|
|
+ });
|
|
|
+ //主列表渲染
|
|
|
tableIns = table.render({
|
|
|
elem: '#mainTable'
|
|
|
, url: ctx + mainTableUrl
|
|
|
@@ -42,14 +56,10 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
}
|
|
|
//响应后数据处理
|
|
|
, parseData: function (res) { //res 即为原始返回的数据
|
|
|
- $("#addForm")[0].reset();
|
|
|
- userId = null;
|
|
|
- form.render();
|
|
|
- var data = res.data;
|
|
|
+ let data = res.data;
|
|
|
console.log("返回的地址数据:", data);
|
|
|
- if (data.rows && data.rows.length > 0) {
|
|
|
- bHasData = true;
|
|
|
- }
|
|
|
+ // if (data.rows && data.rows.length > 0) {
|
|
|
+ // }
|
|
|
return {
|
|
|
"flag": res.flag, //解析接口状态
|
|
|
"msg": res.msg, //解析提示文本
|
|
|
@@ -62,27 +72,31 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
, cols: [[
|
|
|
{field: 'gameId', title: '游戏ID', sort: true}
|
|
|
, {field: 'gameName', title: '游戏名称', sort: true}
|
|
|
- , {field: 'gameDescription', title: '游戏描述', sort: true}
|
|
|
+ , {field: 'gameDescription', title: '游戏描述',hide:true, sort: true}
|
|
|
, {field: 'gameIcon', title: '游戏图标', templet: '#gameIcon'}
|
|
|
, {field: 'gamePicture', title: '游戏图片', templet: '#gamePicture'}
|
|
|
, {
|
|
|
field: 'gameStatus', title: '游戏状态', templet: function (d) {
|
|
|
- if (d.gameStatus == 0) {
|
|
|
- return '<span style="color: green">正常</span>';
|
|
|
- } else if (d.gameStatus == 1) {
|
|
|
- return '<span style="color: red">下架</span>';
|
|
|
+ if (d.gameStatus == 1) {
|
|
|
+ return '<span style="color: green">上线</span>';
|
|
|
+ } else if (d.gameStatus == 0) {
|
|
|
+ return '<span style="color: red">下线</span>';
|
|
|
} else {
|
|
|
return '未添加:' + d.gameStatus;
|
|
|
}
|
|
|
}, sort: true
|
|
|
}
|
|
|
, {
|
|
|
- field: 'gameType', title: '类目编号', templet: function (d) {
|
|
|
- if (d.gameType == 1) {
|
|
|
- return '<span style="color: red">游戏</span>';
|
|
|
- } else if (d.gameType == 2) {
|
|
|
- return '<span style="color: green">视频</span>';
|
|
|
- } else {
|
|
|
+ field: 'gameType', title: '所属分类', templet: function (d) {
|
|
|
+ let isHas = false;
|
|
|
+ for (let i = 0; i < categoryList.length; i++) {
|
|
|
+ let category = categoryList[i];
|
|
|
+ if(d.gameType === category.categoryType){
|
|
|
+ isHas = true;
|
|
|
+ return '<span style="color: green">'+category.categoryName+'</span>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!isHas){
|
|
|
return '其他:' + d.gameType;
|
|
|
}
|
|
|
}, sort: true
|
|
|
@@ -97,7 +111,7 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
} else if (d.gameRankingShow == 1) {
|
|
|
return '<span style="color: green">显示</span>';
|
|
|
} else {
|
|
|
- return '其他:' + d.gameType;
|
|
|
+ return '其他:' + d.gameRankingShow;
|
|
|
}
|
|
|
}, sort: true
|
|
|
}
|
|
|
@@ -115,8 +129,9 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
}
|
|
|
}, sort: true
|
|
|
}
|
|
|
- , {field: 'showTime', title: '游戏显示时间', sort: true}
|
|
|
+ , {field: 'showTime', title: '游戏显示时间', hide: true,sort: true}
|
|
|
, {field: 'createTime', title: '创建时间', hide: true, sort: true}
|
|
|
+ , {field: 'updateTime', title: '更新时间', hide: true, sort: true}
|
|
|
, {fixed: 'right', title: '操作', width: 140, toolbar: '#mainTableBarDemo'}
|
|
|
]]
|
|
|
, defaultToolbar: ['', 'exports', 'print']
|
|
|
@@ -125,20 +140,42 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
, cellMinWidth: 80
|
|
|
});
|
|
|
|
|
|
+ //渲染步骤条
|
|
|
+ step.render({
|
|
|
+ elem: '#stepForm',
|
|
|
+ filter: 'stepForm',
|
|
|
+ width: '100%', //设置容器宽度
|
|
|
+ stepWidth: '600px',
|
|
|
+ height: '1000px',
|
|
|
+ stepItems: [{
|
|
|
+ title: '填入游戏基本信息'
|
|
|
+ }, {
|
|
|
+ title: '上传游戏对应图片'
|
|
|
+ }, {
|
|
|
+ title: '完成'
|
|
|
+ }]
|
|
|
+ });
|
|
|
|
|
|
- //常规使用 - 普通图片上传
|
|
|
- var uploadInstIcon = upload.render({
|
|
|
+ /**
|
|
|
+ * 添加新游戏信息时候图片上传
|
|
|
+ */
|
|
|
+ let uploadIcon = upload.render({
|
|
|
elem: '#iconAdd'
|
|
|
- , url: 'https://httpbin.org/post' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。
|
|
|
- , auto: false
|
|
|
+ , url: ctx + mainUploadUrl
|
|
|
+ , data: {
|
|
|
+ type: 'icon', gameId: function () {
|
|
|
+ return $('#newGameId').val();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // , auto: false
|
|
|
, before: function (obj) {
|
|
|
//预读本地文件示例,不支持ie8
|
|
|
obj.preview(function (index, file, result) {
|
|
|
- $('#demo1').attr('src', result); //图片链接(base64)
|
|
|
+ $('#iconImageAdd').attr('src', result); //图片链接(base64)
|
|
|
});
|
|
|
-
|
|
|
- element.progress('demo', '0%'); //进度条复位
|
|
|
+ // element.progress('iconProgress', '0%'); //进度条复位
|
|
|
layer.msg('上传中', {icon: 16, time: 0});
|
|
|
+ // console.log("before" + JSON.stringify(obj));
|
|
|
}
|
|
|
, done: function (res) {
|
|
|
//如果上传失败
|
|
|
@@ -147,36 +184,98 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
}
|
|
|
//上传成功的一些操作
|
|
|
//……
|
|
|
- $('#demoText').html(''); //置空上传失败的状态
|
|
|
+ $('#iconTextAdd').html(''); //置空上传失败的状态
|
|
|
+ // console.log("done" + JSON.stringify(res));
|
|
|
+ layer.msg('上传成功', {icon: 1});
|
|
|
}
|
|
|
, error: function () {
|
|
|
//演示失败状态,并实现重传
|
|
|
- var demoText = $('#demoText');
|
|
|
+ let demoText = $('#iconTextAdd');
|
|
|
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
|
demoText.find('.demo-reload').on('click', function () {
|
|
|
- uploadInst.upload();
|
|
|
+ uploadIcon.upload();
|
|
|
});
|
|
|
}
|
|
|
- //进度条
|
|
|
- , progress: function (n, elem, e) {
|
|
|
- element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
|
|
|
- if (n == 100) {
|
|
|
- layer.msg('上传完毕', {icon: 1});
|
|
|
+ });
|
|
|
+
|
|
|
+ let uploadPicture = upload.render({
|
|
|
+ elem: '#pictureAdd'
|
|
|
+ , url: ctx + mainUploadUrl
|
|
|
+ , data: {
|
|
|
+ type: 'picture', gameId: function () {
|
|
|
+ return $('#newGameId').val();
|
|
|
}
|
|
|
}
|
|
|
+ , before: function (obj) {
|
|
|
+ obj.preview(function (index, file, result) {
|
|
|
+ $('#pictureImageAdd').attr('src', result);
|
|
|
+ });
|
|
|
+ layer.msg('上传中', {icon: 16, time: 0});
|
|
|
+ }
|
|
|
+ , done: function (res) {
|
|
|
+ //如果上传失败
|
|
|
+ if (res.code > 0) {
|
|
|
+ return layer.msg('上传失败');
|
|
|
+ }
|
|
|
+ //上传成功的一些操作
|
|
|
+ $('#pictureTextAdd').html(''); //置空上传失败的状态
|
|
|
+ layer.msg('上传成功', {icon: 1});
|
|
|
+ }
|
|
|
+ , error: function () {
|
|
|
+ //演示失败状态,并实现重传
|
|
|
+ let demoText = $('#pictureTextAdd');
|
|
|
+ demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
|
+ demoText.find('.demo-reload').on('click', function () {
|
|
|
+ uploadPicture.upload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //进度条
|
|
|
+ // , progress: function (n, elem, e) {
|
|
|
+ // element.progress('pictureProgress', n + '%'); //可配合 layui 进度条元素使用
|
|
|
+ // if (n == 100) {
|
|
|
+ // layer.msg('上传完毕', {icon: 1});
|
|
|
+ // }
|
|
|
+ // }
|
|
|
});
|
|
|
|
|
|
- var uploadInstPicture = upload.render({
|
|
|
- elem: '#pictureAdd'
|
|
|
- , url: 'https://httpbin.org/post' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。
|
|
|
- , auto: false
|
|
|
+ //多图片上传
|
|
|
+ let uploadScroll = upload.render({
|
|
|
+ elem: '#scrollAdd'
|
|
|
+ , url: ctx + mainUploadUrl
|
|
|
+ , data: {
|
|
|
+ type: 'scroll', gameId: function () {
|
|
|
+ return $('#newGameId').val();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ , multiple: true
|
|
|
, before: function (obj) {
|
|
|
//预读本地文件示例,不支持ie8
|
|
|
obj.preview(function (index, file, result) {
|
|
|
- $('#demo1').attr('src', result); //图片链接(base64)
|
|
|
+ $('#scrollImageListAdd').append('<img src="' + result + '" alt="' + file.name + '" class="layui-upload-img">')
|
|
|
});
|
|
|
+ }
|
|
|
+ , done: function (res) {
|
|
|
+ //上传完毕
|
|
|
+ layer.msg('上传完毕', {icon: 1});
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- element.progress('demo', '0%'); //进度条复位
|
|
|
+ /**
|
|
|
+ * 修改信息时候图片上传
|
|
|
+ */
|
|
|
+ let modifyIcon = upload.render({
|
|
|
+ elem: '#icon'
|
|
|
+ , url: ctx + mainUploadUrl
|
|
|
+ , data: {
|
|
|
+ type: 'icon', gameId: function () {
|
|
|
+ return $('#modifyGameId').val();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ , before: function (obj) {
|
|
|
+ //预读本地文件示例,不支持ie8
|
|
|
+ obj.preview(function (index, file, result) {
|
|
|
+ $('#iconImage').attr('src', result); //图片链接(base64)
|
|
|
+ });
|
|
|
layer.msg('上传中', {icon: 16, time: 0});
|
|
|
}
|
|
|
, done: function (res) {
|
|
|
@@ -184,59 +283,96 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
if (res.code > 0) {
|
|
|
return layer.msg('上传失败');
|
|
|
}
|
|
|
- //上传成功的一些操作
|
|
|
- //……
|
|
|
- $('#demoText').html(''); //置空上传失败的状态
|
|
|
+ $('#iconText').html('');
|
|
|
+ layer.msg('上传成功', {icon: 1});
|
|
|
}
|
|
|
, error: function () {
|
|
|
//演示失败状态,并实现重传
|
|
|
- var demoText = $('#demoText');
|
|
|
+ let demoText = $('#iconText');
|
|
|
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
|
demoText.find('.demo-reload').on('click', function () {
|
|
|
- uploadInst.upload();
|
|
|
+ modifyIcon.upload();
|
|
|
});
|
|
|
}
|
|
|
- //进度条
|
|
|
- , progress: function (n, elem, e) {
|
|
|
- element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
|
|
|
- if (n == 100) {
|
|
|
- layer.msg('上传完毕', {icon: 1});
|
|
|
+ });
|
|
|
+
|
|
|
+ let modifyPicture = upload.render({
|
|
|
+ elem: '#picture'
|
|
|
+ , url: ctx + mainUploadUrl
|
|
|
+ , data: {
|
|
|
+ type: 'picture', gameId: function () {
|
|
|
+ return $('#modifyGameId').val();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ , before: function (obj) {
|
|
|
+ obj.preview(function (index, file, result) {
|
|
|
+ $('#pictureImage').attr('src', result);
|
|
|
+ });
|
|
|
+ layer.msg('上传中', {icon: 16, time: 0});
|
|
|
+ }
|
|
|
+ , done: function (res) {
|
|
|
+ //如果上传失败
|
|
|
+ if (res.code > 0) {
|
|
|
+ return layer.msg('上传失败');
|
|
|
}
|
|
|
+ //上传成功的一些操作
|
|
|
+ $('#pictureText').html(''); //置空上传失败的状态
|
|
|
+ layer.msg('上传成功', {icon: 1});
|
|
|
+ }
|
|
|
+ , error: function () {
|
|
|
+ //演示失败状态,并实现重传
|
|
|
+ let demoText = $('#pictureText');
|
|
|
+ demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
|
+ demoText.find('.demo-reload').on('click', function () {
|
|
|
+ modifyPicture.upload();
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //多图片上传
|
|
|
- upload.render({
|
|
|
- elem: '#scrollAdd'
|
|
|
- , url: '' //此处配置你自己的上传接口即可
|
|
|
+ let modifyScroll = upload.render({
|
|
|
+ elem: '#scroll'
|
|
|
+ , url: ctx + mainUploadUrl
|
|
|
+ , data: {
|
|
|
+ type: 'scroll', gameId: function () {
|
|
|
+ return $('#modifyGameId').val();
|
|
|
+ }
|
|
|
+ }
|
|
|
, multiple: true
|
|
|
, before: function (obj) {
|
|
|
//预读本地文件示例,不支持ie8
|
|
|
obj.preview(function (index, file, result) {
|
|
|
- $('#demo2').append('<img src="' + result + '" alt="' + file.name + '" class="layui-upload-img">')
|
|
|
+ $('#scrollImageList').append('<img src="' + result + '" alt="' + file.name + '" class="layui-upload-img">')
|
|
|
});
|
|
|
}
|
|
|
, done: function (res) {
|
|
|
//上传完毕
|
|
|
+ layer.msg('上传完毕', {icon: 1});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ //渲染多选tags
|
|
|
+ let dataArray = [];
|
|
|
+ for (let i = 0; i < allCustomTags.length; i++) {
|
|
|
+ let tag = allCustomTags[i];
|
|
|
+ dataArray.push({name: tag.tagName, value: tag.tagId})
|
|
|
+ }
|
|
|
+ ['#multiselectTagAdd', '#multiselectTag'].forEach((el, index) => {
|
|
|
+ xmSelect.render({
|
|
|
+ el,
|
|
|
+ layVerify: 'required',
|
|
|
+ layVerType: 'tips',
|
|
|
+ data: dataArray
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
//头工具栏事件
|
|
|
table.on('toolbar(test)', function (obj) {
|
|
|
switch (obj.event) {
|
|
|
- case 'query':
|
|
|
- //根据用户地址查询
|
|
|
- findByUserAddress(form);
|
|
|
- break;
|
|
|
- case 'playerLogReload':
|
|
|
- playerLogReload();
|
|
|
- break;
|
|
|
-
|
|
|
case 'addNewRow':
|
|
|
-
|
|
|
$("#tableId").css("display", "none");
|
|
|
$("input[name='itemId']").removeAttr("readonly");
|
|
|
$("#tableTime").css("display", "none");
|
|
|
+ $("#updateTime").css("display", "none");
|
|
|
$("#saveBtn").css("display", "none");
|
|
|
$("#addBtn").css("display", "block");
|
|
|
|
|
|
@@ -255,75 +391,17 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
$('#platformAdd').append(new Option("IOS", "1"));
|
|
|
$('#platformAdd').append(new Option("同时支持两个平台", "2", true));
|
|
|
|
|
|
- //加载标签选择组件
|
|
|
- layui.config({
|
|
|
- base: ctx + '/common/layui/'
|
|
|
- }).extend({
|
|
|
- xmSelect: 'xm-select'
|
|
|
- }).use(['xmSelect'], function () {
|
|
|
- let xmSelect = layui.xmSelect;
|
|
|
- let dataArray = [];
|
|
|
- for (let i = 0; i < allCustomTags.length; i++) {
|
|
|
- let tag = allCustomTags[i];
|
|
|
- dataArray.push({name: tag.tagName, value: tag.tagId})
|
|
|
- }
|
|
|
- //渲染多选
|
|
|
- let multiselectTagAdd = xmSelect.render({
|
|
|
- el: '#multiselectTagAdd',
|
|
|
- data: dataArray
|
|
|
- })
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- layui.config({
|
|
|
- base: ctx + '/common/step-lay/'
|
|
|
- }).use(['form', 'step'], function () {
|
|
|
- var $ = layui.$
|
|
|
- , form = layui.form
|
|
|
- , step = layui.step;
|
|
|
-
|
|
|
- step.render({
|
|
|
- elem: '#stepForm',
|
|
|
- filter: 'stepForm',
|
|
|
- width: '100%', //设置容器宽度
|
|
|
- stepWidth: '750px',
|
|
|
- height: '500px',
|
|
|
- stepItems: [{
|
|
|
- title: '填写入款信息'
|
|
|
- }, {
|
|
|
- title: '确认入款信息'
|
|
|
- }, {
|
|
|
- title: '完成'
|
|
|
- }]
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- form.on('submit(formStep)', function (data) {
|
|
|
- step.next('#stepForm');
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- form.on('submit(formStep2)', function (data) {
|
|
|
- step.next('#stepForm');
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- $('.pre').click(function () {
|
|
|
- step.pre('#stepForm');
|
|
|
- });
|
|
|
-
|
|
|
- $('.next').click(function () {
|
|
|
- step.next('#stepForm');
|
|
|
- });
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
form.render("select");
|
|
|
|
|
|
|
|
|
$("#addForm")[0].reset();
|
|
|
+ form.render();
|
|
|
+ //重置图片信息
|
|
|
+ $('#iconImageAdd').attr('src', '');
|
|
|
+ $('#pictureImageAdd').attr('src', '');
|
|
|
+
|
|
|
+
|
|
|
// form.val("addForm", defaultBLEData);
|
|
|
- // form.render();
|
|
|
openIndex = layer.open({
|
|
|
type: 1, //可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
|
|
|
title: ['新增数据', 'font-size:18px;'],//数组第二项可以写任意css样式;如果你不想显示标题栏,你可以title: false
|
|
|
@@ -337,39 +415,79 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
//监听行工具事件
|
|
|
table.on('tool(test)', function (obj) {
|
|
|
let data = obj.data;
|
|
|
+ console.log("data:", data);
|
|
|
//编辑
|
|
|
if (obj.event === 'edit') {
|
|
|
+ //先查询数据,再显示
|
|
|
+ $.post(ctx + mainGameDetailUrl, {gameId: data.gameId}, function (res) {
|
|
|
+ if (!res.flag) {
|
|
|
+ layer.msg(res.msg, {icon: 2, time: 2000}, function () {
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let gameInfo = res.data.gameInfo;
|
|
|
+ let gamePicturesList = res.data.gamePicturesList;
|
|
|
+ let gameTags = res.data.gameTags;
|
|
|
|
|
|
- $('#bluetoothType').find("option").remove();
|
|
|
- $('#bluetoothType').append(new Option("普通绑带", "1", data.bluetoothType === 1));
|
|
|
- $('#bluetoothType').append(new Option("沙袋绑带", "2", data.bluetoothType === 2));
|
|
|
- $('#bluetoothType').append(new Option("手柄蓝牙", "3", data.bluetoothType === 3));
|
|
|
+ $('#gameStatus').find("option").remove();
|
|
|
+ $('#gameStatus').append(new Option("下线", "0", gameInfo.gameStatus === 0));
|
|
|
+ $('#gameStatus').append(new Option("上线", "1", gameInfo.gameStatus === 1));
|
|
|
|
|
|
- $('#isShare').find("option").remove();
|
|
|
- $('#isShare').append(new Option("不共享", "0", true));
|
|
|
- $('#isShare').append(new Option("共享", "1",));
|
|
|
- form.render("select");
|
|
|
+ $('#gameType').find("option").remove();
|
|
|
+ for (let i = 0; i < categoryList.length; i++) {
|
|
|
+ let category = categoryList[i];
|
|
|
+ $('#gameType').append(new Option(category.categoryName, category.categoryType, gameInfo.gameType === category.categoryType));
|
|
|
+ }
|
|
|
|
|
|
- $("#tableId").css("display", "block");
|
|
|
- $("input[name='itemId']").attr("readonly", "readonly");
|
|
|
+ $('#platform').find("option").remove();
|
|
|
+ $('#platform').append(new Option("Android", "0", gameInfo.platform === 0));
|
|
|
+ $('#platform').append(new Option("IOS", "1", gameInfo.platform === 1));
|
|
|
+ $('#platform').append(new Option("同时支持两个平台", "2", gameInfo.platform === 2));
|
|
|
|
|
|
- $("#tableTime").css("display", "block");
|
|
|
- $("#saveBtn").css("display", "block");
|
|
|
- $("#addBtn").css("display", "none");
|
|
|
- //回显操作表单
|
|
|
- $("#comForm").form(data);
|
|
|
- form.render();
|
|
|
+ form.render("select");
|
|
|
+
|
|
|
+ //渲染多选tags
|
|
|
+ let defaultArray = [];
|
|
|
+ for (let i = 0; i < gameTags.length; i++) {
|
|
|
+ let tag = gameTags[i];
|
|
|
+ defaultArray.push(tag.tagId)
|
|
|
+ }
|
|
|
+ //设置value默认数组
|
|
|
+ xmSelect.get('#multiselectTag', true).setValue(defaultArray)
|
|
|
+
|
|
|
+
|
|
|
+ //重置图片信息
|
|
|
+ $('#iconImage').attr('src', domainName + gameInfo.gameIcon);
|
|
|
+ $('#pictureImage').attr('src', domainName + gameInfo.gamePicture);
|
|
|
+ $('#scrollImageList').children().remove();
|
|
|
+ for (let i = 0; i < gamePicturesList.length; i++) {
|
|
|
+ $('#scrollImageList').append('<img src="' + domainName + gamePicturesList[i] + '" alt="" class="layui-upload-img">')
|
|
|
+ }
|
|
|
|
|
|
- openIndex = layer.open({
|
|
|
- type: 1, //可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
|
|
|
- title: ['修改数据', 'font-size:18px;'],//数组第二项可以写任意css样式;如果你不想显示标题栏,你可以title: false
|
|
|
- area: ['50%', '80%'],
|
|
|
- content: $('#show_div')
|
|
|
+ $("#tableId").css("display", "block");
|
|
|
+ $("input[name='itemId']").attr("readonly", "readonly");
|
|
|
+
|
|
|
+ $("#tableTime").css("display", "block");
|
|
|
+ $("#updateTime").css("display", "block");
|
|
|
+ $("#saveBtn").css("display", "block");
|
|
|
+ $("#addBtn").css("display", "none");
|
|
|
+ //回显操作表单
|
|
|
+ $("#comForm").form(data);
|
|
|
+ form.render();
|
|
|
+
|
|
|
+ openIndex = layer.open({
|
|
|
+ type: 1, //可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
|
|
|
+ title: ['修改数据', 'font-size:18px;'],//数组第二项可以写任意css样式;如果你不想显示标题栏,你可以title: false
|
|
|
+ area: ['50%', '80%'],
|
|
|
+ content: $('#show_div')
|
|
|
+ });
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
} else if (obj.event === 'del') {
|
|
|
- layer.confirm('真的删除行么?', function (index) {
|
|
|
+ layer.confirm('真的删除这个游戏么?', function (index) {
|
|
|
// console.log(ctx + mainDeleteUrl);
|
|
|
- $.post(ctx + mainDeleteUrl, {id: data.bluetoothId}, function (data) {
|
|
|
+ $.post(ctx + mainDeleteUrl, {id: data.gameId}, function (data) {
|
|
|
if (!data.flag) {
|
|
|
layer.msg(data.msg, {icon: 2, time: 2000}, function () {
|
|
|
});
|
|
|
@@ -380,34 +498,75 @@ layui.use(['element', 'form', 'table', 'layer', 'laydate', 'tree', 'util', 'uplo
|
|
|
});
|
|
|
layer.close(index);
|
|
|
});
|
|
|
- } else if (obj.event === 'unBind') {
|
|
|
- // layer.confirm('真的解除绑定么?', function (index) {
|
|
|
- // $.post(ctx + mainUnbindUrl, {id: data.bluetoothId}, function (data) {
|
|
|
- // if (!data.flag) {
|
|
|
- // layer.msg(data.msg, {icon: 2, time: 2000}, function () {
|
|
|
- // });
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // tableIns.reload();
|
|
|
- // });
|
|
|
- // layer.close(index);
|
|
|
- // });
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//日期选择器
|
|
|
- laydate.render({
|
|
|
- elem: '#showTimeDate',
|
|
|
- format: "yyyy-MM-dd HH:mm:ss"
|
|
|
- });
|
|
|
+ // ['#showTimeDate', '#AddShowTimeDate'].forEach((el, index) => {
|
|
|
+ // laydate.render({
|
|
|
+ // elem:el,
|
|
|
+ // format: "yyyy-MM-dd HH:mm:ss"
|
|
|
+ // });
|
|
|
+ // });
|
|
|
|
|
|
//监听提交
|
|
|
form.on('submit(comFilter)', function (data) {
|
|
|
- comFormSave(false);
|
|
|
+ comFormSave();
|
|
|
});
|
|
|
- form.on('submit(comAddFilter)', function (data) {
|
|
|
- comFormAdd();
|
|
|
+
|
|
|
+ form.on('submit(formStep)', function (data) {
|
|
|
+ //先存储一次数据,生成数据后,进行下一步
|
|
|
+ // let stepForm = $("#stepForm").serializeObject();
|
|
|
+ let selectStr = xmSelect.get('#multiselectTagAdd', true).getValue('valueStr');
|
|
|
+ data.field.multiSelectTag = selectStr;
|
|
|
+ console.log(data.field);
|
|
|
+ $.post(ctx + mainSaveUrl, data.field, function (data) {
|
|
|
+ if (!data.flag) {
|
|
|
+ layer.msg(data.msg, {icon: 2, time: 2000}, function () {
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // layer.close(openIndex);
|
|
|
+ console.log("data:" + data)
|
|
|
+ // currentGameInfo = data.data;
|
|
|
+ //回显
|
|
|
+ $("#stepForm").form(data.data);
|
|
|
+ form.render();
|
|
|
+ //下一步
|
|
|
+ step.next('#stepForm');
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ form.on('submit(formStep2)', function (data) {
|
|
|
+ step.next('#stepForm');
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.updateGameInfo').click(function () {
|
|
|
+ tableIns.reload();
|
|
|
+ layer.close(openIndex);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.newGameInfo').click(function () {
|
|
|
+ tableIns.reload();
|
|
|
+ //重置表单数据
|
|
|
+ $("#addForm")[0].reset();
|
|
|
+ form.render();
|
|
|
+ //重置图片信息
|
|
|
+ $('#iconImageAdd').attr('src', '');
|
|
|
+ $('#pictureImageAdd').attr('src', '');
|
|
|
+
|
|
|
+ step.next('#stepForm');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.pre').click(function () {
|
|
|
+ step.pre('#stepForm');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.next').click(function () {
|
|
|
+ step.next('#stepForm');
|
|
|
});
|
|
|
|
|
|
$("#saveBtn").css("display", "none");
|
|
|
@@ -449,38 +608,17 @@ function findByUserAddress(form) {
|
|
|
/**
|
|
|
* 提交保存
|
|
|
*/
|
|
|
-function comFormSave(isAddNew) {
|
|
|
+function comFormSave() {
|
|
|
let comForm = $("#comForm").serializeObject();
|
|
|
- if (!comForm.bluetoothId && !isAddNew) {
|
|
|
+ if (!comForm.gameId) {
|
|
|
layer.msg("选择编辑的对象", {icon: 2, time: 1000}, function () {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- $.post(ctx + mainSaveUrl, comForm, function (data) {
|
|
|
- if (!data.flag) {
|
|
|
- layer.msg(data.msg, {icon: 2, time: 2000}, function () {
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- layer.close(openIndex);
|
|
|
- if (isAddNew) {
|
|
|
- if (!bHasData) {
|
|
|
- findByUserAddress();
|
|
|
- } else {
|
|
|
- tableIns.reload();
|
|
|
- }
|
|
|
- } else {
|
|
|
- tableIns.reload();
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
-}
|
|
|
+ let selectStr = xmSelect.get('#multiselectTag', true).getValue('valueStr');
|
|
|
+ comForm.multiSelectTag = selectStr;
|
|
|
|
|
|
-
|
|
|
-function comFormAdd() {
|
|
|
- let addForm = $("#addForm").serializeObject();
|
|
|
- console.log(addForm);
|
|
|
- $.post(ctx + mainSaveUrl, addForm, function (data) {
|
|
|
+ $.post(ctx + mainSaveUrl, comForm, function (data) {
|
|
|
if (!data.flag) {
|
|
|
layer.msg(data.msg, {icon: 2, time: 2000}, function () {
|
|
|
});
|
|
|
@@ -490,220 +628,3 @@ function comFormAdd() {
|
|
|
tableIns.reload();
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-/**
|
|
|
- * 用户操作日志
|
|
|
- * @param table
|
|
|
- * @param data
|
|
|
- */
|
|
|
-function initPlayerLog(table, data) {
|
|
|
- //用户操作playerLog
|
|
|
- // console.log("playerLog");
|
|
|
- tablePlayerLog = table.render({
|
|
|
- elem: '#comPlayerLogTable'
|
|
|
- , url: ctx + "/sys/sysComUsers/findPlayerLogPage"
|
|
|
- , method: 'POST'
|
|
|
- //请求前参数处理
|
|
|
- , request: {
|
|
|
- pageName: 'page' //页码的参数名称,默认:page
|
|
|
- , limitName: 'rows' //每页数据量的参数名,默认:limit
|
|
|
- }
|
|
|
- , where: data
|
|
|
- , response: {
|
|
|
- statusName: 'flag' //规定数据状态的字段名称,默认:code
|
|
|
- , statusCode: true //规定成功的状态码,默认:0
|
|
|
- , msgName: 'msg' //规定状态信息的字段名称,默认:msg
|
|
|
- , countName: 'records' //规定数据总数的字段名称,默认:count
|
|
|
- , dataName: 'rows' //规定数据列表的字段名称,默认:data
|
|
|
- }
|
|
|
- //响应后数据处理
|
|
|
- , parseData: function (res) { //res 即为原始返回的数据
|
|
|
- let data = res.data;
|
|
|
- // console.log("playerLog",res);
|
|
|
- return {
|
|
|
- "flag": res.flag, //解析接口状态
|
|
|
- "msg": res.msg, //解析提示文本
|
|
|
- "records": data.records, //解析数据长度
|
|
|
- "rows": data.rows //解析数据列表
|
|
|
- };
|
|
|
- }
|
|
|
- , toolbar: '#comPlayerLogTableToolbarDemo'
|
|
|
- , title: '用户仓库操作列表'
|
|
|
- , cols: [[
|
|
|
- {field: 'id', title: 'ID', hide: true}
|
|
|
- , {field: 'userId', title: 'userId', width: 260}
|
|
|
- , {field: 'tId', title: '目标id', width: 100}
|
|
|
- , {
|
|
|
- field: 'tType', title: '交易的类型', width: 100, templet: function (d) {
|
|
|
- if (d.tType == 0) { // 自定义内容
|
|
|
- return '<span style="color: green">收获果实</span>';
|
|
|
- } else if (d.tType == 1) {
|
|
|
- return '<span style="color: red">种植种子</span>';
|
|
|
- } else if (d.tType == 2) {
|
|
|
- return '<span style="color: red">赠送</span>';
|
|
|
- } else if (d.tType == 3) {
|
|
|
- return '<span style="color: green">被赠送</span>';
|
|
|
- } else if (d.tType == 4) {
|
|
|
- return '<span style="color: green">钻石兑换种子</span>';
|
|
|
- } else if (d.tType == 5) {
|
|
|
- return '<span style="color: red">出售果实</span>';
|
|
|
- } else if (d.tType == 6) {
|
|
|
- return '<span style="color: green">偷取果实</span>';
|
|
|
- } else if (d.tType == 7) {
|
|
|
- return '<span style="color: red">断电扣除果实</span>';
|
|
|
- } else {
|
|
|
- return '<span style="color: green">待添加:</span>' + d.tType;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- , {field: 'tName', title: '物品名字', width: 120}
|
|
|
- // , {field: 'tAmount', title: '交易数量', width: 150}
|
|
|
- // , {field: 'beforeAmount', title: '交易前数量'}
|
|
|
- // , {field: 'afterAmount', title: '交易后数量'}
|
|
|
- , {
|
|
|
- field: 'tAmount', title: '交易数量', width: 150, templet: function (d) {
|
|
|
- return (d.tAmount + d.tPart).toFixed(5);
|
|
|
- }
|
|
|
- }
|
|
|
- , {
|
|
|
- field: 'beforeAmount', title: '交易前数量', templet: function (d) {
|
|
|
- return (d.beforeAmount + d.beforePart).toFixed(5);
|
|
|
- }
|
|
|
- }
|
|
|
- , {
|
|
|
- field: 'afterAmount', title: '交易后数量', templet: function (d) {
|
|
|
- return (d.afterAmount + d.afterPart).toFixed(5);
|
|
|
- }
|
|
|
- }
|
|
|
- , {field: 'tLoss', title: '系统扣除部分'}
|
|
|
- , {field: 'lMultiple', title: 'land倍数', width: 80}
|
|
|
- , {
|
|
|
- field: 'withered', title: '损耗类型', width: 100, templet: function (d) {
|
|
|
- if (d.withered == 0) { // 自定义内容
|
|
|
- return '<span style="color: green">---</span>';
|
|
|
- } else if (d.withered == 1) {
|
|
|
- return '<span style="color: red">枯萎(死亡)</span>';
|
|
|
- } else if (d.withered == 2) {
|
|
|
- return '<span style="color: red">断电损耗</span>';
|
|
|
- } else {
|
|
|
- return '<span style="color: green">待添加:</span>' + d.withered;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- , {field: 'createTime', title: '创建时间'}
|
|
|
- , {field: 'updateTime', title: '更新时间', hide: true}
|
|
|
- ]]
|
|
|
- , defaultToolbar: ['', 'exports', 'print']
|
|
|
- , page: true
|
|
|
- , height: 500
|
|
|
- , cellMinWidth: 80
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function playerLogReload(data) {
|
|
|
- tablePlayerLog.reload({
|
|
|
- page: {
|
|
|
- curr: 1 //重新从第 1 页开始
|
|
|
- , limit: 10
|
|
|
- }
|
|
|
- , method: 'POST'
|
|
|
- , url: ctx + "/sys/sysComUsers/findPlayerLogPage"
|
|
|
- , where: data
|
|
|
- , done: function (res, curr, count) {
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- * 用户偷取的操作
|
|
|
- * @param table
|
|
|
- * @param data
|
|
|
- */
|
|
|
-function initPlayerProfit(table, data) {
|
|
|
- //用户操作PlayerProfit
|
|
|
- tablePlayerProfit = table.render({
|
|
|
- elem: '#comPlayerProfitTable'
|
|
|
- , url: ctx + "/sys/sysComUsers/findPlayerProfitPage"
|
|
|
- , method: 'POST'
|
|
|
- //请求前参数处理
|
|
|
- , request: {
|
|
|
- pageName: 'page' //页码的参数名称,默认:page
|
|
|
- , limitName: 'rows' //每页数据量的参数名,默认:limit
|
|
|
- }
|
|
|
- , where: data
|
|
|
- , response: {
|
|
|
- statusName: 'flag' //规定数据状态的字段名称,默认:code
|
|
|
- , statusCode: true //规定成功的状态码,默认:0
|
|
|
- , msgName: 'msg' //规定状态信息的字段名称,默认:msg
|
|
|
- , countName: 'records' //规定数据总数的字段名称,默认:count
|
|
|
- , dataName: 'rows' //规定数据列表的字段名称,默认:data
|
|
|
- }
|
|
|
- //响应后数据处理
|
|
|
- , parseData: function (res) { //res 即为原始返回的数据
|
|
|
- let data = res.data;
|
|
|
- // console.log("playerLog",res);
|
|
|
- return {
|
|
|
- "flag": res.flag, //解析接口状态
|
|
|
- "msg": res.msg, //解析提示文本
|
|
|
- "records": data.records, //解析数据长度
|
|
|
- "rows": data.rows //解析数据列表
|
|
|
- };
|
|
|
- }
|
|
|
- , toolbar: '#comPlayerProfitTableToolbarDemo'
|
|
|
- , title: '用户仓库操作列表'
|
|
|
- , cols: [[
|
|
|
- {field: 'id', title: 'ID', hide: true}
|
|
|
- , {field: 'userId', title: 'userId', width: 260}
|
|
|
- , {field: 'targetId', title: '目标id', width: 100}
|
|
|
- , {field: 'plantFlag', title: '种植标识', width: 120}
|
|
|
- , {field: 'landId', title: '土地号数', width: 120}
|
|
|
- , {
|
|
|
- field: 'leaseDate', title: '租赁类型', width: 100, templet: function (d) {
|
|
|
- if (d.leaseDate == 1) { // 自定义内容
|
|
|
- return '<span style="color: green">3个月</span>';
|
|
|
- } else if (d.leaseDate == 2) {
|
|
|
- return '<span style="color: red">1年</span>';
|
|
|
- } else if (d.leaseDate == 3) {
|
|
|
- return '<span style="color: red">5年</span>';
|
|
|
- } else if (d.leaseDate == 4) {
|
|
|
- return '<span style="color: red">养殖场</span>';
|
|
|
- } else {
|
|
|
- return '<span style="color: green">待添加:</span>' + d.leaseDate;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- , {field: 'leaseMultiple', title: '租赁倍数', width: 120}
|
|
|
- , {field: 'harvest', title: '土地产出量', width: 150}
|
|
|
- , {field: 'profit', title: '利润总值'}
|
|
|
- , {field: 'profitAfter', title: '交易后利润'}
|
|
|
- , {field: 'stolen', title: '目标损失量', width: 150}
|
|
|
- , {field: 'finalSteal', title: '玩家偷取得到的数量'}
|
|
|
- , {field: 'profitRatio', title: '收成的比例值'}
|
|
|
- , {field: 'stealRatio', title: '比例区间1%~3%'}
|
|
|
- , {field: 'finalRatio', title: '损失比例', width: 80}
|
|
|
- , {field: 'createTime', title: '创建时间'}
|
|
|
- , {field: 'updateTime', title: '更新时间', hide: true}
|
|
|
- ]]
|
|
|
- , defaultToolbar: ['', 'exports', 'print']
|
|
|
- , page: true
|
|
|
- , height: 500
|
|
|
- , cellMinWidth: 80
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function playerProfitReload(data) {
|
|
|
- tablePlayerProfit.reload({
|
|
|
- page: {
|
|
|
- curr: 1 //重新从第 1 页开始
|
|
|
- , limit: 10
|
|
|
- }
|
|
|
- , method: 'POST'
|
|
|
- , url: ctx + "/sys/sysComUsers/findPlayerProfitPage"
|
|
|
- , where: data
|
|
|
- , done: function (res, curr, count) {
|
|
|
- }
|
|
|
- });
|
|
|
-}
|