main
scout 2 months ago
parent 4db5fa0085
commit 641364d8e9

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

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

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

Loading…
Cancel
Save