|
@@ -4,13 +4,20 @@
|
|
|
<el-tab-pane label="授权信息" name="info">
|
|
|
<el-descriptions :column="1" border class="info-descriptions">
|
|
|
<el-descriptions-item label="当前信息">
|
|
|
- {{ authInfo.status }}
|
|
|
+ {{ authInfo.auth ? '已授权' : '未授权' }}
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="过期时间">
|
|
|
{{ authInfo.expireTime || '无' }}
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="授权模式">
|
|
|
- {{ authInfo.authMode }}
|
|
|
+ <span>{{ authInfo.authMode }}</span>
|
|
|
+ <span>:</span>
|
|
|
+ <span v-if="authInfo.doubleTrack">双评轨迹授权</span>
|
|
|
+ <span v-if="authInfo.yjsObjectiveEnable">客观题卡</span>
|
|
|
+ <span v-if="authInfo.groupDeleteWarn">开启删除分组警告</span>
|
|
|
+ <span v-if="authInfo.trialMode"
|
|
|
+ >试评:{{ authInfo.trialMode }}</span
|
|
|
+ >
|
|
|
</el-descriptions-item>
|
|
|
</el-descriptions>
|
|
|
</el-tab-pane>
|
|
@@ -86,21 +93,27 @@
|
|
|
import { getAuthInfo, updateAuthInfo } from '@/api/admin';
|
|
|
import { AuthInfo, AuthUpdateParams } from '@/api/types/admin';
|
|
|
import { modalConfirm } from '@/utils/ui';
|
|
|
+ import { downloadExport } from '@/utils/download-export';
|
|
|
+
|
|
|
import useLoading from '@/hooks/loading';
|
|
|
|
|
|
const activeTab = ref('info');
|
|
|
|
|
|
const authInfo = reactive<AuthInfo>({
|
|
|
- status: '未授权',
|
|
|
+ auth: false,
|
|
|
expireTime: null,
|
|
|
authMode: '离线激活',
|
|
|
+ doubleTrack: false,
|
|
|
+ groupDeleteWarn: false,
|
|
|
+ trialMode: '成绩汇总模式',
|
|
|
+ yjsObjectiveEnable: false,
|
|
|
});
|
|
|
|
|
|
const updateForm = reactive<AuthUpdateParams>({
|
|
|
authMode: 'offline', // 默认离线激活
|
|
|
offlineFile: null,
|
|
|
- onlineKey: '',
|
|
|
- onlineSecret: '',
|
|
|
+ accessKey: '',
|
|
|
+ accessSecret: '',
|
|
|
});
|
|
|
|
|
|
const formRef = ref<FormInstance>();
|
|
@@ -109,7 +122,7 @@
|
|
|
offlineFile: [
|
|
|
{ required: true, message: '请选择授权文件', trigger: 'change' },
|
|
|
],
|
|
|
- onlineKey: [
|
|
|
+ accessKey: [
|
|
|
{
|
|
|
required: true,
|
|
|
message: '请输入key',
|
|
@@ -121,7 +134,7 @@
|
|
|
trigger: 'change',
|
|
|
},
|
|
|
],
|
|
|
- onlineSecret: [
|
|
|
+ accessSecret: [
|
|
|
{
|
|
|
required: true,
|
|
|
message: '请输入secret',
|
|
@@ -150,10 +163,9 @@
|
|
|
authInfo.authMode = '离线激活: 双评轨迹授权 试评: 成绩汇总模式';
|
|
|
});
|
|
|
|
|
|
- const exportHardwareInfo = () => {
|
|
|
- // TODO:实际应调用API导出硬件信息
|
|
|
- ElMessage.success('硬件信息导出指令已发送,请注意查收文件。');
|
|
|
- // 例如:window.location.href = '/api/auth/export-hardware';
|
|
|
+ // 导出授权管理信息
|
|
|
+ const exportHardwareInfo = async () => {
|
|
|
+ await downloadExport('exportHardwareInfo');
|
|
|
};
|
|
|
|
|
|
const beforeUpload = (file: File) => {
|
|
@@ -194,8 +206,8 @@
|
|
|
} else if (updateForm.authMode === 'online') {
|
|
|
params = {
|
|
|
authMode: updateForm.authMode,
|
|
|
- key: updateForm.onlineKey,
|
|
|
- secret: updateForm.onlineSecret,
|
|
|
+ accessKey: updateForm.accessKey,
|
|
|
+ accessSecret: updateForm.accessSecret,
|
|
|
};
|
|
|
await updateAuthInfo(params);
|
|
|
}
|