index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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="login_status == 'login'"
  9. @changeStatus="change_status"
  10. @changeTitle="change_title"
  11. ></login_container>
  12. <!-- 注册窗口-->
  13. <regist_container v-if="login_status == 'regist'"
  14. @changeStatus='change_status'
  15. @change_login_status="change_login_status"
  16. :title="regist_title"
  17. ></regist_container>
  18. </div>
  19. <!-- 登陆后 的个人首页-->
  20. <div class="personal_card" v-if="is_login">
  21. <personal_container @change_login_status="change_login_status"></personal_container>
  22. <device_container></device_container>
  23. </div>
  24. <div class="service" :class="{'service_login_page':is_login==false}">
  25. <view class="padding-tb">
  26. <text class="cuIcon-titles text-primary"></text>
  27. <text class="">功能服务</text>
  28. </view>
  29. <div class="content">
  30. <van-row>
  31. <van-col span="12">
  32. <img src="https://img.shuimuai.com/index_btn_chongzhizhongxin.png"
  33. @click="to_page('user_center/recharge')"></img>
  34. </van-col>
  35. <van-col span="12">
  36. <img src="https://img.shuimuai.com/web/index_btn_gerenzhongxin.png" @click="to_page('user_center')"></img>
  37. </van-col>
  38. </van-row>
  39. <van-row>
  40. <van-col span="12">
  41. <img src="https://img.shuimuai.com/web/index_btn_chengjijilu.png" @click="to_page('game_record')"></img>
  42. </van-col>
  43. <van-col span="12">
  44. <img src="https://img.shuimuai.com/index_btn_dailishang.png" @click="to_page('agent/index')"></img>
  45. </van-col>
  46. </van-row>
  47. </div>
  48. </div>
  49. <van-toast id="van-toast"/>
  50. <!-- <button class="cu-btn lg cu-btn-primary text-white text-center margin-tb" @click="auth_msg">获取消息授权-->
  51. <!-- </button>-->
  52. </div>
  53. </template>
  54. <script>
  55. import banner from '@/components/banner'
  56. import login_container from '@/components/index/login'
  57. import regist_container from '@/components/index/regist'
  58. import personal_container from "@/components/index/personal";
  59. import device_container from "@/components/device/device";
  60. import Toast from '../../../static/vant/toast/toast';
  61. import {userDetail} from "../../requests/user";
  62. import user_store from "../../store/index"
  63. import {reload_userinfo} from "../../utils/user";
  64. var $this
  65. export default {
  66. name: "index_container",
  67. components: {
  68. banner, login_container, regist_container, personal_container, device_container
  69. },
  70. data() {
  71. return {
  72. // 三种状态 扫码scan 注册regist 登录login
  73. login_status: "login",
  74. // is_login: false,
  75. is_login: false,
  76. regist_title: ""
  77. }
  78. },
  79. methods: {
  80. get_init_data() {
  81. },
  82. //切换到扫码
  83. change_status($status) {
  84. this.login_status = $status
  85. },
  86. //跳转充值中心
  87. to_recharge() {
  88. mpvue.navigateTo({
  89. url: "/pages/user_center/recharge/main"
  90. })
  91. },
  92. //修改登录状态
  93. change_login_status() {
  94. this.is_login = user_store.getters.get_login_status()
  95. },
  96. // 修改界面的文字
  97. change_title($status) {
  98. if ($status == 0) {
  99. this.regist_title = "注册"
  100. } else if ($status == 1) {
  101. this.regist_title = "登录"
  102. }
  103. },
  104. //跳转页面
  105. to_page($page) {
  106. if ($page == 'agent/index') {
  107. //店员店长不可进
  108. if ($this.userinfo.level == 8 || $this.userinfo.level == 9) {
  109. Toast.fail("店员、店长不可进")
  110. return false
  111. }
  112. }
  113. if (!this.is_login) {
  114. Toast.fail("请先登录")
  115. return false
  116. }
  117. mpvue.navigateTo({
  118. url: "/pages/" + $page + "/main"
  119. })
  120. },
  121. auth_msg() {
  122. wx.requestSubscribeMessage({
  123. tmplIds: ['NV-xb_oOPutXLVge0ZnBxct_nNxS1j1XNCMtfp2c8zw', '70xngszQ62NWHbbCjbggbz5-pvOu3Z8ttLbjfplJXLg'],
  124. success(res) {
  125. console.log(res)
  126. Toast.success("授权成功")
  127. }
  128. })
  129. }
  130. },
  131. mounted() {
  132. },
  133. onShow() {
  134. userDetail().then((res) => {
  135. let $data = res.data
  136. //判断如果是第一次登录就 弹出领取体验卡
  137. $this.userinfo = $data.data
  138. user_store.setters.set_userinfo($this.userinfo)
  139. })
  140. },
  141. onHide() {
  142. },
  143. onUnload() {
  144. },
  145. onLoad($option) {
  146. // 判断存储是否登录
  147. let $token = wx.getStorageSync('token')
  148. if ($token) {
  149. user_store.setters.set_token($token)
  150. user_store.setters.set_login(true)
  151. this.is_login = user_store.getters.get_login_status()
  152. }
  153. },
  154. created() {
  155. $this = this
  156. }
  157. }
  158. </script>
  159. <style scoped>
  160. /*@import "index.css";*/
  161. .login_card {
  162. height: 335px;
  163. background-color: #ffffff;
  164. position: relative;
  165. z-index: 3;
  166. top: -90px;
  167. margin: 0px 10px;
  168. background-image: url(https://img.shuimuai.com/shuimugongzhu.png);
  169. background-position: center;
  170. background-size: 100% 100%;
  171. background-color: rgba(255, 255, 255, 0);
  172. }
  173. /* 功能服务 */
  174. .service {
  175. position: absolute;
  176. width: 100%;
  177. top: 570px;
  178. z-index: 1;
  179. }
  180. .service_login_page {
  181. top: 500px !important;
  182. }
  183. .service .content {
  184. width: 100%;
  185. }
  186. .service .content image {
  187. width: 186px;
  188. height: 89px;
  189. }
  190. .head .line {
  191. width: 4px;
  192. height: 14px;
  193. background-color: #5d4db8;
  194. margin-right: 7px;
  195. }
  196. .head view {
  197. display: flex;
  198. justify-self: start;
  199. align-items: center;
  200. }
  201. .personal_card {
  202. height: 300px;
  203. position: relative;
  204. z-index: 5;
  205. }
  206. </style>