Skip to content

Commit 118f32a

Browse files
YunaiVgitee-org
authored andcommitted
!136 同步 2023-04-22 最新迭代的内容
Merge pull request !136 from 芋道源码/dev
2 parents a364d57 + c14b5c5 commit 118f32a

File tree

51 files changed

+909
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+909
-697
lines changed

src/views/Login/components/LoginForm.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,21 @@
125125
</div>
126126
</el-form-item>
127127
</el-col>
128+
<el-divider content-position="center">萌新必读</el-divider>
129+
<el-col :span="24" style="padding-left: 10px; padding-right: 10px">
130+
<el-form-item>
131+
<div class="flex justify-between w-[100%]">
132+
<el-link href="https://doc.iocoder.cn/" target="_blank">📚开发指南</el-link>
133+
<el-link href="https://doc.iocoder.cn/video/" target="_blank">🔥视频教程</el-link>
134+
<el-link href="https://www.iocoder.cn/Interview/good-collection/" target="_blank">
135+
⚡面试手册
136+
</el-link>
137+
<el-link href="http://static.yudao.iocoder.cn/mp/Aix9975.jpeg" target="_blank">
138+
🤝外包咨询
139+
</el-link>
140+
</div>
141+
</el-form-item>
142+
</el-col>
128143
</el-row>
129144
</el-form>
130145
</template>

src/views/mp/account/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
v-if="scope.row.qrCodeUrl"
4747
:src="scope.row.qrCodeUrl"
4848
alt="二维码"
49-
style="height: 100px; display: inline-block"
49+
style="display: inline-block; height: 100px"
5050
/>
5151
<el-button
5252
link

src/views/mp/autoReply/components/ReplyTable.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@
9494
</el-table>
9595
</template>
9696
<script setup lang="ts">
97-
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'
98-
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'
99-
import WxMusic from '@/views/mp/components/wx-music/main.vue'
100-
import WxNews from '@/views/mp/components/wx-news/main.vue'
97+
import WxVideoPlayer from '@/views/mp/components/wx-video-play'
98+
import WxVoicePlayer from '@/views/mp/components/wx-voice-play'
99+
import WxMusic from '@/views/mp/components/wx-music'
100+
import WxNews from '@/views/mp/components/wx-news'
101101
import { dateFormatter } from '@/utils/formatTime'
102102
import { DICT_TYPE } from '@/utils/dict'
103103
import { MsgType } from './types'

src/views/mp/autoReply/components/types.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,3 @@ export enum MsgType {
55
Message = 2,
66
Keyword = 3
77
}
8-
9-
type ReplyType = 'text' | 'image' | 'voice' | 'video' | 'shortvideo' | 'location' | 'link'
10-
11-
export interface ReplyForm {
12-
// relation:
13-
id?: number
14-
accountId?: number
15-
type?: MsgType
16-
// request:
17-
requestMessageType?: ReplyType
18-
requestMatch?: number
19-
requestKeyword?: string
20-
// response:
21-
responseMessageType?: ReplyType
22-
responseContent?: string
23-
responseMediaId?: number
24-
responseMediaUrl?: string
25-
responseTitle?: string
26-
responseDescription?: number
27-
responseThumbMediaId?: string
28-
responseThumbMediaUrl?: string
29-
responseArticles?: any[]
30-
responseMusicUrl?: string
31-
responseHqMusicUrl?: string
32-
}
33-
34-
// TODO @Dhb52:ObjData 这个类名可以在看看,ObjData 有点通用
35-
export interface ObjData {
36-
type: ReplyType
37-
accountId?: number
38-
content?: string
39-
mediaId?: number
40-
url?: string
41-
title?: string
42-
description?: string
43-
thumbMediaId?: number
44-
thumbMediaUrl?: string
45-
articles?: any[]
46-
musicUrl?: string
47-
hqMusicUrl?: string
48-
}

src/views/mp/autoReply/index.vue

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<el-input v-model="replyForm.requestKeyword" placeholder="请输入内容" clearable />
8383
</el-form-item>
8484
<el-form-item label="回复消息">
85-
<WxReplySelect :objData="objData" />
85+
<WxReplySelect v-model="reply" />
8686
</el-form-item>
8787
</el-form>
8888
<template #footer>
@@ -93,41 +93,41 @@
9393
</ContentWrap>
9494
</template>
9595
<script setup lang="ts" name="MpAutoReply">
96-
import WxReplySelect from '@/views/mp/components/wx-reply/main.vue'
97-
import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
96+
import WxReplySelect, { type Reply, ReplyType } from '@/views/mp/components/wx-reply'
97+
import WxAccountSelect from '@/views/mp/components/wx-account-select'
9898
import * as MpAutoReplyApi from '@/api/mp/autoReply'
9999
import { DICT_TYPE, getDictOptions, getIntDictOptions } from '@/utils/dict'
100100
import { ContentWrap } from '@/components/ContentWrap'
101-
import type { TabPaneName } from 'element-plus'
101+
import type { FormInstance, TabPaneName } from 'element-plus'
102102
import ReplyTable from './components/ReplyTable.vue'
103-
import { MsgType, ReplyForm, ObjData } from './components/types'
103+
import { MsgType } from './components/types'
104104
const message = useMessage() // 消息
105105
106106
const msgType = ref<MsgType>(MsgType.Keyword) // 消息类型
107107
const RequestMessageTypes = ['text', 'image', 'voice', 'video', 'shortvideo', 'location', 'link'] // 允许选择的请求消息类型
108108
const loading = ref(true) // 遮罩层
109109
const total = ref(0) // 总条数
110110
const list = ref<any[]>([]) // 自动回复列表
111-
const formRef = ref() // 表单 ref
111+
const formRef = ref<FormInstance | null>(null) // 表单 ref
112112
// 查询参数
113113
interface QueryParams {
114114
pageNo: number
115115
pageSize: number
116-
accountId?: number
116+
accountId: number
117117
}
118118
const queryParams: QueryParams = reactive({
119119
pageNo: 1,
120120
pageSize: 10,
121-
accountId: undefined
121+
accountId: 0
122122
})
123123
124124
const dialogTitle = ref('') // 弹出层标题
125125
const showFormDialog = ref(false) // 是否显示弹出层
126-
const replyForm = ref<ReplyForm>({}) // 表单参数
126+
const replyForm = ref<any>({}) // 表单参数
127127
// 回复消息
128-
const objData = ref<ObjData>({
129-
type: 'text',
130-
accountId: undefined
128+
const reply = ref<Reply>({
129+
type: ReplyType.Text,
130+
accountId: 0
131131
})
132132
// 表单校验
133133
const rules = {
@@ -136,8 +136,9 @@ const rules = {
136136
}
137137
138138
/** 侦听账号变化 */
139-
const onAccountChanged = (id?: number) => {
139+
const onAccountChanged = (id: number) => {
140140
queryParams.accountId = id
141+
reply.value.accountId = id
141142
getList()
142143
}
143144
@@ -171,8 +172,8 @@ const onTabChange = (tabName: TabPaneName) => {
171172
const onCreate = () => {
172173
reset()
173174
// 打开表单,并设置初始化
174-
objData.value = {
175-
type: 'text',
175+
reply.value = {
176+
type: ReplyType.Text,
176177
accountId: queryParams.accountId
177178
}
178179
@@ -193,7 +194,7 @@ const onUpdate = async (id: number) => {
193194
delete replyForm.value['responseMediaUrl']
194195
delete replyForm.value['responseDescription']
195196
delete replyForm.value['responseArticles']
196-
objData.value = {
197+
reply.value = {
197198
type: data.responseMessageType,
198199
accountId: queryParams.accountId,
199200
content: data.responseContent,
@@ -227,17 +228,17 @@ const onSubmit = async () => {
227228
228229
// 处理回复消息
229230
const submitForm: any = { ...replyForm.value }
230-
submitForm.responseMessageType = objData.value.type
231-
submitForm.responseContent = objData.value.content
232-
submitForm.responseMediaId = objData.value.mediaId
233-
submitForm.responseMediaUrl = objData.value.url
234-
submitForm.responseTitle = objData.value.title
235-
submitForm.responseDescription = objData.value.description
236-
submitForm.responseThumbMediaId = objData.value.thumbMediaId
237-
submitForm.responseThumbMediaUrl = objData.value.thumbMediaUrl
238-
submitForm.responseArticles = objData.value.articles
239-
submitForm.responseMusicUrl = objData.value.musicUrl
240-
submitForm.responseHqMusicUrl = objData.value.hqMusicUrl
231+
submitForm.responseMessageType = reply.value.type
232+
submitForm.responseContent = reply.value.content
233+
submitForm.responseMediaId = reply.value.mediaId
234+
submitForm.responseMediaUrl = reply.value.url
235+
submitForm.responseTitle = reply.value.title
236+
submitForm.responseDescription = reply.value.description
237+
submitForm.responseThumbMediaId = reply.value.thumbMediaId
238+
submitForm.responseThumbMediaUrl = reply.value.thumbMediaUrl
239+
submitForm.responseArticles = reply.value.articles
240+
submitForm.responseMusicUrl = reply.value.musicUrl
241+
submitForm.responseHqMusicUrl = reply.value.hqMusicUrl
241242
242243
if (replyForm.value.id !== undefined) {
243244
await MpAutoReplyApi.updateAutoReply(submitForm)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import WxAccountSelect from './main.vue'
2+
3+
export default WxAccountSelect

src/views/mp/components/wx-account-select/main.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,27 @@ const account: MpAccountApi.AccountVO = reactive({
1414
const accountList: Ref<MpAccountApi.AccountVO[]> = ref([])
1515
1616
const emit = defineEmits<{
17-
(e: 'change', id?: number, name?: string): void
17+
(e: 'change', id: number, name: string): void
1818
}>()
1919
2020
const handleQuery = async () => {
2121
accountList.value = await MpAccountApi.getSimpleAccountList()
2222
// 默认选中第一个
2323
if (accountList.value.length > 0) {
2424
account.id = accountList.value[0].id
25-
account.name = accountList.value[0].name
26-
emit('change', account.id, account.name)
25+
if (account.id) {
26+
account.name = accountList.value[0].name
27+
emit('change', account.id, account.name)
28+
}
2729
}
2830
}
2931
3032
const onChanged = (id?: number) => {
3133
const found = accountList.value.find((v) => v.id === id)
32-
account.name = found ? found.name : ''
33-
emit('change', account.id, account.name)
34+
if (account.id) {
35+
account.name = found ? found.name : ''
36+
emit('change', account.id, account.name)
37+
}
3438
}
3539
3640
/** 初始化 */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import WxLocation from './main.vue'
2+
3+
export default WxLocation
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import WxMaterialSelect from './main.vue'
2+
import { NewsType, MaterialType } from './types'
3+
4+
export { NewsType, MaterialType }
5+
6+
export default WxMaterialSelect

0 commit comments

Comments
 (0)