up. ws update.
This commit is contained in:
parent
25988682cc
commit
84e262ebd7
@ -46,14 +46,14 @@ class AuthController extends BaseController
|
||||
public function unlock()
|
||||
{
|
||||
$client = $this->request->getClient();
|
||||
$lock_password = $this->request->post('lock_password');
|
||||
$password = $this->request->post('password');
|
||||
$clientModel = SysUserClient::where([
|
||||
'client_id' => $client->id,
|
||||
'client_name'=> $client->name,
|
||||
'user_id' => $this->auth->userId,
|
||||
])->find();
|
||||
if($clientModel) {
|
||||
if($clientModel['lock_password'] !== $lock_password) {
|
||||
if($clientModel['lock_password'] !== $password) {
|
||||
return $this->writeSuccess('密码错误');
|
||||
}
|
||||
$clientModel->save(['is_lock'=>0,'lock_password'=>'','lock_time'=>null]);
|
||||
|
||||
@ -2,7 +2,13 @@ import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
import type { UpdatePasswordParam } from './model';
|
||||
|
||||
export async function clientScreenUnlock(data) {
|
||||
const res = await request.post<ApiResult<any>>('/auth/unlock', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
|
||||
@ -34,10 +34,13 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { WsEvent, wsEventManager } from '@/plugins/websocket';
|
||||
import { clientScreenUnlock } from '@/api/layout';
|
||||
|
||||
const visible = ref(false);
|
||||
const lockPassword = ref('');
|
||||
const confirmUnlock = () => {};
|
||||
const confirmUnlock = () => {
|
||||
clientScreenUnlock({ password: lockPassword });
|
||||
};
|
||||
wsEventManager.subscribe(WsEvent.LOCK_CLIENT_SCREEN, () => {
|
||||
visible.value = true;
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user