123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <template>
- <div class="calendar" :style="'font-size:' + fontSize + 'px'">
- <div
- class="group content bg"
- v-for="(item, index) in dataOne"
- :key="item.title + index"
- >
- <img
- :src="item.img_url"
- alt=""
- style="
- width: 79vw;
- max-width: 527px;
- display: block;
- margin: 3.6vh auto 0 auto;
- "
- />
- <p class="headTitle" v-text="item.title"></p>
- <div v-if="item.data.length">
- <div v-for="(v1, i1) in item.data" :key="i1">
- <!-- 月历主页 -->
- <div class="monthlyCalendar" >
- <div style="display: flex;" >
- <div class="title" style="flex: 1;" v-text="v1.month"></div>
- </div>
- <div class="CalenMain">
- <div class="CalenRow CalenHead">
- <div class="CalenCol">
- <p>一</p>
- <!-- <p>MON</p> -->
- </div>
- <div class="CalenCol">
- <p>二</p>
- <!-- <p>TUE</p> -->
- </div>
- <div class="CalenCol">
- <p>三</p>
- <!-- <p>WED</p> -->
- </div>
- <div class="CalenCol">
- <p>四</p>
- <!-- <p>THU</p> -->
- </div>
- <div class="CalenCol">
- <p>五</p>
- <!-- <p>FRI</p> -->
- </div>
- <div class="CalenCol">
- <p>六</p>
- <!-- <p>SAT</p> -->
- </div>
- <div class="CalenCol">
- <p>日</p>
- <!-- <p>SUN</p> -->
- </div>
- </div>
- <div
- class="CalenRow CalenBody"
- v-for="(v, i) in v1.list"
- :key="i"
- >
- <div v-for="(son, o) in v" :key="o" class="CalenCol">
- <div v-if="son" style="color: #000">
- <div class="dayDate">
- <div
- class="dayDate_son"
- :style="
- son.weeks == 0 || son.weeks == 6
- ? 'color:#c31212'
- : ''
- "
- >
- {{ son.day }}
- </div>
- </div>
- <div class="text" v-text="son.value"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <img
- src="@/assets/image/logo.png"
- style="width: 18.8vw; max-width: 125px; margin: 1em auto; display: block"
- alt=""
- />
- <div class="bottom content">
- 本数据由“陕西广电融媒体集团大数据平台”提供。
- <p>
- 技术支持 <span style="white-space: nowrap">白帆13325452244;</span
- ><span style="white-space: nowrap">陈科18629350958。</span>
- </p>
- </div>
- </div>
- </template>
- <script>
- // @ is an alias to /src
- import watermark from "watermark-package";
- import DayJs from "dayjs";
- // import {} from "../utils/tool";
- import { jsonCalendarOne } from "../../../api/index";
- // import echarts from "../../../utils/echarts";
- export default {
- name: "Calendar",
- data() {
- return {
- fontSize: 17,
- dataOne: [],
- };
- },
- watch: {},
- mounted() {
- if (
- this.$route.query.auto !==
- "06fd56cdf5a6cfc3a2139cc8514d05aa0439ee8c1fb4d81145bc9647"
- )
- return;
- this.fontSize = (document.body.offsetWidth / 24).toFixed(2) - 0;
- if (document.body.offsetWidth > 677) this.fontSize = 22;
- watermark.setWaterMark({
- w_texts: ["陕西新媒体大数据"],
- w_options: {
- w_opacity: "0.1",
- },
- });
- jsonCalendarOne({
- date: this.$route.params.date,
- time: Date.now(),
- }).then(res => {
- let dataOne = res || [];
- for (let i = 0; i < dataOne.length; i++) {
- const item1 = dataOne[i].data ? dataOne[i].data || [] : [];
- for (let o = 0; o < item1.length; o++) {
- const item2 =
- dataOne[i].data && dataOne[i].data
- ? dataOne[i].data[o] || []
- : undefined;
- if (item2 === undefined) continue;
- const dayjs_Start =
- item2.list[0] && item2.list[0].dt
- ? new DayJs(item2.list[0].dt)
- : undefined;
- const item2_Length = item2.list.length ? item2.list.length - 1 : 0;
- const dayjs_Last = item2.list[item2_Length]
- ? new DayJs(item2.list[item2_Length].dt)
- : undefined;
- let first = dayjs_Start ? dayjs_Start.format("d") : undefined;
- let last = dayjs_Last ? dayjs_Last.format("d") : undefined;
- last && last != 0 && (last = 7 - last);
- first && dataOne[i].data[o].list.unshift(...new Array(first - 1));
- last && dataOne[i].data[o].list.push(...new Array(last - 0));
- let li = [];
- for (let p = 0; p < dataOne[i].data[o].list.length; p++) {
- const item3 = dataOne[i].data[o].list[p] || undefined;
- if (p % 7 === 0) li.push([]);
- let end = li.length ? li.length - 1 : 0;
- if (!item3) {
- li[end].push(undefined);
- continue;
- }
- let dt3 = new DayJs(item3.dt);
- item3.day = dt3.format("D");
- item3.weeks = dt3.format("d");
- li[end].push(item3);
- }
- dataOne[i].data[o].list = li;
- }
- }
- this.dataOne = dataOne;
- });
- },
- computed: {},
- methods: {},
- beforeUnmount() {},
- components: {},
- };
- </script>
- <style scoped>
- .calendar {
- background-color: #f5b379;
- height: 100%;
- overflow-y: auto;
- box-sizing: border-box;
- color: #000;
- }
- .bottom {
- border: 4px solid #0983a8;
- margin-top: 1em;
- padding: 10px;
- font-size: 0.9rem;
- padding-left: 5px;
- font-weight: 600;
- overflow: hidden;
- }
- .content {
- margin: 0 auto;
- max-width: 667px;
- }
- .group {
- margin-bottom: 2em;
- }
- .headTitle {
- font-size: 1.5rem;
- text-align: center;
- font-family: SourceHanSansCN;
- font-weight: bold;
- color: #be651a;
- line-height: 30px;
- text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff;
- }
- .headSubTitle {
- text-align: center;
- font-size: 1.2rem;
- font-family: SourceHanSansCN;
- font-weight: 400;
- color: #a22626;
- line-height: 30px;
- }
- .bg {
- background-image: url("../../../assets/image/bg.png");
- background-size: 100% 100%;
- padding-bottom: 1.5em;
- }
- .monthlyCalendar {
- background-image: url("../../../assets/image/C_bg.png");
- background-size: 100% 100%;
- width: 82.5%;
- height: calc((82.5% - 10px) * 1.5);
- padding: 1.5em 1px 0 1px;
- max-width: 614px;
- margin: 0 auto;
- margin-top: 1.5em;
- /* width: 92vw;
- height: 117vw; */
- }
- .title {
- font-size: 1rem;
- font-family: STHupo;
- font-weight: 600;
- line-height: 30px;
- padding: .5em .8em;
- }
- .CalenRow {
- display: flex;
- overflow: hidden;
- }
- .CalenCol {
- flex: 1;
- text-align: center;
- border-left: 1px solid #fff;
- }
- .CalenHead {
- font-size: 0.9rem;
- height: 1.5em;
- line-height: 1.5em;
- font-weight: 400;
- color: #fff;
- background-color: #dc721a;
- border-radius: 3px;
- }
- .dayDate {
- box-sizing: border-box;
- width: 1.3em;
- height: 1.3em;
- line-height: 1.3em;
- font-size: 1.1rem;
- font-family: Adobe Heiti Std;
- color: #000;
- background-color: #f4f4f4;
- transform: rotate(45deg);
- margin: 0 auto .3em auto;
- }
- .dayDate_son {
- width: 100%;
- height: 100%;
- transform: rotate(-45deg);
- }
- .CalenBody .CalenCol {
- padding: 10px 0;
- font-weight: bold;
- border-left: 1px solid #eee;
- border-bottom: 1px solid #eee;
- }
- .text {
- background-image: url("../../../assets/image/text.png");
- background-size: 100% 100%;
- margin: 0.5em 1px 0 1px;
- padding: 1px 0;
- font-size: 0.7rem;
- height: 1.3em;
- line-height: 1.3em;
- color: #c31212;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- </style>
- <style></style>
|