index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <!-- 设置 -->
  3. <view class="userSet">
  4. <navigator url="/pages/users/user_info/index" hover-class="none" class="userInfo acea-row row-between-wrapper">
  5. <view class="picTxt acea-row row-middle">
  6. <view class="pictrue">
  7. <image :src="userInfo.avatar"></image>
  8. </view>
  9. <view class="text">
  10. <view class="name line1">{{userInfo.nickname}}</view>
  11. <view class="info">ID:{{userInfo.uid}}</view>
  12. </view>
  13. </view>
  14. <view class="iconfont icon-xiangyou"></view>
  15. </navigator>
  16. <view class="list">
  17. <!-- #ifdef H5 -->
  18. <view class="item acea-row row-between-wrapper" v-if="userInfo.phone && !this.$wechat.isWeixin()">
  19. <view>密码</view>
  20. <navigator url="/pages/users/user_pwd_edit/index" hover-class="none" class="input grab">
  21. 点击修改密码<text class="iconfont icon-xiangyou"></text>
  22. </navigator>
  23. </view>
  24. <!-- #endif -->
  25. <!-- #ifdef APP-PLUS -->
  26. <view class="item acea-row row-between-wrapper" v-if="userInfo.phone">
  27. <view>密码</view>
  28. <navigator url="/pages/users/user_pwd_edit/index" hover-class="none" class="grab">
  29. 点击修改密码<text class="iconfont icon-xiangyou"></text>
  30. </navigator>
  31. </view>
  32. <!-- #endif -->
  33. <view class="item acea-row row-between-wrapper" v-if="userInfo.phone">
  34. <view>更换手机号码</view>
  35. <navigator url="/pages/users/user_phone/index?type=1" hover-class="none" class="grab">
  36. 点击更换手机号码<text class="iconfont icon-xiangyou"></text>
  37. </navigator>
  38. </view>
  39. </view>
  40. <view class="list">
  41. <view class="item acea-row row-between-wrapper">
  42. <view>地址管理</view>
  43. <navigator url="/pages/users/user_address_list/index" hover-class="none" class="grab">
  44. 点击前往<text class="iconfont icon-xiangyou"></text>
  45. </navigator>
  46. </view>
  47. <view class="item acea-row row-between-wrapper">
  48. <view>发票管理</view>
  49. <navigator url="/pages/users/user_invoice_list/index" hover-class="none" class="grab">
  50. 点击前往<text class="iconfont icon-xiangyou"></text>
  51. </navigator>
  52. </view>
  53. </view>
  54. <view class="list">
  55. <!-- #ifndef APP-PLUS -->
  56. <view class="item acea-row row-between-wrapper">
  57. <view>移动网络下视频自动播放</view>
  58. <switch :checked="autoplay" @change="autoplayChange" />
  59. </view>
  60. <!-- #endif -->
  61. <!-- #ifdef MP -->
  62. <view class='item acea-row row-between-wrapper'>
  63. <view>权限设置</view>
  64. <view class="input grab" @click="Setting">
  65. 点击管理<text class="iconfont icon-xiangyou"></text>
  66. </view>
  67. </view>
  68. <!-- #endif -->
  69. <view class="item acea-row row-between-wrapper">
  70. <view>账号注销</view>
  71. <navigator url="/pages/users/user_cancellation/index" hover-class="none" class="input grab">
  72. 注销后无法恢复<text class="iconfont icon-xiangyou"></text>
  73. </navigator>
  74. </view>
  75. </view>
  76. <!-- #ifdef MP -->
  77. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  78. <!-- #endif -->
  79. </view>
  80. </template>
  81. <style lang="scss">
  82. .userSet {
  83. .userInfo {
  84. margin-top: 20rpx;
  85. background-color: #fff;
  86. padding: 0 30rpx;
  87. height: 144rpx;
  88. .iconfont {
  89. font-size: 30rpx;
  90. color: #868686;
  91. }
  92. .picTxt {
  93. .text {
  94. width: 524rpx;
  95. margin-left: 30rpx;
  96. font-weight: 400;
  97. .name {
  98. font-size: 32rpx;
  99. color: #333;
  100. }
  101. .info {
  102. font-size: 24rpx;
  103. color: #999;
  104. margin-top: 5rpx;
  105. }
  106. }
  107. .pictrue {
  108. width: 88rpx;
  109. height: 88rpx;
  110. image {
  111. width: 100%;
  112. height: 100%;
  113. border: 1px solid #eee;
  114. border-radius: 50%;
  115. }
  116. }
  117. }
  118. }
  119. .list{
  120. background-color: #fff;
  121. margin-top: 20rpx;
  122. .item{
  123. padding: 30rpx 30rpx 30rpx 0;
  124. border-bottom: 1rpx solid #f2f2f2;
  125. margin-left: 30rpx;
  126. font-size: 32rpx;
  127. color: #333;
  128. .grab{
  129. color: #ccc;
  130. .iconfont{
  131. font-size: 30rpx;
  132. color: #868686;
  133. margin-left: 6rpx;
  134. }
  135. }
  136. /deep/.uni-switch-input {
  137. width: 84rpx;
  138. height: 48rpx;
  139. margin: -8rpx 0;
  140. &::before {
  141. width: 80rpx;
  142. height: 44rpx;
  143. }
  144. &::after {
  145. width: 44rpx;
  146. height: 44rpx;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. </style>
  153. <script>
  154. import {
  155. getUserInfo
  156. } from '@/api/user.js';
  157. import {
  158. toLogin
  159. } from '@/libs/login.js';
  160. import {
  161. mapGetters,
  162. mapMutations
  163. } from "vuex";
  164. export default {
  165. computed: mapGetters(['isLogin']),
  166. data() {
  167. return {
  168. userInfo:{},
  169. isShowAuth: false,
  170. autoplay: this.$store.state.app.autoplay
  171. }
  172. },
  173. onLoad() {},
  174. onShow() {
  175. if (this.isLogin) {
  176. this.getUserInfo();
  177. } else {
  178. toLogin();
  179. }
  180. },
  181. methods: {
  182. ...mapMutations(['SET_AUTOPLAY']),
  183. /**
  184. * 小程序设置
  185. */
  186. Setting: function() {
  187. uni.openSetting({
  188. success: function(res) {
  189. }
  190. });
  191. },
  192. onLoadFun(){
  193. this.getUserInfo();
  194. this.isShowAuth = false
  195. },
  196. // 授权关闭
  197. authColse: function(e) {
  198. this.isShowAuth = e
  199. },
  200. getUserInfo(){
  201. let that = this;
  202. getUserInfo().then(res => {
  203. that.userInfo = res.data;
  204. });
  205. },
  206. autoplayChange(event){
  207. this.SET_AUTOPLAY(event.detail.value);
  208. }
  209. }
  210. }
  211. </script>