|
|
@ -8,9 +8,12 @@ import Statement from '../components/Statement.vue'
|
|
|
|
import VarDeclEditor from './VarDeclEditor.vue'
|
|
|
|
import VarDeclEditor from './VarDeclEditor.vue'
|
|
|
|
import ExpressionEditor from './ExpressionEditor.vue'
|
|
|
|
import ExpressionEditor from './ExpressionEditor.vue'
|
|
|
|
import TextBox from '../components/TextBox.vue'
|
|
|
|
import TextBox from '../components/TextBox.vue'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import FunctionEditor from '../components/FunctionEditor.vue'
|
|
|
|
import { RichTextBox } from '../support/types'
|
|
|
|
import { RichTextBox } from '../support/types'
|
|
|
|
import { stepX, stepY } from '../support/const'
|
|
|
|
import { stepX, stepY } from '../support/const'
|
|
|
|
import FunctionEditor from '../components/FunctionEditor.vue'
|
|
|
|
import { checkLoggedIn, loggedOut } from '../support/auth'
|
|
|
|
|
|
|
|
import router from '../router'
|
|
|
|
|
|
|
|
|
|
|
|
const math = new MathPage(uuidv4());
|
|
|
|
const math = new MathPage(uuidv4());
|
|
|
|
const statements = ref<MathStatement[]>([]);
|
|
|
|
const statements = ref<MathStatement[]>([]);
|
|
|
@ -130,7 +133,9 @@ const updateStatements = () => {
|
|
|
|
statementsKey.value = uuidv4()
|
|
|
|
statementsKey.value = uuidv4()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(updateStatements)
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
|
|
updateStatements()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const saveNewVariable = (stmt: MathStatement) => {
|
|
|
|
const saveNewVariable = (stmt: MathStatement) => {
|
|
|
|
math.addStatement(stmt)
|
|
|
|
math.addStatement(stmt)
|
|
|
@ -212,6 +217,31 @@ const removeRichTextBox = (id: number) => {
|
|
|
|
console.log(richTextStatements.value[id]);
|
|
|
|
console.log(richTextStatements.value[id]);
|
|
|
|
richTextStatements.value.splice(id, 1);
|
|
|
|
richTextStatements.value.splice(id, 1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Auth
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
const status = ref(checkLoggedIn())
|
|
|
|
|
|
|
|
const logout = async () => {
|
|
|
|
|
|
|
|
const response = await fetch('/api/logout/', {
|
|
|
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
headers: {
|
|
|
|
|
|
|
|
'Accept': 'application/json',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
loggedOut()
|
|
|
|
|
|
|
|
status.value = checkLoggedIn()
|
|
|
|
|
|
|
|
router.push('/')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
|
|
status.value = checkLoggedIn()
|
|
|
|
|
|
|
|
console.log(status.value)
|
|
|
|
|
|
|
|
if (status.value == false) {
|
|
|
|
|
|
|
|
router.push({ path: '/' })
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -223,13 +253,13 @@ const removeRichTextBox = (id: number) => {
|
|
|
|
<q-toolbar-title>
|
|
|
|
<q-toolbar-title>
|
|
|
|
<q-avatar>
|
|
|
|
<q-avatar>
|
|
|
|
<img src="https://cdn.quasar.dev/logo-v2/svg/logo-mono-white.svg" />
|
|
|
|
<img src="https://cdn.quasar.dev/logo-v2/svg/logo-mono-white.svg" />
|
|
|
|
</q-avatar>
|
|
|
|
</q-avatar>Title
|
|
|
|
Title
|
|
|
|
|
|
|
|
</q-toolbar-title>
|
|
|
|
</q-toolbar-title>
|
|
|
|
</q-toolbar>
|
|
|
|
</q-toolbar>
|
|
|
|
<q-tabs align="left">
|
|
|
|
<q-tabs>
|
|
|
|
<q-route-tab to="/Scratch" label="Scratch" />
|
|
|
|
<q-route-tab to="/Scratch" label="Scratch" />
|
|
|
|
<q-route-tab to="/Editor" label="Editor" />
|
|
|
|
<q-route-tab to="/Editor" label="Editor" />
|
|
|
|
|
|
|
|
<q-tab v-if="status" @click="logout()" label="Logout" />
|
|
|
|
</q-tabs>
|
|
|
|
</q-tabs>
|
|
|
|
</q-header>
|
|
|
|
</q-header>
|
|
|
|
|
|
|
|
|
|
|
@ -249,9 +279,7 @@ const removeRichTextBox = (id: number) => {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template v-slot:body="props">
|
|
|
|
<template v-slot:body="props">
|
|
|
|
<q-tr :props="props">
|
|
|
|
<q-tr :props="props">
|
|
|
|
<q-td key="name" :props="props">
|
|
|
|
<q-td key="name" :props="props">{{ props.row.name }}</q-td>
|
|
|
|
{{ props.row.name }}
|
|
|
|
|
|
|
|
</q-td>
|
|
|
|
|
|
|
|
<q-td key="value" :props="props">
|
|
|
|
<q-td key="value" :props="props">
|
|
|
|
<div v-html="props.row.value"></div>
|
|
|
|
<div v-html="props.row.value"></div>
|
|
|
|
</q-td>
|
|
|
|
</q-td>
|
|
|
@ -318,30 +346,19 @@ const removeRichTextBox = (id: number) => {
|
|
|
|
</q-dialog>
|
|
|
|
</q-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<q-dialog v-model="editExpressionModalOpen">
|
|
|
|
<q-dialog v-model="editExpressionModalOpen">
|
|
|
|
<ExpressionEditor
|
|
|
|
<ExpressionEditor :statement="editingStatement" v-on:save="() => finishEditStatement()" />
|
|
|
|
:statement="editingStatement"
|
|
|
|
|
|
|
|
v-on:save="() => finishEditStatement()"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</q-dialog>
|
|
|
|
</q-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<q-dialog v-model="editVarDeclModalOpen">
|
|
|
|
<q-dialog v-model="editVarDeclModalOpen">
|
|
|
|
<VarDeclEditor
|
|
|
|
<VarDeclEditor :statement="editingStatement" v-on:save="() => finishEditStatement()" />
|
|
|
|
:statement="editingStatement"
|
|
|
|
|
|
|
|
v-on:save="() => finishEditStatement()"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</q-dialog>
|
|
|
|
</q-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<q-dialog v-model="newFunctionModalOpen">
|
|
|
|
<q-dialog v-model="newFunctionModalOpen">
|
|
|
|
<FunctionEditor
|
|
|
|
<FunctionEditor v-on:save="(s) => saveNewFunction(s)" />
|
|
|
|
v-on:save="(s) => saveNewFunction(s)"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</q-dialog>
|
|
|
|
</q-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<q-dialog v-model="editFunctionModalOpen">
|
|
|
|
<q-dialog v-model="editFunctionModalOpen">
|
|
|
|
<FunctionEditor
|
|
|
|
<FunctionEditor :statement="editingStatement" v-on:save="() => finishEditStatement()" />
|
|
|
|
:statement="editingStatement"
|
|
|
|
|
|
|
|
v-on:save="() => finishEditStatement()"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</q-dialog>
|
|
|
|
</q-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<q-page-sticky position="bottom-right" :offset="[32, 32]">
|
|
|
|
<q-page-sticky position="bottom-right" :offset="[32, 32]">
|
|
|
@ -379,12 +396,7 @@ const removeRichTextBox = (id: number) => {
|
|
|
|
<q-editor v-model="richEditExpression" min-height="5rem" />
|
|
|
|
<q-editor v-model="richEditExpression" min-height="5rem" />
|
|
|
|
<q-card-actions align="right" class="text-primary">
|
|
|
|
<q-card-actions align="right" class="text-primary">
|
|
|
|
<q-btn flat label="Cancel" v-close-popup></q-btn>
|
|
|
|
<q-btn flat label="Cancel" v-close-popup></q-btn>
|
|
|
|
<q-btn
|
|
|
|
<q-btn flat label="Save" @click="richUpdateValue" v-close-popup></q-btn>
|
|
|
|
flat
|
|
|
|
|
|
|
|
label="Save"
|
|
|
|
|
|
|
|
@click="richUpdateValue"
|
|
|
|
|
|
|
|
v-close-popup
|
|
|
|
|
|
|
|
></q-btn>
|
|
|
|
|
|
|
|
</q-card-actions>
|
|
|
|
</q-card-actions>
|
|
|
|
</q-card>
|
|
|
|
</q-card>
|
|
|
|
</q-dialog>
|
|
|
|
</q-dialog>
|
|
|
|