mine_setting.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. uni.navigateTo({
  34. url:"/pages/webview/webview?url="+url+"&title=隐私协议"
  35. })
  36. break;
  37. case 1:break;
  38. default:break;
  39. }
  40. },
  41. //退出登录
  42. logout() {
  43. this.$auth.logout()
  44. this.touristLogin()
  45. uni.switchTab({
  46. url:"/pages/wode/wode"
  47. })
  48. },
  49. //退出操作
  50. exitAction() {
  51. this.$dialog.confirm({
  52. content:"是否退出本次账号",
  53. success: res => {
  54. if (res.confirm) {
  55. this.logout()
  56. }
  57. }
  58. })
  59. },
  60. /**
  61. * 游客登陆
  62. */
  63. async touristLogin() {
  64. // 检查是否登录
  65. if (!this.$auth.isAuth) { // 就算是游客,也重新登录
  66. let resp = await this.$api.touristLogin()
  67. console.log("Resp",resp);
  68. let userType = this.$global.userType.tourist
  69. this.$auth.login(userType, resp.sessionId, resp.userId, resp)
  70. console.log('游客登录成功!', resp)
  71. }
  72. },
  73. onLoadPage() {
  74. wx.hideShareMenu();
  75. // this.memberInfo = this.$auth.getMemberInfo()
  76. this.isLogin = this.$auth.isAuth
  77. this.moduleList = [
  78. {
  79. id: 0,
  80. title: '隐私协议',
  81. value: '',
  82. hideArrow: false,
  83. isMarginTop:true
  84. },
  85. {
  86. id: 1,
  87. title: '技术支持',
  88. value: '宁夏新邻科技有限公司',
  89. hideArrow: true,
  90. isMarginTop:true
  91. }
  92. ]
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .dt-page{
  99. background-color:#f2f2f2;
  100. min-height:100vh;
  101. .btn-submit {
  102. margin:60upx auto;
  103. width:690upx;
  104. height: 90upx;
  105. line-height: 90upx;
  106. border-radius:10upx;
  107. background-color:#e54d42;
  108. }
  109. }
  110. </style>