Commit 5edd9e47 by 王志慧

commit

1 parent ab6ed82c
...@@ -48,10 +48,10 @@ const exportCustomer = params => { ...@@ -48,10 +48,10 @@ const exportCustomer = params => {
}) })
} }
// 营销日历列表 // 营销日历列表
const getCalendarListData = params => { const getCalendarList = params => {
params.method = 'marketing.api.calendar.list' params.method = 'marketing.api.calendar.list'
return http({ return http({
url: '/rop-scrm-marketing/router', url,
method: 'POST', method: 'POST',
data: params, data: params,
sign: true, sign: true,
...@@ -65,5 +65,5 @@ export default { ...@@ -65,5 +65,5 @@ export default {
createSuperMarketing, createSuperMarketing,
exportCustomer, exportCustomer,
listByPage, listByPage,
getCalendarListData getCalendarList
} }
...@@ -52,8 +52,9 @@ export default { ...@@ -52,8 +52,9 @@ export default {
commit('SET_ACTIVITY_PEOJECT', data) commit('SET_ACTIVITY_PEOJECT', data)
}, },
//营销日历列表 //营销日历列表
getCalendarList(conText,payload){ getCalendarListData(conText,payload){
apis.calendar.getCalendarListData(payload).then(res=>{ apis.activity.getCalendarList(payload).then(res=>{
console.log(res)
if(res.code == 0){ if(res.code == 0){
conText.commit('SET_CALENDAR_DATA', { calendarData: res.data }) conText.commit('SET_CALENDAR_DATA', { calendarData: res.data })
} }
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<div class="theme-list"> <div class="theme-list">
<template v-for="(item, index) in themeList"> <template v-for="(item, index) in themeList">
<div class="theme-line scrm-c3 scrm-f12 flex" :class="{ select: item.hovering }" :key="index" @mouseenter="item.hovering = true" @mouseleave="item.hovering = false"> <div class="theme-line scrm-c3 scrm-f12 flex" :class="{ select: item.hovering }" :key="index" @mouseenter="item.hovering = true" @mouseleave="item.hovering = false">
<div class="scheme-text">{{ index + 1 }}、{{ item.text }}</div> <div class="scheme-text">{{ index + 1 }}、{{ item.title }}</div>
<div class="flex txt-blue" v-show="item.hovering"> <div class="flex txt-blue" v-show="item.hovering">
<span class="scrm-ml6">引用</span> <span class="scrm-ml6">引用</span>
</div> </div>
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
</template> </template>
<script> <script>
import GlsxCalendar from './components/GlsxCalendar' import GlsxCalendar from './components/GlsxCalendar'
import { mapState } from 'vuex'
export default { export default {
components: { components: {
GlsxCalendar GlsxCalendar
...@@ -94,6 +95,27 @@ export default { ...@@ -94,6 +95,27 @@ export default {
} }
] ]
} }
},
computed: {
...mapState({
calendarData: state => state.marketing.calendarData
})
},
watch: {
calendarData(newVal) {
this.getThemeData(newVal)
}
},
methods: {
getThemeData(data) {
this.themeList = data.map(item => {
return {
title: item.title,
id: item.id,
hovering: false
}
})
}
} }
} }
</script> </script>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<ul class="ul-day" @click="handleShowCalendar"> <ul class="ul-day" @click="handleShowCalendar">
<li class="li-day" v-for="(item, index) in days" :key="index" :isThisMonth="item.isThisMonth"> <li class="li-day" v-for="(item, index) in days" :key="index" :isThisMonth="item.isThisMonth">
{{ item.date }} {{ item.date }}
<img class="star-icon" src="@/assets/star.png" /> <img v-if="item.isStar" class="star-icon" src="@/assets/star.png" />
</li> </li>
</ul> </ul>
</div> </div>
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'SimpleCalendar', name: 'SimpleCalendar',
data() { data() {
...@@ -44,18 +45,37 @@ export default { ...@@ -44,18 +45,37 @@ export default {
}, },
curretIndex: 30, curretIndex: 30,
week: ['日', '一', '二', '三', '四', '五', '六'], week: ['日', '一', '二', '三', '四', '五', '六'],
days: [] days: [],
starList: []
}
},
computed: {
...mapState({
calendarData: state => state.marketing.calendarData
})
},
watch: {
calendarData(newVal) {
console.log(newVal)
this.handleSelectCalendar(newVal)
} }
}, },
methods: { methods: {
handleShowCalendar(){ handleSelectCalendar(data) {
this.starList = data.map(item => {
let dateArray = item.startTime.split('/')
return {
date: +dateArray[2],
month: dateArray[1] - 1,
year: +dateArray[0]
}
})
this.createCalendar(this.current.year, this.current.month)
},
handleShowCalendar() {
console.log(111) console.log(111)
this.$parent.$parent.handleShowCalendar() this.$parent.$parent.handleShowCalendar()
}, },
handleClick: function(index) {
// console.log(item.year + '-' + item.month + '-' + item.date)
this.curretIndex = index
},
plusMonth: function() { plusMonth: function() {
if (this.date.month == 11) { if (this.date.month == 11) {
this.date.month = 0 this.date.month = 0
...@@ -101,8 +121,8 @@ export default { ...@@ -101,8 +121,8 @@ export default {
d.setDate(1) d.setDate(1)
let dayOfFirstDay = d.getDay() let dayOfFirstDay = d.getDay()
this.days = [] this.days = []
let i = 0
for (let i = 0; i < 42; i++) { for (; i < 42; i++) {
d.setDate(1) d.setDate(1)
d.setMonth(month) d.setMonth(month)
d.setDate(i - dayOfFirstDay + 1) d.setDate(i - dayOfFirstDay + 1)
...@@ -132,7 +152,17 @@ export default { ...@@ -132,7 +152,17 @@ export default {
} }
this.days.push(date) this.days.push(date)
// console.log(this.days) }
}
if (i == 42) this.selectStar()
},
selectStar() {
let { days, starList } = this
for (let i = 0; i < starList.length; i++) {
for (let j = 0; j < days.length; j++) {
if (starList[i].date == days[j].date && starList[i].year == days[j].year && starList[i].month == days[j].month) {
days[j].isStar = true
}
} }
} }
} }
...@@ -146,8 +176,6 @@ export default { ...@@ -146,8 +176,6 @@ export default {
this.current.year = d.getFullYear() this.current.year = d.getFullYear()
this.current.month = d.getMonth() this.current.month = d.getMonth()
this.current.date = d.getDate() this.current.date = d.getDate()
this.createCalendar(this.current.year, this.current.month)
} }
} }
</script> </script>
...@@ -265,6 +293,6 @@ export default { ...@@ -265,6 +293,6 @@ export default {
position: absolute; position: absolute;
top: 17px; top: 17px;
left: 8px; left: 8px;
height:8px; height: 8px;
} }
</style> </style>
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<script> <script>
import Calendar from '@toast-ui/calendar' import Calendar from '@toast-ui/calendar'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import { mapState } from 'vuex'
export default { export default {
data() { data() {
return { return {
...@@ -21,49 +22,40 @@ export default { ...@@ -21,49 +22,40 @@ export default {
options: { options: {
defaultView: 'month', defaultView: 'month',
calendars: [] calendars: []
} },
eventList: []
} }
}, },
computed: {
...mapState({
calendarData: state => state.marketing.calendarData
})
},
mounted() { mounted() {
let container = this.$refs.calendar let container = this.$refs.calendar
this.calendar = new Calendar(container, this.options) this.calendar = new Calendar(container, this.options)
this.calendar.on('clickEvent', e => { this.calendar.on('clickEvent', e => {
console.log(e) // console.log(e)
}) })
this.getCalendarData() this.getCalendarData()
}, },
methods: { methods: {
getCalendarData() { getCalendarData() {
this.calendar.createEvents([ let { eventList, calendarData,calendar, currentDate } = this
{ eventList = calendarData.map(item => {
id: 'event1', return {
calendarId: 'cal2', id: item.id,
title: 'Weekly meeting', calendarId: item.id,
start: '2023-05-07', title: item.title,
end: '2023-05-07' start: item.startTime.replace('/', '-'),
}, end: item.endTime
{
id: 'event2',
calendarId: 'cal1',
title: 'Lunch appointment',
start: '2023-05-08',
end: '2023-05-09'
},
{
id: 'event3',
calendarId: 'cal2',
title: 'Vacation',
start: '2023-05-08',
end: '2023-05-10',
isAllday: true,
category: 'allday'
} }
]) })
calendar.createEvents(eventList)
this.currentDate = dayjs(this.calendar.getDate()).format('YYYY年MM') this.currentDate = dayjs(this.calendar.getDate()).format('YYYY年MM')
}, },
handlePrev(type) { handlePrev(type) {
this.calendar[type]() this.calendar[type]()
this.getCalendarData()
} }
} }
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<marketing-right></marketing-right> <marketing-right></marketing-right>
</div> </div>
</div> </div>
<div v-show="showCalendar" class="calendar-panel"> <div v-if="showCalendar" class="calendar-panel">
<schedule-calendar ref="calendar"></schedule-calendar> <schedule-calendar ref="calendar"></schedule-calendar>
</div> </div>
</div> </div>
...@@ -41,6 +41,7 @@ import ScheduleCalendar from './components/Marketing/components/ScheduleCalendar ...@@ -41,6 +41,7 @@ import ScheduleCalendar from './components/Marketing/components/ScheduleCalendar
import MarketingLeft from './components/Marketing/MarketingLeft' import MarketingLeft from './components/Marketing/MarketingLeft'
import MarketingMiddle from './components/Marketing/MarketingMiddle' import MarketingMiddle from './components/Marketing/MarketingMiddle'
import MarketingRight from './components/Marketing/MarketingRight' import MarketingRight from './components/Marketing/MarketingRight'
import {mapActions} from 'vuex'
export default { export default {
components: { components: {
MarketingLeft, MarketingLeft,
...@@ -54,19 +55,14 @@ export default { ...@@ -54,19 +55,14 @@ export default {
} }
}, },
mounted() { mounted() {
this.getCalendarList() this.getCalendarListData({})
}, },
methods: { methods: {
...mapActions({ ...mapActions({
getCalendarList: 'marketing/getCalendarList' getCalendarListData: 'marketing/getCalendarListData'
}), }),
handleShowCalendar() { handleShowCalendar() {
this.showCalendar = !this.showCalendar this.showCalendar = true
console.log(this.$refs.calendar.$refs.full.calendar)
let calendar = this.$refs.calendar.$refs.full.calendar.render
console.log(calendar)
calendar()
}, },
goBack() { goBack() {
this.$router.push('/home/index') this.$router.push('/home/index')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!