diff --git a/CHANGELOG.md b/CHANGELOG.md index fad57e9..59a7b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.0.0 (2022-04-01) +# 1.0.0 (2022-04-06) ### 🌟 新功能 范围|描述|commitId @@ -161,6 +161,7 @@ - | 修复app打开详情页失败的问题 | [ecb943e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ecb943e) - | 修复bug | [a55d08e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a55d08e) - | 修复p-deliver报错taskRef的问题 | [880cf7c](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/880cf7c) + - | 长按拖动项目 | [7a05a0c](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/7a05a0c) - | 子组件传参 | [489e218](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/489e218) app.vue | 修复获取token报错的问题 | [9120d54](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9120d54) createTask | 修复createTask v-model的问题 | [b20d3f0](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b20d3f0) diff --git a/components/PrettyExchange/PrettyExchange - 副本.vue b/components/PrettyExchange/PrettyExchange - 副本.vue index 54041d8..d7f6380 100644 --- a/components/PrettyExchange/PrettyExchange - 副本.vue +++ b/components/PrettyExchange/PrettyExchange - 副本.vue @@ -1,120 +1,107 @@ @@ -141,7 +128,8 @@ import ProjectItem from '@/components/Projects/ProjectItem.vue'; const store = useStore(); const projects = computed(() => store.state.project.projects); -const remindData = computed(() => store.state.socket.remindData); +const remindData = computed(() => store.state.socket.remindData); +const userId = computed(() => store.getters['user/userId']); const data = reactive({ // itemTop: 0, // itemLeft: 0, @@ -164,12 +152,13 @@ const data = reactive({ clickProject: {}, projectId: 0, // menuList: [{ text: '复制' }, { text: '编辑' }, { text: '删除' }, { text: '置顶' }, { text: '排序' }], - menuList: [{ text: '导入' }, { text: '导出' }, { text: '删除' }, { text: '排序' }], + menuList: [{ text: '导入' }, { text: '导出' }, { text: '删除' }], // show: false, // border: 'border border-blue-500 shadow rounded-md', // showBorder: false, // 一级项目底部边框是否显示 - showItemIndex: undefined, + showItemIndex: undefined, + isStartMove: 0, // 是否可以移动 }); const emit = defineEmits(['changeHeight', 'change']); @@ -234,12 +223,12 @@ function getDate() { .exec(); } -function setData(flag, project, tips) { - data.showMenu = flag; - data.projectId = project.id; - data.tips = tips; - data.clickProject = project; -} +// function setData(flag, project, tips) { +// data.showMenu = flag; +// data.projectId = project.id; +// data.tips = tips; +// data.clickProject = project; +// } function chooseAction(e) { const obj = { @@ -255,24 +244,24 @@ function chooseAction(e) { // 操作 function actionFun(obj) { const action = data.menuList[obj.index].text; - if (action === '排序') { - data.changeEvent = true; - uni.$ui.showToast('请移动进行排序'); - } + // if (action === '排序') { + // data.changeEvent = true; + // uni.$ui.showToast('请移动进行排序'); + // } if (action === '删除') { - data.changeEvent = false; + // data.changeEvent = false; delProject(obj.projectId, obj.url); } if (action === '导入') { - data.changeEvent = false; + // data.changeEvent = false; store.commit('setDomain', obj.url); importProject(obj.projectId, obj.projectName); } if (action === '导出') { - data.changeEvent = false; + // data.changeEvent = false; exportProject(obj.projectId, obj.url); } @@ -289,7 +278,9 @@ function isNumber(val) { } function start(e, index) { - console.log('开始'); + console.log('开始', e); + data.isStartMove = 1; + setTimeout(() => { getDate(); }, 300); @@ -346,12 +337,16 @@ function start(e, index) { rect: true, size: true, }, - res => { - data.moveTop = res.top; - data.moveLeft = res.left; + res => { + console.log('res', res) + if (res) { + data.moveTop = res.top; + data.moveLeft = res.left; + data.itemWidth = res.width; + data.subItemHeight = res.height; + } + data.moveItem = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; - data.itemWidth = res.width; - data.subItemHeight = res.height; }, ) .exec(); @@ -359,6 +354,7 @@ function start(e, index) { } function move(e, length) { + if (!data.isStartMove) return false; console.log('移动'); data.showMoveImage = true; // 悬浮开始 const touch = e.touches[0]; @@ -398,10 +394,12 @@ function move(e, length) { } function stops(e, index, length) { - console.log('结束', e, index, length); + console.log('结束', e, index); + data.isStartMove = 0; + const touch = e.changedTouches[0]; const lastIndex = findOverIndex(touch.pageY, length); - console.log('11111111111', data.itemList) + // 交换两个值 for (let i = 0; i < data.itemList.length; i++) { // 插入顶部 @@ -425,7 +423,8 @@ function stops(e, index, length) { targetProjectId: '', }; emit('change', options); - } + } + // 清空 clearSet(i); emit('change', data.itemList); @@ -433,7 +432,7 @@ function stops(e, index, length) { } // 插入一级项目 if (data.itemList[i].showBorder) { - if (isNumber(index)) { + if (isNumber(index)) { const Value = data.itemList[index]; data.itemList.splice(i + 1, 0, Value); if (i < index) { @@ -443,9 +442,9 @@ function stops(e, index, length) { } } else { const arr = index.split('-'); - const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; - data.itemList.splice(i + 1, 0, Value); + const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); + data.itemList.splice(i + 1, 0, Value); // const options = { // id: Value.id, // parentId: 0, @@ -456,7 +455,8 @@ function stops(e, index, length) { targetProjectId: '', }; emit('change', options); - } + } + // 清空 clearSet(i); emit('change', data.itemList); @@ -523,14 +523,17 @@ function stops(e, index, length) { } // 还原初始数据 -function clearSet(i) { - data.itemList[i].showBorder = false; - data.itemList[i].showSubBorder = false; - data.itemList[i].showTopBorder = false; +function clearSet(i) { + if (i < data.itemList.length) { + data.itemList[i].showBorder = false; + data.itemList[i].showSubBorder = false; + data.itemList[i].showTopBorder = false; + } + data.deltaLeft == 0; data.showMoveImage = false; data.setSubItem = false; - data.changeEvent = false; + // data.changeEvent = false; data.showItemIndex = undefined; } @@ -653,9 +656,35 @@ function exportProject(id, url) { } // 跳转工作台 -// function toWorkbench() { -// uni.navigateTo({ url: '/pages/workbench/workbench' }); -// } +function toWorkbench() { + uni.navigateTo({ url: '/pages/workbench/workbench' }); +} + +// 打开项目详情 +function openProject(project) { + store.commit('task/clearTasks'); // 清空定期任务 + store.commit('task/clearRealTasks'); // 清空真实任务数据 + store.commit('socket/setCurrLocationTaskId', ''); + store.commit('task/setAllTasks', []); // 清空定期任务 + store.commit('task/setUpNextPage', 1); + store.commit('task/setDownNextPage', 1); + store.commit('task/setTimeLineType', 1); + const { name, id, url, businessCode } = project; + uni.navigateTo({ url: `/pages/project/project?u=${userId.value}&p=${id}&pname=${name}&url=${encodeURIComponent(url)}&businessCode=${businessCode}` }); +} + +/** + * 弹出项目操作面板 + */ +function openMenu(project, index) { + if (index === 0) return; + data.showMenu = true; + data.projectId = project.id; + data.tips.text = project.name; + data.clickProject = project; + + // emit('setData', data.showMenu, project, data.tips); +} diff --git a/components/PrettyExchange/PrettyExchange.vue b/components/PrettyExchange/PrettyExchange.vue index 7ffb3eb..f135ff2 100644 --- a/components/PrettyExchange/PrettyExchange.vue +++ b/components/PrettyExchange/PrettyExchange.vue @@ -13,11 +13,11 @@ @longpress="start($event, index)" > - + - + @@ -70,7 +70,7 @@ v-for="(subItem, subIndex) in item.sonProjectList" > - + @@ -101,8 +101,8 @@ - - + + @@ -132,20 +132,25 @@ const remindData = computed(() => store.state.socket.remindData); const userId = computed(() => store.getters['user/userId']); const data = reactive({ // itemTop: 0, - // itemLeft: 0, - itemHeight: 0, // 移动元素的高度 - itemWidth: 0, // 移动元素的宽度 - subItemHeight: 0, // 移动子元素的高度 - showMoveImage: false, - moveItem: '', // 当前选中的项目信息 - moveLeft: 0, // 当前选中项目距左侧的距离 - moveTop: 0, // 当前选中项目距顶部的距离 + // itemLeft: 0, + begintop: 0, // 项目列表中第一个项目初始时距离顶部的距离 + beginleft: 0, // 项目列表中第一个项目初始时距离左侧的距离 + + itemHeight: 0, // 当前选中移动元素的高度,二级项目则表示父项目的高度 + itemWidth: 0, // 当前选中移动元素的宽度 + moveItem: '', // 当前选中移动的项目信息 + moveLeft: 0, // 当前选中移动项目距左侧的距离 + moveTop: 0, // 当前选中移动项目距顶部的距离 + + showMoveImage: false, // 选中的项目是否悬浮 + + // subItemHeight: 0, // 当前选中移动的是二级项目,移动项目的高度 + deltaLeft: 0, deltaTop: 0, - beginleft: 0, // 项目列表中第一个项目初始时距离左侧的距离 - begintop: 0, // 项目列表中第一个项目初始时距离顶部的距离 + itemList: [], // 项目列表 - setSubItem: false, // 选中的是否是二级项目 + // setSubItem: false, // 选中的是否是二级项目 changeEvent: false, // 是否点击过操作面板 showMenu: false, tips: { text: '', color: '#909399', fontSize: 28 }, @@ -158,7 +163,8 @@ const data = reactive({ // border: 'border border-blue-500 shadow rounded-md', // showBorder: false, // 一级项目底部边框是否显示 showItemIndex: undefined, - isStartMove: 0, // 是否可以移动 + isStartMove: 0, // 是否可以移动 + timer: null }); const emit = defineEmits(['changeHeight', 'change']); @@ -272,22 +278,26 @@ function actionFun(obj) { }); } } - + +// 是不是数字 function isNumber(val) { return val === +val; } -function start(e, index) { - console.log('开始', e); - data.isStartMove = 1; +function start(e, index) { + data.timer = setTimeout(() => { + data.isStartMove = 1; + // console.log('开始', e, index); + }, 1500); setTimeout(() => { - getDate(); + getDate(); // 设置第一个数据的位置,距上,距左 }, 300); - + + // 是数字表示是1级项目,不是数字表示2级项目 if (isNumber(index)) { // 选中一级项目 - data.setSubItem = false; + // data.setSubItem = false; const query = uni .createSelectorQuery() .select(`#cu-${index}`) @@ -310,7 +320,7 @@ function start(e, index) { } else { // 选中二级项目 const arr = index.split('-'); - data.setSubItem = true; + // data.setSubItem = true; const query = uni.createSelectorQuery(); query @@ -337,12 +347,15 @@ function start(e, index) { rect: true, size: true, }, - res => { - data.moveTop = res.top; - data.moveLeft = res.left; + res => { + if (res) { + data.moveTop = res.top; + data.moveLeft = res.left; + data.itemWidth = res.width; + // data.subItemHeight = res.height; + } + data.moveItem = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; - data.itemWidth = res.width; - data.subItemHeight = res.height; }, ) .exec(); @@ -351,21 +364,22 @@ function start(e, index) { function move(e, length) { if (!data.isStartMove) return false; - console.log('移动'); + // console.log('移动'); data.showMoveImage = true; // 悬浮开始 - const touch = e.touches[0]; + const touch = e.touches[0]; if (data.deltaLeft == 0) { - // 获得本身的移动 + // 获得本身的移动,下次移动的位置根据初始位置获取 data.deltaLeft = touch.pageX - data.moveLeft; data.deltaTop = touch.pageY - data.moveTop; - } + } data.moveLeft = touch.pageX - data.deltaLeft; data.moveTop = touch.pageY - data.deltaTop; - const lastIndex = findOverIndex(touch.pageY, length); + const lastIndex = findOverIndex(touch.pageY, length); + // 显示下划线 for (let i = 0; i < data.itemList.length; i++) { - if (data.moveLeft > 35) { + if (data.moveLeft > 35 && lastIndex > -1) { data.itemList[i].showBorder = false; data.itemList[i].showTopBorder = false; if (i === lastIndex) { @@ -390,8 +404,9 @@ function move(e, length) { } function stops(e, index, length) { - console.log('结束'); + // console.log('结束', e, index); data.isStartMove = 0; + clearTimeout(data.timer); const touch = e.changedTouches[0]; const lastIndex = findOverIndex(touch.pageY, length); @@ -400,119 +415,83 @@ function stops(e, index, length) { for (let i = 0; i < data.itemList.length; i++) { // 插入顶部 if (data.itemList[i].showTopBorder) { - if (isNumber(index)) { - const Value = data.itemList[index]; - data.itemList.unshift(Value); - data.itemList.splice(index + 1, 1); - } else { + if (!isNumber(index)) { + // 从二级到顶部 const arr = index.split('-'); const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; - data.itemList.unshift(Value); - data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); - // const options = { - // id: Value.id, - // parentId: 0, - // }; + const options = { businessCode: Value.businessCode, moveProjectId: Value.id, targetProjectId: '', }; emit('change', options); + } else { + // 从一级到顶部 + emit('change', data.itemList); } // 清空 clearSet(i); - emit('change', data.itemList); return; - } + } + // 插入一级项目 if (data.itemList[i].showBorder) { - if (isNumber(index)) { - const Value = data.itemList[index]; - data.itemList.splice(i + 1, 0, Value); - if (i < index) { - data.itemList.splice(index + 1, 1); - } else { - data.itemList.splice(index, 1); - } - } else { + if (!isNumber(index)) { + // 从二级到一级 const arr = index.split('-'); - const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; - data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); - data.itemList.splice(i + 1, 0, Value); - // const options = { - // id: Value.id, - // parentId: 0, - // }; + const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; + const options = { businessCode: Value.businessCode, moveProjectId: Value.id, targetProjectId: '', }; emit('change', options); + } else { + // 从一级到一级 + emit('change', data.itemList); } // 清空 clearSet(i); - emit('change', data.itemList); return; - } + } + // 插入二级项目 if (data.itemList[i].showSubBorder) { - if (isNumber(index)) { - const Value = data.itemList[index]; - if (data.itemList[lastIndex - 1].sonProjectList && data.itemList[lastIndex - 1].sonProjectList.length) { - data.itemList[lastIndex - 1].sonProjectList.push(Value); - } else { - data.itemList[lastIndex].sonProjectList = [Value]; - } - data.itemList.splice(index, 1); - // 清空 - clearSet(i); - // const options = { - // id: Value.id, - // parentId: data.itemList[lastIndex - 1].id, - // }; + if (isNumber(index)) { + // 从一级到二级 + const Value = data.itemList[index]; + + let targetProjectId = ''; + if (index === i) { + targetProjectId = data.itemList[i-1].id; + } else { + targetProjectId = data.itemList[i].id; + } + const options = { businessCode: Value.businessCode, moveProjectId: Value.id, - targetProjectId: data.itemList[lastIndex - 1].id, + targetProjectId: targetProjectId, }; emit('change', options); - } else { + } else { + // 从二级到二级 const arr = index.split('-'); const Value = data.itemList[arr[0] - 0].sonProjectList[arr[1] - 0]; - if (data.itemList[lastIndex].sonProjectList && data.itemList[lastIndex].sonProjectList.length) { - data.itemList[lastIndex].sonProjectList.push(Value); - } else { - data.itemList[lastIndex].sonProjectList = [Value]; - } - data.itemList[arr[0] - 0].sonProjectList.splice([arr[1] - 0], 1); - // 清空 - clearSet(i); - // const options = { - // id: Value.id, - // parentId: data.itemList[lastIndex].id, - // }; + const options = { businessCode: Value.businessCode, moveProjectId: Value.id, targetProjectId: data.itemList[lastIndex].id, }; emit('change', options); - - // const options1 = { - // id: Value.id, - // parentId: 0, - // }; - const options1 = { - businessCode: Value.businessCode, - moveProjectId: Value.id, - targetProjectId: '', - }; - emit('change', options1); - } + } + // 清空 + clearSet(i); return; } } @@ -528,32 +507,37 @@ function clearSet(i) { data.deltaLeft == 0; data.showMoveImage = false; - data.setSubItem = false; + // data.setSubItem = false; // data.changeEvent = false; data.showItemIndex = undefined; } // 找到停下的元素的下标 function findOverIndex(posY) { - // 如果有子项目展开着 - const leng = data.itemList.length * data.itemHeight; // 最后一个元素距离顶部的距离 - if (posY < data.begintop) { + if (posY < data.begintop) { // 移动到第一个项目之前 return -1; - } + } + for (let i = 0; i < data.itemList.length; i++) { - const begin = data.itemHeight * i + data.begintop; - const end = data.itemHeight * i + data.begintop + data.itemHeight; + const begin = 65 * i + data.begintop; + const end = data.begintop + 65 * i + data.itemHeight; if (begin <= posY && end >= posY) { return i; } - } - if (posY > leng) { + } + + // 总数量 + let allNum = data.itemList.length; + data.itemList.forEach(item => { + if (item.show) { + allNum += item.sonProjectList.length; + } + }) + const leng = allNum * 65; // 最后一个元素距离顶部的距离 + if (posY > (leng + data.begintop)) { // 交换最后一个 return data.itemList.length - 1; } - if (posY < data.begintop) { - return 0; - } } // 删除项目 @@ -683,7 +667,11 @@ function openMenu(project, index) { } - diff --git a/components/Projects/ProjectItem.vue b/components/Projects/ProjectItem.vue index d0ab994..1cb06da 100644 --- a/components/Projects/ProjectItem.vue +++ b/components/Projects/ProjectItem.vue @@ -18,7 +18,7 @@ - 工作台 + {{ item.remindNum > 99 ? '99+' : item.remindNum }} diff --git a/components/Projects/Projects.vue b/components/Projects/Projects.vue index 58aa3a0..e12f16e 100644 --- a/components/Projects/Projects.vue +++ b/components/Projects/Projects.vue @@ -15,7 +15,8 @@ // projectIdList.push(item.id); // arr.push(item.name); // }); - // setProjectSort(projectIdList); + // setProjectSort(projectIdList); + emit('getProjects'); } else { setProjectRelation(options); } diff --git a/manifest.json b/manifest.json index 827b9ab..e8da0ef 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "时物链条2", "appid" : "__UNI__6207504", "description" : "", - "versionName" : "1.0.8", + "versionName" : "1.0.10", "versionCode" : "100", "transformPx" : false, /* 5+App特有相关 */ diff --git a/uni_modules/vk-uview-ui/components/u-parse/libs/MpHtmlParser.js b/uni_modules/vk-uview-ui/components/u-parse/libs/MpHtmlParser.js index a829fab..b0e663c 100644 --- a/uni_modules/vk-uview-ui/components/u-parse/libs/MpHtmlParser.js +++ b/uni_modules/vk-uview-ui/components/u-parse/libs/MpHtmlParser.js @@ -536,6 +536,7 @@ MpHtmlParser.prototype.TagName = function(c) { } MpHtmlParser.prototype.AttrName = function(c) { if (c == '=' || blankChar[c] || this.isClose()) { + console.log('6666666666666') this.attrName = this.section(); if (blankChar[c]) while (blankChar[this.data[++this.i]]);