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

230 lines
5.0 KiB

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