This commit is contained in:
qsh
2024-12-26 17:12:11 +08:00
parent 21ff3718bd
commit ac70a128c1
6 changed files with 337 additions and 166 deletions

View File

@@ -10,23 +10,28 @@
</el-checkbox-group>
</template>
</el-table-column>
<el-table-column label="微信群名称" min-width="150">
<el-table-column label="群二维码" width="100">
<template #default="{ row }">
<el-input
v-if="row.sendType.includes('微信群')"
v-model="row.wxGroup"
size="small"
clearable
@input="rowChange(row)"
/>
<span v-else>{{ row.wxGroup }}</span>
</template>
</el-table-column>
<el-table-column label="群二维码" width="90">
<template #default="{ row }">
<img :src="row.wxCode" width="80px" height="80px" alt="" />
<el-upload
ref="rewardFile"
action="#"
:limit="1"
accept=".jpg,.jpeg,.png"
:disabled="loading"
:show-file-list="false"
:before-upload="fileBeforeUpload"
:http-request="(data) => rewardUpload(data, row.id)"
>
<el-button type="primary" size="small">
<Icon icon="ep:upload" class="mr-5px" size="small" /> 点击上传
</el-button>
</el-upload>
<!-- <UploadImg v-model="row.wxQrCode" /> -->
<!-- <img :src="row.wxCode" width="80px" height="80px" alt="" /> -->
</template>
</el-table-column>
<el-table-column label="微信群名称" prop="wxGroup" min-width="150" />
<el-table-column label="操作" width="100">
<template #default="{ row }">
<!-- <div>
@@ -190,6 +195,34 @@ async function submitSendTime() {
}
}
}
const fileBeforeUpload = (file) => {
let format = '.' + file.name.split('.')[1]
if (!['.jpg', '.png', 'jpeg'].includes(format)) {
message.error(`请上传指定格式".jpg,.jpeg,.png"文件`)
return false
}
let isRightSize = file.size / 1024 / 1024 < 20
if (!isRightSize) {
message.error('文件大小超过 20MB')
}
return isRightSize
}
const fd = ref(new FormData())
async function rewardUpload(data, id) {
fd.value.append('file', data.file)
fd.value.append('id', id)
// 上传接口,成功后得到微信群名
try {
// 上传文件
setTimeout(() => {
getTableList()
}, 2000)
} finally {
}
}
</script>
<style lang="scss" scoped></style>