| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <div class="detail-container">
- <div style="padding: 20px;">
- <!-- 主图LOGO部分 -->
- <div class="logo-section flex left top">
- <div class="section-title">
- <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
- 主图LOGO:
- </div>
- <upload :value="form.logoImage" @input="onInput"></upload>
- <router-link class="mar-left-20 " :to="{
- name: 'PhotographySeniorDetail'
- }">
- <button class="generate-button button--primary1 mar-left-20" @click="generate">去高级详情</button>
- </router-link>
- </div>
- <el-divider />
- <!-- 选择详情模板部分 -->
- <div class="template-section ">
- <div class="flex between">
- <div class="section-title">
- <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
- 选择详情模版
- </div>
- <div class="template-pagination">
- <el-pagination background layout="prev, pager, next" v-model:current-page="queryParams.current"
- v-model:page-size.sync="queryParams.size" :total="totalPage" @current-change="onCurrentChange"
- @size-change="onSizeChange" />
- </div>
- </div>
- <div class="template-list">
- <div v-for="(template, index) in visibleTemplates" :key="index" class="template-item"
- @click="form.templateId = template.id">
- <el-image :src="ossResize(test_image_url, {
- m: 'lfit',
- h: 360,
- w: 500
- })" fit="contain" class="cur-p" style="width: 100%; display: block;" />
- <div class="select-warp" :class="form.templateId == template.id ? 'active' : ''">
- <el-icon color="#FFFFFF">
- <Select />
- </el-icon>
- </div>
- <div class="template-info">
- <span class="mar-left-10 chaochu_1">{{ template.templateId }}</span>
- <div class="template-view" @click="viewTemplate(template)">查看</div>
- </div>
- </div>
- </div>
- </div>
- <!-- 详情资料准备部分 -->
- <div class="data-prep-section">
- <div class="flex-item left">
- <div class="section-title">
- <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
- 详情资料准备 (2选1)
- </div>
- </div>
- <div class="flex-item left">
- <el-radio-group v-model="form.dataType" class="ml-4">
- <el-radio label="1" size="large">EXCEL文件选择</el-radio>
- <el-radio label="2" size="large">系统对接(和业务员联系)</el-radio>
- </el-radio-group>
- </div>
- <div v-if="form.dataType == '1'" class="excel-upload">
- <div class="flex bottom between">
- <div style="max-width: 160px;" class="mar-left-20">商品基础资料EXCEL文件选择:</div>
- <div class="flex bottom mar-left-20" style="flex-grow: 1;">
- <el-input type="textarea" v-model="form.excelFilePath" />
- </div>
- <el-button class="select-button button--primary1 mar-left-20" type="primary" @click="selectExcel">
- <img src="@/assets/images/Photography/wenjian.png" style="width: 16px; margin-right: 4px;" />
- 选择</el-button>
- </div>
- </div>
- </div>
- <!-- 开始生成按钮 -->
- <button class="generate-button button--primary1" @click="generate">开始生成</button>
- </div>
- <el-dialog v-model="dialogVisible">
- <img w-full :src="dialogImageUrl" alt="Preview Image" />
- </el-dialog>
- </div>
- </template>
- <script lang="ts" setup>
- import { ref, computed, reactive } from 'vue';
- import { Select } from '@element-plus/icons-vue'
- import { ossResize } from '@/utils/appfun'
- import upload from '@/components/upload'
- import client from "@/stores/modules/client";
- import icpList from '@/utils/ipc'
- const clientStore = client();
- const test_image_url = ref('https://ossimg.valimart.net/uploads/vali_ai/20230927/169580582298394.png')
- // 模拟数据
- const templates = [
- { id: 1101, templateId: '某某模版编号1', preview: '...' },
- { id: 1102, templateId: '某某模版编号2', preview: '...' },
- { id: 1103, templateId: '某某模版编号3', preview: '...' },
- { id: 1104, templateId: '某某模版编号4', preview: '...' },
- { id: 1105, templateId: '某某模版编号5', preview: '...' },
- { id: 1106, templateId: '某某模版编号6', preview: '...' },
- { id: 1107, templateId: '某某模版编号7', preview: '...' },
- { id: 1108, templateId: '某某模版编号8', preview: '...' },
- { id: 1109, templateId: '某某模版编号9', preview: '...' },
- { id: 1110, templateId: '某某模版编号10', preview: '...' },
- { id: 1111, templateId: '某某模版编号11', preview: '...' },
- { id: 1112, templateId: '某某模版编号12', preview: '...' },
- ];
- // 状态变量
- const totalPage = ref(3);
- const itemsPerPage = 4; // 每页显示的模板数量
- const dialogVisible = ref(false);
- const dialogImageUrl = ref('');
- const queryParams = reactive({ // 分页查询参数
- size: 1,
- current: 1,
- })
- const form = reactive({
- dataType: '1', // 1: 选择excel文件 2: 系统对接
- logoImage: '', // 主图LOGO
- templateId: 1101,
- excelFilePath: 'D:\\MyDocuments\\PythonCode\\MyPython\\red_dragonfly\\deal_pics\\auto_capture_V2\\auto_photo', // 商品基础资料EXCEL文件选择
- })
- // 计算属性,获取当前页可见的模板
- const visibleTemplates = computed(() => {
- const startIndex = (queryParams.current - 1) * itemsPerPage;
- const data = templates.slice(startIndex, startIndex + itemsPerPage);
- return data
- });
- // 查看模板详情
- const viewTemplate = (template) => {
- console.log('查看模板详情', template);
- // 展示大图
- dialogVisible.value = true
- dialogImageUrl.value = 'https://ossimg.valimart.net/uploads/vali_ai/20240312/171022217892595.png'
- };
- const onCurrentChange = (page) => {
- queryParams.current = page;
- };
- const onSizeChange = (data) => {
- };
- // 开始生成操作
- const generate = () => {
- // 这里添加实际生成主图和详情的逻辑
- console.log('queryParams', form)
- };
- const onInput = (value) => {
- form.logoImage = value
- }
- function selectExcel() {
- clientStore.ipc.removeAllListeners(icpList.utils.openFile);
- clientStore.ipc.send(icpList.utils.openFile, {
- filters: [
- { name: '支持xls,xlsx', extensions: ['xlsx', 'xls'] }
- ],
- title: "选择基础文件资料"
- });
- clientStore.ipc.on(icpList.utils.openFile, async (event, result) => {
- form.excelFilePath = result
- clientStore.ipc.removeAllListeners(icpList.utils.openFile);
- })
- }
- </script>
- <style lang="scss" scoped>
- .detail-container {
- background-color: #EAECED;
- width: 100%;
- min-width: 600px
- }
- .logo-section,
- .template-section,
- .data-prep-section {
- margin-bottom: 20px;
- }
- .logo-upload {
- border: 1px dashed #ccc;
- border-radius: 5px;
- padding: 50px 0;
- text-align: center;
- cursor: pointer;
- }
- .template-pagination button {
- margin-right: 5px;
- }
- .template-pagination span {
- display: inline-block;
- width: 20px;
- height: 20px;
- line-height: 20px;
- text-align: center;
- border: 1px solid #ccc;
- border-radius: 5px;
- margin-right: 5px;
- cursor: pointer;
- }
- .template-list {
- display: flex;
- flex-wrap: wrap;
- gap: 20px;
- margin-top: 10px;
- .template-item {
- width: calc(25% - 18px);
- border: 1px solid #ccc;
- border-radius: 10px;
- cursor: pointer;
- background: #f0f0f0;
- position: relative;
- overflow: hidden;
- .template-info {
- position: absolute;
- bottom: 0;
- left: 0;
- background: rgba($color: #000000, $alpha: .3);
- width: 100%;
- height: 36px;
- line-height: 36px;
- color: #eee;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .template-view {
- background: #DFE2E3;
- color: #3366FF;
- height: 30px;
- line-height: 30px;
- padding: 0 10px;
- border-radius: 4px;
- margin-right: 10px;
- font-size: 14px;
- }
- }
- }
- }
- .excel-upload {
- width: 100%;
- background: #F7F7F7;
- padding: 20px 0;
- }
- .generate-button {
- padding: 10px 20px;
- color: white;
- border: none;
- border-radius: 5px;
- cursor: pointer;
- }
- .select-button {
- background: #DFE2E3 !important;
- color: #3366FF !important;
- height: 30px;
- line-height: 30px;
- padding: 0 10px;
- border-radius: 4px;
- margin-right: 10px;
- font-size: 14px;
- font-weight: 550;
- }
- .select-warp {
- width: 18px;
- height: 18px;
- border-radius: 4px;
- background-color: #fff;
- position: absolute;
- top: 10px;
- left: 10px;
- &.active {
- background-color: #1677FF;
- }
- }
- .section-title {
- display: flex;
- align-items: center;
- gap: 8px;
- font-weight: bold;
- margin-bottom: 16px;
- color: #474747;
- }
- </style>
|