退出登陆调整

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) {
if (item.title === "注销") {
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: "logout",
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-----判断安卓苹果类型出错");
}
uni.showModal({
title: "提示",
content: "确定注销吗?",
showCancel: true,
success: function (res) {
// 退
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: "logout",
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
},
});
return;
}
if (!path) return;

View File

@ -163,6 +163,7 @@ export default {
onLoad(options) {
console.log("options", JSON.parse(decodeURIComponent(options.params)));
this.params = JSON.parse(decodeURIComponent(options.params));
window.uploadFn = this.uploadResFn;
},
created() {
@ -185,6 +186,29 @@ export default {
//
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({
count: 1, // 1
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() {

View File

@ -14,16 +14,16 @@
</view>
<u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button>
<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"
>登陆18174010562管理员</u-button
>登陆18174010562-管理员</u-button
>
<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"
>登陆18174010561</u-button
>登陆18174010561-清洁工</u-button
>
</view>
</template>

View File

@ -189,32 +189,41 @@ export default {
toPage(path,item) {
if(item.title === '注销'){
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: "logout",
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.showModal({
title: "提示",
content: "确定注销吗?",
showCancel: true,
success: function (res) {
// 退
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: "logout",
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
},
});
return;
}
if (!path) return;