feat: 接口对接完成
This commit is contained in:
+49
-13
@@ -20,11 +20,11 @@
|
||||
<image class="w-30 h-30" src="@/static/images/home/nav-1.png" mode="aspectFill" />
|
||||
<text class="mt-8 text-14 text-#333">简介</text>
|
||||
</view>
|
||||
<view class="flex-1 flex flex-col items-center" @click="handleInvite">
|
||||
<!-- <view class="flex-1 flex flex-col items-center" @click="handleInvite">
|
||||
<image class="w-30 h-30" src="@/static/images/home/nav-2.png" mode="aspectFill" />
|
||||
<text class="mt-8 text-14 text-#333">抽奖转盘</text>
|
||||
</view>
|
||||
<view class="flex-1 flex flex-col items-center" @click="handleInvite">
|
||||
</view> -->
|
||||
<view class="flex-1 flex flex-col items-center" @click="handleReward">
|
||||
<image class="w-30 h-30" src="@/static/images/home/nav-2.png" mode="aspectFill" />
|
||||
<text class="mt-8 text-14 text-#333">奖励制度</text>
|
||||
</view>
|
||||
@@ -34,22 +34,29 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex bg-white py-8 px-15 rounded-10 m-15">
|
||||
<view class="flex bg-white py-8 px-15 rounded-10 m-15 items-center">
|
||||
<view class="text-14 text-#333">系统公告</view>
|
||||
<view class="text-12 ml-15 text-#999">每邀请人可以获得20股马尔代夫股权</view>
|
||||
<view class="flex-1">
|
||||
<wd-notice-bar
|
||||
color="#999999"
|
||||
background-color="transparent"
|
||||
:text="announcementList.map((item) => item.name)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bg-white py-15 px-15 rounded-10 m-15">
|
||||
<view class="text-14 text-#333">热点新闻</view>
|
||||
<view class="flex mt-15" v-for="item in 10" :key="item">
|
||||
<image
|
||||
class="w-85 h-85 rounded-10"
|
||||
src="@/static/images/home/news-2.png"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view
|
||||
class="flex mt-15"
|
||||
v-for="item in newsList"
|
||||
:key="item.id"
|
||||
@click="handleNewsDetail(item.id)"
|
||||
>
|
||||
<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>#人海战术#签约!中央广播电视总台与农业农村部达成战略合作</view>
|
||||
<view class="text-12 text-#999">证券时报网</view>
|
||||
<view text-14>{{ item.name }}</view>
|
||||
<view class="text-12 text-#999">{{ item.source }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -58,17 +65,34 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import { getIntroductionAPI } from '@/service'
|
||||
import { showModal } from '@/utils'
|
||||
|
||||
defineOptions({
|
||||
name: 'Home',
|
||||
})
|
||||
|
||||
const { list: newsList } = useListPageRequest((params) =>
|
||||
getIntroductionAPI({ type: 1, ...params }),
|
||||
)
|
||||
|
||||
// 系统公告
|
||||
const { list: announcementList } = useListPageRequest((params) =>
|
||||
getIntroductionAPI({ type: 2, ...params }),
|
||||
)
|
||||
|
||||
const handleIntroduction = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages-sub/introduction/index',
|
||||
})
|
||||
}
|
||||
|
||||
const handleNewsDetail = (id: number) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages-sub/news-detail/index?id=${id}`,
|
||||
})
|
||||
}
|
||||
|
||||
const handleInvite = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/invite/index',
|
||||
@@ -80,6 +104,18 @@ const handleOfficialCommunity = () => {
|
||||
url: '/pages-sub/official-community/index',
|
||||
})
|
||||
}
|
||||
|
||||
const handleReward = () => {
|
||||
showModal(
|
||||
`1.注册立即送5000股马尔代夫股权;\n
|
||||
2.每股马尔代夫股权价值500元;\n
|
||||
3.每邀请一人可以获得20股马尔代夫股权`,
|
||||
{
|
||||
title: '奖励制度',
|
||||
confirmText: '我知道了',
|
||||
},
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
+27
-12
@@ -16,23 +16,25 @@
|
||||
</NavBar>
|
||||
<view class="flex mt-30 flex-col mx-15 rounded-10 px-40 py-32 main-content">
|
||||
<view class="text-14 text-#6784C7">我的投资金</view>
|
||||
<view class="text-35 leading-35 mt-10 text-#BE7143 font-bold">1000000</view>
|
||||
<view class="text-35 leading-35 mt-10 text-#BE7143 font-bold">
|
||||
{{ userStore.userInfo?.money }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-100">
|
||||
<view
|
||||
v-for="item in 10"
|
||||
:key="item"
|
||||
v-for="item in investmentList"
|
||||
:key="item.id"
|
||||
class="invest-item relative flex flex-col items-center pt-15"
|
||||
>
|
||||
<view class="text-15 text-#3F88F6">5G通讯</view>
|
||||
<view class="text-15 text-#3F88F6">{{ item.name }}</view>
|
||||
<view class="flex w-full mt-15">
|
||||
<view class="flex-1 text-center">
|
||||
<view class="text-22 text-#333 font-bold">1000.00</view>
|
||||
<view class="text-22 text-#333 font-bold">{{ item.money }}</view>
|
||||
<view class="text-12 mt-4 text-blue-red">投资金额</view>
|
||||
</view>
|
||||
<view class="flex-1 text-center">
|
||||
<view class="text-22 text-#FF3B30 font-bold">1000.00</view>
|
||||
<view class="text-22 text-#FF3B30 font-bold">{{ item.dividend }}</view>
|
||||
<view class="text-12 mt-4 text-blue-red">每日分红</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -58,6 +60,9 @@ import NavBar from '@/components/NavBar.vue'
|
||||
import AlipayIcon from '@/static/images/invest/alipay-icon.png'
|
||||
import WechatIcon from '@/static/images/invest/wechat-icon.png'
|
||||
import UnionpayIcon from '@/static/images/invest/unionpay-icon.png'
|
||||
import { getInvestmentListAPI, submitInvestAPI } from '@/service'
|
||||
import { useUserStore } from '@/store'
|
||||
import { mergeStep, showModal } from '@/utils'
|
||||
|
||||
defineOptions({
|
||||
name: 'Home',
|
||||
@@ -78,6 +83,10 @@ const panels = ref([
|
||||
},
|
||||
])
|
||||
|
||||
const { list: investmentList } = useListPageRequest(getInvestmentListAPI)
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const onGoInvestDetail = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages-sub/invest-detail/index',
|
||||
@@ -89,12 +98,18 @@ const onSelectPayType = ({ item, index }: any) => {
|
||||
alert(item.title)
|
||||
}
|
||||
|
||||
const onInvest = (item: any) => {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages-sub/invest-immediately/index',
|
||||
// })
|
||||
showPayType.value = true
|
||||
}
|
||||
const onInvest = mergeStep(async (item: any) => {
|
||||
await showModal('确认投资?')
|
||||
await submitInvestAPI({
|
||||
investid: item.id,
|
||||
type: 3,
|
||||
})
|
||||
await userStore.loadUserInfo()
|
||||
uni.showToast({
|
||||
title: '投资成功',
|
||||
icon: 'none',
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -11,15 +11,18 @@
|
||||
<script setup lang="ts">
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import VueQrcode from '@chenfengyuan/vue-qrcode'
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
const qrcodeValue = '/pages/register/index?invite=888888'
|
||||
const userStore = useUserStore()
|
||||
|
||||
const qrcodeValue =
|
||||
location.origin + '/#/pages/register/index?invite=' + userStore.userInfo?.invitecode
|
||||
|
||||
const onCopy = (code: string) => {
|
||||
uni.setClipboardData({
|
||||
data: code,
|
||||
})
|
||||
}
|
||||
|
||||
const onLottery = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages-sub/lottery/index',
|
||||
@@ -32,9 +35,9 @@ const onLottery = () => {
|
||||
<NavBar />
|
||||
<view class="flex justify-center mt-80">
|
||||
<view class="text-white btn-gradient rounded-full px-30 py-10 text-14">邀请好友</view>
|
||||
<view class="ml-15 bg-white rounded-full px-30 py-10 text-14" @click="onLottery">
|
||||
<!-- <view class="ml-15 bg-white rounded-full px-30 py-10 text-14" @click="onLottery">
|
||||
<text class="text-gradient">幸运大转盘</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="flex flex-col items-center mt-180">
|
||||
<view
|
||||
@@ -42,7 +45,7 @@ const onLottery = () => {
|
||||
>
|
||||
<view>
|
||||
邀请码
|
||||
<text class="font-bold">9999999</text>
|
||||
<text class="font-bold">{{ userStore.userInfo?.invitecode }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="btn-gradient text-white rounded-full px-15 py-4 text-12 ml-10"
|
||||
|
||||
+15
-11
@@ -19,7 +19,7 @@
|
||||
<image class="w-24 h-24" src="@/static/images/login/phone.png" mode="aspectFit" />
|
||||
<input
|
||||
type="text"
|
||||
v-model="formData.member_username"
|
||||
v-model="formData.account"
|
||||
placeholder-class="text-#889BC6"
|
||||
class="text-right flex-1 text-14"
|
||||
placeholder="请输入用户名"
|
||||
@@ -29,16 +29,16 @@
|
||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||
<input
|
||||
placeholder-class="text-#889BC6"
|
||||
type="text"
|
||||
v-model="formData.member_password"
|
||||
type="password"
|
||||
v-model="formData.password"
|
||||
class="text-right flex-1 text-14"
|
||||
placeholder="请输入登录密码"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ml-auto mr-0 w-fit text-gradient text-14 p-15" @click="handleEditPassword">
|
||||
<!-- <view class="ml-auto mr-0 w-fit text-gradient text-14 p-15" @click="handleEditPassword">
|
||||
忘记密码
|
||||
</view>
|
||||
</view> -->
|
||||
<view
|
||||
class="mt-30 text-center py-12 rounded-full mx-15 text-15 text-white btn-gradient"
|
||||
@click="handleLogin"
|
||||
@@ -57,12 +57,13 @@
|
||||
<script lang="ts" setup>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import { isLogged } from '@/interceptors/route'
|
||||
import { loginUserAPI } from '@/service'
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const formData = ref({
|
||||
member_username: '',
|
||||
member_password: '',
|
||||
account: '',
|
||||
password: '',
|
||||
})
|
||||
|
||||
let redirect = '/'
|
||||
@@ -71,15 +72,18 @@ onLoad((options) => {
|
||||
})
|
||||
|
||||
const handleLogin = async () => {
|
||||
if (!formData.value.member_username || !formData.value.member_password) {
|
||||
if (!formData.value.account || !formData.value.password) {
|
||||
return uni.showToast({
|
||||
title: '请输入用户名和密码',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
userStore.setUserInfo({
|
||||
token: '123456',
|
||||
})
|
||||
const {
|
||||
data: {
|
||||
userinfo: { token },
|
||||
},
|
||||
} = await loginUserAPI(formData.value)
|
||||
userStore.setToken(token)
|
||||
uni.reLaunch({
|
||||
url: redirect,
|
||||
})
|
||||
|
||||
+18
-11
@@ -11,18 +11,24 @@
|
||||
<view class="my-page">
|
||||
<NavBar />
|
||||
<view class="flex flex-col items-center justify-center mt-30">
|
||||
<Avatar class="w-80 h-80 mx-auto" />
|
||||
<view class="text-16 mt-10">默认用户</view>
|
||||
<view class="text-12 mt-8">账号:199****654</view>
|
||||
<Avatar class="w-80 h-80 mx-auto" :src="getImageUrl(userStore.userInfo.avatar)" />
|
||||
<view class="text-16 mt-10">{{ userStore.userInfo.nickname }}</view>
|
||||
<view class="text-12 mt-8">账号:{{ userStore.userInfo.username }}</view>
|
||||
</view>
|
||||
<view class="flex justify-center text-center mt-15 items-center">
|
||||
<view>
|
||||
<view class="text-30 font-bold">1002</view>
|
||||
<view class="flex justify-center text-center mt-15 items-center px-30">
|
||||
<view class="flex-1">
|
||||
<view class="text-30 font-bold">{{ Number(userStore.userInfo.money) }}</view>
|
||||
<view class="text-14 mt-10 text-#3B81F3">我的余额</view>
|
||||
</view>
|
||||
<image class="w-100 h-100" src="@/static/images/my/translate.png" mode="aspectFit" />
|
||||
<view>
|
||||
<view class="text-30 font-bold">1231</view>
|
||||
<view class="w-50 h-50 relative">
|
||||
<image
|
||||
class="w-100 h-100 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
||||
src="@/static/images/my/translate.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<view class="text-30 font-bold">{{ Number(userStore.userInfo.score) }}</view>
|
||||
<view class="text-14 mt-10 text-#3B81F3">我的股数</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -97,11 +103,12 @@ import Avatar from '@/components/Avatar.vue'
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import { loginRoute } from '@/interceptors/route'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { getImageUrl } from '@/utils'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const handleLogout = () => {
|
||||
userStore.clearUserInfo()
|
||||
userStore.logout()
|
||||
uni.reLaunch({
|
||||
url: loginRoute,
|
||||
})
|
||||
@@ -143,7 +150,7 @@ const handleBankCard = () => {
|
||||
}
|
||||
|
||||
const handleInvite = () => {
|
||||
uni.navigateTo({
|
||||
uni.switchTab({
|
||||
url: '/pages/invite/index',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<route lang="json5">
|
||||
<route lang="json5" type="page">
|
||||
{
|
||||
style: {
|
||||
navigationBarTitleText: '注册',
|
||||
@@ -7,6 +7,94 @@
|
||||
notNeedLogin: false,
|
||||
}
|
||||
</route>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import { isLogged } from '@/interceptors/route'
|
||||
import { registerUserAPI } from '@/service'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { mergeStep } from '@/utils'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const form = ref({
|
||||
username: '',
|
||||
// member_nickname: '',
|
||||
password: '',
|
||||
retpassword: '',
|
||||
invitecode: '',
|
||||
tpassword: '',
|
||||
rettpassword: '',
|
||||
})
|
||||
|
||||
let redirect = '/'
|
||||
onLoad((options) => {
|
||||
redirect = options.redirect ?? '/'
|
||||
form.value.invitecode = options.invitecode ?? ''
|
||||
})
|
||||
|
||||
const handleRegister = mergeStep(async () => {
|
||||
if (!form.value.username) {
|
||||
uni.showToast({
|
||||
title: '请输入用户名',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!form.value.password) {
|
||||
uni.showToast({
|
||||
title: '请输入登录密码',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (form.value.password !== form.value.retpassword) {
|
||||
uni.showToast({
|
||||
title: '两次输入的密码不一致',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!form.value.tpassword) {
|
||||
uni.showToast({
|
||||
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 },
|
||||
},
|
||||
} = await registerUserAPI(form.value)
|
||||
userStore.setToken(token)
|
||||
uni.reLaunch({
|
||||
url: redirect,
|
||||
})
|
||||
})
|
||||
onLoad(async (options) => {
|
||||
if (isLogged()) {
|
||||
uni.reLaunch({
|
||||
url: redirect,
|
||||
})
|
||||
}
|
||||
form.value.invitecode = options.invite ?? ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="login-container relative">
|
||||
<NavBar />
|
||||
@@ -15,30 +103,17 @@
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/phone.png" mode="aspectFit" />
|
||||
<input
|
||||
v-model="form.username"
|
||||
type="text"
|
||||
placeholder-class="text-#889BC6"
|
||||
class="text-right flex-1 text-14"
|
||||
placeholder="请输入用户名"
|
||||
/>
|
||||
</view>
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/message.png" mode="aspectFit" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder-class="text-#889BC6"
|
||||
class="text-right flex-1 text-14"
|
||||
placeholder="请输入短信验证码"
|
||||
/>
|
||||
<view
|
||||
class="py-6 rounded-full ml-15 px-15 text-12 text-white btn-gradient text-14 text-#889BC6"
|
||||
@click="handleGetCode"
|
||||
>
|
||||
获取验证码
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||
<input
|
||||
v-model="form.password"
|
||||
placeholder-class="text-#889BC6"
|
||||
type="password"
|
||||
class="text-right flex-1 text-14"
|
||||
@@ -48,6 +123,7 @@
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||
<input
|
||||
v-model="form.retpassword"
|
||||
placeholder-class="text-#889BC6"
|
||||
type="password"
|
||||
class="text-right flex-1 text-14"
|
||||
@@ -57,6 +133,7 @@
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||
<input
|
||||
v-model="form.tpassword"
|
||||
placeholder-class="text-#889BC6"
|
||||
type="password"
|
||||
class="text-right flex-1 text-14"
|
||||
@@ -66,6 +143,7 @@
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||
<input
|
||||
v-model="form.rettpassword"
|
||||
placeholder-class="text-#889BC6"
|
||||
type="password"
|
||||
class="text-right flex-1 text-14"
|
||||
@@ -75,8 +153,9 @@
|
||||
<view class="flex items-center py-15">
|
||||
<image class="w-24 h-24" src="@/static/images/login/invite.png" mode="aspectFit" />
|
||||
<input
|
||||
v-model="form.invitecode"
|
||||
placeholder-class="text-#889BC6"
|
||||
type="password"
|
||||
type="text"
|
||||
class="text-right flex-1 text-14"
|
||||
placeholder="请输入邀请码"
|
||||
/>
|
||||
@@ -92,35 +171,6 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import { isLogged } from '@/interceptors/route'
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
let redirect = '/'
|
||||
onLoad((options) => {
|
||||
redirect = options.redirect ?? '/'
|
||||
})
|
||||
|
||||
const handleRegister = () => {
|
||||
userStore.setUserInfo({
|
||||
token: '123456',
|
||||
})
|
||||
uni.reLaunch({
|
||||
url: redirect,
|
||||
})
|
||||
}
|
||||
onLoad(() => {
|
||||
if (isLogged()) {
|
||||
uni.reLaunch({
|
||||
url: redirect,
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.login-container {
|
||||
box-sizing: border-box;
|
||||
|
||||
Reference in New Issue
Block a user