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