增加内网内容

This commit is contained in:
xuli3099
2025-08-19 09:34:58 +08:00
parent 5e36cbb244
commit a0f2fab6bf
4 changed files with 53 additions and 10 deletions

View File

@@ -4,5 +4,5 @@ export const AGREEWELCOME_KEY="agreewelcome";
// clientId 默认写2
export const CLIENT_ID="2";
// #区分内外网 //1-内网2-外网
export const NETWORK_ENV=2;
export const NETWORK_ENV=1;

View File

@@ -1,16 +1,21 @@
import { createSSRApp } from "vue";
import App from "./App.vue";
import { CLIENT_ID,NETWORK_ENV } from '@/enums/cacheEnums';
import '@/static/font/iconfont.css'
// pinia
import { createPinia } from 'pinia'
const pinia = createPinia()
export function createApp() {
const app = createSSRApp(App);
app.config.globalProperties.$CLIENT_ID = CLIENT_ID;
app.config.globalProperties.$NETWORK_ENV = NETWORK_ENV;
app.use(pinia)
return {

View File

@@ -6,13 +6,26 @@
<view :style="{height: navBarPaddingTop + 'px'}"></view>
<view class="auth-title">
<image src="@/static/images/icon-lock@2x.png"/>
<text>设备授权</text>
<text>{{networkEnv==1?'内网':''}}设备授权</text>
</view>
<view class="login-con">
<!-- 登录 -->
<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">
<!-- 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">
<view class="code-con">
<uni-easyinput prefixIcon="person" :inputBorder="false"
@@ -80,7 +93,6 @@ import { v4 as uuidv4 } from 'uuid'
import { getNavBarPaddingTop} from '@/utils/system.js';
import { getBindStatus,authDeviceApply,authInputCode } from '@/api/auth.js';
import {showToast,showAlert} from '@/utils/message.js'
import { CLIENT_ID,NETWORK_ENV } from '@/enums/cacheEnums';
import encryptObj from '@/utils/encrypt.js'
import { requestAndroidPermissionAsync } from '@/utils/common.js'
@@ -94,8 +106,10 @@ const safeSave = uni.requireNativePlugin("Tm-TmSafeSaveFileModule");
// #endif
let systemInfo = {};
let deviceId = ref(undefined);
let clientId = `${proxy.$CLIENT_ID || 2}`;
let networkEnv = ref(proxy.$NETWORK_ENV);//1-内网 2-外网
onLoad(async(opt) => {
console.log("deviceAuth=>onLoad");
console.log("deviceAuth=>onLoad",clientId,networkEnv);
uni.setStorageSync('page_cache',true);
// uni.preloadPage({url: "/pages/login/login"});
// uni.preloadPage({url: "/pages/home/home"});
@@ -191,6 +205,11 @@ const formData2 = ref({
});
const rules2 = {
uniqCode:{
rules: [
{ required: true, errorMessage: '请输入设备标识' },
]
},
username: {
rules: [
{ required: true, errorMessage: '请输入用户名' },
@@ -210,14 +229,19 @@ const submitForm = async() => {
// 用户名和密码登录
form2.value.validate().then(async param => {
btnLoading.value = true;
deviceId.value = uuidv4();
let clientId = `${CLIENT_ID || 2}`;
//1-内网2-外网
if(networkEnv==1){
deviceId.value = form2.value.uniqCode;
}else{
deviceId.value = uuidv4(); //2-外网 生成的设备唯一标识
}
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
let params = {
username:param.username,
password,
networkEnv:NETWORK_ENV,//1-内网2-外网
uniqCode:deviceId.value,//生成的设备唯一标识
networkEnv:networkEnv.value,//1-内网2-外网
uniqCode:deviceId.value,
...systemInfo,//设备信息
// #ifdef APP-PLUS
verId:systemInfo.appWgtVersion,//当前版本号
@@ -443,6 +467,20 @@ const handleSubmit=()=>{
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{
width:496rpx;
height:88rpx;

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B