帧视界壹通告,付费看视频的微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
3.9 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class='updateUserInfo'>
  3. <!--顶部导航栏-->
  4. <navbar leftClick @leftClick="$utils.navigateBack" title="修改个人信息" />
  5. <!--主页面-->
  6. <view class="frame">
  7. <view class="item">
  8. <view style="width: 70%;height: 150rpx;">头像</view>
  9. <view style="border-radius: 50%;border: 1px solid red;overflow: hidden;width: 30%;"
  10. @click="updateUserImage">
  11. <image :src='itemUserImage' style="width: 100%;height: 100%"></image>
  12. <!-- <uv-upload :fileList="fileList" :maxCount="1" multiple width="150rpx" height="150rpx"
  13. :deletable="false" :previewFullImage="false" @afterRead="afterRead" ></uv-upload> -->
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="label">昵称</view>
  18. <view class="value">
  19. <uv-input v-model="form.nickName" placeholder="昵称" border="bottom" clearable
  20. ></uv-input>
  21. </view>
  22. </view>
  23. <view class="item" @click="sexChange">
  24. <view class="label">性别</view>
  25. <view>{{form.sex}}</view>
  26. </view>
  27. <view class="item">
  28. <view class="label">联系方式</view>
  29. <view class="value">
  30. <uv-input v-model="form.phone" placeholder="联系方式" border="bottom" clearable
  31. ></uv-input>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- ActionSheet 操作菜单 -->
  36. <uv-action-sheet ref="actionSheet" :actions="sexList" title="性别" @select="select" @close="close">
  37. </uv-action-sheet>
  38. <!--确认修改个人信息按钮-->
  39. <button @click="confirmEditUserInfo" class="bottomBtn">
  40. 确认修改
  41. </button>
  42. </view>
  43. </template>
  44. <script>
  45. import '../../common.css'; // 引入公共 CSS 文件
  46. import {
  47. mapState
  48. } from 'vuex'
  49. export default {
  50. computed: {
  51. ...mapState(['userInfo']),
  52. },
  53. data() {
  54. return {
  55. form: {
  56. sex: userInfo.sex || '',
  57. nickName: '1',
  58. phone: userInfo.phone || '',
  59. image: userInfo.headImage,
  60. },
  61. itemUserImage: userInfo.headImage,
  62. fileList: [],
  63. sexList: [{
  64. name: '男',
  65. value: 1
  66. },
  67. {
  68. name: '女',
  69. value: 0
  70. },
  71. ],
  72. }
  73. },
  74. mounted() {
  75. console.log(this.userInfo.headImage, "this.userInfo.headImage");
  76. // this.fileList.push({
  77. // url: this.userInfo.headImage
  78. // })
  79. },
  80. methods: {
  81. // 确认修改个人信息
  82. confirmEditUserInfo() {
  83. this.$api('infoUpdateInfo', this.form, res => {
  84. if (res.code == 200) {
  85. // 修改VueX中的信息,是否有密码啥的
  86. uni.showToast({
  87. title: '修改成功',
  88. icon: 'success'
  89. })
  90. setTimeout(() => {
  91. uni.navigateTo({
  92. url: '/pages/index/index'
  93. })
  94. }, 300)
  95. }
  96. })
  97. },
  98. // 修改头像
  99. updateUserImage(e) {
  100. console.log(e, "e");
  101. let self = this
  102. // e.file.forEach(file => {
  103. self.$Oss.ossUpload(file.url).then(url => {
  104. self.itemUserImage = {
  105. url
  106. }
  107. })
  108. // })
  109. },
  110. deleteImage(e) {
  111. this.fileList.splice(e.index, 1)
  112. },
  113. afterRead(e) {
  114. let self = this
  115. e.file.forEach(file => {
  116. self.$Oss.ossUpload(file.url).then(url => {
  117. self.fileList.push({
  118. url
  119. })
  120. })
  121. })
  122. },
  123. sexChange() {
  124. this.$refs.actionSheet.open() //打开ActionSheet 操作菜单
  125. },
  126. // ActionSheet 操作菜单选中
  127. select(e) {
  128. console.log('选中该项:', e);
  129. this.form.sex = e.name
  130. this.$refs.actionSheet.close() //关闭操作菜单
  131. },
  132. // ActionSheet 操作菜单关闭
  133. close() {
  134. this.$refs.actionSheet.close() //关闭操作菜单
  135. },
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. * {
  141. box-sizing: border-box;
  142. margin: 0;
  143. padding: 0;
  144. }
  145. .updateUserInfo {
  146. .frame {
  147. padding: 28rpx 28rpx 0 28rpx;
  148. .item {
  149. display: flex;
  150. justify-content: space-between;
  151. // border-bottom: 1px solid #c9c9c9;
  152. margin-top: 20rpx;
  153. padding: 20rpx;
  154. .label {
  155. width: 50%;
  156. }
  157. .value {
  158. width: 50%;
  159. text-align: right;
  160. }
  161. }
  162. }
  163. }
  164. </style>