增加内网内容
This commit is contained in:
@@ -4,5 +4,5 @@ export const AGREEWELCOME_KEY="agreewelcome";
|
|||||||
// clientId 默认写2
|
// clientId 默认写2
|
||||||
export const CLIENT_ID="2";
|
export const CLIENT_ID="2";
|
||||||
// #区分内外网 //1-内网,2-外网
|
// #区分内外网 //1-内网,2-外网
|
||||||
export const NETWORK_ENV=2;
|
export const NETWORK_ENV=1;
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
import { createSSRApp } from "vue";
|
import { createSSRApp } from "vue";
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
|
import { CLIENT_ID,NETWORK_ENV } from '@/enums/cacheEnums';
|
||||||
import '@/static/font/iconfont.css'
|
import '@/static/font/iconfont.css'
|
||||||
|
|
||||||
// pinia
|
// pinia
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
|
|
||||||
const app = createSSRApp(App);
|
const app = createSSRApp(App);
|
||||||
|
|
||||||
|
app.config.globalProperties.$CLIENT_ID = CLIENT_ID;
|
||||||
|
app.config.globalProperties.$NETWORK_ENV = NETWORK_ENV;
|
||||||
|
|
||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -6,13 +6,26 @@
|
|||||||
<view :style="{height: navBarPaddingTop + 'px'}"></view>
|
<view :style="{height: navBarPaddingTop + 'px'}"></view>
|
||||||
<view class="auth-title">
|
<view class="auth-title">
|
||||||
<image src="@/static/images/icon-lock@2x.png"/>
|
<image src="@/static/images/icon-lock@2x.png"/>
|
||||||
<text>设备授权</text>
|
<text>{{networkEnv==1?'内网':''}}设备授权</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="login-con">
|
<view class="login-con">
|
||||||
<!-- 登录 -->
|
<!-- 登录 -->
|
||||||
<block v-if="!bindStatus">
|
<block v-if="!bindStatus">
|
||||||
<view class="login-form">
|
<view class="login-form" :class="{network1:networkEnv==1}">
|
||||||
<uni-forms ref="form2" :model="formData2" :rules="rules2" label-position="top">
|
<uni-forms ref="form2" :model="formData2" :rules="rules2" label-position="top">
|
||||||
|
<!-- networkEnv -->
|
||||||
|
<uni-forms-item label="设备标识" required name="uniqCode" v-if="networkEnv==1">
|
||||||
|
<view class="code-con">
|
||||||
|
<uni-easyinput :inputBorder="false"
|
||||||
|
v-model="formData2.uniqCode" placeholder="请输入设备标识"
|
||||||
|
>
|
||||||
|
<!-- <template #prefixIcon>
|
||||||
|
<image src="/static/images/login-biaoshi.png" style="width: 20px; height: 20px;" />
|
||||||
|
</template> -->
|
||||||
|
|
||||||
|
</uni-easyinput>
|
||||||
|
</view>
|
||||||
|
</uni-forms-item>
|
||||||
<uni-forms-item label="用户名" required name="username">
|
<uni-forms-item label="用户名" required name="username">
|
||||||
<view class="code-con">
|
<view class="code-con">
|
||||||
<uni-easyinput prefixIcon="person" :inputBorder="false"
|
<uni-easyinput prefixIcon="person" :inputBorder="false"
|
||||||
@@ -80,7 +93,6 @@ import { v4 as uuidv4 } from 'uuid'
|
|||||||
import { getNavBarPaddingTop} from '@/utils/system.js';
|
import { getNavBarPaddingTop} from '@/utils/system.js';
|
||||||
import { getBindStatus,authDeviceApply,authInputCode } from '@/api/auth.js';
|
import { getBindStatus,authDeviceApply,authInputCode } from '@/api/auth.js';
|
||||||
import {showToast,showAlert} from '@/utils/message.js'
|
import {showToast,showAlert} from '@/utils/message.js'
|
||||||
import { CLIENT_ID,NETWORK_ENV } from '@/enums/cacheEnums';
|
|
||||||
import encryptObj from '@/utils/encrypt.js'
|
import encryptObj from '@/utils/encrypt.js'
|
||||||
import { requestAndroidPermissionAsync } from '@/utils/common.js'
|
import { requestAndroidPermissionAsync } from '@/utils/common.js'
|
||||||
|
|
||||||
@@ -94,8 +106,10 @@ const safeSave = uni.requireNativePlugin("Tm-TmSafeSaveFileModule");
|
|||||||
// #endif
|
// #endif
|
||||||
let systemInfo = {};
|
let systemInfo = {};
|
||||||
let deviceId = ref(undefined);
|
let deviceId = ref(undefined);
|
||||||
|
let clientId = `${proxy.$CLIENT_ID || 2}`;
|
||||||
|
let networkEnv = ref(proxy.$NETWORK_ENV);//1-内网 2-外网
|
||||||
onLoad(async(opt) => {
|
onLoad(async(opt) => {
|
||||||
console.log("deviceAuth=>onLoad");
|
console.log("deviceAuth=>onLoad",clientId,networkEnv);
|
||||||
uni.setStorageSync('page_cache',true);
|
uni.setStorageSync('page_cache',true);
|
||||||
// uni.preloadPage({url: "/pages/login/login"});
|
// uni.preloadPage({url: "/pages/login/login"});
|
||||||
// uni.preloadPage({url: "/pages/home/home"});
|
// uni.preloadPage({url: "/pages/home/home"});
|
||||||
@@ -191,6 +205,11 @@ const formData2 = ref({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const rules2 = {
|
const rules2 = {
|
||||||
|
uniqCode:{
|
||||||
|
rules: [
|
||||||
|
{ required: true, errorMessage: '请输入设备标识' },
|
||||||
|
]
|
||||||
|
},
|
||||||
username: {
|
username: {
|
||||||
rules: [
|
rules: [
|
||||||
{ required: true, errorMessage: '请输入用户名' },
|
{ required: true, errorMessage: '请输入用户名' },
|
||||||
@@ -210,14 +229,19 @@ const submitForm = async() => {
|
|||||||
// 用户名和密码登录
|
// 用户名和密码登录
|
||||||
form2.value.validate().then(async param => {
|
form2.value.validate().then(async param => {
|
||||||
btnLoading.value = true;
|
btnLoading.value = true;
|
||||||
deviceId.value = uuidv4();
|
//1-内网,2-外网
|
||||||
let clientId = `${CLIENT_ID || 2}`;
|
if(networkEnv==1){
|
||||||
|
deviceId.value = form2.value.uniqCode;
|
||||||
|
}else{
|
||||||
|
deviceId.value = uuidv4(); //2-外网 生成的设备唯一标识
|
||||||
|
}
|
||||||
|
|
||||||
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
|
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
|
||||||
let params = {
|
let params = {
|
||||||
username:param.username,
|
username:param.username,
|
||||||
password,
|
password,
|
||||||
networkEnv:NETWORK_ENV,//1-内网,2-外网
|
networkEnv:networkEnv.value,//1-内网,2-外网
|
||||||
uniqCode:deviceId.value,//生成的设备唯一标识
|
uniqCode:deviceId.value,
|
||||||
...systemInfo,//设备信息
|
...systemInfo,//设备信息
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
verId:systemInfo.appWgtVersion,//当前版本号
|
verId:systemInfo.appWgtVersion,//当前版本号
|
||||||
@@ -443,6 +467,20 @@ const handleSubmit=()=>{
|
|||||||
content: "\e66c" !important;
|
content: "\e66c" !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 加设备ID样式 */
|
||||||
|
.container .login-form.network1{
|
||||||
|
padding-bottom:50rpx;
|
||||||
|
}
|
||||||
|
.container .login-form.network1 .code-con{
|
||||||
|
padding:0 0 3rpx;
|
||||||
|
}
|
||||||
|
.container .login-form.network1 :deep(.uni-forms-item){
|
||||||
|
margin-bottom:10px !important
|
||||||
|
}
|
||||||
|
.container .login-form.network1 :deep(.uni-easyinput__content-input){
|
||||||
|
height: 30px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-submit{
|
.btn-submit{
|
||||||
width:496rpx;
|
width:496rpx;
|
||||||
height:88rpx;
|
height:88rpx;
|
||||||
|
|||||||
BIN
src/static/images/login-biaoshi.png
Normal file
BIN
src/static/images/login-biaoshi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 860 B |
Reference in New Issue
Block a user