Commit a53aad5d by 杨明

fixed

2 parents fe2a815b 688b29ab
...@@ -8,13 +8,15 @@ ...@@ -8,13 +8,15 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"@toast-ui/calendar": "^2.1.3",
"axios": "^0.21.1", "axios": "^0.21.1",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"core-js": "^3.4.4", "core-js": "^3.4.4",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"glsx-components": "^1.5.2", "glsx-components": "^1.5.2",
"glsx-table": "^1.0.9" "glsx-table": "^1.0.9",
"work-calendar": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-babel": "^4.1.0",
......
...@@ -13,6 +13,7 @@ import './public-path' ...@@ -13,6 +13,7 @@ import './public-path'
// import 'glsx-components/dist/glsx-components.css' // import 'glsx-components/dist/glsx-components.css'
import '@/components' import '@/components'
import { start } from '@/setup' import { start } from '@/setup'
import '@toast-ui/calendar/dist/toastui-calendar.min.css';
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$apis = apis Vue.prototype.$apis = apis
start() start()
......
<!--
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 18:53:17
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-16 18:54:01
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\components\ScheduleCalendar\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template> <template>
<div> <div class="calendar-wrap">
<WorkCalendar ref="workCalendarTemplate" :options="calendarOptions" /> <div class="header">
<div class="header-rounded" @click="handlePrev('prev')">
<img src="@/assets/arrow.png" />
</div>
<span class="range">{{ currentDate }}</span>
<div class="header-rounded next" @click="handlePrev('next')"><img src="@/assets/arrow.png" /></div>
</div>
<div ref="calendar" class="calendar"></div>
</div> </div>
</template> </template>
<script> <script>
// import WorkCalendar from 'work-calendar'; import Calendar from '@toast-ui/calendar'
import * as dayjs from 'dayjs'
export default { export default {
// components: {
// WorkCalendar
// },
data() { data() {
return { return {
calendarOptions: { calendar: '',
TaskData: [ currentDate: '',
[ options: {
{ defaultView: 'month',
title: '第一组:任务标题1', calendars: []
startTime: new Date(),
duration: 20,
endTime: new Date(),
class: 'custom-class-name'
},
{
title: '第一组:任务标题2',
startTime: new Date(),
duration: 20,
endTime: new Date(),
class: 'custom-class-name'
}
],
[
{
title: '第二组:任务标题1',
startTime: new Date(),
duration: 20,
endTime: new Date(),
class: 'custom-class-name'
}
]
],
Holiday: [
{ date: '2021/4/3', name: '清明节' },
{ date: '2021/4/4', name: '清明节' },
{ date: '2021/4/5', name: '清明节' }
],
Workday: [
{ date: '2021/4/25', name: '补劳动节的班' },
{ date: '2021/5/8', name: '补劳动节的班' }
]
} }
} }
},
mounted() {
let container = this.$refs.calendar
this.calendar = new Calendar(container, this.options)
this.calendar.on('clickEvent', e => {
console.log(e)
})
this.getCalendarData()
},
methods: {
getCalendarData() {
this.calendar.createEvents([
{
id: 'event1',
calendarId: 'cal2',
title: 'Weekly meeting',
start: '2023-05-07',
end: '2023-05-07'
},
{
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'
}
])
this.currentDate = dayjs(this.calendar.getDate()).format('YYYY年MM')
},
handlePrev(type) {
this.calendar[type]()
this.getCalendarData()
}
} }
} }
</script> </script>
<style lang="scss" scoped>
.calendar-wrap {
width: 100%;
height: 100%;
margin-bottom: 20px;
}
.header {
display: flex;
margin: 11px 0;
align-items: center;
margin-left: -76px;
position: relative;
left: 50%;
.range {
font-weight: 600;
font-size: 16px;
color: #333333;
text-align: center;
margin: 0 8px;
}
.next {
img {
transform: rotate(270deg);
}
}
}
.calendar {
width: 100%;
height: 100%;
}
.header-rounded {
width: 28px;
height: 28px;
background: #ffffff;
border: 1px solid #e8e8ea;
border-radius: 2px;
display: flex;
img {
width: 11px;
height: 9px;
margin: auto;
transform: rotate(90deg);
}
}
</style>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
</div> </div>
<div class="market-bottom" v-if="isFull"> <div class="market-bottom" v-if="isFull">
<schedule-calendar ref="calendar"></schedule-calendar> <schedule-calendar ref="calendar"></schedule-calendar>
<!-- <div class="market-middle"> <!-- <div class="market-middle">
<marketing-middle></marketing-middle> <marketing-middle></marketing-middle>
</div> </div>
...@@ -48,22 +48,21 @@ export default { ...@@ -48,22 +48,21 @@ export default {
}, },
data() { data() {
return { return {
isFull:true isFull: true
} }
}, },
mounted(){ mounted() {
let dom = this.$refs.calendar.$refs.full let dom = this.$refs.calendar.$refs.full
console.log(dom) console.log(dom)
}, },
methods: { methods: {
handleShowCalendar(){ handleShowCalendar() {
this.isFull = ! this.isFull this.isFull = !this.isFull
console.log( this.$refs.calendar.$refs.full.calendar) console.log(this.$refs.calendar.$refs.full.calendar)
let calendar =this.$refs.calendar.$refs.full.calendar.render let calendar = this.$refs.calendar.$refs.full.calendar.render
console.log(calendar) console.log(calendar)
calendar() calendar()
}, },
goBack() { goBack() {
this.$router.push('/home/index') this.$router.push('/home/index')
...@@ -92,6 +91,9 @@ export default { ...@@ -92,6 +91,9 @@ export default {
.market-bottom { .market-bottom {
display: flex; display: flex;
margin-right: 10px;
height: calc(100% - 210px);
.market-middle { .market-middle {
flex: 1; flex: 1;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!