|
@@ -3,38 +3,27 @@
|
|
|
<!-- banner模块-->
|
|
|
<banner></banner>
|
|
|
<!-- 未登录 登录窗口模块-->
|
|
|
- <div
|
|
|
- class="login_card"
|
|
|
- v-if="!is_login"
|
|
|
- >
|
|
|
+ <div class="login_card" v-if="!is_login">
|
|
|
<!-- 登录窗口-->
|
|
|
- <login_container
|
|
|
- v-if="login_status == 'login'"
|
|
|
- @changeStatus="change_status"
|
|
|
- @changeTitle="change_title"
|
|
|
+ <login_container v-if="login_status == 'login'"
|
|
|
+ @changeStatus="change_status"
|
|
|
+ @changeTitle="change_title"
|
|
|
></login_container>
|
|
|
<!-- 注册窗口-->
|
|
|
- <regist_container
|
|
|
- v-if="login_status == 'regist'"
|
|
|
- @changeStatus='change_status'
|
|
|
- @change_login_status="change_login_status"
|
|
|
- :title="regist_title"
|
|
|
+ <regist_container v-if="login_status == 'regist'"
|
|
|
+ @changeStatus='change_status'
|
|
|
+ @change_login_status="change_login_status"
|
|
|
+ :title="regist_title"
|
|
|
></regist_container>
|
|
|
|
|
|
</div>
|
|
|
<!-- 登陆后 的个人首页-->
|
|
|
- <div
|
|
|
- class="personal_card"
|
|
|
- v-if="is_login"
|
|
|
- >
|
|
|
+ <div class="personal_card" v-if="is_login">
|
|
|
<personal_container @change_login_status="change_login_status"></personal_container>
|
|
|
|
|
|
<device_container></device_container>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="service"
|
|
|
- :class="{'service_login_page':is_login==false}"
|
|
|
- >
|
|
|
+ <div class="service" :class="{'service_login_page':is_login==false}">
|
|
|
<view class="padding-tb">
|
|
|
<text class="cuIcon-titles text-primary"></text>
|
|
|
<text class="">功能服务</text>
|
|
@@ -42,62 +31,50 @@
|
|
|
<div class="content">
|
|
|
<van-row>
|
|
|
<van-col span="12">
|
|
|
- <img
|
|
|
- src="https://img.shuimuai.com/index_btn_chongzhizhongxin.png"
|
|
|
- @click="to_page('user_center/recharge')"
|
|
|
- ></img>
|
|
|
+ <img src="https://img.shuimuai.com/index_btn_chongzhizhongxin.png"
|
|
|
+ @click="to_page('user_center/recharge')"></img>
|
|
|
</van-col>
|
|
|
<van-col span="12">
|
|
|
- <img
|
|
|
- src="https://img.shuimuai.com/web/index_btn_gerenzhongxin.png"
|
|
|
- @click="to_page('user_center')"
|
|
|
- ></img>
|
|
|
+ <img src="https://img.shuimuai.com/web/index_btn_gerenzhongxin.png" @click="to_page('user_center')"></img>
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
|
|
|
<van-row>
|
|
|
<van-col span="12">
|
|
|
- <img
|
|
|
- src="https://img.shuimuai.com/web/index_btn_chengjijilu.png"
|
|
|
- @click="to_page('game_record')"
|
|
|
- ></img>
|
|
|
+ <img src="https://img.shuimuai.com/web/index_btn_chengjijilu.png" @click="to_page('game_record')"></img>
|
|
|
</van-col>
|
|
|
<van-col span="12">
|
|
|
- <img
|
|
|
- src="https://img.shuimuai.com/index_btn_dailishang.png"
|
|
|
- @click="to_page('agent/index')"
|
|
|
- ></img>
|
|
|
+ <img src="https://img.shuimuai.com/index_btn_dailishang.png" @click="to_page('agent/index')"></img>
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <van-toast id="van-toast" />
|
|
|
-
|
|
|
+ <van-toast id="van-toast"/>
|
|
|
+ <van-dialog id="van-dialog"/>
|
|
|
<!-- <button class="cu-btn lg cu-btn-primary text-white text-center margin-tb" @click="auth_msg">获取消息授权-->
|
|
|
<!-- </button>-->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import banner from "@/components/banner";
|
|
|
-import login_container from "@/components/index/login";
|
|
|
-import regist_container from "@/components/index/regist";
|
|
|
+import banner from '@/components/banner'
|
|
|
+import login_container from '@/components/index/login'
|
|
|
+import regist_container from '@/components/index/regist'
|
|
|
import personal_container from "@/components/index/personal";
|
|
|
import device_container from "@/components/device/device";
|
|
|
-import Toast from "../../../static/vant/toast/toast";
|
|
|
-import { userDetail } from "../../requests/user";
|
|
|
-import user_store from "../../store/index";
|
|
|
-import { reload_userinfo } from "../../utils/user";
|
|
|
+import Toast from '../../../static/vant/toast/toast';
|
|
|
+import Dialog from '../../../static/vant/dialog/dialog'
|
|
|
+import {userDetail} from "../../requests/user";
|
|
|
+import user_store from "../../store/index"
|
|
|
+import game_store from "../../store/game"
|
|
|
+import game_util, {post_data} from '../../utils/game'
|
|
|
+
|
|
|
|
|
|
-var $this;
|
|
|
+var $this
|
|
|
export default {
|
|
|
name: "index_container",
|
|
|
components: {
|
|
|
- banner,
|
|
|
- login_container,
|
|
|
- regist_container,
|
|
|
- personal_container,
|
|
|
- device_container,
|
|
|
+ banner, login_container, regist_container, personal_container, device_container
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -105,97 +82,123 @@ export default {
|
|
|
login_status: "login",
|
|
|
// is_login: false,
|
|
|
is_login: false,
|
|
|
- regist_title: "",
|
|
|
- };
|
|
|
+ regist_title: ""
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
- get_init_data() {},
|
|
|
+ get_init_data() {
|
|
|
+ },
|
|
|
//切换到扫码
|
|
|
change_status($status) {
|
|
|
- this.login_status = $status;
|
|
|
+ this.login_status = $status
|
|
|
},
|
|
|
//跳转充值中心
|
|
|
to_recharge() {
|
|
|
mpvue.navigateTo({
|
|
|
- url: "/pages/user_center/recharge/main",
|
|
|
- });
|
|
|
+ url: "/pages/user_center/recharge/main"
|
|
|
+ })
|
|
|
},
|
|
|
//修改登录状态
|
|
|
change_login_status() {
|
|
|
- this.is_login = user_store.getters.get_login_status();
|
|
|
+ this.is_login = user_store.getters.get_login_status()
|
|
|
},
|
|
|
// 修改界面的文字
|
|
|
change_title($status) {
|
|
|
if ($status == 0) {
|
|
|
- this.regist_title = "注册";
|
|
|
+ this.regist_title = "注册"
|
|
|
} else if ($status == 1) {
|
|
|
- this.regist_title = "登录";
|
|
|
+ this.regist_title = "登录"
|
|
|
}
|
|
|
},
|
|
|
//跳转页面
|
|
|
to_page($page) {
|
|
|
- if ($page == "agent/index") {
|
|
|
+ if ($page == 'agent/index') {
|
|
|
//店员店长不可进
|
|
|
if ($this.userinfo.level == 8 || $this.userinfo.level == 9) {
|
|
|
- Toast.fail("店员、店长不可进");
|
|
|
- return false;
|
|
|
+ Toast.fail("店员、店长不可进")
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
if (!this.is_login) {
|
|
|
- Toast.fail("请先登录");
|
|
|
- return false;
|
|
|
+ Toast.fail("请先登录")
|
|
|
+ return false
|
|
|
}
|
|
|
mpvue.navigateTo({
|
|
|
- url: "/pages/" + $page + "/main",
|
|
|
- });
|
|
|
+ url: "/pages/" + $page + "/main"
|
|
|
+ })
|
|
|
},
|
|
|
auth_msg() {
|
|
|
wx.requestSubscribeMessage({
|
|
|
- tmplIds: [
|
|
|
- "NV-xb_oOPutXLVge0ZnBxct_nNxS1j1XNCMtfp2c8zw",
|
|
|
- "70xngszQ62NWHbbCjbggbz5-pvOu3Z8ttLbjfplJXLg",
|
|
|
- ],
|
|
|
+ tmplIds: ['NV-xb_oOPutXLVge0ZnBxct_nNxS1j1XNCMtfp2c8zw', '70xngszQ62NWHbbCjbggbz5-pvOu3Z8ttLbjfplJXLg'],
|
|
|
success(res) {
|
|
|
- console.log(res);
|
|
|
- Toast.success("授权成功");
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
+ console.log(res)
|
|
|
+ Toast.success("授权成功")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
wx.login({
|
|
|
success(res) {
|
|
|
console.log(res);
|
|
|
- },
|
|
|
- });
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
onShow() {
|
|
|
userDetail().then((res) => {
|
|
|
- let $data = res.data;
|
|
|
+ let $data = res.data
|
|
|
//判断如果是第一次登录就 弹出领取体验卡
|
|
|
- $this.userinfo = $data.data;
|
|
|
- user_store.setters.set_userinfo($this.userinfo);
|
|
|
- });
|
|
|
+ $this.userinfo = $data.data
|
|
|
+ user_store.setters.set_userinfo($this.userinfo)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onHide() {
|
|
|
},
|
|
|
- onHide() {},
|
|
|
onLoad($option) {
|
|
|
- // if (process.env.NODE_ENV == 'development') {
|
|
|
- // wx.setStorageSync('token', '7MZYqpAWOdw8WDxsgUV5QkQnKfrU5L_7')
|
|
|
- // }
|
|
|
+ if (process.env.NODE_ENV == 'development') {
|
|
|
+ wx.setStorageSync('token', '7MZYqpAWOdw8WDxsgUV5QkQnKfrU5L_7')
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(game_store.getters.getGameAttMedDatas())
|
|
|
+ console.log(game_store.getters.getPlayedTime())
|
|
|
+ console.log(
|
|
|
+ "游戏状态:" + game_store.getters.getGameStatus(),
|
|
|
+
|
|
|
+ "游戏记录id:" + game_store.getters.getGameRecordId()
|
|
|
+ )
|
|
|
+ if (game_store.getters.getGameStatus() == 1) {
|
|
|
+ // Dialog.confirm({
|
|
|
+ // title: '系统提示',
|
|
|
+ // message: '您上一个游戏尚未结束,是否继续?',
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // Toast.success('是')
|
|
|
+ // })
|
|
|
+ // .catch(() => {
|
|
|
+ // //添加数据,结束游戏
|
|
|
+ // Toast.fail('否')
|
|
|
+ // post_data(game_store.getters.getGameAttMedDatas())
|
|
|
+ // });
|
|
|
+ Dialog.alert({
|
|
|
+ title: '系统提示',
|
|
|
+ message: '正在结束上一个游戏',
|
|
|
+ }).then(() => {
|
|
|
+ post_data(game_store.getters.getGameAttMedDatas())
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 判断存储是否登录
|
|
|
- let $token = wx.getStorageSync("token");
|
|
|
+ let $token = wx.getStorageSync('token')
|
|
|
if ($token) {
|
|
|
- user_store.setters.set_token($token);
|
|
|
- user_store.setters.set_login(true);
|
|
|
- this.is_login = user_store.getters.get_login_status();
|
|
|
+ user_store.setters.set_token($token)
|
|
|
+ user_store.setters.set_login(true)
|
|
|
+ this.is_login = user_store.getters.get_login_status()
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- $this = this;
|
|
|
- },
|
|
|
- //发送给朋友
|
|
|
- onShareAppMessage() {},
|
|
|
-};
|
|
|
+ $this = this
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -252,4 +255,5 @@ export default {
|
|
|
position: relative;
|
|
|
z-index: 5;
|
|
|
}
|
|
|
+
|
|
|
</style>
|