浏览代码

公众号编辑用户反显问题

master
wangxyi 2 天前
父节点
当前提交
144d968411

+ 29
- 9
src/views/messagePush/pushManagement/components/selectUserId/index.vue 查看文件

<template> <template>
<el-popover placement="bottom-start" :width="width" trigger="click" v-model:visible="visible"> <el-popover placement="bottom-start" :width="width" trigger="click" v-model:visible="visible">
<template #reference> <template #reference>
<!-- {{ userInfo }} -->
<el-select clearable v-model="userInfo" placeholder="请选择接收消息的用户" popper-class="popper-content" style="width: 100%" <el-select clearable v-model="userInfo" placeholder="请选择接收消息的用户" popper-class="popper-content" style="width: 100%"
collapse-tags collapse-tags-tooltip @remove-tag="removeTag" multiple value-key="value"></el-select> collapse-tags collapse-tags-tooltip @remove-tag="removeTag" multiple value-key="value"></el-select>
</template> </template>
default: 400, default: 400,
}, },
modelValue: { modelValue: {
default: '',
type: Array,
default: () => [],
}, },
type: { type: {
default: '', default: '',
}, },
}) })
let isNum = false let isNum = false

// 监听 props.modelValue 变化,同步到本地变量
watchEffect(() => {
if (props.modelValue && props.modelValue.length > 0) {
localUserInfo.value = [...props.modelValue]
}
})

// 处理idList // 处理idList
watchEffect(() => { watchEffect(() => {
const userList = props.userList const userList = props.userList
// 支持多种匹配方式:openId、value、wxOpenid // 支持多种匹配方式:openId、value、wxOpenid
let data = tableData.value.find( let data = tableData.value.find(
(tableItem) => (tableItem) =>
tableItem.wxOpenid == item.openId
tableItem.wxOpenid == item.openId||
tableItem.mpOpenid == item.openId
) )
console.log(data,'table.data') console.log(data,'table.data')
// 如果找到了匹配的用户,使用实际的用户名,否则使用传入的标签 // 如果找到了匹配的用户,使用实际的用户名,否则使用传入的标签
const label = data ? (data.userName || data.mobile) : (item.label || item.openId || item.value)
console.log(label,'label')
// const label = data ? (data.userName || data.mobile) : (item.label || item.openId || item.value)
// console.log(label,'label')
userInfoData.push({ userInfoData.push({
label: label,
value: item.openId || item.value,
label: data?data.userName || data.mobile:'',
value:data?data.openId||data.mpOpenid:'',
// value: (data && (data.mpOpenid || data.wxOpenid || data.openId)) || item.mpOpenid || item.wxOpenid || item.openId || item.value,
}) })
console.log(userInfoData,'userInfoData') console.log(userInfoData,'userInfoData')
if (data) { if (data) {
} else { } else {
otherList.data = other otherList.data = other
} }
userInfo.value = userInfoData
handleInitSelect() //选择当前页数据
userInfo.value = [...userInfoData]
nextTick(() => {
console.log(userInfo.value,'userInfo.value')
handleInitSelect() //选择当前页数据
})
} }
// 切换页数 // 切换页数
const switchPage = () => { const switchPage = () => {
} }
} }


// 本地管理显示的数据
const localUserInfo = ref<any[]>([])

const userInfo = computed({ const userInfo = computed({
get: function () { get: function () {
return props.modelValue
return localUserInfo.value
}, },
set: function (newValue) { set: function (newValue) {
console.log(newValue,'newValue')
localUserInfo.value = newValue
emit('update:modelValue', newValue) emit('update:modelValue', newValue)
}, },
}) })

+ 2
- 1
src/views/messagePush/pushManagement/wechatOfficialAccounts/components/stepFrom/oneBasicInformation.vue 查看文件

console.log(ruleForm.mpOpenidList,'ruleForm.mpOpenidList') console.log(ruleForm.mpOpenidList,'ruleForm.mpOpenidList')
} }
// 然后处理其他字段
// 然后处理其他字段(避免覆盖已由子组件控制的 userInfo)
for (const key in ruleForm) { for (const key in ruleForm) {
if (key === 'userInfo') continue
const data = props.dataList[key] const data = props.dataList[key]
if (data || data === 0) { if (data || data === 0) {
ruleForm[key] = props.dataList[key] ruleForm[key] = props.dataList[key]

+ 6
- 6
src/views/messagePush/pushManagement/wechatOfficialAccounts/components/stepFrom/twoBasicInformation.vue 查看文件

console.error('Template data not found or content is empty') console.error('Template data not found or content is empty')
return return
} }
console.log(data, 'data不知道是啥')
console.log(data.content, 'data.content')
// console.log(data, 'data不知道是啥')
// console.log(data.content, 'data.content')
let content = data.content.split('\n') let content = data.content.split('\n')
console.log(content, 'content')
// console.log(content, 'content')
let dataArr: any = [] let dataArr: any = []
content.forEach((item) => { content.forEach((item) => {
// 业务名称:{{thing1.DATA}} // 业务名称:{{thing1.DATA}}
if (item && item.trim()) { if (item && item.trim()) {
console.log(item, 'item')
// console.log(item, 'item')
const arr = item.split(':') const arr = item.split(':')
console.log(arr, 'arr')
// console.log(arr, 'arr')
if (arr.length >= 2 && arr[1]) { if (arr.length >= 2 && arr[1]) {
const keyPart = arr[1].split('.')[0] const keyPart = arr[1].split('.')[0]
const key = keyPart && keyPart.length > 2 ? keyPart.substr(2) : arr[0] const key = keyPart && keyPart.length > 2 ? keyPart.substr(2) : arr[0]
key: arr[0] || item, key: arr[0] || item,
}) })
} }
console.log(dataArr, 'dataArr')
// console.log(dataArr, 'dataArr')
} }
}) })
// 过滤掉第一个和最后一个元素,但要确保数组有足够的元素 // 过滤掉第一个和最后一个元素,但要确保数组有足够的元素

正在加载...
取消
保存