wechat.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 active"></view>
  7. <view class="span active"></view>
  8. <view class="span active"></view>
  9. <view class="span active"></view>
  10. </view>
  11. <view class="title font44 fw600">
  12. 设置你的微信号
  13. </view>
  14. <view class="tip font28 fw400">
  15. 如果你不在线,他可以添加你的微信
  16. </view>
  17. <view class="label-box flex-between">
  18. <view class="left font28 fw400">
  19. 微信号
  20. </view>
  21. </view>
  22. <view class="input-box flex-between">
  23. <input type="text" maxlength="10" placeholder="请填写真实正确的微信号" placeholder-style="color:#494667;font-size:28rpx;" class="input fw500 font32" v-model="wechat">
  24. </view>
  25. <view class="select-title font28 fw400">
  26. 设置查看权限
  27. </view>
  28. <picker mode="selector" :range="auths" range-key="value" @change="authsChange">
  29. <view class="select flex-between">
  30. <view class="select-val font28 fw400" :style="{'color':`${height===''?'':'#ffffff'}`}">
  31. {{auth}}
  32. </view>
  33. <image :src="`${assetsUrl}info-figure-select.png`" mode="aspectFill" class="select-icon"></image>
  34. </view>
  35. </picker>
  36. <cover-view class="btn font32 fw600" @click="sure">
  37. 下一步
  38. </cover-view>
  39. </view>
  40. </template>
  41. <script>
  42. import TopBar from '@/components/TopBar/TopBar.vue';
  43. import ImageCropper from "@/components/invinbg-image-cropper/invinbg-image-cropper.vue";
  44. export default {
  45. components:{TopBar,ImageCropper},
  46. data() {
  47. return {
  48. assetsUrl:this.$util.assetsUrl,
  49. auths:[],
  50. auth:'',
  51. wechat:'',
  52. saveOption:{
  53. completeUser: {},
  54. weiXinStatusEnum: 'WxM2F5'
  55. }
  56. };
  57. },
  58. mounted() {
  59. let user=JSON.parse(uni.getStorageSync('user'));
  60. if(user.sex==='Famale'){
  61. this.auths=[
  62. {key:'WxM2F5',value:'对VIP公开或使用颜豆、权益卡查看'},
  63. {key:'WaitAuth',value:'经过我授权才能查看微信'},
  64. ]
  65. this.auth='对VIP公开或使用颜豆、权益卡查看';
  66. }
  67. else if(user.sex==='Male'){
  68. this.auths=[
  69. {key:'WxF2M7',value:'对完成真人认证的女士公开'},
  70. {key:'WaitAuth',value:'经过我授权才能查看微信'},
  71. ]
  72. this.auth='对完成真人认证的女士公开';
  73. }
  74. },
  75. methods:{
  76. sure(){
  77. if(this.wechat===''){uni.showToast({title:'请填写微信号',icon:'none'});return;}
  78. let user=JSON.parse(uni.getStorageSync('user'));
  79. user.wxId=this.wechat;
  80. this.saveOption.completeUser=user;
  81. uni.showLoading({
  82. title:'保存中',
  83. mask:true
  84. })
  85. this.$api.login.saveWechat(this.saveOption).then(res=>{
  86. uni.hideLoading();
  87. if(res.data.succ){
  88. uni.setStorageSync('regStep','Index');
  89. uni.setStorageSync('user',JSON.stringify(user));
  90. uni.showToast({
  91. icon:'success',
  92. title:'保存成功'
  93. });
  94. this.getMineDetail();
  95. uni.switchTab({
  96. url:'/pages/friends/friends'
  97. })
  98. }
  99. })
  100. },
  101. authsChange(e){
  102. this.auth=this.auths[e.detail.value].value;
  103. this.saveOption.weiXinStatusEnum=this.auths[e.detail.value].key;
  104. },
  105. confirm(e) {
  106. this.tempFilePath = ''
  107. this.cropFilePath = e.detail.tempFilePath;
  108. this.btnText="下一步";
  109. this.$refs.popup.close();
  110. },
  111. getMineDetail(){
  112. let user=JSON.parse(uni.getStorageSync('user'));
  113. this.$api.public.mineDetail({
  114. getAlbum:true,
  115. completeUser:user
  116. }).then(res=>{
  117. this.$store.commit('setUserInfo',res.data);
  118. uni.setStorageSync('userInfo',JSON.stringify(res.data));//正式环境删除
  119. })
  120. },
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .container{
  126. width: 100vw;
  127. min-height: 100vh;
  128. background-color: $bgcolor1;
  129. .line-bar{
  130. margin: 0 60rpx;
  131. margin-top: 30rpx;
  132. .span{
  133. width: 120rpx;
  134. height: 8rpx;
  135. border-radius: 4rpx 0rpx 0rpx 4rpx;
  136. background-color: $bgcolor4;
  137. }
  138. .active{
  139. background-color: $primary;
  140. }
  141. }
  142. .title{
  143. color: $fontcolor5;
  144. padding-left: 60rpx;
  145. margin-top: 108rpx;
  146. }
  147. .tip{
  148. color: $fontcolor3;
  149. padding-left: 60rpx;
  150. margin-top: 8rpx;
  151. }
  152. .label-box{
  153. margin: 0 60rpx;
  154. margin-top: 56rpx;
  155. .left{
  156. color: $fontcolor3;
  157. }
  158. }
  159. .input-box{
  160. margin: 0rpx 60rpx;
  161. margin-top: 16rpx;
  162. background-color: $bgcolor3;
  163. border-radius: 16rpx;
  164. height: 112rpx;
  165. padding: 0rpx 32rpx;
  166. .input{
  167. color: $fontcolor5;
  168. }
  169. }
  170. .select-title{
  171. color: $fontcolor3;
  172. margin: 0 60rpx;
  173. margin-top: 56rpx;
  174. }
  175. .select{
  176. background-color: $bgcolor3;
  177. margin: 0 60rpx;
  178. margin-top: 16rpx;
  179. height: 112rpx;
  180. border-radius: 16px;
  181. padding: 0 36rpx;
  182. .select-val{
  183. color: $fontcolor1;
  184. }
  185. .select-icon{
  186. width: 24rpx;
  187. height: 24rpx;
  188. }
  189. }
  190. .btn{
  191. position: fixed;
  192. z-index: 999;
  193. left: 0;
  194. right: 0;
  195. bottom: 44rpx;
  196. margin: auto;
  197. width: 630rpx;
  198. height: 104rpx;
  199. border-radius: 52rpx;
  200. background-color: $primary;
  201. color: $fontcolor5;
  202. text-align: center;
  203. line-height: 104rpx;
  204. }
  205. }
  206. .input-num{
  207. color: $fontcolor2;
  208. }
  209. </style>