mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 14:04:47 +08:00
Demo:ai能力默认关闭
This commit is contained in:
@@ -140,8 +140,8 @@
|
||||
<div class="item" @click="exec('EXPORT_CUR_NODE_TO_PNG')">
|
||||
<span class="name">{{ $t('contextmenu.exportNodeToPng') }}</span>
|
||||
</div>
|
||||
<div class="splitLine"></div>
|
||||
<div class="item" @click="aiCreate">
|
||||
<div class="splitLine" v-if="enableAi"></div>
|
||||
<div class="item" @click="aiCreate" v-if="enableAi">
|
||||
<span class="name">{{ $t('contextmenu.aiCreate') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -257,7 +257,8 @@ export default {
|
||||
isZenMode: state => state.localConfig.isZenMode,
|
||||
isDark: state => state.localConfig.isDark,
|
||||
supportNumbers: state => state.supportNumbers,
|
||||
supportCheckbox: state => state.supportCheckbox
|
||||
supportCheckbox: state => state.supportCheckbox,
|
||||
enableAi: state => state.enableAi
|
||||
}),
|
||||
expandList() {
|
||||
return [
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
v-if="mindMap"
|
||||
:mindMap="mindMap"
|
||||
></NodeImgPlacementToolbar>
|
||||
<AiCreate v-if="mindMap" :mindMap="mindMap"></AiCreate>
|
||||
<AiChat></AiChat>
|
||||
<AiCreate v-if="mindMap && enableAi" :mindMap="mindMap"></AiCreate>
|
||||
<AiChat v-if="enableAi"></AiChat>
|
||||
<div
|
||||
class="dragMask"
|
||||
v-if="showDragMask"
|
||||
@@ -111,7 +111,7 @@ import { getData, storeData, storeConfig } from '@/api'
|
||||
import Navigator from './Navigator.vue'
|
||||
import NodeImgPreview from './NodeImgPreview.vue'
|
||||
import SidebarTrigger from './SidebarTrigger.vue'
|
||||
import { mapState } from 'vuex'
|
||||
import { mapMutations, mapState } from 'vuex'
|
||||
import icon from '@/config/icon'
|
||||
import CustomNodeContent from './CustomNodeContent.vue'
|
||||
import Color from './Color.vue'
|
||||
@@ -217,7 +217,8 @@ export default {
|
||||
state.localConfig.isUseHandDrawnLikeStyle,
|
||||
isUseMomentum: state => state.localConfig.isUseMomentum,
|
||||
extraTextOnExport: state => state.extraTextOnExport,
|
||||
isDragOutlineTreeNode: state => state.isDragOutlineTreeNode
|
||||
isDragOutlineTreeNode: state => state.isDragOutlineTreeNode,
|
||||
enableAi: state => state.enableAi
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
@@ -250,6 +251,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query && this.$route.query.ai) {
|
||||
this.setEnableAi(true)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
showLoading()
|
||||
// this.showNewFeatureInfo()
|
||||
@@ -282,6 +288,8 @@ export default {
|
||||
this.mindMap.destroy()
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['setEnableAi']),
|
||||
|
||||
handleStartTextEdit() {
|
||||
this.mindMap.renderer.startTextEdit()
|
||||
},
|
||||
|
||||
@@ -44,7 +44,8 @@ export default {
|
||||
...mapState({
|
||||
isDark: state => state.localConfig.isDark,
|
||||
activeSidebar: state => state.activeSidebar,
|
||||
isReadonly: state => state.isReadonly
|
||||
isReadonly: state => state.isReadonly,
|
||||
enableAi: state => state.enableAi
|
||||
}),
|
||||
|
||||
triggerList() {
|
||||
@@ -54,6 +55,11 @@ export default {
|
||||
return ['outline', 'shortcutKey'].includes(item.value)
|
||||
})
|
||||
}
|
||||
if (!this.enableAi) {
|
||||
list = list.filter(item => {
|
||||
return item.value !== 'ai'
|
||||
})
|
||||
}
|
||||
return list
|
||||
}
|
||||
},
|
||||
|
||||
@@ -163,6 +163,27 @@ import { throttle, isMobile } from 'simple-mind-map/src/utils/index'
|
||||
* @Desc: 工具栏
|
||||
*/
|
||||
let fileHandle = null
|
||||
const defaultBtnList = [
|
||||
'back',
|
||||
'forward',
|
||||
'painter',
|
||||
'siblingNode',
|
||||
'childNode',
|
||||
'deleteNode',
|
||||
'image',
|
||||
'icon',
|
||||
'link',
|
||||
'note',
|
||||
'tag',
|
||||
'summary',
|
||||
'associativeLine',
|
||||
'formula',
|
||||
// 'attachment',
|
||||
'outerFrame',
|
||||
'annotation',
|
||||
'ai'
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'Toolbar',
|
||||
components: {
|
||||
@@ -178,26 +199,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isMobile: isMobile(),
|
||||
list: [
|
||||
'back',
|
||||
'forward',
|
||||
'painter',
|
||||
'siblingNode',
|
||||
'childNode',
|
||||
'deleteNode',
|
||||
'image',
|
||||
'icon',
|
||||
'link',
|
||||
'note',
|
||||
'tag',
|
||||
'summary',
|
||||
'associativeLine',
|
||||
'formula',
|
||||
// 'attachment',
|
||||
'outerFrame',
|
||||
'annotation',
|
||||
'ai'
|
||||
],
|
||||
horizontalList: [],
|
||||
verticalList: [],
|
||||
showMoreBtn: true,
|
||||
@@ -217,8 +218,24 @@ export default {
|
||||
...mapState({
|
||||
isDark: state => state.localConfig.isDark,
|
||||
isHandleLocalFile: state => state.isHandleLocalFile,
|
||||
openNodeRichText: state => state.localConfig.openNodeRichText
|
||||
})
|
||||
openNodeRichText: state => state.localConfig.openNodeRichText,
|
||||
enableAi: state => state.enableAi
|
||||
}),
|
||||
|
||||
btnLit() {
|
||||
let res = [...defaultBtnList]
|
||||
if (!this.openNodeRichText) {
|
||||
res = res.filter(item => {
|
||||
return item !== 'formula'
|
||||
})
|
||||
}
|
||||
if (!this.enableAi) {
|
||||
res = res.filter(item => {
|
||||
return item !== 'ai'
|
||||
})
|
||||
}
|
||||
return res
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isHandleLocalFile(val) {
|
||||
@@ -226,21 +243,9 @@ export default {
|
||||
Notification.closeAll()
|
||||
}
|
||||
},
|
||||
openNodeRichText: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
const index = this.list.findIndex(item => {
|
||||
return item === 'formula'
|
||||
})
|
||||
if (val) {
|
||||
if (index === -1) {
|
||||
this.list.splice(13, 0, 'formula')
|
||||
}
|
||||
} else {
|
||||
if (index !== -1) {
|
||||
this.list.splice(index, 1)
|
||||
}
|
||||
}
|
||||
btnLit: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.computeToolbarShow()
|
||||
}
|
||||
}
|
||||
@@ -268,7 +273,7 @@ export default {
|
||||
computeToolbarShow() {
|
||||
if (!this.$refs.toolbarRef) return
|
||||
const windowWidth = window.innerWidth - 40
|
||||
const all = [...this.list]
|
||||
const all = [...this.btnLit]
|
||||
let index = 1
|
||||
const loopCheck = () => {
|
||||
if (index > all.length) return done()
|
||||
|
||||
@@ -45,7 +45,8 @@ const store = new Vuex.Store({
|
||||
model: '',
|
||||
port: 3456,
|
||||
method: 'POST'
|
||||
}
|
||||
},
|
||||
enableAi: false // 是否开启AI功能
|
||||
},
|
||||
mutations: {
|
||||
// 设置思维导图数据
|
||||
@@ -142,6 +143,11 @@ const store = new Vuex.Store({
|
||||
// 设置树节点拖拽
|
||||
setIsDragOutlineTreeNode(state, data) {
|
||||
state.isDragOutlineTreeNode = data
|
||||
},
|
||||
|
||||
// 设置是否启用AI功能
|
||||
setEnableAi(state, data) {
|
||||
state.enableAi = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
Reference in New Issue
Block a user