diff --git a/app/src/config/account.ts b/app/src/config/account.ts index b6c14eae5..2e01ddc29 100644 --- a/app/src/config/account.ts +++ b/app/src/config/account.ts @@ -31,13 +31,13 @@ export const account = { element: undefined as Element, genHTML: (onlyPayHTML = false) => { const isIOS = isInIOS(); - let payHTML + let payHTML; if (isIOS) { // 已付费 if (window.siyuan.user?.userSiYuanOneTimePayStatus === 1) { payHTML = `` +`; } else { payHTML = `` +`; } } else { payHTML = ` ${window.siyuan.languages[window.siyuan.user?.userSiYuanOneTimePayStatus === 1 ? "account4" : "account1"]} -` +`; } payHTML += `
@@ -253,12 +253,12 @@ ${renewHTML} return; } window.siyuan.user = response.data; - const productType = item.getAttribute("data-type") - let productID + const productType = item.getAttribute("data-type"); + let productID; if (window.siyuan.config.cloudRegion === 0) { - productID = productType === "function" ? "0" : "1" + productID = productType === "function" ? "0" : "1"; } else { - productID = productType === "function" ? "2" : "3" + productID = productType === "function" ? "2" : "3"; } window.webkit.messageHandlers.purchase.postMessage(`${productID} ${genUUID().substring(0, 19)}${window.siyuan.config.cloudRegion}00${window.siyuan.user.userId.substring(0, 1)}-${window.siyuan.user.userId.substring(1)}`); }); diff --git a/app/src/mobile/settings/account.ts b/app/src/mobile/settings/account.ts index ebd3a92b3..6e492c737 100644 --- a/app/src/mobile/settings/account.ts +++ b/app/src/mobile/settings/account.ts @@ -1,5 +1,5 @@ import {openModel} from "../menu/model"; -import {isInIOS, isIPhone} from "../../protyle/util/compatibility"; +import {isInIOS} from "../../protyle/util/compatibility"; import {fetchPost} from "../../util/fetch"; import {closePanel} from "../util/closePanel"; import {processSync} from "../../dialog/processSystem"; @@ -20,7 +20,7 @@ export const showAccountInfo = () => { if (window.siyuan.user?.userSiYuanOneTimePayStatus === 1) { payHTML = `` +`; } else { payHTML = `` +`; } } else { payHTML = ` ${window.siyuan.languages[window.siyuan.user?.userSiYuanOneTimePayStatus === 1 ? "account4" : "account1"]} -` +`; } payHTML += `
@@ -125,7 +125,7 @@ ${renewHTML}`; modelMainElement.addEventListener("click", (event) => { let target = event.target as HTMLElement; if (typeof event.detail !== "number") { - target = event.detail + target = event.detail; } while (target && !target.isSameNode(modelMainElement)) { if (target.getAttribute("data-action") === "iOSPay") { @@ -142,12 +142,12 @@ ${renewHTML}`; return; } window.siyuan.user = response.data; - const productType = target.getAttribute("data-type") - let productID + const productType = target.getAttribute("data-type"); + let productID; if (window.siyuan.config.cloudRegion === 0) { - productID = productType === "function" ? "0" : "1" + productID = productType === "function" ? "0" : "1"; } else { - productID = productType === "function" ? "2" : "3" + productID = productType === "function" ? "2" : "3"; } window.webkit.messageHandlers.purchase.postMessage(`${productID} ${genUUID().substring(0, 19)}${window.siyuan.config.cloudRegion}00${window.siyuan.user.userId.substring(0, 1)}-${window.siyuan.user.userId.substring(1)}`); }); @@ -155,7 +155,7 @@ ${renewHTML}`; showMessage(window.siyuan.languages.needLogin); } event.preventDefault(); - event.stopPropagation() + event.stopPropagation(); break; } else if (target.id === "logout") { fetchPost("/api/setting/logoutCloudUser", {}, () => { @@ -164,8 +164,8 @@ ${renewHTML}`; document.getElementById("menuAccount").innerHTML = `${window.siyuan.languages.login}`; processSync(); }); - event.preventDefault() - event.stopPropagation() + event.preventDefault(); + event.stopPropagation(); break; } else if (target.id === "deactivateUser") { const dialog = new Dialog({ @@ -175,8 +175,8 @@ ${renewHTML}`; }); bindLoginEvent(dialog.element.querySelector(".b3-dialog__body"), true); dialog.element.setAttribute("data-key", Constants.DIALOG_DEACTIVATEUSER); - event.preventDefault() - event.stopPropagation() + event.preventDefault(); + event.stopPropagation(); break; } else if (target.id === "trialSub") { fetchPost("/api/account/startFreeTrial", {}, () => { @@ -184,8 +184,8 @@ ${renewHTML}`; detail: modelMainElement.querySelector("#refresh") })); }); - event.preventDefault() - event.stopPropagation() + event.preventDefault(); + event.stopPropagation(); break; } else if (target.id === "refresh") { const svgElement = target.firstElementChild; @@ -207,13 +207,13 @@ ${renewHTML}`; } processSync(); }); - event.preventDefault() - event.stopPropagation() + event.preventDefault(); + event.stopPropagation(); break; } target = target.parentElement; } - }) + }); } }); }; diff --git a/app/src/util/iOSPurchase.ts b/app/src/util/iOSPurchase.ts index 52179996f..2c8318ace 100644 --- a/app/src/util/iOSPurchase.ts +++ b/app/src/util/iOSPurchase.ts @@ -1,4 +1,4 @@ -export const IOSPurchase = (data:string) => { +export const IOSPurchase = (data: string) => { /// #if MOBILE document.querySelector("#modelMain").dispatchEvent(new CustomEvent("click", { detail: document.querySelector("#modelMain #refresh") @@ -6,4 +6,4 @@ export const IOSPurchase = (data:string) => { /// #else document.querySelector('.config__tab-container[data-name="account"] #refresh').dispatchEvent(new Event("click")); /// #endif -} +};