xiaohaizhao 2 anni fa
parent
commit
1137faf7e9

+ 4 - 5
pages/login/login.vue

@@ -2,17 +2,16 @@
 	<view class="container" style="background-image: url('../../static/login.gif');height:100vh;">
 		<view :style="{ height: height }" />
 		<view class="logo">
-			<u--image src="/static/logo.png" width="294rpx" height="94rpx" mode="scaleToFill">
+			<u--image src="/static/img/logo.png" width="294rpx" height="94rpx" mode="scaleToFill">
 				<template v-slot:loading>
 					<u-loading-icon color="red"></u-loading-icon>
 				</template>
 				<view slot="error" style="font-size: 24rpx;">加载失败</view>
 			</u--image>
 		</view>
-
 		<account v-show="loginMethod == 'account'" />
 		<phone v-show="loginMethod == 'phone'" />
-
+		<view style="height: 50rpx;" />
 		<other-login :loginMethod="loginMethod" @onChange="changeLoginMethod" />
 	</view>
 </template>
@@ -30,10 +29,10 @@ export default {
 	data() {
 		return {
 			loginMethod: "",
-			height: "",
+			height: ""
 		};
 	},
-	created() {
+	onLoad() {
 		this.loginMethod = uni.getStorageSync('loginMethod') || 'account';//登录方式
 		// #ifdef H5
 		this.height = "200rpx";

+ 22 - 16
pages/login/modules/account.vue

@@ -14,13 +14,10 @@
 			</label>
 			<navigator url="#">忘记密码?</navigator>
 		</view>
-		<view class="flex flex-direction" style="padding: 104rpx 100rpx; 0">
-			<button class="cu-btn bg-red margin-tb-sm lg" :loading='loading'
-				:disabled="account.account == '' || account.password == ''" @click="startLogging">{{ loading ? ' 登陆中' :
-					'登录' }}</button>
-		</view>
+		<u-button :customStyle="butSty" :disabled="account.account == '' || account.password == ''" :loading="loading" loadingText='登陆中...' text="确 定"
+			@click="startLogging" />
 	</view>
-</template>
+</view></template>
 
 <script>
 import { hexMD5 } from "./md5";
@@ -34,18 +31,32 @@ export default {
 			account: {
 				account: "",
 				password: ""
+			},
+			butSty: {
+				width: "550rpx",
+				height: "90rpx",
+				background: "#0A3971",
+				borderRadius: "8rpx",
+				opacity: "0.65",
+				borderWidth: 0,
+				fontSize: "32rpx",
+				fontFamily: " PingFang SC - Regular, PingFang SC",
+				color: " #FFFFFF",
+				margin: "134rpx auto 0",
 			}
 		};
 	},
-	created() {
-		this.account = uni.getStorageSync("account") || "";
+	mounted() {
+		this.account = uni.getStorageSync("account") || {
+				account: "",
+				password: ""
+			};
 		this.memory = uni.getStorageSync("memory") || 0;
 	},
-
 	methods: {
 		/* 输入框输入内容 */
 		onInput(e) {
-			this.account[e.currentTarget.dataset.name] = e.detail.value;
+			this.account[e.target.dataset.name] = e.detail.value;
 		},
 		/* 开始登录 */
 		startLogging() {
@@ -72,7 +83,7 @@ export default {
 						account: this.account.account,
 						password: this.memory == 1 ? this.account.password : ''
 					});
-					loginMsg(res.account_list)
+					loginMsg(res.account_list, this.$Http)
 				}
 			})
 
@@ -121,9 +132,4 @@ export default {
 		padding-right: 10rpx;
 	}
 }
-
-.cu-btn {
-	background: #0A3971;
-	opacity: 0.65;
-}
 </style>

+ 13 - 16
pages/login/modules/dispose.js

@@ -1,26 +1,21 @@
 let count = 0; //接口完成数量
 
-function loginMsg(account_list) {
-    console.log(account_list)
+function loginMsg(account_list, _Http) {
     uni.setStorageSync("account_list", account_list);
+    console.log(account_list)
     if (account_list.length == 1) {
         uni.setStorageSync('userMsg', account_list[0])
-        query_userauth();
-        query_adspacelist();
-        querySite_Parameter();
+        query_userauth(_Http);
+        query_adspacelist(_Http);
+        querySite_Parameter(_Http);
     } else {
-        wx.redirectTo({
-            url: '/pages/login/selectSite',
-            success: (res) => {},
-            fail: (res) => {},
-            complete: (res) => {
-                console.log(res)
-            },
+        uni.navigateTo({
+            url: '/pages/login/selectSite'
         })
     }
 }
 /* 获取用户权限 */
-function query_userauth() {
+function query_userauth(_Http) {
     _Http.basic({
         "classname": "sysmanage.develop.userauth.userauth",
         "method": "query_userauth",
@@ -39,7 +34,7 @@ function query_userauth() {
     });
 }
 /* 查询站点数据 */
-function querySite_Parameter() {
+function querySite_Parameter(_Http) {
     _Http.basic({
         id: 20230608103802,
         "content": {}
@@ -55,7 +50,7 @@ function querySite_Parameter() {
     })
 }
 /* 查询轮播图 */
-function query_adspacelist(i = 0) {
+function query_adspacelist(_Http) {
     _Http.basic({
         id: 20230608100802,
         "content": {}
@@ -73,7 +68,9 @@ function query_adspacelist(i = 0) {
 
 function toHome() {
     if (count < 3) return;
-    console.log("跳转首页")
+    uni.reLaunch({
+        url: '/pages/index/index',
+    })
 }
 /* 站点数据查询 */
 module.exports = {

+ 19 - 15
pages/login/modules/phone.vue

@@ -11,11 +11,8 @@
 			</view>
 			<button class="cu-btn bg-red" :loading='loading' @click="getAuthcode">{{ butText }}</button>
 		</view>
-		<view class="flex flex-direction" style="padding: 104rpx 100rpx; 0">
-			<button class="cu-btn bg-red margin-tb-sm lg" :disabled="phoneNumber == '' || password == ''" :loading='loading'
-				@click="startLogging">{{ loading ? ' 登陆中' :
-					'登录' }}</button>
-		</view>
+		<u-button :customStyle="butSty" :disabled="phoneNumber == '' || password == ''" :loading="loading"
+			loadingText='登陆中...' text="确 定" @click="startLogging" />
 	</view>
 </template>
 
@@ -32,11 +29,23 @@ export default {
 			loading: false,
 			phoneNumber: "",
 			password: "",
-			butText: "获取验证码"
+			butText: "获取验证码",
+			butSty: {
+				width: "550rpx",
+				height: "90rpx",
+				background: "#0A3971",
+				borderRadius: "8rpx",
+				opacity: "0.65",
+				borderWidth: 0,
+				fontSize: "32rpx",
+				fontFamily: " PingFang SC - Regular, PingFang SC",
+				color: " #FFFFFF",
+				margin: "134rpx auto 0",
+			}
 		};
 	},
-	created() {
-		if (uni.getStorageSync("phoneNumber")) this.phoneNumber = uni.getStorageSync("phoneNumber");
+	mounted() {
+		this.phoneNumber = uni.getStorageSync("phoneNumber") || "";
 	},
 	methods: {
 		/* 获取验证码 */
@@ -82,7 +91,7 @@ export default {
 				icon: "none",
 			});
 			this.loading = true;
-			this.$Http.login({
+			this.$Http.plogin({
 				"phonenumber": this.phonenumber,
 				"password": hexMD5(this.password),
 				"systemclient": "wechat"
@@ -98,7 +107,7 @@ export default {
 				} else {
 					uni.setStorageSync("phoneNumber", this.phoneNumber);
 					uni.setStorageSync("loginMethod", 'phone');
-					loginMsg(res.account_list)
+					loginMsg(res.account_list, this.$Http)
 				}
 			})
 		}
@@ -146,9 +155,4 @@ export default {
 		padding-right: 10rpx;
 	}
 }
-
-.cu-btn {
-	background: #0A3971;
-	opacity: 0.65;
-}
 </style>