Browse Source

dev feature

Arsekl 3 years ago
parent
commit
2f98ee96ac

+ 1 - 1
.umirc.ts

@@ -3,7 +3,7 @@ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
 
 export default defineConfig({
     title: 'SEECODER | 软件工程学习系统',
-    favicon: '/favicon.ico',
+    favicon: '/logo.png',
     hash: true,
     ignoreMomentLocale: true,
     targets: {

BIN
public/favicon.ico


BIN
public/favicon.png


BIN
public/logo.png


+ 3 - 3
src/api/index.ts

@@ -3,6 +3,7 @@ import {Gitlab} from "@gitbeaker/browser";
 import {store} from "@/redux/store";
 import {loadError, loadSuccess} from "@/redux/action/action";
 import {IFolderTreeNodeProps} from "@dtinsight/molecule/esm/model";
+import molecule from "@dtinsight/molecule";
 
 const basePath = './mock';
 const apiPath = '/api'
@@ -96,7 +97,7 @@ const api = {
     },
 
     async query(query: string = '') {
-        const res = await http.get(`${basePath}/folderTree.json`);
+        const data = molecule.folderTree.getState().folderTree;
         const result: any[] = [];
         const search = (nodeItem: any) => {
             if (!nodeItem) return;
@@ -110,8 +111,7 @@ const api = {
                 })
             }
         }
-        search(res.data);
-
+        search(data);
         return result;
     },
 

+ 8 - 2
src/extensions/action/index.ts

@@ -2,8 +2,12 @@
 import { IExtension } from '@dtinsight/molecule/esm/model/extension';
 import { IExtensionService } from '@dtinsight/molecule/esm/services';
 
-import { KeybindingAction } from './keybindingAction';
 import { QuickOpenAction } from './quickOpenAction';
+import {
+    OpenKeybindingAction,
+    ResultKeybindingAction,
+    SubmitKeybindingAction
+} from "@/extensions/action/keybindingAction";
 
 export class ActionExtension implements IExtension {
 
@@ -13,7 +17,9 @@ export class ActionExtension implements IExtension {
     activate(extensionCtx: IExtensionService): void {
         // Register the Action
         extensionCtx.registerAction(QuickOpenAction);
-        extensionCtx.registerAction(KeybindingAction);
+        extensionCtx.registerAction(ResultKeybindingAction);
+        extensionCtx.registerAction(SubmitKeybindingAction);
+        extensionCtx.registerAction(OpenKeybindingAction);
     }
 
     dispose(extensionCtx: IExtensionService): void {

+ 53 - 5
src/extensions/action/keybindingAction.ts

@@ -3,26 +3,74 @@ import { KeyCode, KeyMod } from "@dtinsight/molecule/esm/monaco";
 import { Action2 } from '@dtinsight/molecule/esm/monaco/action';
 //@ts-ignore
 import { KeyChord } from 'monaco-editor/esm/vs/base/common/keyCodes';
+import {DRAWER_MENU_ENUM} from "@/constant";
+import {history} from "@@/core/history";
+import {submitQuestion} from "@/utils";
+import {jumpToCoder} from "@/services/exam";
 
-export class KeybindingAction extends Action2 {
+export class ResultKeybindingAction extends Action2 {
 
-    static readonly ID = 'AutoSave';
+    constructor() {
+        super({
+            id: DRAWER_MENU_ENUM.RESULT,
+            precondition: undefined,
+            f1: false, // Not show in the Command Palette
+            keybinding: {
+                weight: KeybindingWeight.WorkbenchContrib,
+                when: undefined,
+                primary: KeyChord(KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyK)
+            },
+        })
+    }
+
+    run(accessor: any, ...args: any[]) {
+        history.push({
+            query: {
+                drawer: DRAWER_MENU_ENUM.RESULT,
+            },
+        });
+        // do something
+    }
+}
+
+export class SubmitKeybindingAction extends Action2 {
+
+    constructor() {
+        super({
+            id: DRAWER_MENU_ENUM.SUBMIT,
+            precondition: undefined,
+            f1: false, // Not show in the Command Palette
+            keybinding: {
+                weight: KeybindingWeight.WorkbenchContrib,
+                when: undefined,
+                primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK)
+            },
+        })
+    }
+
+    run(accessor: any, ...args: any[]) {
+        submitQuestion();
+        // do something
+    }
+}
+
+export class OpenKeybindingAction extends Action2 {
 
     constructor() {
         super({
-            id: KeybindingAction.ID,
+            id: 'openFile',
             precondition: undefined,
             f1: false, // Not show in the Command Palette
             keybinding: {
                 weight: KeybindingWeight.WorkbenchContrib,
                 when: undefined,
-                primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyS)
+                primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyO)
             },
         })
     }
 
     run(accessor: any, ...args: any[]) {
-        alert('Save success!');
+        jumpToCoder();
         // do something
     }
 }

+ 2 - 2
src/extensions/init.tsx

@@ -98,8 +98,8 @@ function initMenuBar() {
     const state = molecule.menuBar.getState();
     const nextData = state.data.concat();
     nextData.splice(1, 0, {
-        id: 'seec',
-        name: 'Seec',
+        id: 'seecoder',
+        name: 'Seecoder',
         data: [
             {
                 id: DRAWER_MENU_ENUM.RESULT,

File diff suppressed because it is too large
+ 0 - 0
src/pages/logo.tsx


+ 1 - 1
src/pages/welcome/index.tsx

@@ -9,7 +9,7 @@ export default function Welcome() {
     return (
         <div className={prefixClaName('welcome')}>
             <Logo className="logo" />
-            <h1 className="title">SEEC</h1>
+            <h1 className="title" style={{width: "155px"}}>SEECODER</h1>
             <div className="keybindings">
                 <ul>
                     {keys.map((item) => {

+ 2 - 2
src/services/exam.ts

@@ -1,6 +1,6 @@
-const coder = 'https://coder.seec.seecoder.cn'
+const coder = 'https://p.seec.seecoder.cn'
 
 
 export const jumpToCoder = () => {
-    window.location.href = coder
+    window.open(coder, "_blank")
 }

+ 6 - 0
src/utils/index.ts

@@ -237,6 +237,12 @@ function generateFileTree(question: NestedCodeItemVO) {
     }
     molecule.folderTree.reset()
     molecule.folderTree.add(files)
+    const groups = molecule.editor.getState().groups
+    if (groups) {
+        for (let i = 0; i < groups.length; i++) {
+            molecule.editor.closeAll(groups[i].id)
+        }
+    }
     message.success('Loading is Complete')
 }
 

Some files were not shown because too many files changed in this diff