- Updated main.ts to export createMessage and queryLogin. - Modified checkPluginLogin in login-handle.ts to return structured results. - Refactored query.ts to adjust imports and export queryLogin. - Cleaned up kv-login.ts by removing unused imports and improving method handling. - Adjusted Vite configuration for deployment path changes. - Simplified web.html by removing unnecessary import maps and scripts. - Created web.ts to handle login success events and user redirection logic.
21 lines
618 B
TypeScript
21 lines
618 B
TypeScript
// import '../dist/app.js'
|
|
import '../src/main.ts'
|
|
//
|
|
|
|
import { loginEmitter, createMessage, checkPluginLogin, queryLogin } from '../src/main.ts'
|
|
|
|
// const message = createMessage();
|
|
loginEmitter.once('login-success', async (data) => {
|
|
console.log('登录成功,接收到的数据:');
|
|
const res = await checkPluginLogin()
|
|
if (res.code === 400 && res.data.redirectUrl) {
|
|
window.open(res.data.redirectUrl, '_self');
|
|
} else if (res.code === 400 && !res.data.redirectUrl) {
|
|
|
|
const me = await queryLogin.getMe();
|
|
console.log('用户信息:', me);
|
|
window.open('/root/home/', '_self');
|
|
}
|
|
})
|
|
|