feat: mp comps init

pull/5/MERGE
xingyu 2023-04-25 14:10:17 +08:00
parent 5795521a99
commit d9bb4105dd
13 changed files with 128 additions and 3 deletions

View File

@ -1,5 +1,10 @@
import { defHttp } from '@/utils/http/axios'
export interface AccountVO {
id?: number
name: string
}
// 创建公众号账号
export function createAccount(data) {
return defHttp.post({ url: '/mp/account/create', data })

View File

@ -0,0 +1,43 @@
<template>
<Select v-model:value="account.id" placeholder="请选择公众号" class="!w-240px" @change="onChanged">
<SelectOption v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" />
</Select>
</template>
<script lang="ts" setup name="WxAccountSelect">
import { Select } from 'ant-design-vue'
import { AccountVO, getSimpleAccounts } from '@/api/mp/account'
import { onMounted, reactive, ref } from 'vue'
const SelectOption = Select.Option
const account = reactive<AccountVO>({
id: undefined,
name: ''
})
const accountList = ref<AccountVO[]>([])
const emit = defineEmits(['change'])
async function handleQuery() {
accountList.value = await getSimpleAccounts()
//
if (accountList.value.length > 0) {
account.id = accountList.value[0].id
if (account.id) {
account.name = accountList.value[0].name
emit('change', account.id, account.name)
}
}
}
function onChanged(id?: number) {
const found = accountList.value.find((v) => v.id === id)
if (account.id) {
account.name = found ? found.name : ''
emit('change', account.id, account.name)
}
}
/** 初始化 */
onMounted(() => {
handleQuery()
})
</script>

View File

@ -0,0 +1,65 @@
import { Image } from 'ant-design-vue';
<template>
<div>
<a-button
type="link"
target="_blank"
:href="
'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=' +
locationY +
'&pointy=' +
locationX +
'&name=' +
label +
'&ref=yudao'
"
>
<Image
:src="
'https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|' +
locationX +
',' +
locationY +
'&key=' +
qqMapKey +
'&size=250*180'
"
/>
<Icon icon="ep:location" />
{{ label }}
</a-button>
</div>
</template>
<script lang="ts" setup name="WxLocation">
import { Image } from 'ant-design-vue'
import Icon from '@/components/Icon'
const props = defineProps({
locationX: {
required: true,
type: Number
},
locationY: {
required: true,
type: Number
},
label: {
//
required: true,
type: String
},
qqMapKey: {
// QQ https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
required: false,
type: String,
default: 'TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E' //
}
})
defineExpose({
locationX: props.locationX,
locationY: props.locationY,
label: props.label,
qqMapKey: props.qqMapKey
})
</script>

View File

@ -0,0 +1 @@
<template><span>123</span> </template>

View File

@ -0,0 +1,11 @@
export enum NewsType {
Draft = '2',
Published = '1'
}
export enum MaterialType {
Image = 'image',
Voice = 'voice',
Video = 'video',
News = 'news'
}

View File

View File

View File

@ -0,0 +1,3 @@
import wxAccountSelect from './WxAccountSelect/index.vue'
export { wxAccountSelect }

View File

@ -1,3 +0,0 @@
<template>
<div>开发中</div>
</template>