提交 b03fd41e authored 作者: caicai's avatar caicai

修改名称;新增删除功能

上级 99be6521
# 所有环境默认
# 页面 title 前缀
VUE_APP_TITLE=菜单
VUE_APP_TITLE=UiDock
# 打包后安装程序名字
VUE_APP_PRODUCTNAME=菜单
VUE_APP_PRODUCTNAME=UiDock
# 网络请求公用地址
# 测试
......
......@@ -104,7 +104,7 @@ npm run electron:generate-icons
"icon": './build/icons',
"category":"Education",
desktop:{
icon: 'menudock'
icon: 'UiDock'
},
"target": [
"AppImage",
......
{
"name": "menudock",
"name": "UiDock",
"version": "1.0.0",
"private": true,
"description": "菜单平台",
"description": "UiDock",
"homepage": "/",
"author": "Guangzhou Menu Technology Co., Ltd. <service@sei-tpo.com> (https://www.zei-dao.com/)",
"scripts": {
......
......@@ -332,6 +332,10 @@ class IpcEvents {
this.categoryPlugin.addCategory({name:data, sender:e.sender})
// e.sender.send("category-list", list);
})
ipcMain.on("delCategory", (e, data) => {
console.log('delCategory-2')
this.categoryPlugin.delCategory({id:data.id, sender:e.sender})
})
ipcMain.on("changeNameOfCategory", (e, data) => {
let { name,detail,index } = data;
this.categoryPlugin.updateName({name, detail, sender:e.sender})
......
......@@ -58,6 +58,20 @@ class category {
this.mainWindow.win.webContents.send("add-category", category);
}
/* 删除分类 */
delCategory({id, sender}) {
let categoryList = this.store.get("categorys6");
let hasIn = categoryList.findIndex(v => v.id == id);
console.log('delCategory - hasIn', hasIn, id)
if(hasIn == -1) return null;
categoryList.splice(hasIn,1);
this.store.set("categorys6", categoryList);
sender.send('remove-category',{id});
this.mainWindow.main.webContents.send("category-list", categoryList);
}
// 获取分类详情
getCategory(id) {
let categoryList = this.store.get("categorys6");
......
......@@ -6,9 +6,12 @@
<cateBox v-for="(cItem, cIndex) in cateList" :key="cIndex" :nolist="(!cItem.softList || cItem.softList.length == 0)">
<div class="dragbox_cate" :data-id="cItem.id" data-type="cate_container">
<!-- @dblclick="modifyName(cItem.name,cIndex)" -->
<div v-if="editIndex != cIndex" class="dragbox_cate_name" >{{cItem.name}}
<img @click="modifyName(cItem.name,cIndex)"
src="~@/assets/edit_icon.png" alt="" class="dragbox_cate_edit">
<div v-if="editIndex != cIndex" class="dragbox_cate_header">
<div class="dragbox_cate_name" >{{cItem.name}}
<img @click="modifyName(cItem.name,cIndex)"
src="~@/assets/edit_icon.png" alt="" class="dragbox_cate_edit">
</div>
<img @click="delCate(cItem,cIndex)" src="~@/assets/close.png" alt="" class="dragbox_cate_del">
</div>
<el-input v-else v-model="editName" placeholder="" @blur="closeEdit(cIndex)" class="dragbox_cate_input"></el-input>
<div v-if="cItem.softList" class="dragbox_cate_list">
......@@ -19,7 +22,7 @@
<el-dialog
title="添加分类"
:visible.sync="centerDialogVisible"
width="30%"
width="330px"
destroy-on-close
center>
<div style="padding-bottom:12px;fontsize:16px">请输入分类名称</div>
......@@ -164,6 +167,21 @@ export default {
this.editName = name;
this.editIndex = index;
},
delCate(item,index) {
this.$confirm('确认删除该分类?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
this.$emit("delCate",{item,index});
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
},
cancelAdd() {
this.centerDialogVisible = false;
this.cateName = "";
......@@ -186,6 +204,10 @@ export default {
</script>
<style lang="less" scoped>
.dialog-footer {
display: flex;
justify-content: flex-end;
}
.dragbox_head {
display: flex;
align-items: center;
......@@ -205,6 +227,17 @@ export default {
}
.dragbox_cate {
width: 100%;
.dragbox_cate_header {
display: flex;
align-items: center;
justify-content: space-between;
.dragbox_cate_del {
cursor: pointer;
width: 14px;
height: 14px;
padding: 3px;
}
}
.dragbox_cate_name {
display: flex;
align-items: center;
......
......@@ -42,6 +42,7 @@
<SchoolBox v-if="current === 'school'"></SchoolBox>
<DragBox ref="dragEl" v-if="current === 'mine'" :cateList="categoryList"
@addCategory="addCategory" @changeName="changeName"
@delCate="delCate"
@removeSoftFromCate="removeSoftFromCate"
></DragBox>
</div>
......@@ -135,6 +136,10 @@ export default {
// 添加分类
this.ipcRenderer.send("addCategory",name);
},
delCate({item,index}) {
// 删除分类
this.ipcRenderer.send("delCategory",{id:item.id,index});
},
removeSoftFromCate(args) {
// 从分类移出某个软件
this.ipcRenderer.send("removeSoftFromCate",args)
......@@ -199,6 +204,13 @@ export default {
});
this.ipcRenderer.on("remove-category", (event, {id}) => {
// console.log("添加分类 2", data);
let curIndex = this.categoryList.findIndex(v => v.id == id);
if(curIndex >= 0) this.categoryList.splice(curIndex,1)
this.$message.success("删除分类成功");
});
this.ipcRenderer.on("update-category-name", (event, data) => {
let {detail,id,name} = data;
let curIndex = this.categoryList.findIndex(v => v.id == id);
......
......@@ -79,7 +79,7 @@ module.exports = {
"icon": './build/icons',
"category":"Education",
desktop:{
icon: 'menudock'
icon: 'UiDock'
},
"target": [
"AppImage",
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论