vcFramework.js 113 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318
/**
 * vcFramework
 *
 * @author 吴学文
 *
 * @version 1.8
 *
 * @description 完成组件化编程思想
 *
 * @time 2020-03-04
 *
 * @qq 928255095
 *
 * @mail 928255095@qq.com
 *
 */
/**
 构建vcFramework对象
 **/
(function (window) {
    "use strict";
    let vcFramework = window.vcFramework || {};
    window.vcFramework = vcFramework;
    //为了兼容 0.1版本的vc 框架
    window.vc = vcFramework;
    let _vmOptions = {};
    let _initMethod = [];
    let _initEvent = [];
    let _component = {};
    let _destroyedMethod = [];
    let _timers = []; //定时器
    let _map = []; // 共享数据存储
    let _namespace = [];
    let _vueCache = {};
    let _routes = []; // 页面路由


    _vmOptions = {
        el: '#component',
        data: {},
        watch: {},
        methods: {},
        destroyed: function () {
            window.vcFramework.destroyedMethod.forEach(function (eventMethod) {
                eventMethod();
            });
            //清理所有定时器

            window.vcFramework.timers.forEach(function (timer) {
                clearInterval(timer);
            });

            _timers = [];
        }

    };

    vcFramework = {
        version: "v1.9",
        name: "vcFramework",
        author: '吴学文',
        email: '928255095@qq.com',
        qq: '928255095',
        description: 'vcFramework 是自研的一套组件开发套件',
        vueCache: _vueCache,
        vmOptions: _vmOptions,
        namespace: _namespace,
        initMethod: _initMethod,
        initEvent: _initEvent,
        component: _component,
        destroyedMethod: _destroyedMethod,
        debug: false,
        timers: _timers,
        _map: {},
        pageRoutes: _routes, //路由
    };
    //通知window对象
    window.vcFramework = vcFramework;
    window.vc = vcFramework;

})(window);

//解决 toFixed bug 问题
(function (vcFramework) {
    Number.prototype.toFixed = function (d) {
        var s = this + "";
        if (!d) d = 0;
        if (s.indexOf(".") == -1) s += ".";
        s += new Array(d + 1).join("0");
        if (new RegExp("^(-|\\+)?(\\d+(\\.\\d{0," + (d + 1) + "})?)\\d*$").test(s)) {
            var s = "0" + RegExp.$2,
                pm = RegExp.$1,
                a = RegExp.$3.length,
                b = true;
            if (a == d + 2) {
                a = s.match(/\d/g);
                if (parseInt(a[a.length - 1]) > 4) {
                    for (var i = a.length - 2; i >= 0; i--) {
                        a[i] = parseInt(a[i]) + 1;
                        if (a[i] == 10) {
                            a[i] = 0;
                            b = i != 1;
                        } else break;
                    }
                }
                s = a.join("").replace(new RegExp("(\\d+)(\\d{" + d + "})\\d$"), "$1.$2");


            }
            if (b) s = s.substr(1);
            return (pm + s).replace(/\.$/, "");
        }
        return this + "";
    }


})(window.vcFramework);

(function (vcFramework) {

    let componentCache = {};
    /**
     *  树
     * @param {*} _vcCreate  自定义组件
     * @param {*} _html 组件内容
     * @param {*} _nodeLocation  组件位置 1 开始节点 -1 结束节点
     */
    let VcTree = function (_vcCreate, _html, _nodeLocation) {
        let o = new Object();
        o.treeId = vcFramework.uuid();
        o.vcCreate = _vcCreate;
        o.html = _html;
        o.js = "";
        o.css = "";
        o.vcSubTree = [];
        o.nodeLocation = _nodeLocation;
        o.putSubTree = function (_vcSubTree) {
            o.vcSubTree.push(_vcSubTree);
        };
        o.setHtml = function (_html) {
            o.html = _html;
        };
        o.setJs = function (_js) {
            o.js = _js;
        };
        o.setCss = function (_css) {
            o.css = _css;
        };
        o.setLocation = function (_location) {
            o.nodeLocation = _location;
        };
        return o;
    };

    /**
     * 构建 树
     */
    vcFramework.builderVcTree = async function () {
        let _componentUrl = location.hash;

        //判断是否为组件页面
        if (vcFramework.notNull(_componentUrl)) {
            let _vcComponent = document.getElementById('component');
            let vcComponentChilds = _vcComponent.childNodes;
            for (let vcIndex = vcComponentChilds.length - 1; vcIndex >= 0; vcIndex--) {
                _vcComponent.removeChild(vcComponentChilds[vcIndex]);
            }

            if (_componentUrl.lastIndexOf('#') > -1) {
                let endPos = _componentUrl.length;
                if (_componentUrl.indexOf('?') > -1) {
                    endPos = _componentUrl.indexOf('?');
                }
                _componentUrl = _componentUrl.substring(_componentUrl.lastIndexOf('#') + 1, endPos);
            }

            let _tmpVcCreate = document.createElement("vc:create");
            let _divComponentAttr = document.createAttribute('path');
            _divComponentAttr.value = _componentUrl;
            _tmpVcCreate.setAttributeNode(_divComponentAttr);
            _vcComponent.appendChild(_tmpVcCreate);

            let _commonPath = _vcComponent.getAttribute('vc-path');
            if (vc.isNotEmpty(_commonPath)) {
                let _pathVcCreate = document.createElement("vc:create");
                let _pathDivComponentAttr = document.createAttribute('path');
                _pathDivComponentAttr.value = _commonPath;
                _pathVcCreate.setAttributeNode(_pathDivComponentAttr);
                _vcComponent.appendChild(_pathVcCreate);
            }

        } else {
            let _vcComponent = document.getElementById('component');
            let _commonPath = _vcComponent.getAttribute('vc-path');
            if (vc.isNotEmpty(_commonPath)) {
                let _pathVcCreate = document.createElement("vc:create");
                let _pathDivComponentAttr = document.createAttribute('path');
                _pathDivComponentAttr.value = _commonPath;
                _pathVcCreate.setAttributeNode(_pathDivComponentAttr);
                _vcComponent.appendChild(_pathVcCreate);
            }

        }
        let vcElements = document.getElementsByTagName('vc:create');
        let treeList = [];
        let _componentScript = [];
        for (let _vcElementIndex = 0; _vcElementIndex < vcElements.length; _vcElementIndex++) {
            let _vcElement = vcElements[_vcElementIndex];
            let _tree = new VcTree(_vcElement, '', 1);
            let _vcCreateAttr = document.createAttribute('id');
            _vcCreateAttr.value = _tree.treeId;
            _vcElement.setAttributeNode(_vcCreateAttr);
            treeList.push(_tree);
            //创建div
            await findVcLabel(_tree, _vcElement);
            let _res = _tree.html;
        }

        //渲染组件html
        reader(treeList, _componentScript);

        parseVcI18N();
        //执行组件js
        execScript(treeList, _componentScript);
    };

    /**
     * 页面内 组件跳转
     */
    vcFramework.reBuilderVcTree = async function () {
        let _componentUrl = location.hash;

        //判断是否为组件页面
        if (!vcFramework.notNull(_componentUrl)) {
            vcFramework.toast('程序异常,url没有包含组件');
            return;
        }

        if (_componentUrl.lastIndexOf('#') < 0) {
            vcFramework.toast('程序异常,url包含组件错误');
            return;
        }

        let _vcComponent = document.getElementById('component');
        let vcComponentChilds = _vcComponent.childNodes;
        for (let vcIndex = vcComponentChilds.length - 1; vcIndex >= 0; vcIndex--) {
            _vcComponent.removeChild(vcComponentChilds[vcIndex]);
        }
        let endPos = _componentUrl.length;
        if (_componentUrl.indexOf('?') > -1) {
            endPos = _componentUrl.indexOf('?');
        }

        _componentUrl = _componentUrl.substring(_componentUrl.lastIndexOf('#') + 1, endPos);

        let _tmpVcCreate = document.createElement("vc:create");
        let _divComponentAttr = document.createAttribute('path');
        _divComponentAttr.value = _componentUrl;
        _tmpVcCreate.setAttributeNode(_divComponentAttr);
        _vcComponent.appendChild(_tmpVcCreate);

        let _commonPath = _vcComponent.getAttribute('vc-path');
        if (vc.isNotEmpty(_commonPath)) {
            let _pathVcCreate = document.createElement("vc:create");
            let _pathDivComponentAttr = document.createAttribute('path');
            _pathDivComponentAttr.value = _commonPath;
            _pathVcCreate.setAttributeNode(_pathDivComponentAttr);
            _vcComponent.appendChild(_pathVcCreate);
        }

        let treeList = [];
        let _componentScript = [];

        let _vcElement = _tmpVcCreate;

        let vcElements = _vcComponent.getElementsByTagName('vc:create');

        for (let _vcElementIndex = 0; _vcElementIndex < vcElements.length; _vcElementIndex++) {
            let _vcElement = vcElements[_vcElementIndex];
            let _tree = new VcTree(_vcElement, '', 1);
            let _vcCreateAttr = document.createAttribute('id');
            _vcCreateAttr.value = _tree.treeId;
            _vcElement.setAttributeNode(_vcCreateAttr);
            treeList.push(_tree);
            //创建div
            await findVcLabel(_tree, _vcElement);
        }

        //渲染组件html
        reader(treeList, _componentScript);
        parseVcI18N();
        //执行组件js
        execScript(treeList, _componentScript);
    };

    /**
     * 从当前 HTML中找是否存在 <vc:create path="xxxx"></vc:create> 标签
     */
    findVcLabel = async function (_tree) {
        //查看是否存在子 vc:create 
        let _componentName = _tree.vcCreate.getAttribute('path');
        //console.log('_componentName', _componentName, _tree);
        if (!vcFramework.isNotEmpty(_componentName)) {
            throw '组件未包含path 属性' + _tree.vcCreate.outerHTML;
        }
        //开始加载组件
        let _componentElement = await loadComponent(_componentName, _tree);
        //_tree.setHtml(_componentElement);

        //console.log('_componentElement>>', _componentElement)

        if (vcFramework.isNotNull(_componentElement)) {
            let vcChildElements = _componentElement.getElementsByTagName('vc:create');
            if (vcChildElements.length > 0) {
                let _vcDiv = document.createElement('div');
                for (let _vcChildIndex = 0; _vcChildIndex < vcChildElements.length; _vcChildIndex++) {
                    //console.log('vcChildElements', vcChildElements);
                    let _tmpChildElement = vcChildElements[_vcChildIndex];
                    let _subtree = new VcTree(_tmpChildElement, '', 2);
                    let _vcCreateAttr = document.createAttribute('id');
                    _vcCreateAttr.value = _subtree.treeId;
                    _tmpChildElement.setAttributeNode(_vcCreateAttr);
                    _tree.putSubTree(_subtree);
                    await findVcLabel(_subtree);
                }
            }

        }
    };

    /**
     * 渲染组件 html 页面
     */
    reader = function (_treeList, _componentScript) {
        //console.log('_treeList', _treeList);
        let _header = document.getElementsByTagName('head');
        for (let _treeIndex = 0; _treeIndex < _treeList.length; _treeIndex++) {
            let _tree = _treeList[_treeIndex];
            let _vcCreateEl = document.getElementById(_tree.treeId);
            let _componentHeader = _tree.html.getElementsByTagName('head');
            let _componentBody = _tree.html.getElementsByTagName('body');

            if (_vcCreateEl.hasAttribute("location") && 'head' == _vcCreateEl.getAttribute('location')) {
                let _componentHs = _componentHeader[0].childNodes;
                _header[0].appendChild(_componentHeader[0]);

            } else if (_vcCreateEl.hasAttribute("location") && 'body' == _vcCreateEl.getAttribute('location')) {
                _vcCreateEl.parentNode.replaceChild(_componentHeader[0].childNodes[0], _vcCreateEl);
                let _bodyComponentHs = _componentHeader[0].childNodes;
                for (let _bsIndex = 0; _bsIndex < _bodyComponentHs.length; _bsIndex++) {
                    let _bComponentScript = _bodyComponentHs[_bsIndex];
                    if (_bComponentScript.tagName == 'SCRIPT') {
                        let scriptObj = document.createElement("script");
                        scriptObj.src = _bComponentScript.src;
                        scriptObj.type = "text/javascript";
                        document.getElementsByTagName("body")[0].appendChild(scriptObj);
                    } else {
                        _header[0].appendChild(_bodyComponentHs[_bsIndex]);
                    }

                }

            } else {
                //_vcCreateEl.innerHTML = _componentBody[0].innerHTML;
                //_vcCreateEl.parentNode.replaceChild(_componentBody[0], _vcCreateEl);

                for (let _comBodyIndex = 0; _comBodyIndex < _componentBody.length; _comBodyIndex++) {
                    let _childNodes = _componentBody[_comBodyIndex].childNodes;
                    for (let _tmpChildIndex = 0; _tmpChildIndex < _childNodes.length; _tmpChildIndex++) {
                        _vcCreateEl.parentNode.insertBefore(_childNodes[_tmpChildIndex], _vcCreateEl)
                    }

                }

            }
            //将js 脚本放到 组件 脚本中
            if (vcFramework.isNotEmpty(_tree.js)) {
                _componentScript.push(_tree.js);
            }


            let _tmpSubTrees = _tree.vcSubTree;

            if (_tmpSubTrees != null && _tmpSubTrees.length > 0) {
                reader(_tmpSubTrees, _componentScript);
            }

        }
        /**
         * 执行 页面上的js 文件
         */
        let _tmpScripts = document.head.getElementsByTagName("script");
        let _tmpBody = document.getElementsByTagName('body');
        for (let _scriptsIndex = 0; _scriptsIndex < _tmpScripts.length; _scriptsIndex++) {
            let _tmpScript = _tmpScripts[_scriptsIndex];
            //console.log('_head 中 script', _tmpScript.outerHTML)
            let scriptObj = document.createElement("script");
            scriptObj.src = _tmpScript.src;
            //_tmpScript.parentNode.removeChild(_tmpScript);
            scriptObj.type = "text/javascript";
            _tmpBody[0].appendChild(scriptObj);
        }
    };

    vcFramework.i18n = function (_key, _namespace) {
        if (!window.hasOwnProperty('lang')) {
            return _key;
        }

        let _lang = window.lang;

        if (_namespace && _lang.hasOwnProperty(_namespace)) {
            let _namespaceObj = _lang[_namespace];
            if (_namespaceObj.hasOwnProperty(_key)) {
                return _namespaceObj[_key];
            }
        }

        if (!_lang.hasOwnProperty(_key)) {
            return _key;
        }

        return _lang[_key];
    }

    /**
     * 解析 i18n 标签
     */
    parseVcI18N = function () {
        let _tmpI18N = document.getElementsByTagName("vc:i18n");
        for (let _vcElementIndex = 0; _vcElementIndex < _tmpI18N.length; _vcElementIndex++) {
            let _vcElement = _tmpI18N[_vcElementIndex];
            let _name = _vcElement.getAttribute('name');
            let _namespace = _vcElement.getAttribute('namespace');
            let textNode = document.createTextNode(vc.i18n(_name, _namespace));
            _vcElement.parentNode.appendChild(textNode);
            //_vcElement.parentNode.replaceChild(textNode,_vcElement);

        }
        let _i18nLength = _tmpI18N.length;
        for (let _vcElementIndex = 0; _vcElementIndex < _i18nLength; _vcElementIndex++) {
            let _vcElement = _tmpI18N[0];
            _vcElement.parentNode.removeChild(_vcElement);
        }
        _tmpI18N = document.head.getElementsByTagName("vc:i18n");
        for (let _vcElementIndex = 0; _vcElementIndex < _tmpI18N.length; _vcElementIndex++) {
            let _vcElement = _tmpI18N[_vcElementIndex];
            let _name = _vcElement.getAttribute('name');
            let _namespace = _vcElement.getAttribute('namespace');
            let textNode = document.createTextNode(vc.i18n(_name, _namespace));
            _vcElement.parentNode.appendChild(textNode);

        }
        for (let _vcElementIndex = 0; _vcElementIndex < _tmpI18N.length; _vcElementIndex++) {
            let _vcElement = _tmpI18N[_vcElementIndex];
            _vcElement.parentNode.removeChild(_vcElement);
        }

    }

    /**
     * 手工执行js 脚本
     */
    execScript = function (_tree, _componentScript) {

        //console.log('_componentScript', _componentScript);


        for (let i = 0; i < _componentScript.length; i++) {
            //一段一段执行script 
            try {
                eval(_componentScript[i]);
            } catch (e) {
                console.log('js脚本错误', _componentScript[i]);
                console.error(e);
            }

        }

        //初始化vue 对象
        vcFramework.initVue();

        vcFramework.initVcComponent();
    }

    /**
     * 加载组件
     * 异步去服务端 拉去HTML 和 js
     */
    loadComponent = async function (_componentName, _tree) {
        if (vcFramework.isNotEmpty(_componentName) && _componentName.lastIndexOf('/') > 0) {
            _componentName = _componentName + '/' + _componentName.substring(_componentName.lastIndexOf('/') + 1, _componentName.length);
        }
        //从缓存查询
        let _cacheComponent = vcFramework.getComponent(_componentName);
        //console.log('加载组件名称', _componentName);
        let _htmlBody = '';
        let _jsBody = '';
        if (!vcFramework.isNotNull(_cacheComponent)) {
            let _domain = 'components';
            let filePath = '';

            if (_tree.vcCreate.hasAttribute("domain")) {
                _domain = _tree.vcCreate.getAttribute("domain");
            }
            if (_componentName.startsWith('/pages')) { //这里是为了处理 pages 页面
                filePath = _componentName;
            } else { //这里是为了处理组件
                filePath = '/' + _domain + '/' + _componentName;
            }
            let htmlFilePath = filePath + ".html";
            let jsFilePath = filePath + ".js";
            //加载html 页面
            [_htmlBody, _jsBody] = await Promise.all([vcFramework.httpGet(htmlFilePath), vcFramework.httpGet(jsFilePath)]);
            let _componentObj = {
                html: _htmlBody,
                js: _jsBody
            };
            vcFramework.putComponent(_componentName, _componentObj);
        } else {
            _htmlBody = _cacheComponent.html;
            _jsBody = _cacheComponent.js;
        }
        //处理命名空间
        _htmlBody = dealHtmlNamespace(_tree, _htmlBody);

        //处理 js
        _jsBody = dealJs(_tree, _jsBody);
        _jsBody = dealJsAddComponentCode(_tree, _jsBody);
        //处理命名空间
        _jsBody = dealJsNamespace(_tree, _jsBody);

        //处理侦听
        _jsBody = dealHtmlJs(_tree, _jsBody);

        _tmpJsBody = '<script type="text/javascript">//<![CDATA[\n' + _jsBody + '//]]>\n</script>';
        let parser = new DOMParser();

        //let htmlComponentDoc = parser.parseFromString(_htmlBody + _tmpJsBody, 'text/html').documentElement;
        let htmlComponentDoc = parser.parseFromString(_htmlBody, 'text/html').documentElement;

        //创建div
        let vcDiv = document.createElement('div');
        let _divComponentAttr = document.createAttribute('data-component');
        _divComponentAttr.value = _componentName;
        vcDiv.setAttributeNode(_divComponentAttr);
        vcDiv.appendChild(htmlComponentDoc);
        //vcDiv.appendChild(jsComponentDoc);

        _tree.setHtml(vcDiv);
        _tree.setJs(_jsBody);
        return vcDiv;
    };

    /**
     * 处理 命名空间html
     */
    dealHtmlNamespace = function (_tree, _html) {

        let _componentVcCreate = _tree.vcCreate;
        if (!_componentVcCreate.hasAttribute('namespace')) {
            return _html;
        }

        let _namespaceValue = _componentVcCreate.getAttribute("namespace");

        _html = _html.replace(/this./g, _namespaceValue + "_");

        _html = _html.replace(/(id)( )*=( )*'/g, "id='" + _namespaceValue + "_");
        _html = _html.replace(/(id)( )*=( )*"/g, 'id="' + _namespaceValue + '_');
        return _html;
    };
    /**
     * 处理js
     */
    dealJs = function (_tree, _js) {
        //在js 中检测propTypes 属性
        if (_js.indexOf("propTypes") < 0) {
            return _js;
        }

        let _componentVcCreate = _tree.vcCreate;

        //解析propTypes信息
        let tmpProTypes = _js.substring(_js.indexOf("propTypes"), _js.length);
        tmpProTypes = tmpProTypes.substring(tmpProTypes.indexOf("{") + 1, tmpProTypes.indexOf("}")).trim();

        if (!vcFramework.notNull(tmpProTypes)) {
            return _js;
        }

        tmpProTypes = tmpProTypes.indexOf("\r") > 0 ? tmpProTypes.replace("\r/g", "") : tmpProTypes;

        let tmpType = tmpProTypes.indexOf("\n") > 0 ?
            tmpProTypes.split("\n") :
            tmpProTypes.split(",");
        let propsJs = "\nlet $props = {};\n";
        for (let typeIndex = 0; typeIndex < tmpType.length; typeIndex++) {
            let type = tmpType[typeIndex];
            if (!vcFramework.notNull(type) || type.indexOf(":") < 0) {
                continue;
            }
            let types = type.split(":");
            let attrKey = "";
            if (types[0].indexOf("//") > 0) {
                attrKey = types[0].substring(0, types[0].indexOf("//"));
            }
            attrKey = types[0].replace(" ", "");
            attrKey = attrKey.replace("\n", "")
            attrKey = attrKey.replace("\r", "").trim();
            if (!_componentVcCreate.hasAttribute(attrKey) && types[1].indexOf("=") < 0) {
                let componentName = _componentVcCreate.getAttribute("path");
                throw "组件[" + componentName + "]未配置组件属性" + attrKey;
            }
            let vcType = _componentVcCreate.getAttribute(attrKey);
            if (!_componentVcCreate.hasAttribute(attrKey) && types[1].indexOf("=") > 0) {
                vcType = dealJsPropTypesDefault(types[1]);
            } else if (types[1].indexOf("vc.propTypes.string") >= 0) {
                vcType = "'" + vcType + "'";
            }
            propsJs = propsJs + "$props." + attrKey + "=" + vcType + ";\n";
        }

        //将propsJs 插入到 第一个 { 之后
        let position = _js.indexOf("{");
        if (position < 0) {
            let componentName = _componentVcCreate.getAttribute("name");
            throw "组件" + componentName + "对应js 未包含 {}  ";
        }
        let newJs = _js.substring(0, position + 1);
        newJs = newJs + propsJs;
        newJs = newJs + _js.substring(position + 1, _js.length);
        return newJs;
    };

    dealJsPropTypesDefault = function (typeValue) {
        let startPos = typeValue.indexOf("=") + 1;
        let endPos = typeValue.length;
        if (typeValue.indexOf(",") > 0) {
            endPos = typeValue.indexOf(",");
        } else if (typeValue.indexOf("//") > 0) {
            endPos = typeValue.indexOf("//");
        }

        return typeValue.substring(startPos, endPos);
    };
    /**
     * js 处理命名
     */
    dealJsNamespace = function (_tree, _js) {

        //在js 中检测propTypes 属性
        let _componentVcCreate = _tree.vcCreate;

        if (_js.indexOf("vc.extends") < 0) {
            return _js;
        }
        let namespace = "";
        if (!_componentVcCreate.hasAttribute("namespace")) {
            namespace = 'default';
        } else {
            namespace = _componentVcCreate.getAttribute("namespace");
        }

        //js对象中插入namespace 值
        let extPos = _js.indexOf("vc.extends");
        let tmpProTypes = _js.substring(extPos, _js.length);
        let pos = tmpProTypes.indexOf("{") + 1;
        _js = _js.substring(0, extPos) + tmpProTypes.substring(0, pos).trim() +
            "\nnamespace:'" + namespace.trim() + "',\n" + tmpProTypes.substring(pos, tmpProTypes.length);
        let position = _js.indexOf("{");
        let propsJs = "\nlet $namespace='" + namespace.trim() + "';\n";

        let newJs = _js.substring(0, position + 1);
        newJs = newJs + propsJs;
        newJs = newJs + _js.substring(position + 1, _js.length);
        return newJs;
    };

    /**
     * 处理js 变量和 方法都加入 组件编码
     *
     * @param tag 页面元素
     * @param js  js文件内容
     * @return js 文件内容
     */
    dealJsAddComponentCode = function (_tree, _js) {
        let _componentVcCreate = _tree.vcCreate;

        if (!_componentVcCreate.hasAttribute("code")) {
            return _js;
        }

        let code = _componentVcCreate.getAttribute("code");

        return _js.replace("@vc_/g", code);
    }

    /**
     * 处理命名空间js
     */
    dealHtmlJs = function (_tree, _js) {
        let _componentVcCreate = _tree.vcCreate;
        if (!_componentVcCreate.hasAttribute('namespace')) {
            return _js;
        }

        let _namespaceValue = _componentVcCreate.getAttribute("namespace");
        _js = _js.replace(/this./g, "vc.component." + _namespaceValue + "_");
        _js = _js.replace(/(\$)( )*(\()( )*'#/g, "\$('#" + _namespaceValue + "_");

        _js = _js.replace(/(\$)( )*(\()( )*"#/g, "\$(\"#" + _namespaceValue + "_");

        //将 监听也做优化
        _js = _js.replace(/(vc.on)\('/g, "vc.on('" + _namespaceValue + "','");
        _js = _js.replace(/(vc.on)\("/g, "vc.on(\"" + _namespaceValue + "\",\"");
        return _js;
    }

})(window.vcFramework);

/**
 * vc-event 事件处理
 *
 */

(function (vcFramework) {

    _initVcFrameworkEvent = function () {
        let vcFrameworkEvent = document.createEvent('Event');
        // 定义事件名为'build'.
        vcFrameworkEvent.initEvent('initVcFrameworkFinish', true, true);
        vcFramework.vcFrameworkEvent = vcFrameworkEvent;
    };

    /**
     * 初始化 vue 事件
     */
    _initVueEvent = function () {
        vcFramework.$event = new Vue();
    }

    _initVcFrameworkEvent();

    _initVueEvent();


})(window.vcFramework);

/**
 * vc-util
 */
(function (vcFramework) {

    //空判断 true 为非空 false 为空
    vcFramework.isNotNull = function (_paramObj) {
        if (_paramObj == null || _paramObj == undefined) {
            return false;
        }
        return true;
    };

    //空判断 true 为非空 false 为空
    vcFramework.isNotEmpty = function (_paramObj) {
        if (_paramObj == null || _paramObj == undefined || _paramObj.trim() == '') {
            return false;
        }
        return true;
    };

    vcFramework.uuid = function () {
        let s = [];
        let hexDigits = "0123456789abcdef";
        for (let i = 0; i < 36; i++) {
            s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
        }
        s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
        s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
        s[8] = s[13] = s[18] = s[23] = "-";

        let uuid = s.join("");
        return uuid;
    };

    /**
     * 深度拷贝对象
     */
    vcFramework.deepClone = function (obj) {
        return JSON.parse(JSON.stringify(obj));
    }

    vcFramework.changeNumMoneyToChinese = function (money) {
        let cnNums = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); //汉字的数字
        let cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
        let cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
        let cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
        let cnInteger = "整"; //整数金额时后面跟的字符
        let cnIntLast = "元"; //整型完以后的单位
        let maxNum = 999999999999999.9999; //最大处理的数字
        let IntegerNum; //金额整数部分
        let DecimalNum; //金额小数部分
        let ChineseStr = ""; //输出的中文金额字符串
        let parts; //分离金额后用的数组,预定义    
        let Symbol = ""; //正负值标记
        if (money == "") {
            return "";
        }

        money = parseFloat(money);
        if (money >= maxNum) {
            alert('超出最大处理数字');
            return "";
        }
        if (money == 0) {
            ChineseStr = cnNums[0] + cnIntLast + cnInteger;
            return ChineseStr;
        }
        if (money < 0) {
            money = -money;
            Symbol = "负 ";
        }
        money = money.toString(); //转换为字符串
        if (money.indexOf(".") == -1) {
            IntegerNum = money;
            DecimalNum = '';
        } else {
            parts = money.split(".");
            IntegerNum = parts[0];
            DecimalNum = parts[1].substr(0, 4);
        }
        if (parseInt(IntegerNum, 10) > 0) { //获取整型部分转换
            var zeroCount = 0;
            var IntLen = IntegerNum.length;
            for (var i = 0; i < IntLen; i++) {
                var n = IntegerNum.substr(i, 1);
                var p = IntLen - i - 1;
                var q = p / 4;
                var m = p % 4;
                if (n == "0") {
                    zeroCount++;
                } else {
                    if (zeroCount > 0) {
                        ChineseStr += cnNums[0];
                    }
                    zeroCount = 0; //归零
                    ChineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
                }
                if (m == 0 && zeroCount < 4) {
                    ChineseStr += cnIntUnits[q];
                }
            }
            ChineseStr += cnIntLast;
            //整型部分处理完毕
        }
        if (DecimalNum != '') { //小数部分
            var decLen = DecimalNum.length;
            for (var i = 0; i < decLen; i++) {
                var n = DecimalNum.substr(i, 1);
                if (n != '0') {
                    ChineseStr += cnNums[Number(n)] + cnDecUnits[i];
                }
            }
        }
        if (ChineseStr == '') {
            ChineseStr += cnNums[0] + cnIntLast + cnInteger;
        } else if (DecimalNum == '') {
            ChineseStr += cnInteger;
        }
        ChineseStr = Symbol + ChineseStr;

        return ChineseStr;
    }


})(window.vcFramework);

/**
 * 封装 后端请求 代码
 */
(function (vcFramework) {

    vcFramework.httpGet = function (url) {
        // XMLHttpRequest对象用于在后台与服务器交换数据 
        return new Promise((resolve, reject) => {
            let xhr = new XMLHttpRequest();
            xhr.open('GET', url, true);
            xhr.onreadystatechange = function () {
                // readyState == 4说明请求已完成
                if (xhr.readyState == 4 && xhr.status == 200 || xhr.status == 304) {
                    // 从服务器获得数据 
                    // fn.call(this, xhr.responseText);
                    resolve(xhr.responseText);
                }
            };
            xhr.send();
        });
    };
    vcFramework.httpPost = function (url, data, fn) {
        let xhr = new XMLHttpRequest();
        xhr.open("POST", url, true);
        // 添加http头,发送信息至服务器时内容编码类型
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 304)) {
                fn.call(xhr.responseText);
            }
        };
        xhr.send(data);
    };
})(window.vcFramework);

/**
 *  vc-cache
 *
 * 组件缓存
 */
(function (vcFramework) {

    /**
     * 组件缓存
     */
    vcFramework.putComponent = function (_componentName, _component) {
        let _componentCache = vcFramework.vueCache;
        _componentCache[_componentName] = _component;
    };
    /**
     * 组件提取
     */
    vcFramework.getComponent = function (_componentName) {
        let _componentCache = vcFramework.vueCache;
        return _componentCache[_componentName];
    }

})(window.vcFramework);

/***
 * vc- constant 内容
 */


/**
 常量
 **/
(function (vcFramework) {

    let constant = {
        REQUIRED_MSG: "不能为空",
        GET_CACHE_URL: ["/user.getUserInfo"]
    }
    vcFramework.constant = constant;
})(window.vcFramework);


/***
 * vc component 0.1 版本代码合并过来-----------------------------------------------------------------------
 *
 *
 */

/**
 vc 函数初始化
 add by Kevin
 **/
(function (vcFramework) {
    let DEFAULT_NAMESPACE = "default";
    vcFramework.http = {
        post: function (componentCode, componentMethod, param, options, successCallback, errorCallback) {
            let _lang = vcFramework.getData('JAVA110-LANG');
            if (!_lang) {
                _lang = {
                    name: '简体中文',
                    lang: 'zh-cn'
                }
            }
            Vue.http.headers.common['JAVA110-LANG'] = _lang.lang;
            Vue.http.headers.common['APP-ID'] = '8000418004';
            Vue.http.headers.common['TRANSACTION-ID'] = vcFramework.uuid();
            Vue.http.headers.common['REQ-TIME'] = vcFramework.getDateYYYYMMDDHHMISS();
            Vue.http.headers.common['SIGN'] = '';
            let _accessToken = window.localStorage.getItem('token');
            if(_accessToken){
                Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken;
            }
            vcFramework.loading('open');
            Vue.http.post('/callComponent/' + componentCode + "/" + componentMethod, param, options)
                .then(function (res) {
                    try {
                        let _header = res.headers.map;
                        //console.log('res', res);
                        if (vcFramework.notNull(_header['location'])) {
                            window.location.href = _header['location'];
                            return;
                        };
                        successCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                }, function (res) {
                    try {
                        if (res.status == 401 && res.headers.map["location"]) {
                            let _header = res.headers.map;
                            //console.log('res', res);
                            window.location.href = _header['location'];
                            return;
                        }
                        if (res.status == 404) {
                            window.location.href = '/user.html#/pages/frame/login';
                            return;
                        }
                        errorCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                });
        },
        get: function (componentCode, componentMethod, param, successCallback, errorCallback) {
            //加入缓存机制
            let _getPath = '/' + componentCode + '/' + componentMethod;
            if (vcFramework.constant.GET_CACHE_URL.includes(_getPath)) {
                let _cacheData = vcFramework.getData(_getPath);
                //浏览器缓存中能获取到
                if (_cacheData != null && _cacheData != undefined) {
                    successCallback(JSON.stringify(_cacheData), { status: 200 });
                    return;
                }
            }
            let _lang = vcFramework.getData('JAVA110-LANG');
            if (!_lang) {
                _lang = {
                    name: '简体中文',
                    lang: 'zh-cn'
                }
            }
            vcFramework.loading('open');
            Vue.http.headers.common['JAVA110-LANG'] = _lang.lang;
            Vue.http.headers.common['APP-ID'] = '8000418004';
            Vue.http.headers.common['TRANSACTION-ID'] = vcFramework.uuid();
            Vue.http.headers.common['REQ-TIME'] = vcFramework.getDateYYYYMMDDHHMISS();
            Vue.http.headers.common['SIGN'] = '';
            let _accessToken = window.localStorage.getItem('token');
            if(_accessToken){
                Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken;
            }

            Vue.http.get('/callComponent/' + componentCode + "/" + componentMethod, param)
                .then(function (res) {
                    try {

                        successCallback(res.bodyText, res);
                        if (vcFramework.constant.GET_CACHE_URL.includes(_getPath) && res.status == 200) {
                            vcFramework.saveData('/nav/getUserInfo', JSON.parse(res.bodyText));
                        }
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                }, function (res) {
                    try {
                        if (res.status == 401 && res.headers.map["location"]) {
                            let _header = res.headers.map;
                            //console.log('res', res);
                            window.location.href = _header['location'];
                            return;

                        }
                        if (res.status == 404) {
                            window.location.href = '/user.html#/pages/frame/login';
                            return;
                        }
                        errorCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                });
        },
        apiPost: function (api, param, options, successCallback, errorCallback) {
            let _api = '';
            let _lang = vcFramework.getData('JAVA110-LANG');
            if (!_lang) {
                _lang = {
                    name: '简体中文',
                    lang: 'zh-cn'
                }
            }
            Vue.http.headers.common['JAVA110-LANG'] = _lang.lang;
            Vue.http.headers.common['APP-ID'] = '8000418004';
            Vue.http.headers.common['TRANSACTION-ID'] = vcFramework.uuid();
            Vue.http.headers.common['REQ-TIME'] = vcFramework.getDateYYYYMMDDHHMISS();
            Vue.http.headers.common['SIGN'] = '';
            Vue.http.headers.common['VERSION'] = 'v1.8';
            let _accessToken = window.localStorage.getItem('token');
            if(_accessToken){
                Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken;
            }

            if (api.indexOf('/') >= 0) {
                _api = '/app' + api;
            } else {
                _api = '/callComponent/' + api;
            }

            vcFramework.loading('open');
            Vue.http.post(_api, param, options)
                .then(function (res) {
                    vcFramework.loading('close');
                    try {
                        let _header = res.headers.map;
                        //console.log('res', res);
                        if (vcFramework.notNull(_header['location'])) {
                            window.location.href = _header['location'];
                            return;
                        };
                        successCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally { }
                }, function (res) {
                    vcFramework.loading('close');
                    try {
                        if (res.status == 401 && res.headers.map["location"]) {
                            let _header = res.headers.map;
                            //console.log('res', res);
                            window.location.href = _header['location'];
                            return;
                        }
                        if (res.status == 404) {
                            window.location.href = '/user.html#/pages/frame/login';
                            return;
                        }
                        errorCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally { }
                });
        },
        apiGet: function (api, param, successCallback, errorCallback) {
            //加入缓存机制
            let _getPath = '';
            if (api.indexOf('/') != 0) {
                _getPath = '/' + api;
            } else {
                _getPath = api;
            }
            if (vcFramework.constant.GET_CACHE_URL.includes(_getPath)) {
                let _cacheData = vcFramework.getData(_getPath);
                //浏览器缓存中能获取到
                if (_cacheData != null && _cacheData != undefined) {
                    successCallback(JSON.stringify(_cacheData), { status: 200 });
                    return;
                }
            }

            let _api = '';
            let _lang = vcFramework.getData('JAVA110-LANG');
            if (!_lang) {
                _lang = {
                    name: '简体中文',
                    lang: 'zh-cn'
                }
            }
            Vue.http.headers.common['JAVA110-LANG'] = _lang.lang;
            Vue.http.headers.common['APP-ID'] = '8000418004';
            Vue.http.headers.common['TRANSACTION-ID'] = vcFramework.uuid();
            Vue.http.headers.common['REQ-TIME'] = vcFramework.getDateYYYYMMDDHHMISS();
            Vue.http.headers.common['SIGN'] = '';
            Vue.http.headers.common['USER-ID'] = '-1';
            Vue.http.headers.common['VERSION'] = 'v1.8';
            let _accessToken = window.localStorage.getItem('token');
            if(_accessToken){
                Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken;
            }

            if (api.indexOf('/') >= 0) {
                _api = '/app' + api;
            } else {
                _api = '/callComponent/' + api;
            }
            if (vcFramework.hasOwnProperty('loading')) {
                vcFramework.loading('open');
            }

            Vue.http.get(_api, param)
                .then(function (res) {
                    try {

                        successCallback(res.bodyText, res);

                        if (vcFramework.constant.GET_CACHE_URL.includes(_getPath) && res.status == 200) {
                            vcFramework.saveData('/nav/getUserInfo', JSON.parse(res.bodyText));
                        }
                    } catch (e) {
                        console.error(e);
                    } finally {
                        if (vcFramework.hasOwnProperty('loading')) {
                            vcFramework.loading('close');
                        }
                    }
                }, function (res) {
                    try {
                        if (res.status == 401 && res.headers.map["location"]) {
                            let _header = res.headers.map;
                            //console.log('res', res);
                            window.location.href = _header['location'];
                            return;

                        }
                        if (res.status == 404) {
                            window.location.href = '/user.html#/pages/frame/login';
                            return;
                        }
                        errorCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                });
        },
        upload: function (componentCode, componentMethod, param, options, successCallback, errorCallback) {
            let _accessToken = window.localStorage.getItem('token');
            if(_accessToken){
                Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken;
            }
            vcFramework.loading('open');
            Vue.http.post('/callComponent/upload/' + componentCode + "/" + componentMethod, param, options)
                .then(function (res) {
                    try {
                        successCallback(res.bodyText, res);
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                }, function (error) {
                    try {
                        errorCallback(error.bodyText, error);
                    } catch (e) {
                        console.error(e);
                    } finally {
                        vcFramework.loading('close');
                    }
                });

        },

    };

    //let vmOptions = vcFramework.vmOptions;
    //继承方法,合并 _vmOptions 的数据到 vmOptions中
    vcFramework.extends = function (_vmOptions) {
        let vmOptions = vcFramework.vmOptions;
        if (typeof _vmOptions !== "object") {
            throw "_vmOptions is not Object";
        }
        //console.log('vmOptions',vmOptions);
        let nameSpace = DEFAULT_NAMESPACE;
        if (_vmOptions.hasOwnProperty("namespace")) {
            nameSpace = _vmOptions.namespace;
            vcFramework.namespace.push({
                namespace: _vmOptions.namespace,
            })
        }

        //处理 data 对象

        if (_vmOptions.hasOwnProperty('data')) {
            for (let dataAttr in _vmOptions.data) {
                if (nameSpace == DEFAULT_NAMESPACE) {
                    vmOptions.data[dataAttr] = _vmOptions.data[dataAttr];
                } else {

                    vmOptions.data[nameSpace + "_" + dataAttr] = _vmOptions.data[dataAttr];

                }
            }
        }
        //处理methods 对象
        if (_vmOptions.hasOwnProperty('methods')) {
            for (let methodAttr in _vmOptions.methods) {
                if (nameSpace == DEFAULT_NAMESPACE) {
                    vmOptions.methods[methodAttr] = _vmOptions.methods[methodAttr];
                } else {

                    vmOptions.methods[nameSpace + "_" + methodAttr] = _vmOptions.methods[methodAttr];
                }
            }
        }
        //处理methods 对象
        if (_vmOptions.hasOwnProperty('watch')) {
            for (let watchAttr in _vmOptions.watch) {
                if (nameSpace == DEFAULT_NAMESPACE) {
                    vmOptions.watch[watchAttr] = _vmOptions.watch[watchAttr];
                } else {

                    vmOptions.watch[nameSpace + "_" + watchAttr] = _vmOptions.watch[watchAttr];
                }
            }
        }
        //处理_initMethod 初始化执行函数
        if (_vmOptions.hasOwnProperty('_initMethod')) {
            vcFramework.initMethod.push(_vmOptions._initMethod);
        }
        //处理_initEvent
        if (_vmOptions.hasOwnProperty('_initEvent')) {
            vcFramework.initEvent.push(_vmOptions._initEvent);
        }

        //处理_initEvent_destroyedMethod
        if (_vmOptions.hasOwnProperty('_destroyedMethod')) {
            vcFramework.destroyedMethod.push(_vmOptions._destroyedMethod);
        }


    };
    //绑定跳转函数
    vcFramework.jumpToPage = function (url) {
        //判断 url 的模板是否 和当前url 模板一个
        if (url.indexOf('#') < 0) {
            window.location.href = url;
            return;
        }
        //保存路由信息
        vcFramework.saveComponentToPageRoute();
        let _targetUrl = url.substring(0, url.indexOf('#'));
        if (location.pathname != _targetUrl) {
            window.location.href = url;
            return;
        }
        //刷新框架参数
        //refreshVcFramework();
        //修改锚点
        location.hash = url.substring(url.indexOf("#") + 1, url.length);
        //vcFramework.reBuilderVcTree();
    };

    //跳转至商城
    vcFramework.jumpToMall = function (url) {
        let param = {
            params: {
                targetUrl: encodeURIComponent(url),
                communityId: vc.getCurrentCommunity().communityId
            }
        };
        //发送get请求
        vc.http.apiGet('/mall.getMallToken',
            param,
            function (json, res) {
                let _json = JSON.parse(json);
                if (_json.code != 0) {
                    vc.toast(_json.msg);
                    return;
                }
                let _url = _json.data.url;
                window.open(_url);
            },
            function () {
                console.log('请求失败处理');
            }
        );
    };

    //跳转至物联网
    vcFramework.jumpToIot = function (url) {
        let param = {
            params: {
                targetUrl: encodeURIComponent(url),
                communityId: vc.getCurrentCommunity().communityId
            }
        };
        //发送get请求
        vc.http.apiGet('/iot.getIotToken',
            param,
            function (json, res) {
                let _json = JSON.parse(json);
                if (_json.code != 0) {
                    vc.toast(_json.msg);
                    return;
                }
                let _url = _json.data.url;
                window.open(_url);
            },
            function () {
                console.log('请求失败处理');
            }
        );
    };

    //跳转至插件
    vcFramework.jumpToPlugin = function (url) {
        let param = {
            params: {
                targetUrl: encodeURIComponent(url),
                communityId: vc.getCurrentCommunity().communityId
            }
        };
        //发送get请求
        vc.http.apiGet('/plugin.getPluginToken',
            param,
            function (json, res) {
                let _json = JSON.parse(json);
                if (_json.code != 0) {
                    vc.toast(_json.msg);
                    return;
                }
                let _url = _json.data.url;
                window.open(_url);
            },
            function () {
                console.log('请求失败处理');
            }
        );
    };

    vcFramework.hasPlugin = function (_pluginType) {
        let _sysInfo = vc.getData('java110SystemInfo');
        if (!_sysInfo || !_sysInfo.hasOwnProperty("plugins")) {
            return false;
        }
        let _plugins = _sysInfo.plugins;
        let _hasPlugin = false;
        _plugins.forEach(_p => {
            if (_pluginType == _p.pluginType) {
                _hasPlugin = true;
            }
        })
        return _hasPlugin;
    };


    refreshVcFramework = function () {
        $that.$destroy();
        let _vmOptions = {
            el: '#component',
            data: {},
            watch: {},
            methods: {},
            destroyed: function () {
                window.vcFramework.destroyedMethod.forEach(function (eventMethod) {
                    eventMethod();
                });
                //清理所有定时器

                window.vcFramework.timers.forEach(function (timer) {
                    clearInterval(timer);
                });

                _timers = [];
            }

        };
        vcFramework.vmOptions = _vmOptions;
        vcFramework.initMethod = [];
        vcFramework.initEvent = [];
        vcFramework.component = {};
        vcFramework.destroyedMethod = [];
        vcFramework.namespace = [];
    };
    //保存菜单
    vcFramework.setCurrentMenu = function (_menuId) {
        window.localStorage.setItem('hc_menuId', _menuId);
    };
    //获取菜单
    vcFramework.getCurrentMenu = function () {
        return window.localStorage.getItem('hc_menuId');
    };

    //保存用户菜单
    vcFramework.setMenus = function (_menus) {
        window.localStorage.setItem('hc_menus', JSON.stringify(_menus));
    };
    //获取用户菜单
    vcFramework.getMenus = function () {
        return JSON.parse(window.localStorage.getItem('hc_menus'));
    };

    //保存菜单状态
    vcFramework.setMenuState = function (_menuState) {
        window.localStorage.setItem('hc_menu_state', _menuState);
    };
    //获取菜单状态
    vcFramework.getMenuState = function () {
        return window.localStorage.getItem('hc_menu_state');
    };

    //保存用户菜单
    vcFramework.saveData = function (_key, _value) {
        window.localStorage.setItem(_key, JSON.stringify(_value));
    };
    //保存用户菜单
    vcFramework.removeData = function (_key) {
        Object.keys(localStorage).forEach(item => item.indexOf(_key) !== -1 ? localStorage.removeItem(item) : '');
    };
    //获取用户菜单
    vcFramework.getData = function (_key) {
        return JSON.parse(window.localStorage.getItem(_key));
    };

    //保存当前小区信息 _communityInfo : {"communityId":"123213","name":"测试小区"}
    vcFramework.setCurrentCommunity = function (_currentCommunityInfo) {
        window.localStorage.setItem('hc_currentCommunityInfo', JSON.stringify(_currentCommunityInfo));
    };

    //获取当前小区信息
    // @return   {"communityId":"123213","name":"测试小区"}
    vcFramework.getCurrentCommunity = function () {
        let _community = JSON.parse(window.localStorage.getItem('hc_currentCommunityInfo'));

        if (!_community) {
            return {
                communityId: '-1',
                communityName: '未知'
            };
        }

        return _community;
    };

    //保存当前小区信息 _communityInfos : [{"communityId":"123213","name":"测试小区"}]
    vcFramework.setCommunitys = function (_communityInfos) {
        window.localStorage.setItem('hc_communityInfos', JSON.stringify(_communityInfos));
    };

    //获取当前小区信息
    // @return   {"communityId":"123213","name":"测试小区"}
    vcFramework.getCommunitys = function () {
        return JSON.parse(window.localStorage.getItem('hc_communityInfos'));
    };

    //删除缓存数据
    vcFramework.clearCacheData = function () {
        window.localStorage.clear();
        window.sessionStorage.clear();
    };

    //将org 对象的属性值赋值给dst 属性名为一直的属性
    vcFramework.copyObject = function (org, dst) {

        if (!org || !dst) {
            return;
        }
        //for(key in Object.getOwnPropertyNames(dst)){
        for (let key in dst) {
            if (org.hasOwnProperty(key)) {
                dst[key] = org[key]
            }
        }
    };

    vcFramework.copyArray = function (org) {
        let res = []
        if (!org) {
            return res;
        }

        for (let i = 0; i < org.length; i++) {
            res.push(org[i])
        }
        return res
    };

    vcFramework.resetObject = function (org) {
        if (!org) {
            return;
        }
        //for(key in Object.getOwnPropertyNames(dst)){
        for (let key in org) {
            if (typeof (key) == "string") {
                org[key] = ''
            }
        }
    };
    //扩展 现有的对象 没有的属性扩充上去
    vcFramework.extendObject = function (org, dst) {
        for (let key in dst) {
            if (!org.hasOwnProperty(key)) {
                dst[key] = org[key]
            }
        }
    };
    vcFramework.getComponentCode = function () {
        let _componentUrl = location.hash;

        //判断是否为组件页面
        if (!vcFramework.notNull(_componentUrl)) {
            return "/";
        }

        if (_componentUrl.lastIndexOf('#') < 0) {
            return "/";
        }

        let endPos = _componentUrl.length;
        if (_componentUrl.indexOf('?') > -1) {
            endPos = _componentUrl.indexOf('?');
        }

        _componentUrl = _componentUrl.substring(_componentUrl.lastIndexOf('#') + 1, endPos);
        return _componentUrl;
    }
    //获取url参数
    vcFramework.getParam = function (_key) {
        //返回当前 URL 的查询部分(问号 ? 之后的部分)。
        let urlParameters = location.search;
        if (!vcFramework.notNull(urlParameters)) {
            urlParameters = location.hash;

            if (urlParameters.indexOf('?') != -1) {
                urlParameters = urlParameters.substring(urlParameters.indexOf('?'), urlParameters.length);
            }
        }
        //如果该求青中有请求的参数,则获取请求的参数,否则打印提示此请求没有请求的参数
        if (urlParameters.indexOf('?') != -1) {
            //获取请求参数的字符串
            let parameters = decodeURI(urlParameters.substr(1));
            //将请求的参数以&分割中字符串数组
            parameterArray = parameters.split('&');
            //循环遍历,将请求的参数封装到请求参数的对象之中
            for (let i = 0; i < parameterArray.length; i++) {
                if (_key == parameterArray[i].split('=')[0]) {
                    return parameterArray[i].split('=')[1];
                }
            }
        }
        return "";
    };
    //查询url
    vcFramework.getUrl = function () {
        //返回当前 URL 的查询部分(问号 ? 之后的部分)。
        let urlParameters = location.pathname;
        return urlParameters;
    };
    vcFramework.isBack = function () {
        let _back = vc.getData("JAVA110_IS_BACK");

        if (_back == null) {
            return false;
        }
        vc.removeData("JAVA110_IS_BACK");
        let beforeTime = _back;
        let _date = new Date();
        //10 秒内有效
        if (_date.getTime() - beforeTime < 10 * 1000) {
            return true;
        }
        return false;
    };
    vcFramework.getBack = function () {
        //window.location.href = document.referrer;
        let _date = new Date();
        vc.saveData("JAVA110_IS_BACK", _date.getTime());
        window.history.back(-1);
    }
    vcFramework.goBack = function () {
        //window.location.href = document.referrer;
        let _date = new Date();
        vc.saveData("JAVA110_IS_BACK", _date.getTime());
        window.history.back(-1);
    }
    //对象转get参数
    vcFramework.objToGetParam = function (obj) {
        let str = [];
        for (let p in obj)
            if (obj.hasOwnProperty(p)) {
                str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
            }
        return str.join("&");
    };
    //空判断 true 为非空 false 为空
    vcFramework.notNull = function (_paramObj) {
        if (_paramObj == null || _paramObj == undefined || _paramObj.trim() == '') {
            return false;
        }
        return true;
    };
    vcFramework.isEmpty = function (_paramObj) {
        if (_paramObj == null || _paramObj == undefined) {
            return true;
        }
        return false;
    };
    //设置debug 模式
    vcFramework.setDebug = function (_param) {
        vcFramework.debug = _param;
    };
    //数据共享存放 主要为了组件间传递数据
    vcFramework.put = function (_key, _value) {
        vcFramework.map[_key] = _value;
    };
    //数据共享 获取 主要为了组件间传递数据
    vcFramework.get = function (_key) {
        return vcFramework.map[_key];
    };

    vcFramework.getDict = function (_name, _type, _callFun) {
        let param = {
            params: {
                name: _name,
                type: _type
            }
        };

        //发送get请求
        vcFramework.http.get('core', 'list', param,
            function (json, res) {
                if (res.status == 200) {
                    let _dictInfo = JSON.parse(json);
                    _callFun(_dictInfo);
                    return;
                }
            },
            function (errInfo, error) {
                console.log('请求失败处理');
            });
    }

    vcFramework.getAttrSpec = function (_tableName, _callFun, _domain) {
        let param = {
            params: {
                tableName: _tableName,
                page: 1,
                row: 100,
                domain: _domain
            }
        };

        //发送get请求
        vcFramework.http.apiGet('/attrSpec/queryAttrSpec', param,
            function (json, res) {
                let _attrSpecInfo = JSON.parse(json);

                if (_attrSpecInfo.code == 0) {
                    _callFun(_attrSpecInfo.data);
                    return;
                }
            },
            function (errInfo, error) {
                console.log('请求失败处理');
            });
    }


    vcFramework.getAttrValue = function (_specCd, _callFun, _domain) {
        let param = {
            params: {
                specCd: _specCd,
                page: 1,
                row: 100,
                domain: _domain
            }
        };

        //发送get请求
        vcFramework.http.apiGet('/attrValue/queryAttrValue', param,
            function (json, res) {
                let _attrSpecInfo = JSON.parse(json);

                if (_attrSpecInfo.code == 0) {
                    _callFun(_attrSpecInfo.data);
                    return;
                }
            },
            function (errInfo, error) {
                console.log('请求失败处理');
            });
    }

    vcFramework.refreshSystemInfo = function () {
        let param = {
            params: {
                page: 1,
                row: 1,
            }
        };

        //发送get请求
        vcFramework.http.apiGet('/system.listSystemInfo', param,
            function (json, res) {
                let _systemInfo = JSON.parse(json);

                if (_systemInfo.code != 0) {
                    return;
                }

                if (!_systemInfo.data || _systemInfo.data.length < 1) {
                    return;
                }

                let _data = _systemInfo.data[0];


                document.title = _data.systemTitle;
                let _logoImg = document.getElementsByClassName('java110-logo');
                if (_logoImg && _logoImg.length > 0) {
                    let _image = document.createElement('img')
                    _image.src = _data.logoUrl;
                    _image.style.width = "300px";
                    _image.style.height = "80px";

                    _logoImg[0].appendChild(_image);
                }

                let _subSystemName = document.getElementsByClassName('java110-sub-system-name');
                if (_subSystemName && _subSystemName.length > 0) {
                    _subSystemName[0].innerHTML = _data.subSystemTitle;
                }
                let _companyTeam = document.getElementsByClassName('java110-company-team');
                if (_companyTeam && _companyTeam.length > 0) {
                    _companyTeam[0].innerHTML = _data.companyName;
                }



                vc.saveData('java110SystemInfo', _data)
            },
            function (errInfo, error) {
                console.log('请求失败处理');
            });
    }




})(window.vcFramework);

/**
 vc 定时器处理
 **/
(function (w, vcFramework) {

    /**
     创建定时器
     **/
    vcFramework.createTimer = function (func, sec) {
        let _timer = w.setInterval(func, sec);
        vcFramework.timers.push(_timer); //这里将所有的定时器保存起来,页面退出时清理

        return _timer;
    };
    //清理定时器
    vcFramework.clearTimer = function (timer) {
        clearInterval(timer);
    }


})(window, window.vcFramework);

/**
 * vcFramework.toast("");
 时间处理工具类
 **/
(function (vcFramework) {
    function add0(m) {
        return m < 10 ? '0' + m : m
    }



    vcFramework.dateTimeFormat = function (shijianchuo) {
        //shijianchuo是整数,否则要parseInt转换
        let time = new Date(parseInt(shijianchuo));
        let y = time.getFullYear();
        let m = time.getMonth() + 1;
        let d = time.getDate();
        let h = time.getHours();
        let mm = time.getMinutes();
        let s = time.getSeconds();
        return y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
    }

    vcFramework.dateFormat = function (_time) {
        let _date = new Date(_time);
        let y = _date.getFullYear();
        let m = _date.getMonth() + 1;
        let d = _date.getDate();
        return y + '-' + add0(m) + '-' + add0(d);
    }

    vcFramework.timeFormat = function (_time) {
        let _date = new Date(_time);
        let h = _date.getHours();
        let mm = _date.getMinutes();
        let s = _date.getSeconds();
        return add0(h) + ':' + add0(mm) + ':' + add0(s);
    }
    vcFramework.timeMinFormat = function (_time) {
        let _date = new Date(_time);
        let h = _date.getHours();
        let mm = _date.getMinutes();
        return add0(h) + ':' + add0(mm);
    }

    vcFramework.dateSubOneDay = function (_startTime, _endTime, feeFlag) {
        if (!_endTime || _endTime == '-') {
            return _endTime
        }
        let dateTime = new Date(_endTime);
        let startTime = new Date(_startTime);
        //如果开始时间是31日 结束时间是30日 不做处理
        let _startTimeLastDay = startTime.getDate();
        let _endTimeLastDay = dateTime.getDate();
        if (_startTimeLastDay == 31 && _endTimeLastDay == 30) {
            return vcFramework.dateFormat(dateTime);
        }

        //2月份特殊处理
        let _endTimeMonth = dateTime.getMonth();
        if (_endTimeMonth == 1 && _endTimeLastDay > 26 && _startTimeLastDay > 26) {
            return vcFramework.dateFormat(dateTime);
        }

        if (feeFlag != "2006012") {
            dateTime = dateTime.setDate(dateTime.getDate() - 1);
        }
        dateTime = vcFramework.dateFormat(dateTime)
        return dateTime;
    }

    vcFramework.dateSub = function (dateTime, feeFlag) {
        if (!dateTime || dateTime == '-') {
            return dateTime
        }
        console.log("feeFlag:" + feeFlag);
        dateTime = new Date(dateTime);
        if (feeFlag != "2006012") {
            dateTime = dateTime.setDate(dateTime.getDate() - 1);
        }
        dateTime = vcFramework.dateFormat(dateTime)
        return dateTime;
    }
    vcFramework.dateAdd = function (dateTime) {
        if (!dateTime || dateTime == '-') {
            return dateTime
        }
        dateTime = new Date(dateTime);
        dateTime = dateTime.setDate(dateTime.getDate() + 1);
        dateTime = vcFramework.dateFormat(dateTime)
        return dateTime;
    }

    vcFramework.addOneDay = function (date) {
        // 将给定的日期转换为Date对象
        let currentDate = new Date(date);
        // 获取当前日期的时间戳
        let timestamp = currentDate.getTime();
        // 将时间戳加上一天的毫秒数(24小时 * 60分钟 * 60秒 * 1000毫秒)
        timestamp += 24 * 60 * 60 * 1000;
        // 根据新的时间戳创建一个新的Date对象
        const newDate = new Date(timestamp);
        // 返回新的日期对象
        return newDate;
    }


    vcFramework.getDateYYYYMMDDHHMISS = function () {
        let date = new Date();
        let year = date.getFullYear();
        let month = date.getMonth() + 1;
        let day = date.getDate();
        let hour = date.getHours();
        let minute = date.getMinutes();
        let second = date.getSeconds();

        if (month < 10) {
            month = '0' + month;
        }

        if (day < 10) {
            day = '0' + day;
        }

        if (hour < 10) {
            hour = '0' + hour;
        }

        if (minute < 10) {
            minute = '0' + minute;
        }

        if (second < 10) {
            second = '0' + second;
        }

        return year + "" + month + "" + day + "" + hour + "" + minute + "" + second;
    };

    vcFramework.getDateYYYYMMDD = function () {
        let date = new Date();
        let year = date.getFullYear();
        let month = date.getMonth() + 1;
        let day = date.getDate();

        if (month < 10) {
            month = '0' + month;
        }

        if (day < 10) {
            day = '0' + day;
        }


        return year + "-" + month + "-" + day;
    };

    vcFramework.initDateTime = function (_dateStr, _callBack) {
        $('.' + _dateStr).datetimepicker({
            language: 'zh-CN',
            fontAwesome: 'fa',
            format: 'yyyy-mm-dd hh:ii:ss',
            initTime: true,
            initialDate: new Date(),
            autoClose: 1,
            todayBtn: true
        });
        $('.' + _dateStr).datetimepicker()
            .on('changeDate', function (ev) {
                var value = $('.' + _dateStr).val();
                //vc.component.addFeeConfigInfo.startTime = value;
                _callBack(value);
            });
    }

    vcFramework.initDate = function (_dateStr, _callBack) {
        $('.' + _dateStr).datetimepicker({
            language: 'zh-CN',
            minView: 'month',
            fontAwesome: 'fa',
            format: 'yyyy-mm-dd',
            initTime: true,
            initialDate: new Date(),
            autoClose: 1,
            todayBtn: true

        });
        $('.' + _dateStr).datetimepicker()
            .on('changeDate', function (ev) {
                let value = $('.' + _dateStr).val();
                //vc.component.addFeeConfigInfo.startTime = value;
                _callBack(value);
            });
    }

    vcFramework.initHourMinute = function (_dateStr, _callBack) {
        $('.' + _dateStr).datetimepicker({
            language: 'zh-CN',
            fontAwesome: 'fa',
            format: 'hh:ii',
            initTime: true,
            startView: 'day',
            autoClose: 1,
            todayBtn: true

        });
        $('.' + _dateStr).datetimepicker()
            .on('changeDate', function (ev) {
                var value = $('.' + _dateStr).val();
                //vc.component.addFeeConfigInfo.startTime = value;
                _callBack(value);
            });
    }

    vcFramework.initDateMonth = function (_dateStr, _callBack) {
        $('.' + _dateStr).datetimepicker({
            language: 'zh-CN',
            fontAwesome: 'fa',
            format: 'yyyy-mm',
            initTime: true,
            startView: 3,
            minView: 3,
            initialDate: new Date(),
            autoClose: 1,
            todayBtn: true
        });
        $('.' + _dateStr).datetimepicker()
            .on('changeDate', function (ev) {
                let value = $('.' + _dateStr).val();
                //vc.component.addFeeConfigInfo.startTime = value;
                _callBack(value);
            });
    }

    vcFramework.getCurrentMonthMaxDay = function () {
        let _date = new Date();
        let y = _date.getFullYear();
        let m = _date.getMonth();
        return vcFramework.daysInMonth(y, m);
    }

    vcFramework.daysInMonth = function (year, month) {
        if (month == 1) {
            if (year % 4 == 0 && year % 100 != 0)
                return 29;
            else
                return 28;
        } else if ((month <= 6 && month % 2 == 0) || (month = 6 && month % 2 == 1))
            return 31;
        else
            return 30;
    }

    vcFramework.unum = function (_money) {
        return parseFloat(_money) * -1;
    }

    vcFramework.addMonth = function (_date, _month) {
        let y = _date.getFullYear();
        let m = _date.getMonth();
        let nextY = y;
        let nextM = m;
        //如果当前月+要加上的月>11 这里之所以用11是因为 js的月份从0开始
        if ((m + _month) > 11) {
            nextY = y + 1;
            nextM = parseInt(m + _month) - 12;
        } else {
            nextM = m + _month
        }
        let daysInNextMonth = vcFramework.daysInMonth(nextY, nextM);
        let day = _date.getDate();
        if (day > daysInNextMonth) {
            day = daysInNextMonth;
        }
        let _newDate = new Date(nextY, nextM, day)
        return _newDate.getFullYear() + '-' + (_newDate.getMonth() + 1) + '-' + _newDate.getDate() + " " + _date.getHours() + ":" + _date.getMinutes() + ":" + _date.getSeconds();
    };
    vcFramework.addMonthDate = function (_date, _month) {
        let y = _date.getFullYear();
        let m = _date.getMonth();
        let nextY = y;
        let nextM = m;
        //如果当前月+要加上的月>11 这里之所以用11是因为 js的月份从0开始
        if ((m + _month) > 11) {
            nextY = y + 1;
            nextM = parseInt(m + _month) - 12;
        } else {
            nextM = m + _month
        }
        let daysInNextMonth = vcFramework.daysInMonth(nextY, nextM);
        let day = _date.getDate();
        if (day > daysInNextMonth) {
            day = daysInNextMonth;
        }
        let _newDate = new Date(nextY, nextM, day)
        return _newDate.getFullYear() + '-' + add0(_newDate.getMonth() + 1) + '-' + add0(_newDate.getDate());
    };

    vcFramework.addPersonMonth = function (_date, _month) {
        // 设置日期为下个月
        _date.setMonth(_date.getMonth() + 1);
        // 如果日期是31号,并且下个月没有31号(例如2月),则日期会自动调整为下个月的最后一天
        // 因此,我们需要手动调整日期为下个月的最后一天的前一天
        var daysInNextMonth = new Date(_date.getFullYear(), _date.getMonth() + 1, 0).getDate();
        if (_date.getDate() > daysInNextMonth) {
            _date.setDate(daysInNextMonth);
        }

        // 减去一天
        _date.setDate(_date.getDate() - 1);

        // 输出结果
        console.log(_date);
        return _date.getFullYear() + '-' + add0(_date.getMonth() + 1) + '-' + add0(_date.getDate());
    };


    vcFramework.popover = function (_className) {
        $("." + _className).mouseover(() => {
            $("." + _className).popover('show');
        })
        $("." + _className).mouseleave(() => {
            $("." + _className).popover('hide');
        })
    }

    vcFramework.getWeek = function (_week) {
        if (_week == 1) {
            return '第一周';
        }
        if (_week == 2) {
            return '第二周';
        }
        if (_week == 3) {
            return '第三周';
        }
        if (_week == 4) {
            return '第四周';
        }

    }

    vcFramework.getWorkDay = function (_day) {
        if (_day == 1) {
            return '星期一';
        }
        if (_day == 2) {
            return '星期二';
        }
        if (_day == 3) {
            return '星期三';
        }
        if (_day == 4) {
            return '星期四';
        }
        if (_day == 5) {
            return '星期五';
        }
        if (_day == 6) {
            return '星期六';
        }
        if (_day == 7) {
            return '星期日';
        }
    }
})(window.vcFramework);

(function (vcFramework) {
    vcFramework.propTypes = {
        string: "string", //字符串类型
        array: "array",
        object: "object",
        number: "number"
    }
})(window.vcFramework);

/**
 toast
 **/
(function (vcFramework) {
    vcFramework.toast = function Toast(msg, duration) {
        duration = isNaN(duration) ? 3000 : duration;
        let m = document.createElement('div');
        m.innerHTML = msg;
        m.style.cssText = "max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 30%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
        document.body.appendChild(m);
        setTimeout(function () {
            let d = 0.5;
            m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
            m.style.opacity = '0';
            setTimeout(function () {
                document.body.removeChild(m)
            }, d * 1000);
        }, duration);
    }
})(window.vcFramework);

/**
 toast
 **/
(function (vcFramework) {
    vcFramework.speckText = function (msg) {
        let utterThis = new window.SpeechSynthesisUtterance();
        utterThis.text = msg; //播放内容
        utterThis.pitch = 2; //表示说话的音高,数值,范围从0(最小)到2(最大)。默认值为1
        utterThis.rate = 1; //语速,数值,默认值是1,范围是0.1到10
        utterThis.lang = 'zh-CN';
        utterThis.volume = 100; // 声音的音量
        window.speechSynthesis.speak(utterThis);
        // console.log("播放内容:" + str);
    }
})(window.vcFramework);

/**
 isNumber
 **/
(function (vcFramework) {
    vcFramework.isNumber = function (val) {

        var regPos = /^\d+(\.\d+)?$/; //非负浮点数
        var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
        if (regPos.test(val) || regNeg.test(val)) {
            return true;
        } else {
            return false;
        }
    }
})(window.vcFramework);

/**
 toast
 **/
(function (vcFramework) {
    vcFramework.urlToBase64 = function urlToBase64(_url, _callFun) {
        let imgData;
        let reader = new FileReader();
        getImageBlob(_url, function (blob) {
            reader.readAsDataURL(blob);
        });
        reader.onload = function (e) {
            imgData = e.target.result;
            _callFun(imgData);
        };

        function getImageBlob(_url, cb) {
            let xhr = new XMLHttpRequest();
            xhr.open("get", _url, true);
            xhr.responseType = "blob";
            xhr.onload = function () {
                if (this.status == 200) {
                    if (cb) cb(this.response);
                }
            };
            xhr.send();
        }
    }
})(window.vcFramework);

/***
 * vc component 0.1 版本代码合并过来(end)-----------------------------------------------------------------------
 */
/**
 初始化vue 对象
 @param vc vue component对象
 @param vmOptions Vue参数
 **/
(function (vcFramework) {
    vcFramework.initVue = function () {
        let vmOptions = vcFramework.vmOptions;
        //console.log("vmOptions:", vmOptions);
        vcFramework.vue = new Vue(vmOptions);
        vcFramework.component = vcFramework.vue;
        //方便二次开发
        window.$that = vcFramework.vue;
        //发布vue 创建完成 事件
        document.dispatchEvent(vcFramework.vcFrameworkEvent);
    }
})(window.vcFramework);


/**
 * vcFramwork init
 * 框架开始初始化
 */
(function (vcFramework) {

    vcFramework.builderVcTree();
    vcFramework.refreshSystemInfo();


})(window.vcFramework);


/**
 vc监听事件
 **/
(function (vcFramework) {
    /**
     事件监听
     **/
    vcFramework.on = function () {
        let _namespace = "";
        let _componentName = "";
        let _value = "";
        let _callback = undefined;
        if (arguments.length == 4) {
            _namespace = arguments[0];
            _componentName = arguments[1];
            _value = arguments[2];
            _callback = arguments[3];
        } else if (arguments.length == 3) {
            _componentName = arguments[0];
            _value = arguments[1];
            _callback = arguments[2];
        } else {
            console.error("执行on 异常,vcFramework.on 参数只能是3个 或4个");
            return;
        }
        if (vcFramework.notNull(_namespace)) {
            vcFramework.vue.$on(_namespace + "_" + _componentName + '_' + _value,
                function (param) {
                    if (vcFramework.debug) {
                        console.log("监听ON事件", _namespace, _componentName, _value, param);
                    }
                    _callback(param);
                }
            );
            return;
        }
        vcFramework.vue.$on(_componentName + '_' + _value,
            function (param) {
                if (vcFramework.debug) {
                    console.log("监听ON事件", _componentName, _value, param);
                }
                _callback(param);
            }
        );
    };

    /**
     事件触发
     **/
    vcFramework.emit = function () {
        let _namespace = "";
        let _componentName = "";
        let _value = "";
        let _param = undefined;
        if (arguments.length == 4) {
            _namespace = arguments[0];
            _componentName = arguments[1];
            _value = arguments[2];
            _param = arguments[3];
        } else if (arguments.length == 3) {
            _componentName = arguments[0];
            _value = arguments[1];
            _param = arguments[2];
        } else {
            console.error("执行on 异常,vcFramework.on 参数只能是3个 或4个");
            return;
        }
        if (vcFramework.debug) {
            console.log("监听emit事件", _namespace, _componentName, _value, _param);
        }
        if (vcFramework.notNull(_namespace)) {
            vcFramework.vue.$emit(_namespace + "_" + _componentName + '_' + _value, _param);
            return;
        }
        vcFramework.vue.$emit(_componentName + '_' + _value, _param);
    };
})(window.vcFramework);

/**
 * vue对象 执行初始化方法
 */
(function (vcFramework) {
    vcFramework.initVcComponent = function () {
        vcFramework.initEvent.forEach(function (eventMethod) {
            eventMethod();
        });
        vcFramework.initMethod.forEach(function (callback) {
            callback();
        });
        vcFramework.namespace.forEach(function (_param) {
            vcFramework[_param.namespace] = vcFramework.vue[_param.namespace];
        });
    }
})(window.vcFramework);
/**
 * 锚点变化监听
 */
(function (vcFramework) {
    window.addEventListener("hashchange", function (e) {
        let _componentUrl = location.hash;
        //判断是否为组件页面
        if (!vcFramework.notNull(_componentUrl)) {
            return;
        }
        //获取参数
        let _tab = vc.getParam('tab')

        if (_tab) {
            vcFramework.setTabToLocal({
                url: _componentUrl,
                name: _tab
            });
        }
        refreshVcFramework();
        vcFramework.reBuilderVcTree();
    }, false);
})(window.vcFramework);

/**
 vc 校验 工具类 -method
 (1)、required:true               必输字段
 (2)、remote:"remote-valid.jsp"   使用ajax方法调用remote-valid.jsp验证输入值
 (3)、email:true                  必须输入正确格式的电子邮件
 (4)、url:true                    必须输入正确格式的网址
 (5)、date:true                   必须输入正确格式的日期,日期校验ie6出错,慎用
 (6)、dateISO:true                必须输入正确格式的日期(ISO),例如:2009-06-23,1998/01/22 只验证格式,不验证有效性
 (7)、number:true                 必须输入合法的数字(负数,小数)
 (8)、digits:true                 必须输入整数
 (9)、creditcard:true             必须输入合法的信用卡号
 (10)、equalTo:"#password"        输入值必须和#password相同
 (11)、accept:                    输入拥有合法后缀名的字符串(上传文件的后缀)
 (12)、maxlength:5                输入长度最多是5的字符串(汉字算一个字符)
 (13)、minlength:10               输入长度最小是10的字符串(汉字算一个字符)
 (14)、rangelength:[5,10]         输入长度必须介于 5 和 10 之间的字符串")(汉字算一个字符)
 (15)、range:[5,10]               输入值必须介于 5 和 10 之间
 (16)、max:5                      输入值不能大于5
 (17)、min:10                     输入值不能小于10
 **/
(function (vcFramework) {
    let validate = {
        state: true,
        errInfo: '',
        setState: function (_state, _errInfo) {
            this.state = _state;
            if (!this.state) {
                this.errInfo = _errInfo
                throw "校验失败:" + _errInfo;
            }
        },

        /**
         校验手机号
         **/
        phone: function (text) {
            let regPhone = /^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/;
            return regPhone.test(text);
        },
        /**
         校验邮箱
         **/
        email: function (text) {
            let regEmail = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式
            return regEmail.test(text);
        },
        /**
            校验车牌号
        **/
        carnumber: function (text) {
            let regCarNumber = new RegExp("^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-HJ-NP-Z]{1}(([A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$)|([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))"); //正则表达式
            return regCarNumber.test(text);
        },
        /**
         * 必填
         * @param {参数} text
         */
        required: function (text) {
            if (text == undefined || text == null || text == "") {
                return false;
            }
            return true;
        },
        /**
         * 校验长度
         * @param {校验文本} text
         * @param {最小长度} minLength
         * @param {最大长度} maxLength
         */
        maxin: function (text, minLength, maxLength) {
            if (text.length < minLength || text.length > maxLength) {
                return false;
            }
            return true;
        },
        /**
         * 校验长度
         * @param {校验文本} text
         * @param {最大长度} maxLength
         */
        maxLength: function (text, maxLength) {
            if (text.length > maxLength) {
                return false;
            }
            return true;
        },
        /**
         * 校验最小长度
         * @param {校验文本} text
         * @param {最小长度} minLength
         */
        minLength: function (text, minLength) {
            if (text.length < minLength) {
                return false;
            }
            return true;
        },
        /**
         * 全是数字
         * @param {校验文本} text
         */
        num: function (text) {
            if (text == null || text == undefined) {
                return true;
            }
            let regNum = /^[0-9][0-9]*$/;
            return regNum.test(text);
        },
        date: function (str) {
            if (str == null || str == undefined) {
                return true;
            }
            let regDate = /^(\d{4})-(\d{2})-(\d{2})$/;
            return regDate.test(str);
        },
        dateTime: function (str) {
            if (str == null || str == undefined) {
                return true;
            }
            let reDateTime = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
            return reDateTime.test(str);
        },
        /**
         金额校验
         **/
        money: function (text) {
            if (text == null || text == undefined) {
                return true;
            }
            let regMoney = /^\-?\d+\.?\d{0,2}$/;
            return regMoney.test(text);
        },
        /**
         系数校验
         **/
        moneyModulus: function (text) {
            if (text == null || text == undefined) {
                return true;
            }
            let regMoney = /^\-?\d+\.?\d{0,4}$/;
            return regMoney.test(text);
        },
        idCard: function (num) {
            if (num == null || num == undefined || num == '') {
                return true;
            }
            num = num.toUpperCase();
            //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。
            if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
                return false;
            }
            return true;
        },
        /**
            校验最小值
        **/
        min: function (text, minVal) {
            if (parseFloat(text) >= parseFloat(minVal)) {
                return true;
            }
            return false;
        },
        /**
            校验最大值
        **/
        max: function (text, maxVal) {
            if (parseFloat(text) <= parseFloat(maxVal)) {
                return true;
            }
            return false;
        },

    };
    vc.validate = validate;
})(window.vcFramework);

/**
 * 校验 -core
 */
(function (validate) {

    /**
     * 根据配置校验
     *
     * eg:
     * dataObj:
     * {
     *      name:"Kevin",
     *      age:"19",
     *      emailInfo:{
     *          email:"928255095@qq.com"
     *      }
     * }
     *
     * dataConfig:
     * {
     *      "name":[
                    {
                       limit:"required",
                       param:"",
                       errInfo:'用户名为必填'
                    },
                    {
                        limit:"maxin",
                       param:"1,10",
                       errInfo:'用户名必须为1到10个字之间'
                    }]
     * }
     *
     */
    validate.validate = function (dataObj, dataConfig) {
        try {
            // 循环配置(每个字段)
            for (let key in dataConfig) {
                //配置信息
                let tmpDataConfigValue = dataConfig[key];
                //对key进行处理
                let keys = key.split(".");
                console.log("keys :", keys);
                let tmpDataObj = dataObj;
                //根据配置获取 数据值
                keys.forEach(function (tmpKey) {
                    console.log('tmpDataObj:', tmpDataObj);
                    tmpDataObj = tmpDataObj[tmpKey]
                });
                //                for(let tmpKey in keys){
                //                    console.log('tmpDataObj:',tmpDataObj);
                //                    tmpDataObj = tmpDataObj[tmpKey]
                //                }

                tmpDataConfigValue.forEach(function (configObj) {
                    if (configObj.limit == "required") {
                        validate.setState(validate.required(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'phone') {
                        validate.setState(validate.phone(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'email') {
                        validate.setState(validate.email(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'carnumber') {
                        validate.setState(validate.carnumber(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'maxin') {
                        let tmpParam = configObj.param.split(",")
                        validate.setState(validate.maxin(tmpDataObj, tmpParam[0], tmpParam[1]), configObj.errInfo);
                    }
                    if (configObj.limit == 'maxLength') {
                        validate.setState(validate.maxLength(tmpDataObj, configObj.param), configObj.errInfo);
                    }
                    if (configObj.limit == 'minLength') {
                        validate.setState(validate.minLength(tmpDataObj, configObj.param), configObj.errInfo);
                    }
                    if (configObj.limit == 'num') {
                        validate.setState(validate.num(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'date') {
                        validate.setState(validate.date(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'dateTime') {
                        validate.setState(validate.dateTime(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'money') {
                        validate.setState(validate.money(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'idCard') {
                        validate.setState(validate.idCard(tmpDataObj), configObj.errInfo);
                    }
                    if (configObj.limit == 'min') {
                        validate.setState(validate.min(tmpDataObj, configObj.param), configObj.errInfo);
                    }
                    if (configObj.limit == 'max') {
                        validate.setState(validate.max(tmpDataObj, configObj.param), configObj.errInfo);
                    }
                });

            }
        } catch (error) {
            console.log("数据校验失败", validate.state, validate.errInfo, error);
            return false;
        }
        return true;
    }
})(window.vcFramework.validate);

/**
 对 validate 进行二次封装
 **/
(function (vcFramework) {
    vcFramework.check = function (dataObj, dataConfig) {
        return vcFramework.validate.validate(dataObj, dataConfig);
    }
})(window.vcFramework);

/**
 * 监听div 大小
 */
(function (vcFramework) {
    vcFramework.eleResize = {
        _handleResize: function (e) {
            let ele = e.target || e.srcElement;
            let trigger = ele.__resizeTrigger__;
            if (trigger) {
                let handlers = trigger.__z_resizeListeners;
                if (handlers) {
                    let size = handlers.length;
                    for (let i = 0; i < size; i++) {
                        let h = handlers[i];
                        let handler = h.handler;
                        let context = h.context;
                        handler.apply(context, [e]);
                    }
                }
            }
        },
        _removeHandler: function (ele, handler, context) {
            let handlers = ele.__z_resizeListeners;
            if (handlers) {
                let size = handlers.length;
                for (let i = 0; i < size; i++) {
                    let h = handlers[i];
                    if (h.handler === handler && h.context === context) {
                        handlers.splice(i, 1);
                        return;
                    }
                }
            }
        },
        _createResizeTrigger: function (ele) {
            let obj = document.createElement('object');
            obj.setAttribute('style',
                'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden;opacity: 0; pointer-events: none; z-index: -1;');
            obj.onload = vcFramework.eleResize._handleObjectLoad;
            obj.type = 'text/html';
            ele.appendChild(obj);
            obj.data = 'about:blank';
            return obj;
        },
        _handleObjectLoad: function (evt) {
            this.contentDocument.defaultView.__resizeTrigger__ = this.__resizeElement__;
            this.contentDocument.defaultView.addEventListener('resize', vcFramework.eleResize._handleResize);
        }
    };
    if (document.attachEvent) { //ie9-10
        vcFramework.eleResize.on = function (ele, handler, context) {
            let handlers = ele.__z_resizeListeners;
            if (!handlers) {
                handlers = [];
                ele.__z_resizeListeners = handlers;
                ele.__resizeTrigger__ = ele;
                ele.attachEvent('onresize', EleResize._handleResize);
            }
            handlers.push({
                handler: handler,
                context: context
            });
        };
        vcFramework.eleResize.off = function (ele, handler, context) {
            let handlers = ele.__z_resizeListeners;
            if (handlers) {
                EleResize._removeHandler(ele, handler, context);
                if (handlers.length === 0) {
                    ele.detachEvent('onresize', EleResize._handleResize);
                    delete ele.__z_resizeListeners;
                }
            }
        }
    } else {
        vcFramework.eleResize.on = function (ele, handler, context) {
            let handlers = ele.__z_resizeListeners;
            if (!handlers) {
                handlers = [];
                ele.__z_resizeListeners = handlers;
                if (getComputedStyle(ele, null).position === 'static') {
                    ele.style.position = 'relative';
                }
                let obj = vcFramework.eleResize._createResizeTrigger(ele);
                ele.__resizeTrigger__ = obj;
                obj.__resizeElement__ = ele;
            }
            handlers.push({
                handler: handler,
                context: context
            });
        };
        vcFramework.eleResize.off = function (ele, handler, context) {
            let handlers = ele.__z_resizeListeners;
            if (handlers) {
                vcFramework.eleResize._removeHandler(ele, handler, context);
                if (handlers.length === 0) {
                    let trigger = ele.__resizeTrigger__;
                    if (trigger) {
                        trigger.contentDocument.defaultView.removeEventListener('resize', EleResize._handleResize);
                        ele.removeChild(trigger);
                        delete ele.__resizeTrigger__;
                    }
                    delete ele.__z_resizeListeners;
                }
            }
        }
    }
})(window.vcFramework);

//全屏处理 这个后面可以关掉
(function (vcFramework) {
    vcFramework._fix_height = (_targetDiv) => {
        //只要窗口高度发生变化,就会进入这里面,在这里就可以写,回到聊天最底部的逻辑
        let _vcPageHeight = document.getElementsByClassName('vc-page-height')[0];
        //浏览器可见高度
        let _minHeight = document.documentElement.clientHeight;
        let _scollHeight = _targetDiv.scrollHeight;
        if (_scollHeight < _minHeight) {
            _scollHeight = _minHeight
        }
        _vcPageHeight.style.minHeight = _scollHeight + 'px';
        //console.log('是否设置高度', _vcPageHeight.style.minHeight);
    }
})(window.vcFramework);

/**
 * 权限处理
 */
(function (vcFramework) {
    let _staffPrivilege = vc.getData('hc_staff_privilege');
    if (_staffPrivilege == null) {
        _staffPrivilege = [];
    }
    vcFramework.hasPrivilege = (_privalege) => {
        //只要窗口高度发生变化,就会进入这里面,在这里就可以写,回到聊天最底部的逻辑
        let _privaleges = _privalege.split(',');
        let _hasPri = false;
        _privaleges.forEach(item => {
            if (_staffPrivilege.includes(item)) {
                _hasPri = true;
            }
        })
        return _hasPri;
    }
})(window.vcFramework);


//图片压缩处理

(function (vcFramework) {
    vcFramework.dataURLtoFile = function (dataUrl, fileName) {
        let arr = dataUrl.split(','),
            mime = arr[0].match(/:(.*?);/)[1],
            bstr = atob(arr[1]),
            n = bstr.length,
            u8arr = new Uint8Array(n);
        while (n--) {
            u8arr[n] = bstr.charCodeAt(n);
        }
        return new File([u8arr], fileName, { type: mime });
    }
    vcFramework.translate = function (imgSrc, callback) {
        var img = new Image();
        img.src = imgSrc;
        img.onload = function () {
            var that = this;
            var h = that.height;
            // 默认按比例压缩
            var w = that.width;
            if (h > 1080 || w > 1080) {
                let _rate = 0;
                if (h > w) {
                    _rate = h / 1080;
                    h = 1080;
                    w = Math.floor(w / _rate);
                } else {
                    _rate = w / 1080;
                    w = 1080;
                    h = Math.floor(h / _rate);
                }
            }
            var canvas = document.createElement('canvas');
            var ctx = canvas.getContext('2d');
            var anw = document.createAttribute("width");
            anw.nodeValue = w;
            var anh = document.createAttribute("height");
            anh.nodeValue = h;
            canvas.setAttributeNode(anw);
            canvas.setAttributeNode(anh);
            ctx.drawImage(that, 0, 0, w, h);
            //压缩比例
            var quality = 0.3;
            var base64 = canvas.toDataURL('image/jpeg', quality);
            canvas = null;
            callback(base64);

        }
    }
})(window.vcFramework);

/**
 * 水印处理
 */

(function (vcFramework) {
    vcFramework.watermark = function (settings) {
        //默认设置
        var defaultSettings = {
            watermark_txt: "text",
            watermark_x: 20, //水印起始位置x轴坐标
            watermark_y: 20, //水印起始位置Y轴坐标
            watermark_rows: 100, //水印行数
            watermark_cols: 20, //水印列数
            watermark_x_space: 10, //水印x轴间隔
            watermark_y_space: 10, //水印y轴间隔
            watermark_color: '#aaa', //水印字体颜色
            watermark_alpha: 0.3, //水印透明度
            watermark_fontsize: '15px', //水印字体大小
            watermark_font: '微软雅黑', //水印字体
            watermark_width: 150, //水印宽度
            watermark_height: 80, //水印长度
            watermark_angle: 15 //水印倾斜度数
        };
        //采用配置项替换默认值,作用类似jquery.extend
        if (arguments.length === 1 && typeof arguments[0] === "object") {
            var src = arguments[0] || {};
            for (key in src) {
                if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key])
                    continue;
                else if (src[key])
                    defaultSettings[key] = src[key];
            }
        }

        let oTemp = document.createDocumentFragment();

        //获取页面最大宽度
        let page_width = Math.max(document.body.scrollWidth, document.body.clientWidth);
        let cutWidth = page_width * 0.0150;
        page_width = page_width - cutWidth;
        //获取页面最大高度
        let page_height = Math.max(document.body.scrollHeight - 80, document.body.clientHeight - 40);
        // var page_height = document.body.scrollHeight+document.body.scrollTop;
        //如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
        if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings.watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (defaultSettings.watermark_cols - 1)) > page_width)) {
            defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings.watermark_x_space));
            defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x - defaultSettings.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
        }
        //如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
        if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (defaultSettings.watermark_rows - 1)) > page_height)) {
            defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height - defaultSettings.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
            defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) - defaultSettings.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
        }
        let x;
        let y;
        for (let i = 0; i < defaultSettings.watermark_rows; i++) {
            y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
            for (let j = 0; j < defaultSettings.watermark_cols; j++) {
                x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;
                var mask_div = document.createElement('div');
                mask_div.id = 'mask_div' + i + j;
                mask_div.className = 'mask_div';
                mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
                //设置水印div倾斜显示
                mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                mask_div.style.visibility = "";
                mask_div.style.position = "fixed";
                mask_div.style.left = x + 'px';
                mask_div.style.top = y + 'px';
                mask_div.style.overflow = "hidden";
                mask_div.style.zIndex = "9999";
                mask_div.style.pointerEvents = 'none'; //pointer-events:none  让水印不遮挡页面的点击事件
                //mask_div.style.border="solid #eee 1px";
                mask_div.style.opacity = defaultSettings.watermark_alpha;
                mask_div.style.fontSize = defaultSettings.watermark_fontsize;
                mask_div.style.fontFamily = defaultSettings.watermark_font;
                mask_div.style.color = defaultSettings.watermark_color;
                mask_div.style.textAlign = "center";
                mask_div.style.width = defaultSettings.watermark_width + 'px';
                mask_div.style.height = defaultSettings.watermark_height + 'px';
                mask_div.style.display = "block";
                //交叉网格显示
                if ((i % 2 == 0) && (j % 2 == 0)) {
                    oTemp.appendChild(mask_div);
                }
                if ((i % 2 == 1) && (j % 2 == 1)) {
                    oTemp.appendChild(mask_div);
                }
            };
        };
        document.body.appendChild(oTemp);
    }
})(window.vcFramework);



(function (vcFramework) {

    vcFramework.getPageRouteFromLocal = function () {
        let routesStr = window.localStorage.getItem('vcPageRoute');

        let routes = [];

        if (!routesStr) {
            window.localStorage.setItem('vcPageRoute', JSON.stringify(routes))
        } else {
            routes = JSON.parse(routesStr);
        }

        return routes;
    }

    vcFramework.setPageRouteToLocal = function (_obj) {
        let routes = vcFramework.getPageRouteFromLocal();

        //判断是否已经有 如果有则删除
        let loction = 0;
        for (let routeIndex = 0; routeIndex < routes.length; routeIndex++) {
            _tmpRoute = routes[routeIndex];
            if (!_tmpRoute.pagePath || _tmpRoute.pagePath != _obj.pagePath) {
                continue;
            }
            loction = routeIndex;
            routes.splice(loction, 1);
        }

        if (routes.length > 10) {
            routes.shift();
        }

        routes.push(_obj);
        try {
            window.localStorage.setItem('vcPageRoute', JSON.stringify(routes));
        } catch (e) {

        }
    }

    vcFramework.deletePageRouteToLocal = function () {
        let routes = vcFramework.getPageRouteFromLocal();
        routes.pop();
        window.localStorage.setItem('vcPageRoute', JSON.stringify(routes));
    }

    vcFramework.recoverComponentByPageRoute = function () {
        let _hash = location.hash;

        let routes = vcFramework.getPageRouteFromLocal();

        if (routes.length < 1) {
            return;
        }
        let _tmpRoute = null;
        let loction = 0;
        for (let routeIndex = 0; routeIndex < routes.length; routeIndex++) {
            _tmpRoute = routes[routeIndex];
            if (!_tmpRoute.pagePath || _tmpRoute.pagePath != _hash) {
                continue;
            }

            for (key in _tmpRoute.pageData) {
                vcFramework.component[key] = _tmpRoute.pageData[key];
            }
            loction = routeIndex;
            routes.splice(loction, 1);
        }

        window.localStorage.setItem('vcPageRoute', JSON.stringify(routes));
    }

    /**
     * pageData = {
     *      pagePath:'',
     *      pageData:{
     * 
     * }
     * }
     */
    vcFramework.saveComponentToPageRoute = function () {
        let _component = vcFramework.component;
        let _hash = location.hash;

        if (!_hash) {
            return;
        }

        let _pageData = {
            pagePath: _hash,
            pageData: {}
        }

        for (_key in _component) {
            if (_key.startsWith('$') || _key.startsWith('_') || typeof _key == 'function') {
                continue;
            }
            _pageData.pageData[_key] = _component[_key];
        }
        vcFramework.setPageRouteToLocal(_pageData);
    }

    document.addEventListener('initVcFrameworkFinish', function (e) {
        //寻找当前页面是否在路由中 如果有恢复下数据,并做弹出
        vcFramework.recoverComponentByPageRoute();
    }, false);


    vcFramework.getTabFromLocal = function () {
        let tabStr = window.sessionStorage.getItem('vcTab');

        let tabs = [];

        if (!tabStr) {
            window.sessionStorage.setItem('vcTab', JSON.stringify(tabs))
        } else {
            tabs = JSON.parse(tabStr);
        }

        return tabs;
    }

    vcFramework.setTabToLocal = function (_obj) {
        let tabs = vcFramework.getTabFromLocal();

        //判断是否已经有 如果有则删除
        for (let tabIndex = 0; tabIndex < tabs.length; tabIndex++) {
            _tmpTab = tabs[tabIndex];
            if (_tmpTab.url == _obj.url) {
                return;
            }
        }
        if (tabs.length > 10) {
            tabs.shift();
        }
        tabs.push(_obj);
        window.sessionStorage.setItem('vcTab', JSON.stringify(tabs));
    }

    vcFramework.deleteTabToLocal = function (_obj) {
        let tabs = vcFramework.getTabFromLocal();
        for (let tabIndex = 0; tabIndex < tabs.length; tabIndex++) {
            _tmpTab = tabs[tabIndex];
            console.log(_tmpTab[tabIndex], _obj)
            if (_tmpTab.url == _obj.url) {
                tabs.splice(tabIndex, 1);
            }
        }
        window.sessionStorage.setItem('vcTab', JSON.stringify(tabs));
    }

    vcFramework.clearTabToLocal = function () {
        let tabs = [];
        window.sessionStorage.setItem('vcTab', JSON.stringify(tabs));
    }
})(window.vcFramework);

/**
 * 身份证号码信息提取
 * 18位身份证
 * 1生日2性别3年龄
 */
(function (vcFramework) {
    vcFramework.idCardInfoExt = function (idCard, type) {
        //通过身份证号计算年龄、性别、出生日期
        if (type == 1) {
            //获取出生日期
            birth = idCard.substring(6, 10) + "-" + idCard.substring(10, 12) + "-" + idCard.substring(12, 14);
            return birth;
        }
        if (type == 2) {
            //获取性别
            if (parseInt(idCard.substr(16, 1)) % 2 == 1) {
                //男
                return 0;
            } else {
                //女
                return 1;
            }
        }
        if (type == 3) {
            //获取年龄
            var myDate = new Date();
            var month = myDate.getMonth() + 1;
            var day = myDate.getDate();
            var age = myDate.getFullYear() - idCard.substring(6, 10) - 1;
            if (idCard.substring(10, 12) < month || idCard.substring(10, 12) == month && idCard.substring(12, 14) <= day) {
                age++;
            }
            return age;
        }
    }
})(window.vcFramework);


/**
 * 文档
 */
(function (vcFramework) {
    vcFramework.showMarkdown = function (_url) {
        let _docUrl = _url + "/docs/readme.md";
        window.open('/markdown.html?url=' + _docUrl);
    }
    vcFramework.toDoc = function (_url) {
        window.open('http://www.homecommunity.cn/' + _url);
    }
})(window.vcFramework);

(function (vcFramework) {
    var x_PI = 3.14159265358979324 * 3000.0 / 180.0;
    var PI = 3.1415926535897932384626;
    var a = 6378245.0;
    var ee = 0.00669342162296594323;

    function out_of_china(lng, lat) {
        var lat = +lat;
        var lng = +lng;
        // 纬度3.86~53.55,经度73.66~135.05 
        return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
    }
    function transformlat(lng, lat) {
        var lat = +lat;
        var lng = +lng;
        var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
        ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
        return ret
    }
    function transformlng(lng, lat) {
        var lat = +lat;
        var lng = +lng;
        var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
        ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
        return ret
    }
    vcFramework.wgs84togcj02 = function (lng, lat) {
        var lat = +lat;
        var lng = +lng;
        if (out_of_china(lng, lat)) {
            return [lng, lat]
        } else {
            var dlat = transformlat(lng - 105.0, lat - 35.0);
            var dlng = transformlng(lng - 105.0, lat - 35.0);
            var radlat = lat / 180.0 * PI;
            var magic = Math.sin(radlat);
            magic = 1 - ee * magic * magic;
            var sqrtmagic = Math.sqrt(magic);
            dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
            dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
            var mglat = lat + dlat;
            var mglng = lng + dlng;
            return { lat: mglat, lon: mglng }
        }
    }
})(window.vcFramework);