12.12 页面风格改版,增加事件详情相关概念网页跳转,增加绑定手机号功能
This commit is contained in:
105
unpackage/dist/dev/mp-weixin/pages/login/login.js
vendored
105
unpackage/dist/dev/mp-weixin/pages/login/login.js
vendored
@@ -6,13 +6,63 @@ const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
contentTop: "",
|
||||
isAgree: false
|
||||
isAgree: false,
|
||||
isBindPhone: true
|
||||
//是否绑定过手机号
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.contentTop = common_vendor.inject("navHeight") + 230 / 750 * common_vendor.inject("windowWidth");
|
||||
this.getIsBindPhoneData();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取手机号
|
||||
* @param {Object} e
|
||||
*/
|
||||
getPhoneNumData(e) {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:44", e);
|
||||
if (e.detail.errMsg == "getPhoneNumber:ok") {
|
||||
common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
success(res) {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:49", res.code);
|
||||
let param = { code: res.code, isJson: 1 };
|
||||
request_api.loginByWx(param).then((res2) => {
|
||||
if (res2.code == 200) {
|
||||
let token = res2.data.token;
|
||||
common_vendor.index.setStorageSync("token", token);
|
||||
let param2 = { code: e.detail.code };
|
||||
request_api.wxBindPhone(param2).then((res3) => {
|
||||
if (res3.code == 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: res3.message
|
||||
});
|
||||
setTimeout(function() {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/index/index"
|
||||
});
|
||||
}, 1e3);
|
||||
} else
|
||||
common_vendor.index.showToast({
|
||||
title: res3.message,
|
||||
icon: "none"
|
||||
});
|
||||
}).catch((error) => {
|
||||
});
|
||||
} else
|
||||
common_vendor.index.showToast({
|
||||
title: res2.message,
|
||||
icon: "none"
|
||||
});
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
fail() {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 点击一键登录
|
||||
*/
|
||||
@@ -27,14 +77,12 @@ const _sfc_main = {
|
||||
common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
success(res) {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:49", res.code);
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:106", res.code);
|
||||
let param = { code: res.code, isJson: 1 };
|
||||
request_api.loginByWx(param).then((res2) => {
|
||||
if (res2.code == 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: res2.message
|
||||
});
|
||||
common_vendor.index.setStorageSync("token", res2.data.token);
|
||||
let token = res2.data.token;
|
||||
common_vendor.index.setStorageSync("token", token);
|
||||
setTimeout(function() {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/index/index"
|
||||
@@ -73,6 +121,31 @@ const _sfc_main = {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/mine/web/web?type=" + type
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取是否绑定过手机号
|
||||
*/
|
||||
getIsBindPhoneData() {
|
||||
let that = this;
|
||||
common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
success(res) {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:166", res.code);
|
||||
let param = { code: res.code, isJson: 1 };
|
||||
request_api.loginByWx(param).then((res2) => {
|
||||
if (res2.code == 200) {
|
||||
that.isBindPhone = res2.data.user.phone ? true : false;
|
||||
} else
|
||||
common_vendor.index.showToast({
|
||||
title: res2.message,
|
||||
icon: "none"
|
||||
});
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
fail() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -93,17 +166,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
}),
|
||||
b: common_vendor.s("margin-top:" + $data.contentTop + "px;"),
|
||||
c: common_assets._imports_0$1,
|
||||
d: common_vendor.o(($event) => $options.clickOneClickLogin()),
|
||||
e: common_vendor.o(($event) => $options.clickCodeLogin()),
|
||||
f: $data.isAgree
|
||||
d: !$data.isBindPhone
|
||||
}, !$data.isBindPhone ? {
|
||||
e: common_vendor.o((...args) => $options.getPhoneNumData && $options.getPhoneNumData(...args))
|
||||
} : {}, {
|
||||
f: common_vendor.o(($event) => $data.isBindPhone ? $options.clickOneClickLogin() : ""),
|
||||
g: common_vendor.o(($event) => $options.clickCodeLogin()),
|
||||
h: $data.isAgree
|
||||
}, $data.isAgree ? {
|
||||
g: common_assets._imports_3$5
|
||||
i: common_assets._imports_3$5
|
||||
} : {
|
||||
h: common_assets._imports_4$4
|
||||
j: common_assets._imports_4$6
|
||||
}, {
|
||||
i: common_vendor.o(($event) => $options.clickAgree()),
|
||||
j: common_vendor.o(($event) => $options.clickProtocol(2)),
|
||||
k: common_vendor.o(($event) => $options.clickProtocol(3))
|
||||
k: common_vendor.o(($event) => $options.clickAgree()),
|
||||
l: common_vendor.o(($event) => $options.clickProtocol(2)),
|
||||
m: common_vendor.o(($event) => $options.clickProtocol(3))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
Reference in New Issue
Block a user