Browse Source

登录流程优化

xiaohaizhao 11 tháng trước cách đây
mục cha
commit
663fcb44a3
4 tập tin đã thay đổi với 678 bổ sung547 xóa
  1. 189 127
      pages/login/login.vue
  2. 176 156
      pages/login/modules/account.vue
  3. 92 74
      pages/login/modules/otherLogin.vue
  4. 221 190
      pages/login/modules/phone.vue

+ 189 - 127
pages/login/login.vue

@@ -1,147 +1,209 @@
 <template>
-	<view class="container">
-		<image class="image"
-			src="https://yossys22170.obs.cn-east-2.myhuaweicloud.com:443/202309251695606306772B2018b85b.jpg"
-			mode="scaleToFill" />
-		<view class="box">
-			<view :style="{ height: height }" />
-			<view class="logo">
-				<u--image src="/static/img/LOGO-c1524a7d.svg" width="39.200vw" height="12.533vw" mode="scaleToFill">
-					<template v-slot:loading>
-						<u-loading-icon color="red"></u-loading-icon>
-					</template>
-					<view slot="error" style="font-size: 12px;">加载失败</view>
-				</u--image>
-			</view>
-			<account :isAgreement="isAgreement" v-show="loginMethod == 'account'" />
-			<phone :isAgreement="isAgreement" v-show="loginMethod == 'phone'" />
-			<view style="height: 25px;" />
-			<view class="agreement">
-				<u-checkbox :checked="isAgreement" shape="circle" @change="changeAgreement" />
-				<view @click="changeAgreement">
-					已阅读并同意
-				</view>
-				<text class="nav" @tap="checkTheAgreement">《隐私协议》</text>
-			</view>
-			<other-login :isAgreement="isAgreement" :loginMethod="loginMethod" @onChange="changeLoginMethod" />
-		</view>
-	</view>
+  <view class="container">
+    <image
+      class="image"
+      src="https://yossys22170.obs.cn-east-2.myhuaweicloud.com:443/202309251695606306772B2018b85b.jpg"
+      mode="scaleToFill"
+    />
+    <view class="box">
+      <view :style="{ height: height }" />
+      <view class="logo">
+        <u--image
+          src="/static/img/LOGO-c1524a7d.svg"
+          width="39.200vw"
+          height="12.533vw"
+          mode="scaleToFill"
+        >
+          <template v-slot:loading>
+            <u-loading-icon color="red"></u-loading-icon>
+          </template>
+          <view slot="error" style="font-size: 12px">加载失败</view>
+        </u--image>
+      </view>
+      <account
+        ref="account"
+        :isAgreement="isAgreement"
+        @getPermission="getPermission"
+        v-show="loginMethod == 'account'"
+      />
+      <phone
+        ref="phone"
+        :isAgreement="isAgreement"
+        @getPermission="getPermission"
+        v-show="loginMethod == 'phone'"
+      />
+      <view style="height: 25px" />
+      <view class="agreement">
+        <u-checkbox
+          :checked="isAgreement"
+          shape="circle"
+          @change="changeAgreement"
+        />
+        <view @click="changeAgreement"> 已阅读并同意 </view>
+        <text class="nav" @tap="checkTheAgreement">《隐私协议》</text>
+      </view>
+      <other-login
+        :isAgreement="isAgreement"
+        :loginMethod="loginMethod"
+        @onChange="changeLoginMethod"
+        ref="OtherLogin"
+        @getPermission="getPermission"
+      />
+
+      <u-modal
+        asyncClose
+        :show="showModal"
+        confirmColor="#052E5D"
+        showCancelButton
+        confirmText="阅读并获取"
+        @confirm="onConfirm"
+        @cancel="getPermission(false)"
+      >
+        <view class="modal-u"
+          >请阅读并同意<text class="nav" @tap="checkTheAgreement"
+            >《隐私协议》</text
+          ></view
+        >
+      </u-modal>
+    </view>
+  </view>
 </template>
 <script>
 import account from "./modules/account.vue";
 import phone from "./modules/phone.vue";
 import otherLogin from "./modules/otherLogin.vue";
 export default {
-	components: {
-		account,
-		phone,
-		otherLogin
-	},
-	data() {
-		return {
-			loginMethod: "",
-			height: this.usePort == 'h5' ? "100px" : "100px",
-			isAgreement: false
-		};
-	},
-	onLoad() {
-		this.loginMethod = uni.getStorageSync('loginMethod') || 'account';//登录方式
-		if (uni.getStorageSync("isAgreement")) this.isAgreement = true;
-	},
-	methods: {
-		/* 修改登录方式 */
-		changeLoginMethod(Method) {
-			this.loginMethod = Method;
-		},
-		changeAgreement() {
-			this.isAgreement = !this.isAgreement;
-		},
-		checkTheAgreement() {
-			uni.showLoading({
-				title: '加载中...',
-			})
-			uni.downloadFile({
-				url: 'https://yossys22170.obs.cn-east-2.myhuaweicloud.com:443/202309261695715892017B6ef5bd76.docx',
-				success: (res) => {
-					uni.openDocument({
-						filePath: res.tempFilePath,
-						fileType: "docx",
-						success: (s) => {
-							uni.hideLoading();
-						},
-						fail: (err) => {
-							console.log("openDocument", err)
-							uni.hideLoading();
-							uni.showToast({
-								title: '读取失败,请稍后再试',
-								icon: "none"
-							})
-						}
-					})
-				},
-				fail: (err) => {
-					console.log("downloadFile", err)
-					uni.hideLoading();
-					uni.showToast({
-						title: '读取失败,请稍后再试',
-						icon: "none"
-					})
-				}
-			})
-		}
-	}
-}
+  components: {
+    account,
+    phone,
+    otherLogin,
+  },
+  data() {
+    return {
+      loginMethod: "",
+      height: this.usePort == "h5" ? "100px" : "100px",
+      isAgreement: false,
+      showModal: false,
+    };
+  },
+  onLoad() {
+    this.loginMethod = uni.getStorageSync("loginMethod") || "account"; //登录方式
+    if (uni.getStorageSync("isAgreement")) this.isAgreement = true;
+  },
+  methods: {
+    /* 修改登录方式 */
+    changeLoginMethod(Method) {
+      this.loginMethod = Method;
+    },
+    changeAgreement() {
+      this.isAgreement = !this.isAgreement;
+    },
+    checkTheAgreement() {
+      uni.showLoading({
+        title: "加载中...",
+      });
+      uni.downloadFile({
+        url: "https://yossys22170.obs.cn-east-2.myhuaweicloud.com:443/202309261695715892017B6ef5bd76.docx",
+        success: (res) => {
+          uni.openDocument({
+            filePath: res.tempFilePath,
+            fileType: "docx",
+            success: (s) => {
+              uni.hideLoading();
+            },
+            fail: (err) => {
+              console.log("openDocument", err);
+              uni.hideLoading();
+              uni.showToast({
+                title: "读取失败,请稍后再试",
+                icon: "none",
+              });
+            },
+          });
+        },
+        fail: (err) => {
+          console.log("downloadFile", err);
+          uni.hideLoading();
+          uni.showToast({
+            title: "读取失败,请稍后再试",
+            icon: "none",
+          });
+        },
+      });
+    },
+    getPermission(e) {
+      this.showModal = e;
+    },
+    onConfirm() {
+      this.isAgreement = true;
+      setTimeout(() => {
+        if (this.showModal == "OtherLogin") {
+          this.$refs[this.showModal].wechatLogin();
+        } else {
+          this.$refs[this.showModal].startLogging();
+        }
+        this.getPermission(false);
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .container {
-	position: relative;
+  position: relative;
 
-	.box {
-		position: fixed;
-		top: 0;
-		left: 0;
-		width: 100vw;
-		box-sizing: border-box;
-		z-index: 9;
+  .box {
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100vw;
+    box-sizing: border-box;
+    z-index: 9;
 
-		.logo {
-			width: 147px;
-			height: 42px;
-			margin: 0 auto 50px;
-		}
+    .logo {
+      width: 147px;
+      height: 42px;
+      margin: 0 auto 50px;
+    }
 
-		.agreement {
-			display: flex;
-			justify-content: center;
-			margin: 0 auto;
-			height: 17px;
-			font-size: 12px;
-			font-weight: 400;
-			color: #fff;
+    .agreement {
+      display: flex;
+      justify-content: center;
+      margin: 0 auto;
+      height: 17px;
+      font-size: 12px;
+      font-weight: 400;
+      color: #fff;
 
-			.nav {
-				color: #16FFF6;
-			}
-		}
+      .nav {
+        color: #16fff6;
+      }
+    }
 
-		/deep/.u-checkbox__icon-wrap,
-		/deep/.u-checkbox__icon-wrap--circle {
-			width: 16px !important;
-			height: 16px !important;
+    /deep/.u-checkbox__icon-wrap,
+    /deep/.u-checkbox__icon-wrap--circle {
+      width: 16px !important;
+      height: 16px !important;
 
-			.u-icon__icon {
-				font-size: 10px !important;
-			}
-		}
-	}
+      .u-icon__icon {
+        font-size: 10px !important;
+      }
+    }
+  }
+
+  .image {
+    width: 100vw;
+    height: 100vh;
+    position: absolute;
+    top: 0;
+    z-index: 3;
+  }
+}
 
-	.image {
-		width: 100vw;
-		height: 100vh;
-		position: absolute;
-		top: 0;
-		z-index: 3;
-	}
+.modal-u {
+  .nav {
+    color: #052e5d;
+  }
 }
 </style>

+ 176 - 156
pages/login/modules/account.vue

@@ -1,194 +1,214 @@
 <template>
-	<view class="container">
-		<view class="input-box">
-			<view class="iconfont icon-zhanghao" />
-			<input class="input" placeholder-class="placeholder" type="text" :value="account.account" placeholder="请输入账号"
-				data-name='account' @input="onInput">
-		</view>
-		<view class="input-box" style="margin-top:15px;">
-			<view class="iconfont icon-mima" />
-			<input class="input" placeholder-class="placeholder" type="password" :value="account.password"
-				placeholder="请输入密码" data-name='password' @input="onInput">
-		</view>
-		<view class="assist">
-			<navigator class="navigator" url="#" style="display: flex; align-items: center;"
-				@click="memory = memory == '1' ? '0' : '1'">
-				<u-checkbox :checked="memory == 1" />记住密码
-			</navigator>
-
-			<!-- <navigator class="navigator" url="#">忘记密码?</navigator> -->
-		</view>
-		<u-button :customStyle="butSty" :disabled="account.account == '' || account.password == ''" :loading="loading"
-			loadingText='登陆中...' @click="startLogging">
-			<text style="font-size: 4.267vw;">
-				确 定
-			</text>
-		</u-button>
-	</view>
+  <view class="container">
+    <view class="input-box">
+      <view class="iconfont icon-zhanghao" />
+      <input
+        class="input"
+        placeholder-class="placeholder"
+        type="text"
+        :value="account.account"
+        placeholder="请输入账号"
+        data-name="account"
+        @input="onInput"
+      />
+    </view>
+    <view class="input-box" style="margin-top: 15px">
+      <view class="iconfont icon-mima" />
+      <input
+        class="input"
+        placeholder-class="placeholder"
+        type="password"
+        :value="account.password"
+        placeholder="请输入密码"
+        data-name="password"
+        @input="onInput"
+      />
+    </view>
+    <view class="assist">
+      <navigator
+        class="navigator"
+        url="#"
+        style="display: flex; align-items: center"
+        @click="memory = memory == '1' ? '0' : '1'"
+      >
+        <u-checkbox :checked="memory == 1" />记住密码
+      </navigator>
+
+      <!-- <navigator class="navigator" url="#">忘记密码?</navigator> -->
+    </view>
+    <u-button
+      :customStyle="butSty"
+      :disabled="account.account == '' || account.password == ''"
+      :loading="loading"
+      loadingText="登陆中..."
+      @click="startLogging"
+    >
+      <text style="font-size: 4.267vw"> 确 定 </text>
+    </u-button>
+  </view>
 </template>
 
 <script>
 import { hexMD5 } from "./md5";
 import { loginMsg } from "./dispose";
 export default {
-	name: "Account",
-	props: {
-		isAgreement: Boolean
-	},
-	data() {
-		return {
-			memory: 1,//是否记忆密码
-			loading: false,
-			account: {
-				account: "",
-				password: ""
-			},
-			butSty: {
-				width: "73.333vw",
-				height: "12.000vw",
-				background: "#0A3971",
-				borderRadius: "1.067vw",
-				opacity: "0.65",
-				borderWidth: 0,
-				fontFamily: " PingFang SC - Regular, PingFang SC",
-				color: " #FFFFFF",
-				margin: "17.867vw auto 0"
-			}
-		};
-	},
-	mounted() {
-		this.account = uni.getStorageSync("account") || {
-			account: "",
-			password: ""
-		};
-		this.memory = uni.getStorageSync("memory") || 0;
-	},
-	methods: {
-		/* 输入框输入内容 */
-		onInput(e) {
-			this.account[e.target.dataset.name] = e.detail.value;
-		},
-		/* 开始登录 */
-		startLogging() {
-			if (this.loading) return;
-			if (!this.isAgreement) return uni.showToast({
-				title: '请阅读并勾选用户协议',
-				icon: 'none',
-			})
-			this.loading = true;
-			this.$Http.login({
-				"accountno": this.account.account,
-				"password": hexMD5(this.account.password),
-				"systemclient": "wechat"
-			}).then(res => {
-				console.log("账号密码登录", res)
-				this.loading = false;
-				if (res.code == 0) {
-					uni.showToast({
-						title: res.msg,
-						duration: 2000,
-						icon: "none"
-					});
-				} else {
-					//存储是否记住密码 以及登录方式
-					uni.setStorageSync("memory", this.memory + '');
-					uni.setStorageSync("loginMethod", 'account')
-					uni.setStorageSync("account", {
-						account: this.account.account,
-						password: this.memory == 1 ? this.account.password : ''
-					});
-					loginMsg(res.account_list, this)
-				}
-			})
-
-		}
-	}
-}
+  name: "Account",
+  props: {
+    isAgreement: Boolean,
+    getPermission: Function,
+  },
+  data() {
+    return {
+      memory: 1, //是否记忆密码
+      loading: false,
+      account: {
+        account: "",
+        password: "",
+      },
+      butSty: {
+        width: "73.333vw",
+        height: "12.000vw",
+        background: "#0A3971",
+        borderRadius: "1.067vw",
+        opacity: "0.65",
+        borderWidth: 0,
+        fontFamily: " PingFang SC - Regular, PingFang SC",
+        color: " #FFFFFF",
+        margin: "17.867vw auto 0",
+      },
+    };
+  },
+  mounted() {
+    this.account = uni.getStorageSync("account") || {
+      account: "",
+      password: "",
+    };
+    this.memory = uni.getStorageSync("memory") || 0;
+  },
+  methods: {
+    /* 输入框输入内容 */
+    onInput(e) {
+      this.account[e.target.dataset.name] = e.detail.value;
+    },
+    /* 开始登录 */
+    startLogging() {
+      if (this.loading) return;
+      if (!this.isAgreement) return this.$emit("getPermission", "account");
+      this.loading = true;
+      this.$Http
+        .login({
+          accountno: this.account.account,
+          password: hexMD5(this.account.password),
+          systemclient: "wechat",
+        })
+        .then((res) => {
+          console.log("账号密码登录", res);
+          this.loading = false;
+          if (res.code == 0) {
+            uni.showToast({
+              title: res.msg,
+              duration: 2000,
+              icon: "none",
+            });
+          } else {
+            //存储是否记住密码 以及登录方式
+            uni.setStorageSync("memory", this.memory + "");
+            uni.setStorageSync("loginMethod", "account");
+            uni.setStorageSync("account", {
+              account: this.account.account,
+              password: this.memory == 1 ? this.account.password : "",
+            });
+            loginMsg(res.account_list, this);
+          }
+        });
+    },
+  },
+};
 </script>
 
 <style lang="scss">
 .input-box {
-	display: flex;
-	align-items: center;
-	width: 275px;
-	height: 45px;
-	background: #FFFFFF;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin: 0 auto 0;
-
-	.input {
-		font-size: 14px;
-		height: 30px;
-	}
-
-	.placeholder {
-		font-size: 12px !important;
-	}
-
-	.iconfont {
-		font-size: 12px;
-		padding: 0 10px;
-		color: #052E5D;
-	}
+  display: flex;
+  align-items: center;
+  width: 275px;
+  height: 45px;
+  background: #ffffff;
+  border-radius: 4px;
+  opacity: 0.65;
+  margin: 0 auto 0;
+
+  .input {
+    font-size: 14px;
+    height: 30px;
+  }
+
+  .placeholder {
+    font-size: 12px !important;
+  }
+
+  .iconfont {
+    font-size: 12px;
+    padding: 0 10px;
+    color: #052e5d;
+  }
 }
 
 .icon {
-	width: 16px;
-	height: 16px;
-	margin: 0 10px;
+  width: 16px;
+  height: 16px;
+  margin: 0 10px;
 }
 
 input {
-	width: 80%;
+  width: 80%;
 }
 
 /* 验证码 */
 .authcode {
-	display: flex;
-	justify-content: space-between;
-	height: 45px;
-	width: 275px;
-	margin: 0 auto 0;
+  display: flex;
+  justify-content: space-between;
+  height: 45px;
+  width: 275px;
+  margin: 0 auto 0;
 }
 
 .authcode .input-box {
-	width: 170px;
+  width: 170px;
 }
 
 .authcode .cu-btn {
-	width: 97px;
-	height: 45px;
-	background: #0A3971;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin-left: 8px;
-	font-size: 24px;
-	font-family: PingFang SC-Regular, PingFang SC;
-	padding: 0;
+  width: 97px;
+  height: 45px;
+  background: #0a3971;
+  border-radius: 4px;
+  opacity: 0.65;
+  margin-left: 8px;
+  font-size: 24px;
+  font-family: PingFang SC-Regular, PingFang SC;
+  padding: 0;
 }
 
 .icon {
-	background-color: $my-color-main;
+  background-color: $my-color-main;
 }
 
 .assist {
-	display: flex;
-	justify-content: space-between;
-	align-items: center;
-	width: 274px;
-	margin: 13px auto 0;
-
-	.navigator {
-		padding-right: 5px;
-		font-family: PingFang SC-Regular, PingFang SC;
-		font-size: 12px !important;
-		color: #FFFFFF;
-		border-radius: 4px;
-	}
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  width: 274px;
+  margin: 13px auto 0;
+
+  .navigator {
+    padding-right: 5px;
+    font-family: PingFang SC-Regular, PingFang SC;
+    font-size: 12px !important;
+    color: #ffffff;
+    border-radius: 4px;
+  }
 }
 
 /deep/.u-button__loading-text {
-	font-size: 14px !important;
+  font-size: 14px !important;
 }
 </style>

+ 92 - 74
pages/login/modules/otherLogin.vue

@@ -1,95 +1,113 @@
 <template>
-    <view class="container">
-        <u-divider text="其他登录方式" textSize="3.2vw" textColor="#fff" lineColor="#fff" />
-        <view class="grid-box">
-            <view class="item" @click="changeLoginMethod">
-                <text class="iconfont" :class="loginMethod == 'phone' ? 'icon-zhanghaodenglu' : 'icon-shoujidenglu'" />
-            </view>
-            <view class="item" style="background-color: #28C445;" v-if="port == 'wechat'" @click="wechatLogin">
-                <u-icon name="weixin-fill" size="8vw" color="#fff"></u-icon>
-            </view>
-        </view>
+  <view class="container">
+    <u-divider
+      text="其他登录方式"
+      textSize="3.2vw"
+      textColor="#fff"
+      lineColor="#fff"
+    />
+    <view class="grid-box">
+      <view class="item" @click="changeLoginMethod">
+        <text
+          class="iconfont"
+          :class="
+            loginMethod == 'phone' ? 'icon-zhanghaodenglu' : 'icon-shoujidenglu'
+          "
+        />
+      </view>
+      <view
+        class="item"
+        style="background-color: #28c445"
+        v-if="port == 'wechat'"
+        @click="wechatLogin"
+      >
+        <u-icon name="weixin-fill" size="8vw" color="#fff"></u-icon>
+      </view>
     </view>
+  </view>
 </template>
 
 <script>
 import { loginMsg } from "./dispose";
 export default {
-    name: "OtherLogin",
-    props: {
-        "loginMethod": String,
-        onChange: Function,
-        isAgreement: Boolean
+  name: "OtherLogin",
+  props: {
+    loginMethod: String,
+    onChange: Function,
+    isAgreement: Boolean,
+    getPermission: Function,
+  },
+  data() {
+    return {
+      port: "wechat",
+    };
+  },
+  created() {
+    // #ifndef MP
+    this.port = "h5";
+    // #endif
+    // #ifdef MP-WEIXIN
+    this.port = "wechat";
+    // #endif
+  },
+  methods: {
+    /* 改变登录方式 */
+    changeLoginMethod() {
+      this.$emit(
+        "onChange",
+        this.loginMethod == "account" ? "phone" : "account"
+      );
     },
-    data() {
-        return {
-            port: 'wechat'
-        }
-    },
-    created() {
-        // #ifndef MP
-        this.port = 'h5'
-        // #endif
-        // #ifdef MP-WEIXIN
-        this.port = 'wechat'
-        // #endif
-    },
-    methods: {
-        /* 改变登录方式 */
-        changeLoginMethod() {
-            this.$emit("onChange", this.loginMethod == 'account' ? 'phone' : 'account')
-        },
-        /* 微信登录 */
-        wechatLogin() {
-            if (!this.isAgreement) return uni.showToast({
-                title: '请阅读并勾选用户协议',
-                icon: 'none',
-            })
-            let that = this;
-            uni.login({
-                success(res) {
-                    that.$Http.loginbywechat({
-                        wechat_code: res.code,
-                        "systemclient": "wechat"
-                    }).then(res => {
-                        console.log("微信快捷登录", res)
-                        if (that.cutoff(res.msg)) return;
-                        loginMsg(res.account_list, that)
-                    })
-                }
+    /* 微信登录 */
+    wechatLogin() {
+      if (!this.isAgreement) return this.$emit("getPermission", "OtherLogin");
+      let that = this;
+      uni.login({
+        success(res) {
+          that.$Http
+            .loginbywechat({
+              wechat_code: res.code,
+              systemclient: "wechat",
             })
+            .then((res) => {
+              console.log("微信快捷登录", res);
+              if (that.cutoff(res.msg)) return;
+              loginMsg(res.account_list, that);
+            });
         },
+      });
     },
-}
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .container {
-    width: 275px !important;
-    margin: 0 auto;
+  width: 275px !important;
+  margin: 0 auto;
 
-    .grid-box {
-        display: flex;
-        width: 100%;
-        justify-content: center;
-        flex-wrap: wrap;
+  .grid-box {
+    display: flex;
+    width: 100%;
+    justify-content: center;
+    flex-wrap: wrap;
 
-        .item {
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            width: 40px;
-            height: 40px;
-            border-radius: 50%;
-            background-color: rgba($color: #fff, $alpha: .3);
-            flex-shrink: 0;
-            margin: 0 7px 7px;
-            color: #fff;
+    .item {
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      width: 40px;
+      height: 40px;
+      border-radius: 50%;
+      background-color: rgba($color: #fff, $alpha: 0.3);
+      flex-shrink: 0;
+      margin: 0 7px 7px;
+      color: #fff;
 
-            .iconfont {
-                font-size: 20px;
-            }
-        }
+      .iconfont {
+        font-size: 20px;
+      }
     }
+  }
 }
 </style>

+ 221 - 190
pages/login/modules/phone.vue

@@ -1,25 +1,50 @@
 <template>
-	<view class="container">
-		<view class="input-box">
-			<view class="iconfont icon-shoujihao" />
-			<input class="input" placeholder-class="placeholder" type="number" :value="phoneNumber" placeholder="请输入手机号码"
-				data-name='phoneNumber' @input="onInput">
-		</view>
-		<view class="authcode" style="margin-top:15px;">
-			<view class="input-box">
-				<view class="iconfont icon-duanxinyanzheng" />
-				<input class="input" placeholder-class="placeholder" type="number" :value="password" placeholder="请输入验证码"
-					data-name='password' @input="onInput">
-			</view>
-			<button class="cu-btn bg-red" :loading='loading' @click="getAuthcode">{{ butText }}</button>
-		</view>
-		<u-button :customStyle="butSty" :disabled="phoneNumber == '' || password == ''" :loading="loading"
-			loadingText='登陆中...' @click="startLogging">
-			<text style="font-size: 4.267vw;">
-				确 定
-			</text>
-		</u-button>
-	</view>
+  <view class="container">
+    <view class="input-box">
+      <view class="iconfont icon-shoujihao" />
+      <input
+        class="input"
+        placeholder-class="placeholder"
+        type="number"
+        :value="phoneNumber"
+        placeholder="请输入手机号码"
+        data-name="phoneNumber"
+        @input="onInput"
+      />
+    </view>
+    <view class="authcode" style="margin-top: 15px">
+      <view class="input-box">
+        <view class="iconfont icon-duanxinyanzheng" />
+        <input
+          class="input"
+          placeholder-class="placeholder"
+          :focus="focus"
+          type="number"
+          :value="password"
+          placeholder="请输入验证码"
+          data-name="password"
+          @input="onInput"
+        />
+      </view>
+      <button
+        :disabled="phoneNumber.length != 11"
+        class="cu-btn bg-red"
+        :loading="loading"
+        @click="getAuthcode"
+      >
+        {{ butText }}
+      </button>
+    </view>
+    <u-button
+      :customStyle="butSty"
+      :disabled="phoneNumber == '' || password == ''"
+      :loading="loading"
+      loadingText="登陆中..."
+      @click="startLogging"
+    >
+      <text style="font-size: 4.267vw"> 确 定 </text>
+    </u-button>
+  </view>
 </template>
 
 <script>
@@ -29,206 +54,212 @@ import { CheckPhoneNumber } from "../../../utils/basicInspection";
 import { loginMsg } from "./dispose";
 
 export default {
-	name: "Phone",
-	props: {
-		isAgreement: Boolean
-	},
-	data() {
-		return {
-			loading: false,
-			phoneNumber: "",
-			password: "",
-			butText: "获取验证码",
-			butSty: {
-				width: "73.333vw",
-				height: "12.000vw",
-				background: "#0A3971",
-				borderRadius: "1.067vw",
-				opacity: "0.65",
-				borderWidth: 0,
-				fontFamily: " PingFang SC - Regular, PingFang SC",
-				color: " #FFFFFF",
-				margin: "17.867vw auto 0"
-			}
-		};
-	},
-	mounted() {
-		this.phoneNumber = uni.getStorageSync("phoneNumber") || "";
-	},
-	methods: {
-		/* 获取验证码 */
-		getAuthcode() {
-			if (this.butText == '获取验证码' || this.butText == '重新获取') {
-				if (!CheckPhoneNumber(this.phoneNumber, '请输入正确的手机号码')) return;
-				this.$Http.getpassword({
-					"phonenumber": this.phoneNumber,
-					"systemclient": "wechat"
-				}).then(res => {
-					console.log("获取验证码", res)
-					uni.showToast({
-						title: res.msg,
-						duration: 3000,
-						icon: "none",
-					});
-					if (res.code == 0) return;
-					var count = 30;
-					this.butText = count + 's';
-					countDown = setInterval(() => {
-						if (count == 0) {
-							clearInterval(countDown);
-							this.butText = '重新获取';
-						} else {
-							count = count - 1;
-							this.butText = count + 's';
-						}
-					}, 1000)
-				});
-			};
-		},
-		/* 输入框输入内容 */
-		onInput(e) {
-			this[e.currentTarget.dataset.name] = e.detail.value;
-		},
-		/* 开始登录 */
-		startLogging() {
-			if (this.loading) return;
-			if (!this.isAgreement) return uni.showToast({
-				title: '请阅读并勾选用户协议',
-				icon: 'none',
-			})
-			if (!CheckPhoneNumber(this.phoneNumber, '请输入正确的手机号码')) return;
-			if (this.password == "") return uni.showToast({
-				title: '还未填写验证码',
-				duration: 2000,
-				icon: "none",
-			});
-			this.loading = true;
-			this.$Http.plogin({
-				"phonenumber": this.phoneNumber,
-				"password": hexMD5(this.password),
-				"systemclient": "wechat"
-			}).then(res => {
-				console.log("验证码登录", res)
-				this.loading = false;
-				if (res.code == 0) {
-					uni.showToast({
-						title: res.msg,
-						duration: 2000,
-						icon: "none"
-					});
-				} else {
-					uni.setStorageSync("phoneNumber", this.phoneNumber);
-					uni.setStorageSync("loginMethod", 'phone');
-					loginMsg(res.account_list, this.$Http)
-				}
-			})
-		}
-	}
-}
+  name: "Phone",
+  props: {
+    isAgreement: Boolean,
+    getPermission: Function,
+  },
+  data() {
+    return {
+      loading: false,
+      phoneNumber: "",
+      password: "",
+      butText: "获取验证码",
+      focus: false,
+      butSty: {
+        width: "73.333vw",
+        height: "12.000vw",
+        background: "#0A3971",
+        borderRadius: "1.067vw",
+        opacity: "0.65",
+        borderWidth: 0,
+        fontFamily: " PingFang SC - Regular, PingFang SC",
+        color: " #FFFFFF",
+        margin: "17.867vw auto 0",
+      },
+    };
+  },
+  mounted() {
+    this.phoneNumber = uni.getStorageSync("phoneNumber") || "";
+  },
+  methods: {
+    /* 获取验证码 */
+    getAuthcode() {
+      this.focus = false;
+      if (this.butText == "获取验证码" || this.butText == "重新获取") {
+        if (!CheckPhoneNumber(this.phoneNumber, "请输入正确的手机号码")) return;
+        this.$Http
+          .getpassword({
+            phonenumber: this.phoneNumber,
+            systemclient: "wechat",
+          })
+          .then((res) => {
+            console.log("获取验证码", res);
+            uni.showToast({
+              title: res.msg,
+              duration: 3000,
+              icon: "none",
+            });
+            if (res.code == 0) return;
+            this.focus = true;
+            var count = 30;
+            this.butText = count + "s";
+            countDown = setInterval(() => {
+              if (count == 0) {
+                clearInterval(countDown);
+                this.butText = "重新获取";
+              } else {
+                count = count - 1;
+                this.butText = count + "s";
+              }
+            }, 1000);
+          });
+      }
+    },
+    /* 输入框输入内容 */
+    onInput(e) {
+      this[e.currentTarget.dataset.name] = e.detail.value;
+    },
+    /* 开始登录 */
+    startLogging() {
+      if (this.loading) return;
+      if (!this.isAgreement) return this.$emit("getPermission", "phone");
+      if (!CheckPhoneNumber(this.phoneNumber, "请输入正确的手机号码")) return;
+      if (this.password == "")
+        return uni.showToast({
+          title: "还未填写验证码",
+          duration: 2000,
+          icon: "none",
+        });
+      this.loading = true;
+      this.$Http
+        .plogin({
+          phonenumber: this.phoneNumber,
+          password: hexMD5(this.password),
+          systemclient: "wechat",
+        })
+        .then((res) => {
+          console.log("验证码登录", res);
+          this.loading = false;
+          if (res.code == 0) {
+            uni.showToast({
+              title: res.msg,
+              duration: 2000,
+              icon: "none",
+            });
+          } else {
+            uni.setStorageSync("phoneNumber", this.phoneNumber);
+            uni.setStorageSync("loginMethod", "phone");
+            loginMsg(res.account_list, this.$Http);
+          }
+        });
+    },
+  },
+};
 </script>
 
 <style lang="scss">
 .input-box {
-	display: flex;
-	align-items: center;
-	width: 275px;
-	height: 45px;
-	background: #FFFFFF;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin: 0 auto;
-
-	.input {
-		font-size: 14px;
-		height: 30px;
-		line-height: 30px;
-	}
-
-	.placeholder{
-		font-size: 12px !important;
-	}
-
-	.iconfont {
-		font-size: 11px;
-		padding: 0 10px;
-		color: #052E5D;
-	}
+  display: flex;
+  align-items: center;
+  width: 275px;
+  height: 45px;
+  background: #ffffff;
+  border-radius: 4px;
+  opacity: 0.65;
+  margin: 0 auto;
+
+  .input {
+    font-size: 14px;
+    height: 30px;
+    line-height: 30px;
+  }
+
+  .placeholder {
+    font-size: 12px !important;
+  }
+
+  .iconfont {
+    font-size: 11px;
+    padding: 0 10px;
+    color: #052e5d;
+  }
 }
 
 .icon {
-	width: 16px;
-	height: 16px;
-	margin: 0 10px;
+  width: 16px;
+  height: 16px;
+  margin: 0 10px;
 }
 
 input {
-	width: 80%;
+  width: 80%;
 }
 
 /* 验证码 */
 .authcode {
-	display: flex;
-	justify-content: space-between;
-	height: 45px;
-	width: 275px;
-	margin: 0 auto 0;
+  display: flex;
+  justify-content: space-between;
+  height: 45px;
+  width: 275px;
+  margin: 0 auto 0;
 }
 
 .authcode .input-box {
-	width: 170px;
+  width: 170px;
 }
 
 .authcode .cu-btn {
-	width: 97px;
-	height: 45px;
-	background: #0A3971;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin-left: 8px;
-	font-size: 12px;
-	font-family: PingFang SC-Regular, PingFang SC;
-	padding: 0;
+  width: 97px;
+  height: 45px;
+  background: #0a3971;
+  border-radius: 4px;
+  opacity: 0.65;
+  margin-left: 8px;
+  font-size: 12px;
+  font-family: PingFang SC-Regular, PingFang SC;
+  padding: 0;
 }
 
 .icon {
-	background-color: $my-color-main;
+  background-color: $my-color-main;
 }
 
 /deep/uni-checkbox.blue.checked .uni-checkbox-input {
-	background-color: #0A3971 !important;
-	opacity: 0.65;
+  background-color: #0a3971 !important;
+  opacity: 0.65;
 }
 
 .assist {
-	display: flex;
-	justify-content: space-between;
-	width: 274px;
-	height: 17px;
-	font-size: 12px;
-	font-family: PingFang SC-Regular, PingFang SC;
-	color: #FFFFFF;
-	margin: 13px auto 0;
-
-	label {
-		display: flex;
-		align-items: center;
-
-		checkbox {
-			transform: scale(0.6);
-			background: #0A3971;
-			color: #0A3971;
-			border-radius: 4px;
-			opacity: 0.65;
-			border: 1px solid rgba(11, 63, 126, 0.1);
-		}
-	}
-
-	navigator {
-		padding-right: 5px;
-	}
+  display: flex;
+  justify-content: space-between;
+  width: 274px;
+  height: 17px;
+  font-size: 12px;
+  font-family: PingFang SC-Regular, PingFang SC;
+  color: #ffffff;
+  margin: 13px auto 0;
+
+  label {
+    display: flex;
+    align-items: center;
+
+    checkbox {
+      transform: scale(0.6);
+      background: #0a3971;
+      color: #0a3971;
+      border-radius: 4px;
+      opacity: 0.65;
+      border: 1px solid rgba(11, 63, 126, 0.1);
+    }
+  }
+
+  navigator {
+    padding-right: 5px;
+  }
 }
 
 /deep/.u-button__loading-text {
-	font-size: 14px !important;
+  font-size: 14px !important;
 }
 </style>