邀请码功能

planet
shenhan 2025-03-05 13:37:24 +08:00
parent f2d8f098e6
commit 1717d5abba
18 changed files with 593 additions and 248 deletions

1
app/components.d.ts vendored
View File

@ -26,6 +26,7 @@ declare module 'vue' {
NInputGroup: typeof import('naive-ui')['NInputGroup'] NInputGroup: typeof import('naive-ui')['NInputGroup']
NMessageProvider: typeof import('naive-ui')['NMessageProvider'] NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal'] NModal: typeof import('naive-ui')['NModal']
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
NQrCode: typeof import('naive-ui')['NQrCode'] NQrCode: typeof import('naive-ui')['NQrCode']
NRadio: typeof import('naive-ui')['NRadio'] NRadio: typeof import('naive-ui')['NRadio']
NRadioGroup: typeof import('naive-ui')['NRadioGroup'] NRadioGroup: typeof import('naive-ui')['NRadioGroup']

View File

@ -1,23 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import type { FormInst } from 'naive-ui';
import { ref } from 'vue'; import { ref } from 'vue';
import { uploadImagesInBatches } from '../utils/uploadImg.ts'; import { uploadImagesInBatches } from '../utils/uploadImg.ts';
const userStore = useUserStore() const userStore = useUserStore()
const userInfo = userStore.userInfo const userInfo = userStore.userInfo
const message = useMessage() const message = useMessage()
const ruleForm = ref({}) const ruleForm = ref({})
function onShowModel() { // function onShowModel() {
ruleForm.value.nickName = userInfo.nickName // ruleForm.value.nickName = userInfo.nickName
ruleForm.value.avatar = userInfo.avatar // ruleForm.value.avatar = userInfo.avatar
ruleForm.value.brief = userInfo.brief // ruleForm.value.brief = userInfo.brief
ruleForm.value.userId = userInfo.userId // ruleForm.value.userId = userInfo.userId
} // }
const rules = ref({ const rules = ref({
nickName: [ nickName: [
{ required: true, message: '请输入用户名', trigger: 'blur' }, { required: true, message: '请输入用户名', trigger: 'blur' },
{ min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }, { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
], ],
}) })
// //
@ -52,24 +52,37 @@ async function handlePictureChange(event: Event) {
message.error('图片上传失败') message.error('图片上传失败')
} }
} }
const formRef = ref<FormInst | null>(null)
async function saveInfo() { async function saveInfo() {
const res = await request.post('/system/user/updateUserInfo', ruleForm.value) formRef.value?.validate(async(errors:any) => {
const data = await userStore.getUserInfo() if (!errors) {
onCloseModel() const res1 = await request.post('/system/user/updateUserInfo', ruleForm.value)
if(res1.code === 200){
const res = await request.get('/system/user/selectUserById')
if (res.code === 200) {
message.success('修改成功!')
userStore.setUserInfo(res.data)
onCloseModel()
}
}
}
})
} }
watch( watch(
() => userStore.userInfo, // userInfo () => userStore.userInfo, // userInfo
(newUserInfo) => { (newUserInfo:any) => {
if (newUserInfo) { if (newUserInfo) {
ruleForm.value.nickName = newUserInfo.nickName ruleForm.value.nickName = newUserInfo.nickName
ruleForm.value.avatar = newUserInfo.avatar ruleForm.value.avatar = newUserInfo.avatar
ruleForm.value.brief = newUserInfo.brief ruleForm.value.brief = newUserInfo.brief
ruleForm.value.userId = newUserInfo.userId ruleForm.value.userId = newUserInfo.userId
// ruleForm.value.invitationName = newUserInfo.invitationName
} }
}, },
{ immediate: true }, // ruleForm { immediate: true, deep: true }, // ruleForm
) )
const isVisible = ref(false) const isVisible = ref(false)
@ -115,6 +128,15 @@ onMounted(() => {
<n-form-item path="nickName" label="用户名"> <n-form-item path="nickName" label="用户名">
<n-input v-model:value="ruleForm.nickName" placeholder="请输入用户名" @keydown.enter.prevent /> <n-input v-model:value="ruleForm.nickName" placeholder="请输入用户名" @keydown.enter.prevent />
</n-form-item> </n-form-item>
<div v-if="userInfo.invitationName" class="mb-3">
已经填写: {{ userInfo.invitationName }} 的邀请码
</div>
<!-- <n-form-item v-if="userInfo.invitationName" path="invitationCode">
</n-form-item> -->
<n-form-item v-else path="invitationCode" label="邀请码">
<n-input v-model:value="ruleForm.invitationName" placeholder="请输入邀请码" @keydown.enter.prevent />
</n-form-item>
<n-form-item label="简介" path="textareaValue"> <n-form-item label="简介" path="textareaValue">
<n-input <n-input
v-model:value="ruleForm.brief" v-model:value="ruleForm.brief"

View File

@ -1,7 +1,7 @@
<!-- components/SearchInput.vue --> <!-- components/SearchInput.vue -->
<script setup> <script setup>
import { CloseCircle } from "@vicons/ionicons5"; import { CloseCircle } from "@vicons/ionicons5";
import { Camera, Search } from "lucide-vue-next"; import { Search } from "lucide-vue-next";
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
const modalStore = useModalStore(); const modalStore = useModalStore();
@ -29,7 +29,6 @@ function handleSearch() {
if (route.path !== "/search") { if (route.path !== "/search") {
const baseUrl = window.location.origin; const baseUrl = window.location.origin;
const type = searchType.value[route.path] const type = searchType.value[route.path]
debugger
window.open( window.open(
`${baseUrl}/search?keyword=${keyword.value}&type=${type}`, `${baseUrl}/search?keyword=${keyword.value}&type=${type}`,
"_blank", "_blank",
@ -79,7 +78,7 @@ watch(searchQuery, (newValue) => {
</n-icon> </n-icon>
</div> </div>
<Camera class="h-5 w-5 text-gray-400 mr-3 cursor-pointer" /> <!-- <Camera class="h-5 w-5 text-gray-400 mr-3 cursor-pointer" /> -->
<Search class="h-5 w-5 text-gray-400 mr-3 cursor-pointer" @click="handleSearch" /> <Search class="h-5 w-5 text-gray-400 mr-3 cursor-pointer" @click="handleSearch" />
</div> </div>
</template> </template>

View File

@ -116,11 +116,8 @@ function closePublishImg() {
<div> <div>
<div class="upload-content"> <div class="upload-content">
<div class="flex flex-col bg-[#f3f5f9] justify-center items-center w-30 h-30 border border-dashed mt-2 rounded-lg bg-white"> <div class="flex flex-col bg-[#f3f5f9] justify-center items-center w-30 h-30 border border-dashed mt-2 rounded-lg bg-white">
<div class="w-24 bg-gradient-to-r from-[#2D28FF] to-[#1A7DFF] h-8 text-white rounded-sm bg-[#3162ff] cursor-pointer flex justify-center items-center mt-6" @click="triggerFileInput()"> <div class="my-6 w-24 bg-gradient-to-r from-[#2D28FF] to-[#1A7DFF] h-8 text-white rounded-sm bg-[#3162ff] cursor-pointer flex justify-center items-center mt-6" @click="triggerFileInput()">
上传文件 上传图片
</div>
<div class="my-3">
点击上传文件
</div> </div>
<!-- <div class="text-[#999999] text-xs"> <!-- <div class="text-[#999999] text-xs">
.json/.zip .json/.zip

View File

@ -53,7 +53,7 @@ async function getDictType() {
const [res1, res2, res3, res4] = await Promise.all([ const [res1, res2, res3, res4] = await Promise.all([
commonApi.dictType({ type: 'model_part_category' }), commonApi.dictType({ type: 'model_part_category' }),
commonApi.dictType({ type: 'model_child_category' }), commonApi.dictType({ type: 'model_child_category' }),
commonApi.dictType({ type: 'model_category' }), commonApi.dictType({ type: 'model_type' }),
commonApi.dictType({ type: 'work_flow_functions' }), commonApi.dictType({ type: 'work_flow_functions' }),
]) ])

View File

@ -1,11 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { commonApi } from "@/api/common"; import { commonApi } from "@/api/common";
import { uploadImagesInBatches } from "@/utils/uploadImg.ts"; import { uploadFileBatches } from "@/utils/uploadImg.ts";
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from "lodash-es";
import { Asterisk, Trash } from "lucide-vue-next"; import { Asterisk, Trash } from "lucide-vue-next";
import type { FormInst } from "naive-ui"; import type { FormInst } from "naive-ui";
import { computed, ref, watch } from "vue"; import { computed, ref, watch } from "vue";
const message = useMessage()
const message = useMessage();
// //
const props = defineProps({ const props = defineProps({
@ -18,16 +19,18 @@ const emit = defineEmits(["update:modelValue", "nextStep", "prevStep"]);
const acceptTypes = const acceptTypes =
".safetensors,.ckpt,.pt,.bin,.pth,.zip,.json,.flow,.lightflow,.yaml,.yml,.onnx,.gguf,.sft"; ".safetensors,.ckpt,.pt,.bin,.pth,.zip,.json,.flow,.lightflow,.yaml,.yml,.onnx,.gguf,.sft";
const modelVersionItem = { const modelVersionItem = {
delFlag: '0', // 0 2 objectKey:null,
isEncrypt: 0, //0
delFlag: "0", // 0 2
versionName: "", // versionName: "", //
modelVersionType: null, // modelVersionType: null, //
versionDescription: "", // versionDescription: "", //
filePath: "", // filePath: "", //
fileName: "", // fileName: "", //
sampleImagePaths:[], // 20, sampleImagePaths: [], // 20,
triggerWords: "", // triggerWords: "", //
isPublic: 1, // isPublic: 1, //
isOnlineUse:1, //线使 isOnlineUse: 1, //线使
allowFusion: 1, // allowFusion: 1, //
isFree: 0, // 0 isFree: 0, // 0
allowDownloadImage: 1, // allowDownloadImage: 1, //
@ -35,8 +38,8 @@ const modelVersionItem = {
allowCommercialUse: 1, // allowCommercialUse: 1, //
allowUsage: 1, // allowUsage: 1, //
isExclusiveModel: 1, // isExclusiveModel: 1, //
hideImageGenInfo:0, // hideImageGenInfo: 0, //
id:null id: null,
}; };
const isPublicList = [ const isPublicList = [
{ {
@ -88,7 +91,7 @@ const rules = {
}, },
}; };
function addVersion() { function addVersion() {
const param = cloneDeep(modelVersionItem) const param = cloneDeep(modelVersionItem);
localForm.value.modelVersionList.unshift(param); localForm.value.modelVersionList.unshift(param);
} }
const originalBtnList = ref([ const originalBtnList = ref([
@ -144,11 +147,26 @@ async function handleFileChange(event: Event) {
const files = target.files; const files = target.files;
if (files && files.length > 0) { if (files && files.length > 0) {
try{ const { name, size} = files[0] as { name: string, size: number};
const res = await uploadImagesInBatches(files); try {
localForm.value.modelVersionList[uploadFileIndex.value].filePath = res[0].url; // 0 1
localForm.value.modelVersionList[uploadFileIndex.value].fileName = res[0].fileName; const res1 = await request.get(`/file/selectFile?type=model&name=${name}`);
}catch(err){ if (res1.code == 200) {
if (res1.data === 1) {
try {
const res = await uploadFileBatches(files);
localForm.value.modelVersionList[uploadFileIndex.value].filePath = res[0].path;
localForm.value.modelVersionList[uploadFileIndex.value].objectKey = res[0].objectKey;
localForm.value.modelVersionList[uploadFileIndex.value].fileName = name;
localForm.value.modelVersionList[uploadFileIndex.value].fileSize = size
} catch (err) {
console.log(err);
}
} else {
message.warning("该模型名称已存在");
}
}
} catch (err) {
console.log(err); console.log(err);
} }
} }
@ -162,7 +180,7 @@ function prevStep() {
const baseModelTypeList = ref([]); const baseModelTypeList = ref([]);
async function getDictType() { async function getDictType() {
try { try {
const res = await commonApi.dictType({ type: "mode_type" }); const res = await commonApi.dictType({ type: "mode_version_type" });
if (res.code === 200) { if (res.code === 200) {
baseModelTypeList.value = res.data; baseModelTypeList.value = res.data;
} }
@ -173,12 +191,11 @@ async function getDictType() {
getDictType(); getDictType();
function computedDelFlag() { function computedDelFlag() {
return localForm.value.modelVersionList.filter(item => item.delFlag === '0') return localForm.value.modelVersionList.filter((item) => item.delFlag === "0");
} }
function onDelete(index: number) { function onDelete(index: number) {
if (computedDelFlag().length === 1) if (computedDelFlag().length === 1) return;
return localForm.value.modelVersionList[index].delFlag = "2";
localForm.value.modelVersionList[index].delFlag = '2'
} }
</script> </script>
@ -191,8 +208,8 @@ function onDelete(index: number) {
> >
<div v-if="item.delFlag === '0'" class="bg-gray-100 p-4 rounded-lg mt-4 relative"> <div v-if="item.delFlag === '0'" class="bg-gray-100 p-4 rounded-lg mt-4 relative">
<div class="absolute -right-10 top-4 cursor-pointer"> <div class="absolute -right-10 top-4 cursor-pointer">
<Trash class="cursor-pointer" @click="onDelete(index)" /> <Trash class="cursor-pointer" @click="onDelete(index)" />
</div> </div>
<n-form <n-form
:ref="(el) => setFormRef(el, index)" :ref="(el) => setFormRef(el, index)"
:label-width="80" :label-width="80"
@ -212,8 +229,18 @@ function onDelete(index: number) {
:options="baseModelTypeList" :options="baseModelTypeList"
/> />
</n-form-item> </n-form-item>
<div class="flex"> <div class="flex items-center justify-between">
上传文件 <Asterisk :size="10" color="#ff0000" class="mt-1" /> <div class="flex">
上传文件 <Asterisk :size="10" color="#ff0000" class="mt-1" />
</div>
<div>
<n-checkbox
v-model:checked="item.isEncrypt"
:checked-value="1"
:unchecked-value="0"
label="是否加密"
/>
</div>
</div> </div>
<div <div
v-if="item.fileName" v-if="item.fileName"
@ -402,19 +429,19 @@ function onDelete(index: number) {
</div> </div>
</template> </template>
<div class="flex items-center justify-center mt-5"> <div class="flex items-center justify-center mt-5">
<div <div
class="flex justify-center items-center mt-5 w-[20%] mx-2 h-10 rounded-lg bg-[#f1f2f7] cursor-pointer" class="flex justify-center items-center mt-5 w-[20%] mx-2 h-10 rounded-lg bg-[#f1f2f7] cursor-pointer"
@click="prevStep" @click="prevStep"
> >
上一步 上一步
</div>
<div
class="flex justify-center items-center mt-5 text-white mx-2 w-[20%] h-10 rounded-lg bg-[#3162ff] cursor-pointer"
@click="nextStep"
>
下一步
</div>
</div> </div>
<div
class="flex justify-center items-center mt-5 text-white mx-2 w-[20%] h-10 rounded-lg bg-[#3162ff] cursor-pointer"
@click="nextStep"
>
下一步
</div>
</div>
</div> </div>
<input <input
ref="fileInput" ref="fileInput"

View File

@ -151,7 +151,7 @@ function onPositiveClick() {
上传文件 上传文件
</div> </div>
<div class="my-3"> <div class="my-3">
点击上传文件 点击上传图片
</div> </div>
<div class="text-[#999999] text-xs"> <div class="text-[#999999] text-xs">
请勿上传裸露暴力血腥或其他包含非法信息图片 请勿上传裸露暴力血腥或其他包含非法信息图片

View File

@ -1,11 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
// import { uploadFileBatches } from '@/utils/uploadImg.ts'; import { uploadFileBatches } from "@/utils/uploadImg.ts";
import { uploadImagesInBatches } from '@/utils/uploadImg.ts'; import { cloneDeep } from "lodash-es";
import { Asterisk, Trash } from "lucide-vue-next";
import { cloneDeep } from 'lodash-es'; import type { FormInst } from "naive-ui";
import { Asterisk, Trash } from 'lucide-vue-next'; import { computed, ref, watch } from "vue";
import type { FormInst } from 'naive-ui';
import { computed, ref, watch } from 'vue';
// //
const props = defineProps({ const props = defineProps({
@ -13,81 +11,86 @@ const props = defineProps({
type: Object, type: Object,
required: true, required: true,
}, },
}) });
const emit = defineEmits(['update:modelValue', 'nextStep', 'preStep']) const emit = defineEmits(["update:modelValue", "nextStep", "preStep"]);
const localForm = computed({ const localForm = computed({
get() { get() {
return props.modelValue return props.modelValue;
}, },
set(value) { set(value) {
emit('update:modelValue', value) emit("update:modelValue", value);
}, },
}) });
watch( watch(
() => localForm.value, () => localForm.value,
(newVal) => { (newVal:any) => {
console.log('newVal', newVal) console.log("newVal", newVal);
emit('update:modelValue', newVal) emit("update:modelValue", newVal);
}, },
{ immediate: true, deep: true }, { immediate: true, deep: true }
) );
const message = useMessage() const message = useMessage();
const acceptTypes = '.json,.zip' const acceptTypes = ".json,.zip";
defineExpose({ defineExpose({
addVersion, addVersion,
}) });
const modelVersionItem = { const modelVersionItem = {
versionName: '', versionName: "",
versionDescription: '', // versionDescription: "", //
filePath: '', // filePath: "", //
fileName: '', // fileName: "", //
delFlag: '0', delFlag: "0",
imagePaths: [], imagePaths: [],
id:null id: null,
} };
const rules = { const rules = {
versionName: { versionName: {
required: true, required: true,
message: '', message: "",
trigger: 'blur', trigger: "blur",
}, },
} };
function addVersion() { function addVersion() {
const param = cloneDeep(modelVersionItem) const param = cloneDeep(modelVersionItem);
localForm.value.workFlowVersionList.unshift(param) localForm.value.workFlowVersionList.unshift(param);
} }
const formRefs = ref<(FormInst | null)[]>([]) const formRefs = ref<(FormInst | null)[]>([]);
function setFormRef(el: FormInst | null, index: number) { function setFormRef(el: FormInst | null, index: number) {
if (el) { if (el) {
formRefs.value[index] = el formRefs.value[index] = el;
} }
} }
async function nextStep() { async function nextStep() {
for (let i = 0; i < localForm.value.workFlowVersionList.length; i++) { for (let i = 0; i < localForm.value.workFlowVersionList.length; i++) {
if (localForm.value.workFlowVersionList[i].delFlag === '0' && localForm.value.workFlowVersionList[i].fileName === '') { if (
return message.error('请上传文件') localForm.value.workFlowVersionList[i].delFlag === "0" &&
localForm.value.workFlowVersionList[i].fileName === ""
) {
return message.error("请上传文件");
} }
const regex = /[\u4E00-\u9FA5]/ // const regex = /[\u4E00-\u9FA5]/; //
if (localForm.value.workFlowVersionList[i].delFlag === '0' && !regex.test(localForm.value.workFlowVersionList[i].versionDescription)) { if (
return message.error('请用中文填写版本介绍') localForm.value.workFlowVersionList[i].delFlag === "0" &&
!regex.test(localForm.value.workFlowVersionList[i].versionDescription)
) {
return message.error("请用中文填写版本介绍");
} }
} }
try { try {
const promises = formRefs.value const promises = formRefs.value
.filter((form): form is FormInst => form !== null) .filter((form:any): form is FormInst => form !== null)
.map(form => form.validate()) .map((form:any) => form.validate());
await Promise.all(promises) await Promise.all(promises);
emit('nextStep') emit("nextStep");
} } catch (errors) {
catch (errors) { console.error("部分表单验证失败:", errors);
console.error('部分表单验证失败:', errors)
} }
// formRef.value?.validate((errors) => { // formRef.value?.validate((errors) => {
// if (!errors) { // if (!errors) {
@ -99,41 +102,52 @@ async function nextStep() {
// }) // })
} }
function preStep() { function preStep() {
emit('preStep') emit("preStep");
} }
// //
const uploadFileIndex = ref(0) const uploadFileIndex = ref(0);
const fileInput = ref<HTMLInputElement | null>(null) const fileInput = ref<HTMLInputElement | null>(null);
function triggerFileInput(index: number) { function triggerFileInput(index: number) {
(fileInput.value as HTMLInputElement)?.click() (fileInput.value as HTMLInputElement)?.click();
uploadFileIndex.value = index uploadFileIndex.value = index;
} }
async function handleFileChange(event: Event) { async function handleFileChange(event: Event) {
const target = event.target as HTMLInputElement const target = event.target as HTMLInputElement;
const files = target.files const files = target.files;
if (files && files.length > 0) { if (files && files.length > 0) {
try{ const { name , size} = files[0] as { name: string, size: number};
const res = await uploadImagesInBatches(files) try {
localForm.value.workFlowVersionList[uploadFileIndex.value].filePath = res[0].url const res1 = await request.get(`/file/selectFile?type=workflow&name=${name}`);
localForm.value.workFlowVersionList[uploadFileIndex.value].fileName = res[0].fileName if (res1.code == 200) {
}catch(err){ if (res1.data === 1) {
//0 1
try {
const res = await uploadFileBatches(files);
localForm.value.workFlowVersionList[uploadFileIndex.value].filePath = res[0].path;
localForm.value.workFlowVersionList[uploadFileIndex.value].objectKey = res[0].objectKey;
localForm.value.workFlowVersionList[uploadFileIndex.value].fileName = name
localForm.value.workFlowVersionList[uploadFileIndex.value].fileSize = size
} catch (err) {
console.log(err);
}
} else {
message.error("该工作流名称已存在");
}
}
} catch (err) {
console.log(err); console.log(err);
} }
// if(res[0].success){
// }
} }
target.value = '' target.value = "";
} }
function computedDelFlag() { function computedDelFlag() {
return localForm.value.workFlowVersionList.filter(item => item.delFlag === '0') return localForm.value.workFlowVersionList.filter((item:any) => item.delFlag === "0");
} }
function onDelete(index: number) { function onDelete(index: number) {
if (computedDelFlag().length === 1) if (computedDelFlag().length === 1) return;
return localForm.value.workFlowVersionList[index].delFlag = "2";
localForm.value.workFlowVersionList[index].delFlag = '2'
} }
</script> </script>
@ -146,7 +160,7 @@ function onDelete(index: number) {
<Trash class="cursor-pointer" @click="onDelete(index)" /> <Trash class="cursor-pointer" @click="onDelete(index)" />
</div> </div>
<n-form <n-form
:ref="(el) => setFormRef(el, index)" :ref="(el:any) => setFormRef(el, index)"
:label-width="80" :label-width="80"
:model="localForm.workFlowVersionList[index]" :model="localForm.workFlowVersionList[index]"
:rules="rules" :rules="rules"
@ -169,31 +183,38 @@ function onDelete(index: number) {
<div class="flex mt-4"> <div class="flex mt-4">
上传文件 <Asterisk :size="10" color="#ff0000" class="mt-1" /> 上传文件 <Asterisk :size="10" color="#ff0000" class="mt-1" />
</div> </div>
<div v-if="item.fileName" class="flex justify-between items-center bg-white p-3 mt-2 rounded-lg"> <div
<div class="bg-[#d8e5fd] text-[12px] text-[#3162ff] w-16 h-7 rounded-lg flex justify-center items-center"> v-if="item.fileName"
class="flex justify-between items-center bg-white p-3 mt-2 rounded-lg"
>
<div
class="bg-[#d8e5fd] text-[12px] text-[#3162ff] w-16 h-7 rounded-lg flex justify-center items-center"
>
100% 100%
</div> </div>
<div class="flex-1 flex items-center line-clamp"> <div class="flex-1 flex items-center line-clamp">
{{ {{ item.fileName }}
item.fileName
}}
</div> </div>
<div> <div>
<Trash class="cursor-pointer" @click="item.fileName = '', item.filePath = ''" /> <Trash
class="cursor-pointer"
@click="(item.fileName = ''), (item.filePath = '')"
/>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div class="upload-content"> <div class="upload-content">
<div class="flex flex-col justify-center items-center w-30 h-40 border border-dashed mt-2 rounded-lg bg-white"> <div
<div class="w-24 bg-gradient-to-r from-[#2D28FF] to-[#1A7DFF] h-8 text-white rounded-sm bg-[#3162ff] cursor-pointer flex justify-center items-center" @click="triggerFileInput(index)"> class="flex flex-col justify-center items-center w-30 h-40 border border-dashed mt-2 rounded-lg bg-white"
>
<div
class="w-24 bg-gradient-to-r from-[#2D28FF] to-[#1A7DFF] h-8 text-white rounded-sm bg-[#3162ff] cursor-pointer flex justify-center items-center"
@click="triggerFileInput(index)"
>
上传文件 上传文件
</div> </div>
<div class="my-3"> <div class="my-3">点击上传文件</div>
点击上传文件 <div class="text-[#999999] text-xs">.json/.zip</div>
</div>
<div class="text-[#999999] text-xs">
.json/.zip
</div>
</div> </div>
</div> </div>
</div> </div>
@ -201,10 +222,16 @@ function onDelete(index: number) {
</div> </div>
</template> </template>
<div class="flex items-center justify-center mt-5"> <div class="flex items-center justify-center mt-5">
<div class="flex justify-center items-center mt-5 w-[20%] mx-2 h-10 rounded-lg bg-[#f1f2f7] cursor-pointer" @click="preStep"> <div
class="flex justify-center items-center mt-5 w-[20%] mx-2 h-10 rounded-lg bg-[#f1f2f7] cursor-pointer"
@click="preStep"
>
上一步 上一步
</div> </div>
<div class="flex justify-center items-center mt-5 text-white mx-2 w-[20%] h-10 rounded-lg bg-[#3162ff] cursor-pointer" @click="nextStep"> <div
class="flex justify-center items-center mt-5 text-white mx-2 w-[20%] h-10 rounded-lg bg-[#3162ff] cursor-pointer"
@click="nextStep"
>
下一步 下一步
</div> </div>
</div> </div>
@ -217,7 +244,7 @@ function onDelete(index: number) {
class="hidden" class="hidden"
:accept="acceptTypes" :accept="acceptTypes"
@change="handleFileChange" @change="handleFileChange"
> />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, onMounted } from 'vue' import { nextTick, onMounted } from 'vue';
definePageMeta({ definePageMeta({
layout: 'header', layout: 'header',
@ -18,6 +18,7 @@ async function getPoints() {
const res = await request.get('/member/getPoints') const res = await request.get('/member/getPoints')
if (res.code === 200) { if (res.code === 200) {
pointsResult.value = res.data as PointsResult pointsResult.value = res.data as PointsResult
debugger
nextTick(() => { nextTick(() => {
activeTab.value = 'beatles' activeTab.value = 'beatles'
}) })
@ -98,7 +99,7 @@ onMounted(() => {
{{ item.consumeTime }} {{ item.consumeTime }}
</div> </div>
<div class="w-[250px]"> <div class="w-[250px]">
每日赠送算力清零 生图
</div> </div>
<div class="flex-1"> <div class="flex-1">
- -

View File

@ -35,7 +35,6 @@ async function getInfo() {
if (res.code === 200) { if (res.code === 200) {
detailsInfo.value = res.data; detailsInfo.value = res.data;
detailsInfo.value.styleList = JSON.parse(res.data.styleList); detailsInfo.value.styleList = JSON.parse(res.data.styleList);
debugger
// detailsInfo.value.styleList =JSON.parse(res.data.styleList) // detailsInfo.value.styleList =JSON.parse(res.data.styleList)
// // 1 // // 1
try { try {

View File

@ -75,7 +75,7 @@ function onInputSearch(){
/> />
<!-- 相机图标 --> <!-- 相机图标 -->
<button class="absolute right-24 p-2 mr-2 text-gray-400 hover:text-gray-600"> <!-- <button class="absolute right-24 p-2 mr-2 text-gray-400 hover:text-gray-600">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6" class="h-6 w-6"
@ -96,7 +96,7 @@ function onInputSearch(){
d="M15 13a3 3 0 11-6 0 3 3 0 016 0z" d="M15 13a3 3 0 11-6 0 3 3 0 016 0z"
/> />
</svg> </svg>
</button> </button> -->
<!-- 搜索按钮 --> <!-- 搜索按钮 -->
<button <button

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Close } from "@vicons/ionicons5"; import { Close } from "@vicons/ionicons5";
const message = useMessage() const message = useMessage();
import { commonApi } from "@/api/common"; import { commonApi } from "@/api/common";
import EditUserInfo from "@/components/EditUserInfo.vue"; import EditUserInfo from "@/components/EditUserInfo.vue";
@ -95,17 +95,18 @@ function initLikesParams() {
const urlList = ref({ const urlList = ref({
mallProduct: { mallProduct: {
0: "/model/selectByUserIdModel", 0: "/personalCenter/selectByUserIdModel",
1: "/model/selectByUserIdWorkFlow", 1: "/personalCenter/selectByUserIdWorkFlow",
2: "/model/selectByUserIdImage", 2: "/personalCenter/selectByUserIdImage",
}, },
like: { like: {
0: "/model/likeModel", 0: "/personalCenter/likeModel",
1: "/model/likeWorkFlow", 1: "/personalCenter/likeWorkFlow",
2: "/model/likeImage", 2: "/personalCenter/likeImage",
}, },
}); });
const showInvitationModal = ref(false);
// //
const statusOptions = ref([]); const statusOptions = ref([]);
@ -164,16 +165,16 @@ function changeTabs(id: string) {
// // // //
function changeType(id: string) { function changeType(id: string) {
if(id === '2'){ if (id === "2") {
statusOptions.value.forEach(item => { statusOptions.value.forEach((item) => {
if(item.dictValue === '2'){ if (item.dictValue === "2") {
item.disabled = true item.disabled = true;
} }
}); });
}else{ } else {
statusOptions.value.forEach(item => { statusOptions.value.forEach((item) => {
if(item.dictValue === '2'){ if (item.dictValue === "2") {
item.disabled = false item.disabled = false;
} }
}); });
} }
@ -216,8 +217,6 @@ async function changeDate(value: string[]) {
initPageNUm(); initPageNUm();
} }
// // // //
interface SelectUserInfo { interface SelectUserInfo {
likeCount: number; likeCount: number;
@ -357,17 +356,17 @@ function onClearDate() {
} }
// //
const isShowFan = ref(false) const isShowFan = ref(false);
const attentionFinished = ref(false) const attentionFinished = ref(false);
const attentionList = ref([]); const attentionList = ref([]);
const attentionListParams = ref({ const attentionListParams = ref({
pageNumber: 1, pageNumber: 1,
pageSize: 15, pageSize: 15,
}); });
async function getAttentionList() { async function getAttentionList() {
try{ try {
if(attentionFinished.value) return if (attentionFinished.value) return;
const res = await request.post(`/attention/selectToAttention`, { const res = await request.post(`/attention/selectToAttention`, {
...attentionListParams.value, ...attentionListParams.value,
}); });
@ -380,10 +379,10 @@ async function getAttentionList() {
total.value = res.data.total; // total.value = res.data.total; //
// //
if ( attentionList.value.length >= total.value) { if (attentionList.value.length >= total.value) {
attentionFinished.value = true; attentionFinished.value = true;
} }
attentionListParams.value.pageNumber++ attentionListParams.value.pageNumber++;
} }
} catch (err) { } catch (err) {
attentionList.value = []; attentionList.value = [];
@ -394,15 +393,15 @@ async function getAttentionList() {
getAttentionList(); getAttentionList();
// //
const likeFinished = ref(false) const likeFinished = ref(false);
const likeList = ref([]); const likeList = ref([]);
const likeListParams = ref({ const likeListParams = ref({
pageNumber: 1, pageNumber: 1,
pageSize: 15, pageSize: 15,
}); });
async function getLikeList() { async function getLikeList() {
try{ try {
if(likeFinished.value) return if (likeFinished.value) return;
const res = await request.post(`/attention/selectAttentionList`, { const res = await request.post(`/attention/selectAttentionList`, {
...likeListParams.value, ...likeListParams.value,
}); });
@ -415,10 +414,10 @@ async function getLikeList() {
total.value = res.data.total; // total.value = res.data.total; //
// //
if ( likeList.value.length >= total.value) { if (likeList.value.length >= total.value) {
likeFinished.value = true; likeFinished.value = true;
} }
likeListParams.value.pageNumber++ likeListParams.value.pageNumber++;
} }
} catch (err) { } catch (err) {
likeList.value = []; likeList.value = [];
@ -429,25 +428,178 @@ async function getLikeList() {
getLikeList(); getLikeList();
function closefanList() { function closefanList() {
isShowFan.value = false isShowFan.value = false;
} }
// / // /
async function onAttention(item:any){ async function onAttention(item: any) {
try { try {
const res = await request.get(`/attention/addAttention?userId=${item.userId}`); const res = await request.get(`/attention/addAttention?userId=${item.userId}`);
if (res.code === 200) { if (res.code === 200) {
if(res.data){ if (res.data) {
message.success('关注成功') message.success("关注成功");
}else{ } else {
message.success('取消关注成功') message.success("取消关注成功");
} }
item.attention = !item.attention item.attention = !item.attention;
} }
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
} }
//
const invitationCode = ref("");
async function getInvitation() {
try {
const res = await request.get(`/invitation/getInvitationCode`);
if (res.code === 200) {
invitationCode.value = res.msg;
}
} catch (err) {
console.log(err);
}
}
getInvitation();
//
// async function getInvitationList() {
// }
//
function copyToClipboard(text: string) {
const textarea = document.createElement("textarea");
textarea.value = text;
document.body.appendChild(textarea);
textarea.select();
const success = document.execCommand("copy");
document.body.removeChild(textarea);
if (success) {
message.success("复制成功!");
} else {
message.success("复制成功!");
}
}
//
function handlePositiveClick() {
copyToClipboard(invitationCode.value);
}
const activeTab = ref('like')
//
const invitationList = ref({
totalAmount: 2889,
earningsDisplayList: [
{
user: {
userId: 2,
userName: "ry",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 1,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 105,
userName: "默认用户:oKwIrhqh",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 2,
},
{
user: {
userId: 107,
userName: "默认用户:hQDEthgT",
avatar:
"https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
},
count: 0,
},
],
});
async function handleNegativeClick() {
try {
const res = await request.get(`/invitation/earningsDisplay`);
if (res.code === 200) {
invitationList.value = res.data
showInvitationModal.value = true;
}
} catch (err) {
console.log(err);
}
}
const showLike = (type:string) =>{
isShowFan.value= true
activeTab.value = type
}
</script> </script>
<template> <template>
@ -495,6 +647,21 @@ async function onAttention(item:any){
> >
去实名 去实名
</div> </div>
<div>
<n-popconfirm
class="bg-white ml-2"
positive-text="复制邀请码"
negative-text="查看列表"
:show-icon="false"
@positive-click="handlePositiveClick"
@negative-click="handleNegativeClick"
>
<template #trigger>
<n-button class="ml-2 rounded-lg" type="info" round>获取邀请码</n-button>
</template>
邀请码: {{ invitationCode }}
</n-popconfirm>
</div>
</div> </div>
<!-- User Details --> <!-- User Details -->
@ -509,8 +676,7 @@ async function onAttention(item:any){
<div class="production-state mt-4 flex text-sm text-gray-700"> <div class="production-state mt-4 flex text-sm text-gray-700">
<div <div
class="production-state-item mr-5 cursor-pointer" class="production-state-item mr-5 cursor-pointer"
@click="isShowFan = true" @click="showLike('like')"
> >
<span class="production-state-number font-bold">{{ <span class="production-state-number font-bold">{{
selectUserInfo.bean ? selectUserInfo.bean : 0 selectUserInfo.bean ? selectUserInfo.bean : 0
@ -519,8 +685,7 @@ async function onAttention(item:any){
</div> </div>
<div <div
class="production-state-item mr-5 cursor-pointer" class="production-state-item mr-5 cursor-pointer"
@click="isShowFan = true" @click="showLike('attention')"
> >
<span class="production-state-number font-bold">{{ <span class="production-state-number font-bold">{{
selectUserInfo.attention ? selectUserInfo.attention : 0 selectUserInfo.attention ? selectUserInfo.attention : 0
@ -651,67 +816,136 @@ async function onAttention(item:any){
<div v-if="finished" class="text-center text-gray-500"></div> <div v-if="finished" class="text-center text-gray-500"></div>
</div> </div>
<div class="fan-centent" v-if="isShowFan"> <div class="fan-centent" v-if="isShowFan">
<div
<div class="w-[550px] h-[calc(100vh-100px)] max-h-[700px] m-auto py-0 px-8 pb-[43px] bg-[#fff] rounded-lg relative"
class="w-[550px] h-[calc(100vh-100px)] max-h-[700px] m-auto py-0 px-8 pb-[43px] bg-[#fff] rounded-lg relative" >
> <n-icon
<n-icon size="20" class="mr-2 cursor-pointer absolute top-4 right-2" @click="closefanList"> size="20"
<Close /> class="mr-2 cursor-pointer absolute top-4 right-2"
</n-icon> @click="closefanList"
<n-tabs >
v-model:value="activeTab" <Close />
default-value="like" </n-icon>
justify-content="space-evenly" <n-tabs
type="line" v-model:value="activeTab"
> default-value="like"
<n-tab-pane name="like" :tab="`粉丝${selectUserInfo.bean || 0}`"> justify-content="space-evenly"
<n-infinite-scroll style="height: calc(100vh - 200px);padding:0 10px" :distance="10" @load="getAttentionList"> type="line"
<!-- <div class="overflow-y-auto h-[calc(100vh-200px)] px-2"> --> >
<n-tab-pane name="like" :tab="`粉丝${selectUserInfo.bean || 0}`">
<n-infinite-scroll
style="height: calc(100vh - 200px); padding: 0 10px"
:distance="10"
@load="getAttentionList"
>
<!-- <div class="overflow-y-auto h-[calc(100vh-200px)] px-2"> -->
<div <div
v-for="(item, index) in attentionList" v-for="(item, index) in attentionList"
:key="index" :key="index"
class="flex justify-between items-center p-2" class="flex justify-between items-center p-2"
> >
<div class="flex items-center"> <div class="flex items-center">
<img :src="item.avatar || ''" alt="" class="w-14 h-14 rounded-full mr-2" /> <img
:src="item.avatar || ''"
alt=""
class="w-14 h-14 rounded-full mr-2"
/>
{{ item.nickName }} {{ item.nickName }}
</div> </div>
<div class="bg-[#f4f5f9] px-4 py-2 rounded-full cursor-pointer" @click="onAttention(item)"> <div
{{ item.attention ? '已关注' : '未关注' }} class="bg-[#f4f5f9] px-4 py-2 rounded-full cursor-pointer"
@click="onAttention(item)"
>
{{ item.attention ? "已关注" : "未关注" }}
</div> </div>
</div> </div>
<div v-if="attentionList.length === 0" class="w-full text-center text-gray-500 font-bold mt-2"> <div
v-if="attentionList.length === 0"
class="w-full text-center text-gray-500 font-bold mt-2"
>
暂无数据 暂无数据
</div> </div>
<!-- </div> --> <!-- </div> -->
</n-infinite-scroll> </n-infinite-scroll>
</n-tab-pane>
<n-tab-pane name="attention" :tab="`关注${selectUserInfo.attention || 0}`">
<!-- <div class="overflow-y-auto h-[calc(100vh-200px)] px-2"> -->
<n-infinite-scroll style="height: calc(100vh - 200px); padding:0 10px" :distance="10" @load="getLikeList">
<div
v-for="(item, index) in likeList"
:key="index"
class="flex justify-between items-center p-2"
>
<div class="flex items-center">
<img :src="item.avatar || ''" alt="" class="w-14 h-14 rounded-full mr-2" />
{{ item.nickName }}
</div>
<div class="bg-[#f4f5f9] px-4 py-2 rounded-full cursor-pointer" @click="onAttention(item)">
{{ item.attention ? '已关注' : '未关注' }}
</div>
</div>
<div v-if="attentionList.length === 0" class="w-full text-center text-gray-500 font-bold mt-2">
暂无数据
</div>
<!-- </div> -->
</n-infinite-scroll>
</n-tab-pane> </n-tab-pane>
</n-tabs> <n-tab-pane name="attention" :tab="`关注${selectUserInfo.attention || 0}`">
</div> <!-- <div class="overflow-y-auto h-[calc(100vh-200px)] px-2"> -->
</div> <n-infinite-scroll
style="height: calc(100vh - 200px); padding: 0 10px"
:distance="10"
@load="getLikeList"
>
<div
v-for="(item, index) in likeList"
:key="index"
class="flex justify-between items-center p-2"
>
<div class="flex items-center">
<img
:src="item.avatar || ''"
alt=""
class="w-14 h-14 rounded-full mr-2"
/>
{{ item.nickName }}
</div>
<div
class="bg-[#f4f5f9] px-4 py-2 rounded-full cursor-pointer"
@click="onAttention(item)"
>
{{ item.attention ? "已关注" : "未关注" }}
</div>
</div>
<div
v-if="attentionList.length === 0"
class="w-full text-center text-gray-500 font-bold mt-2"
>
暂无数据
</div>
<!-- </div> -->
</n-infinite-scroll>
</n-tab-pane>
</n-tabs>
</div>
</div>
<n-modal v-model:show="showInvitationModal">
<n-card
style="width: 600px"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<!-- <template #header-extra>
</template> -->
<div class="py-4 flex justify-between">
<div class="text-xl font-bold">邀请列表</div>
<div class="text-sm text-gray-600">
总收益: {{ invitationList.totalAmount }}
</div>
</div>
<div class="rounded-lg">
<div class="flex w-[100%]">
<div class="w-[180px] flex items-center py-2">头像</div>
<div class="w-[180px] flex items-center py-2">邀请人购买数量</div>
<div class="w-[180px] flex items-center py-2">邀请人名字</div>
</div>
<div class="max-h-[500px] overflow-y-auto">
<div
class="flex w-[100%] hover:bg-[#f3f3f3] px-2"
v-for="(item, index) in invitationList.earningsDisplayList"
:key="index"
>
<div class="w-[180px] flex items-center py-2">
<img class="w-10 h-10 rounded-full" :src="item.user.avatar" alt="" />
</div>
<div class="w-[180px] flex items-center py-2">{{ item.count }}</div>
<div class="w-[180px] flex items-center py-2">{{ item.user.userName }}</div>
</div>
</div>
</div>
</n-card>
</n-modal>
</div> </div>
</template> </template>

View File

@ -4,6 +4,7 @@ import EditVersion from "@/components/publishModel/EditVersion.vue";
import UploadImg from "@/components/publishModel/UploadImg.vue"; import UploadImg from "@/components/publishModel/UploadImg.vue";
import { NConfigProvider, NMessageProvider } from "naive-ui"; import { NConfigProvider, NMessageProvider } from "naive-ui";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
const message = useMessage();
const route = useRoute(); const route = useRoute();
const { type, id } = route.query; const { type, id } = route.query;
@ -31,6 +32,9 @@ async function initFormData() {
modelVersionList: [ modelVersionList: [
{ {
objectKey:null,
id:null,
isEncrypt:0,
delFlag: "0", // 0 2 delFlag: "0", // 0 2
versionName: "", // versionName: "", //
modelVersionType: null, // modelVersionType: null, //
@ -97,8 +101,24 @@ const timeLineList = ref([
index: 3, index: 3,
}, },
]); ]);
function nextStep() { async function nextStep() {
currentStep.value += 1; if(currentStep.value === 1){
const name = formData.value.modelProduct.modelName
try {
const res = await request.get(`/file/selectFile?type=model&name=${name}`);
if (res.code == 200) {
if(res.data === 1){ //0 1
currentStep.value += 1;
}else{
message.warning('该模型名称已存在')
}
}
} catch (err) {
console.log(err);
}
}else{
currentStep.value += 1;
}
} }
function prevStep() { function prevStep() {
currentStep.value -= 1; currentStep.value -= 1;

View File

@ -24,6 +24,7 @@ async function initFormData() {
}, },
workFlowVersionList: [ workFlowVersionList: [
{ {
id:null,
versionName: "", versionName: "",
hideGenInfo: 0, // hideGenInfo: 0, //
versionDescription: "", // versionDescription: "", //
@ -70,8 +71,21 @@ const currentStep = ref(1);
function handleAddVersion() { function handleAddVersion() {
EditVersionRef.value.addVersion(); EditVersionRef.value.addVersion();
} }
function nextStep() { async function nextStep() {
currentStep.value += 1; // currentStep.value += 1;
if(currentStep.value === 1){
const name = formData.value.workFlow.workflowName
try {
const res = await request.get(`/file/selectFile?type=workflow&name=${name}`);
if (res.code == 200) {
currentStep.value += 1;
}
} catch (err) {
console.log(err);
}
}else{
currentStep.value += 1;
}
} }
function preStep() { function preStep() {
currentStep.value -= 1; currentStep.value -= 1;

View File

@ -24,6 +24,7 @@ export const useUserStore = defineStore('user', () => {
function setUserInfo(info: any) { function setUserInfo(info: any) {
userInfo.value = info userInfo.value = info
debugger
} }
async function getUserInfo() { async function getUserInfo() {
const res = await request.get('/system/user/selectUserById', { const res = await request.get('/system/user/selectUserById', {
@ -36,6 +37,7 @@ export const useUserStore = defineStore('user', () => {
} }
// 登出 // 登出
function logout() { function logout() {
console.log('object-------out');
isLoggedIn.value = false isLoggedIn.value = false
token.value = '' token.value = ''
userInfo.value = {} as UserInfoType userInfo.value = {} as UserInfoType

View File

@ -29,11 +29,13 @@ class RequestHttp {
(config:any) => { (config:any) => {
const userStore = useUserStore() const userStore = useUserStore()
const isToken = (config.headers || {}).isToken === false const isToken = (config.headers || {}).isToken === false
if (userStore.token && !isToken) { if (userStore.token && !isToken) {
config.headers.Authorization = `Bearer ${userStore.token}` // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers.Authorization = `Bearer ${userStore.token}` // 让每个请求携带自定义token 请根据实际情况自行修改
} }
// if (userStore.token && !isToken) {
// config.headers.Authorization = `Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjA1NDk1MmNmLTg2YTgtNDZkNC05OWU0LWUzYzU5ODFjZGE2OSJ9.fifWwKgHIswkqGLqp71BWx-UJjv_qYiPO_XeMYt2HkzLfEoDVVpdHysebp_2XNWdjLi4weRga1GzlUBdW_xebw` // 让每个请求携带自定义token 请根据实际情况自行修改
// }
// 开启 loading // 开启 loading
if (config.loading) { if (config.loading) {
loadingBar.start() loadingBar.start()
@ -59,7 +61,6 @@ class RequestHttp {
this.handleError(data.code) this.handleError(data.code)
// token过期以后需要重新登录 // token过期以后需要重新登录
if (data.code === 401) { if (data.code === 401) {
debugger
// message.error(data.message || '登录已过期,请重新登录') // message.error(data.message || '登录已过期,请重新登录')
// const modalStore = useModalStore() // const modalStore = useModalStore()
const modalStore = useModalStore(); const modalStore = useModalStore();
@ -67,8 +68,8 @@ class RequestHttp {
const userStore = useUserStore() const userStore = useUserStore()
try { try {
// eslint-disable-next-line ts/no-use-before-define // eslint-disable-next-line ts/no-use-before-define
await request.post('/logout') // await request.post('/logout')
userStore.logout() // userStore.logout()
// navigateTo('/model-square') // navigateTo('/model-square')
} }
catch (error) { catch (error) {

View File

@ -57,8 +57,9 @@ export async function uploadFileBatches(files, batchSize = 3) {
uploadResults.push(res.data) uploadResults.push(res.data)
} }
catch (error) { catch (error) {
console.error(`文件上传失败: ${file.name}`, error) throw new Error(`上传第 ${i + 1} 个文件失败!`);
uploadResults.push({ success: false, error }) // console.error(`文件上传失败: ${file.name}`, error)
// uploadResults.push({ success: false, error })
} }
} }
return uploadResults return uploadResults

View File

@ -83,8 +83,8 @@ export default defineNuxtConfig({
devProxy: { devProxy: {
'/api': { '/api': {
// target: 'http://1.13.246.108:8080', // 线上 // target: 'http://1.13.246.108:8080', // 线上
target: 'http://192.168.2.10:8080', // 代 // target: 'http://192.168.2.10:8080', // 代
// target: 'http://192.168.1.69:8080', // 嗨 target: 'http://192.168.2.7:8080', // 嗨
// target: 'https://2d1a399f.r27.cpolar.top', // 嗨 // target: 'https://2d1a399f.r27.cpolar.top', // 嗨
changeOrigin: true, changeOrigin: true,
prependPath: true, prependPath: true,