帧视界壹通告,付费看视频的微信小程序
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.

221 lines
4.6 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
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
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="headImage">
  8. <view style="" class="key">头像</view>
  9. <button style="" class="value" @chooseavatar="onChooseAvatar" open-type="chooseAvatar">
  10. <image :src="form.headImage" v-if="form.headImage" style="width: 150%;height: 100%" mode="">
  11. </image>
  12. <image src="/static/image/tabbar/6.png" v-else style="width: 100%;height: 100%" mode="">
  13. </image>
  14. </button>
  15. </view>
  16. <view class="item">
  17. <view class="label">昵称</view>
  18. <view class="value">
  19. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  20. v-model="form.nickName" />
  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></uv-input>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- ActionSheet 操作菜单 -->
  35. <uv-action-sheet ref="actionSheet" :actions="sexList" title="性别" @select="select" @close="close">
  36. </uv-action-sheet>
  37. <!--确认修改个人信息按钮-->
  38. <button @click="confirmEditUserInfo" class="bottomBtn">
  39. 确认修改
  40. </button>
  41. </view>
  42. </template>
  43. <script>
  44. import '../../common.css'; // 引入公共 CSS 文件
  45. import {
  46. mapState
  47. } from 'vuex'
  48. export default {
  49. computed: {
  50. ...mapState(['userInfo']),
  51. },
  52. data() {
  53. return {
  54. form: {
  55. sex: '',
  56. nickName: '1',
  57. phone: '',
  58. headImage: '',
  59. },
  60. // itemUserImage: userInfo.headImage,
  61. fileList: [],
  62. sexList: [{
  63. name: '男',
  64. value: 1
  65. },
  66. {
  67. name: '女',
  68. value: 0
  69. },
  70. ],
  71. }
  72. },
  73. mounted() {
  74. this.form.phone = this.userInfo.phone
  75. this.form.headImage = this.userInfo.headImage
  76. this.form.nickName = this.userInfo.nickName
  77. this.form.sex = this.userInfo.sex
  78. if (this.userInfo.sex == '' || this.userInfo.sex == null) {
  79. this.form.sex = '未知'
  80. }
  81. },
  82. methods: {
  83. onChooseAvatar(res) {
  84. let self = this
  85. console.log(res.target.avatarUrl, "res.target.avatarUrl");
  86. self.$Oss.ossUpload(res.target.avatarUrl)
  87. .then(url => {
  88. console.log(url, "url");
  89. self.form.headImage = url
  90. })
  91. },
  92. // 确认修改个人信息
  93. confirmEditUserInfo() {
  94. let self = this
  95. uni.createSelectorQuery().in(this)
  96. .select("#nickName")
  97. .fields({
  98. properties: ["value"],
  99. })
  100. .exec((res) => {
  101. const nickName = res?.[0]?.value
  102. self.form.nickName = nickName
  103. if (self.$utils.verificationAll(self.form, {
  104. headImage: '请选择头像',
  105. nickName: '请填写昵称'
  106. })) {
  107. return
  108. }
  109. self.$api('infoUpdateInfo', self.form, res => {
  110. if (res.code == 200) {
  111. uni.navigateTo({
  112. url: '/pages/index/index'
  113. })
  114. }
  115. })
  116. })
  117. this.$api('infoUpdateInfo', this.form, res => {
  118. if (res.code == 200) {
  119. uni.navigateTo({
  120. url: '/pages/index/index'
  121. })
  122. }
  123. })
  124. },
  125. sexChange() {
  126. this.$refs.actionSheet.open() //打开ActionSheet 操作菜单
  127. },
  128. // ActionSheet 操作菜单选中
  129. select(e) {
  130. console.log('选中该项:', e);
  131. this.form.sex = e.name
  132. this.$refs.actionSheet.close() //关闭操作菜单
  133. },
  134. // ActionSheet 操作菜单关闭
  135. close() {
  136. this.$refs.actionSheet.close() //关闭操作菜单
  137. },
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. * {
  143. box-sizing: border-box;
  144. margin: 0;
  145. padding: 0;
  146. }
  147. .updateUserInfo {
  148. .frame {
  149. padding: 28rpx 28rpx 0 28rpx;
  150. .headImage {
  151. display: flex;
  152. // width: 100vw;
  153. padding: 20rpx;
  154. .key {
  155. width: 500rpx;
  156. display: flex;
  157. align-items: center;
  158. }
  159. .value {
  160. border-radius: 50rpx;
  161. border: 1px solid red;
  162. box-sizing: border-box;
  163. overflow: hidden;
  164. width: 100rpx;
  165. height: 100rpx;
  166. }
  167. }
  168. .item {
  169. display: flex;
  170. justify-content: space-between;
  171. // border-bottom: 1px solid #c9c9c9;
  172. margin-top: 20rpx;
  173. padding: 20rpx;
  174. .label {
  175. width: 50%;
  176. }
  177. .value {
  178. width: 50%;
  179. text-align: right;
  180. }
  181. }
  182. }
  183. }
  184. /deep/ .input__content {
  185. /deep/.uv-input__content__field-wrapper {
  186. border: 1px solid red;
  187. input {
  188. text-align: right;
  189. }
  190. }
  191. }
  192. /deep/ .uv-input__content__field-wrapper__field {
  193. text-align: right;
  194. }
  195. </style>