yangyin
2024-07-07 68e9ca0b9076a0fe14474cc71b6dc2c420fc5e7f
feat: 新增指令使用模板可以弹窗
已修改2个文件
55 ■■■■ 文件已修改
src/views/project/ch/home/component/waterRight/bottom.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/ch/home/component/waterRight/center.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/ch/home/component/waterRight/bottom.vue
@@ -14,7 +14,7 @@
            </div>
        </div>
        <div class="main">
        <div class="main" v-show="state.applicationScenarios && state.applicationScenarios.length <= 3">
            <div
                class="main_item flex cursor-pointer"
                v-for="item in state.applicationScenarios"
@@ -30,8 +30,23 @@
                </div>
            </div>
        </div>
        <div class="set-page">
            <el-pagination size="small" background layout="prev, pager, next" class="mt-4" />
        <div class="main" v-show="state.applicationScenarios && state.applicationScenarios.length > 3">
            <div
                class="main_item flex cursor-pointer"
                v-for="item in state.applicationScenarios"
                :key="item.section_id"
                :class="{ main_item_active: item.section_id === activeSectionAId }"
                @click="changeScenarios(item)"
            >
                <div :class="['iconfont icon-' + item.Icon]"></div>
                <div class="right">
                    <h4>{{ item.section_name }}</h4>
                    <p>{{ item.section_title }}</p>
                </div>
                <el-carousel height="10px">
                    <el-carousel-item v-for="group in groupedArray" :key="group">{{ group }} </el-carousel-item>
                </el-carousel>
            </div>
        </div>
    </div>
</template>
@@ -55,14 +70,12 @@
    const iconList = ['biaodan', 'putong', 'zhongduancanshuchaxun', 'shidu'];
    res.sections.forEach((sectionItem, index) => {
        sectionItem.Icon = iconList[index];
        if (index < 4) {
            result.push(sectionItem);
        }
        // if (index < 4) {
        //     result.push(sectionItem);
        // }
    });
    state.applicationScenarios = result;
    state.applicationScenarios = res.sections;
    res.sections?.[0] && changeScenarios(res.sections[0]);
    // state.scenariosIds = result.map((item) => item.section_id);
};
const groupedArray = computed(() => {
    const groups = [];
@@ -70,6 +83,7 @@
    while (state.applicationScenarios.length > i) {
        groups.push(state.applicationScenarios.slice(i, (i += 4)));
    }
    console.log(groups, 86);
    return groups;
});
const nextPage = () => {
src/views/project/ch/home/component/waterRight/center.vue
@@ -145,6 +145,15 @@
                </div>
            </el-drawer>
        </div>
        <el-dialog v-model="state.useInstructDialog" :title="state.instructInfo?.template_title" width="500" :before-close="handleClose">
            <el-input v-model="state.inputInstruct" :rows="10" type="textarea"></el-input>
            <template #footer>
                <div class="dialog-footer">
                    <el-button @click="handleClose">取消</el-button>
                    <el-button type="primary" @click="submitInstruct"> 确认 </el-button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>
@@ -237,6 +246,9 @@
    activeLabelName: 0,
    activeInstructName: 0,
    isShowExpand: false,
    useInstructDialog: false,
    instructInfo: {},
    inputInstruct: '', //可修改指令
});
const exampleList = ref([]); //模版列表
const instructContentList = ref([]); //指令列表
@@ -320,7 +332,16 @@
};
//#region ====================== templateUseClick ======================
const templateUseClick = (row) => {
    emitter.emit('updateChatInput', row.template_value);
    state.useInstructDialog = true;
    state.instructInfo = row;
    state.inputInstruct = row.template_value;
};
const handleClose = () => {
    state.useInstructDialog = false;
};
const submitInstruct = () => {
    emitter.emit('updateChatInput', state.inputInstruct);
    handleClose();
};
//#endregion
//#region ====================== 搜索模板/指令 ======================