7.10 增加登录页面,事件详情接口对接,我的点赞,关注收藏页面搭建,接口对接
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
<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="avatar" :src="avatar?avatar:avatarUrl" mode="aspectFill"></image>
|
||||
<image class="icon absolute" src="/static/icon/mine/basicInfo/edit.png" mode="widthFix"></image>
|
||||
<button class="absolute" open-type="chooseAvatar" @chooseavatar="chooseAvatar"></button>
|
||||
</view>
|
||||
<view class="preferenceC fixed" :style="'top:'+contentTop+'px;'">
|
||||
<view class="title">投资偏好设置</view>
|
||||
@@ -40,20 +41,23 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottomC fixed flex">
|
||||
<view class="pre btn">上一步</view>
|
||||
<view class="finish btn flex1">完成</view>
|
||||
<view class="pre btn" @click="clickPre()">上一步</view>
|
||||
<view class="finish btn flex1" @click="clickFinish()">完成</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { inject } from 'vue';
|
||||
import { userInfo, updateInvestPreference } from '@/request/api';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
avatarTop:'',
|
||||
contentTop:'',
|
||||
avatar:'', //选择头像临时地址
|
||||
avatarUrl:'', //已上传的链接
|
||||
investPreferenceList:['长期投资','中短期投资','风险控制型'],
|
||||
selectInvestIndex:-1,
|
||||
stockYearList:['新手入门','1年以内','1-3年','3-5年','5-10年','10年以上'],
|
||||
@@ -68,8 +72,17 @@
|
||||
onLoad() {
|
||||
this.avatarTop = inject('navHeight') + 60/750*inject('windowWidth')
|
||||
this.contentTop = this.avatarTop + 75/750*inject('windowWidth')
|
||||
this.getUserInfoData()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击选择头像
|
||||
* @param {Object} e
|
||||
*/
|
||||
chooseAvatar(e)
|
||||
{
|
||||
this.avatar = e.detail.avatarUrl
|
||||
},
|
||||
/**
|
||||
* 点击选择投资偏好
|
||||
* @param {Object} index
|
||||
@@ -121,6 +134,160 @@
|
||||
clickMarketItem(index)
|
||||
{
|
||||
this.preferredMarketList[index].select = !this.preferredMarketList[index].select;
|
||||
},
|
||||
/**
|
||||
* 点击上一步
|
||||
*/
|
||||
clickPre()
|
||||
{
|
||||
uni.navigateBack()
|
||||
},
|
||||
/**
|
||||
* 点击完成
|
||||
*/
|
||||
clickFinish()
|
||||
{
|
||||
if(this.selectInvestIndex<0)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择投资偏好',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(this.selectYearIndex<0)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择炒股年限',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(this.selectRiskIndex<0)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择风险偏好',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(this.selectScaleIndex<0)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择投资规模',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
let arr = []
|
||||
for (let item of this.preferredMarketList) {
|
||||
if(item.select)
|
||||
{
|
||||
arr.push(item.title)
|
||||
}
|
||||
}
|
||||
if(arr.length==0)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择偏好市场',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(this.avatar)
|
||||
{
|
||||
//如果选择了新头像
|
||||
let param = {avatar:this.avatar,isFile:1}
|
||||
updateBasicInfo(param).then(res=>{
|
||||
this.uploadInvestPreferenceData()
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
}else
|
||||
this.uploadInvestPreferenceData()
|
||||
},
|
||||
/**
|
||||
* 更新投资偏好设置
|
||||
*/
|
||||
uploadInvestPreferenceData()
|
||||
{
|
||||
let param = {trading_experience: this.selectYearIndex,investment_style: this.investPreferenceList[this.selectInvestIndex],
|
||||
risk_preference: this.riskPreferenceList[this.selectRiskIndex],
|
||||
investment_amount: this.investmentScaleList[this.selectScaleIndex],
|
||||
preferred_markets: arr}
|
||||
updateInvestPreference(param).then(res=>{
|
||||
uni.navigateBack({
|
||||
delta:2
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取用户偏好设置数据
|
||||
*/
|
||||
getUserInfoData()
|
||||
{
|
||||
userInfo().then(res=>{
|
||||
if(res.code==200)
|
||||
{
|
||||
let data = res.data.investment_preferences
|
||||
//投资偏好
|
||||
for (var i = 0; i < this.investPreferenceList.length; i++) {
|
||||
let item = this.investPreferenceList[i]
|
||||
if(item==data.investment_style)
|
||||
{
|
||||
this.selectInvestIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
//炒股年限
|
||||
this.selectYearIndex = data.trading_experience
|
||||
// for (var i = 0; i < this.stockYearList.length; i++) {
|
||||
// let item = this.stockYearList[i]
|
||||
// if(item==data.investment_style)
|
||||
// {
|
||||
// this.selectYearIndex = i
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
//风险偏好
|
||||
for (var i = 0; i < this.riskPreferenceList.length; i++) {
|
||||
let item = this.riskPreferenceList[i]
|
||||
if(item==data.risk_preference)
|
||||
{
|
||||
this.selectRiskIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
//投资规模
|
||||
for (var i = 0; i < this.investmentScaleList.length; i++) {
|
||||
let item = this.investmentScaleList[i]
|
||||
if(item==data.investment_amount)
|
||||
{
|
||||
this.selectScaleIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
//偏好市场
|
||||
for (let item of this.preferredMarketList) {
|
||||
let arr = JSON.parse(data.preferred_markets)
|
||||
let arr1 = arr[0].split(',')
|
||||
if(arr1.indexOf(item.title)>-1)
|
||||
{
|
||||
item.select = true
|
||||
}else
|
||||
{
|
||||
item.select = false
|
||||
}
|
||||
}
|
||||
}else
|
||||
wx.showToast({
|
||||
title:res.message,
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +308,6 @@
|
||||
width: 150rpx;
|
||||
.avatar
|
||||
{
|
||||
background-color: red;
|
||||
width: 100%;
|
||||
height: 150rpx;
|
||||
border-radius: 50%;
|
||||
@@ -154,6 +320,13 @@
|
||||
width: 40rpx;
|
||||
height: auto;
|
||||
}
|
||||
button
|
||||
{
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
z-index: 10;
|
||||
}
|
||||
.preferenceC
|
||||
|
||||
Reference in New Issue
Block a user