初始化项目
This commit is contained in:
77
AUTS_Server/wwwroot/js/login/index.js
Normal file
77
AUTS_Server/wwwroot/js/login/index.js
Normal file
@@ -0,0 +1,77 @@
|
||||
// 使用 createApp 来创建一个 Vue 应用实例
|
||||
const App = {
|
||||
data() {
|
||||
return {
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: '',
|
||||
remember: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 登录按钮点击事件
|
||||
handleLogin() {
|
||||
console.log(this.loginForm);
|
||||
},
|
||||
/*
|
||||
async generateKey() { // 二次验证登录(未完成,可用)需要添加两个变量:secretKey totpCode
|
||||
try {
|
||||
const response = await axios.get('/MultiFactorAuth/GenerateKey');
|
||||
this.secretKey = response.data.secretKey;
|
||||
this.totpCode = response.data.qrCodeSetupUrl;
|
||||
console.log(response);
|
||||
// 显示二维码,让用户扫描
|
||||
// 可以使用第三方库来显示二维码,例如 qrcode.vue
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
async verifyTOTP() {
|
||||
try {
|
||||
const response = await axios.post('/MultiFactorAuth/VerifyTOTP', {
|
||||
SecretKey: this.secretKey,
|
||||
TotpCode: this.totpCode,
|
||||
});
|
||||
if (response.data.Success) {
|
||||
alert('Verification successful!');
|
||||
// 进行登录流程
|
||||
} else {
|
||||
alert('Invalid TOTP code.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
*/
|
||||
},
|
||||
mounted() {
|
||||
// this.generateKey();
|
||||
},
|
||||
};
|
||||
const app = Vue.createApp(App);
|
||||
app.use(ElementPlus);
|
||||
|
||||
|
||||
// 挂载 Vue 应用到 DOM 元素上
|
||||
app.mount('#app');
|
||||
|
||||
// 页面加载时
|
||||
window.onload = function () {
|
||||
|
||||
};
|
||||
|
||||
// 监听窗口大小变化事件方法
|
||||
function AdjustWindow() {
|
||||
|
||||
if (window.innerWidth <= 768) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 监听窗口大小变化事件Window加载时创建
|
||||
window.addEventListener('resize', function () { AdjustWindow() });
|
||||
|
||||
4
AUTS_Server/wwwroot/js/site.js
Normal file
4
AUTS_Server/wwwroot/js/site.js
Normal file
@@ -0,0 +1,4 @@
|
||||
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your JavaScript code.
|
||||
Reference in New Issue
Block a user