|
|
@@ -25,14 +25,8 @@
|
|
|
<script>
|
|
|
import tools from "@/service/tools";
|
|
|
import {
|
|
|
- commonRegisterSms
|
|
|
- } from '@/api/common.js';
|
|
|
- import {
|
|
|
- membeRphoneLogin
|
|
|
+ appletLogin
|
|
|
} from "@/api/member";
|
|
|
- import {
|
|
|
- getAgreement
|
|
|
- } from "@/api/common.js";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -54,11 +48,40 @@
|
|
|
agreementData: []
|
|
|
};
|
|
|
},
|
|
|
+ onShow() {},
|
|
|
onLoad(data) {
|
|
|
- console.log(data);
|
|
|
+ console.log('00000');
|
|
|
+ uni.setStorageSync('shop_id', 111)
|
|
|
+ uni.setStorageSync('table_number', 1)
|
|
|
+ this.firstLogin()
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ firstLogin() {
|
|
|
+ tools.showLoading()
|
|
|
+ uni.login({
|
|
|
+ provider: "weixin",
|
|
|
+ success: (loginRes) => {
|
|
|
+ this.appletLogin(loginRes.code);
|
|
|
+ },
|
|
|
+ fail: (loginRes) => {
|
|
|
+ this.isAjax = false;
|
|
|
+ tools.error("获取授权信息失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ appletLogin(code) {
|
|
|
+ appletLogin({
|
|
|
+ 'code': code
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 1) {
|
|
|
+ uni.setStorageSync('token', res.data.token)
|
|
|
+ uni.setStorageSync('m_id', res.data.m_id)
|
|
|
+ tools.hideLoading()
|
|
|
+ // this.goToUrl()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
refuse() {
|
|
|
// #ifdef MP-WEIXIN
|
|
|
// 微信小程序平台
|
|
|
@@ -80,16 +103,12 @@
|
|
|
// url: "/pages/index/index",
|
|
|
// });
|
|
|
// return
|
|
|
+ console.log('11111111111111');
|
|
|
if (this.isAjax) {
|
|
|
return false;
|
|
|
}
|
|
|
- this.isAjax = true;
|
|
|
- uni.switchTab({
|
|
|
- url: "/pages/index/index",
|
|
|
- });
|
|
|
- },
|
|
|
- noLogin() {
|
|
|
- uni.switchTab({
|
|
|
+ this.isAjax = false;
|
|
|
+ uni.reLaunch({
|
|
|
url: "/pages/index/index",
|
|
|
});
|
|
|
}
|