版本暂存

This commit is contained in:
dragon
2024-11-14 15:37:31 +08:00
parent 7610a2768f
commit ed618598c2
6 changed files with 1827 additions and 788 deletions

View File

@@ -0,0 +1,12 @@
import request from '@/utils/request';
import { genQueryParam } from '@/utils/maintainer';
import qs from 'qs';
// 地区接口
export const listPartitionInfo = query => {
return request({
url: '/partition/listPartitionInfo',
method: 'get',
params: query
});
};

View File

@@ -7,140 +7,221 @@
<h1 id="itemTitle"></h1> <h1 id="itemTitle"></h1>
</section> </section>
<div id="toolbar"> <div id="toolbar">
<el-form-item label="装扮类型" prop="dateCycle">
<el-select placeholder="请选择" v-model="dressTypeVal">
<el-option
v-for="(item, i) in dressTypeArr"
:key="i"
:label="item.desc"
:value="item.val"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="获得方式" prop="dateCycle">
<el-select placeholder="请选择" v-model="obtainWayVal">
<el-option
v-for="(item, i) in obtainWayArr"
:key="i"
:label="item.desc"
:value="item.val"
></el-option>
</el-select>
</el-form-item>
<div class="col-sm-12"> <div class="col-sm-12">
<button id="btnAdd" <button
class="btn btn-default"> id="btnAdd"
class="btn btn-default"
style="margin-right: 20px"
>
<i class="glyphicon glyphicon-plus"></i>增加 <i class="glyphicon glyphicon-plus"></i>增加
</button> </button>
<button @click="initData" id="getData" class="btn btn-default">
查询
</button>
</div> </div>
</div> </div>
</div> </div>
<!-- .content --> <!-- .content -->
<div id="table"></div> <div id="table"></div>
</div> </div>
</section> </section>
<div class="modal fade" <div
class="modal fade"
id="roomTagModal" id="roomTagModal"
tabindex="-1" tabindex="-1"
role="dialog" role="dialog"
aria-labelledby="modalLabel"> aria-labelledby="modalLabel"
<div class="modal-dialog" >
role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" <button
type="button"
class="close" class="close"
data-dismiss="modal" data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span> aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" <h4 class="modal-title" id="modalLabel">新增</h4>
id="modalLabel">新增</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" <form class="form-horizontal" id="addForm">
id="addForm"> <input type="hidden" name="id" id="id" />
<input type="hidden"
name="id"
id="id" />
<div class="form-group"> <div class="form-group">
<label for="dressType" <label for="dressType" class="col-sm-3 control-label"
class="col-sm-3 control-label">装扮类型:</label> >装扮类型:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<select name="dressType" <select name="dressType" id="dressType">
id="dressType">
<option value="">-- 请选择 --</option> <option value="">-- 请选择 --</option>
<option value="0">头饰</option> <option value="0">头饰</option>
<option value="1">座驾</option> <option value="1">座驾</option>
<option value="2">铭牌</option> <option value="2">铭牌</option>
<option value="3">资料卡</option> <option value="3">资料卡</option>
<option value="4">聊天气泡</option> <option value="4">聊天气泡</option>
<option value="5">个人装扮</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group" <div class="form-group">
id="txtBox"> <label for="obtainWay" class="col-sm-3 control-label"
<label for="dressId" >获得方式:</label
class="col-sm-3 control-label">装扮id<font color="red">*</font></label> >
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" <select name="obtainWay" id="obtainWay">
<option value="">-- 请选择 --</option>
<option value="1">普通</option>
<option value="2">活动</option>
</select>
</div>
</div>
<div class="form-group" id="txtBox">
<label for="dressId" class="col-sm-3 control-label"
>装扮id<font color="red">*</font></label
>
<div class="col-sm-9">
<input
type="text"
class="form-control validate[required]" class="form-control validate[required]"
name="dressId" name="dressId"
id="dressId" id="dressId"
placeholder="请输入对应的装扮id"> placeholder="请输入对应的装扮id"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="dressSeq" <label for="dressSeq" class="col-sm-3 control-label"
class="col-sm-3 control-label">展示排序<font color="red">*</font></label> >展示排序<font color="red">*</font></label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" <input
type="text"
class="form-control validate[required]" class="form-control validate[required]"
name="dressSeq" name="dressSeq"
id="dressSeq" id="dressSeq"
placeholder="数字小的排前面,必填"> placeholder="数字小的排前面,必填"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="dressPrice" <label for="dressPrice" class="col-sm-3 control-label"
class="col-sm-3 control-label">装扮价格:</label> >装扮价格:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" <input
type="text"
class="form-control validate[required]" class="form-control validate[required]"
name="dressPrice" name="dressPrice"
id="dressPrice" id="dressPrice"
placeholder="请输入价格"> placeholder="请输入价格"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="dressDay" <label for="dressDay" class="col-sm-3 control-label"
class="col-sm-3 control-label">有效期:</label> >有效期:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" <input
type="text"
class="form-control validate[required]" class="form-control validate[required]"
name="dressDay" name="dressDay"
id="dressDay" id="dressDay"
placeholder="请输入天数"> placeholder="请输入天数"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="dressLimitStatus" <label for="dressLimitStatus" class="col-sm-3 control-label"
class="col-sm-3 control-label">装扮限时状态:</label> >装扮限时状态:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<select name="dressType" <select name="dressType" id="dressLimitStatus">
id="dressLimitStatus">
<option value="0"></option> <option value="0"></option>
<option value="1"></option> <option value="1"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label for="vipLimit" class="col-sm-3 control-label"
>贵族限定:</label
>
<div class="col-sm-9">
<select name="dressType" id="vipLimit">
<option value="">无限制</option>
<option value="1">VIP1</option>
<option value="2">VIP2</option>
<option value="3">VIP3</option>
<option value="4">VIP4</option>
<option value="5">VIP5</option>
<option value="6">VIP6</option>
<option value="7">VIP7</option>
<option value="8">VIP8</option>
<option value="9">VIP9</option>
</select>
</div>
</div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" <button type="button" class="btn btn-default" data-dismiss="modal">
class="btn btn-default" 关闭
data-dismiss="modal">关闭</button> </button>
<button type="button" <button type="button" class="btn btn-primary" id="add">确定</button>
class="btn btn-primary"
id="add">确定</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import TableHelper from '@/utils/bootstrap-table-helper'; import TableHelper from "@/utils/bootstrap-table-helper";
import { serverError } from '@/utils/maintainer'; import { serverError } from "@/utils/maintainer";
export default { export default {
name: "DressShopAdminView", name: "DressShopAdminView",
setup () { data() {
return {}; return {
dressTypeVal: "",
dressTypeArr: [
{ desc: "全部", val: "" },
{ desc: "头饰", val: "0" },
{ desc: "座驾", val: "1" },
{ desc: "铭牌", val: "2" },
{ desc: "资料卡", val: "3" },
{ desc: "聊天气泡", val: "4" },
{ desc: "个人装扮", val: "5" },
],
obtainWayVal: "",
obtainWayArr: [
{ desc: "全部", val: "" },
{ desc: "普通", val: "1" },
{ desc: "活动", val: "2" },
],
};
}, },
created() { created() {
this.$nextTick(function () { this.$nextTick(function () {
@@ -149,81 +230,209 @@ export default {
}, },
methods: { methods: {
initData() { initData() {
$(function () { var dressTypeVal = this.dressTypeVal;
$('#table').bootstrapTable('destroy'); var obtainWayVal = this.obtainWayVal;
$('#table').bootstrapTable({ $("#table").bootstrapTable("destroy");
$("#table").bootstrapTable({
columns: [ columns: [
{ field: 'id', title: 'ID', align: 'center', valign: 'middle', width: '10%' },
{ field: 'dressId', title: '装扮id', align: 'center', valign: 'middle', width: '10%' },
{ field: 'name.zh', title: '装扮名称', align: 'left', valign: 'middle', width: '10%' },
{ field: 'name.ar', title: '阿语装扮名称', align: 'left', valign: 'middle', width: '10%' },
{ field: 'name.en', title: '英语装扮名称', align: 'left', valign: 'middle', width: '10%' },
{ field: 'name.tr', title: '土耳其装扮名称', align: 'left', valign: 'middle', width: '10%' },
{ {
field: 'pic', title: '装扮图片', align: 'left', valign: 'middle', width: '10%', field: "id",
formatter: function (val, row, index) { title: "ID",
if (null != val && val != '') { align: "center",
return '<img src="' + val + '" alt="" style="width: 30px; height: 30px;">'; valign: "middle",
} width: "10%",
return '-';
}
}, },
{ {
field: 'dressType', field: "dressId",
title: '装扮类型', title: "装扮id",
align: 'center', align: "center",
width: '5%', valign: "middle",
valign: 'middle', width: "10%",
},
{
field: "name.zh",
title: "装扮名称",
align: "left",
valign: "middle",
width: "10%",
},
{
field: "name.ar",
title: "阿语装扮名称",
align: "left",
valign: "middle",
width: "10%",
},
{
field: "name.en",
title: "英语装扮名称",
align: "left",
valign: "middle",
width: "10%",
},
{
field: "pic",
title: "装扮图片",
align: "left",
valign: "middle",
width: "10%",
formatter: function (val, row, index) { formatter: function (val, row, index) {
if (val == '0') { if (null != val && val != "") {
return (
'<img src="' +
val +
'" alt="" style="width: 30px; height: 30px;">'
);
}
return "-";
},
},
{
field: "dressType",
title: "装扮类型",
align: "center",
width: "5%",
valign: "middle",
formatter: function (val, row, index) {
if (val == "0") {
return "头饰"; return "头饰";
} else if (val == '1') { } else if (val == "1") {
return '座驾'; return "座驾";
} else if (val == '2') { } else if (val == "2") {
return '铭牌'; return "铭牌";
} else if (val == '3') { } else if (val == "3") {
return '资料卡'; return "资料卡";
} else if (val == '4') { } else if (val == "4") {
return '聊天气泡'; return "聊天气泡";
} else if (val == "5") {
return "个人装扮";
} else { } else {
return '-'; return "-";
} }
}
}, },
{ field: 'dressSeq', title: '装扮排序', align: 'center', valign: 'middle', width: '10%' }, },
{ field: 'dressPrice', title: '装扮展示价值', align: 'center', valign: 'middle', width: '10%' },
{ field: 'dressDay', title: '装扮有效期(天)', align: 'center', valign: 'middle', width: '10%' },
{ field: 'buyNum', title: '购买数量', align: '购买数量 ', valign: 'middle', width: '10%' },
{ field: 'userDonateNum', title: '购买赠送用户数量', align: '购买数量', valign: 'middle', width: '10%' },
{ {
field: 'dressLimitStatus', field: "obtainWay",
title: '装扮限时状态', title: "获得方式",
align: 'center', align: "center",
width: '5%', width: "5%",
valign: 'middle', valign: "middle",
formatter: function (val, row, index) { formatter: function (val, row, index) {
if (val == '0') { if (val == "1") {
return "普通";
} else if (val == "2") {
return "活动";
} else {
return "-";
}
},
},
{
field: "dressSeq",
title: "装扮排序",
align: "center",
valign: "middle",
width: "10%",
},
{
field: "dressPrice",
title: "装扮展示价值",
align: "center",
valign: "middle",
width: "10%",
},
{
field: "dressDay",
title: "装扮有效期(天)",
align: "center",
valign: "middle",
width: "10%",
},
{
field: "buyNum",
title: "购买数量",
align: "购买数量 ",
valign: "middle",
width: "10%",
},
{
field: "userDonateNum",
title: "购买赠送用户数量",
align: "购买数量",
valign: "middle",
width: "10%",
},
{
field: "dressLimitStatus",
title: "装扮限时状态",
align: "center",
width: "5%",
valign: "middle",
formatter: function (val, row, index) {
if (val == "0") {
return "有效"; return "有效";
} else { } else {
return '无效'; return "无效";
} }
} },
}, },
{ {
field: 'id', field: "vipLimit",
title: '操作', title: "贵族限定",
align: 'center', align: "center",
width: '10%', width: "5%",
valign: "middle",
formatter: function (val, row, index) { formatter: function (val, row, index) {
return '<button id="btnEdit" name="btnEdit" class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' + if (val == "1") {
return "VIP1";
}
if (val == "2") {
return "VIP2";
}
if (val == "3") {
return "VIP3";
}
if (val == "4") {
return "VIP4";
}
if (val == "5") {
return "VIP5";
}
if (val == "6") {
return "VIP6";
}
if (val == "7") {
return "VIP7";
}
if (val == "8") {
return "VIP8";
}
if (val == "9") {
return "VIP9";
} else {
return "无限制";
}
},
},
{
field: "id",
title: "操作",
align: "center",
width: "10%",
formatter: function (val, row, index) {
return (
'<button id="btnEdit" name="btnEdit" class="btn btn-sm btn-success opt-edit" data-id=' +
val +
">" +
'<i class="glyphicon glyphicon-edit"></i> 编辑</button>' + '<i class="glyphicon glyphicon-edit"></i> 编辑</button>' +
'&nbsp;&nbsp;<button class="btn btn-sm btn-danger opt-remove" data-id=' + val + ' data-new-status=' + 2 + '&nbsp;&nbsp;<button class="btn btn-sm btn-danger opt-remove" data-id=' +
'><i class="glyphicon glyphicon-remove"></i>删除</button>'; val +
" data-new-status=" +
} 2 +
} '><i class="glyphicon glyphicon-remove"></i>删除</button>'
);
},
},
], ],
undefinedText: "-", undefinedText: "-",
cache: false, cache: false,
@@ -235,28 +444,32 @@ export default {
search: false, search: false,
sidePagination: "server", //表示服务端请求 sidePagination: "server", //表示服务端请求
queryParamsType: "undefined", queryParamsType: "undefined",
queryParams: function queryParams (params) { //设置查询参数 queryParams: function queryParams(params) {
//设置查询参数
var param = { var param = {
pageNum: params.pageNumber, pageNum: params.pageNumber,
pageSize: params.pageSize pageSize: params.pageSize,
dressType: dressTypeVal,
obtainWay: obtainWayVal,
}; };
return param; return param;
}, },
ajax: function (request) { //使用ajax请求 ajax: function (request) {
//使用ajax请求
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: '/admin/dress/shop/list', url: "/admin/dress/shop/list",
contentType: 'application/json;charset=utf-8', contentType: "application/json;charset=utf-8",
dataType: 'json', dataType: "json",
data: request.data, data: request.data,
success: function (res) { success: function (res) {
apiResult(res); apiResult(res);
console.log(res) console.log(res);
request.success({ request.success({
total: res.data.total, total: res.data.total,
rows: res.data.rows.map(i => { rows: res.data.rows.map((i) => {
let value = i.name; let value = i.name;
if (value.startsWith('{') && value.endsWith('}')) { if (value.startsWith("{") && value.endsWith("}")) {
i.name = JSON.parse(i.name); i.name = JSON.parse(i.name);
} else { } else {
i.name = { i.name = {
@@ -266,46 +479,48 @@ export default {
}; };
} }
return i; return i;
}) }),
}); });
}, },
error: function (req) { error: function (req) {
serverError(req); serverError(req);
}
})
}, },
toolbar: '#toolbar', });
onLoadSuccess: function () { //加载成功时执行 },
toolbar: "#toolbar",
onLoadSuccess: function () {
//加载成功时执行
console.log("load success"); console.log("load success");
}, },
onLoadError: function () { //加载失败时执行 onLoadError: function () {
//加载失败时执行
console.log("load fail"); console.log("load fail");
} },
}); });
// 查询刷新 // 查询刷新
$('#btnSearch').on('click', function () { $("#btnSearch").on("click", function () {
TableHelper.doRefresh('#table'); TableHelper.doRefresh("#table");
}); });
//新建标签 //新建标签
$("#btnAdd").click(function () { $("#btnAdd").click(function () {
clearModal(); clearModal();
$("#roomTagModal").modal('show'); $("#roomTagModal").modal("show");
}); });
$("#add").click(function () { $("#add").click(function () {
var id = $("#id").val(); var id = $("#id").val();
var dressType = $('#dressType').val(); var dressType = $("#dressType").val();
var obtainWay = $("#obtainWay").val();
var dressId = $("#dressId").val(); var dressId = $("#dressId").val();
var dressSeq = $('#dressSeq').val(); var dressSeq = $("#dressSeq").val();
var dressPrice = $('#dressPrice').val(); var dressPrice = $("#dressPrice").val();
var dressDay = $('#dressDay').val(); var dressDay = $("#dressDay").val();
var dressLimitStatus = $('#dressLimitStatus').val(); var dressLimitStatus = $("#dressLimitStatus").val();
var vipLimit = $("#vipLimit").val();
if ($("#addForm").validationEngine('validate')) { if ($("#addForm").validationEngine("validate")) {
$.ajax({ $.ajax({
type: "post", type: "post",
url: "/admin/dress/shop/saveOrUpdate", url: "/admin/dress/shop/saveOrUpdate",
@@ -313,31 +528,32 @@ export default {
id: id, id: id,
dressId: dressId, dressId: dressId,
dressType: dressType, dressType: dressType,
obtainWay: obtainWay,
dressSeq: dressSeq, dressSeq: dressSeq,
dressPrice: dressPrice, dressPrice: dressPrice,
dressDay: dressDay, dressDay: dressDay,
dressLimitStatus: dressLimitStatus, dressLimitStatus: dressLimitStatus,
vipLimit: vipLimit,
}, },
dataType: "json", dataType: "json",
success: function (json) { success: function (json) {
if (json.code == 200) { if (json.code == 200) {
$("#tipMsg").text("保存成功"); $("#tipMsg").text("保存成功");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
TableHelper.doRefresh("#table"); TableHelper.doRefresh("#table");
$("#roomTagModal").modal('hide'); $("#roomTagModal").modal("hide");
} else { } else {
$("#tipMsg").text("保存失败." + json.message); $("#tipMsg").text("保存失败." + json.message);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
TableHelper.doRefresh("#table"); TableHelper.doRefresh("#table");
$("#roomTagModal").modal('hide'); $("#roomTagModal").modal("hide");
}
} }
},
}); });
} }
}); });
$("#table").on("click", '.opt-edit', function () { $("#table").on("click", ".opt-edit", function () {
var id = $(this).attr("data-id"); var id = $(this).attr("data-id");
clearModal(); clearModal();
@@ -350,116 +566,113 @@ export default {
var json = res.data; var json = res.data;
if (json) { if (json) {
$("#id").val(id); $("#id").val(id);
$('#dressId').val(json.dressId); $("#dressId").val(json.dressId);
$('#dressType').val(json.dressType); $("#dressType").val(json.dressType);
$('#dressSeq').val(json.dressSeq); $("#obtainWay").val(json.obtainWay);
$('#dressPrice').val(json.dressPrice); $("#dressSeq").val(json.dressSeq);
$('#dressDay').val(json.dressDay); $("#dressPrice").val(json.dressPrice);
$('#dressLimitStatus').val(json.dressLimitStatus); $("#dressDay").val(json.dressDay);
$("#dressLimitStatus").val(json.dressLimitStatus);
$("#vipLimit").val(json.vipLimit);
// 打开编辑弹窗 // 打开编辑弹窗
$("#roomTagModal").modal('show'); $("#roomTagModal").modal("show");
$("#modalLabel").text("编辑"); $("#modalLabel").text("编辑");
} else { } else {
$("#tipMsg").text("获取信息出错"); $("#tipMsg").text("获取信息出错");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
}
} }
},
}); });
}); });
$("#table").on("click", '.opt-remove', function () { $("#table").on("click", ".opt-remove", function () {
var id = $(this).attr("data-id"); var id = $(this).attr("data-id");
if (confirm("你确认删除该记录吗? \r\n 删除后再也不能找回,请谨慎操作!")) { if (
confirm("你确认删除该记录吗? \r\n 删除后再也不能找回,请谨慎操作!")
) {
const requestParam = { const requestParam = {
id: id id: id,
} };
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/admin/dress/shop/delById", url: "/admin/dress/shop/delById",
data: requestParam, data: requestParam,
dataType: "json", dataType: "json",
contentType: 'application/json', contentType: "application/json",
success: function (json) { success: function (json) {
if (json.code == 200) { if (json.code == 200) {
$("#tipMsg").text("修改成功"); $("#tipMsg").text("修改成功");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
TableHelper.doRefresh("#table"); TableHelper.doRefresh("#table");
} else { } else {
$("#tipMsg").text("修改失败." + json.message); $("#tipMsg").text("修改失败." + json.message);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
}
} }
},
}); });
} }
}); });
function apiResult(json) { function apiResult(json) {
if (json.code == 200 && json.message == 'success') { if (json.code == 200 && json.message == "success") {
return true; return true;
} }
$("#tipMsg").text("请求失败,错误信息:" + json.message); $("#tipMsg").text("请求失败,错误信息:" + json.message);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return false; return false;
} }
$("#iconBtn").on("click", function () {
$('#iconBtn').on('click', function () { if ($("#iconFile").val() == "") {
if ($('#iconFile').val() == '') { $("#tipMsg").text("上传图片为空");
$('#tipMsg').text('上传图片为空'); $("#tipModal").modal("show");
$('#tipModal').modal('show');
return; return;
} }
$.ajaxFileUpload({ $.ajaxFileUpload({
fileElementId: 'iconFile', //需要上传的文件域的ID即<input type="file">的ID。 fileElementId: "iconFile", //需要上传的文件域的ID即<input type="file">的ID。
url: '/admin/upload/img', //后台方法的路径 url: "/admin/upload/img", //后台方法的路径
type: 'post', //当要提交自定义参数时这个参数要设置成post type: "post", //当要提交自定义参数时这个参数要设置成post
dataType: 'json', //服务器返回的数据类型。可以为xml,script,json,html。如果不填写jQuery会自动判断。 dataType: "json", //服务器返回的数据类型。可以为xml,script,json,html。如果不填写jQuery会自动判断。
secureuri: false, //是否启用安全提交默认为false。 secureuri: false, //是否启用安全提交默认为false。
async: true, //是否是异步 async: true, //是否是异步
success: function (json) { //提交成功后自动执行的处理函数参数data就是服务器返回的数据。 success: function (json) {
//提交成功后自动执行的处理函数参数data就是服务器返回的数据。
if (json.path) { if (json.path) {
$('#iconUrl').val(json.path); $("#iconUrl").val(json.path);
$('#iconImgUrl').attr("src", json.path); $("#iconImgUrl").attr("src", json.path);
console.log(json.path); console.log(json.path);
} else { } else {
$("#tipMsg").text(json.msg); $("#tipMsg").text(json.msg);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
} }
}, },
error: function (data, status, e) { //提交失败自动执行的处理函数。 error: function (data, status, e) {
//提交失败自动执行的处理函数。
console.error(e); console.error(e);
} },
});
}); });
})
function clearModal() { function clearModal() {
$('#iconImgUrl').attr('src', ''); $("#iconImgUrl").attr("src", "");
$('#addForm').find('input[type=text],input[type=hidden],input[type=file]').each(function () { $("#addForm")
$(this).val(''); .find("input[type=text],input[type=hidden],input[type=file]")
}) .each(function () {
$(this).val("");
$('#type').val(1); });
$("#type").val(1);
} }
$("#type").change(function () { $("#type").change(function () {
var optVal = $(this).val(); var optVal = $(this).val();
}); });
});
}
}, },
},
}; };
</script> </script>

View File

@@ -0,0 +1,151 @@
<template>
<div class="box">
<!-- 查询 -->
<div class="inquire">
<span>平台ID</span>
<el-input v-model="inquire.id" placeholder="" class="input"></el-input>
</div>
<!-- 查询按钮 -->
<el-button class="primary" type="primary" @click="getData()"
>查询</el-button
>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="x" align="center" label="个人主页id" />
<el-table-column prop="x" align="center" label="个人主页名称" />
<el-table-column prop="x" align="center" label="用户uID" />
<el-table-column prop="x" align="center" label="用户昵称" />
<el-table-column prop="x" align="center" label="赠送天数" />
<el-table-column prop="x" align="center" label="备注" />
<el-table-column prop="x" align="center" label="操作时间" />
<el-table-column prop="x" align="center" label="操作人" />
<!-- <el-table-column align="center" label="操作" width="300">
<template v-slot="scope">
<el-button
@click="
operationDialog = true;
operationValue.partitionId = scope.row.x;
operationValue.nameZh = scope.row.x;
operationValue.nameEn = scope.row.x;
operationValue.nameAr = scope.row.x;
operationValue.nameTr = scope.row.x;
operationValue.price = scope.row.x;
operationValue.day = scope.row.x;
operationValue.imageUrl = scope.row.x;
operationValue.status = scope.row.x;
"
class="primary"
type="primary"
size="default"
>编辑</el-button
>
<el-button
@click="send()"
class="primary"
type="primary"
size="default"
>赠送</el-button
>
</template>
</el-table-column> -->
</el-table>
<!-- 分页 -->
<el-pagination
style="margin-top: 10px"
class="paginationClass"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
layout="sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
// import { } from "@/api/personalHomepageResourceManagement/personalHomepageResourceManagement";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
export default {
name: "personalHomepageGiftRecordManagement",
data() {
return {
loading: false,
//查询所需条件对象
inquire: {
id: "",
},
// 表格
tableData: [{ x: "x" }],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
};
},
created() {},
methods: {
// 查询接口
getData() {
this.loading = true;
// get({}).then((res) => {
// if (res.code == 200) {
// this.loading = false;
// } else {
// ElMessage({
// showClose: true,
// message: res.message,
// type: "error",
// });
// }
// });
},
// 分页导航
handleSizeChange() {
this.getData();
},
handleCurrentChange() {
this.getData();
},
},
};
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
.operation {
margin-bottom: 20px;
width: 55%;
display: flex;
align-items: baseline;
justify-content: space-between;
}
</style>

View File

@@ -0,0 +1,152 @@
<template>
<div class="box">
<!-- 查询 -->
<div class="inquire">
<span>平台ID</span>
<el-input v-model="inquire.id" placeholder="" class="input"></el-input>
</div>
<!-- 查询按钮 -->
<el-button class="primary" type="primary" @click="getData()"
>查询</el-button
>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="x" align="center" label="个人主页id" />
<el-table-column prop="x" align="center" label="个人主页名称" />
<el-table-column prop="x" align="center" label="用户uID" />
<el-table-column prop="x" align="center" label="用户昵称" />
<el-table-column prop="x" align="center" label="拥有个人主页" />
<el-table-column prop="x" align="center" label="个人主页状态" />
<el-table-column prop="x" align="center" label="购买时间" />
<el-table-column prop="x" align="center" label="有效时间" />
<el-table-column prop="x" align="center" label="过期时间" />
<!-- <el-table-column align="center" label="操作" width="300">
<template v-slot="scope">
<el-button
@click="
operationDialog = true;
operationValue.partitionId = scope.row.x;
operationValue.nameZh = scope.row.x;
operationValue.nameEn = scope.row.x;
operationValue.nameAr = scope.row.x;
operationValue.nameTr = scope.row.x;
operationValue.price = scope.row.x;
operationValue.day = scope.row.x;
operationValue.imageUrl = scope.row.x;
operationValue.status = scope.row.x;
"
class="primary"
type="primary"
size="default"
>编辑</el-button
>
<el-button
@click="send()"
class="primary"
type="primary"
size="default"
>赠送</el-button
>
</template>
</el-table-column> -->
</el-table>
<!-- 分页 -->
<el-pagination
style="margin-top: 10px"
class="paginationClass"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
layout="sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
// import { } from "@/api/personalHomepageResourceManagement/personalHomepageResourceManagement";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
export default {
name: "personalHomepageRecordManagement",
data() {
return {
loading: false,
//查询所需条件对象
inquire: {
id: "",
},
// 表格
tableData: [{ x: "x" }],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
};
},
created() {},
methods: {
// 查询接口
getData() {
this.loading = true;
// get({}).then((res) => {
// if (res.code == 200) {
// this.loading = false;
// } else {
// ElMessage({
// showClose: true,
// message: res.message,
// type: "error",
// });
// }
// });
},
// 分页导航
handleSizeChange() {
this.getData();
},
handleCurrentChange() {
this.getData();
},
},
};
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
.operation {
margin-bottom: 20px;
width: 55%;
display: flex;
align-items: baseline;
justify-content: space-between;
}
</style>

View File

@@ -0,0 +1,369 @@
<template>
<div class="box">
<!-- 查询 -->
<div class="inquire">
<span>地区</span>
<el-select v-model="inquire.partitionId" placeholder="请选择">
<el-option
v-for="item in inquire.partitionArr"
:key="item.id"
:label="item.desc"
:value="item.id"
>
</el-option>
</el-select>
</div>
<div class="inquire">
<span>名称</span>
<el-input v-model="inquire.name" placeholder="" class="input"></el-input>
</div>
<div class="inquire">
<span>状态</span>
<el-select v-model="inquire.status" placeholder="请选择">
<el-option
v-for="item in inquire.options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<!-- 查询按钮 -->
<el-button class="primary" type="primary" @click="getData()"
>查询</el-button
>
<!-- 新增按钮 -->
<el-button
class="primary"
type="primary"
@click="
operationDialog = true;
operationValue.partitionId = '';
operationValue.nameZh = '';
operationValue.nameEn = '';
operationValue.nameAr = '';
operationValue.nameTr = '';
operationValue.price = '';
operationValue.day = '';
operationValue.imageUrl = '';
operationValue.status = '';
"
>新增</el-button
>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="x" align="center" label="地区" />
<el-table-column prop="x" align="center" label="名称" />
<el-table-column prop="x" align="center" label="阿语名称" />
<el-table-column prop="x" align="center" label="英语名称" />
<el-table-column prop="x" align="center" label="土耳其名称" />
<el-table-column prop="x" align="center" label="价格" />
<el-table-column prop="x" align="center" label="有效期" />
<el-table-column prop="x" align="center" label="图片">
<template v-slot="scope">
<el-image
style="width: 200px; height: 200px"
:src="scope.row.x"
:zoom-rate="1.1"
:preview-src-list="[scope.row.x]"
fit="scale-down"
preview-teleported="true"
hide-on-click-modal="true"
/>
</template>
</el-table-column>
<el-table-column prop="x" align="center" label="状态">
<template v-slot="scope">
{{ scope.row.x }}
</template>
</el-table-column>
<el-table-column prop="x" align="center" label="操作人" />
<el-table-column prop="x" align="center" label="操作时间" />
<el-table-column align="center" label="操作" width="300">
<template v-slot="scope">
<el-button
@click="
operationDialog = true;
operationValue.partitionId = scope.row.x;
operationValue.nameZh = scope.row.x;
operationValue.nameEn = scope.row.x;
operationValue.nameAr = scope.row.x;
operationValue.nameTr = scope.row.x;
operationValue.price = scope.row.x;
operationValue.day = scope.row.x;
operationValue.imageUrl = scope.row.x;
operationValue.status = scope.row.x;
"
class="primary"
type="primary"
size="default"
>编辑</el-button
>
<el-button
@click="send()"
class="primary"
type="primary"
size="default"
>赠送</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 新增&操作弹窗 -->
<el-dialog
v-model="operationDialog"
:title="operationDialogTitle"
width="28%"
center
>
<div class="operation">
<span style="margin-right: 20px">地区</span>
<el-select v-model="operationValue.partitionId" placeholder="请选择">
<el-option
v-for="item in operationValue.partitionArr"
:key="item.id"
:label="item.desc"
:value="item.id"
>
</el-option>
</el-select>
</div>
<div class="operation">
<span style="margin-right: 20px">华语名称</span>
<el-input
v-model="operationValue.nameZh"
style="width: 200px"
class="input"
></el-input>
</div>
<div class="operation">
<span style="margin-right: 20px">英语名称</span>
<el-input
v-model="operationValue.nameEn"
style="width: 200px"
class="input"
></el-input>
</div>
<div class="operation">
<span style="margin-right: 20px">阿拉伯名称</span>
<el-input
v-model="operationValue.nameAr"
style="width: 200px"
class="input"
></el-input>
</div>
<div class="operation">
<span style="margin-right: 20px">土耳其名称</span>
<el-input
v-model="operationValue.nameTr"
style="width: 200px"
class="input"
></el-input>
</div>
<div class="operation">
<span style="margin-right: 20px">价格</span>
<el-input
v-model="operationValue.price"
style="width: 200px"
class="input"
></el-input>
</div>
<div class="operation">
<span style="margin-right: 20px">有效天数</span>
<el-input
v-model="operationValue.day"
style="width: 200px"
class="input"
></el-input>
</div>
<div class="operation">
<span class="left" style="margin-right: 20px">图片</span>
<el-upload
class="avatar-uploader"
action="/admin/tencent/cos/upload/file"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:on-error="handleAvatarError"
>
<img
v-if="operationValue.imageUrl"
:src="operationValue.imageUrl"
class="avatar"
/>
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload>
</div>
<div class="operation">
<span style="margin-right: 20px">状态</span>
<el-select v-model="operationValue.status" placeholder="请选择">
<el-option
v-for="item in operationValue.options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="operationDialog = false">取消</el-button>
<el-button type="primary" @click="operation()"> 确认 </el-button>
</span>
</template>
</el-dialog>
<!-- 分页 -->
<el-pagination
style="margin-top: 10px"
class="paginationClass"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
layout="sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import { listPartitionInfo } from "@/api/personalHomepageResourceManagement/personalHomepageResourceManagement";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
export default {
name: "personalHomepageResourceManagement",
data() {
return {
loading: false,
//查询所需条件对象
inquire: {
partitionId: "",
partitionArr: [],
name: "",
status: "",
options: [
{ label: "有效", value: 1 },
{ label: "无效", value: 0 },
],
},
operationDialog: false,
operationDialogTitle: "新增%编辑",
operationValue: {
partitionId: "",
partitionArr: [],
nameZh: "",
nameEn: "",
nameAr: "",
nameTr: "",
price: "",
day: "",
imageUrl: "",
status: "",
options: [
{ label: "有效", value: 1 },
{ label: "无效", value: 0 },
],
},
// 表格
tableData: [{ x: "x" }],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
};
},
created() {
listPartitionInfo().then((res) => {
this.inquire.partitionArr = this.operationValue.partitionArr = res.data;
// this.getData();
});
},
methods: {
// 查询接口
getData() {
this.loading = true;
// get({}).then((res) => {
// if (res.code == 200) {
// this.loading = false;
// } else {
// ElMessage({
// showClose: true,
// message: res.message,
// type: "error",
// });
// }
// });
},
beforeAvatarUpload() {
ElMessage({
showClose: true,
message: "上传中~",
type: "warning",
});
},
handleAvatarError() {
ElMessage({
showClose: true,
message: "上传失败!",
type: "error",
});
},
handleAvatarSuccess(res, file) {
console.log(file);
this.ediObj.imageUrl1 = file.response.data;
ElMessage({
showClose: true,
message: "上传成功!",
type: "success",
});
},
// 分页导航
handleSizeChange() {
this.getData();
},
handleCurrentChange() {
this.getData();
},
},
};
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
.operation {
margin-bottom: 20px;
width: 55%;
display: flex;
align-items: baseline;
justify-content: space-between;
}
</style>

View File

@@ -15,58 +15,85 @@
<option value="4">工会账号</option> <option value="4">工会账号</option>
<option value="5">大头账号</option> <option value="5">大头账号</option>
</select> </select>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 操作时间
操作时间 <input
<input type="text" name="startTime" id="startTime" class="input-sm" placeholder="请选择开始时间"> type="text"
- <input type="text" name="endTime" id="endTime" class="input-sm" placeholder="请选择结束时间"> name="startTime"
id="startTime"
class="input-sm"
placeholder="请选择开始时间"
/>
-
<input
type="text"
name="endTime"
id="endTime"
class="input-sm"
placeholder="请选择结束时间"
/>
</form> </form>
<button id="btnSearch" class="btn btn-primary"> <button id="btnSearch" class="btn btn-primary">
<i class="glyphicon glyphicon-search"></i>查询 <i class="glyphicon glyphicon-search"></i>查询
</button> </button>
<button class="btn btn-success" id='addBtn'> <button class="btn btn-success" id="addBtn">
<i class="glyphicon glyphicon-plus"></i>生成账号 <i class="glyphicon glyphicon-plus"></i>生成账号
</button> </button>
<button id="btnExport" class="btn btn-default"> <button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出 <i class="glyphicon glyphicon-export"></i>导出
</button> </button>
</div> </div>
</div> </div>
<!-- .content --> <!-- .content -->
<div id="table"></div> <div id="table"></div>
</div> </div>
</div> </div>
</section> </section>
<div class="modal fade" id="genAccountModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel"> <div
class="modal fade"
id="genAccountModal"
tabindex="-1"
role="dialog"
aria-labelledby="modalLabel"
>
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span <button
aria-hidden="true">&times;</span> type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" id="modalLabel">生成账号</h4> <h4 class="modal-title" id="modalLabel">生成账号</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="addForm"> <form class="form-horizontal" id="addForm">
<div class="form-group"> <div class="form-group">
<label for="partitionId" class="col-sm-3 control-label">选择地区</label> <label for="partitionId" class="col-sm-3 control-label"
<div class="col-sm-9"> >选择地区:</label
<select name="partitionId" id="partitionId" class="form-control"> >
<option value="1">英语区</option> <div class="col-sm-7">
<option value="2">阿拉伯语区</option> <select
<option value="4">华语区</option> name="partitionId"
</select> id="partitionId"
class="form-control validate[required]"
></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="nick" class="col-sm-3 control-label">昵称:</label> <label for="nick" class="col-sm-3 control-label">昵称:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" name="nick" id="nick" placeholder='不填写默认“Peko小新”'> <input
type="text"
class="form-control"
name="nick"
id="nick"
placeholder="不填写默认“Peko小新”"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -81,116 +108,204 @@
<div class="form-group"> <div class="form-group">
<label for="avatar" class="col-sm-3 control-label">头像:</label> <label for="avatar" class="col-sm-3 control-label">头像:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<img src="" id="picUrl" style="width:40px;height:40px;" alt=""> <img
<input type="file" id="uploadAvatarFile" name="uploadAvatarFile" src=""
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"> id="picUrl"
<button class="btn btn-success" type="button" id="uploadPicBtn">上传</button> style="width: 40px; height: 40px"
<input type="hidden" class="form-control validate[required]" name="avatar" id="avatar" alt=""
style="width:40px"><span>不上传将使用默认头像</span> />
<input
type="file"
id="uploadAvatarFile"
name="uploadAvatarFile"
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
/>
<button class="btn btn-success" type="button" id="uploadPicBtn">
上传
</button>
<input
type="hidden"
class="form-control validate[required]"
name="avatar"
id="avatar"
style="width: 40px"
/><span>不上传将使用默认头像</span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group"></div>
</div>
<div class="form-group"> <div class="form-group">
<label for="size" class="col-sm-3 control-label">数量:</label> <label for="size" class="col-sm-3 control-label">数量:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" name="size" id="size" placeholder='一次生成最多不超过20个' <input
oninput="value=value.replace(/[^\d]/g,'')"> type="text"
class="form-control"
name="size"
id="size"
placeholder="一次生成最多不超过20个"
oninput="value=value.replace(/[^\d]/g,'')"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="remark" class="col-sm-3 control-label">备注:</label> <label for="remark" class="col-sm-3 control-label">备注:</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" name="remark" id="remark" value="仅供后台记录用" <input
placeholder="请输入备注50字内"> type="text"
class="form-control"
name="remark"
id="remark"
value="仅供后台记录用"
placeholder="请输入备注50字内"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="genDefUser" class="col-sm-3 control-label">帐号类型:</label> <label for="genDefUser" class="col-sm-3 control-label"
>帐号类型:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<select name="defUser" id="genDefUser" class="form-control validate[required]"> <select
name="defUser"
id="genDefUser"
class="form-control validate[required]"
>
<option value="4">工会账号</option> <option value="4">工会账号</option>
<!-- <option value="5">大头账号</option> --> <!-- <option value="5">大头账号</option> -->
</select> </select>
</div> </div>
</div> </div>
<div id="header_block" style="display: none;"> <div id="header_block" style="display: none">
<div class="form-group"> <div class="form-group">
<label for="phone" class="col-sm-3 control-label">手机号:</label> <label for="phone" class="col-sm-3 control-label"
>手机号:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required, maxlength: 20]" name="phone" <input
id="phone" placeholder='请输入手机号,必填'> type="text"
class="form-control validate[required, maxlength: 20]"
name="phone"
id="phone"
placeholder="请输入手机号,必填"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="realName" class="col-sm-3 control-label">实际姓名:</label> <label for="realName" class="col-sm-3 control-label"
>实际姓名:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required] validate[maxlength: 20]" <input
name="realName" id="realName" placeholder='请输入身份证上的姓名,必填'> type="text"
class="form-control validate[required] validate[maxlength: 20]"
name="realName"
id="realName"
placeholder="请输入身份证上的姓名,必填"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="idCardNum" class="col-sm-3 control-label">身份证号:</label> <label for="idCardNum" class="col-sm-3 control-label"
>身份证号:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required] validate[maxlength: 30]" <input
name="idCardNum" id="idCardNum" placeholder='请输入身份证号码,必填'> type="text"
class="form-control validate[required] validate[maxlength: 30]"
name="idCardNum"
id="idCardNum"
placeholder="请输入身份证号码,必填"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="alipayAccount" class="col-sm-3 control-label">支付宝账号:</label> <label for="alipayAccount" class="col-sm-3 control-label"
>支付宝账号:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required] validate[maxlength: 60]" <input
name="alipayAccount" id="alipayAccount" placeholder='请输入支付宝帐号,必填'> type="text"
class="form-control validate[required] validate[maxlength: 60]"
name="alipayAccount"
id="alipayAccount"
placeholder="请输入支付宝帐号,必填"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="alipayAccountName" class="col-sm-3 control-label">支付宝姓名:</label> <label for="alipayAccountName" class="col-sm-3 control-label"
>支付宝姓名:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required] validate[maxlength: 60]" <input
name="alipayAccountName" id="alipayAccountName" placeholder='请输入支付宝姓名'> type="text"
class="form-control validate[required] validate[maxlength: 60]"
name="alipayAccountName"
id="alipayAccountName"
placeholder="请输入支付宝姓名"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="bankCardNum" class="col-sm-3 control-label">银行卡号:</label> <label for="bankCardNum" class="col-sm-3 control-label"
>银行卡号:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required] validate[maxlength: 30]" <input
name="bankCardNum" id="bankCardNum" placeholder='请输入银行卡号'> type="text"
class="form-control validate[required] validate[maxlength: 30]"
name="bankCardNum"
id="bankCardNum"
placeholder="请输入银行卡号"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="bankCardName" class="col-sm-3 control-label">持卡人:</label> <label for="bankCardName" class="col-sm-3 control-label"
>持卡人:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control validate[required] validate[maxlength: 20]" <input
name="bankCardName" id="bankCardName" placeholder='请输入银行卡-持卡人姓名'> type="text"
class="form-control validate[required] validate[maxlength: 20]"
name="bankCardName"
id="bankCardName"
placeholder="请输入银行卡-持卡人姓名"
/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="paymentPwd" class="col-sm-3 control-label">支付密码:</label> <label for="paymentPwd" class="col-sm-3 control-label"
>支付密码:</label
>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" <input
type="text"
class="form-control validate[required] validate[minlength: 6] validate[maxlength: 20]" class="form-control validate[required] validate[minlength: 6] validate[maxlength: 20]"
name="paymentPwd" id="paymentPwd" placeholder='请输入6位数字的支付密码必填'> name="paymentPwd"
id="paymentPwd"
placeholder="请输入6位数字的支付密码必填"
/>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> 关闭
</button>
<button type="button" class="btn btn-primary" id="add">确定</button> <button type="button" class="btn btn-primary" id="add">确定</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import TableHelper from '@/utils/bootstrap-table-helper'; import TableHelper from "@/utils/bootstrap-table-helper";
import { showLoading, hideLoading } from '@/utils/maintainer'; import { showLoading, hideLoading } from "@/utils/maintainer";
import { getPartitionInfoList } from '@/api/partition/partitionInfo';
import { buildSelectOption } from '@/utils/system-helper';
export default { export default {
name: "GenAccountView", name: "GenAccountView",
setup() { setup() {
@@ -198,74 +313,102 @@ export default {
}, },
created() { created() {
this.$nextTick(function () { this.$nextTick(function () {
this.initPartition();
this.initData(); this.initData();
}); });
}, },
methods: { methods: {
initPartition() {
getPartitionInfoList().then((res) => {
let data = res.data;
this.partitionInfos = data;
buildSelectOption(
"#partitionId",
null,
data.map((v) => {
return {
value: v.id,
text: v.desc,
};
})
);
});
},
initData() { initData() {
$(function () { $(function () {
var picker1 = $('#startTime').datetimepicker({ var picker1 = $("#startTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00', format: "yyyy-mm-dd hh:ii:00",
autoclose: true, autoclose: true,
endDate: new Date() endDate: new Date(),
}); });
var picker2 = $('#endTime').datetimepicker({ var picker2 = $("#endTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00', format: "yyyy-mm-dd hh:ii:00",
autoclose: true autoclose: true,
}); });
picker1.on('changeDate', function () { picker1.on("changeDate", function () {
var date = $('#startTime').datetimepicker('getDate'); var date = $("#startTime").datetimepicker("getDate");
picker2.datetimepicker('setStartDate', date); picker2.datetimepicker("setStartDate", date);
}); });
picker2.on('changeDate', function () { picker2.on("changeDate", function () {
var date = $('#endTime').datetimepicker('getDate'); var date = $("#endTime").datetimepicker("getDate");
picker1.datetimepicker('setEndDate', date); picker1.datetimepicker("setEndDate", date);
}); });
$('#table').bootstrapTable('destroy'); $("#table").bootstrapTable("destroy");
$('#table').bootstrapTable({ $("#table").bootstrapTable({
columns: [ columns: [
{ field: 'uid', title: 'UID', align: 'center', width: '5%' }, { field: "uid", title: "UID", align: "center", width: "5%" },
{ field: 'erbanNo', title: 'ID', align: 'center', width: '5%' }, { field: "erbanNo", title: "ID", align: "center", width: "5%" },
{ field: 'nick', title: '昵称', align: 'center', width: '5%' }, { field: "nick", title: "昵称", align: "center", width: "5%" },
{ {
field: 'defUser', title: '账号类型', align: 'center', width: '5%', field: "defUser",
title: "账号类型",
align: "center",
width: "5%",
formatter: function (val, row, index) { formatter: function (val, row, index) {
if (val == null) { if (val == null) {
return '-'; return "-";
} }
if (val == 1) { if (val == 1) {
return '普通账号'; return "普通账号";
} else if (val == 2) { } else if (val == 2) {
return '官方账号'; return "官方账号";
} else if (val == 3) { } else if (val == 3) {
return '机器账号'; return "机器账号";
} else if (val == 4) { } else if (val == 4) {
return '工会账户'; return "工会账户";
} else if (val == 5) { } else if (val == 5) {
return '大头账号'; return "大头账号";
} }
return val; return val;
}
}, },
{ field: 'remark', title: '备注', align: 'center', width: '5%' }, },
{ field: 'operator', title: '操作人', align: 'center', width: '5%' }, { field: "remark", title: "备注", align: "center", width: "5%" },
{ {
field: 'createTime', title: '操作时间', align: 'center', valign: 'middle', width: '10%', field: "operator",
title: "操作人",
align: "center",
width: "5%",
},
{
field: "createTime",
title: "操作时间",
align: "center",
valign: "middle",
width: "10%",
formatter: function (val, row, index) { formatter: function (val, row, index) {
if (val) { if (val) {
var date = new Date(val); var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss'); return date.format("yyyy-MM-dd hh:mm:ss");
} else { } else {
return '-'; return "-";
}
}
} }
},
},
], ],
undefinedText: '-', undefinedText: "-",
cache: false, cache: false,
striped: true, striped: true,
showRefresh: false, showRefresh: false,
@@ -275,107 +418,110 @@ export default {
search: false, search: false,
sidePagination: "server", //表示服务端请求 sidePagination: "server", //表示服务端请求
queryParamsType: "undefined", queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数 queryParams: function queryParams(params) {
//设置查询参数
var param = { var param = {
pageNum: params.pageNumber, pageNum: params.pageNumber,
pageSize: params.pageSize, pageSize: params.pageSize,
defUser: $('#defUser').val(), defUser: $("#defUser").val(),
startTime: $('#startTime').val(), startTime: $("#startTime").val(),
endTime: $('#endTime').val() endTime: $("#endTime").val(),
}; };
return param; return param;
}, },
toolbar: '#toolbar', toolbar: "#toolbar",
url: '/admin/gen/account/list', url: "/admin/gen/account/list",
onLoadSuccess: function () { //加载成功时执行 onLoadSuccess: function () {
//加载成功时执行
console.log("load success"); console.log("load success");
}, },
onLoadError: function () { //加载失败时执行 onLoadError: function () {
//加载失败时执行
console.log("load fail"); console.log("load fail");
} },
}); });
$('#addBtn').on('click', function () { $("#addBtn").on("click", function () {
$("#addForm")[0].reset(); $("#addForm")[0].reset();
$('#addForm').validationEngine('hideAll'); $("#addForm").validationEngine("hideAll");
$('#picUrl').attr('src', ''); $("#picUrl").attr("src", "");
$('#genDefUser').val(4); $("#genDefUser").val(4);
$('#header_block').attr('style', 'display:none;'); $("#header_block").attr("style", "display:none;");
$('#genAccountModal').modal('show'); $("#genAccountModal").modal("show");
}); });
// 查询刷新 // 查询刷新
$('#btnSearch').on('click', function () { $("#btnSearch").on("click", function () {
TableHelper.doRefresh('#table'); TableHelper.doRefresh("#table");
}); });
$('#uploadPicBtn').on('click', function () { $("#uploadPicBtn").on("click", function () {
var options = { var options = {
type: 'post', type: "post",
url: '/admin/gen/account/headImg', url: "/admin/gen/account/headImg",
dataType: 'json', dataType: "json",
success: function (json) { success: function (json) {
if (json.path) { if (json.path) {
$('#avatar').val(json.path); $("#avatar").val(json.path);
$('#picUrl').attr('src', json.path); $("#picUrl").attr("src", json.path);
} else { } else {
$('#tipMsg').text(json.msg); $("#tipMsg").text(json.msg);
$('#tipModal').modal('show'); $("#tipModal").modal("show");
} }
} },
} };
$('#addForm').ajaxSubmit(options); $("#addForm").ajaxSubmit(options);
}); });
$("#add").click(function () { $("#add").click(function () {
if ($('#addForm').validationEngine('validate')) { if ($("#addForm").validationEngine("validate")) {
var size = $('#size').val(); var size = $("#size").val();
if (!size) { if (!size) {
$("#tipMsg").text("请填写数量"); $("#tipMsg").text("请填写数量");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
if (size > 20) { if (size > 20) {
$("#tipMsg").text("一次只允许生成20个账号"); $("#tipMsg").text("一次只允许生成20个账号");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
if (!$('#gender').val()) { if (!$("#gender").val()) {
$("#tipMsg").text("请选择性别"); $("#tipMsg").text("请选择性别");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
if ($('#remark').val().length > 50) { if ($("#remark").val().length > 50) {
$("#tipMsg").text("备注不能超过50字"); $("#tipMsg").text("备注不能超过50字");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
if ($('#genDefUser').val() == 5) { if ($("#genDefUser").val() == 5) {
// 验证手机号 // 验证手机号
var phoneReg = /^1[0-9]{10}$/; var phoneReg = /^1[0-9]{10}$/;
if (!phoneReg.test($('#phone').val())) { if (!phoneReg.test($("#phone").val())) {
$("#tipMsg").text("手机号不正确"); $("#tipMsg").text("手机号不正确");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
// 验证身份证号 // 验证身份证号
var idCardNumReg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/; var idCardNumReg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
if (!idCardNumReg.test($('#idCardNum').val())) { if (!idCardNumReg.test($("#idCardNum").val())) {
$("#tipMsg").text("身份证号不正确"); $("#tipMsg").text("身份证号不正确");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
// 验证银行卡号 // 验证银行卡号
var bankCardNumReg = /^\d{10,30}$/; var bankCardNumReg = /^\d{10,30}$/;
if (!bankCardNumReg.test($('#bankCardNum').val())) { if (!bankCardNumReg.test($("#bankCardNum").val())) {
$("#tipMsg").text("银行卡号不正确"); $("#tipMsg").text("银行卡号不正确");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
// 验证支付密码 // 验证支付密码
var paymentPwdReg = /^\d{6}$/; var paymentPwdReg = /^\d{6}$/;
if (!paymentPwdReg.test($('#paymentPwd').val())) { if (!paymentPwdReg.test($("#paymentPwd").val())) {
$("#tipMsg").text("支付密码不正确必须为6位数字"); $("#tipMsg").text("支付密码不正确必须为6位数字");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
} }
@@ -384,52 +530,51 @@ export default {
$.ajax({ $.ajax({
type: "post", type: "post",
url: "/admin/gen/account/add", url: "/admin/gen/account/add",
data: $('#addForm').serialize(), data: $("#addForm").serialize(),
dataType: 'json', dataType: "json",
success: function (json) { success: function (json) {
if (json.success == 'true') { if (json.success == "true") {
$("#genAccountModal").modal('hide'); $("#genAccountModal").modal("hide");
$("#tipMsg").text(json.msg); $("#tipMsg").text(json.msg);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
TableHelper.doRefresh("#table"); TableHelper.doRefresh("#table");
hideLoading(); hideLoading();
} else { } else {
$("#tipMsg").text("保存失败,错误信息:" + json.msg); $("#tipMsg").text("保存失败,错误信息:" + json.msg);
$("#tipModal").modal('show'); $("#tipModal").modal("show");
hideLoading(); hideLoading();
} }
},
});
} }
})
}
}); });
$('#genDefUser').on('change', function () { $("#genDefUser").on("change", function () {
var defUser = $('#genDefUser').val(); var defUser = $("#genDefUser").val();
if (defUser == 4) { if (defUser == 4) {
$('#header_block').attr('style', 'display:none;'); $("#header_block").attr("style", "display:none;");
} else if (defUser == 5) { } else if (defUser == 5) {
$('#header_block').removeAttr('style'); $("#header_block").removeAttr("style");
} }
}); });
//导出 //导出
$('#btnExport').on('click', function () { $("#btnExport").on("click", function () {
var startTime = $('#startTime').val(); var startTime = $("#startTime").val();
var endTime = $('#endTime').val(); var endTime = $("#endTime").val();
if (null == startTime || startTime.trim() == '') { if (null == startTime || startTime.trim() == "") {
$("#tipMsg").text("开始日期不能为空"); $("#tipMsg").text("开始日期不能为空");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
if (null == endTime || endTime.trim() == '') { if (null == endTime || endTime.trim() == "") {
$("#tipMsg").text("结束日期不能为空"); $("#tipMsg").text("结束日期不能为空");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
if (startTime > endTime) { if (startTime > endTime) {
$("#tipMsg").text("开始日期不能大于结束日期"); $("#tipMsg").text("开始日期不能大于结束日期");
$("#tipModal").modal('show'); $("#tipModal").modal("show");
return; return;
} }
@@ -437,12 +582,9 @@ export default {
form.attr("action", "/admin/gen/account/export"); form.attr("action", "/admin/gen/account/export");
form.submit(); form.submit();
}); });
}); });
}
}, },
},
}; };
</script> </script>