|
@@ -58,7 +58,11 @@
|
|
<uni-easyinput type="password" placeholder="请输入密码" v-model="state.account.password" :inputBorder="false"></uni-easyinput>
|
|
<uni-easyinput type="password" placeholder="请输入密码" v-model="state.account.password" :inputBorder="false"></uni-easyinput>
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
</uni-forms>
|
|
</uni-forms>
|
|
- <view class="register" @tap="handleChangeRegister">还没有登录账户?去注册</view>
|
|
|
|
|
|
+ <view class="quickLogon">
|
|
|
|
+ <button v-if="showWxLogon" class="wxLogon" type="text" :plain="true" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信登录</button>
|
|
|
|
+ <view v-else></view>
|
|
|
|
+ <view class="register" @tap="handleChangeRegister">还没有登录账户?去注册</view>
|
|
|
|
+ </view>
|
|
<button class="send-button" @tap="handleLogin"> 登 录 </button>
|
|
<button class="send-button" @tap="handleLogin"> 登 录 </button>
|
|
<view class="agreement-box ss-flex ss-row-center">
|
|
<view class="agreement-box ss-flex ss-row-center">
|
|
<uni-icons size="20" :type="protocol ? 'checkbox-filled' : 'circle'" :color="protocol ? '#00897B' : '#ccc'" @tap="protocol = !protocol"></uni-icons>
|
|
<uni-icons size="20" :type="protocol ? 'checkbox-filled' : 'circle'" :color="protocol ? '#00897B' : '#ccc'" @tap="protocol = !protocol"></uni-icons>
|
|
@@ -228,6 +232,29 @@ function handleChangeLogin () {
|
|
changeType.value = 'login'
|
|
changeType.value = 'login'
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const showWxLogon = false
|
|
|
|
+// 微信登录
|
|
|
|
+const getPhoneNumber = async (e) => {
|
|
|
|
+ if (!protocol.value) return await uni.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
|
|
|
|
+ if (e?.detail?.errMsg !== 'getPhoneNumber:ok') {
|
|
|
|
+ uni.showToast({ title: '微信登录失败', icon: 'none' })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ changeType.value = 'login'
|
|
|
|
+ wx.login({
|
|
|
|
+ success: async (result) => {
|
|
|
|
+ const wxLoginCode = result?.code || ''
|
|
|
|
+ const query = {
|
|
|
|
+ wxLoginCode,
|
|
|
|
+ iv: e.detail.iv,
|
|
|
|
+ encryptedData: e.detail.encryptedData,
|
|
|
|
+ }
|
|
|
|
+ await useUserStore.handleSmsLogin(query, current.value === 0)
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=> { console.log("获取登录凭证code失败!", res) }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
async function handleRegister () {
|
|
async function handleRegister () {
|
|
const validate = await unref(registerForm).validate()
|
|
const validate = await unref(registerForm).validate()
|
|
if (!validate) return
|
|
if (!validate) return
|
|
@@ -271,11 +298,24 @@ const handleLogin = async () => {
|
|
color: #00897B;
|
|
color: #00897B;
|
|
margin-top: 30rpx;
|
|
margin-top: 30rpx;
|
|
}
|
|
}
|
|
|
|
+.quickLogon {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ padding: 0 20rpx;
|
|
|
|
+ align-items: center;
|
|
|
|
+}
|
|
|
|
+.wxLogon {
|
|
|
|
+ font-size: .85em;
|
|
|
|
+ color: #00897B;
|
|
|
|
+ border: none;
|
|
|
|
+ margin: 0;
|
|
|
|
+ padding: 0;
|
|
|
|
+}
|
|
.register {
|
|
.register {
|
|
widows: 100%;
|
|
widows: 100%;
|
|
font-size: .85em;
|
|
font-size: .85em;
|
|
color: red;
|
|
color: red;
|
|
- text-align: right;
|
|
|
|
|
|
+ // text-align: right;
|
|
&.login {
|
|
&.login {
|
|
color: #00897B;
|
|
color: #00897B;
|
|
}
|
|
}
|