|
@@ -252,6 +252,7 @@ export const save = async (
|
|
|
// setDot(false);
|
|
|
dot.value = false;
|
|
|
localforage.removeItem(localMeta2dDataName);
|
|
|
+ return true;
|
|
|
};
|
|
|
const pen = ref(false);
|
|
|
const drawPen = () => {
|
|
@@ -310,8 +311,10 @@ export const showMap = () => {
|
|
|
|
|
|
export const title = "系统可能不会保存您所做的更改,是否继续?";
|
|
|
export const unLogin = "未登录,系统可能不会保存您的文件,是否继续?";
|
|
|
+export const unsave = "当前文件未保存,是否继续?(开通vip可享受自动保存服务)";
|
|
|
+
|
|
|
//未登录,当前文件可能不会保存
|
|
|
-// 当前文件未保存,请先手动保存!(开通vip可享受自动保存服务)
|
|
|
+//
|
|
|
export const newFile = async () => {
|
|
|
if (!(user && user.id)) {
|
|
|
if (await showNotification(unLogin)) {
|
|
@@ -319,8 +322,15 @@ export const newFile = async () => {
|
|
|
}
|
|
|
} else {
|
|
|
if (dot.value) {
|
|
|
- if (await showNotification(title)) {
|
|
|
- newfile(false);
|
|
|
+ if (!user.vipExpired) {
|
|
|
+ if (await save(SaveType.Save)) {
|
|
|
+ //TODO 保存报错了需要save吗
|
|
|
+ newfile(false);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (await showNotification(unsave)) {
|
|
|
+ newfile(false);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
newfile(false);
|
|
@@ -349,10 +359,9 @@ export const newfile = async (noRouter: boolean = false) => {
|
|
|
meta2d.map?.isShow && showMap();
|
|
|
// setDot(false);
|
|
|
dot.value = false;
|
|
|
- // await localforage.removeItem(localMeta2dDataName);
|
|
|
+ await localforage.removeItem(localMeta2dDataName);
|
|
|
// 打开文件操作不跳转
|
|
|
// const router = useRouter();
|
|
|
- console.log("router", router);
|
|
|
!noRouter &&
|
|
|
router.replace({
|
|
|
path: "/",
|