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
+2 -1
View File
@@ -97,6 +97,7 @@
"useId": true,
"useModel": true,
"useTemplateRef": true,
"useListPageRequest": true
"useListPageRequest": true,
"useCaptcha": true
}
}
Vendored
+2 -2
View File
@@ -7,8 +7,8 @@ VITE_WX_APPID = 'wxa2abb91f64032a2b'
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE=/
VITE_SERVER_BASEURL = 'https://mapi.foxmail555.cc'
VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload'
VITE_SERVER_BASEURL = 'https://sapi.foxmail555.cc'
VITE_UPLOAD_BASEURL = 'https://sapi.foxmail555.cc/api/common/upload'
# h5是否需要配置代理
VITE_APP_PROXY=false
+11
View File
@@ -0,0 +1,11 @@
export const useCaptcha = () => {
const codeUrl = ref('')
const refreshCode = () => {
const baseUrl = import.meta.env.VITE_SERVER_BASEURL
codeUrl.value = baseUrl + '/captcha.html?t=' + Date.now()
}
onMounted(() => {
refreshCode()
})
return { codeUrl, refreshCode }
}
+3
View File
@@ -52,6 +52,9 @@ function useListPageRequest(
})
console.log(data)
data.forEach((item: any) => {
if (String(item.createtime).length < 11) {
item.createtime = item.createtime * 1000
}
item.createtime = formatTime(item.createtime)
item.image = getImageUrl(item.image)
})
+6 -1
View File
@@ -56,7 +56,12 @@ function uploadFile<T>({ tempFilePath, formData, data, error, loading }) {
name: 'file',
formData,
success: (uploadFileRes) => {
data.value = uploadFileRes.data as T
try {
data.value = JSON.parse(uploadFileRes.data).data.fullurl as T
} catch (e) {
console.log(e)
data.value = uploadFileRes.data as T
}
},
fail: (err) => {
console.error('uni.uploadFile err->', err)
+3 -2
View File
@@ -6,7 +6,7 @@
}
</route>
<template>
<view class="hot-news-page p-15">
<view class="hot-news-page min-h-screen p-15">
<view class="bg-#fff rounded-10 px-15 py-15" v-if="newsList.length > 0">
<view
class="flex mb-15"
@@ -17,7 +17,7 @@
<image class="w-85 h-85 rounded-10" :src="item.image" mode="aspectFill" />
<view class="ml-15 flex-1 flex flex-col justify-between">
<view text-14>{{ item.name }}</view>
<view class="text-12 text-#999">{{ item.source }}</view>
<view class="text-12 text-#999">{{ formatTime(item.createtime) }}</view>
</view>
</view>
</view>
@@ -27,6 +27,7 @@
<script setup lang="ts">
import { getIntroductionAPI } from '@/service'
import { formatTime } from '@/utils'
const { list: newsList } = useListPageRequest((params) =>
getIntroductionAPI({ type: 1, ...params }),
+1 -1
View File
@@ -27,6 +27,6 @@ onLoad(async (options) => {
</view>
</view>
<image class="w-full mt-15" mode="widthFix" :src="getImageUrl(newsDetail.image)" />
<view class="text-14 text-gray-600 mt-15">{{ newsDetail.content }}</view>
<view class="text-14 text-gray-600 mt-15" v-html="newsDetail.content" />
</view>
</template>
+42 -1
View File
@@ -38,6 +38,36 @@
v-model="form.cardnum"
/>
</view>
<view class="py-15 text-14">
<view class="flex items-center">
<image src="@/static/images/page-sub/realname/realname-card.png" class="w-20 h-20" />
<view class="ml-8">证件照片</view>
</view>
<view
class="flex items-center justify-center mt-15 rounded-10 bg-#F1F9FC h-168 w-full"
@click="onUploadZCardImage"
>
<view v-if="!zcardimage" class="text-center">
<image src="@/static/images/page-sub/realname/upload-icon.png" class="w-40 h-40" />
<view class="text-14 text-#999 mt-10">点击上传身份证正面</view>
</view>
<view v-else class="flex items-center">
<image :src="zcardimage" class="w-315 h-168" mode="aspectFit" />
</view>
</view>
<view
class="flex items-center justify-center mt-15 rounded-10 bg-#F1F9FC h-168 w-full"
@click="onUploadFCardImage"
>
<view v-if="!fcardimage" class="text-center">
<image src="@/static/images/page-sub/realname/upload-icon.png" class="w-40 h-40" />
<view class="text-14 text-#999 mt-10">点击上传身份证反面</view>
</view>
<view v-else class="flex items-center">
<image :src="fcardimage" class="w-315 h-168" mode="aspectFit" />
</view>
</view>
</view>
</view>
<view class="fixed bottom-0 left-0 right-0 pb-safe">
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onSubmit">
@@ -112,7 +142,15 @@ const onSubmit = async () => {
await showModal('请填写完整信息')
return
}
await realNameAuthAPI(form.value)
if (!zcardimage.value || !fcardimage.value) {
await showModal('请上传身份证照片')
return
}
await realNameAuthAPI({
...form.value,
zcardimage: zcardimage.value,
fcardimage: fcardimage.value,
})
await showModal('提交成功,请耐心等待审核!')
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
return res.data
@@ -125,6 +163,9 @@ const onGoHome = () => {
})
}
const { data: zcardimage, run: onUploadZCardImage } = useUpload()
const { data: fcardimage, run: onUploadFCardImage } = useUpload()
const realnameInfo = ref(null)
onLoad(async () => {
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
+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
+16
View File
@@ -153,3 +153,19 @@ export const getWithdrawalRecordAPI = (data) =>
export const downloadAppAPI = () => {
location.href = 'https://tiktok-test.gbnorg.com/7885922.apk'
}
// 社区我的邀请
export const getCommunityMyInviteAPI = (data) =>
http({
url: '/api/user/inviteelist',
method: 'POST',
data,
})
// 领取奖励第一步
export const getCommunityInviteFirstAPI = (data) =>
http({
url: '/api/user/rewardone',
method: 'POST',
data,
})
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

+2
View File
@@ -75,6 +75,7 @@ declare global {
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCaptcha: typeof import('../hooks/useCaptcha')['useCaptcha']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useId: typeof import('vue')['useId']
@@ -172,6 +173,7 @@ declare module 'vue' {
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
readonly unref: UnwrapRef<typeof import('vue')['unref']>
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
readonly useCaptcha: UnwrapRef<typeof import('../hooks/useCaptcha')['useCaptcha']>
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
readonly useId: UnwrapRef<typeof import('vue')['useId']>