| | |
| | | const licenseDays = ref(365);
|
| | | getLicenseDays();
|
| | | function getLicenseDays() {
|
| | | const currentDate = new Date();
|
| | | const newDate = new Date(currentDate);
|
| | | post('/api/license/getLicenseDays', {}).then((resp) => {
|
| | | let result = resp.data;
|
| | | let data = result.data;
|
| | | if (result.code == 200) {
|
| | | licenseDays.value = data;
|
| | | if(data <= 15) {
|
| | | newDate.setDate(currentDate.getDate() + data);
|
| | | alert("许可证有效期:" + data + "天," + "到期日期:" + formatDate(newDate))
|
| | | }
|
| | | }
|
| | | })
|
| | | }
|
| | |
|
| | | // 完整的日期格式化函数
|
| | | function formatDate(date, format = 'yyyy-MM-dd') {
|
| | | const year = date.getFullYear();
|
| | | const month = String(date.getMonth() + 1).padStart(2, '0');
|
| | | const day = String(date.getDate()).padStart(2, '0');
|
| | |
|
| | | return format
|
| | | .replace('yyyy', year)
|
| | | .replace('MM', month)
|
| | | .replace('dd', day);
|
| | | }
|
| | |
|
| | | const switchHost = (item) => {
|
| | | globalState.currentHost = item;
|
| | | postForm('/api/root/change/host/auth', {
|