refine: 修改新增方式

pull/5/head
zhangqi 4 weeks ago
parent 874c773512
commit a14b9dd1dc
  1. 40
      src/components/Yys.vue
  2. 2
      src/locales/zh.json

@ -16,8 +16,6 @@
<draggable :list="groups" item-key="group" style="display: flex; flex-direction: column; width: 100%;" <draggable :list="groups" item-key="group" style="display: flex; flex-direction: column; width: 100%;"
handle=".drag-handle"> handle=".drag-handle">
<template class="group" #item="{ element: group, index: groupIndex }"> <template class="group" #item="{ element: group, index: groupIndex }">
<el-row :span="24"> <el-row :span="24">
<div class="group-item"> <div class="group-item">
@ -33,7 +31,8 @@
</div> </div>
<div class="opt-right"> <div class="opt-right">
<el-button class="drag-handle" type="primary" icon="Rank" circle></el-button> <el-button class="drag-handle" type="primary" icon="Rank" circle></el-button>
<el-button type="primary" icon="Plus" circle @click="addGroup"></el-button> <el-button type="primary" @click="addGroup">{{t('AddGroup')}}</el-button>
<el-button type="primary" @click="addGroupElement(groupIndex)">{{t('AddShikigami')}}</el-button>
<el-button type="danger" icon="Delete" circle @click="removeGroup(groupIndex)"></el-button> <el-button type="danger" icon="Delete" circle @click="removeGroup(groupIndex)"></el-button>
</div> </div>
</div> </div>
@ -42,12 +41,13 @@
<div class="group-body"> <div class="group-body">
<draggable :list="group.groupInfo" item-key="name" class="body-content"> <draggable :list="group.groupInfo" item-key="name" class="body-content">
<template #item="{element : position, index:positionIndex}"> <template #item="{element : position, index:positionIndex}">
<el-col> <div>
<el-col>
<el-card class="group-card" shadow="never"> <el-card class="group-card" shadow="never">
<div class="opt-btn" data-html2canvas-ignore="true"> <div class="opt-btn" data-html2canvas-ignore="true">
<!-- Add delete button here --> <!-- Add delete button here -->
<el-button type="danger" icon="Delete" circle @click="removeGroupElement(groupIndex, positionIndex)"/> <el-button type="danger" icon="Delete" circle @click="removeGroupElement(groupIndex, positionIndex)"/>
<el-button type="primary" icon="Plus" circle @click="addGroupElement(groupIndex)"/> <!-- <el-button type="primary" icon="Plus" circle @click="addGroupElement(groupIndex)"/> -->
</div> </div>
<div class="avatar-container"> <div class="avatar-container">
<!-- 头像图片 --> <!-- 头像图片 -->
@ -87,11 +87,9 @@
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
</div>
</template> </template>
</draggable> </draggable>
<!-- <div class="add-btn" data-html2canvas-ignore="true">
<el-button type="primary" icon="Plus" circle @click="addGroupElement(groupIndex)"></el-button>
</div> -->
</div> </div>
<div class="group-footer"> <div class="group-footer">
<div class="group-opt" data-html2canvas-ignore="true"> <div class="group-opt" data-html2canvas-ignore="true">
@ -106,13 +104,14 @@
<QuillEditor ref="detailsEditor" v-model:content="group.details" contentType="html" theme="snow" :toolbar="toolbarOptions" /> <QuillEditor ref="detailsEditor" v-model:content="group.details" contentType="html" theme="snow" :toolbar="toolbarOptions" />
</div> </div>
</div> </div>
<div class="divider-horizontal"></div>
</el-row> </el-row>
</template> </template>
</draggable> </draggable>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, reactive, toRefs} from 'vue'; import {ref, reactive, toRefs, nextTick} from 'vue';
import draggable from 'vuedraggable'; import draggable from 'vuedraggable';
import ShikigamiSelect from './ShikigamiSelect.vue'; import ShikigamiSelect from './ShikigamiSelect.vue';
import ShikigamiProperty from './ShikigamiProperty.vue'; import ShikigamiProperty from './ShikigamiProperty.vue';
@ -213,7 +212,7 @@ const editShikigami = (groupIndex, positionIndex) => {
}; };
const updateShikigami = (shikigami) => { const updateShikigami = (shikigami) => {
console.log("parent====> ", shikigami); console.log("parent====> ", shikigami, state);
state.showSelectShikigami = false; state.showSelectShikigami = false;
const oldProperties = props.groups[state.groupIndex].groupInfo[state.positionIndex].properties; const oldProperties = props.groups[state.groupIndex].groupInfo[state.positionIndex].properties;
@ -284,10 +283,21 @@ const addGroup = () => {
groupInfo: [{}, {}, {}, {}, {}], groupInfo: [{}, {}, {}, {}, {}],
details: '' details: ''
}); });
const container = document.getElementById('main-container');
nextTick(() => {
container.scrollTo({
top: container.scrollHeight,
behavior: 'smooth' //
});
})
}; };
const addGroupElement = (groupIndex) => { const addGroupElement = (groupIndex) => {
props.groups[groupIndex].groupInfo.push({}); props.groups[groupIndex].groupInfo.push({});
editShikigami(groupIndex, props.groups[groupIndex].groupInfo.length - 1);
}; };
@ -440,6 +450,15 @@ defineExpose({
width: 80%; width: 80%;
} }
/* 水平分割线 */
.divider-horizontal {
border: 0;
height: 1px;
background: #e0e0e0;
margin: 24px 0;
width: 100%;
}
.body-content { .body-content {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -477,6 +496,7 @@ defineExpose({
.opt-btn { .opt-btn {
position: absolute; position: absolute;
top: 0px; top: 0px;
right: 0px;
z-index: 10; z-index: 10;
opacity: 0; opacity: 0;
} }

@ -4,6 +4,8 @@
"setWatermark": "设置水印", "setWatermark": "设置水印",
"Copy": "复制", "Copy": "复制",
"Paste": "粘贴", "Paste": "粘贴",
"AddGroup": "新增小队",
"AddShikigami": "新增式神",
"editProperties": "配置属性", "editProperties": "配置属性",
"prepareCapture": "生成截图", "prepareCapture": "生成截图",
"yuhunSelect": "请选择御魂", "yuhunSelect": "请选择御魂",

Loading…
Cancel
Save