mine_setting.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="dt-page">
  3. <DtMenuList
  4. :menuStyle="menuStyle"
  5. :itemData="moduleList"
  6. @tapitem="onTapItem"/>
  7. <template v-if="isLogin">
  8. <button @tap="exitAction" class="btn-submit" hover-class="button-hover-scale">退出系统</button>
  9. </template>
  10. </view>
  11. </template>
  12. <script>
  13. import DtMenuList from '../comps/dt_menu_list.vue'
  14. export default {
  15. components: {
  16. DtMenuList
  17. },
  18. data() {
  19. return {
  20. menuStyle: {
  21. spaceColor: '#f2f2f2',
  22. spaceHeight: 20
  23. },
  24. moduleList: [],
  25. isLogin: true
  26. }
  27. },
  28. methods: {
  29. onTapItem(item) {
  30. switch (item.id) {
  31. case 0:
  32. // let url='https://community.58fo.com/appfile/protocal.htm'
  33. let url = 'https://wuye.nxzhsq.cn/community/protocol/protocal.html'
  34. uni.navigateTo({
  35. url: "/pages/webview/webview?url=" + url + "&title=隐私协议"
  36. })
  37. break;
  38. case 1:
  39. break;
  40. default:
  41. break;
  42. }
  43. },
  44. //退出登录
  45. logout() {
  46. this.$auth.logout()
  47. this.touristLogin()
  48. uni.switchTab({
  49. url: "/pages/wode/wode"
  50. })
  51. },
  52. //退出操作
  53. exitAction() {
  54. this.$dialog.confirm({
  55. content: "是否退出本次账号",
  56. success: res => {
  57. if (res.confirm) {
  58. this.logout()
  59. }
  60. }
  61. })
  62. },
  63. /**
  64. * 游客登陆
  65. */
  66. async touristLogin() {
  67. // 检查是否登录
  68. if (!this.$auth.isAuth) { // 就算是游客,也重新登录
  69. let resp = await this.$api.touristLogin()
  70. console.log("Resp", resp);
  71. let userType = this.$global.userType.tourist
  72. this.$auth.login(userType, resp.sessionId, resp.userId, resp)
  73. console.log('游客登录成功!', resp)
  74. }
  75. },
  76. onLoadPage() {
  77. wx.hideShareMenu();
  78. // this.memberInfo = this.$auth.getMemberInfo()
  79. this.isLogin = this.$auth.isAuth
  80. this.moduleList = [
  81. {
  82. id: 0,
  83. title: '隐私协议',
  84. value: '',
  85. hideArrow: false,
  86. isMarginTop: true
  87. },
  88. {
  89. id: 1,
  90. title: '技术支持',
  91. value: '宁夏新邻科技有限公司',
  92. hideArrow: true,
  93. isMarginTop: true
  94. }
  95. ]
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .dt-page {
  102. background-color: #f2f2f2;
  103. min-height: 100vh;
  104. .btn-submit {
  105. margin: 60 upx auto;
  106. width: 690 upx;
  107. height: 90 upx;
  108. line-height: 90 upx;
  109. border-radius: 10 upx;
  110. background-color: #e54d42;
  111. }
  112. }
  113. </style>