From 8efdbe37bdaaab7717571d3cf3869957db8e17a2 Mon Sep 17 00:00:00 2001 From: xinzhedeai <2291006094@qq.com> Date: Mon, 30 Dec 2024 13:29:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + api/home.js | 35 +++ pages/home/home.vue | 388 +++++++++++++++++--------------- static/image/paokong/impexp.png | Bin 0 -> 1571 bytes 4 files changed, 247 insertions(+), 177 deletions(-) create mode 100644 .gitignore create mode 100644 api/home.js create mode 100644 static/image/paokong/impexp.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be30a57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +unpackage/ diff --git a/api/home.js b/api/home.js new file mode 100644 index 0000000..adc1811 --- /dev/null +++ b/api/home.js @@ -0,0 +1,35 @@ +import request from '@/common/request.js' + +export function getExportData(data) { // 鑾峰彇涓嬫媺鍒楄〃鏁版嵁 + return request({ + url: '/product/ryexport', + method: 'get', + data + }) +} + +export function getselectList4productName(data) { // 鑾峰彇涓嬫媺鍒楄〃鏁版嵁 + return request({ + url: '/product/getList', + method: 'get', + data + }) +} + +export function getselectList4tester(data) { // 鑾峰彇涓嬫媺鍒楄〃鏁版嵁 + return request({ + url: '/product/getList', + method: 'post', + data + }) +} + +export function getDict(data) { // 鑾峰彇涓嬫媺鍒楄〃鏁版嵁 + return request({ + url: '/system/dict/data/type/'+data.type, + method: 'get', + }) +} + + + diff --git a/pages/home/home.vue b/pages/home/home.vue index d249c8a..717befd 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -6,7 +6,7 @@ <h3>闇插ぉ鐐瓟楠屾敹浠�</h3> <button @click="gosend">鑾峰彇鐢甸噺</button> </view> - <view class="link-info-wrapper" @click="gosend('POWER')"> + <view class="link-info-wrapper" @click="gosend('POWER')"> <div class="left"> <image :src="`/static/image/paokong/${connected?'linkY':'linkN'}.png`" mode=""></image> <view class="link-status"> @@ -20,7 +20,7 @@ </div> </view> <p class="list-item"> - <image src="/static/image/home/icon1.png" alt="" /> + <image src="/static/image/paokong/impexp.png" alt="" /> <span>鐐瓟璁捐鏁版嵁瀵煎叆</span> <!-- <button size="mini" class="funcBtn" type="primary" @click="navTo('import')">瀵煎叆瀵煎嚭</button> --> </p> @@ -34,13 +34,13 @@ <span>璁惧娴嬭瘯</span> <button size="mini" class="funcBtn" type="primary" @click="navTo('measureTest')">娴嬮噺</button> </p> --> - <p class="list-item" @click="navTo('measure')"> + <p class="list-item" @click="navTo('measure')"> <image src="/static/image/paokong/measure.png" alt="" /> <span>鐐瓟娴嬮噺</span> <!-- <button size="mini" class="funcBtn" type="primary" @click="navTo('measure')">娴嬮噺</button> --> </p> - <p class="list-item"> - <image src="/static/image/home/icon1.png" alt="" /> + <p class="list-item" @click="exportExcel"> + <image src="/static/image/paokong/impexp.png" alt="" /> <span>鐐瓟娴嬮噺鏁版嵁瀵煎嚭</span> <!-- <button size="mini" class="funcBtn" type="primary" @click="navTo('export')">瀵煎嚭</button> --> </p> @@ -65,31 +65,31 @@ </span> </view> </view> - + </view> </template> <script> - import CustomNavbar from '@/pages/component/CustomNavbar.vue'; - import {formatNumber,formatDateThis,getUnixTime} from "../../common/dateUtil.js" - import {stringToBytes, showCustomModal, showCustomToast, commonStateCodeDeal} from "../../common/util.js" - // import { - // blueToothMixin - // } from '../../common/mixin.js' + import { + formatNumber, + formatDateThis, + getUnixTime + } from "../../common/dateUtil.js" + import { + stringToBytes, + showCustomModal, + showCustomToast, + commonStateCodeDeal + } from "../../common/util.js" + import * as XLSX from '@/common/excel.js' + import { + getExportData, + } from '../../api/home.js' + export default { - // mixins: [blueToothMixin], - onBackPress(options) { - // showCustomToast({ - // title: '褰撳墠椤典负鏈€鍚庝竴椤碉紝涓嶈兘缁х画杩斿洖浜�' - // }) - // return true - }, - components: { - CustomNavbar, - }, data() { return { - deviceInfo: {} + deviceInfo: {}, } }, /** @@ -97,39 +97,59 @@ */ onLoad: function(options) { uni.hideLoading() - // if(uni.getStorageSync('connected')){ - // this.gosend('POWER') - // }else{ - // this.initLink() - // }' }, onShow() { uni.hideLoading() }, - // watch:{ - // connected(newVal){ - // if(newVal){ // 宸茶繛鎺� - // this.gosend('POWER') - // } - // } - // }, mounted() { const deviceInfo = uni.getStorageSync('deviceInfo') - if(deviceInfo){ // 鑾峰彇钃濈墮璁惧鍨嬪彿id + if (deviceInfo) { // 鑾峰彇钃濈墮璁惧鍨嬪彿id this.deviceInfo = deviceInfo } uni.hideTabBar() }, - + methods: { - gosend(){ + async exportExcel() { // 瀵煎嚭excel + let res = await getExportData({ + }) + if (res) { + console.log('export', res) + const ExcelData = res; //鍒楄〃鏁版嵁 + this.loading = false + + const fileName='鐐瓟娴嬮噺鏁版嵁瀵煎嚭' + const header = ['productName', 'artilleryAreaName', 'cannonHoleArrayNum', 'cannonHoleNum', 'expectedDepth', + 'remark' + ]; + const headerName = { + productName: '宸ョ▼鍚嶇О', + artilleryAreaName: '鐖嗗尯鍚嶇О', + cannonHoleArrayNum: '鐐瓟鎺掑彿', + cannonHoleNum: '鐐瓟缂栧彿', + expectedDepth: '璁捐瀛旀繁', + remark: '澶囨敞' + }; + + showCustomToast({ + title: "瀵煎嚭涓紝璇风◢鍚�...", + duration: 3000, + }) + XLSX.excel_exprot(ExcelData, header, headerName, fileName) + }else{ + showCustomToast({ + title: '鏆傛棤鏁版嵁' + }) + } + }, + gosend() { var strbuf = new Uint8Array(stringToBytes('POWER')); var buffer1 = strbuf.buffer; - setTimeout(()=>{ + setTimeout(() => { uni.writeBLECharacteristicValue({ deviceId: 'C8:47:80:52:93:A2', serviceId: '0000FFE0-0000-1000-8000-00805F9B34FB', - characteristicId:'0000FFE1-0000-1000-8000-00805F9B34FB', + characteristicId: '0000FFE1-0000-1000-8000-00805F9B34FB', value: buffer1, success: (res) => { console.log('writeBLECharacteristicValue-success:res=>', res) @@ -137,36 +157,36 @@ fail: (res) => { console.log('writeBLECharacteristicValue-fail:res=>', res) // commonStateCodeDeal(res.errCode || res, 'gosend -> writeBLECharacteristicValue', - // this) + // this) }, }); }, 1000) }, - navTo(flag){ - if(flag === 'export'){ + navTo(flag) { + if (flag === 'export') { this.exportData2Excel() return } let url = '' - if(flag === 'login'){ + if (flag === 'login') { // url = 'test' url = '/pages/user/login' - }else if(flag === 'import'){ + } else if (flag === 'import') { url = '/pages/home/importFile' - }else if(flag === 'measureTest'){ + } else if (flag === 'measureTest') { url = '/pages/home/blueTest' - }else if(flag === 'measure'){ + } else if (flag === 'measure') { url = '/pages/home/blueMeasure' - }else if(flag === 'link'){ + } else if (flag === 'link') { url = '/pages/home/blueSearch' - }else if(flag === 'importFileDataPreview'){ + } else if (flag === 'importFileDataPreview') { url = '/pages/home/importFileDataPreview' - }else if(flag === 'paokongceliang'){ + } else if (flag === 'paokongceliang') { url = '/pages/home/paokongceliang' - }else if(flag === 'operateLog'){ + } else if (flag === 'operateLog') { url = '/pages/home/operateLog' } - + uni.navigateTo({ url }) @@ -175,142 +195,156 @@ } </script> <style lang="scss"> -.wrapper{ - width: 100vw; - height: calc(100vh-55rpx); - padding-top: 55rpx; - background: linear-gradient(180deg, #007AFF 0%, #419AFF 16%, #EFF1F4 43%); - position: relative; - .footer{ - // position: absolute; - // bottom: 10rpx; - width: 100%; - // padding-top: 200rpx; - // height: 10rpx; - // height: 120rpx; - // line-height: 120rpx; - text-align: center; - span{ - font-weight: 400; - font-size: 27rpx; - color: #A0A7AE; + .wrapper { + width: 100vw; + height: calc(100vh-55rpx); + padding-top: 55rpx; + background: linear-gradient(180deg, #007AFF 0%, #419AFF 16%, #EFF1F4 43%); + position: relative; + + .footer { + // position: absolute; + // bottom: 10rpx; + width: 100%; + // padding-top: 200rpx; + // height: 10rpx; + // height: 120rpx; + // line-height: 120rpx; + text-align: center; + + span { + font-weight: 400; + font-size: 27rpx; + color: #A0A7AE; + } } } -} -.body-wrapper{ - display: flex; - justify-content: center; - flex-direction: column; - align-items: center; - gap: 20rpx; - background-color: linear-gradient(180deg, #007AFF 0%, #419AFF 16%, #EFF1F4 43%); - padding-top: 50rpx; -} -.logo-wrapper{ - position: relative; - height: 300rpx; - display: flex; - justify-content: center; - flex-direction: column; - align-items: center; - gap: 50rpx; - font-family: Source Han Sans SC; - .logoImg{ - width: 454rpx; - height: 98rpx; - } - h3{ - color: #ffffff; - font-size: 37rpx; - font-weight: bold; + + .body-wrapper { + display: flex; + justify-content: center; + flex-direction: column; + align-items: center; + gap: 20rpx; + background-color: linear-gradient(180deg, #007AFF 0%, #419AFF 16%, #EFF1F4 43%); + padding-top: 50rpx; } -} -.link-info-wrapper{ - - width: 646rpx; - height: 300rpx; - background: url('/static/image/paokong/home-title-bg.png'); - // background-color: linear-gradient(-90deg, #F6F9FF 31%, #E4EFFF 100%); - background-position: center right; - background-size: cover; - box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(7,36,72,0.11); - border-radius: 10rpx; - border: 2px solid #FFFFFF; - display: flex; - align-items: center; - gap: 47rpx; - padding-left: 49rpx; - .left{ - image{ - width: 136rpx; - height: 136rpx; + .logo-wrapper { + position: relative; + height: 300rpx; + display: flex; + justify-content: center; + flex-direction: column; + align-items: center; + gap: 50rpx; + font-family: Source Han Sans SC; + + .logoImg { + width: 454rpx; + height: 98rpx; } - .link-status{ - font-family: Source Han Sans SC; + + h3 { + color: #ffffff; + font-size: 37rpx; font-weight: bold; - font-size: 30rpx; - color: #007AFF; - ::before{ - content: ''; - width: 12rpx; - height: 12rpx; - background: #007AFF; - border-radius: 50%; - } } } - .right{ - h2{ - font-size: 34rpx; - font-weight: bold; + + .link-info-wrapper { + + width: 646rpx; + height: 300rpx; + background: url('@/static/image/paokong/home-title-bg.png'); + // background-color: linear-gradient(-90deg, #F6F9FF 31%, #E4EFFF 100%); + background-position: center right; + background-size: cover; + box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(7, 36, 72, 0.11); + border-radius: 10rpx; + border: 2px solid #FFFFFF; + display: flex; + align-items: center; + gap: 47rpx; + padding-left: 49rpx; + + .left { + image { + width: 136rpx; + height: 136rpx; + } + + .link-status { + font-family: Source Han Sans SC; + font-weight: bold; + font-size: 30rpx; + color: #007AFF; + + ::before { + content: ''; + width: 12rpx; + height: 12rpx; + background: #007AFF; + border-radius: 50%; + } + } } - p{ - font-size: 30rpx; - // font-weight: bold; - color: #848484; - margin-top: 20rpx; + + .right { + h2 { + font-size: 34rpx; + font-weight: bold; + } + + p { + font-size: 30rpx; + // font-weight: bold; + color: #848484; + margin-top: 20rpx; + } } } -} -.list-item{ - width: 660rpx; - height: 140rpx; - // border-top: 1px solid rgba(187,187,187,1); - display: flex; - justify-content: flex-start; - align-items: center; - gap: 0px 30px; - padding: 10px; - background-color: #ffffff; - border-radius: 10rpx; - image{ - width: 102rpx; - height: 102rpx; - } - span{ - display: inline-block; - width: 420rpx; - font-family: PingFangSC-regular; - color: rgba(0,0,0,1); - font-size: 18px; - font-weight: bold; - } - .funcBtn{ - width: 120rpx; - height: 62rpx; - line-height: 62rpx; - background: #FFFFFF; - border-radius: 36rpx; - border: 2rpx solid #007AFF; - color: #007AFF; - padding: 0; - // font-size: 27rp; - font-family: Source Han Sans SC; - font-weight: bold; - + .list-item { + width: 660rpx; + height: 140rpx; + // border-top: 1px solid rgba(187,187,187,1); + display: flex; + justify-content: flex-start; + align-items: center; + gap: 0px 30px; + padding: 10px; + background-color: #ffffff; + border-radius: 10rpx; + + image { + width: 102rpx; + height: 102rpx; + } + + span { + display: inline-block; + width: 420rpx; + font-family: PingFangSC-regular; + color: rgba(0, 0, 0, 1); + font-size: 18px; + font-weight: bold; + } + + .funcBtn { + width: 120rpx; + height: 62rpx; + line-height: 62rpx; + background: #FFFFFF; + border-radius: 36rpx; + border: 2rpx solid #007AFF; + color: #007AFF; + padding: 0; + // font-size: 27rp; + font-family: Source Han Sans SC; + font-weight: bold; + + } } -} -</style> +</style> \ No newline at end of file diff --git a/static/image/paokong/impexp.png b/static/image/paokong/impexp.png new file mode 100644 index 0000000000000000000000000000000000000000..5a010257186249efdeb0d3af0ccff9071297fee1 GIT binary patch literal 1571 zcmV+;2Hg3HP)<h;3K|Lk000e1NJLTq002e+002e^1^@s6aW3M700009a7bBm000ie z000ie0hKEb8vp<W)k#D_RCt{2++T=XXBo%w&pA80Tf0eIf|~?4E!Y;)Zj%;K2}RKc zYzmgzKXHrTO|;M!O55As2n8>^5k*YFJM}^=Zq$ZCpozFD5skK>X<9q|6EB(-wlQI| zO>O?|j2G{0va^}lnK|#woRc+Q7#L>W^UU-9=KcGe=RL{n{6&2t!2~{oEw$IDFp7_3 zq*m@joW>mfg>vonD&9b~FV6N@nDuxN_h1J$M%tUjG!EiLoQky9lwJsv;9fkA`!Lw; zAE<Ew`|)EOK&6|;yD3Zw-@voDwOdBpq>S(4=jcj>x+Tm#_>nMf<VhJ%3oR&$H1hg! z{Icdq-l7nEcv<jibBv)FVIIU$OvX6SBPQ`09?EJUi!j4NxA~1Q)fSae{95pJxYLU} z9b?vGAHLA(59Q1up@pAp_kvDZ%x3(_)h7zU=R?An*cR;yvl)NT|7p0J+=@SHb5L$a zm@)hoH$^yA6mAmgGS;eKD`AF&F{KDoaktolmxQ`CrIj$>!(H9-s6cEN>eiH%W~GO* zSJ?ZkR(1(f`V}-2W?WdjjrPu`LNJG|m|6Zsv##`gt6vmC9e>d1i$=oi#3Q}*reI78 zVUjwQccm1sySmpaSttw9#Y-`r(y{`RB1PH%R^oTZ5@-7qG2Jl21GiP(xhX2*xkczD zFD!nrw8bR&JMPG0`Ga#jdm!~vIdQIUVdTK*bv%7n#gp5k#Q6t4trk;WI>zjjQIrb{ zJU5-%`+EOHfw{AMXF4@?G-_pWrx0*My)e78T72hJ;)NsmE_bSU{&3>dM^R?Jx%g&L zn00s{tF_rPT<mHnIvf8yk$C@1)F1R!L5oYm?83*gTFayRG@}xC*Xep;#eYedoiWz> z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