userinfo.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="content">
  3. <view class="row1">
  4. <text class="tit">头像</text>
  5. <view class="background-img" @click.stop="imgsub"><image class="background-img" :src="userInfo.avatar" mode="aspectFill"></image></view>
  6. </view>
  7. <view class="row">
  8. <text class="tit">昵称</text>
  9. <input class="input" type="text" v-model="userInfo.nickname" placeholder-class="placeholder" />
  10. </view>
  11. <view class="row">
  12. <text class="tit" style="width: 240upx;">银行账号</text>
  13. <input class="input" type="text" v-model="userInfo.bank_card_no" placeholder-class="placeholder" />
  14. </view>
  15. <view class="row">
  16. <text class="tit" style="width: 240upx;">所属银行</text>
  17. <input class="input" type="text" v-model="userInfo.bank_of_deposit" placeholder-class="placeholder" />
  18. </view>
  19. <view class="row">
  20. <text class="tit">ID</text>
  21. <input class="input" type="text" disabled="true" v-model="userInfo.id" placeholder-class="placeholder" />
  22. </view>
  23. <view class="row">
  24. <text class="tit">账户</text>
  25. <input class="input" type="text" disabled="true" v-model="userInfo.username" placeholder-class="placeholder" />
  26. </view>
  27. <view class="row1">
  28. <text class="tit">支付宝收款码</text>
  29. <view class="background-img1" @click.stop="imgsubali"><image class="background-img1" :src="userInfo.ali" mode="aspectFill"></image></view>
  30. </view>
  31. <view class="row1">
  32. <text class="tit">微信收款码</text>
  33. <view class="background-img1" @click.stop="imgsubwechat"><image class="background-img1" :src="userInfo.wechat" mode="aspectFill"></image></view>
  34. </view>
  35. <view class="add-btn" @click="confirm">提交</view>
  36. <view class="out" @click="toLogout">退出登录</view>
  37. </view>
  38. </template>
  39. <script>
  40. import { mapState,mapMutations } from 'vuex';
  41. import { uploads } from '@/api/user.js';
  42. import {userEdit,logout} from '@/api/set.js';
  43. export default{
  44. data(){
  45. return{
  46. }
  47. },
  48. onLoad() {
  49. console.log(this.userInfo)
  50. },
  51. computed: {
  52. ...mapState('user',['userInfo'])
  53. },
  54. methods: {
  55. ...mapMutations('user',['logout']),
  56. imgsub() {
  57. console.log('上传头像')
  58. uploads({
  59. filename: ''
  60. }).then(res => {
  61. // console.log("data",data);
  62. // this.userInfo.avatar = data.fullurl;
  63. console.log(res,'++++++++++++++++')
  64. this.userInfo.avatar = res[0].fullurl;
  65. })
  66. },
  67. imgsubali() {
  68. console.log('上传支付宝二维码')
  69. uploads({
  70. filename: ''
  71. }).then(res => {
  72. // console.log("data",data);
  73. // this.userInfo.avatar = data.fullurl;
  74. console.log(res,'++++++++++++++++')
  75. this.userInfo.ali = res[0].fullurl;
  76. })
  77. },
  78. imgsubwechat() {
  79. console.log('上传微信二维码')
  80. uploads({
  81. filename: ''
  82. }).then(res => {
  83. // console.log("data",data);
  84. // this.userInfo.avatar = data.fullurl;
  85. console.log(res,'++++++++++++++++')
  86. this.userInfo.wechat = res[0].fullurl;
  87. })
  88. },
  89. confirm() {
  90. userEdit({ avatar: this.userInfo.avatar ,nickname: this.userInfo.nickname,bank_of_deposit:this.userInfo.bank_of_deposit,bank_card_no:this.userInfo.bank_card_no,ali: this.userInfo.ali,wechat: this.userInfo.wechat})
  91. .then(e => {
  92. this.$api.msg('修改成功');
  93. setTimeout(()=> {
  94. uni.switchTab({
  95. url:'/pages/user/user'
  96. });
  97. }, 1000);
  98. console.log(e);
  99. })
  100. .catch(e => {
  101. console.log(e);
  102. });
  103. },
  104. toLogout(){
  105. let obj = this;
  106. uni.showModal({
  107. content: '确定要退出登录么',
  108. success: (e)=>{
  109. if(e.confirm){
  110. // logout({}).then((e) => {
  111. // uni.navigateBack();
  112. // }).catch((e) => {
  113. // console.log(e);
  114. // })
  115. uni.navigateBack();
  116. obj.logout();
  117. }
  118. }
  119. });
  120. },
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. .row1 {
  126. display: flex;
  127. align-items: center;
  128. justify-content: space-between;
  129. position: relative;
  130. padding: 0 30upx;
  131. height: 110upx;
  132. background: #000;
  133. margin-bottom: 20upx;
  134. .tit {
  135. flex-shrink: 0;
  136. width: 120upx;
  137. font-size: $font-lg;
  138. color: #fff;
  139. }
  140. .background-img {
  141. width: 80rpx;
  142. height: 80rpx;
  143. border-radius: 50%;
  144. background: #f2f2f2;
  145. }
  146. .background-img1 {
  147. width: 80rpx;
  148. height: 80rpx;
  149. background: #f2f2f2;
  150. }
  151. }
  152. .row {
  153. display: flex;
  154. align-items: center;
  155. padding: 0 30upx;
  156. height: 110upx;
  157. background: #000;
  158. .tit {
  159. flex-shrink: 0;
  160. width: 120upx;
  161. font-size: $font-lg;
  162. color: #fff;
  163. }
  164. .input {
  165. flex: 1;
  166. text-align: right;
  167. font-size: $font-base;
  168. color: #fff;
  169. }
  170. }
  171. .add-btn {
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. margin: 158rpx auto 30rpx;
  176. width: 560rpx;
  177. height: 80rpx;
  178. background: linear-gradient(-74deg, #CE9C6D, #FFECD6);
  179. border-radius: 40px;
  180. color: #FFFFFF;
  181. }
  182. .out {
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. margin: 0 auto 30rpx;
  187. width: 560rpx;
  188. height: 80rpx;
  189. border: 1px solid #FFECD6;
  190. background: #FFFFFF;
  191. border-radius: 40px;
  192. color: #CE9C6D;
  193. }
  194. </style>