index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div id="container">
  3. <!-- banner模块-->
  4. <banner></banner>
  5. <!-- 未登录 登录窗口模块-->
  6. <div class="login_card" v-if="!is_login">
  7. <!-- 登录窗口-->
  8. <login_container v-if="status == 'login'"
  9. @changeStatus="change_status"
  10. @changeTitle="change_title"
  11. ></login_container>
  12. <!-- 关于水母-->
  13. <scan_container v-if="status == 'scan'"></scan_container>
  14. <!-- 注册窗口-->
  15. <regist_container v-if="status == 'regist'"
  16. @changeStatus='change_status'
  17. @change_login_status="change_login_status"
  18. :title="regist_title"
  19. ></regist_container>
  20. </div>
  21. <!-- 登陆后 的个人首页-->
  22. <div class="personal_card" v-if="is_login">
  23. <personal_container></personal_container>
  24. <device_container></device_container>
  25. </div>
  26. <div class="service">
  27. <div class="head">
  28. <div>
  29. <div class="line"></div>
  30. <div class="title">功能服务</div>
  31. </div>
  32. </div>
  33. <div class="content">
  34. <img src="https://img.shuimuai.com/chongzhizhongxin.png" @click="to_page('recharge')"></img>
  35. <img src="https://img.shuimuai.com/shebeiguanli.png" @click="to_page('user_center')"></img>
  36. <img src="https://img.shuimuai.com/chongzhizhongxin.png" @click="to_page('report')"></img>
  37. <img src="https://img.shuimuai.com/shebeiguanli.png" @click="to_page('agent/index')"></img>
  38. </div>
  39. </div>
  40. <van-toast id="van-toast"/>
  41. </div>
  42. </template>
  43. <script>
  44. import banner from '@/components/banner'
  45. import login_container from '@/components/index/login'
  46. import scan_container from '@/components/index/scan'
  47. import regist_container from '@/components/index/regist'
  48. import personal_container from "@/components/index/personal";
  49. import device_container from "@/components/device/device";
  50. import Toast from '../../../static/vant/toast/toast';
  51. export default {
  52. name: "index_container",
  53. components: {
  54. banner, login_container, scan_container, regist_container, personal_container, device_container
  55. },
  56. data() {
  57. return {
  58. // 三种状态 扫码scan 注册regist 登录login
  59. status: "login",
  60. is_login: false,
  61. regist_title: ""
  62. }
  63. },
  64. methods: {
  65. get_init_data() {
  66. },
  67. //切换到扫码
  68. change_status($status) {
  69. this.status = $status
  70. },
  71. //跳转充值中心
  72. to_recharge() {
  73. mpvue.navigateTo({
  74. url: "/pages/user_center/recharge/main"
  75. })
  76. },
  77. //修改登录状态
  78. change_login_status() {
  79. this.is_login = this.$store.getters.get_login_status
  80. },
  81. // 修改界面的文字
  82. change_title($status) {
  83. if ($status == 0) {
  84. this.regist_title = "注册"
  85. } else if ($status == 1) {
  86. this.regist_title = "登录"
  87. }
  88. },
  89. //跳转页面
  90. to_page($page) {
  91. if (!this.is_login){
  92. Toast.fail("请先登录")
  93. return false
  94. }
  95. mpvue.navigateTo({
  96. url: "/pages/" + $page + "/main"
  97. })
  98. }
  99. },
  100. mounted() {
  101. },
  102. onLoad($option) {
  103. // 判断存储是否登录
  104. let $token = wx.getStorageSync('token')
  105. if ($token) {
  106. this.$store.commit('set_token', $token);
  107. this.$store.commit('set_login', true);
  108. this.is_login = this.$store.getters.get_login_status
  109. }
  110. }
  111. }
  112. </script>
  113. <style scoped>
  114. @import "index.css";
  115. </style>