membetreg.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view>
  3. <tui-bottom-popup :show="show">
  4. <tui-list-cell :hover="false">
  5. <view class="tui-item__title">
  6. <view>填写您的昵称、头像</view>
  7. <view class="titletxt">提供具有辨识度的用户中心界面</view>
  8. </view>
  9. <view class="tui-icon-close" @tap="close">
  10. <tui-icon name="shut" :size="22" color="#BFBFBF"></tui-icon>
  11. </view>
  12. </tui-list-cell>
  13. <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  14. <tui-list-cell :hover="false" :lineLeft="false">
  15. <view class="tui-cell-input">
  16. <label style="padding-right: 60rpx;">头像</label>
  17. <image :src="userpic || '/static/images/my/mine_def_touxiang_3x.png'" class="tui-avatar"></image>
  18. <label class="getuserpic">获取头像</label>
  19. </view>
  20. </tui-list-cell>
  21. </button>
  22. <tui-list-cell :hover="false" :lineLeft="false">
  23. <view class="tui-cell-input">
  24. <label style="padding-right: 60rpx;">昵称</label>
  25. <!-- #ifndef MP-WEIXIN -->
  26. <input type="text" v-model="nickname" placeholder="请输入昵称" placeholder-class="tui-phcolor" />
  27. <!-- #endif -->
  28. <!-- #ifdef MP-WEIXIN -->
  29. <input type="nickname" v-model="nickname" @blur="inputNickname" @input="inputNickname" placeholder="请输入昵称" placeholder-class="tui-phcolor" />
  30. <!-- #endif -->
  31. </view>
  32. </tui-list-cell>
  33. <view class="tui-btn-pay">
  34. <button class="gopaybutt" @click="bindSave" :style="'background:'+ stylecolor">保存</button>
  35. </view>
  36. </tui-bottom-popup>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. name: 'membetreg',
  42. props: {
  43. //支付方式
  44. paymethod: {
  45. type: Array,
  46. default() {
  47. return [];
  48. }
  49. },
  50. //控制显示
  51. show: {
  52. type: Boolean,
  53. default: false
  54. },
  55. amuont:{
  56. type: String,
  57. default: ''
  58. },
  59. stylecolor:{
  60. type: String,
  61. default: '#ff1e02'
  62. },
  63. page: {
  64. type: Number,
  65. default: 1
  66. }
  67. },
  68. data() {
  69. return {
  70. paymentType:"",
  71. nickname: '',
  72. userpic:''
  73. };
  74. },
  75. methods: {
  76. bindSave() {
  77. let _this = this;
  78. _this.$request.post('member.update', {
  79. samkey: (new Date()).valueOf(),
  80. nickname: _this.nickname,
  81. userpic: _this.userpic,
  82. }).then(res => {
  83. if (res.errno == 0) {
  84. this.$emit("loginnextpage")
  85. }
  86. });
  87. },
  88. inputNickname(e) {
  89. this.nickname = e.detail.value;
  90. },
  91. clearInput() {
  92. this.nickname = '';
  93. },
  94. close() {
  95. this.$emit("close", {})
  96. },
  97. paymentradioChange(e) {
  98. this.paymentType = e.target.value
  99. },
  100. onChooseAvatar(e) {
  101. let _this = this;
  102. this.userpic = e.detail.avatarUrl;
  103. this.$request.uploadFile(e.detail.avatarUrl).then(res => {
  104. //console.log(res);
  105. _this.userpic = res.url;
  106. _this.$request.post('member.update', {
  107. userpic: _this.userpic
  108. }).then(res => {});
  109. });
  110. },
  111. onChooseAvatar2() {
  112. let _this = this;
  113. uni.chooseImage({
  114. count: 1,
  115. sizeType: ['original', 'compressed'],
  116. sourceType: ['album', 'camera'],
  117. success: res => {
  118. //console.log(res);
  119. _this.userpic = res.tempFilePaths[0];
  120. this.$request.uploadFile(_this.userpic).then(res => {
  121. //console.log(res);
  122. _this.userpic = res.url;
  123. _this.$request.post('member.update', {
  124. userpic: _this.userpic
  125. }).then(res => {});
  126. });
  127. }
  128. });
  129. },
  130. }
  131. }
  132. </script>
  133. <style lang="scss">
  134. .tui-item__title {
  135. width: 100%;
  136. padding-bottom: 20rpx;
  137. align-items: center;
  138. justify-content: space-between;
  139. box-sizing: border-box;
  140. font-size: 34rpx;
  141. font-weight: bold;
  142. }
  143. .titletxt {
  144. color: #999999;
  145. padding-top: 10rpx;
  146. font-size: 34rpx;
  147. font-weight: normal;
  148. }
  149. .tui-icon-close {
  150. position: absolute;
  151. right: 30rpx;
  152. top: 60rpx;
  153. transform: translateY(-50%);
  154. }
  155. .getuserpic {
  156. color: #999;
  157. padding-top: 10rpx;
  158. padding-left: 30rpx;
  159. }
  160. .tui-cell-input {
  161. width: 100%;
  162. display: flex;
  163. align-items: center;
  164. padding-top: 18rpx;
  165. padding-bottom: $uni-spacing-col-base;
  166. input {
  167. flex: 1;
  168. padding-left: $uni-spacing-row-base;
  169. }
  170. }
  171. .avatar-wrapper {
  172. padding-left: 0px;
  173. padding-right: 0px;
  174. box-sizing: border-box;
  175. border-radius: 0px;
  176. }
  177. .tui-avatar {
  178. width: 100rpx;
  179. height: 100rpx;
  180. border-radius: 50%;
  181. display: block;
  182. }
  183. .tui-btn-pay {
  184. width: 100%;
  185. padding: 68rpx 60rpx 50rpx;
  186. box-sizing: border-box;
  187. }
  188. .gopaybutt {
  189. height: 88rpx;
  190. line-height: 88rpx;
  191. font-size: 28rpx;
  192. border-radius: 50rpx;
  193. color: #ffffff;
  194. align-items: center;
  195. }
  196. </style>