增加内网设备绑定
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;
|
||||||
|
|
||||||
|
|||||||
@@ -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 code-device">
|
||||||
|
<uni-easyinput prefixIcon="person" :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"
|
||||||
@@ -96,7 +109,7 @@ let deviceId = ref(undefined);
|
|||||||
let clientId = `${proxy.$CLIENT_ID || 2}`;
|
let clientId = `${proxy.$CLIENT_ID || 2}`;
|
||||||
let networkEnv = ref(proxy.$NETWORK_ENV);//1-内网 2-外网
|
let networkEnv = ref(proxy.$NETWORK_ENV);//1-内网 2-外网
|
||||||
onLoad(async(opt) => {
|
onLoad(async(opt) => {
|
||||||
console.log("deviceAuth=>onLoad",clientId,networkEnv);
|
console.log("deviceAuth=>onLoad",clientId,networkEnv.value);
|
||||||
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"});
|
||||||
@@ -187,11 +200,17 @@ let refreshBindStatus = async ()=>{
|
|||||||
// 账号登录
|
// 账号登录
|
||||||
const form2 = ref(null);
|
const form2 = ref(null);
|
||||||
const formData2 = ref({
|
const formData2 = ref({
|
||||||
|
uniqCode:'',
|
||||||
username: '',
|
username: '',
|
||||||
password: ''
|
password: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const rules2 = {
|
const rules2 = {
|
||||||
|
uniqCode:{
|
||||||
|
rules: [
|
||||||
|
{ required: true, errorMessage: '请输入设备标识' },
|
||||||
|
]
|
||||||
|
},
|
||||||
username: {
|
username: {
|
||||||
rules: [
|
rules: [
|
||||||
{ required: true, errorMessage: '请输入用户名' },
|
{ required: true, errorMessage: '请输入用户名' },
|
||||||
@@ -212,8 +231,8 @@ const submitForm = async() => {
|
|||||||
form2.value.validate().then(async param => {
|
form2.value.validate().then(async param => {
|
||||||
btnLoading.value = true;
|
btnLoading.value = true;
|
||||||
//1-内网,2-外网
|
//1-内网,2-外网
|
||||||
if(networkEnv==1){
|
if(networkEnv.value==1){
|
||||||
deviceId.value = form2.value.uniqCode;
|
deviceId.value = param.uniqCode;
|
||||||
}else{
|
}else{
|
||||||
deviceId.value = uuidv4(); //2-外网 生成的设备唯一标识
|
deviceId.value = uuidv4(); //2-外网 生成的设备唯一标识
|
||||||
}
|
}
|
||||||
@@ -450,6 +469,31 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container .login-form .code-con.code-device :deep(.uni-easyinput__content .uniui-person){
|
||||||
|
background: url('@/static/images/login-biaoshi.png') 15rpx no-repeat;
|
||||||
|
background-size:25rpx 30rpx;
|
||||||
|
width: 25rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
margin-right:10rpx;
|
||||||
|
}
|
||||||
|
.container .login-form .code-con.code-device :deep(.uniui-person:before){
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-submit{
|
.btn-submit{
|
||||||
width:496rpx;
|
width:496rpx;
|
||||||
height:88rpx;
|
height:88rpx;
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
>
|
>
|
||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<!-- 删除设备ID--测试用 -->
|
<!-- 删除设备ID--测试用 -->
|
||||||
<!-- <view class="del-cache" @click="handleDelete">
|
<view class="del-cache" @click="handleDelete">
|
||||||
<uni-icons type="minus" size="30" color="#ffffff"></uni-icons>
|
<uni-icons type="minus" size="30" color="#ffffff"></uni-icons>
|
||||||
</view> -->
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
|
|
||||||
<!-- 待办内容 -->
|
<!-- 待办内容 -->
|
||||||
|
|||||||
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