Compare commits
3 Commits
7932a53184
...
4bbf595d2b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bbf595d2b | ||
|
|
82366257e0 | ||
|
|
195ee1f0d1 |
@ -1,5 +1,5 @@
|
|||||||
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
|
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
|
||||||
NODE_ENV = 'production'
|
NODE_ENV = 'production'
|
||||||
VITE_APP_BASE_API = 'https://mini-chat.1024tool.vip/api'
|
VITE_APP_BASE_API = 'https://dsjhd9s.tbmw.cn/api/'
|
||||||
VITE_SERVE = "https://mini-chat.1024tool.vip/api/"
|
VITE_SERVE = "https://dsjhd9s.tbmw.cn/api/"
|
||||||
VITE_APP_BASE_API_img = "https://mini-chat.1024tool.vip/"
|
VITE_APP_BASE_API_img = "https://dsjhd9s.tbmw.cn/"
|
||||||
|
|||||||
1
components.d.ts
vendored
1
components.d.ts
vendored
@ -8,7 +8,6 @@ export {}
|
|||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
ChatRecord: typeof import('./src/components/ChatRecord/index.vue')['default']
|
ChatRecord: typeof import('./src/components/ChatRecord/index.vue')['default']
|
||||||
copy: typeof import('./src/components/UserCard copy/index.vue')['default']
|
|
||||||
ElAside: typeof import('element-plus/es')['ElAside']
|
ElAside: typeof import('element-plus/es')['ElAside']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
ElCard: typeof import('element-plus/es')['ElCard']
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
|
|||||||
@ -32,3 +32,12 @@ export const get_messages = (params) => {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const send_template_message = (data) => {
|
||||||
|
return request({
|
||||||
|
url: `wechat/subscribe`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -37,6 +37,14 @@
|
|||||||
>
|
>
|
||||||
{{ isSending ? '发送中...' : '发送' }}
|
{{ isSending ? '发送中...' : '发送' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="sendTemplateMessage"
|
||||||
|
:loading="isSending2"
|
||||||
|
style="height: 60px;"
|
||||||
|
>
|
||||||
|
{{ isSending2 ? '发送中...' : '发送模板消息' }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -50,7 +58,7 @@ import WxUserCard from '@/components/UserCard/index.vue'
|
|||||||
import UserMessage from '@/components/UserMessage/index.vue'
|
import UserMessage from '@/components/UserMessage/index.vue'
|
||||||
import mihoutai from '@/assets/images/mihoutai.png'
|
import mihoutai from '@/assets/images/mihoutai.png'
|
||||||
import V3Emoji from "vue3-emoji";
|
import V3Emoji from "vue3-emoji";
|
||||||
import { getUserList, send_message, get_messages } from '@/api/chat'
|
import { getUserList, send_message, get_messages, send_template_message } from '@/api/chat'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { uploadFile } from '@/api/upload'
|
import { uploadFile } from '@/api/upload'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
@ -835,6 +843,28 @@ const restartMessageTimer = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sendTemplateMessage = async (templateId) => {
|
||||||
|
if (!activeUser.value.sender_id) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
await send_template_message({
|
||||||
|
"app_id": route.query.app_id,
|
||||||
|
"app_secret": route.query.app_secret,
|
||||||
|
"template_id": route.query.template_id,
|
||||||
|
"touser": activeUser.value.sender_id
|
||||||
|
})
|
||||||
|
ElMessage({ type: 'success', message: '模板消息发送成功' })
|
||||||
|
|
||||||
|
// 发送成功后,立即轮询获取最新消息以获取真实ID
|
||||||
|
setTimeout(() => {
|
||||||
|
getMessages(false, 1) // 轮询最新消息
|
||||||
|
}, 500)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('模板消息发送失败:', error)
|
||||||
|
ElMessage({ type: 'error', message: '模板消息发送失败' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 组件挂载时
|
// 组件挂载时
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getUsers()
|
getUsers()
|
||||||
|
|||||||
@ -504,7 +504,7 @@ const uploadSuccess = (e) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleDetail = (row) => {
|
const handleDetail = (row) => {
|
||||||
router.push({ path: '/chat', query: { app_id: row.app_id } })
|
router.push({ path: '/chat', query: { app_id: row.app_id, app_secret: row.app_secret, template_id: row.template_id } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const qrCode = ref('')
|
const qrCode = ref('')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user