Commit 8d2b568a authored by 罗超's avatar 罗超

Merge branch '1.2.0' of http://gitlab.oytour.com/viitto/pptist into 1.2.0

parents f9f2e874 883a220a
......@@ -288,6 +288,9 @@ page {
padding-left: 10px;
padding-right: 10px;
}
.q-pl-md{
padding-left: 10px;
}
.q-pl-lg{
padding-left: 20px;
}
......@@ -295,6 +298,14 @@ page {
padding-top: 20px;
padding-bottom: 20px;
}
.q-my-sm{
margin-top: 5px;
margin-bottom: 5px;
}
.q-my-md{
margin-top: 10px;
margin-bottom: 10px;
}
.q-my-lg{
margin-top: 20px;
margin-bottom: 20px;
......@@ -310,6 +321,9 @@ page {
.q-pt-lg{
padding-top: 20px;
}
.q-pt-sm{
padding-top: 8px;
}
.q-pt-md{
padding-top: 12px;
}
......@@ -385,4 +399,7 @@ page {
}
.pointer{
cursor: pointer;
}
.wrap{
white-space: wrap;
}
\ No newline at end of file
......@@ -129,6 +129,7 @@ import {
AssemblyLine,
More,
Setting,
Refresh,
} from '@icon-park/vue-next'
export interface Icons {
......@@ -262,6 +263,7 @@ export const icons: Icons = {
IconAssemblyLine: AssemblyLine,
IconMore: More,
IconSetting: Setting,
IconRefresh: Refresh,
}
export default {
......
......@@ -51,11 +51,12 @@ export const getHtmlPlainText = (html_str:string) => {
}
}
export const recentTime = (date1:string, date2:string) => {
const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
const firstDate = new Date(date1); // 第一个日期对象
const secondDate = new Date(date2); // 第二个日期对象
// const diffDays = Math.round(Math.abs((firstDate - secondDate) / oneDay)); // 差异天数的绝对值,取整
// 计算距离当前多少天
export const getDaysBetween = (date1:any, date2:any) => {
const ONE_DAY = 1000 * 60 * 60 * 24; // 一天的毫秒数
const date1Time = date1.getTime(); // 获取时间戳
const date2Time = date2.getTime();
// return diffDays;
const difference = Math.abs(date1Time - date2Time); // 获取时间差
return Math.round(difference / ONE_DAY); // 两个日期之间的天数
}
\ No newline at end of file
......@@ -218,7 +218,7 @@
<el-empty description="暂无数据" />
</div>
<el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'>
<span class="text-samll" style="background: #f3f6fb;padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
<span class="text-small" style="background: #f3f6fb;padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider>
<div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
</div>
......
......@@ -89,7 +89,7 @@
<el-empty description="暂无数据" />
</div>
<el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'>
<span class="text-samll bg-white" style="background: #f3f6fb;padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
<span class="text-small bg-white" style="background: #f3f6fb;padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider>
<div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
</div>
......
......@@ -76,7 +76,27 @@
</div>
</div>
<div class="col">
<Example></Example>
<div class="q-px-md q-pt-lg">
<div class="q-pl-lg row q-pb-sm">
<h5 class="q-pl-md">
<template v-if="!currentMenu">最近</template>
<template v-else-if="currentMenu==1">星标</template>
<template v-else-if="currentMenu==2">共享</template>
<template v-else-if="currentMenu==3">行程文档</template>
<template v-else-if="currentMenu==4">广告图</template>
<template v-else-if="currentMenu==-1">回收站</template>
</h5>
<div class="select-btn row items-center q-pl-lg pointer">
<el-icon>
<RefreshRight v-if="!datas.journeyAds.RefreshLoading"
@click="datas.journeyAds.RefreshLoading=true"/>
<Refresh v-else />
</el-icon>
</div>
</div>
</div>
<!-- <Example></Example> -->
<journeyAds v-if="currentMenu==3||currentMenu==4"></journeyAds>
</div>
</div>
</div>
......@@ -88,7 +108,8 @@ import { storeToRefs } from 'pinia';
import { ref,reactive,provide,inject } from 'vue';
import SearchDocument from './components/SearchDocument.vue'
import Example from './components/Example.vue'
import { Plus,ArrowDown,Clock,Star,Share,Picture,Management,Delete } from '@element-plus/icons-vue';
import journeyAds from './components/journeyAds.vue'
import { Plus,ArrowDown,Clock,Star,Share,Picture,Management,Delete,RefreshRight,Refresh } from '@element-plus/icons-vue';
import { injectKeyTemplate } from '@/types/injectKey'
import { useSellTemplateStore, useScreenStore, useSlidesStore } from '@/store'
......@@ -97,14 +118,21 @@ const {userInfo} = storeToRefs(userStore())
const currentMenu = ref<number>(0)
const datas = reactive({
SellDatas:{
currentMenu: 3,
journeyAds:{
RefreshLoading: false
}
})
provide('SellDatas',datas.SellDatas)
provide('journeyAds',datas.journeyAds)
const searchData = ref({} as any)
searchData.value = inject(injectKeyTemplate)
if(searchData.value.SellTemplateType){
let current = 0
if(searchData.value.SellTemplateType==1) current = 3
if(searchData.value.SellTemplateType==2) current = 4
currentMenu.value = current
}
const SalesEditorStore = useSellTemplateStore()
const marketStore = useScreenStore()
......@@ -117,6 +145,10 @@ const sellAdd = (type:number) =>{
const setCurrentMenuHandler=(i:number)=>{
currentMenu.value=i
let TemplateType = 1
if(i==3) TemplateType = 1
if(i==4) TemplateType = 2
if(TemplateType) searchData.value.SellTemplateType = TemplateType
}
</script>
<style scoped>
......
<template>
<div ref="SellTemplateRef" class="journeyAds-container" style="height: 100%;overflow: auto;">
<el-scrollbar @scroll="scrollingHandler" height="100%" class="q-px-md">
<pre style="min-width:700px;">
<table class="text-small" style="width: 100%">
<tr>
<th class="text-left" style="width: 20px;"><el-checkbox size="sm" v-model="datas.selectAll"
@click="clickSelectAll"/></th>
<th colspan="2" class="text-light"><div class="text-left q-pl-md">文档名称</div></th>
<th class="text-light">最近修改</th>
<th class="text-light">创建者</th>
<th width="150" class="text-light">操作</th>
</tr>
<template v-for="(item,index) in dataList">
<tr class="text-5B5D62 journeyAdsple-table pointer">
<td class=""><div class="row items-center hoverShow"
:style="{'opacity':item.singleChoice?1:''}">
<el-checkbox size="sm" v-model="item.singleChoice"
@click="singleChoice(item)"/></div></td>
<td class="" style="width: 30px;"><img class="q-px-md" :src="item.TemplateType==1?datas.pdfImg:datas.adsImg"
style="height: 25px;" /></td>
<td class="journeyAdsple-title wrap"><span>{{item.Title}}</span></td>
<td class="text-center"><span>{{item.Day?item.Day+'天前':item.UpdateTime}}</span></td>
<td class="text-center"><span>{{item.CreateByName}}</span></td>
<td class="text-center"><div class="hoverShow row items-center just-center q-pt-sm"><el-button type="primary" :icon="Edit" size="small" @click="editDelete(item)">编辑</el-button><el-dropdown class="q-pl-md" trigger="click"><el-icon size="16" color="#b1b7cf"><MoreFilled /></el-icon>
<template #dropdown>
<el-dropdown-menu class="q-pa-md">
<el-dropdown-item icon="EditPen">重命名</el-dropdown-item>
<el-dropdown-item icon="Clock">历史版本</el-dropdown-item>
<el-dropdown-item icon="Position">分享</el-dropdown-item>
<el-dropdown-item icon="Delete" @click="editDelete(item,1)">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown></div></td>
</tr>
</template>
</table>
</pre>
<div v-if="dataList.length == 0 && !loading" class="q-mt-lg bg-white rounded"
style="padding: 30px 10px 30px 10px;">
<el-empty description="暂无数据" />
</div>
<el-divider class="no-bg q-mt-lg" v-if='queryObj.pageCount == queryObj.pageIndex && !loading'>
<span class="text-small bg-white" style="padding: 0 10px;color:#a3a3a3">已加载完成所有数据</span>
</el-divider>
<div style="height:40px;" class="q-mt-md no-bg" background="transparent" v-loading="loading" element-loading-text="正在加载中"></div>
</el-scrollbar>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, provide, watch, inject, onMounted } from 'vue'
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
import { MoreFilled,Edit } from '@element-plus/icons-vue'
import ConfigService from '@/services/ConfigService'
import { injectKeyTemplate } from '@/types/injectKey'
import { getDaysBetween } from '@/utils/common'
import { useSellTemplateStore, useScreenStore, useSlidesStore } from '@/store'
const SalesEditorStore = useSellTemplateStore()
const marketStore = useScreenStore()
const PopoverVisibleControls = ref(false)
const dataList = ref([] as Array < any > )
const searchData = ref({} as any)
searchData.value = inject(injectKeyTemplate)
const datas = reactive({
selectedDatas: [] as Array,
selectAll: false as any,
journeyAds:{} as any,
pdfImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_558.png',
adsImg: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1708250377000_777.png',
})
let TemplateType = 0
if(searchData.value.SellTemplateType) TemplateType = searchData.value.SellTemplateType
// if(searchData.value.journeyAds) {
// if(searchData.value.SellTemplateType==3) TemplateType = 1
// else TemplateType = 2
// }
const queryObj = reactive({
Title: '',
pageIndex: 1,
pageSize: 20,
pageCount: 0, //总页数
TemplateType: TemplateType,
})
datas.journeyAds = inject('journeyAds')
const loading = ref(false as any)
const SellTemplateRef = ref<any>()
// 全选按钮
const clickSelectAll = () => {
if(datas.selectAll) {
datas.selectedDatas = dataList.value.map(x=>{
return x.Id
})
}else datas.selectedDatas = []
setTimeout(()=>{
for(let i=0;i<dataList.value.length;i++){
if(datas.selectAll==true) dataList.value[i].singleChoice = true
else dataList.value[i].singleChoice = false
}
},100)
}
const singleChoice = (row:any) => {
if(!row.singleChoice){
datas.selectedDatas.push(row.Id)
}else {
let index
for(let i=0;i<datas.selectedDatas.length;i++){
if(datas.selectedDatas[i] == row.Id) index = i
}
datas.selectedDatas.splice(index,1)
}
if(dataList.value.length>0
&&datas.selectedDatas.length>0
&&dataList.value.length==datas.selectedDatas.length) datas.selectAll = true
if(dataList.value.length>0
&&datas.selectedDatas.length>0
&&dataList.value.length>datas.selectedDatas.length) datas.selectAll = ['']
if(dataList.value.length==0
&&datas.selectedDatas.length==0) datas.selectAll = ['']
console.log(datas.selectedDatas,'----')
}
const setTemplateType = (Id:number) => {
queryObj.pageIndex = 1
queryObj.TemplateType = Id
querySearchHandler()
}
const DeleteTemplate = async (item:any) => {
ElMessageBox.confirm(
'此操作将删除该模版,是否确定?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(async () => {
try {
let queryMsg = {
Id: item.Id
}
deleteLoading.value = ElLoading.service({
lock:true,
text:'正在处理'
})
let pageRes = await ConfigService.sellSetRemoveTemplate(queryMsg);
if (pageRes.data.resultCode == 1) {
queryObj.pageIndex = 1
ElMessage({
showClose: true,
message: `删除${item.TemplateType==2?'广告':'行程'}成功`,
type: 'success',
})
querySearchHandler()
}else {
ElMessage({
showClose: true,
message: `删除${item.TemplateType==2?'广告':'行程'}失败`,
type: 'warning',
})
}
deleteLoading.value.close()
deleteLoading.value = null
} catch (error) {}
}).catch(() => {})
}
const editDelete = async (row:any,type:Number) => {
if(type==1){
DeleteTemplate(row)
}else{
let list = [
{
id: 'test-slide-1',
pageType: 0,
elements: [],
background: {
type: 'solid',
color: '#ffffff',
},
}
]
useSlidesStore().setSlides(list)
searchData.value.sellId = row.Id
searchData.value.sellTempId = row.TempId
searchData.value.TemplateType = row.TemplateType
SalesEditorStore.setSalesEditor(2)
marketStore.setMarket(false)
}
}
const querySearchHandler = async () => {
loading.value = true
try {
if(queryObj.pageIndex == 1) dataList.value =[]
let pageRes = await ConfigService.sellGetTripOtherPage(queryObj);
if (pageRes.data.resultCode == 1) {
let arrList = function(list){
list.forEach(x => {
x.show = false
x.singleChoice = false
const date1 = new Date();
const date2 = new Date(x.UpdateTime);
x.Day = getDaysBetween(date1, date2)
});
}
arrList(pageRes.data.data.pageData)
dataList.value = dataList.value.concat(pageRes.data.data.pageData);
queryObj.pageCount = pageRes.data.data.pageCount;
}
loading.value = false
datas.journeyAds.RefreshLoading = false
} catch (error) {
loading.value = false
datas.journeyAds.RefreshLoading = false
}
}
const scrollingHandler = () =>{
if(SellTemplateRef.value && !loading.value){
let maxHeight = SellTemplateRef.value.scrollHeight - SellTemplateRef.value.offsetHeight
let scrollTop = SellTemplateRef.value.scrollTop
if((maxHeight - scrollTop==0||maxHeight - scrollTop<1) && queryObj.pageCount > queryObj.pageIndex) {
queryObj.pageIndex++
querySearchHandler()
}
}
}
watch(() => searchData.value.SellTemplateType, (n,o) => {
setTemplateType(n)
})
watch(() => datas.journeyAds.RefreshLoading, (n,o) => {
if(!n) return
queryObj.pageIndex = 1
querySearchHandler()
})
onMounted(()=>{
// SellTemplateRef.value.addEventListener("scroll", scrollingHandler);
})
querySearchHandler()
</script>
<style lang="scss" scoped>
@import url('../../../assets/styles/common.css');
.journeyAds-container {
position: relative;
overflow: auto ;
}
.journeyAds-container th {
background: #fff;
position: sticky;
top: 0px;
z-index: 2;
}
.journeyAdsple-table{
}
.journeyAdsple-table td,.journeyAds-container th{
border-bottom: 1px solid #F6F6F6;
}
.journeyAdsple-table td:first-child,
.journeyAdsple-table td:nth-child(2),
.journeyAds-container th:first-child{
border: 0;
}
.journeyAdsple-table td{
padding-bottom: 6px;
}
.journeyAdsple-table td:nth-child(2){
padding-bottom: 0;
}
.hoverShow{
opacity: 0;
}
.journeyAdsple-table:hover .hoverShow{
opacity: 1;
}
</style>
\ No newline at end of file
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