Commit ba37a90e19a9c606fb3f26563b8d8e6222374740

Authored by 郭伟龙
1 parent f6e1e707
Exists in develop

feat: 样式调整

.hbuilderx/launch.json
... ... @@ -2,8 +2,15 @@
2 2 "version" : "1.0",
3 3 "configurations" : [
4 4 {
5   - "openVueDevtools" : true,
  5 + "openVueDevtools" : false,
6 6 "type" : "uni-app:h5"
7   - }
  7 + },
  8 + {
  9 + "mp-weixin" :
  10 + {
  11 + "launchtype" : "local"
  12 + },
  13 + "type" : "uniCloud"
  14 + }
8 15 ]
9 16 }
... ...
locale/en.json
... ... @@ -6,64 +6,68 @@
6 6 "index.language": "Language",
7 7 "index.language-info": "Settings",
8 8 "index.system-language": "System language",
9   - "hdk.productInformation":"ProductInformation",
10   - "hdk.inspectionInformation":"InspectionInformation",
11   - "hdk.attachmentInformation":"AttachmentInformation",
12   - "hdk.placeholder":"Please enter the SN code on the product",
13   - "hdk.tips":"Please enter the SN code to query the product",
14   - "hdk.sninexistence":"The SN code does not exist. Please enter the correct SN code",
  9 + "hdk.productInformation":"Products",
  10 + "hdk.inspectionInformation":"Inspections",
  11 + "hdk.attachmentInformation":"Accesories",
  12 + "hdk.placeholder":"SN Code",
  13 + "hdk.tips":"Search by SN Code",
  14 + "hdk.sninexistence":"The SN code does not exist, please enter the correct SN code!",
15 15 "hdk.search":"Search",
16   - "hdk.gohome":"Click back to Home",
17   - "hdk.ProductInformation":"productInformation",
18   - "hdk.SnCode":"SNcode",
19   - "hdk.ProductName":"ProductName",
  16 + "hdk.gohome":"Back to Home Page",
  17 + "hdk.ProductInformation":"Products",
  18 + "hdk.SnCode":"SN Code",
  19 + "hdk.ProductName":"Product Name",
20 20 "hdk.Model":"Model",
21   - "hdk.DateOfProduction":"DateOfProduction",
22   - "hdk.ProductionPersonnel":"ProductionPersonnel",
23   - "hdk.ProductSpecification":"ProductSpecification",
24   - "hdk.ProductManual":"ProductManual",
25   - "hdk.InspectionInformation":"InspectionInformation",
26   - "hdk.SoftwareVersion":"SoftwareVersion",
27   - "hdk.HardwareVersion":"HardwareVersion",
28   - "hdk.TestDate":"TestDate",
29   - "hdk.ElectricalParameters":"ElectricalParameters",
  21 + "hdk.DateOfProduction":"Production Date",
  22 + "hdk.ProductionPersonnel":"Production Personnel",
  23 + "hdk.ProductSpecification":"Data Sheet",
  24 + "hdk.ProductManual":"User Manual",
  25 + "hdk.InspectionInformation":"Inspections",
  26 + "hdk.SoftwareVersion":"Software Version",
  27 + "hdk.HardwareVersion":"Hardware Version",
  28 + "hdk.TestDate":"Inspection Date",
  29 + "hdk.ElectricalParameters":"Electric Spec",
30 30 "hdk.Power":"Power",
31   - "hdk.PowerFactor":"PowerFactor",
32   - "hdk.LightIntensityDistribution":"LightIntensityDistribution",
33   - "hdk.AirTightnessInspectionDocuments":"AirTightnessInspectionDocuments",
34   - "hdk.AttachmentModel":"AttachmentModel",
35   - "hdk.OrderCode":"OrderCode",
36   - "hdk.AttachmentIsEmpty":"AttachmentIsEmpty",
37   - "hdk.scan":"scan",
38   - "hdk.Required":"(Required)",
39   - "hdk.Basicinformation":"BasicInformation",
40   - "hdk.ProblemDescription":"ProblemDescription",
41   - "hdk.DescriptionPlaceholder":"Please describe the situation and location of the problem accurately, which is more conducive to solution",
42   - "hdk.AirportName":"AirportName",
  31 + "hdk.PowerFactor":"Power Factor",
  32 + "hdk.LightIntensityDistribution":"Light Intensity Distribution",
  33 + "hdk.AirTightnessInspectionDocuments":"Airtightness Inspection Files",
  34 + "hdk.AttachmentModel":"Model of Accessories",
  35 + "hdk.OrderCode":"Order code",
  36 + "hdk.AttachmentIsEmpty":"No Attachment",
  37 + "hdk.scan":"Scan",
  38 + "hdk.Required":"(Mandatory)",
  39 + "hdk.Basicinformation":"Basic Information",
  40 + "hdk.ProblemDescription":"Description of Questions",
  41 + "hdk.DescriptionPlaceholder":"Please describe the circumstance and location of the problem accurately, which is more conducive to solution",
  42 + "hdk.AirportName":"Airport",
43 43 "hdk.Name":"Name",
44   - "hdk.ContactInformations":"ContactInformation",
  44 + "hdk.ContactInformation":"Contact",
45 45 "hdk.Email":"Email",
46   - "hdk.DetailedAddress":"DetailedAddress(e.g.**Street**)",
47   - "hdk.ConfirmAndReport":"ConfirmAndReport",
  46 + "hdk.DetailedAddress":"Detailed Address ( No.xxx,xxx Street)",
  47 + "hdk.ConfirmAndReport":"Confirm & Report",
48 48 "hdk.Repair":"Repair",
49   - "hdk.noFile":"NoFiles",
  49 + "hdk.noFile":"No Files",
50 50 "hdk.Check":"Check",
51   - "hdk.Reminder":"WarmReminder",
  51 + "hdk.Reminder":"Friendly Tips",
52 52 "hdk.Confirm":"Confirm",
53   - "hdk.PromptContent":"Confirm submission of this content",
  53 + "hdk.PromptContent":"Are you sure to submit this content?",
54 54 "hdk.Cancel":"Cancel",
55   - "hdk.QRCodeContent":"Two-dimensional code content",
  55 + "hdk.QRCodeContent":"Content of QR Code",
56 56 "hdk.ErrorPrompt1":"The current SN code does not exist, please scan the correct QR code",
57 57 "hdk.ErrorPrompt2":"The current SN code format is incorrect. Please scan the correct QR code",
58 58 "hdk.Rescan":"Rescan",
59   - "hdk.FillSNCode":"Please enter the SN code",
  59 + "hdk.FillSNCode":"Please enter SN Code",
60 60 "hdk.FillProductName":"Please fill in the product name",
61 61 "hdk.FillName":"Please fill in the name",
62   - "hdk.FillEmail":"Please fill in the correct email address",
  62 + "hdk.FillEmail":"Please fill in the correct email ",
63 63 "hdk.FillDescription":"Please fill in the description or upload a picture",
64 64 "hdk.FillAirportName":"Please fill in the airport name",
65 65 "hdk.Uploading":"Uploading",
66 66 "hdk.SuccessfullyReported":"Report successfully",
67 67 "hdk.CheckSN":"Check whether the SN code is correct",
68   - "hdk.CheckForUnfilledItems":"Check the blanks"
  68 + "hdk.CheckForUnfilledItems":"Check the blanks",
  69 + "hdk.networkError":"Network Error",
  70 + "hdk.fileNotUploaded":"Unuploaded File",
  71 + "hdk.loading":"loading",
  72 + "hdk.incorrectImportFormat":"Incorrect import format"
69 73 }
... ...
locale/zh-Hans.json
... ... @@ -16,7 +16,7 @@
16 16 "hdk.gohome":"点击回到主页",
17 17 "hdk.ProductInformation":"产品信息",
18 18 "hdk.SnCode":"SN码",
19   - "hdk.ProductName":"产品名",
  19 + "hdk.ProductName":"产品名",
20 20 "hdk.Model":"型号",
21 21 "hdk.DateOfProduction":"出厂日期",
22 22 "hdk.ProductionPersonnel":"生产人员",
... ... @@ -31,7 +31,7 @@
31 31 "hdk.PowerFactor":"功率因数",
32 32 "hdk.LightIntensityDistribution":"光强分布",
33 33 "hdk.AirTightnessInspectionDocuments":"气密检测文件",
34   - "hdk.AttachmentModel":"附件型号",
  34 + "hdk.AttachmentModel":"型号名称",
35 35 "hdk.OrderCode":"订货编码",
36 36 "hdk.AttachmentIsEmpty":"附件为空",
37 37 "hdk.scan":"扫一扫",
... ... @@ -41,12 +41,12 @@
41 41 "hdk.DescriptionPlaceholder":"请将所遇问题情况和具体位置描述准确,更有利于解决。",
42 42 "hdk.AirportName":"机场名",
43 43 "hdk.Name":"姓名",
44   - "hdk.ContactInformations":"联系方式",
  44 + "hdk.ContactInformation":"联系方式",
45 45 "hdk.Email":"邮箱",
46 46 "hdk.DetailedAddress":"详细地址(例如**街**号)",
47 47 "hdk.ConfirmAndReport":"确认并上报",
48 48 "hdk.Repair":"维护报修",
49   - "hdk.noFile":"无文件",
  49 + "hdk.noFile":"无文件",
50 50 "hdk.Check":"查看",
51 51 "hdk.Reminder":"温馨提示",
52 52 "hdk.Confirm":"确认",
... ... @@ -65,5 +65,9 @@
65 65 "hdk.Uploading":"上传中",
66 66 "hdk.SuccessfullyReported":"上报成功",
67 67 "hdk.CheckSN":"请检查SN码是否正确",
68   - "hdk.CheckForUnfilledItems":"检查未填项"
  68 + "hdk.CheckForUnfilledItems":"检查未填项",
  69 + "hdk.networkError":"网络错误",
  70 + "hdk.fileNotUploaded":"未上传文件",
  71 + "hdk.loading":"加载中",
  72 + "hdk.incorrectImportFormat":"导入格式有误"
69 73 }
70 74 \ No newline at end of file
... ...
main.js
... ... @@ -5,7 +5,8 @@ import uView from '@/uni_modules/uview-ui'
5 5 import { deviceMixin } from '@/utils/utils';
6 6  
7 7 let i18nConfig = {
8   - locale: uni.getLocale(),
  8 + // locale: uni.getLocale(),
  9 + locale: 'en', //默认英文
9 10 messages
10 11 }
11 12  
... ...
manifest.json
... ... @@ -72,10 +72,10 @@
72 72 "h5" : {
73 73 "router" : {
74 74 "mode" : "history",
75   - "base" : "/hdk-web/"
  75 + "base" : "mobile"
76 76 },
77 77 "devServer" : {
78   - "https" : false
  78 + "https" : true
79 79 }
80 80 }
81 81 }
... ...
mobile/pages/component/AuxiliaryModule.vue
... ... @@ -120,7 +120,7 @@
120 120  
121 121  
122 122 .photo {
123   - margin: 47px 28px 0 28px;
  123 + margin: 30px;
124 124 }
125 125  
126 126  
... ...
mobile/pages/component/InformationModule.vue
... ... @@ -23,7 +23,7 @@
23 23 </view>
24 24 <view class="flex-between">
25 25 <text class="leftT">{{$t('hdk.DateOfProduction')}}</text>
26   - <text class="rightT">{{$u.timeFormat(informationData.productionTime, 'yyyy年mm月dd日') || ""}}</text>
  26 + <text class="rightT">{{$u.timeFormat(informationData.productionTime, 'yyyy-mm-dd') || ""}}</text>
27 27 </view>
28 28 <view class="flex-between">
29 29 <text class="leftT">{{$t('hdk.ProductionPersonnel')}}</text>
... ...
mobile/pages/component/InspectionModule.vue
... ... @@ -179,7 +179,6 @@
179 179  
180 180 .fileViewingModule {
181 181 width: 80%;
182   - height: 235px;
183 182 margin: 20px 24px;
184 183 padding: 2px 2px 2px 2px;
185 184 border-radius: 20px;
... ... @@ -201,7 +200,7 @@
201 200  
202 201  
203 202 .photo {
204   - margin: 47px 28px 0 28px;
  203 + margin: 30px;
205 204 }
206 205  
207 206  
... ...
mobile/pages/component/topWindow.vue
1 1 <template>
2 2 <view>
3 3 <b-navbar toggleable="lg" type="dark" class="b-navbar">
4   - <b-navbar-brand :title="$t('hdk.gohome')" href="/hdk-web">
  4 + <b-navbar-brand :title="$t('hdk.gohome')" href="/mobile">
5 5 <img src="@/static/hdk-top-logo.png" width="63px" height="32px" style="margin-left: 10px;" alt="Kitten">
6 6 </b-navbar-brand>
7 7 <b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
... ...
mobile/pages/homePage/index.vue
... ... @@ -27,7 +27,7 @@
27 27 import {
28 28 getProductFind
29 29 } from '@/api/scan'
30   - import topWindow from "@/mobile/pages/component/topWindow.vue"
  30 + import topWindow from "@/pages/component/topWindow.vue"
31 31 export default {
32 32 data() {
33 33 return {
... ... @@ -112,7 +112,7 @@
112 112 console.log("sn查询结果", res)
113 113 const data = res.data;
114 114 uni.navigateTo({
115   - url: "/mobile/pages/product/index?sn=" + this.SNcode
  115 + url: "/pages/product/index?sn=" + this.SNcode
116 116 })
117 117 } else {
118 118 this.isError = true
... ... @@ -121,7 +121,7 @@
121 121 },
122 122 scanClick() {
123 123 uni.navigateTo({
124   - url: "/mobile/pages/product/scan"
  124 + url: "/pages/product/scan"
125 125 })
126 126 },
127 127 getResult(res) {
... ...
mobile/pages/product/index.vue
... ... @@ -28,11 +28,11 @@
28 28 import {
29 29 getProductFind
30 30 } from '@/api/scan'
31   - import topWindow from "@/mobile/pages/component/topWindow.vue"
32   - import goback from "@/mobile/pages/component/goback.vue"
33   - import InformationModule from '@/mobile/pages/component/InformationModule.vue'
34   - import InspectionModule from '@/mobile/pages/component/InspectionModule.vue'
35   - import AuxiliaryModule from '@/mobile/pages/component/AuxiliaryModule.vue'
  31 + import topWindow from "@/pages/component/topWindow.vue"
  32 + import goback from "@/pages/component/goback.vue"
  33 + import InformationModule from '@/pages/component/InformationModule.vue'
  34 + import InspectionModule from '@/pages/component/InspectionModule.vue'
  35 + import AuxiliaryModule from '@/pages/component/AuxiliaryModule.vue'
36 36 export default {
37 37 components: {
38 38 InformationModule,
... ... @@ -182,7 +182,7 @@
182 182 jumpService() {
183 183 console.log(this.repairInformation);
184 184 uni.navigateTo({
185   - url: "/mobile/pages/product/repairReport?repairpObject=" + encodeURIComponent(JSON.stringify(
  185 + url: "/pages/product/repairReport?repairpObject=" + encodeURIComponent(JSON.stringify(
186 186 this.repairInformation)),
187 187 })
188 188 },
... ...
mobile/pages/product/invalidCode.vue
... ... @@ -28,7 +28,7 @@
28 28 </template>
29 29  
30 30 <script>
31   - import topWindow from "@/mobile/pages/component/topWindow.vue"
  31 + import topWindow from "@/pages/component/topWindow.vue"
32 32 export default {
33 33 components: {
34 34 topWindow
... ... @@ -53,7 +53,7 @@
53 53 methods: {
54 54 rescan() {
55 55 uni.redirectTo({
56   - url: '/mobile/pages/product/scan'
  56 + url: '/pages/product/scan'
57 57 })
58 58 },
59 59 // 判断字符串是否为SN码格式
... ...
mobile/pages/product/repairReport.vue
... ... @@ -11,15 +11,15 @@
11 11 <view class="uform">
12 12 <u-form-item required :label="$t('hdk.SnCode')" labelWidth="50%" prop="formInfo.sn" borderBottom
13 13 ref="item1">
14   - <u-input v-model="modal.formInfo.sn" border="none"></u-input>
  14 + <u-input v-model="modal.formInfo.sn" maxlength="10" border="none"></u-input>
15 15 </u-form-item>
16 16 <u-form-item required :label="$t('hdk.ProductName')" labelWidth="50%"
17 17 prop="formInfo.productName" borderBottom ref="item2">
18   - <u-input v-model="modal.formInfo.productName" border="none"></u-input>
  18 + <u-input v-model="modal.formInfo.productName" maxlength="20" border="none"></u-input>
19 19 </u-form-item>
20 20 <u-form-item :label="$t('hdk.Model')" labelWidth="50%" prop="formInfo.type" borderBottom
21 21 ref="item3">
22   - <u-input v-model="modal.formInfo.type" border="none"></u-input>
  22 + <u-input v-model="modal.formInfo.type" maxlength="20" border="none"></u-input>
23 23 </u-form-item>
24 24 </view>
25 25 </view>
... ... @@ -31,7 +31,7 @@
31 31 :placeholder="$t('hdk.DescriptionPlaceholder')"></u-textarea>
32 32 </view>
33 33 <view class="uploadCss">
34   - <u-upload upload-icon="plus" :fileList="modal.formInfo.fileList" @afterRead="afterRead"
  34 + <u-upload upload-icon="plus" :fileList="fileList" @afterRead="afterRead"
35 35 @delete="deletePic" :previewFullImage="true" name="faultPicture" multiple :maxCount="5"
36 36 accept="image"></u-upload>
37 37 </view>
... ... @@ -42,23 +42,23 @@
42 42 <view class="uform">
43 43 <u-form-item required :label="$t('hdk.AirportName')" labelWidth="50%"
44 44 prop="formInfo.airportName" borderBottom ref="item3">
45   - <u-input v-model="modal.formInfo.airportName" border="none"></u-input>
  45 + <u-input v-model="modal.formInfo.airportName" maxlength="20" border="none"></u-input>
46 46 </u-form-item>
47 47 <u-form-item required :label="$t('hdk.Name')" labelWidth="50%" prop="formInfo.contactPersonName"
48 48 borderBottom ref="item4">
49   - <u-input v-model="modal.formInfo.contactPersonName" border="none"></u-input>
  49 + <u-input v-model="modal.formInfo.contactPersonName" maxlength="10" border="none"></u-input>
50 50 </u-form-item>
51   - <u-form-item :label="$t('hdk.ContactInformations')" labelWidth="50%" prop="formInfo.phone"
  51 + <u-form-item :label="$t('hdk.ContactInformation')" labelWidth="50%" prop="formInfo.phone"
52 52 borderBottom ref="item5">
53   - <u-input v-model="modal.formInfo.contactPersonPhone" border="none"></u-input>
  53 + <u-input v-model="modal.formInfo.contactPersonPhone" maxlength="20" border="none"></u-input>
54 54 </u-form-item>
55 55 <u-form-item required :label="$t('hdk.Email')" labelWidth="50%" prop="formInfo.email"
56 56 borderBottom ref="item6">
57   - <u-input v-model="modal.formInfo.email" border="none"></u-input>
  57 + <u-input v-model="modal.formInfo.email" maxlength="20" border="none"></u-input>
58 58 </u-form-item>
59 59 <u-form-item :label="$t('hdk.DetailedAddress')" labelWidth="100%" prop="formInfo.address"
60 60 borderBottom ref="item7">
61   - <u-input v-model="modal.formInfo.address" border="none"></u-input>
  61 + <u-input v-model="modal.formInfo.address" maxlength="30" border="none"></u-input>
62 62 </u-form-item>
63 63 </view>
64 64 </view>
... ... @@ -78,8 +78,8 @@
78 78 </template>
79 79  
80 80 <script>
81   - import topWindow from "@/mobile/pages/component/topWindow.vue"
82   - import goback from "@/mobile/pages/component/goback.vue"
  81 + import topWindow from "@/pages/component/topWindow.vue"
  82 + import goback from "@/pages/component/goback.vue"
83 83 import {
84 84 createAFaultReport
85 85 } from "@/api/scan.js"
... ... @@ -100,15 +100,15 @@
100 100 productName: "",
101 101 type: "",
102 102 repairDescribe: "",
103   - fileList: [],
104 103 picPath: "",
105 104 airportName: "",
106 105 contactPersonName: "",
107 106 contactPersonPhone: "",
108 107 email: "",
109 108 address: "",
110   - }
  109 + },
111 110 },
  111 + fileList: [],
112 112 confirmModal: false,
113 113 title: "",
114 114 content: "",
... ... @@ -169,30 +169,30 @@
169 169 },
170 170 methods: {
171 171 deletePic(event) {
172   - this.modal.formInfo.fileList.splice(event.index, 1)
  172 + this.fileList.splice(event.index, 1)
173 173 },
174 174 async afterRead(event) {
175 175 console.log(event);
  176 + let that = this;
176 177 let lists = [].concat(event.file)
177   - let data = this.modal.formInfo;
178   - let fileListLen = data.fileList.length
  178 + let fileListLen = that.fileList.length
179 179 lists.map((item) => {
180   - data.fileList.push({
  180 + that.fileList.push({
181 181 ...item,
182 182 status: 'uploading',
183   - message: this.$t('hdk.Uploading')
  183 + message: that.$t('hdk.Uploading')
184 184 })
185 185 })
186 186 for (let i = 0; i < lists.length; i++) {
187   - const result = await this.uploadFilePromise(lists[i].url)
188   - let item = data.fileList[fileListLen]
189   - data.fileList.splice(fileListLen, 1, Object.assign(item, {
  187 + const result = await that.uploadFilePromise(lists[i].url)
  188 + let item = that.fileList[fileListLen]
  189 + that.fileList.splice(fileListLen, 1, Object.assign(item, {
190 190 status: 'success',
191 191 message: '',
192 192 realUrl: result,
193 193 url: config.prefixUrl + result
194 194 }))
195   - console.log(data.fileList);
  195 + console.log(that.fileList);
196 196 fileListLen++
197 197 }
198 198 },
... ... @@ -226,16 +226,17 @@
226 226 })
227 227 },
228 228 openModal() {
229   - this.title = this.$t('hdk.Reminder');
230   - this.content = this.$t('hdk.PromptContent');
231   - this.confirmModal = true
  229 + this.$refs.uForm.validate().then(res => {
  230 + this.title = this.$t('hdk.Reminder');
  231 + this.content = this.$t('hdk.PromptContent');
  232 + this.confirmModal = true
  233 + })
232 234 },
233 235 submit() {
234 236 console.log(this.modal.formInfo);
235 237 this.$refs.uForm.validate().then(res => {
236 238 let ohterValidate = this.checkOtherItems()
237 239 if (ohterValidate) {
238   - // return
239 240 createAFaultReport(this.modal.formInfo).then(res => {
240 241 console.log(res);
241 242 if (res.code === 0) {
... ... @@ -277,11 +278,11 @@
277 278 },
278 279 checkOtherItems() {
279 280 let data = this.modal.formInfo;
280   - if (data.repairDescribe === "" && data.fileList.length <= 0) {
  281 + if (data.repairDescribe === "" && this.fileList.length <= 0) {
281 282 // uni.$u.toast('描述或图片未上传');
282 283 return false;
283 284 }
284   - data.picPath = JSON.stringify(data.fileList.map(it => `${it.realUrl}`));
  285 + data.picPath = JSON.stringify(this.fileList.map(it => `${it.realUrl}`));
285 286 // delete data.fileList;
286 287 console.log(data.picPath);
287 288 return true;
... ... @@ -299,7 +300,9 @@
299 300 background: #F2F4F3;
300 301 }
301 302  
302   -
  303 + /deep/.uni-input-input{
  304 + padding-left: 10px
  305 + }
303 306  
304 307 .uform {
305 308 margin: 20px;
... ... @@ -325,7 +328,7 @@
325 328 //移动端样式
326 329 @media screen and (max-width: 767px) {
327 330 .title {
328   - width: 114px;
  331 + min-width: 114px;
329 332 margin: 20px 0 0 15px;
330 333 font-size: 15px;
331 334 background-color: rgba(255, 255, 255, 0);
... ... @@ -366,13 +369,19 @@
366 369 color: #ffffff;
367 370 text-align: center;
368 371 line-height: normal;
  372 + z-index: 999;
  373 + }
  374 +
  375 + .contentTextCss {
  376 + font-size: 14px;
  377 + color: #999999;
369 378 }
370 379 }
371 380  
372 381 //PC端样式
373 382 @media screen and (min-width: 768px) {
374 383 .title {
375   - width: 228px;
  384 + min-width: 228px;
376 385 margin: 40px 0 0 30px;
377 386 font-size: 30px;
378 387 background-color: rgba(255, 255, 255, 0);
... ... @@ -382,11 +391,29 @@
382 391 text-align: left;
383 392 }
384 393  
  394 + .contentTextCss {
  395 + font-size: 20px;
  396 + color: #999999;
  397 + }
  398 +
385 399 .content{
386 400 width: 80%;
387 401 position: relative;
388 402 }
389 403  
  404 + /deep/.u-modal{
  405 + width: 500px !important;
  406 + }
  407 +
  408 + /deep/.u-modal__title{
  409 + height: 80px;
  410 + font-size: 24px
  411 + }
  412 +
  413 + /deep/.u-modal__content{
  414 + height: 80px;
  415 + }
  416 +
390 417 /deep/.uni-textarea-textarea{
391 418 font-size: 18px;
392 419 }
... ... @@ -432,11 +459,9 @@
432 459 color: #ffffff;
433 460 text-align: center;
434 461 line-height: normal;
  462 + z-index: 999;
435 463 }
436 464 }
437 465  
438   - .contentTextCss {
439   - font-size: 30px;
440   - color: #999999;
441   - }
  466 +
442 467 </style>
443 468 \ No newline at end of file
... ...
mobile/pages/product/scan.vue
... ... @@ -6,8 +6,8 @@
6 6 </template>
7 7  
8 8 <script>
9   - import topWindow from "@/mobile/pages/component/topWindow.vue"
10   - import QrScan from "@/mobile/pages/component/QrScan.vue"
  9 + import topWindow from "@/pages/component/topWindow.vue"
  10 + import QrScan from "@/pages/component/QrScan.vue"
11 11 import config from '@/common/config.js'
12 12 import {
13 13 getProductFind
... ... @@ -62,14 +62,14 @@
62 62 console.log(res);
63 63 if (res.code === 1400001001) {
64 64 uni.navigateTo({
65   - url: '/mobile/pages/product/invalidCode?snCode='+sncode,
  65 + url: '/pages/product/invalidCode?snCode='+sncode,
66 66 success() {
67 67 this.open = true
68 68 }
69 69 });
70 70 } else {
71 71 uni.navigateTo({
72   - url: "/mobile/pages/product/index?sn=" + sncode
  72 + url: "/pages/product/index?sn=" + sncode
73 73 })
74 74 }
75 75 })
... ...
pages.json
1 1 {
2 2 "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
3 3 {
4   - "path": "mobile/pages/homePage/index",
  4 + "path": "pages/homePage/index",
5 5 "style": {
6 6 "navigationStyle": "custom"
7 7 // "navigationBarTitleText": "%index.title%"
8 8 }
9 9 }, {
10   - "path": "mobile/pages/product/index",
  10 + "path": "pages/product/index",
11 11 "style": {
12 12 "navigationStyle": "custom"
13 13 }
14 14 }, {
15   - "path": "mobile/pages/component/component",
  15 + "path": "pages/component/component",
16 16 "style": {
17 17 "navigationBarTitleText": "%index.component%",
18 18 "enablePullDownRefresh": false
19 19 }
20 20 }, {
21   - "path": "mobile/pages/product/scan",
  21 + "path": "pages/product/scan",
22 22 "style": {
23 23 "navigationStyle": "custom"
24 24 }
25 25 }, {
26   - "path": "mobile/pages/product/invalidCode",
  26 + "path": "pages/product/invalidCode",
27 27 "style": {
28 28 "navigationStyle": "custom"
29 29 }
30 30 }, {
31   - "path": "mobile/pages/product/repairReport",
  31 + "path": "pages/product/repairReport",
32 32 "style": {
33 33 "navigationStyle": "custom"
34 34 }
... ... @@ -40,24 +40,24 @@
40 40 // "borderStyle": "black",
41 41 // "backgroundColor": "#F8F8F8",
42 42 // "list": [{
43   - // "pagePath": "mobile/pages/homePage/index",
  43 + // "pagePath": "pages/homePage/index",
44 44 // "text": "%index.home%"
45 45 // },
46 46 // {
47   - // "pagePath": "mobile/pages/component/component",
  47 + // "pagePath": "pages/component/component",
48 48 // "text": "%index.component%"
49 49 // }, {
50   - // "pagePath": "mobile/pages/api/api",
  50 + // "pagePath": "pages/api/api",
51 51 // "text": "%index.api%"
52 52 // }, {
53   - // "pagePath": "mobile/pages/schema/schema",
  53 + // "pagePath": "pages/schema/schema",
54 54 // "text": "%index.schema%"
55 55 // }
56 56 // ]
57 57 // },
58 58 "globalStyle": {
59 59 "navigationBarTextStyle": "black",
60   - "navigationBarTitleText": "uni-app",
  60 + "navigationBarTitleText": "HDK",
61 61 "navigationBarBackgroundColor": "#F8F8F8",
62 62 "backgroundColor": "#F8F8F8"
63 63 }
... ...
pages/api/api.vue 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +<template>
  2 + <view class="container">
  3 + <button @click="showModel">uni.showModal</button>
  4 + </view>
  5 +</template>
  6 +
  7 +<script>
  8 + export default {
  9 + data() {
  10 + return {}
  11 + },
  12 + methods: {
  13 + showModel() {
  14 + uni.showModal({
  15 + content: this.$t('api.message'),
  16 + success: (res) => {
  17 + console.log(res);
  18 + }
  19 + })
  20 + }
  21 + }
  22 + }
  23 +</script>
  24 +
  25 +<style>
  26 +
  27 +</style>
... ...
pages/component/AuxiliaryModule.vue 0 → 100644
... ... @@ -0,0 +1,145 @@
  1 +<template>
  2 + <view class="containers">
  3 + <view class="empty" v-if="auxiliaryData.length <= 0 || auxiliaryData === null">
  4 + <u-empty :text="$t('hdk.AttachmentIsEmpty')" mode="data"
  5 + icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  6 + </view>
  7 + <view class="auxiliaryModule" v-for="(item,index) in auxiliaryData" :key="index" v-else>
  8 + <view class="title">{{$t('hdk.AttachmentModel')}}:{{item.type}}</view>
  9 + <view class="photo">
  10 + <u-swiper @click="previewLargeImage(item.productPicturePath,index)" :current="currents[index]"
  11 + :list="item.productPicturePath" indicator indicatorMode="dot" circular imgMode="aspectFit"
  12 + :height="$isMobile?'400rpx':'600px'" indicatorActiveColor="#00aeaa"
  13 + indicatorInactiveColor="rgba(0, 174, 170, 0.3)" @change=" e => currents[index] = e.current"
  14 + :indicatorStyle="{bottom:'20px',right:'5px'}"></u-swiper>
  15 + </view>
  16 + <view class="title">{{$t('hdk.OrderCode')}}:{{item.orderCode}}</view>
  17 + <UploadFile :fileType="1" :downloadFileName="item.productManual"
  18 + :downloadFileNamePath="item.productManualPath" />
  19 + </view>
  20 + </view>
  21 +</template>
  22 +
  23 +<script>
  24 + import UploadFile from './UploadFile.vue'
  25 + export default {
  26 + components: {
  27 + UploadFile
  28 + },
  29 + props: {
  30 + auxiliaryData: {
  31 + type: Array
  32 + }
  33 + },
  34 + data() {
  35 + return {
  36 + currents: []
  37 + }
  38 + },
  39 + computed: {
  40 +
  41 + },
  42 + mounted() {
  43 + this.currents = this.auxiliaryData.map(() => 0)
  44 + },
  45 + methods: {
  46 + previewLargeImage(productPicturePath, index) {
  47 + console.log("第几组图", index);
  48 + console.log("图片列表", productPicturePath);
  49 + console.log("滑块", this.currents[index]);
  50 + const current = this.currents[index]
  51 + wx.previewImage({
  52 + current: productPicturePath[current],
  53 + urls: productPicturePath
  54 + });
  55 + }
  56 + }
  57 + }
  58 +</script>
  59 +
  60 +<style lang="scss" scoped>
  61 + .containers {
  62 + display: flex;
  63 + justify-content: center;
  64 + align-items: center;
  65 + flex-direction: column;
  66 + }
  67 +
  68 + @media screen and (max-width: 767px) {
  69 + .title {
  70 + font-size: 15px;
  71 + margin: 19px 0 0 14px;
  72 + }
  73 +
  74 + .flex-between {
  75 + margin: 16.5px;
  76 + display: flex;
  77 + justify-content: space-between;
  78 + font-size: 13px;
  79 + }
  80 +
  81 + .auxiliaryModule {
  82 + width: 95%;
  83 + margin: 16px 24px 20px 24px;
  84 + padding: 2px 2px 2px 2px;
  85 + border-radius: 20px;
  86 + background-color: #ffffff;
  87 + box-sizing: border-box;
  88 + }
  89 + }
  90 +
  91 + //PC端样式
  92 + @media screen and (min-width: 768px) {
  93 + .title {
  94 + font-size: 30px;
  95 + margin: 38px 0 0 28px;
  96 + }
  97 +
  98 + .flex-between {
  99 + margin: 33px;
  100 + display: flex;
  101 + justify-content: space-between;
  102 + font-size: 26px;
  103 + }
  104 +
  105 + .auxiliaryModule {
  106 + width: 80%;
  107 + margin: 16px 24px 20px 24px;
  108 + padding: 2px 2px 2px 2px;
  109 + border-radius: 20px;
  110 + background-color: #ffffff;
  111 + box-sizing: border-box;
  112 + }
  113 + }
  114 +
  115 + .empty {
  116 + width: 100%;
  117 + height: 100%;
  118 + }
  119 +
  120 +
  121 +
  122 + .photo {
  123 + margin: 30px;
  124 + }
  125 +
  126 +
  127 +
  128 + .leftT {
  129 + background-color: rgba(255, 255, 255, 0);
  130 + box-sizing: border-box;
  131 + font-family: '苹方 中等', '苹方', sans-serif;
  132 + color: #999db0;
  133 + text-align: left;
  134 + line-height: normal;
  135 + }
  136 +
  137 + .rightT {
  138 + background-color: rgba(255, 255, 255, 0);
  139 + box-sizing: border-box;
  140 + font-family: '苹方 中等', '苹方', sans-serif;
  141 + color: #2b3950;
  142 + text-align: left;
  143 + line-height: normal;
  144 + }
  145 +</style>
0 146 \ No newline at end of file
... ...
pages/component/InformationModule.vue 0 → 100644
... ... @@ -0,0 +1,196 @@
  1 +<template>
  2 + <view class="containers">
  3 + <u-swiper class="swiperCss" :list="informationData.lampPath"
  4 + @click="previewLargeImage(informationData.lampPath,current)" :current="current" indicator
  5 + indicatorMode="dot" imgMode="aspectFit" circular :height="$isMobile?'400rpx':'600px'"
  6 + indicatorActiveColor="#00aeaa" indicatorInactiveColor="rgba(0, 174, 170, 0.3)" @change="changeSwiper"
  7 + :indicatorStyle="{bottom:'20px',right:'5px'}"></u-swiper>
  8 + <view class="informationModule">
  9 + <view class="title">
  10 + {{$t('hdk.productInformation')}}
  11 + </view>
  12 + <view class="flex-between">
  13 + <text class="leftT">{{$t('hdk.SnCode')}}</text>
  14 + <text class="rightT">{{informationData.sn || ""}}</text>
  15 + </view>
  16 + <view class="flex-between">
  17 + <text class="leftT">{{$t('hdk.ProductName')}}</text>
  18 + <text class="rightT">{{informationData.productName || ""}}</text>
  19 + </view>
  20 + <view class="flex-between">
  21 + <text class="leftT">{{$t('hdk.Model')}}</text>
  22 + <text class="rightT">{{informationData.type || ""}}</text>
  23 + </view>
  24 + <view class="flex-between">
  25 + <text class="leftT">{{$t('hdk.DateOfProduction')}}</text>
  26 + <text class="rightT">{{$u.timeFormat(informationData.productionTime, 'yyyy-mm-dd') || ""}}</text>
  27 + </view>
  28 + <view class="flex-between">
  29 + <text class="leftT">{{$t('hdk.ProductionPersonnel')}}</text>
  30 + <text class="rightT">{{informationData.productionUserName || ""}}</text>
  31 + </view>
  32 + </view>
  33 + <view class="fileViewingModule">
  34 + <view class="title">
  35 + {{$t('hdk.ProductSpecification')}}
  36 + </view>
  37 + <UploadFile :fileType="1" :downloadFileName="informationData.productDatasheet"
  38 + :downloadFileNamePath="informationData.productDatasheetPath" />
  39 + </view>
  40 +
  41 + <view class="fileViewingModule">
  42 + <view class="title">
  43 + {{$t('hdk.ProductManual')}}
  44 + </view>
  45 + <UploadFile :fileType="1" :downloadFileName="informationData.productManual"
  46 + :downloadFileNamePath="informationData.productManualPath" />
  47 + </view>
  48 + </view>
  49 +</template>
  50 +
  51 +<script>
  52 + import UploadFile from './UploadFile.vue'
  53 + export default {
  54 + components: {
  55 + UploadFile
  56 + },
  57 + props: {
  58 + informationData: {
  59 + type: Object
  60 + }
  61 + },
  62 + data() {
  63 + return {
  64 + current: 0
  65 + }
  66 + },
  67 + computed: {
  68 +
  69 + },
  70 + onLoad() {},
  71 + methods: {
  72 + changeSwiper(e) {
  73 + this.current = e.current
  74 + // console.log("当前滑块", this.current);
  75 + },
  76 + previewLargeImage(productPicturePath, current) {
  77 + console.log("图片列表", productPicturePath);
  78 + console.log("滑块", current);
  79 + wx.previewImage({
  80 + current: productPicturePath[current],
  81 + urls: productPicturePath
  82 + });
  83 + }
  84 + }
  85 + }
  86 +</script>
  87 +
  88 +<style lang="scss" scoped>
  89 + .containers {
  90 + display: flex;
  91 + justify-content: center;
  92 + align-items: center;
  93 + flex-direction: column;
  94 + }
  95 +
  96 +
  97 + //移动端样式
  98 + @media screen and (max-width: 767px) {
  99 + .title {
  100 + font-size: 15px;
  101 + margin: 19px 0 0 14px;
  102 + }
  103 +
  104 + .swiperCss {
  105 + width: 95%;
  106 + }
  107 +
  108 + .flex-between {
  109 + margin: 16.5px;
  110 + display: flex;
  111 + justify-content: space-between;
  112 + font-size: 13px;
  113 + }
  114 +
  115 + .pdfTitle {
  116 + font-size: 13px;
  117 + margin-left: 8px;
  118 + }
  119 +
  120 + .informationModule {
  121 + width: 95%;
  122 + margin: 20px 24px;
  123 + padding: 2px;
  124 + border-radius: 20px;
  125 + background-color: #ffffff;
  126 + box-sizing: border-box;
  127 + }
  128 +
  129 + .fileViewingModule {
  130 + width: 95%;
  131 + min-height: 100px;
  132 + margin: 20px 24px;
  133 + padding: 2px 2px 2px 2px;
  134 + border-radius: 20px;
  135 + background-color: #ffffff;
  136 + box-sizing: border-box;
  137 + }
  138 +
  139 + }
  140 +
  141 + //PC端样式
  142 + @media screen and (min-width: 768px) {
  143 + .title {
  144 + font-size: 30px;
  145 + margin: 38px 0 0 28px;
  146 + }
  147 +
  148 + .swiperCss {
  149 + width: 80%;
  150 + }
  151 +
  152 + .flex-between {
  153 + margin: 33px;
  154 + display: flex;
  155 + justify-content: space-between;
  156 + font-size: 26px;
  157 + }
  158 +
  159 + .informationModule {
  160 + width: 80%;
  161 + margin: 20px 24px;
  162 + padding: 2px;
  163 + border-radius: 20px;
  164 + background-color: #ffffff;
  165 + box-sizing: border-box;
  166 + }
  167 +
  168 +
  169 + .fileViewingModule {
  170 + width: 80%;
  171 + min-height: 100px;
  172 + margin: 20px 24px;
  173 + padding: 2px 2px 2px 2px;
  174 + border-radius: 20px;
  175 + background-color: #ffffff;
  176 + box-sizing: border-box;
  177 + }
  178 + }
  179 + .leftT {
  180 + background-color: rgba(255, 255, 255, 0);
  181 + box-sizing: border-box;
  182 + font-family: '苹方 中等', '苹方', sans-serif;
  183 + color: #999db0;
  184 + text-align: left;
  185 + line-height: normal;
  186 + }
  187 +
  188 + .rightT {
  189 + background-color: rgba(255, 255, 255, 0);
  190 + box-sizing: border-box;
  191 + font-family: '苹方 中等', '苹方', sans-serif;
  192 + color: #2b3950;
  193 + text-align: left;
  194 + line-height: normal;
  195 + }
  196 +</style>
0 197 \ No newline at end of file
... ...
pages/component/InspectionModule.vue 0 → 100644
... ... @@ -0,0 +1,224 @@
  1 +<template>
  2 + <view class="containers">
  3 + <!-- <view class="empty" v-if="inspectionData === null">
  4 + <u-empty text="附件为空" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  5 + </view> -->
  6 + <view class="informationModule">
  7 + <view class="title">
  8 + {{$t('hdk.inspectionInformation')}}
  9 + </view>
  10 + <view class="flex-between">
  11 + <text class="leftT">{{$t('hdk.SoftwareVersion')}}</text>
  12 + <text class="rightT">{{inspectionData.softwareVersion || ''}}</text>
  13 + </view>
  14 + <view class="flex-between">
  15 + <text class="leftT">{{$t('hdk.HardwareVersion')}}</text>
  16 + <text class="rightT">{{inspectionData.hardwareVersion || ''}}</text>
  17 + </view>
  18 + <view class="flex-between">
  19 + <text class="leftT">{{$t('hdk.TestDate')}}</text>
  20 + <text class="rightT">{{$u.timeFormat(inspectionData.checkTime, 'yyyy年mm月dd日') || ''}}</text>
  21 + </view>
  22 + </view>
  23 +
  24 + <view class="informationModule">
  25 + <view class="title">
  26 + {{$t('hdk.ElectricalParameters')}}
  27 + </view>
  28 + <view class="flex-between">
  29 + <text class="leftT">{{$t('hdk.Power')}}</text>
  30 + <text class="rightT">{{inspectionData.power || ''}}</text>
  31 + </view>
  32 + <view class="flex-between">
  33 + <text class="leftT">{{$t('hdk.PowerFactor')}}</text>
  34 + <text class="rightT">{{inspectionData.powerFactor || ''}}</text>
  35 + </view>
  36 + </view>
  37 +
  38 + <view class="dataViewingModule">
  39 + <view class="title">
  40 + {{$t('hdk.LightIntensityDistribution')}}
  41 + </view>
  42 + <view class="photo">
  43 + <u-swiper :list="inspectionData.lightIntensityPhoto"
  44 + @click="previewLargeImage(inspectionData.lightIntensityPhoto,current)" :current="current"
  45 + v-if="inspectionData.lightIntensityPhoto.length > 0" indicator indicatorMode="dot" circular
  46 + imgMode="aspectFit" :height="$isMobile?'400rpx':'600px'" indicatorActiveColor="#00aeaa"
  47 + @change="changeSwiper" indicatorInactiveColor="rgba(0, 174, 170, 0.3)"
  48 + :indicatorStyle="{bottom:'20px',right:'5px'}"></u-swiper>
  49 + </view>
  50 + <UploadFile :fileType="2" v-for="(item,index) in inspectionData.lightIntensityFile" :key="index"
  51 + :downloadFileName="item" :downloadFileNamePath="item" :isCsv="true" />
  52 + </view>
  53 +
  54 + <view class="fileViewingModule">
  55 + <view class="title">
  56 + {{$t('hdk.AirTightnessInspectionDocuments')}}
  57 + </view>
  58 + <UploadFile :fileType="2" :downloadFileName="inspectionData.tightnessCheckFile"
  59 + :downloadFileNamePath="inspectionData.tightnessCheckFilePath" />
  60 + </view>
  61 +
  62 + </view>
  63 +</template>
  64 +
  65 +<script>
  66 + import UploadFile from './UploadFile.vue'
  67 + export default {
  68 + components: {
  69 + UploadFile
  70 + },
  71 + props: {
  72 + inspectionData: {
  73 + type: Object
  74 + }
  75 + },
  76 + data() {
  77 + return {
  78 + current: 0
  79 + }
  80 + },
  81 + computed: {
  82 +
  83 + },
  84 + onLoad() {
  85 +
  86 + },
  87 + methods: {
  88 + changeSwiper(e) {
  89 + this.current = e.current
  90 + // console.log("当前滑块",this.current);
  91 + },
  92 + previewLargeImage(productPicturePath, current) {
  93 + console.log("图片列表", productPicturePath);
  94 + console.log("滑块", current);
  95 + wx.previewImage({
  96 + current: productPicturePath[current],
  97 + urls: productPicturePath
  98 + });
  99 + }
  100 + }
  101 + }
  102 +</script>
  103 +
  104 +<style lang="scss" scoped>
  105 + .containers {
  106 + display: flex;
  107 + justify-content: center;
  108 + align-items: center;
  109 + flex-direction: column;
  110 + }
  111 +
  112 + //移动端样式
  113 + @media screen and (max-width: 767px) {
  114 + .title {
  115 + font-size: 15px;
  116 + margin: 19px 0 0 14px;
  117 + }
  118 +
  119 + .flex-between {
  120 + margin: 16.5px;
  121 + display: flex;
  122 + justify-content: space-between;
  123 + font-size: 13px;
  124 + }
  125 +
  126 + .informationModule {
  127 + width: 95%;
  128 + max-height: 467px;
  129 + margin: 20px 24px;
  130 + padding: 2px 2px 2px 2px;
  131 + border-radius: 20px;
  132 + background-color: #ffffff;
  133 + box-sizing: border-box;
  134 + }
  135 +
  136 + .fileViewingModule {
  137 + width: 95%;
  138 + margin: 20px 24px;
  139 + padding: 2px 2px 2px 2px;
  140 + border-radius: 20px;
  141 + background-color: #ffffff;
  142 + box-sizing: border-box;
  143 + }
  144 +
  145 +
  146 + .dataViewingModule {
  147 + width: 95%;
  148 + margin: 20px 24px;
  149 + padding: 2px 2px 2px 2px;
  150 + border-radius: 20px;
  151 + background-color: #ffffff;
  152 + box-sizing: border-box;
  153 + }
  154 + }
  155 +
  156 + //PC端样式
  157 + @media screen and (min-width: 768px) {
  158 + .title {
  159 + font-size: 30px;
  160 + margin: 38px 0 0 28px;
  161 + }
  162 +
  163 + .flex-between {
  164 + margin: 33px;
  165 + display: flex;
  166 + justify-content: space-between;
  167 + font-size: 26px;
  168 + }
  169 +
  170 + .informationModule {
  171 + width: 80%;
  172 + max-height: 467px;
  173 + margin: 20px 24px;
  174 + padding: 2px 2px 2px 2px;
  175 + border-radius: 20px;
  176 + background-color: #ffffff;
  177 + box-sizing: border-box;
  178 + }
  179 +
  180 + .fileViewingModule {
  181 + width: 80%;
  182 + margin: 20px 24px;
  183 + padding: 2px 2px 2px 2px;
  184 + border-radius: 20px;
  185 + background-color: #ffffff;
  186 + box-sizing: border-box;
  187 + }
  188 +
  189 +
  190 + .dataViewingModule {
  191 + width: 80%;
  192 + margin: 20px 24px;
  193 + padding: 2px 2px 2px 2px;
  194 + border-radius: 20px;
  195 + background-color: #ffffff;
  196 + box-sizing: border-box;
  197 + }
  198 + }
  199 +
  200 +
  201 +
  202 + .photo {
  203 + margin: 30px;
  204 + }
  205 +
  206 +
  207 + .leftT {
  208 + background-color: rgba(255, 255, 255, 0);
  209 + box-sizing: border-box;
  210 + font-family: '苹方 中等', '苹方', sans-serif;
  211 + color: #999db0;
  212 + text-align: left;
  213 + line-height: normal;
  214 + }
  215 +
  216 + .rightT {
  217 + background-color: rgba(255, 255, 255, 0);
  218 + box-sizing: border-box;
  219 + font-family: '苹方 中等', '苹方', sans-serif;
  220 + color: #2b3950;
  221 + text-align: left;
  222 + line-height: normal;
  223 + }
  224 +</style>
0 225 \ No newline at end of file
... ...
pages/component/QrScan.vue 0 → 100644
... ... @@ -0,0 +1,100 @@
  1 +<template>
  2 + <div class="qrcode">
  3 + <div id="reader">
  4 + </div>
  5 + </div>
  6 +</template>
  7 +
  8 +<script>
  9 + import {
  10 + Html5Qrcode
  11 + } from 'html5-qrcode';
  12 + export default {
  13 + created() {
  14 + this.getCameras();
  15 + navigator.mediaDevices.getUserMedia({
  16 + video: true
  17 + })
  18 + .then(stream => {
  19 + this.$refs.qrcodeReader.$refs.reader.$refs.video.srcObject = stream
  20 + })
  21 + .catch(error => {
  22 + console.log(error)
  23 + // alert('Failed to access camera.')
  24 + })
  25 + },
  26 + beforeDestroy() {
  27 + this.stop();
  28 + },
  29 + methods: {
  30 + getCameras() {
  31 + Html5Qrcode.getCameras()
  32 + .then((devices) => {
  33 + if (devices && devices.length) {
  34 + this.html5QrCode = new Html5Qrcode('reader');
  35 + this.start();
  36 + }
  37 + })
  38 + .catch((err) => {
  39 + // handle err
  40 + this.html5QrCode = new Html5Qrcode('reader');
  41 + this.error = 'ERROR: 您需要授予相机访问权限';
  42 + this.$emit('err', this.error, err);
  43 + });
  44 + },
  45 + start() {
  46 + //environment后置 user前置
  47 + this.html5QrCode
  48 + .start({
  49 + facingMode: 'environment'
  50 + }, {
  51 + fps: 10, // 设置每秒多少帧
  52 + aspectRatio: 1,
  53 + qrbox: 250, // 设置取景范围
  54 + colorDark: '#0000ff', //加深二维码黑色部分的颜色提高识别度
  55 + colorLight: '#ffffff', //这个应该是提高非黑即白部分的亮度 提高识别度
  56 + visualFeedback: true, //开启视觉反馈 没有体会到
  57 + halfSample: true, //缩小二维码提高识别精度吧
  58 + },
  59 + (decodedText) => {
  60 + this.$emit('ok', decodedText);
  61 + },
  62 + )
  63 + .catch((err) => {
  64 + this.$emit('err', err);
  65 + });
  66 + },
  67 + stop() {
  68 + this.html5QrCode
  69 + .stop()
  70 + .then((ignore) => {
  71 + // QR Code scanning is stopped.
  72 + this.$emit('err', ignore);
  73 + console.log('QR Code scanning stopped.');
  74 + })
  75 + .catch((err) => {
  76 + this.$emit('err', err);
  77 + // Stop failed, handle it.
  78 + console.log('Unable to stop scanning.');
  79 + });
  80 + },
  81 + },
  82 + };
  83 +</script>
  84 +
  85 +<style lang="scss" scoped>
  86 + .qrcode {
  87 + position: absolute;
  88 + height: 100%;
  89 + width: 100%;
  90 + // background: rgba($color: #000000, $alpha: 0.48);
  91 + background:rgba(0, 0, 0, 1.48);
  92 + }
  93 +
  94 +
  95 + #reader {
  96 + top: 50%;
  97 + left: 0;
  98 + transform: translateY(-50%);
  99 + }
  100 +</style>
0 101 \ No newline at end of file
... ...
pages/component/UploadFile.vue 0 → 100644
... ... @@ -0,0 +1,222 @@
  1 +<template>
  2 + <view>
  3 + <view class="flex-content">
  4 + <view class="iconText">
  5 + <u-icon name="/static/images/icon/pdfIcon.png" size="33px" v-if="fileType == 1"></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>
  8 + <text class="iconTitle"
  9 + @click="seeFile">{{downloadFileName ? downloadFileName.substring(downloadFileName.lastIndexOf('/') + 1) : $t('hdk.noFile')}}</text>
  10 + </view>
  11 + <view class="rightText" @click="seeFile('preview')" v-if="downloadFileNamePath != ''">
  12 + {{$t('hdk.Check')}}
  13 + </view>
  14 + </view>
  15 + </view>
  16 +</template>
  17 +
  18 +<script>
  19 + import {
  20 + downloadTemplateFile
  21 + } from '@/api/scan.js'
  22 + import config from '@/common/config'
  23 + export default {
  24 + components: {},
  25 + props: {
  26 + fileType: {
  27 + type: Number,
  28 + require: true
  29 + },
  30 + downloadFileName: {
  31 + type: String,
  32 + require: true
  33 + },
  34 + downloadFileNamePath: {
  35 + type: String,
  36 + require: true
  37 + },
  38 + isCsv: {
  39 + type: Boolean,
  40 + default: false
  41 + },
  42 + },
  43 + data() {
  44 + return {
  45 + openIframe:false,
  46 + documentUrl:""
  47 + }
  48 + },
  49 + computed: {
  50 +
  51 + },
  52 + onLoad() {
  53 + // uni.showShareMenu({
  54 + // withShareTicket: true,
  55 + // menus: ['shareAppMessage'],
  56 + // success: function() {
  57 + // console.log('分享菜单显示成功');
  58 + // },
  59 + // fail: function(res) {
  60 + // console.log('分享菜单显示失败', res);
  61 + // }
  62 + // });
  63 + },
  64 + methods: {
  65 + seeFile(acceptType) {
  66 + console.log(acceptType);
  67 + // if (this.isCsv) {
  68 + // return
  69 + // }
  70 + console.log('查看文件');
  71 + uni.showLoading({
  72 + title: this.$t('hdk.loading')
  73 + })
  74 + let that = this;
  75 +
  76 + if (!this.isCsv) {
  77 + const count = (this.downloadFileNamePath.match(/;/g) || []).length;
  78 + console.log(this.downloadFileNamePath, "解析文件有", count, "个")
  79 + if (count > 1) {
  80 + uni.showToast({
  81 + icon: 'none',
  82 + title: this.$t('hdk.incorrectImportFormat')
  83 + });
  84 + return
  85 + }
  86 + }
  87 + //去除分号分割符
  88 + let downloadName = that.downloadFileNamePath.replace(/;/g, "");
  89 + console.log("下载名", downloadName);
  90 + // let query = `/download?bucketName=hdk&file=${downloadName}`
  91 + // console.log("query", config.baseUrl + query)
  92 + const parts = downloadName.split(".");
  93 + // 取数组最后一个元素作为后缀名
  94 + let fileType = parts[parts.length - 1];
  95 + console.log("后缀", fileType);
  96 + let environment = uni.getSystemInfoSync().platform
  97 + console.log("当前环境", environment);
  98 + const urls = config.fileUrl + `/${encodeURI(downloadName)}`
  99 + let fileName = downloadName.substring(downloadName.lastIndexOf('/') + 1);
  100 + this.checkUrlValidity(urls).then(isExistence => {
  101 + if (isExistence) {
  102 + uni.hideLoading()
  103 + uni.getSystemInfo({
  104 + success: function (res) {
  105 + var platform = res.platform.toLowerCase();
  106 + // 如果是安卓设备
  107 + if (platform === 'android' || platform === 'windows') {
  108 + window.open(urls, '_blank');
  109 + }
  110 + // 如果是 iOS 设备
  111 + else if (platform === 'ios') {
  112 + window.open(urls);
  113 + }
  114 + }
  115 + });
  116 + } else {
  117 + uni.hideLoading()
  118 + uni.showToast({
  119 + icon: 'none',
  120 + title: this.$t('hdk.fileNotUploaded')
  121 + });
  122 + }
  123 + })
  124 + },
  125 + //检查是否有效
  126 + checkUrlValidity(url) {
  127 + return new Promise((resolve, reject) => {
  128 + uni.request({
  129 + url,
  130 + header: {
  131 + 'tenant-id': 1,
  132 + },
  133 + method: 'HEAD',
  134 + success(res) {
  135 + console.log("检验地址", res);
  136 + if (res.statusCode >= 200 && res.statusCode < 400) {
  137 + resolve(true); // URL有效
  138 + } else {
  139 + console.log("地址无效");
  140 + resolve(false); // URL无效
  141 + }
  142 + },
  143 + fail(err) {
  144 + reject(err); // 请求失败
  145 + }
  146 + });
  147 + });
  148 + },
  149 + }
  150 + }
  151 +</script>
  152 +
  153 +<style lang="scss" scoped>
  154 + @media screen and (max-width: 767px) {
  155 + .iconTitle {
  156 + width: 200px;
  157 + font-size: 13px;
  158 + margin-left: 8px;
  159 + white-space: nowrap;
  160 + /* 防止换行 */
  161 + overflow: hidden;
  162 + /* 超出部分隐藏 */
  163 + text-overflow: ellipsis;
  164 + /* 显示省略号 */
  165 + }
  166 + .rightText {
  167 + padding: 5px;
  168 + color: #00aeaa;
  169 + font-size: 14px;
  170 + }
  171 +
  172 + .flex-content {
  173 + display: flex;
  174 + justify-content: space-between;
  175 + font-size: 26px;
  176 + align-items: center;
  177 + margin: 30px;
  178 +
  179 + .iconText {
  180 + display: flex;
  181 + align-items: center;
  182 + height: 50px;
  183 + color: #2b3950;
  184 + }
  185 + }
  186 + }
  187 +
  188 + //PC端样式
  189 + @media screen and (min-width: 768px) {
  190 + .iconTitle {
  191 + width: 400px;
  192 + font-size: 26px;
  193 + margin-left: 16px;
  194 + white-space: nowrap;
  195 + /* 防止换行 */
  196 + overflow: hidden;
  197 + /* 超出部分隐藏 */
  198 + text-overflow: ellipsis;
  199 + /* 显示省略号 */
  200 + }
  201 + .rightText {
  202 + padding: 10px;
  203 + color: #00aeaa;
  204 + font-size: 28px;
  205 + }
  206 +
  207 + .flex-content {
  208 + display: flex;
  209 + justify-content: space-between;
  210 + font-size: 26px;
  211 + align-items: center;
  212 + margin: 30px;
  213 +
  214 + .iconText {
  215 + display: flex;
  216 + align-items: center;
  217 + height: 50px;
  218 + color: #2b3950;
  219 + }
  220 + }
  221 + }
  222 +</style>
0 223 \ No newline at end of file
... ...
pages/component/component.vue 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +<template>
  2 + <view class="container">
  3 + <no-data></no-data>
  4 + </view>
  5 +</template>
  6 +
  7 +<script>
  8 + export default {
  9 + data() {
  10 + return {
  11 + title: this.$t('')
  12 + }
  13 + },
  14 + methods: {
  15 +
  16 + }
  17 + }
  18 +</script>
  19 +
  20 +<style>
  21 +
  22 +</style>
... ...
pages/component/goback.vue 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +<template>
  2 + <view class="back" @click="goback" v-if="!$isMobile">
  3 + <u-image src="/static/images/icon/back.png" mode="witFix" width="100px" height="100px"></u-image>
  4 + </view>
  5 +</template>
  6 +
  7 +<script>
  8 + export default {
  9 + components: {},
  10 + props: {
  11 +
  12 + },
  13 + data() {
  14 + return {
  15 +
  16 + }
  17 + },
  18 + computed: {
  19 +
  20 + },
  21 + onLoad() {
  22 +
  23 + },
  24 + methods: {
  25 + goback() {
  26 + if (window.history.length > 1) {
  27 + window.history.back();
  28 + } else {
  29 + window.location.href = '/mobile';
  30 + }
  31 + }
  32 + }
  33 + }
  34 +</script>
  35 +
  36 +<style lang="scss" scoped>
  37 + .back {
  38 + width: 50px;
  39 + height: 50px;
  40 + border-radius: 50px;
  41 + position: fixed;
  42 + display: flex;
  43 + flex-direction: column;
  44 + justify-content: center;
  45 + align-items: center;
  46 + left:1%;
  47 + top: 10%;
  48 + bottom: 0;
  49 + }
  50 +</style>
0 51 \ No newline at end of file
... ...
pages/component/topWindow.vue 0 → 100644
... ... @@ -0,0 +1,160 @@
  1 +<template>
  2 + <view>
  3 + <b-navbar toggleable="lg" type="dark" class="b-navbar">
  4 + <b-navbar-brand :title="$t('hdk.gohome')" href="/mobile">
  5 + <img src="@/static/hdk-top-logo.png" width="63px" height="32px" style="margin-left: 10px;" alt="Kitten">
  6 + </b-navbar-brand>
  7 + <b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
  8 + <b-collapse id="nav-collapse" is-nav class="collapseR">
  9 + <b-navbar-nav>
  10 + <b-nav-item v-show="!isHome" @click="handleClick('productInformation')"
  11 + :class="{ 'activeCSS': selectedNavItem === 'productInformation' }">
  12 + {{$t('hdk.productInformation')}}
  13 + </b-nav-item>
  14 + <b-nav-item v-show="!isHome" @click="handleClick('inspectionInformation')"
  15 + :class="{ 'activeCSS': selectedNavItem === 'inspectionInformation' }">
  16 + {{$t('hdk.inspectionInformation')}}
  17 + </b-nav-item>
  18 + <b-nav-item v-show="!isHome" @click="handleClick('attachmentInformation')"
  19 + :class="{ 'activeCSS': selectedNavItem === 'attachmentInformation' }">
  20 + {{$t('hdk.attachmentInformation')}}
  21 + </b-nav-item>
  22 + <b-nav-item-dropdown :text="selectedLanguage" right>
  23 + <template #button-content>
  24 + <img src="@/static/images/icon/language.png" width="17px" height="17px"
  25 + alt="Kitten" style="margin:2px 2px 5px 2px;">
  26 + <text>{{selectedLanguage}}</text>
  27 + </template>
  28 + <b-dropdown-item href="#" @click="changeLanguage('en')">{{$t('locale.en')}}
  29 + </b-dropdown-item>
  30 + <b-dropdown-item href="#" @click="changeLanguage('zh-hans')">{{$t('locale.zh-hans')}}
  31 + </b-dropdown-item>
  32 + </b-nav-item-dropdown>
  33 + </b-navbar-nav>
  34 + </b-collapse>
  35 + </b-navbar>
  36 + </view>
  37 +</template>
  38 +
  39 +<script>
  40 + export default {
  41 + data() {
  42 + return {
  43 + selectedLanguage: this.$t('index.language'),
  44 + selectedNavItem: 'productInformation'
  45 + }
  46 + },
  47 + props: {
  48 + isHome: {
  49 + type: Boolean,
  50 + default: true
  51 + },
  52 + },
  53 + mounted() {
  54 + var url = window.location.href;
  55 + var lang = this.getQueryString('lang');
  56 + console.log("地址携带语种", lang);
  57 + if (lang === "zh") {
  58 + this.$i18n.locale = 'zh-Hans';
  59 + uni.setLocale('zh-Hans');
  60 + this.selectedLanguage = `${this.$t('index.language')}:${this.$t('locale.zh-hans')}`;
  61 + } else if (lang === "en") {
  62 + this.$i18n.locale = 'en';
  63 + uni.setLocale('en');
  64 + this.selectedLanguage = `${this.$t('index.language')}:${this.$t('locale.en')}`;
  65 + } else {
  66 + let Localelang = 'en';
  67 + console.log("本地语言", Localelang);
  68 + this.selectedLanguage = Localelang == 'en' ? `${this.$t('index.language')}:${this.$t('locale.en')}` :
  69 + `${this.$t('index.language')}:${this.$t('locale.zh-hans')}`
  70 + }
  71 + },
  72 + methods: {
  73 + getQueryString(key) {
  74 + const url = new URL(decodeURIComponent(location.href));
  75 + return url.searchParams.get(key);
  76 + },
  77 + handleClick(item) {
  78 + this.selectedNavItem = item;
  79 + this.$emit('item-click', item);
  80 + },
  81 + changeLanguage(locale) {
  82 + console.log('切换语言为:', locale);
  83 + // 更新选择的语言
  84 + if (locale === 'en') {
  85 + this.$i18n.locale = 'en';
  86 + uni.setLocale('en');
  87 + this.selectedLanguage = `${this.$t('index.language')}:${this.$t('locale.en')}`;
  88 + } else if (locale === 'zh-hans') {
  89 + this.$i18n.locale = 'zh-Hans';
  90 + uni.setLocale('zh-Hans');
  91 + this.selectedLanguage = `${this.$t('index.language')}:${this.$t('locale.zh-hans')}`;
  92 + }
  93 + }
  94 + }
  95 + }
  96 +</script>
  97 +
  98 +<style scoped lang="scss">
  99 + .uni-top-window {
  100 + padding: 0 15px;
  101 + display: flex;
  102 + flex-direction: row;
  103 + justify-content: space-between;
  104 + align-items: center;
  105 + box-sizing: border-box;
  106 + border-bottom: 1px solid #e1e1e1;
  107 + background-color: #00AEAA;
  108 + color: #333;
  109 + }
  110 +
  111 + .b-navbar {
  112 + width: 100vw;
  113 + background-color: #00AEAA;
  114 + display: flex;
  115 + }
  116 +
  117 + /* PC端样式 */
  118 + @media screen and (min-width: 768px) {
  119 + .b-navbar {
  120 + padding: 0 10%;
  121 + height: 50px;
  122 + }
  123 +
  124 + .navbar-nav {
  125 + height: 100%;
  126 + }
  127 +
  128 + .nav-item {
  129 + padding: 0 20px;
  130 + }
  131 +
  132 + .collapseR {
  133 + width: 100%;
  134 + height: 100%;
  135 + line-height: 30px !important;
  136 + justify-content: flex-end;
  137 + }
  138 + }
  139 +
  140 + /* 移动端样式 */
  141 + @media screen and (max-width: 767px) {
  142 + .nav-item {
  143 + padding-left: 10px;
  144 + }
  145 + }
  146 +
  147 + .activeCSS {
  148 + .nav-link {
  149 + color: #000;
  150 + }
  151 +
  152 + background: #fff;
  153 + }
  154 +
  155 +
  156 +
  157 + .b-navCss {
  158 + color: #fff;
  159 + }
  160 +</style>
... ...
pages/homePage/index.vue 0 → 100644
... ... @@ -0,0 +1,263 @@
  1 +<template>
  2 + <view class="containers">
  3 + <topWindow :isHome="true"></topWindow>
  4 + <view class="content">
  5 + <image src="@/static/logo.png" style="width: 100px; height: 50px;" mode="aspectFit"></image>
  6 + <view class="tipsCss">{{$t('hdk.tips')}}</view>
  7 + <view class="flex-row">
  8 + <b-input id="input" ref="inputField" class="inputCss" autofocus="autofocus" :placeholder="$t('hdk.placeholder')"
  9 + @input="handleChange" @keypress.enter="handleScan" v-model="SNcode"></b-input>
  10 + <b-button class="SearchBtnCss my-2 my-sm-0" size="sm" @click="search"
  11 + style="background:#00AEAA;">{{$t('hdk.search')}}</b-button>
  12 + </view>
  13 + <view class="errorTipCss" v-if="isError">
  14 + <image class="errorImageCss" src="/static/images/icon/warning.png"
  15 + style="width:16px;height:16px;margin: 2px;" mode="widthFix" />
  16 + <text>{{$t('hdk.sninexistence')}}</text>
  17 + </view>
  18 + <view class="btnSNscan" @click="scanClick" v-if="$isMobile">
  19 + <u-icon name="/static/images/icon/scan2.png"></u-icon>
  20 + <text style="margin-left: 10rpx;">{{$t('hdk.scan')}}</text>
  21 + </view>
  22 + </view>
  23 + </view>
  24 +</template>
  25 +
  26 +<script>
  27 + // window.document.onkeydown = (e) => {
  28 + // console.log(e);
  29 + // let input = document.getElementById('input');
  30 + // input.focus()
  31 + // if (e.keyCode === 20) {
  32 + // console.log(input.value);
  33 + // input.innerHTML = input.value;
  34 + // // input.value = ''
  35 + // }
  36 + // }
  37 +
  38 + import {
  39 + getProductFind
  40 + } from '@/api/scan'
  41 + import topWindow from "@/pages/component/topWindow.vue"
  42 + export default {
  43 + data() {
  44 + return {
  45 + systemLocale: '',
  46 + applicationLocale: '',
  47 + isError: false,
  48 + SNcode: "",
  49 + open: false,
  50 + lastTimeLen: null,
  51 + lastCode: ""
  52 + }
  53 + },
  54 + components: {
  55 + topWindow,
  56 + },
  57 + computed: {
  58 + locales() {
  59 + return [{
  60 + text: this.$t('locale.en'),
  61 + code: 'en'
  62 + },
  63 + {
  64 + text: this.$t('locale.zh-hans'),
  65 + code: 'zh-Hans'
  66 + },
  67 + ]
  68 + }
  69 + },
  70 + mounted() {
  71 + // const inputElement = this.$refs.inputField.$el.querySelector('input');
  72 + document.addEventListener('keydown', this.handleKeyDown);
  73 + },
  74 + onLoad() {
  75 + let systemInfo = uni.getSystemInfoSync();
  76 + this.systemLocale = systemInfo.language;
  77 + this.applicationLocale = uni.getLocale();
  78 + this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
  79 + },
  80 + methods: {
  81 + getFirstSnFromUrl(url) {
  82 + const regex = /sn=([^&]+)/;
  83 + const match = url.match(regex);
  84 + if (match && match.length > 1) {
  85 + const sn = match[1];
  86 + return sn;
  87 + }
  88 + return url;
  89 + },
  90 + handleChange(event) {
  91 + console.log(event);
  92 + this.SNcode = this.getFirstSnFromUrl(event);
  93 + },
  94 + handleScan(event) {
  95 + // console.log(this.SNcode);
  96 + // 捕获扫码枪输入的内容
  97 + // this.isError = false;
  98 +
  99 + },
  100 + search() {
  101 + console.log("查询");
  102 + if (this.SNcode === "") {
  103 + return
  104 + }
  105 + uni.showLoading({
  106 + title: '查询中...'
  107 + })
  108 + getProductFind(this.SNcode).then(res => {
  109 + uni.hideLoading()
  110 + if (res.code == 0) {
  111 + console.log("sn查询结果", res)
  112 + const data = res.data;
  113 + uni.navigateTo({
  114 + url: "/pages/product/index?sn=" + this.SNcode
  115 + })
  116 + } else {
  117 + this.isError = true
  118 + }
  119 + })
  120 + },
  121 + scanClick() {
  122 + uni.navigateTo({
  123 + url: "/pages/product/scan"
  124 + })
  125 + },
  126 + getResult(res) {
  127 + console.log(res);
  128 + },
  129 + geterror(e) {
  130 + console.log(e);
  131 + }
  132 + }
  133 + }
  134 +</script>
  135 +
  136 +<style lang="scss" scoped>
  137 + .containers {
  138 + width: 100vw;
  139 + height: 100vh;
  140 + background: #1E5866;
  141 + }
  142 +
  143 + .content {
  144 + display: flex;
  145 + flex-direction: column;
  146 + justify-content: center;
  147 + align-items: center;
  148 + height: 80vh;
  149 + }
  150 +
  151 + .flex-row {
  152 + display: flex;
  153 + justify-content: center;
  154 + align-items: center;
  155 + }
  156 +
  157 + //移动端样式
  158 + @media screen and (max-width: 767px) {
  159 + .inputCss {
  160 + width: 278px;
  161 + height: 44px;
  162 + }
  163 +
  164 + .btnSNscan {
  165 + width: 100px;
  166 + height: 38px;
  167 + margin: 8px;
  168 + padding: 2px;
  169 + display: flex;
  170 + align-items: center;
  171 + justify-content: center;
  172 + border-radius: 54px;
  173 + background-color: rgba(0, 174, 170, 0.25);
  174 + box-sizing: border-box;
  175 + font-family: '苹方 中等', '苹方', sans-serif;
  176 + color: #ffffff;
  177 + text-align: center;
  178 + }
  179 +
  180 + .SearchBtnCss {
  181 + width: 80px;
  182 + height: 44px;
  183 + border-radius: 4px;
  184 + background-color: #00aeaa;
  185 + box-sizing: border-box;
  186 + font-family: '苹方 中等', '苹方', sans-serif;
  187 + color: #ffffff;
  188 + text-align: center;
  189 + }
  190 +
  191 + .tipsCss {
  192 + margin: 16px 0 22px 0;
  193 + font-size: 16px;
  194 + color: #ffffff;
  195 + }
  196 +
  197 + .errorTipCss {
  198 + overflow: hidden;
  199 + display: flex;
  200 + align-items: flex-start;
  201 + margin-top: 16px;
  202 + font-size: 16px;
  203 + color: red;
  204 + }
  205 +
  206 + .errorImageCss {
  207 + margin-top: 4px !important;
  208 + }
  209 +
  210 + }
  211 +
  212 + //PC端样式
  213 + @media screen and (min-width: 768px) {
  214 +
  215 + .tipsCss {
  216 + margin: 16px 0 22px 0;
  217 + font-size: 16px;
  218 + color: #ffffff;
  219 + }
  220 +
  221 + .errorTipCss {
  222 + display: flex;
  223 + align-items: center;
  224 + overflow: hidden;
  225 + margin-top: 16px;
  226 + font-size: 16px;
  227 + color: red;
  228 + }
  229 +
  230 +
  231 + .inputCss {
  232 + width: 566px;
  233 + height: 44px;
  234 + }
  235 +
  236 + .btnSNscan {
  237 + width: 130px;
  238 + height: 44px;
  239 + margin: 20px 0 0 0;
  240 + padding: 2px;
  241 + display: flex;
  242 + justify-content: center;
  243 + align-items: center;
  244 + border-radius: 54px;
  245 + background-color: rgba(0, 174, 170, 0.25);
  246 + box-sizing: border-box;
  247 + font-family: '苹方 中等', '苹方', sans-serif;
  248 + color: #ffffff;
  249 + text-align: center;
  250 + }
  251 +
  252 + .SearchBtnCss {
  253 + width: 80px;
  254 + height: 44px;
  255 + border-radius: 4px;
  256 + background-color: #00aeaa;
  257 + box-sizing: border-box;
  258 + font-family: '苹方 中等', '苹方', sans-serif;
  259 + color: #ffffff;
  260 + text-align: center;
  261 + }
  262 + }
  263 +</style>
0 264 \ No newline at end of file
... ...
pages/product/index.vue 0 → 100644
... ... @@ -0,0 +1,332 @@
  1 +<template>
  2 + <view class="containers">
  3 + <topWindow :isHome="false" @item-click="handleItemClick"></topWindow>
  4 + <goback></goback>
  5 + <view class="ComponentsBody">
  6 + <view class="productInformation" v-if="current == 'productInformation'">
  7 + <InformationModule v-if="informationData != null" :informationData="informationData">
  8 + </InformationModule>
  9 + </view>
  10 + <view class="inspectionInformation" v-else-if="current == 'inspectionInformation'">
  11 + <InspectionModule v-if="inspectionData != null" :inspectionData="inspectionData"></InspectionModule>
  12 + </view>
  13 + <view class="attachmentInformation" v-else-if="current == 'attachmentInformation'">
  14 + <AuxiliaryModule v-if="auxiliaryData != null" :auxiliaryData="auxiliaryData"></AuxiliaryModule>
  15 + </view>
  16 + <view class="repairReportBtnCss" @click="jumpService">
  17 + <u-image src="/static/images/icon/repair.png" mode="witFix" :width="$isMobile?'100px':'200px'"
  18 + :height="$isMobile?'100px':'200px'"></u-image>
  19 + <text class="repairReportTextCss">{{$t("hdk.Repair")}}</text>
  20 + </view>
  21 + </view>
  22 +
  23 + </view>
  24 +</template>
  25 +
  26 +<script>
  27 + import config from '@/common/config.js'
  28 + import {
  29 + getProductFind
  30 + } from '@/api/scan'
  31 + import topWindow from "@/pages/component/topWindow.vue"
  32 + import goback from "@/pages/component/goback.vue"
  33 + import InformationModule from '@/pages/component/InformationModule.vue'
  34 + import InspectionModule from '@/pages/component/InspectionModule.vue'
  35 + import AuxiliaryModule from '@/pages/component/AuxiliaryModule.vue'
  36 + export default {
  37 + components: {
  38 + InformationModule,
  39 + InspectionModule,
  40 + AuxiliaryModule,
  41 + topWindow,
  42 + goback
  43 + },
  44 + data() {
  45 + return {
  46 + sn: "",
  47 + productObject: null,
  48 + informationData: null,
  49 + inspectionData: null,
  50 + auxiliaryData: null,
  51 + repairInformation: null,
  52 + current: "productInformation"
  53 + }
  54 + },
  55 + computed: {
  56 +
  57 + },
  58 + onLoad(data) {
  59 + console.log(data);
  60 + if (data) {
  61 + this.sn = data.sn;
  62 + }
  63 + this.initData()
  64 + },
  65 + methods: {
  66 + initData() {
  67 + // uni.showLoading({title: '查询中...'})
  68 + getProductFind(this.sn).then(res => {
  69 + uni.hideLoading()
  70 + if (res.code == 0) {
  71 + console.log("sn查询结果", res)
  72 + this.productObject = res.data
  73 + this.initializationMethod()
  74 + } else {
  75 + uni.showToast({
  76 + icon: 'error',
  77 + title: this.$t('hdk.networkError'),
  78 + })
  79 + }
  80 + })
  81 + },
  82 + initializationMethod() {
  83 + //重新组装产品信息数据
  84 + this.informationData = {
  85 + lamp: this.productObject.productRespVO?.lamp || null,
  86 + lampPath: this.productObject.productRespVO?.lampPath || [require('@/static/images/noPhoto.png')],
  87 + sn: this.productObject.sn,
  88 + productName: this.productObject.productRespVO?.productName || null,
  89 + type: this.productObject.productRespVO?.type || null,
  90 + productionTime: this.productObject.productionTime,
  91 + productionUserName: this.productObject.productionUserName,
  92 + productDatasheet: this.productObject.productRespVO?.productDatasheet || null,
  93 + productDatasheetPath: this.productObject.productRespVO?.productDatasheetPath || [],
  94 + productManual: this.productObject.productRespVO?.productManual || null,
  95 + productManualPath: this.productObject.productRespVO?.productManualPath || []
  96 + };
  97 + console.log("产品信息", this.informationData);
  98 +
  99 + this.repairInformation = {
  100 + sn: this.productObject.sn,
  101 + productName: this.productObject.productRespVO?.productName || null,
  102 + type: this.productObject.productRespVO?.type || null
  103 + }
  104 +
  105 + //重新组装检验信息数据
  106 + this.inspectionData = {
  107 + softwareVersion: this.productObject.softwareVersion,
  108 + hardwareVersion: this.productObject.hardwareVersion,
  109 + checkTime: this.productObject.checkTime,
  110 + type: this.productObject.productRespVO?.type || null,
  111 + power: this.productObject.power,
  112 + powerFactor: this.productObject.powerFactor,
  113 + tightnessCheckFile: this.productObject.tightnessCheckFile,
  114 + tightnessCheckFilePath: this.productObject.tightnessCheckFilePath,
  115 + lightIntensityPhoto: [],
  116 + lightIntensityFile: ''
  117 + };
  118 + console.log("检验信息", this.inspectionData);
  119 + //重新组装附件信息数据
  120 + this.auxiliaryData = this.productObject.attachmentRespVOList || [];
  121 +
  122 +
  123 + // console.log("重新组装检验信息", this.inspectionData);
  124 + if (this.productObject.attachmentRespVOList === null) {
  125 + this.auxiliaryData = [];
  126 + } else {
  127 + this.auxiliaryData = this.productObject.attachmentRespVOList.map(obj => ({
  128 + ...obj,
  129 + current: 0
  130 + }));
  131 + }
  132 + console.log("附件信息", this.auxiliaryData);
  133 + //产品数据转图片
  134 + if (this.productObject && this.productObject.productRespVO) {
  135 + const productRespVO = this.productObject.productRespVO;
  136 + // console.log("灯具", productRespVO);
  137 + // const modifiedManuals = this.generateDownloadUrls(productRespVO.lamp);
  138 + // this.informationData.lamp = modifiedManuals;
  139 + this.generateDownloadUrls(productRespVO.lampPath)
  140 + .then(modifiedManuals => {
  141 + // console.log("灯具==>", modifiedManuals);
  142 + this.informationData.lampPath = modifiedManuals;
  143 + })
  144 + .catch(error => {
  145 + console.error(error);
  146 + });
  147 + }
  148 + //光强数据转图片
  149 + if (this.productObject && this.productObject.lightIntensityPath) {
  150 + if (this.productObject.lightIntensityPath) {
  151 + this.generateDownloadUrls(this.productObject.lightIntensityPath)
  152 + .then(modifiedManuals => {
  153 + // console.log("光强==>", modifiedManuals);
  154 + this.inspectionData.lightIntensityPhoto = modifiedManuals.filter(url => this.isPicture(
  155 + url));
  156 + this.inspectionData.lightIntensityFile = modifiedManuals.filter(filename => !this
  157 + .isPicture(filename) && filename.includes('.'));
  158 + // 在这里可以访问已更新的inspectionData.lightIntensityPhoto和inspectionData.lightIntensityFile的值
  159 + })
  160 + .catch(error => {
  161 + console.error(error);
  162 + });
  163 + }
  164 + }
  165 + //附件信息转图片
  166 + if (this.auxiliaryData) {
  167 + this.auxiliaryData.forEach(attachment => {
  168 + if (attachment.productPicturePath) {
  169 + this.generateDownloadUrls(attachment.productPicturePath)
  170 + .then(modifiedPictures => {
  171 + // console.log("附件图片==>", modifiedPictures);
  172 + attachment.productPicturePath = modifiedPictures;
  173 + })
  174 + .catch(error => {
  175 + console.error(error);
  176 + });
  177 + }
  178 + });
  179 + }
  180 +
  181 + },
  182 + jumpService() {
  183 + console.log(this.repairInformation);
  184 + uni.navigateTo({
  185 + url: "/pages/product/repairReport?repairpObject=" + encodeURIComponent(JSON.stringify(
  186 + this.repairInformation)),
  187 + })
  188 + },
  189 + generateDownloadUrls(filenames) {
  190 + // console.log("filenames", filenames)
  191 + if (!filenames || filenames.length === 0) {
  192 + // 如果 filenames 为空或者null,则执行相应的操作
  193 + return Promise.resolve(require('@/static/images/noPhoto.png'))
  194 + }
  195 + const modifiedFilenames = filenames.replace(/;+$/, '');
  196 + const modifiedUrls = modifiedFilenames.split(";").map(filename => {
  197 + const trimmedFilename = filename.trim();
  198 + if (trimmedFilename.endsWith('.png') || trimmedFilename.endsWith('.jpg')) {
  199 + // const encodedFilename = Buffer.from(trimmedFilename, 'utf-8').toString('base64');
  200 + const url = config.fileUrl + `/${trimmedFilename}`;
  201 + // console.log(url);
  202 + return this.checkUrlValidity(url).catch(error => {
  203 + // console.error(error);
  204 + // console.log("请求失败", trimmedFilename)
  205 + return Promise.resolve(require('@/static/images/noPhoto.png'));
  206 + });
  207 + } else if (trimmedFilename.includes('.')) {
  208 + return Promise.resolve(trimmedFilename);
  209 + } else {
  210 + return Promise.resolve(require('@/static/images/noPhoto.png'));
  211 + }
  212 + });
  213 +
  214 + return Promise.all(modifiedUrls).then(results => {
  215 + const validUrls = results.filter(url => url !== null);
  216 + if (validUrls.length > 0) {
  217 + // console.log("有效地址",validUrls);
  218 + return validUrls;
  219 + } else {
  220 + return [require('@/static/images/noPhoto.png')];
  221 + }
  222 + });
  223 + },
  224 + checkUrlValidity(url) {
  225 + return new Promise((resolve, reject) => {
  226 + uni.request({
  227 + url,
  228 + method: 'HEAD',
  229 + success(res) {
  230 + // console.log("检验地址",res);
  231 + if (res.statusCode >= 200 && res.statusCode < 400) {
  232 + resolve(url); // URL有效
  233 + } else {
  234 + // console.log("地址无效");
  235 + resolve(null); // URL无效
  236 + }
  237 + },
  238 + fail(err) {
  239 + reject(err); // 请求失败
  240 + }
  241 + });
  242 + });
  243 + },
  244 + isPicture(str) {
  245 + // 正则表达式判断是否为网址类型的字符串
  246 + const pictureRegex = /\.(jpg|jpeg|png|gif)$/i;
  247 + return pictureRegex.test(str);
  248 + },
  249 + handleItemClick(item) {
  250 + this.current = item;
  251 + console.log('点击的菜单项:', item);
  252 + // 在此处处理被点击的菜单项
  253 + }
  254 + }
  255 + }
  256 +</script>
  257 +
  258 +<style lang="scss" scoped>
  259 + .containers {
  260 + width: 100%;
  261 + height: 100%;
  262 + background: #F9FAF9;
  263 + }
  264 +
  265 + .ComponentsBody {
  266 + // width:100%;
  267 + // display: flex;
  268 + // justify-content: center;
  269 + // align-items: center;
  270 + }
  271 +
  272 + // .productInformation{
  273 + // width: 100%;
  274 + // }
  275 +
  276 + // .inspectionInformation{
  277 + // width: 100%;
  278 + // }
  279 +
  280 + // .attachmentInformation{
  281 + // width: 100%;
  282 + // }
  283 +
  284 + @media screen and (max-width: 767px) {
  285 + .repairReportBtnCss {
  286 + width: 100px;
  287 + height: 100px;
  288 + border-radius: 100px;
  289 + position: fixed;
  290 + display: flex;
  291 + flex-direction: column;
  292 + justify-content: center;
  293 + align-items: center;
  294 + right: 0;
  295 + bottom: 100px;
  296 + // background-color: #00aeaa;
  297 + }
  298 +
  299 + .repairReportTextCss {
  300 + position: absolute;
  301 + bottom: 30px;
  302 + color: #fff;
  303 + font-size: 10px;
  304 + }
  305 + }
  306 +
  307 +
  308 +
  309 + // //PC端样式
  310 + @media screen and (min-width: 768px) {
  311 + .repairReportBtnCss {
  312 + width: 100px;
  313 + height: 100px;
  314 + border-radius: 100px;
  315 + position: fixed;
  316 + display: flex;
  317 + flex-direction: column;
  318 + justify-content: center;
  319 + align-items: center;
  320 + right: 20px;
  321 + bottom: 100px;
  322 + // background-color: #00aeaa;
  323 + }
  324 +
  325 + .repairReportTextCss {
  326 + position: absolute;
  327 + bottom: 15px;
  328 + color: #fff;
  329 + }
  330 +
  331 + }
  332 +</style>
0 333 \ No newline at end of file
... ...
pages/product/invalidCode.vue 0 → 100644
... ... @@ -0,0 +1,147 @@
  1 +<template>
  2 + <view class="containers">
  3 + <topWindow></topWindow>
  4 + <view class="invalidPhoto">
  5 + <u-image src="/static/images/icon/invalidPhoto.png" width="400rpx" height="400rpx"></u-image>
  6 + </view>
  7 + <view class="flex-column">
  8 + <view class="snCodeText">{{$t('hdk.QRCodeContent')}}:{{snCode}}</view>
  9 + <!-- <view class="firstLine">
  10 + 当前SN码不存在
  11 + </view>
  12 + <view class="secondLine">
  13 + 请扫描正确的二维码
  14 + </view> -->
  15 + <view class="errorBar">
  16 + <view class="errorIcon">
  17 + <u-image width="44rpx" height="44rpx" src="/static/images/icon/warning.png"></u-image>
  18 + </view>
  19 + <view class="errorText">
  20 + {{isSNCode(snCode)?error1:error2}}
  21 + </view>
  22 + </view>
  23 + </view>
  24 + <view class="rescan" @click="rescan">
  25 + {{$t('hdk.Rescan')}}
  26 + </view>
  27 + </view>
  28 +</template>
  29 +
  30 +<script>
  31 + import topWindow from "@/pages/component/topWindow.vue"
  32 + export default {
  33 + components: {
  34 + topWindow
  35 + },
  36 + props: {
  37 +
  38 + },
  39 + data() {
  40 + return {
  41 + snCode: "",
  42 + error1: this.$t('hdk.ErrorPrompt1'),
  43 + error2: this.$t('hdk.ErrorPrompt2')
  44 + }
  45 + },
  46 + computed: {
  47 +
  48 + },
  49 + onLoad(data) {
  50 + console.log("无效参数", data);
  51 + this.snCode = data.snCode;
  52 + },
  53 + methods: {
  54 + rescan() {
  55 + uni.redirectTo({
  56 + url: '/pages/product/scan'
  57 + })
  58 + },
  59 + // 判断字符串是否为SN码格式
  60 + isSNCode(str) {
  61 + // SN码的正则表达式
  62 + const snRegex = /^[a-zA-Z0-9]+$/;
  63 + return snRegex.test(str);
  64 + },
  65 + // 判断字符串是否为其他非SN码格式
  66 + isNonSNCode(str) {
  67 + // 非SN码的正则表达式
  68 + const nonSNRegex = /^[A-Za-z0-9]{6,}$/;
  69 + return nonSNRegex.test(str);
  70 + }
  71 + }
  72 + }
  73 +</script>
  74 +
  75 +<style lang="scss" scoped>
  76 + .containers {
  77 + width: 100vw;
  78 + height: 100vh;
  79 + display: flex;
  80 + flex-direction: column;
  81 + align-items: center;
  82 +
  83 + .invalidPhoto {
  84 + margin: 80rpx 0 0 0;
  85 + }
  86 +
  87 + .flex-column {
  88 + display: flex;
  89 + flex-direction: column;
  90 + justify-content: center;
  91 + align-items: center;
  92 + text-align: center;
  93 + font-size: 28rpx;
  94 +
  95 + .snCodeText {
  96 + margin: 20px 0 44px 0;
  97 + color: #333333;
  98 + }
  99 +
  100 + .firstLine {
  101 + margin: 20px 0;
  102 + color: #333333;
  103 + }
  104 +
  105 + .secondLine {
  106 + margin: 20px 0;
  107 + color: #333333;
  108 + }
  109 + }
  110 +
  111 + .errorBar {
  112 + width: 702px;
  113 + height: 88px;
  114 + padding: 2px;
  115 + border-radius: 4px;
  116 + background-color: #fef1f1;
  117 + box-sizing: border-box;
  118 + display: flex;
  119 + align-items: center;
  120 + justify-content: flex-start;
  121 +
  122 + .errorIcon {
  123 + margin: 22px 20px;
  124 + }
  125 +
  126 + .errorText {
  127 + font-size: 28rpx;
  128 + color: #6d727a;
  129 + }
  130 + }
  131 +
  132 +
  133 + .rescan {
  134 + width: 690px;
  135 + height: 88px;
  136 + margin: 50px 0 0 0;
  137 + padding: 2px;
  138 + background-color: #00aeaa;
  139 + box-sizing: border-box;
  140 + font-family: '苹方 中等', '苹方', sans-serif;
  141 + color: #ffffff;
  142 + text-align: center;
  143 + line-height: 88px;
  144 + font-size: 32px;
  145 + }
  146 + }
  147 +</style>
0 148 \ No newline at end of file
... ...
pages/product/repairReport.vue 0 → 100644
... ... @@ -0,0 +1,467 @@
  1 +<template>
  2 + <view class="containers">
  3 + <topWindow></topWindow>
  4 + <goback></goback>
  5 + <view class="content">
  6 + <u-form labelPosition="top" labelAlign="left" :model="modal" :rules="rules" ref="uForm"
  7 + :labelStyle="{fonSize:'26px',color:'#8B91A4',paddingLeft:'10px'}">
  8 + <view class="basicInformation">
  9 + <view class="title">{{$t('hdk.Basicinformation')}}<text
  10 + style="color:#8B91A4;">{{$t('hdk.Required')}}</text></view>
  11 + <view class="uform">
  12 + <u-form-item required :label="$t('hdk.SnCode')" labelWidth="50%" prop="formInfo.sn" borderBottom
  13 + ref="item1">
  14 + <u-input v-model="modal.formInfo.sn" maxlength="10" border="none"></u-input>
  15 + </u-form-item>
  16 + <u-form-item required :label="$t('hdk.ProductName')" labelWidth="50%"
  17 + prop="formInfo.productName" borderBottom ref="item2">
  18 + <u-input v-model="modal.formInfo.productName" maxlength="20" border="none"></u-input>
  19 + </u-form-item>
  20 + <u-form-item :label="$t('hdk.Model')" labelWidth="50%" prop="formInfo.type" borderBottom
  21 + ref="item3">
  22 + <u-input v-model="modal.formInfo.type" maxlength="20" border="none"></u-input>
  23 + </u-form-item>
  24 + </view>
  25 + </view>
  26 + <view class="basicInformation">
  27 + <view class="title">{{$t('hdk.ProblemDescription')}}<text
  28 + style="color:#8B91A4;">{{$t('hdk.Required')}}</text></view>
  29 + <view class="textAreaCss">
  30 + <u-textarea :placeholderStyle="!$isMobile?'font-size:18px':''" v-model="modal.formInfo.repairDescribe" count maxlength="200"
  31 + :placeholder="$t('hdk.DescriptionPlaceholder')"></u-textarea>
  32 + </view>
  33 + <view class="uploadCss">
  34 + <u-upload upload-icon="plus" :fileList="fileList" @afterRead="afterRead"
  35 + @delete="deletePic" :previewFullImage="true" name="faultPicture" multiple :maxCount="5"
  36 + accept="image"></u-upload>
  37 + </view>
  38 + </view>
  39 + <view class="basicInformation">
  40 + <view class="title">{{$t('hdk.ContactInformation')}}<text
  41 + style="color:#8B91A4;">{{$t('hdk.Required')}}</text></view>
  42 + <view class="uform">
  43 + <u-form-item required :label="$t('hdk.AirportName')" labelWidth="50%"
  44 + prop="formInfo.airportName" borderBottom ref="item3">
  45 + <u-input v-model="modal.formInfo.airportName" maxlength="20" border="none"></u-input>
  46 + </u-form-item>
  47 + <u-form-item required :label="$t('hdk.Name')" labelWidth="50%" prop="formInfo.contactPersonName"
  48 + borderBottom ref="item4">
  49 + <u-input v-model="modal.formInfo.contactPersonName" maxlength="10" border="none"></u-input>
  50 + </u-form-item>
  51 + <u-form-item :label="$t('hdk.ContactInformation')" labelWidth="50%" prop="formInfo.phone"
  52 + borderBottom ref="item5">
  53 + <u-input v-model="modal.formInfo.contactPersonPhone" maxlength="20" border="none"></u-input>
  54 + </u-form-item>
  55 + <u-form-item required :label="$t('hdk.Email')" labelWidth="50%" prop="formInfo.email"
  56 + borderBottom ref="item6">
  57 + <u-input v-model="modal.formInfo.email" maxlength="20" border="none"></u-input>
  58 + </u-form-item>
  59 + <u-form-item :label="$t('hdk.DetailedAddress')" labelWidth="100%" prop="formInfo.address"
  60 + borderBottom ref="item7">
  61 + <u-input v-model="modal.formInfo.address" maxlength="30" border="none"></u-input>
  62 + </u-form-item>
  63 + </view>
  64 + </view>
  65 + </u-form>
  66 + <view class="submitBtn" @click="openModal()">
  67 + {{$t('hdk.ConfirmAndReport')}}
  68 + </view>
  69 + <u-modal :show="confirmModal" :title="title" :confirmText="$t('hdk.Confirm')" :cancelText="$t('hdk.Cancel')" showCancelButton @confirm="submit()"
  70 + @cancel="confirmModal = false">
  71 + <view class="slot-content">
  72 + <rich-text class="contentTextCss" :nodes="content"></rich-text>
  73 + </view>
  74 + </u-modal>
  75 + <u-toast ref="uToast"></u-toast>
  76 + </view>
  77 + </view>
  78 +</template>
  79 +
  80 +<script>
  81 + import topWindow from "@/pages/component/topWindow.vue"
  82 + import goback from "@/pages/component/goback.vue"
  83 + import {
  84 + createAFaultReport
  85 + } from "@/api/scan.js"
  86 + import config from '@/common/config'
  87 + export default {
  88 + components: {
  89 + topWindow,
  90 + goback
  91 + },
  92 + props: {
  93 +
  94 + },
  95 + data() {
  96 + return {
  97 + modal: {
  98 + formInfo: {
  99 + sn: "",
  100 + productName: "",
  101 + type: "",
  102 + repairDescribe: "",
  103 + picPath: "",
  104 + airportName: "",
  105 + contactPersonName: "",
  106 + contactPersonPhone: "",
  107 + email: "",
  108 + address: "",
  109 + },
  110 + },
  111 + fileList: [],
  112 + confirmModal: false,
  113 + title: "",
  114 + content: "",
  115 + rules: {
  116 + 'formInfo.sn': {
  117 + type: 'string',
  118 + required: true,
  119 + message: this.$t('hdk.FillSNCode'),
  120 + trigger: ['blur', 'change']
  121 + },
  122 + 'formInfo.productName': {
  123 + type: 'string',
  124 + required: true,
  125 + message: this.$t('hdk.FillProductName'),
  126 + trigger: ['blur', 'change']
  127 + },
  128 + 'formInfo.contactPersonName': {
  129 + type: 'string',
  130 + required: true,
  131 + message: this.$t('hdk.FillName'),
  132 + trigger: ['blur', 'change']
  133 + },
  134 + 'formInfo.email': {
  135 + type: 'email',
  136 + required: true,
  137 + message: this.$t('hdk.FillEmail'),
  138 + trigger: ['blur', 'change']
  139 + },
  140 + 'formInfo.repairDescribe': {
  141 + type: 'string',
  142 + required: true,
  143 + message: this.$t('hdk.FillDescription'),
  144 + trigger: ['blur', 'change']
  145 + },
  146 + 'formInfo.airportName': {
  147 + type: 'string',
  148 + required: true,
  149 + message: this.$t('hdk.FillAirportName'),
  150 + trigger: ['blur', 'change']
  151 + },
  152 + },
  153 + }
  154 + },
  155 + computed: {
  156 +
  157 + },
  158 + onReady() {},
  159 + onLoad(data) {
  160 + if (data.repairpObject) {
  161 + const repairpObject = JSON.parse(decodeURIComponent(data.repairpObject))
  162 + console.log(repairpObject);
  163 + this.modal.formInfo = {
  164 + ...this.modal.formInfo,
  165 + ...repairpObject
  166 + };
  167 + console.log(this.modal.formInfo);
  168 + }
  169 + },
  170 + methods: {
  171 + deletePic(event) {
  172 + this.fileList.splice(event.index, 1)
  173 + },
  174 + async afterRead(event) {
  175 + console.log(event);
  176 + let that = this;
  177 + let lists = [].concat(event.file)
  178 + let fileListLen = that.fileList.length
  179 + lists.map((item) => {
  180 + that.fileList.push({
  181 + ...item,
  182 + status: 'uploading',
  183 + message: that.$t('hdk.Uploading')
  184 + })
  185 + })
  186 + for (let i = 0; i < lists.length; i++) {
  187 + const result = await that.uploadFilePromise(lists[i].url)
  188 + let item = that.fileList[fileListLen]
  189 + that.fileList.splice(fileListLen, 1, Object.assign(item, {
  190 + status: 'success',
  191 + message: '',
  192 + realUrl: result,
  193 + url: config.prefixUrl + result
  194 + }))
  195 + console.log(that.fileList);
  196 + fileListLen++
  197 + }
  198 + },
  199 + uploadFilePromise(url) {
  200 + console.log(url);
  201 + const filename = url.substring(url.indexOf('tmp/') + 4);
  202 + // return;
  203 + return new Promise((resolve, reject) => {
  204 + let a = uni.uploadFile({
  205 + url: config.baseUrl + '/upload-file',
  206 + header: {
  207 + 'tenant-id': '1',
  208 + // 'Content-Type': 'multipart/form-data;'
  209 + },
  210 + filePath: url,
  211 + name: "file",
  212 +
  213 + success: (res) => {
  214 + console.log(res);
  215 + let data = JSON.parse(res.data);
  216 + console.log(data);
  217 + if (data.code === 0) {
  218 + setTimeout(() => {
  219 + resolve(data.data)
  220 + }, 500)
  221 + } else {
  222 + reject("")
  223 + }
  224 + }
  225 + });
  226 + })
  227 + },
  228 + openModal() {
  229 + this.$refs.uForm.validate().then(res => {
  230 + this.title = this.$t('hdk.Reminder');
  231 + this.content = this.$t('hdk.PromptContent');
  232 + this.confirmModal = true
  233 + })
  234 + },
  235 + submit() {
  236 + console.log(this.modal.formInfo);
  237 + this.$refs.uForm.validate().then(res => {
  238 + let ohterValidate = this.checkOtherItems()
  239 + if (ohterValidate) {
  240 + createAFaultReport(this.modal.formInfo).then(res => {
  241 + console.log(res);
  242 + if (res.code === 0) {
  243 + this.$refs.uToast.show({
  244 + type: 'success',
  245 + message: this.$t('hdk.SuccessfullyReported'),
  246 + iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
  247 + complete() {
  248 + uni.navigateBack(1)
  249 + }
  250 + })
  251 + } else if (res.code === 1400001001) {
  252 + this.$refs.uToast.show({
  253 + type: 'error',
  254 + icon: false,
  255 + message: this.$t('hdk.CheckSN'),
  256 + iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  257 + })
  258 + }
  259 + })
  260 + } else {
  261 + this.$refs.uToast.show({
  262 + type: 'error',
  263 + icon: false,
  264 + message: this.$t('hdk.FillDescription'),
  265 + iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  266 + })
  267 + }
  268 + }).catch(errors => {
  269 + this.$refs.uToast.show({
  270 + type: 'error',
  271 + icon: false,
  272 + message: this.$t('hdk.CheckForUnfilledItems'),
  273 + iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  274 + })
  275 + console.log(errors);
  276 + })
  277 + this.confirmModal = false;
  278 + },
  279 + checkOtherItems() {
  280 + let data = this.modal.formInfo;
  281 + if (data.repairDescribe === "" && this.fileList.length <= 0) {
  282 + // uni.$u.toast('描述或图片未上传');
  283 + return false;
  284 + }
  285 + data.picPath = JSON.stringify(this.fileList.map(it => `${it.realUrl}`));
  286 + // delete data.fileList;
  287 + console.log(data.picPath);
  288 + return true;
  289 + }
  290 + }
  291 + }
  292 +</script>
  293 +
  294 +<style lang="scss" scoped>
  295 + .containers {
  296 + display: flex;
  297 + flex-direction: column;
  298 + justify-content: center;
  299 + align-items: center;
  300 + background: #F2F4F3;
  301 + }
  302 +
  303 + /deep/.uni-input-input{
  304 + padding-left: 10px
  305 + }
  306 +
  307 + .uform {
  308 + margin: 20px;
  309 + position:relative;
  310 + }
  311 +
  312 + .textAreaCss {
  313 + margin: 30px;
  314 + background-color: #f8f9fd;
  315 + }
  316 +
  317 + .uploadCss {
  318 + margin: 30px;
  319 + }
  320 +
  321 + /deep/.u-modal__title {
  322 + display: flex;
  323 + justify-content: center;
  324 + }
  325 +
  326 +
  327 +
  328 + //移动端样式
  329 + @media screen and (max-width: 767px) {
  330 + .title {
  331 + min-width: 114px;
  332 + margin: 20px 0 0 15px;
  333 + font-size: 15px;
  334 + background-color: rgba(255, 255, 255, 0);
  335 + box-sizing: border-box;
  336 + font-family: '苹方 中等', '苹方', sans-serif;
  337 + color: #333333;
  338 + text-align: left;
  339 + }
  340 + .content{
  341 + width: 100%;
  342 + }
  343 +
  344 + .basicInformation {
  345 + width: 95%;
  346 + height: auto;
  347 + padding: 2px;
  348 + border-radius: 10px;
  349 + background-color: #ffffff;
  350 + box-sizing: border-box;
  351 + margin: 10px 12px;
  352 + padding-bottom: 80px;
  353 + }
  354 +
  355 + .submitBtn {
  356 + width: 350px;
  357 + height: 40px;
  358 + padding: 2px;
  359 + margin: 24px;
  360 + position: fixed;
  361 + bottom: 0px;
  362 + display: flex;
  363 + justify-content: center;
  364 + align-items: center;
  365 + border-radius: 8px;
  366 + background-color: #00aeaa;
  367 + box-sizing: border-box;
  368 + font-family: '苹方 中等', '苹方', sans-serif;
  369 + color: #ffffff;
  370 + text-align: center;
  371 + line-height: normal;
  372 + z-index: 999;
  373 + }
  374 +
  375 + .contentTextCss {
  376 + font-size: 14px;
  377 + color: #999999;
  378 + }
  379 + }
  380 +
  381 + //PC端样式
  382 + @media screen and (min-width: 768px) {
  383 + .title {
  384 + min-width: 228px;
  385 + margin: 40px 0 0 30px;
  386 + font-size: 30px;
  387 + background-color: rgba(255, 255, 255, 0);
  388 + box-sizing: border-box;
  389 + font-family: '苹方 中等', '苹方', sans-serif;
  390 + color: #333333;
  391 + text-align: left;
  392 + }
  393 +
  394 + .contentTextCss {
  395 + font-size: 20px;
  396 + color: #999999;
  397 + }
  398 +
  399 + .content{
  400 + width: 80%;
  401 + position: relative;
  402 + }
  403 +
  404 + /deep/.u-modal{
  405 + width: 500px !important;
  406 + }
  407 +
  408 + /deep/.u-modal__title{
  409 + height: 80px;
  410 + font-size: 24px
  411 + }
  412 +
  413 + /deep/.u-modal__content{
  414 + height: 80px;
  415 + }
  416 +
  417 + /deep/.uni-textarea-textarea{
  418 + font-size: 18px;
  419 + }
  420 +
  421 + /deep/.uni-input-input{
  422 + font-size: 20px !important;
  423 + }
  424 +
  425 + /deep/.u-form-item__body__right__message{
  426 + font-size: 18px;
  427 + }
  428 +
  429 + /deep/.u-form-item__body__left__content__label {
  430 + font-size: 22px;
  431 + }
  432 +
  433 + .basicInformation {
  434 + width: 100%;
  435 + height: auto;
  436 + padding: 2px;
  437 + border-radius: 20px;
  438 + background-color: #ffffff;
  439 + box-sizing: border-box;
  440 + margin: 20px 24px;
  441 + padding-bottom: 40px;
  442 + }
  443 +
  444 + .submitBtn {
  445 + width: 500px;
  446 + height: 39px;
  447 + padding: 2px;
  448 + position: fixed;
  449 + left: 0;right: 0;
  450 + bottom: 30px;
  451 + margin: 0 auto;
  452 + display: flex;
  453 + justify-content: center;
  454 + align-items: center;
  455 + border-radius: 4px;
  456 + background-color: #00aeaa;
  457 + box-sizing: border-box;
  458 + font-family: '苹方 中等', '苹方', sans-serif;
  459 + color: #ffffff;
  460 + text-align: center;
  461 + line-height: normal;
  462 + z-index: 999;
  463 + }
  464 + }
  465 +
  466 +
  467 +</style>
0 468 \ No newline at end of file
... ...
pages/product/scan.vue 0 → 100644
... ... @@ -0,0 +1,89 @@
  1 +<template>
  2 + <view class="containers">
  3 + <topWindow></topWindow>
  4 + <QrScan ref="qrcode" @ok="getResult" @err="geterror" v-if="open" />
  5 + </view>
  6 +</template>
  7 +
  8 +<script>
  9 + import topWindow from "@/pages/component/topWindow.vue"
  10 + import QrScan from "@/pages/component/QrScan.vue"
  11 + import config from '@/common/config.js'
  12 + import {
  13 + getProductFind
  14 + } from '@/api/scan'
  15 + var browser = { // 判断浏览器内核
  16 + versions: (function() {
  17 + var u = navigator.userAgent;
  18 + return {
  19 + trident: u.indexOf('Trident') > -1, //IE内核
  20 + presto: u.indexOf('Presto') > -1, //opera内核
  21 + webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
  22 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
  23 + weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
  24 + };
  25 + })(),
  26 + };
  27 + export default {
  28 + components: {
  29 + QrScan,
  30 + topWindow
  31 + },
  32 + props: {
  33 +
  34 + },
  35 + data() {
  36 + return {
  37 + open: false
  38 + }
  39 + },
  40 + computed: {
  41 +
  42 + },
  43 + mounted() {
  44 + if (browser.versions.webKit || browser.versions.weixin || browser.versions.gecko) {
  45 + this.open = true;
  46 + } else {
  47 + Toast('Browser not supported');
  48 + }
  49 + },
  50 + onLoad() {
  51 +
  52 + },
  53 + methods: {
  54 + getResult(sn) {
  55 + console.log(sn);
  56 + this.open = false;
  57 + const regex = /sn=([^&]+)/;
  58 + const match = regex.exec(sn);
  59 + const sncode = match ? match[1] : sn;
  60 + // let sncode = sn.substring(sn.lastIndexOf(":") + 1);
  61 + getProductFind(sncode).then(res => {
  62 + console.log(res);
  63 + if (res.code === 1400001001) {
  64 + uni.navigateTo({
  65 + url: '/pages/product/invalidCode?snCode='+sncode,
  66 + success() {
  67 + this.open = true
  68 + }
  69 + });
  70 + } else {
  71 + uni.navigateTo({
  72 + url: "/pages/product/index?sn=" + sncode
  73 + })
  74 + }
  75 + })
  76 +
  77 + },
  78 + geterror(e) {
  79 + console.log(e);
  80 + },
  81 + }
  82 + }
  83 +</script>
  84 +
  85 +<style lang="scss" scoped>
  86 + .containers {
  87 + width: 100vw;
  88 + }
  89 +</style>
0 90 \ No newline at end of file
... ...
postcss.config.js
... ... @@ -9,7 +9,7 @@ module.exports = {
9 9 fontViewportUnit: 'px', // 字体使用的视口单位
10 10 // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位。
11 11 // 下面配置表示类名中含有'keep-px'都不会被转换
12   - selectorBlackList: ['keep-px','u-modal','u-form-item'],
  12 + selectorBlackList: ['keep-px','u-modal','u-form-item','u-upload',"uni-input"],
13 13 minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
14 14 mediaQuery: false, // 媒体查询里的单位是否需要转换单位
15 15 replace: true, // 是否直接更换属性值,而不添加备用属性
... ...