main
parent
2ac5348326
commit
215c3c66ae
2
App.vue
2
App.vue
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
checkLogin() {
|
||||
if (!getToken()) {
|
||||
this.$tab.reLaunch('/pages/login')
|
||||
this.$tab.reLaunch('pages/loginInfo/login')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
handleLogout() {
|
||||
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
this.$tab.reLaunch('/pages/loginInfo/login')
|
||||
this.$tab.reLaunch('/')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue