退出登陆调整

This commit is contained in:
李彪 2025-04-18 13:51:49 +08:00
parent ee96a2b2f5
commit c3627c8629
4 changed files with 109 additions and 54 deletions

View File

@ -198,30 +198,40 @@ export default {
toPage(path, item) { toPage(path, item) {
if (item.title === "注销") { if (item.title === "注销") {
let u = navigator.userAgent; uni.showModal({
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android title: "提示",
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios content: "确定注销吗?",
try { showCancel: true,
if (isAndroid && AndroidJs) { success: function (res) {
console.log("%c%s", "color:red", "安卓--调用返回方法"); // 退
const reqRow = { let u = navigator.userAgent;
name: "logout", let isAndroid =
data: "", u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
}; // let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
AndroidJs.func(JSON.stringify(reqRow)); // try {
} else { if (isAndroid && AndroidJs) {
console.log("%c%s", "color:red", "苹果--调用返回方法"); console.log("%c%s", "color:red", "安卓--调用返回方法");
const reqRow = { const reqRow = {
name: "back-iphone", name: "logout",
data: "", data: "",
}; };
window.webkit.messageHandlers.func.postMessage( AndroidJs.func(JSON.stringify(reqRow)); //
JSON.stringify(reqRow) } else {
); // ios console.log("%c%s", "color:red", "苹果--调用返回方法");
} const reqRow = {
} catch (e) { name: "back-iphone",
console.log(e, "e-----判断安卓苹果类型出错"); data: "",
} };
window.webkit.messageHandlers.func.postMessage(
JSON.stringify(reqRow)
); // ios
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
}
return
},
});
return; return;
} }
if (!path) return; if (!path) return;

View File

@ -163,6 +163,7 @@ export default {
onLoad(options) { onLoad(options) {
console.log("options", JSON.parse(decodeURIComponent(options.params))); console.log("options", JSON.parse(decodeURIComponent(options.params)));
this.params = JSON.parse(decodeURIComponent(options.params)); this.params = JSON.parse(decodeURIComponent(options.params));
window.uploadFn = this.uploadResFn;
}, },
created() { created() {
@ -185,6 +186,29 @@ export default {
// //
takePhoto() { takePhoto() {
let u = navigator.userAgent;
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
try {
if (isAndroid && AndroidJs) {
console.log("%c%s", "color:red", "安卓--调用方法");
const reqRow = {
name: "upload",
data: "",
};
AndroidJs.func(JSON.stringify(reqRow)); //
} else {
console.log("%c%s", "color:red", "苹果--调用方法");
const reqRow = {
name: "back-iphone",
data: "",
};
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // ios
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
}
return
uni.chooseImage({ uni.chooseImage({
count: 1, // 1 count: 1, // 1
sourceType: ["camera"], // sourceType: ["camera"], //
@ -200,6 +224,18 @@ export default {
}, },
}); });
}, },
// android
uploadResFn(data){
if (!data) {
return uni.showToast({ title: "未传入参数 uploadFn", icon: "none" });
}
uni.showModal({
title: "查看uploadFn",
content: JSON.stringify(data) || "未传入参数 initFn",
showCancel: true,
success: function (res) {},
});
},
// //
handleDelete() { handleDelete() {

View File

@ -14,16 +14,16 @@
</view> </view>
<u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button> <u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button>
<u-button type="primary" @click="login1Fn" style="margin-top: 50rpx" <u-button type="primary" @click="login1Fn" style="margin-top: 50rpx"
>登陆13800451500清洁工</u-button >登陆13800451500-清洁工</u-button
> >
<u-button type="primary" @click="login2Fn" style="margin-top: 50rpx" <u-button type="primary" @click="login2Fn" style="margin-top: 50rpx"
>登陆18174010562管理员</u-button >登陆18174010562-管理员</u-button
> >
<u-button type="primary" @click="login4Fn" style="margin-top: 50rpx" <u-button type="primary" @click="login4Fn" style="margin-top: 50rpx"
>登陆18174010562清洁工</u-button >登陆18174010562-清洁工</u-button
> >
<u-button type="primary" @click="login3Fn" style="margin-top: 50rpx" <u-button type="primary" @click="login3Fn" style="margin-top: 50rpx"
>登陆18174010561</u-button >登陆18174010561-清洁工</u-button
> >
</view> </view>
</template> </template>

View File

@ -189,32 +189,41 @@ export default {
toPage(path,item) { toPage(path,item) {
if(item.title === '注销'){ if(item.title === '注销'){
let u = navigator.userAgent; uni.showModal({
let isAndroid = title: "提示",
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android content: "确定注销吗?",
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios showCancel: true,
try { success: function (res) {
if (isAndroid && AndroidJs) { // 退
console.log("%c%s", "color:red", "安卓--调用返回方法"); let u = navigator.userAgent;
const reqRow = { let isAndroid =
name: "logout", u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
data: "", // let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
}; try {
AndroidJs.func(JSON.stringify(reqRow)); // if (isAndroid && AndroidJs) {
} else { console.log("%c%s", "color:red", "安卓--调用返回方法");
console.log("%c%s", "color:red", "苹果--调用返回方法"); const reqRow = {
const reqRow = { name: "logout",
name: "back-iphone", data: "",
data: "", };
}; AndroidJs.func(JSON.stringify(reqRow)); //
window.webkit.messageHandlers.func.postMessage( } else {
JSON.stringify(reqRow) console.log("%c%s", "color:red", "苹果--调用返回方法");
); // ios const reqRow = {
} name: "back-iphone",
} catch (e) { data: "",
console.log(e, "e-----判断安卓苹果类型出错"); };
} window.webkit.messageHandlers.func.postMessage(
return JSON.stringify(reqRow)
); // ios
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
}
return
},
});
return;
} }
if (!path) return; if (!path) return;