diff --git a/.env.dev b/.env.dev index 9d8fd99..865abc7 100644 --- a/.env.dev +++ b/.env.dev @@ -1,2 +1,2 @@ -NODE_ENV = 'development' -VITE_NUXT_ENV = 'http://1.13.246.108:8080/' \ No newline at end of file +NODE_ENV = 'dev' +VITE_NUXT_ENV = 'http://www.mc158c.com' \ No newline at end of file diff --git a/.env.pro b/.env.pro index 0b5eda0..8788079 100644 --- a/.env.pro +++ b/.env.pro @@ -1,2 +1,2 @@ NODE_ENV = 'production' -VITE_NUXT_ENV = 'http://113.45.190.154:8080/' \ No newline at end of file +VITE_NUXT_ENV = 'http://www.mc158c.com' \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..aef68bc --- /dev/null +++ b/.env.production @@ -0,0 +1,4 @@ +# 生产环境配置 +VITE_APP_TITLE=魔创未来 +VITE_NUXT_ENVL=http://113.45.9.111 +VITE_APP_ENV=production \ No newline at end of file diff --git a/README.md b/README.md index bfd8250..6ac12e2 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,5 @@ npx degit antfu/vitesse-nuxt my-nuxt-app cd my-nuxt-app pnpm i # If you don't have pnpm installed, run: npm install -g pnpm ``` + + diff --git a/app/api/planet.ts b/app/api/planet.ts new file mode 100644 index 0000000..e69de29 diff --git a/app/api/planet/planet-detail.ts b/app/api/planet/planet-detail.ts new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/img/elite.png b/app/assets/img/elite.png new file mode 100644 index 0000000..b918b63 Binary files /dev/null and b/app/assets/img/elite.png differ diff --git a/app/assets/img/logo.png b/app/assets/img/logo.png new file mode 100644 index 0000000..0747fe8 Binary files /dev/null and b/app/assets/img/logo.png differ diff --git a/app/assets/img/planetBg.png b/app/assets/img/planetBg.png new file mode 100644 index 0000000..f07cf39 Binary files /dev/null and b/app/assets/img/planetBg.png differ diff --git a/app/components.d.ts b/app/components.d.ts index c562f5b..4ee6cb8 100644 --- a/app/components.d.ts +++ b/app/components.d.ts @@ -8,6 +8,7 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + NAffix: typeof import('naive-ui')['NAffix'] NAvatar: typeof import('naive-ui')['NAvatar'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] @@ -24,9 +25,11 @@ declare module 'vue' { NInput: typeof import('naive-ui')['NInput'] NInputGroup: typeof import('naive-ui')['NInputGroup'] NModal: typeof import('naive-ui')['NModal'] + NPagination: typeof import('naive-ui')['NPagination'] NPopconfirm: typeof import('naive-ui')['NPopconfirm'] NQrCode: typeof import('naive-ui')['NQrCode'] NSelect: typeof import('naive-ui')['NSelect'] + NSkeleton: typeof import('naive-ui')['NSkeleton'] NSpace: typeof import('naive-ui')['NSpace'] NSpin: typeof import('naive-ui')['NSpin'] NTabPane: typeof import('naive-ui')['NTabPane'] diff --git a/app/components/BaseComment.vue b/app/components/BaseComment.vue index eb2bf5b..eeda81a 100644 --- a/app/components/BaseComment.vue +++ b/app/components/BaseComment.vue @@ -1,8 +1,8 @@ + + + + + + + + + + 上传封面 + + + + + + + + + + + + + + + + + + + + + + + + + + + 付费星球 + + + 免费星球 + + + + + + + + + + 积分 + + + + + + + + + + + + + + 取消 + + + 创建 + + + + + + diff --git a/app/components/DownPlanetFile.vue b/app/components/DownPlanetFile.vue new file mode 100644 index 0000000..3a9b446 --- /dev/null +++ b/app/components/DownPlanetFile.vue @@ -0,0 +1,149 @@ +# 创建新文件 + + + + + + + + + + {{ file.fileName }} + + + {{ file.fileSize }} · {{ file.uploadBy }} · {{ file.uploadTime }} + + + + + + + 下载 + + + + + 暂无文件 + + + + + + 关闭 + + + + + diff --git a/app/components/EditPlanet.vue b/app/components/EditPlanet.vue new file mode 100644 index 0000000..d17638e --- /dev/null +++ b/app/components/EditPlanet.vue @@ -0,0 +1,320 @@ + + + + + + + + + + + 上传封面 + + + + + + + + + + + + + + + + + + + + + + + + + 付费星球 + + + 免费星球 + + + + + + + + + + 积分 + + + + + + + + + + + + + + 取消 + + + 保存 + + + + + + + + diff --git a/app/components/EditUserInfo.vue b/app/components/EditUserInfo.vue index bc43d02..ddbaf25 100644 --- a/app/components/EditUserInfo.vue +++ b/app/components/EditUserInfo.vue @@ -1,7 +1,8 @@ @@ -188,9 +196,17 @@ onMounted(() => {}); + + + 魔创未来 + - 魔创未来 + @@ -287,13 +303,15 @@ onMounted(() => {}); > {{ item.content }} - {{ item.createTime }} + + {{ item.createTime }} + + class="w-2 h-2 bg-[#ea5049] rounded" + /> diff --git a/app/components/IntPayment.vue b/app/components/IntPayment.vue index bee0293..0df5837 100644 --- a/app/components/IntPayment.vue +++ b/app/components/IntPayment.vue @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + {{ currentUserInfo.nickName }} + + + + {{ isSelectAttention ? '已关注' : '关注' }} + + + + + + + + + {{ planetInfo.communityName }} + + + + 创建{{ planetInfo.validityDay }}天 + + + {{ planetInfo.description }} + + + + + + 全部文件 + + + + + 我要提问 + + + + + + + + + + + + diff --git a/app/components/PlanetComment.vue b/app/components/PlanetComment.vue new file mode 100644 index 0000000..2216a01 --- /dev/null +++ b/app/components/PlanetComment.vue @@ -0,0 +1,667 @@ + + + + + + + + + + + + {{ item.userName }} + + + + + + + + + handleSelect(event, 'choiceness', item)" + > + {{ item.isElite === 1 ? '取消精选' : '精选' }} + + + handleSelect(event, 'complaint', item)" + > + 投诉 + + + + + + + + {{ item.content }} + + + {{ item.createTime }} + + + + {{ item.likeNum }} + + + + + + 回复 + + 删除 + + + + + + + + + 发送 + + + + + + + + + + + + {{ ele.userName }} + + + + + 回复 + @{{ ele.replyUserName }} + + {{ ele.content }} + + + {{ ele.createTime }} + + + + {{ ele.likeNum }} + + 回复 + 删除 + + + + + + + + + 发送 + + + + + + + + 暂时没有更多评论 + + + + + diff --git a/app/components/PlanetHeader.vue b/app/components/PlanetHeader.vue new file mode 100644 index 0000000..927aaa1 --- /dev/null +++ b/app/components/PlanetHeader.vue @@ -0,0 +1,186 @@ + + + + + + + + + + 魔创未来 + + + + + + {{ item.name }} + + + + + + + + + + + + + + 搜索 + + + + + + + + + + + + + + + + 登录 + + + + + + + + + + + + {{ userStore.userInfo.nickName }} + + + 欢迎来到魔创星球 + + + + + + + 个人主页 + + + 收益明细 + + + + + 推出登录 + + + + + + + + + + diff --git a/app/components/PlanetMessage/index.vue b/app/components/PlanetMessage/index.vue new file mode 100644 index 0000000..0cc4bcf --- /dev/null +++ b/app/components/PlanetMessage/index.vue @@ -0,0 +1,216 @@ + + + + + + + + + 通知 + + + + + + + + + + + + + {{ item.name }} + + + + + + + + + + + + + + {{ item.content }} + + + + {{ item.createTime }} + + + + + + {{ item.title }} + + + {{ item.content }} + + + + {{ item.createTime }} + + + + + + + {{ item.content }} + + + + {{ item.createTime }} + + + + + + + + 暂无消息 + + + + + + + + + + diff --git a/app/components/PlanetQuestionComment.vue b/app/components/PlanetQuestionComment.vue new file mode 100644 index 0000000..4899528 --- /dev/null +++ b/app/components/PlanetQuestionComment.vue @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + {{ item.questionUserName }} + + + {{ item.content }} + + + {{ item.createTime }} + + + + + + + + + + + + + + + + + {{ ele.userName }} + + + + + {{ ele.content }} + + + {{ ele.createTime }} + + + + + + + + + + 回答该问题可获得 + {{ item.amount }}积分 + + + 回答该问题 + + + + + 暂时没有更多评论 + + + + + + + 回答 + + {{ questionItem.questionUserName }} + 发起的咨询 + + + + + + + + + + 回答 + + + + + + + + + + diff --git a/app/components/PublishContent.vue b/app/components/PublishContent.vue new file mode 100644 index 0000000..8e0457b --- /dev/null +++ b/app/components/PublishContent.vue @@ -0,0 +1,217 @@ + + + + + + + + + + + + {{ item }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 发布 + + + + + + + diff --git a/app/components/QuestionPublish.vue b/app/components/QuestionPublish.vue new file mode 100644 index 0000000..6fdc53e --- /dev/null +++ b/app/components/QuestionPublish.vue @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + ¥ + + + + + + + + + + + 免费 + + + 付费 + + + + + 匿名提问 + + + + 提问 + + + + + + + diff --git a/app/components/WechatLoginQr.vue b/app/components/WechatLoginQr.vue index c99557a..57b7bed 100644 --- a/app/components/WechatLoginQr.vue +++ b/app/components/WechatLoginQr.vue @@ -3,8 +3,8 @@ // import { getUUid, uuidLogin } from '@api/login' // import { useStore } from '@store/index' // import { IosRefresh } from '@vicons/ionicons5'; -import { RotateCcw } from 'lucide-vue-next'; -import { onBeforeUnmount, onMounted, ref } from 'vue'; +import { RotateCcw } from 'lucide-vue-next' +import { onBeforeUnmount, onMounted, ref } from 'vue' // 定义事件 const emit = defineEmits<{ (event: 'login-success', data: any): void @@ -50,14 +50,18 @@ async function onGetUUid() { if (res.status === 1) { clearTimeout(pollingTimer) const userStore = useUserStore() - userStore.setToken(res.token) - const res1 = await request.get>('/getInfo', { - token: res.token, - }) - userStore.setUserInfo(res1.user) + await userStore.setToken(res.token) + await userStore.getUserInfo() + // const res1 = await request.get>('/getInfo', { + // token: res.token, + // }) + // const res1 = await request.get('/system/user/selectUserById', { + // token: token.value, + // }) + // userStore.setUserInfo(res1.user) // window.location.href = '/' - // 刷新页面 - window.location.reload(); + // 刷新页面 + window.location.reload() } }).catch(() => { clearTimeout(pollingTimer) @@ -87,7 +91,6 @@ onBeforeUnmount(() => { - 刷新二维码 diff --git a/app/components/WorkFlowList.vue b/app/components/WorkFlowList.vue index ea2a334..b4bdea0 100644 --- a/app/components/WorkFlowList.vue +++ b/app/components/WorkFlowList.vue @@ -1,3 +1,124 @@ + + @@ -12,14 +133,14 @@ :src="item.coverPath" class="w-full h-full object-cover rounded-lg cursor-pointer ransform transition-transform duration-300 hover:scale-110" alt="" - /> + > - {{ item.type }} - + --> - - {{ item.workflowName }} - + + {{ item.workflowName }} + - + {{ item.nickName }} - - + + - 加载中... - 没有更多数据了 + + 加载中... + + + 没有更多数据了 + - - diff --git a/app/components/fileUpload/index.vue b/app/components/fileUpload/index.vue index 3568c50..6f68c3a 100644 --- a/app/components/fileUpload/index.vue +++ b/app/components/fileUpload/index.vue @@ -1,49 +1,9 @@ - - - - - - - - - - - - - - - - - - - diff --git a/app/components/publishModel/EditVersion.vue b/app/components/publishModel/EditVersion.vue index 68899b1..7b7667a 100644 --- a/app/components/publishModel/EditVersion.vue +++ b/app/components/publishModel/EditVersion.vue @@ -1,11 +1,9 @@ @@ -160,7 +165,7 @@ function toUs(url: string) { @@ -270,36 +275,55 @@ function toUs(url: string) { {{ item.name }} - 扫码关注 - + + 扫码关注 + + - - 用户协议 - 隐私政策 - 关于我们 + + + 用户协议 + + + 隐私政策 + + + 关于我们 + + + + + 魔创未来(盘锦)量子科技有限公司 + + + + + 辽ICP备2024045484号-1 @@ -32,9 +88,9 @@ - - - + + + - 正在验证您的身份 + + 正在验证您的身份 + + /> + /> 请稍候片刻 @@ -106,58 +164,6 @@ - - diff --git a/app/pages/myPlanetDetail/index.vue b/app/pages/myPlanetDetail/index.vue new file mode 100644 index 0000000..435ef76 --- /dev/null +++ b/app/pages/myPlanetDetail/index.vue @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + {{ userStore.userInfo?.nickName }} + + + {{ selectUserInfo.bean || 0 }} 粉丝 + {{ selectUserInfo.attention || 0 }} 关注 + + + + + + + + + + + {{ item.label }} + + + + + + + {{ item.communityName }} + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/pages/personal-center/index.vue b/app/pages/personal-center/index.vue index 6979632..73df9e1 100644 --- a/app/pages/personal-center/index.vue +++ b/app/pages/personal-center/index.vue @@ -572,9 +572,9 @@ async function showBinding() { try { const res2 = await request.get(`/ali/pay/queryBindStatus`) if (res2.data === '1') { + await userStore.getUserInfo() closeBindingModal() message.success('绑定成功!') - // window.location.reload() getBindStatus() } } diff --git a/app/pages/personal-publish/index.vue b/app/pages/personal-publish/index.vue index e2c71db..86d8270 100644 --- a/app/pages/personal-publish/index.vue +++ b/app/pages/personal-publish/index.vue @@ -1,3 +1,267 @@ + + + > - {{ isAttention ? '已关注' : '关注' }} @@ -43,7 +306,7 @@ class="production-state-item mr-5 cursor-pointer" @click="isShowFan = true" > - {{ + {{ selectUserInfo.bean ? selectUserInfo.bean : 0 }} 粉丝 @@ -111,17 +374,20 @@ /> - 加载中... - 没有更多数据了 + + 加载中... + + + 没有更多数据了 + - - + - - - + + + - + + + + + + {{ item.nickName }} + + + {{ item.attention ? '已关注' : '未关注' }} + + + + 暂无数据 + + + + + - + {{ item.nickName }} - + {{ item.attention ? '已关注' : '未关注' }} @@ -148,291 +435,13 @@ 暂无数据 - - - - - - - {{ item.nickName }} - - - {{ item.attention ? '已关注' : '未关注' }} - - - - 暂无数据 - - - - - diff --git a/app/pages/planet-earnings/index.vue b/app/pages/planet-earnings/index.vue new file mode 100644 index 0000000..ded94b4 --- /dev/null +++ b/app/pages/planet-earnings/index.vue @@ -0,0 +1,358 @@ + + + + + + + + + + 星球收益(金币) + + + {{ formatAmount(dataDetail.communityIncome?.todayIncome) }} + + + 昨日 {{ formatAmount(dataDetail.communityIncome?.yesterdayIncome) }} + + + + + 问答收益(金币) + + + {{ formatAmount(dataDetail.questionIncome?.todayIncome) }} + + + 昨日 {{ formatAmount(dataDetail.questionIncome?.yesterdayIncome) }} + + + + + 星球累计收益(金币) + + + {{ formatAmount(dataDetail.totalIncome) }} + + + + + 金币余额 + + + {{ formatAmount(integralGold.wallet) }} + + + 去提现 > + + + + + + + + 金币收益明细 + + + + + + + + + + + + + + 用户 + + + 星球名称 + + + 类型 + + + 支付金额(金币) + + + 时间 + + + + + + + + {{ item.userName }} + + + + {{ item.communityName }} + + + {{ item.type === 0 ? '付费加入' : '付费问答' }} + + + {{ formatAmount(item.amount) }} + + + {{ item.createTime || '-' }} + + + + + + + + + 暂无数据 + + + + + + + + + + diff --git a/app/pages/planet/index.vue b/app/pages/planet/index.vue new file mode 100644 index 0000000..58ec195 --- /dev/null +++ b/app/pages/planet/index.vue @@ -0,0 +1,211 @@ + + + + + + + + + {{ item.dictLabel }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 这里空空如也,什么都没有找到~ + + + + + + + + + diff --git a/app/pages/planetAllFile/index.vue b/app/pages/planetAllFile/index.vue new file mode 100644 index 0000000..b8c375c --- /dev/null +++ b/app/pages/planetAllFile/index.vue @@ -0,0 +1,367 @@ + + + + + + + + + 上传文件 + + + + + + + + + + + + + + + + + + 全部文件 + + + 文件大小 + + + 上传人 + + + 上传时间 + + + 下载次数 + + + 操作 + + + + + + + + + + + + + {{ item.fileName }} + + + + {{ formatFileSize(item.fileSize) }} + + + {{ item.uploadUserName || '-' }} + + + {{ item.createTime }} + + + + {{ item.downloadFileUser.count }} + + + + + 下载 + + + + + + + + + + 暂无数据 + + + + + + + + + + diff --git a/app/pages/planetDetail.vue b/app/pages/planetDetail.vue new file mode 100644 index 0000000..aa94da6 --- /dev/null +++ b/app/pages/planetDetail.vue @@ -0,0 +1,74 @@ + + + + + + + + Not found + + + Back + + + + diff --git a/app/pages/planetMember/index.vue b/app/pages/planetMember/index.vue new file mode 100644 index 0000000..3f4ca0f --- /dev/null +++ b/app/pages/planetMember/index.vue @@ -0,0 +1,388 @@ + + + + + + + + 分享星球 + + + + + + + + + + + + + + 全部成员 + + + 权限 + + + 加入类型 + + + 首次加入时间 + + + 到期时间 + + + 操作 + + + + + + + + + + + + + {{ item.nickName }} + + + + {{ item.userType === 0 ? '成员' : item.userType === 1 ? '管理员' : '群主' }} + + + {{ item.userType !== 2 ? item.joinType : '-' }} + + + {{ item.startTime || '-' }} + + + {{ item.endTime || '-' }} + + + + + {{ item.userType === 2 ? '-' : item.userType === 0 ? '设为管理员' : '取消管理员' }} + + + + + {{ item.userType === 2 ? '-' : item.isBlack === '0' ? '拉黑' : '解除拉黑' }} + + + + + + + + + + + + 拉黑成员 + + + + + formRef.value?.validate(['blackDay'])" + /> + 天 + + + + 拉黑后该成员将不能对星球进行内容发布、点赞、评论内容等操作!拉黑时长结束后将自动解除 + + + + + + + + + + + 取消 + + + 确定拉黑 + + + + + + + + + + diff --git a/app/pages/public-planet-detail/index.vue b/app/pages/public-planet-detail/index.vue new file mode 100644 index 0000000..93ee11a --- /dev/null +++ b/app/pages/public-planet-detail/index.vue @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + {{ communityDetail.communityName }} + + + 最新更新时间: {{ communityDetail.lastUpdateTime }} + + + + + + 成员数量: {{ communityDetail.userNum }} + + + + 累计更新内容: {{ communityDetail.updateNum }} + + + 星球创建天数: {{ communityDetail.createDay }} + + + + + + + {{ communityDetail.price ? communityDetail.price : '免费' }} 积分 + + + 立即加入 + + + + + + + + 星球概况 + + + + + + + + + {{ userInfo.nickName }} + + + + + {{ selectUserInfo.bean }}粉丝 + {{ selectUserInfo.attention }}关注 + {{ Number(selectUserInfo.imageLikeNum) + Number(selectUserInfo.modelLikeNum) }}获赞 + + + + + {{ communityDetail.description }} + + + + 付费通知 + + + 1、付费后,你可以使用当前付款的帐号在有效期内查看、参与内容互动,向星主、群成员提问。 + 2、本星球由星主自行创建,加入前请确认风险,平台不提供相关保证。若发现违反法律法规的星球,请勿加入,并投诉。 + + + + + + + + diff --git a/app/pages/wallet/index.vue b/app/pages/wallet/index.vue index 7366440..ba0ff34 100644 --- a/app/pages/wallet/index.vue +++ b/app/pages/wallet/index.vue @@ -3,16 +3,14 @@ import { isAmount } from '@/utils/index.ts' import { Close } from '@vicons/ionicons5' import { ref } from 'vue' +const loading = ref(false) const activeTab = ref('withdrawDetail') const showWalletModal = ref(false) function showModal() { showWalletModal.value = true } const message = useMessage() -function closeWalletModal() { - showWalletModal.value = false - needWalletNum.value = 0 -} + // const allDetailList = ref([]); // 获取可提现金额 const integralGold = ref({}) @@ -32,10 +30,13 @@ getIntegralGold() // 提现操作 const needWalletNum = ref(0) async function handleWallet() { + if (loading.value) + return if (isAmount(needWalletNum.value)) { if (needWalletNum.value > integralGold.value.wallet) return message.warning('可提现金额不足') try { + loading.value = true const res = await request.get(`/ali/pay/fetch?amount=${needWalletNum.value}`) if (res.code === 200) { message.success('提现成功!') @@ -47,12 +48,20 @@ async function handleWallet() { catch (err) { console.log(err) } + finally { + loading.value = false + } } else { message.warning('请输入正确的金额') } } +function closeWalletModal() { + showWalletModal.value = false + needWalletNum.value = 0 +} + // 获取累计收入金额 const totalAmount = ref(0) async function getTotalAmount() { @@ -228,18 +237,21 @@ getWithdrawDetail() 可提现金额: ¥ {{ integralGold.wallet || 0 }} - + + + 取消 + 确定 diff --git a/app/pages/workflow-details/[id].vue b/app/pages/workflow-details/[id].vue index fcdda4b..51fe24f 100644 --- a/app/pages/workflow-details/[id].vue +++ b/app/pages/workflow-details/[id].vue @@ -184,9 +184,9 @@ async function onLike() { // 举报 const reportParams = ref({ - reportId: undefined, + reportType: undefined, text: '', - type: 3, + type: 1, }) const reportList = ref([]) async function getDictType() { @@ -202,7 +202,7 @@ async function getDictType() { } getDictType() function handleChange(item) { - reportParams.value.reportId = item.dictValue + reportParams.value.reportType = item.dictValue if (item.dictValue !== '5') { reportParams.value.text = '' } @@ -214,8 +214,9 @@ function closeReport() { } async function onReport() { - if (reportParams.value.reportId !== undefined) { + if (reportParams.value.reportType !== undefined) { reportParams.value.productId = detailsInfo.value.id + reportParams.value.productName = detailsInfo.value.workflowName try { const res = await request.post('/report/addReport', reportParams.value) if (res.code === 200) { @@ -601,7 +602,7 @@ async function handelDown() { :key="index" class="m-4 text-[#fff000]" size="large" - :checked="reportParams.reportId === item.dictValue" + :checked="reportParams.reportType === item.dictValue" value="Definitely Maybe" name="basic-demo" @change="handleChange(item)" @@ -609,7 +610,7 @@ async function handelDown() { {{ item.dictLabel }} { } } async function getUserInfo() { - const res = await request.get('/system/user/selectUserById', { - token: token.value, - }) - if (res.code === 200) { - res.data.avatar = res.data.avatar || defaultAvatar - setUserInfo(res.data) + if (token.value) { + const res = await request.get('/system/user/selectUserById', { + token: token.value, + }) + if (res.code === 200) { + res.data.avatar = res.data.avatar || defaultAvatar + setUserInfo(res.data) + } } } // 登出 diff --git a/app/types/api.ts b/app/types/api.ts index c2a0f14..40e3dd6 100644 --- a/app/types/api.ts +++ b/app/types/api.ts @@ -15,4 +15,4 @@ export interface PaginationResponse { total: number page: number pageSize: number -} \ No newline at end of file +} diff --git a/app/utils/index.ts b/app/utils/index.ts index 78151ab..324ecd2 100644 --- a/app/utils/index.ts +++ b/app/utils/index.ts @@ -6,23 +6,34 @@ export async function formatDate(timestamp: string) { return `${year}-${month}-${day}` } -export function formatFileSize(bytes:number = 0, decimals = 2) { - if (bytes === 0) return '0 B'; +export function formatFileSize(bytes: number = 0, decimals = 2) { + if (bytes === 0) + return '0 B' - const k = 1024; // 1 KB = 1024 B - const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - const i = Math.floor(Math.log(bytes) / Math.log(k)); // 计算单位索引 + const k = 1024 // 1 KB = 1024 B + const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + const i = Math.floor(Math.log(bytes) / Math.log(k)) // 计算单位索引 // 转换为合适的单位并保留指定小数位数 - return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i]; + return `${Number.parseFloat((bytes / k ** i).toFixed(decimals))} ${sizes[i]}` } -export function isAmount(str:any) { - const amountRegex = /^\d+(\.\d{1,2})?$/; - return amountRegex.test(str); +export function isAmount(str: any) { + const amountRegex = /^\d+(\.\d{1,2})?$/ + return amountRegex.test(str) +} +/** + * 金额转换千分位 + * @param amount 金额数值 + * @returns 格式化后的金额字符串 + */ +export function formatAmount(amount: number | undefined): string { + if (amount === undefined || amount === null) + return '-' + return amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') } // function isAmount(str) { // // 正则表达式 - -// } \ No newline at end of file + +// } diff --git a/app/utils/request.ts b/app/utils/request.ts index 7a0f04b..0044ae2 100644 --- a/app/utils/request.ts +++ b/app/utils/request.ts @@ -66,10 +66,9 @@ class RequestHttp { modalStore.showLoginModal() const userStore = useUserStore() try { - - // await request.post('/logout') - // userStore.logout() - // navigateTo('/model-square') + await request.post('/logout') + userStore.logout() + navigateTo('/model-square') } catch (error) { console.log(error) @@ -177,7 +176,7 @@ class RequestHttp { } const request = new RequestHttp({ - baseURL: import.meta.env.VITE_NUXT_ENV || '/api', + baseURL: import.meta.env.NODE_ENV === 'production' ? `${import.meta.env.VITE_NUXT_ENV}/api` : '/api', timeout: 20000, headers: { 'Content-Type': 'application/json', diff --git a/nuxt.config.ts b/nuxt.config.ts index c008cd4..e39ff4a 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -87,7 +87,7 @@ export default defineNuxtConfig({ '/api': { // target: 'http://113.45.190.154:8080', // 线上 // target: 'http://192.168.2.29:8080', // 代 - target: 'http://192.168.2.4:8080', // 嗨 + target: 'http://192.168.2.21:8080', // 嗨 // target: 'https://2d1a399f.r27.cpolar.top', // 嗨 changeOrigin: true, prependPath: true, diff --git a/package.json b/package.json index 03257d9..a1037dc 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,11 @@ "private": true, "packageManager": "pnpm@9.15.1", "scripts": { + "build:production": "nuxi build --dotenv .env.production", + "build:dev": "nuxi build --dotenv .env.dev", "build": "nuxi build --dotenv .env.pro", "dev:pwa": "VITE_PLUGIN_PWA=true nuxi dev", - "dev": "nuxi dev --port 3080", + "dev": "nuxi dev --port 8080", "generate": "nuxi generate", "prepare": "nuxi prepare", "start": "node .output/server/index.mjs",
+ {{ item.content }} +
正在验证您的身份
+ 正在验证您的身份 +
+ 这里空空如也,什么都没有找到~ +