Commit fb633749 by 前端

多组件内容重复解决

1 parent f8df7209
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
> >
<label slot="label" class="required">分享素材:</label> <label slot="label" class="required">分享素材:</label>
<GLEditor <GLEditor
:id="'missionList' + index1 + 'welcome'" :key="'missionList' + itm.id + 'welcome'"
ref="welcome" ref="welcome"
:form="'customer'" :form="'customer'"
style="line-height: 12px" style="line-height: 12px"
...@@ -403,6 +403,7 @@ export default { ...@@ -403,6 +403,7 @@ export default {
activityImage: '', activityImage: '',
// 公共任务类型 // 公共任务类型
basicObj: { basicObj: {
id: '',
missonType: '', missonType: '',
missionName: '', missionName: '',
missonDesc: '', missonDesc: '',
...@@ -663,6 +664,8 @@ export default { ...@@ -663,6 +664,8 @@ export default {
this.taskList[index].missionList.unshift({ this.taskList[index].missionList.unshift({
...this.basicObj, ...this.basicObj,
}) })
this.taskList[index].missionList[0].id = this.getUuid()
console.log(this.taskList[index].missionList[0])
}, },
// 任务选择类型切换 // 任务选择类型切换
selectTaskType(dateTask, dateTaskIndex, task, taskIndex) { selectTaskType(dateTask, dateTaskIndex, task, taskIndex) {
...@@ -710,7 +713,9 @@ export default { ...@@ -710,7 +713,9 @@ export default {
taskItem = { ...this.basicObj } taskItem = { ...this.basicObj }
} }
taskItem.missonType = task.missonType taskItem.missonType = task.missonType
taskItem.id = task.id
this.$set(this.taskList[dateTaskIndex].missionList, taskIndex, taskItem) this.$set(this.taskList[dateTaskIndex].missionList, taskIndex, taskItem)
console.log(this.taskList[dateTaskIndex].missionList)
}, },
// 获取分享素材内容 // 获取分享素材内容
getEditor(dateTask, dateTaskIndex, task, taskIndex) { getEditor(dateTask, dateTaskIndex, task, taskIndex) {
...@@ -922,6 +927,7 @@ export default { ...@@ -922,6 +927,7 @@ export default {
if (itm.repeatCount || itm.repeatFlag) { if (itm.repeatCount || itm.repeatFlag) {
itm.repeatCount = itm.repeatCount ? itm.repeatCount : -1 itm.repeatCount = itm.repeatCount ? itm.repeatCount : -1
} }
delete itm.id
}) })
}) })
try { try {
...@@ -1015,6 +1021,48 @@ export default { ...@@ -1015,6 +1021,48 @@ export default {
]) ])
this.$root.close('*添加任务模板') this.$root.close('*添加任务模板')
}, },
// 生成唯一uuid
getUuid() {
if (typeof crypto === 'object') {
if (typeof crypto.randomUUID === 'function') {
return crypto.randomUUID()
}
if (
typeof crypto.getRandomValues === 'function' &&
typeof Uint8Array === 'function'
) {
const callback = (c) => {
const num = Number(c)
return (
num ^
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))
).toString(16)
}
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(
/[018]/g,
callback
)
}
}
let timestamp = new Date().getTime()
let perforNow =
(typeof performance !== 'undefined' &&
performance.now &&
performance.now() * 1000) ||
0
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
let random = Math.random() * 16
if (timestamp > 0) {
random = (timestamp + random) % 16 | 0
timestamp = Math.floor(timestamp / 16)
} else {
random = (perforNow + random) % 16 | 0
perforNow = Math.floor(perforNow / 16)
}
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
})
},
}, },
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!