Files
JiaZhiQianYan/pages/mine/investPreference/investPreference.vue
2025-06-30 19:02:44 +08:00

239 lines
5.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<navBar leftText="信息完善"></navBar>
<image class="topBg absolute" src="/static/image/mine/myTopBg.png" mode="widthFix"></image>
<view class="avatarC fixed" :style="'top:'+avatarTop+'px;'">
<image class="avatar" src="" mode="aspectFill"></image>
<image class="icon absolute" src="/static/icon/mine/basicInfo/edit.png" mode="widthFix"></image>
</view>
<view class="preferenceC fixed" :style="'top:'+contentTop+'px;'">
<view class="title">投资偏好设置</view>
<view class="section first">投资偏好</view>
<view class="list flexWrap">
<view :class="'item '+(selectInvestIndex==index?'select':'')" v-for="(item,index) in investPreferenceList" :key="index" @click="clickInvestItem(index)">
{{item}}
</view>
</view>
<view class="section">炒股年限</view>
<view class="list flexWrap">
<view :class="'item '+(selectYearIndex==index?'select':'')" v-for="(item,index) in stockYearList" :key="index" @click="clickYearItem(index)">
{{item}}
</view>
</view>
<view class="section">风险偏好</view>
<view class="list flexWrap">
<view :class="'item '+(selectRiskIndex==index?'select':'')" v-for="(item,index) in riskPreferenceList" :key="index" @click="clickRiskItem(index)">
{{item}}
</view>
</view>
<view class="section">投资规模</view>
<view class="list flexWrap">
<view :class="'item '+(selectScaleIndex==index?'select':'')" v-for="(item,index) in investmentScaleList" :key="index" @click="clickScaleItem(index)">
{{item}}
</view>
</view>
<view class="section">偏好市场可多选</view>
<view class="list flexWrap">
<view :class="'item '+(item.select?'select':'')" v-for="(item,index) in preferredMarketList" :key="index" @click="clickMarketItem(index)">
{{item.title}}
</view>
</view>
</view>
<view class="bottomC fixed flex">
<view class="pre btn">上一步</view>
<view class="finish btn flex1">完成</view>
</view>
</view>
</template>
<script>
import { inject } from 'vue';
export default {
data() {
return {
avatarTop:'',
contentTop:'',
investPreferenceList:['长期投资','中短期投资','风险控制型'],
selectInvestIndex:-1,
stockYearList:['新手入门','1年以内','1-3年','3-5年','5-10年','10年以上'],
selectYearIndex:-1,
riskPreferenceList:['保守型','稳健型','保守型'],
selectRiskIndex:-1,
investmentScaleList:['50万以下','50-100万','100万以上'],
selectScaleIndex:-1,
preferredMarketList:[{title:'A股'},{title:'港股'},{title:'美股'},{title:'期货'},{title:'虚拟货币'},{title:'新兴市场'}]
}
},
onLoad() {
this.avatarTop = inject('navHeight') + 60/750*inject('windowWidth')
this.contentTop = this.avatarTop + 75/750*inject('windowWidth')
},
methods: {
/**
* 点击选择投资偏好
* @param {Object} index
*/
clickInvestItem(index)
{
if(this.selectInvestIndex!=index)
{
this.selectInvestIndex = index
}
},
/**
* 点击选择风险偏好
* @param {Object} index
*/
clickYearItem(index)
{
if(this.selectYearIndex!=index)
{
this.selectYearIndex = index
}
},
/**
* 点击选择风险偏好
* @param {Object} index
*/
clickRiskItem(index)
{
if(this.selectRiskIndex!=index)
{
this.selectRiskIndex = index
}
},
/**
* 点击选择投资规模
* @param {Object} index
*/
clickScaleItem(index)
{
if(this.selectScaleIndex!=index)
{
this.selectScaleIndex = index
}
},
/**
* 点击选择市场偏好
* @param {Object} index
*/
clickMarketItem(index)
{
this.preferredMarketList[index].select = !this.preferredMarketList[index].select;
}
}
}
</script>
<style lang="less">
.topBg
{
top: 0;
left: 0;
width: 100%;
height: auto;
}
.avatarC
{
left: 0;
margin-left:calc((100% - 150rpx)/2);
width: 150rpx;
.avatar
{
background-color: red;
width: 100%;
height: 150rpx;
border-radius: 50%;
border: solid 2rpx white;
}
.icon
{
right: 20rpx;
bottom: 0;
width: 40rpx;
height: auto;
}
z-index: 10;
}
.preferenceC
{
background-color: white;
left: 0;
right: 0;
bottom: calc(73rpx + 17rpx + 80rpx);
border-radius: 20rpx 20rpx 0 0;
overflow-y: scroll;
.title
{
margin: 150rpx 0 0 60rpx;
font-size: 36rpx;
font-weight: bold;
}
.section
{
margin: 10rpx 60rpx 0;
line-height: 66rpx;
font-size: 26rpx;
font-weight: bold;
}
.section.first
{
margin-top: 20rpx;
}
.list
{
padding: 0 60rpx;
.item
{
background-color: #FBFBFD;
margin: 0 14rpx 12rpx 0;
width: calc((100% - 28rpx)/3);
line-height: 76rpx;
border: solid 2rpx #EFEFF2;
border-radius: 10rpx;
font-size: 24rpx;
font-weight: 500;
color: #555;
text-align: center;
}
.item.select
{
background-color: #FFE9D9;
border: solid 2rpx #F97316;
}
.item:nth-child(3n)
{
margin-right: 0;
}
}
}
.bottomC
{
left: 0;
right: 0;
bottom: 73rpx;
margin: 0 25rpx;
.btn
{
line-height: 80rpx;
border-radius: 20rpx;
font-size: 26rpx;
text-align: center;
}
.pre
{
background-color: #FFE9D9;
width: 226rpx;
color: #F97316;
}
.finish
{
background-color: #F97316;
margin-left: 20rpx;
color: white;
}
}
</style>