From e13367edf304cb78f978e321f1679299a66b3a23 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 10 Jan 2024 16:08:18 +0800
Subject: [PATCH] fix:地图
---
uni_modules/uview-ui/components/u-text/value.js | 85 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/uni_modules/uview-ui/components/u-text/value.js b/uni_modules/uview-ui/components/u-text/value.js
new file mode 100644
index 0000000..9859bbb
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-text/value.js
@@ -0,0 +1,85 @@
+export default {
+ computed: {
+ // ������������������������������
+ value() {
+ const {
+ text,
+ mode,
+ format,
+ href
+ } = this
+ // ������������
+ if (mode === 'price') {
+ // ������text������������������������
+ if (!/^\d+(\.\d+)?$/.test(text)) {
+ uni.$u.error('������������������text���������������������������');
+ }
+ // ���������������������������������������format���������������������������������������������������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���������������������������������������')
+ // ���������������������������������������format���������������������������������������������������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('���������������������text���������������������������������')
+ if (uni.$u.test.func(format)) {
+ // ������������������������������������������������������
+ return format(text)
+ } if (format === 'encrypt') {
+ // ������format���encrypt������������������������������������������
+ 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���encrypt���������������������������������������
+ return this.formatName(text)
+ }
+ return text
+ } if (mode === 'link') {
+ // ������������������������������
+ !uni.$u.test.url(href) && uni.$u.error('���������������������href���������������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.8.0