export default {
	timeYMDFilter(timestamp) { // 时间戳转为yyyy-mm-dd hh:mm:ss
		// console.log(timestamp)
		if (timestamp !== undefined && timestamp !== null) {
			let date = new Date(timestamp); // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
			let Y = date.getFullYear() + '-';
			let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			let D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
			// let h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
			// let m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
			// let s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
			return Y + M + D;
		} else {
			return ''
		}
	},
	timeYMFilter(timestamp) { // 时间戳转为yyyy-mm-dd hh:mm:ss
		// console.log(timestamp)
		if (timestamp !== undefined && timestamp !== null) {
			let date = new Date(timestamp); // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
			let Y = date.getFullYear() + '-';
			let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
			// let D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
			// let h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
			// let m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
			// let s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
			return Y + M;
		} else {
			return ''
		}
	},
	timeHMSFilter(timestamp) { // 时间戳转为yyyy-mm-dd hh:mm:ss
		// console.log(timestamp)
		if (timestamp !== undefined && timestamp !== null) {
			let date = new Date(timestamp); // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
			let Y = date.getFullYear() + '-';
			let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			let D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
			let h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
			let m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
			let s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
			return h + m + s;
		} else {
			return ''
		}
	},
	timeYMDHMSFilter(timestamp) { // 时间戳转为yyyy-mm-dd hh:mm:ss
		// console.log(timestamp)
		if (timestamp !== undefined && timestamp !== null) {
			let date = new Date(timestamp); // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
			let Y = date.getFullYear() + '-';
			let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			let D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
			let h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
			let m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
			let s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
			return Y + M + D + h + m + s;
		} else {
			return ''
		}
	},
	statusName(val) {
		let name;
		if (val === 'unpublished') {
			name = '未发布'
		} else if (val === 'ongoing') {
			name = '进行中'
		} else if (val === 'audit') {
			name = '待审核'
		} else if (val === 'review') {
			name = '待考评'
		} else if (val === 'finished') {
			name = '已完结'
		} else if (val === 'delete'){
			name = '已删除'
		} else {
			name = '';
		}
		return name;
	},
	colorStatus(val) {
		// console.log(val)
		let color;
		switch(val) {
			case 'ongoing':
				color = '#3cc65c';
				break;
			case 'audit':
				color = '#D83AA8';
				break;
			case 'unpublished':
				color = '#787682';
				break;
			case 'review':
				color = '#fc9200';
				break;
			case 'finished':
				color = '#075da4';
				break;
			case 'delete':
				color = '#ee4b4c';
				break;
			default:
				break;
		}
		return color;
	},
	personStatusName(val) {
		let name = '';
		if (val === '0') {
			name = '空闲';
		} else if (val === '1') {
			name = '正常';
		} else {
			name = '忙碌';
		}
		return name;
	},
	colorNum(val) {
		let color;
		if (val === '0') {
			color = '#fc9200';
		} else if (val === '1') {
			color = '#3cc65c';
		} else {
			color = '#ee4b4c';
		}
		return color;
	},
	approvalStatusName(val) {
		let name = '';
		if (val === '0') {
			name = '待审核';
		} else if (val === '1') {
			name = '已通过';
		} else {
			name = '未通过';
		}
		return name;
	},
}
