| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <view class="flex-common-css">
- <Nav title="性别设置" titleColor="#333" bgckgroundBox='#fff'></Nav>
- <scroll-view :scroll-y="true" class="scroll-view-css">
- <view class="content-box">
- <view class="list-box box-border-box mb-80 bgc-f">
- <view class="item-box flex-justify-space" v-for="(item,index) in sexList" :key="index" @click="setSex(item.id)">
- <view class="fs-32 fc-3">
- {{item.name}}
- </view>
- <uni-icons v-show="fromData.sex == item.id" color="#57CAFF" type="checkbox-filled" size="25"></uni-icons>
- </view>
- </view>
- <view class="but-box box-border-box" @click="save()">
- <view class="but fs-32 fc-f fw-600 b-rad-200 bgc-41ABF5 text-align-center" >
- 保存
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import {userInfo,userUpdate} from '@/api/member.js';
- import tools from '@/service/tools';
- export default {
- data() {
- return {
- sexList:[
- {name:'保密',id:0},
- {name:'男',id:1},
- {name:'女',id:2},
- ],
- fromData:{
- nickname:'',
- head_img:'',
- sex:'',
- },
- isAJAX:false,
- };
- },
- onShow() {
- this.getUserInfo();
- },
- methods: {
- getUserInfo(){
- userInfo().then((res)=>{
- if(res.code === 1){
- this.fromData = res.data;
- }
- })
- },
- setSex(id) {
- if(this.fromData.sex != id){
- this.fromData.sex = id
- }
- },
- save(){
- if(this.isAJAX){
- return
- }
- this.isAJAX = true;
- userUpdate(this.fromData).then((res)=>{
- if(res.code === 1){
- this.isAJAX = false;
- tools.success(res.msg)
- }else{
- this.isAJAX = false;
- tools.error(res.msg)
- }
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .content-box{
- padding: 20rpx 0 0 0;
- }
- .list-box{
- padding: 0 32rpx;
- }
- .item-box{
- height: 108rpx;
- line-height: 108rpx;
- border-bottom: 1rpx solid #EEEEEE;
- }
- .item-box:last-child {
- border: none;
- }
- .but-box{
- padding: 0 40rpx;
- }
- .but{
- width: 100%;
- height: 92rpx;
- line-height: 92rpx;
- }
- </style>
|