添加微信手机号授权登录

This commit is contained in:
qiaocl 2025-03-25 09:18:11 +08:00
parent 213a31de4d
commit 1c5f79f32e
74 changed files with 97 additions and 94 deletions

View File

@ -53,6 +53,7 @@
<text>注册</text> <text>注册</text>
</view> </view>
</view> </view>
<!-- #ifdef MP-WEIXIN -->
<view class="wxbtn"> <view class="wxbtn">
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="value==1"> <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="value==1">
<view> <view>
@ -67,6 +68,7 @@
<text>手机号快捷登录</text> <text>手机号快捷登录</text>
</button> </button>
</view> </view>
<!-- #endif -->
</view> </view>
</template> </template>
@ -82,10 +84,13 @@
second: 60, second: 60,
value: 0, value: 0,
isCode: true, isCode: true,
loginCode: ""
} }
}, },
onLoad() { onLoad() {
// #ifdef MP-WEIXIN
this.login() this.login()
// #endif
}, },
methods: { methods: {
// //
@ -181,15 +186,7 @@
success(res) { success(res) {
if (res.code) { if (res.code) {
if (res.errMsg = "login:ok") { if (res.errMsg = "login:ok") {
that.$model.onlogin({ that.loginCode = res.code
code: res.code,
userid: ""
}).then(res => {
if (res.code == 2) {
that.sessionid = res.data.sessionid
return
}
}).catch(e => {})
} }
} }
} }
@ -199,8 +196,8 @@
getPhoneNumber(res) { getPhoneNumber(res) {
const that = this const that = this
if (res.detail.errMsg == 'getPhoneNumber:ok') { if (res.detail.errMsg == 'getPhoneNumber:ok') {
this.$model.getregister({ this.$model.getRegisterPhone({
sessionId: uni.getStorageSync('sessionid'), code: that.loginCode,
encryptedData: res.detail.encryptedData, encryptedData: res.detail.encryptedData,
iv: res.detail.iv, iv: res.detail.iv,
}).then(res => { }).then(res => {

View File

@ -18,6 +18,11 @@ export default {
return res return res
}) })
}, },
getRegisterPhone(param) { // 手机号快捷登录
return http.post("/wechat_quick_login", param).then(res => {
return res
})
},
getdeleteAccount(param) { // 删除用户 getdeleteAccount(param) { // 删除用户
return http.post("/delete_account", param).then(res => { return http.post("/delete_account", param).then(res => {
return res return res

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29654,7 +29654,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ./node_modules/css-loader/dist/runtime/api.js */ 13); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ./node_modules/css-loader/dist/runtime/api.js */ 13);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, "@charset \"UTF-8\";\n/* 主题色 */\n.bg[data-v-942944ba] {\n position: absolute;\n top: 0;\n width: 100%;\n height: 50vh;\n z-index: 9;\n background: #37cc92;\n}\n.top[data-v-942944ba] {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n position: relative;\n top: 70px;\n z-index: 99;\n margin-bottom: 15px;\n}\n.top uni-image[data-v-942944ba] {\n width: 70px;\n height: 70px;\n margin: auto;\n margin-bottom: 10px;\n border-radius: 50%;\n}\n.top uni-text[data-v-942944ba] {\n color: #fff;\n display: block;\n width: 100%;\n font-size: 18px;\n text-align: center;\n font-weight: bold;\n}\n.login[data-v-942944ba] {\n width: 86%;\n height: auto;\n background: #fff;\n border-radius: 10px;\n padding: 10px 0;\n background-color: #fff;\n z-index: 99;\n position: absolute;\n left: 7%;\n top: 28%;\n box-shadow: 0px 1px 5px 2px #dfe2e1fc;\n}\n.login .title[data-v-942944ba] {\n text-align: left;\n color: #333;\n font-size: 40rpx;\n font-weight: bold;\n margin-bottom: 15px;\n margin-left: 15px;\n}\n.login .toggle[data-v-942944ba] {\n position: absolute;\n right: 15px;\n top: 20px;\n}\n.login .editem[data-v-942944ba] {\n position: relative;\n display: flex;\n align-items: center;\n font-size: 32rpx;\n margin: 0 15px;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n.login .editem .item[data-v-942944ba] {\n width: 100%;\n margin-bottom: 15px;\n}\n.login .editem .item .text[data-v-942944ba] {\n font-size: 32rpx;\n margin-bottom: 10px;\n}\n.login .editem .item .input[data-v-942944ba] {\n height: 35px;\n line-height: 35px;\n display: flex;\n position: relative;\n border: #dfdfdf 1px solid;\n padding: 0 10px;\n border-radius: 5px;\n}\n.login .editem .item uni-input[data-v-942944ba] {\n height: 40px;\n line-height: 40px;\n position: absolute;\n left: 10px;\n right: 0px;\n z-index: 88;\n font-size: 32rpx;\n}\n.login .editem .item .yanzhengma uni-input[data-v-942944ba] {\n right: 240rpx;\n font-size: 32rpx;\n}\n.login .editem .code[data-v-942944ba] {\n width: 220rpx;\n background: #dfdfdf;\n font-size: 28rpx;\n margin: 0;\n line-height: 40px;\n border-radius: 5px;\n text-align: center;\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n z-index: 99;\n}\n.login .editem .forget[data-v-942944ba] {\n width: 100%;\n font-size: 28rpx !important;\n background: #fff;\n color: #37cc92;\n text-align: right;\n}\n.login .editem .forget uni-text[data-v-942944ba] {\n width: 100px;\n text-align: right;\n}\n.login .btngroup[data-v-942944ba] {\n height: 35px;\n line-height: 35px;\n display: flex;\n margin: 0 15px;\n justify-content: center;\n}\n.login .btngroup uni-text[data-v-942944ba] {\n display: block;\n color: #37cc92;\n}\n.login .btnlogin[data-v-942944ba] {\n width: calc(100% - 30px);\n margin: 15px;\n height: 42px;\n line-height: 42px;\n background: #fea606;\n font-weight: 700;\n border-radius: 15px;\n text-align: center;\n color: #fff !important;\n}\n.xieyi[data-v-942944ba] {\n font-size: 32rpx;\n color: #37cc92;\n margin-left: 10px;\n}\n.xieyi uni-text[data-v-942944ba] {\n border-bottom: 1px solid #37cc92;\n}\n.content[data-v-942944ba] {\n width: 100%;\n height: 100vh;\n}\n.xieyi[data-v-942944ba] {\n font-size: 28rpx;\n color: #999;\n margin-left: 10px;\n}\n.xieyi uni-text[data-v-942944ba] {\n color: #37cc92;\n}\n.href[data-v-942944ba] {\n width: auto;\n}\n", ""]); exports.push([module.i, "@charset \"UTF-8\";\n/* 主题色 */\n.bg[data-v-942944ba] {\n position: absolute;\n top: 0;\n width: 100%;\n height: 50vh;\n z-index: 9;\n background: #37cc92;\n}\n.top[data-v-942944ba] {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n position: relative;\n top: 70px;\n z-index: 99;\n margin-bottom: 15px;\n}\n.top uni-image[data-v-942944ba] {\n width: 70px;\n height: 70px;\n margin: auto;\n border-radius: 50%;\n}\n.top uni-text[data-v-942944ba] {\n color: #fff;\n display: block;\n width: 100%;\n font-size: 18px;\n text-align: center;\n font-weight: bold;\n}\n.login[data-v-942944ba] {\n width: 86%;\n height: auto;\n background: #fff;\n border-radius: 10px;\n padding: 10px 0;\n background-color: #fff;\n z-index: 99;\n position: absolute;\n left: 7%;\n top: 27%;\n box-shadow: 0px 1px 5px 2px #dfe2e1fc;\n}\n.login .title[data-v-942944ba] {\n text-align: left;\n color: #333;\n font-size: 40rpx;\n font-weight: bold;\n margin-bottom: 15px;\n margin-left: 15px;\n}\n.login .toggle[data-v-942944ba] {\n position: absolute;\n right: 15px;\n top: 20px;\n}\n.login .editem[data-v-942944ba] {\n position: relative;\n display: flex;\n align-items: center;\n font-size: 32rpx;\n margin: 0 15px;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n.login .editem .item[data-v-942944ba] {\n width: 100%;\n margin-bottom: 15px;\n}\n.login .editem .item .text[data-v-942944ba] {\n font-size: 32rpx;\n margin-bottom: 10px;\n}\n.login .editem .item .input[data-v-942944ba] {\n height: 35px;\n line-height: 35px;\n display: flex;\n position: relative;\n border: #dfdfdf 1px solid;\n padding: 0 10px;\n border-radius: 5px;\n}\n.login .editem .item uni-input[data-v-942944ba] {\n height: 40px;\n line-height: 40px;\n position: absolute;\n left: 10px;\n right: 0px;\n z-index: 88;\n font-size: 32rpx;\n}\n.login .editem .item .yanzhengma uni-input[data-v-942944ba] {\n right: 240rpx;\n font-size: 32rpx;\n}\n.login .editem .code[data-v-942944ba] {\n width: 220rpx;\n background: #dfdfdf;\n font-size: 28rpx;\n margin: 0;\n line-height: 40px;\n border-radius: 5px;\n text-align: center;\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n z-index: 99;\n}\n.login .editem .forget[data-v-942944ba] {\n width: 100%;\n font-size: 28rpx !important;\n background: #fff;\n color: #37cc92;\n text-align: right;\n}\n.login .editem .forget uni-text[data-v-942944ba] {\n width: 100px;\n text-align: right;\n}\n.login .btngroup[data-v-942944ba] {\n height: 35px;\n line-height: 35px;\n display: flex;\n margin: 0 15px;\n justify-content: center;\n}\n.login .btngroup uni-text[data-v-942944ba] {\n display: block;\n color: #37cc92;\n}\n.login .btnlogin[data-v-942944ba] {\n width: calc(100% - 30px);\n margin: 15px;\n height: 42px;\n line-height: 42px;\n background: #fea606;\n font-weight: 700;\n border-radius: 15px;\n text-align: center;\n color: #fff !important;\n}\n.xieyi[data-v-942944ba] {\n font-size: 32rpx;\n color: #37cc92;\n margin-left: 10px;\n}\n.xieyi uni-text[data-v-942944ba] {\n border-bottom: 1px solid #37cc92;\n}\n.content[data-v-942944ba] {\n width: 100%;\n height: 100vh;\n}\n.xieyi[data-v-942944ba] {\n font-size: 28rpx;\n color: #999;\n margin-left: 10px;\n}\n.xieyi uni-text[data-v-942944ba] {\n color: #37cc92;\n}\n.href[data-v-942944ba] {\n width: auto;\n}\n.wxbtn[data-v-942944ba] {\n width: 100%;\n position: absolute;\n margin-top: 30px;\n top: 80%;\n}\n.wxbtn uni-icon[data-v-942944ba] {\n font-size: 25px;\n color: #28c445;\n}\n.wxbtn uni-text[data-v-942944ba] {\n display: block;\n margin-top: 5px;\n font-size: 12px;\n text-align: center;\n border-bottom: 1px solid blue;\n color: blue;\n}\n.wxbtn uni-button[data-v-942944ba] {\n line-height: initial;\n background: #fff;\n display: flex;\n flex-wrap: wrap;\n padding: 0;\n justify-content: center;\n}\n.wxbtn uni-button[data-v-942944ba]::after {\n display: none;\n}\n.wxbtn uni-view[data-v-942944ba] {\n width: 100%;\n}\n.wxbtn uni-image[data-v-942944ba] {\n width: 30px;\n height: 30px;\n border-radius: 50%;\n}\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -11211,6 +11211,12 @@ var _default = {
return res; return res;
}); });
}, },
getRegisterPhone: function getRegisterPhone(param) {
// 手机号快捷登录
return _https.default.post("/wechat_quick_login", param).then(function (res) {
return res;
});
},
getdeleteAccount: function getdeleteAccount(param) { getdeleteAccount: function getdeleteAccount(param) {
// 删除用户 // 删除用户
return _https.default.post("/delete_account", param).then(function (res) { return _https.default.post("/delete_account", param).then(function (res) {

View File

@ -214,6 +214,8 @@ exports.default = void 0;
// //
// //
// //
//
//
var _default = { var _default = {
data: function data() { data: function data() {
return { return {
@ -223,7 +225,8 @@ var _default = {
disabled: false, disabled: false,
second: 60, second: 60,
value: 0, value: 0,
isCode: true isCode: true,
loginCode: ""
}; };
}, },
onLoad: function onLoad() { onLoad: function onLoad() {
@ -323,15 +326,7 @@ var _default = {
success: function success(res) { success: function success(res) {
if (res.code) { if (res.code) {
if (res.errMsg = "login:ok") { if (res.errMsg = "login:ok") {
that.$model.onlogin({ that.loginCode = res.code;
code: res.code,
userid: ""
}).then(function (res) {
if (res.code == 2) {
that.sessionid = res.data.sessionid;
return;
}
}).catch(function (e) {});
} }
} }
} }
@ -341,8 +336,8 @@ var _default = {
getPhoneNumber: function getPhoneNumber(res) { getPhoneNumber: function getPhoneNumber(res) {
var that = this; var that = this;
if (res.detail.errMsg == 'getPhoneNumber:ok') { if (res.detail.errMsg == 'getPhoneNumber:ok') {
this.$model.getregister({ this.$model.getRegisterPhone({
sessionId: uni.getStorageSync('sessionid'), code: that.loginCode,
encryptedData: res.detail.encryptedData, encryptedData: res.detail.encryptedData,
iv: res.detail.iv iv: res.detail.iv
}).then(function (res) { }).then(function (res) {