You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
3.5 KiB
173 lines
3.5 KiB
// package/subSystem/subSystem.js
|
|
import * as echarts from '../components/ec-canvas/echarts';
|
|
let chart = null;
|
|
|
|
function initChart(canvas, width, height, dpr) {
|
|
const chart = echarts.init(canvas, null, {
|
|
width: 300,
|
|
height: 300,
|
|
devicePixelRatio: dpr // new
|
|
});
|
|
canvas.setChart(chart);
|
|
|
|
var option = {
|
|
backgroundColor: "#ffffff",
|
|
series: [{
|
|
label: {
|
|
normal: {
|
|
fontSize: 14
|
|
}
|
|
},
|
|
type: 'pie',
|
|
center: ['50%', '50%'],
|
|
radius: ['20%', '40%'],
|
|
data: [{
|
|
value: 55,
|
|
name: '北京'
|
|
}, {
|
|
value: 20,
|
|
name: '武汉'
|
|
}, {
|
|
value: 10,
|
|
name: '杭州'
|
|
}, {
|
|
value: 20,
|
|
name: '广州'
|
|
}, {
|
|
value: 38,
|
|
name: '上海'
|
|
}]
|
|
}]
|
|
};
|
|
|
|
chart.setOption(option);
|
|
return chart;
|
|
}
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
ec: {
|
|
onInit: initChart
|
|
},
|
|
date: '',
|
|
show: true,
|
|
selectedDate: new Date(),// 设置默认选中的日期为当前日期
|
|
formatter(day) {
|
|
console.log('xxasaasas',day)
|
|
const month = day.date.getMonth() + 1;
|
|
const date = day.date.getDate();
|
|
const style = {};
|
|
if (month === 10) {
|
|
if (date === 1) {
|
|
day.bottomInfo = '.';
|
|
day.className='dayClass'
|
|
style.backgroundColor = 'red';
|
|
// document.getElementsByClassName('van-calendar__bottom-info')
|
|
}
|
|
}
|
|
|
|
if (day.type === 'start') {
|
|
day.bottomInfo = '入住';
|
|
} else if (day.type === 'end') {
|
|
day.bottomInfo = '离店';
|
|
}
|
|
day.style = style;
|
|
console.log('day111',day)
|
|
return day;
|
|
},
|
|
|
|
},
|
|
|
|
onDisplay() {
|
|
this.setData({ show: true });
|
|
},
|
|
onClose() {
|
|
this.setData({ show: false });
|
|
},
|
|
|
|
onConfirm(event) {
|
|
this.setData({
|
|
show: false,
|
|
date: this.formatDate(event.detail),
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
wx.setNavigationBarTitle({
|
|
title: options.key,
|
|
});
|
|
// 其他渲染逻辑
|
|
// 创建一个 Date 对象来获取当前日期
|
|
const currentDate = new Date();
|
|
// 获取当前年份
|
|
const currentYear = currentDate.getFullYear();
|
|
// 获取当前月份(注意,月份是从 0 到 11 表示,所以需要加 1)
|
|
const currentMonth = currentDate.getMonth() + 1;
|
|
// 获取当前月份的第一天和最后一天
|
|
const nextMonth = new Date().getMonth() + 1;
|
|
const firstDay = new Date().setDate(1);
|
|
const lastDay = new Date().setMonth(nextMonth,1) - 86400000;
|
|
// 更新数据,将年份和月份传递给 WXML 页面
|
|
this.setData({
|
|
currentYear: currentYear,
|
|
currentMonth: currentMonth,
|
|
lastDay:lastDay,
|
|
firstDay:firstDay
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
})
|