feat: 上传图片调试
This commit is contained in:
parent
ce75f9b8f6
commit
aa6e56c556
|
@ -220,12 +220,12 @@ export default {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
|
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
|
||||||
}
|
}
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: "开发调试查看nimei",
|
// title: "开发调试查看nimei",
|
||||||
content: JSON.stringify(data) || "未传入参数 initFn",
|
// content: JSON.stringify(data) || "未传入参数 initFn",
|
||||||
showCancel: true,
|
// showCancel: true,
|
||||||
success: function (res) {},
|
// success: function (res) {},
|
||||||
});
|
// });
|
||||||
let cardID = data.cardID;
|
let cardID = data.cardID;
|
||||||
// let nimei = data.nimei;
|
// let nimei = data.nimei;
|
||||||
let nimei = data.uuid;
|
let nimei = data.uuid;
|
||||||
|
|
|
@ -204,12 +204,14 @@ export default {
|
||||||
name: "back-iphone",
|
name: "back-iphone",
|
||||||
data: "",
|
data: "",
|
||||||
};
|
};
|
||||||
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // 给ios 传参
|
window.webkit.messageHandlers.func.postMessage(
|
||||||
|
JSON.stringify(reqRow)
|
||||||
|
); // 给ios 传参
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e, "e-----判断安卓苹果类型出错");
|
console.log(e, "e-----判断安卓苹果类型出错");
|
||||||
}
|
}
|
||||||
return
|
return;
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, // 每次拍摄1张
|
count: 1, // 每次拍摄1张
|
||||||
sourceType: ["camera"], // 仅限拍照
|
sourceType: ["camera"], // 仅限拍照
|
||||||
|
@ -226,18 +228,18 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// android回调
|
// android回调
|
||||||
uploadResFn(data){
|
uploadResFn(data) {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return uni.showToast({ title: "未传入参数 uploadFn", icon: "none" });
|
return uni.showToast({ title: "未传入参数 uploadFn", icon: "none" });
|
||||||
}
|
}
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: "查看uploadFn",
|
// title: "查看uploadFn",
|
||||||
content: JSON.stringify(data) || "未传入参数 initFn",
|
// content: JSON.stringify(data) || "未传入参数 initFn",
|
||||||
showCancel: true,
|
// showCancel: true,
|
||||||
success: function (res) {},
|
// success: function (res) {},
|
||||||
});
|
// });
|
||||||
|
|
||||||
// this.form.url = data.path
|
this.form.url = data.path;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 删除图片
|
// 删除图片
|
||||||
|
@ -263,8 +265,8 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await UploadFiles([this.form.url]);
|
// const res = await UploadFiles([this.form.url]);
|
||||||
if (!res.succeed) return;
|
// if (!res.succeed) return;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
note: this.form.note,
|
note: this.form.note,
|
||||||
|
@ -272,7 +274,8 @@ export default {
|
||||||
reportingTime: this.reportingTime.replace(" ", "T"),
|
reportingTime: this.reportingTime.replace(" ", "T"),
|
||||||
userId: this.dataInfo.userId,
|
userId: this.dataInfo.userId,
|
||||||
id: this.dataInfo.id,
|
id: this.dataInfo.id,
|
||||||
url: res.data[0].path,
|
// url: res.data[0].path,
|
||||||
|
url: this.form.url,
|
||||||
};
|
};
|
||||||
|
|
||||||
const res1 = await ReportingNFCDanger(params);
|
const res1 = await ReportingNFCDanger(params);
|
||||||
|
|
|
@ -119,6 +119,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() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -138,6 +139,32 @@ 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"], // 仅限拍照
|
||||||
|
@ -152,6 +179,21 @@ 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) {},
|
||||||
|
// });
|
||||||
|
|
||||||
|
this.imageList = [...this.imageList, data.path];
|
||||||
|
},
|
||||||
|
|
||||||
// 上传图片
|
// 上传图片
|
||||||
async uploadFiles() {
|
async uploadFiles() {
|
||||||
const res = await UploadFiles(this.imageList);
|
const res = await UploadFiles(this.imageList);
|
||||||
|
@ -186,9 +228,11 @@ export default {
|
||||||
picturesDto: [],
|
picturesDto: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const res = await UploadFiles(this.imageList);
|
// const res = await UploadFiles(this.imageList);
|
||||||
if (!res.succeed) return;
|
// if (!res.succeed) return;
|
||||||
params.picturesDto = res.data;
|
// params.picturesDto = res.data;
|
||||||
|
|
||||||
|
params.picturesDto = this.imageList;
|
||||||
|
|
||||||
const res2 = await UploadArea(params);
|
const res2 = await UploadArea(params);
|
||||||
if (res2.succeed) {
|
if (res2.succeed) {
|
||||||
|
|
Loading…
Reference in New Issue