修改登录及设备授权处理
This commit is contained in:
@@ -200,6 +200,7 @@ let refreshBindStatus = async ()=>{
|
|||||||
// 账号登录
|
// 账号登录
|
||||||
const form2 = ref(null);
|
const form2 = ref(null);
|
||||||
const formData2 = ref({
|
const formData2 = ref({
|
||||||
|
uniqCode:'',
|
||||||
username: '',
|
username: '',
|
||||||
password: ''
|
password: ''
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,71 +1,71 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view id="test">
|
||||||
|
<!-- #ifdef h5 -->
|
||||||
<web-view :src="url"></web-view>
|
<web-view :src="url"></web-view>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref,onMounted,getCurrentInstance } from 'vue';
|
import { ref,onMounted,getCurrentInstance } from 'vue';
|
||||||
import { onLoad,onReady } from '@dcloudio/uni-app';
|
import { onLoad,onReady,onBackPress } from '@dcloudio/uni-app';
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
let windowInfo = ref(null);
|
let windowInfo = ref(null);
|
||||||
let url = ref('');
|
let url = ref('');
|
||||||
let title = ref('');
|
let title = ref('');
|
||||||
//将要创建的webview对象
|
|
||||||
let wv;
|
|
||||||
onLoad(async(opt) => {
|
onLoad(async(opt) => {
|
||||||
// console.log(opt)
|
console.log(opt)
|
||||||
url.value = opt.url;
|
url.value = opt.url;
|
||||||
title.value = opt.title;
|
title.value = opt.title;
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
titleNViewWebview(url.value,title.value);
|
||||||
|
// #endif
|
||||||
|
// uni.getSystemInfo({
|
||||||
|
// success: (res)=> {
|
||||||
|
// windowInfo.value = res;
|
||||||
|
// createWvAndLoadUrl(url.value,title.value);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
})
|
})
|
||||||
|
|
||||||
onReady(()=>{
|
|
||||||
setTimeout(()=>{
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title:title.value
|
|
||||||
})
|
|
||||||
},2000)
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
uni.getSystemInfo({
|
// 带标题栏控件的Webview窗口
|
||||||
success: (res)=> {
|
let webview = null;
|
||||||
windowInfo.value = res;
|
function titleNViewWebview(url,title) {
|
||||||
createWvAndLoadUrl(url.value);
|
webview = plus.webview.create(url, 'test', {
|
||||||
|
titleNView: {
|
||||||
|
backgroundColor: '#307AF5',
|
||||||
|
titleText: title,
|
||||||
|
titleColor: '#ffffff',
|
||||||
|
autoBackButton: true,
|
||||||
|
backgroundImage:'./../../static/images/bg-Blue-header.png',
|
||||||
|
buttons:[{onclick:clickButton}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
webview.addEventListener('close', function(){
|
||||||
|
webview=null;
|
||||||
/*创建web-view并加载url*/
|
});
|
||||||
const createWvAndLoadUrl=(url)=>{
|
webview.addEventListener('titleUpdate', function(){
|
||||||
// #ifdef APP-PLUS
|
webview.show();
|
||||||
wv = plus.webview.create(url,"webview",{
|
});
|
||||||
// plusrequire:"none", //禁止远程网页使用plus的API,有些使用mui制作的网页可能会监听plus.key,造成关闭页面混乱,可以通过这种方式禁止
|
webview.addEventListener('loading', () => {
|
||||||
top: 0,//this.windowInfo.statusBarHeight + 126, //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
|
|
||||||
scalable: true,
|
|
||||||
height: windowInfo.value.windowHeight - windowInfo.value.statusBarHeight //- 126
|
|
||||||
})
|
|
||||||
wv.addEventListener('loading', () => {
|
|
||||||
plus.nativeUI.showWaiting("loading...",{
|
plus.nativeUI.showWaiting("loading...",{
|
||||||
width:'110px',
|
width:'110px',
|
||||||
padding:'10px'
|
padding:'10px'
|
||||||
})
|
})
|
||||||
}, false);
|
}, false);
|
||||||
//plus.nativeUI.showWaiting()
|
//plus.nativeUI.showWaiting()
|
||||||
wv.addEventListener('loaded', () => {
|
webview.addEventListener('loaded', () => {
|
||||||
plus.nativeUI.closeWaiting();
|
plus.nativeUI.closeWaiting();
|
||||||
}, false);
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
//wv.loadURL(url)
|
// 左侧按钮返回
|
||||||
let currentWebview = proxy.$scope.$getAppWebview();
|
function clickButton(){
|
||||||
currentWebview = wv;
|
// plus.nativeUI.alert('clicked!');
|
||||||
// console.log(wv)
|
webview=null;
|
||||||
// setTimeout(()=> {
|
|
||||||
// console.log(wv.getStyle())
|
|
||||||
// }, 1000);
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -254,10 +254,10 @@ const submitForm = () => {
|
|||||||
param.clientId = clientId;
|
param.clientId = clientId;
|
||||||
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
|
let password = encryptObj.Encrypt(param.username + clientId + "," + param.password);
|
||||||
param.password = password;
|
param.password = password;
|
||||||
param.runEnv = networkEnv;
|
param.runEnv = networkEnv.value;
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
param.uniqCode = '7f47cfb4-59e2-4cb9-ac46-9da5e23c4de2';//uni.getStorageSync('app_device_id');//先从缓存取之后处理
|
param.uniqCode = 'e5687e80-526f-4522-ba7d-41d5db197a15';//h5测试用
|
||||||
let res = await login(param);
|
let res = await login(param);
|
||||||
userStore.login(res);
|
userStore.login(res);
|
||||||
uni.switchTab({ url: '/pages/home/home' })
|
uni.switchTab({ url: '/pages/home/home' })
|
||||||
|
|||||||
Reference in New Issue
Block a user