setting.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="setting">
  3. <!-- 占位元素 -->
  4. <view style="height: 24rpx;"></view>
  5. <!-- 列表 -->
  6. <view class="cell">
  7. <view class="cell_item" @click="goPrivacy">
  8. <text>隐私政策</text>
  9. <image src="/static/icon/right.png"></image>
  10. </view>
  11. <view class="cell_item" @click="goUser">
  12. <text>用户协议</text>
  13. <image src="/static/icon/right.png"></image>
  14. </view>
  15. <view class="cell_item" @click="goVerfication" v-if="staff !=null">
  16. <text>核销中心</text>
  17. <image src="/static/icon/right.png"></image>
  18. </view>
  19. </view>
  20. <!-- 按钮 -->
  21. <view class="btn" @click="loginOut">
  22. <text>退出登录</text>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. staff:'',
  31. }
  32. },
  33. onLoad() {
  34. this.getInfo()
  35. },
  36. methods: {
  37. //用户信息
  38. getInfo(){
  39. this.$api.my.userInfo().then(res=>{
  40. this.$store.dispatch('user/info', res.data)
  41. this.staff = this.$store.getters.userInfo.staff
  42. console.log(this.staff );
  43. })
  44. },
  45. // 跳转隐私政策
  46. goPrivacy() {
  47. uni.navigateTo({
  48. url: '/pages/my/protocol/PrivacyPolicy'
  49. })
  50. },
  51. // 跳转用户协议
  52. goUser() {
  53. uni.navigateTo({
  54. url: '/pages/my/protocol/UserAgreement'
  55. })
  56. },
  57. // 跳转核销中心
  58. goVerfication() {
  59. uni.navigateTo({
  60. url: '/pages/my/verification/verification'
  61. })
  62. },
  63. // 退出登录
  64. loginOut() {
  65. if (this.$store.getters.token) {
  66. //记录用户曾经登录过
  67. // this.$store.getters.userInfo.isLoginOff = true
  68. // this.$store.dispatch("user/info", this.$store.getters.userInfo)
  69. this.$store.dispatch("user/info", null)
  70. // this.$store.dispatch("user/token", null)
  71. // uni.removeStorageSync('auth_token')
  72. uni.removeStorageSync('userInfo')
  73. uni.reLaunch({
  74. url:'/pages/login/login'
  75. })
  76. } else {
  77. uni.showToast({
  78. title: '请先登录!',
  79. icon: 'error'
  80. })
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. $pageColor:#F9F9F9;
  88. $bgColor:#FFFFFF;
  89. @mixin flexlayout {
  90. display: flex;
  91. align-items: center;
  92. justify-content: center;
  93. }
  94. .setting {
  95. height: 100%;
  96. background: $pageColor;
  97. }
  98. .cell {
  99. width: 100%;
  100. border-radius: 16rpx;
  101. padding: 0 30rpx;
  102. background: $bgColor;
  103. margin-bottom: 48rpx;
  104. .cell_item {
  105. box-sizing: border-box;
  106. height: 110rpx;
  107. width: 690rpx;
  108. border-bottom: solid 2rpx #F0F0F0;
  109. display: flex;
  110. align-items: center;
  111. position: relative;
  112. text {
  113. font-size: 30rpx;
  114. font-family: PingFang-SC-Medium, PingFang-SC;
  115. font-weight: 500;
  116. color: #000000;
  117. }
  118. image {
  119. width: 12rpx;
  120. height: 20rpx;
  121. position: absolute;
  122. right: 0rpx;
  123. top: 46rpx;
  124. }
  125. }
  126. .cell_item:nth-last-child(1) {
  127. box-sizing: border-box;
  128. height: 110rpx;
  129. width: 690rpx;
  130. border-bottom: solid 0rpx #F0F0F0;
  131. display: flex;
  132. align-items: center;
  133. position: relative;
  134. text {
  135. font-size: 30rpx;
  136. font-family: PingFang-SC-Medium, PingFang-SC;
  137. font-weight: 500;
  138. color: #000000;
  139. }
  140. image {
  141. width: 12rpx;
  142. height: 20rpx;
  143. position: absolute;
  144. right: 0rpx;
  145. top: 46rpx;
  146. }
  147. }
  148. }
  149. .btn {
  150. width: 690rpx;
  151. height: 92rpx;
  152. background: $bgColor;
  153. border-radius: 16rpx;
  154. margin-left: 30rpx;
  155. @include flexlayout() text {
  156. font-size: 28rpx;
  157. font-family: PingFang-SC-Medium, PingFang-SC;
  158. font-weight: 500;
  159. color: #333333;
  160. }
  161. }
  162. </style>