diff options
| author | unknown <[email protected]> | 2022-06-24 17:11:23 +0800 |
|---|---|---|
| committer | unknown <[email protected]> | 2022-06-24 17:11:23 +0800 |
| commit | 8565e1bb597b481447d33bac6d8c48c2c45215de (patch) | |
| tree | a4f10c8f7f85a1a8b5c947f7d0d2f967d808a9c4 /UI source code/dns_mapping_ui-master/src/utils | |
| parent | 8165dfcc7bdb0b2e6f1c05f8e7c93553c0e7911e (diff) | |
Diffstat (limited to 'UI source code/dns_mapping_ui-master/src/utils')
13 files changed, 1627 insertions, 0 deletions
diff --git a/UI source code/dns_mapping_ui-master/src/utils/auth.js b/UI source code/dns_mapping_ui-master/src/utils/auth.js new file mode 100644 index 0000000..b643e73 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/auth.js @@ -0,0 +1,18 @@ +import Cookies from 'js-cookie' +import Config from '@/settings' + +const TokenKey = Config.TokenKey + +export function getToken() { + return Cookies.get(TokenKey) +} + +export function setToken(token, rememberMe) { + if (rememberMe) { + return Cookies.set(TokenKey, token, { expires: Config.tokenCookieExpires }) + } else return Cookies.set(TokenKey, token) +} + +export function removeToken() { + return Cookies.remove(TokenKey) +} diff --git a/UI source code/dns_mapping_ui-master/src/utils/chinamap.js b/UI source code/dns_mapping_ui-master/src/utils/chinamap.js new file mode 100644 index 0000000..0718c33 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/chinamap.js @@ -0,0 +1,491 @@ +const chinaGeoCoordMap = { + 六安: [116.3123, 31.8329], + 安庆: [116.7517, 30.5255], + 滁州: [118.1909, 32.536], + 宣城: [118.8062, 30.6244], + 阜阳: [115.7629, 32.9919], + 宿州: [117.5208, 33.6841], + 黄山: [118.0481, 29.9542], + 巢湖: [117.7734, 31.4978], + 亳州: [116.1914, 33.4698], + 池州: [117.3889, 30.2014], + 合肥: [117.29, 32.0581], + 蚌埠: [117.4109, 33.1073], + 芜湖: [118.3557, 31.0858], + 淮北: [116.6968, 33.6896], + 淮南: [116.7847, 32.7722], + 马鞍山: [118.6304, 31.5363], + 铜陵: [117.9382, 30.9375], + 澳门: [113.5547, 22.1484], + 密云县: [117.0923, 40.5121], + 怀柔区: [116.6377, 40.6219], + 房山区: [115.8453, 39.7163], + 延庆县: [116.1543, 40.5286], + 门头沟区: [115.8, 39.9957], + 昌平区: [116.1777, 40.2134], + 大兴区: [116.4716, 39.6352], + 顺义区: [116.7242, 40.1619], + 平谷区: [117.1706, 40.2052], + 通州区: [116.7297, 39.8131], + 朝阳区: [116.4977, 39.949], + 海淀区: [116.2202, 40.0239], + 丰台区: [116.2683, 39.8309], + 石景山区: [116.1887, 39.9346], + 西城区: [116.3631, 39.9353], + 东城区: [116.418, 39.9367], + 宣武区: [116.3603, 39.8852], + 崇文区: [116.4166, 39.8811], + 新疆: [84.9023, 41.748], + 西藏: [88.7695, 31.6846], + 内蒙古: [117.5977, 44.3408], + 青海: [96.2402, 35.4199], + 四川: [102.9199, 30.1904], + 黑龙江: [128.1445, 48.5156], + 甘肃: [95.7129, 40.166], + 云南: [101.8652, 25.1807], + 广西: [108.2813, 23.6426], + 湖南: [111.5332, 27.3779], + 陕西: [109.5996, 35.6396], + 广东: [113.4668, 22.8076], + 吉林: [126.4746, 43.5938], + 河北: [115.4004, 37.9688], + 湖北: [112.2363, 31.1572], + 贵州: [106.6113, 26.9385], + 山东: [118.7402, 36.4307], + 江西: [116.0156, 27.29], + 河南: [113.4668, 33.8818], + 辽宁: [122.3438, 41.0889], + 山西: [112.4121, 37.6611], + 安徽: [117.2461, 32.0361], + 福建: [118.3008, 25.9277], + 浙江: [120.498, 29.0918], + 江苏: [120.0586, 32.915], + 重庆: [107.7539, 30.1904], + 宁夏: [105.9961, 37.3096], + 海南: [109.9512, 19.2041], + 台湾: [121.0295, 23.6082], + 北京: [116.4551, 40.2539], + 天津: [117.4219, 39.4189], + 上海: [121.4648, 31.2891], + 香港: [114.2784, 22.3057], + 酉阳土家族苗族自治县: [108.8196, 28.8666], + 奉节县: [109.3909, 30.9265], + 巫溪县: [109.3359, 31.4813], + 开县: [108.4131, 31.2561], + 彭水苗族土家族自治县: [108.2043, 29.3994], + 云阳县: [108.8306, 31.0089], + 万州区: [108.3911, 30.6958], + 城口县: [108.7756, 31.9098], + 江津区: [106.2158, 28.9874], + 石柱土家族自治县: [108.2813, 30.1025], + 巫山县: [109.8853, 31.1188], + 涪陵区: [107.3364, 29.6796], + 丰都县: [107.8418, 29.9048], + 武隆县: [107.655, 29.35], + 南川区: [107.1716, 29.1302], + 秀山土家族苗族自治县: [109.0173, 28.5205], + 黔江区: [108.7207, 29.4708], + 合川区: [106.3257, 30.108], + 綦江县: [106.6553, 28.8171], + 忠县: [107.8967, 30.3223], + 梁平县: [107.7429, 30.6519], + 巴南区: [106.7322, 29.4214], + 潼南县: [105.7764, 30.1135], + 永川区: [105.8643, 29.2566], + 垫江县: [107.4573, 30.2454], + 渝北区: [106.7212, 29.8499], + 长寿区: [107.1606, 29.9762], + 大足县: [105.7544, 29.6136], + 铜梁县: [106.0291, 29.8059], + 荣昌县: [105.5127, 29.4708], + 璧山县: [106.2048, 29.5807], + 北碚区: [106.5674, 29.8883], + 万盛区: [106.908, 28.9325], + 九龙坡区: [106.3586, 29.4049], + 沙坪坝区: [106.3696, 29.6191], + 南岸区: [106.6663, 29.5367], + 江北区: [106.8311, 29.6191], + 大渡口区: [106.4905, 29.4214], + 双桥区: [105.7874, 29.4928], + 渝中区: [106.5344, 29.5477], + 南平: [118.136, 27.2845], + 三明: [117.5317, 26.3013], + 龙岩: [116.8066, 25.2026], + 宁德: [119.6521, 26.9824], + 福州: [119.4543, 25.9222], + 漳州: [117.5757, 24.3732], + 泉州: [118.3228, 25.1147], + 莆田: [119.0918, 25.3455], + 厦门: [118.1689, 24.6478], + 酒泉: [96.2622, 40.4517], + 张掖: [99.7998, 38.7433], + 甘南藏族自治州: [102.9199, 34.6893], + 武威: [103.0188, 38.1061], + 陇南: [105.304, 33.5632], + 庆阳: [107.5342, 36.2], + 白银: [104.8645, 36.5076], + 定西: [104.5569, 35.0848], + 天水: [105.6445, 34.6289], + 兰州: [103.5901, 36.3043], + 平凉: [107.0728, 35.321], + 临夏回族自治州: [103.2715, 35.5737], + 金昌: [102.074, 38.5126], + 嘉峪关: [98.1738, 39.8035], + 清远: [112.9175, 24.3292], + 韶关: [113.7964, 24.7028], + 湛江: [110.3577, 20.9894], + 梅州: [116.1255, 24.1534], + 河源: [114.917, 23.9722], + 肇庆: [112.1265, 23.5822], + 惠州: [114.6204, 23.1647], + 茂名: [111.0059, 22.0221], + 江门: [112.6318, 22.1484], + 阳江: [111.8298, 22.0715], + 云浮: [111.7859, 22.8516], + 广州: [113.5107, 23.2196], + 汕尾: [115.5762, 23.0438], + 揭阳: [116.1255, 23.313], + 珠海: [113.7305, 22.1155], + 佛山: [112.8955, 23.1097], + 潮州: [116.7847, 23.8293], + 汕头: [117.1692, 23.3405], + 深圳: [114.5435, 22.5439], + 东莞: [113.8953, 22.901], + 中山: [113.4229, 22.478], + 百色: [106.6003, 23.9227], + 河池: [107.8638, 24.5819], + 桂林: [110.5554, 25.318], + 南宁: [108.479, 23.1152], + 柳州: [109.3799, 24.9774], + 崇左: [107.3364, 22.4725], + 来宾: [109.7095, 23.8403], + 玉林: [110.2148, 22.3792], + 梧州: [110.9949, 23.5052], + 贺州: [111.3135, 24.4006], + 钦州: [109.0283, 22.0935], + 贵港: [109.9402, 23.3459], + 防城港: [108.0505, 21.9287], + 北海: [109.314, 21.6211], + 遵义: [106.908, 28.1744], + 黔东南苗族侗族自治州: [108.4241, 26.4166], + 毕节地区: [105.1611, 27.0648], + 黔南布依族苗族自治州: [107.2485, 25.8398], + 铜仁地区: [108.6218, 28.0096], + 黔西南布依族苗族自治州: [105.5347, 25.3949], + 六盘水: [104.7546, 26.0925], + 安顺: [105.9082, 25.9882], + 贵阳: [106.6992, 26.7682], + 儋州: [109.3291, 19.5653], + 文昌: [110.8905, 19.7823], + 乐东黎族自治县: [109.0283, 18.6301], + 三亚: [109.3716, 18.3698], + 琼中黎族苗族自治县: [109.8413, 19.0736], + 东方: [108.8498, 19.0414], + 海口: [110.3893, 19.8516], + 万宁: [110.3137, 18.8388], + 澄迈县: [109.9937, 19.7314], + 白沙黎族自治县: [109.3703, 19.211], + 琼海: [110.4208, 19.224], + 昌江黎族自治县: [109.0407, 19.2137], + 临高县: [109.6957, 19.8063], + 陵水黎族自治县: [109.9924, 18.5415], + 屯昌县: [110.0377, 19.362], + 定安县: [110.3384, 19.4698], + 保亭黎族苗族自治县: [109.6284, 18.6108], + 五指山: [109.5282, 18.8299], + 黑河: [127.1448, 49.2957], + 大兴安岭地区: [124.1016, 52.2345], + 哈尔滨: [127.9688, 45.368], + 齐齐哈尔: [124.541, 47.5818], + 牡丹江: [129.7815, 44.7089], + 绥化: [126.7163, 46.8018], + 伊春: [129.1992, 47.9608], + 佳木斯: [133.0005, 47.5763], + 鸡西: [132.7917, 45.7361], + 双鸭山: [133.5938, 46.7523], + 大庆: [124.7717, 46.4282], + 鹤岗: [130.4407, 47.7081], + 七台河: [131.2756, 45.9558], + 承德: [117.5757, 41.4075], + 张家口: [115.1477, 40.8527], + 保定: [115.0488, 39.0948], + 唐山: [118.4766, 39.6826], + 沧州: [116.8286, 38.2104], + 石家庄: [114.4995, 38.1006], + 邢台: [114.8071, 37.2821], + 邯郸: [114.4775, 36.535], + 秦皇岛: [119.2126, 40.0232], + 衡水: [115.8838, 37.7161], + 廊坊: [116.521, 39.0509], + 南阳: [112.4011, 33.0359], + 信阳: [114.8291, 32.0197], + 洛阳: [112.0605, 34.3158], + 驻马店: [114.1589, 32.9041], + 周口: [114.873, 33.6951], + 商丘: [115.741, 34.2828], + 三门峡: [110.8301, 34.3158], + 新乡: [114.2029, 35.3595], + 平顶山: [112.9724, 33.739], + 郑州: [113.4668, 34.6234], + 安阳: [114.5325, 36.0022], + 开封: [114.5764, 34.6124], + 焦作: [112.8406, 35.1508], + 许昌: [113.6975, 34.0466], + 濮阳: [115.1917, 35.799], + 漯河: [113.8733, 33.6951], + 鹤壁: [114.3787, 35.744], + 怀化: [109.9512, 27.4438], + 永州: [111.709, 25.752], + 邵阳: [110.9619, 26.8121], + 郴州: [113.2361, 25.8673], + 常德: [111.4014, 29.2676], + 湘西土家族苗族自治州: [109.7864, 28.6743], + 衡阳: [112.4121, 26.7902], + 岳阳: [113.2361, 29.1357], + 益阳: [111.731, 28.3832], + 长沙: [113.0823, 28.2568], + 株洲: [113.5327, 27.0319], + 张家界: [110.5115, 29.328], + 娄底: [111.6431, 27.7185], + 湘潭: [112.5439, 27.7075], + 盐城: [120.2234, 33.5577], + 徐州: [117.5208, 34.3268], + 南通: [121.1023, 32.1625], + 淮安: [118.927, 33.4039], + 苏州: [120.6519, 31.3989], + 宿迁: [118.5535, 33.7775], + 连云港: [119.1248, 34.552], + 扬州: [119.4653, 32.8162], + 南京: [118.8062, 31.9208], + 泰州: [120.0586, 32.5525], + 无锡: [120.3442, 31.5527], + 常州: [119.4543, 31.5582], + 镇江: [119.4763, 31.9702], + 赣州: [115.2795, 25.8124], + 吉安: [114.884, 26.9659], + 上饶: [117.8613, 28.7292], + 九江: [115.4224, 29.3774], + 抚州: [116.4441, 27.4933], + 宜春: [115.0159, 28.3228], + 南昌: [116.0046, 28.6633], + 景德镇: [117.334, 29.3225], + 萍乡: [113.9282, 27.4823], + 鹰潭: [117.0813, 28.2349], + 新余: [114.95, 27.8174], + 延边朝鲜族自治州: [129.397, 43.2587], + 白城: [123.0029, 45.2637], + 松原: [124.0906, 44.7198], + 长春: [125.8154, 44.2584], + 白山: [127.2217, 42.0941], + 通化: [125.9583, 41.8579], + 四平: [124.541, 43.4894], + 辽源: [125.343, 42.7643], + 大连: [122.2229, 39.4409], + 朝阳: [120.0696, 41.4899], + 丹东: [124.541, 40.4242], + 铁岭: [124.2773, 42.7423], + 沈阳: [123.1238, 42.1216], + 抚顺: [124.585, 41.8579], + 葫芦岛: [120.1575, 40.578], + 阜新: [122.0032, 42.2699], + 锦州: [121.6626, 41.4294], + 鞍山: [123.0798, 40.6055], + 本溪: [124.1455, 41.1987], + 营口: [122.4316, 40.4297], + 辽阳: [123.4094, 41.1383], + 盘锦: [121.9482, 41.0449], + 呼伦贝尔: [120.8057, 50.2185], + 阿拉善盟: [102.019, 40.1001], + 锡林郭勒盟: [115.6421, 44.176], + 鄂尔多斯: [108.9734, 39.2487], + 赤峰: [118.6743, 43.2642], + 巴彦淖尔: [107.5562, 41.3196], + 通辽: [121.4758, 43.9673], + 乌兰察布: [112.5769, 41.77], + 兴安盟: [121.3879, 46.1426], + 包头: [110.3467, 41.4899], + 呼和浩特: [111.4124, 40.4901], + 乌海: [106.886, 39.4739], + 吴忠: [106.853, 37.3755], + 中卫: [105.4028, 36.9525], + 固原: [106.1389, 35.9363], + 银川: [106.3586, 38.1775], + 石嘴山: [106.4795, 39.0015], + 海西蒙古族藏族自治州: [94.9768, 37.1118], + 玉树藏族自治州: [93.5925, 33.9368], + 果洛藏族自治州: [99.3823, 34.0466], + 海南藏族自治州: [100.3711, 35.9418], + 海北藏族自治州: [100.3711, 37.9138], + 黄南藏族自治州: [101.5686, 35.1178], + 海东地区: [102.3706, 36.2988], + 西宁: [101.4038, 36.8207], + 崇明县: [121.5637, 31.5383], + 南汇区: [121.8755, 30.954], + 奉贤区: [121.5747, 30.8475], + 浦东新区: [121.6928, 31.2561], + 金山区: [121.2657, 30.8112], + 青浦区: [121.1751, 31.1909], + 松江区: [121.1984, 31.0268], + 嘉定区: [121.2437, 31.3625], + 宝山区: [121.4346, 31.4051], + 闵行区: [121.4992, 31.0838], + 杨浦区: [121.528, 31.2966], + 普陀区: [121.3879, 31.2602], + 徐汇区: [121.4333, 31.1607], + 长宁区: [121.3852, 31.2115], + 闸北区: [121.4511, 31.2794], + 虹口区: [121.4882, 31.2788], + 黄浦区: [121.4868, 31.219], + 卢湾区: [121.4758, 31.2074], + 静安区: [121.4484, 31.2286], + 榆林: [109.8743, 38.205], + 延安: [109.1052, 36.4252], + 汉中: [106.886, 33.0139], + 安康: [109.1162, 32.7722], + 商洛: [109.8083, 33.761], + 宝鸡: [107.1826, 34.3433], + 渭南: [109.7864, 35.0299], + 咸阳: [108.4131, 34.8706], + 西安: [109.1162, 34.2004], + 铜川: [109.0393, 35.1947], + 忻州: [112.4561, 38.8971], + 吕梁: [111.3574, 37.7325], + 临汾: [111.4783, 36.1615], + 晋中: [112.7747, 37.37], + 运城: [111.1487, 35.2002], + 大同: [113.7854, 39.8035], + 长治: [112.8625, 36.4746], + 朔州: [113.0713, 39.6991], + 晋城: [112.7856, 35.6342], + 太原: [112.3352, 37.9413], + 阳泉: [113.4778, 38.0951], + 甘孜藏族自治州: [99.9207, 31.0803], + 阿坝藏族羌族自治州: [102.4805, 32.4536], + 凉山彝族自治州: [101.9641, 27.6746], + 绵阳: [104.7327, 31.8713], + 达州: [107.6111, 31.333], + 广元: [105.6885, 32.2284], + 雅安: [102.6672, 29.8938], + 宜宾: [104.6558, 28.548], + 乐山: [103.5791, 29.1742], + 南充: [106.2048, 31.1517], + 巴中: [107.0618, 31.9977], + 泸州: [105.4578, 28.493], + 成都: [103.9526, 30.7617], + 资阳: [104.9744, 30.1575], + 攀枝花: [101.6895, 26.7133], + 眉山: [103.8098, 30.0146], + 广安: [106.6333, 30.4376], + 德阳: [104.48, 31.1133], + 内江: [104.8535, 29.6136], + 遂宁: [105.5347, 30.6683], + 自贡: [104.6667, 29.2786], + 蓟县: [117.4672, 40.004], + 武清区: [117.0621, 39.4121], + 宝坻区: [117.4274, 39.5913], + 静海县: [116.9824, 38.8312], + 宁河县: [117.6801, 39.3853], + 大港区: [117.3875, 38.757], + 塘沽区: [117.6801, 38.9987], + 西青区: [117.1829, 39.0022], + 北辰区: [117.1761, 39.2548], + 东丽区: [117.4013, 39.1223], + 汉沽区: [117.8888, 39.2191], + 津南区: [117.3958, 38.9603], + 河西区: [117.2365, 39.0804], + 河东区: [117.2571, 39.1209], + 南开区: [117.1527, 39.1065], + 河北区: [117.2145, 39.1615], + 红桥区: [117.1596, 39.1663], + 和平区: [117.2008, 39.1189], + 巴音郭楞蒙古自治州: [88.1653, 39.6002], + 和田地区: [81.167, 36.9855], + 哈密地区: [93.7793, 42.9236], + 阿克苏地区: [82.9797, 41.0229], + 阿勒泰地区: [88.2971, 47.0929], + 喀什地区: [77.168, 37.8534], + 塔城地区: [86.6272, 45.8514], + 昌吉回族自治州: [89.6814, 44.4507], + 克孜勒苏柯尔克孜自治州: [74.6301, 39.5233], + 吐鲁番地区: [89.6375, 42.4127], + 伊犁哈萨克自治州: [82.5513, 43.5498], + 博尔塔拉蒙古自治州: [81.8481, 44.6979], + 乌鲁木齐: [87.9236, 43.5883], + 克拉玛依: [85.2869, 45.5054], + 阿拉尔: [81.2769, 40.6549], + 图木舒克: [79.1345, 39.8749], + 五家渠: [87.5391, 44.3024], + 石河子: [86.0229, 44.2914], + 那曲地区: [88.1982, 33.3215], + 阿里地区: [82.3645, 32.7667], + 日喀则地区: [86.2427, 29.5093], + 林芝地区: [95.4602, 29.1138], + 昌都地区: [97.0203, 30.7068], + 山南地区: [92.2083, 28.3392], + 拉萨: [91.1865, 30.1465], + 普洱: [100.7446, 23.4229], + 红河哈尼族彝族自治州: [103.0408, 23.6041], + 文山壮族苗族自治州: [104.8865, 23.5712], + 曲靖: [103.9417, 25.7025], + 楚雄彝族自治州: [101.6016, 25.3619], + 大理白族自治州: [99.9536, 25.6805], + 临沧: [99.613, 24.0546], + 迪庆藏族自治州: [99.4592, 27.9327], + 昭通: [104.0955, 27.6031], + 昆明: [102.9199, 25.4663], + 丽江: [100.448, 26.955], + 西双版纳傣族自治州: [100.8984, 21.8628], + 保山: [99.0637, 24.9884], + 玉溪: [101.9312, 23.8898], + 怒江傈僳族自治州: [99.1516, 26.5594], + 德宏傣族景颇族自治州: [98.1299, 24.5874], + 丽水: [119.5642, 28.1854], + 杭州: [119.5313, 29.8773], + 温州: [120.498, 27.8119], + 宁波: [121.5967, 29.6466], + 舟山: [122.2559, 30.2234], + 台州: [121.1353, 28.6688], + 金华: [120.0037, 29.1028], + 衢州: [118.6853, 28.8666], + 绍兴: [120.564, 29.7565], + 嘉兴: [120.9155, 30.6354], + 湖州: [119.8608, 30.7782], + 烟台: [120.7397, 37.5128], + 临沂: [118.3118, 35.2936], + 潍坊: [119.0918, 36.524], + 青岛: [120.4651, 36.3373], + 菏泽: [115.6201, 35.2057], + 济宁: [116.8286, 35.3375], + 德州: [116.6858, 37.2107], + 滨州: [117.8174, 37.4963], + 聊城: [115.9167, 36.4032], + 东营: [118.7073, 37.5513], + 济南: [117.1582, 36.8701], + 泰安: [117.0264, 36.0516], + 威海: [121.9482, 37.1393], + 日照: [119.2786, 35.5023], + 淄博: [118.0371, 36.6064], + 枣庄: [117.323, 34.8926], + 莱芜: [117.6526, 36.2714], + 恩施土家族苗族自治州: [109.5007, 30.2563], + 十堰: [110.5115, 32.3877], + 宜昌: [111.1707, 30.7617], + 襄樊: [111.9397, 31.9263], + 黄冈: [115.2686, 30.6628], + 荆州: [113.291, 30.0092], + 荆门: [112.6758, 30.9979], + 咸宁: [114.2578, 29.6631], + 随州: [113.4338, 31.8768], + 孝感: [113.9502, 31.1188], + 武汉: [114.3896, 30.6628], + 黄石: [115.0159, 29.9213], + 神农架林区: [110.4565, 31.5802], + 天门: [113.0273, 30.6409], + 仙桃: [113.3789, 30.3003], + 潜江: [112.7637, 30.3607], + 鄂州: [114.7302, 30.4102] + } + export default { + chinaGeoCoordMap + } +
\ No newline at end of file diff --git a/UI source code/dns_mapping_ui-master/src/utils/clipboard.js b/UI source code/dns_mapping_ui-master/src/utils/clipboard.js new file mode 100644 index 0000000..e916a44 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/clipboard.js @@ -0,0 +1,36 @@ +import Vue from 'vue' +import Clipboard from 'clipboard' + +function clipboardSuccess() { + Vue.prototype.$message({ + message: 'Copy successfully', + type: 'success', + duration: 1500 + }) +} + +function clipboardError() { + Vue.prototype.$message({ + message: 'Copy failed', + type: 'error' + }) +} + +export default function handleClipboard(text, event) { + const clipboard = new Clipboard(event.target, { + text: () => text + }) + clipboard.on('success', () => { + clipboardSuccess() + clipboard.off('error') + clipboard.off('success') + clipboard.destroy() + }) + clipboard.on('error', () => { + clipboardError() + clipboard.off('error') + clipboard.off('success') + clipboard.destroy() + }) + clipboard.onClick(event) +} diff --git a/UI source code/dns_mapping_ui-master/src/utils/datetime.js b/UI source code/dns_mapping_ui-master/src/utils/datetime.js new file mode 100644 index 0000000..67f808a --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/datetime.js @@ -0,0 +1,216 @@ +/* eslint-disable */ + +/** + * Date对象的补充函数,包括类似Python中的strftime() + * 阿债 https://gitee.com/azhai/datetime.js + */ + +Date.prototype.toMidnight = function() { + this.setHours(0) + this.setMinutes(0) + this.setSeconds(0) + this.setMilliseconds(0) + return this +} + +Date.prototype.daysAgo = function(days, midnight) { + days = days ? days - 0 : 0 + const date = new Date(this.getTime() - days * 8.64E7) + return midnight ? date.toMidnight() : date +} + +Date.prototype.monthBegin = function(offset) { + offset = offset ? offset - 0 : 0 + const days = this.getDate() - 1 - offset + return this.daysAgo(days, true) +} + +Date.prototype.quarterBegin = function() { + const month = this.getMonth() - this.getMonth() % 3 + return new Date(this.getFullYear(), month, 1).toMidnight() +} + +Date.prototype.yearBegin = function() { + return new Date(this.getFullYear(), 0, 1).toMidnight() +} + +Date.prototype.strftime = function(format, local) { + if (!format) { + const str = new Date(this.getTime() + 2.88E7).toISOString() + return str.substr(0, 16).replace('T', ' ') + } + local = local && local.startsWith('zh') ? 'zh' : 'en' + const padZero = function(str, len) { + const pads = len - str.toString().length + return (pads && pads > 0 ? '0'.repeat(pads) : '') + str + } + format = format.replace('%F', '%Y-%m-%d') + format = format.replace(/%D|%x/, '%m/%d/%y') + format = format.replace(/%T|%X/, '%H:%M:%S') + format = format.replace('%R', '%H:%M') + format = format.replace('%r', '%H:%M:%S %p') + format = format.replace('%c', '%a %b %e %H:%M:%S %Y') + const _this = this + return format.replace(/%[A-Za-z%]/g, function(f) { + let ans = f + switch (f) { + case '%%': + ans = '%' + break + + case '%Y': + case '%G': + ans = _this.getFullYear() + break + + case '%y': + ans = _this.getFullYear() % 100 + break + + case '%C': + ans = _this.getFullYear() / 100 + break + + case '%m': + case '%n': + ans = _this.getMonth() + 1 + break + + case '%B': + local = local.startsWith('en') ? 'english' : local + + case '%b': + const m = _this.getMonth() + ans = local_labels.monthes[local][m] + break + + case '%d': + case '%e': + ans = _this.getDate() + break + + case '%j': + ans = _this.getDaysOfYear() + break + + case '%U': + case '%W': + const ws = _this.getWeeksOfYear(f === '%W') + ans = padZero(ws, 2) + break + + case '%w': + ans = _this.getDay() + + case '%u': + ans = ans === 0 ? 7 : ans + break + + case '%A': + local = local.startsWith('en') ? 'english' : local + + case '%a': + const d = _this.getDay() + ans = local_labels.weekdays[local][d] + break + + case '%H': + case '%k': + ans = _this.getHours() + break + + case '%I': + case '%l': + ans = _this.getHours() + ans = ans % 12 + break + + case '%M': + ans = _this.getMinutes() + break + + case '%S': + ans = _this.getSeconds() + break + + case '%s': + ans = parseInt(_this.getTime() / 1E3) + break + + case '%f': + const ms = _this.getMilliseconds() + ans = padZero(ms * 1E3, 6) + break + + case '%P': + local = local.startsWith('en') ? 'english' : local + + case '%p': + const h = _this.getHours() + ans = local_labels.meridians[local][h < 12 ? 0 : 1] + break + + case '%z': + let tzo = _this.getTimezoneOffset() + const sign = tzo < 0 ? '-' : '+' + tzo = Math.abs(tzo) + const ho = padZero(tzo / 60, 2) + const mo = padZero(tzo % 60, 2) + ans = sign + ho + mo + break + + default: + break + } + if (f === '%C' || f === '%y' || f === '%m' || f === '%d' || f === '%H' || f === '%M' || f === '%S') { + ans = padZero(ans, 2) + } + return ans.toString() + }) +} + +Date.prototype.humanize = function(local) { + local = local && local.startsWith('zh') ? 'zh' : 'en' + const result = this.strftime('', local) + const days = (Date.today() - this.toMidnight().getTime()) / 8.64E7 + if (days <= -10 || days >= 10) { + return result + } + const labels = local_labels.dayagos[local] + let lbl = '' + if (days === 0 || days === 1) { + lbl = labels[days] + } else if (days === -1) { + lbl = labels[2] + } else if (days >= 2) { + lbl = days + labels[3] + } else { + lbl = days + labels[4] + } + return lbl + result.substr(10, 6) +} + +const local_labels = { + monthes: { + english: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + en: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + zh: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'] + }, + weekdays: { + english: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + en: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + zh: ['日', '一', '二', '三', '四', '五', '六'] + }, + meridians: { + english: ['a.m.', 'p.m.'], + en: ['AM', 'PM'], + zh: ['上午', '下午'] + }, + dayagos: { + english: ['Today', 'Yesterday', 'Tomorrow', ' days ago', ' days late'], + en: ['Today', 'Yesterday', 'Tomorrow', ' days ago', ' days late'], + zh: ['今天', '昨天', '明天', '天前', '天后'] + } +} + +export default Date diff --git a/UI source code/dns_mapping_ui-master/src/utils/fackClickOutSide.js b/UI source code/dns_mapping_ui-master/src/utils/fackClickOutSide.js new file mode 100644 index 0000000..9b1f0a2 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/fackClickOutSide.js @@ -0,0 +1,45 @@ +let lock = true +let el = null +// const MousedownEvent = new Event('mousedown', { bubbles: true }) +// const MouseupEvent = new Event('mouseup', { bubbles: true }) +const MousedownEvent = document.createEvent('Events') +MousedownEvent.initEvent('mousedown', true, true) +const MouseupEvent = document.createEvent('Events') +MouseupEvent.initEvent('mouseup', true, true) +const fakeClickOutSide = () => { + document.dispatchEvent(MousedownEvent) + document.dispatchEvent(MouseupEvent) + lock = true // console.log('dispatchEvent'); +} +const mousedownHandle = e => { + const classList = e.target.classList + if (classList.contains('el-select__caret') || classList.contains('el-input__inner') || classList.contains('el-select__tags')) { + lock = false + return + } + if (lock) return + fakeClickOutSide() +} +const mousewheelHandle = e => { + if (lock || e.target.classList.contains('el-select-dropdown__item') || e.target.parentNode.classList.contains('el-select-dropdown__item') || e.target.classList.contains('el-cascader-node__label') || e.target.parentNode.classList.contains('el-cascader-node__label')) return + fakeClickOutSide() +} +const eventListener = (type) => { + el[type + 'EventListener']('mousedown', mousedownHandle) + window[type + 'EventListener']('mousewheel', mousewheelHandle) + window[type + 'EventListener']('DOMMouseScroll', mousewheelHandle) // fireFox 3.5+ +} +export default { + mounted() { + el = this.$root.$el + el.addFakeClickOutSideEventCount = el.addFakeClickOutSideEventCount || 0; + (!el.addFakeClickOutSideEventCount) && this.$nextTick(() => { + eventListener('add') + }) + el.addFakeClickOutSideEventCount += 1 + }, + destroyed() { + eventListener('remove') + el.addFakeClickOutSideEventCount -= 1 + } +} diff --git a/UI source code/dns_mapping_ui-master/src/utils/i18n.js b/UI source code/dns_mapping_ui-master/src/utils/i18n.js new file mode 100644 index 0000000..c1aca41 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/i18n.js @@ -0,0 +1,22 @@ +// translate router.meta.title, be used in breadcrumb sidebar tagsview +// export function generateTitle(title) { +// console.log(this.$te, 222) +// // const hasKey = this.$te('route.' + title) + +// if (hasKey) { +// // $t :this method from vue-i18n, inject in @/lang/index.js +// const translatedTitle = this.$t('route.' + title) + +// return translatedTitle +// } +// return title +// } + +// export function generateTitle(title){ +// const hasKey = this.$te('route.' + title) +// if(hasKey){ +// const translatedTitle = this.$t('route.' + title) +// return translatedTitle +// } +// return title +// } diff --git a/UI source code/dns_mapping_ui-master/src/utils/index.js b/UI source code/dns_mapping_ui-master/src/utils/index.js new file mode 100644 index 0000000..ab7ad30 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/index.js @@ -0,0 +1,388 @@ +/** + * Created by PanJiaChen on 16/11/18. + */ + +/** + * Parse the time to string + * @param {(Object|string|number)} time + * @param {string} cFormat + * @returns {string} + */ +export function parseTime(time, cFormat) { + if (arguments.length === 0) { + return null + } + const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'undefined' || time === null || time === 'null') { + return '' + } else if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} + +/** + * @param {number} time + * @param {string} option + * @returns {string} + */ +export function formatTime(time, option) { + if (('' + time).length === 10) { + time = parseInt(time) * 1000 + } else { + time = +time + } + const d = new Date(time) + const now = Date.now() + + const diff = (now - d) / 1000 + + if (diff < 30) { + return '刚刚' + } else if (diff < 3600) { + // less 1 hour + return Math.ceil(diff / 60) + '分钟前' + } else if (diff < 3600 * 24) { + return Math.ceil(diff / 3600) + '小时前' + } else if (diff < 3600 * 24 * 2) { + return '1天前' + } + if (option) { + return parseTime(time, option) + } else { + return ( + d.getMonth() + + 1 + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' + ) + } +} + +/** + * @param {string} url + * @returns {Object} + */ +export function getQueryObject(url) { + url = url == null ? window.location.href : url + const search = url.substring(url.lastIndexOf('?') + 1) + const obj = {} + const reg = /([^?&=]+)=([^?&=]*)/g + search.replace(reg, (rs, $1, $2) => { + const name = decodeURIComponent($1) + let val = decodeURIComponent($2) + val = String(val) + obj[name] = val + return rs + }) + return obj +} + +/** + * @param {string} input value + * @returns {number} output value + */ +export function byteLength(str) { + // returns the byte length of an utf8 string + let s = str.length + for (var i = str.length - 1; i >= 0; i--) { + const code = str.charCodeAt(i) + if (code > 0x7f && code <= 0x7ff) s++ + else if (code > 0x7ff && code <= 0xffff) s += 2 + if (code >= 0xDC00 && code <= 0xDFFF) i-- + } + return s +} + +/** + * @param {Array} actual + * @returns {Array} + */ +export function cleanArray(actual) { + const newArray = [] + for (let i = 0; i < actual.length; i++) { + if (actual[i]) { + newArray.push(actual[i]) + } + } + return newArray +} + +/** + * @param {Object} json + * @returns {Array} + */ +export function param(json) { + if (!json) return '' + return cleanArray( + Object.keys(json).map(key => { + if (json[key] === undefined) return '' + return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) + }) + ).join('&') +} + +/** + * @param {string} url + * @returns {Object} + */ +export function param2Obj(url) { + const search = url.split('?')[1] + if (!search) { + return {} + } + return JSON.parse( + '{"' + + decodeURIComponent(search) + .replace(/"/g, '\\"') + .replace(/&/g, '","') + .replace(/=/g, '":"') + .replace(/\+/g, ' ') + + '"}' + ) +} + +/** + * @param {string} val + * @returns {string} + */ +export function html2Text(val) { + const div = document.createElement('div') + div.innerHTML = val + return div.textContent || div.innerText +} + +/** + * Merges two objects, giving the last one precedence + * @param {Object} target + * @param {(Object|Array)} source + * @returns {Object} + */ +export function objectMerge(target, source) { + if (typeof target !== 'object') { + target = {} + } + if (Array.isArray(source)) { + return source.slice() + } + Object.keys(source).forEach(property => { + const sourceProperty = source[property] + if (typeof sourceProperty === 'object') { + target[property] = objectMerge(target[property], sourceProperty) + } else { + target[property] = sourceProperty + } + }) + return target +} + +/** + * @param {HTMLElement} element + * @param {string} className + */ +export function toggleClass(element, className) { + if (!element || !className) { + return + } + let classString = element.className + const nameIndex = classString.indexOf(className) + if (nameIndex === -1) { + classString += '' + className + } else { + classString = + classString.substr(0, nameIndex) + + classString.substr(nameIndex + className.length) + } + element.className = classString +} + +/** + * @param {string} type + * @returns {Date} + */ +export function getTime(type) { + if (type === 'start') { + return new Date().getTime() - 3600 * 1000 * 24 * 90 + } else { + return new Date(new Date().toDateString()) + } +} + +/** + * @param {Function} func + * @param {number} wait + * @param {boolean} immediate + * @return {*} + */ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function(...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} + +/** + * This is just a simple version of deep copy + * Has a lot of edge cases bug + * If you want to use a perfect deep copy, use lodash's _.cloneDeep + * @param {Object} source + * @returns {Object} + */ +export function deepClone(source) { + if (!source && typeof source !== 'object') { + throw new Error('error arguments', 'deepClone') + } + const targetObj = source.constructor === Array ? [] : {} + Object.keys(source).forEach(keys => { + if (source[keys] && typeof source[keys] === 'object') { + targetObj[keys] = deepClone(source[keys]) + } else { + targetObj[keys] = source[keys] + } + }) + return targetObj +} + +/** + * @param {Array} arr + * @returns {Array} + */ +export function uniqueArr(arr) { + return Array.from(new Set(arr)) +} + +/** + * @returns {string} + */ +export function createUniqueString() { + const timestamp = +new Date() + '' + const randomNum = parseInt((1 + Math.random()) * 65536) + '' + return (+(randomNum + timestamp)).toString(32) +} + +/** + * Check if an element has a class + * @param {HTMLElement} elm + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele, cls) { + return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) +} + +/** + * Add class to element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function addClass(ele, cls) { + if (!hasClass(ele, cls)) ele.className += ' ' + cls +} + +/** + * Remove class from element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function removeClass(ele, cls) { + if (hasClass(ele, cls)) { + const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') + ele.className = ele.className.replace(reg, ' ') + } +} + +// 替换邮箱字符 +export function regEmail(email) { + if (String(email).indexOf('@') > 0) { + const str = email.split('@') + let _s = '' + if (str[0].length > 3) { + for (var i = 0; i < str[0].length - 3; i++) { + _s += '*' + } + } + var new_email = str[0].substr(0, 3) + _s + '@' + str[1] + } + return new_email +} + +// 替换手机字符 +export function regMobile(mobile) { + if (mobile.length > 7) { + var new_mobile = mobile.substr(0, 3) + '****' + mobile.substr(7) + } + return new_mobile +} + +// 下载文件 +export function downloadFile(obj, name, suffix) { + const url = window.URL.createObjectURL(new Blob([obj])) + const link = document.createElement('a') + link.style.display = 'none' + link.href = url + const fileName = parseTime(new Date()) + '-' + name + '.' + suffix + link.setAttribute('download', fileName) + document.body.appendChild(link) + link.click() + document.body.removeChild(link) +} diff --git a/UI source code/dns_mapping_ui-master/src/utils/permission.js b/UI source code/dns_mapping_ui-master/src/utils/permission.js new file mode 100644 index 0000000..b0c7523 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/permission.js @@ -0,0 +1,23 @@ +import store from '@/store' + +/** + * @param {Array} value + * @returns {Boolean} + * @example see @/views/permission/directive.vue + */ +export default { + install(Vue) { + Vue.prototype.checkPer = (value) => { + if (value && value instanceof Array && value.length > 0) { + const roles = store.getters && store.getters.roles + const permissionRoles = value + return roles.some(role => { + return permissionRoles.includes(role) + }) + } else { + console.error(`need roles! Like v-permission="['admin','editor']"`) + return false + } + } + } +} diff --git a/UI source code/dns_mapping_ui-master/src/utils/request.js b/UI source code/dns_mapping_ui-master/src/utils/request.js new file mode 100644 index 0000000..ce7fd1b --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/request.js @@ -0,0 +1,88 @@ +import axios from 'axios' +import router from '@/router/routers' +import { Notification } from 'element-ui' +import store from '../store' +import { getToken } from '@/utils/auth' +import Config from '@/settings' +import Cookies from 'js-cookie' + +// 创建axios实例 +const service = axios.create({ + baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url + timeout: Config.timeout // 请求超时时间 +}) + +// request拦截器 +service.interceptors.request.use( + config => { + if (getToken()) { + config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + } + config.headers['Content-Type'] = 'application/json' + return config + }, + error => { + Promise.reject(error) + } +) + +// response 拦截器 +service.interceptors.response.use( + response => { + return response.data + }, + error => { + // 兼容blob下载出错json提示 + if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) { + const reader = new FileReader() + reader.readAsText(error.response.data, 'utf-8') + reader.onload = function(e) { + const errorMsg = JSON.parse(reader.result).message + Notification.error({ + title: errorMsg, + duration: 5000 + }) + } + } else { + let code = 0 + try { + code = error.response.data.status + } catch (e) { + if (error.toString().indexOf('Error: timeout') !== -1) { + Notification.error({ + title: '网络请求超时', + duration: 5000 + }) + return Promise.reject(error) + } + } + console.log(code) + if (code) { + if (code === 401) { + store.dispatch('LogOut').then(() => { + // 用户登录界面提示 + Cookies.set('point', 401) + location.reload() + }) + } else if (code === 403) { + router.push({ path: '/401' }) + } else { + const errorMsg = error.response.data.message + if (errorMsg !== undefined) { + Notification.error({ + title: errorMsg, + duration: 5000 + }) + } + } + } else { + Notification.error({ + title: '接口请求失败', + duration: 5000 + }) + } + } + return Promise.reject(error) + } +) +export default service diff --git a/UI source code/dns_mapping_ui-master/src/utils/rsaEncrypt.js b/UI source code/dns_mapping_ui-master/src/utils/rsaEncrypt.js new file mode 100644 index 0000000..1948ddd --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/rsaEncrypt.js @@ -0,0 +1,14 @@ +import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' + +// 密钥对生成 http://web.chacuo.net/netrsakeypair + +const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' + + '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==' + +// 加密 +export function encrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPublicKey(publicKey) // 设置公钥 + return encryptor.encrypt(txt) // 对需要加密的数据进行加密 +} + diff --git a/UI source code/dns_mapping_ui-master/src/utils/shortcuts.js b/UI source code/dns_mapping_ui-master/src/utils/shortcuts.js new file mode 100644 index 0000000..d92edc3 --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/shortcuts.js @@ -0,0 +1,108 @@ +import Date from './datetime.js' + +export const calendarBaseShortcuts = [{ + text: '今天', + onClick(picker) { + const startTime = new Date(new Date().setHours(0, 0, 0)) + const endTime = new Date(new Date().setHours(23, 59, 59)) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: '昨天', + onClick(picker) { + const startTime = new Date(new Date().daysAgo(1).setHours(0, 0, 0)) + const endTime = new Date(new Date().daysAgo(1).setHours(23, 59, 59)) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: '最近一周', + onClick(picker) { + const startTime = new Date(new Date().daysAgo(7).setHours(0, 0, 0)) + const endTime = new Date(new Date().setHours(23, 59, 59)) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: '最近30天', + onClick(picker) { + const startTime = new Date(new Date().daysAgo(30).setHours(0, 0, 0)) + const endTime = new Date(new Date().setHours(23, 59, 59)) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: '这个月', + onClick(picker) { + const startTime = new Date(new Date().monthBegin().setHours(0, 0, 0)) + const endTime = new Date(new Date().setHours(23, 59, 59)) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: '本季度', + onClick(picker) { + const startTime = new Date(new Date().quarterBegin().setHours(0, 0, 0)) + const endTime = new Date(new Date().setHours(23, 59, 59)) + picker.$emit('pick', [startTime, endTime]) + } +}] + +export const calendarMoveShortcuts = [{ + text: '‹ 往前一天 ', + onClick(picker) { + let startTime = new Date(new Date().daysAgo(1).setHours(0, 0, 0)) + let endTime = new Date(new Date().daysAgo(1).setHours(23, 59, 59)) + if (!picker.value) { + picker.value = [startTime, endTime] + } + startTime = picker.value[0].daysAgo(1) + endTime = picker.value[1].daysAgo(1) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: ' 往后一天 ›', + onClick(picker) { + let startTime = new Date(new Date().setHours(0, 0, 0)) + let endTime = new Date(new Date().setHours(23, 59, 59)) + if (!picker.value) { + picker.value = [startTime, endTime] + } + startTime = picker.value[0].daysAgo(-1) + endTime = picker.value[1].daysAgo(-1) + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: '« 往前一周 ', + onClick(picker) { + let startTime = new Date(new Date().setHours(0, 0, 0)) + let endTime = new Date(new Date().setHours(23, 59, 59)) + if (!picker.value) { + picker.value = [startTime.daysAgo(new Date().getDay()), + endTime.daysAgo(new Date().getDay() + 1)] + } else { + picker.value = [picker.value[0].daysAgo(picker.value[0].getDay()), + picker.value[1].daysAgo(picker.value[1].getDay() + 1)] + } + startTime = picker.value[0].daysAgo(7) + endTime = picker.value[1] + picker.$emit('pick', [startTime, endTime]) + } +}, { + text: ' 往后一周 »', + onClick(picker) { + let startTime = new Date(new Date().setHours(0, 0, 0)) + let endTime = new Date(new Date().setHours(23, 59, 59)) + if (!picker.value) { + picker.value = [startTime.daysAgo(new Date().getDay() - 7), + endTime.daysAgo(new Date().getDay() - 6)] + } else { + picker.value = [picker.value[0].daysAgo(picker.value[0].getDay() - 7), + picker.value[1].daysAgo(picker.value[1].getDay() - 6)] + } + startTime = picker.value[0] + endTime = picker.value[1].daysAgo(-7) + picker.$emit('pick', [startTime, endTime]) + } +}] + +export const calendarShortcuts = [ + ...calendarBaseShortcuts, + ...calendarMoveShortcuts +] diff --git a/UI source code/dns_mapping_ui-master/src/utils/upload.js b/UI source code/dns_mapping_ui-master/src/utils/upload.js new file mode 100644 index 0000000..945414b --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/upload.js @@ -0,0 +1,11 @@ +import axios from 'axios' +import { getToken } from '@/utils/auth' + +export function upload(api, file) { + var data = new FormData() + data.append('file', file) + const config = { + headers: { 'Authorization': getToken() } + } + return axios.post(api, data, config) +} diff --git a/UI source code/dns_mapping_ui-master/src/utils/validate.js b/UI source code/dns_mapping_ui-master/src/utils/validate.js new file mode 100644 index 0000000..751f94f --- /dev/null +++ b/UI source code/dns_mapping_ui-master/src/utils/validate.js @@ -0,0 +1,167 @@ +/** + * Created by PanJiaChen on 16/11/18. + */ + +/** + * @param {string} path + * @returns {Boolean} + */ +export function isExternal(path) { + return /^(https?:|mailto:|tel:)/.test(path) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUsername(str) { + const valid_map = ['admin', 'editor'] + return valid_map.indexOf(str.trim()) >= 0 +} + +/** + * @param {string} url + * @returns {Boolean} + */ +export function validURL(url) { + const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/ + return reg.test(url) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validLowerCase(str) { + const reg = /^[a-z]+$/ + return reg.test(str) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUpperCase(str) { + const reg = /^[A-Z]+$/ + return reg.test(str) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validAlphabets(str) { + const reg = /^[A-Za-z]+$/ + return reg.test(str) +} + +/** + * @param {string} email + * @returns {Boolean} + */ +export function validEmail(email) { + const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ + return reg.test(email) +} + +export function isvalidPhone(phone) { + const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/ + return reg.test(phone) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function isString(str) { + if (typeof str === 'string' || str instanceof String) { + return true + } + return false +} + +/** + * @param {Array} arg + * @returns {Boolean} + */ +export function isArray(arg) { + if (typeof Array.isArray === 'undefined') { + return Object.prototype.toString.call(arg) === '[object Array]' + } + return Array.isArray(arg) +} + +/** + * 是否合法IP地址 + * @param rule + * @param value + * @param callback + */ +export function validateIP(rule, value, callback) { + if (value === '' || value === undefined || value == null) { + callback() + } else { + const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ + if ((!reg.test(value)) && value !== '') { + callback(new Error('请输入正确的IP地址')) + } else { + callback() + } + } +} + +/* 是否手机号码或者固话*/ +export function validatePhoneTwo(rule, value, callback) { + const reg = /^((0\d{2,3}-\d{7,8})|(1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}))$/ + if (value === '' || value === undefined || value == null) { + callback() + } else { + if ((!reg.test(value)) && value !== '') { + callback(new Error('请输入正确的电话号码或者固话号码')) + } else { + callback() + } + } +} + +/* 是否固话*/ +export function validateTelephone(rule, value, callback) { + const reg = /0\d{2}-\d{7,8}/ + if (value === '' || value === undefined || value == null) { + callback() + } else { + if ((!reg.test(value)) && value !== '') { + callback(new Error('请输入正确的固话(格式:区号+号码,如010-1234567)')) + } else { + callback() + } + } +} + +/* 是否手机号码*/ +export function validatePhone(rule, value, callback) { + const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/ + if (value === '' || value === undefined || value == null) { + callback() + } else { + if ((!reg.test(value)) && value !== '') { + callback(new Error('请输入正确的电话号码')) + } else { + callback() + } + } +} + +/* 是否身份证号码*/ +export function validateIdNo(rule, value, callback) { + const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/ + if (value === '' || value === undefined || value == null) { + callback() + } else { + if ((!reg.test(value)) && value !== '') { + callback(new Error('请输入正确的身份证号码')) + } else { + callback() + } + } +} |
