|
|
@@ -93,7 +93,7 @@
|
|
|
}
|
|
|
// 保存tag参数
|
|
|
if(options.tag){
|
|
|
- this.tagParam = options.tag
|
|
|
+ this.tagParam = decodeURIComponent(options.tag)
|
|
|
}
|
|
|
|
|
|
// 获取状态栏高度
|
|
|
@@ -148,8 +148,11 @@
|
|
|
|
|
|
// 处理标签回显(区分系统标签和自定义标签)
|
|
|
handleTagDisplay(tagString) {
|
|
|
- const tagArray = tagString.split(',')
|
|
|
-
|
|
|
+ const tagArray = tagString
|
|
|
+ .split(',')
|
|
|
+ .map(tag => tag.trim())
|
|
|
+ .filter(tag => tag && tag !== '不限')
|
|
|
+
|
|
|
// 收集所有系统标签名称
|
|
|
const allSystemTags = []
|
|
|
this.operationOptions.forEach(category => {
|
|
|
@@ -159,27 +162,29 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
// 清空当前选中的标签
|
|
|
this.selectedOperation = []
|
|
|
this.customTags = []
|
|
|
-
|
|
|
+
|
|
|
// 遍历传入的标签,区分系统标签和自定义标签
|
|
|
tagArray.forEach(tag => {
|
|
|
- const trimmedTag = tag.trim()
|
|
|
- if (!trimmedTag) return // 跳过空标签
|
|
|
-
|
|
|
// 检查是否是系统标签
|
|
|
- if (allSystemTags.includes(trimmedTag)) {
|
|
|
- // 是系统标签
|
|
|
- if (!this.selectedOperation.includes(trimmedTag) && this.selectedOperation.length < 8) {
|
|
|
- this.selectedOperation.push(trimmedTag)
|
|
|
+ if (allSystemTags.includes(tag)) {
|
|
|
+ // 系统标签
|
|
|
+ if (
|
|
|
+ !this.selectedOperation.includes(tag) &&
|
|
|
+ this.selectedOperation.length < 20
|
|
|
+ ) {
|
|
|
+ this.selectedOperation.push(tag)
|
|
|
}
|
|
|
} else {
|
|
|
- // 是自定义标签
|
|
|
- if (this.customTags.length < 5 &&
|
|
|
- this.customTags.length + this.selectedOperation.length < 8) {
|
|
|
- this.customTags.push(trimmedTag)
|
|
|
+ // 自定义标签
|
|
|
+ if (
|
|
|
+ this.customTags.length < 5 &&
|
|
|
+ this.customTags.length + this.selectedOperation.length < 20
|
|
|
+ ) {
|
|
|
+ this.customTags.push(tag)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -187,10 +192,11 @@
|
|
|
|
|
|
toggleOperation(item) {
|
|
|
const index = this.selectedOperation.indexOf(item)
|
|
|
+ let realLength = this.customTags.filter(item => item !== '不限').length;
|
|
|
if (index > -1) {
|
|
|
this.selectedOperation.splice(index, 1)
|
|
|
} else {
|
|
|
- if (this.selectedOperation.length + this.customTags.length < 20) {
|
|
|
+ if (this.selectedOperation.length + realLength < 20) {
|
|
|
this.selectedOperation.push(item)
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
@@ -211,10 +217,11 @@
|
|
|
},
|
|
|
addCustomTag() {
|
|
|
if (this.newTagName.trim()) {
|
|
|
- if (this.customTags.length < 5) {
|
|
|
- if (this.customTags.length + this.selectedOperation.length >= 8) {
|
|
|
+ let realLength = this.customTags.filter(item => item !== '不限').length;
|
|
|
+ if (realLength < 5) {
|
|
|
+ if (realLength + this.selectedOperation.length >= 20) {
|
|
|
return uni.showToast({
|
|
|
- title: '最多选择8个标签',
|
|
|
+ title: '最多选择20个标签',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|