From 9ab4955166b7b1370fc2a49b152353241ca9e64a Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期一, 16 十月 2023 09:22:23 +0800 Subject: [PATCH] 小程序 --- minipro_standard/uni_modules/uview-ui/components/u-text/value.js | 85 ------------------------------------------ 1 files changed, 0 insertions(+), 85 deletions(-) diff --git a/minipro_standard/uni_modules/uview-ui/components/u-text/value.js b/minipro_standard/uni_modules/uview-ui/components/u-text/value.js index 9859bbb..e69de29 100644 --- a/minipro_standard/uni_modules/uview-ui/components/u-text/value.js +++ b/minipro_standard/uni_modules/uview-ui/components/u-text/value.js @@ -1,85 +0,0 @@ -export default { - computed: { - // 缁忓鐞嗗悗闇�瑕佹樉绀虹殑鍊� - value() { - const { - text, - mode, - format, - href - } = this - // 浠锋牸绫诲瀷 - if (mode === 'price') { - // 濡傛灉text涓嶄负閲戦杩涜鎻愮ず - if (!/^\d+(\.\d+)?$/.test(text)) { - uni.$u.error('閲戦妯″紡涓嬶紝text鍙傛暟闇�瑕佷负閲戦鏍煎紡'); - } - // 杩涜鏍煎紡鍖栵紝鍒ゆ柇鐢ㄦ埛浼犲叆鐨刦ormat鍙傛暟涓烘鍒欙紝鎴栬�呭嚱鏁帮紝濡傛灉娌℃湁浼犲叆format锛屽垯浣跨敤榛樿鐨勯噾棰濇牸寮忓寲澶勭悊 - if (uni.$u.test.func(format)) { - // 濡傛灉鐢ㄦ埛浼犲叆鐨勬槸鍑芥暟锛屼娇鐢ㄥ嚱鏁版牸寮忓寲 - return format(text) - } - // 濡傛灉format闈炴鍒欙紝闈炲嚱鏁帮紝鍒欎娇鐢ㄩ粯璁ょ殑閲戦鏍煎紡鍖栨柟娉曡繘琛屾搷浣� - return uni.$u.priceFormat(text, 2) - } if (mode === 'date') { - // 鍒ゆ柇鏄惁鍚堟硶鐨勬棩鏈熸垨鑰呮椂闂存埑 - !uni.$u.test.date(text) && uni.$u.error('鏃ユ湡妯″紡涓嬶紝text鍙傛暟闇�瑕佷负鏃ユ湡鎴栨椂闂存埑鏍煎紡') - // 杩涜鏍煎紡鍖栵紝鍒ゆ柇鐢ㄦ埛浼犲叆鐨刦ormat鍙傛暟涓烘鍒欙紝鎴栬�呭嚱鏁帮紝濡傛灉娌℃湁浼犲叆format锛屽垯浣跨敤榛樿鐨勬牸寮忓寲澶勭悊 - if (uni.$u.test.func(format)) { - // 濡傛灉鐢ㄦ埛浼犲叆鐨勬槸鍑芥暟锛屼娇鐢ㄥ嚱鏁版牸寮忓寲 - return format(text) - } if (format) { - // 濡傛灉format闈炴鍒欙紝闈炲嚱鏁帮紝鍒欎娇鐢ㄩ粯璁ょ殑鏃堕棿鏍煎紡鍖栨柟娉曡繘琛屾搷浣� - return uni.$u.timeFormat(text, format) - } - // 濡傛灉娌℃湁璁剧疆format锛屽垯璁剧疆涓洪粯璁ょ殑鏃堕棿鏍煎紡鍖栧舰寮� - return uni.$u.timeFormat(text, 'yyyy-mm-dd') - } if (mode === 'phone') { - // 鍒ゆ柇鏄惁鍚堟硶鐨勬墜鏈哄彿 - // !uni.$u.test.mobile(text) && uni.$u.error('鎵嬫満鍙锋ā寮忎笅锛宼ext鍙傛暟闇�瑕佷负鎵嬫満鍙风爜鏍煎紡') - if (uni.$u.test.func(format)) { - // 濡傛灉鐢ㄦ埛浼犲叆鐨勬槸鍑芥暟锛屼娇鐢ㄥ嚱鏁版牸寮忓寲 - return format(text) - } if (format === 'encrypt') { - // 濡傛灉format涓篹ncrypt锛屽垯灏嗘墜鏈哄彿杩涜鏄熷彿鍔犲瘑澶勭悊 - return `${text.substr(0, 3)}****${text.substr(7)}` - } - return text - } if (mode === 'name') { - // 鍒ゆ柇鏄惁鍚堟硶鐨勫瓧绗︾矖 - !(typeof (text) === 'string') && uni.$u.error('濮撳悕妯″紡涓嬶紝text鍙傛暟闇�瑕佷负瀛楃涓叉牸寮�') - if (uni.$u.test.func(format)) { - // 濡傛灉鐢ㄦ埛浼犲叆鐨勬槸鍑芥暟锛屼娇鐢ㄥ嚱鏁版牸寮忓寲 - return format(text) - } if (format === 'encrypt') { - // 濡傛灉format涓篹ncrypt锛屽垯灏嗗鍚嶈繘琛屾槦鍙峰姞瀵嗗鐞� - return this.formatName(text) - } - return text - } if (mode === 'link') { - // 鍒ゆ柇鏄惁鍚堟硶鐨勫瓧绗︾矖 - !uni.$u.test.url(href) && uni.$u.error('瓒呴摼鎺ユā寮忎笅锛宧ref鍙傛暟闇�瑕佷负URL鏍煎紡') - return text - } - return text - } - }, - methods: { - // 榛樿鐨勫鍚嶈劚鏁忚鍒� - formatName(name) { - let value = '' - if (name.length === 2) { - value = name.substr(0, 1) + '*' - } else if (name.length > 2) { - let char = '' - for (let i = 0, len = name.length - 2; i < len; i++) { - char += '*' - } - value = name.substr(0, 1) + char + name.substr(-1, 1) - } else { - value = name - } - return value - } - } -} -- Gitblit v1.9.3