From 20de15fda80098199528953297c9a814945a3390 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Wed, 6 Jan 2021 14:22:22 +0800 Subject: [PATCH] no message --- app.js | 21 +++-- colorui/main.wxss | 2 +- components/vehicle-keyboard/index.js | 88 +++++++++++++++++++ components/vehicle-keyboard/index.json | 6 ++ components/vehicle-keyboard/index.wxml | 35 ++++++++ components/vehicle-keyboard/index.wxss | 113 +++++++++++++++++++++++++ pages/agent/edit/index.js | 13 +++ pages/agent/edit/index.json | 3 +- pages/agent/edit/index.wxml | 12 ++- project.config.json | 6 +- 10 files changed, 280 insertions(+), 19 deletions(-) create mode 100644 components/vehicle-keyboard/index.js create mode 100644 components/vehicle-keyboard/index.json create mode 100644 components/vehicle-keyboard/index.wxml create mode 100644 components/vehicle-keyboard/index.wxss diff --git a/app.js b/app.js index fbf3d08..4614058 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ //app.js - App({ +App({ //----------------------------------------------globalData-------------------------------------- - release: 1, + release: 0, httpUrl: 'https://api.qniao.cn', tmplIds: ['SUjEgwDopCv9xkkSZ4KbS0L7XbAiVQor6GmPg14K760'], agentMsgIds: ['kG8DErWDpyzBHCFaLlSKYMF7xVy8UpgogCwV_WSNt10', 'oLbv-IyJOia2tenh64_Lc8xeAzwgzu3gh1vFJ1Se-ME'], @@ -21,11 +21,10 @@ if (this.release) { this.httpUrl = 'https://api.qniao.cn' } else { - // this.httpUrl = 'http://47.113.118.47:9000' - this.httpUrl = 'https://api-test.qniao.cn' + this.httpUrl = 'http://47.113.118.47:9000' + // this.httpUrl = 'https://api-test.qniao.cn' } }, - // 获取高度 onShow: function(){ wx.getSystemInfo({ @@ -58,10 +57,10 @@ } return false }, - checkIPhoneX: function (e) { - var t = e.model, - o = e.platform; - return (/iPhone 11/.test(t) || /iPhone X/.test(t) || /iPhone 12/.test(t)) && 'ios' === o - } + checkIPhoneX: function (e) { + var t = e.model, + o = e.platform; + return (/iPhone 11/.test(t) || /iPhone X/.test(t) || /iPhone 12/.test(t)) && 'ios' === o + } - }) \ No newline at end of file +}) \ No newline at end of file diff --git a/colorui/main.wxss b/colorui/main.wxss index cc9da18..714714c 100644 --- a/colorui/main.wxss +++ b/colorui/main.wxss @@ -1162,7 +1162,7 @@ button.icon.lg { right: 0; bottom: 0; left: 0; - z-index: 100; + z-index: 60; opacity: 0; outline: 0; text-align: center; diff --git a/components/vehicle-keyboard/index.js b/components/vehicle-keyboard/index.js new file mode 100644 index 0000000..dee965b --- /dev/null +++ b/components/vehicle-keyboard/index.js @@ -0,0 +1,88 @@ +Component({ + options: { + addGlobalClass: true, + }, + properties: { + plateNumber: { + type: Array, + value: ["", "", "", "", "", "", ""] + }, + safeBottom: { + type: Number, + value: 0 + } + }, + data: { + provinces: "京津沪冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤川青藏琼宁渝港澳台", + letters: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + numbers: "0123456789", + visible: false, + activeIndex: -1, + type: 0, + disabled: true, + mode: 0 // 键盘模式 0 关闭状态 1 显示省份输入 2 显示数字和字母输入 + }, + lifetimes: { + attached: function () { + + }, + }, + methods: { + show: function (number, type) { + if(number && number.length){ + this.data.plateNumber = number.split('') + } + this.data.type = type + this.updateNumber() + this.setData({ plateNumber: this.data.plateNumber, mode: 1, activeIndex: 0, visible: true}) + }, + hide: function () { + this.setData({visible: false, plateNumber: ["", "", "", "", "", "", ""]}) + this.triggerEvent("change", null) + }, + updateNumber: function(){ + this.data.disabled = false + for (let index = 0; index < this.data.plateNumber.length; index++) { + const element = this.data.plateNumber[index] + if(element.length == 0){ + this.data.disabled = true + break + } + } + this.setData({disabled: this.data.disabled, plateNumber: this.data.plateNumber}) + }, + inputKeyboard: function(e){ + let index = typeof e === 'number' ? e : e.currentTarget.dataset.index + if(e.currentTarget && this.data.plateNumber[index].length == 0){ + return + } + this.setData({ mode: index == 0 ? 1 : 2, activeIndex: index }) + }, + tapDelete: function(e){ + let activeIndex = this.data.activeIndex + this.data.plateNumber[activeIndex] = '' + this.updateNumber() + if (activeIndex > 0) { + this.inputKeyboard(--activeIndex) + } + }, + tapFinish: function(){ + if(this.data.disabled){ + return + } + this.setData({visible: false, activeIndex: -1 }) + this.triggerEvent("change", {plateNumber: this.data.plateNumber.join(''), type: this.data.type}) + }, + tapKeyboard: function(e){ + let val = e.currentTarget.dataset.val + let activeIndex = this.data.activeIndex + this.data.plateNumber[activeIndex] = val + this.updateNumber() + if (activeIndex < 6) { + this.inputKeyboard(++activeIndex) + } else { + this.tapFinish() + } + }, + } +}) \ No newline at end of file diff --git a/components/vehicle-keyboard/index.json b/components/vehicle-keyboard/index.json new file mode 100644 index 0000000..8d120df --- /dev/null +++ b/components/vehicle-keyboard/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "wux-popup": "../popup/index" + } +} \ No newline at end of file diff --git a/components/vehicle-keyboard/index.wxml b/components/vehicle-keyboard/index.wxml new file mode 100644 index 0000000..c78dbd8 --- /dev/null +++ b/components/vehicle-keyboard/index.wxml @@ -0,0 +1,35 @@ + + + {{plateNumber[0]}} + {{plateNumber[1]}} + + {{plateNumber[2]}} + {{plateNumber[3]}} + {{plateNumber[4]}} + {{plateNumber[5]}} + {{plateNumber[6]}} + + + + + + + + + + + 确定 + + + + \ No newline at end of file diff --git a/components/vehicle-keyboard/index.wxss b/components/vehicle-keyboard/index.wxss new file mode 100644 index 0000000..bd5c8ac --- /dev/null +++ b/components/vehicle-keyboard/index.wxss @@ -0,0 +1,113 @@ + +.license-number .item { + width: 64rpx; + height: 72rpx; + line-height: 72rpx; + text-align: center; + border: 1rpx solid #999590; + border-radius: 8rpx; + display: flex; + font-size: 28rpx; + align-items: center; + justify-content: center; +} +.license-number .item.item-new-energy { + line-height: 1em; + display: flex; + align-items: center; + border: 1rpx dashed #999590; +} +.license-number .item.item-new-energy .ico { + line-height: 1em; + font-size: 36rpx; + margin-bottom: -5rpx; + color: #777; +} +.license-number .item.item-new-energy .tit { + font-size: 12px; + transform: scale(0.7); + color: #777; +} + +.license-number .item.active { + border: 1rpx solid #008AFF; + color:#008AFF; +} + +.license-number .item.item-dot { + border: none; + width: auto; + padding: 0 6rpx; +} +.license-number .item.item-dot .dot { + width: 12rpx; + height: 12rpx; + background: #a09c96; + border-radius: 10rpx; +} + +.kb-keyboard { + padding: 6rpx; + position: relative; +} +.flex-brick { + display: flex; + flex-flow: row wrap; +} +.kb-keyboard-action { + display: flex; + justify-content: space-between; + position: absolute; + bottom: 6rpx; + right: 6rpx; +} +.kb-keyboard_td { + color: #1e1e1e; + box-shadow: 1rpx 1rpx 1rpx #919191; + background: #fff; + display: flex; + align-items: center; + justify-content: center; + width: calc((100vw - 12rpx) / 10 - 12rpx); + font-size: 18px; + height: 48px; + margin: 6rpx; + border-radius:5px; +} + +.kb-keyboard_td.disabled { + opacity: 0.5; + pointer-events: none; +} + +.kb-keyboard_td:active { + background: #f2f2f2; +} +.kb-keyboard__del { + align-self: flex-end; + width: calc(((100vw - 12rpx) / 10 - 12rpx) * 1.8); + height: 48px; + display: flex; + justify-content: center; + align-items: center; + padding-right: 1rpx; +} +.kb-keyboard__del .ico-del { + width: 44rpx; + height: 30rpx; + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAeCAMAAABg6AyVAAAAclBMVEUAAAAwMDAxMTEMDAwpKSkpKSkwMDAqKioxMTExMTEpKSkqKiokJCQpKSkpKSkqKioqKioqKioqKioqKiopKSkoKCgoKCgnJycqKioqKioqKioqKioqKioqKioqKiorKysrKysoKCgqKioAAAAlJSUqKipvWYGQAAAAJXRSTlMA/lcC+OyZhmk+lioH8OXd1MlOPzQZDCDcvr2ysaWjajsTEgEiwq/YugAAAM9JREFUOMud1McWgyAQBdABKxp7S+/v/38xDUPAY/DwNs7iLoQZhoycCswkiFY69RL8SaTbA/yaZnJGQD9Z7ZA1NBuAVPoNgpaW4UuFPKVluCuxHmgZHgqUnTxmHAqSEWHsTXCao7rKOmaM8U/Jn2Vs4jbAtieZkL30aFlo4CbDXrVHsLeWlgkd1z6O3teOiMsPaZj7SG5EE62swqkvm25qZRWOkNAkfLTu2P4bzge0X51rU+ztdh0kmbtlRC3D7/Cs3B+s6yqwLxnX9WVfjA8P3SLCPZZ7QgAAAABJRU5ErkJggg==); + background-size: 100% 100%; +} +.kb-keyboard__finished { + width: calc(((100vw - 12rpx) / 10 - 12rpx) * 1.8); +} + + +@keyframes breath { + from { + border-color:rgba(11, 245, 183, 0.3); + } + 40% { border-color: #0bf5b7c2; } + 60% { border-color: #0bf5b7c2; } + to { border-color: rgba(11, 245, 183, 0.3); } +} \ No newline at end of file diff --git a/pages/agent/edit/index.js b/pages/agent/edit/index.js index 31e9c2b..6694ed6 100644 --- a/pages/agent/edit/index.js +++ b/pages/agent/edit/index.js @@ -152,6 +152,19 @@ Page({ var form_data = 'form.' + event.target.id this.setData({ [form_data]: event.detail.value }) }, + showKeyboard: function(e){ + var item = this.data.vehicleList[e.currentTarget.dataset.index] + this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard') + this.setData({ picking: true }) + this.keyboard.show(item.plateNumber, e.currentTarget.dataset.index) + }, + onPlatenumber: function({detail}){ + if(detail && detail.plateNumber){ + this.setData({ ['vehicleList[' + detail.type + '].plateNumber']: detail.plateNumber, picking: false }) + } else { + this.setData({ picking: false }) + } + }, addCate: function (e) { if(this.data.vehicleList.length >= 5){ util.showToast('一次预约不能超过5辆车') diff --git a/pages/agent/edit/index.json b/pages/agent/edit/index.json index a328391..dd8a87a 100644 --- a/pages/agent/edit/index.json +++ b/pages/agent/edit/index.json @@ -5,6 +5,7 @@ "picker-view": "/components/picker-view/index", "wux-divider": "/components/divider/index", "wux-tag": "/components/tag/index", - "wux-button": "/components/button/index" + "wux-button": "/components/button/index", + "vehicle-keyboard": "/components/vehicle-keyboard/index" } } \ No newline at end of file diff --git a/pages/agent/edit/index.wxml b/pages/agent/edit/index.wxml index 184dc58..84797dd 100644 --- a/pages/agent/edit/index.wxml +++ b/pages/agent/edit/index.wxml @@ -66,9 +66,11 @@ 货车车牌{{index + 1}}: - - + {{item.plateNumber||'点击输入车牌号码'}} + + @@ -95,4 +97,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/project.config.json b/project.config.json index 082d8bf..386bf7f 100644 --- a/project.config.json +++ b/project.config.json @@ -21,13 +21,14 @@ "checkSiteMap": true, "uploadWithSourceMap": true, "compileHotReLoad": false, - "useMultiFrameRuntime": false, + "useMultiFrameRuntime": true, "useApiHook": true, "babelSetting": { "ignore": [], "disablePlugins": [], "outputPath": "" }, + "enableEngineNative": false, "bundle": false, "useIsolateContext": true, "useCompilerModule": true, @@ -35,7 +36,8 @@ "userConfirmedBundleSwitch": false, "packNpmManually": false, "packNpmRelationList": [], - "minifyWXSS": true + "minifyWXSS": true, + "useApiHostProcess": true }, "compileType": "miniprogram", "libVersion": "2.13.1",