setting.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view :style="vuex_skin">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <u-navbar title-color="#000000" :is-back="true" title="设置"></u-navbar>
  5. <!-- #endif -->
  6. <u-cell-group>
  7. <u-cell-item v-for="(item,index) in menuList" :key="index" @click="jump(item)" :icon="item.icon"
  8. :title="item.title"></u-cell-item>
  9. </u-cell-group>
  10. <view v-if="vuex_userId" class="center" style="margin-top: 200rpx;">
  11. <button @click="logout" class="cu-btn flex text-lg bg-base radius" style="padding: 42rpx 0;width: 90%;">
  12. 退出登录
  13. </button>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. menuList: [{
  22. icon: 'question-circle',
  23. title: '积分兑换规则', //显示的title
  24. name: '积分规则', //对应后端获取数据的title
  25. path: '/pages/introduce/notice'
  26. },
  27. {
  28. icon: 'bookmark',
  29. title: '用户隐私协议',
  30. name: '用户隐私协议',
  31. path: '/pages/introduce/notice'
  32. }
  33. ]
  34. }
  35. },
  36. onLoad() {
  37. // #ifdef MP-WEIXIN
  38. let obj = {
  39. icon: 'account',
  40. title: '用户授权设置',
  41. path: ''
  42. }
  43. this.menuList.push(obj)
  44. // #endif
  45. },
  46. methods: {
  47. jump(item) {
  48. if (item.title == '用户授权设置') {
  49. uni.openSetting({
  50. success(res) {
  51. console.log(res.authSetting)
  52. }
  53. });
  54. return
  55. }
  56. let params = {
  57. title: item.name,
  58. }
  59. if (item.name=='用户隐私协议') {
  60. params.isGlobal=true
  61. }
  62. uni.navigateTo({
  63. url: item.path + this.$u.queryParams(params)
  64. })
  65. },
  66. logout() {
  67. this.$cache.clear()
  68. this.$u.vuex('vuex_userId', null)
  69. this.$u.vuex('vuex_phone', null)
  70. this.$u.vuex('vuex_gzh_userOpenid', null)
  71. uni.reLaunch({
  72. url: "/pages/mine/mine"
  73. })
  74. },
  75. }
  76. }
  77. </script>
  78. <style>
  79. </style>