fixed bug, filelist page support pagination, do not load captcha component for user login first time

This commit is contained in:
RockYang
2024-09-13 17:03:05 +08:00
parent 5c77e67b0f
commit 6c7fa17e50
11 changed files with 33 additions and 19 deletions

View File

@@ -143,7 +143,7 @@ onMounted(() => {
const links = props.data.content.match(linkRegex);
if (links) {
httpPost("/api/upload/list", {urls: links}).then(res => {
files.value = res.data
files.value = res.data.items
for (let link of links) {
if (isExternalImg(link, files.value)) {

View File

@@ -60,6 +60,7 @@ const removeFile = (file) => {
display flex
flex-flow row
margin-right 10px
max-width 600px
position relative
.el-image {

View File

@@ -68,7 +68,7 @@ const fileList = ref([])
const fetchFiles = () => {
show.value = true
httpPost("/api/upload/list").then(res => {
fileList.value = res.data
fileList.value = res.data.items
}).catch(() => {
})
}

View File

@@ -263,8 +263,8 @@ watch(() => props.show, (newValue) => {
const login = ref(true)
const data = ref({
username: "",
password: "",
username: process.env.VUE_APP_USER,
password: process.env.VUE_APP_PASS,
mobile: "",
email: "",
repass: "",
@@ -285,6 +285,8 @@ const action = ref("login")
const enableVerify = ref(false)
const showResetPass = ref(false)
const router = useRouter()
// 是否需要验证码,输入一次密码错之后就要验证码
const needVerify = ref(false)
onMounted(() => {
const returnURL = `${location.protocol}//${location.host}/login/callback?action=login`
@@ -338,7 +340,7 @@ const submitLogin = () => {
if (data.value.password === '') {
return ElMessage.error('请输入密码');
}
if (enableVerify.value) {
if (enableVerify.value && needVerify.value) {
captchaRef.value.loadCaptcha()
action.value = "login"
} else {
@@ -355,8 +357,10 @@ const doLogin = (verifyData) => {
ElMessage.success("登录成功!")
emits("hide")
emits('success')
needVerify.value = false
}).catch((e) => {
ElMessage.error('登录失败,' + e.message)
needVerify.value = true
})
}

View File

@@ -349,7 +349,6 @@ onMounted(() => {
onUnmounted(() => {
if (socket.value !== null) {
socket.value.close()
socket.value = null
}
})
@@ -518,9 +517,9 @@ const loadChat = function (chat) {
modelID.value = chat.model_id;
chatId.value = chat.chat_id;
showStopGenerate.value = false;
router.push(`/chat/${chatId.value}`)
loadHistory.value = true
socket.value.close()
connect()
router.replace(`/chat/${chatId.value}`)
}
// 编辑会话标题
@@ -757,7 +756,7 @@ const sendMessage = function () {
if (files.value.length === 1) {
content += files.value.map(file => file.url).join(" ")
} else if (files.value.length > 1) {
showMessageError("当前只支持一个文件!")
showMessageError("当前只支持上传一个文件!")
return false
}
// 追加消息

View File

@@ -76,7 +76,6 @@ import {setUserToken} from "@/store/session";
import ResetPass from "@/components/ResetPass.vue";
import {showMessageError} from "@/utils/dialog";
import Captcha from "@/components/Captcha.vue";
import QRCode from "qrcode";
import {setRoute} from "@/store/system";
const router = useRouter();
@@ -89,6 +88,8 @@ const licenseConfig = ref({})
const wechatLoginURL = ref('')
const enableVerify = ref(false)
const captchaRef = ref(null)
// 是否需要验证码,输入一次密码错之后就要验证码
const needVerify = ref(false)
onMounted(() => {
// 获取系统配置
@@ -137,7 +138,7 @@ const login = function () {
return showMessageError('请输入密码');
}
if (enableVerify.value) {
if (enableVerify.value && needVerify.value) {
captchaRef.value.loadCaptcha()
} else {
doLogin({})
@@ -153,6 +154,7 @@ const doLogin = (verifyData) => {
x: verifyData.x
}).then((res) => {
setUserToken(res.data.token)
needVerify.value = false
if (isMobile()) {
router.push('/mobile')
} else {
@@ -161,6 +163,7 @@ const doLogin = (verifyData) => {
}).catch((e) => {
showMessageError('登录失败,' + e.message)
needVerify.value = true
})
}
</script>

View File

@@ -610,7 +610,7 @@ const publishJob = (item) => {
}
const getShareURL = (item) => {
return `${location.protocol}//${location.host}/song/${item.id}`
return `${location.protocol}//${location.host}/song/${item.song_id}`
}
const uploadCover = (file) => {