|
@@ -3,15 +3,15 @@
|
|
|
<!-- <u-loading-page :loading="true" loading-text="loading..." loading-mode="spinner"></u-loading-page> -->
|
|
|
|
|
|
<view class="bg">
|
|
|
- <image class="bgImage" :src="bg" v-if="bg" />
|
|
|
+ <image class="bgImage" :src="useStore.$state.loginBg" v-if="useStore.$state.loginBg" />
|
|
|
<!-- <image class="bgImage" src="@/static/images/wt/bg.png" v-else /> -->
|
|
|
</view>
|
|
|
|
|
|
<view class="middle">
|
|
|
<view class="top">
|
|
|
- <image class="logo" mode="heightFix" :src="logo" v-if="logo" />
|
|
|
+ <image class="logo" mode="heightFix" :src="useStore.$state.loginLogo" v-if="useStore.$state.loginLogo" />
|
|
|
<image class="logo" mode="heightFix" src="@/static/logo200.png" v-else />
|
|
|
- <text class="title" v-if="title">{{ title }}</text>
|
|
|
+ <text class="title" v-if="useStore.$state.loginTitle">{{ useStore.$state.loginTitle }}</text>
|
|
|
<text class="title" v-else>移动端登录</text>
|
|
|
</view>
|
|
|
|
|
@@ -67,16 +67,16 @@
|
|
|
<!--#endif-->
|
|
|
</view>
|
|
|
<view class="bottom">
|
|
|
- <div class="title">{{ bottomTitle }}</div>
|
|
|
+ <div class="title">{{ useStore.$state.loginBottomTitle }}</div>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { onLoad, onShow, onHide, onLaunch, onReady } from "@dcloudio/uni-app";
|
|
|
-import { reactive, getCurrentInstance, toRefs, inject, watchEffect } from "vue";
|
|
|
+import { reactive, getCurrentInstance, toRefs, inject } from "vue";
|
|
|
import { getToken, setToken, removeToken } from "@/utils/auth";
|
|
|
-import { getCodeImg, getMobileTenantConfig } from "@/api/login";
|
|
|
+import { getCodeImg } from "@/api/login";
|
|
|
|
|
|
import publicStore from "@/store/modules/public.js";
|
|
|
|
|
@@ -87,17 +87,11 @@ const newPublicStore = publicStore();
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
|
const data = reactive({
|
|
|
- /** saas数据 */
|
|
|
- bg: "",
|
|
|
- logo: "",
|
|
|
- title: "",
|
|
|
- bottomTitle: "",
|
|
|
/** login数据 */
|
|
|
phone: undefined,
|
|
|
verify: undefined,
|
|
|
codeTime: 0,
|
|
|
switchText: "验证码登录",
|
|
|
- tenantId: undefined,
|
|
|
username: undefined,
|
|
|
password: undefined,
|
|
|
inputIconBool: true,
|
|
@@ -109,7 +103,7 @@ const data = reactive({
|
|
|
// VerificationCodeOne
|
|
|
});
|
|
|
|
|
|
-const { title, bg, bottomTitle, logo, phone, verify, codeTime, switchText, username, password, tenantId, inputIconBool, linkUrl, userChecked } = toRefs(data);
|
|
|
+const { phone, verify, codeTime, switchText, username, password, inputIconBool, linkUrl, userChecked } = toRefs(data);
|
|
|
|
|
|
function goSeverConfig() {
|
|
|
proxy.$tab.navigateTo("/pages/serveConfig");
|
|
@@ -174,6 +168,14 @@ function getVerifyCode() {
|
|
|
* 判断运行环境
|
|
|
*/
|
|
|
function env() {
|
|
|
+ useStore.SET_LOGINMOBILELIST({
|
|
|
+ loginTitle: "",
|
|
|
+ loginBottomTitle: "",
|
|
|
+ loginBg: "",
|
|
|
+ loginLogo: "",
|
|
|
+ tenantId: "",
|
|
|
+ });
|
|
|
+
|
|
|
// const u = navigator.userAgent
|
|
|
// //https://blog.csdn.net/weixin_42659644/article/details/126294231
|
|
|
// if(u.indexOf('saas')>-1){ //指定app内 获取app识别号
|
|
@@ -182,16 +184,8 @@ function env() {
|
|
|
|
|
|
// let port = uni.getSystemInfoSync().platform;
|
|
|
// switch (port) {
|
|
|
- // case "android":
|
|
|
- // getMobileTenantConfigApi({ url: window.location.host });
|
|
|
- // console.log("Android"); //android
|
|
|
- // break;
|
|
|
- // case "ios":
|
|
|
- // console.log("iOS"); //ios
|
|
|
- // getMobileTenantConfigApi({ url: window.location.host });
|
|
|
- // break;
|
|
|
// case "windows":
|
|
|
- // getMobileTenantConfigApi({ url: window.location.host });
|
|
|
+ // useStore.GetMobileTenantConfig({ url: window.location.host });
|
|
|
// break;
|
|
|
// default: //devtools
|
|
|
// console.log("小程序");
|
|
@@ -199,17 +193,19 @@ function env() {
|
|
|
// }
|
|
|
|
|
|
//#ifdef H5
|
|
|
- linkUrl.value = window.location.host;
|
|
|
- // linkUrl.value = window.location.host;
|
|
|
- // linkUrl.value='ces.cn';
|
|
|
- // linkUrl.value='172.16.120.165:13203'
|
|
|
- getMobileTenantConfigApi({ url: linkUrl.value });
|
|
|
+ if (window.location.host) {
|
|
|
+ linkUrl.value = window.location.host;
|
|
|
+ // linkUrl.value = window.location.host;
|
|
|
+ // linkUrl.value='ces.cn';
|
|
|
+ // linkUrl.value='172.16.120.165:13203'
|
|
|
+ useStore.GetMobileTenantConfig({ url: linkUrl.value });
|
|
|
+ }
|
|
|
//#endif
|
|
|
|
|
|
//#ifdef APP-PLUS
|
|
|
if (uni.getStorageSync("serveUrl")) {
|
|
|
linkUrl.value = uni.getStorageSync("serveUrl");
|
|
|
- getMobileTenantConfigApi({ url: linkUrl.value });
|
|
|
+ useStore.GetMobileTenantConfig({ url: linkUrl.value });
|
|
|
}
|
|
|
//#endif
|
|
|
}
|
|
@@ -246,7 +242,7 @@ function submitRes() {
|
|
|
login({
|
|
|
phone: phone.value,
|
|
|
verify: verify.value,
|
|
|
- tenantId: tenantId.value,
|
|
|
+ tenantId: useStore.$state.tenantId,
|
|
|
});
|
|
|
} else {
|
|
|
if (!username.value) {
|
|
@@ -261,7 +257,7 @@ function submitRes() {
|
|
|
login({
|
|
|
username: username.value,
|
|
|
password: password.value,
|
|
|
- tenantId: tenantId.value,
|
|
|
+ tenantId: useStore.$state.tenantId,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -279,23 +275,6 @@ function login(data) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/** 获取登录页数据 */
|
|
|
-function getMobileTenantConfigApi(params) {
|
|
|
- getMobileTenantConfig(params).then((res) => {
|
|
|
- if (res.data.length > 0) {
|
|
|
- let data = res.data[0];
|
|
|
- title.value = data.loginTitle;
|
|
|
- bottomTitle.value = data.loginFooter;
|
|
|
- tenantId.value = data.tenantId;
|
|
|
- bg.value = data.loginBackUrl;
|
|
|
- logo.value = data.loginLogo;
|
|
|
- uni.setStorageSync("homeTitle", data.loginTitle);
|
|
|
-
|
|
|
- useStore.$state.tenantId = data.tenantId;
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
// 用户协议
|
|
|
function handleUserAgrement() {
|
|
|
let site = getApp().globalData.config.appInfo.agreements[0];
|
|
@@ -307,28 +286,11 @@ function handlePrivacy() {
|
|
|
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
|
|
|
*/
|
|
|
onLoad(() => {
|
|
|
env();
|
|
|
-
|
|
|
- const token = getToken();
|
|
|
- //需要登录
|
|
|
- if (token) {
|
|
|
- uni.switchTab({
|
|
|
- url: "/pages/index",
|
|
|
- });
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
// onReady(() => {
|
|
@@ -536,12 +498,12 @@ page {
|
|
|
}
|
|
|
|
|
|
.bottom {
|
|
|
- position: absolute;
|
|
|
+ position: fixed;
|
|
|
width: 100%;
|
|
|
bottom: 10px;
|
|
|
.title {
|
|
|
text-align: center;
|
|
|
- color: #000;
|
|
|
+ color: #96a6b5;
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
}
|