big step
This commit is contained in:
@@ -114,8 +114,8 @@ body {
|
||||
}
|
||||
|
||||
button span {
|
||||
font-size: 16px !important;
|
||||
font-size: 15px !important;
|
||||
font-family: apple-system,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif;
|
||||
margin-bottom: 5px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,8 +3,7 @@ import { getStoreKey } from "@/api/lock";
|
||||
import storage from "@/libs/storage";
|
||||
import { md5 } from "@/libs/secret";
|
||||
|
||||
const servicePath = "https://flagnote.com";
|
||||
//const servicePath = "http://localhost:8080";
|
||||
const servicePath = process.env.VUE_APP_BASE_URL;
|
||||
|
||||
export function saveNote(noteForm, secret) {
|
||||
let storeKey = secret.storeKey;
|
||||
|
||||
@@ -12,7 +12,16 @@ const en = {
|
||||
selectAll: "Select All",
|
||||
copy: "Copy",
|
||||
copyAll: "Copy All",
|
||||
share: "Share"
|
||||
share: "Share",
|
||||
close: "Close"
|
||||
},
|
||||
error: {
|
||||
"100001": "Unknown Error!",
|
||||
"100002": "Wrong Address!",
|
||||
"100003": "Deleted!",
|
||||
"100004": "Expired!",
|
||||
"100005": "Not Available!",
|
||||
"100006": "100006",
|
||||
}
|
||||
};
|
||||
export default en;
|
||||
|
||||
@@ -12,7 +12,16 @@ const zh = {
|
||||
selectAll: "全选",
|
||||
copy: "复制",
|
||||
copyAll: "复制全部",
|
||||
share: "分享"
|
||||
share: "分享",
|
||||
close: "关闭"
|
||||
},
|
||||
error: {
|
||||
"100001": "未知错误!",
|
||||
"100002": "地址有误!",
|
||||
"100003": "内容已删除!",
|
||||
"100004": "内容已过期!",
|
||||
"100005": "内容不存在!",
|
||||
"100006": "100006",
|
||||
}
|
||||
};
|
||||
export default zh;
|
||||
|
||||
@@ -6,7 +6,7 @@ import VueAxios from 'vue-axios'
|
||||
import './plugins/iview.js'
|
||||
import i18n from './i18n/'
|
||||
|
||||
axios.defaults.baseURL="https://flagnote.com";
|
||||
axios.defaults.baseURL= process.env.VUE_APP_BASE_URL;
|
||||
|
||||
Vue.use(VueAxios, axios)
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ import Vue from "vue";
|
||||
import VueRouter from "vue-router";
|
||||
import EditNote from "@/views/EditNote.vue";
|
||||
import ViewNote from "@/views/ViewNote.vue";
|
||||
import ErrorView from "@/views/ErrorView.vue";
|
||||
import BlankNote from "@/views/BlankNote.vue";
|
||||
import InvalidateNote from "@/views/InvalidateNote.vue";
|
||||
import { getKeyMeta, getNoteMeta } from "@/api/note";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
import storage from "@/libs/storage";
|
||||
@@ -12,6 +11,7 @@ Vue.use(VueRouter);
|
||||
|
||||
var keyMeta = null;
|
||||
var noteMeta = null;
|
||||
var errorMeta = null;
|
||||
|
||||
function getKeyMetaParam() {
|
||||
return keyMeta;
|
||||
@@ -21,6 +21,10 @@ function getNoteMetaParam() {
|
||||
return noteMeta;
|
||||
}
|
||||
|
||||
function getErrorMetaParam() {
|
||||
return errorMeta;
|
||||
}
|
||||
|
||||
function getNoteView() {
|
||||
let path = location.pathname;
|
||||
let key = path.substring(1, path.length);
|
||||
@@ -31,7 +35,8 @@ function getNoteView() {
|
||||
|
||||
let regKey = /^[abcdefhikmnopqstuvwxyz23456789]{16}$/;
|
||||
if (!regKey.test(key)) {
|
||||
return;
|
||||
errorMeta = 100002;
|
||||
return InvalidateNote;
|
||||
}
|
||||
|
||||
if (keyMeta && keyMeta.key) {
|
||||
@@ -42,29 +47,52 @@ function getNoteView() {
|
||||
//set noteMeta
|
||||
noteMeta = getNoteMeta(key);
|
||||
|
||||
//invalidated key
|
||||
if (!noteMeta || !noteMeta.key) {
|
||||
errorMeta = 100002;
|
||||
return InvalidateNote;
|
||||
}
|
||||
|
||||
//validated state
|
||||
if (1 == noteMeta.state) {
|
||||
return ViewNote;
|
||||
}
|
||||
|
||||
//deleted
|
||||
if (0 == noteMeta.state) {
|
||||
let storeKey = getStoreKey(key);
|
||||
|
||||
let storeInfo = storage.local.getText(storeKey);
|
||||
if (storeInfo) {
|
||||
let starray = storeInfo.split("|");
|
||||
let commitFlag = starray[2];
|
||||
if (commitFlag == "1") {
|
||||
//timeout and clear local
|
||||
storage.local.delete(storeKey );
|
||||
return BlankNote;
|
||||
} else {
|
||||
//secondEdit
|
||||
return EditNote;
|
||||
}
|
||||
} else {
|
||||
//uncommited or timeout
|
||||
return BlankNote;
|
||||
storage.local.delete(storeKey);
|
||||
// user deleted
|
||||
if (noteMeta.ttl > 0) {
|
||||
errorMeta = 100003;
|
||||
return InvalidateNote;
|
||||
} else {// timeout
|
||||
errorMeta = 100004;
|
||||
return InvalidateNote;
|
||||
}
|
||||
}
|
||||
// view in time
|
||||
return ViewNote;
|
||||
|
||||
if (null == noteMeta.state) {
|
||||
let storeKey = getStoreKey(key);
|
||||
//if has storage , then edit
|
||||
if (storage.local.getText(storeKey)) {
|
||||
return EditNote;
|
||||
} else {
|
||||
//storage is empty
|
||||
let df = storage.session.getText(storeKey + "_delete")
|
||||
if (df) {//unsubmitted,user deleted.
|
||||
errorMeta = 100003;
|
||||
return InvalidateNote;
|
||||
} else {//unsubmitted
|
||||
errorMeta = 100005;
|
||||
return InvalidateNote;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// other exception
|
||||
errorMeta = 100001;
|
||||
return InvalidateNote;
|
||||
}
|
||||
|
||||
function getHomeRedirect() {
|
||||
@@ -85,15 +113,10 @@ const routes = [
|
||||
redirect: getHomeRedirect(),
|
||||
},
|
||||
{
|
||||
path: "/error",
|
||||
name: "error",
|
||||
component: ErrorView,
|
||||
},
|
||||
{
|
||||
path: "/:name([abcdefhikmnopqstuvwxyz23456789]{16})",
|
||||
path: "/:name([a-z0-9]{16})",
|
||||
name: "note",
|
||||
component: getNoteView(),
|
||||
meta: { keyMeta: getKeyMetaParam(), noteMeta: getNoteMetaParam() },
|
||||
meta: { keyMeta: getKeyMetaParam(), noteMeta: getNoteMetaParam(), errorMeta: getErrorMetaParam() },
|
||||
//alias:'/xxxx'
|
||||
},
|
||||
];
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<Button-group size="large">
|
||||
<Button aria-label="publish" type="error" :loading="model.submitting"
|
||||
style="margin-left:5px; border-radius: 0px;font-size: 23px;" @click="submitNote()"
|
||||
style="margin-left:5px; border-radius: 0px;font-size: 19px;" @click="submitNote()"
|
||||
icon="md-cloud-upload">{{$t("button.share")}}</Button>
|
||||
<Button aria-label="menu" type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
|
||||
@click="switchMenu()" @blur.native="hideMenu()" icon="md-menu"></Button>
|
||||
@@ -163,12 +163,12 @@
|
||||
<Footer class="layout-footer-center">2022 © flagnote.com</Footer>
|
||||
</Layout>
|
||||
|
||||
<Modal v-model="model.showDelete" width="330" footer-hide class-name="fnmodal" :styles="{ borderRadius: 0 }">
|
||||
<Modal v-model="model.showDelete" width="360" footer-hide class-name="fnmodal" :styles="{ borderRadius: 0 }">
|
||||
<p style="text-align: center;font-size:medium ;margin-bottom: 20px;">
|
||||
{{ $t("message.askTodelete") }}
|
||||
</p>
|
||||
<p style="text-align: center;">
|
||||
<Button type="error" :loading="model.deleting" style="border-radius: 0px;" @click="dropNote()">{{
|
||||
<Button type="error" :loading="model.deleting" style="border-radius: 0px;font-size: 19px;" @click="dropNote()">{{
|
||||
$t("button.yes")
|
||||
}}</Button>
|
||||
</p>
|
||||
@@ -423,6 +423,7 @@ export default {
|
||||
let storeInfo = storage.local.getText(that.secret.storeKey);
|
||||
let starray = storeInfo.split("|");
|
||||
storage.local.setText(that.secret.storeKey, starray[0] + '|' + starray[1] + '|1|' + starray[3] + '|' + starray[4]);
|
||||
storage.session.setText(that.secret.storeKey+"_share",'1');
|
||||
location.reload();
|
||||
this.state.locking = 0;
|
||||
}
|
||||
@@ -440,6 +441,7 @@ export default {
|
||||
dropNote() {
|
||||
this.model.deleting = true;
|
||||
storage.local.delete(this.secret.storeKey);
|
||||
storage.session.setText(this.secret.storeKey+"_delete",1);
|
||||
location.reload();
|
||||
},
|
||||
bindToTopEvent() {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
error
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ErrorView',
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
created() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -37,6 +37,7 @@
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<template>
|
||||
<div class="layout" onkeydown="keydown">
|
||||
@@ -85,6 +86,7 @@
|
||||
<div id="noteText" style="text-align: center;min-height: 650px;" class="monoFt">
|
||||
<h1></h1>
|
||||
{{ $t("content.blankTip") }}
|
||||
{{ $t("error."+this.errorInfo.code) }}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -126,10 +128,14 @@ export default {
|
||||
lock: 0,
|
||||
locking: 0,
|
||||
commited: 0
|
||||
},
|
||||
errorInfo: {
|
||||
code: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.errorInfo.code = this.$route.meta.errorMeta;
|
||||
this.noteForm.key = this.$route.params.name;
|
||||
},
|
||||
mounted() {
|
||||
@@ -68,6 +68,21 @@
|
||||
</style>
|
||||
|
||||
<style>
|
||||
#qrUrl {
|
||||
color: #ed4014;
|
||||
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei";
|
||||
}
|
||||
|
||||
#qrUrl::selection {
|
||||
background-color: #ed4014;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#copyBtn {
|
||||
color: #ed4014;
|
||||
font-size:large;
|
||||
}
|
||||
|
||||
.ivu-btn-text:focus {
|
||||
margin-top: -3px;
|
||||
box-shadow: none !important;
|
||||
@@ -168,7 +183,7 @@
|
||||
<Button-group size="large">
|
||||
|
||||
<Button aria-label="share" type="error"
|
||||
style="margin-left:5px; border-radius: 0px;font-size: 23px; font-family: Arial, sans-serif"
|
||||
style="margin-left:5px; border-radius: 0px;font-size: 19px; font-family: Arial, sans-serif"
|
||||
@click="showShareModel()" icon="md-cloud-done">{{ state.ttlDesc }}</Button>
|
||||
|
||||
<Button aria-label="menu" type="error" style="margin-left:5px; border-radius: 0px;font-size: 24px;"
|
||||
@@ -236,23 +251,34 @@
|
||||
|
||||
</Layout>
|
||||
|
||||
<Modal v-model="model.showShare" width="330" footer-hide class-name="qrmodal" :styles="{ borderRadius: 0 }">
|
||||
<p style="text-align: center;">
|
||||
<canvas id="qrimg" class=""></canvas>
|
||||
<Modal v-model="model.showShare" width="360" footer-hide class-name="qrmodal" :styles="{ borderRadius: 0 }">
|
||||
<p style="text-align: center;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
left: 0px;
|
||||
width: 100%;">
|
||||
<Tag style="border-radius: 0px;" v-show="model.copyTip" color="#ed4014" text="">Url Copied.</Tag>
|
||||
</p>
|
||||
<p style="text-align: center;">
|
||||
<span id="tag-copy" class="noteUrl" :data-clipboard-text="noteForm.noteUrl" data-clipboard-action="copy">{{
|
||||
noteForm.noteUrl
|
||||
}}</span>
|
||||
<p style="text-align: center;margin-top:20px;line-height:100%">
|
||||
<span style="margin-right:3px;" id="copyBtn"><Icon type="md-copy" /></span><span id="qrUrl">{{ noteForm.noteUrl }}</span>
|
||||
</p>
|
||||
|
||||
<p style="text-align: center;margin-top:5px;">
|
||||
<canvas id="qrImg" class=""></canvas>
|
||||
</p>
|
||||
<p style="text-align: center;margin-top:10px;">
|
||||
<Button type="error" style="border-radius: 0px;font-size:19px;"
|
||||
@click="closeShareModel()">{{$t("button.close")}}</Button>
|
||||
</p>
|
||||
</Modal>
|
||||
|
||||
<Modal v-model="model.showDelete" width="330" footer-hide class-name="fnmodal" :styles="{ borderRadius: 0 }">
|
||||
<Modal v-model="model.showDelete" width="360" footer-hide class-name="fnmodal" :styles="{ borderRadius: 0 }">
|
||||
<p style="text-align: center;font-size:medium;margin-bottom: 20px;">
|
||||
{{ $t("message.askTodelete") }}
|
||||
</p>
|
||||
<p style="text-align: center;">
|
||||
<Button type="error" :loading="model.deleting" style="border-radius: 0px;" @click="dropNote()">{{
|
||||
<Button type="error" :loading="model.deleting" style="border-radius: 0px;font-size:19px;" @click="dropNote()">{{
|
||||
$t("button.yes")
|
||||
}}</Button>
|
||||
</p>
|
||||
@@ -308,6 +334,7 @@ export default {
|
||||
showShare: false,
|
||||
deleting: false,
|
||||
showDownloadText: false,
|
||||
copyTip: false,
|
||||
},
|
||||
toTopState: false,
|
||||
showMenuState: false,
|
||||
@@ -343,7 +370,6 @@ export default {
|
||||
this.secret.cipher = "00000000000000000000000000000000";//noteMeta.cipher; //读者有没有值可配置
|
||||
this.secret.md5 = noteMeta.md5;
|
||||
|
||||
|
||||
this.startClock();
|
||||
|
||||
storage.local.dynamicClear();
|
||||
@@ -360,7 +386,12 @@ export default {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
//this.bindCopyTextEvent();
|
||||
|
||||
let stateInfo = storage.session.getText(this.secret.storeKey + "_share");
|
||||
if (stateInfo == '1') {
|
||||
storage.session.setText(this.secret.storeKey + "_share", '0');
|
||||
this.showShareModel();
|
||||
}
|
||||
|
||||
const myObserver = new ResizeObserver(entries => {
|
||||
// iterate over the entries, do something.
|
||||
@@ -437,7 +468,7 @@ export default {
|
||||
},
|
||||
showShareModel() {
|
||||
this.model.showShare = true;
|
||||
let qrimg = document.getElementById("qrimg");
|
||||
let qrimg = document.getElementById("qrImg");
|
||||
let qrurl = "https://flagnote.com/" + this.noteForm.key;
|
||||
var opts = {
|
||||
errorCorrectionLevel: 'Q',
|
||||
@@ -452,6 +483,12 @@ export default {
|
||||
}
|
||||
}
|
||||
QRCode.toCanvas(qrimg, qrurl, opts)
|
||||
|
||||
storage.session.setText(this.secret.storeKey + "_share", '1');
|
||||
},
|
||||
closeShareModel() {
|
||||
this.model.showShare = false;
|
||||
storage.session.setText(this.secret.storeKey + "_share", '0');
|
||||
},
|
||||
showDeleteModel() {
|
||||
this.model.showDelete = true;
|
||||
@@ -537,9 +574,18 @@ export default {
|
||||
},
|
||||
bindCopyUrlEvent() {
|
||||
let that = this;
|
||||
var clipboard = new Clipboard("#tag-copy")
|
||||
var clipboard = new Clipboard("#copyBtn", {
|
||||
target: function () {
|
||||
return document.querySelector('#qrUrl');
|
||||
}
|
||||
})
|
||||
clipboard.on('success', function () {
|
||||
that.$Message.success({ content: 'url copied.' });
|
||||
that.model.copyTip = true;
|
||||
let tipTimer = setInterval(() => {
|
||||
that.model.copyTip = false;
|
||||
clearInterval(tipTimer);
|
||||
}, 1500);
|
||||
|
||||
});
|
||||
|
||||
clipboard.on('error', function () {
|
||||
|
||||
Reference in New Issue
Block a user