11.28前端

This commit is contained in:
@QQNZX 2023-11-28 17:27:10 +08:00
parent dea95896c2
commit 3ffad8c89e

View File

@ -0,0 +1,145 @@
<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">登录</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<u-button text="手机号快捷登录" class="dl" :customStyle="{color:'#ffffff'}" color="#0D2E8D"
open-type='getPhoneNumber' @getphonenumber="getPhone"></u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: '',
baseUrl: this.$baseUrl,
}
},
onLoad() {
console.log(this.$baseUrl);
},
components: {
},
methods: {
wxlogin() {
},
getPhone(e) {
let that = this
// if (this.privacyPolicyChecked == false) {
// uni.showToast({
// icon: "none",
// title: "",
// duration: 2000
// })
// return;
// }
uni.login({
provider: 'weixin',
success(res) {
if (res.code) {
uni.setStorageSync('c1', res.code);
console.log('weixin', res.code);
} else {
console.log('登录失败!' + res.errMsg)
}
console.log(e);
uni.checkSession({
success: () => {
uni.request({
url: that.baseUrl + "clientApi/sign/mpWxLogin",
method: "POST",
data: {
code: uni.getStorageSync('c1'),
encryptedIv: e.detail.iv,
encryptedData: e.detail.encryptedData,
userInfo: {
storeId: "",
staffId: "",
},
type: 'phone',
inviteId: uni.getStorageSync('inviteId') ? uni
.getStorageSync(
'inviteId') : null
},
success: (rex) => {
console.log('请求成功', rex)
},
fail: (res) => {
console.log("fail", res);
uni.showToast({
icon: "error",
title: "登录失败,请重新点击并授权!",
duration: 2000
})
}
})
},
fail: () => {
uni.showToast({
icon: 'error',
duration: 2000,
title: "登录状态过期,重新登录"
});
}
})
}
})
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 99999;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
</style>