Introducing new features. 优化微信公众号

This commit is contained in:
aeizzz 2023-03-02 13:20:58 +08:00
parent 7a928715d4
commit 8d55645309
7 changed files with 179 additions and 4499 deletions

4486
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -92,7 +92,6 @@ export function useTable(options?: BasicTableProps) {
descs: state.descs,
ascs: state.ascs
}).then((res: any) => {
console.log(res,'resss')
state.dataList = state.isPage ? res.data[state.props.item] : res.data
state.pagination!.total = state.isPage ? res.data[state.props.totalCount] : 0
}).catch((err: any) => {

View File

@ -0,0 +1,150 @@
<template>
<el-dialog v-model="visible" :close-on-click-modal="false"
:title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable>
<el-form ref="dataFormRef" v-loading="loading" :model="form" :rules="dataRules" label-width="90px">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item :label="t('fans.wxAccountName')" prop="wxAccountName">
<el-input v-model="form.wxAccountName" disabled/>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item :label="t('fans.wxAccountAppid')" prop="wxAccountAppid">
<el-input v-model="form.wxAccountAppid" disabled/>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item :label="t('fans.openid')" prop="openid">
<el-input v-model="form.openid" disabled/>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item :label="t('fans.nickname')" prop="nickname">
<el-input v-model="form.nickname" disabled/>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item :label="t('fans.remark')" prop="remark">
<el-input v-model="form.remark" :placeholder="t('fans.inputremarkTip')"/>
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item :label="t('fans.tagIds')" prop="tagIds">
<el-select v-model="form.tagIds" :placeholder="t('fans.inputTagTip')" class="w100" clearable multiple>
<el-option v-for="item in tagOption" :key="item.tagId" :label="item.tag" :value="item.tagId"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" name="wx-fans" setup>
import {addObj, getObj, putObj} from "/@/api/mp/wx-account-fans";
import {list} from '/@/api/mp/wx-account-tag'
import {useMessage} from "/@/hooks/message";
import {useI18n} from "vue-i18n"
const {t} = useI18n();
const emit = defineEmits(['refresh']);
//
const dataFormRef = ref();
const visible = ref(false)
const loading = ref(false)
const wxAccountAppid = ref()
//
const form = reactive({
id: ''
});
const dataRules = ref([])
//
const openDialog = (row: any, accountId: string) => {
visible.value = true
form.id = row.id
wxAccountAppid.value = accountId
//
if (dataFormRef.value) {
dataFormRef.value.resetFields()
}
if (form.id) {
getFansData()
}
getTagList()
};
const getFansData = () => {
loading.value = true
getObj(form.id).then(res => {
Object.assign(form, res.data)
}).finally(() => {
loading.value = false
})
}
//
const onSubmit = () => {
dataFormRef.value.validate((valid: boolean) => {
if (!valid) {
return false
}
loading.value = true
if (form.id) {
putObj(form).then(() => {
useMessage().success(t('common.editSuccessText'))
visible.value = false //
emit('refresh')
}).catch((err: any) => {
useMessage().error(err.msg)
}).finally(() => {
loading.value = false
})
} else {
addObj(form).then(() => {
useMessage().success(t('common.addSuccessText'))
visible.value = false //
emit('refresh')
}).catch((err: any) => {
useMessage().error(err.msg)
}).finally(() => {
loading.value = false
})
}
})
}
const tagOption = ref([])
const getTagList = () => {
list(wxAccountAppid.value).then(res => {
tagOption.value = res.data
})
}
//
defineExpose({
openDialog
});
</script>
<style scoped>
</style>

View File

@ -12,11 +12,13 @@ export default {
country: '国家',
province: '省份',
city: '城市',
tagIds: '分组ID',
tagIds: '分组',
headimgUrl: ' headimgUrl',
remark: '备注',
wxAccountId: '微信公众号ID',
wxAccountName: '微信公众号',
wxAccountAppid: '公众号appid'
wxAccountAppid: '公众号appid',
inputremarkTip: '请输入备注',
inputTagTip: '请选择分组'
}
}

View File

@ -27,10 +27,6 @@
@click="exportExcel">
{{ $t('common.exportBtn') }}
</el-button>
<el-button v-auth="'mp_fans_del'" :disabled="multiple" class="ml10" formDialogRef icon="Delete"
type="primary" @click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@queryTable="getDataList"></right-toolbar>
</div>
@ -41,20 +37,29 @@
<el-table-column :label="t('fans.index')" type="index" width="80"/>
<el-table-column :label="t('fans.id')" prop="id" show-overflow-tooltip/>
<el-table-column :label="t('fans.openid')" prop="openid" show-overflow-tooltip/>
<el-table-column :label="t('fans.subscribeStatus')" prop="subscribeStatus" show-overflow-tooltip/>
<el-table-column :label="t('fans.subscribeStatus')" prop="subscribeStatus" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="subscribe" :value="scope.row.subscribeStatus"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="t('fans.subscribeTime')" prop="subscribeTime" show-overflow-tooltip/>
<el-table-column :label="t('fans.nickname')" prop="nickname" show-overflow-tooltip/>
<el-table-column :label="t('fans.gender')" prop="gender" show-overflow-tooltip/>
<el-table-column :label="t('fans.language')" prop="language" show-overflow-tooltip/>
<el-table-column :label="t('fans.tagIds')" prop="tagIds" show-overflow-tooltip/>
<el-table-column :label="t('fans.tagIds')" prop="tagIds" show-overflow-tooltip width="200">
<template #default="scope">
<span v-for="(tag, index) in scope.row.tagList" :key="index">
<el-tag>{{ tag.tag }} </el-tag>&nbsp;&nbsp;
</span>
</template>
</el-table-column>
<el-table-column :label="t('fans.remark')" prop="remark" show-overflow-tooltip/>
<el-table-column :label="t('fans.wxAccountName')" prop="wxAccountName" show-overflow-tooltip/>
<el-table-column :label="$t('common.action')" width="150">
<template #default="scope">
<el-button v-auth="'mp_fans_edit'" text type="primary"
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
<el-button text type="primary"
@click="formDialogRef.openDialog(scope.row,state.queryForm.wxAccountAppid)">{{ $t('common.editBtn') }}
</el-button>
<el-button v-auth="'sys_fans_del'" text type="primary" @click="handleDelete([scope.row.id])">{{
<el-button text type="primary" @click="handleDelete([scope.row.id])">{{
$t('common.delBtn')
}}
</el-button>
@ -62,6 +67,7 @@
</el-table-column>
</el-table>
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"/>
<form-dialog ref="formDialogRef" @refresh="getDataList"></form-dialog>
</el-card>
</div>
</template>
@ -72,6 +78,11 @@ import {delObjs, fetchList, sync} from "/@/api/mp/wx-account-fans";
import { fetchAccountList } from '/@/api/mp/wx-account'
import {useMessage, useMessageBox} from "/@/hooks/message";
import {useI18n} from "vue-i18n";
import {useDict} from "/@/hooks/dict";
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const { subscribe } = useDict('subscribe')
//
const {t} = useI18n()

View File

@ -23,7 +23,7 @@
// /
const emit = defineEmits(['refresh']);
import {useMessage} from "/@/hooks/message";
import {addObj, putObj} from '/@/api/mp/wx-account-tag'
import {addObj} from '/@/api/mp/wx-account-tag'
import {useI18n} from "vue-i18n"
const {t} = useI18n();

View File

@ -308,7 +308,7 @@ const handleEdit = (row: any) => {
}
const handleDel = (row) => {
useMessageBox().confirm("").then(() => {
useMessageBox().confirm("是否确认删除此数据?").then(() => {
delObj(row.id).then(() =>{
useMessage().success("删除成功")
getDataList()