sex.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="container">
  3. <TopBar></TopBar>
  4. <view class="line-bar flex-between">
  5. <view class="span active"></view>
  6. <view class="span"></view>
  7. <view class="span"></view>
  8. <view class="span"></view>
  9. <view class="span"></view>
  10. </view>
  11. <view class="title font44 fw600">
  12. 请选择性别
  13. </view>
  14. <view class="tip font28 fw400">
  15. 选择好性别,才好遇见你的那个TA
  16. </view>
  17. <view class="img-box" style="margin-top: 104rpx;" @click="sex='Famale'">
  18. <image :src="`${assetsUrl}info-female-${sex==='Famale'?'on':'off'}.png`" mode="aspectFill" class="img"></image>
  19. <view class="img-text font28 fw400" :style="{'color':`${sex==='Famale'?'#ffffff':''}`}">
  20. 我是女生
  21. </view>
  22. </view>
  23. <view class="img-box" style="margin-left: 368rpx;" @click="sex='Male'">
  24. <image :src="`${assetsUrl}info-male-${sex==='Male'?'on':'off'}.png`" mode="aspectFill" class="img"></image>
  25. <view class="img-text font28 fw400" :style="{'color':`${sex==='Male'?'#ffffff':''}`}">
  26. 我是男生
  27. </view>
  28. </view>
  29. <view style="height: 200rpx;"></view>
  30. <cover-view class="btn font32 fw600" @click="sure">
  31. 确认选择
  32. </cover-view>
  33. </view>
  34. </template>
  35. <script>
  36. import TopBar from '@/components/TopBar/TopBar.vue';
  37. export default {
  38. components:{TopBar},
  39. data() {
  40. return {
  41. assetsUrl:this.$util.assetsUrl,
  42. sex:'Famale',
  43. };
  44. },
  45. methods:{
  46. sure(){
  47. uni.showModal({
  48. title:'确认性别',
  49. content:`性别选择后无法修改,当前选择为${this.sex==='Famale'?'女性':'男性'},请确认!`,
  50. confirmText:'确认',
  51. confirmColor:'#6C52F4',
  52. success:(res)=>{
  53. if(res.confirm){
  54. uni.showLoading({
  55. title:'保存中',
  56. mask:true
  57. })
  58. let user=JSON.parse(uni.getStorageSync('user'));
  59. user.sex=this.sex;
  60. this.$api.login.saveSex({
  61. "completeUser": user,
  62. "weiXinStatusEnum": 'NoWeiXin',
  63. }).then(res=>{
  64. uni.setStorageSync('regStep','SocialImage');
  65. uni.setStorageSync('LL_Ukn',res.data.ukn);
  66. uni.setStorageSync('user',JSON.stringify(user));
  67. uni.hideLoading();
  68. uni.reLaunch({
  69. url:`/pages/info/figure`
  70. })
  71. }).catch(err=>{})
  72. }
  73. }
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .container{
  81. width: 100vw;
  82. min-height: 100vh;
  83. background-color: $bgcolor1;
  84. .line-bar{
  85. margin: 0 60rpx;
  86. margin-top: 30rpx;
  87. .span{
  88. width: 120rpx;
  89. height: 8rpx;
  90. border-radius: 4rpx 0rpx 0rpx 4rpx;
  91. background-color: $bgcolor4;
  92. }
  93. .active{
  94. background-color: $primary;
  95. }
  96. }
  97. .title{
  98. color: $fontcolor5;
  99. padding-left: 60rpx;
  100. margin-top: 108rpx;
  101. }
  102. .tip{
  103. color: $fontcolor3;
  104. padding-left: 60rpx;
  105. margin-top: 8rpx;
  106. }
  107. .img-box{
  108. width: 320rpx;
  109. margin-left: 60rpx;
  110. .img{
  111. width: 320rpx;
  112. height: 320rpx;
  113. }
  114. .img-text{
  115. color: $fontcolor3;
  116. text-align: center;
  117. }
  118. }
  119. .btn{
  120. position: fixed;
  121. z-index: 999;
  122. left: 0;
  123. right: 0;
  124. bottom: 44rpx;
  125. margin: auto;
  126. width: 630rpx;
  127. height: 104rpx;
  128. border-radius: 52rpx;
  129. background-color: $primary;
  130. color: $fontcolor5;
  131. text-align: center;
  132. line-height: 104rpx;
  133. }
  134. }
  135. </style>