123456789101112131415161718192021222324252627282930313233343536373839404142 |
- // 获取当前时间 yyyy-mm-dd
- const getNowDate = function () {
- // 获取当前日期
- const date = new Date(); // 获取当前月份
- let nowMonth = date.getMonth() + 1; // 获取当前是几号
- let strDate = date.getDate(); // 添加分隔符“-”
- const seperator = '-'; // 对月份进行处理,1-9月在前面添加一个“0”
- if (nowMonth >= 1 && nowMonth <= 9) {
- nowMonth = `0${nowMonth}`;
- } // 对月份进行处理,1-9号在前面添加一个“0”
- if (strDate >= 0 && strDate <= 9) {
- strDate = `0${strDate}`;
- } // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
- return date.getFullYear() + seperator + nowMonth + seperator + strDate;
- };
- const CREATE_CARD_TYPE = {
- CREATE: 0,
- BIND: 1,
- EDIT: 2,
- CARD_TYPE_TITLE: {
- 0: '创建就诊卡',
- 1: '绑定就诊卡',
- 2: '修改就诊卡'
- }
- };
- const getCurrentPage = () => {
- const pages = getCurrentPages(); // eslint-disable-next-line no-proto
- return `/${pages[pages.length - 1].__proto__.route}`;
- };
- export { getNowDate, CREATE_CARD_TYPE, getCurrentPage };
|