Commit 1d94e02d authored by zhengke's avatar zhengke

定时更新数据 接口

parent 16de2048
......@@ -89,6 +89,14 @@ class ConfigService{
return Api.Post("triptemplate_RemoveTripOther",params)
}
/**
* 销售行程获取缓存数据
*/
static async GetTripOtherMongo(Id: any):Promise<HttpResponse>{
let params = {Id}
return Api.Post("triptemplate_GetTripOtherMongo",params)
}
/**
* 销售行程定时更新数据
*/
......
......@@ -142,7 +142,7 @@
<script lang="ts" setup>
import { ArrowDown } from '@element-plus/icons-vue'
import { nextTick, ref, reactive, inject, computed, watch, provide } from 'vue'
import { nextTick, ref, reactive, inject, computed, watch, provide, onBeforeUnmount } from 'vue'
import { storeToRefs } from 'pinia'
import { toPng, toJpeg } from 'html-to-image'
import message from '@/utils/message'
......@@ -229,7 +229,7 @@ if(queryObj.value.Title) titleValue.value = queryObj.value.Title
const MonitoringNumber = ref(0)
const MonitoringTNumber = ref(0)
const timer = 10
const timer = 30
const Countdown = ref<any>(timer)
const intervalId = ref(null);
const showTimer = ref(false);
......@@ -255,6 +255,9 @@ const goBack = (type:any) =>{
path = `/market/op/${ConfigId.value}/${TempType.value}`
router.push({path})
}else if(model.value==2){
clearInterval(intervalId.value);
intervalId.value = null;
UpdateItinerary()
if(type==1) {
searchData.value.SalesEditor = router.currentRoute.value.params
if(searchData.value.sellId)searchData.value.TempId2 = queryObj.value.TempId
......@@ -321,11 +324,9 @@ const UpdateItinerary = async () => {
}
const result = await ConfigService.SetTripOtherTemp(queryMsg);
if (result.data.resultCode == 1) {
console.log(Countdown.value,'======成功')
datas.loading = false
}else{
datas.loading = false
console.log('更新行程数据成功-----')
}
datas.loading = false
}
}
......@@ -621,6 +622,8 @@ const setTemplate = async (type) =>{
datas.loading = true
await SetTripTemplateConfig()
}else if(model.value==2&&SalesEditor.value>0){
clearInterval(intervalId.value);
intervalId.value = null;
if(type==1||!searchData.value.sellId){
let obj = {
FileName: queryObj.value.Title,
......@@ -665,25 +668,34 @@ watch(()=>autoSave.value,(newVal)=>{
}
})
watch(()=>slides.value,(newVal,oldVal)=>{
if(!MonitoringNumber.value||MonitoringNumber.value<2) MonitoringNumber.value++
if(MonitoringNumber.value>1) {
Countdown.value = timer
benginTimer()
if(model.value==2&&SalesEditor.value>0){
if(!MonitoringNumber.value||MonitoringNumber.value<2) MonitoringNumber.value++
if(MonitoringNumber.value>1) {
Countdown.value = timer
benginTimer()
}
}
},{
deep: true,
immediate: false
})
watch(()=>queryObj.value.Title,(newVal,oldVal)=>{
if(!MonitoringTNumber.value||MonitoringTNumber.value<2) MonitoringTNumber.value++
if(MonitoringTNumber.value>1) {
Countdown.value = timer
benginTimer()
if(model.value==2&&SalesEditor.value>0){
if(!MonitoringTNumber.value||MonitoringTNumber.value<2) MonitoringTNumber.value++
if(MonitoringTNumber.value>1) {
Countdown.value = timer
benginTimer()
}
}
console.log('000---',MonitoringTNumber.value)
})
handleUpdateTitle()
onBeforeUnmount(() => {
clearInterval(intervalId.value);
intervalId.value = null;
});
</script>
<style lang="scss" scoped>
......
......@@ -754,11 +754,55 @@ const sellGetTripTemplate = async () =>{
slidesStore.setSlides(newSlides)
}
}else ElMessage({
showClose: true,
message: dataRes.data.message,
type: 'warning',
})
if(searchData.value.sellId) getTripOtherMongo()
} catch (error) {
}
}
// 销售模版缓存数据
const getTripOtherMongo = async () =>{
try {
const loadingObj = ElLoading.service({text:'正在获取缓存数据',lock:true})
let dataRes = await ConfigService.GetTripOtherMongo(searchData.value.sellId);
if (dataRes.data.resultCode == 1) {
let dataObj = dataRes.data.data
let SlidesData = JSON.parse(dataObj.TempData)
let newSlides = []
SlidesData.forEach((x,i)=>{
x.elements.forEach((y:any)=>{
if(y.content && y.defaultFontName && y.defaultFontName.includes(',')) y.defaultFontName = y.defaultFontName.split(',')[0]
if(y.content && (y.content.includes('&amp;nbsp;'))){
y.content = y.content.replaceAll('&amp;nbsp;','&nbsp;')
//y.content=y.content.replaceAll('&nbsp;',' ')
}
if(y.contentStr && !y.contentStr.includes('<p') && y.content && y.content.includes(y.contentStr)){
let temp = HtmlUtil.htmlEncodeByRegExp(y.contentStr)
if(temp!=y.contentStr) {
y.content = y.content.replace(y.contentStr,temp)
}
}
})
newSlides.push(x)
})
slidesStore.setSlides(newSlides)
loadingObj.close()
}else {
loadingObj.close()
ElMessage({
showClose: true,
message: dataRes.data.message,
type: 'warning',
})
}
} catch (error) {
}
......
......@@ -13,7 +13,14 @@
<div class="symbol-item NormalDataCenter cursor-pointer"
:class="[current==item.Feature?'active':'']"
v-for="(item,index) in dataList" @click="setElText(item,index)">
<div class="title fz14 text-weight-bold text-ellipsis">{{item.Name}}</div>
<div class="title fz14 text-weight-bold text-ellipsis">
<el-tooltip
style="width: 100%;"
effect="dark"
:content="item.Name"
placement="top"
>{{item.Name}}</el-tooltip>
</div>
<div class="images">
<el-image :src="item.PicPath" style="width: 100%;"
fit="cover">
......@@ -25,7 +32,12 @@
</el-image>
</div>
<div class="text fz12">
{{item.Feature}}
<el-tooltip
style="width:200px;"
effect="dark"
:content="item.Feature"
placement="top"
>{{item.Feature}}</el-tooltip>
</div>
</div>
</div>
......
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