gxxc-util 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ var author = require('./modules/author.js');
4
+ var cityOptions = require('./modules/cityOptions.js');
5
+ var color = require('./modules/color.js');
6
+ var demo = require('./modules/demo.js');
7
+ var file = require('./modules/file.js');
8
+ var number = require('./modules/number.js');
9
+ var other = require('./modules/other.js');
10
+ var validation = require('./modules/validation.js');
11
+
12
+
13
+
14
+ exports.author_passwordCheck = author.author_passwordCheck;
15
+ exports.author_router_add = author.author_router_add;
16
+ exports.author_router_filter = author.author_router_filter;
17
+ exports.author_rsa = author.author_rsa;
18
+ exports.author_strict = author.author_strict;
19
+ exports.author_traceId = author.author_traceId;
20
+ exports.city_code_text = cityOptions.city_code_text;
21
+ exports.city_options = cityOptions.city_options;
22
+ exports.city_two_code_text = cityOptions.city_two_code_text;
23
+ exports.get_multiple_color = color.get_multiple_color;
24
+ exports.hex_to_rgb = color.hex_to_rgb;
25
+ exports.reduce_opacity = color.reduce_opacity;
26
+ exports.rgb_to_hex = color.rgb_to_hex;
27
+ exports.theme_change = color.theme_change;
28
+ exports.demo = demo.demo;
29
+ exports.file_calculate_md5 = file.file_calculate_md5;
30
+ exports.file_load = file.file_load;
31
+ exports.file_open = file.file_open;
32
+ exports.num_expand = number.num_expand;
33
+ exports.num_expand_100 = number.num_expand_100;
34
+ exports.num_reduce_100 = number.num_reduce_100;
35
+ exports.num_text = number.num_text;
36
+ exports.num_unit = number.num_unit;
37
+ exports.getOptionConfig = other.getOptionConfig;
38
+ exports.getUrlConfig = other.getUrlConfig;
39
+ exports.sys_detectBrowser = other.sys_detectBrowser;
40
+ exports.sys_print = other.sys_print;
41
+ exports.tem_compare_version = other.tem_compare_version;
42
+ exports.tem_get_tableHeader = other.tem_get_tableHeader;
43
+ exports.timejs = other.timejs;
44
+ exports.video_preview = other.video_preview;
45
+ exports.win_dynamic_fontSize = other.win_dynamic_fontSize;
46
+ exports.val_amount = validation.val_amount;
47
+ exports.val_beforeAfter_space = validation.val_beforeAfter_space;
48
+ exports.val_email = validation.val_email;
49
+ exports.val_idcard = validation.val_idcard;
50
+ exports.val_landline = validation.val_landline;
51
+ exports.val_number = validation.val_number;
52
+ exports.val_phone = validation.val_phone;
53
+ exports.val_space = validation.val_space;
54
+ exports.val_three_percent = validation.val_three_percent;
55
+ exports.val_two_percent = validation.val_two_percent;
@@ -0,0 +1,167 @@
1
+ 'use strict';
2
+
3
+ var uuid = require('uuid');
4
+ var JSEncrypt = require('jsencrypt');
5
+
6
+ /**
7
+ * 生成TraceId
8
+ * @param {string} origin 请求源(请求发起方)
9
+ * @param {string} url 请求url
10
+ * @returns - traceId,例如 "os-os-1d677771-4e85-460d-b669-682077a5067f"
11
+ */
12
+ const author_traceId = (origin, url) => {
13
+ const randomString = uuid.v4();
14
+ let traceId = randomString ?? "";
15
+ if (origin && url) {
16
+ if (url.includes("os_service")) {
17
+ traceId = `${origin}-os-${randomString}`;
18
+ }
19
+ if (url.includes("b_service")) {
20
+ traceId = `${origin}-b-${randomString}`;
21
+ }
22
+ if (url.includes("a_service")) {
23
+ traceId = `${origin}-a-${randomString}`;
24
+ }
25
+ if (url.includes("g_service")) {
26
+ traceId = `${origin}-g-${randomString}`;
27
+ }
28
+ if (url.includes("base_common")) {
29
+ traceId = `${origin}-base-${randomString}`;
30
+ }
31
+ if (url.includes("auth")) {
32
+ traceId = `${origin}-auth-${randomString}`;
33
+ }
34
+ }
35
+ return traceId;
36
+ };
37
+ /**
38
+ * 严格匹配当前按钮权限
39
+ * @param {ResourceItem[]} list 当前的页面权限
40
+ * @param {number} id 当前的按钮权限
41
+ * @returns {boolean} 是否存在该权限 true/false
42
+ */
43
+ const author_strict = (list, id) => {
44
+ let isShow = false;
45
+ isShow = list?.some((item) => item?.resourceId === id);
46
+ return isShow;
47
+ };
48
+ /**
49
+ * 计算密码强度,返回等级
50
+ * @param {string} str 当前密码
51
+ * @returns {number} 强度等级
52
+ */
53
+ const author_passwordCheck = (str) => {
54
+ let level = 0;
55
+ if (/\d/.test(str)) {
56
+ level = level + 1;
57
+ }
58
+ if (/[a-zA-Z]/.test(str)) {
59
+ level = level + 1;
60
+ }
61
+ if (/[^a-zA-Z0-9\s]/.test(str)) {
62
+ level = level + 1;
63
+ }
64
+ return level;
65
+ };
66
+ /**
67
+ * 处理接口的路由数据,将本地的路由信息补充进去
68
+ * 数据层面:既处理数据问题,也解决浏览器关于menuId,resourceList等字段驼峰大小写的警告
69
+ * 业务层面:处理的的数据存储到localstore中,便于系统使用
70
+ * @param {Array} origin 接口的路由信息
71
+ * @param {Array} local 本地的路由信息
72
+ * @returns {Array} 适配到项目的路由树
73
+ */
74
+ const author_router_filter = (origin, local) => {
75
+ return origin
76
+ ?.map((originItem) => {
77
+ const matchingItem = local?.find((targetItem) => targetItem?.menuid === originItem?.menuId);
78
+ if (matchingItem) {
79
+ const newItem = {
80
+ key: matchingItem?.key,
81
+ menuid: originItem?.menuId,
82
+ label: originItem?.label,
83
+ resourcelist: originItem?.resourceList,
84
+ children: originItem?.children,
85
+ };
86
+ if (!newItem?.children || newItem?.children?.length === 0) {
87
+ delete newItem?.children;
88
+ }
89
+ if (originItem?.children && originItem?.children?.length > 0) {
90
+ newItem.children = author_router_filter(originItem?.children, matchingItem?.children || []);
91
+ }
92
+ return newItem;
93
+ }
94
+ return null;
95
+ })
96
+ ?.filter(Boolean);
97
+ };
98
+ /**
99
+ * 处理缓存的路由数据,将本地的路由信息补充进去
100
+ * 数据层面:既处理数据问题,也将DOM元素打进当前函数
101
+ * 业务层面:可以在当前函数中使用DOM元素,用于渲染
102
+ * @param {Array} origin 接口的路由信息
103
+ * @param {Array} local 本地的路由信息
104
+ * @returns {Array} 用于渲染的路由树
105
+ */
106
+ const author_router_add = (origin, local) => {
107
+ return origin
108
+ ?.map((originItem) => {
109
+ const matchingItem = local?.find((localItem) => localItem?.menuid === originItem?.menuid);
110
+ if (matchingItem) {
111
+ originItem?.resourcelist?.forEach((i) => {
112
+ matchingItem?.resourcelist?.forEach((j) => {
113
+ if (i.resourceId === j.resourceId && !j.more) {
114
+ Object.assign(i, j);
115
+ }
116
+ });
117
+ });
118
+ // 处理后端 resourceId 返回相同情况
119
+ const a = matchingItem?.resourcelist?.filter((i) => i.more);
120
+ const b = a?.filter((i) => originItem?.resourcelist?.some((j) => i.resourceId === j.resourceId));
121
+ const c = b ? originItem?.resourcelist?.concat(b) : originItem?.resourcelist;
122
+ const newItem = { ...originItem, ...matchingItem, resourcelist: c };
123
+ if (originItem.children && originItem.children.length > 0) {
124
+ newItem.children = author_router_add(originItem?.children, matchingItem?.children || []);
125
+ }
126
+ return newItem;
127
+ }
128
+ return null;
129
+ })
130
+ ?.filter(Boolean);
131
+ };
132
+ // Base64 转二进制
133
+ const base64ToBinary = (base64) => {
134
+ const binaryString = atob(base64);
135
+ const bytes = new Uint8Array(binaryString.length);
136
+ for (let i = 0; i < binaryString.length; i++) {
137
+ bytes[i] = binaryString.charCodeAt(i);
138
+ }
139
+ return bytes;
140
+ };
141
+ // 二进制转 16 进制
142
+ const binaryToHex = (binary) => {
143
+ const hexArray = Array.from(binary).map((byte) => byte.toString(16).padStart(2, "0"));
144
+ return hexArray.join("");
145
+ };
146
+ /**
147
+ * RSA数据加密处理,用于密码加密传输
148
+ * @param {String} pubKey 公钥
149
+ * @param {String} password 密码
150
+ * @returns {String} 加密后的数据,吐出为十六进制
151
+ */
152
+ const author_rsa = (pubKey, password) => {
153
+ const jsEncrypt = new JSEncrypt();
154
+ jsEncrypt.setPublicKey(pubKey);
155
+ const result = jsEncrypt.encrypt(password);
156
+ // 进行转换
157
+ const binaryData = base64ToBinary(result);
158
+ const encryptedHex = binaryToHex(binaryData);
159
+ return encryptedHex;
160
+ };
161
+
162
+ exports.author_passwordCheck = author_passwordCheck;
163
+ exports.author_router_add = author_router_add;
164
+ exports.author_router_filter = author_router_filter;
165
+ exports.author_rsa = author_rsa;
166
+ exports.author_strict = author_strict;
167
+ exports.author_traceId = author_traceId;
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ var city = require('../constant/city.js');
4
+
5
+ /**
6
+ * 城市选择器
7
+ * <Cascader/> 组件内使用 options={cityOptions} 引入省市区
8
+ */
9
+ const city_options = (level = "three") => {
10
+ if (level === "three") {
11
+ return city.city_three;
12
+ }
13
+ else if (level === "two") {
14
+ return city.city_two;
15
+ }
16
+ else {
17
+ return city.city_three;
18
+ }
19
+ };
20
+ /**
21
+ * 编码转城市
22
+ */
23
+ const city_two_code_text = (provinceId, cityId) => {
24
+ let cityName = "";
25
+ if (provinceId) {
26
+ if (provinceId === "000000") {
27
+ cityName = "全国";
28
+ }
29
+ else {
30
+ city.city_two?.forEach((i) => {
31
+ if (i.value === provinceId) {
32
+ cityName = cityName + i.label;
33
+ i.children?.forEach((j) => {
34
+ if (j.value === `${provinceId}${cityId}`) {
35
+ cityName = cityName + j.label;
36
+ }
37
+ });
38
+ }
39
+ });
40
+ }
41
+ }
42
+ return cityName;
43
+ };
44
+ /**
45
+ * 编码转城市,默认三级
46
+ */
47
+ const city_code_text = (provinceId, cityId, districtId) => {
48
+ let cityName = "";
49
+ if (provinceId) {
50
+ if (provinceId === "000000") {
51
+ cityName = "全国";
52
+ }
53
+ else {
54
+ city.city_three?.forEach((i) => {
55
+ if (i.value === provinceId) {
56
+ cityName = cityName + i.label;
57
+ i.children?.forEach((j) => {
58
+ if (j.value === `${provinceId}${cityId}`) {
59
+ cityName = cityName + j.label;
60
+ j.children?.forEach((k) => {
61
+ if (k.value === `${provinceId}${cityId}${districtId}`) {
62
+ cityName = cityName + k.label;
63
+ }
64
+ });
65
+ }
66
+ });
67
+ }
68
+ });
69
+ }
70
+ }
71
+ return cityName;
72
+ };
73
+
74
+ exports.city_code_text = city_code_text;
75
+ exports.city_options = city_options;
76
+ exports.city_two_code_text = city_two_code_text;
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * 函数“hex_to_rgb”将十六进制颜色代码转换为 RGB 颜色数组。
5
+ * @param {string} hex - 十六进制颜色代码,例如“#FFA500”
6
+ * @returns 包含从输入提供的十六进制颜色代码转换而来的 RGB 值的数组。
7
+ */
8
+ const hex_to_rgb = (hex) => {
9
+ const r = Number.parseInt(hex.substring(1, 3), 16);
10
+ const g = Number.parseInt(hex.substring(3, 5), 16);
11
+ const b = Number.parseInt(hex.substring(5, 7), 16);
12
+ return [r, g, b];
13
+ };
14
+ /**
15
+ * 函数“reduce_opacity”将十六进制颜色透明度改变,得到同等规则下的颜色。
16
+ * @param rgb - RGB颜色代码,例如 [ 22, 34, 55 ]
17
+ * @returns - RGB颜色代码,例如 [ 69, 78, 95 ]
18
+ */
19
+ const reduce_opacity = (rgb, opacity) => {
20
+ const r = Math.round(rgb[0] + (255 - rgb[0]) * (1 - opacity));
21
+ const g = Math.round(rgb[1] + (255 - rgb[1]) * (1 - opacity));
22
+ const b = Math.round(rgb[2] + (255 - rgb[2]) * (1 - opacity));
23
+ return [r, g, b];
24
+ };
25
+ /**
26
+ * 该函数将 RGB 颜色数组转换为十六进制颜色代码。
27
+ * @param rgb - 参数 `rgb` 应该是一个数字数组,表示 RGB 颜色模型中颜色的红色、绿色和蓝色值。
28
+ * @returns 十六进制颜色代码。
29
+ */
30
+ const rgb_to_hex = (rgb) => {
31
+ const hexColor = rgb?.reduce((acc, value) => {
32
+ const hex = value?.toString(16)?.padStart(2, "0");
33
+ return acc + hex;
34
+ }, "#");
35
+ return hexColor;
36
+ };
37
+ /**
38
+ * 该函数将颜色转成一种颜色的多种透明度的
39
+ * @param value rgb或者十六进制
40
+ * @param {number} opacity 透明度
41
+ * @returns 十六进制颜色代码
42
+ */
43
+ const get_multiple_color = (value, opacity) => {
44
+ let rgb;
45
+ if (value === null) {
46
+ return "#feefcf";
47
+ }
48
+ if (value.startsWith("#")) {
49
+ rgb = hex_to_rgb(value);
50
+ }
51
+ else {
52
+ rgb = value.match(/\d+/g).map(Number);
53
+ }
54
+ const multipleColor = reduce_opacity(rgb, opacity);
55
+ const hexColor = rgb_to_hex(multipleColor);
56
+ return hexColor;
57
+ };
58
+ /**
59
+ * 该函数用于生成主题颜色。
60
+ * @param value - 主题颜色值
61
+ */
62
+ const theme_change = (value) => {
63
+ // 创建或获取样式元素
64
+ let styleEl = document.getElementById("theme-style");
65
+ if (!styleEl) {
66
+ styleEl = document.createElement("style");
67
+ styleEl.id = "theme-style";
68
+ document.head.appendChild(styleEl);
69
+ }
70
+ // 生成CSS变量
71
+ let cssText = ":root {\n";
72
+ cssText += ` --themeColor: ${value};\n`;
73
+ const steps = [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5];
74
+ steps.forEach((step) => {
75
+ const variableName = `--themeColor${step.toString().replace(".", "_")}`;
76
+ const colorValue = get_multiple_color(value, step / 10);
77
+ cssText += ` ${variableName}: ${colorValue};\n`;
78
+ });
79
+ cssText += "}";
80
+ // 更新样式表内容
81
+ styleEl.textContent = cssText;
82
+ };
83
+
84
+ exports.get_multiple_color = get_multiple_color;
85
+ exports.hex_to_rgb = hex_to_rgb;
86
+ exports.reduce_opacity = reduce_opacity;
87
+ exports.rgb_to_hex = rgb_to_hex;
88
+ exports.theme_change = theme_change;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * 函数“demo”将字符串“123”记录到控制台。
5
+ */
6
+ const demo = () => {
7
+ return true;
8
+ };
9
+
10
+ exports.demo = demo;
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ var CryptoJS = require('crypto-js');
4
+
5
+ /**
6
+ * 函数“file_calculate_md5”读取一个文件,计算其 MD5 哈希值,并将哈希值作为 Promise 返回。
7
+ * @param {any} file - `file_calculate_md5` 函数将文件作为输入,并使用 CryptoJS 库计算文件内容的 MD5 哈希值。`file` 参数表示要计算 MD5
8
+ * 哈希值的文件。
9
+ * @returns 一旦文件被读取并处理完毕,`file_calculate_md5` 函数就会返回一个 Promise,该 Promise 会使用文件内容的 MD5 哈希值进行解析。
10
+ */
11
+ const file_calculate_md5 = (file) => {
12
+ return new Promise((resolve, reject) => {
13
+ const reader = new FileReader();
14
+ reader.onload = function (event) {
15
+ const fileData = event.target.result;
16
+ const wordArray = CryptoJS.lib.WordArray.create(fileData);
17
+ const md5 = CryptoJS.MD5(wordArray).toString();
18
+ resolve(md5);
19
+ };
20
+ reader.onerror = function (event) {
21
+ reject(event.target.error);
22
+ };
23
+ reader.readAsArrayBuffer(file);
24
+ });
25
+ };
26
+ /**
27
+ * 函数 "file_open" 打开一个文件,如果该文件再浏览器无法预览,会实现下载功能
28
+ * @param {string} url 必填参数,传入的文件的url
29
+ * @param {string=} name 可选参数,传入的文件的文件名。如果不提供,默认使用URL中的文件名
30
+ */
31
+ const file_open = (props) => {
32
+ const { url, name } = props;
33
+ if (typeof url === "string" && url !== "") {
34
+ const fileName = url?.split("/")?.[url?.split("/")?.length - 1];
35
+ const link = document.createElement("a");
36
+ link.href = url;
37
+ link.download = name ?? fileName;
38
+ link.addEventListener("error", () => {
39
+ link.remove();
40
+ });
41
+ link.addEventListener("click", () => {
42
+ link.remove();
43
+ });
44
+ document.body.appendChild(link);
45
+ link.click();
46
+ }
47
+ };
48
+ /**
49
+ * 函数 "file_load" 下载一个文件
50
+ * @param {string} url 必填参数,传入的文件的url
51
+ * @param {string=} name 可选参数,传入的文件的文件名。如果不提供,默认使用URL中的文件名
52
+ */
53
+ const file_load = (props) => {
54
+ const { url, name } = props;
55
+ if (typeof url === "string" && url !== "") {
56
+ const fileName = url?.split("/")?.[url?.split("/")?.length - 1];
57
+ if (typeof url === "string" && url !== "") {
58
+ return fetch(url)
59
+ .then((response) => response.blob())
60
+ .then((blob) => {
61
+ const link = document.createElement("a");
62
+ link.href = URL.createObjectURL(blob);
63
+ link.download = name ?? fileName;
64
+ link.click();
65
+ URL.revokeObjectURL(link.href);
66
+ });
67
+ }
68
+ }
69
+ };
70
+
71
+ exports.file_calculate_md5 = file_calculate_md5;
72
+ exports.file_load = file_load;
73
+ exports.file_open = file_open;
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ var Num = require('number-precision');
4
+
5
+ /**
6
+ * 单位扩大固定倍数
7
+ * @param {*} amount 当前金额
8
+ * @param {*} unit 转换单位,默认100
9
+ * @param {*} accuracy 保留几位小数,默认2位
10
+ */
11
+ const num_expand = (amount, unit = 100, accuracy = 2) => {
12
+ if (amount || amount === 0) {
13
+ const realAmount = Num.divide(amount, unit).toFixed(accuracy);
14
+ return realAmount;
15
+ }
16
+ else {
17
+ return amount;
18
+ }
19
+ };
20
+ /**
21
+ * 单位扩大两位,一般用于(分->元)(百分数->数)
22
+ * @param {*} amount 当前金额
23
+ * @param {*} accuracy 保留几位小数,默认2位
24
+ */
25
+ const num_expand_100 = (amount, accuracy = 2) => {
26
+ if (amount || amount === 0) {
27
+ const realAmount = Num.divide(amount, 100).toFixed(accuracy);
28
+ return realAmount;
29
+ }
30
+ else {
31
+ return amount;
32
+ }
33
+ };
34
+ const num_unit = (amount) => {
35
+ const num = Number(amount);
36
+ if (Math.abs(num) >= 100000000) {
37
+ return `${num_expand(amount, 100000000)} 亿`;
38
+ }
39
+ else if (Math.abs(num) >= 10000) {
40
+ return `${num_expand(amount, 10000)} 万`;
41
+ }
42
+ else {
43
+ return amount;
44
+ }
45
+ };
46
+ /**
47
+ * 单位缩小两位,一般用于(元->分)(数->百分数)
48
+ * @param {*} amount 当前金额
49
+ */
50
+ const num_reduce_100 = (amount) => {
51
+ if (amount || amount === 0) {
52
+ const realAmount = Num.times(amount, 100);
53
+ return realAmount;
54
+ }
55
+ else {
56
+ return amount;
57
+ }
58
+ };
59
+ /**
60
+ * @description 数字转中文数码
61
+ *
62
+ * @param {Number|String} num 数字[正整数]
63
+ * @param {String} type 文本类型,lower|upper,默认upper
64
+ *
65
+ * @example number2text(100000000) => "壹亿元整"
66
+ */
67
+ const num_text = (number, type = "upper") => {
68
+ // 配置
69
+ const confs = {
70
+ lower: {
71
+ num: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
72
+ unit: ["", "十", "百", "千", "万"],
73
+ level: ["", "万", "亿"],
74
+ },
75
+ upper: {
76
+ num: ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"],
77
+ unit: ["", "拾", "佰", "仟"],
78
+ level: ["", "万", "亿"],
79
+ },
80
+ decimal: {
81
+ unit: ["分", "角"],
82
+ },
83
+ maxNumber: 999999999999.99,
84
+ };
85
+ // 过滤不合法参数
86
+ if (Number(number) > confs.maxNumber) {
87
+ return false;
88
+ }
89
+ const conf = confs[type];
90
+ const numbers = String(Number(number)?.toFixed(2))?.split(".");
91
+ const integer = numbers[0]?.split("");
92
+ const decimal = Number(numbers[1]) === 0 ? [] : numbers[1]?.split("");
93
+ // 四位分级
94
+ const levels = integer.reverse().reduce((pre, item, idx) => {
95
+ const level = pre[0] && pre[0]?.length < 4 ? pre[0] : [];
96
+ const value = item === "0" ? conf.num[item] : conf.num[item] + conf.unit[idx % 4];
97
+ level.unshift(value);
98
+ if (level.length === 1) {
99
+ pre.unshift(level);
100
+ }
101
+ else {
102
+ pre[0] = level;
103
+ }
104
+ return pre;
105
+ }, []);
106
+ // 整数部分
107
+ const _integer = levels.reduce((pre, item, idx) => {
108
+ let _level = conf.level[levels.length - idx - 1];
109
+ let _item = item?.join("")?.replace(/(零)\1+/g, "$1"); // 连续多个零字的部分设置为单个零字
110
+ // 如果这一级只有一个零字,则去掉这级
111
+ if (_item === "零") {
112
+ _item = "";
113
+ _level = "";
114
+ // 否则如果末尾为零字,则去掉这个零字
115
+ }
116
+ else if (_item[_item.length - 1] === "零") {
117
+ _item = _item?.slice(0, _item.length - 1);
118
+ }
119
+ return pre + _item + _level;
120
+ }, "");
121
+ // 小数部分
122
+ const _decimal = decimal
123
+ ?.map((item, idx) => {
124
+ const unit = confs.decimal.unit;
125
+ const _unit = item !== "0" ? unit[unit.length - idx - 1] : "";
126
+ return `${conf.num[item]}${_unit}`;
127
+ })
128
+ .join("");
129
+ // 如果是整数,则补个整字
130
+ return `${_integer ? _integer : "零"}元` + (_decimal || "整");
131
+ };
132
+
133
+ exports.num_expand = num_expand;
134
+ exports.num_expand_100 = num_expand_100;
135
+ exports.num_reduce_100 = num_reduce_100;
136
+ exports.num_text = num_text;
137
+ exports.num_unit = num_unit;