Ver código fonte

1、blockly编程配置加入标记类型方格

liyanbo 4 meses atrás
pai
commit
6bb971c7bc

+ 0 - 2
src/types/auto-imports.d.ts

@@ -7,8 +7,6 @@ export {}
 declare global {
   const DICT_TYPE: typeof import('@/utils/dict')['DICT_TYPE']
   const EffectScope: typeof import('vue')['EffectScope']
-  const ElMessage: typeof import('element-plus/es')['ElMessage']
-  const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
   const computed: typeof import('vue')['computed']
   const createApp: typeof import('vue')['createApp']
   const customRef: typeof import('vue')['customRef']

+ 2 - 1
src/utils/dict.ts

@@ -262,5 +262,6 @@ export enum DICT_TYPE {
   AI_BLOCKLY_MAP_TYPE = 'ai_blockly_map_type', // 地图类型
   BLOCKLY_COURSE_LABEL = 'blockly_course_label', // 课程标签
   BLOCKLY_COURSE_COUTNET_TYPE = 'blockly_course_content_type', // 课程内容类型
-  BLOCKLY_MAP_SPECIAL = 'blockly_map_special' // 地图特殊方块类型
+  BLOCKLY_MAP_SPECIAL = 'blockly_map_special', // 地图特殊方块类型
+  BLOCKLY_MAP_MARK = 'blockly_map_mark', // 地图标记标签
 }

+ 33 - 9
src/views/blockly/blockly/BlocklyForm.vue

@@ -357,7 +357,7 @@
                     <!-- 第二行:地图类型 -->
                     <div class="config-row" style="display: flex; flex-wrap: wrap; gap: 20px;">
                       <el-form-item label="地图类型" class="config-item"
-                        :style="(selectedBlocklyPoint.type === 'task' || selectedBlocklyPoint.type === 'item') ? 'width: calc(50% - 20px);' : 'width: 100%;'">
+                        :style="(selectedBlocklyPoint.type === 'task' || selectedBlocklyPoint.type === 'item' || selectedBlocklyPoint.type === 'mark') ? 'width: calc(50% - 20px);' : 'width: 100%;'">
                         <el-select
                           v-model="selectedBlocklyPoint.type"
                           placeholder="选择地图类型"
@@ -388,18 +388,39 @@
                         />
                       </el-form-item>
                       <el-form-item
-                        label="限制通行"
-                        class="config-item"
-                        v-if="selectedBlocklyPoint.type === 'task'"
-                        style="width: calc(50% - 20px);"
+                          label="限制通行"
+                          class="config-item"
+                          v-if="selectedBlocklyPoint.type === 'task'"
+                          style="width: calc(50% - 20px);"
                       >
                         <el-switch
-                          v-model="selectedBlocklyPoint.noPassing"
-                          active-text="是"
-                          inactive-text="否"
-                          size="large"
+                            v-model="selectedBlocklyPoint.noPassing"
+                            active-text="是"
+                            inactive-text="否"
+                            size="large"
                         />
                       </el-form-item>
+
+                      <el-form-item
+                          label="标记标签"
+                          class="config-item"
+                          v-if="selectedBlocklyPoint.type === 'mark'"
+                          style="width: calc(50% - 20px);"
+                      >
+                        <el-select
+                            v-model="selectedBlocklyPoint.mark"
+                            placeholder="标记标签"
+                            clearable
+                            size="large"
+                        >
+                          <el-option
+                              v-for="dict in getStrDictOptions(DICT_TYPE.BLOCKLY_MAP_MARK)"
+                              :key="dict.value"
+                              :label="dict.label"
+                              :value="dict.value"
+                          />
+                        </el-select>
+                      </el-form-item>
                     </div>
 
                     <!-- 第三行:图标上传 -->
@@ -565,6 +586,7 @@ interface BlocklyWalkablePoint {
   walkable: boolean
   type: string
   must: boolean
+  mark: String
   noPassing: boolean
   img: string
   endImg: string
@@ -696,6 +718,7 @@ const selectBlocklyCell = (cell: { x: number, y: number }) => {
       walkable: false,
       type: '',
       must: false,
+      mark: '',
       noPassing: false,
       img: '',
       endImg: '',
@@ -826,6 +849,7 @@ const open = async (type: string, id?: number) => {
             walkable: true,
             type: p.type || '',
             must: p.must || false,
+            mark: p.mark || '',
             noPassing: p.noPassing || false,
             img: p.img || '',
             endImg: p.endImg || '',