feat: mp comps init
parent
5795521a99
commit
d9bb4105dd
|
@ -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 })
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -0,0 +1 @@
|
|||
<template><span>123</span> </template>
|
|
@ -0,0 +1,11 @@
|
|||
export enum NewsType {
|
||||
Draft = '2',
|
||||
Published = '1'
|
||||
}
|
||||
|
||||
export enum MaterialType {
|
||||
Image = 'image',
|
||||
Voice = 'voice',
|
||||
Video = 'video',
|
||||
News = 'news'
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
import wxAccountSelect from './WxAccountSelect/index.vue'
|
||||
|
||||
export { wxAccountSelect }
|
|
@ -1,3 +0,0 @@
|
|||
<template>
|
||||
<div>开发中</div>
|
||||
</template>
|
Loading…
Reference in New Issue