解决冲突
This commit is contained in:
commit
89b91a936d
|
@ -33,8 +33,7 @@ export const GetPlanInfoAre = (data) =>
|
||||||
request.post("/api/App/GetPlanInfoAre", data);
|
request.post("/api/App/GetPlanInfoAre", data);
|
||||||
|
|
||||||
// 获取计划列表
|
// 获取计划列表
|
||||||
export const GetPlanList = (data) =>
|
export const GetPlanList = (data) => request.get("/api/App/GetPlanList", data);
|
||||||
request.get("/api/App/GetPlanList", data);
|
|
||||||
|
|
||||||
// 获取单位信息
|
// 获取单位信息
|
||||||
export const GetCompanyInformation = (data) =>
|
export const GetCompanyInformation = (data) =>
|
||||||
|
@ -45,13 +44,11 @@ export const ReportingNFCDanger = (data) =>
|
||||||
request.post("/api/App/ReportingNFCDanger", data);
|
request.post("/api/App/ReportingNFCDanger", data);
|
||||||
|
|
||||||
// 上传图片
|
// 上传图片
|
||||||
export const UploadFiles = (formData) =>
|
export const UploadFiles = (fileList, params) =>
|
||||||
request.upload("/api/App/UploadFiles", formData);
|
request.upload("/api/App/UploadFiles", fileList, params);
|
||||||
|
|
||||||
// 上传
|
|
||||||
export const UploadArea = (data) =>
|
|
||||||
request.post("/api/App/UploadArea", data);
|
|
||||||
|
|
||||||
// 获取待上传区域
|
// 获取待上传区域
|
||||||
export const GetAwaitUploadAreaApi = (data) =>
|
export const GetAwaitUploadAreaApi = (data) =>
|
||||||
request.get("/api/App/GetAwaitUploadArea", data);
|
request.get("/api/App/GetAwaitUploadArea", data);
|
||||||
|
// 修改上传接口定义
|
||||||
|
export const UploadArea = (data) => request.post("/api/App/UploadArea", data);
|
||||||
|
|
|
@ -2,64 +2,78 @@
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<u-navbar title="保洁详情"></u-navbar>
|
<u-navbar title="保洁详情"></u-navbar>
|
||||||
<view class="area-info">
|
<view class="area-info">
|
||||||
<view class="name">保洁区域名称</view>
|
<view class="name">{{ dataInfo.name }}</view>
|
||||||
<view class="position">所在区域:学校操场</view>
|
<view class="position">所属计划:{{ dataInfo.planName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="area-details">
|
<view class="area-details">
|
||||||
<view class="title">区域详情</view>
|
<view class="title">区域详情</view>
|
||||||
<view class="details">
|
<view class="details">
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<view class="value">室内/室外</view>
|
<view class="value"> {{ dataInfo.areaType }}</view>
|
||||||
<view class="label">区域类型</view>
|
<view class="label">区域类型</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<view class="value">保洁员1号</view>
|
<view class="value">{{ dataInfo.userName }}</view>
|
||||||
<view class="label">保洁人员</view>
|
<view class="label">保洁人员</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<view class="value">2024/1/27 9:53:35</view>
|
<view class="value">{{ dataInfo.cleanTime }}</view>
|
||||||
<view class="label">清扫时间</view>
|
<view class="label">清扫时间</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<view class="value">清扫完成</view>
|
<view class="value">{{ dataInfo.note }}</view>
|
||||||
<view class="label">备注</view>
|
<view class="label">备注</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="title">保洁区域图片</view>
|
<view class="title">保洁区域图片</view>
|
||||||
<view class="images">
|
<view class="images">
|
||||||
<u-image
|
<image
|
||||||
class="image"
|
class="image"
|
||||||
v-for="(v, i) in 7"
|
v-for="(v, i) in dataInfo.pictures"
|
||||||
:key="i"
|
:key="i"
|
||||||
width="212rpx"
|
mode="scaleToFill"
|
||||||
height="212rpx"
|
style="width: 180rpx; height: 180rpx; border-radius: 18rpx"
|
||||||
src="https://cdn.uviewui.com/uview/example/fade.jpg"
|
:src="BASE_URL + '/uploads/' + v.path"
|
||||||
></u-image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import BASE_URL from "@/api/env.js"; //引入接口共用地址
|
||||||
import { GetPlanInfoAre } from "@/api/apiList";
|
import { GetPlanInfoAre } from "@/api/apiList";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: "",
|
id: "",
|
||||||
|
|
||||||
|
params: {},
|
||||||
|
|
||||||
|
dataInfo: {},
|
||||||
|
|
||||||
|
BASE_URL,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.id = options.id;
|
console.log("options", JSON.parse(decodeURIComponent(options.params)));
|
||||||
|
this.params = JSON.parse(decodeURIComponent(options.params));
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
this.getAreaInfo();
|
this.getAreaInfo();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async getAreaInfo() {
|
async getAreaInfo() {
|
||||||
const res = await GetPlanInfoAre({
|
const res = await GetPlanInfoAre({
|
||||||
id: this.id,
|
id: this.params.id,
|
||||||
});
|
});
|
||||||
console.log(res);
|
|
||||||
|
if (res.succeed) {
|
||||||
|
this.dataInfo = res.data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="arealist" v-if="dataInfo.areas.length > 0">
|
<view class="arealist" v-if="dataInfo.areas.length > 0">
|
||||||
<view class="block-info" v-for="item in dataInfo.areas" :key="item.id">
|
<view class="block-info" v-for="item in dataInfo.areas" :key="item.id" @click="toItemPage(item)">
|
||||||
<view v-if="!item.isCompleted" class="schedule schedule-wait"
|
<view v-if="!item.isCompleted" class="schedule schedule-wait"
|
||||||
>待保洁</view
|
>待保洁</view
|
||||||
>
|
>
|
||||||
|
@ -57,7 +57,13 @@
|
||||||
:text="item.areaType"
|
:text="item.areaType"
|
||||||
class="tag"
|
class="tag"
|
||||||
border-color="transparent"
|
border-color="transparent"
|
||||||
:type="item.areaType === '室外' ? 'success' : 'primary'"
|
:type="
|
||||||
|
item.areaType === '室外'
|
||||||
|
? 'success'
|
||||||
|
: item.areaType === '特殊'
|
||||||
|
? 'warning'
|
||||||
|
: 'primary'
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<!-- 特殊先隐藏,没有这个字段 -->
|
<!-- 特殊先隐藏,没有这个字段 -->
|
||||||
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
|
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
|
||||||
|
@ -249,7 +255,9 @@ export default {
|
||||||
// 先关闭弹窗再跳转
|
// 先关闭弹窗再跳转
|
||||||
this.successShow = false;
|
this.successShow = false;
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/index/uploadPhoto?params=" + encodeURIComponent(JSON.stringify(params)),
|
url:
|
||||||
|
"/pages/index/uploadPhoto?params=" +
|
||||||
|
encodeURIComponent(JSON.stringify(params)),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 异常上报
|
// 异常上报
|
||||||
|
@ -262,6 +270,14 @@ export default {
|
||||||
url: "/pages/index/list",
|
url: "/pages/index/list",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toItemPage(item) {
|
||||||
|
console.log("%c%s", "color:red", "跳转至详情页");
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/cleanDetails?params=" + encodeURIComponent(JSON.stringify(item)),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
openFn() {},
|
openFn() {},
|
||||||
closeFn() {},
|
closeFn() {},
|
||||||
changeTab(i) {
|
changeTab(i) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ export default {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, // 每次拍摄1张
|
count: 1, // 每次拍摄1张
|
||||||
sourceType: ["camera"], // 仅限拍照
|
sourceType: ["camera"], // 仅限拍照
|
||||||
sizeType: ["compressed"], // 压缩图片
|
sizeType: ["compressed", "original"],
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
// console.log("拍照成功", res);
|
// console.log("拍照成功", res);
|
||||||
this.imageList = [...this.imageList, res.tempFilePaths[0]];
|
this.imageList = [...this.imageList, res.tempFilePaths[0]];
|
||||||
|
@ -153,8 +153,8 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 上传图片
|
// 上传图片
|
||||||
async uploadFiles(filePath) {
|
async uploadFiles() {
|
||||||
const res = await UploadFiles(filePath);
|
const res = await UploadFiles(this.imageList);
|
||||||
if (res.succeed) {
|
if (res.succeed) {
|
||||||
this.imageList = [...this.imageList, res.data];
|
this.imageList = [...this.imageList, res.data];
|
||||||
}
|
}
|
||||||
|
@ -183,23 +183,20 @@ export default {
|
||||||
const params = {
|
const params = {
|
||||||
id: this.params.areaId,
|
id: this.params.areaId,
|
||||||
note: this.remark,
|
note: this.remark,
|
||||||
|
picturesDto: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const formData = new FormData();
|
const res = await UploadFiles(this.imageList);
|
||||||
formData.append("id", this.params.areaId);
|
if (res.succeed) {
|
||||||
formData.append("note", this.remark);
|
params.picturesDto = res.data;
|
||||||
for (const file of this.imageList) {
|
|
||||||
formData.append("files", file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("提交表单", params);
|
const res2 = await UploadArea(params);
|
||||||
console.log("提交表单", picturesDto, this.remark);
|
if (res2.succeed) {
|
||||||
|
|
||||||
const res = await UploadArea(formData);
|
|
||||||
|
|
||||||
if (res.succeed) {
|
|
||||||
// 成功的处理
|
// 成功的处理
|
||||||
uni.showToast({ title: "上传成功", icon: "success" });
|
uni.showToast({ title: "上传成功", icon: "success" });
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res2.error || "上传失败", icon: "none" });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,15 +46,16 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (successData.statusCode === 401) {
|
if (successData.statusCode === 401) {
|
||||||
console.log(successData,'successData--')
|
console.log(successData, "successData--");
|
||||||
console.log('%c%s', 'color:red', '登录过期')
|
console.log("%c%s", "color:red", "登录过期");
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
content: "登陆过期,请重新登陆",
|
content: "登陆过期,请重新登陆",
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
let u = navigator.userAgent;
|
let u = navigator.userAgent;
|
||||||
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
|
let isAndroid =
|
||||||
|
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
|
||||||
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
|
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
|
||||||
try {
|
try {
|
||||||
if (isAndroid && AndroidJs) {
|
if (isAndroid && AndroidJs) {
|
||||||
|
@ -70,7 +71,9 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
|
||||||
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-----判断安卓苹果类型出错");
|
||||||
|
@ -78,7 +81,7 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
reject(res);
|
reject(res);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
console.log("网络连接失败,请稍后重试", url);
|
console.log("网络连接失败,请稍后重试", url);
|
||||||
toast("网络连接失败,请稍后重试");
|
toast("网络连接失败,请稍后重试");
|
||||||
|
@ -94,8 +97,8 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加文件上传的基础方法
|
// 修改基础上传方法以支持多文件
|
||||||
const baseUpload = async (api, filePath, formData = {}, loading = true) => {
|
const baseUpload = async (api, fileList, formData = {}, loading = true) => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "上传中...",
|
title: "上传中...",
|
||||||
|
@ -109,14 +112,14 @@ const baseUpload = async (api, filePath, formData = {}, loading = true) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: BASE_URL + api,
|
url: BASE_URL + api,
|
||||||
filePath: filePath,
|
files: fileList.map((filePath) => ({
|
||||||
name: "Files", // 文件对应的 key
|
name: "Files",
|
||||||
formData: formData,
|
uri: filePath,
|
||||||
|
})),
|
||||||
|
formData: formData, // 额外的表单数据
|
||||||
header: header,
|
header: header,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (loading) uni.hideLoading();
|
if (loading) uni.hideLoading();
|
||||||
|
|
||||||
// 处理响应数据
|
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
const data = JSON.parse(res.data);
|
const data = JSON.parse(res.data);
|
||||||
if (data.succeed) {
|
if (data.succeed) {
|
||||||
|
@ -147,8 +150,8 @@ const baseUpload = async (api, filePath, formData = {}, loading = true) => {
|
||||||
const request = {};
|
const request = {};
|
||||||
|
|
||||||
// 将 upload 方法添加到 request 对象中
|
// 将 upload 方法添加到 request 对象中
|
||||||
request.upload = (api, filePath, formData, loading) =>
|
request.upload = (api, fileList, formData, loading) =>
|
||||||
baseUpload(api, filePath, formData, loading);
|
baseUpload(api, fileList, formData, loading);
|
||||||
|
|
||||||
["options", "get", "post", "put", "head", "delete", "trace", "connect"].forEach(
|
["options", "get", "post", "put", "head", "delete", "trace", "connect"].forEach(
|
||||||
(method) => {
|
(method) => {
|
||||||
|
|
Loading…
Reference in New Issue