解决冲突

This commit is contained in:
李彪 2025-04-14 09:10:01 +08:00
commit 89b91a936d
5 changed files with 88 additions and 61 deletions

View File

@ -33,8 +33,7 @@ export const GetPlanInfoAre = (data) =>
request.post("/api/App/GetPlanInfoAre", data);
// 获取计划列表
export const GetPlanList = (data) =>
request.get("/api/App/GetPlanList", data);
export const GetPlanList = (data) => request.get("/api/App/GetPlanList", data);
// 获取单位信息
export const GetCompanyInformation = (data) =>
@ -45,13 +44,11 @@ export const ReportingNFCDanger = (data) =>
request.post("/api/App/ReportingNFCDanger", data);
// 上传图片
export const UploadFiles = (formData) =>
request.upload("/api/App/UploadFiles", formData);
// 上传
export const UploadArea = (data) =>
request.post("/api/App/UploadArea", data);
export const UploadFiles = (fileList, params) =>
request.upload("/api/App/UploadFiles", fileList, params);
// 获取待上传区域
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);

View File

@ -2,64 +2,78 @@
<view class="content">
<u-navbar title="保洁详情"></u-navbar>
<view class="area-info">
<view class="name">保洁区域名称</view>
<view class="position">在区域学校操场</view>
<view class="name">{{ dataInfo.name }}</view>
<view class="position">属计划{{ dataInfo.planName }}</view>
</view>
<view class="area-details">
<view class="title">区域详情</view>
<view class="details">
<view class="block">
<view class="value">室内/室外</view>
<view class="value"> {{ dataInfo.areaType }}</view>
<view class="label">区域类型</view>
</view>
<view class="block">
<view class="value">保洁员1号</view>
<view class="value">{{ dataInfo.userName }}</view>
<view class="label">保洁人员</view>
</view>
<view class="block">
<view class="value">2024/1/27 9:53:35</view>
<view class="value">{{ dataInfo.cleanTime }}</view>
<view class="label">清扫时间</view>
</view>
<view class="block">
<view class="value">清扫完成</view>
<view class="value">{{ dataInfo.note }}</view>
<view class="label">备注</view>
</view>
</view>
<view class="title">保洁区域图片</view>
<view class="images">
<u-image
<image
class="image"
v-for="(v, i) in 7"
v-for="(v, i) in dataInfo.pictures"
:key="i"
width="212rpx"
height="212rpx"
src="https://cdn.uviewui.com/uview/example/fade.jpg"
></u-image>
mode="scaleToFill"
style="width: 180rpx; height: 180rpx; border-radius: 18rpx"
:src="BASE_URL + '/uploads/' + v.path"
></image>
</view>
</view>
</view>
</template>
<script>
import BASE_URL from "@/api/env.js"; //
import { GetPlanInfoAre } from "@/api/apiList";
export default {
data() {
return {
id: "",
params: {},
dataInfo: {},
BASE_URL,
};
},
onLoad(options) {
this.id = options.id;
console.log("options", JSON.parse(decodeURIComponent(options.params)));
this.params = JSON.parse(decodeURIComponent(options.params));
},
onShow() {
this.getAreaInfo();
},
methods: {
async getAreaInfo() {
const res = await GetPlanInfoAre({
id: this.id,
id: this.params.id,
});
console.log(res);
if (res.succeed) {
this.dataInfo = res.data;
}
},
},
};
@ -123,11 +137,11 @@ export default {
}
}
.images {
margin-top: 46rpx;
display: grid;
grid-template-columns: repeat(auto-fill, 212rpx);
gap: 20rpx; //
}
margin-top: 46rpx;
display: grid;
grid-template-columns: repeat(auto-fill, 212rpx);
gap: 20rpx; //
}
}
}
</style>

View File

@ -41,7 +41,7 @@
</view>
</view>
<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
>
@ -57,7 +57,13 @@
:text="item.areaType"
class="tag"
border-color="transparent"
:type="item.areaType === '室外' ? 'success' : 'primary'"
:type="
item.areaType === '室外'
? 'success'
: item.areaType === '特殊'
? 'warning'
: 'primary'
"
/>
<!-- 特殊先隐藏没有这个字段 -->
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
@ -249,7 +255,9 @@ export default {
//
this.successShow = false;
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",
});
},
toItemPage(item) {
console.log("%c%s", "color:red", "跳转至详情页");
uni.navigateTo({
url: "/pages/index/cleanDetails?params=" + encodeURIComponent(JSON.stringify(item)),
});
},
openFn() {},
closeFn() {},
changeTab(i) {

View File

@ -141,7 +141,7 @@ export default {
uni.chooseImage({
count: 1, // 1
sourceType: ["camera"], //
sizeType: ["compressed"], //
sizeType: ["compressed", "original"],
success: async (res) => {
// console.log("", res);
this.imageList = [...this.imageList, res.tempFilePaths[0]];
@ -153,8 +153,8 @@ export default {
},
//
async uploadFiles(filePath) {
const res = await UploadFiles(filePath);
async uploadFiles() {
const res = await UploadFiles(this.imageList);
if (res.succeed) {
this.imageList = [...this.imageList, res.data];
}
@ -183,23 +183,20 @@ export default {
const params = {
id: this.params.areaId,
note: this.remark,
picturesDto: [],
};
const formData = new FormData();
formData.append("id", this.params.areaId);
formData.append("note", this.remark);
for (const file of this.imageList) {
formData.append("files", file);
const res = await UploadFiles(this.imageList);
if (res.succeed) {
params.picturesDto = res.data;
}
console.log("提交表单", params);
console.log("提交表单", picturesDto, this.remark);
const res = await UploadArea(formData);
if (res.succeed) {
const res2 = await UploadArea(params);
if (res2.succeed) {
//
uni.showToast({ title: "上传成功", icon: "success" });
} else {
uni.showToast({ title: res2.error || "上传失败", icon: "none" });
}
},
},

View File

@ -45,16 +45,17 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
reslove(res);
}
} else {
if(successData.statusCode === 401){
console.log(successData,'successData--')
console.log('%c%s', 'color:red', '登录过期')
if (successData.statusCode === 401) {
console.log(successData, "successData--");
console.log("%c%s", "color:red", "登录过期");
uni.showModal({
title: "提示",
content: "登陆过期,请重新登陆",
showCancel: false,
success: function (res) {
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
try {
if (isAndroid && AndroidJs) {
@ -70,7 +71,9 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
name: "back-iphone",
data: "",
};
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // 给ios 传参
window.webkit.messageHandlers.func.postMessage(
JSON.stringify(reqRow)
); // 给ios 传参
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
@ -78,7 +81,7 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
},
});
reject(res);
return
return;
}
console.log("网络连接失败,请稍后重试", url);
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) {
uni.showLoading({
title: "上传中...",
@ -109,14 +112,14 @@ const baseUpload = async (api, filePath, formData = {}, loading = true) => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: BASE_URL + api,
filePath: filePath,
name: "Files", // 文件对应的 key
formData: formData,
files: fileList.map((filePath) => ({
name: "Files",
uri: filePath,
})),
formData: formData, // 额外的表单数据
header: header,
success: (res) => {
if (loading) uni.hideLoading();
// 处理响应数据
if (res.statusCode === 200) {
const data = JSON.parse(res.data);
if (data.succeed) {
@ -147,8 +150,8 @@ const baseUpload = async (api, filePath, formData = {}, loading = true) => {
const request = {};
// 将 upload 方法添加到 request 对象中
request.upload = (api, filePath, formData, loading) =>
baseUpload(api, filePath, formData, loading);
request.upload = (api, fileList, formData, loading) =>
baseUpload(api, fileList, formData, loading);
["options", "get", "post", "put", "head", "delete", "trace", "connect"].forEach(
(method) => {