Files
crm-uni/pages/login/index.vue
T
2025-03-19 15:39:21 +08:00

238 lines
4.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page">
<view class="title">
<image src="/static/image/hesu.png" mode=""></image>
</view>
<view class="form">
<view class="inputs_button">
<view class="inputs">
<view class="account">
<input type="text" v-model="email" :placeholder="$t('account')" />
</view>
<view class="password">
<u--input
type="password"
:placeholder="$t('password')"
v-model="password"
border="none"
></u--input>
</view>
</view>
<view class="forgot-password">
<view @click="regin">{{$t('reg')}}</view>
<view @click="forgotPassword">{{$t('fgpassword')}}?</view>
</view>
<view class="button">
<view @click="login">
{{$t('login')}}
</view>
</view>
</view>
<view class="three">
<u-divider :text="$t('threelogin')" style="padding: 0px 40px;"></u-divider>
<u-grid :border="false" @click="click" align="center">
<u-grid-item>
<image src="/static/image/login/fenshu.png" mode=""></image>
<text class="grid-text">{{$t('Facebook')}}</text>
</u-grid-item>
<u-grid-item>
<image src="/static/image/login/emali.png" mode=""></image>
<text class="grid-text">{{$t('email')}}</text>
</u-grid-item>
<u-grid-item>
<image src="/static/image/login/phone.png" mode=""></image>
<text class="grid-text">{{$t('phone')}}</text>
</u-grid-item>
</u-grid>
</view>
</view>
<view class="pact">
<radio :checked="pactChecked" activeBackgroundColor="#3264ed" activeBorderColor="#3264ed"
borderColor="#3264ed" color="#fff" @click="pactChange" />
<view>{{$t('agreeMsg')}}<text @click="toPact">{{$t('UserAgreement')}}</text>{{$t('and')}}<text @click="toPact">{{$t('Privacy')}}</text></view>
</view>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
email: "1696136552@qq.com",
password: "123456",
pactChecked: false,
}
},
onLoad() {
},
methods: {
pactChange() {
this.pactChecked = !this.pactChecked
},
regin(){
uni.navigateTo({
url: '/pages/login/register'
})
},
forgotPassword(){
uni.navigateTo({
url: '/pages/mine/resetPwd'
})
},
login() {
if(this.email==''){
uni.showToast({
title:this.$t('emailerr'),
icon: 'none'
});
return false
}
if(this.password==''){
uni.showToast({
title:this.$t('passworerr'),
icon: 'none'
});
return false
}
if(!this.pactChecked){
uni.showToast({
title:this.$t('agreementarr'),
icon: 'none'
});
return false
}
request({
url:'user/login',
method:'POST',
data:{
email: this.email,
password: this.password,
}
}).then(res => {
console.log(res.data.data)
if (res.data.code == -1) {
uni.showToast({
title: res.data.message,
icon: 'none'
});token
} else if (res.data.code == 0) {
//存取session
uni.setStorageSync('token', res.data.data.token);
//返回数据接收成功
uni.reLaunch({
url: '/pages/index/index',// 替换为你要跳转的页面路径
});
}
})
},
toPact() {
uni.showToast({
title: "协议",
icon: 'none'
})
}
}
}
</script>
<style lang="scss" scoped>
.page {
min-height: 100vh;
background-image: url("../../static/image/login/loginbg.png");
background-size: 100%;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
padding-top: 220rpx;
text-align: center;
image{
width: 160px;
height: 37px;
}
}
.form {
flex: 1;
margin: 0 76rpx;
overflow: hidden;
.inputs_button {
.inputs {
padding: 150rpx 0px 0;
margin-bottom: 20rpx;
.account,
.password{
height: 80rpx;
border-radius: 50px;
padding: 0 48rpx;
display: flex;
align-items: center;
background-color: #F6F6F6;
input {
flex: 1;
}
}
.account {
margin-bottom: 48rpx;
}
}
.button {
padding: 0 32rpx;
view {
line-height: 80rpx;
border-radius: 50px;
text-align: center;
font-size: 32rpx;
background: linear-gradient(to right, #3471FF, #6776FF);
color: #fff;
}
}
}
.three{
margin: 40rpx 0px;
padding: 20rpx 40rpx;
image{
width: 100rpx;
height: 100rpx;
}
}
}
.forgot-password {
display: flex;
align-items: center;
justify-content:space-between;
// text-align: right;
margin-bottom: 20px;
}
.pact {
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
margin-bottom: 20px;
text {
color: #3264ed;
}
radio {
:deep(.uni-radio-input) {
border: 1rpx solid #3264ed;
}
transform:scale(0.6)
}
}
}
</style>