feat: 二创防止重复点击

This commit is contained in:
zhangyh
2025-11-25 14:05:46 +08:00
parent 0ef8b3060c
commit a81f65a5a7

View File

@@ -276,7 +276,6 @@ import { Modal,message } from "ant-design-vue";
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import fullScreenImg from '@/component/HomePage/fullScreenImg.vue' import fullScreenImg from '@/component/HomePage/fullScreenImg.vue'
import { debounce } from 'lodash-es'
export default defineComponent({ export default defineComponent({
components:{fullScreenImg}, components:{fullScreenImg},
@@ -438,25 +437,35 @@ export default defineComponent({
}) })
} }
let setChoose = debounce(async()=>{ let flag = true
let setChoose = async()=>{
if(!flag) return
flag = false
try {
if(userDetail.value.systemList.indexOf(1) == -1){ if(userDetail.value.systemList.indexOf(1) == -1){
return message.info(t('newScaleImage.jsContent1')) message.info(t('newScaleImage.jsContent1'))
return
} }
const targetDate = new Date('2025-09-01T00:00:00'); const targetDate = new Date('2025-09-01T00:00:00');
// 解析输入日期字符串 // 解析输入日期字符串
const inputDate = new Date(imgData.scaleImageData.createDate); const inputDate = new Date(imgData.scaleImageData.createDate);
if(inputDate < targetDate){ if(inputDate < targetDate){
return message.info(t('newScaleImage.jsContent2')) message.info(t('newScaleImage.jsContent2'))
return
} }
if(imgData.scaleImageData.openSource == 0){ if(imgData.scaleImageData.openSource == 0){
return message.info(t('newScaleImage.jsContent2')) message.info(t('newScaleImage.jsContent2'))
return
} }
let id = await getWorks(imgData.scaleImageData.id) let id = await getWorks(imgData.scaleImageData.id)
router.push(`/home/history/${id}`) await router.push(`/home/history/${id}`)
// router.push({name:'home',params: {id:imgData.scaleImageData.id,type:'Works'}})
store.commit('setChooseIsDesign',false) store.commit('setChooseIsDesign',false)
},300) } finally {
// 函数执行完成后恢复为 true确保无论成功还是失败都能再次点击
flag = true
}
}
let setCommentReply = (value:any,str:any)=>{ let setCommentReply = (value:any,str:any)=>{
imgData.commentReply.leve1Id = value.id imgData.commentReply.leve1Id = value.id