From e3c2cd23253f3501be7d31e03955fbb6f4aa3556 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Fri, 15 May 2026 16:30:04 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v9.0/9.0.4' into prod

---
 src/pages/login/index.vue |   65 ++++++++++++++++++++++++++++++--
 1 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index 318b8a6..57ad7e0 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -11,8 +11,14 @@
       <image :src="passwordSvg" />
       <input
         v-model="loginForm.password"
-        type="password"
+        type="text"
+        :password="showPassword"
         placeholder="请输入密码"
+      />
+      <image
+        class="pass-word-icon"
+        :src="passwordTriggerIcon"
+        @click="showPassWord"
       />
     </div>
     <div class="remember-password">
@@ -30,6 +36,14 @@
 
     <button class="login-btn" :style="[inputStyle]" @tap="submit">登录</button>
     <image class="lowerRightCorner" :src="droneSvg" />
+
+    <!-- #ifdef MP-WEIXIN -->
+    <GetPrivacy
+      ref="privacyComponent"
+      position="center"
+      @allowPrivacy="allowPrivacy"
+    />
+    <!-- #endif -->
   </view>
 </template>
 
@@ -38,7 +52,9 @@
 import md5 from "js-md5";
 import { loginByUsername } from "@/api/user/index.js";
 import { useUserStore } from "@/store/index.js";
-
+// #ifdef MP-WEIXIN
+import GetPrivacy from "@/components/GetPrivacy.vue";
+// #endif
 import { HOME_PATH, LOGIN_PATH, removeQueryString } from "@/router";
 import { onMounted } from "vue";
 
@@ -46,6 +62,8 @@
 const usernameSvg = getAssetsImage("/images/login/username.png");
 const passwordSvg = getAssetsImage("/images/login/password.png");
 const logoSvg = getAssetsImage("/images/login/logo.png");
+const passwordShow = getAssetsImage("/images/password-show.png");
+const passwordHide = getAssetsImage("/images/password-hide.png");
 
 const userStore = useUserStore();
 const loginForm = ref({
@@ -132,6 +150,16 @@
   }
 }
 
+const showPassword = ref(true);
+
+const showPassWord = () => {
+  showPassword.value = !showPassword.value;
+};
+
+const passwordTriggerIcon = computed(() => {
+  return showPassword.value ? passwordHide : passwordShow;
+});
+
 // 从本地存储加载记住的密码
 onMounted(() => {
   const savedUserInfo = uni.getStorageSync("rememberedUser");
@@ -147,6 +175,28 @@
     redirect = decodeURIComponent(options.redirect);
   }
 });
+
+// #ifdef MP-WEIXIN
+const allowPrivacy = () => {
+  // 同意隐私协议触发事件,有些接口需要同意授权后才能执行,比如获取手机号授权接口,可以在同意隐私协议后,再执行授权获取手机号接口,如果不需要可以不添加该方法
+  console.log("同意隐私授权");
+};
+const privacyComponent = ref(null);
+// onShow(() =>{
+//   wx.getPrivacySetting({
+//     success: res => {
+//       console.log(res)
+//       if (!res.needAuthorization) {
+//         privacyComponent?.value?.closePrivacy()
+//         // 查询授权,针对有tab切换的页面,可以在onshow中查询隐私授权状态,判断在tab切换后是否需要关闭授权弹框
+//         console.log('已经同意隐私授权,不需要再次授权')
+//       }
+//     },
+//     fail: () => {},
+//     complete: () => {}
+//   })
+// })
+// #endif
 </script>
 
 <style lang="scss" scoped>
@@ -203,10 +253,16 @@
       margin-right: 12rpx;
     }
 
+    .pass-word-icon {
+      margin-left: 12rpx;
+      margin-right: 0;
+    }
+
     :deep(uni-input) {
       height: 40rpx;
       line-height: 40rpx;
-      width: 80%;
+      width: 0;
+      flex: 1;
       margin-top: 20rpx;
       padding: 0 !important;
     }
@@ -214,7 +270,8 @@
     :deep(input) {
       height: 40rpx;
       line-height: 40rpx;
-      width: 80%;
+      width: 0;
+      flex: 1;
       margin-top: 20rpx;
       padding: 0 !important;
       margin: 0 !important;

--
Gitblit v1.9.3