提交 d31852ea authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 2ec5186a
...@@ -66,7 +66,7 @@ let cktInstance ...@@ -66,7 +66,7 @@ let cktInstance
function openDesignPage() { function openDesignPage() {
const appId = '54d9adec77d0402794018d166110f3dd' const appId = '54d9adec77d0402794018d166110f3dd'
const appSecret = '08097010E0EF4B85EE2B8CE438328249' const appSecret = '08097010E0EF4B85EE2B8CE438328249'
const userFlag = userStore.user.id + props.kindId.toString() const userFlag = userStore.user.id
const expireTime = Date.now() const expireTime = Date.now()
const sign = buildVersion2Sign(appId, expireTime, userFlag, appSecret) const sign = buildVersion2Sign(appId, expireTime, userFlag, appSecret)
const params = { const params = {
......
...@@ -44,3 +44,13 @@ export function searchCategory(params: { name: string }) { ...@@ -44,3 +44,13 @@ export function searchCategory(params: { name: string }) {
export function getAttrList(params: { live_commodity_type_id: string }) { export function getAttrList(params: { live_commodity_type_id: string }) {
return httpRequest.get('/api/lab/v1/experiment/live-commodity-attr/search', { params }) return httpRequest.get('/api/lab/v1/experiment/live-commodity-attr/search', { params })
} }
// 创客贴-查询我的设计(排序+筛选)
export function getChuanKitDesignList(data: {
user_flag: string
page_no: number
page_size: number
time_order: number
}) {
return httpRequest.post('/api/lab/v1/experiment/marketing-ai/chuangkit-designs', data)
}
<script setup>
import { getChuanKitDesignList } from '../api'
import { useUserStore } from '@/stores/user'
import { uploadFileByUrl } from '@/utils/upload'
const ChuangKitDesign = defineAsyncComponent(() => import('@/components/ChuangKitDesign.vue'))
const emit = defineEmits(['update', 'update:modelValue'])
const userStore = useUserStore()
const designVisible = ref(false)
const data = reactive({
list: [],
count: 0,
})
async function fetchList() {
const res = await getChuanKitDesignList({
user_flag: userStore.user.id,
kind_id: 29,
page_no: 1,
page_size: 1000,
time_order: 1,
})
Object.assign(data, res.data)
}
onMounted(fetchList)
function onClose() {
designVisible.value = false
fetchList()
}
const active = ref(null)
async function handleClick(item) {
active.value = item
}
async function handleSubmit() {
const url = await uploadFileByUrl(active.value.thumbUrl)
emit('update', url)
emit('update:modelValue', false)
}
</script>
<template>
<el-dialog title="图库选择" :close-on-click-modal="false" @closed="$emit('update:modelValue', false)" width="860px">
<div class="image-design">
<el-button type="primary" @click="designVisible = true">打开编辑器</el-button>
<ul>
<li
v-for="item in data.list"
:key="item.designId"
:class="{ active: item.designId === active?.designId }"
@click="handleClick(item)">
<img :src="item.thumbUrl" />
</li>
</ul>
<ChuangKitDesign :kindId="29" @close="onClose" v-if="designVisible"></ChuangKitDesign>
</div>
<template #footer>
<el-row justify="center">
<el-button round auto-insert-space @click="$emit('update:modelValue', false)">关闭</el-button>
<el-button type="primary" round auto-insert-space :disabled="!active" @click="handleSubmit">确定</el-button>
</el-row>
</template>
</el-dialog>
</template>
<style lang="scss">
.image-design {
ul {
margin: 30px auto;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 30px;
}
li {
width: 140px;
border-radius: 20px;
overflow: hidden;
cursor: pointer;
box-sizing: border-box;
&.active {
border: 5px solid var(--main-color);
}
}
img {
width: 100%;
}
}
</style>
...@@ -3,7 +3,7 @@ import { Plus, UploadFilled, Picture } from '@element-plus/icons-vue' ...@@ -3,7 +3,7 @@ import { Plus, UploadFilled, Picture } from '@element-plus/icons-vue'
import { useFileDialog } from '@vueuse/core' import { useFileDialog } from '@vueuse/core'
import { upload } from '@/utils/upload' import { upload } from '@/utils/upload'
import dayjs from 'dayjs' import dayjs from 'dayjs'
const ChuangKitDesign = defineAsyncComponent(() => import('@/components/ChuangKitDesign.vue')) const ImageDesign = defineAsyncComponent(() => import('./ImageDesign.vue'))
const props = defineProps({ const props = defineProps({
modelValue: { type: [Array, String], default: () => [] }, modelValue: { type: [Array, String], default: () => [] },
...@@ -124,7 +124,7 @@ const handleDesignSave = (url) => { ...@@ -124,7 +124,7 @@ const handleDesignSave = (url) => {
</template> </template>
</el-popover> </el-popover>
</template> </template>
<ChuangKitDesign :kindId="29" @save="handleDesignSave" @close="designVisible = false" v-if="designVisible"></ChuangKitDesign> <ImageDesign v-model="designVisible" :kindId="29" @update="handleDesignSave" v-if="designVisible"></ImageDesign>
</div> </div>
</template> </template>
......
...@@ -15,7 +15,13 @@ const data = reactive({ ...@@ -15,7 +15,13 @@ const data = reactive({
count: 0, count: 0,
}) })
async function fetchList() { async function fetchList() {
const res = await getChuanKitDesignList({ user_flag: userStore.user.id, page_no: 1, page_size: 1000, time_order: 1 }) const res = await getChuanKitDesignList({
user_flag: userStore.user.id,
kind_id: 447,
page_no: 1,
page_size: 1000,
time_order: 1,
})
Object.assign(data, res.data) Object.assign(data, res.data)
} }
onMounted(fetchList) onMounted(fetchList)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论