utils.js 1.02 KB
import oauth from '@/apis/modules/oauth.js'
import clueApi from '@/apis/modules/clue.js'
const utils = {
	gettime() {
		const now = new Date();
		// 年
		const year = now.getFullYear();
		// 月(注意:月份从 0 开始,需要 +1)
		const month = now.getMonth() + 1;
		// 日
		const day = now.getDate();
		// 时
		const hour = now.getHours();
		// 分
		const minute = now.getMinutes();
		// 秒
		const second = now.getSeconds();
		// 格式化时间(补零处理)
		const formatTime =
			`${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')} ${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${second.toString().padStart(2, '0')}`;
		console.log('当前时间:', formatTime);
		return formatTime
	},
	async gethy(e) {
		let c1 = '暂无'
		const result = await clueApi.getCustomerClues({
			currentPage: 1,
			pageSize: 1,
			keyword: e
		});
		if(result.code == 200 && result.data.list.length>0){
			c1 = result.data.list[0].id
		}
		return c1
	}

};
export default utils;