|
@@ -10,7 +10,6 @@
|
|
|
|
|
|
<view class="middle-content">
|
|
|
<text class="title" :style="{ color: useStore.loginBg ? '#FFFFFF' : '#000000' }">请登录</text>
|
|
|
-
|
|
|
<!-- #ifdef APP-PLUS || MP-WEIXIN -->
|
|
|
<view class="prompt" v-if="!linkUrl">首次账号登录请先配置服务器</view>
|
|
|
<view class="setting" @tap="goSeverConfig"> 配置服务器 </view>
|
|
@@ -19,7 +18,6 @@
|
|
|
|
|
|
<view class="middle-input" v-if="switchText == '验证码登录'">
|
|
|
<u-input v-model="phone" prefixIcon="phone" placeholder="请输入手机号" :maxlength="11" />
|
|
|
-
|
|
|
<u-input v-model="verify" prefixIcon="email" placeholder="请输入验证码" :maxlength="6">
|
|
|
<template #suffix>
|
|
|
<button class="verify" @click="getVerifyCode">{{ !useStore.codeTime ? "获取验证码" : useStore.codeTime + "s" }}</button>
|
|
@@ -29,21 +27,22 @@
|
|
|
|
|
|
<view class="middle-input" v-if="switchText == '账号密码登录'">
|
|
|
<u-input type="text" v-model="username" prefixIcon="account" placeholder="请输入账号" />
|
|
|
-
|
|
|
- <u-input v-model="password" prefixIcon="lock" placeholder="请输入密码" :password="inputIconBool">
|
|
|
+ <u-input v-model="password" prefixIcon="lock" placeholder="请输入密码" :password="isPassword">
|
|
|
<template #suffix>
|
|
|
- <text :class="!inputIconBool ? 'iconfont oaIcon-eye' : 'iconfont oaIcon-eye-close'" @click="inputIconBool = !inputIconBool"></text>
|
|
|
+ <text :class="!isPassword ? 'iconfont oaIcon-eye' : 'iconfont oaIcon-eye-close'" @click="isPassword = !isPassword"></text>
|
|
|
</template>
|
|
|
</u-input>
|
|
|
</view>
|
|
|
|
|
|
<button class="middle-submit" @click="submitRes">登 录</button>
|
|
|
|
|
|
- <view class="middle-switch">
|
|
|
+ <!-- #ifdef APP-PLUS || MP-WEIXIN || H5 -->
|
|
|
+ <view class="middle-switch" v-if="proxy.$common.isVisible()">
|
|
|
<text class="switch-loginMethod" @click="switchMode(1)">{{ switchText === "验证码登录" ? "账号密码登录" : "验证码登录" }}</text>
|
|
|
<view style="margin: auto"></view>
|
|
|
<text class="switch-register" @click="switchMode(2)">注册账号</text>
|
|
|
</view>
|
|
|
+ <!--#endif-->
|
|
|
|
|
|
<!-- #ifdef APP-PLUS || MP-WEIXIN -->
|
|
|
<view class="middle-agreed text-center">
|
|
@@ -66,31 +65,35 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import config from "@/config";
|
|
|
+/*----------------------------------依赖引入-----------------------------------*/
|
|
|
import { onLoad, onShow, onHide, onLaunch, onReady } from "@dcloudio/uni-app";
|
|
|
import { reactive, getCurrentInstance, toRefs, inject, nextTick } from "vue";
|
|
|
+/*----------------------------------接口引入-----------------------------------*/
|
|
|
+/*----------------------------------组件引入-----------------------------------*/
|
|
|
+/*----------------------------------store引入-----------------------------------*/
|
|
|
import { useStores, commonStores } from "@/store/modules/index";
|
|
|
-
|
|
|
+/*----------------------------------公共方法引入-----------------------------------*/
|
|
|
+import config from "@/config";
|
|
|
+/*----------------------------------公共变量-----------------------------------*/
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
const useStore = useStores();
|
|
|
const commonStore = commonStores();
|
|
|
-
|
|
|
-const { proxy } = getCurrentInstance();
|
|
|
-
|
|
|
-const data = reactive({
|
|
|
+/*----------------------------------变量声明-----------------------------------*/
|
|
|
+const state = reactive({
|
|
|
/** login数据 */
|
|
|
phone: undefined,
|
|
|
verify: undefined,
|
|
|
switchText: "验证码登录",
|
|
|
username: undefined,
|
|
|
password: undefined,
|
|
|
- inputIconBool: true,
|
|
|
+ isPassword: true,
|
|
|
/** 服务器配置数据 */
|
|
|
linkUrl: uni.getStorageSync("serveUrl"),
|
|
|
/** 用户隐私协议数据 */
|
|
|
userChecked: [true],
|
|
|
});
|
|
|
|
|
|
-const { phone, verify, switchText, username, password, inputIconBool, linkUrl, userChecked } = toRefs(data);
|
|
|
+const { phone, verify, switchText, username, password, isPassword, linkUrl, userChecked } = toRefs(state);
|
|
|
|
|
|
/**
|
|
|
* @跳转服务器配置
|
|
@@ -137,15 +140,12 @@ function init() {
|
|
|
useStore.SetInterval("codeTime"); //调用倒计时定时器
|
|
|
|
|
|
//#ifdef H5
|
|
|
- if (proxy.$common.isWechatMp()) {
|
|
|
- window.location.href = proxy.$BASE_URL + "/service-iot/weChat/getFirst1";
|
|
|
- }
|
|
|
+ useStore.GetWxOpenId(1); //调用获取微信公众号openId
|
|
|
|
|
|
if (window.location.host) {
|
|
|
linkUrl.value = window.location.host;
|
|
|
- linkUrl.value = "172.16.120.165:13200";
|
|
|
+ // linkUrl.value = "172.16.120.165:13200";
|
|
|
// linkUrl.value = "localhost:81";
|
|
|
-
|
|
|
useStore.GetMobileTenantConfig({ url: linkUrl.value });
|
|
|
}
|
|
|
//#endif
|
|
@@ -192,11 +192,14 @@ function submitRes() {
|
|
|
proxy.$modal.msg("请输入验证码");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
login({
|
|
|
phone: phone.value,
|
|
|
verify: verify.value,
|
|
|
tenantId: useStore.tenantId,
|
|
|
cids: proxy.$settingStore.pushClientId,
|
|
|
+ type: proxy.$common.isWechatMp() ? "wx" : "app",
|
|
|
+ openId: useStore.wxOpenId || undefined,
|
|
|
});
|
|
|
} else {
|
|
|
if (!username.value) {
|
|
@@ -213,6 +216,8 @@ function submitRes() {
|
|
|
password: password.value,
|
|
|
tenantId: useStore.tenantId,
|
|
|
cids: proxy.$settingStore.pushClientId,
|
|
|
+ type: proxy.$common.isWechatMp() ? "wx" : "app",
|
|
|
+ openId: useStore.wxOpenId || undefined,
|
|
|
});
|
|
|
}
|
|
|
}
|