diff --git a/vue/gold-system/README.md b/vue/gold-system/README.md index 6abe182..c861b78 100644 --- a/vue/gold-system/README.md +++ b/vue/gold-system/README.md @@ -18,4 +18,6 @@ npm install @element-plus/icons-vue 下载element-plus图标库 npm install vue-icons-plus --save 下载外部图标库 -npm install echarts 安装echarts组件 \ No newline at end of file +npm install echarts 安装echarts组件 + +npm install moment 安装moment组件 \ No newline at end of file diff --git a/vue/gold-system/package-lock.json b/vue/gold-system/package-lock.json index 6d9f5bf..a59c9bc 100644 --- a/vue/gold-system/package-lock.json +++ b/vue/gold-system/package-lock.json @@ -12,6 +12,7 @@ "axios": "^1.7.8", "echarts": "^5.5.1", "element-plus": "^2.8.8", + "moment": "^2.30.1", "vue": "^3.5.12", "vue-icons-plus": "^0.1.7", "vue-router": "^4.5.0" @@ -1393,6 +1394,15 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/moment": { + "version": "2.30.1", + "resolved": "https://mirrors.huaweicloud.com/repository/npm/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/muggle-string": { "version": "0.4.1", "resolved": "https://mirrors.huaweicloud.com/repository/npm/muggle-string/-/muggle-string-0.4.1.tgz", diff --git a/vue/gold-system/package.json b/vue/gold-system/package.json index 7be23ad..3d2e2c0 100644 --- a/vue/gold-system/package.json +++ b/vue/gold-system/package.json @@ -13,6 +13,7 @@ "axios": "^1.7.8", "echarts": "^5.5.1", "element-plus": "^2.8.8", + "moment": "^2.30.1", "vue": "^3.5.12", "vue-icons-plus": "^0.1.7", "vue-router": "^4.5.0" diff --git a/vue/gold-system/src/views/managerecharge/activity.vue b/vue/gold-system/src/views/managerecharge/activity.vue index 329fd48..db4b13f 100644 --- a/vue/gold-system/src/views/managerecharge/activity.vue +++ b/vue/gold-system/src/views/managerecharge/activity.vue @@ -3,6 +3,7 @@ import { ref, onMounted, reactive, computed } from "vue"; import ElementPlus from "element-plus"; import { ElMessage, ElMessageBox } from 'element-plus' import axios from 'axios'; +import moment from 'moment'; //变量 // 用户对象假的 const admin = ref({ @@ -59,7 +60,7 @@ const get = async function (val) { console.log('搜索参数', getObj.value); // 发送POST请求 - const result = await axios.post('http://192.168.8.93:10010/recharge/activity/select', {...getObj.value,activity:{...activity.value}}); + const result = await axios.post('http://192.168.8.93:10010/recharge/activity/select', { ...getObj.value, activity: { ...activity.value } }); // 将响应结果存储到响应式数据中 console.log('请求成功', result); @@ -212,6 +213,29 @@ const rules = reactive({ ], }) +// 验证跳转输入框的数字是否合法 +const checkNumber = function () { + if (typeof parseInt(getObj.value.pageNum) === 'number') { + console.log('总共有多少页' + Math.ceil(total.value / getObj.value.pageSize)); + if ((getObj.value.pageNum > 0) && (getObj.value.pageNum <= Math.ceil(total.value / getObj.value.pageSize))) { + console.log('输入的数字合法'); + get(); + } else { + //提示 + ElMessage({ + type: 'error', + message: '请检查输入内容', + }) + } + } else { + //提示 + ElMessage({ + type: 'error', + message: '请检查输入内容', + }) + } +} + // 挂载 onMounted(async function () { get(); @@ -282,7 +306,11 @@ onMounted(async function () { - + + +