redirect done
This commit is contained in:
@@ -4,7 +4,7 @@ import EditNote from "@/views/EditNote.vue";
|
||||
import ViewNote from "@/views/ViewNote.vue";
|
||||
import ErrorRoute from "@/views/ErrorRoute.vue";
|
||||
import ErrorNote from "@/views/ErrorNote.vue";
|
||||
import { getKeyMeta, getNoteMeta } from "@/api/note";
|
||||
import { getNoteMeta } from "@/api/note";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
import storage from "@/libs/storage";
|
||||
|
||||
@@ -35,6 +35,7 @@ function getNoteView() {
|
||||
|
||||
let key = path.substring(1, path.length);
|
||||
|
||||
keyMeta = storage.session.getObject(key+".keyMeta");
|
||||
if (keyMeta && keyMeta.key) {
|
||||
key = keyMeta.key;
|
||||
}
|
||||
@@ -107,30 +108,7 @@ function getNoteView() {
|
||||
return ErrorNote;
|
||||
}
|
||||
|
||||
function getHomeRedirect() {
|
||||
let path = location.pathname;
|
||||
if (path != "/") {
|
||||
return;
|
||||
}
|
||||
|
||||
//setKeyMeta
|
||||
keyMeta = getKeyMeta();
|
||||
|
||||
// server error
|
||||
if (!keyMeta) {
|
||||
errorMeta = 100006;
|
||||
return "/error_"+errorMeta;
|
||||
}
|
||||
|
||||
return "/" + keyMeta.key;
|
||||
}
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
redirect: getHomeRedirect(),
|
||||
},
|
||||
{ path: "/error_:code([0-9]{6})", component: ErrorNote },
|
||||
{
|
||||
path: "/:name([a-z0-9]{10,20})",
|
||||
|
||||
@@ -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: 21px;" @click="submitNote()"
|
||||
icon="md-share"></Button>
|
||||
icon="md-cloud-upload"></Button>
|
||||
<Button aria-label="menu" type="error" style="margin-left:3px; border-radius: 0px;font-size: 24px;"
|
||||
@click="switchMenu()" @blur.native="hideMenu()" icon="md-menu"></Button>
|
||||
|
||||
@@ -247,10 +247,10 @@ export default {
|
||||
let keyMeta = this.$route.meta.keyMeta;
|
||||
|
||||
//ipad chrome url not redirect
|
||||
let path = location.pathname;
|
||||
if ("/" == path) {
|
||||
history.pushState('', '', '/' + this.noteForm.key);
|
||||
}
|
||||
// let path = location.pathname;
|
||||
// if ("/" == path) {
|
||||
// history.pushState('', '', '/' + this.noteForm.key);
|
||||
// }
|
||||
|
||||
//wx does not show downloadText
|
||||
this.model.showDownloadText = !isWeixin();
|
||||
@@ -276,6 +276,7 @@ export default {
|
||||
// }
|
||||
|
||||
storage.local.setText(storeKey, "0|" + this.secret.cipher + "|0|" + this.state.initTime + "|");
|
||||
storage.session.delete(keyMeta.key+".keyMeta");
|
||||
} else {
|
||||
// second edit
|
||||
let noteMeta = this.$route.meta.noteMeta;
|
||||
|
||||
Reference in New Issue
Block a user