feat: 对接部分接口

This commit is contained in:
anonymous
2025-01-09 10:45:10 +08:00
parent 21d8f75f6a
commit e70ca852d8
17 changed files with 165 additions and 62 deletions
+8 -5
View File
@@ -51,7 +51,7 @@
</view>
<view
class="flex mt-15"
v-for="item in newsList"
v-for="item in hotNewsList"
:key="item.id"
@click="handleNewsDetail(item.id)"
>
@@ -74,9 +74,7 @@
<text class="whitespace-nowrap text-14 font-bold text-gradient">
公告{{ ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'][index] }}
</text>
<text class="text-14 text-#333 flex-1">
{{ item.content }}
</text>
<text class="text-14 text-#333 flex-1" v-html="item.content"></text>
</view>
</view>
<view
@@ -99,7 +97,8 @@ defineOptions({
name: 'Home',
})
const { list: newsList } = useListPageRequest((params) =>
// 热门咨询
const { list: hotNewsList } = useListPageRequest((params) =>
getIntroductionAPI({ type: 1, ...params }),
)
@@ -149,6 +148,10 @@ const handleHotNews = () => {
const { list: announcementList } = useListPageRequest((params) =>
getIntroductionAPI({ type: 2, ...params }),
)
// 最新时讯
const { list: newsList } = useListPageRequest((params) =>
getIntroductionAPI({ type: 3, ...params }),
)
watch(
() => announcementList.value.length,
(newVal) => {
+19 -15
View File
@@ -13,6 +13,7 @@ import NavBar from '@/components/NavBar.vue'
import VueQrcode from '@chenfengyuan/vue-qrcode'
import { useUserStore } from '@/store'
import Avatar from '@/components/Avatar.vue'
import { getCommunityMyInviteAPI } from '@/service'
const userStore = useUserStore()
@@ -24,11 +25,18 @@ const onCopy = (code: string) => {
data: code,
})
}
const onLottery = () => {
uni.navigateTo({
url: '/pages-sub/lottery/index',
const inviteData = ref({
num: 0,
performance: 0,
})
const { list } = useListPageRequest((params) => {
return getCommunityMyInviteAPI(params).then((res) => {
inviteData.value.num = res.data.num
inviteData.value.performance = res.data.performance
res.data.data = res.data.list
return res.data
})
}
})
</script>
<template>
@@ -77,7 +85,7 @@ const onLottery = () => {
<view class="flex-1">
<view class="text-15 text-#333 font-500">
邀请10人
<text class="text-#50D0FF">(10</text>
<text class="text-#50D0FF">({{ inviteData.num }}</text>
<text class="text-#50D0FF">/10)</text>
</view>
<view class="text-12 text-#333 mt-8">每月额外领取3000元数济金</view>
@@ -134,25 +142,21 @@ const onLottery = () => {
</view>
<view class="mt-15 w-345 mx-auto">
<view class="ml-15 text-18 text-white">团队成员3/</view>
<view
class="mt-15 bg-white px-15 pt-15 pb-4 rounded-10"
v-for="(item, index) of 3"
:key="index"
>
<view class="mt-15 bg-white px-15 pt-15 pb-4 rounded-10" v-for="item of list" :key="item.id">
<view class="flex items-center">
<Avatar class="w-50 h-50" />
<Avatar :src="item.avatar" class="w-50 h-50" mode="aspectFill" />
<view class="ml-15 flex-1">
<view class="text-15 text-#333">Aaron</view>
<view class="text-12 text-#333 mt-10">2024-03-08</view>
<view class="text-15 text-#333">{{ item.nickname }}</view>
<view class="text-12 text-#333 mt-10">{{ item.jointime }}</view>
</view>
</view>
<view class="flex mt-16 py-8">
<view class="flex-1 text-center">
<view class="text-gradient">2</view>
<view class="text-gradient">{{ item.yiliao }}</view>
<view class="text-15 text-#333">医疗</view>
</view>
<view class="flex-1 text-center">
<view class="text-gradient">2</view>
<view class="text-gradient">{{ item.yanglao }}</view>
<view class="text-15 text-#333">养老</view>
</view>
</view>
+30 -11
View File
@@ -39,13 +39,18 @@
<view class="flex items-center py-15">
<view class="text-gradient">验证码</view>
<input
v-model="formData.invitecode"
v-model="formData.captcha"
placeholder-class="text-#889BC6"
type="text"
class="text-right flex-1 text-14"
placeholder="请输入验证码"
/>
<image class="w-60 h-24 ml-15 bg-gray-400" mode="aspectFit" />
<image
:src="codeUrl"
class="w-100 h-30 ml-15 bg-gray-400"
mode="widthFix"
@click="refreshCode"
/>
</view>
</view>
<!-- <view class="ml-auto mr-0 w-fit text-gradient text-14 p-15" @click="handleEditPassword">
@@ -76,12 +81,16 @@ const userStore = useUserStore()
const formData = ref({
account: '',
password: '',
captcha: '',
})
const { codeUrl, refreshCode } = useCaptcha()
let redirect = '/'
onLoad((options) => {
redirect = options.redirect ?? '/'
})
onShow(refreshCode)
const handleLogin = async () => {
if (!formData.value.account || !formData.value.password) {
@@ -90,15 +99,25 @@ const handleLogin = async () => {
icon: 'none',
})
}
const {
data: {
userinfo: { token },
},
} = await loginUserAPI(formData.value)
userStore.setToken(token)
uni.reLaunch({
url: redirect,
})
if (!formData.value.captcha) {
return uni.showToast({
title: '请输入验证码',
icon: 'none',
})
}
try {
const {
data: {
userinfo: { token },
},
} = await loginUserAPI(formData.value)
userStore.setToken(token)
uni.reLaunch({
url: redirect,
})
} catch (error) {
refreshCode()
}
}
const handleRegister = () => {
+4 -4
View File
@@ -28,7 +28,7 @@
<view class="grid grid-cols-2 gap-10 px-15 mt-15">
<view class="px-15 py-10 rounded-10 bg-#FFFFFF33">
<view class="flex text-white text-12">我的余额</view>
<view class="text-20 text-gradient font-bold">2361</view>
<view class="text-20 text-gradient font-bold">{{ userStore.userInfo.money }}</view>
<view
class="btn-gradient w-fit rounded-full text-center text-12 text-white py-2 px-15 mt-8"
@click="handleWithdrawal"
@@ -38,7 +38,7 @@
</view>
<view class="px-15 py-10 rounded-10 bg-#FFFFFF33">
<view class="flex text-white text-12">养老金余额</view>
<view class="text-20 text-gradient font-bold">2361</view>
<view class="text-20 text-gradient font-bold">{{ userStore.userInfo.moneyold }}</view>
<view
class="btn-gradient w-fit rounded-full text-center text-12 text-white py-2 px-15 mt-8"
@click="handleConvert(0)"
@@ -48,11 +48,11 @@
</view>
<view class="px-15 py-10 rounded-10 bg-#FFFFFF33">
<view class="flex text-white text-12">救济金余额</view>
<view class="text-20 text-gradient font-bold">2361</view>
<view class="text-20 text-gradient font-bold">{{ userStore.userInfo.moneyjiu }}</view>
</view>
<view class="px-15 py-10 rounded-10 bg-#FFFFFF33">
<view class="flex text-white text-12">团队佣金</view>
<view class="text-20 text-gradient font-bold">2361</view>
<view class="text-20 text-gradient font-bold">{{ userStore.userInfo.moneyyong }}</view>
<view
class="btn-gradient w-fit rounded-full text-center text-12 text-white py-2 px-15 mt-8"
@click="handleConvert(1)"
+16 -19
View File
@@ -22,8 +22,8 @@ const form = ref({
password: '',
retpassword: '',
invitecode: '',
tpassword: '',
rettpassword: '',
// tpassword: '',
// rettpassword: '',
})
let redirect = '/'
@@ -54,27 +54,14 @@ const handleRegister = mergeStep(async () => {
})
return
}
if (!form.value.tpassword) {
if (!form.value.invitecode) {
uni.showToast({
title: '请输入支付密码',
title: '请输入邀请码',
icon: 'none',
})
return
}
if (form.value.tpassword !== form.value.rettpassword) {
uni.showToast({
title: '两次输入的支付密码不一致',
icon: 'none',
})
return
}
// if (!form.value.invitecode) {
// uni.showToast({
// title: '请输入邀请码',
// icon: 'none',
// })
// return
// }
const {
data: {
userinfo: { token },
@@ -121,6 +108,16 @@ onLoad(async (options) => {
/>
</view>
<view class="flex items-center py-15">
<view class="text-gradient">确认登录密码</view>
<input
v-model="form.retpassword"
placeholder-class="text-#889BC6"
type="password"
class="text-right flex-1 text-14"
placeholder="请再次输入登录密码"
/>
</view>
<!-- <view class="flex items-center py-15">
<view class="text-gradient">验证码</view>
<input
v-model="form.invitecode"
@@ -130,7 +127,7 @@ onLoad(async (options) => {
placeholder="请输入验证码"
/>
<image class="w-60 h-24 ml-15 bg-gray-400" mode="aspectFit" />
</view>
</view> -->
<view class="flex items-center py-15">
<view class="text-gradient">邀请码</view>
<input