diff --git a/.env.development b/.env.development index 033cdd4..7cf965b 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ NODE_ENV = developement VUE_APP_BASE_NAME = developement VUE_APP_BASE_URL = http://localhost:8080 +NOTE_MAX_WORDS = 10240 diff --git a/.env.production b/.env.production index 8ce9cc0..725f7b6 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,4 @@ NODE_ENV = production VUE_APP_BASE_NAME = production VUE_APP_BASE_URL = https://flagnote.com +NOTE_MAX_WORDS = 10240 diff --git a/src/api/note.js b/src/api/note.js index c5899f9..f90ab86 100644 --- a/src/api/note.js +++ b/src/api/note.js @@ -4,6 +4,11 @@ import storage from "@/libs/storage"; import { md5 } from "@/libs/secret"; const servicePath = process.env.VUE_APP_BASE_URL; +const noteMaxWords = parseInt(process.env.NOTE_MAX_WORDS); + +export { + noteMaxWords +} export function saveNote(noteForm, secret) { let storeKey = secret.storeKey; @@ -95,10 +100,10 @@ export function ajaxGet(url) { xmlhttp.onreadystatechange = () => { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200 || xmlhttp.status == 304) { - if(xmlhttp.responseText){ - data = JSON.parse(xmlhttp.responseText); - }else{ - data ={}; + if (xmlhttp.responseText) { + data = JSON.parse(xmlhttp.responseText); + } else { + data = {}; } } } diff --git a/src/i18n/config/en.js b/src/i18n/config/en.js index bcff123..07e9cc8 100644 --- a/src/i18n/config/en.js +++ b/src/i18n/config/en.js @@ -5,6 +5,7 @@ const en = { content: { blankTip: "I am Blank.", noteTip: "Start writing something...", + deleteTip: "The note will be deleted automatically. ttl:" }, button: { ok: "OK", @@ -24,7 +25,7 @@ const en = { "100005": "Not Published!", "100006": "Server Unavailable!", "100011": "Empty Note!", - "100012": "Too Large, Beyond 200K!", + "100012": "Too Large, Beyond 400K!", } }; export default en; diff --git a/src/i18n/config/zh.js b/src/i18n/config/zh.js index b10316c..57e8cc7 100644 --- a/src/i18n/config/zh.js +++ b/src/i18n/config/zh.js @@ -4,7 +4,8 @@ const zh = { }, content: { blankTip: "空白的内容。", - noteTip: "开始写下一些东西吧。。。" + noteTip: "开始写下一些东西吧。。。", + deleteTip: "笔记将被自动删除。剩余时间:" }, button: { ok: "好的", @@ -19,12 +20,12 @@ const zh = { error: { "100001": "未知错误!", "100002": "地址有误!", - "100003": "内容已删除!", - "100004": "内容已过期!", - "100005": "内容未分享!", + "100003": "笔记已删除!", + "100004": "笔记已过期!", + "100005": "笔记未分享!", "100006": "服务器不可用!", - "100011": "内容为空!", - "100012": "内容过大,超过200K!", + "100011": "笔记为空!", + "100012": "笔记过大,超过400K!", } }; export default zh; diff --git a/src/views/EditNote.vue b/src/views/EditNote.vue index faafe0a..59640a7 100644 --- a/src/views/EditNote.vue +++ b/src/views/EditNote.vue @@ -152,7 +152,7 @@
@@ -341,7 +341,7 @@ export default { }, recordText() { let text = this.noteForm.text; - if (text.length > 204800) { + if (text.length > 409600) { this.errorInfo = this.$t('error.100012'); this.model.showError = true; return; @@ -370,7 +370,7 @@ export default { let end = event.currentTarget.selectionEnd; let text = event.currentTarget.value; - if (text.length > 204800) { + if (text.length > 409600) { this.errorInfo = this.$t('error.100012'); this.model.showError = true; return; @@ -416,7 +416,7 @@ export default { }, validateForm() { let text = this.noteForm.text; - if (text.length > 204800) { + if (text.length > 409600) { this.errorInfo = this.$t('error.100012'); this.model.showError = true; return false; diff --git a/src/views/ErrorNote.vue b/src/views/ErrorNote.vue index 2dcb559..18bbe87 100644 --- a/src/views/ErrorNote.vue +++ b/src/views/ErrorNote.vue @@ -139,7 +139,7 @@ export default { } else if (this.$route.params.code) { this.errorInfo.code = this.$route.params.code; } - + if (this.$route.params.name) { this.noteForm.key = this.$route.params.name; } diff --git a/src/views/ViewNote.vue b/src/views/ViewNote.vue index 3a137e7..2424ea6 100644 --- a/src/views/ViewNote.vue +++ b/src/views/ViewNote.vue @@ -202,9 +202,13 @@+ {{$t("content.deleteTip")}}{{ state.ttlDesc }} +
+ ++ +
+{{ $t("message.askTodelete") }} @@ -367,6 +382,7 @@ export default { showDownloadText: false, copyTip: false, showError: false, + showTtlDelete: false, }, toTopState: false, showMenuState: false, @@ -515,6 +531,12 @@ export default { this.errorInfo = ''; this.model.showError = false; }, + showTtlDeleteModel(){ + this.model.showTtlDelete = true; + }, + closeTtlDeleteModel(){ + this.model.showTtlDelete = false; + }, showShareModel() { this.model.showShare = true; storage.session.setText(this.secret.storeKey + "_share", '1');