diff --git a/stdiet-ui/package.json b/stdiet-ui/package.json index dc83779d1..ae970217d 100644 --- a/stdiet-ui/package.json +++ b/stdiet-ui/package.json @@ -64,7 +64,7 @@ "path-to-regexp": "2.4.0", "quill": "1.3.7", "screenfull": "4.2.0", - "sortablejs": "1.8.4", + "sortablejs": "^1.14.0", "vue": "2.6.10", "vue-count-to": "1.0.13", "vue-cropper": "0.4.9", diff --git a/stdiet-ui/src/utils/shortCutUtils.js b/stdiet-ui/src/utils/shortCutUtils.js index df49202b9..c45537e34 100644 --- a/stdiet-ui/src/utils/shortCutUtils.js +++ b/stdiet-ui/src/utils/shortCutUtils.js @@ -3,15 +3,20 @@ export function getShortCut(key) { try { const data = JSON.parse(localStorage.getItem("shortCut") || "[]"); //关键字检索 - if(key != undefined && key != null && key != ""){ - const resultData = []; - data.forEach((item,index) => { - if(item.name.indexOf(key) != -1 || (item.className != undefined && item.className != null && item.className.indexOf(key) != -1)){ - resultData.push(item); - } - }); - res(resultData); - }else{ + if (key != undefined && key != null && key != "") { + const resultData = []; + data.forEach((item, index) => { + if ( + item.name.indexOf(key) != -1 || + (item.className != undefined && + item.className != null && + item.className.indexOf(key) != -1) + ) { + resultData.push(item); + } + }); + res(resultData); + } else { res(data); } } catch (error) { @@ -50,7 +55,9 @@ export async function removeMuchShortCut(ids) { const shortCutList = await getShortCut(); return new Promise((res, rej) => { try { - const newShortCutList = shortCutList.filter(obj => ids.indexOf(obj.id) == -1); + const newShortCutList = shortCutList.filter( + obj => ids.indexOf(obj.id) == -1 + ); localStorage.setItem("shortCut", JSON.stringify(newShortCutList)); res(); } catch (error) { @@ -74,3 +81,7 @@ export async function editShortCut(data) { } }); } + +export function updateSortCut(data) { + localStorage.setItem("shortCut", JSON.stringify(data)); +} diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue index 1499eff0b..f94ad5c3e 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue @@ -1,7 +1,13 @@