|
@@ -18,40 +18,53 @@
|
|
|
<view class="content">
|
|
|
<text class="title">请登录</text>
|
|
|
|
|
|
- <!-- #ifdef APP-PLUS || H5 -->
|
|
|
- <view id="okay">首次账号登录请先配置服务器</view>
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <view id="okay" v-if="!linkUrl">首次账号登录请先配置服务器</view>
|
|
|
<!-- <u-icon class="icons" name="scan" color="gray" size="22"></u-icon> -->
|
|
|
<view class="setting" @tap="goSeverConfig"> 配置服务器 </view>
|
|
|
<!--#endif-->
|
|
|
</view>
|
|
|
|
|
|
- <view id="login-input" style="margin-top: 20px" v-if="switchText == '账号密码登录'">
|
|
|
+ <view id="login-input" v-if="switchText == '账号密码登录'">
|
|
|
<u-input v-model="phone" prefixIcon="phone" placeholder="请输入手机号码" />
|
|
|
</view>
|
|
|
|
|
|
- <view id="login-input" style="display: flex; margin-top: 20px" v-if="switchText == '账号密码登录'">
|
|
|
- <u-input style="width: 60%" v-model="verify" prefixIcon="email" placeholder="请输入验证码" />
|
|
|
-
|
|
|
- <u-button @click="getVerifyCode">{{ !codeTime ? "获取验证码" : codeTime + "s" }}</u-button>
|
|
|
+ <view id="login-input" v-if="switchText == '账号密码登录'">
|
|
|
+ <u-input v-model="verify" prefixIcon="email" placeholder="请输入验证码">
|
|
|
+ <template #suffix>
|
|
|
+ <u-button @click="getVerifyCode">{{ !codeTime ? "获取验证码" : codeTime + "s" }}</u-button>
|
|
|
+ </template>
|
|
|
+ </u-input>
|
|
|
</view>
|
|
|
|
|
|
- <view id="login-input" style="margin-top: 20px" v-if="switchText == '验证码登录'">
|
|
|
+ <view id="login-input" v-if="switchText == '验证码登录'">
|
|
|
<u-input type="text" v-model="username" prefixIcon="account" placeholder="请输入账号" />
|
|
|
|
|
|
- <u-input style="margin-top: 20px" v-model="password" prefixIcon="lock" placeholder="请输入密码" :password="inputIconBool">
|
|
|
+ <u-input v-model="password" prefixIcon="lock" placeholder="请输入密码" :password="inputIconBool">
|
|
|
<template #suffix>
|
|
|
- <text class="iconfont ucicon-eye" @click="inputIcon()" v-if="!inputIconBool"></text>
|
|
|
- <text class="iconfont ucicon-eye-close" @click="inputIcon()" v-if="inputIconBool"></text>
|
|
|
+ <text :class="!inputIconBool ? 'iconfont ucicon-eye' : 'iconfont ucicon-eye-close'" @click="inputIconBool = !inputIconBool"></text>
|
|
|
</template>
|
|
|
</u-input>
|
|
|
</view>
|
|
|
|
|
|
<!-- -->
|
|
|
+ <button class="submit" @click="submitRes">登 录</button>
|
|
|
|
|
|
<view class="switchText" @click="switchMode">
|
|
|
<text>{{ switchText }}</text>
|
|
|
</view>
|
|
|
- <button class="submit" @click="submitRes">登 录</button>
|
|
|
+
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <view class="xieyi text-center">
|
|
|
+ <u-checkbox-group>
|
|
|
+ <u-checkbox v-model="userChecked" shape="circle" inactiveColor="#0081ff" size="13"></u-checkbox>
|
|
|
+ </u-checkbox-group>
|
|
|
+ <text>我已阅读并同意</text>
|
|
|
+ <text @click="handleUserAgrement" class="text-blue">用户协议</text>
|
|
|
+ <text>和</text>
|
|
|
+ <text @click="handlePrivacy" class="text-blue">隐私协议</text>
|
|
|
+ </view>
|
|
|
+ <!--#endif-->
|
|
|
</view>
|
|
|
<view class="bottom">
|
|
|
<div class="title">{{ bottomTitle }}</div>
|
|
@@ -61,7 +74,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { onLoad, onShow, onHide, onLaunch } from "@dcloudio/uni-app";
|
|
|
-import { reactive, getCurrentInstance, toRefs, inject } from "vue";
|
|
|
+import { reactive, getCurrentInstance, toRefs, inject, watchEffect } from "vue";
|
|
|
import { getToken, setToken, removeToken } from "@/utils/auth";
|
|
|
import { Lock, User, Cellphone } from "@element-plus/icons-vue";
|
|
|
import { getCodeImg, getMobileTenantConfig } from "@/api/login";
|
|
@@ -89,17 +102,20 @@ const data = reactive({
|
|
|
username: undefined,
|
|
|
password: undefined,
|
|
|
inputIconBool: true,
|
|
|
+ /** 服务器配置数据 */
|
|
|
+ linkUrl: uni.getStorageSync("serveUrl"),
|
|
|
+ /** 用户隐私协议数据 */
|
|
|
+ userChecked: false,
|
|
|
|
|
|
// VerificationCodeOne
|
|
|
});
|
|
|
|
|
|
-const { title, bg, bottomTitle, logo, phone, verify, codeTime, switchText, username, password, tenantId, inputIconBool } = toRefs(data);
|
|
|
+const { title, bg, bottomTitle, logo, phone, verify, codeTime, switchText, username, password, tenantId, inputIconBool, linkUrl, userChecked } = toRefs(data);
|
|
|
|
|
|
function goSeverConfig() {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/serveConfig",
|
|
|
- });
|
|
|
+ proxy.$tab.navigateTo("/pages/serveConfig");
|
|
|
}
|
|
|
+
|
|
|
/**登录方式切换 */
|
|
|
function switchMode() {
|
|
|
if (switchText.value == "验证码登录") {
|
|
@@ -108,32 +124,40 @@ function switchMode() {
|
|
|
switchText.value = "验证码登录";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/** 点击发送验证码 */
|
|
|
function getVerifyCode() {
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ if (!uni.getStorageSync("serveUrl")) {
|
|
|
+ proxy.$modal.msg("首次登录请先进行服务器配置");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //#endif
|
|
|
+
|
|
|
if (!phone.value) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入手机号码...",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入手机号码");
|
|
|
return;
|
|
|
}
|
|
|
if (!/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(phone.value)) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入正确的手机号码...",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入正确的手机号码");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ if (userChecked.value) {
|
|
|
+ proxy.$modal.msg("请在阅读并同意 用户协议和隐私协议后登录");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //#endif
|
|
|
+
|
|
|
verify.value = undefined;
|
|
|
- getSendSms({
|
|
|
+ getCodeImg({
|
|
|
phone: phone.value,
|
|
|
+ }).then((res) => {
|
|
|
+ console.log(res);
|
|
|
});
|
|
|
- //
|
|
|
if (codeTime.value > 0) {
|
|
|
- uni.showToast({
|
|
|
- title: "不能重复获取",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("不能重复获取");
|
|
|
return;
|
|
|
} else {
|
|
|
codeTime.value = 60;
|
|
@@ -146,12 +170,6 @@ function getVerifyCode() {
|
|
|
}, 1000);
|
|
|
}
|
|
|
}
|
|
|
-/** 获取验证码 */
|
|
|
-async function getSendSms(params) {
|
|
|
- getCodeImg(params).then((res) => {
|
|
|
- console.log(res);
|
|
|
- });
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
* 判断运行环境
|
|
@@ -164,13 +182,10 @@ function env() {
|
|
|
// }
|
|
|
|
|
|
//#ifdef H5
|
|
|
- var linkUrl = window.location.host;
|
|
|
- // var linkUrl='ces.cn';
|
|
|
- // var linkUrl='172.16.120.165:13203'
|
|
|
- //#endif
|
|
|
-
|
|
|
- //#ifdef APP-PLUS
|
|
|
- var linkUrl = newPublicStore.serveUrl;
|
|
|
+ linkUrl.value = window.location.host;
|
|
|
+ // linkUrl.value='ces.cn';
|
|
|
+ // linkUrl.value='172.16.120.165:13203'
|
|
|
+ getMobileTenantConfigApi({ url: linkUrl.value });
|
|
|
//#endif
|
|
|
|
|
|
// uni.showToast({
|
|
@@ -178,8 +193,6 @@ function env() {
|
|
|
// icon: "none",
|
|
|
// })
|
|
|
|
|
|
- getMobileTenantConfigApi({ url: linkUrl });
|
|
|
-
|
|
|
// let port = uni.getSystemInfoSync().platform;
|
|
|
// switch (port) {
|
|
|
// case "android":
|
|
@@ -200,88 +213,67 @@ function env() {
|
|
|
}
|
|
|
|
|
|
/** 点击提交按钮 */
|
|
|
-async function submitRes() {
|
|
|
+function submitRes() {
|
|
|
//#ifdef APP-PLUS
|
|
|
- var linkUrl = newPublicStore.serveUrl;
|
|
|
- if (!newPublicStore.serveUrl) {
|
|
|
- uni.showToast({
|
|
|
- title: "首次登录请先进行服务器配置...",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ if (!uni.getStorageSync("serveUrl")) {
|
|
|
+ proxy.$modal.msg("首次登录请先进行服务器配置");
|
|
|
return;
|
|
|
}
|
|
|
//#endif
|
|
|
|
|
|
if (switchText.value == "账号密码登录") {
|
|
|
if (!phone.value) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入手机号码...",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入手机号码");
|
|
|
return;
|
|
|
}
|
|
|
if (!/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(phone.value)) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入正确的手机号码...",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入正确的手机号码");
|
|
|
return;
|
|
|
}
|
|
|
if (!verify.value) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入验证码...",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入验证码");
|
|
|
return;
|
|
|
}
|
|
|
- login({
|
|
|
- phone: phone.value,
|
|
|
- verify: verify.value,
|
|
|
- tenantId: tenantId.value,
|
|
|
- });
|
|
|
} else {
|
|
|
if (!username.value) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入账户",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入账户");
|
|
|
return;
|
|
|
}
|
|
|
if (!password.value) {
|
|
|
- uni.showToast({
|
|
|
- title: "请输入密码",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
+ proxy.$modal.msg("请输入密码");
|
|
|
return;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- login({
|
|
|
- username: username.value,
|
|
|
- password: password.value,
|
|
|
- tenantId: tenantId.value,
|
|
|
- });
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ if (userChecked.value) {
|
|
|
+ proxy.$modal.msg("请在阅读并同意 用户协议和隐私协议后登录");
|
|
|
+ return;
|
|
|
}
|
|
|
+ //#endif
|
|
|
+
|
|
|
+ login({
|
|
|
+ username: username.value,
|
|
|
+ password: password.value,
|
|
|
+ tenantId: tenantId.value,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/** 获取登录数据 */
|
|
|
-async function login(data) {
|
|
|
- // proxy.$modal.loading("登录中,请耐心等待...");
|
|
|
+function login(data) {
|
|
|
+ proxy.$modal.loading("登录中,请耐心等待...");
|
|
|
|
|
|
useStore.Login(data).then(() => {
|
|
|
- info();
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-/** 获取用户信息 */
|
|
|
-async function info() {
|
|
|
- proxy.$modal.closeLoading();
|
|
|
- useStore.GetInfo().then((res) => {
|
|
|
- proxy.$tab.reLaunch("/pages/index");
|
|
|
+ /** 获取用户信息 */
|
|
|
+ proxy.$modal.closeLoading();
|
|
|
+ useStore.GetInfo().then((res) => {
|
|
|
+ proxy.$tab.reLaunch("/pages/index");
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/** 获取登录页数据 */
|
|
|
-async function getMobileTenantConfigApi(params) {
|
|
|
+function getMobileTenantConfigApi(params) {
|
|
|
getMobileTenantConfig(params).then((res) => {
|
|
|
if (res.data.length > 0) {
|
|
|
let data = res.data[0];
|
|
@@ -295,14 +287,26 @@ async function getMobileTenantConfigApi(params) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * @密码显示隐藏icon图标事件
|
|
|
- * @icon点击事件
|
|
|
- */
|
|
|
-function inputIcon() {
|
|
|
- inputIconBool.value = !inputIconBool.value;
|
|
|
+// 用户协议
|
|
|
+function handleUserAgrement() {
|
|
|
+ let site = getApp().globalData.config.appInfo.agreements[0];
|
|
|
+ proxy.$tab.navigateTo(`/pages/common/textview/index1?title=${site.title}&content=${site.content}`);
|
|
|
+}
|
|
|
+// 隐私协议
|
|
|
+function handlePrivacy() {
|
|
|
+ let site = getApp().globalData.config.appInfo.agreements[1];
|
|
|
+ proxy.$tab.navigateTo(`/pages/common/textview/index1?title=${site.title}&content=${site.content}`);
|
|
|
}
|
|
|
|
|
|
+watchEffect(() => {
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ if (uni.getStorageSync("serveUrl")) {
|
|
|
+ linkUrl.value = uni.getStorageSync("serveUrl");
|
|
|
+ getMobileTenantConfigApi({ url: linkUrl.value });
|
|
|
+ }
|
|
|
+ //#endif
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* @onLoad
|
|
|
*/
|
|
@@ -318,9 +322,10 @@ onLoad(() => {
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
+
|
|
|
<style>
|
|
|
-.uni-input {
|
|
|
- color: red !important;
|
|
|
+page {
|
|
|
+ background-color: #ffffff;
|
|
|
}
|
|
|
</style>
|
|
|
|
|
@@ -338,7 +343,6 @@ onLoad(() => {
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
z-index: 0;
|
|
|
- background: #fff;
|
|
|
.bgImage {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -361,20 +365,17 @@ onLoad(() => {
|
|
|
border: 0 !important;
|
|
|
// border-color: #000 !important;
|
|
|
// border-color: gray !important;
|
|
|
- background-color: rgba(255, 255, 255, 0.1) !important;
|
|
|
+ // background-color: rgba(255, 255, 255, 0.1) !important;
|
|
|
background-color: #f5f6fa !important;
|
|
|
+ margin-bottom: 20px;
|
|
|
}
|
|
|
|
|
|
- :deep(.uni-input-wrapper) {
|
|
|
- font-size: 16px;
|
|
|
- color: #a0a4af;
|
|
|
+ :deep(.input-placeholder) {
|
|
|
+ color: #96a6b5 !important;
|
|
|
}
|
|
|
|
|
|
- :deep(uni-input) {
|
|
|
- color: #000 !important;
|
|
|
- background-color: rgba(255, 255, 255, 0) !important;
|
|
|
- border: 0px solid #ededed !important;
|
|
|
- padding-left: 0 !important;
|
|
|
+ :deep(.uni-input-wrapper) {
|
|
|
+ font-size: 16px;
|
|
|
}
|
|
|
|
|
|
:deep(.u-icon__icon) {
|
|
@@ -387,27 +388,27 @@ onLoad(() => {
|
|
|
color: gray !important;
|
|
|
}
|
|
|
|
|
|
- :deep(.u-button) {
|
|
|
- width: 35%;
|
|
|
- height: 45px;
|
|
|
- line-height: 45px;
|
|
|
- color: #2a98ff;
|
|
|
- border-radius: 24px;
|
|
|
- margin: 0 0 0 5%;
|
|
|
- font-size: 17px !important;
|
|
|
- white-space: nowrap;
|
|
|
- border-color: #2a98ff !important;
|
|
|
- background-color: rgba(255, 255, 255, 0.1) !important;
|
|
|
- }
|
|
|
-
|
|
|
:deep(:-webkit-autofill) {
|
|
|
- caret-color: #a0a4af; // 设置光标颜色
|
|
|
+ caret-color: #000; // 设置光标颜色
|
|
|
// -webkit-text-fill-color: gray !important;
|
|
|
-webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
|
|
|
background-color: transparent;
|
|
|
background-image: none;
|
|
|
transition: background-color 50000s ease-in-out 0s; //背景色透明 生效时长 过渡效果 启用时延迟的时间
|
|
|
}
|
|
|
+
|
|
|
+ :deep(.u-button) {
|
|
|
+ color: #2a98ff;
|
|
|
+ font-size: 16px !important;
|
|
|
+ white-space: nowrap;
|
|
|
+ border: 0;
|
|
|
+ border-color: #2a98ff !important;
|
|
|
+ background-color: rgba(255, 255, 255, 0) !important;
|
|
|
+
|
|
|
+ &:before {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.top {
|
|
@@ -418,6 +419,8 @@ onLoad(() => {
|
|
|
|
|
|
:deep(uni-image) {
|
|
|
height: 40px;
|
|
|
+ // width:40px;
|
|
|
+ width: auto;
|
|
|
}
|
|
|
.logo {
|
|
|
margin-right: 10px;
|
|
@@ -433,14 +436,15 @@ onLoad(() => {
|
|
|
.content {
|
|
|
display: flex;
|
|
|
position: relative;
|
|
|
+ margin: 30px 0 30px 0;
|
|
|
.title {
|
|
|
margin: auto auto auto 0;
|
|
|
color: #000;
|
|
|
- font-size: 17px;
|
|
|
+ font-size: 18px;
|
|
|
}
|
|
|
|
|
|
.icons {
|
|
|
- margin: auto 5px 0 0;
|
|
|
+ margin: auto 5px auto 0;
|
|
|
}
|
|
|
|
|
|
.setting {
|
|
@@ -472,10 +476,10 @@ onLoad(() => {
|
|
|
}
|
|
|
|
|
|
.switchText {
|
|
|
- color: #a0a4af;
|
|
|
- margin-top: 20px;
|
|
|
+ color: #96a6b5;
|
|
|
width: 100%;
|
|
|
display: block;
|
|
|
+ margin-top: 20px;
|
|
|
}
|
|
|
|
|
|
.submit {
|
|
@@ -484,9 +488,34 @@ onLoad(() => {
|
|
|
border-radius: 24px;
|
|
|
background: #2a98ff;
|
|
|
color: #fff;
|
|
|
- margin-top: 30px;
|
|
|
border: 0px;
|
|
|
}
|
|
|
+
|
|
|
+ .xieyi {
|
|
|
+ color: #96a6b5;
|
|
|
+ margin-top: 30px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ > uni-view {
|
|
|
+ margin: auto 0;
|
|
|
+ }
|
|
|
+ > uni-text {
|
|
|
+ margin: auto 0;
|
|
|
+ }
|
|
|
+ // animation: roundRule 0.5s linear infinite;
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes roundRule {
|
|
|
+ 0% {
|
|
|
+ transform: translateX(0);
|
|
|
+ }
|
|
|
+ 50% {
|
|
|
+ transform: translateX(-5px);
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: translateX(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.bottom {
|