From a31135b4d9cb77a88c7f59cf4deeff508ca2e8f9 Mon Sep 17 00:00:00 2001 From: Enzo <1284707383@qq.com> Date: Mon, 21 Jun 2021 18:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- colorui/main.css | 2 +- components/amount/DINPro-Medium.ttf | Bin 0 -> 2588 bytes components/amount/_util/animate.js | 220 ++++++++++++++++++ components/amount/_util/dom.js | 22 ++ components/amount/_util/env.js | 18 ++ components/amount/_util/formate-value.js | 76 ++++++ components/amount/_util/index.js | 2 + components/amount/index.vue | 139 +++++++++++ components/amount/number-capital.js | 110 +++++++++ components/me-tabs/me-tabs.vue | 24 +- .../my-uni-modal-bottom.vue | 52 +++++ components/my-uni-modal/my-uni-modal.vue | 70 ++++++ main.js | 6 +- pages.json | 6 +- pages/order/index.vue | 105 +++++---- pages/order/order-item.vue | 162 +++++++++++++ project.config.json | 68 ++++++ 17 files changed, 1031 insertions(+), 51 deletions(-) create mode 100644 components/amount/DINPro-Medium.ttf create mode 100644 components/amount/_util/animate.js create mode 100644 components/amount/_util/dom.js create mode 100644 components/amount/_util/env.js create mode 100644 components/amount/_util/formate-value.js create mode 100644 components/amount/_util/index.js create mode 100644 components/amount/index.vue create mode 100644 components/amount/number-capital.js create mode 100644 components/my-uni-modal-bottom/my-uni-modal-bottom.vue create mode 100644 components/my-uni-modal/my-uni-modal.vue create mode 100644 pages/order/order-item.vue create mode 100644 project.config.json diff --git a/colorui/main.css b/colorui/main.css index 539e6f0..9875069 100644 --- a/colorui/main.css +++ b/colorui/main.css @@ -3469,7 +3469,7 @@ scroll-view.cu-steps .cu-item { } .bg-orange { - background-color: #f37b1d; + background-color: #FE9903; color: #ffffff; } diff --git a/components/amount/DINPro-Medium.ttf b/components/amount/DINPro-Medium.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2607a134bd42aac9fa566b9e2ead889339deaccd GIT binary patch literal 2588 zcmds3O>7%Q6n<~ku@lE}vP~S@vAtgJCb5%PNo;4mvDZzLLW@*rNn5E>+N6n<9}=3x zZQ?fNCx`!~muF-f7YB7kisgGf?Xi#T0_3%dK;YDF#%^G4jCa{j>E7Jhs!j^V+X-!YRM+Y=kqtXHU^In z$F+iB1M&$f>0#8zp%XIYvPE^5%jM6@m&=!|StO>#?Pm9%KS&D;whFtWvdURa`Tn0Y z1`6dO$yO+n4gg(@h|!d&Dp>dPxpTl)?j2Cr6vc`#SkA*LEb;t%HC0?)+Ipt+1DDh2 zd06IhT~j^hmtlFCgWXrYi{G%XVGA?^vy8HENUDiF#F5m4 zzqnW~H#B4zf?ya!L%E#07z(74fnYF@Oa($0v2R>YBc}E7()$)Q&C;@rD9dTws)soh z);Tl?$LTZ6t^(oQBB~CLF5>LWOD_St`c!fG-YHXOfOM{tj}qx1ilawO7UDFio>hSqk#yC7= z`jIwJcMDnHyf4%e&a|YiJDfRoDou3qMW&TK2$#?J>G+Noz6yNG=M0D7_?)rLP!rx?{W-eFA8;kX%TU-25m&}=|v{k zF;jY{D;|$eWiyCI?g;CTD2PhLFsN76>w39wWnNwF5cADNLGK4jz= zHu;;QR7b48Z!Ev9-#uHc$XZV%g1oXcS*dn8rBI?f6haJzx)UMEdC6#R_j;ny>@ctW zbb2@&je5N8?fsLy;&lCSmQi@jN>7iXBC1Lk?&6h-l9WhN>0(%F;Wb2(iomYYn8q0kldO>+%NmTC*of}a9GhB~2}%!nN|>Z1$;q}H%$O)lVE>IoTr^~jrg@2 zhY!%awfl=HbgDLE$y|w#tT!8;00q4;h#?pxtv))X2B3rX-2lZuKzA5rfm#Eh9EVwW z2F{=z6?_uU;$`+Ad%;|>hVEp33vS+AbR+W!xIa$w%W1lNiCdEk5P&+1wvn{MqATbe z)GV57? { + /* istanbul ignore next */ + const time = + Date.now || + (() => { + return +new Date() + }) + const desiredFrames = 60 + const millisecondsPerSecond = 1000 + + let running = {} + let counter = 1 + + return { + /** + * A requestAnimationFrame wrapper / polyfill. + * + * @param callback {Function} The callback to be invoked before the next repaint. + * @param root {HTMLElement} The root element for the repaint + */ + requestAnimationFrame: (() => { + // Check for request animation Frame support + const requestFrame = + global.requestAnimationFrame || + global.webkitRequestAnimationFrame || + global.mozRequestAnimationFrame || + global.oRequestAnimationFrame + let isNative = !!requestFrame + + if (requestFrame && !/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(requestFrame.toString())) { + isNative = false + } + + if (isNative) { + return (callback, root) => { + requestFrame(callback, root) + } + } + + const TARGET_FPS = 60 + let requests = {} + let requestCount = 0 + let rafHandle = 1 + let intervalHandle = null + let lastActive = +new Date() + + return callback => { + const callbackHandle = rafHandle++ + + // Store callback + requests[callbackHandle] = callback + requestCount++ + + // Create timeout at first request + if (intervalHandle === null) { + intervalHandle = setInterval(() => { + const time = +new Date() + const currentRequests = requests + + // Reset data structure before executing callbacks + requests = {} + requestCount = 0 + + for (const key in currentRequests) { + if (currentRequests.hasOwnProperty(key)) { + currentRequests[key](time) + lastActive = time + } + } + + // Disable the timeout when nothing happens for a certain + // period of time + if (time - lastActive > 2500) { + clearInterval(intervalHandle) + intervalHandle = null + } + }, 1000 / TARGET_FPS) + } + + return callbackHandle + } + })(), + + /** + * Stops the given animation. + * + * @param id {Integer} Unique animation ID + * @return {Boolean} Whether the animation was stopped (aka, was running before) + */ + stop(id) { + const cleared = running[id] != null + cleared && (running[id] = null) + return cleared + }, + + /** + * Whether the given animation is still running. + * + * @param id {Integer} Unique animation ID + * @return {Boolean} Whether the animation is still running + */ + isRunning(id) { + return running[id] != null + }, + + /** + * Start the animation. + * + * @param stepCallback {Function} Pointer to function which is executed on every step. + * Signature of the method should be `function(percent, now, virtual) { return continueWithAnimation; }` + * @param verifyCallback {Function} Executed before every animation step. + * Signature of the method should be `function() { return continueWithAnimation; }` + * @param completedCallback {Function} + * Signature of the method should be `function(droppedFrames, finishedAnimation) {}` + * @param duration {Integer} Milliseconds to run the animation + * @param easingMethod {Function} Pointer to easing function + * Signature of the method should be `function(percent) { return modifiedValue; }` + * @param root {Element ? document.body} Render root, when available. Used for internal + * usage of requestAnimationFrame. + * @return {Integer} Identifier of animation. Can be used to stop it any time. + */ + start(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) { + const start = time() + let lastFrame = start + let percent = 0 + let dropCounter = 0 + const id = counter++ + + if (!root) { + // root = document.body + } + + // Compacting running db automatically every few new animations + if (id % 20 === 0) { + const newRunning = {} + for (const usedId in running) { + newRunning[usedId] = true + } + running = newRunning + } + + // This is the internal step method which is called every few milliseconds + const step = virtual => { + // Normalize virtual value + const render = virtual !== true + + // Get current time + const now = time() + + // Verification is executed before next animation step + if (!running[id] || (verifyCallback && !verifyCallback(id))) { + running[id] = null + completedCallback && + completedCallback(desiredFrames - dropCounter / ((now - start) / millisecondsPerSecond), id, false) + return + } + + // For the current rendering to apply let's update omitted steps in memory. + // This is important to bring internal state variables up-to-date with progress in time. + if (render) { + const droppedFrames = Math.round((now - lastFrame) / (millisecondsPerSecond / desiredFrames)) - 1 + for (let j = 0; j < Math.min(droppedFrames, 4); j++) { + step(true) + dropCounter++ + } + } + + // Compute percent value + if (duration) { + percent = (now - start) / duration + if (percent > 1) { + percent = 1 + } + } + + // Execute step callback, then... + let value = easingMethod ? easingMethod(percent) : percent + value = isNaN(value) ? 0 : value + if ((stepCallback(value, now, render) === false || percent === 1) && render) { + running[id] = null + completedCallback && + completedCallback( + desiredFrames - dropCounter / ((now - start) / millisecondsPerSecond), + id, + percent === 1 || duration == null, + ) + } else if (render) { + lastFrame = now + this.requestAnimationFrame(step, root) + } + } + + // Mark as running + running[id] = true + + // Init first step + this.requestAnimationFrame(step, root) + + // Return unique animation ID + return id + }, + } +})(root) + +export const easeOutCubic = pos => { + return Math.pow(pos - 1, 3) + 1 +} + +export const easeInOutCubic = pos => { + if ((pos /= 0.5) < 1) { + return 0.5 * Math.pow(pos, 3) + } + + return 0.5 * (Math.pow(pos - 2, 3) + 2) +} + +export default Animate diff --git a/components/amount/_util/dom.js b/components/amount/_util/dom.js new file mode 100644 index 0000000..87f687f --- /dev/null +++ b/components/amount/_util/dom.js @@ -0,0 +1,22 @@ +import {inBrowser} from './env' + +class Dom { + appendChild() {} + removeChild() {} + querySelector() {} + addEventListener() {} + removeEventListener() {} +} + +const dom = new Dom() +let mdDocument = dom +let mdBody = dom + +mdDocument.body = mdBody + +if (inBrowser) { + // mdDocument = window.document + // mdBody = document.body +} + +export {mdDocument, mdBody, dom} diff --git a/components/amount/_util/env.js b/components/amount/_util/env.js new file mode 100644 index 0000000..c6c175c --- /dev/null +++ b/components/amount/_util/env.js @@ -0,0 +1,18 @@ +import Vue from 'vue' + +// Development environment +export const isProd = process.env.NODE_ENV === 'production' + +// Browser environment sniffing +export const inBrowser = !Vue.prototype.$isServer +export const UA = inBrowser +export const isAndroid = UA +export const isIOS = UA +export const root = typeof window !== 'undefined' ? window : global + + +// export const inBrowser = !Vue.prototype.$isServer || typeof window !== 'undefined' +// export const UA = inBrowser && window.navigator.userAgent.toLowerCase() +// export const isAndroid = UA && UA.indexOf('android') > 0 +// export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) +// export const root = typeof window !== 'undefined' ? window : global \ No newline at end of file diff --git a/components/amount/_util/formate-value.js b/components/amount/_util/formate-value.js new file mode 100644 index 0000000..1491592 --- /dev/null +++ b/components/amount/_util/formate-value.js @@ -0,0 +1,76 @@ +export function formatValueByGapRule(gapRule, value, gap = ' ', range, isAdd = 1) { + const arr = value ? value.split('') : [] + let showValue = '' + const rule = [] + gapRule.split('|').some((n, j) => { + rule[j] = +n + (rule[j - 1] ? +rule[j - 1] : 0) + }) + let j = 0 + arr.some((n, i) => { + // Remove the excess part + if (i > rule[rule.length - 1] - 1) { + return + } + if (i > 0 && i === rule[j]) { + showValue = showValue + gap + n + j++ + } else { + showValue = showValue + '' + n + } + }) + let adapt = 0 + rule.some((n, j) => { + if (range === +n + 1 + j) { + adapt = 1 * isAdd + } + }) + range = typeof range !== 'undefined' ? (range === 0 ? 0 : range + adapt) : showValue.length + return {value: showValue, range: range} +} + +export function formatValueByGapStep(step, value, gap = ' ', direction = 'right', range, isAdd = 1, oldValue = '') { + if (value.length === 0) { + return {value, range} + } + + const arr = value && value.split('') + let _range = range + let showValue = '' + + if (direction === 'right') { + for (let j = arr.length - 1, k = 0; j >= 0; j--, k++) { + const m = arr[j] + showValue = k > 0 && k % step === 0 ? m + gap + showValue : m + '' + showValue + } + if (isAdd === 1) { + // 在添加的情况下,如果添加前字符串的长度减去新的字符串的长度为2,说明多了一个间隔符,需要调整range + if (oldValue.length - showValue.length === -2) { + _range = range + 1 + } + } else { + // 在删除情况下,如果删除前字符串的长度减去新的字符串的长度为2,说明少了一个间隔符,需要调整range + if (oldValue.length - showValue.length === 2) { + _range = range - 1 + } + // 删除到最开始,range 保持 0 + if (_range <= 0) { + _range = 0 + } + } + } else { + arr.some((n, i) => { + showValue = i > 0 && i % step === 0 ? showValue + gap + n : showValue + '' + n + }) + const adapt = range % (step + 1) === 0 ? 1 * isAdd : 0 + _range = typeof range !== 'undefined' ? (range === 0 ? 0 : range + adapt) : showValue.length + } + + return {value: showValue, range: _range} +} + +export function trimValue(value, gap = ' ') { + value = typeof value === 'undefined' ? '' : value + const reg = new RegExp(gap, 'g') + value = value.toString().replace(reg, '') + return value +} diff --git a/components/amount/_util/index.js b/components/amount/_util/index.js new file mode 100644 index 0000000..9451c18 --- /dev/null +++ b/components/amount/_util/index.js @@ -0,0 +1,2 @@ +export * from './env' +export * from './dom' diff --git a/components/amount/index.vue b/components/amount/index.vue new file mode 100644 index 0000000..a167f96 --- /dev/null +++ b/components/amount/index.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/components/amount/number-capital.js b/components/amount/number-capital.js new file mode 100644 index 0000000..e473f73 --- /dev/null +++ b/components/amount/number-capital.js @@ -0,0 +1,110 @@ +const cnNums = ['\u96f6', '\u58f9', '\u8d30', '\u53c1', '\u8086', '\u4f0d', '\u9646', '\u67d2', '\u634c', '\u7396'] + +// 拾 \u62fe 佰 \u4f70 仟 \u4edf +const cnIntRadice = ['', '\u62fe', '\u4f70', '\u4edf'] + +// 万 \u4e07 亿 \u4ebf 兆 \u5146 +const cnIntUnits = ['', '\u4e07', '\u4ebf', '兆'] + +// 角 \u89d2 分 \u5206 毫 \u6beb 厘 \u5398 +const cnDecUnits = ['\u89d2', '\u5206', '\u6beb', '\u5398'] +const cnInteger = '\u6574' // 整 \u6574 +const cnIntLast = '\u5143' // 元 \u5143 + +const cnNegative = '\u8d1f' // 负 + +// Maximum number +const maxNum = 999999999999999.9999 + +export default function(number) { + let negative + // Integral part + let integerNum + // Decimal part + let decimalNum + // Capital number + let capitalStr = '' + + let parts + + /* istanbul ignore if */ + if (number === '') { + return '' + } + + number = parseFloat(number) + + if (number < 0) { + negative = true + number = Math.abs(number) + } + + /* istanbul ignore if */ + if (number >= maxNum) { + return '' + } + + /* istanbul ignore if */ + if (number === 0) { + capitalStr = cnNums[0] + cnIntLast + cnInteger + return capitalStr + } + + // Convert to String + number += '' + + if (number.indexOf('.') === -1) { + integerNum = number + decimalNum = '' + } else { + parts = number.split('.') + integerNum = parts[0] + decimalNum = parts[1].substr(0, 4) + } + + // Convert integer part + if (parseInt(integerNum, 10) > 0) { + let zeroCount = 0 + for (let i = 0, IntLen = integerNum.length; i < IntLen; i++) { + const n = integerNum.substr(i, 1) + const p = IntLen - i - 1 + const q = p / 4 + const m = p % 4 + if (n === '0') { + zeroCount++ + } else { + if (zeroCount > 0) { + capitalStr += cnNums[0] + } + zeroCount = 0 + capitalStr += cnNums[parseInt(n)] + cnIntRadice[m] + } + if (m === 0 && zeroCount < 4) { + capitalStr += cnIntUnits[q] + } + } + capitalStr += cnIntLast + } + + // Convert decimal part + if (decimalNum !== '') { + for (let i = 0, decLen = decimalNum.length; i < decLen; i++) { + const n = decimalNum.substr(i, 1) + if (n !== '0') { + capitalStr += cnNums[Number(n)] + cnDecUnits[i] + } + } + } + + /* istanbul ignore if */ + if (capitalStr === '') { + capitalStr += cnNums[0] + cnIntLast + cnInteger + } else if (decimalNum === '') { + capitalStr += cnInteger + } + + if (negative) { + capitalStr = `${cnNegative}${capitalStr}` + } + return capitalStr +} diff --git a/components/me-tabs/me-tabs.vue b/components/me-tabs/me-tabs.vue index fbe228d..1d325ab 100644 --- a/components/me-tabs/me-tabs.vue +++ b/components/me-tabs/me-tabs.vue @@ -5,7 +5,7 @@ :scroll-animation-duration="300"> - {{getTabName(tab)}} @@ -37,7 +37,7 @@ tabWidth: Number, // 每个tab的宽度,默认不设置值,为flex平均分配; 如果指定宽度,则不使用flex,每个tab居左,超过则水平滑动(单位默认rpx) height: { // 高度,单位rpx type: Number, - default: 64 + default: 62 } }, data() { @@ -53,9 +53,15 @@ tabHeightPx() { return uni.upx2px(this.height) }, + tabHeightPx1() { + return uni.upx2px(54) + }, tabHeightVal() { return this.tabHeightPx + 'px' }, + tabHeightVal1() { + return this.tabHeightPx1 + 'px' + }, tabWidthPx() { return uni.upx2px(this.tabWidth) }, @@ -130,6 +136,7 @@ position: relative; box-sizing: border-box; overflow-y: hidden; + background-color: #FE9903; // box-shadow: 0 0.06rem 0.3rem rgba(0, 0, 0, .1); &.tabs-fixed { @@ -137,6 +144,8 @@ } .tabs-item { + padding: 0 2px; + border-radius: 16px; display: flex; position: relative; white-space: nowrap; @@ -150,7 +159,7 @@ width: 100%; height: 1rpx; content: ''; - border-bottom: 1rpx solid rgba(255, 255, 255, 0.2); + // border-bottom: 1rpx solid rgba(255, 255, 255, 0.2); } .tab-item { @@ -158,10 +167,14 @@ position: relative; text-align: center; box-sizing: border-box; + color: white; &.active { // font-weight: bold; - color: red; + color: black; + background-color: white; + border-radius: 10px; + margin: 2px 0; } } } @@ -172,6 +185,7 @@ .tab-item { flex: 1; + background-color: #FE9903; } } @@ -192,7 +206,7 @@ transform: translateX(-50%); border-radius: 4rpx; transition: left .3s; - background: red; + // background: red; } } diff --git a/components/my-uni-modal-bottom/my-uni-modal-bottom.vue b/components/my-uni-modal-bottom/my-uni-modal-bottom.vue new file mode 100644 index 0000000..24fb338 --- /dev/null +++ b/components/my-uni-modal-bottom/my-uni-modal-bottom.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/components/my-uni-modal/my-uni-modal.vue b/components/my-uni-modal/my-uni-modal.vue new file mode 100644 index 0000000..e45216b --- /dev/null +++ b/components/my-uni-modal/my-uni-modal.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/main.js b/main.js index 436a2db..555bf2d 100644 --- a/main.js +++ b/main.js @@ -22,9 +22,9 @@ Vue.component('mescroll-body', MescrollBody) import Skeleton from './components/my-uni-skeleton/index.vue' Vue.component('skeleton', Skeleton) -// //金融数字 -// import aMount from './components/amount/index.vue' -// Vue.component('amount', aMount) +//金融数字 +import aMount from './components/amount/index.vue' +Vue.component('amount', aMount) //路由跳转 Vue.prototype.$routerGo = (obj) => { diff --git a/pages.json b/pages.json index ddb8cb3..80293dc 100644 --- a/pages.json +++ b/pages.json @@ -12,7 +12,7 @@ { "path": "pages/order/index", "style": { - "navigationBarTitleText": "订单" + "navigationBarTitleText": "我的订单" } }, { @@ -25,8 +25,8 @@ "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uView", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" + "navigationBarBackgroundColor": "#fff", + "backgroundColor": "#fff" }, "tabBar": { "color": "#909399", diff --git a/pages/order/index.vue b/pages/order/index.vue index abb1f96..dbf8723 100644 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -1,58 +1,85 @@ - diff --git a/pages/order/order-item.vue b/pages/order/order-item.vue new file mode 100644 index 0000000..3d47e6d --- /dev/null +++ b/pages/order/order-item.vue @@ -0,0 +1,162 @@ + + + + + diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..bb011a2 --- /dev/null +++ b/project.config.json @@ -0,0 +1,68 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": false, + "useCompilerModule": true, + "userConfirmedUseCompilerModuleSwitch": false, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true + }, + "compileType": "miniprogram", + "libVersion": "2.17.3", + "appid": "wx8f7c9e12f8fb8c14", + "projectname": "miniprogram-1", + "debugOptions": { + "hidedInDevtools": [] + }, + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + } +} \ No newline at end of file