detail.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div class="detail-container">
  3. <div style="padding: 20px;">
  4. <!-- 主图LOGO部分 -->
  5. <div class="logo-section flex left top">
  6. <div class="section-title">
  7. <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
  8. 主图LOGO:
  9. </div>
  10. <upload :value="form.logoImage" @input="onInput"></upload>
  11. <router-link class="mar-left-20 " :to="{
  12. name: 'PhotographySeniorDetail'
  13. }">
  14. <button class="generate-button button--primary1 mar-left-20" @click="generate">去高级详情</button>
  15. </router-link>
  16. </div>
  17. <el-divider />
  18. <!-- 选择详情模板部分 -->
  19. <div class="template-section ">
  20. <div class="flex between">
  21. <div class="section-title">
  22. <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
  23. 选择详情模版
  24. </div>
  25. <div class="template-pagination">
  26. <el-pagination background layout="prev, pager, next" v-model:current-page="queryParams.current"
  27. v-model:page-size.sync="queryParams.size" :total="totalPage" @current-change="onCurrentChange"
  28. @size-change="onSizeChange" />
  29. </div>
  30. </div>
  31. <div class="template-list">
  32. <div v-for="(template, index) in visibleTemplates" :key="index" class="template-item"
  33. @click="form.templateId = template.id">
  34. <el-image :src="ossResize(test_image_url, {
  35. m: 'lfit',
  36. h: 360,
  37. w: 500
  38. })" fit="contain" class="cur-p" style="width: 100%; display: block;" />
  39. <div class="select-warp" :class="form.templateId == template.id ? 'active' : ''">
  40. <el-icon color="#FFFFFF">
  41. <Select />
  42. </el-icon>
  43. </div>
  44. <div class="template-info">
  45. <span class="mar-left-10 chaochu_1">{{ template.templateId }}</span>
  46. <div class="template-view" @click="viewTemplate(template)">查看</div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <!-- 详情资料准备部分 -->
  52. <div class="data-prep-section">
  53. <div class="flex-item left">
  54. <div class="section-title">
  55. <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
  56. 详情资料准备 (2选1)
  57. </div>
  58. </div>
  59. <div class="flex-item left">
  60. <el-radio-group v-model="form.dataType" class="ml-4">
  61. <el-radio label="1" size="large">EXCEL文件选择</el-radio>
  62. <el-radio label="2" size="large">系统对接(和业务员联系)</el-radio>
  63. </el-radio-group>
  64. </div>
  65. <div v-if="form.dataType == '1'" class="excel-upload">
  66. <div class="flex bottom between">
  67. <div style="max-width: 160px;" class="mar-left-20">商品基础资料EXCEL文件选择:</div>
  68. <div class="flex bottom mar-left-20" style="flex-grow: 1;">
  69. <el-input type="textarea" v-model="form.excelFilePath" />
  70. </div>
  71. <el-button class="select-button button--primary1 mar-left-20" type="primary" @click="selectExcel">
  72. <img src="@/assets/images/Photography/wenjian.png" style="width: 16px; margin-right: 4px;" />
  73. 选择</el-button>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- 开始生成按钮 -->
  78. <button class="generate-button button--primary1" @click="generate">开始生成</button>
  79. </div>
  80. <el-dialog v-model="dialogVisible">
  81. <img w-full :src="dialogImageUrl" alt="Preview Image" />
  82. </el-dialog>
  83. </div>
  84. </template>
  85. <script lang="ts" setup>
  86. import { ref, computed, reactive } from 'vue';
  87. import { Select } from '@element-plus/icons-vue'
  88. import { ossResize } from '@/utils/appfun'
  89. import upload from '@/components/upload'
  90. import client from "@/stores/modules/client";
  91. import icpList from '@/utils/ipc'
  92. const clientStore = client();
  93. const test_image_url = ref('https://ossimg.valimart.net/uploads/vali_ai/20230927/169580582298394.png')
  94. // 模拟数据
  95. const templates = [
  96. { id: 1101, templateId: '某某模版编号1', preview: '...' },
  97. { id: 1102, templateId: '某某模版编号2', preview: '...' },
  98. { id: 1103, templateId: '某某模版编号3', preview: '...' },
  99. { id: 1104, templateId: '某某模版编号4', preview: '...' },
  100. { id: 1105, templateId: '某某模版编号5', preview: '...' },
  101. { id: 1106, templateId: '某某模版编号6', preview: '...' },
  102. { id: 1107, templateId: '某某模版编号7', preview: '...' },
  103. { id: 1108, templateId: '某某模版编号8', preview: '...' },
  104. { id: 1109, templateId: '某某模版编号9', preview: '...' },
  105. { id: 1110, templateId: '某某模版编号10', preview: '...' },
  106. { id: 1111, templateId: '某某模版编号11', preview: '...' },
  107. { id: 1112, templateId: '某某模版编号12', preview: '...' },
  108. ];
  109. // 状态变量
  110. const totalPage = ref(3);
  111. const itemsPerPage = 4; // 每页显示的模板数量
  112. const dialogVisible = ref(false);
  113. const dialogImageUrl = ref('');
  114. const queryParams = reactive({ // 分页查询参数
  115. size: 1,
  116. current: 1,
  117. })
  118. const form = reactive({
  119. dataType: '1', // 1: 选择excel文件 2: 系统对接
  120. logoImage: '', // 主图LOGO
  121. templateId: 1101,
  122. excelFilePath: 'D:\\MyDocuments\\PythonCode\\MyPython\\red_dragonfly\\deal_pics\\auto_capture_V2\\auto_photo', // 商品基础资料EXCEL文件选择
  123. })
  124. // 计算属性,获取当前页可见的模板
  125. const visibleTemplates = computed(() => {
  126. const startIndex = (queryParams.current - 1) * itemsPerPage;
  127. const data = templates.slice(startIndex, startIndex + itemsPerPage);
  128. return data
  129. });
  130. // 查看模板详情
  131. const viewTemplate = (template) => {
  132. console.log('查看模板详情', template);
  133. // 展示大图
  134. dialogVisible.value = true
  135. dialogImageUrl.value = 'https://ossimg.valimart.net/uploads/vali_ai/20240312/171022217892595.png'
  136. };
  137. const onCurrentChange = (page) => {
  138. queryParams.current = page;
  139. };
  140. const onSizeChange = (data) => {
  141. };
  142. // 开始生成操作
  143. const generate = () => {
  144. // 这里添加实际生成主图和详情的逻辑
  145. console.log('queryParams', form)
  146. };
  147. const onInput = (value) => {
  148. form.logoImage = value
  149. }
  150. function selectExcel() {
  151. clientStore.ipc.removeAllListeners(icpList.utils.openFile);
  152. clientStore.ipc.send(icpList.utils.openFile, {
  153. filters: [
  154. { name: '支持xls,xlsx', extensions: ['xlsx', 'xls'] }
  155. ],
  156. title: "选择基础文件资料"
  157. });
  158. clientStore.ipc.on(icpList.utils.openFile, async (event, result) => {
  159. form.excelFilePath = result
  160. clientStore.ipc.removeAllListeners(icpList.utils.openFile);
  161. })
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .detail-container {
  166. background-color: #EAECED;
  167. width: 100%;
  168. min-width: 600px
  169. }
  170. .logo-section,
  171. .template-section,
  172. .data-prep-section {
  173. margin-bottom: 20px;
  174. }
  175. .logo-upload {
  176. border: 1px dashed #ccc;
  177. border-radius: 5px;
  178. padding: 50px 0;
  179. text-align: center;
  180. cursor: pointer;
  181. }
  182. .template-pagination button {
  183. margin-right: 5px;
  184. }
  185. .template-pagination span {
  186. display: inline-block;
  187. width: 20px;
  188. height: 20px;
  189. line-height: 20px;
  190. text-align: center;
  191. border: 1px solid #ccc;
  192. border-radius: 5px;
  193. margin-right: 5px;
  194. cursor: pointer;
  195. }
  196. .template-list {
  197. display: flex;
  198. flex-wrap: wrap;
  199. gap: 20px;
  200. margin-top: 10px;
  201. .template-item {
  202. width: calc(25% - 18px);
  203. border: 1px solid #ccc;
  204. border-radius: 10px;
  205. cursor: pointer;
  206. background: #f0f0f0;
  207. position: relative;
  208. overflow: hidden;
  209. .template-info {
  210. position: absolute;
  211. bottom: 0;
  212. left: 0;
  213. background: rgba($color: #000000, $alpha: .3);
  214. width: 100%;
  215. height: 36px;
  216. line-height: 36px;
  217. color: #eee;
  218. display: flex;
  219. align-items: center;
  220. justify-content: space-between;
  221. .template-view {
  222. background: #DFE2E3;
  223. color: #3366FF;
  224. height: 30px;
  225. line-height: 30px;
  226. padding: 0 10px;
  227. border-radius: 4px;
  228. margin-right: 10px;
  229. font-size: 14px;
  230. }
  231. }
  232. }
  233. }
  234. .excel-upload {
  235. width: 100%;
  236. background: #F7F7F7;
  237. padding: 20px 0;
  238. }
  239. .generate-button {
  240. padding: 10px 20px;
  241. color: white;
  242. border: none;
  243. border-radius: 5px;
  244. cursor: pointer;
  245. }
  246. .select-button {
  247. background: #DFE2E3 !important;
  248. color: #3366FF !important;
  249. height: 30px;
  250. line-height: 30px;
  251. padding: 0 10px;
  252. border-radius: 4px;
  253. margin-right: 10px;
  254. font-size: 14px;
  255. font-weight: 550;
  256. }
  257. .select-warp {
  258. width: 18px;
  259. height: 18px;
  260. border-radius: 4px;
  261. background-color: #fff;
  262. position: absolute;
  263. top: 10px;
  264. left: 10px;
  265. &.active {
  266. background-color: #1677FF;
  267. }
  268. }
  269. .section-title {
  270. display: flex;
  271. align-items: center;
  272. gap: 8px;
  273. font-weight: bold;
  274. margin-bottom: 16px;
  275. color: #474747;
  276. }
  277. </style>