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() { checkLogin() {
if (!getToken()) { if (!getToken()) {
this.$tab.reLaunch('/pages/login') this.$tab.reLaunch('pages/loginInfo/login')
} }
} }
} }

View File

@ -4,8 +4,10 @@
<view class="flex justify-center"> <view class="flex justify-center">
<text class="text-[36rpx] text-[#8f8f94]">Hello RuoYi</text> <text class="text-[36rpx] text-[#8f8f94]">Hello RuoYi</text>
<button @click="csqq"></button> <button @click="csqq"></button>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
@ -33,6 +35,8 @@ const form = ref({});
}) })
} }
</script> </script>
<style></style> <style></style>

View File

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

View File

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