Files
peko-admin-web/src/views/users/PasswordLockAdminView.vue
2023-09-24 21:00:03 +08:00

125 lines
4.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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 name="erbanNo" id="erbanNo" placeholder="请输入平台号" />
<button id="btnSearch" class="btn btn-sm btn-primary">查询</button>
</div>
</section>
</div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "PasswordLockAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable("destroy");
$('#table').bootstrapTable({
columns: [
{ field: 'erbanNo', title: '用户平台号', align: 'center', width: '20%' },
{ field: 'nick', title: '用户昵称', align: 'center', width: '30%' },
{ field: 'loginPwdCount', title: '登录密码错误次数', align: 'center', width: '15%' },
{ field: 'payPwdCount', title: '支付密码错误次数', align: 'center', width: '15%' },
{
field: 'uid',
title: '操作',
align: 'center',
width: '20%',
formatter: function (val, row, index) {
var key = row.uid;
return '<button class="btn btn-sm btn-warning opt-login" data-id=' + key + '>登录解锁</button>' +
'<button class="btn btn-sm btn-warning opt-pay" data-id=' + key + '>支付解锁</button>';
}
}
],
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 = {
erbanNo: $('#erbanNo').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/pwdLock/getUser.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
$("#table").on('click', '.opt-login', function () {
debugger;
var id = $(this).attr("data-id");
releaseLock(id, 1);
});
$("#table").on('click', '.opt-pay', function () {
var id = $(this).attr("data-id");
releaseLock(id, 2);
});
})
}
},
};
function releaseLock(uid, type) {
if (confirm("确认解除锁定吗?")) {
$.ajax({
type: "post",
url: "/admin/pwdLock/release.action",
data: {
uid: uid,
type: type
},
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("成功解除锁定");
$("#tipModal").modal("show");
} else {
$("#tipMsg").text("解除锁定失败");
$("#tipModal").modal("show");
}
}
})
}
}
</script>
<style scoped></style>