| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 | <template>	<view class="content">		<view class="title">			<text class="thing" style="width: 100rpx;"></text>			<text class="name">用户登录</text>			<text class="thing" style="width: 300rpx;"></text>		</view>		<view class="form-box">			<view class="row-input">				<u-icon name="account" color="#2979ff" size="50" style="padding: 0 20rpx;"></u-icon>				<input v-model="account" placeholder="请输入用户账号" maxlength="18" />			</view>			<view class="row-input">				<u-icon name="lock" color="#2979ff" size="50" style="padding: 0 20rpx;"></u-icon>				<input v-model="password" placeholder="登陆密码" :password="!isShowPassword" />				<u-icon name="eye-fill" color="#2979ff" size="50" style="padding-right:20rpx" v-if="isShowPassword"					@click="showOrHide"></u-icon>				<u-icon name="eye-off" color="#2979ff" size="50" style="padding-right:0rpx" v-else @click="showOrHide">				</u-icon>			</view>			<!-- <view class="rowinputcaptcha">				<u-icon name="hourglass" color="#2979ff" size="50" style="padding: 0 20rpx;"></u-icon>				<input class="captchainput" v-model="captcha"  placeholder="验证码"/>							<u--image :showLoading="true" :src="captchaPath" width="150px" height="35px" @click="getCaptcha"></u--image>							</view> -->			<view class="menu-link">				<text @click="forget">找回密码</text>			</view>			<view class="login-btn" @click="loginbtn">登录</view>			<view class="tip-link">				还没有账号?<text @click="register">注册</text>			</view>		</view>		<u-toast ref="uToast" />	</view></template><script>	// function getUUID() {	//   return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {	//     return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)	//   })	// }	//const BaseApi= require("@/http/baseApi.js");	export default {		data() {			return {				isShowPassword: true,				account: 'admin',				password: 'cx868688',				captcha: '',				uuid: '',				captchaPath: '',			}		},		onLoad() {			//	 this.getCaptcha(); 		},		methods: {			// 获取验证码			  			//  getCaptcha() {			//    this.uuid = getUUID();			// this.captchaPath =BaseApi.BaseApi+ `/captcha?uuid=${this.uuid}`; 			//  },			loginbtn() {				if (this.account == '') {					this.$refs.uToast.show({						type: 'error',						message: "请输入账号",					})					// uni.showToast({					// 	title: "请输入账号",					// 	icon:'error',					// 	duration: 1000,					// })				} else if (this.password == '') {					this.$refs.uToast.show({						type: 'error',						message: "请输入密码",					})				}				let formData = {					username: this.account,					password: this.password,					// uuid:this.uuid,					// captcha:this.captcha,				}				//登录功能				this.$api.post('/login', formData)					.then(res => {						if (res.data.code == 0) {							uni.setStorageSync('tokendata', res.data.data.token); //token							uni.setStorageSync('Userinformation', formData); //用户信息							//获取用户权限功能							// 					 this.$api.get('/sys/menu/permissions',{})							// 					 .then(res1=>{							// 					 	uni.setStorageSync('ButtonPermissions', res1.data.data);//权限列表							// 						uni.switchTab({							// 							url: '/pages/index/index',							// 							success:res=>{},							// 							fail:()=>{},							// 							complete:()=>{},							// 						})							// 					 })													Promise.all([this.getpermissions(), this.getDictList()]).then(() => {								uni.switchTab({									url: '/pages/index/index',									success: res => {},									fail: () => {},									complete: () => {},								})							});						} else {							this.$refs.uToast.show({								type: 'error',								message: "账号或者密码错误,请重新输入",							})						}					})			},			getpermissions() {				  console.log('权限功能',)				//获取用户权限功能				// 					 this.$api.get('/sys/menu/permissions',{})				// 					 .then(res1=>{				// 					 	uni.setStorageSync('ButtonPermissions', res1.data.data);//权限列表				// 										// 					 })			},			getDictList() {//获取字典列表, 添加并全局变量保存									 this.$api.get('/all',{})									 .then(res=>{										 //  console.log('88888', res.data.data)									 	uni.setStorageSync('getDictDataList', res.data.data);																			 })			},			// 密码显示/密码隐藏			showOrHide() {				this.isShowPassword = !this.isShowPassword			},			// 找回密码			forget() {				uni.navigateTo({					url: '/pages/login/forget',					success: res => {},					fail: () => {},					complete: () => {},				})			},			// 注册			register() {				uni.navigateTo({					url: '/pages/login/register',					success: res => {},					fail: () => {},					complete: () => {},				})			}		}	}</script><style lang="scss">	page {		background-color: #0b0c14;	}	.content {		padding: 100rpx 40rpx;	}	.title {		display: flex;		flex-direction: column;		height: 200rpx;		.thing {			height: 8rpx;			background-image: linear-gradient(to right, #3feaea, #0168e6);		}		.name {			font-weight: bold;			font-size: 50rpx;			line-height: 120rpx;			background: linear-gradient(to right, #3feaea, blue);			background-clip: text;			color: transparent;			letter-spacing: 5rpx;		}	}	.form-box {		.rowinputcaptcha {			display: flex;			justify-content: flex-start;			align-items: center;			height: 110rpx;			//background-color: #2b2f41;			border-radius: 8rpx;			margin-bottom: 50rpx;			input {				width: 300rpx;				font-size: 30rpx;				color: #a1a2a3;			}		}		.row-input {			display: flex;			justify-content: flex-start;			align-items: center;			height: 110rpx;			background-color: #2b2f41;			border-radius: 8rpx;			margin-bottom: 50rpx;			image {				margin: 0 30rpx;				flex-shrink: 0;				width: 38rpx;				height: 38rpx;			}			input {				width: 460rpx;				font-size: 30rpx;				color: #a1a2a3;			}		}		.menu-link {			display: flex;			justify-content: flex-end;			align-items: center;			font-size: 28rpx;			color: #676c7f;		}		.login-btn {			margin-top: 60rpx;			display: flex;			justify-content: center;			align-items: center;			font-size: 35rpx;			letter-spacing: 15rpx;			color: #FFFFFF;			height: 110rpx;			border-radius: 8rpx;			background-image: linear-gradient(to right, #3feaea, #0168e6);		}		.tip-link {			position: fixed;			letter-spacing: 4rpx;			bottom: 50rpx;			left: 40rpx;			font-size: 28rpx;			color: #a1a2a3;			text {				padding-left: 10rpx;				color: #226ef0;			}		}	}	.captchainput {		width: 300rpx;	}</style>
 |