From 641364d8e9236d9b17b1d5b8df89aa90e89070f0 Mon Sep 17 00:00:00 2001
From: scout <1134087124@qq.com>
Date: Tue, 9 Jul 2024 09:43:02 +0800
Subject: [PATCH] fixbug
---
http/interface.js | 2 +-
manifest.json | 2 +-
pages/repair/index.vue | 179 +++++++++++++++++++----------------------
3 files changed, 83 insertions(+), 100 deletions(-)
diff --git a/http/interface.js b/http/interface.js
index 34b399e..635603f 100644
--- a/http/interface.js
+++ b/http/interface.js
@@ -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) {
diff --git a/manifest.json b/manifest.json
index 9731bde..4e52b1a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,5 +1,5 @@
{
- "name" : "sing-h5",
+ "name" : "repair-h5",
"appid" : "__UNI__9473E40",
"description" : "",
"versionName" : "1.0.0",
diff --git a/pages/repair/index.vue b/pages/repair/index.vue
index 9eb295b..76e1956 100644
--- a/pages/repair/index.vue
+++ b/pages/repair/index.vue
@@ -38,7 +38,7 @@
画作类型
- {{ detailData.ArtworkType }}
+ {{ artworkTyoeDict[detailData.ArtworkType] }}
@@ -78,6 +78,7 @@
:fileList="fileList"
@delete="deletePic"
@afterRead="afterRead"
+ accept="image"
name="3"
width="100"
height="100"
@@ -98,6 +99,7 @@
- 提交
+ 提交
@@ -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;
-
},
};
@@ -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;