From e86b537bd1cab3c77c0c63257d53329e9363b79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Thu, 23 Oct 2025 13:07:07 +0800 Subject: [PATCH] tijiao --- src/api/index.js | 4 +- src/common/js/debounce.js | 88 ++-- src/components/common/common.vue | 9 +- src/components/page/articleAdd2.vue | 398 +++++++++++------- .../components/article/journal-selector.vue | 308 ++++++++++++++ 5 files changed, 593 insertions(+), 214 deletions(-) create mode 100644 src/components/page/components/article/journal-selector.vue diff --git a/src/api/index.js b/src/api/index.js index 2698668..fa6d863 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -19,8 +19,8 @@ const service = axios.create({ // baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换 // baseURL: 'http://www.tougao.com/', //测试本地 记得切换 // baseURL: 'http://192.168.110.110/tougao/public/index.php/', - // baseURL: '/api', //本地 - baseURL: '/', //正式 + baseURL: '/api', //本地 + // baseURL: '/', //正式 }); diff --git a/src/common/js/debounce.js b/src/common/js/debounce.js index b1a6087..a3737ee 100644 --- a/src/common/js/debounce.js +++ b/src/common/js/debounce.js @@ -1,5 +1,5 @@ let timeout = null - + /** * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数 * @@ -9,51 +9,51 @@ let timeout = null * @return null */ function debounce(func, wait = 500, immediate = false) { - // 清除定时器 - if (timeout !== null) clearTimeout(timeout) - // 立即执行,此类情况一般用不到 - if (immediate) { - const callNow = !timeout - timeout = setTimeout(() => { - timeout = null - }, wait) - if (callNow) typeof func === 'function' && func() - } else { - // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法 - timeout = setTimeout(() => { - typeof func === 'function' && func() - }, wait) - } + // 清除定时器 + if (timeout !== null) clearTimeout(timeout) + // 立即执行,此类情况一般用不到 + if (immediate) { + const callNow = !timeout + timeout = setTimeout(() => { + timeout = null + }, wait) + if (callNow) typeof func === 'function' && func() + } else { + // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法 + timeout = setTimeout(() => { + typeof func === 'function' && func() + }, wait) + } } function throttle(fn, delay = 1000, immediate = false) { - console.log("进入节流对象") - let timer - let status = false // 是否为重复点击状态 - return function () { - let _this = this - let args = arguments - - if (immediate) { - console.log("立即执行参数 执行一次方法") - fn.apply(_this, args) - immediate = false - return - } - if (status) { - console.log("当前点击状态为正在重复点击,请稍等片刻后在点击执行") - return - } - console.log("执行节流:当前执行了一次点击方法") + console.log("进入节流对象") + let timer + let status = false // 是否为重复点击状态 + return function () { + let _this = this + let args = arguments + + if (immediate) { + console.log("立即执行参数 执行一次方法") fn.apply(_this, args) - status = true // 修改状态 - timer = setTimeout(() => { - console.log("规定时间到,重置状态,可以重新调用") - status = false - }, delay) + immediate = false + return } + if (status) { + console.log("当前点击状态为正在重复点击,请稍等片刻后在点击执行") + return + } + console.log("执行节流:当前执行了一次点击方法") + fn.apply(_this, args) + status = true // 修改状态 + timer = setTimeout(() => { + console.log("规定时间到,重置状态,可以重新调用") + status = false + }, delay) } - - export { - debounce, - throttle - } \ No newline at end of file +} + +export { + debounce, + throttle +} \ No newline at end of file diff --git a/src/components/common/common.vue b/src/components/common/common.vue index e5d0eb1..92a15a2 100644 --- a/src/components/common/common.vue +++ b/src/components/common/common.vue @@ -5,12 +5,9 @@ const mediaUrl = '/public/'; const baseUrl = '/'; - // const mediaUrl = 'https://submission.tmrjournals.com/public/'; // // const mediaUrl = 'http://zmzm.tougao.dev.com/public/'; -// const baseUrl = '/api'; - - +// const baseUrl = '/api' //本地(正式环境 ) @@ -33,8 +30,6 @@ const baseUrl = '/'; export default { baseUrl, - mediaUrl, - - + mediaUrl }; diff --git a/src/components/page/articleAdd2.vue b/src/components/page/articleAdd2.vue index e8077ee..1db6bbf 100644 --- a/src/components/page/articleAdd2.vue +++ b/src/components/page/articleAdd2.vue @@ -1,7 +1,7 @@ + + \ No newline at end of file