Commit 0ec212473ec515f0a942bfd6b5d87a565e784bcd

Authored by 郭伟龙
1 parent ef2eeb98
Exists in develop

fix: 限制字符,超出隐藏,无文件时不查看文件

pages/component/AuxiliaryModule.vue
@@ -93,6 +93,11 @@ @@ -93,6 +93,11 @@
93 .title { 93 .title {
94 font-size: 30px; 94 font-size: 30px;
95 margin: 38px 0 0 28px; 95 margin: 38px 0 0 28px;
  96 + white-space: nowrap;
  97 + /* 防止换行 */
  98 + overflow: hidden;
  99 + /* 超出部分隐藏 */
  100 + text-overflow: ellipsis;
96 } 101 }
97 102
98 .flex-between { 103 .flex-between {
pages/component/InformationModule.vue
1 <template> 1 <template>
2 <view class="containers"> 2 <view class="containers">
3 - <u-swiper class="swiperCss" :list="informationData.lampPath" 3 + <u-swiper class="swiperCss" :list="informationData.lampPath"
4 @click="previewLargeImage(informationData.lampPath,current)" :current="current" indicator 4 @click="previewLargeImage(informationData.lampPath,current)" :current="current" indicator
5 indicatorMode="dot" imgMode="aspectFit" circular :height="$isMobile?'400rpx':'600px'" 5 indicatorMode="dot" imgMode="aspectFit" circular :height="$isMobile?'400rpx':'600px'"
6 indicatorActiveColor="#00aeaa" indicatorInactiveColor="rgba(0, 174, 170, 0.3)" @change="changeSwiper" 6 indicatorActiveColor="#00aeaa" indicatorInactiveColor="rgba(0, 174, 170, 0.3)" @change="changeSwiper"
@@ -197,5 +197,11 @@ @@ -197,5 +197,11 @@
197 color: #2b3950; 197 color: #2b3950;
198 text-align: left; 198 text-align: left;
199 line-height: normal; 199 line-height: normal;
  200 + max-width: 400px;
  201 + white-space: nowrap;
  202 + /* 防止换行 */
  203 + overflow: hidden;
  204 + /* 超出部分隐藏 */
  205 + text-overflow: ellipsis;
200 } 206 }
201 </style> 207 </style>
202 \ No newline at end of file 208 \ No newline at end of file
pages/component/InspectionModule.vue
@@ -220,5 +220,11 @@ @@ -220,5 +220,11 @@
220 color: #2b3950; 220 color: #2b3950;
221 text-align: left; 221 text-align: left;
222 line-height: normal; 222 line-height: normal;
  223 + max-width: 400px;
  224 + white-space: nowrap;
  225 + /* 防止换行 */
  226 + overflow: hidden;
  227 + /* 超出部分隐藏 */
  228 + text-overflow: ellipsis;
223 } 229 }
224 </style> 230 </style>
225 \ No newline at end of file 231 \ No newline at end of file
pages/component/UploadFile.vue
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 <u-icon name="/static/images/icon/excelIcon.png" size="33px" v-if="fileType == 2"></u-icon> 6 <u-icon name="/static/images/icon/excelIcon.png" size="33px" v-if="fileType == 2"></u-icon>
7 <u-icon name="/static/images/icon/csvIcon.png" size="33px" v-if="fileType == 3"></u-icon> 7 <u-icon name="/static/images/icon/csvIcon.png" size="33px" v-if="fileType == 3"></u-icon>
8 <text class="iconTitle" 8 <text class="iconTitle"
9 - @click="seeFile">{{downloadFileName ? downloadFileName.substring(downloadFileName.lastIndexOf('/') + 1) : $t('hdk.noFile')}}</text> 9 + @click="seeFile('preview')">{{downloadFileName ? downloadFileName.substring(downloadFileName.lastIndexOf('/') + 1) : $t('hdk.noFile')}}</text>
10 </view> 10 </view>
11 - <view class="rightText" @click="seeFile('preview')" v-if="downloadFileNamePath != ''"> 11 + <view class="rightText" @click="seeFile('preview')" v-if="downloadFileName && downloadFileNamePath">
12 {{$t('hdk.Check')}} 12 {{$t('hdk.Check')}}
13 </view> 13 </view>
14 </view> 14 </view>
@@ -67,12 +67,17 @@ @@ -67,12 +67,17 @@
67 // if (this.isCsv) { 67 // if (this.isCsv) {
68 // return 68 // return
69 // } 69 // }
  70 + console.log(this.downloadFileName);
  71 + console.log(this.downloadFileNamePath);
  72 + if(!this.downloadFileName || !this.downloadFileNamePath){
  73 + return false
  74 + }
70 console.log('查看文件'); 75 console.log('查看文件');
  76 + // return
71 uni.showLoading({ 77 uni.showLoading({
72 title: this.$t('hdk.loading') 78 title: this.$t('hdk.loading')
73 }) 79 })
74 let that = this; 80 let that = this;
75 -  
76 if (!this.isCsv) { 81 if (!this.isCsv) {
77 const count = (this.downloadFileNamePath.match(/;/g) || []).length; 82 const count = (this.downloadFileNamePath.match(/;/g) || []).length;
78 console.log(this.downloadFileNamePath, "解析文件有", count, "个") 83 console.log(this.downloadFileNamePath, "解析文件有", count, "个")
pages/product/index.vue
@@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
7 :activeStyle="activeStyle" :inactiveStyle="inactiveStyle"></u-tabs> 7 :activeStyle="activeStyle" :inactiveStyle="inactiveStyle"></u-tabs>
8 <view class="ComponentsBody"> 8 <view class="ComponentsBody">
9 <view class="productInformation" v-if="current == 0"> 9 <view class="productInformation" v-if="current == 0">
10 - <InformationModule v-if="informationData != null" :informationData="informationData"> 10 + <InformationModule v-if="informationData != null && Array.isArray(informationData.lampPath)"
  11 + :informationData="informationData">
11 </InformationModule> 12 </InformationModule>
12 </view> 13 </view>
13 <view class="inspectionInformation" v-else-if="current == 1"> 14 <view class="inspectionInformation" v-else-if="current == 1">
@@ -17,8 +18,8 @@ @@ -17,8 +18,8 @@
17 <AuxiliaryModule v-if="auxiliaryData != null" :auxiliaryData="auxiliaryData"></AuxiliaryModule> 18 <AuxiliaryModule v-if="auxiliaryData != null" :auxiliaryData="auxiliaryData"></AuxiliaryModule>
18 </view> 19 </view>
19 <view class="repairReportBtnCss" @click="jumpService"> 20 <view class="repairReportBtnCss" @click="jumpService">
20 - <image src="/static/images/icon/repair.png" class="repairReportImageCss" mode="witFix" ></u-image>  
21 - <text class="repairReportTextCss">{{$t("hdk.Repair")}}</text> 21 + <image src="/static/images/icon/repair.png" class="repairReportImageCss" mode="witFix"></u-image>
  22 + <text class="repairReportTextCss">{{$t("hdk.Repair")}}</text>
22 </view> 23 </view>
23 </view> 24 </view>
24 25
@@ -134,9 +135,9 @@ @@ -134,9 +135,9 @@
134 productionTime: this.productObject.productionTime, 135 productionTime: this.productObject.productionTime,
135 productionUserName: this.productObject.productionUserName, 136 productionUserName: this.productObject.productionUserName,
136 productDatasheet: this.productObject.productRespVO?.productDatasheet || null, 137 productDatasheet: this.productObject.productRespVO?.productDatasheet || null,
137 - productDatasheetPath: this.productObject.productRespVO?.productDatasheetPath || [], 138 + productDatasheetPath: this.productObject.productRespVO?.productDatasheetPath || null,
138 productManual: this.productObject.productRespVO?.productManual || null, 139 productManual: this.productObject.productRespVO?.productManual || null,
139 - productManualPath: this.productObject.productRespVO?.productManualPath || [] 140 + productManualPath: this.productObject.productRespVO?.productManualPath || null
140 }; 141 };
141 console.log("产品信息", this.informationData); 142 console.log("产品信息", this.informationData);
142 143
@@ -195,8 +196,9 @@ @@ -195,8 +196,9 @@
195 this.generateDownloadUrls(this.productObject.lightIntensityPath) 196 this.generateDownloadUrls(this.productObject.lightIntensityPath)
196 .then(modifiedManuals => { 197 .then(modifiedManuals => {
197 // console.log("光强==>", modifiedManuals); 198 // console.log("光强==>", modifiedManuals);
198 - this.inspectionData.lightIntensityPhoto = modifiedManuals.filter(url => this.isPicture(  
199 - url)); 199 + this.inspectionData.lightIntensityPhoto = modifiedManuals.filter(url => this
  200 + .isPicture(
  201 + url));
200 this.inspectionData.lightIntensityFile = modifiedManuals.filter(filename => !this 202 this.inspectionData.lightIntensityFile = modifiedManuals.filter(filename => !this
201 .isPicture(filename) && filename.includes('.')); 203 .isPicture(filename) && filename.includes('.'));
202 // 在这里可以访问已更新的inspectionData.lightIntensityPhoto和inspectionData.lightIntensityFile的值 204 // 在这里可以访问已更新的inspectionData.lightIntensityPhoto和inspectionData.lightIntensityFile的值
@@ -234,7 +236,7 @@ @@ -234,7 +236,7 @@
234 // console.log("filenames", filenames) 236 // console.log("filenames", filenames)
235 if (!filenames || filenames.length === 0) { 237 if (!filenames || filenames.length === 0) {
236 // 如果 filenames 为空或者null,则执行相应的操作 238 // 如果 filenames 为空或者null,则执行相应的操作
237 - return Promise.resolve(require('@/static/images/noPhoto.png')) 239 + return Promise.resolve([require('@/static/images/noPhoto.png')])
238 } 240 }
239 const modifiedFilenames = filenames.replace(/;+$/, ''); 241 const modifiedFilenames = filenames.replace(/;+$/, '');
240 const modifiedUrls = modifiedFilenames.split(";").map(filename => { 242 const modifiedUrls = modifiedFilenames.split(";").map(filename => {
@@ -243,7 +245,11 @@ @@ -243,7 +245,11 @@
243 // const encodedFilename = Buffer.from(trimmedFilename, 'utf-8').toString('base64'); 245 // const encodedFilename = Buffer.from(trimmedFilename, 'utf-8').toString('base64');
244 const url = config.fileUrl + `/${trimmedFilename}`; 246 const url = config.fileUrl + `/${trimmedFilename}`;
245 // console.log(url); 247 // console.log(url);
246 - return this.checkUrlValidity(url).catch(error => { 248 + return this.checkUrlValidity(url)
  249 + // .then(res => {
  250 + // return res == null ? Promise.resolve(require('@/static/images/noPhoto.png')):res
  251 + // })
  252 + .catch(error => {
247 // console.error(error); 253 // console.error(error);
248 // console.log("请求失败", trimmedFilename) 254 // console.log("请求失败", trimmedFilename)
249 return Promise.resolve(require('@/static/images/noPhoto.png')); 255 return Promise.resolve(require('@/static/images/noPhoto.png'));
@@ -256,7 +262,9 @@ @@ -256,7 +262,9 @@
256 }); 262 });
257 263
258 return Promise.all(modifiedUrls).then(results => { 264 return Promise.all(modifiedUrls).then(results => {
  265 + console.log(results);
259 const validUrls = results.filter(url => url !== null); 266 const validUrls = results.filter(url => url !== null);
  267 + // console.log(validUrls);
260 if (validUrls.length > 0) { 268 if (validUrls.length > 0) {
261 // console.log("有效地址",validUrls); 269 // console.log("有效地址",validUrls);
262 return validUrls; 270 return validUrls;
@@ -335,7 +343,7 @@ @@ -335,7 +343,7 @@
335 // .attachmentInformation{ 343 // .attachmentInformation{
336 // width: 100%; 344 // width: 100%;
337 // } 345 // }
338 - 346 +
339 //移动端样式 347 //移动端样式
340 @media screen and (max-width: 767px) { 348 @media screen and (max-width: 767px) {
341 .repairReportBtnCss { 349 .repairReportBtnCss {
@@ -351,15 +359,15 @@ @@ -351,15 +359,15 @@
351 bottom: 100px; 359 bottom: 100px;
352 // background-color: #00aeaa; 360 // background-color: #00aeaa;
353 } 361 }
354 -  
355 -  
356 - 362 +
  363 +
  364 +
357 // .u-image__image{ 365 // .u-image__image{
358 // width: 100px !important; 366 // width: 100px !important;
359 // height: 100px !important; 367 // height: 100px !important;
360 // } 368 // }
361 -  
362 - .repairReportImageCss{ 369 +
  370 + .repairReportImageCss {
363 width: 100px !important; 371 width: 100px !important;
364 height: 100px !important; 372 height: 100px !important;
365 } 373 }
@@ -388,13 +396,13 @@ @@ -388,13 +396,13 @@
388 bottom: 100px; 396 bottom: 100px;
389 // background-color: #00aeaa; 397 // background-color: #00aeaa;
390 } 398 }
391 - 399 +
392 // .u-image__image{ 400 // .u-image__image{
393 // width: 200px !important; 401 // width: 200px !important;
394 // } 402 // }
395 -  
396 -  
397 - .repairReportImageCss{ 403 +
  404 +
  405 + .repairReportImageCss {
398 width: 200px !important; 406 width: 200px !important;
399 height: 200px !important; 407 height: 200px !important;
400 } 408 }
utils/utils.js
@@ -7,7 +7,7 @@ export const deviceMixin = { @@ -7,7 +7,7 @@ export const deviceMixin = {
7 7
8 for (const keyword of mobileKeywords) { 8 for (const keyword of mobileKeywords) {
9 if (userAgent.includes(keyword)) { 9 if (userAgent.includes(keyword)) {
10 - console.log(keyword); 10 + // console.log(keyword);
11 return true; // 如果包含移动设备关键词,则判断为移动端 11 return true; // 如果包含移动设备关键词,则判断为移动端
12 } 12 }
13 } 13 }