Commit ef2eeb98929c5fa7ba3bc0e5962db89ade377f70

Authored by 郭伟龙
1 parent da785871
Exists in develop

fix: logo图更换高清

响应式按钮大小过渡调整
产品信息隐藏生产人和生成时间字段
扫码增加声音和震动
切换tab调整
正则表达式更换,ios低版本不支持零宽度正向断言
pages/component/InformationModule.vue
@@ -21,14 +21,15 @@ @@ -21,14 +21,15 @@
21 <text class="leftT">{{$t('hdk.Model')}}</text> 21 <text class="leftT">{{$t('hdk.Model')}}</text>
22 <text class="rightT">{{informationData.type || ""}}</text> 22 <text class="rightT">{{informationData.type || ""}}</text>
23 </view> 23 </view>
24 - <view class="flex-between"> 24 + <!-- 不展示 -->
  25 + <!-- <view class="flex-between">
25 <text class="leftT">{{$t('hdk.DateOfProduction')}}</text> 26 <text class="leftT">{{$t('hdk.DateOfProduction')}}</text>
26 <text class="rightT">{{$u.timeFormat(informationData.productionTime, 'yyyy-mm-dd') || ""}}</text> 27 <text class="rightT">{{$u.timeFormat(informationData.productionTime, 'yyyy-mm-dd') || ""}}</text>
27 </view> 28 </view>
28 <view class="flex-between"> 29 <view class="flex-between">
29 <text class="leftT">{{$t('hdk.ProductionPersonnel')}}</text> 30 <text class="leftT">{{$t('hdk.ProductionPersonnel')}}</text>
30 <text class="rightT">{{informationData.productionUserName || ""}}</text> 31 <text class="rightT">{{informationData.productionUserName || ""}}</text>
31 - </view> 32 + </view> -->
32 </view> 33 </view>
33 <view class="fileViewingModule"> 34 <view class="fileViewingModule">
34 <view class="title"> 35 <view class="title">
@@ -102,7 +103,9 @@ @@ -102,7 +103,9 @@
102 } 103 }
103 104
104 .swiperCss { 105 .swiperCss {
  106 + margin-top: 20px;
105 width: 95%; 107 width: 95%;
  108 + height: 200px !important;
106 } 109 }
107 110
108 .flex-between { 111 .flex-between {
@@ -147,6 +150,8 @@ @@ -147,6 +150,8 @@
147 150
148 .swiperCss { 151 .swiperCss {
149 width: 80%; 152 width: 80%;
  153 + margin-top: 20px;
  154 + height: 600px !important;
150 } 155 }
151 156
152 .flex-between { 157 .flex-between {
pages/component/InspectionModule.vue
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </view> 17 </view>
18 <view class="flex-between"> 18 <view class="flex-between">
19 <text class="leftT">{{$t('hdk.TestDate')}}</text> 19 <text class="leftT">{{$t('hdk.TestDate')}}</text>
20 - <text class="rightT">{{$u.timeFormat(inspectionData.checkTime, 'yyyy年mm月dd日') || ''}}</text> 20 + <text class="rightT">{{$u.timeFormat(inspectionData.checkTime, 'yyyy-mm-dd') || ''}}</text>
21 </view> 21 </view>
22 </view> 22 </view>
23 23
pages/component/QrScan.vue
@@ -9,8 +9,11 @@ @@ -9,8 +9,11 @@
9 import { 9 import {
10 Html5Qrcode 10 Html5Qrcode
11 } from 'html5-qrcode'; 11 } from 'html5-qrcode';
  12 + const innerAudioContext = uni.createInnerAudioContext();
  13 + innerAudioContext.autoplay = true;
  14 + innerAudioContext.src = '/static/audio/scanSound.mp3';
12 export default { 15 export default {
13 - created() { 16 + mounted() {
14 this.getCameras(); 17 this.getCameras();
15 navigator.mediaDevices.getUserMedia({ 18 navigator.mediaDevices.getUserMedia({
16 video: true 19 video: true
@@ -43,6 +46,7 @@ @@ -43,6 +46,7 @@
43 }); 46 });
44 }, 47 },
45 start() { 48 start() {
  49 + let that = this;
46 //environment后置 user前置 50 //environment后置 user前置
47 this.html5QrCode 51 this.html5QrCode
48 .start({ 52 .start({
@@ -57,13 +61,24 @@ @@ -57,13 +61,24 @@
57 halfSample: true, //缩小二维码提高识别精度吧 61 halfSample: true, //缩小二维码提高识别精度吧
58 }, 62 },
59 (decodedText) => { 63 (decodedText) => {
60 - this.$emit('ok', decodedText); 64 + this.playAudio();
  65 + navigator.vibrate(500);
  66 + setTimeout(()=>{
  67 + that.$emit('ok', decodedText);
  68 + this.stop();
  69 + },500)
61 }, 70 },
62 ) 71 )
63 .catch((err) => { 72 .catch((err) => {
64 this.$emit('err', err); 73 this.$emit('err', err);
65 }); 74 });
66 }, 75 },
  76 + playAudio() {
  77 + innerAudioContext.play();
  78 + innerAudioContext.onPlay(() => {
  79 + console.log('音频开始播放');
  80 + });
  81 + },
67 stop() { 82 stop() {
68 this.html5QrCode 83 this.html5QrCode
69 .stop() 84 .stop()
@@ -88,7 +103,7 @@ @@ -88,7 +103,7 @@
88 height: 100%; 103 height: 100%;
89 width: 100%; 104 width: 100%;
90 // background: rgba($color: #000000, $alpha: 0.48); 105 // background: rgba($color: #000000, $alpha: 0.48);
91 - background:rgba(0, 0, 0, 1.48); 106 + background: rgba(0, 0, 0, 1.48);
92 } 107 }
93 108
94 109
pages/component/goback.vue
1 <template> 1 <template>
2 <view class="back" @click="goback" v-if="!$isMobile"> 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> 3 + <u-image src="/static/images/icon/back.png" mode="witFix" class="ImageCss"></u-image>
4 </view> 4 </view>
5 </template> 5 </template>
6 6
@@ -34,6 +34,18 @@ @@ -34,6 +34,18 @@
34 </script> 34 </script>
35 35
36 <style lang="scss" scoped> 36 <style lang="scss" scoped>
  37 + /deep/.u-image__image{
  38 + width: 50px !important;
  39 + height: 50px !important;
  40 + }
  41 + /deep/.u-image{
  42 + width: 0 !important;
  43 + height: 0 !important;
  44 + }
  45 + .ImageCss{
  46 + width: 50px !important;
  47 + height: 50px !important;
  48 + }
37 .back { 49 .back {
38 width: 50px; 50 width: 50px;
39 height: 50px; 51 height: 50px;
@@ -43,7 +55,7 @@ @@ -43,7 +55,7 @@
43 flex-direction: column; 55 flex-direction: column;
44 justify-content: center; 56 justify-content: center;
45 align-items: center; 57 align-items: center;
46 - left:1%; 58 + left:10px;
47 top: 10%; 59 top: 10%;
48 bottom: 0; 60 bottom: 0;
49 } 61 }
pages/component/topWindow.vue
@@ -7,16 +7,16 @@ @@ -7,16 +7,16 @@
7 <b-navbar-toggle target="nav-collapse"></b-navbar-toggle> 7 <b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
8 <b-collapse id="nav-collapse" is-nav class="collapseR"> 8 <b-collapse id="nav-collapse" is-nav class="collapseR">
9 <b-navbar-nav> 9 <b-navbar-nav>
10 - <b-nav-item v-show="!isHome" @click="handleClick('productInformation')"  
11 - :class="{ 'activeCSS': selectedNavItem === 'productInformation' }"> 10 + <b-nav-item v-show="!isHome && !$isMobile" @click="handleClick(0)"
  11 + :class="{ 'activeCSS': selectedNavItem === 0 }">
12 {{$t('hdk.productInformation')}} 12 {{$t('hdk.productInformation')}}
13 </b-nav-item> 13 </b-nav-item>
14 - <b-nav-item v-show="!isHome" @click="handleClick('inspectionInformation')"  
15 - :class="{ 'activeCSS': selectedNavItem === 'inspectionInformation' }"> 14 + <b-nav-item v-show="!isHome && !$isMobile" @click="handleClick(1)"
  15 + :class="{ 'activeCSS': selectedNavItem === 1 }">
16 {{$t('hdk.inspectionInformation')}} 16 {{$t('hdk.inspectionInformation')}}
17 </b-nav-item> 17 </b-nav-item>
18 - <b-nav-item v-show="!isHome" @click="handleClick('attachmentInformation')"  
19 - :class="{ 'activeCSS': selectedNavItem === 'attachmentInformation' }"> 18 + <b-nav-item v-show="!isHome && !$isMobile" @click="handleClick(2)"
  19 + :class="{ 'activeCSS': selectedNavItem === 2 }">
20 {{$t('hdk.attachmentInformation')}} 20 {{$t('hdk.attachmentInformation')}}
21 </b-nav-item> 21 </b-nav-item>
22 <b-nav-item-dropdown :text="selectedLanguage" right> 22 <b-nav-item-dropdown :text="selectedLanguage" right>
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 data() { 41 data() {
42 return { 42 return {
43 selectedLanguage: this.$t('index.language'), 43 selectedLanguage: this.$t('index.language'),
44 - selectedNavItem: 'productInformation' 44 + selectedNavItem: 0
45 } 45 }
46 }, 46 },
47 props: { 47 props: {
pages/homePage/index.vue
@@ -110,12 +110,12 @@ @@ -110,12 +110,12 @@
110 }, 110 },
111 methods: { 111 methods: {
112 getFirstSnFromUrl(url) { 112 getFirstSnFromUrl(url) {
113 - // const regex = /sn=([^&]+)/;  
114 - const regex = /((?<=\?sn=)|(?<=HDKSN:))\w+/; 113 + // const regex = /((?<=\?sn=)|(?<=HDKSN:))\w+/;「零宽度正向断言」ios低版本不支持
  114 + const regex = /(?:\?sn=|HDKSN:)(\w+)/;
115 const match = url.match(regex); 115 const match = url.match(regex);
116 console.log(match) 116 console.log(match)
117 if (match && match.length > 1) { 117 if (match && match.length > 1) {
118 - const sn = match[0]; 118 + const sn = match[1];
119 return sn; 119 return sn;
120 } 120 }
121 return url; 121 return url;
pages/product/index.vue
1 <template> 1 <template>
2 <view class="containers"> 2 <view class="containers">
3 - <topWindow :isHome="false" @item-click="handleItemClick"></topWindow> 3 + <topWindow :isHome="false" @item-click="handleItemClick" @lanChange="changeLan"></topWindow>
4 <goback></goback> 4 <goback></goback>
  5 + <u-tabs :list="list" :current="current" lineColor="#00aeaa"
  6 + :itemStyle="{width:'200px',height:'40px',backgraound:'#000'}" @click="tabChange" v-show="$isMobile"
  7 + :activeStyle="activeStyle" :inactiveStyle="inactiveStyle"></u-tabs>
5 <view class="ComponentsBody"> 8 <view class="ComponentsBody">
6 - <view class="productInformation" v-if="current == 'productInformation'"> 9 + <view class="productInformation" v-if="current == 0">
7 <InformationModule v-if="informationData != null" :informationData="informationData"> 10 <InformationModule v-if="informationData != null" :informationData="informationData">
8 </InformationModule> 11 </InformationModule>
9 </view> 12 </view>
10 - <view class="inspectionInformation" v-else-if="current == 'inspectionInformation'"> 13 + <view class="inspectionInformation" v-else-if="current == 1">
11 <InspectionModule v-if="inspectionData != null" :inspectionData="inspectionData"></InspectionModule> 14 <InspectionModule v-if="inspectionData != null" :inspectionData="inspectionData"></InspectionModule>
12 </view> 15 </view>
13 - <view class="attachmentInformation" v-else-if="current == 'attachmentInformation'"> 16 + <view class="attachmentInformation" v-else-if="current == 2">
14 <AuxiliaryModule v-if="auxiliaryData != null" :auxiliaryData="auxiliaryData"></AuxiliaryModule> 17 <AuxiliaryModule v-if="auxiliaryData != null" :auxiliaryData="auxiliaryData"></AuxiliaryModule>
15 </view> 18 </view>
16 <view class="repairReportBtnCss" @click="jumpService"> 19 <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> 20 + <image src="/static/images/icon/repair.png" class="repairReportImageCss" mode="witFix" ></u-image>
19 <text class="repairReportTextCss">{{$t("hdk.Repair")}}</text> 21 <text class="repairReportTextCss">{{$t("hdk.Repair")}}</text>
20 </view> 22 </view>
21 </view> 23 </view>
@@ -49,7 +51,37 @@ @@ -49,7 +51,37 @@
49 inspectionData: null, 51 inspectionData: null,
50 auxiliaryData: null, 52 auxiliaryData: null,
51 repairInformation: null, 53 repairInformation: null,
52 - current: "productInformation" 54 + // current: "productInformation",
  55 + current: 0,
  56 + list: [{
  57 + name: this.$t('hdk.productInformation'),
  58 + }, {
  59 + name: this.$t('hdk.inspectionInformation'),
  60 + }, {
  61 + name: this.$t('hdk.attachmentInformation')
  62 + }],
  63 + inactiveStyle: {
  64 + width: '120rpx',
  65 + height: '38rpx',
  66 + backgroundColor: 'rgba(255, 255, 255, 0)',
  67 + boxSizing: 'border-box',
  68 + fontFamily: "苹方 中等, 苹方, sans-serif",
  69 + color: '#555555',
  70 + textAlign: 'left',
  71 + lineHeight: 'normal',
  72 + fontSize: '28rpx'
  73 + },
  74 + activeStyle: {
  75 + width: '128rpx',
  76 + height: '43rpx',
  77 + backgroundColor: 'rgba(255, 255, 255, 0)',
  78 + boxSizing: 'border-box',
  79 + fontFamily: "苹方 中等, 苹方, sans-serif",
  80 + color: '#00aeaa',
  81 + textAlign: 'left',
  82 + lineHeight: 'normal',
  83 + fontSize: '32rpx'
  84 + },
53 } 85 }
54 }, 86 },
55 computed: { 87 computed: {
@@ -63,6 +95,18 @@ @@ -63,6 +95,18 @@
63 this.initData() 95 this.initData()
64 }, 96 },
65 methods: { 97 methods: {
  98 + changeLan(lang) {
  99 + console.log("改变语言", lang);
  100 + this.list = [];
  101 + // 重新构建新的 list 数组
  102 + this.list = [{
  103 + name: this.$t('hdk.productInformation'),
  104 + }, {
  105 + name: this.$t('hdk.inspectionInformation'),
  106 + }, {
  107 + name: this.$t('hdk.attachmentInformation')
  108 + }];
  109 + },
66 initData() { 110 initData() {
67 // uni.showLoading({title: '查询中...'}) 111 // uni.showLoading({title: '查询中...'})
68 getProductFind(this.sn).then(res => { 112 getProductFind(this.sn).then(res => {
@@ -246,6 +290,16 @@ @@ -246,6 +290,16 @@
246 const pictureRegex = /\.(jpg|jpeg|png|gif)$/i; 290 const pictureRegex = /\.(jpg|jpeg|png|gif)$/i;
247 return pictureRegex.test(str); 291 return pictureRegex.test(str);
248 }, 292 },
  293 + tabChange(item) {
  294 + this.current = item.index
  295 + if (this.current == 0) {
  296 + // console.log(this.informationData);
  297 + } else if (this.current == 1) {
  298 + // console.log(this.inspectionData);
  299 + } else {
  300 + // console.log(this.auxiliaryData);
  301 + }
  302 + },
249 handleItemClick(item) { 303 handleItemClick(item) {
250 this.current = item; 304 this.current = item;
251 console.log('点击的菜单项:', item); 305 console.log('点击的菜单项:', item);
@@ -263,6 +317,7 @@ @@ -263,6 +317,7 @@
263 } 317 }
264 318
265 .ComponentsBody { 319 .ComponentsBody {
  320 + margin-top: 5px;
266 // width:100%; 321 // width:100%;
267 // display: flex; 322 // display: flex;
268 // justify-content: center; 323 // justify-content: center;
@@ -280,7 +335,8 @@ @@ -280,7 +335,8 @@
280 // .attachmentInformation{ 335 // .attachmentInformation{
281 // width: 100%; 336 // width: 100%;
282 // } 337 // }
283 - 338 +
  339 + //移动端样式
284 @media screen and (max-width: 767px) { 340 @media screen and (max-width: 767px) {
285 .repairReportBtnCss { 341 .repairReportBtnCss {
286 width: 100px; 342 width: 100px;
@@ -295,6 +351,18 @@ @@ -295,6 +351,18 @@
295 bottom: 100px; 351 bottom: 100px;
296 // background-color: #00aeaa; 352 // background-color: #00aeaa;
297 } 353 }
  354 +
  355 +
  356 +
  357 + // .u-image__image{
  358 + // width: 100px !important;
  359 + // height: 100px !important;
  360 + // }
  361 +
  362 + .repairReportImageCss{
  363 + width: 100px !important;
  364 + height: 100px !important;
  365 + }
298 366
299 .repairReportTextCss { 367 .repairReportTextCss {
300 position: absolute; 368 position: absolute;
@@ -309,9 +377,8 @@ @@ -309,9 +377,8 @@
309 // //PC端样式 377 // //PC端样式
310 @media screen and (min-width: 768px) { 378 @media screen and (min-width: 768px) {
311 .repairReportBtnCss { 379 .repairReportBtnCss {
312 - width: 100px;  
313 - height: 100px;  
314 - border-radius: 100px; 380 + width: 200px;
  381 + height: 200px;
315 position: fixed; 382 position: fixed;
316 display: flex; 383 display: flex;
317 flex-direction: column; 384 flex-direction: column;
@@ -322,9 +389,19 @@ @@ -322,9 +389,19 @@
322 // background-color: #00aeaa; 389 // background-color: #00aeaa;
323 } 390 }
324 391
  392 + // .u-image__image{
  393 + // width: 200px !important;
  394 + // }
  395 +
  396 +
  397 + .repairReportImageCss{
  398 + width: 200px !important;
  399 + height: 200px !important;
  400 + }
  401 +
325 .repairReportTextCss { 402 .repairReportTextCss {
326 position: absolute; 403 position: absolute;
327 - bottom: 15px; 404 + bottom: 60px;
328 color: #fff; 405 color: #fff;
329 } 406 }
330 407
pages/product/repairReport.vue
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <view class="containers"> 2 <view class="containers">
3 <topWindow @lanChange="changeLan"></topWindow> 3 <topWindow @lanChange="changeLan"></topWindow>
4 <goback></goback> 4 <goback></goback>
5 - <view class="content"> 5 + <view class="contents">
6 <u-form labelPosition="top" labelAlign="left" :model="modal" :rules="rules" ref="uForm" 6 <u-form labelPosition="top" labelAlign="left" :model="modal" :rules="rules" ref="uForm"
7 :labelStyle="{fonSize:'26px',color:'#8B91A4',paddingLeft:'10px'}"> 7 :labelStyle="{fonSize:'26px',color:'#8B91A4',paddingLeft:'10px'}">
8 <view class="basicInformation"> 8 <view class="basicInformation">
@@ -169,16 +169,52 @@ @@ -169,16 +169,52 @@
169 } 169 }
170 }, 170 },
171 methods: { 171 methods: {
  172 + setRules() {
  173 + this.rules = {
  174 + 'formInfo.sn': {
  175 + type: 'string',
  176 + required: true,
  177 + message: this.$t('hdk.FillSNCode'),
  178 + trigger: ['blur', 'change']
  179 + },
  180 + 'formInfo.productName': {
  181 + type: 'string',
  182 + required: true,
  183 + message: this.$t('hdk.FillProductName'),
  184 + trigger: ['blur', 'change']
  185 + },
  186 + 'formInfo.contactPersonName': {
  187 + type: 'string',
  188 + required: true,
  189 + message: this.$t('hdk.FillName'),
  190 + trigger: ['blur', 'change']
  191 + },
  192 + 'formInfo.email': {
  193 + type: 'email',
  194 + required: true,
  195 + message: this.$t('hdk.FillEmail'),
  196 + trigger: ['blur', 'change']
  197 + },
  198 + 'formInfo.repairDescribe': {
  199 + type: 'string',
  200 + required: true,
  201 + message: this.$t('hdk.FillDescription'),
  202 + trigger: ['blur', 'change']
  203 + },
  204 + 'formInfo.airportName': {
  205 + type: 'string',
  206 + required: true,
  207 + message: this.$t('hdk.FillAirportName'),
  208 + trigger: ['blur', 'change']
  209 + },
  210 + }
  211 + },
172 changeLan(locale) { 212 changeLan(locale) {
173 console.log("切换语言,重新触发提示语", locale); 213 console.log("切换语言,重新触发提示语", locale);
174 // 清除校验状态 214 // 清除校验状态
175 this.$refs.uForm.clearValidate(); 215 this.$refs.uForm.clearValidate();
176 // 重新校验 216 // 重新校验
177 - this.$forceUpdate()  
178 - this.$nextTick(() => {  
179 - this.$refs.uForm.validate();  
180 - });  
181 - 217 + this.setRules();
182 }, 218 },
183 deletePic(event) { 219 deletePic(event) {
184 this.fileList.splice(event.index, 1) 220 this.fileList.splice(event.index, 1)
@@ -350,7 +386,7 @@ @@ -350,7 +386,7 @@
350 text-align: left; 386 text-align: left;
351 } 387 }
352 388
353 - .content { 389 + .contents {
354 width: 100%; 390 width: 100%;
355 } 391 }
356 392
@@ -374,20 +410,19 @@ @@ -374,20 +410,19 @@
374 } 410 }
375 411
376 .submitBtn { 412 .submitBtn {
377 - width: 350px; 413 + width: 90%;
378 height: 40px; 414 height: 40px;
379 - padding: 2px;  
380 - margin: 24px; 415 + margin: 20px 24px;
381 position: fixed; 416 position: fixed;
382 - bottom: 0px; 417 + bottom: 0;
383 display: flex; 418 display: flex;
384 justify-content: center; 419 justify-content: center;
385 align-items: center; 420 align-items: center;
386 border-radius: 8px; 421 border-radius: 8px;
387 background-color: #00aeaa; 422 background-color: #00aeaa;
388 box-sizing: border-box; 423 box-sizing: border-box;
389 - font-family: '苹方 中等', '苹方', sans-serif;  
390 - color: #ffffff; 424 + font-family: 苹方 中等, 苹方, sans-serif;
  425 + color: #fff;
391 text-align: center; 426 text-align: center;
392 line-height: normal; 427 line-height: normal;
393 z-index: 999; 428 z-index: 999;
@@ -417,7 +452,7 @@ @@ -417,7 +452,7 @@
417 color: #999999; 452 color: #999999;
418 } 453 }
419 454
420 - .content { 455 + .contents {
421 width: 80%; 456 width: 80%;
422 position: relative; 457 position: relative;
423 } 458 }
@@ -463,22 +498,19 @@ @@ -463,22 +498,19 @@
463 } 498 }
464 499
465 .submitBtn { 500 .submitBtn {
466 - width: 500px;  
467 - height: 39px;  
468 - padding: 2px; 501 + width: 80%;
  502 + height: 40px;
  503 + margin: 20px 24px;
469 position: fixed; 504 position: fixed;
470 - left: 0;  
471 - right: 0;  
472 - bottom: 30px;  
473 - margin: 0 auto; 505 + bottom: 0;
474 display: flex; 506 display: flex;
475 justify-content: center; 507 justify-content: center;
476 align-items: center; 508 align-items: center;
477 - border-radius: 4px; 509 + border-radius: 8px;
478 background-color: #00aeaa; 510 background-color: #00aeaa;
479 box-sizing: border-box; 511 box-sizing: border-box;
480 - font-family: '苹方 中等', '苹方', sans-serif;  
481 - color: #ffffff; 512 + font-family: 苹方 中等, 苹方, sans-serif;
  513 + color: #fff;
482 text-align: center; 514 text-align: center;
483 line-height: normal; 515 line-height: normal;
484 z-index: 999; 516 z-index: 999;
pages/product/scan.vue
@@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
40 computed: { 40 computed: {
41 41
42 }, 42 },
  43 + onShow() {
  44 + this.open = true
  45 + },
43 mounted() { 46 mounted() {
44 if (browser.versions.webKit || browser.versions.weixin || browser.versions.gecko) { 47 if (browser.versions.webKit || browser.versions.weixin || browser.versions.gecko) {
45 this.open = true; 48 this.open = true;
@@ -51,25 +54,40 @@ @@ -51,25 +54,40 @@
51 54
52 }, 55 },
53 methods: { 56 methods: {
  57 + playAudio() {
  58 + const innerAudioContext = uni.createInnerAudioContext();
  59 + innerAudioContext.autoplay = true;
  60 + innerAudioContext.src = '/static/audio/scanSound.mp3';
  61 + innerAudioContext.play();
  62 + innerAudioContext.onPlay(() => {
  63 + alert('音频开始播放')
  64 + console.log('音频开始播放');
  65 + });
  66 + },
54 getResult(sn) { 67 getResult(sn) {
55 console.log(sn); 68 console.log(sn);
  69 + // this.playAudio()
56 this.open = false; 70 this.open = false;
57 - const regex = /((?<=\?sn=)|(?<=HDKSN:))\w+/; 71 + // const regex = /((?<=\?sn=)|(?<=HDKSN:))\w+/;「零宽度正向断言」ios低版本不支持
  72 + const regex = /(?:\?sn=|HDKSN:)(\w+)/;
58 const match = regex.exec(sn); 73 const match = regex.exec(sn);
59 - const sncode = match ? match[0] : sn; 74 + const sncode = match ? match[1] : sn;
60 // let sncode = sn.substring(sn.lastIndexOf(":") + 1); 75 // let sncode = sn.substring(sn.lastIndexOf(":") + 1);
61 getProductFind(sncode).then(res => { 76 getProductFind(sncode).then(res => {
62 console.log(res); 77 console.log(res);
63 if (res.code === 1400001001) { 78 if (res.code === 1400001001) {
64 uni.navigateTo({ 79 uni.navigateTo({
65 - url: '/pages/product/invalidCode?snCode='+sncode, 80 + url: '/pages/product/invalidCode?snCode=' + sncode,
66 success() { 81 success() {
67 this.open = true 82 this.open = true
68 } 83 }
69 }); 84 });
70 } else { 85 } else {
71 uni.navigateTo({ 86 uni.navigateTo({
72 - url: "/pages/product/index?sn=" + sncode 87 + url: "/pages/product/index?sn=" + sncode,
  88 + success() {
  89 + this.open = true
  90 + }
73 }) 91 })
74 } 92 }
75 }) 93 })
static/hdk-top-logo.png

1.29 KB | W: | H:

3.75 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
static/logo.png

1.83 KB | W: | H:

4.31 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin