支持864登录二维码切换与退出重登
This commit is contained in:
@@ -187,6 +187,28 @@
|
||||
</div>
|
||||
<div class="login-qr-dialog__actions">
|
||||
<el-button size="mini" @click="loadLoginQrStatus(true)">立即刷新状态</el-button>
|
||||
<el-button
|
||||
v-if="isServer864Login"
|
||||
size="mini"
|
||||
:loading="loginQrActionLoading === 'harmony_api'"
|
||||
@click="switch864LoginMode('harmony_api', 'harmony')">
|
||||
鸿蒙二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isServer864Login"
|
||||
size="mini"
|
||||
:loading="loginQrActionLoading === 'new'"
|
||||
@click="switch864LoginMode('new')">
|
||||
标准New二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isServer864Login"
|
||||
size="mini"
|
||||
type="danger"
|
||||
:loading="loginQrActionLoading === 'logout_864'"
|
||||
@click="logout864Login">
|
||||
退出864登录
|
||||
</el-button>
|
||||
<el-button v-if="loginQrCurrent.scan_url" type="text" @click="copyLoginQrScanUrl">
|
||||
复制扫码链接
|
||||
</el-button>
|
||||
@@ -586,6 +608,7 @@
|
||||
server_now: 0
|
||||
},
|
||||
loginQrCountdownSeconds: 0,
|
||||
loginQrActionLoading: '',
|
||||
groups: [],
|
||||
selectedGroupForHourlyTrend: '',
|
||||
hourlyTrendDays: 1,
|
||||
@@ -622,6 +645,10 @@
|
||||
loginQrCurrent() {
|
||||
return this.loginQrDialog.current || {};
|
||||
},
|
||||
isServer864Login() {
|
||||
const providerName = String(this.loginQrDialog.provider_name || '').trim().toLowerCase();
|
||||
return providerName === 'server_864' || providerName === '864';
|
||||
},
|
||||
showLoginQrBanner() {
|
||||
return !this.loginQrDialog.logged_in;
|
||||
},
|
||||
@@ -971,6 +998,63 @@
|
||||
this.loginQrDialog.loading = false;
|
||||
});
|
||||
},
|
||||
switch864LoginMode(loginQrApi, loginWay = '') {
|
||||
if (!this.isServer864Login) {
|
||||
this.$message.warning('当前不是 864 登录模式,暂不支持切换二维码入口');
|
||||
return;
|
||||
}
|
||||
this.loginQrActionLoading = loginQrApi;
|
||||
axios.post('/robot/api/login_qr_mode', {
|
||||
login_qr_api: loginQrApi,
|
||||
login_way: loginWay
|
||||
})
|
||||
.then(response => {
|
||||
if (response.data.success) {
|
||||
const state = (((response.data || {}).data || {}).login_qr_state) || {};
|
||||
if (state && Object.keys(state).length > 0) {
|
||||
this.applyLoginQrState(state);
|
||||
}
|
||||
this.$message.success(response.data.message || '864 登录二维码入口已切换');
|
||||
setTimeout(() => this.loadLoginQrStatus(true), 1200);
|
||||
return;
|
||||
}
|
||||
this.$message.error(response.data.error || '切换 864 登录二维码入口失败');
|
||||
})
|
||||
.catch(error => {
|
||||
const errorMessage = (((error || {}).response || {}).data || {}).error || '切换 864 登录二维码入口失败';
|
||||
this.$message.error(errorMessage);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loginQrActionLoading = '';
|
||||
});
|
||||
},
|
||||
logout864Login() {
|
||||
if (!this.isServer864Login) {
|
||||
this.$message.warning('当前不是 864 登录模式,暂不支持此操作');
|
||||
return;
|
||||
}
|
||||
this.loginQrActionLoading = 'logout_864';
|
||||
axios.post('/robot/api/logout_864')
|
||||
.then(response => {
|
||||
if (response.data.success) {
|
||||
const state = (((response.data || {}).data || {}).login_qr_state) || {};
|
||||
if (state && Object.keys(state).length > 0) {
|
||||
this.applyLoginQrState(state);
|
||||
}
|
||||
this.$message.success(response.data.message || '864 已退出当前登录态');
|
||||
setTimeout(() => this.loadLoginQrStatus(true), 1200);
|
||||
return;
|
||||
}
|
||||
this.$message.error(response.data.error || '退出 864 登录态失败');
|
||||
})
|
||||
.catch(error => {
|
||||
const errorMessage = (((error || {}).response || {}).data || {}).error || '退出 864 登录态失败';
|
||||
this.$message.error(errorMessage);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loginQrActionLoading = '';
|
||||
});
|
||||
},
|
||||
tickLoginQrCountdown() {
|
||||
if (this.loginQrDialog.logged_in) {
|
||||
this.loginQrCountdownSeconds = 0;
|
||||
|
||||
Reference in New Issue
Block a user