This commit is contained in:
yyx 2025-07-11 19:04:16 +08:00
parent 5818568014
commit 8df649c8ee
5 changed files with 89 additions and 31 deletions

View File

@ -52,7 +52,7 @@
</van-form>
<div class="footer">
<van-button type="primary" class="footer-button" @click="onSubmit">提交</van-button>
<van-button type="primary" v-if="!isView" class="footer-button" @click="onSubmit">提交</van-button>
</div>
<Pay v-model:showDialog="showPayCodeDialog" v-model:current_order="current_order"
@ -99,6 +99,7 @@ let task_title = ref("添加任务")
let template_info = {}
let group_info = {}
const isEdit = ref(false)
const isView = ref(false)
const onClickLeft = () => {
router.back()
}
@ -107,17 +108,20 @@ const onConfirm = ({ selectedOptions }) => {
form.template = selectedOptions[0]?.text;
form.temp_id = selectedOptions[0]?.value;
showPicker.value = false;
let template = template_info.find(item => item.id == selectedOptions[0]?.value)
let template = template_info?.find(item => item?.id == selectedOptions[0]?.value)
console.log(template);
let group_id = JSON.parse(template?.group_ids)
form.times = template?.times + '小时1次'
form.cycle = template?.cycle + '天'
form.price = template?.price
let filter_groups = group_id.map(id => {
return group_info.find(item => item.id == id).tg_name + '@' + group_info.find(item => item.id == id).tg_url
})
form.group = filter_groups.join(',');
if (template) {
let group_id = template?.group_ids ? JSON.parse(template?.group_ids) : []
form.times = template?.times + '小时1次'
form.cycle = template?.cycle + '天'
form.price = template?.price
let filter_groups = group_id.map(id => {
return group_info.find(item => item.id == id).tg_name + '@' + group_info.find(item => item.id == id).tg_url
})
form.group = filter_groups.join(',');
}
};
const onTypeConfirm = ({ selectedOptions }) => {
@ -227,6 +231,13 @@ onBeforeMount(async () => {
form.next_run_time = current_task_info.next_run_time
form.tg_title = current_task_info.tg_title
isEdit.value = true
isView.value = current_task_info.type == 'view'
if (current_task_info.type == 'view') {
task_title.value = '查看任务'
}
if (current_task_info.type == 'edit') {
task_title.value = '编辑任务'
}
}
})
@ -244,6 +255,9 @@ const handleConfrimPay = (val = '', type) => {
const closePay = () => {
router.push('/h5')
}
const goBack = () => {
router.push('/h5')
}
onMounted(() => {
})

View File

@ -4,6 +4,7 @@
<van-search v-model="search" placeholder="请输入任务名称进行搜索" @search="onSearch" @clear="onSearch" />
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<div v-for="item in list" :key="item.id" class="item">
<div>任务ID{{ item.id }}</div>
<div>任务名称{{ item.title }}</div>
<div>模板名称{{ item.temp_name }}</div>
<div>模板类型{{ item.temp_type === 1 ? '预设模板' : '定制模板' }}</div>
@ -44,23 +45,32 @@
<van-tag type="success" v-if="item.order_status == 2 || item.order_status == 5">
{{order_status?.find(o => o.value == item.order_status)?.label}}</van-tag>
</div>
<div class="item-btns">
<van-button type="primary"
v-if="item.status == 0 || item.status == 1 || item.status == 3 || item.status == 5" size="small"
style="margin-left: 12px;" @click="addTask(item)">编辑</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;"
v-if="item.order_status == 0 || item.order_status == 8" @click="payTask(item)">支付</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;" v-if="item.status == 5"
@click="handleTask(item.id, '2')">执行</van-button>
<van-button type="primary" size="small" v-if="item.status == 2" style="margin-left: 12px;"
@click="handleTask(item.id, '5')">暂停</van-button>
<van-button type="danger" size="small" style="margin-left: 12px;"
v-if="item.status == 6 || item.status == 0" @click="deleteTask(item.id)">删除</van-button>
<div class="buttons-groups">
<div>
<van-button type="primary" size="small" @click="viewRecord(item)">群发记录</van-button>
</div>
<div class="item-btns">
<van-button type="primary" size="small" style="margin-left: 12px;"
@click="addTask(item, 'view')">查看</van-button>
<van-button type="primary"
v-if="item.status == 0 || item.status == 1 || item.status == 3 || item.status == 5"
size="small" style="margin-left: 12px;" @click="addTask(item, 'edit')">编辑</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;"
v-if="item.order_status == 0 || item.order_status == 8"
@click="payTask(item)">支付</van-button>
<van-button type="primary" size="small" style="margin-left: 12px;" v-if="item.status == 5"
@click="handleTask(item.id, '2')">执行</van-button>
<van-button type="primary" size="small" v-if="item.status == 2" style="margin-left: 12px;"
@click="handleTask(item.id, '5')">暂停</van-button>
<van-button type="danger" size="small" style="margin-left: 12px;"
v-if="item.status == 6 || item.status == 0" @click="deleteTask(item.id)">删除</van-button>
</div>
</div>
</div>
</van-list>
<div class="footer">
<van-button type="primary" size="small" class="footer-button" @click="addTask('')">创建任务</van-button>
<van-button type="primary" size="small" class="footer-button" @click="addTask('', '')">创建任务</van-button>
</div>
<Pay v-model:showDialog="showPayCodeDialog" v-model:current_order="current_order"
@handleConfrimPay="handleConfrimPay"></Pay>
@ -180,9 +190,10 @@ const goPage = (url) => {
console.log('goPage', url)
window.open(url)
}
const addTask = (row = '') => {
const addTask = (row = '', type = '') => {
console.log('addTask', row)
if (row.id) {
row.type = type
localStorage.setItem('current_task_info', JSON.stringify(row))
} else {
localStorage.removeItem('current_task_info')
@ -249,6 +260,12 @@ const deleteTask = (id) => {
});
}
const viewRecord = (row) => {
localStorage.setItem('current_task_id', row.id)
router.push({
path: '/h5/mass_send',
})
}
</script>
<style lang="scss">
@ -263,11 +280,16 @@ const deleteTask = (id) => {
border-radius: 24px;
padding: 12px;
.buttons-groups {
display: flex;
justify-content: space-between;
margin-top: 8px;
}
.item-btns {
display: flex;
align-items: flex-end;
justify-content: flex-end;
margin-top: 8px;
}
}

View File

@ -54,6 +54,7 @@ const editUserInfo = () => {
router.push('/h5/detail')
}
const goPage = (url) => {
localStorage.setItem('current_task_id', '')
router.push(url)
}
</script>

View File

@ -10,8 +10,13 @@
1 ? '成功' : '失败'
}}</van-tag></div>
<div><span>发送时间</span>{{ dayjs(item.updated_at).format('YYYY-MM-DD HH:mm:ss') }}</div>
<div><span>发送群组</span>{{ item.group_name }}</div>
<div @click="goPage(item.send_url)"><span>发送链接</span>{{ item.send_url }}</div>
<div v-if="item.group_id" @click="goPage(groupsList.find(g => g.id ==
item.group_id).tg_url)"><span>发送群组:</span><a target="_blank" href="#">{{groupsList.find(g => g.id
==
item.group_id).tg_url}}</a></div>
<div @click="goPage(getMessageUrl(item))"><span>发送链接</span> <a style="color: #1989fa;" target="_blank"
href="#">{{
getMessageUrl(item) }}</a></div>
<div><span>失败原因</span> {{ showReason(item.reason) }}</div>
@ -20,9 +25,9 @@
</div>
</template>
<script setup>
import { ref, onBeforeMount } from 'vue';
import { useRouter } from 'vue-router';
import { getMassSend } from '@/axios/request';
import { ref, onBeforeMount, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { getMassSend, getGroupsList } from '@/axios/request';
import dayjs from 'dayjs';
const router = useRouter();
@ -42,6 +47,7 @@ const onLoad = async () => {
})
console.log('list', res)
if (currentPage == 1) {
list.value = []
list.value = res.data
} else {
list.value = list.value.concat(res.data)
@ -57,6 +63,21 @@ const onSearch = () => {
currentPage = 1
onLoad()
}
const groupsList = ref([])
onBeforeMount(async () => {
})
onMounted(async () => {
search.value = localStorage.getItem('current_task_id')
groupsList.value = await getGroupsList({ pagination: 'off' })
console.log('groupList', groupsList.value)
})
const getMessageUrl = (row) => {
let message_id = row?.tg_message_id;
let chat_id = row?.chat_id;
return `https://t.me/c/${chat_id}/${message_id}`
};
const goPage = (url) => {

View File

@ -23,7 +23,7 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://192.168.2.79',
target: 'http://128.1.34.17:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api'),
},