REVIEW 公众号的实现

(cherry picked from commit 1a1bfe0ebb)
pull/173/head
YunaiV 2023-04-13 22:25:35 +08:00 committed by shizhong
parent 0da3c00dea
commit df41b6860e
7 changed files with 20 additions and 28 deletions

View File

@ -79,7 +79,8 @@ const include = [
'element-plus/es/components/dropdown-item/style/css', 'element-plus/es/components/dropdown-item/style/css',
'element-plus/es/components/badge/style/css', 'element-plus/es/components/badge/style/css',
'element-plus/es/components/breadcrumb/style/css', 'element-plus/es/components/breadcrumb/style/css',
'element-plus/es/components/breadcrumb-item/style/css' 'element-plus/es/components/breadcrumb-item/style/css',
'element-plus/es/components/image/style/css'
] ]
const exclude = ['@iconify/json'] const exclude = ['@iconify/json']

View File

@ -3,7 +3,7 @@
<el-option v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</template> </template>
<!-- TODO @芋艿WxMpSelect 改成 WxAccountSelect然后挪到现有的 wx-account-select 包下 -->
<script lang="ts" setup name="WxMpSelect"> <script lang="ts" setup name="WxMpSelect">
import * as MpAccountApi from '@/api/mp/account' import * as MpAccountApi from '@/api/mp/account'

View File

@ -102,5 +102,3 @@ const uploadError = () => {
</div> </div>
</div> </div>
</template> </template>
<style></style>

View File

@ -252,7 +252,6 @@ import * as MpFreePublishApi from '@/api/mp/freePublish'
import type { UploadFiles, UploadProps, UploadRawFile } from 'element-plus' import type { UploadFiles, UploadProps, UploadRawFile } from 'element-plus'
// API // API
// import drafts from './mock' // import drafts from './mock'
const message = useMessage() // const message = useMessage() //
const loading = ref(true) // const loading = ref(true) //
@ -362,7 +361,7 @@ const submitForm = async () => {
} finally { } finally {
dialogNewsVisible.value = false dialogNewsVisible.value = false
addMaterialLoading.value = false addMaterialLoading.value = false
getList() await getList()
} }
} }

View File

@ -276,14 +276,11 @@ const uploadRules: FormRules = {
} }
// //
type MatertialType = 'image' | 'voice' | 'video' type MaterialType = 'image' | 'voice' | 'video'
const type = ref<MatertialType>('image') const type = ref<MaterialType>('image')
// const loading = ref(false) //
const loading = ref(false) const list = ref<any[]>([]) //
// const total = ref(0) //
//
const list = ref<any[]>([])
const total = ref(0)
// //
interface QueryParams { interface QueryParams {
pageNo: number pageNo: number
@ -301,7 +298,7 @@ const queryParams: QueryParams = reactive({
const fileList = ref<UploadUserFile[]>([]) const fileList = ref<UploadUserFile[]>([])
interface UploadData { interface UploadData {
type: MatertialType type: MaterialType
title: string title: string
introduction: string introduction: string
} }
@ -345,7 +342,7 @@ const handleQuery = () => {
const onTabChange = (tabName: TabPaneName) => { const onTabChange = (tabName: TabPaneName) => {
// type // type
uploadData.type = tabName as MatertialType uploadData.type = tabName as MaterialType
// tab // tab
list.value = [] list.value = []

View File

@ -71,11 +71,10 @@
<TagForm ref="formRef" @success="getList" /> <TagForm ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts" name="MpTag"> <script setup lang="ts" name="MpTag">
import { dateFormatter } from '@/utils/formatTime'
import * as MpTagApi from '@/api/mp/tag' import * as MpTagApi from '@/api/mp/tag'
import TagForm from './TagForm.vue' import TagForm from './TagForm.vue'
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue' import WxMpSelect from '@/views/mp/components/WxMpSelect.vue'
import { dateFormatter } from '@/utils/formatTime'
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -93,7 +92,6 @@ const queryParams: QueryParams = reactive({
pageSize: 10, pageSize: 10,
accountId: undefined accountId: undefined
}) })
const formRef = ref<InstanceType<typeof TagForm> | null>(null) const formRef = ref<InstanceType<typeof TagForm> | null>(null)
/** 侦听公众号变化 **/ /** 侦听公众号变化 **/

View File

@ -121,15 +121,8 @@ const queryParams: QueryParams = reactive({
openid: null, openid: null,
nickname: null nickname: null
}) })
const tagList = ref<any[]>([]) //
const queryFormRef = ref<FormInstance | null>(null) // const queryFormRef = ref<FormInstance | null>(null) //
const formRef = ref<InstanceType<typeof UserForm> | null>(null) const tagList = ref<any[]>([]) //
/** 初始化 */
onMounted(async () => {
tagList.value = await MpTagApi.getSimpleTagList()
})
/** 侦听公众号变化 **/ /** 侦听公众号变化 **/
const onAccountChanged = (id?: number) => { const onAccountChanged = (id?: number) => {
@ -165,6 +158,7 @@ const resetQuery = () => {
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref<InstanceType<typeof UserForm> | null>(null)
const openForm = (id: number) => { const openForm = (id: number) => {
formRef.value?.open(id) formRef.value?.open(id)
} }
@ -175,7 +169,12 @@ const handleSync = async () => {
await message.confirm('是否确认同步粉丝?') await message.confirm('是否确认同步粉丝?')
await MpUserApi.syncUser(queryParams.accountId) await MpUserApi.syncUser(queryParams.accountId)
message.success('开始从微信公众号同步粉丝信息,同步需要一段时间,建议稍后再查询') message.success('开始从微信公众号同步粉丝信息,同步需要一段时间,建议稍后再查询')
getList() await getList()
} catch {} } catch {}
} }
/** 初始化 */
onMounted(async () => {
tagList.value = await MpTagApi.getSimpleTagList()
})
</script> </script>