Commit 87077a2e authored by zhengke's avatar zhengke

广告

parent 22931897
...@@ -127,6 +127,7 @@ const sellGetTripTemplate = async () =>{ ...@@ -127,6 +127,7 @@ const sellGetTripTemplate = async () =>{
let dataObj = dataRes.data.data let dataObj = dataRes.data.data
let viewportRatio = 1.414 let viewportRatio = 1.414
if(dataRes.data.data.TempType==1) viewportRatio = 0.7069 if(dataRes.data.data.TempType==1) viewportRatio = 0.7069
if(dataRes.data.data.Width&&dataRes.data.data.Height) viewportRatio = dataRes.data.data.Height/dataRes.data.data.Width
slidesStore.setViewportRatio(viewportRatio) slidesStore.setViewportRatio(viewportRatio)
let SlidesData = JSON.parse(dataObj.TempData) let SlidesData = JSON.parse(dataObj.TempData)
let newSlides = [] let newSlides = []
......
...@@ -72,16 +72,17 @@ ...@@ -72,16 +72,17 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref,defineProps,watch} from 'vue' import {ref,defineProps,watch,inject} from 'vue'
import { UploadFilled,Delete } from '@element-plus/icons-vue' import { UploadFilled,Delete } from '@element-plus/icons-vue'
import type { UploadProps, UploadUserFile,UploadInstance } from 'element-plus' import type { UploadProps, UploadUserFile,UploadInstance } from 'element-plus'
import PSD from 'psd.js' import PSD from 'psd.js'
import {getFonts, toSlider, toThumbnails} from '@/utils/psdParser/index' import {getFonts, toSlider,getDrawingBoardSize, toThumbnails} from '@/utils/psdParser/index'
import { useSlidesStore } from '@/store' import { useSlidesStore } from '@/store'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import AliyunUpload from '@/utils/upload/aliyun' import AliyunUpload from '@/utils/upload/aliyun'
import { useFontStore,useScreenStore } from '@/store' import { useFontStore,useScreenStore } from '@/store'
import { CustomerFonts } from '@/store/font' import { CustomerFonts } from '@/store/font'
import { injectKeyDataSource,injectKeyTemplate } from '@/types/injectKey'
const props = defineProps({ const props = defineProps({
visible:{ visible:{
...@@ -105,6 +106,11 @@ const fonts = ref<any[]>() ...@@ -105,6 +106,11 @@ const fonts = ref<any[]>()
const uploadingIndex = ref(-1) const uploadingIndex = ref(-1)
const uploadFinishFont = ref<string[]>([]) const uploadFinishFont = ref<string[]>([])
const queryObj = ref({} as any)
const searchData = ref({} as any)
queryObj.value = inject(injectKeyDataSource).queryObj
searchData.value = inject(injectKeyTemplate)
const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => { const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
isResolving.value=true isResolving.value=true
...@@ -114,6 +120,11 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => { ...@@ -114,6 +120,11 @@ const handleChange: UploadProps['onChange'] = (uploadFile, uploadFiles) => {
PSD.fromURL(url).then(async (psd:any) => { PSD.fromURL(url).then(async (psd:any) => {
thumbnails.value= await toThumbnails(psd) thumbnails.value= await toThumbnails(psd)
sliders.value = await toSlider(psd) sliders.value = await toSlider(psd)
if(searchData.value.TemplateType==2) {
let DrawingBoardSize = await getDrawingBoardSize(psd)
queryObj.value.Width = DrawingBoardSize.Width
queryObj.value.Height = DrawingBoardSize.Height
}
fonts.value = getFonts(psd) fonts.value = getFonts(psd)
if(fonts.value){ if(fonts.value){
fonts.value = fonts.value.filter(x=>useFontStore().getFonts.findIndex(y=>y.fontFamily==x)==-1) fonts.value = fonts.value.filter(x=>useFontStore().getFonts.findIndex(y=>y.fontFamily==x)==-1)
......
...@@ -8,7 +8,7 @@ export interface SalesState { ...@@ -8,7 +8,7 @@ export interface SalesState {
export const useSellTemplateStore = defineStore('sales', { export const useSellTemplateStore = defineStore('sales', {
state: (): SalesState => ({ state: (): SalesState => ({
SalesEditor: 0, // 1 新增 2编辑 SalesEditor: 0, // 1 新增模版 2编辑模版 3新增广告 4编辑广告
SalesBack: 0,// 0 销售首页 1 模版首页 SalesBack: 0,// 0 销售首页 1 模版首页
SalesTripId: '', // 销售行程id SalesTripId: '', // 销售行程id
}), }),
......
...@@ -703,7 +703,7 @@ export interface Slide { ...@@ -703,7 +703,7 @@ export interface Slide {
animations?: PPTAnimation[] animations?: PPTAnimation[]
turningMode?: TurningMode turningMode?: TurningMode
pageType: number, pageType: number,
isTripItems?:boolean isTripItems?:boolean,
} }
/** /**
......
import { ResolvePsdToSliderHandler, ResolveThumbHandler,ResolveSliderFonts } from "./resolve" import { ResolvePsdToSliderHandler,ResolvePsdDrawingBoardSize, ResolveThumbHandler,ResolveSliderFonts } from "./resolve"
export const toSlider = async (psd:any)=>{ export const toSlider = async (psd:any)=>{
const sliders = await ResolvePsdToSliderHandler(psd); const sliders = await ResolvePsdToSliderHandler(psd);
return sliders return sliders
} }
export const getDrawingBoardSize= (psd:any) => {
return ResolvePsdDrawingBoardSize(psd)
}
export const getFonts = (psd:any) => { export const getFonts = (psd:any) => {
return ResolveSliderFonts(psd) return ResolveSliderFonts(psd)
} }
......
...@@ -63,6 +63,25 @@ export const ResolvePsdToSliderHandler = async (psd:any) => { ...@@ -63,6 +63,25 @@ export const ResolvePsdToSliderHandler = async (psd:any) => {
} }
} }
export const ResolvePsdDrawingBoardSize= async (psd:any) => {
let items:Array<any> = psd.tree().children().filter((x:any)=>x.layer.visible)
if(items && items.length>0){
for (let i = 0; i < items.length; i++) {
const x = items[i];
const {_children} = x
if(_children && _children.length>0){
let DrawingBoardSize = {
Width: x.layer.artboard().export().coords.right-x.layer.artboard().export().coords.left,
Height: x.layer.artboard().export().coords.bottom-x.layer.artboard().export().coords.top
}
return DrawingBoardSize
}
}
}
}
export const ResolveSliderFonts = (psd:any) => { export const ResolveSliderFonts = (psd:any) => {
let items:Array<any> = psd.tree().children().filter((x:any)=>x.layer.visible) let items:Array<any> = psd.tree().children().filter((x:any)=>x.layer.visible)
......
...@@ -220,7 +220,7 @@ onMounted(() => { ...@@ -220,7 +220,7 @@ onMounted(() => {
// 点击画布的空白区域:清空焦点元素、设置画布焦点、清除文字选区、清空格式刷状态 // 点击画布的空白区域:清空焦点元素、设置画布焦点、清除文字选区、清空格式刷状态
const handleClickBlankArea = (e: MouseEvent) => { const handleClickBlankArea = (e: MouseEvent) => {
console.log(e) console.log(e,slides.value[6])
if (activeElementIdList.value.length) mainStore.setActiveElementIdList([]) if (activeElementIdList.value.length) mainStore.setActiveElementIdList([])
if (!spaceKeyState.value && e.button==0) updateMouseSelection(e) if (!spaceKeyState.value && e.button==0) updateMouseSelection(e)
else if(e.button==1) dragViewport(e) else if(e.button==1) dragViewport(e)
...@@ -368,7 +368,7 @@ provide(injectKeySlideScale, canvasScale) ...@@ -368,7 +368,7 @@ provide(injectKeySlideScale, canvasScale)
.canvas { .canvas {
height: 100%; height: 100%;
user-select: none; user-select: none;
/* overflow: hidden; */ overflow: hidden;
background-color: $lightGray; background-color: $lightGray;
position: relative; position: relative;
} }
......
...@@ -78,38 +78,37 @@ ...@@ -78,38 +78,37 @@
size="small" :loading="datas.loading" size="small" :loading="datas.loading"
@click="setTemplate" style="color: #ffff;margin-left: 10px;"> @click="setTemplate" style="color: #ffff;margin-left: 10px;">
<template v-if="userInfo.IsEditTripTemplate==1&&model==1"> <template v-if="userInfo.IsEditTripTemplate==1&&model==1">
保存模板 {{searchData.TemplateType!=2?'保存模板':'保存广告'}}
</template> </template>
<template v-if="(ConfigId>0&&model!=2)"> <template v-if="ConfigId>0&&model!=2">
保存行程 保存行程
</template> </template>
</el-button> </el-button>
<template v-if="model==2"> <template v-if="model==2">
<Popover trigger="click" placement="bottom-start" v-model:value="sellSaveVisible"> <el-dropdown v-if="searchData.sellId>0" split-button
<template #content> size="small" type="primary">
<div> 保存
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-button type="primary" <el-button type="primary"
size="small" :loading="datas.loading" size="small" :loading="datas.loading"
style="color: #ffff;margin-left: 10px;" style="color: #ffff;"
@click="setTemplate(0)"> @click="setTemplate(0)">
保存模板 保存模板
</el-button> </el-button>
</div> </el-dropdown-item>
<div class="q-mt-md"> <el-dropdown-item>
<el-button type="primary" <el-button type="primary"
size="small" :loading="datas.loading" size="small" :loading="datas.loading"
style="color: #ffff;margin-left: 10px;" style="color: #ffff;"
@click="setTemplate(1)"> @click="setTemplate(1)">
另存模板 另存模板
</el-button> </el-button>
</div> </el-dropdown-item>
</el-dropdown-menu>
</template> </template>
<el-button v-if="searchData.sellId>0" type="primary" </el-dropdown>
size="small" :loading="datas.loading"
style="color: #ffff;margin-left: 10px;">
保存
</el-button>
</Popover>
<el-button v-if="!searchData.sellId" type="primary" <el-button v-if="!searchData.sellId" type="primary"
size="small" :loading="datas.loading" size="small" :loading="datas.loading"
style="color: #ffff;margin-left: 10px;" style="color: #ffff;margin-left: 10px;"
...@@ -135,6 +134,7 @@ ...@@ -135,6 +134,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ArrowDown } from '@element-plus/icons-vue'
import { nextTick, ref, reactive, inject, computed, watch } from 'vue' import { nextTick, ref, reactive, inject, computed, watch } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { toPng, toJpeg } from 'html-to-image' import { toPng, toJpeg } from 'html-to-image'
...@@ -187,7 +187,6 @@ const hotkeyDrawerVisible = ref(false) ...@@ -187,7 +187,6 @@ const hotkeyDrawerVisible = ref(false)
const editingTitle = ref(false) const editingTitle = ref(false)
const titleInputRef = ref<InstanceType<typeof Input>>() const titleInputRef = ref<InstanceType<typeof Input>>()
const titleValue = ref('') const titleValue = ref('')
const sellSaveVisible = ref(false)
const { setNewDatasList } = useEditor() const { setNewDatasList } = useEditor()
...@@ -278,12 +277,21 @@ const UploadPsdHandler = () => { ...@@ -278,12 +277,21 @@ const UploadPsdHandler = () => {
// 销售新增修改模版 // 销售新增修改模版
const SetSellTemplate = async (type) => { const SetSellTemplate = async (type) => {
try { try {
let TempId = 0
if(queryObj.value.TempId) TempId = queryObj.value.TempId
if(!TempId){
return ElMessage({
showClose: true,
message: '模版不存在, 请重选',
type: 'warning',
})
}
let Id = 0 let Id = 0
if(searchData.value.sellId&&!type) Id = searchData.value.sellId if(searchData.value.sellId&&type==0) Id = searchData.value.sellId
if(type==1) Id = 0 if(type==1) Id = 0
let queryMsg = { let queryMsg = {
Id: Id, Id: Id,
TempId: queryObj.value.TempId, TempId: TempId,
TempData: queryObj.value.TempData, TempData: queryObj.value.TempData,
Title: queryObj.value.Title Title: queryObj.value.Title
} }
...@@ -294,7 +302,6 @@ const SetSellTemplate = async (type) => { ...@@ -294,7 +302,6 @@ const SetSellTemplate = async (type) => {
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
}) })
sellSaveVisible.value = false
setTimeout(()=>{ setTimeout(()=>{
SalesEditorStore.setSalesEditor(0) SalesEditorStore.setSalesEditor(0)
},100) },100)
...@@ -313,6 +320,8 @@ const SetSellTemplate = async (type) => { ...@@ -313,6 +320,8 @@ const SetSellTemplate = async (type) => {
// 新增修改模版 // 新增修改模版
const SetTripTemplateSlide = async () => { const SetTripTemplateSlide = async () => {
try { try {
console.log(queryObj.value,'======')
return
let TemplateRes = await ConfigService.SetTripTemplateSlide(queryObj.value); let TemplateRes = await ConfigService.SetTripTemplateSlide(queryObj.value);
if (TemplateRes.data.resultCode == 1) { if (TemplateRes.data.resultCode == 1) {
if(!queryObj.value.TempId){ if(!queryObj.value.TempId){
...@@ -326,6 +335,7 @@ const SetTripTemplateSlide = async () => { ...@@ -326,6 +335,7 @@ const SetTripTemplateSlide = async () => {
}) })
datas.DataSource.DataSourceOverlay = false datas.DataSource.DataSourceOverlay = false
dataLoadingStore.setDataLoading(1) dataLoadingStore.setDataLoading(1)
useSlidesStore().setThumbnails([])
}else{ }else{
ElMessage({ ElMessage({
showClose: true, showClose: true,
...@@ -387,7 +397,7 @@ const uploadImageHandler = async ()=>{ ...@@ -387,7 +397,7 @@ const uploadImageHandler = async ()=>{
queryObj.value.PageImage.push(url) queryObj.value.PageImage.push(url)
} }
} }
useSlidesStore().setThumbnails([])
} }
loadingInstance.value.close() loadingInstance.value.close()
...@@ -440,12 +450,12 @@ const SetTripTemplateConfig = async () => { ...@@ -440,12 +450,12 @@ const SetTripTemplateConfig = async () => {
} }
// 保存 // 保存
const setTemplate = async (type) =>{ const setTemplate = async (type) =>{
if(searchData.value.TemplateType) queryObj.value.TemplateType = searchData.value.TemplateType
queryObj.value.Title = title.value queryObj.value.Title = title.value
datas.loading = true datas.loading = true
if(SourceLoading.value) setNewDatasList(datas.DataSource) if(SourceLoading.value) setNewDatasList(datas.DataSource)
await uploadImageHandler() await uploadImageHandler()
console.log(JSON.stringify(queryObj.value))
let arr = JSON.parse(JSON.stringify(slides.value)) let arr = JSON.parse(JSON.stringify(slides.value))
if(dataLoading.value){ if(dataLoading.value){
dataLoadingStore.setDataLoading(0) dataLoadingStore.setDataLoading(0)
...@@ -483,6 +493,7 @@ const setTemplate = async (type) =>{ ...@@ -483,6 +493,7 @@ const setTemplate = async (type) =>{
} }
} else { } else {
arr.forEach(x=>{ arr.forEach(x=>{
if(searchData.value.TemplateType==2) x.pageType = 0
x.elements.forEach(y=>{ x.elements.forEach(y=>{
delete y.TemplateList delete y.TemplateList
delete y.TemplateDataSource delete y.TemplateDataSource
...@@ -503,12 +514,12 @@ const setTemplate = async (type) =>{ ...@@ -503,12 +514,12 @@ const setTemplate = async (type) =>{
// console.log(arr,'-------tttt') // console.log(arr,'-------tttt')
queryObj.value.TempData = JSON.stringify(arr) queryObj.value.TempData = JSON.stringify(arr)
console.log(JSON.stringify(queryObj.value)) // console.log(JSON.stringify(queryObj.value))
if(model.value==1&&userInfo.value.IsEditTripTemplate==1){ if(model.value==1&&userInfo.value.IsEditTripTemplate==1){
await SetTripTemplateSlide() await SetTripTemplateSlide()
}else if(ConfigId.value&&model.value!=2){ }else if(ConfigId.value&&model.value!=2){
await SetTripTemplateConfig() await SetTripTemplateConfig()
}else if(model.value==2){ }else if(model.value==2&&SalesEditor.value>0&&(SalesEditor.value==1||SalesEditor.value==2)){
await SetSellTemplate(type) await SetSellTemplate(type)
} }
} }
......
...@@ -374,7 +374,7 @@ const GetTripTemplate = async () =>{ ...@@ -374,7 +374,7 @@ const GetTripTemplate = async () =>{
}, },
} }
] ]
slidesStore.setTitle('模版名称') slidesStore.setTitle(searchData.value.TemplateType!=2?'模版名称':'广告名称')
return slidesStore.setSlides(list) return slidesStore.setSlides(list)
} }
try { try {
...@@ -390,6 +390,7 @@ const GetTripTemplate = async () =>{ ...@@ -390,6 +390,7 @@ const GetTripTemplate = async () =>{
if(SalesBack.value==0||(SalesBack.value==1&&searchData.value.TempId)){ if(SalesBack.value==0||(SalesBack.value==1&&searchData.value.TempId)){
let viewportRatio = 1.414 let viewportRatio = 1.414
if(dataRes.data.data.TempType==1) viewportRatio = 0.7069 if(dataRes.data.data.TempType==1) viewportRatio = 0.7069
if(dataRes.data.data.Width&&dataRes.data.data.Height) viewportRatio = dataRes.data.data.Height/dataRes.data.data.Width
slidesStore.setViewportRatio(viewportRatio) slidesStore.setViewportRatio(viewportRatio)
let SlidesData = JSON.parse(dataRes.data.data.TempData) let SlidesData = JSON.parse(dataRes.data.data.TempData)
...@@ -457,18 +458,26 @@ const sellGetTripTemplate = async () =>{ ...@@ -457,18 +458,26 @@ const sellGetTripTemplate = async () =>{
} }
let dataRes = await ConfigService.sellGetTemplateDetails(queryMsg); let dataRes = await ConfigService.sellGetTemplateDetails(queryMsg);
if (dataRes.data.resultCode == 1) { if (dataRes.data.resultCode == 1) {
if(searchData.value.TempId) queryObj.value.TempId = searchData.value.TempId
else if(searchData.value.TempId2&&!searchData.value.TempId) queryObj.value.TempId = searchData.value.TempId2
else if(searchData.value.sellTempId) queryObj.value.TempId = searchData.value.sellTempId
else if(TempId.value) queryObj.value.TempId = TempId.value
let dataObj = dataRes.data.data let dataObj = dataRes.data.data
let viewportRatio = 1.414 let viewportRatio = 1.414
if(dataRes.data.data.TempType==1) viewportRatio = 0.7069 if(dataRes.data.data.TempType==1) viewportRatio = 0.7069
if(dataRes.data.data.Width&&dataRes.data.data.Height) viewportRatio = dataRes.data.data.Height/dataRes.data.data.Width
slidesStore.setViewportRatio(viewportRatio) slidesStore.setViewportRatio(viewportRatio)
if(SalesBack.value==0) slidesStore.setTitle(dataRes.data.data.Title) if(SalesBack.value==0) slidesStore.setTitle(dataRes.data.data.Title)
if(SalesBack.value==0&&searchData.value.sellTempId){ if(SalesBack.value==0&&searchData.value.sellId){
console.log(JSON.parse(dataObj.TempData))
let SlidesData = JSON.parse(dataObj.TempData) let SlidesData = JSON.parse(dataObj.TempData)
let newSlides = [] let newSlides = []
await SlidesData.forEach((x,i)=>{ await SlidesData.forEach((x,i)=>{
newSlides.push(x) newSlides.push(x)
}) })
slidesStore.setSlides(newSlides) slidesStore.setSlides(newSlides)
} }
} }
} catch (error) { } catch (error) {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
</Button> </Button>
</div> </div>
</div> </div>
<template v-if="searchData.TemplateType!=2">
<div class="row q-mt-md"> <div class="row q-mt-md">
<Button style="flex: 1;" @click="AllDataSource()"> <Button style="flex: 1;" @click="AllDataSource()">
<!-- <span class="Required">*</span> --> <!-- <span class="Required">*</span> -->
...@@ -34,11 +35,12 @@ ...@@ -34,11 +35,12 @@
/> />
</el-select> </el-select>
</div> </div>
</template>
<p class="q-mt-md"><span class="Required q-mr-md">*</span>模版名称</p> <p class="q-mt-md"><span class="Required q-mr-md">*</span>{{searchData.TemplateType!=2?'模版名称':'广告名称'}}</p>
<div class="row wrap q-mt-md"> <div class="row wrap q-mt-md">
<el-input v-model="titleValue" @blur="handleUpdateTitle()" <el-input v-model="titleValue" @blur="handleUpdateTitle()"
placeholder="输入模板名称" class="input-with-select"></el-input> :placeholder="searchData.TemplateType!=2?'输入模板名称':'输入广告名称'" class="input-with-select"></el-input>
</div> </div>
<p class="q-mt-md"><span class="Required q-mr-md">*</span>国家:</p> <p class="q-mt-md"><span class="Required q-mr-md">*</span>国家:</p>
<div class="row wrap q-mt-md"> <div class="row wrap q-mt-md">
...@@ -202,7 +204,7 @@ ...@@ -202,7 +204,7 @@
import { useMainStore, useSlidesStore, useScreenStore } from '@/store' import { useMainStore, useSlidesStore, useScreenStore } from '@/store'
import LineService from '@/services/LineService' import LineService from '@/services/LineService'
import ConfigService from '@/services/ConfigService' import ConfigService from '@/services/ConfigService'
import { injectKeyDataSource } from '@/types/injectKey' import { injectKeyDataSource, injectKeyTemplate } from '@/types/injectKey'
import { getHtmlPlainText } from '@/utils/common' import { getHtmlPlainText } from '@/utils/common'
import useExport from '@/hooks/useExport' import useExport from '@/hooks/useExport'
import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue' import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue'
...@@ -222,8 +224,10 @@ ...@@ -222,8 +224,10 @@
}) })
const dispositionObj = ref({} as any) const dispositionObj = ref({} as any)
const queryObj = ref({} as any) const queryObj = ref({} as any)
const searchData = ref({} as any)
datas.DataSource = inject(injectKeyDataSource) datas.DataSource = inject(injectKeyDataSource)
queryObj.value = inject(injectKeyDataSource).queryObj queryObj.value = inject(injectKeyDataSource).queryObj
searchData.value = inject(injectKeyTemplate)
const lines = ref([] as Array < any > ) //线路 const lines = ref([] as Array < any > ) //线路
const Series = ref([] as Array < any > ) //系列 const Series = ref([] as Array < any > ) //系列
......
...@@ -113,6 +113,9 @@ const datas = reactive({ ...@@ -113,6 +113,9 @@ const datas = reactive({
ColorStr: null,//颜色值 是 [string] ColorStr: null,//颜色值 是 [string]
TempType: 1,// 版面类型(1-横版,2-竖版) TempType: 1,// 版面类型(1-横版,2-竖版)
TagJsonStr: '',// 标签 TagJsonStr: '',// 标签
TemplateType: 0,
Width: 0,
Height: 0,
} }
}, },
......
...@@ -13,10 +13,28 @@ ...@@ -13,10 +13,28 @@
</el-input> </el-input>
</el-col> </el-col>
<el-col :span="6" style="text-align: right;"> <el-col :span="6" style="text-align: right;">
<el-button v-if="userInfo.IsEditTripTemplate==1&&model==1" <el-dropdown split-button
v-tooltip="'添加模版'" type="primary" size="small" type="primary"
size="small" icon="Plus" v-if="userInfo.IsEditTripTemplate==1&&model==1">
@click="addTemplate()" style="color: #ffff;"></el-button> <span style="font-size: 23px;"> + </span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-button type="primary" size="small"
@click="addTemplate(1)" style="color: #ffff;">
添加模版
</el-button>
</el-dropdown-item>
<el-dropdown-item v-if="false">
<el-button type="primary" size="small"
@click="addTemplate(2)" style="color: #ffff;">
添加广告
</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button v-if="SalesEditor>0" <el-button v-if="SalesEditor>0"
v-tooltip="SalesBack==1?'返回到上页':'返回到首页'" type="primary" v-tooltip="SalesBack==1?'返回到上页':'返回到首页'" type="primary"
size="small" size="small"
...@@ -25,9 +43,9 @@ ...@@ -25,9 +43,9 @@
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<div class="q-mt-lg bg-white rounded text-nowrap" style="padding: 20px 20px 0 20px;"> <div class="q-mt-lg bg-white rounded text-nowrap marketTag" style="padding: 20px 20px 0 20px;">
<div class="row text-small items-center nowrap"> <div class="row text-small items-center nowrap">
<span style="margin-right: 50px;">适用线路:</span> <span style="margin-right: 30px;">适用线路:</span>
<div class="row wrap"> <div class="row wrap">
<el-check-tag :checked="queryObj.LineId == 0" @change="onLineChangeHandler(0)" <el-check-tag :checked="queryObj.LineId == 0" @change="onLineChangeHandler(0)"
class="text-small q-mr-md">全部</el-check-tag> class="text-small q-mr-md">全部</el-check-tag>
...@@ -39,7 +57,7 @@ ...@@ -39,7 +57,7 @@
<div class="row wrap items-center q-pb-md"> <div class="row wrap items-center q-pb-md">
<div class="q-pb-md"> <div class="q-pb-md">
<div class="row text-small items-center wrap"> <div class="row text-small items-center wrap">
<span style="margin-right: 50px;">适用国家:</span> <span style="margin-right: 30px;">适用国家:</span>
<el-check-tag :checked="queryObj.CountryName == ''" @change="onCountryNameChangeHandler('')" <el-check-tag :checked="queryObj.CountryName == ''" @change="onCountryNameChangeHandler('')"
class="text-small q-mr-md">通用</el-check-tag> class="text-small q-mr-md">通用</el-check-tag>
<el-check-tag :checked="queryObj.CountryName == x.CountryName" <el-check-tag :checked="queryObj.CountryName == x.CountryName"
...@@ -52,12 +70,11 @@ ...@@ -52,12 +70,11 @@
v-for="(x,i) in countriesOther" :key="i">{{x.CountryName}}</el-check-tag> v-for="(x,i) in countriesOther" :key="i">{{x.CountryName}}</el-check-tag>
</template> </template>
<div class="row items-center"> <div class="row items-center">
<div v-if="CountryOtherName">
<el-check-tag :checked="queryObj.CountryName"
class="text-small q-mr-md">{{queryObj.CountryName}}</el-check-tag>
</div>
<el-check-tag :checked="CountryOtherName" <el-check-tag :checked="CountryOtherName"
class="text-small q-mr-md q-ml-sm"> class="text-small q-mr-md">
<span class="q-mr-md" v-if="CountryOtherName">
{{queryObj.CountryName}}
</span>
<el-icon class="pointer" v-if="!MenuCountryVisible"> <el-icon class="pointer" v-if="!MenuCountryVisible">
<ArrowDownBold @click="MenuCountryVisible = false"/> <ArrowDownBold @click="MenuCountryVisible = false"/>
</el-icon> </el-icon>
...@@ -75,7 +92,7 @@ ...@@ -75,7 +92,7 @@
</div> </div>
<div class="q-pb-md"> <div class="q-pb-md">
<div class="row text-small items-center wrap"> <div class="row text-small items-center wrap">
<span style="margin-right: 50px;">季节:</span> <span style="margin-right: 30px;">季节:</span>
<el-check-tag :checked="queryObj.SeasonName == ''" @change="onSeasonNameChangeHandler('')" <el-check-tag :checked="queryObj.SeasonName == ''" @change="onSeasonNameChangeHandler('')"
class="text-small q-mr-md">通用</el-check-tag> class="text-small q-mr-md">通用</el-check-tag>
<el-check-tag :checked="queryObj.SeasonName == x.SeasonName" @change="onSeasonNameChangeHandler(x.SeasonName)" <el-check-tag :checked="queryObj.SeasonName == x.SeasonName" @change="onSeasonNameChangeHandler(x.SeasonName)"
...@@ -87,7 +104,7 @@ ...@@ -87,7 +104,7 @@
</div> </div>
<div class="q-pb-md"> <div class="q-pb-md">
<div class="row text-small items-center nowrap"> <div class="row text-small items-center nowrap">
<span style="margin-right: 50px;">颜色:</span> <span style="margin-right: 30px;">颜色:</span>
<el-check-tag :checked="queryObj.ColorName == ''" @change="onColorNameChangeHandler('')" <el-check-tag :checked="queryObj.ColorName == ''" @change="onColorNameChangeHandler('')"
class="text-small q-mr-md">通用</el-check-tag> class="text-small q-mr-md">通用</el-check-tag>
<div class="row items-center nowrap"> <div class="row items-center nowrap">
...@@ -148,6 +165,18 @@ ...@@ -148,6 +165,18 @@
</Popover> </Popover>
</div> </div>
</div> </div>
<div class="q-pb-md">
<div class="MarketVerticalLine">&nbsp;</div>
</div>
<div class="q-pb-md" v-if="false">
<div class="row text-small items-center wrap">
<span style="margin-right: 30px;">类型:</span>
<el-check-tag :checked="queryObj.TemplateType == 0" @change="onTypeChangeHandler('')"
class="text-small q-mr-md">不限</el-check-tag>
<el-check-tag :checked="queryObj.TemplateType == x.type" @change="onTypeChangeHandler(x.type)"
class="text-small q-mr-md" v-for="(x,i) in typeArr" :key="i">{{x.typeName}}</el-check-tag>
</div>
</div>
</div> </div>
</div> </div>
<div style="margin-top: 20px;"> <div style="margin-top: 20px;">
...@@ -221,6 +250,7 @@ ...@@ -221,6 +250,7 @@
const colorArrOther = ref([] as Array < any > ); //颜色 const colorArrOther = ref([] as Array < any > ); //颜色
const colorArr = ref([] as Array < any > ); //颜色 const colorArr = ref([] as Array < any > ); //颜色
const seasonArr = ref([] as Array < any > ); //季节 const seasonArr = ref([] as Array < any > ); //季节
const typeArr = ref([] as Array < any > ); //类型
const dataList = ref([] as Array < any > ); //模板数据列表 const dataList = ref([] as Array < any > ); //模板数据列表
const marketRef = ref<any>() const marketRef = ref<any>()
const MenuColorVisible = ref(false) const MenuColorVisible = ref(false)
...@@ -246,6 +276,8 @@ ...@@ -246,6 +276,8 @@
ColorName: '', //颜色名称 ColorName: '', //颜色名称
pageCount: 0, //总页数 pageCount: 0, //总页数
TempType: 0, TempType: 0,
TemplateType: 0,//1模版 2广告
type: 0,
}) })
const loading = ref(false as any) const loading = ref(false as any)
...@@ -260,7 +292,8 @@ ...@@ -260,7 +292,8 @@
const SalesEditorStore = useSellTemplateStore() const SalesEditorStore = useSellTemplateStore()
const { SalesEditor, SalesBack } = storeToRefs(useSellTemplateStore()) const { SalesEditor, SalesBack } = storeToRefs(useSellTemplateStore())
const addTemplate = () =>{ const addTemplate = (type:number) =>{
searchData.value.TemplateType = type
marketStore.setMarket(!market) marketStore.setMarket(!market)
searchData.value.TempId = 0 searchData.value.TempId = 0
} }
...@@ -335,6 +368,7 @@ ...@@ -335,6 +368,7 @@
if(!ConfigId.value&&!model.value) return if(!ConfigId.value&&!model.value) return
datas.DetailsVisible = false datas.DetailsVisible = false
searchData.value.TempId = item.TempId searchData.value.TempId = item.TempId
searchData.value.TemplateType = item.TemplateType
marketStore.setMarket(false) marketStore.setMarket(false)
datas.TemplateRow = {} datas.TemplateRow = {}
// console.log("item", item.TempId); // console.log("item", item.TempId);
...@@ -381,6 +415,13 @@ ...@@ -381,6 +415,13 @@
queryTemplateBySearchHandler(); queryTemplateBySearchHandler();
} }
//类型切换
const onTypeChangeHandler = (Type: string) => {
queryObj.TemplateType = Type;
queryObj.pageIndex = 1
queryTemplateBySearchHandler();
}
//颜色切换 //颜色切换
const onColorNameChangeHandler = (ColorName: string,ColorValue: String) => { const onColorNameChangeHandler = (ColorName: string,ColorValue: String) => {
MenuColorVisible.value = false MenuColorVisible.value = false
...@@ -427,6 +468,17 @@ ...@@ -427,6 +468,17 @@
if (tempData && tempData.SeasonList) { if (tempData && tempData.SeasonList) {
seasonArr.value = tempData.SeasonList; seasonArr.value = tempData.SeasonList;
} }
//类型
for(let i=1;i<3;i++){
typeArr.value.push({
type:i,
typeName:i==1?'模版':'广告'
})
}
// if (tempData && tempData.SeasonList) {
// seasonArr.value = tempData.SeasonList;
// }
} }
} catch (error) { } catch (error) {
console.log("getTemplateQuery", error); console.log("getTemplateQuery", error);
...@@ -463,6 +515,9 @@ ...@@ -463,6 +515,9 @@
url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/pz3etdXOpfWP.woff") format("woff"); url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/pz3etdXOpfWP.woff") format("woff");
font-display: swap; font-display: swap;
} }
.marketTag .el-check-tag.is-checked,.marketTag .el-check-tag{
padding: 5px 8px;
}
.colorMark:hover .ColorNameBox { .colorMark:hover .ColorNameBox {
display: block; display: block;
} }
......
<template> <template>
<div ref="SellTemplateRef"> <div ref="SellTemplateRef">
<el-row justify="space-between"> <el-row justify="space-between" class="items-center">
<el-col :span="4"></el-col> <el-col :span="6" class="row items-center">
<el-col :span="10"> <!-- <el-button-group class="ml-4">
<el-button type="primary" size="small" @click="querySearchHandler">模版</el-button>
<el-button type="primary" size="small" @click="querySearchHandler">广告</el-button>
</el-button-group> -->
</el-col>
<el-col :span="8">
<el-input v-model="queryObj.Title" placeholder="输入关键字快速查找" class="input-with-select"> <el-input v-model="queryObj.Title" placeholder="输入关键字快速查找" class="input-with-select">
<template #append> <template #append>
<el-button type="primary" @click="querySearchHandler">搜索</el-button> <el-button type="primary" @click="querySearchHandler">搜索</el-button>
</template> </template>
</el-input> </el-input>
</el-col> </el-col>
<el-col :span="4"></el-col> <el-col :span="4" class="row flex-end">
<sellNavs />
</el-col>
</el-row> </el-row>
<div style="margin-top: 20px;"> <div style="margin-top: 20px;">
<div v-if="dataList.length>0" class="column"> <div v-if="dataList.length>0" class="bg-white column q-mt-lg rounded q-px-lg">
<div class="row flex-between nowrap sellHeader"> <div class="row flex-between nowrap sellHeader">
<div>名称</div> <div>名称</div>
<div>创建人</div> <div>创建人</div>
...@@ -68,12 +75,12 @@ ...@@ -68,12 +75,12 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="dataList.length == 0 && !loading" class="q-mt-lg bg-white rounded" <div v-else-if="dataList.length == 0 && !loading" class="q-mt-lg bg-white rounded"
style="padding: 30px 10px 30px 10px;"> style="padding: 30px 10px 30px 10px;">
<el-empty description="暂无数据" /> <el-empty description="暂无数据" />
</div> </div>
<el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'> <el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'>
<span class="text-samll bg-white" style="padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span> <span class="text-samll bg-white" style="background: #f3f6fb;padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider> </el-divider>
<div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div> <div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
</div> </div>
...@@ -91,6 +98,7 @@ ...@@ -91,6 +98,7 @@
import QRCode from '@/components/QRCode/QRCode.vue' import QRCode from '@/components/QRCode/QRCode.vue'
import sellNavs from '@/views/components/sellNavs/index.vue'
import navItem from '@/views/components/navs/index.vue' import navItem from '@/views/components/navs/index.vue'
......
<template> <template>
<div class="common-layout" style="background: #f3f6fb;height:100vh;overflow: auto;"> <div class="common-layout" style="background: #f3f6fb;height:100vh;overflow: auto;">
<div style="padding: 30px; max-width:1440px; margin:0 auto;height: 100%;"> <div style="padding: 30px; max-width:1440px; margin:0 auto;height: 100%;">
<el-container class="SellTemplate-form bg-white"> <div class="rounded-bottom rounded-top">
<el-aside width="200px">
<sellNavs />
</el-aside>
<el-container>
<el-main class="bg-white rounded-bottom rounded-top">
<SellTemplate /> <SellTemplate />
</el-main> </div>
</el-container>
</el-container>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, provide, watch, inject } from 'vue' import { ref, reactive, provide, watch, inject } from 'vue'
import sellNavs from '@/views/components/sellNavs/index.vue'
import SellTemplate from './SellTemplate.vue' import SellTemplate from './SellTemplate.vue'
const datas = reactive({ const datas = reactive({
SellDatas:{ SellDatas:{
activeId: 1, activeId: 1,
...@@ -30,7 +23,6 @@ ...@@ -30,7 +23,6 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.SellTemplate-form{ .SellTemplate-form{
height: 100%; height: 100%;
background: none;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="navs-form"> <div class="navs-form row items-center">
<el-button class="navs-Button" type="primary" @click="sellAdd(1)"> <el-dropdown split-button
size="small" type="primary">
<span style="font-size: 23px;margin-right: 10px;"> + </span> <span>新建</span> <span style="font-size: 23px;margin-right: 10px;"> + </span> <span>新建</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-button type="primary"
size="small" :loading="datas.loading"
style="color: #ffff;"
@click="sellAdd(1)">
新建模版
</el-button> </el-button>
</el-dropdown-item>
<!-- <el-dropdown-item>
<el-button type="primary"
size="small" :loading="datas.loading"
style="color: #ffff;"
@click="setTemplate(3)">
新建广告
</el-button>
</el-dropdown-item> -->
</el-dropdown-menu>
</template>
</el-dropdown>
<!-- <el-button class="navs-Button" type="primary" @click="sellAdd(1)">
<span style="font-size: 23px;margin-right: 10px;"> + </span> <span>新建</span>
</el-button> -->
<div class="q-mt-lg"> <div class="q-mt-lg">
<div v-for="(item,index) in datas.navs" class="q-mb-md"> <div v-for="(item,index) in datas.navs" class="q-mb-md">
<el-button class="navs-Button" <el-button class="navs-Button"
...@@ -17,6 +41,7 @@ ...@@ -17,6 +41,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ArrowDown } from '@element-plus/icons-vue'
import { reactive, ref, inject, watch, onMounted} from "vue"; import { reactive, ref, inject, watch, onMounted} from "vue";
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useSellTemplateStore,useScreenStore } from '@/store' import { useSellTemplateStore,useScreenStore } from '@/store'
...@@ -37,17 +62,17 @@ ...@@ -37,17 +62,17 @@
] ]
}) })
datas.SellDatas = inject('SellDatas') datas.SellDatas = inject('SellDatas')
const sellAdd = () =>{ const sellAdd = (type:number) =>{
searchData.value.sellId = 0 searchData.value.sellId = 0
searchData.value.sellTempId = 0 searchData.value.sellTempId = 0
SalesEditorStore.setSalesEditor(1) SalesEditorStore.setSalesEditor(type)
marketStore.setMarket(true) marketStore.setMarket(true)
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navs-form{ .navs-form{
padding: 15px; /* padding: 15px; */
} }
.navs-Button{ .navs-Button{
width: 100%; width: 100%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment