This commit is contained in:
Jesse-Ma
2022-06-06 10:56:12 +08:00
parent 0d10a1802a
commit 9a7d98316c
11 changed files with 392 additions and 50 deletions

189
src/views/BlankNote.vue Normal file
View File

@@ -0,0 +1,189 @@
<style scoped>
.layout {
height: 100%;
background: #dddddd;
}
.header {
background: #dddddd;
}
.ivu-layout-header {
line-height: normal;
height: auto;
padding: 0px;
}
.content {
background: #dddddd;
}
.ivu-layout-content {
padding: 0px;
}
.layout-footer-center {
background: #dddddd;
text-align: center;
}
.ivu-card-bordered {
border: 0px solid #dcdee2;
border-color: #e8eaec;
}
.noteKey {
color: red;
font-weight: bold;
font-size: 18px;
font-family: "Bitstream Vera Sans Mono", Consolas, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei"
}
</style>
<style>
#noteText {
color: black;
padding: 15px;
vertical-align: top;
width: 100%;
height: auto;
background: white;
min-width: 200px;
border-radius: 0px;
overflow-y: auto;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
/*min-height: 400px;*/
font-size: 14px;
}
#noteText::selection {
background: firebrick;
color: white;
}
#noteText::-moz-selection {
background: firebrick;
color: white;
}
#noteText br::selection {
background: firebrick;
color: white;
}
#noteText br::-moz-selection {
background: firebrick;
color: white;
}
</style>
<template>
<div class="layout" onkeydown="keydown">
<Layout>
<Affix :offset-top="0">
<Header class="header">
<div>
<Row>
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
<div style="background: white;width:100%;height:40px;">
<img style="height:40px;float:left;" src="favicon.png">
<div style="float:right;width:auto;">
<Button-group size="large">
<Button type="error" style="margin-left:0px; border-radius: 0px;font-size: 24px;"
@click="createNote()" icon="md-add"></Button>
</Button-group>
</div>
</div>
</Col>
</Row>
</div>
</Header>
</Affix>
<Content class="content">
<div style="min-height: 650px;">
<Row>
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
<Card :padding="0">
<div style="border-left: 0px solid #FF3366;">
<div id="noteText" style="text-align: center;min-height: 650px;" class="monoFt">
<h1>blank</h1>
</div>
</div>
</Card>
</Col>
</Row>
</div>
</Content>
<Footer class="layout-footer-center">2022 &copy; flagnote.com</Footer>
</Layout>
</div>
</template>
<script>
export default {
name: 'BlankNote',
components: {},
props: {},
data() {
return {
noteForm: {
url: '',
text: '',
escapeText: '',
key: '',
md5: '',
lock: '0',
},
secret: {
storeKey: '',
secretKey: '',
cipher: '',
},
state: {
lock: '0',
locking: '0',
commited: '0'
}
}
},
created() {
this.noteForm.key = this.$route.params.name;
},
methods: {
createNote() {
window.open("/");
}
}
}
</script>

View File

@@ -52,7 +52,7 @@
<style>
#noteText {
color: black;
padding: 10px;
padding: 15px;
vertical-align: top;
width: 100%;
height: auto;
@@ -93,18 +93,67 @@
<div style="background: white;width:100%;height:40px;">
<img style="height:40px;float:left;" src="favicon.png">
<div style="float:left;width:auto;">
<div style="height: 40px;float: left;padding-top: 15px;padding-left: 20px;">
<Icon type="md-create" style="font-size: 22px;color:red" /><a class="noteKey">{{ noteForm.key }}</a>
<Button-group size="large">
</Button-group>
</div>
<img style="height:40px;float:left;" src="favicon.png">
<div style="float:left;width:auto;">
<Button-group size="large">
</Button-group>
</div>
<div style="float:right;width:auto;">
<Button-group size="large">
<Button v-show="!showPassword" type="error"
style="margin-right:5px; border-radius: 0px;font-size: 24px;" @click="showInput()"
icon="md-unlock"></Button>
<Input v-show="!showPassword">
<Button slot="append" type="error" style="margin-right:5px; border-radius: 0px;font-size: 24px;"
icon="md-checkmark-circle"></Button>
</Input>
<Button type="error" :loading="loading"
style="margin-right:5px; border-radius: 0px;font-size: 24px;" @click="submitNote()"
icon="md-cloud-upload"></Button>
<Button type="error" style="margin-left:0px; border-radius: 0px;font-size: 24px;"
@click="createNote()" icon="md-add"></Button>
<Button type="error" style="margin-left:0px; border-radius: 0px;font-size: 24px;"
@click="dropNote()" icon="md-trash"></Button>
</Button-group>
</div>
<div style="float:right;width:auto;">
<Button-group size="large">
<Button type="error" :loading="loading" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="submitNote()" icon="md-cloud-upload"></Button>
<Button type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="createNote()" icon="md-add"></Button>
<!--
<Button v-show="!show" type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="showNote()" icon="md-eye"></Button>
<Button v-show="show" type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="hideNote()" icon="md-eye-off"></Button>
-->
</Button-group>
</div>
@@ -116,7 +165,8 @@
<Button-group size="default">
<Button type="error" @click="unLockNote()" icon="md-eye"></Button>
<Button type="error" @click="lockNote()" icon="md-eye-off"></Button>
</Button-group>
<Button type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="dropNote()" icon="md-trash"></Button> </Button-group>
</div>
-->
@@ -153,7 +203,7 @@
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
<Card :padding="0">
<Form :model="noteForm" :label-width="80">
<div id="wrapper" style="border-left: 3px solid #FF3366;">
<div id="wrapper" style="border-left: 0px solid #FF3366;">
<Input element-id="noteText" type="textarea" :border="false" v-model="noteForm.text"
:autosize="{ minRows: 30, maxRows: 1024 }" placeholder="Enter something..." v-on:input="log"
@@ -172,7 +222,7 @@
</Content>
<Footer class="layout-footer-center">2022 &copy; openif.com</Footer>
<Footer class="layout-footer-center">2022 &copy; flagnote.com</Footer>
</Layout>
<Modal v-model="modal1" title="Common Modal dialog box title" @on-ok="ok" @on-cancel="cancel">
@@ -204,6 +254,7 @@ export default {
components: {},
data() {
return {
show: true,
loading: false,
modal1: false,
showExt: false,
@@ -244,6 +295,7 @@ export default {
}
if (this.state.lock == "1") {
this.show = false;
this.noteForm.text = "*****lock*****";
return;
} else {
@@ -264,6 +316,12 @@ export default {
computed: {},
watch: {},
methods: {
showInput() {
this.showPassword = true;
},
hideInput() {
//this.showPassword = false;
},
change(status) {
this.showPassword = status;
},
@@ -324,7 +382,7 @@ export default {
// //document.body.appendChild(canvas);
// });
} else if (event.ctrlKey && event.which == 13) {
} else if (event.ctrlKey && (event.which == 13)) {
this.save().then(res => {
if (res) {
location.reload();
@@ -352,7 +410,7 @@ export default {
}
});
},
lockNote() {
hideNote() {
if (this.state.locking == "1") {
return;
}
@@ -363,6 +421,8 @@ export default {
return;
}
let password = '123456';
setStoreText(this.noteForm.text, this.secret, password);
@@ -378,11 +438,13 @@ export default {
noteText.selectionStart = 0;
noteText.selectionEnd = 1;
this.show = false;
this.state.locking = "0";
},
unLockNote() {
showNote() {
if (this.state.locking == "1") {
return;
}
@@ -426,7 +488,7 @@ export default {
this.noteForm.text = plainText.substring(9);
this.state.lock = "0";
setStoreText(this.noteForm.text, this.secret);
this.show = true;
this.state.locking = "0";
} else {
alert("password is wrong!")
@@ -438,10 +500,21 @@ export default {
this.state.locking = "0";
}
},
refresh() {
location.reload();
},
createNote() {
window.open("/");
},
dropNote() {
storage.local.delete(this.secret.storeKey + '.text');
storage.session.delete(this.secret.storeKey + '.keyMeta');
location.reload();
},
bindEvent() {
if (document.body.createTextRange) {
Jquery(document).keydown(function (e) {

View File

@@ -52,7 +52,7 @@
<style>
#noteText {
color: black;
padding: 10px;
padding: 15px;
vertical-align: top;
width: 100%;
height: auto;
@@ -86,8 +86,10 @@
color: white;
}
button span {
font-size: 18px;
margin-left: -1px !important;
}
</style>
<template>
<div class="layout" onkeydown="keydown">
@@ -98,39 +100,38 @@
<Header class="header">
<div>
<Row>
<Col :xs="{ span: 24, offset: 0}" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
<div style="background: white;width:100%;height:40px;">
<img style="height:40px;float:left;" src="favicon.png">
<div style="float:left;width:auto;">
<Button-group size="large">
<Button type="error"
style="margin-left:5px; border-radius: 0px;font-size: 24px; font-family: Arial, sans-serif"
icon="md-cloud-done">{{ this.noteForm.ttlDesc }}</Button>
</Button-group>
<div style="height: 40px;float: left;padding-top: 15px;padding-left: 20px;">
<Icon type="md-cloud-done" style="font-size: 22px;color:red" /><a class="noteKey">{{ noteForm.key
}}</a>
</div>
<div style="float:right;width:auto;">
<Button-group size="large">
<Button type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="deleteNote()" icon="md-trash"></Button>
<Button type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
<Button type="error" style="margin-left:0px; border-radius: 0px;font-size: 24px;"
@click="createNote()" icon="md-add"></Button>
<Button type="error" style="margin-left:0px; border-radius: 0px;font-size: 24px;"
@click="dropNote()" icon="md-trash"></Button>
</Button-group>
</div>
<!--
<div style="float:right;width:auto;">
<Button-group size="default">
<Button type="error" @click="unLockNote()" icon="md-eye"></Button>
<Button type="error" @click="lockNote()" icon="md-eye-off"></Button>
</Button-group>
</div>
-->
<!--
@@ -160,10 +161,10 @@
<Content class="content">
<div style="min-height: 650px;">
<Row>
<Col :xs="{ span: 24, offset: 0}" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
<Card :padding="0">
<div style="border-left: 3px solid #FF3366;">
<div style="border-left: 0px solid #FF3366;">
<div id="noteText" style="text-align: left;min-height: 650px;" class="monoFt"
v-html="this.noteForm.escapeText">
view2
@@ -177,7 +178,7 @@
</Content>
<Footer class="layout-footer-center">2022 &copy; flagnote.com</Footer>
</Layout>
@@ -190,6 +191,7 @@
import { aesDecrypt, md5, unzip } from "@/libs/secret";
import Jquery from "jquery";
import { getSecretKey, getStoreKey } from "@/api/lock";
import { deleteNote } from "@/api/note";
import storage from "@/libs/storage";
import { getEscapeText } from "@/libs/noteStorage";
@@ -206,6 +208,8 @@ export default {
key: '',
md5: '',
lock: '0',
ttl: 3600,
ttlDesc: '',
},
secret: {
storeKey: '',
@@ -228,12 +232,42 @@ export default {
this.state.lock = noteMeta.lock;
this.secret.cipher = noteMeta.cipher;
this.noteForm.md5 = noteMeta.md5;
this.noteForm.ttl = noteMeta.ttl;
this.startClock();
this.loadText();
}
this.bindEvent();
},
methods: {
startClock() {
let that = this;
window.setInterval(function () {
let ittl = parseInt(that.noteForm.ttl / 1000);
let mins = parseInt(ittl / 60);
if (mins < 10) {
mins = "0" + mins;
}
if (mins < 0) {
mins = "00";
}
let seds = parseInt(ittl % 60);
if (seds < 10) {
seds = "0" + seds;
}
if (seds < 0) {
seds = "00";
}
that.noteForm.ttlDesc = mins + ":" + seds;
that.noteForm.ttl -= 1000;
if (that.noteForm.ttl <= 0) {
that.storage.local.delete(that.secret.storeKey + '.text');
that.storage.session.delete(that.secret.storeKey + '.keyMeta');
location.reload();
}
}, 1000)
},
decryptNote() {
// let password = "123456";
// let secretKey = getSecretKey(this.noteForm.key, password);
@@ -243,6 +277,15 @@ export default {
createNote() {
window.open("/");
},
dropNote() {
deleteNote(this.noteForm.key).then(res => {
if (res) {
storage.local.delete(this.secret.storeKey + '.text');
storage.session.delete(this.secret.storeKey + '.keyMeta');
location.reload();
}
});
},
loadText() {
let password;