修改登录及设备授权处理

This commit is contained in:
xuli3099
2025-08-19 17:31:28 +08:00
parent 7fa1e5b2f9
commit 8f849cda40
5 changed files with 68 additions and 60 deletions

View File

@@ -73,7 +73,7 @@
</template>
<script setup>
import { ref,onMounted } from 'vue';
import { ref,onMounted,getCurrentInstance } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import customTabs from '@/components/customTabs.vue';
import {isPhoneNumber} from '@/utils/validate';
@@ -83,14 +83,17 @@ import { AGREEWELCOME_KEY } from '@/enums/cacheEnums';
import { getNavBarPaddingTop} from '@/utils/system.js'
import { useUserStore } from '@/stores/user';
import encryptObj from '@/utils/encrypt.js'
import { CLIENT_ID } from '@/enums/cacheEnums';
import {showAlert} from '@/utils/message.js'
// #ifdef APP-PLUS
// 获取 存储手机的module
const safeSave = uni.requireNativePlugin("Tm-TmSafeSaveFileModule");
// #endif
const userStore = useUserStore()
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
let clientId = `${proxy.$CLIENT_ID || 2}`;
let networkEnv = ref(proxy.$NETWORK_ENV);//1-内网 2-外网
onLoad(async(opt) => {
uni.setStorageSync('page_cache',true);
})
@@ -248,13 +251,13 @@ const submitForm = () => {
// 用户名和密码登录
form2.value.validate().then(async param => {
param.loginType = activeTab.value;
let clientId = `${CLIENT_ID || "2"}`;
param.clientId = clientId;
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
param.password = password;
param.runEnv = networkEnv.value;
// #ifdef H5
param.uniqCode = '7f47cfb4-59e2-4cb9-ac46-9da5e23c4de2';//uni.getStorageSync('app_device_id');//先从缓存取之后处理 '7f47cfb4-59e2-4cb9-ac46-9da5e23c4de2'//
param.uniqCode = 'e5687e80-526f-4522-ba7d-41d5db197a15';//h5测试用
let res = await login(param);
userStore.login(res);
uni.switchTab({ url: '/pages/home/home' })