mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
修复一些错误
This commit is contained in:
1 parent
747cb1b9b5
commit
b19f948fdd
30 files changed
+306
-132
No files matched your search
+2
-1
@@ -44,7 +44,8 @@ module.exports = {
|
||||
"UiContext": true,
|
||||
"UserContext": true,
|
||||
"Context": true,
|
||||
"LOCALES": true
|
||||
"LOCALES": true,
|
||||
"window": true,
|
||||
},
|
||||
"rules": {
|
||||
"comma-dangle": [
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ async function load() {
|
||||
...buildSequence(includedPages, 'after'),
|
||||
...buildSequence([currentPage], 'after'),
|
||||
];
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const { page, func, type } of loadSequence) {
|
||||
if (typeof func !== 'function') {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
|
||||
@@ -47,6 +47,10 @@ export class AutoloadPage extends Page {
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro = {
|
||||
NamedPage, AutoloadPage,
|
||||
};
|
||||
|
||||
export class PageLoader {
|
||||
constructor() {
|
||||
const pageReq = require.context('../', true, /\.page\.js$/i);
|
||||
@@ -57,6 +61,7 @@ export class PageLoader {
|
||||
}
|
||||
return page;
|
||||
});
|
||||
window.Hydro.pageInstances = this.pageInstances;
|
||||
}
|
||||
|
||||
getAutoloadPages() {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { NamedPage } from 'vj/misc/PageLoader';
|
||||
import Notification from 'vj/components/notification';
|
||||
import { ActionDialog } from 'vj/components/dialog';
|
||||
|
||||
import request from 'vj/utils/request';
|
||||
|
||||
const page = new NamedPage('manage_module', () => {
|
||||
const addModuleDialog = new ActionDialog({
|
||||
$body: $('.dialog__body--add-module > div'),
|
||||
onDispatch(action) {
|
||||
const $url = addModuleDialog.$dom.find('[name="url"]');
|
||||
if (action === 'ok' && $url.val() === '') {
|
||||
$url.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
});
|
||||
addModuleDialog.clear = function () {
|
||||
this.$dom.find('[name="url"]').val('');
|
||||
this.$dom.find('[name="id"]').val('');
|
||||
return this;
|
||||
};
|
||||
|
||||
async function handleClickAddModule() {
|
||||
const action = await addModuleDialog.clear().open();
|
||||
if (action !== 'ok') return;
|
||||
const url = addModuleDialog.$dom.find('[name="url"]').val();
|
||||
const id = addModuleDialog.$dom.find('[name="id"]').val();
|
||||
try {
|
||||
await request.post('', {
|
||||
operation: 'install',
|
||||
url,
|
||||
id,
|
||||
});
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
Notification.error(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
$('[name="add_module"]').click(() => handleClickAddModule());
|
||||
});
|
||||
|
||||
export default page;
|
||||
Reference in new issue
Block a user