From 80ca74e477fb6f082d6d855dd3f6513d03da1a36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com>
Date: Tue, 22 Apr 2025 11:47:58 +0800
Subject: [PATCH] =?UTF-8?q?Demo=EF=BC=9A=E9=83=A8=E5=88=86=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E8=BD=AC=E4=B8=BA=E7=BD=91=E9=A1=B5=E7=89=88=E8=AF=95?=
=?UTF-8?q?=E7=94=A8=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/src/lang/en_us.js | 10 ++-
web/src/lang/vi_vn.js | 12 ++-
web/src/lang/zh_cn.js | 9 ++-
web/src/lang/zh_tw.js | 9 ++-
web/src/pages/Edit/components/Contextmenu.vue | 8 +-
web/src/pages/Edit/components/Edit.vue | 75 +++++++++++++++++++
web/src/pages/Edit/components/Export.vue | 7 +-
web/src/pages/Edit/components/Import.vue | 3 +-
.../Edit/components/NavigatorToolbar.vue | 10 ++-
.../Edit/components/NodeAnnotationBtn.vue | 2 +-
web/src/pages/Edit/components/Setting.vue | 11 ++-
web/src/utils/index.js | 10 +++
12 files changed, 144 insertions(+), 22 deletions(-)
diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js
index e3e1aa3b..bcbc994c 100644
--- a/web/src/lang/en_us.js
+++ b/web/src/lang/en_us.js
@@ -215,7 +215,8 @@ export default {
ai: 'AI dialogue',
downloadClient: 'Download client',
site: 'Official website',
- current: 'Current:'
+ current: 'Current:',
+ downloadDesc: 'You can download it from the following address:'
},
nodeHyperlink: {
title: 'Link',
@@ -369,7 +370,12 @@ export default {
'Detected imported rich text content, automatically enabled rich text mode',
localStorageExceededTip:
'The volume of the mind map you created has exceeded the maximum storage limit allowed by the browser. Please export it immediately, otherwise the data will be lost! It is recommended to download the client for use, as there is no size limit for the client.',
- withBg: 'With background image'
+ withBg: 'With background image',
+ tryTipTitle: 'Function trial prompt',
+ tryTipDesc:
+ 'This feature is a trial feature in the web version. Please download the client to use it:',
+ downBaidu: 'Go to Baidu Netdisk to download',
+ downGithub: 'Download from Github'
},
mouseAction: {
tip1:
diff --git a/web/src/lang/vi_vn.js b/web/src/lang/vi_vn.js
index acb1d352..1cc0c382 100644
--- a/web/src/lang/vi_vn.js
+++ b/web/src/lang/vi_vn.js
@@ -214,7 +214,8 @@ export default {
ai: 'Đối thoại AI',
downloadClient: 'Tải về khách hàng',
site: 'Trang web chính thức',
- current: 'Hiện tại:'
+ current: 'Hiện tại:',
+ downloadDesc: 'Có thể download từ địa chỉ sau:'
},
nodeHyperlink: {
title: 'Liên kết',
@@ -367,7 +368,12 @@ export default {
'Phát hiện nội dung văn bản phong phú nhập vào, tự động bật chế độ văn bản phong phú',
localStorageExceededTip:
'Dung lượng sơ đồ tư duy bạn tạo đã vượt quá giới hạn lưu trữ tối đa cho phép của trình duyệt. Vui lòng xuất ngay lập tức, nếu không dữ liệu sẽ bị mất! Nên tải xuống ứng dụng khách để sử dụng, vì không có giới hạn kích thước khi sử dụng ứng dụng khách.',
- withBg: 'Với Background'
+ withBg: 'Với Background',
+ tryTipTitle: 'Mẹo dùng thử chức năng',
+ tryTipDesc:
+ 'Chức năng này là chức năng dùng thử trong phiên bản web, xin vui lòng tải xuống để khách hàng sử dụng:',
+ downBaidu: 'Tải xuống Baidu',
+ downGithub: 'Tải xuống Github'
},
mouseAction: {
tip1:
@@ -536,4 +542,4 @@ export default {
tip4: 'Xóa thành công',
tip5: 'Nút liên kết không tồn tại. Có nên xóa liên kết không?'
}
-}
\ No newline at end of file
+}
diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js
index 161c99e7..3de67001 100644
--- a/web/src/lang/zh_cn.js
+++ b/web/src/lang/zh_cn.js
@@ -209,7 +209,8 @@ export default {
ai: 'AI对话',
downloadClient: '下载客户端',
site: '官方网站',
- current: '当前:'
+ current: '当前:',
+ downloadDesc: '可从如下地址下载:'
},
nodeHyperlink: {
title: '超链接',
@@ -358,7 +359,11 @@ export default {
autoOpenNodeRichTextTip: '检测到导入了富文本内容,已自动开启富文本模式',
localStorageExceededTip:
'你创建的思维导图体积已经超过浏览器允许存储的上限,请立即导出,否则数据将丢失!建议下载客户端进行使用,客户端无大小限制。',
- withBg: '带背景'
+ withBg: '带背景',
+ tryTipTitle: '功能试用提示',
+ tryTipDesc: '该功能在网页版中为试用功能,请下载客户端使用:',
+ downBaidu: '去百度网盘下载',
+ downGithub: '去Github下载'
},
mouseAction: {
tip1: '当前:左键拖动画布,右键框选节点',
diff --git a/web/src/lang/zh_tw.js b/web/src/lang/zh_tw.js
index bf88a91a..6536766c 100644
--- a/web/src/lang/zh_tw.js
+++ b/web/src/lang/zh_tw.js
@@ -211,7 +211,7 @@ export default {
downloadClient: '下載客戶端',
site: '官方網站',
current: '當前:',
- withBg: '帶背景'
+ downloadDesc: '可從如下地址下載:'
},
nodeHyperlink: {
title: '超連結',
@@ -358,7 +358,12 @@ export default {
dragTip: '在此釋放以匯入檔案',
autoOpenNodeRichTextTip: '檢測到導入了富文本內容,已自動開啓富文本模式',
localStorageExceededTip:
- '你創建的思維導圖體積已經超過浏覽器允許存儲的上限,請立即導出,否則數據將丟失!建議下載客戶端進行使用,客戶端無大小限制。'
+ '你創建的思維導圖體積已經超過浏覽器允許存儲的上限,請立即導出,否則數據將丟失!建議下載客戶端進行使用,客戶端無大小限制。',
+ withBg: '帶背景',
+ tryTipTitle: '功能試用提示',
+ tryTipDesc: '該功能在網頁版中為試用功能,請下載用戶端使用:',
+ downBaidu: '去百度網盤下載',
+ downGithub: '去Github下載'
},
mouseAction: {
tip1: '目前:左鍵拖曳畫布,右鍵框選節點',
diff --git a/web/src/pages/Edit/components/Contextmenu.vue b/web/src/pages/Edit/components/Contextmenu.vue
index bab20dd7..5b98ac82 100644
--- a/web/src/pages/Edit/components/Contextmenu.vue
+++ b/web/src/pages/Edit/components/Contextmenu.vue
@@ -62,7 +62,7 @@
{{ $t('contextmenu.expandNodeChild') }}
-
+
{{ $t('contextmenu.number') }}
-
+
{{
hasCheckbox ? $t('contextmenu.removeToDo') : $t('contextmenu.addToDo')
}}
@@ -134,14 +134,14 @@
{{ $t('contextmenu.removeNote') }}
-
+
{{
hasNodeLink
? $t('contextmenu.modifyNodeLink')
: $t('contextmenu.linkToNode')
}}
-
+
{{ $t('contextmenu.removeNodeLink') }}
diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue
index ce136a2d..1cfe5cb1 100644
--- a/web/src/pages/Edit/components/Edit.vue
+++ b/web/src/pages/Edit/components/Edit.vue
@@ -141,6 +141,7 @@ import NodeIconToolbar from './NodeIconToolbar.vue'
import OutlineEdit from './OutlineEdit.vue'
import { showLoading, hideLoading } from '@/utils/loading'
import handleClipboardText from '@/utils/handleClipboardText'
+import { getParentWithClass } from '@/utils'
import Scrollbar from './Scrollbar.vue'
import exampleData from 'simple-mind-map/example/exampleData'
import FormulaSidebar from './FormulaSidebar.vue'
@@ -294,6 +295,9 @@ export default {
this.$bus.$on('showLoading', this.handleShowLoading)
this.$bus.$on('localStorageExceeded', this.onLocalStorageExceeded)
window.addEventListener('resize', this.handleResize)
+ document.body.addEventListener('click', this.onVipCheckClick)
+ this.$bus.$on('showDownloadTip', this.showDownloadTip)
+ this.$bus.$on('vipCheckClick', this.onVipCheckClick)
},
beforeDestroy() {
this.$bus.$off('execCommand', this.execCommand)
@@ -308,6 +312,9 @@ export default {
this.$bus.$off('showLoading', this.handleShowLoading)
this.$bus.$off('localStorageExceeded', this.onLocalStorageExceeded)
window.removeEventListener('resize', this.handleResize)
+ document.body.removeEventListener('click', this.onVipCheckClick)
+ this.$bus.$off('showDownloadTip', this.showDownloadTip)
+ this.$bus.$off('vipCheckClick', this.onVipCheckClick)
this.mindMap.destroy()
},
methods: {
@@ -1025,6 +1032,74 @@ export default {
const file = dt.files && dt.files[0]
if (!file) return
this.$bus.$emit('importFile', file)
+ },
+
+ // 网页版功能试用提示
+ onVipCheckClick(e) {
+ const el = getParentWithClass(e.target, 'vip')
+ if (el) {
+ const className = el.classList.value.split(/\s+/).join('_')
+ const storageKey = 'VIP_USAGE_TIP'
+ let data = localStorage.getItem(storageKey)
+ if (data) {
+ data = JSON.parse(data)
+ } else {
+ data = {}
+ }
+ if (!data[className]) {
+ data[className] = 0
+ }
+ data[className]++
+ if (data[className] > 3) {
+ this.showDownloadTip(
+ this.$t('edit.tryTipTitle'),
+ this.$t('edit.tryTipDesc')
+ )
+ }
+ localStorage.setItem(storageKey, JSON.stringify(data))
+ }
+ },
+
+ showDownloadTip(title, desc) {
+ const h = this.$createElement
+ this.$msgbox({
+ title,
+ message: h('div', null, [
+ h('p', null, desc),
+ h('div', null, [
+ h(
+ 'a',
+ {
+ attrs: {
+ href:
+ 'https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3',
+ target: '_blank'
+ },
+ style: {
+ color: '#409eff',
+ marginRight: '12px'
+ }
+ },
+ this.$t('edit.downBaidu')
+ ),
+ h(
+ 'a',
+ {
+ attrs: {
+ href: 'https://github.com/wanglin2/mind-map/releases',
+ target: '_blank'
+ },
+ style: {
+ color: '#409eff'
+ }
+ },
+ this.$t('edit.downGithub')
+ )
+ ])
+ ]),
+ showCancelButton: false,
+ showConfirmButton: false
+ })
}
}
}
diff --git a/web/src/pages/Edit/components/Export.vue b/web/src/pages/Edit/components/Export.vue
index 0b19bc73..bc8e5740 100644
--- a/web/src/pages/Edit/components/Export.vue
+++ b/web/src/pages/Edit/components/Export.vue
@@ -20,7 +20,10 @@
class="downloadTypeItem"
v-for="item in downTypeList"
:key="item.type"
- :class="{ active: exportType === item.type }"
+ :class="{
+ active: exportType === item.type,
+ vip: ['mm', 'xlsx'].includes(item.type)
+ }"
@click="exportType = item.type"
>
@@ -77,7 +80,7 @@
{{ $t('export.format') }}
PNG
- JPG
+ JPG
diff --git a/web/src/pages/Edit/components/Import.vue b/web/src/pages/Edit/components/Import.vue
index 1ac0a2c4..e5636124 100644
--- a/web/src/pages/Edit/components/Import.vue
+++ b/web/src/pages/Edit/components/Import.vue
@@ -25,6 +25,7 @@
size="small"
style="margin-left: 10px;"
@click="mdImportDialogVisible = true"
+ class="vip"
>{{ $t('import.mdImportDialogTitle') }}
@@ -33,7 +34,7 @@
diff --git a/web/src/pages/Edit/components/NavigatorToolbar.vue b/web/src/pages/Edit/components/NavigatorToolbar.vue
index 221888a6..f6d1991d 100644
--- a/web/src/pages/Edit/components/NavigatorToolbar.vue
+++ b/web/src/pages/Edit/components/NavigatorToolbar.vue
@@ -209,6 +209,13 @@ export default {
} else if (command === 'aiChat') {
this.setActiveSidebar('ai')
return
+ } else if (command === 'client') {
+ this.$bus.$emit(
+ 'showDownloadTip',
+ this.$t('navigatorToolbar.downloadClient'),
+ this.$t('navigatorToolbar.downloadDesc')
+ )
+ return
}
let url = ''
switch (command) {
@@ -228,8 +235,7 @@ export default {
case 'issue':
url = 'https://github.com/wanglin2/mind-map/issues/new'
break
- case 'client':
- url = 'https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3'
+
default:
break
}
diff --git a/web/src/pages/Edit/components/NodeAnnotationBtn.vue b/web/src/pages/Edit/components/NodeAnnotationBtn.vue
index 72d2f8c5..aeac61eb 100644
--- a/web/src/pages/Edit/components/NodeAnnotationBtn.vue
+++ b/web/src/pages/Edit/components/NodeAnnotationBtn.vue
@@ -89,7 +89,7 @@
-
+
-
+
-
+
{
document.body.removeChild(iframe)
}, 500)
}
+
+export const getParentWithClass = (el, className) => {
+ if (el.classList.contains(className)) {
+ return el
+ }
+ if (el.parentNode && el.parentNode !== document.body) {
+ return getParentWithClass(el.parentNode, className)
+ }
+ return null
+}
\ No newline at end of file