Commit da7858714321fbb9a777c5b54375d3c65c952db2
1 parent
15769f10
Exists in
develop
fix: 样式修改 删除mobile文件夹 支持新老二维码 扫码枪覆盖
Showing
21 changed files
with
138 additions
and
2493 deletions
Show diff stats
mobile/pages/api/api.vue
... | ... | @@ -1,27 +0,0 @@ |
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> |
mobile/pages/component/AuxiliaryModule.vue
... | ... | @@ -1,145 +0,0 @@ |
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> | |
146 | 0 | \ No newline at end of file |
mobile/pages/component/InformationModule.vue
... | ... | @@ -1,196 +0,0 @@ |
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> | |
197 | 0 | \ No newline at end of file |
mobile/pages/component/InspectionModule.vue
... | ... | @@ -1,224 +0,0 @@ |
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> | |
225 | 0 | \ No newline at end of file |
mobile/pages/component/QrScan.vue
... | ... | @@ -1,100 +0,0 @@ |
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> | |
101 | 0 | \ No newline at end of file |
mobile/pages/component/UploadFile.vue
... | ... | @@ -1,207 +0,0 @@ |
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 | - }, | |
46 | - computed: { | |
47 | - | |
48 | - }, | |
49 | - onLoad() { | |
50 | - uni.showShareMenu({ | |
51 | - withShareTicket: true, | |
52 | - menus: ['shareAppMessage'], | |
53 | - success: function() { | |
54 | - console.log('分享菜单显示成功'); | |
55 | - }, | |
56 | - fail: function(res) { | |
57 | - console.log('分享菜单显示失败', res); | |
58 | - } | |
59 | - }); | |
60 | - }, | |
61 | - methods: { | |
62 | - seeFile(acceptType) { | |
63 | - console.log(acceptType); | |
64 | - // if (this.isCsv) { | |
65 | - // return | |
66 | - // } | |
67 | - console.log('查看文件'); | |
68 | - uni.showLoading({ | |
69 | - title: "加载中" | |
70 | - }) | |
71 | - let that = this; | |
72 | - | |
73 | - if (!this.isCsv) { | |
74 | - const count = (this.downloadFileNamePath.match(/;/g) || []).length; | |
75 | - console.log(this.downloadFileNamePath, "解析文件有", count, "个") | |
76 | - if (count > 1) { | |
77 | - uni.showToast({ | |
78 | - icon: 'none', | |
79 | - title: '导入格式有误' | |
80 | - }); | |
81 | - return | |
82 | - } | |
83 | - } | |
84 | - //去除分号分割符 | |
85 | - let downloadName = that.downloadFileNamePath.replace(/;/g, ""); | |
86 | - console.log("下载名", downloadName); | |
87 | - // let query = `/download?bucketName=hdk&file=${downloadName}` | |
88 | - // console.log("query", config.baseUrl + query) | |
89 | - const parts = downloadName.split("."); | |
90 | - // 取数组最后一个元素作为后缀名 | |
91 | - let fileType = parts[parts.length - 1]; | |
92 | - console.log("后缀", fileType); | |
93 | - let environment = uni.getSystemInfoSync().platform | |
94 | - console.log("当前环境", environment); | |
95 | - const urls = config.fileUrl + `/${encodeURI(downloadName)}` | |
96 | - let fileName = downloadName.substring(downloadName.lastIndexOf('/') + 1); | |
97 | - this.checkUrlValidity(urls).then(isExistence => { | |
98 | - if (isExistence) { | |
99 | - uni.hideLoading() | |
100 | - window.open(urls, '_blank'); | |
101 | - } else { | |
102 | - uni.hideLoading() | |
103 | - uni.showToast({ | |
104 | - icon: 'none', | |
105 | - title: '文件未上传!' | |
106 | - }); | |
107 | - } | |
108 | - }) | |
109 | - }, | |
110 | - //检查是否有效 | |
111 | - checkUrlValidity(url) { | |
112 | - return new Promise((resolve, reject) => { | |
113 | - uni.request({ | |
114 | - url, | |
115 | - header: { | |
116 | - 'tenant-id': 1, | |
117 | - }, | |
118 | - method: 'HEAD', | |
119 | - success(res) { | |
120 | - console.log("检验地址", res); | |
121 | - if (res.statusCode >= 200 && res.statusCode < 400) { | |
122 | - resolve(true); // URL有效 | |
123 | - } else { | |
124 | - console.log("地址无效"); | |
125 | - resolve(false); // URL无效 | |
126 | - } | |
127 | - }, | |
128 | - fail(err) { | |
129 | - reject(err); // 请求失败 | |
130 | - } | |
131 | - }); | |
132 | - }); | |
133 | - }, | |
134 | - } | |
135 | - } | |
136 | -</script> | |
137 | - | |
138 | -<style lang="scss" scoped> | |
139 | - @media screen and (max-width: 767px) { | |
140 | - .iconTitle { | |
141 | - width: 200px; | |
142 | - font-size: 13px; | |
143 | - margin-left: 8px; | |
144 | - white-space: nowrap; | |
145 | - /* 防止换行 */ | |
146 | - overflow: hidden; | |
147 | - /* 超出部分隐藏 */ | |
148 | - text-overflow: ellipsis; | |
149 | - /* 显示省略号 */ | |
150 | - } | |
151 | - .rightText { | |
152 | - padding: 5px; | |
153 | - color: #00aeaa; | |
154 | - font-size: 14px; | |
155 | - } | |
156 | - | |
157 | - .flex-content { | |
158 | - display: flex; | |
159 | - justify-content: space-between; | |
160 | - font-size: 26px; | |
161 | - align-items: center; | |
162 | - margin: 30px; | |
163 | - | |
164 | - .iconText { | |
165 | - display: flex; | |
166 | - align-items: center; | |
167 | - height: 50px; | |
168 | - color: #2b3950; | |
169 | - } | |
170 | - } | |
171 | - } | |
172 | - | |
173 | - //PC端样式 | |
174 | - @media screen and (min-width: 768px) { | |
175 | - .iconTitle { | |
176 | - width: 400px; | |
177 | - font-size: 26px; | |
178 | - margin-left: 16px; | |
179 | - white-space: nowrap; | |
180 | - /* 防止换行 */ | |
181 | - overflow: hidden; | |
182 | - /* 超出部分隐藏 */ | |
183 | - text-overflow: ellipsis; | |
184 | - /* 显示省略号 */ | |
185 | - } | |
186 | - .rightText { | |
187 | - padding: 10px; | |
188 | - color: #00aeaa; | |
189 | - font-size: 28px; | |
190 | - } | |
191 | - | |
192 | - .flex-content { | |
193 | - display: flex; | |
194 | - justify-content: space-between; | |
195 | - font-size: 26px; | |
196 | - align-items: center; | |
197 | - margin: 30px; | |
198 | - | |
199 | - .iconText { | |
200 | - display: flex; | |
201 | - align-items: center; | |
202 | - height: 50px; | |
203 | - color: #2b3950; | |
204 | - } | |
205 | - } | |
206 | - } | |
207 | -</style> | |
208 | 0 | \ No newline at end of file |
mobile/pages/component/component.vue
... | ... | @@ -1,22 +0,0 @@ |
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> |
mobile/pages/component/goback.vue
... | ... | @@ -1,46 +0,0 @@ |
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 | - window.history.back(); | |
27 | - } | |
28 | - } | |
29 | - } | |
30 | -</script> | |
31 | - | |
32 | -<style lang="scss" scoped> | |
33 | - .back { | |
34 | - width: 50px; | |
35 | - height: 50px; | |
36 | - border-radius: 50px; | |
37 | - position: fixed; | |
38 | - display: flex; | |
39 | - flex-direction: column; | |
40 | - justify-content: center; | |
41 | - align-items: center; | |
42 | - left:1%; | |
43 | - top: 10%; | |
44 | - bottom: 0; | |
45 | - } | |
46 | -</style> | |
47 | 0 | \ No newline at end of file |
mobile/pages/component/topWindow.vue
... | ... | @@ -1,160 +0,0 @@ |
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 = uni.getLocale(); | |
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> |
mobile/pages/homePage/index.vue
... | ... | @@ -1,265 +0,0 @@ |
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 ref="inputField" class="inputCss" autofocus="autofocus" :placeholder="$t('hdk.placeholder')" | |
9 | - @change="handleChange" v-model="SNcode"></b-input> | |
10 | - <!-- <input type="text"> --> | |
11 | - <b-button class="SearchBtnCss my-2 my-sm-0" size="sm" @click="search" | |
12 | - style="background:#00AEAA;">{{$t('hdk.search')}}</b-button> | |
13 | - </view> | |
14 | - <view class="errorTipCss" v-if="isError"> | |
15 | - <image class="errorImageCss" src="/static/images/icon/warning.png" 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 | - import { | |
28 | - getProductFind | |
29 | - } from '@/api/scan' | |
30 | - import topWindow from "@/pages/component/topWindow.vue" | |
31 | - export default { | |
32 | - data() { | |
33 | - return { | |
34 | - systemLocale: '', | |
35 | - applicationLocale: '', | |
36 | - isError: false, | |
37 | - SNcode: "", | |
38 | - open: false, | |
39 | - lastTimeLen: null | |
40 | - } | |
41 | - }, | |
42 | - components: { | |
43 | - topWindow, | |
44 | - }, | |
45 | - computed: { | |
46 | - locales() { | |
47 | - return [{ | |
48 | - text: this.$t('locale.en'), | |
49 | - code: 'en' | |
50 | - }, | |
51 | - { | |
52 | - text: this.$t('locale.zh-hans'), | |
53 | - code: 'zh-Hans' | |
54 | - }, | |
55 | - ] | |
56 | - } | |
57 | - }, | |
58 | - mounted() { | |
59 | - // const inputElement = this.$refs.inputField.$el.querySelector('input'); | |
60 | - document.addEventListener('keydown', this.handleKeyDown); | |
61 | - }, | |
62 | - onLoad() { | |
63 | - let systemInfo = uni.getSystemInfoSync(); | |
64 | - this.systemLocale = systemInfo.language; | |
65 | - this.applicationLocale = uni.getLocale(); | |
66 | - this.isAndroid = systemInfo.platform.toLowerCase() === 'android'; | |
67 | - }, | |
68 | - methods: { | |
69 | - getFirstSnFromUrl(url) { | |
70 | - const regex = /sn=([^&]+)/; | |
71 | - const match = url.match(regex); | |
72 | - if (match && match.length > 1) { | |
73 | - const sn = match[1]; | |
74 | - return sn; | |
75 | - } | |
76 | - return url; | |
77 | - }, | |
78 | - handleChange(event) { | |
79 | - this.isError = false; | |
80 | - this.SNcode = this.getFirstSnFromUrl(event); | |
81 | - // if (sncode) { | |
82 | - // this.SNcode = sncode; | |
83 | - // this.lastTimeLen = eventLen; // 重置 lastTimeLen | |
84 | - // } else { | |
85 | - // if (eventLen > this.lastTimeLen) { | |
86 | - // this.SNcode = event.slice(this.lastTimeLen, eventLen); | |
87 | - // this.lastTimeLen = eventLen; | |
88 | - // } | |
89 | - // } | |
90 | - }, | |
91 | - handleBarcodeInput(event) { | |
92 | - // 捕获扫码枪输入的内容 | |
93 | - console.log(event); | |
94 | - const barcodeContent = event.target.value; | |
95 | - console.log(barcodeContent); | |
96 | - if (key === 'Enter') { | |
97 | - console.log(event); | |
98 | - } | |
99 | - | |
100 | - }, | |
101 | - search() { | |
102 | - console.log("查询"); | |
103 | - if (this.SNcode === "") { | |
104 | - return | |
105 | - } | |
106 | - uni.showLoading({ | |
107 | - title: '查询中...' | |
108 | - }) | |
109 | - getProductFind(this.SNcode).then(res => { | |
110 | - uni.hideLoading() | |
111 | - if (res.code == 0) { | |
112 | - console.log("sn查询结果", res) | |
113 | - const data = res.data; | |
114 | - uni.navigateTo({ | |
115 | - url: "/pages/product/index?sn=" + this.SNcode | |
116 | - }) | |
117 | - } else { | |
118 | - this.isError = true | |
119 | - } | |
120 | - }) | |
121 | - }, | |
122 | - scanClick() { | |
123 | - uni.navigateTo({ | |
124 | - url: "/pages/product/scan" | |
125 | - }) | |
126 | - }, | |
127 | - getResult(res) { | |
128 | - console.log(res); | |
129 | - }, | |
130 | - geterror(e) { | |
131 | - console.log(e); | |
132 | - } | |
133 | - } | |
134 | - } | |
135 | -</script> | |
136 | - | |
137 | -<style lang="scss" scoped> | |
138 | - .containers { | |
139 | - width: 100vw; | |
140 | - height: 100vh; | |
141 | - background: #1E5866; | |
142 | - } | |
143 | - | |
144 | - .content { | |
145 | - display: flex; | |
146 | - flex-direction: column; | |
147 | - justify-content: center; | |
148 | - align-items: center; | |
149 | - height: 80vh; | |
150 | - } | |
151 | - | |
152 | - .flex-row { | |
153 | - display: flex; | |
154 | - justify-content: center; | |
155 | - align-items: center; | |
156 | - } | |
157 | - | |
158 | - //移动端样式 | |
159 | - @media screen and (max-width: 767px) { | |
160 | - .inputCss { | |
161 | - width: 278px; | |
162 | - height: 44px; | |
163 | - } | |
164 | - | |
165 | - .btnSNscan { | |
166 | - width: 100px; | |
167 | - height: 38px; | |
168 | - margin: 8px; | |
169 | - padding: 2px; | |
170 | - display: flex; | |
171 | - align-items: center; | |
172 | - justify-content: center; | |
173 | - border-radius: 54px; | |
174 | - background-color: rgba(0, 174, 170, 0.25); | |
175 | - box-sizing: border-box; | |
176 | - font-family: '苹方 中等', '苹方', sans-serif; | |
177 | - color: #ffffff; | |
178 | - text-align: center; | |
179 | - } | |
180 | - | |
181 | - .SearchBtnCss { | |
182 | - width: 80px; | |
183 | - height: 44px; | |
184 | - border-radius: 4px; | |
185 | - background-color: #00aeaa; | |
186 | - box-sizing: border-box; | |
187 | - font-family: '苹方 中等', '苹方', sans-serif; | |
188 | - color: #ffffff; | |
189 | - text-align: center; | |
190 | - } | |
191 | - | |
192 | - .tipsCss { | |
193 | - margin: 16px 0 22px 0; | |
194 | - font-size: 16px; | |
195 | - color: #ffffff; | |
196 | - } | |
197 | - | |
198 | - .errorTipCss { | |
199 | - overflow: hidden; | |
200 | - display: flex; | |
201 | - align-items: flex-start; | |
202 | - margin-top: 16px; | |
203 | - font-size: 16px; | |
204 | - color: red; | |
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 | - | |
264 | - | |
265 | -</style> | |
266 | 0 | \ No newline at end of file |
mobile/pages/product/index.vue
... | ... | @@ -1,332 +0,0 @@ |
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: '网络错误', | |
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> | |
333 | 0 | \ No newline at end of file |
mobile/pages/product/invalidCode.vue
... | ... | @@ -1,147 +0,0 @@ |
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> | |
148 | 0 | \ No newline at end of file |
mobile/pages/product/repairReport.vue
... | ... | @@ -1,467 +0,0 @@ |
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> | |
468 | 0 | \ No newline at end of file |
mobile/pages/product/scan.vue
... | ... | @@ -1,89 +0,0 @@ |
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> | |
90 | 0 | \ No newline at end of file |
pages/component/QrScan.vue
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | }) |
21 | 21 | .catch(error => { |
22 | 22 | console.log(error) |
23 | - // alert('Failed to access camera.') | |
23 | + // alert(error) | |
24 | 24 | }) |
25 | 25 | }, |
26 | 26 | beforeDestroy() { |
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 | |
94 | 94 | |
95 | 95 | #reader { |
96 | - top: 50%; | |
96 | + top: 45%; | |
97 | 97 | left: 0; |
98 | 98 | transform: translateY(-50%); |
99 | 99 | } | ... | ... |
pages/component/topWindow.vue
pages/homePage/index.vue
... | ... | @@ -5,8 +5,9 @@ |
5 | 5 | <image src="@/static/logo.png" style="width: 100px; height: 50px;" mode="aspectFit"></image> |
6 | 6 | <view class="tipsCss">{{$t('hdk.tips')}}</view> |
7 | 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> | |
8 | + <b-input id="input" ref="inputField" type="text" class="inputCss" maxLength="100" autofocus="autofocus" | |
9 | + :placeholder="$t('hdk.placeholder')" οnkeyup="this.value=this.value.replace(/\D|/g,'')" | |
10 | + @input="handleChange" @keypress.enter="handleScan" v-model="SNcode"></b-input> | |
10 | 11 | <b-button class="SearchBtnCss my-2 my-sm-0" size="sm" @click="search" |
11 | 12 | style="background:#00AEAA;">{{$t('hdk.search')}}</b-button> |
12 | 13 | </view> |
... | ... | @@ -24,17 +25,6 @@ |
24 | 25 | </template> |
25 | 26 | |
26 | 27 | <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 | 28 | import { |
39 | 29 | getProductFind |
40 | 30 | } from '@/api/scan' |
... | ... | @@ -45,10 +35,13 @@ |
45 | 35 | systemLocale: '', |
46 | 36 | applicationLocale: '', |
47 | 37 | isError: false, |
48 | - SNcode: "", | |
49 | 38 | open: false, |
50 | - lastTimeLen: null, | |
51 | - lastCode: "" | |
39 | + SNcode: "", | |
40 | + code: "", | |
41 | + lastTime: "", | |
42 | + lastCode: "", | |
43 | + nextTime: "", | |
44 | + nextCode: "", | |
52 | 45 | } |
53 | 46 | }, |
54 | 47 | components: { |
... | ... | @@ -67,10 +60,48 @@ |
67 | 60 | ] |
68 | 61 | } |
69 | 62 | }, |
70 | - mounted() { | |
71 | - // const inputElement = this.$refs.inputField.$el.querySelector('input'); | |
72 | - document.addEventListener('keydown', this.handleKeyDown); | |
73 | - }, | |
63 | + created() { | |
64 | + | |
65 | + window.document.onkeypress = (e) => { | |
66 | + if (window.event) { | |
67 | + // IE | |
68 | + this.nextCode = e.keyCode; | |
69 | + } else if (e.which) { | |
70 | + // Netscape/Firefox/Opera | |
71 | + this.nextCode = e.which; | |
72 | + } | |
73 | + if (e.which === 20) { | |
74 | + // 键盘回车事件 | |
75 | + if (this.code.length < 3) return; // 扫码枪的速度很快,手动输入的时间不会让code的长度大于2,所以这里不会对扫码枪有效 | |
76 | + console.log("扫码结束。"); | |
77 | + console.log("条形码:", this.code); | |
78 | + this.handleScan(this.code); // 获取到扫码枪输入的内容,做别的操作 | |
79 | + this.lastCode = ""; | |
80 | + this.lastTime = ""; | |
81 | + return; | |
82 | + } | |
83 | + this.nextTime = new Date().getTime(); | |
84 | + if (!this.lastTime && !this.lastCode) { | |
85 | + this.code = ""; // 清空上次的条形码 | |
86 | + this.code += e.key; | |
87 | + console.log("扫码开始---", this.code); | |
88 | + } | |
89 | + if ( | |
90 | + this.lastCode && | |
91 | + this.lastTime && | |
92 | + this.nextTime - this.lastTime > 500 | |
93 | + ) { | |
94 | + // 当扫码前有keypress事件时,防止首字缺失 | |
95 | + this.code = e.key; | |
96 | + // console.log("防止首字缺失。。。", this.code); | |
97 | + } else if (this.lastCode && this.lastTime) { | |
98 | + this.code += e.key; | |
99 | + // console.log("扫码中。。。", this.code); | |
100 | + } | |
101 | + this.lastCode = this.nextCode; | |
102 | + this.lastTime = this.nextTime; | |
103 | + }; | |
104 | + }, | |
74 | 105 | onLoad() { |
75 | 106 | let systemInfo = uni.getSystemInfoSync(); |
76 | 107 | this.systemLocale = systemInfo.language; |
... | ... | @@ -79,23 +110,22 @@ |
79 | 110 | }, |
80 | 111 | methods: { |
81 | 112 | getFirstSnFromUrl(url) { |
82 | - const regex = /sn=([^&]+)/; | |
113 | + // const regex = /sn=([^&]+)/; | |
114 | + const regex = /((?<=\?sn=)|(?<=HDKSN:))\w+/; | |
83 | 115 | const match = url.match(regex); |
116 | + console.log(match) | |
84 | 117 | if (match && match.length > 1) { |
85 | - const sn = match[1]; | |
118 | + const sn = match[0]; | |
86 | 119 | return sn; |
87 | 120 | } |
88 | 121 | return url; |
89 | 122 | }, |
90 | 123 | handleChange(event) { |
91 | - console.log(event); | |
92 | - this.SNcode = this.getFirstSnFromUrl(event); | |
124 | + // console.log(event); | |
125 | + // this.SNcode = this.getFirstSnFromUrl(event); | |
93 | 126 | }, |
94 | 127 | handleScan(event) { |
95 | - // console.log(this.SNcode); | |
96 | - // 捕获扫码枪输入的内容 | |
97 | - // this.isError = false; | |
98 | - | |
128 | + this.SNcode = this.getFirstSnFromUrl(this.code); | |
99 | 129 | }, |
100 | 130 | search() { |
101 | 131 | console.log("查询"); | ... | ... |
pages/product/invalidCode.vue
... | ... | @@ -130,6 +130,27 @@ |
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | + | |
134 | + } | |
135 | + //移动端样式 | |
136 | + @media screen and (max-width: 767px) { | |
137 | + .rescan { | |
138 | + width: 345px; | |
139 | + height: 44px; | |
140 | + margin: 25px 0 0 0; | |
141 | + padding: 2px; | |
142 | + background-color: #00aeaa; | |
143 | + box-sizing: border-box; | |
144 | + font-family: '苹方 中等', '苹方', sans-serif; | |
145 | + color: #ffffff; | |
146 | + text-align: center; | |
147 | + line-height: 44px; | |
148 | + font-size: 16px; | |
149 | + } | |
150 | + } | |
151 | + | |
152 | + //PC端样式 | |
153 | + @media screen and (min-width: 768px) { | |
133 | 154 | .rescan { |
134 | 155 | width: 690px; |
135 | 156 | height: 88px; | ... | ... |
pages/product/repairReport.vue
1 | 1 | <template> |
2 | 2 | <view class="containers"> |
3 | - <topWindow></topWindow> | |
3 | + <topWindow @lanChange="changeLan"></topWindow> | |
4 | 4 | <goback></goback> |
5 | 5 | <view class="content"> |
6 | 6 | <u-form labelPosition="top" labelAlign="left" :model="modal" :rules="rules" ref="uForm" |
... | ... | @@ -27,12 +27,13 @@ |
27 | 27 | <view class="title">{{$t('hdk.ProblemDescription')}}<text |
28 | 28 | style="color:#8B91A4;">{{$t('hdk.Required')}}</text></view> |
29 | 29 | <view class="textAreaCss"> |
30 | - <u-textarea :placeholderStyle="!$isMobile?'font-size:18px':''" v-model="modal.formInfo.repairDescribe" count maxlength="200" | |
30 | + <u-textarea :placeholderStyle="!$isMobile?'font-size:18px':''" | |
31 | + v-model="modal.formInfo.repairDescribe" count maxlength="200" | |
31 | 32 | :placeholder="$t('hdk.DescriptionPlaceholder')"></u-textarea> |
32 | 33 | </view> |
33 | 34 | <view class="uploadCss"> |
34 | - <u-upload upload-icon="plus" :fileList="fileList" @afterRead="afterRead" | |
35 | - @delete="deletePic" :previewFullImage="true" name="faultPicture" multiple :maxCount="5" | |
35 | + <u-upload upload-icon="plus" :fileList="fileList" @afterRead="afterRead" @delete="deletePic" | |
36 | + :previewFullImage="true" name="faultPicture" multiple :maxCount="5" | |
36 | 37 | accept="image"></u-upload> |
37 | 38 | </view> |
38 | 39 | </view> |
... | ... | @@ -66,8 +67,8 @@ |
66 | 67 | <view class="submitBtn" @click="openModal()"> |
67 | 68 | {{$t('hdk.ConfirmAndReport')}} |
68 | 69 | </view> |
69 | - <u-modal :show="confirmModal" :title="title" :confirmText="$t('hdk.Confirm')" :cancelText="$t('hdk.Cancel')" showCancelButton @confirm="submit()" | |
70 | - @cancel="confirmModal = false"> | |
70 | + <u-modal :show="confirmModal" :title="title" :confirmText="$t('hdk.Confirm')" :cancelText="$t('hdk.Cancel')" | |
71 | + showCancelButton @confirm="submit()" @cancel="confirmModal = false"> | |
71 | 72 | <view class="slot-content"> |
72 | 73 | <rich-text class="contentTextCss" :nodes="content"></rich-text> |
73 | 74 | </view> |
... | ... | @@ -168,6 +169,17 @@ |
168 | 169 | } |
169 | 170 | }, |
170 | 171 | methods: { |
172 | + changeLan(locale) { | |
173 | + console.log("切换语言,重新触发提示语", locale); | |
174 | + // 清除校验状态 | |
175 | + this.$refs.uForm.clearValidate(); | |
176 | + // 重新校验 | |
177 | + this.$forceUpdate() | |
178 | + this.$nextTick(() => { | |
179 | + this.$refs.uForm.validate(); | |
180 | + }); | |
181 | + | |
182 | + }, | |
171 | 183 | deletePic(event) { |
172 | 184 | this.fileList.splice(event.index, 1) |
173 | 185 | }, |
... | ... | @@ -202,14 +214,14 @@ |
202 | 214 | // return; |
203 | 215 | return new Promise((resolve, reject) => { |
204 | 216 | let a = uni.uploadFile({ |
205 | - url: config.baseUrl + '/upload-file', | |
217 | + url: config.baseUrl + '/upload-file', | |
206 | 218 | header: { |
207 | 219 | 'tenant-id': '1', |
208 | 220 | // 'Content-Type': 'multipart/form-data;' |
209 | 221 | }, |
210 | 222 | filePath: url, |
211 | 223 | name: "file", |
212 | - | |
224 | + | |
213 | 225 | success: (res) => { |
214 | 226 | console.log(res); |
215 | 227 | let data = JSON.parse(res.data); |
... | ... | @@ -299,14 +311,14 @@ |
299 | 311 | align-items: center; |
300 | 312 | background: #F2F4F3; |
301 | 313 | } |
302 | - | |
303 | - /deep/.uni-input-input{ | |
314 | + | |
315 | + /deep/.uni-input-input { | |
304 | 316 | padding-left: 10px |
305 | 317 | } |
306 | 318 | |
307 | 319 | .uform { |
308 | 320 | margin: 20px; |
309 | - position:relative; | |
321 | + position: relative; | |
310 | 322 | } |
311 | 323 | |
312 | 324 | .textAreaCss { |
... | ... | @@ -322,8 +334,8 @@ |
322 | 334 | display: flex; |
323 | 335 | justify-content: center; |
324 | 336 | } |
325 | - | |
326 | - | |
337 | + | |
338 | + | |
327 | 339 | |
328 | 340 | //移动端样式 |
329 | 341 | @media screen and (max-width: 767px) { |
... | ... | @@ -337,10 +349,19 @@ |
337 | 349 | color: #333333; |
338 | 350 | text-align: left; |
339 | 351 | } |
340 | - .content{ | |
352 | + | |
353 | + .content { | |
341 | 354 | width: 100%; |
342 | 355 | } |
343 | 356 | |
357 | + /deep/.uni-textarea-textarea { | |
358 | + font-size: 15px; | |
359 | + } | |
360 | + | |
361 | + /deep/.uni-textarea-placeholder { | |
362 | + font-size: 15px; | |
363 | + } | |
364 | + | |
344 | 365 | .basicInformation { |
345 | 366 | width: 95%; |
346 | 367 | height: auto; |
... | ... | @@ -371,7 +392,7 @@ |
371 | 392 | line-height: normal; |
372 | 393 | z-index: 999; |
373 | 394 | } |
374 | - | |
395 | + | |
375 | 396 | .contentTextCss { |
376 | 397 | font-size: 14px; |
377 | 398 | color: #999999; |
... | ... | @@ -390,39 +411,39 @@ |
390 | 411 | color: #333333; |
391 | 412 | text-align: left; |
392 | 413 | } |
393 | - | |
414 | + | |
394 | 415 | .contentTextCss { |
395 | 416 | font-size: 20px; |
396 | 417 | color: #999999; |
397 | 418 | } |
398 | - | |
399 | - .content{ | |
419 | + | |
420 | + .content { | |
400 | 421 | width: 80%; |
401 | 422 | position: relative; |
402 | 423 | } |
403 | - | |
404 | - /deep/.u-modal{ | |
424 | + | |
425 | + /deep/.u-modal { | |
405 | 426 | width: 500px !important; |
406 | 427 | } |
407 | - | |
408 | - /deep/.u-modal__title{ | |
428 | + | |
429 | + /deep/.u-modal__title { | |
409 | 430 | height: 80px; |
410 | 431 | font-size: 24px |
411 | 432 | } |
412 | - | |
413 | - /deep/.u-modal__content{ | |
433 | + | |
434 | + /deep/.u-modal__content { | |
414 | 435 | height: 80px; |
415 | 436 | } |
416 | - | |
417 | - /deep/.uni-textarea-textarea{ | |
437 | + | |
438 | + /deep/.uni-textarea-textarea { | |
418 | 439 | font-size: 18px; |
419 | 440 | } |
420 | - | |
421 | - /deep/.uni-input-input{ | |
441 | + | |
442 | + /deep/.uni-input-input { | |
422 | 443 | font-size: 20px !important; |
423 | 444 | } |
424 | - | |
425 | - /deep/.u-form-item__body__right__message{ | |
445 | + | |
446 | + /deep/.u-form-item__body__right__message { | |
426 | 447 | font-size: 18px; |
427 | 448 | } |
428 | 449 | |
... | ... | @@ -446,7 +467,8 @@ |
446 | 467 | height: 39px; |
447 | 468 | padding: 2px; |
448 | 469 | position: fixed; |
449 | - left: 0;right: 0; | |
470 | + left: 0; | |
471 | + right: 0; | |
450 | 472 | bottom: 30px; |
451 | 473 | margin: 0 auto; |
452 | 474 | display: flex; |
... | ... | @@ -462,6 +484,4 @@ |
462 | 484 | z-index: 999; |
463 | 485 | } |
464 | 486 | } |
465 | - | |
466 | - | |
467 | 487 | </style> |
468 | 488 | \ No newline at end of file | ... | ... |
pages/product/scan.vue
... | ... | @@ -54,9 +54,9 @@ |
54 | 54 | getResult(sn) { |
55 | 55 | console.log(sn); |
56 | 56 | this.open = false; |
57 | - const regex = /sn=([^&]+)/; | |
57 | + const regex = /((?<=\?sn=)|(?<=HDKSN:))\w+/; | |
58 | 58 | const match = regex.exec(sn); |
59 | - const sncode = match ? match[1] : sn; | |
59 | + const sncode = match ? match[0] : sn; | |
60 | 60 | // let sncode = sn.substring(sn.lastIndexOf(":") + 1); |
61 | 61 | getProductFind(sncode).then(res => { |
62 | 62 | console.log(res); | ... | ... |
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','u-upload',"uni-input"], | |
12 | + selectorBlackList: ['keep-px','u-modal','u-form-item','u-upload',"uni-input","uni-textarea-textarea","uni-textarea-placeholder","u-toast"], | |
13 | 13 | minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换 |
14 | 14 | mediaQuery: false, // 媒体查询里的单位是否需要转换单位 |
15 | 15 | replace: true, // 是否直接更换属性值,而不添加备用属性 | ... | ... |