加入账号登录限制

This commit is contained in:
java110 2021-01-03 16:15:51 +08:00
parent 0809cbc03a
commit 293991d0a4
6 changed files with 244 additions and 5 deletions

View File

@ -0,0 +1,32 @@
<div id="adminLoginPropertyModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">密码确认</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">密码</label>
<div class="col-sm-10">
<input placeholder="必填,请输入当前账号密码" type="password" class="form-control"
v-model="adminLoginPropertyInfo.curPasswd"></div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="_adminLoginPropertySubmit()"><i class="fa fa-check"></i>&nbsp;登录
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<vc:create path="frame/initData"></vc:create>
</div>

View File

@ -0,0 +1,112 @@
(function (vc) {
vc.extends({
data: {
adminLoginPropertyInfo: {
username: '',
userId: '',
curPasswd: '',
curUserName: ''
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('adminLoginProperty', 'login', function (_param) {
vc.copyObject(_param, $that.adminLoginPropertyInfo);
$('#adminLoginPropertyModel').modal('show');
});
},
methods: {
adminLoginPropertyValidate() {
return vc.validate.validate({
adminLoginPropertyInfo: vc.component.adminLoginPropertyInfo
}, {
'adminLoginPropertyInfo.curPasswd': [
{
limit: "required",
param: "",
errInfo: "当前用户密码不能为空"
}
]
});
},
_adminLoginPropertySubmit: function () {
if (!vc.component.adminLoginPropertyValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.http.apiPost('/adminLoginPropertyAccount',
JSON.stringify($that.adminLoginPropertyInfo),
{
emulateJSON: true
},
function (json, res) {
$that.clearAddBasePrivilegeInfo();
$('#adminLoginPropertyModel').modal('hide');
let _data = JSON.parse(json);
if (_data.hasOwnProperty('code') && _data.code != '0') {
vc.toast(_data.msg);
return;
}
if (res.status == 200) {
vc.component.clearCacheData();
vc.component._loadSysInfo();
vc.emit('initData', 'loadCommunityInfo', {
url: '/'
});
return;
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(json);
});
},
clearAddBasePrivilegeInfo: function () {
vc.component.adminLoginPropertyInfo = {
username: '',
userId: '',
curPasswd: '',
curUserName: ''
}
},
clearCacheData: function () {
vc.clearCacheData();
},
_loadSysInfo: function () {
var param = {
params: {
sys: 'HC'
}
}
vc.http.get(
'login',
'getSysInfo',
param,
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status != 200) {
console.log("加载系统信息失败");
vc.saveData("_sysInfo", { logo: 'HC' });
vc.copyObject(json, vc.component.loginInfo);
return;
}
vc.copyObject(JSON.parse(json), vc.component.loginInfo);
//保存到浏览器
vc.saveData("_sysInfo", JSON.parse(json));
},
function (errInfo, error) {
console.log('请求失败处理');
vc.saveData("_sysInfo", { logo: 'HC' });
vc.copyObject(json, vc.component.loginInfo);
vc.component.loginInfo.errorInfo = errInfo;
});
},
}
});
})(window.vc);

View File

@ -0,0 +1,19 @@
<div class="modal fade" id="updateStoreStateModel" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">请确认您的操作!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<tr align="center"><th>确认是否{{updateStoreStateInfo.stateName}}!</th></tr>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="closeResetStaffPwdModel()">点错了</button>
<button type="button" class="btn btn-primary" v-on:click="_updateStoreState()">确认</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,51 @@
(function (vc) {
vc.extends({
data: {
updateStoreStateInfo: {
storeId: '',
state: '',
stateName: ''
}
},
_initEvent: function () {
vc.on('updateStoreState', 'open', function (_storeInfo) {
vc.copyObject(_storeInfo, $that.updateStoreStateInfo)
$('#updateStoreStateModel').modal('show');
});
},
methods: {
closeDeleteStaffModel: function () {
$that.updateStoreStateInfo = {
storeId: '',
state: '',
stateName: ''
}
$('#updateStoreStateModel').modal('hide');
},
_updateStoreState: function () {
vc.http.apiPost(
'/storeApi/updateStoreState',
JSON.stringify($that.updateStoreStateInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
//关闭model
let _result = JSON.parse(json);
vc.toast(_result.msg);
$('#updateStoreStateModel').modal('hide');
vc.emit('listPropertyManage', 'listListProperty',{})
},
function (errInfo, error) {
console.log('请求失败处理');
vc.component.updateStoreStateInfo.errorInfo = errInfo;
});
}
}
});
})(window.vc);

View File

@ -20,8 +20,8 @@
</div>
</div>
<div class="col-sm-4">
<input type="text" placeholder="请输入管理员" v-model="listPropertyManageInfo.conditions.staffName"
class=" form-control">
<input type="text" placeholder="请输入管理员"
v-model="listPropertyManageInfo.conditions.staffName" class=" form-control">
</div>
<div class="col-sm-3">
<div class="form-group">
@ -30,7 +30,8 @@
</div>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryListPropertyMethod()">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_queryListPropertyMethod()">
<i class="fa fa-search"></i> 查询
</button>
</div>
@ -57,6 +58,7 @@
<th class="text-center">管理员</th>
<th class="text-center">管理员电话</th>
<th class="text-center">管理员ID</th>
<th class="text-center">状态</th>
<th class="text-center">创建时间</th>
<th class="text-right">操作</th>
</tr>
@ -67,6 +69,7 @@
<td class="text-center">{{listProperty.staffName}}</td>
<td class="text-center">{{listProperty.staffTel}}</td>
<td class="text-center">{{listProperty.staffId}}</td>
<td class="text-center">{{listProperty.state == '48002'?'限制登录':'正常'}}</td>
<td class="text-center">{{listProperty.createTime}}</td>
<td class="text-right">
<div class="btn-group">
@ -74,7 +77,13 @@
v-on:click="_openPropertysCommunityModel(listProperty)">隶属小区
</button>
<button class="btn-white btn btn-xs"
v-on:click="_openPropertysCommunityModel(listProperty)">免密登录
v-on:click="_openAdminLoginPropertyModel(listProperty)">登录
</button>
<button class="btn-white btn btn-xs" v-if="listProperty.state != '48002'"
v-on:click="_openUpdateStoreStateModel(listProperty,'48002')">限制登录
</button>
<button class="btn-white btn btn-xs" v-else
v-on:click="_openUpdateStoreStateModel(listProperty,'48001')">恢复登录
</button>
</div>
</td>
@ -96,5 +105,7 @@
</div>
<vc:create path="common/storesCommunity"></vc:create>
<vc:create path="admin/adminLoginProperty"></vc:create>
<vc:create path="admin/updateStoreState"></vc:create>
</div>

View File

@ -15,7 +15,7 @@
name: '',
staffName: '',
tel: '',
relCd:'600311000001'
relCd: '600311000001'
}
}
},
@ -59,6 +59,20 @@
_openPropertysCommunityModel: function (_listProperty) {
vc.emit('storesCommunity', 'openStoresCommunity', _listProperty);
},
_openAdminLoginPropertyModel: function (_listProperty) {
vc.emit('adminLoginProperty', 'login', {
username: _listProperty.staffName,
userId: _listProperty.staffId,
curUserName: vc.getData('/nav/getUserInfo').name
})
},
_openUpdateStoreStateModel: function (_listProperty, state) {
vc.emit('updateStoreState', 'open', {
storeId: _listProperty.storeId,
state: state,
stateName: state == '48002' ? '限制登录' : '恢复登录'
})
},
_queryListPropertyMethod: function () {
vc.component._listListPropertys(DEFAULT_PAGE, DEFAULT_ROWS);