This commit is contained in:
Jesse-Ma
2022-06-30 12:32:28 +08:00
parent 9a7d98316c
commit 0bdd2eea5c
5 changed files with 55 additions and 69 deletions

View File

@@ -123,7 +123,7 @@ button span {
<Button-group size="large">
<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;"
<Button type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
@click="dropNote()" icon="md-trash"></Button>
</Button-group>
</div>
@@ -207,7 +207,7 @@ export default {
escapeText: '',
key: '',
md5: '',
lock: '0',
lock: 0,
ttl: 3600,
ttlDesc: '',
},
@@ -217,9 +217,11 @@ export default {
cipher: '',
},
state: {
lock: '0',
locking: '0',
commited: '0'
lock: 0,
locking: 0,
initTime: null,
initTtl: null,
commited: 0
}
}
},
@@ -230,6 +232,8 @@ export default {
let noteMeta = storage.session.getObject(storeKey + '.noteMeta');
if (noteMeta) {
this.state.lock = noteMeta.lock;
this.state.initTime = new Date().getTime();
this.state.initTtl = noteMeta.ttl;
this.secret.cipher = noteMeta.cipher;
this.noteForm.md5 = noteMeta.md5;
this.noteForm.ttl = noteMeta.ttl;
@@ -246,24 +250,25 @@ export default {
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";
} else if (mins < 10) {
mins = "0" + mins;
}
let seds = parseInt(ittl % 60);
if (seds < 10) {
seds = "0" + seds;
}
if (seds < 0) {
seds = "00";
} else if (seds < 10) {
seds = "0" + seds;
}
that.noteForm.ttlDesc = mins + ":" + seds;
that.noteForm.ttl -= 1000;
that.noteForm.ttl = that.state.initTtl - (new Date().getTime() - that.state.initTime);
if (that.noteForm.ttl <= 0) {
that.storage.local.delete(that.secret.storeKey + '.text');
that.storage.session.delete(that.secret.storeKey + '.keyMeta');
storage.local.delete(that.secret.storeKey + '.text');
storage.session.delete(that.secret.storeKey + '.keyMeta');
location.reload();
}
}, 1000)
@@ -290,7 +295,7 @@ export default {
let password;
if (this.noteForm.lock == "1") {
if (this.noteForm.lock == 1) {
password = "123456"
}