balibabu
commited on
Commit
·
cd46bb2
1
Parent(s):
e34cb81
feat: submit new password to backend and submit user information and add Form to UserSettingProfile (#114)
Browse files* feat: add Form to UserSettingProfile
* feat: submit user information
* feat: submit new password to backend
- web/src/constants/setting.ts +421 -0
- web/src/hooks/userSettingHook.ts +13 -0
- web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx +9 -20
- web/src/pages/setting/model.ts +1 -2
- web/src/pages/user-setting/components/setting-title/index.tsx +19 -0
- web/src/pages/user-setting/hooks.ts +23 -0
- web/src/pages/user-setting/index.less +12 -0
- web/src/pages/user-setting/index.tsx +6 -2
- web/src/pages/user-setting/setting-password/index.less +3 -0
- web/src/pages/user-setting/setting-password/index.tsx +135 -1
- web/src/pages/user-setting/setting-profile/index.less +7 -0
- web/src/pages/user-setting/setting-profile/index.tsx +190 -1
- web/src/pages/user-setting/sidebar/index.less +3 -0
- web/src/pages/user-setting/sidebar/index.tsx +11 -6
- web/src/utils/fileUtil.ts +27 -0
web/src/constants/setting.ts
CHANGED
|
@@ -15,3 +15,424 @@ export const UserSettingRouteMap = {
|
|
| 15 |
[UserSettingRouteKey.Team]: 'Team',
|
| 16 |
[UserSettingRouteKey.Logout]: 'Log out',
|
| 17 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
[UserSettingRouteKey.Team]: 'Team',
|
| 16 |
[UserSettingRouteKey.Logout]: 'Log out',
|
| 17 |
};
|
| 18 |
+
|
| 19 |
+
export const TimezoneList = [
|
| 20 |
+
'UTC-11\tPacific/Midway',
|
| 21 |
+
'UTC-11\tPacific/Niue',
|
| 22 |
+
'UTC-11\tPacific/Pago_Pago',
|
| 23 |
+
'UTC-10\tAmerica/Adak',
|
| 24 |
+
'UTC-10\tPacific/Honolulu',
|
| 25 |
+
'UTC-10\tPacific/Rarotonga',
|
| 26 |
+
'UTC-10\tPacific/Tahiti',
|
| 27 |
+
'UTC-9:30\tPacific/Marquesas',
|
| 28 |
+
'UTC-9\tAmerica/Anchorage',
|
| 29 |
+
'UTC-9\tAmerica/Juneau',
|
| 30 |
+
'UTC-9\tAmerica/Metlakatla',
|
| 31 |
+
'UTC-9\tAmerica/Nome',
|
| 32 |
+
'UTC-9\tAmerica/Sitka',
|
| 33 |
+
'UTC-9\tAmerica/Yakutat',
|
| 34 |
+
'UTC-9\tPacific/Gambier',
|
| 35 |
+
'UTC-8\tAmerica/Los_Angeles',
|
| 36 |
+
'UTC-8\tAmerica/Tijuana',
|
| 37 |
+
'UTC-8\tAmerica/Vancouver',
|
| 38 |
+
'UTC-8\tPacific/Pitcairn',
|
| 39 |
+
'UTC-7\tAmerica/Boise',
|
| 40 |
+
'UTC-7\tAmerica/Cambridge_Bay',
|
| 41 |
+
'UTC-7\tAmerica/Ciudad_Juarez',
|
| 42 |
+
'UTC-7\tAmerica/Creston',
|
| 43 |
+
'UTC-7\tAmerica/Dawson',
|
| 44 |
+
'UTC-7\tAmerica/Dawson_Creek',
|
| 45 |
+
'UTC-7\tAmerica/Denver',
|
| 46 |
+
'UTC-7\tAmerica/Edmonton',
|
| 47 |
+
'UTC-7\tAmerica/Fort_Nelson',
|
| 48 |
+
'UTC-7\tAmerica/Hermosillo',
|
| 49 |
+
'UTC-7\tAmerica/Inuvik',
|
| 50 |
+
'UTC-7\tAmerica/Mazatlan',
|
| 51 |
+
'UTC-7\tAmerica/Phoenix',
|
| 52 |
+
'UTC-7\tAmerica/Whitehorse',
|
| 53 |
+
'UTC-7\tAmerica/Yellowknife',
|
| 54 |
+
'UTC-6\tAmerica/Bahia_Banderas',
|
| 55 |
+
'UTC-6\tAmerica/Belize',
|
| 56 |
+
'UTC-6\tAmerica/Chicago',
|
| 57 |
+
'UTC-6\tAmerica/Chihuahua',
|
| 58 |
+
'UTC-6\tAmerica/Costa_Rica',
|
| 59 |
+
'UTC-6\tAmerica/El_Salvador',
|
| 60 |
+
'UTC-6\tAmerica/Guatemala',
|
| 61 |
+
'UTC-6\tAmerica/Indiana/Knox',
|
| 62 |
+
'UTC-6\tAmerica/Indiana/Tell_City',
|
| 63 |
+
'UTC-6\tAmerica/Managua',
|
| 64 |
+
'UTC-6\tAmerica/Matamoros',
|
| 65 |
+
'UTC-6\tAmerica/Menominee',
|
| 66 |
+
'UTC-6\tAmerica/Merida',
|
| 67 |
+
'UTC-6\tAmerica/Mexico_City',
|
| 68 |
+
'UTC-6\tAmerica/Monterrey',
|
| 69 |
+
'UTC-6\tAmerica/North_Dakota/Beulah',
|
| 70 |
+
'UTC-6\tAmerica/North_Dakota/Center',
|
| 71 |
+
'UTC-6\tAmerica/North_Dakota/New_Salem',
|
| 72 |
+
'UTC-6\tAmerica/Ojinaga',
|
| 73 |
+
'UTC-6\tAmerica/Rankin_Inlet',
|
| 74 |
+
'UTC-6\tAmerica/Regina',
|
| 75 |
+
'UTC-6\tAmerica/Resolute',
|
| 76 |
+
'UTC-6\tAmerica/Swift_Current',
|
| 77 |
+
'UTC-6\tAmerica/Tegucigalpa',
|
| 78 |
+
'UTC-6\tAmerica/Winnipeg',
|
| 79 |
+
'UTC-6\tPacific/Easter',
|
| 80 |
+
'UTC-6\tPacific/Galapagos',
|
| 81 |
+
'UTC-5\tAmerica/Atikokan',
|
| 82 |
+
'UTC-5\tAmerica/Bogota',
|
| 83 |
+
'UTC-5\tAmerica/Cancun',
|
| 84 |
+
'UTC-5\tAmerica/Cayman',
|
| 85 |
+
'UTC-5\tAmerica/Detroit',
|
| 86 |
+
'UTC-5\tAmerica/Eirunepe',
|
| 87 |
+
'UTC-5\tAmerica/Grand_Turk',
|
| 88 |
+
'UTC-5\tAmerica/Guayaquil',
|
| 89 |
+
'UTC-5\tAmerica/Havana',
|
| 90 |
+
'UTC-5\tAmerica/Indiana/Indianapolis',
|
| 91 |
+
'UTC-5\tAmerica/Indiana/Marengo',
|
| 92 |
+
'UTC-5\tAmerica/Indiana/Petersburg',
|
| 93 |
+
'UTC-5\tAmerica/Indiana/Vevay',
|
| 94 |
+
'UTC-5\tAmerica/Indiana/Vincennes',
|
| 95 |
+
'UTC-5\tAmerica/Indiana/Winamac',
|
| 96 |
+
'UTC-5\tAmerica/Iqaluit',
|
| 97 |
+
'UTC-5\tAmerica/Jamaica',
|
| 98 |
+
'UTC-5\tAmerica/Kentucky/Louisville',
|
| 99 |
+
'UTC-5\tAmerica/Kentucky/Monticello',
|
| 100 |
+
'UTC-5\tAmerica/Lima',
|
| 101 |
+
'UTC-5\tAmerica/Nassau',
|
| 102 |
+
'UTC-5\tAmerica/New_York',
|
| 103 |
+
'UTC-5\tAmerica/Panama',
|
| 104 |
+
'UTC-5\tAmerica/Port-au-Prince',
|
| 105 |
+
'UTC-5\tAmerica/Rio_Branco',
|
| 106 |
+
'UTC-5\tAmerica/Toronto',
|
| 107 |
+
'UTC-4\tAmerica/Anguilla',
|
| 108 |
+
'UTC-4\tAmerica/Antigua',
|
| 109 |
+
'UTC-4\tAmerica/Aruba',
|
| 110 |
+
'UTC-4\tAmerica/Asuncion',
|
| 111 |
+
'UTC-4\tAmerica/Barbados',
|
| 112 |
+
'UTC-4\tAmerica/Blanc-Sablon',
|
| 113 |
+
'UTC-4\tAmerica/Boa_Vista',
|
| 114 |
+
'UTC-4\tAmerica/Campo_Grande',
|
| 115 |
+
'UTC-4\tAmerica/Caracas',
|
| 116 |
+
'UTC-4\tAmerica/Cuiaba',
|
| 117 |
+
'UTC-4\tAmerica/Curacao',
|
| 118 |
+
'UTC-4\tAmerica/Dominica',
|
| 119 |
+
'UTC-4\tAmerica/Glace_Bay',
|
| 120 |
+
'UTC-4\tAmerica/Goose_Bay',
|
| 121 |
+
'UTC-4\tAmerica/Grenada',
|
| 122 |
+
'UTC-4\tAmerica/Guadeloupe',
|
| 123 |
+
'UTC-4\tAmerica/Guyana',
|
| 124 |
+
'UTC-4\tAmerica/Halifax',
|
| 125 |
+
'UTC-4\tAmerica/Kralendijk',
|
| 126 |
+
'UTC-4\tAmerica/La_Paz',
|
| 127 |
+
'UTC-4\tAmerica/Lower_Princes',
|
| 128 |
+
'UTC-4\tAmerica/Manaus',
|
| 129 |
+
'UTC-4\tAmerica/Marigot',
|
| 130 |
+
'UTC-4\tAmerica/Martinique',
|
| 131 |
+
'UTC-4\tAmerica/Moncton',
|
| 132 |
+
'UTC-4\tAmerica/Montserrat',
|
| 133 |
+
'UTC-4\tAmerica/Porto_Velho',
|
| 134 |
+
'UTC-4\tAmerica/Port_of_Spain',
|
| 135 |
+
'UTC-4\tAmerica/Puerto_Rico',
|
| 136 |
+
'UTC-4\tAmerica/Santiago',
|
| 137 |
+
'UTC-4\tAmerica/Santo_Domingo',
|
| 138 |
+
'UTC-4\tAmerica/St_Barthelemy',
|
| 139 |
+
'UTC-4\tAmerica/St_Kitts',
|
| 140 |
+
'UTC-4\tAmerica/St_Lucia',
|
| 141 |
+
'UTC-4\tAmerica/St_Thomas',
|
| 142 |
+
'UTC-4\tAmerica/St_Vincent',
|
| 143 |
+
'UTC-4\tAmerica/Thule',
|
| 144 |
+
'UTC-4\tAmerica/Tortola',
|
| 145 |
+
'UTC-4\tAtlantic/Bermuda',
|
| 146 |
+
'UTC-3:30\tAmerica/St_Johns',
|
| 147 |
+
'UTC-3\tAmerica/Araguaina',
|
| 148 |
+
'UTC-3\tAmerica/Argentina/Buenos_Aires',
|
| 149 |
+
'UTC-3\tAmerica/Argentina/Catamarca',
|
| 150 |
+
'UTC-3\tAmerica/Argentina/Cordoba',
|
| 151 |
+
'UTC-3\tAmerica/Argentina/Jujuy',
|
| 152 |
+
'UTC-3\tAmerica/Argentina/La_Rioja',
|
| 153 |
+
'UTC-3\tAmerica/Argentina/Mendoza',
|
| 154 |
+
'UTC-3\tAmerica/Argentina/Rio_Gallegos',
|
| 155 |
+
'UTC-3\tAmerica/Argentina/Salta',
|
| 156 |
+
'UTC-3\tAmerica/Argentina/San_Juan',
|
| 157 |
+
'UTC-3\tAmerica/Argentina/San_Luis',
|
| 158 |
+
'UTC-3\tAmerica/Argentina/Tucuman',
|
| 159 |
+
'UTC-3\tAmerica/Argentina/Ushuaia',
|
| 160 |
+
'UTC-3\tAmerica/Bahia',
|
| 161 |
+
'UTC-3\tAmerica/Belem',
|
| 162 |
+
'UTC-3\tAmerica/Cayenne',
|
| 163 |
+
'UTC-3\tAmerica/Fortaleza',
|
| 164 |
+
'UTC-3\tAmerica/Maceio',
|
| 165 |
+
'UTC-3\tAmerica/Miquelon',
|
| 166 |
+
'UTC-3\tAmerica/Montevideo',
|
| 167 |
+
'UTC-3\tAmerica/Paramaribo',
|
| 168 |
+
'UTC-3\tAmerica/Punta_Arenas',
|
| 169 |
+
'UTC-3\tAmerica/Recife',
|
| 170 |
+
'UTC-3\tAmerica/Santarem',
|
| 171 |
+
'UTC-3\tAmerica/Sao_Paulo',
|
| 172 |
+
'UTC-3\tAntarctica/Palmer',
|
| 173 |
+
'UTC-3\tAntarctica/Rothera',
|
| 174 |
+
'UTC-3\tAtlantic/Stanley',
|
| 175 |
+
'UTC-2\tAmerica/Noronha',
|
| 176 |
+
'UTC-2\tAmerica/Nuuk',
|
| 177 |
+
'UTC-2\tAtlantic/South_Georgia',
|
| 178 |
+
'UTC-1\tAmerica/Scoresbysund',
|
| 179 |
+
'UTC-1\tAtlantic/Azores',
|
| 180 |
+
'UTC-1\tAtlantic/Cape_Verde',
|
| 181 |
+
'UTC+0\tAfrica/Abidjan',
|
| 182 |
+
'UTC+0\tAfrica/Accra',
|
| 183 |
+
'UTC+0\tAfrica/Bamako',
|
| 184 |
+
'UTC+0\tAfrica/Banjul',
|
| 185 |
+
'UTC+0\tAfrica/Bissau',
|
| 186 |
+
'UTC+0\tAfrica/Casablanca',
|
| 187 |
+
'UTC+0\tAfrica/Conakry',
|
| 188 |
+
'UTC+0\tAfrica/Dakar',
|
| 189 |
+
'UTC+0\tAfrica/El_Aaiun',
|
| 190 |
+
'UTC+0\tAfrica/Freetown',
|
| 191 |
+
'UTC+0\tAfrica/Lome',
|
| 192 |
+
'UTC+0\tAfrica/Monrovia',
|
| 193 |
+
'UTC+0\tAfrica/Nouakchott',
|
| 194 |
+
'UTC+0\tAfrica/Ouagadougou',
|
| 195 |
+
'UTC+0\tAfrica/Sao_Tome',
|
| 196 |
+
'UTC+0\tAmerica/Danmarkshavn',
|
| 197 |
+
'UTC+0\tAntarctica/Troll',
|
| 198 |
+
'UTC+0\tAtlantic/Canary',
|
| 199 |
+
'UTC+0\tAtlantic/Faroe',
|
| 200 |
+
'UTC+0\tAtlantic/Madeira',
|
| 201 |
+
'UTC+0\tAtlantic/Reykjavik',
|
| 202 |
+
'UTC+0\tAtlantic/St_Helena',
|
| 203 |
+
'UTC+0\tEurope/Dublin',
|
| 204 |
+
'UTC+0\tEurope/Guernsey',
|
| 205 |
+
'UTC+0\tEurope/Isle_of_Man',
|
| 206 |
+
'UTC+0\tEurope/Jersey',
|
| 207 |
+
'UTC+0\tEurope/Lisbon',
|
| 208 |
+
'UTC+0\tEurope/London',
|
| 209 |
+
'UTC+1\tAfrica/Algiers',
|
| 210 |
+
'UTC+1\tAfrica/Bangui',
|
| 211 |
+
'UTC+1\tAfrica/Brazzaville',
|
| 212 |
+
'UTC+1\tAfrica/Ceuta',
|
| 213 |
+
'UTC+1\tAfrica/Douala',
|
| 214 |
+
'UTC+1\tAfrica/Kinshasa',
|
| 215 |
+
'UTC+1\tAfrica/Lagos',
|
| 216 |
+
'UTC+1\tAfrica/Libreville',
|
| 217 |
+
'UTC+1\tAfrica/Luanda',
|
| 218 |
+
'UTC+1\tAfrica/Malabo',
|
| 219 |
+
'UTC+1\tAfrica/Ndjamena',
|
| 220 |
+
'UTC+1\tAfrica/Niamey',
|
| 221 |
+
'UTC+1\tAfrica/Porto-Novo',
|
| 222 |
+
'UTC+1\tAfrica/Tunis',
|
| 223 |
+
'UTC+1\tAfrica/Windhoek',
|
| 224 |
+
'UTC+1\tArctic/Longyearbyen',
|
| 225 |
+
'UTC+1\tEurope/Amsterdam',
|
| 226 |
+
'UTC+1\tEurope/Andorra',
|
| 227 |
+
'UTC+1\tEurope/Belgrade',
|
| 228 |
+
'UTC+1\tEurope/Berlin',
|
| 229 |
+
'UTC+1\tEurope/Bratislava',
|
| 230 |
+
'UTC+1\tEurope/Brussels',
|
| 231 |
+
'UTC+1\tEurope/Budapest',
|
| 232 |
+
'UTC+1\tEurope/Copenhagen',
|
| 233 |
+
'UTC+1\tEurope/Gibraltar',
|
| 234 |
+
'UTC+1\tEurope/Ljubljana',
|
| 235 |
+
'UTC+1\tEurope/Luxembourg',
|
| 236 |
+
'UTC+1\tEurope/Madrid',
|
| 237 |
+
'UTC+1\tEurope/Malta',
|
| 238 |
+
'UTC+1\tEurope/Monaco',
|
| 239 |
+
'UTC+1\tEurope/Oslo',
|
| 240 |
+
'UTC+1\tEurope/Paris',
|
| 241 |
+
'UTC+1\tEurope/Podgorica',
|
| 242 |
+
'UTC+1\tEurope/Prague',
|
| 243 |
+
'UTC+1\tEurope/Rome',
|
| 244 |
+
'UTC+1\tEurope/San_Marino',
|
| 245 |
+
'UTC+1\tEurope/Sarajevo',
|
| 246 |
+
'UTC+1\tEurope/Skopje',
|
| 247 |
+
'UTC+1\tEurope/Stockholm',
|
| 248 |
+
'UTC+1\tEurope/Tirane',
|
| 249 |
+
'UTC+1\tEurope/Vaduz',
|
| 250 |
+
'UTC+1\tEurope/Vatican',
|
| 251 |
+
'UTC+1\tEurope/Vienna',
|
| 252 |
+
'UTC+1\tEurope/Warsaw',
|
| 253 |
+
'UTC+1\tEurope/Zagreb',
|
| 254 |
+
'UTC+1\tEurope/Zurich',
|
| 255 |
+
'UTC+2\tAfrica/Blantyre',
|
| 256 |
+
'UTC+2\tAfrica/Bujumbura',
|
| 257 |
+
'UTC+2\tAfrica/Cairo',
|
| 258 |
+
'UTC+2\tAfrica/Gaborone',
|
| 259 |
+
'UTC+2\tAfrica/Harare',
|
| 260 |
+
'UTC+2\tAfrica/Johannesburg',
|
| 261 |
+
'UTC+2\tAfrica/Juba',
|
| 262 |
+
'UTC+2\tAfrica/Khartoum',
|
| 263 |
+
'UTC+2\tAfrica/Kigali',
|
| 264 |
+
'UTC+2\tAfrica/Lubumbashi',
|
| 265 |
+
'UTC+2\tAfrica/Lusaka',
|
| 266 |
+
'UTC+2\tAfrica/Maputo',
|
| 267 |
+
'UTC+2\tAfrica/Maseru',
|
| 268 |
+
'UTC+2\tAfrica/Mbabane',
|
| 269 |
+
'UTC+2\tAfrica/Tripoli',
|
| 270 |
+
'UTC+2\tAsia/Beirut',
|
| 271 |
+
'UTC+2\tAsia/Famagusta',
|
| 272 |
+
'UTC+2\tAsia/Gaza',
|
| 273 |
+
'UTC+2\tAsia/Hebron',
|
| 274 |
+
'UTC+2\tAsia/Jerusalem',
|
| 275 |
+
'UTC+2\tAsia/Nicosia',
|
| 276 |
+
'UTC+2\tEurope/Athens',
|
| 277 |
+
'UTC+2\tEurope/Bucharest',
|
| 278 |
+
'UTC+2\tEurope/Chisinau',
|
| 279 |
+
'UTC+2\tEurope/Helsinki',
|
| 280 |
+
'UTC+2\tEurope/Kaliningrad',
|
| 281 |
+
'UTC+2\tEurope/Kyiv',
|
| 282 |
+
'UTC+2\tEurope/Mariehamn',
|
| 283 |
+
'UTC+2\tEurope/Riga',
|
| 284 |
+
'UTC+2\tEurope/Sofia',
|
| 285 |
+
'UTC+2\tEurope/Tallinn',
|
| 286 |
+
'UTC+2\tEurope/Vilnius',
|
| 287 |
+
'UTC+3\tAfrica/Addis_Ababa',
|
| 288 |
+
'UTC+3\tAfrica/Asmara',
|
| 289 |
+
'UTC+3\tAfrica/Dar_es_Salaam',
|
| 290 |
+
'UTC+3\tAfrica/Djibouti',
|
| 291 |
+
'UTC+3\tAfrica/Kampala',
|
| 292 |
+
'UTC+3\tAfrica/Mogadishu',
|
| 293 |
+
'UTC+3\tAfrica/Nairobi',
|
| 294 |
+
'UTC+3\tAntarctica/Syowa',
|
| 295 |
+
'UTC+3\tAsia/Aden',
|
| 296 |
+
'UTC+3\tAsia/Amman',
|
| 297 |
+
'UTC+3\tAsia/Baghdad',
|
| 298 |
+
'UTC+3\tAsia/Bahrain',
|
| 299 |
+
'UTC+3\tAsia/Damascus',
|
| 300 |
+
'UTC+3\tAsia/Kuwait',
|
| 301 |
+
'UTC+3\tAsia/Qatar',
|
| 302 |
+
'UTC+3\tAsia/Riyadh',
|
| 303 |
+
'UTC+3\tEurope/Istanbul',
|
| 304 |
+
'UTC+3\tEurope/Kirov',
|
| 305 |
+
'UTC+3\tEurope/Minsk',
|
| 306 |
+
'UTC+3\tEurope/Moscow',
|
| 307 |
+
'UTC+3\tEurope/Simferopol',
|
| 308 |
+
'UTC+3\tEurope/Volgograd',
|
| 309 |
+
'UTC+3\tIndian/Antananarivo',
|
| 310 |
+
'UTC+3\tIndian/Comoro',
|
| 311 |
+
'UTC+3\tIndian/Mayotte',
|
| 312 |
+
'UTC+3:30\tAsia/Tehran',
|
| 313 |
+
'UTC+4\tAsia/Baku',
|
| 314 |
+
'UTC+4\tAsia/Dubai',
|
| 315 |
+
'UTC+4\tAsia/Muscat',
|
| 316 |
+
'UTC+4\tAsia/Tbilisi',
|
| 317 |
+
'UTC+4\tAsia/Yerevan',
|
| 318 |
+
'UTC+4\tEurope/Astrakhan',
|
| 319 |
+
'UTC+4\tEurope/Samara',
|
| 320 |
+
'UTC+4\tEurope/Saratov',
|
| 321 |
+
'UTC+4\tEurope/Ulyanovsk',
|
| 322 |
+
'UTC+4\tIndian/Mahe',
|
| 323 |
+
'UTC+4\tIndian/Mauritius',
|
| 324 |
+
'UTC+4\tIndian/Reunion',
|
| 325 |
+
'UTC+4:30\tAsia/Kabul',
|
| 326 |
+
'UTC+5\tAntarctica/Mawson',
|
| 327 |
+
'UTC+5\tAsia/Aqtau',
|
| 328 |
+
'UTC+5\tAsia/Aqtobe',
|
| 329 |
+
'UTC+5\tAsia/Ashgabat',
|
| 330 |
+
'UTC+5\tAsia/Atyrau',
|
| 331 |
+
'UTC+5\tAsia/Dushanbe',
|
| 332 |
+
'UTC+5\tAsia/Karachi',
|
| 333 |
+
'UTC+5\tAsia/Oral',
|
| 334 |
+
'UTC+5\tAsia/Qyzylorda',
|
| 335 |
+
'UTC+5\tAsia/Samarkand',
|
| 336 |
+
'UTC+5\tAsia/Tashkent',
|
| 337 |
+
'UTC+5\tAsia/Yekaterinburg',
|
| 338 |
+
'UTC+5\tIndian/Kerguelen',
|
| 339 |
+
'UTC+5\tIndian/Maldives',
|
| 340 |
+
'UTC+5:30\tAsia/Colombo',
|
| 341 |
+
'UTC+5:30\tAsia/Kolkata',
|
| 342 |
+
'UTC+5:45\tAsia/Kathmandu',
|
| 343 |
+
'UTC+6\tAntarctica/Vostok',
|
| 344 |
+
'UTC+6\tAsia/Almaty',
|
| 345 |
+
'UTC+6\tAsia/Bishkek',
|
| 346 |
+
'UTC+6\tAsia/Dhaka',
|
| 347 |
+
'UTC+6\tAsia/Omsk',
|
| 348 |
+
'UTC+6\tAsia/Qostanay',
|
| 349 |
+
'UTC+6\tAsia/Thimphu',
|
| 350 |
+
'UTC+6\tAsia/Urumqi',
|
| 351 |
+
'UTC+6\tIndian/Chagos',
|
| 352 |
+
'UTC+6:30\tAsia/Yangon',
|
| 353 |
+
'UTC+6:30\tIndian/Cocos',
|
| 354 |
+
'UTC+7\tAntarctica/Davis',
|
| 355 |
+
'UTC+7\tAsia/Bangkok',
|
| 356 |
+
'UTC+7\tAsia/Barnaul',
|
| 357 |
+
'UTC+7\tAsia/Hovd',
|
| 358 |
+
'UTC+7\tAsia/Ho_Chi_Minh',
|
| 359 |
+
'UTC+7\tAsia/Jakarta',
|
| 360 |
+
'UTC+7\tAsia/Krasnoyarsk',
|
| 361 |
+
'UTC+7\tAsia/Novokuznetsk',
|
| 362 |
+
'UTC+7\tAsia/Novosibirsk',
|
| 363 |
+
'UTC+7\tAsia/Phnom_Penh',
|
| 364 |
+
'UTC+7\tAsia/Pontianak',
|
| 365 |
+
'UTC+7\tAsia/Tomsk',
|
| 366 |
+
'UTC+7\tAsia/Vientiane',
|
| 367 |
+
'UTC+7\tIndian/Christmas',
|
| 368 |
+
'UTC+8\tAsia/Brunei',
|
| 369 |
+
'UTC+8\tAsia/Choibalsan',
|
| 370 |
+
'UTC+8\tAsia/Hong_Kong',
|
| 371 |
+
'UTC+8\tAsia/Irkutsk',
|
| 372 |
+
'UTC+8\tAsia/Kuala_Lumpur',
|
| 373 |
+
'UTC+8\tAsia/Kuching',
|
| 374 |
+
'UTC+8\tAsia/Macau',
|
| 375 |
+
'UTC+8\tAsia/Makassar',
|
| 376 |
+
'UTC+8\tAsia/Manila',
|
| 377 |
+
'UTC+8\tAsia/Shanghai',
|
| 378 |
+
'UTC+8\tAsia/Singapore',
|
| 379 |
+
'UTC+8\tAsia/Taipei',
|
| 380 |
+
'UTC+8\tAsia/Ulaanbaatar',
|
| 381 |
+
'UTC+8\tAustralia/Perth',
|
| 382 |
+
'UTC+8:45\tAustralia/Eucla',
|
| 383 |
+
'UTC+9\tAsia/Chita',
|
| 384 |
+
'UTC+9\tAsia/Dili',
|
| 385 |
+
'UTC+9\tAsia/Jayapura',
|
| 386 |
+
'UTC+9\tAsia/Khandyga',
|
| 387 |
+
'UTC+9\tAsia/Pyongyang',
|
| 388 |
+
'UTC+9\tAsia/Seoul',
|
| 389 |
+
'UTC+9\tAsia/Tokyo',
|
| 390 |
+
'UTC+9\tAsia/Yakutsk',
|
| 391 |
+
'UTC+9\tPacific/Palau',
|
| 392 |
+
'UTC+9:30\tAustralia/Adelaide',
|
| 393 |
+
'UTC+9:30\tAustralia/Broken_Hill',
|
| 394 |
+
'UTC+9:30\tAustralia/Darwin',
|
| 395 |
+
'UTC+10\tAntarctica/DumontDUrville',
|
| 396 |
+
'UTC+10\tAntarctica/Macquarie',
|
| 397 |
+
'UTC+10\tAsia/Ust-Nera',
|
| 398 |
+
'UTC+10\tAsia/Vladivostok',
|
| 399 |
+
'UTC+10\tAustralia/Brisbane',
|
| 400 |
+
'UTC+10\tAustralia/Hobart',
|
| 401 |
+
'UTC+10\tAustralia/Lindeman',
|
| 402 |
+
'UTC+10\tAustralia/Melbourne',
|
| 403 |
+
'UTC+10\tAustralia/Sydney',
|
| 404 |
+
'UTC+10\tPacific/Chuuk',
|
| 405 |
+
'UTC+10\tPacific/Guam',
|
| 406 |
+
'UTC+10\tPacific/Port_Moresby',
|
| 407 |
+
'UTC+10\tPacific/Saipan',
|
| 408 |
+
'UTC+10:30\tAustralia/Lord_Howe',
|
| 409 |
+
'UTC+11\tAntarctica/Casey',
|
| 410 |
+
'UTC+11\tAsia/Magadan',
|
| 411 |
+
'UTC+11\tAsia/Sakhalin',
|
| 412 |
+
'UTC+11\tAsia/Srednekolymsk',
|
| 413 |
+
'UTC+11\tPacific/Bougainville',
|
| 414 |
+
'UTC+11\tPacific/Efate',
|
| 415 |
+
'UTC+11\tPacific/Guadalcanal',
|
| 416 |
+
'UTC+11\tPacific/Kosrae',
|
| 417 |
+
'UTC+11\tPacific/Norfolk',
|
| 418 |
+
'UTC+11\tPacific/Noumea',
|
| 419 |
+
'UTC+11\tPacific/Pohnpei',
|
| 420 |
+
'UTC+12\tAntarctica/McMurdo',
|
| 421 |
+
'UTC+12\tAsia/Anadyr',
|
| 422 |
+
'UTC+12\tAsia/Kamchatka',
|
| 423 |
+
'UTC+12\tPacific/Auckland',
|
| 424 |
+
'UTC+12\tPacific/Fiji',
|
| 425 |
+
'UTC+12\tPacific/Funafuti',
|
| 426 |
+
'UTC+12\tPacific/Kwajalein',
|
| 427 |
+
'UTC+12\tPacific/Majuro',
|
| 428 |
+
'UTC+12\tPacific/Nauru',
|
| 429 |
+
'UTC+12\tPacific/Tarawa',
|
| 430 |
+
'UTC+12\tPacific/Wake',
|
| 431 |
+
'UTC+12\tPacific/Wallis',
|
| 432 |
+
'UTC+12:45\tPacific/Chatham',
|
| 433 |
+
'UTC+13\tPacific/Apia',
|
| 434 |
+
'UTC+13\tPacific/Fakaofo',
|
| 435 |
+
'UTC+13\tPacific/Kanton',
|
| 436 |
+
'UTC+13\tPacific/Tongatapu',
|
| 437 |
+
'UTC+14\tPacific/Kiritimati',
|
| 438 |
+
];
|
web/src/hooks/userSettingHook.ts
CHANGED
|
@@ -74,3 +74,16 @@ export const useLogout = () => {
|
|
| 74 |
|
| 75 |
return logout;
|
| 76 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
return logout;
|
| 76 |
};
|
| 77 |
+
|
| 78 |
+
export const useSaveSetting = () => {
|
| 79 |
+
const dispatch = useDispatch();
|
| 80 |
+
|
| 81 |
+
const saveSetting = useCallback(
|
| 82 |
+
(userInfo: { new_password: string } | IUserInfo): number => {
|
| 83 |
+
return dispatch<any>({ type: 'settingModel/setting', payload: userInfo });
|
| 84 |
+
},
|
| 85 |
+
[dispatch],
|
| 86 |
+
);
|
| 87 |
+
|
| 88 |
+
return saveSetting;
|
| 89 |
+
};
|
web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx
CHANGED
|
@@ -26,6 +26,11 @@ import { useDispatch, useSelector } from 'umi';
|
|
| 26 |
import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llmHooks';
|
| 27 |
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
| 28 |
import { IKnowledge } from '@/interfaces/database/knowledge';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
import { PlusOutlined } from '@ant-design/icons';
|
| 30 |
import { LlmModelType } from '../../constant';
|
| 31 |
import styles from './index.less';
|
|
@@ -43,26 +48,12 @@ const Configuration = () => {
|
|
| 43 |
(state: any) => state.kSModel.knowledgeDetails,
|
| 44 |
);
|
| 45 |
|
| 46 |
-
const normFile = (e: any) => {
|
| 47 |
-
if (Array.isArray(e)) {
|
| 48 |
-
return e;
|
| 49 |
-
}
|
| 50 |
-
return e?.fileList;
|
| 51 |
-
};
|
| 52 |
-
|
| 53 |
const parserList = useSelectParserList();
|
| 54 |
|
| 55 |
const embeddingModelOptions = useSelectLlmOptions();
|
| 56 |
|
| 57 |
const onFinish = async (values: any) => {
|
| 58 |
-
|
| 59 |
-
const fileList = values.avatar;
|
| 60 |
-
let avatar;
|
| 61 |
-
|
| 62 |
-
if (Array.isArray(fileList) && fileList.length > 0) {
|
| 63 |
-
avatar = fileList[0].thumbUrl;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
dispatch({
|
| 67 |
type: 'kSModel/updateKb',
|
| 68 |
payload: {
|
|
@@ -78,12 +69,10 @@ const Configuration = () => {
|
|
| 78 |
};
|
| 79 |
|
| 80 |
useEffect(() => {
|
| 81 |
-
const
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
-
if (avatar) {
|
| 85 |
-
fileList = [{ uid: '1', name: 'file', thumbUrl: avatar, status: 'done' }];
|
| 86 |
-
}
|
| 87 |
form.setFieldsValue({
|
| 88 |
...pick(knowledgeDetails, [
|
| 89 |
'description',
|
|
|
|
| 26 |
import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llmHooks';
|
| 27 |
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
| 28 |
import { IKnowledge } from '@/interfaces/database/knowledge';
|
| 29 |
+
import {
|
| 30 |
+
getBase64FromUploadFileList,
|
| 31 |
+
getUploadFileListFromBase64,
|
| 32 |
+
normFile,
|
| 33 |
+
} from '@/utils/fileUtil';
|
| 34 |
import { PlusOutlined } from '@ant-design/icons';
|
| 35 |
import { LlmModelType } from '../../constant';
|
| 36 |
import styles from './index.less';
|
|
|
|
| 48 |
(state: any) => state.kSModel.knowledgeDetails,
|
| 49 |
);
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
const parserList = useSelectParserList();
|
| 52 |
|
| 53 |
const embeddingModelOptions = useSelectLlmOptions();
|
| 54 |
|
| 55 |
const onFinish = async (values: any) => {
|
| 56 |
+
const avatar = getBase64FromUploadFileList(values.avatar);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
dispatch({
|
| 58 |
type: 'kSModel/updateKb',
|
| 59 |
payload: {
|
|
|
|
| 69 |
};
|
| 70 |
|
| 71 |
useEffect(() => {
|
| 72 |
+
const fileList: UploadFile[] = getUploadFileListFromBase64(
|
| 73 |
+
knowledgeDetails.avatar,
|
| 74 |
+
);
|
| 75 |
|
|
|
|
|
|
|
|
|
|
| 76 |
form.setFieldsValue({
|
| 77 |
...pick(knowledgeDetails, [
|
| 78 |
'description',
|
web/src/pages/setting/model.ts
CHANGED
|
@@ -52,7 +52,7 @@ const model: DvaModel<SettingModelState> = {
|
|
| 52 |
const { data } = yield call(userService.setting, payload);
|
| 53 |
const { retcode } = data;
|
| 54 |
if (retcode === 0) {
|
| 55 |
-
message.success('
|
| 56 |
yield put({
|
| 57 |
type: 'updateState',
|
| 58 |
payload: {
|
|
@@ -61,7 +61,6 @@ const model: DvaModel<SettingModelState> = {
|
|
| 61 |
});
|
| 62 |
yield put({
|
| 63 |
type: 'getUserInfo',
|
| 64 |
-
payload: {},
|
| 65 |
});
|
| 66 |
}
|
| 67 |
},
|
|
|
|
| 52 |
const { data } = yield call(userService.setting, payload);
|
| 53 |
const { retcode } = data;
|
| 54 |
if (retcode === 0) {
|
| 55 |
+
message.success('Modified!');
|
| 56 |
yield put({
|
| 57 |
type: 'updateState',
|
| 58 |
payload: {
|
|
|
|
| 61 |
});
|
| 62 |
yield put({
|
| 63 |
type: 'getUserInfo',
|
|
|
|
| 64 |
});
|
| 65 |
}
|
| 66 |
},
|
web/src/pages/user-setting/components/setting-title/index.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Typography } from 'antd';
|
| 2 |
+
|
| 3 |
+
const { Title, Paragraph } = Typography;
|
| 4 |
+
|
| 5 |
+
interface IProps {
|
| 6 |
+
title: string;
|
| 7 |
+
description: string;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const SettingTitle = ({ title, description }: IProps) => {
|
| 11 |
+
return (
|
| 12 |
+
<div>
|
| 13 |
+
<Title level={5}>{title}</Title>
|
| 14 |
+
<Paragraph>{description}</Paragraph>
|
| 15 |
+
</div>
|
| 16 |
+
);
|
| 17 |
+
};
|
| 18 |
+
|
| 19 |
+
export default SettingTitle;
|
web/src/pages/user-setting/hooks.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
| 2 |
+
import { Form } from 'antd';
|
| 3 |
+
import { useEffect, useState } from 'react';
|
| 4 |
+
|
| 5 |
+
export const useValidateSubmittable = () => {
|
| 6 |
+
const [form] = Form.useForm();
|
| 7 |
+
const [submittable, setSubmittable] = useState<boolean>(false);
|
| 8 |
+
|
| 9 |
+
// Watch all values
|
| 10 |
+
const values = Form.useWatch([], form);
|
| 11 |
+
|
| 12 |
+
useEffect(() => {
|
| 13 |
+
form
|
| 14 |
+
.validateFields({ validateOnly: true })
|
| 15 |
+
.then(() => setSubmittable(true))
|
| 16 |
+
.catch(() => setSubmittable(false));
|
| 17 |
+
}, [form, values]);
|
| 18 |
+
|
| 19 |
+
return { submittable, form };
|
| 20 |
+
};
|
| 21 |
+
|
| 22 |
+
export const useGetUserInfoLoading = () =>
|
| 23 |
+
useOneNamespaceEffectsLoading('settingModel', ['setting']);
|
web/src/pages/user-setting/index.less
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.settingWrapper {
|
| 2 |
+
width: 100%;
|
| 3 |
+
|
| 4 |
+
.outletWrapper {
|
| 5 |
+
padding: 32px 32px 0;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
.itemDescription {
|
| 9 |
+
padding: 10px 0;
|
| 10 |
+
margin: 0;
|
| 11 |
+
}
|
| 12 |
+
}
|
web/src/pages/user-setting/index.tsx
CHANGED
|
@@ -2,11 +2,15 @@ import { Flex } from 'antd';
|
|
| 2 |
import { Outlet } from 'umi';
|
| 3 |
import SideBar from './sidebar';
|
| 4 |
|
|
|
|
|
|
|
| 5 |
const UserSetting = () => {
|
| 6 |
return (
|
| 7 |
-
<Flex>
|
| 8 |
<SideBar></SideBar>
|
| 9 |
-
<
|
|
|
|
|
|
|
| 10 |
</Flex>
|
| 11 |
);
|
| 12 |
};
|
|
|
|
| 2 |
import { Outlet } from 'umi';
|
| 3 |
import SideBar from './sidebar';
|
| 4 |
|
| 5 |
+
import styles from './index.less';
|
| 6 |
+
|
| 7 |
const UserSetting = () => {
|
| 8 |
return (
|
| 9 |
+
<Flex className={styles.settingWrapper}>
|
| 10 |
<SideBar></SideBar>
|
| 11 |
+
<Flex flex={1} className={styles.outletWrapper}>
|
| 12 |
+
<Outlet></Outlet>
|
| 13 |
+
</Flex>
|
| 14 |
</Flex>
|
| 15 |
);
|
| 16 |
};
|
web/src/pages/user-setting/setting-password/index.less
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.passwordWrapper {
|
| 2 |
+
width: 100%;
|
| 3 |
+
}
|
web/src/pages/user-setting/setting-password/index.tsx
CHANGED
|
@@ -1,5 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
const UserSettingPassword = () => {
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
};
|
| 4 |
|
| 5 |
export default UserSettingPassword;
|
|
|
|
| 1 |
+
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
| 2 |
+
import { useSaveSetting } from '@/hooks/userSettingHook';
|
| 3 |
+
import { rsaPsw } from '@/utils';
|
| 4 |
+
import { Button, Divider, Form, Input, Space } from 'antd';
|
| 5 |
+
import SettingTitle from '../components/setting-title';
|
| 6 |
+
import { useValidateSubmittable } from '../hooks';
|
| 7 |
+
|
| 8 |
+
import parentStyles from '../index.less';
|
| 9 |
+
import styles from './index.less';
|
| 10 |
+
|
| 11 |
+
type FieldType = {
|
| 12 |
+
password?: string;
|
| 13 |
+
new_password?: string;
|
| 14 |
+
confirm_password?: string;
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
const tailLayout = {
|
| 18 |
+
wrapperCol: { offset: 20, span: 4 },
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
const UserSettingPassword = () => {
|
| 22 |
+
const loading = useOneNamespaceEffectsLoading('settingModel', ['setting']);
|
| 23 |
+
const { form, submittable } = useValidateSubmittable();
|
| 24 |
+
const saveSetting = useSaveSetting();
|
| 25 |
+
|
| 26 |
+
const onFinish = (values: any) => {
|
| 27 |
+
const password = rsaPsw(values.password) as string;
|
| 28 |
+
const new_password = rsaPsw(values.new_password) as string;
|
| 29 |
+
|
| 30 |
+
saveSetting({ password, new_password });
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
const onFinishFailed = (errorInfo: any) => {
|
| 34 |
+
console.log('Failed:', errorInfo);
|
| 35 |
+
};
|
| 36 |
+
|
| 37 |
+
return (
|
| 38 |
+
<section className={styles.passwordWrapper}>
|
| 39 |
+
<SettingTitle
|
| 40 |
+
title="Password"
|
| 41 |
+
description="Please enter your current password to change your password."
|
| 42 |
+
></SettingTitle>
|
| 43 |
+
<Divider />
|
| 44 |
+
<Form
|
| 45 |
+
colon={false}
|
| 46 |
+
name="basic"
|
| 47 |
+
labelAlign={'left'}
|
| 48 |
+
labelCol={{ span: 8 }}
|
| 49 |
+
wrapperCol={{ span: 16 }}
|
| 50 |
+
style={{ width: '100%' }}
|
| 51 |
+
initialValues={{ remember: true }}
|
| 52 |
+
onFinish={onFinish}
|
| 53 |
+
onFinishFailed={onFinishFailed}
|
| 54 |
+
form={form}
|
| 55 |
+
autoComplete="off"
|
| 56 |
+
// requiredMark={'optional'}
|
| 57 |
+
>
|
| 58 |
+
<Form.Item<FieldType>
|
| 59 |
+
label="Current password"
|
| 60 |
+
name="password"
|
| 61 |
+
rules={[
|
| 62 |
+
{
|
| 63 |
+
required: true,
|
| 64 |
+
message: 'Please input your password!',
|
| 65 |
+
whitespace: true,
|
| 66 |
+
},
|
| 67 |
+
]}
|
| 68 |
+
>
|
| 69 |
+
<Input.Password />
|
| 70 |
+
</Form.Item>
|
| 71 |
+
<Divider />
|
| 72 |
+
<Form.Item label="New password" required>
|
| 73 |
+
<Form.Item<FieldType>
|
| 74 |
+
noStyle
|
| 75 |
+
name="new_password"
|
| 76 |
+
rules={[
|
| 77 |
+
{
|
| 78 |
+
required: true,
|
| 79 |
+
message: 'Please input your password!',
|
| 80 |
+
whitespace: true,
|
| 81 |
+
},
|
| 82 |
+
]}
|
| 83 |
+
>
|
| 84 |
+
<Input.Password />
|
| 85 |
+
</Form.Item>
|
| 86 |
+
<p className={parentStyles.itemDescription}>
|
| 87 |
+
Your new password must be more than 8 characters.
|
| 88 |
+
</p>
|
| 89 |
+
</Form.Item>
|
| 90 |
+
<Divider />
|
| 91 |
+
<Form.Item<FieldType>
|
| 92 |
+
label="Confirm new password"
|
| 93 |
+
name="confirm_password"
|
| 94 |
+
dependencies={['new_password']}
|
| 95 |
+
rules={[
|
| 96 |
+
{
|
| 97 |
+
required: true,
|
| 98 |
+
message: 'Please confirm your password!',
|
| 99 |
+
whitespace: true,
|
| 100 |
+
},
|
| 101 |
+
({ getFieldValue }) => ({
|
| 102 |
+
validator(_, value) {
|
| 103 |
+
if (!value || getFieldValue('new_password') === value) {
|
| 104 |
+
return Promise.resolve();
|
| 105 |
+
}
|
| 106 |
+
return Promise.reject(
|
| 107 |
+
new Error('The new password that you entered do not match!'),
|
| 108 |
+
);
|
| 109 |
+
},
|
| 110 |
+
}),
|
| 111 |
+
]}
|
| 112 |
+
>
|
| 113 |
+
<Input.Password />
|
| 114 |
+
</Form.Item>
|
| 115 |
+
<Divider />
|
| 116 |
+
<Form.Item
|
| 117 |
+
{...tailLayout}
|
| 118 |
+
shouldUpdate={(prevValues, curValues) =>
|
| 119 |
+
prevValues.additional !== curValues.additional
|
| 120 |
+
}
|
| 121 |
+
>
|
| 122 |
+
<Space>
|
| 123 |
+
<Button htmlType="button">Cancel</Button>
|
| 124 |
+
<Button
|
| 125 |
+
type="primary"
|
| 126 |
+
htmlType="submit"
|
| 127 |
+
disabled={!submittable}
|
| 128 |
+
loading={loading}
|
| 129 |
+
>
|
| 130 |
+
Save
|
| 131 |
+
</Button>
|
| 132 |
+
</Space>
|
| 133 |
+
</Form.Item>
|
| 134 |
+
</Form>
|
| 135 |
+
</section>
|
| 136 |
+
);
|
| 137 |
};
|
| 138 |
|
| 139 |
export default UserSettingPassword;
|
web/src/pages/user-setting/setting-profile/index.less
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.profileWrapper {
|
| 2 |
+
width: 100%;
|
| 3 |
+
.emailDescription {
|
| 4 |
+
padding: 10px 0;
|
| 5 |
+
margin: 0;
|
| 6 |
+
}
|
| 7 |
+
}
|
web/src/pages/user-setting/setting-profile/index.tsx
CHANGED
|
@@ -1,5 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
const UserSettingProfile = () => {
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
};
|
| 4 |
|
| 5 |
export default UserSettingProfile;
|
|
|
|
| 1 |
+
import { useSaveSetting, useSelectUserInfo } from '@/hooks/userSettingHook';
|
| 2 |
+
import {
|
| 3 |
+
getBase64FromUploadFileList,
|
| 4 |
+
getUploadFileListFromBase64,
|
| 5 |
+
normFile,
|
| 6 |
+
} from '@/utils/fileUtil';
|
| 7 |
+
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
| 8 |
+
import {
|
| 9 |
+
Button,
|
| 10 |
+
Divider,
|
| 11 |
+
Form,
|
| 12 |
+
Input,
|
| 13 |
+
Select,
|
| 14 |
+
Space,
|
| 15 |
+
Tooltip,
|
| 16 |
+
Upload,
|
| 17 |
+
UploadFile,
|
| 18 |
+
} from 'antd';
|
| 19 |
+
import { useEffect } from 'react';
|
| 20 |
+
import SettingTitle from '../components/setting-title';
|
| 21 |
+
import { TimezoneList } from '../constants';
|
| 22 |
+
import { useGetUserInfoLoading, useValidateSubmittable } from '../hooks';
|
| 23 |
+
|
| 24 |
+
import parentStyles from '../index.less';
|
| 25 |
+
import styles from './index.less';
|
| 26 |
+
|
| 27 |
+
const { Option } = Select;
|
| 28 |
+
|
| 29 |
+
type FieldType = {
|
| 30 |
+
nickname?: string;
|
| 31 |
+
language?: string;
|
| 32 |
+
email?: string;
|
| 33 |
+
color_schema?: string;
|
| 34 |
+
timezone?: string;
|
| 35 |
+
avatar?: string;
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
const tailLayout = {
|
| 39 |
+
wrapperCol: { offset: 20, span: 4 },
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
const UserSettingProfile = () => {
|
| 43 |
+
const userInfo = useSelectUserInfo();
|
| 44 |
+
const saveSetting = useSaveSetting();
|
| 45 |
+
const loading = useGetUserInfoLoading();
|
| 46 |
+
const { form, submittable } = useValidateSubmittable();
|
| 47 |
+
|
| 48 |
+
const onFinish = (values: any) => {
|
| 49 |
+
const avatar = getBase64FromUploadFileList(values.avatar);
|
| 50 |
+
saveSetting({ ...values, avatar });
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
const onFinishFailed = (errorInfo: any) => {
|
| 54 |
+
console.log('Failed:', errorInfo);
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
useEffect(() => {
|
| 58 |
+
const fileList: UploadFile[] = getUploadFileListFromBase64(userInfo.avatar);
|
| 59 |
+
form.setFieldsValue({ ...userInfo, avatar: fileList });
|
| 60 |
+
}, [form, userInfo]);
|
| 61 |
+
|
| 62 |
+
return (
|
| 63 |
+
<section className={styles.profileWrapper}>
|
| 64 |
+
<SettingTitle
|
| 65 |
+
title="Profile"
|
| 66 |
+
description="Update your photo and personal details here."
|
| 67 |
+
></SettingTitle>
|
| 68 |
+
<Divider />
|
| 69 |
+
<Form
|
| 70 |
+
colon={false}
|
| 71 |
+
name="basic"
|
| 72 |
+
labelAlign={'left'}
|
| 73 |
+
labelCol={{ span: 8 }}
|
| 74 |
+
wrapperCol={{ span: 16 }}
|
| 75 |
+
style={{ width: '100%' }}
|
| 76 |
+
initialValues={{ remember: true }}
|
| 77 |
+
onFinish={onFinish}
|
| 78 |
+
onFinishFailed={onFinishFailed}
|
| 79 |
+
form={form}
|
| 80 |
+
autoComplete="off"
|
| 81 |
+
>
|
| 82 |
+
<Form.Item<FieldType>
|
| 83 |
+
label="Username"
|
| 84 |
+
name="nickname"
|
| 85 |
+
rules={[
|
| 86 |
+
{
|
| 87 |
+
required: true,
|
| 88 |
+
message: 'Please input your username!',
|
| 89 |
+
whitespace: true,
|
| 90 |
+
},
|
| 91 |
+
]}
|
| 92 |
+
>
|
| 93 |
+
<Input />
|
| 94 |
+
</Form.Item>
|
| 95 |
+
<Divider />
|
| 96 |
+
<Form.Item<FieldType>
|
| 97 |
+
label={
|
| 98 |
+
<div>
|
| 99 |
+
<Space>
|
| 100 |
+
Your photo
|
| 101 |
+
<Tooltip title="prompt text">
|
| 102 |
+
<QuestionCircleOutlined />
|
| 103 |
+
</Tooltip>
|
| 104 |
+
</Space>
|
| 105 |
+
<div>This will be displayed on your profile.</div>
|
| 106 |
+
</div>
|
| 107 |
+
}
|
| 108 |
+
name="avatar"
|
| 109 |
+
valuePropName="fileList"
|
| 110 |
+
getValueFromEvent={normFile}
|
| 111 |
+
>
|
| 112 |
+
<Upload
|
| 113 |
+
listType="picture-card"
|
| 114 |
+
maxCount={1}
|
| 115 |
+
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
|
| 116 |
+
>
|
| 117 |
+
<button style={{ border: 0, background: 'none' }} type="button">
|
| 118 |
+
<PlusOutlined />
|
| 119 |
+
<div style={{ marginTop: 8 }}>Upload</div>
|
| 120 |
+
</button>
|
| 121 |
+
</Upload>
|
| 122 |
+
</Form.Item>
|
| 123 |
+
<Divider />
|
| 124 |
+
<Form.Item<FieldType>
|
| 125 |
+
label="Color schema"
|
| 126 |
+
name="color_schema"
|
| 127 |
+
rules={[
|
| 128 |
+
{ required: true, message: 'Please select your color schema!' },
|
| 129 |
+
]}
|
| 130 |
+
>
|
| 131 |
+
<Select placeholder="select your color schema">
|
| 132 |
+
<Option value="Bright">Bright</Option>
|
| 133 |
+
<Option value="Dark">Dark</Option>
|
| 134 |
+
</Select>
|
| 135 |
+
</Form.Item>
|
| 136 |
+
<Divider />
|
| 137 |
+
<Form.Item<FieldType>
|
| 138 |
+
label="Language"
|
| 139 |
+
name="language"
|
| 140 |
+
rules={[{ required: true, message: 'Please input your language!' }]}
|
| 141 |
+
>
|
| 142 |
+
<Select placeholder="select your language">
|
| 143 |
+
<Option value="English">English</Option>
|
| 144 |
+
<Option value="Chinese">Chinese</Option>
|
| 145 |
+
</Select>
|
| 146 |
+
</Form.Item>
|
| 147 |
+
<Divider />
|
| 148 |
+
<Form.Item<FieldType>
|
| 149 |
+
label="Timezone"
|
| 150 |
+
name="timezone"
|
| 151 |
+
rules={[{ required: true, message: 'Please input your timezone!' }]}
|
| 152 |
+
>
|
| 153 |
+
<Select placeholder="select your timezone" showSearch>
|
| 154 |
+
{TimezoneList.map((x) => (
|
| 155 |
+
<Option value={x} key={x}>
|
| 156 |
+
{x}
|
| 157 |
+
</Option>
|
| 158 |
+
))}
|
| 159 |
+
</Select>
|
| 160 |
+
</Form.Item>
|
| 161 |
+
<Divider />
|
| 162 |
+
<Form.Item label="Email address">
|
| 163 |
+
<Form.Item<FieldType> name="email" noStyle>
|
| 164 |
+
<Input disabled />
|
| 165 |
+
</Form.Item>
|
| 166 |
+
<p className={parentStyles.itemDescription}>
|
| 167 |
+
Once registered, an account cannot be changed and can only be
|
| 168 |
+
cancelled.
|
| 169 |
+
</p>
|
| 170 |
+
</Form.Item>
|
| 171 |
+
<Form.Item
|
| 172 |
+
{...tailLayout}
|
| 173 |
+
shouldUpdate={(prevValues, curValues) =>
|
| 174 |
+
prevValues.additional !== curValues.additional
|
| 175 |
+
}
|
| 176 |
+
>
|
| 177 |
+
<Space>
|
| 178 |
+
<Button htmlType="button">Cancel</Button>
|
| 179 |
+
<Button
|
| 180 |
+
type="primary"
|
| 181 |
+
htmlType="submit"
|
| 182 |
+
disabled={!submittable}
|
| 183 |
+
loading={loading}
|
| 184 |
+
>
|
| 185 |
+
Save
|
| 186 |
+
</Button>
|
| 187 |
+
</Space>
|
| 188 |
+
</Form.Item>
|
| 189 |
+
</Form>
|
| 190 |
+
</section>
|
| 191 |
+
);
|
| 192 |
};
|
| 193 |
|
| 194 |
export default UserSettingProfile;
|
web/src/pages/user-setting/sidebar/index.less
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.sideBarWrapper {
|
| 2 |
+
padding-top: 32px;
|
| 3 |
+
}
|
web/src/pages/user-setting/sidebar/index.tsx
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
| 10 |
UserSettingRouteMap,
|
| 11 |
} from '../constants';
|
| 12 |
|
|
|
|
|
|
|
| 13 |
type MenuItem = Required<MenuProps>['items'][number];
|
| 14 |
|
| 15 |
function getItem(
|
|
@@ -45,12 +47,15 @@ const SideBar = () => {
|
|
| 45 |
}, [pathName]);
|
| 46 |
|
| 47 |
return (
|
| 48 |
-
<
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
);
|
| 55 |
};
|
| 56 |
|
|
|
|
| 10 |
UserSettingRouteMap,
|
| 11 |
} from '../constants';
|
| 12 |
|
| 13 |
+
import styles from './index.less';
|
| 14 |
+
|
| 15 |
type MenuItem = Required<MenuProps>['items'][number];
|
| 16 |
|
| 17 |
function getItem(
|
|
|
|
| 47 |
}, [pathName]);
|
| 48 |
|
| 49 |
return (
|
| 50 |
+
<section className={styles.sideBarWrapper}>
|
| 51 |
+
<Menu
|
| 52 |
+
selectedKeys={selectedKeys}
|
| 53 |
+
mode="inline"
|
| 54 |
+
items={items}
|
| 55 |
+
onClick={handleMenuClick}
|
| 56 |
+
style={{ width: 312 }}
|
| 57 |
+
/>
|
| 58 |
+
</section>
|
| 59 |
);
|
| 60 |
};
|
| 61 |
|
web/src/utils/fileUtil.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
export const transformFile2Base64 = (val: any): Promise<any> => {
|
| 2 |
return new Promise((resolve, reject) => {
|
| 3 |
const reader = new FileReader();
|
|
@@ -26,3 +28,28 @@ export const transformBase64ToFile = (
|
|
| 26 |
}
|
| 27 |
return new File([u8arr], filename, { type: mimeType });
|
| 28 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { UploadFile } from 'antd';
|
| 2 |
+
|
| 3 |
export const transformFile2Base64 = (val: any): Promise<any> => {
|
| 4 |
return new Promise((resolve, reject) => {
|
| 5 |
const reader = new FileReader();
|
|
|
|
| 28 |
}
|
| 29 |
return new File([u8arr], filename, { type: mimeType });
|
| 30 |
};
|
| 31 |
+
|
| 32 |
+
export const normFile = (e: any) => {
|
| 33 |
+
if (Array.isArray(e)) {
|
| 34 |
+
return e;
|
| 35 |
+
}
|
| 36 |
+
return e?.fileList;
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
export const getUploadFileListFromBase64 = (avatar: string) => {
|
| 40 |
+
let fileList: UploadFile[] = [];
|
| 41 |
+
|
| 42 |
+
if (avatar) {
|
| 43 |
+
fileList = [{ uid: '1', name: 'file', thumbUrl: avatar, status: 'done' }];
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
return fileList;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
export const getBase64FromUploadFileList = (fileList?: UploadFile[]) => {
|
| 50 |
+
if (Array.isArray(fileList) && fileList.length > 0) {
|
| 51 |
+
return fileList[0].thumbUrl;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return '';
|
| 55 |
+
};
|