26947 2024-05-04 21:10:22 +08:00
parent 2ac5348326
commit 215c3c66ae
4 changed files with 37 additions and 18 deletions

View File

@ -22,7 +22,7 @@
},
checkLogin() {
if (!getToken()) {
this.$tab.reLaunch('/pages/login')
this.$tab.reLaunch('pages/loginInfo/login')
}
}
}

View File

@ -4,8 +4,10 @@
<view class="flex justify-center">
<text class="text-[36rpx] text-[#8f8f94]">Hello RuoYi</text>
<button @click="csqq"></button>
</view>
</view>
</template>
<script setup>
@ -13,7 +15,7 @@ import { ref, getCurrentInstance } from 'vue';
import { updateOuathinfo } from "@/api/system/logins";
const { proxy } = getCurrentInstance();
const form = ref({});
const csqq = () => {
const csqq = () => {
form.value = {
id: 7,
userId: 1,
@ -33,6 +35,8 @@ const form = ref({});
})
}
</script>
<style></style>

View File

@ -1,13 +1,19 @@
<template>
<div>
<button @click="wxLogin"></button>
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
<button @click="wxLogin" v-if="type == 'mp-weixin'"></button>
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="type == 'mp-weixin'"></button>
<button @click="wxLogins" v-if="type == 'app'"></button>
<div>
<uni-easyinput prefixIcon="search" v-model="phone" placeholder="手机号">
</uni-easyinput>
<uni-easyinput prefixIcon="search" v-model="phoneCode" placeholder="验证码">
</uni-easyinput>
<view class="u-demo-block__content">
<up-input
placeholder="请输入手机号"
v-model="phone"
border="surround"
type="number"
clearable
></up-input>
</view>
<up-code-input v-model="phoneCode" mode="line"></up-code-input>
<button @click="phoneLoginCode" v-if="!isCounting"></button>
<button disabled v-else>{{ countDown }}</button>
<button @click="PhoneCodeLoginInfo"></button>
@ -22,12 +28,10 @@ import { useRouter } from 'vue-router'
import { ref, getCurrentInstance } from 'vue';
import { getPhoneCode, PhoneCodeLogin } from "@/api/system/logins";
const { proxy } = getCurrentInstance();
const phone = ref('')
const phone = ref()
const phoneCode = ref('')
const type = ref("");
function getPlat() {
type.value = uni.getSystemInfoSync().uniPlatform
}
const wxXCode = ref('')
const wxLogin = async () => {
uni.login({
@ -77,8 +81,8 @@ const phoneLogin = () => {
}
getPlat();
//wxLogin();
const countDown = ref(60);
const isCounting = ref(false);
const phoneLoginCode = async () => {
@ -126,7 +130,7 @@ const PhoneCodeLoginInfo = async () => {
try {
await store.dispatch('loginByPhoneCode', data).then(res => {
uni.hideLoading()
})
await loginSuccess()
} catch (error) {
@ -140,7 +144,18 @@ function validatePhoneNumber(phoneNumber) {
return regex.test(phoneNumber);
}
function getPlat() {
type.value = uni.getSystemInfoSync().uniPlatform
console.log("当前环境是:",type.value);
if(type.value == "mp-weixin"){
wxLogin();
}
}
getPlat();
</script>
<style lang="scss"></style>
<style lang="scss">
.wrap {
padding: 24rpx;
}
</style>

View File

@ -50,7 +50,7 @@
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/loginInfo/login')
this.$tab.reLaunch('/')
})
})
}