main
scout 2 months ago
parent 4db5fa0085
commit 641364d8e9

@ -52,7 +52,7 @@ export default {
response = newResponse; response = newResponse;
} }
} }
if (response.data.status === 401) { if (response.data.code === 401) {
// 若token过期则尝试获取RefreshToken重新获取token // 若token过期则尝试获取RefreshToken重新获取token
const newToken = await this.getRefreshToken(); const newToken = await this.getRefreshToken();
if (newToken) { if (newToken) {

@ -1,5 +1,5 @@
{ {
"name" : "sing-h5", "name" : "repair-h5",
"appid" : "__UNI__9473E40", "appid" : "__UNI__9473E40",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",

@ -38,7 +38,7 @@
</view> </view>
<view class="item"> <view class="item">
<view class="sub1">画作类型</view> <view class="sub1">画作类型</view>
<view class="sub2">{{ detailData.ArtworkType }}</view> <view class="sub2">{{ artworkTyoeDict[detailData.ArtworkType] }}</view>
</view> </view>
</view> </view>
<view class="list"> <view class="list">
@ -78,6 +78,7 @@
:fileList="fileList" :fileList="fileList"
@delete="deletePic" @delete="deletePic"
@afterRead="afterRead" @afterRead="afterRead"
accept="image"
name="3" name="3"
width="100" width="100"
height="100" height="100"
@ -98,6 +99,7 @@
<u-upload <u-upload
:fileList="repFileList" :fileList="repFileList"
@delete="repDeletePic" @delete="repDeletePic"
accept="image"
@afterRead="repAfterRead" @afterRead="repAfterRead"
name="3" name="3"
width="100" width="100"
@ -114,7 +116,13 @@
></u--textarea> ></u--textarea>
</view> </view>
</view> </view>
<u-button type="primary" :loading="loading" class="search" @click="goSubmit"></u-button> <u-button
type="primary"
:loading="loading"
class="search"
@click="goSubmit"
>提交</u-button
>
</view> </view>
</view> </view>
</view> </view>
@ -139,6 +147,12 @@ export default {
repFileList: [], repFileList: [],
actName: "破损", actName: "破损",
loading: false, loading: false,
artworkTyoeDict: {
1: "优秀画作",
2: "赠画",
3: "卷轴",
4: "普通画作",
},
}; };
}, },
@ -146,6 +160,31 @@ export default {
changeTab(e) { changeTab(e) {
this.actName = e.name; this.actName = e.name;
}, },
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
const Authorization = uni.getStorageSync("repari-token");
const userId = uni.getStorageSync("repari-refresh-token").ID;
let a = uni.uploadFile({
url: this.$baseUrl + "/upload/img",
filePath: url,
name: "file",
formData: {
type: "image",
source: "user",
mask: userId,
},
header: {
Authorization,
},
success: (res) => {
console.log(res, "res");
res.data = JSON.parse(res.data);
resolve(res.data.data.ori_url);
this.uploadFlag = true;
},
});
});
},
// //
deletePic(event) { deletePic(event) {
this[`fileList`].splice(event.index, 1); this[`fileList`].splice(event.index, 1);
@ -177,32 +216,6 @@ export default {
fileListLen++; fileListLen++;
} }
}, },
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
const Authorization = uni.getStorageSync("repari-token");
const userId = uni.getStorageSync("repari-refresh-token").ID;
let a = uni.uploadFile({
url: this.$baseUrl + "/upload/img",
filePath: url,
name: "file",
formData: {
type: "image",
source: "user",
mask: userId,
},
header: {
Authorization,
},
success: (res) => {
console.log(res, "res");
res.data = JSON.parse(res.data);
resolve(res.data.data.ori_url);
this.uploadFlag = true;
},
});
});
},
// //
repDeletePic(event) { repDeletePic(event) {
this[`repFileList`].splice(event.index, 1); this[`repFileList`].splice(event.index, 1);
@ -236,53 +249,22 @@ export default {
}, },
// //
async goSubmit() { async goSubmit() {
// //
if (this.actName === "破损") { if (
if (this.fileList.length === 0) { this.fileList < 1 &&
this.$refs.uNotify.show({ this.DamagedRemark == "" &&
top: 10, this.repFileList < 1 &&
type: "error", this.RepairedRemark == ""
message: "请上传破损图片", ) {
duration: 1000 * 3, this.$refs.uNotify.show({
fontSize: 20, top: 10,
safeAreaInsetTop: true, type: "error",
}); message: "请填写破损或修复信息",
return; duration: 1000 * 3,
} fontSize: 20,
if (!this.DamagedRemark) { safeAreaInsetTop: true,
this.$refs.uNotify.show({ });
top: 10, return;
type: "error",
message: "请填写破损备注",
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop: true,
});
return;
}
} else {
if (this.repFileList.length === 0) {
this.$refs.uNotify.show({
top: 10,
type: "error",
message: "请上传修复图片",
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop: true,
});
return;
}
if (!this.RepairedRemark) {
this.$refs.uNotify.show({
top: 10,
type: "error",
message: "请填写修复备注",
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop: true,
});
return;
}
} }
this.loading = true; this.loading = true;
let data = { let data = {
@ -307,8 +289,8 @@ export default {
this.loading = false; this.loading = false;
setTimeout(() => { setTimeout(() => {
this.$router.push({ this.$router.push({
path: "/", path: "/",
}); });
}, 1000); }, 1000);
} else { } else {
this.loading = false; this.loading = false;
@ -325,25 +307,27 @@ export default {
}, },
onLoad(item) { onLoad(item) {
this.detailData = JSON.parse(item.detailData); this.detailData = JSON.parse(item.detailData);
this.fileList = this.detailData.DamagedImgs ? this.detailData.DamagedImgs.map((item) => { this.fileList = this.detailData.DamagedImgs
return { ? this.detailData.DamagedImgs.map((item) => {
url: item, return {
status: "success", url: item,
message: "", status: "success",
}; message: "",
}) : []; };
this.repFileList = this.detailData.RepairedImgs ? this.detailData.RepairedImgs.map((item) => { })
return { : [];
url: item, this.repFileList = this.detailData.RepairedImgs
status: "success", ? this.detailData.RepairedImgs.map((item) => {
message: "", return {
}; url: item,
}) : []; status: "success",
message: "",
};
})
: [];
this.DamagedRemark = this.detailData.DamagedRemark; this.DamagedRemark = this.detailData.DamagedRemark;
this.RepairedRemark = this.detailData.RepairedRemark; this.RepairedRemark = this.detailData.RepairedRemark;
}, },
}; };
</script> </script>
@ -422,11 +406,10 @@ page {
font-size: 32rpx; font-size: 32rpx;
color: #666666; color: #666666;
margin-top: 10rpx; margin-top: 10rpx;
// //
width: 140rpx; white-space: normal;
overflow: hidden; word-wrap: break-word;
text-overflow: ellipsis; width: 200rpx;
white-space: nowrap;
} }
.sub1 { .sub1 {
font-size: 32rpx; font-size: 32rpx;

Loading…
Cancel
Save