diff --git a/star_lock/assets/countries.json b/star_lock/assets/countries.json new file mode 100644 index 00000000..e084bd73 --- /dev/null +++ b/star_lock/assets/countries.json @@ -0,0 +1,1540 @@ +[{ + "short": "AD", + "name": "安道尔共和国", + "en": "Andorra", + "tel": "376", + "pinyin": "adeghg" +}, +{ + "short": "AE", + "name": "阿拉伯联合酋长国", + "en": "UnitedArabEmirates", + "tel": "971", + "pinyin": "alblhqzg" +}, +{ + "short": "AF", + "name": "阿富汗", + "en": "Afghanistan", + "tel": "93", + "pinyin": "afh" +}, +{ + "short": "AG", + "name": "安提瓜和巴布达", + "en": "AntiguaandBarbuda", + "tel": "1268", + "pinyin": "atghbbd" +}, +{ + "short": "AI", + "name": "安圭拉岛", + "en": "Anguilla", + "tel": "1264", + "pinyin": "agld" +}, +{ + "short": "AL", + "name": "阿尔巴尼亚", + "en": "Albania", + "tel": "355", + "pinyin": "aebny" +}, +{ + "short": "AM", + "name": "阿美尼亚", + "en": "Armenia", + "tel": "374", + "pinyin": "amny" +}, +{ + "short": "", + "name": "阿森松", + "en": "Ascension", + "tel": "247", + "pinyin": "als" + +}, +{ + "short": "AO", + "name": "安哥拉", + "en": "Angola", + "tel": "244", + "pinyin": "agl" + +}, +{ + "short": "AR", + "name": "阿根廷", + "en": "Argentina", + "tel": "54", + "pinyin": "agt" + +}, +{ + "short": "AT", + "name": "奥地利", + "en": "Austria", + "tel": "43", + "pinyin": "adl" + +}, +{ + "short": "AU", + "name": "澳大利亚", + "en": "Australia", + "tel": "61", + "pinyin": "adly" + +}, +{ + "short": "AZ", + "name": "阿塞拜疆", + "en": "Azerbaijan", + "tel": "994", + "pinyin": "asbj" + +}, +{ + "short": "BB", + "name": "巴巴多斯", + "en": "Barbados", + "tel": "1246", + "pinyin": "bbds" + +}, +{ + "short": "BD", + "name": "孟加拉国", + "en": "Bangladesh", + "tel": "880", + "pinyin": "mjlg" + +}, +{ + "short": "BE", + "name": "比利时", + "en": "Belgium", + "tel": "32", + "pinyin": "bls" + +}, +{ + "short": "BF", + "name": "布基纳法索", + "en": "Burkina-faso", + "tel": "226", + "pinyin": "bjnfs" + +}, +{ + "short": "BG", + "name": "保加利亚", + "en": "Bulgaria", + "tel": "359", + "pinyin": "bjly" + +}, +{ + "short": "BH", + "name": "巴林", + "en": "Bahrain", + "tel": "973", + "pinyin": "bl" + +}, +{ + "short": "BI", + "name": "布隆迪", + "en": "Burundi", + "tel": "257", + "pinyin": "bld" + +}, +{ + "short": "BJ", + "name": "贝宁", + "en": "Benin", + "tel": "229", + "pinyin": "bl" + +}, +{ + "short": "BL", + "name": "巴勒斯坦", + "en": "Palestine", + "tel": "970", + "pinyin": "blst" + +}, +{ + "short": "BM", + "name": "百慕大群岛", + "en": "BermudaIs.", + "tel": "1441", + "pinyin": "bmdqd" + +}, +{ + "short": "BN", + "name": "文莱", + "en": "Brunei", + "tel": "673", + "pinyin": "wl" + +}, +{ + "short": "BO", + "name": "玻利维亚", + "en": "Bolivia", + "tel": "591", + "pinyin": "blwy" + +}, +{ + "short": "BR", + "name": "巴西", + "en": "Brazil", + "tel": "55", + "pinyin": "bx" + +}, +{ + "short": "BS", + "name": "巴哈马", + "en": "Bahamas", + "tel": "1242", + "pinyin": "bhm" + +}, +{ + "short": "BW", + "name": "博茨瓦纳", + "en": "Botswana", + "tel": "267", + "pinyin": "bcwn" + +}, +{ + "short": "BY", + "name": "白俄罗斯", + "en": "Belarus", + "tel": "375", + "pinyin": "bels" + +}, +{ + "short": "BZ", + "name": "伯利兹", + "en": "Belize", + "tel": "501", + "pinyin": "blz" + +}, +{ + "short": "CA", + "name": "加拿大", + "en": "Canada", + "tel": "1", + "pinyin": "jnd" + +}, +{ + "short": "", + "name": "开曼群岛", + "en": "CaymanIs.", + "tel": "1345", + "pinyin": "kmqd" + +}, +{ + "short": "CF", + "name": "中非共和国", + "en": "CentralAfricanRepublic", + "tel": "236", + "pinyin": "zfghg" + +}, +{ + "short": "CG", + "name": "刚果", + "en": "Congo", + "tel": "242", + "pinyin": "gg" + +}, +{ + "short": "CH", + "name": "瑞士", + "en": "Switzerland", + "tel": "41", + "pinyin": "rs" + +}, +{ + "short": "CK", + "name": "库克群岛", + "en": "CookIs.", + "tel": "682", + "pinyin": "kkqd" + +}, +{ + "short": "CL", + "name": "智利", + "en": "Chile", + "tel": "56", + "pinyin": "zl" + +}, +{ + "short": "CM", + "name": "喀麦隆", + "en": "Cameroon", + "tel": "237", + "pinyin": "kml" + +}, +{ + "short": "CN", + "name": "中国", + "en": "China", + "tel": "86", + "pinyin": "zg" + +}, +{ + "short": "CO", + "name": "哥伦比亚", + "en": "Colombia", + "tel": "57", + "pinyin": "glby" + +}, +{ + "short": "CR", + "name": "哥斯达黎加", + "en": "CostaRica", + "tel": "506", + "pinyin": "gsdlj" + +}, +{ + "short": "CS", + "name": "捷克", + "en": "Czech", + "tel": "420", + "pinyin": "jk" + +}, +{ + "short": "CU", + "name": "古巴", + "en": "Cuba", + "tel": "53", + "pinyin": "gb" + +}, +{ + "short": "CY", + "name": "塞浦路斯", + "en": "Cyprus", + "tel": "357", + "pinyin": "spls" + +}, +{ + "short": "CZ", + "name": "捷克", + "en": "CzechRepublic", + "tel": "420", + "pinyin": "jk" + +}, +{ + "short": "DE", + "name": "德国", + "en": "Germany", + "tel": "49", + "pinyin": "dg" + +}, +{ + "short": "DJ", + "name": "吉布提", + "en": "Djibouti", + "tel": "253", + "pinyin": "jbt" + +}, +{ + "short": "DK", + "name": "丹麦", + "en": "Denmark", + "tel": "45", + "pinyin": "dm" + +}, +{ + "short": "DO", + "name": "多米尼加共和国", + "en": "DominicaRep.", + "tel": "1890", + "pinyin": "dmnjghg" + +}, +{ + "short": "DZ", + "name": "阿尔及利亚", + "en": "Algeria", + "tel": "213", + "pinyin": "aejly" + +}, +{ + "short": "EC", + "name": "厄瓜多尔", + "en": "Ecuador", + "tel": "593", + "pinyin": "egde" + +}, +{ + "short": "EE", + "name": "爱沙尼亚", + "en": "Estonia", + "tel": "372", + "pinyin": "asny" + +}, +{ + "short": "EG", + "name": "埃及", + "en": "Egypt", + "tel": "20", + "pinyin": "ej" + +}, +{ + "short": "ES", + "name": "西班牙", + "en": "Spain", + "tel": "34", + "pinyin": "xby" + +}, +{ + "short": "ET", + "name": "埃塞俄比亚", + "en": "Ethiopia", + "tel": "251", + "pinyin": "aseby" + +}, +{ + "short": "FI", + "name": "芬兰", + "en": "Finland", + "tel": "358", + "pinyin": "fl" + +}, +{ + "short": "FJ", + "name": "斐济", + "en": "Fiji", + "tel": "679", + "pinyin": "fj" + +}, +{ + "short": "FR", + "name": "法国", + "en": "France", + "tel": "33", + "pinyin": "fg" + +}, +{ + "short": "GA", + "name": "加蓬", + "en": "Gabon", + "tel": "241", + "pinyin": "jp" + +}, +{ + "short": "GB", + "name": "英国", + "en": "UnitedKiongdom", + "tel": "44", + "pinyin": "yg" + +}, +{ + "short": "GD", + "name": "格林纳达", + "en": "Grenada", + "tel": "1809", + "pinyin": "glnd" + +}, +{ + "short": "GE", + "name": "格鲁吉亚", + "en": "Georgia", + "tel": "995", + "pinyin": "gljy" + +}, +{ + "short": "GF", + "name": "法属圭亚那", + "en": "FrenchGuiana", + "tel": "594", + "pinyin": "fsgyn" + +}, +{ + "short": "GH", + "name": "加纳", + "en": "Ghana", + "tel": "233", + "pinyin": "jn" + +}, +{ + "short": "GI", + "name": "直布罗陀", + "en": "Gibraltar", + "tel": "350", + "pinyin": "zblt" + +}, +{ + "short": "GM", + "name": "冈比亚", + "en": "Gambia", + "tel": "220", + "pinyin": "gby" + +}, +{ + "short": "GN", + "name": "几内亚", + "en": "Guinea", + "tel": "224", + "pinyin": "jny" + +}, +{ + "short": "GR", + "name": "希腊", + "en": "Greece", + "tel": "30", + "pinyin": "xl" + +}, +{ + "short": "GT", + "name": "危地马拉", + "en": "Guatemala", + "tel": "502", + "pinyin": "wdml" + +}, +{ + "short": "GU", + "name": "关岛", + "en": "Guam", + "tel": "1671", + "pinyin": "gd" + +}, +{ + "short": "GY", + "name": "圭亚那", + "en": "Guyana", + "tel": "592", + "pinyin": "gyn" + +}, +{ + "short": "HK", + "name": "香港(中国)", + "en": "Hongkong", + "tel": "852", + "pinyin": "xgzg" + +}, +{ + "short": "HN", + "name": "洪都拉斯", + "en": "Honduras", + "tel": "504", + "pinyin": "hdls" + +}, +{ + "short": "HT", + "name": "海地", + "en": "Haiti", + "tel": "509", + "pinyin": "hd" + +}, +{ + "short": "HU", + "name": "匈牙利", + "en": "Hungary", + "tel": "36", + "pinyin": "xyl" + +}, +{ + "short": "ID", + "name": "印度尼西亚", + "en": "Indonesia", + "tel": "62", + "pinyin": "ydnxy" + +}, +{ + "short": "IE", + "name": "爱尔兰", + "en": "Ireland", + "tel": "353", + "pinyin": "ael" + +}, +{ + "short": "IL", + "name": "以色列", + "en": "Israel", + "tel": "972", + "pinyin": "ysl" + +}, +{ + "short": "IN", + "name": "印度", + "en": "India", + "tel": "91", + "pinyin": "yd" + +}, +{ + "short": "IQ", + "name": "伊拉克", + "en": "Iraq", + "tel": "964", + "pinyin": "ylk" + +}, +{ + "short": "IR", + "name": "伊朗", + "en": "Iran", + "tel": "98", + "pinyin": "yl" + +}, +{ + "short": "IS", + "name": "冰岛", + "en": "Iceland", + "tel": "354", + "pinyin": "bd" + +}, +{ + "short": "IT", + "name": "意大利", + "en": "Italy", + "tel": "39", + "pinyin": "ydl" + +}, +{ + "short": "", + "name": "科特迪瓦", + "en": "IvoryCoast", + "tel": "225", + "pinyin": "ktdw" + +}, +{ + "short": "JM", + "name": "牙买加", + "en": "Jamaica", + "tel": "1876", + "pinyin": "ymj" + +}, +{ + "short": "JO", + "name": "约旦", + "en": "Jordan", + "tel": "962", + "pinyin": "yd" + +}, +{ + "short": "JP", + "name": "日本", + "en": "Japan", + "tel": "81", + "pinyin": "rb" + +}, +{ + "short": "KE", + "name": "肯尼亚", + "en": "Kenya", + "tel": "254", + "pinyin": "kny" + +}, +{ + "short": "KG", + "name": "吉尔吉斯坦", + "en": "Kyrgyzstan", + "tel": "331", + "pinyin": "jejst" + +}, +{ + "short": "KH", + "name": "柬埔寨", + "en": "Kampuchea(Cambodia)", + "tel": "855", + "pinyin": "jpz" + +}, +{ + "short": "KP", + "name": "朝鲜", + "en": "NorthKorea", + "tel": "850", + "pinyin": "cx" + +}, +{ + "short": "KR", + "name": "韩国", + "en": "Korea", + "tel": "82", + "pinyin": "hg" + + +}, +{ + "short": "KT", + "name": "科特迪瓦共和国", + "en": "RepublicofIvoryCoast", + "tel": "225", + "pinyin": "ktdwghg" + +}, +{ + "short": "KW", + "name": "科威特", + "en": "Kuwait", + "tel": "965", + "pinyin": "kwt" + +}, +{ + "short": "KZ", + "name": "哈萨克斯坦", + "en": "Kazakstan", + "tel": "327", + "pinyin": "hskst" + +}, +{ + "short": "LA", + "name": "老挝", + "en": "Laos", + "tel": "856", + "pinyin": "lw" + +}, +{ + "short": "LB", + "name": "黎巴嫩", + "en": "Lebanon", + "tel": "961", + "pinyin": "lbn" + +}, +{ + "short": "LC", + "name": "圣卢西亚", + "en": "St.Lucia", + "tel": "1758", + "pinyin": "slxy" + +}, +{ + "short": "LI", + "name": "列支敦士登", + "en": "Liechtenstein", + "tel": "423", + "pinyin": "lzdsd" + +}, +{ + "short": "LK", + "name": "斯里兰卡", + "en": "SriLanka", + "tel": "94", + "pinyin": "sllk" + +}, +{ + "short": "LR", + "name": "利比里亚", + "en": "Liberia", + "tel": "231", + "pinyin": "lbly" + +}, +{ + "short": "LS", + "name": "莱索托", + "en": "Lesotho", + "tel": "266", + "pinyin": "lst" + +}, +{ + "short": "LT", + "name": "立陶宛", + "en": "Lithuania", + "tel": "370", + "pinyin": "ltw" + +}, +{ + "short": "LU", + "name": "卢森堡", + "en": "Luxembourg", + "tel": "352", + "pinyin": "lsb" + +}, +{ + "short": "LV", + "name": "拉脱维亚", + "en": "Latvia", + "tel": "371", + "pinyin": "ltwy" + +}, +{ + "short": "LY", + "name": "利比亚", + "en": "Libya", + "tel": "218", + "pinyin": "lby" + +}, +{ + "short": "MA", + "name": "摩洛哥", + "en": "Morocco", + "tel": "212", + "pinyin": "mlg" + +}, +{ + "short": "MC", + "name": "摩纳哥", + "en": "Monaco", + "tel": "377", + "pinyin": "mng" + +}, +{ + "short": "MD", + "name": "摩尔多瓦", + "en": "Moldova,Republicof", + "tel": "373", + "pinyin": "medw" + +}, +{ + "short": "MG", + "name": "马达加斯加", + "en": "Madagascar", + "tel": "261", + "pinyin": "mdjsj" + +}, +{ + "short": "ML", + "name": "马里", + "en": "Mali", + "tel": "223", + "pinyin": "ml" + +}, +{ + "short": "MM", + "name": "缅甸", + "en": "Burma", + "tel": "95", + "pinyin": "md" + +}, +{ + "short": "MN", + "name": "蒙古", + "en": "Mongolia", + "tel": "976", + "pinyin": "mg" + +}, +{ + "short": "MO", + "name": "澳门(中国)", + "en": "Macao", + "tel": "853", + "pinyin": "am zg" + +}, +{ + "short": "MS", + "name": "蒙特塞拉特岛", + "en": "MontserratIs", + "tel": "1664", + "pinyin": "mtsstd" + +}, +{ + "short": "MT", + "name": "马耳他", + "en": "Malta", + "tel": "356", + "pinyin": "met" + +}, +{ + "short": "", + "name": "马里亚那群岛", + "en": "MarianaIs", + "tel": "1670", + "pinyin": "mlynqd" + +}, +{ + "short": "", + "name": "马提尼克", + "en": "Martinique", + "tel": "596", + "pinyin": "mtnk" + +}, +{ + "short": "MU", + "name": "毛里求斯", + "en": "Mauritius", + "tel": "230", + "pinyin": "mlqs" + +}, +{ + "short": "MV", + "name": "马尔代夫", + "en": "Maldives", + "tel": "960", + "pinyin": "medf" + + +}, +{ + "short": "MW", + "name": "马拉维", + "en": "Malawi", + "tel": "265", + "pinyin": "mlw" + +}, +{ + "short": "MX", + "name": "墨西哥", + "en": "Mexico", + "tel": "52", + "pinyin": "mxg" + +}, +{ + "short": "MY", + "name": "马来西亚", + "en": "Malaysia", + "tel": "60", + "pinyin": "mlxy" + +}, +{ + "short": "MZ", + "name": "莫桑比克", + "en": "Mozambique", + "tel": "258", + "pinyin": "msbk" + +}, +{ + "short": "NA", + "name": "纳米比亚", + "en": "Namibia", + "tel": "264", + "pinyin": "nmby" + +}, +{ + "short": "NE", + "name": "尼日尔", + "en": "Niger", + "tel": "977", + "pinyin": "nre" + +}, +{ + "short": "NG", + "name": "尼日利亚", + "en": "Nigeria", + "tel": "234", + "pinyin": "nrly" + +}, +{ + "short": "NI", + "name": "尼加拉瓜", + "en": "Nicaragua", + "tel": "505", + "pinyin": "njlg" + +}, +{ + "short": "NL", + "name": "荷兰", + "en": "Netherlands", + "tel": "31", + "pinyin": "hl" + +}, +{ + "short": "NO", + "name": "挪威", + "en": "Norway", + "tel": "47", + "pinyin": "nw" + +}, +{ + "short": "NP", + "name": "尼泊尔", + "en": "Nepal", + "tel": "977", + "pinyin": "nbe" + +}, +{ + "short": "", + "name": "荷属安的列斯", + "en": "NetheriandsAntilles", + "tel": "599", + "pinyin": "hsadls" + +}, +{ + "short": "NR", + "name": "瑙鲁", + "en": "Nauru", + "tel": "674", + "pinyin": "nl" + +}, +{ + "short": "NZ", + "name": "新西兰", + "en": "NewZealand", + "tel": "64", + "pinyin": "xxl" + +}, +{ + "short": "OM", + "name": "阿曼", + "en": "Oman", + "tel": "968", + "pinyin": "am" + +}, +{ + "short": "PA", + "name": "巴拿马", + "en": "Panama", + "tel": "507", + "pinyin": "bnm" + +}, +{ + "short": "PE", + "name": "秘鲁", + "en": "Peru", + "tel": "51", + "pinyin": "bl" + +}, +{ + "short": "PF", + "name": "法属玻利尼西亚", + "en": "FrenchPolynesia", + "tel": "689", + "pinyin": "fsblnxy" + +}, +{ + "short": "PG", + "name": "巴布亚新几内亚", + "en": "PapuaNewCuinea", + "tel": "675", + "pinyin": "bbyxjny" + +}, +{ + "short": "PH", + "name": "菲律宾", + "en": "Philippines", + "tel": "63", + "pinyin": "flb" + +}, +{ + "short": "PK", + "name": "巴基斯坦", + "en": "Pakistan", + "tel": "92", + "pinyin": "bjst" + +}, +{ + "short": "PL", + "name": "波兰", + "en": "Poland", + "tel": "48", + "pinyin": "bl" + +}, +{ + "short": "PR", + "name": "波多黎各", + "en": "PuertoRico", + "tel": "1787", + "pinyin": "bdlg" + +}, +{ + "short": "PT", + "name": "葡萄牙", + "en": "Portugal", + "tel": "351", + "pinyin": "pty" + +}, +{ + "short": "PY", + "name": "巴拉圭", + "en": "Paraguay", + "tel": "595", + "pinyin": "blg" + +}, +{ + "short": "QA", + "name": "卡塔尔", + "en": "Qatar", + "tel": "974", + "pinyin": "kte" + +}, +{ + "short": "", + "name": "留尼旺", + "en": "Reunion", + "tel": "262", + "pinyin": "lnw" + +}, +{ + "short": "RO", + "name": "罗马尼亚", + "en": "Romania", + "tel": "40", + "pinyin": "lmny" + +}, +{ + "short": "RU", + "name": "俄罗斯", + "en": "Russia", + "tel": "7", + "pinyin": "els" + +}, +{ + "short": "SA", + "name": "沙特阿拉伯", + "en": "SaudiArabia", + "tel": "966", + "pinyin": "stalb" + +}, +{ + "short": "SB", + "name": "所罗门群岛", + "en": "SolomonIs", + "tel": "677", + "pinyin": "slmqd" + +}, +{ + "short": "SC", + "name": "塞舌尔", + "en": "Seychelles", + "tel": "248", + "pinyin": "sse" + +}, +{ + "short": "SD", + "name": "苏丹", + "en": "Sudan", + "tel": "249", + "pinyin": "sd" + +}, +{ + "short": "SE", + "name": "瑞典", + "en": "Sweden", + "tel": "46", + "pinyin": "rd" + +}, +{ + "short": "SG", + "name": "新加坡", + "en": "Singapore", + "tel": "65", + "pinyin": "xjp" + +}, +{ + "short": "SI", + "name": "斯洛文尼亚", + "en": "Slovenia", + "tel": "386", + "pinyin": "slwny" + +}, +{ + "short": "SK", + "name": "斯洛伐克", + "en": "Slovakia", + "tel": "421", + "pinyin": "slfk" + +}, +{ + "short": "SL", + "name": "塞拉利昂", + "en": "SierraLeone", + "tel": "232", + "pinyin": "slla" + +}, +{ + "short": "SM", + "name": "圣马力诺", + "en": "SanMarino", + "tel": "378", + "pinyin": "smln" + +}, +{ + "short": "", + "name": "东萨摩亚(美)", + "en": "SamoaEastern", + "tel": "684", + "pinyin": "dsmym" + +}, +{ + "short": "", + "name": "西萨摩亚", + "en": "SanMarino", + "tel": "685", + "pinyin": "xsmy" + +}, +{ + "short": "SN", + "name": "塞内加尔", + "en": "Senegal", + "tel": "221", + "pinyin": "snje" + +}, +{ + "short": "SO", + "name": "索马里", + "en": "Somali", + "tel": "252", + "pinyin": "sml" + +}, +{ + "short": "SR", + "name": "苏里南", + "en": "Suriname", + "tel": "597", + "pinyin": "sln" + +}, +{ + "short": "ST", + "name": "圣多美和普林西比", + "en": "SaoTomeandPrincipe", + "tel": "239", + "pinyin": "sdmhplxb" + +}, +{ + "short": "SV", + "name": "萨尔瓦多", + "en": "EISalvador", + "tel": "503", + "pinyin": "sewd" + +}, +{ + "short": "SY", + "name": "叙利亚", + "en": "Syria", + "tel": "963", + "pinyin": "xly" + +}, +{ + "short": "SZ", + "name": "斯威士兰", + "en": "Swaziland", + "tel": "268", + "pinyin": "swsl" + +}, +{ + "short": "TD", + "name": "乍得", + "en": "Chad", + "tel": "235", + "pinyin": "zd" + +}, +{ + "short": "TG", + "name": "多哥", + "en": "Togo", + "tel": "228", + "pinyin": "dg" + +}, +{ + "short": "TH", + "name": "泰国", + "en": "Thailand", + "tel": "66", + "pinyin": "tg" + +}, +{ + "short": "TJ", + "name": "塔吉克斯坦", + "en": "Tajikstan", + "tel": "992", + "pinyin": "tjkst" + +}, +{ + "short": "TM", + "name": "土库曼斯坦", + "en": "Turkmenistan", + "tel": "993", + "pinyin": "tkmst" + +}, +{ + "short": "TN", + "name": "突尼斯", + "en": "Tunisia", + "tel": "216", + "pinyin": "tns" + +}, +{ + "short": "TO", + "name": "汤加", + "en": "Tonga", + "tel": "676", + "pinyin": "tj" + +}, +{ + "short": "TR", + "name": "土耳其", + "en": "Turkey", + "tel": "90", + "pinyin": "teq" + +}, +{ + "short": "TT", + "name": "特立尼达和多巴哥", + "en": "TrinidadandTobago", + "tel": "1809", + "pinyin": "tlndhdbg" + +}, +{ + "short": "TW", + "name": "台湾(中国)", + "en": "Taiwan", + "tel": "886", + "pinyin": "twzg" + +}, +{ + "short": "TZ", + "name": "坦桑尼亚", + "en": "Tanzania", + "tel": "255", + "pinyin": "tsny" + +}, +{ + "short": "UA", + "name": "乌克兰", + "en": "Ukraine", + "tel": "380", + "pinyin": "wkl" + +}, +{ + "short": "UG", + "name": "乌干达", + "en": "Uganda", + "tel": "256", + "pinyin": "wgd" + +}, +{ + "short": "US", + "name": "美国", + "en": "UnitedStatesofAmerica", + "tel": "1", + "pinyin": "mg" + +}, +{ + "short": "UY", + "name": "乌拉圭", + "en": "Uruguay", + "tel": "598", + "pinyin": "wlg" + +}, +{ + "short": "UZ", + "name": "乌兹别克斯坦", + "en": "Uzbekistan", + "tel": "233", + "pinyin": "wzbkst" + +}, +{ + "short": "VC", + "name": "圣文森特岛", + "en": "SaintVincent", + "tel": "1784", + "pinyin": "swstd" + +}, +{ + "short": "VE", + "name": "委内瑞拉", + "en": "Venezuela", + "tel": "58", + "pinyin": "wnrl" + +}, +{ + "short": "VN", + "name": "越南", + "en": "Vietnam", + "tel": "84", + "pinyin": "yn" + +}, +{ + "short": "YE", + "name": "也门", + "en": "Yemen", + "tel": "967", + "pinyin": "ym" + +}, +{ + "short": "YU", + "name": "南斯拉夫", + "en": "Yugoslavia", + "tel": "381", + "pinyin": "nslf" + +}, +{ + "short": "ZA", + "name": "南非", + "en": "SouthAfrica", + "tel": "27", + "pinyin": "nf" + +}, +{ + "short": "ZM", + "name": "赞比亚", + "en": "Zambia", + "tel": "260", + "pinyin": "zby" + +}, +{ + "short": "ZR", + "name": "扎伊尔", + "en": "Zaire", + "tel": "243", + "pinyin": "zye" + +}, +{ + "short": "ZW", + "name": "津巴布韦", + "en": "Zimbabwe", + "tel": "263", + "pinyin": "jbbw" + +} +] diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index b089d2a4..06d704ca 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -191,6 +191,9 @@ "lanChinese":"Chinese", "multilingual":"Multilingual", "addLock":"Add Lock", + "selectLockType":"Select lock type", + "videoIntercomDoorLock":"Video intercom door lock", + "NFCPassiveLock":"NFC Passive Lock", "addDevice":"Add device", "gateway":"Gateway", "message":"Message", diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 22f3f9d0..bf52f4ae 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -191,6 +191,9 @@ "lanChinese":"lanChinese", "multilingual":"multilingual", "addLock":"addLock", + "selectLockType":"selectLockType", + "videoIntercomDoorLock":"videoIntercomDoorLock", + "NFCPassiveLock":"NFCPassiveLock", "addDevice":"addDevice", "gateway":"gateway", "message":"message", diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 05cf5f74..bf47020d 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -191,6 +191,9 @@ "lanChinese":"中文", "multilingual":"多语言", "addLock":"添加锁", + "selectLockType":"选择锁类型", + "videoIntercomDoorLock":"可视对讲门锁", + "NFCPassiveLock":"NFC无源锁", "addDevice":"添加设备", "gateway":"网关", "message":"消息", diff --git a/star_lock/lib/login/forgetPassword/entity/ForgetPasswordData.dart b/star_lock/lib/login/forgetPassword/entity/ForgetPasswordData.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/login/forgetPassword/entity/ForgetPasswordEntity.dart b/star_lock/lib/login/forgetPassword/entity/ForgetPasswordEntity.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_binding.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_binding.dart new file mode 100644 index 00000000..40c46ffd --- /dev/null +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_binding.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; +import 'starLock_forgetPassword_logic.dart'; + +class StarLockForgetPasswordBinding extends Bindings { + @override + void dependencies() { + Get.lazyPut(() => StarLockForgetPasswordLogic()); + } +} diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart new file mode 100644 index 00000000..6437847c --- /dev/null +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_logic.dart @@ -0,0 +1,88 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart'; + +import '../../network/api_repository.dart'; +import '../../tools/baseGetXController.dart'; +import '../../tools/toast.dart'; + +class StarLockForgetPasswordLogic extends BaseGetXController { + final StarLockForgetPasswordState state = StarLockForgetPasswordState(); + + late Timer _timer; + void _startTimer() { + _timer = Timer.periodic(1.seconds, (timer) { + if (state.currentSecond > 1) { + state.currentSecond--; + } else { + _cancelTimer(); + state.currentSecond = state.totalSeconds; + } + state.resetResend(); + }); + } + + void _cancelTimer() { + _timer.cancel(); + // _timer = null; + } + + void resetPassword() async { + var entity = await ApiRepository.to.resetPassword( + state.countryCode.value, + state.phoneStr.value, + state.date.value, + state.pwd.value, + "B748F838-94EE-4BDB-A0E6-7B2D16849792", + state.verificationCode.value); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: '重置成功'); + Get.back(); + } else { + print('Error'); + } + } + + void sendValidationCode() async { + var entity = await ApiRepository.to.sendValidationCode( + // state.countryCode.value, + "+86", + state.phoneStr.value, + // state.isIphoneType.value ? "1" : "2", + '1', + state.codeType.value, + "B748F838-94EE-4BDB-A0E6-7B2D16849792", + state.xWidth.value.toString()); + if (entity.errorCode!.codeIsSuccessful) { + _startTimer(); + } else {} + } + + void checkNext(TextEditingController controller) { + changeInput(controller); + } + + void changeInput(TextEditingController controller) { + if (controller == state.phoneController) { + state.phoneStr.value = controller.text; + state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty; + } + if (controller == state.pwdController) { + state.pwd.value = controller.text; + } + if (controller == state.sureController) { + state.surePwd.value = controller.text; + } + if (controller == state.codeController) { + state.verificationCode.value = controller.text; + } + _resetCanSub(); + } + + void _resetCanSub() { + state.canSub.value = state.pwdIsOK && state.codeIsOK; + print("22222:${state.canSub.value}"); + } +} diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart index 755aef0b..af0b1eb3 100644 --- a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; @@ -22,13 +23,8 @@ class StarLockForgetPasswordPage extends StatefulWidget { class _StarLockForgetPasswordPageState extends State { - final TextEditingController _phoneController = TextEditingController(); - final TextEditingController _pwdController = TextEditingController(); - final TextEditingController _codeController = TextEditingController(); - - late Timer _timer; - - int _seconds = 60; + final logic = Get.put(StarLockForgetPasswordLogic()); + final state = Get.find().state; @override Widget build(BuildContext context) { @@ -44,7 +40,11 @@ class _StarLockForgetPasswordPageState padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), children: [ LoginInput( - controller: _phoneController, + controller: state.phoneController, + onchangeAction: (v) { + print("3333333:${v}"); + logic.checkNext(state.phoneController); + }, leftWidget: Padding( padding: EdgeInsets.only( top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), @@ -63,7 +63,10 @@ class _StarLockForgetPasswordPageState ]), SizedBox(height: 10.h), LoginInput( - controller: _pwdController, + controller: state.pwdController, + onchangeAction: (v) { + logic.checkNext(state.pwdController); + }, isPwd: true, leftWidget: Padding( padding: EdgeInsets.only( @@ -87,7 +90,10 @@ class _StarLockForgetPasswordPageState ), SizedBox(height: 10.w), LoginInput( - controller: _pwdController, + controller: state.sureController, + onchangeAction: (v) { + logic.checkNext(state.sureController); + }, isPwd: true, leftWidget: Padding( padding: EdgeInsets.only( @@ -108,21 +114,17 @@ class _StarLockForgetPasswordPageState children: [ Expanded( child: LoginInput( - controller: _codeController, - isPwd: true, + controller: state.codeController, + onchangeAction: (v) { + logic.checkNext(state.codeController); + }, leftWidget: Padding( - padding: EdgeInsets.only( - top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), - child: SizedBox( - width: 36.w, - height: 36.w, - ) - // Image.asset( - // 'images/main/icon_main_search.png', - // width: 40.w, - // height: 40.w, - // ), - ), + padding: EdgeInsets.only(right: 10.w, left: 5.w), + child: SizedBox( + width: 30.w, + height: 30.w, + ), + ), hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}", inputFormatters: [ @@ -130,48 +132,62 @@ class _StarLockForgetPasswordPageState ]), ), SizedBox( - width: 20.w, + width: 10.w, ), - GestureDetector( - child: Container( - width: 160.w, - height: 60.h, - padding: EdgeInsets.all(5.h), - decoration: BoxDecoration( - color: AppColors.mainColor, - borderRadius: BorderRadius.circular(5)), - child: Center( - child: Text( - _seconds == 60 - ? '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}' - : (_seconds < 10) - ? '0$_seconds s' - : '$_seconds s', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 26.sp, - )), - ), - ), - onTap: () { - if (_seconds == 60) { - // _setVerify(); - } else { - // Toast.show(msg: '正在获取验证码'); - } - }, - ) + Obx(() => GestureDetector( + onTap: state.phoneStrIsOK.value + ? () async { + // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); + var result = await Navigator.pushNamed( + context, Routers.safetyVerificationPage, + arguments: { + "countryCode": "+86", + "account": state.phoneStr.value + }); + logic.state.xWidth.value = + (result as Map)['xWidth']; + logic.sendValidationCode(); + } + : null, + child: Container( + width: 180.w, + height: 60.h, + padding: EdgeInsets.all(5.h), + decoration: BoxDecoration( + color: state.phoneStrIsOK.value + ? AppColors.mainColor + : AppColors.btnDisableColor, + borderRadius: BorderRadius.circular(5)), + child: Center( + child: Text(state.btnText.value, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 24.sp, + )), + ), + ), + )) ], ), + // ], + // ), SizedBox(height: 50.w), - SubmitBtn( - btnName: - "${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}", - fontSize: 30.sp, - borderRadius: 20.w, - padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () {}), + Obx(() { + return SubmitBtn( + btnName: + "${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}", + // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], + fontSize: 30.sp, + borderRadius: 20.w, + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + isDisabled: state.canSub.value, + onClick: state.canSub.value + ? () { + logic.resetPassword(); + } + : null); + }), ], )); } diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart new file mode 100644 index 00000000..205206fb --- /dev/null +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_state.dart @@ -0,0 +1,55 @@ +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../translations/trans_lib.dart'; + +class StarLockForgetPasswordState { + final TextEditingController phoneController = TextEditingController(); + final TextEditingController pwdController = TextEditingController(); + final TextEditingController sureController = TextEditingController(); + final TextEditingController codeController = TextEditingController(); + + static int currentTimeMillis() { + return DateTime.now().millisecondsSinceEpoch; + } + + var countryCode = '+86'.obs; + var countryId = '9'.obs; + var codeType = '2'.obs; + var pwd = ''.obs; + var surePwd = ''.obs; + var verificationCode = ''.obs; + var xWidth = ''.obs; // 滑动验证码滑动位置 + var canSub = false.obs; + var phoneStr = ''.obs; + var phoneStrIsOK = false.obs; + var date = currentTimeMillis().toString().obs; + + bool get isIphone => RegexUtil.isMobileSimple(phoneStr.value); + bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value); + bool get codeIsOK => verificationCode.value.isNotEmpty; + + var canResend = false.obs; + var btnText = ''.obs; + var totalSeconds = 120; + var currentSecond = 120; + + StarLockForgetPasswordState() { + resetResend(); + } + + void resetResend() { + canResend.value = totalSeconds == currentSecond; + btnText.value = !canResend.value + ? '$currentSecond s' + : btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr; + } + + void onClose() { + phoneController.dispose(); + pwdController.dispose(); + sureController.dispose(); + codeController.dispose(); + } +} diff --git a/star_lock/lib/login/register/starLock_register_logic.dart b/star_lock/lib/login/register/starLock_register_logic.dart index d334cc55..7ea009b3 100644 --- a/star_lock/lib/login/register/starLock_register_logic.dart +++ b/star_lock/lib/login/register/starLock_register_logic.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'package:flutter/material.dart'; @@ -9,15 +8,15 @@ import '../../tools/baseGetXController.dart'; import '../../tools/toast.dart'; import 'starLock_register_state.dart'; -class StarLockRegisterLogic extends BaseGetXController{ +class StarLockRegisterLogic extends BaseGetXController { final StarLockRegisterState state = StarLockRegisterState(); late Timer _timer; void _startTimer() { _timer = Timer.periodic(1.seconds, (timer) { - if(state.currentSecond > 1){ + if (state.currentSecond > 1) { state.currentSecond--; - }else { + } else { _cancelTimer(); state.currentSecond = state.totalSeconds; } @@ -30,38 +29,33 @@ class StarLockRegisterLogic extends BaseGetXController{ // _timer = null; } - void register() async{ + void register() async { var entity = await ApiRepository.to.register( state.countryCode.value, state.countryId.value, state.phoneOrEmailStr.value, state.pwd.value, "477E6814-289D-402A-9F49-F89A8BD05D63", - state.verificationCode.value - ); - if(entity.errorCode!.codeIsSuccessful){ + state.verificationCode.value); + if (entity.errorCode!.codeIsSuccessful) { // await loginSuccess(loginEntity: entity); Toast.show(msg: "注册成功"); Get.back(); - } else { - - } + } else {} } - void sendValidationCode() async{ + void sendValidationCode() async { var entity = await ApiRepository.to.sendValidationCode( // state.countryCode.value, "+86", state.phoneOrEmailStr.value, - state.isIphoneType.value?"1":"2", + state.isIphoneType.value ? "1" : "2", + '1', "B748F838-94EE-4BDB-A0E6-7B2D16849792", - state.xWidth.value.toString() - ); - if(entity.errorCode!.codeIsSuccessful){ + state.xWidth.value.toString()); + if (entity.errorCode!.codeIsSuccessful) { _startTimer(); - } else { - - } + } else {} } void checkNext(TextEditingController controller) { @@ -69,25 +63,26 @@ class StarLockRegisterLogic extends BaseGetXController{ } void changeInput(TextEditingController controller) { - if(controller == state.phoneOrEmailController){ + if (controller == state.phoneOrEmailController) { state.phoneOrEmailStr.value = controller.text; state.phoneOrEmailStrIsOK.value = state.phoneOrEmailStr.value.isNotEmpty; } - if(controller == state.pwdController) { + if (controller == state.pwdController) { state.pwd.value = controller.text; } - if(controller == state.sureController) { + if (controller == state.sureController) { state.surePwd.value = controller.text; } - if(controller == state.codeController) { + if (controller == state.codeController) { state.verificationCode.value = controller.text; } _resetCanSub(); } - void _resetCanSub(){ - state.canSub.value = state.pwdIsOK && state.codeIsOK && (state.isIphoneType.value ? state.isIphone : state.isEmail); + void _resetCanSub() { + state.canSub.value = state.pwdIsOK && + state.codeIsOK && + (state.isIphoneType.value ? state.isIphone : state.isEmail); print("22222:${state.canSub.value}"); } - -} \ No newline at end of file +} diff --git a/star_lock/lib/login/register/starLock_register_state.dart b/star_lock/lib/login/register/starLock_register_state.dart index 2fa5f1ec..50e61ca1 100644 --- a/star_lock/lib/login/register/starLock_register_state.dart +++ b/star_lock/lib/login/register/starLock_register_state.dart @@ -1,25 +1,23 @@ - import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../translations/trans_lib.dart'; -class StarLockRegisterState{ - +class StarLockRegisterState { final TextEditingController phoneOrEmailController = TextEditingController(); final TextEditingController pwdController = TextEditingController(); final TextEditingController sureController = TextEditingController(); final TextEditingController codeController = TextEditingController(); - var countryCode = ''.obs; - var countryId = ''.obs; + var countryCode = '+86'.obs; + var countryId = '9'.obs; var phoneOrEmailStr = ''.obs; var phoneOrEmailStrIsOK = false.obs; var pwd = ''.obs; var surePwd = ''.obs; var verificationCode = ''.obs; - var xWidth = ''.obs;// 滑动验证码滑动位置 + var xWidth = ''.obs; // 滑动验证码滑动位置 var isIphoneType = true.obs; var canSub = false.obs; @@ -33,13 +31,15 @@ class StarLockRegisterState{ var totalSeconds = 120; var currentSecond = 120; - StarLockRegisterState(){ + StarLockRegisterState() { resetResend(); } void resetResend() { canResend.value = totalSeconds == currentSecond; - btnText.value = !canResend.value ? '$currentSecond s' : btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr; + btnText.value = !canResend.value + ? '$currentSecond s' + : btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr; } void onClose() { @@ -48,4 +48,4 @@ class StarLockRegisterState{ sureController.dispose(); codeController.dispose(); } -} \ No newline at end of file +} diff --git a/star_lock/lib/login/seletCountryRegion/common/countries_model.dart b/star_lock/lib/login/seletCountryRegion/common/countries_model.dart new file mode 100644 index 00000000..f1e49d4c --- /dev/null +++ b/star_lock/lib/login/seletCountryRegion/common/countries_model.dart @@ -0,0 +1,54 @@ +import 'package:azlistview/azlistview.dart'; + +import 'index.dart'; + +class CountriesModel extends ISuspensionBean { + String? short; + late String name; + String? en; + late String tel; + String? pinyin; + String? tagIndex; + + CountriesModel( + {this.short, + required this.name, + this.en, + required this.tel, + this.pinyin, + this.tagIndex}); + + CountriesModel.fromJson(Map json) { + if (json["short"] is String) { + short = json["short"]; + } + if (json["name"] is String) { + name = json["name"]; + } + if (json["en"] is String) { + en = json["en"]; + } + if (json["tel"] is String) { + tel = json["tel"]; + } + if (json["pinyin"] is String) { + pinyin = json["pinyin"]; + } + } + + Map toJson() { + final Map data = {}; + data["short"] = short; + data["name"] = name; + data["en"] = en; + data["tel"] = tel; + data["pinyin"] = pinyin; + return data; + } + + @override + String getSuspensionTag() => tagIndex!; + + @override + String toString() => json.encode(this); +} diff --git a/star_lock/lib/login/seletCountryRegion/common/index.dart b/star_lock/lib/login/seletCountryRegion/common/index.dart new file mode 100644 index 00000000..abbcb9c4 --- /dev/null +++ b/star_lock/lib/login/seletCountryRegion/common/index.dart @@ -0,0 +1,8 @@ +export 'utils.dart'; +export 'res.dart'; + +export 'dart:convert'; + +export 'package:common_utils/common_utils.dart'; + +export 'package:lpinyin/lpinyin.dart'; diff --git a/star_lock/lib/login/seletCountryRegion/common/models.dart b/star_lock/lib/login/seletCountryRegion/common/models.dart new file mode 100644 index 00000000..e0324ca4 --- /dev/null +++ b/star_lock/lib/login/seletCountryRegion/common/models.dart @@ -0,0 +1,108 @@ +import 'dart:convert'; + +import 'package:azlistview/azlistview.dart'; +import 'package:flutter/material.dart'; + +class CityModel extends ISuspensionBean { + String name; + String? tagIndex; + String? namePinyin; + + CityModel({ + required this.name, + this.tagIndex, + this.namePinyin, + }); + + CityModel.fromJson(Map json) : name = json['name']; + + Map toJson() => { + 'name': name, +// 'tagIndex': tagIndex, +// 'namePinyin': namePinyin, +// 'isShowSuspension': isShowSuspension + }; + + @override + String getSuspensionTag() => tagIndex!; + + @override + String toString() => json.encode(this); +} + +class ContactInfo extends ISuspensionBean { + String name; + String? tagIndex; + String? namePinyin; + + Color? bgColor; + IconData? iconData; + + String? img; + String? id; + String? firstletter; + + ContactInfo({ + required this.name, + this.tagIndex, + this.namePinyin, + this.bgColor, + this.iconData, + this.img, + this.id, + this.firstletter, + }); + + ContactInfo.fromJson(Map json) + : name = json['name'], + img = json['img'], + id = json['id']?.toString(), + firstletter = json['firstletter']; + + Map toJson() => { +// 'id': id, + 'name': name, + 'img': img, +// 'firstletter': firstletter, +// 'tagIndex': tagIndex, +// 'namePinyin': namePinyin, +// 'isShowSuspension': isShowSuspension + }; + + @override + String getSuspensionTag() => tagIndex!; + + @override + String toString() => json.encode(this); +} + +// class Languages extends GithubLanguage with ISuspensionBean { +// String? tagIndex; +// String? pinyin; +// String? shortPinyin; + +// Languages.fromJson(Map json) : super.fromJson(json); + +// @override +// Map toJson() { +// final Map map = super.toJson(); +// void addIfNonNull(String fieldName, dynamic value) { +// if (value != null) { +// map[fieldName] = value; +// } +// } + +// // addIfNonNull('tagIndex', tagIndex); +// return map; +// } + +// @override +// String getSuspensionTag() { +// return tagIndex!; +// } + +// @override +// String toString() { +// return json.encode(this); +// } +// } diff --git a/star_lock/lib/login/seletCountryRegion/common/utils.dart b/star_lock/lib/login/seletCountryRegion/common/utils.dart new file mode 100644 index 00000000..4c12483d --- /dev/null +++ b/star_lock/lib/login/seletCountryRegion/common/utils.dart @@ -0,0 +1,170 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/login/seletCountryRegion/common/countries_model.dart'; +import 'package:star_lock/login/seletCountryRegion/common/models.dart'; + +import 'index.dart'; + +class Utils { + static String getImgPath(String name, {String format: 'png'}) { + return 'assets/images/$name.$format'; + } + + static void showSnackBar(BuildContext context, String msg) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(msg), + duration: Duration(seconds: 2), + ), + ); + } + + static Widget getSusItem(BuildContext context, String tag, + {double susHeight = 40}) { + if (tag == '★') { + tag = '★ 热门城市'; + } + return Container( + height: susHeight, + width: MediaQuery.of(context).size.width, + padding: const EdgeInsets.only(left: 16.0), + color: const Color(0xFFF3F4F5), + alignment: Alignment.centerLeft, + child: Text( + tag, + softWrap: false, + style: const TextStyle( + fontSize: 14.0, + color: Color(0xFF666666), + ), + ), + ); + } + + static Widget getListItem(BuildContext context, CountriesModel model, + {double susHeight = 40}) { + return GestureDetector( + child: SizedBox( + height: 80.h, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: 20.w, + ), + Text( + model.name, + style: TextStyle( + color: AppColors.darkGrayTextColor, fontSize: 24.sp), + ), + Expanded( + child: SizedBox( + width: 30.w, + )), + Text( + '+${model.tel}', + style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), + ), + SizedBox( + width: 60.w, + ) + ], + ), + // Divider( + // height: 1, + // color: AppColors.greyLineColor, + // endIndent: 0, + // indent: 20.w, + // ) + ), + onTap: () { + LogUtil.e("onItemClick : $model"); + Utils.showSnackBar(context, 'onItemClick : ${model.name}'); + }, + ); + + // return ListTile( + // title: Text('${model.name} +${model.tel}'), + // onTap: () { + // LogUtil.e("onItemClick : $model"); + // Utils.showSnackBar(context, 'onItemClick : ${model.name}'); + // }, + // ); +// return Column( +// mainAxisSize: MainAxisSize.min, +// children: [ +// Offstage( +// offstage: !(model.isShowSuspension == true), +// child: getSusItem(context, model.getSuspensionTag(), +// susHeight: susHeight), +// ), +// ListTile( +// title: Text(model.name), +// onTap: () { +// LogUtil.e("onItemClick : $model"); +// Utils.showSnackBar(context, 'onItemClick : ${model.name}'); +// }, +// ) +// ], +// ); + } + + static Widget getWeChatListItem( + BuildContext context, + ContactInfo model, { + double susHeight = 40, + Color? defHeaderBgColor, + }) { + return getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor); +// return Column( +// mainAxisSize: MainAxisSize.min, +// children: [ +// Offstage( +// offstage: !(model.isShowSuspension == true), +// child: getSusItem(context, model.getSuspensionTag(), +// susHeight: susHeight), +// ), +// getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor), +// ], +// ); + } + + static Widget getWeChatItem( + BuildContext context, + ContactInfo model, { + Color? defHeaderBgColor, + }) { + DecorationImage? image; +// if (model.img != null && model.img.isNotEmpty) { +// image = DecorationImage( +// image: CachedNetworkImageProvider(model.img), +// fit: BoxFit.contain, +// ); +// } + return ListTile( + leading: Container( + width: 36, + height: 36, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4.0), + color: model.bgColor ?? defHeaderBgColor, + image: image, + ), + child: model.iconData == null + ? null + : Icon( + model.iconData, + color: Colors.white, + size: 20, + ), + ), + title: Text(model.name), + onTap: () { + LogUtil.e("onItemClick : $model"); + Utils.showSnackBar(context, 'onItemClick : ${model.name}'); + }, + ); + } +} diff --git a/star_lock/lib/login/seletCountryRegion/seletCountryRegion_page.dart b/star_lock/lib/login/seletCountryRegion/seletCountryRegion_page.dart index b4e811a5..1d8d5de7 100644 --- a/star_lock/lib/login/seletCountryRegion/seletCountryRegion_page.dart +++ b/star_lock/lib/login/seletCountryRegion/seletCountryRegion_page.dart @@ -1,10 +1,13 @@ +import 'package:azlistview/azlistview.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import '../../app_settings/app_colors.dart'; import '../../tools/titleAppBar.dart'; import '../../translations/trans_lib.dart'; +import 'common/countries_model.dart'; +import 'common/index.dart'; class SeletCountryRegionPage extends StatefulWidget { const SeletCountryRegionPage({Key? key}) : super(key: key); @@ -14,14 +17,67 @@ class SeletCountryRegionPage extends StatefulWidget { } class _SeletCountryRegionPageState extends State { + List countriesList = []; + + @override + void initState() { + super.initState(); + + SuspensionUtil.setShowSuspensionStatus( + countriesList.cast()); + Future.delayed(const Duration(milliseconds: 500), () { + loadData(); + }); + } + + Future loadJsonFromAssets(String assetsPath) async { + return await rootBundle.loadString(assetsPath); + } + + void loadData() async { + //加载国家列表 + String jsonData = await loadJsonFromAssets('assets/countries.json'); + countriesList.clear(); + List list = json.decode(jsonData); + for (var v in list) { + countriesList.add(CountriesModel.fromJson(v)); + } + + _handleList(countriesList); + } + + void _handleList(List list) { + if (list.isEmpty) return; + for (int i = 0, length = list.length; i < length; i++) { + CountriesModel countryModel = list[i]; + // String pinyin = PinyinHelper.getPinyinE(list[i].name); + String tag = countryModel.pinyin!.substring(0, 1).toUpperCase(); + // list[i].pinyin = pinyin; + if (RegExp('[A-Z]').hasMatch(tag)) { + list[i].tagIndex = tag; + } else { + list[i].tagIndex = '#'; + } + } + // A-Z sort. + SuspensionUtil.sortListBySuspensionTag(list); + // show sus tag. + SuspensionUtil.setShowSuspensionStatus(countriesList); + + setState(() {}); + } @override Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: const Color(0xFFFFFFFF), - appBar: TitleAppBar(barTitle: "${TranslationLoader.lanKeys!.selet!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", haveBack:true, backgroundColor: AppColors.mainColor, actionsList: [ + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFFFFFFF), + appBar: TitleAppBar( + barTitle: + "${TranslationLoader.lanKeys!.selet!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", + haveBack: true, + backgroundColor: AppColors.mainColor, + actionsList: [ TextButton( child: Text( TranslationLoader.lanKeys!.reset!.tr, @@ -31,18 +87,23 @@ class _SeletCountryRegionPageState extends State { Navigator.pop(context, {'code': "+86", "countryId": "9"}); }, ), - ],), - body:ListView( - padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), - children: [ - - ], - ) + ], + ), + body: AzListView( + data: countriesList, + itemCount: countriesList.length, + itemBuilder: (BuildContext context, int index) { + CountriesModel model = countriesList[index]; + return Utils.getListItem(context, model); + }, + padding: EdgeInsets.zero, + susItemBuilder: (BuildContext context, int index) { + CountriesModel model = countriesList[index]; + String tag = model.getSuspensionTag(); + return Utils.getSusItem(context, tag); + }, + indexBarData: ['★', ...kIndexBarData], + ), ); } - - _backBtnAction(){ - - } - } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart index db3602ee..6a0a09d1 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_page.dart @@ -124,8 +124,8 @@ class _CheckingInDetailPageState extends State { child: Container( // margin: EdgeInsets.only(left: 20.w), child: Image( - width: 40.w, - height: 40.w, + width: 30.w, + height: 30.w, image: const AssetImage("images/icon_left_black.png"), ), ), @@ -135,7 +135,7 @@ class _CheckingInDetailPageState extends State { ), Text("$_year-$_month", style: TextStyle( - fontSize: 34.sp, + fontSize: 28.sp, color: Colors.black, fontWeight: FontWeight.w500)), SizedBox( @@ -148,8 +148,8 @@ class _CheckingInDetailPageState extends State { child: Container( // margin: EdgeInsets.only(right: 20.sp), child: Image( - width: 40.w, - height: 40.h, + width: 30.w, + height: 30.w, image: const AssetImage("images/icon_right_black.png"), ), ), @@ -195,7 +195,7 @@ class _CheckingInDetailPageState extends State { color: index == 5 || index == 6 ? const Color(0xFFC4C8D0) : const Color(0xFF3C3E43), - fontSize: 30.sp), + fontSize: 26.sp), )); }, ), @@ -267,13 +267,13 @@ class _CheckingInDetailPageState extends State { //设置选中字体颜色,以及周末和工作日颜色 style: _datas[index].isSelect! ? TextStyle( - fontSize: 32.sp, color: const Color(0xFFFFFFFF)) + fontSize: 24.sp, color: const Color(0xFFFFFFFF)) : (index % 7 == 5 || index % 7 == 6 ? TextStyle( - fontSize: 32.sp, + fontSize: 24.sp, color: const Color(0xFFC4C8D0)) : TextStyle( - fontSize: 32.sp, + fontSize: 24.sp, color: const Color(0xFF3C3E43))), ), ), @@ -316,7 +316,7 @@ class _CheckingInDetailPageState extends State { "月统计", style: TextStyle( color: Colors.white, - fontSize: 32.sp, + fontSize: 26.sp, fontWeight: FontWeight.w500), ), ), @@ -344,22 +344,22 @@ class _CheckingInDetailPageState extends State { children: [ SizedBox(width: 20.w), Container( - width: 35.w, - height: 35.w, + width: 30.w, + height: 30.w, decoration: BoxDecoration( color: color, - borderRadius: BorderRadius.all(Radius.circular(35.h))), + borderRadius: BorderRadius.all(Radius.circular(30.h))), ), SizedBox(width: 20.w), Expanded( child: Text(leftTitel, style: TextStyle( - fontSize: 28.sp, fontWeight: FontWeight.w500))), + fontSize: 24.sp, fontWeight: FontWeight.w500))), SizedBox(width: 20.w), Text(rightTitle, textAlign: TextAlign.end, style: - TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500)), + TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500)), SizedBox(width: 10.w), ], ), diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index 581b8e44..ea183b7e 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -121,11 +121,17 @@ class _LockSetPageState extends State { CommonItem( leftTitel: TranslationLoader.lanKeys!.unlockQRCode!.tr, rightTitle: "", - isHaveLine: false, + isHaveLine: true, isHaveDirection: true, action: () { Navigator.pushNamed(context, Routers.unlockQRCodePage); }), + CommonItem( + leftTitel: 'WiFi配网', + rightTitle: "", + isHaveLine: false, + isHaveDirection: true, + action: () {}), SizedBox( height: 10.h, ), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 0347d9cc..b04a1aac 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -149,6 +149,15 @@ class _LockDetailPageState extends State { Navigator.pushNamed(context, Routers.otherTypeKeyListPage, arguments: 2); }), + //可视对讲门锁新增->人脸、监控 + bottomItem('images/main/icon_main_fingerprint.png', '人脸', () { + // Navigator.pushNamed(context, Routers.otherTypeKeyListPage, + // arguments: 1); + }), + bottomItem('images/main/icon_main_fingerprint.png', '监控', () { + // Navigator.pushNamed(context, Routers.otherTypeKeyListPage, + // arguments: 1); + }), bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { Navigator.pushNamed(context, Routers.authorizedAdminListPage); diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart index e4a23b14..833aa55f 100644 --- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart @@ -83,7 +83,13 @@ class _OtherTypeKeyDetailPageState extends State { action: () { Navigator.pushNamed(context, Routers.keyOperationRecordPage); }), - Container(height: 40.h), + SizedBox( + height: 40.h, + ), + addControlsBtn(type), + SizedBox( + height: 30.h, + ), SubmitBtn( btnName: TranslationLoader.lanKeys!.delete!.tr, isDelete: true, @@ -97,6 +103,96 @@ class _OtherTypeKeyDetailPageState extends State { ); } + Widget addControlsBtn(int type) { + List widgetList = []; + List> routerList = []; + //卡详情 + if (type == 0) { + routerList.add({ + 'btnTitle': '设置密码', + 'routerName': Routers.passwordKeyDetailPage, + 'type': 9 + }); + routerList.add({ + 'btnTitle': '设置指纹', + 'routerName': Routers.otherTypeKeyManagePage, + 'type': 1 + }); + routerList.add({ + 'btnTitle': '设置遥控', + 'routerName': Routers.otherTypeKeyManagePage, + 'type': 2 + }); + } else if (type == 1) { + //指纹详情 + routerList.add({ + 'btnTitle': '设置密码', + 'routerName': Routers.passwordKeyDetailPage, + 'type': 9 + }); + routerList.add({ + 'btnTitle': '设置卡', + 'routerName': Routers.otherTypeKeyManagePage, + 'type': 0 + }); + routerList.add({ + 'btnTitle': '设置遥控', + 'routerName': Routers.otherTypeKeyManagePage, + 'type': 2 + }); + } else if (type == 2) { + //遥控详情 + routerList.add({ + 'btnTitle': '设置密码', + 'routerName': Routers.passwordKeyDetailPage, + 'type': 9 + }); + routerList.add({ + 'btnTitle': '设置卡', + 'routerName': Routers.otherTypeKeyManagePage, + 'type': 0 + }); + routerList.add({ + 'btnTitle': '设置指纹', + 'routerName': Routers.otherTypeKeyManagePage, + 'type': 1 + }); + } + + for (int i = 0; i < routerList.length; i++) { + widgetList.add(SizedBox( + width: ScreenUtil().screenWidth - 40.w, + height: 60.h, + child: OutlinedButton( + style: OutlinedButton.styleFrom( + // backgroundColor: Colors.white, + side: BorderSide(width: 1, color: AppColors.mainColor)), + onPressed: () { + if (routerList[i]['type'] == 9) { + Navigator.pushNamed(context, Routers.passwordKeyManagePage); + } else { + Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, + arguments: routerList[i]['type']); + } + }, + child: Text( + routerList[i]['btnTitle'], + style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), + )), + )); + + widgetList.add( + SizedBox( + height: 10.h, + ), + ); + } + + return Column( + children: widgetList, + ); + } + String getAppBarTitle(int type) { String title = ""; switch (type) { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 5e267bf9..9c9009e9 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/shareModule/sharePopup.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; @@ -90,6 +91,63 @@ class _PasswordKeyDetailPageState extends State { Navigator.pushNamed(context, Routers.keyOperationRecordPage); }), Container(height: 40.h), + SizedBox( + width: ScreenUtil().screenWidth - 40.w, + height: 60.h, + child: OutlinedButton( + style: OutlinedButton.styleFrom( + // backgroundColor: Colors.white, + side: BorderSide(width: 1, color: AppColors.mainColor)), + onPressed: () { + Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, + arguments: 0); + }, + child: Text( + '设置卡', + style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), + )), + ), + SizedBox( + height: 10.h, + ), + SizedBox( + width: ScreenUtil().screenWidth - 40.w, + height: 60.h, + child: OutlinedButton( + style: OutlinedButton.styleFrom( + // backgroundColor: Colors.white, + side: BorderSide(width: 1, color: AppColors.mainColor)), + onPressed: () { + Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, + arguments: 1); + }, + child: Text( + '设置指纹', + style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), + )), + ), + SizedBox( + height: 10.h, + ), + SizedBox( + width: ScreenUtil().screenWidth - 40.w, + height: 60.h, + child: OutlinedButton( + style: OutlinedButton.styleFrom( + // backgroundColor: Colors.white, + side: BorderSide(width: 1, color: AppColors.mainColor)), + onPressed: () { + Navigator.pushNamed(context, Routers.otherTypeKeyManagePage, + arguments: 2); + }, + child: Text( + '设置遥控', + style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp), + )), + ), + SizedBox( + height: 30.h, + ), SubmitBtn( btnName: TranslationLoader.lanKeys!.delete!.tr, isDelete: true, diff --git a/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart b/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart index 4f430649..1edaa1d1 100644 --- a/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart +++ b/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart @@ -22,7 +22,7 @@ class _SeletLockTypePageState extends State with BaseWidget { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.addLock!.tr, + barTitle: TranslationLoader.lanKeys!.selectLockType!.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( @@ -41,6 +41,10 @@ class _SeletLockTypePageState extends State with BaseWidget { TranslationLoader.lanKeys!.doorLock!.tr, () { Navigator.pushNamed(context, Routers.addLockPage); }), + lockTypeItem('images/lockType/lockType_doorLock.png', + TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () { + Navigator.pushNamed(context, Routers.addLockPage); + }), lockTypeItem('images/lockType/lockType_padlock.png', TranslationLoader.lanKeys!.padlock!.tr, () { Navigator.pushNamed(context, Routers.addLockPage); diff --git a/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart b/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart index 7e82d7f3..62403282 100644 --- a/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart +++ b/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/tools/ExpandedListView.dart'; import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/translations/trans_lib.dart'; @@ -97,20 +98,14 @@ class _AuthorityManagementPageState extends State child: ListView.separated( itemBuilder: (context, index) { if (index == 0) { - return _buildNameWidget( - context, index, 'images/icon_password.png', '密码1'); + return _buildNameExpandedList(context, index, "张三"); } else if (index == 1) { - return _buildNameWidget( - context, index, 'images/icon_card.png', '卡1'); + return _buildNameExpandedList(context, index, "李四"); } else if (index == 2) { - return _buildNameWidget( - context, index, 'images/icon_fingerprint.png', '指纹1'); - } else if (index == 3) { - return _buildNameWidget( - context, index, 'images/icon_card.png', '遥控1'); + return _buildNameExpandedList(context, index, "王二"); + } else { + return _buildNameExpandedList(context, index, "麻子"); } - return null; - // return _buildNameWidget(context, index); }, separatorBuilder: (context, index) { return const Divider( @@ -141,17 +136,13 @@ class _AuthorityManagementPageState extends State child: ListView.separated( itemBuilder: (context, index) { if (index == 0) { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "大门锁"); + return _buildDeviceExpandedList(context, index, "大门锁"); } else if (index == 1) { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "办公室锁"); + return _buildDeviceExpandedList(context, index, "办公室锁"); } else if (index == 2) { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "会议室锁"); + return _buildDeviceExpandedList(context, index, "会议室锁"); } else { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "宴会厅锁"); + return _buildDeviceExpandedList(context, index, "宴会厅锁"); } }, separatorBuilder: (context, index) { @@ -172,10 +163,85 @@ class _AuthorityManagementPageState extends State ); } + //设备多层级列表 + Widget _buildDeviceExpandedList(context, index, deviceName) { + return ExpandedListTile( + onTap: () => print("onTap."), + title: deviceName, + imgName: 'images/icon_lock.png', + typeImgList: const [], + child: ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: 10, + itemBuilder: (_, index) { + if (index == 0) { + return _buildNameWidget( + context, index, 'images/icon_password.png', '张三'); + } else if (index == 1) { + return _buildNameWidget( + context, index, 'images/icon_card.png', '李四'); + } else if (index == 2) { + return _buildNameWidget( + context, index, 'images/icon_fingerprint.png', '王二'); + } else if (index == 3) { + return _buildNameWidget( + context, index, 'images/icon_card.png', '麻子'); + } else { + return null; + } + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ), + ); + } + + //姓名多层级列表 + Widget _buildNameExpandedList(context, index, deviceName) { + return ExpandedListTile( + onTap: () => print("onTap."), + title: deviceName, + imgName: 'images/controls_user.png', + typeImgList: const ['images/icon_password.png', 'images/icon_card.png'], + child: ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: 5, + itemBuilder: (_, index) { + if (index == 0) { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "大门锁"); + } else if (index == 1) { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "办公室锁"); + } else if (index == 2) { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "会议室锁"); + } else { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "宴会厅锁"); + } + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ), + ); + } + +//单个姓名行 Widget _buildNameWidget(context, index, imageName, getName) { return GestureDetector( child: Container( - height: 90.h, + height: 60.h, color: Colors.white, width: ScreenUtil().screenWidth, child: Row( @@ -184,7 +250,7 @@ class _AuthorityManagementPageState extends State width: 30.w, ), Image.asset( - imageName, + 'images/controls_user.png', width: 36.w, height: 36.w, ), @@ -193,18 +259,8 @@ class _AuthorityManagementPageState extends State ), Text( getName, - style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor), - ), - Expanded( - child: SizedBox( - width: 20.w, - )), - Image.asset( - isNameSelect == false - ? 'images/icon_round_unSelet.png' - : 'images/icon_round_selet.png', - width: 30.sp, - height: 30.sp, + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), ), SizedBox( width: 30.w, @@ -223,10 +279,11 @@ class _AuthorityManagementPageState extends State ); } +//单个设备行 Widget _buildDeviceWidget(context, index, imageName, deviceName) { return GestureDetector( child: Container( - height: 90.h, + height: 60.h, color: Colors.white, width: ScreenUtil().screenWidth, child: Row( @@ -244,18 +301,8 @@ class _AuthorityManagementPageState extends State ), Text( deviceName, - style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor), - ), - Expanded( - child: SizedBox( - width: 20.w, - )), - Image.asset( - isDeviceSelect == false - ? 'images/icon_round_unSelet.png' - : 'images/icon_round_selet.png', - width: 30.sp, - height: 30.sp, + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), ), SizedBox( width: 30.w, diff --git a/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart b/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart index 2761e59e..8dd83f30 100644 --- a/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart +++ b/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart @@ -54,16 +54,16 @@ class _GetNameListPageState extends State { itemBuilder: (context, index) { if (index == 0) { return _buildNameWidget( - context, index, 'images/icon_password.png', '密码1'); + context, index, 'images/controls_user.png', '张三'); } else if (index == 1) { return _buildNameWidget( - context, index, 'images/icon_card.png', '卡1'); + context, index, 'images/controls_user.png', '李四'); } else if (index == 2) { return _buildNameWidget( - context, index, 'images/icon_fingerprint.png', '指纹1'); + context, index, 'images/controls_user.png', '王二'); } else if (index == 3) { return _buildNameWidget( - context, index, 'images/icon_card.png', '遥控1'); + context, index, 'images/controls_user.png', '麻子'); } return null; }, diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 8d6551ef..2b3594b0 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -1,8 +1,6 @@ - abstract class Api { - // final String baseUrl = "http://test.lock.star-lock.cn/api"; // 葛工 - final String baseUrl = "https://lock.star-lock.cn/api";// 测试环境 + final String baseUrl = "https://lock.star-lock.cn/api"; // 测试环境 // 登录注册 final String getVerificationCodeUrl = '/user/sendValidationCode'; @@ -10,5 +8,5 @@ abstract class Api { final String getSliderVerifyImgUrl = '/user/getSliderVerifyImg'; final String checkImgUrl = '/user/isSliderValid'; final String loginUrl = '/user/login'; - + final String resetPasswordURL = '/user/resetPassword'; //重置密码 } diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 904179bb..c4db6f8e 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -1,70 +1,96 @@ +import 'dart:convert'; import 'package:get/get.dart'; import 'api_provider_base.dart'; class ApiProvider extends BaseProvider { + Future getVerificationCode(String countryCode, String account, + String channel, String codeType, String uniqueid, String xWidth) => + post( + getVerificationCodeUrl.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + "channel": channel, + 'codeType': codeType, + "uniqueid": uniqueid, + 'xWidth': xWidth, + })); - Future getVerificationCode( - String countryCode, - String account, - String channel, - String uniqueid, - String xWidth) => post(getVerificationCodeUrl.toUrl, null, query: { - 'countryCode':countryCode, - 'account':account, - "channel":channel, - 'codeType':"1", - "uniqueid":uniqueid, - 'xWidth':xWidth, - }); + Future register(String countryCode, String countryId, String mobile, + String password, String uniqueid, String verificationCode) => + post(registerUrl.toUrl, null, query: { + 'countryCode': countryCode, + 'countryId': countryId, + "mobile": mobile, + 'password': password, + 'platId': "2", + "uniqueid": uniqueid, + 'verificationCode': verificationCode, + }); - Future register( - String countryCode, - String countryId, - String mobile, - String password, - String uniqueid, - String verificationCode) => post(registerUrl.toUrl, null,query: { - 'countryCode':countryCode, - 'countryId':countryId, - "mobile":mobile, - 'password':password, - 'platId':"2", - "uniqueid":uniqueid, - 'verificationCode':verificationCode, - }); + // post( + // registerUrl.toUrl, + // jsonEncode({ + // 'countryCode': countryCode, + // 'countryId': countryId, + // "mobile": mobile, + // 'password': password, + // 'platId': "2", + // "uniqueid": uniqueid, + // 'verificationCode': verificationCode, + // })); - Future getSliderVerifyImg( - String countryCode, - String account) => post(getSliderVerifyImgUrl.toUrl, null,query: { - 'countryCode':countryCode, - 'account':account, - }); + Future getSliderVerifyImg(String countryCode, String account) => + post( + getSliderVerifyImgUrl.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + })); Future checkSliderVerifyImg( - String countryCode, - String account, - String xWidth) => post(checkImgUrl.toUrl, null,query: { - 'countryCode':countryCode, - 'account':account, - 'xWidth':xWidth, - }); + String countryCode, String account, String xWidth) => + post( + checkImgUrl.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + 'xWidth': xWidth, + })); - Future login( - String loginType, - String password, - String countryCode, - String username) => post(loginUrl.toUrl, null,query: { - 'loginType':loginType, - 'password':password, - "platId":"2", - 'uniqueid':"477E6814-289D-402A-9F49-F89A8BD05D63", - 'countryCode':countryCode, - "username":username - }); + Future login(String loginType, String password, String countryCode, + String username) => + post( + loginUrl.toUrl, + jsonEncode({ + 'loginType': loginType, + 'password': password, + "platId": "2", + 'uniqueid': "477E6814-289D-402A-9F49-F89A8BD05D63", + 'countryCode': countryCode, + "username": username + })); + Future resetPassword( + String countryCode, + String account, + String date, + String newPassword, + String uniqueid, + String verificationCode) => + post( + resetPasswordURL.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + "date": date, + 'newPassword': newPassword, + "uniqueid": uniqueid, + 'verificationCode': verificationCode, + })); } extension ExtensionString on String { String get toUrl => '$this'; -} \ No newline at end of file +} diff --git a/star_lock/lib/network/api_provider_base.dart b/star_lock/lib/network/api_provider_base.dart index ce943575..0b052980 100644 --- a/star_lock/lib/network/api_provider_base.dart +++ b/star_lock/lib/network/api_provider_base.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; @@ -20,11 +21,23 @@ class BaseProvider extends GetConnect with Api { } @override - Future> post(String? url, body, {String? contentType, Map? headers, Map? query, Decoder? decoder, Progress? uploadProgress}) async { + Future> post(String? url, body, + {String? contentType, + Map? headers, + Map? query, + Decoder? decoder, + Progress? uploadProgress}) async { // print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}"); - var res = await super.post(url, body, contentType: contentType, headers:headers, query: query, decoder:decoder, uploadProgress: uploadProgress); - if(res.body == null){ - if(EasyLoading.isShow)EasyLoading.dismiss(animation: true); + + print('哈喽请求body体为:${body}'); + var res = await super.post(url, body, + contentType: contentType, + headers: headers, + query: query, + decoder: decoder, + uploadProgress: uploadProgress); + if (res.body == null) { + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); var rs = { "errorMsg": "Network Error!", "errorCode": -1, @@ -42,5 +55,4 @@ class BaseProvider extends GetConnect with Api { } return res; } - -} \ No newline at end of file +} diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index a776c5b2..fd9467cd 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -1,5 +1,3 @@ - - import 'package:get/get.dart'; import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/SafetyVerificationEntity.dart'; @@ -13,15 +11,16 @@ class ApiRepository { static ApiRepository get to => Get.find(); ApiRepository(this.apiProvider); - // 发送验证码 + // 发送验证码 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号 Future sendValidationCode( String countryCode, String account, String channel, + String codeType, String uniqueid, - String xWidth - ) async { - final res = await apiProvider.getVerificationCode(countryCode, account, channel, uniqueid, xWidth); + String xWidth) async { + final res = await apiProvider.getVerificationCode( + countryCode, account, channel, codeType, uniqueid, xWidth); return SendValidationCodeEntity.fromJson(res.body); } @@ -32,38 +31,44 @@ class ApiRepository { String mobile, String password, String uniqueid, - String verificationCode - ) async { - final res = await apiProvider.register(countryCode, countryId, mobile, password, uniqueid, verificationCode); + String verificationCode) async { + final res = await apiProvider.register( + countryCode, countryId, mobile, password, uniqueid, verificationCode); return LoginEntity.fromJson(res.body); } // 获取图片验证码 Future getSliderVerifyImg( - String countryCode, - String account - ) async { + String countryCode, String account) async { final res = await apiProvider.getSliderVerifyImg(countryCode, account); return SafetyVerificationEntity.fromJson(res.body); } // 检验图片验证码 Future checkSliderVerifyImg( - String countryCode, - String account, - String xWidth) async { - final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth); + String countryCode, String account, String xWidth) async { + final res = + await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth); return CheckSafetyVerificationEntity.fromJson(res.body); } - Future login( - String loginType, - String password, - String countryCode, - String username) async { - final res = await apiProvider.login(loginType, password, countryCode, username); + Future login(String loginType, String password, + String countryCode, String username) async { + final res = + await apiProvider.login(loginType, password, countryCode, username); return LoginEntity.fromJson(res.body); } + //重置密码 + Future resetPassword( + String countryCode, + String account, + String date, + String newPassword, + String uniqueid, + String verificationCode) async { + final res = await apiProvider.resetPassword( + countryCode, account, date, newPassword, uniqueid, verificationCode); + return LoginEntity.fromJson(res.body); + } } - diff --git a/star_lock/lib/network/request_interceptor_log.dart b/star_lock/lib/network/request_interceptor_log.dart index 6c458de1..a3f40889 100644 --- a/star_lock/lib/network/request_interceptor_log.dart +++ b/star_lock/lib/network/request_interceptor_log.dart @@ -1,13 +1,12 @@ - - import 'dart:async'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; import 'package:get/get_connect/http/src/request/request.dart'; FutureOr requestLogInterceptor(Request request) async { - Get.log('GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} '); + Get.log( + 'GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} '); Get.log(request.headers.toString()); EasyLoading.show(); return request; -} \ No newline at end of file +} diff --git a/star_lock/lib/tools/ExpandedListView.dart b/star_lock/lib/tools/ExpandedListView.dart new file mode 100644 index 00000000..01434c83 --- /dev/null +++ b/star_lock/lib/tools/ExpandedListView.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; + +class ExpandedListTile extends StatefulWidget { + const ExpandedListTile( + {Key? key, + required this.title, + this.child, + this.onTap, + required this.typeImgList, + required this.imgName}) + : super(key: key); + + final String title; + final String imgName; + final Widget? child; + final List typeImgList; + final Function()? onTap; + + @override + _ExpandedListTileState createState() => _ExpandedListTileState(); +} + +class _ExpandedListTileState extends State { + bool _isExpanded = false; + final Duration _animationDuration = const Duration(milliseconds: 200); + bool _isCheck = false; + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + color: Colors.white, + height: 80.h, + child: Row( + children: _buildExpandRowList(), + ), + ), + ClipRect( + child: AnimatedAlign( + heightFactor: _isExpanded ? 1.0 : 0.0, + alignment: Alignment.center, + duration: _animationDuration, + child: widget.child), + ), + ], + ); + } + + List _buildExpandRowList() { + List widgetList = []; + widgetList.add(GestureDetector( + child: Container( + color: Colors.white, + width: 80.w, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + _isCheck + ? "images/icon_round_selet.png" + : "images/icon_round_unSelet.png", + width: 30.w, + height: 30.w, + ), + SizedBox( + width: 20.w, + ) + ], + ), + ), + onTap: () { + //点击左侧是否勾选按钮 + setState(() { + _isCheck = !_isCheck; + }); + }, + )); + widgetList.add(GestureDetector( + child: Container( + width: ScreenUtil().screenWidth - 80.w, + color: Colors.white, + child: Row( + children: [ + Image.asset( + widget.imgName, + width: 36.w, + height: 36.w, + ), + SizedBox( + width: 10.w, + ), + Text( + widget.title, + style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), + ), + Expanded( + child: SizedBox( + width: 10.w, + )), + AnimatedRotation( + turns: _isExpanded ? 0 : -0.5, + duration: _animationDuration, + child: const Icon(Icons.keyboard_arrow_down), + ), + SizedBox( + width: 30.w, + ) + ], + ), + ), + onTap: () { + //点击右侧上拉下拉按钮 + setState(() { + _isExpanded = !_isExpanded; + }); + widget.onTap?.call(); + }, + )); + return widgetList; + } +} diff --git a/star_lock/lib/tools/shareModule/sharePopup.dart b/star_lock/lib/tools/shareModule/sharePopup.dart new file mode 100644 index 00000000..d0f43b67 --- /dev/null +++ b/star_lock/lib/tools/shareModule/sharePopup.dart @@ -0,0 +1,105 @@ +import 'package:flutter/material.dart'; + +class SharePopup extends StatelessWidget { + List nameItems = [ + '微信', + '朋友圈', + 'QQ', + 'QQ空间', + '微博', + 'FaceBook', + '邮件', + '链接' + ]; + List urlItems = [ + 'icon_wechat.png', + 'icon_wechat_moments.png', + 'icon_qq.png', + 'icon_qzone.png', + 'icon_sina.png', + 'icon_facebook.png', + 'icon_email.png', + 'icon_copylink.png' + ]; + + SharePopup({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return _shareWidget(context); + // Scaffold( + // appBar: AppBar( + // title: const Text("分享页面"), + // ), + // body: _shareWidget(context) + /* + Center( + child: Builder(builder: (BuildContext context) { + return ElevatedButton( + onPressed: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return _shareWidget(context); + }); + }, + child: const Text("我要分享"), + // color: Colors.blue + ); + }), + ) + */ + // ); + } + + Widget _shareWidget(BuildContext context) { + return SizedBox( + height: 250.0, + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0), + child: SizedBox( + height: 190.0, + child: GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + mainAxisSpacing: 5.0, + childAspectRatio: 1.0), + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Padding( + padding: + const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 6.0), + child: Image.asset( + 'images/${urlItems[index]}', + width: 50.0, + height: 50.0, + fit: BoxFit.fill, + )), + Text(nameItems[index]) + ], + ); + }, + itemCount: nameItems.length, + ), + ), + ), + Container( + height: 0.5, + color: Colors.blueGrey, + ), + const Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0), + child: Text( + '取 消', + style: TextStyle(fontSize: 18.0, color: Colors.blueGrey), + )), + ) + ], + ), + ); + } +} diff --git a/star_lock/lib/tools/submitBtn.dart b/star_lock/lib/tools/submitBtn.dart index 2dd24868..b7715a93 100644 --- a/star_lock/lib/tools/submitBtn.dart +++ b/star_lock/lib/tools/submitBtn.dart @@ -54,7 +54,7 @@ class SubmitBtn extends StatelessWidget { child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: isDisabled == false - ? Colors.grey + ? AppColors.btnDisableColor : (isDelete == true ? Colors.red : AppColors.mainColor), ), onPressed: () { diff --git a/star_lock/lib/translations/lanKeyEntity.dart b/star_lock/lib/translations/lanKeyEntity.dart index 7713fa1f..c3973591 100644 --- a/star_lock/lib/translations/lanKeyEntity.dart +++ b/star_lock/lib/translations/lanKeyEntity.dart @@ -188,6 +188,9 @@ class LanKeyEntity { this.lanChinese, this.multilingual, this.addLock, + this.selectLockType, + this.videoIntercomDoorLock, + this.NFCPassiveLock, this.addDevice, this.gateway, this.message, @@ -570,6 +573,9 @@ class LanKeyEntity { lanChinese = json['lanChinese']; multilingual = json['multilingual']; addLock = json['addLock']; + selectLockType = json['selectLockType']; + videoIntercomDoorLock = json['videoIntercomDoorLock']; + NFCPassiveLock = json['NFCPassiveLock']; addDevice = json['addDevice']; gateway = json['gateway']; message = json['message']; @@ -969,6 +975,9 @@ class LanKeyEntity { String? lanChinese; String? multilingual; String? addLock; + String? selectLockType; + String? videoIntercomDoorLock; + String? NFCPassiveLock; String? addDevice; String? gateway; String? message; @@ -1365,6 +1374,9 @@ class LanKeyEntity { map['lanChinese'] = lanChinese; map['multilingual'] = multilingual; map['addLock'] = addLock; + map['selectLockType'] = selectLockType; + map['videoIntercomDoorLock'] = videoIntercomDoorLock; + map['NFCPassiveLock'] = NFCPassiveLock; map['addDevice'] = addDevice; map['gateway'] = gateway; map['message'] = message; diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 1dabd36c..96444c9f 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -80,6 +80,10 @@ dependencies: flutter_easyloading: ^3.0.5 #图形验证码 aj_captcha_flutter: ^0.0.1 + #国家选择 + azlistview: ^2.0.0 + common_utils: ^2.0.0 + lpinyin: ^2.0.3 dev_dependencies: flutter_test: @@ -111,6 +115,7 @@ flutter: - images/lan/ - images/mine/ - images/lockType/ + - assets/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware