修复网站导航链接
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { CmsArticle, CmsArticleParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询文章
|
||||
*/
|
||||
export async function pageCmsArticle(params: CmsArticleParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CmsArticle>>>(
|
||||
MODULES_API_URL + '/cms/cms-article/page',
|
||||
SERVER_API_URL + '/cms/cms-article/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageCmsArticle(params: CmsArticleParam) {
|
||||
*/
|
||||
export async function listCmsArticle(params?: CmsArticleParam) {
|
||||
const res = await request.get<ApiResult<CmsArticle[]>>(
|
||||
MODULES_API_URL + '/cms/cms-article',
|
||||
SERVER_API_URL + '/cms/cms-article',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listCmsArticle(params?: CmsArticleParam) {
|
||||
*/
|
||||
export async function addCmsArticle(data: CmsArticle) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/cms-article',
|
||||
SERVER_API_URL + '/cms/cms-article',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addCmsArticle(data: CmsArticle) {
|
||||
*/
|
||||
export async function updateCmsArticle(data: CmsArticle) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/cms-article',
|
||||
SERVER_API_URL + '/cms/cms-article',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateCmsArticle(data: CmsArticle) {
|
||||
*/
|
||||
export async function removeCmsArticle(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/cms-article/' + id
|
||||
SERVER_API_URL + '/cms/cms-article/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeCmsArticle(id?: number) {
|
||||
*/
|
||||
export async function removeBatchCmsArticle(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/cms-article/batch',
|
||||
SERVER_API_URL + '/cms/cms-article/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchCmsArticle(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getCmsArticle(id: number) {
|
||||
const res = await request.get<ApiResult<CmsArticle>>(
|
||||
MODULES_API_URL + '/cms/cms-article/' + id
|
||||
SERVER_API_URL + '/cms/cms-article/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -16,8 +16,10 @@ export interface CmsArticle {
|
||||
showType?: number;
|
||||
// 话题
|
||||
topic?: string;
|
||||
// 文章分类ID
|
||||
// 栏目ID
|
||||
categoryId?: number;
|
||||
// 栏目名称
|
||||
categoryName?: string;
|
||||
// 封面图
|
||||
image?: string;
|
||||
// 来源
|
||||
@@ -52,6 +54,8 @@ export interface CmsArticle {
|
||||
commentNumbers?: number;
|
||||
// 提醒谁看
|
||||
toUsers?: string;
|
||||
// 文章内容
|
||||
content?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
|
||||
@@ -71,6 +71,9 @@ export interface CmsNavigation {
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
children?: CmsNavigation[];
|
||||
disabled?: boolean;
|
||||
label?: string;
|
||||
value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ChatMessage } from '@/api/system/chat/model';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import CryptoJS from 'crypto-js';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getSiteDomain, getTenantId } from '@/utils/domain';
|
||||
import { getSiteDomain } from '@/utils/domain';
|
||||
import { uuid } from 'ele-admin-pro';
|
||||
|
||||
type Events = {
|
||||
@@ -73,24 +73,18 @@ export function openSpmUrl(path: string, d?: any, id = 0): void {
|
||||
const spm = ref<string>('');
|
||||
const token = ref<string>();
|
||||
const url = ref<string>();
|
||||
const tid = getTenantId() || 0;
|
||||
const tid = d?.tenantId || 0;
|
||||
const pid = d?.parentId || 0;
|
||||
const cid = d?.categoryId || 0;
|
||||
const uid = localStorage.getItem('UserId') || 0;
|
||||
const timestamp = ref(Date.now() / 1000);
|
||||
token.value = `&token=${uuid()}`;
|
||||
|
||||
// TODO 不传data
|
||||
// if (!d) {
|
||||
// window.open(`${domain}${path}`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// TODO 封装租户ID和店铺ID
|
||||
spm.value = `?spm=c.${uid}.${tid}.${pid}.${cid}.${id}.${timestamp.value}`;
|
||||
|
||||
// TODO 含http直接跳转
|
||||
if (path.slice(0, 4) == 'http') {
|
||||
if (path.startsWith('http')) {
|
||||
window.open(`${path}${spm.value}`);
|
||||
return;
|
||||
}
|
||||
@@ -413,5 +407,8 @@ export const getIdBySpm = (index: number) => {
|
||||
* 提取传参中的token
|
||||
*/
|
||||
export const getTokenBySpm = () => {
|
||||
return JSON.parse(router.currentRoute.value.query.token);
|
||||
const token = router.currentRoute.value.query.token;
|
||||
if (token) {
|
||||
return JSON.parse(`${token}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`/article/detail/${record.articleId}.html`,
|
||||
`/article/detail/${record.articleId}`,
|
||||
record,
|
||||
record.articleId
|
||||
)
|
||||
|
||||
512
src/views/cms/cmsArticle/components/articleEdit.vue
Normal file
512
src/views/cms/cmsArticle/components/articleEdit.vue
Normal file
@@ -0,0 +1,512 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="900"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑文章' : '添加文章'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 3, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 24, sm: 24, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-tabs type="card" v-model:active-key="active" @change="onChange">
|
||||
<a-tab-pane tab="基本信息" key="base">
|
||||
<a-form-item label="选择栏目" name="categoryId">
|
||||
<a-tree-select
|
||||
allow-clear
|
||||
:tree-data="navigationList"
|
||||
tree-default-expand-all
|
||||
style="width: 558px"
|
||||
placeholder="请选择栏目"
|
||||
:value="form.categoryId || undefined"
|
||||
:dropdown-style="{ maxHeight: '360px', overflow: 'auto' }"
|
||||
@update:value="(value?: number) => (form.categoryId = value)"
|
||||
@change="onCategoryId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章标题" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
style="width: 558px"
|
||||
placeholder="文章标题"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章图片" name="image">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseImage"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="上传附件" name="files">
|
||||
<SelectFile
|
||||
:placeholder="`请选择视频文件`"
|
||||
:limit="9"
|
||||
:data="files"
|
||||
@done="chooseFile"
|
||||
@del="onDeleteFile"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章内容" name="content">
|
||||
<!-- 编辑器 -->
|
||||
<tinymce-editor
|
||||
ref="editorRef"
|
||||
class="content"
|
||||
v-model:value="content"
|
||||
:disabled="disabled"
|
||||
:init="config"
|
||||
placeholder="图片直接粘贴自动上传"
|
||||
@paste="onPaste"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="摘要">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
show-count
|
||||
placeholder="请输入文章摘要"
|
||||
@focus="onComments"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="发布时间" name="createTime" v-if="isUpdate">
|
||||
<a-date-picker
|
||||
v-model:value="form.createTime"
|
||||
show-time
|
||||
placeholder="Select Time"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-radio-group v-model:value="form.status">
|
||||
<a-radio :value="0">已发布</a-radio>
|
||||
<a-radio :value="1">待审核</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="其他选项" key="other">
|
||||
<a-form-item label="文章来源" name="source">
|
||||
<source-select
|
||||
v-model:value="form.source"
|
||||
style="width: 180px"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="虚拟阅读量" name="virtualViews" :extra="`用户看到的阅读量(${Number(form?.actualViews) + Number(form?.virtualViews)}) = 实际阅读量(${form.actualViews}) + 虚拟阅读量(${form.virtualViews})`">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="999999999"
|
||||
style="width: 180px"
|
||||
placeholder="请输入虚拟阅读量"
|
||||
v-model:value="form.virtualViews"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, htmlToText, uuid } from 'ele-admin-pro';
|
||||
import { addCmsArticle, getCmsArticle, updateCmsArticle } from "@/api/cms/cmsArticle";
|
||||
import { CmsArticle } from '@/api/cms/cmsArticle/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance, RuleObject } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
import TinymceEditor from '@/components/TinymceEditor/index.vue';
|
||||
import { uploadFile, uploadOss } from "@/api/system/file";
|
||||
import { SpecValue } from "@/api/shop/specValue/model";
|
||||
import { CmsArticleCategory } from "@/api/cms/cmsArticleCategory/model";
|
||||
import { listCmsArticleCategory } from "@/api/cms/cmsArticleCategory";
|
||||
import { Navigation } from "@/api/cms/navigation/model";
|
||||
import SourceSelect from "@/views/cms/article/dictionary/source-select.vue";
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: CmsArticle | null;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
categoryId?: number;
|
||||
// 栏目数据
|
||||
navigationList?: Navigation[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
const content = ref('');
|
||||
const disabled = ref(false);
|
||||
// 当前选项卡
|
||||
const active = ref('base');
|
||||
|
||||
const spec = ref<SpecValue[]>([]);
|
||||
const files = ref<ItemType[]>([]);
|
||||
const category = ref<string[]>([]);
|
||||
const takeaway = ref<CmsArticleCategory[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<CmsArticle>({
|
||||
articleId: undefined,
|
||||
// 封面图
|
||||
image: '',
|
||||
// 文章标题
|
||||
title: '',
|
||||
type: 0,
|
||||
// 展现方式
|
||||
showType: 10,
|
||||
// 文章来源
|
||||
source: undefined,
|
||||
// 文章类型
|
||||
categoryId: undefined,
|
||||
// 栏目名称
|
||||
categoryName: undefined,
|
||||
// 文章内容
|
||||
content: '',
|
||||
// 虚拟阅读量
|
||||
virtualViews: 0,
|
||||
// 实际阅读量
|
||||
actualViews: 0,
|
||||
// 用户ID
|
||||
userId: undefined,
|
||||
files: '',
|
||||
// 排序
|
||||
sortNumber: 100,
|
||||
// 备注
|
||||
comments: undefined,
|
||||
// 状态
|
||||
status: 0,
|
||||
// 创建时间
|
||||
createTime: '',
|
||||
// 更新时间
|
||||
updateTime: ''
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择文章标题',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
// image: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请上传图片',
|
||||
// type: 'string',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
// files: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请上传轮播图',
|
||||
// type: 'string',
|
||||
// trigger: 'blur',
|
||||
// validator: async (_rule: RuleObject, value: string) => {
|
||||
// if (form.files == '') {
|
||||
// return Promise.reject('选择上传轮播图');
|
||||
// }
|
||||
// return Promise.resolve();
|
||||
// }
|
||||
// }
|
||||
// ],
|
||||
categoryId: [
|
||||
{
|
||||
required: true,
|
||||
type: 'number',
|
||||
message: '请选择栏目',
|
||||
trigger: 'blur',
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (!form.categoryId) {
|
||||
return Promise.reject('请选择栏目');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
],
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入文章内容",
|
||||
trigger: "blur",
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (content.value == "") {
|
||||
return Promise.reject("请输入文字内容");
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.image = data.path;
|
||||
};
|
||||
|
||||
// 选择栏目
|
||||
const onCategoryId = (id: number) => {
|
||||
form.categoryId = id;
|
||||
};
|
||||
|
||||
const onChange = () => {
|
||||
// 加载文章多规格
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.image = '';
|
||||
};
|
||||
|
||||
const onComments = () => {
|
||||
if (form.comments == undefined) {
|
||||
form.comments = htmlToText(content.value)
|
||||
form.comments = form.comments.slice(0, 120)
|
||||
}
|
||||
}
|
||||
|
||||
const chooseFile = (data: FileRecord) => {
|
||||
files.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.files = JSON.stringify(files.value.map(d => d.url))
|
||||
|
||||
};
|
||||
|
||||
const onDeleteFile = (index: number) => {
|
||||
files.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const editorRef = ref<InstanceType<typeof TinymceEditor> | null>(null);
|
||||
const config = ref({
|
||||
height: 500,
|
||||
images_upload_handler: (blobInfo, success, error) => {
|
||||
const file = blobInfo.blob();
|
||||
const formData = new FormData();
|
||||
formData.append('file', file, file.name);
|
||||
uploadOss(file).then(res => {
|
||||
success(res.path)
|
||||
}).catch((msg) => {
|
||||
error(msg);
|
||||
})
|
||||
},
|
||||
// 自定义文件上传(这里使用把选择的文件转成 blob 演示)
|
||||
file_picker_callback: (callback: any, _value: any, meta: any) => {
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('type', 'file');
|
||||
// 设定文件可选类型
|
||||
if (meta.filetype === 'image') {
|
||||
input.setAttribute('accept', 'image/*');
|
||||
} else if (meta.filetype === 'media') {
|
||||
input.setAttribute('accept', 'video/*,.pdf');
|
||||
}
|
||||
input.onchange = () => {
|
||||
const file = input.files?.[0];
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
if (meta.filetype === 'media') {
|
||||
if (file.size / 1024 / 1024 > 200) {
|
||||
editorRef.value?.alert({ content: '大小不能超过 200MB' });
|
||||
return;
|
||||
}
|
||||
if(file.type.startsWith('application/pdf')){
|
||||
uploadOss(file).then(res => {
|
||||
const addPath = `<a href="${res.downloadUrl}" target="_blank">${res.name}</a>`;
|
||||
content.value = content.value + addPath
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (!file.type.startsWith('video/')) {
|
||||
editorRef.value?.alert({ content: '只能选择视频文件' });
|
||||
return;
|
||||
}
|
||||
uploadOss(file).then(res => {
|
||||
callback(res.path)
|
||||
});
|
||||
}
|
||||
};
|
||||
input.click();
|
||||
}
|
||||
});
|
||||
|
||||
/* 粘贴图片上传服务器并插入编辑器 */
|
||||
const onPaste = (e) => {
|
||||
const items = (e.clipboardData || e.originalEvent.clipboardData).items;
|
||||
let hasFile = false;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].type.indexOf('image') !== -1) {
|
||||
let file = items[i].getAsFile();
|
||||
const item: ItemType = {
|
||||
file,
|
||||
uid: (file as any).lastModified,
|
||||
name: file.name
|
||||
};
|
||||
uploadFile(<File>item.file)
|
||||
.then((result) => {
|
||||
const addPath = `<p><img class="content-img" src="${result.url}"></p>`;
|
||||
content.value = content.value + addPath
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
hasFile = true;
|
||||
}
|
||||
}
|
||||
if (hasFile) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form,
|
||||
content: content.value
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateCmsArticle : addCmsArticle;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if(props.categoryId){
|
||||
form.categoryId = props.categoryId;
|
||||
}
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
category.value = [];
|
||||
files.value = [];
|
||||
if (props.data) {
|
||||
// 文章详情
|
||||
getCmsArticle(Number(props.data?.articleId)).then(data => {
|
||||
|
||||
assignObject(form, data);
|
||||
|
||||
if (data.content){
|
||||
content.value = data.content;
|
||||
}
|
||||
|
||||
if (data.image) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: data.image,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
if(data.files){
|
||||
const arr = JSON.parse(data.files)
|
||||
arr.map((url:string) => {
|
||||
files.value.push({
|
||||
uid: uuid(),
|
||||
url: url,
|
||||
status: 'done'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 外卖文章分类
|
||||
listCmsArticleCategory({merchantId: props.merchantId}).then(list => {
|
||||
takeaway.value = list
|
||||
})
|
||||
|
||||
|
||||
// assignObject(form, props.data);
|
||||
|
||||
|
||||
// 文章分类
|
||||
// if(props.data.categoryParent){
|
||||
// category.value.push(props.data.categoryParent);
|
||||
// }
|
||||
// if(props.data.categoryChildren){
|
||||
// category.value.push(props.data.categoryChildren);
|
||||
// }
|
||||
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
spec.value = [];
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -1,400 +0,0 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑文章' : '添加文章'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="文章标题" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入文章标题"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章类型 0常规 1视频" name="type">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入文章类型 0常规 1视频"
|
||||
v-model:value="form.type"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章模型" name="model">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入文章模型"
|
||||
v-model:value="form.model"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="列表显示方式(10小图展示 20大图展示)" name="showType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入列表显示方式(10小图展示 20大图展示)"
|
||||
v-model:value="form.showType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="话题" name="topic">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入话题"
|
||||
v-model:value="form.topic"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章分类ID" name="categoryId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入文章分类ID"
|
||||
v-model:value="form.categoryId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="封面图"
|
||||
name="image">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseImage"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="来源" name="source">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入来源"
|
||||
v-model:value="form.source"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="虚拟阅读量(仅用作展示)" name="virtualViews">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入虚拟阅读量(仅用作展示)"
|
||||
v-model:value="form.virtualViews"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="实际阅读量" name="actualViews">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入实际阅读量"
|
||||
v-model:value="form.actualViews"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="发布来源客户端 (APP、H5、小程序等)" name="platform">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入发布来源客户端 (APP、H5、小程序等)"
|
||||
v-model:value="form.platform"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文章附件" name="files">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入文章附件"
|
||||
v-model:value="form.files"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="视频地址" name="video">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入视频地址"
|
||||
v-model:value="form.video"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="接受的文件类型" name="accept">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入接受的文件类型"
|
||||
v-model:value="form.accept"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="经度" name="longitude">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入经度"
|
||||
v-model:value="form.longitude"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="纬度" name="latitude">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入纬度"
|
||||
v-model:value="form.latitude"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在省份" name="province">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入所在省份"
|
||||
v-model:value="form.province"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在城市" name="city">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入所在城市"
|
||||
v-model:value="form.city"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在辖区" name="region">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入所在辖区"
|
||||
v-model:value="form.region"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="街道地址" name="address">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入街道地址"
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="点赞数" name="likes">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入点赞数"
|
||||
v-model:value="form.likes"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="评论数" name="commentNumbers">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入评论数"
|
||||
v-model:value="form.commentNumbers"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="提醒谁看" name="toUsers">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入提醒谁看"
|
||||
v-model:value="form.toUsers"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用户ID" name="userId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户ID"
|
||||
v-model:value="form.userId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入描述"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="状态, 0已发布, 1待审核 2已驳回 3违规内容" name="status">
|
||||
<a-radio-group v-model:value="form.status">
|
||||
<a-radio :value="0">显示</a-radio>
|
||||
<a-radio :value="1">隐藏</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否删除, 0否, 1是"
|
||||
v-model:value="form.deleted"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="修改时间" name="updateTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入修改时间"
|
||||
v-model:value="form.updateTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addCmsArticle, updateCmsArticle } from '@/api/cms/cmsArticle';
|
||||
import { CmsArticle } from '@/api/cms/cmsArticle/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: CmsArticle | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<CmsArticle>({
|
||||
articleId: undefined,
|
||||
title: undefined,
|
||||
type: undefined,
|
||||
model: undefined,
|
||||
showType: undefined,
|
||||
topic: undefined,
|
||||
categoryId: undefined,
|
||||
image: undefined,
|
||||
source: undefined,
|
||||
virtualViews: undefined,
|
||||
actualViews: undefined,
|
||||
platform: undefined,
|
||||
files: undefined,
|
||||
video: undefined,
|
||||
accept: undefined,
|
||||
longitude: undefined,
|
||||
latitude: undefined,
|
||||
province: undefined,
|
||||
city: undefined,
|
||||
region: undefined,
|
||||
address: undefined,
|
||||
likes: undefined,
|
||||
commentNumbers: undefined,
|
||||
toUsers: undefined,
|
||||
userId: undefined,
|
||||
sortNumber: undefined,
|
||||
comments: undefined,
|
||||
status: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
cmsArticleId: undefined,
|
||||
cmsArticleName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
cmsArticleName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写文章名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.image = data.path;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.image = '';
|
||||
};
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateCmsArticle : addCmsArticle;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -7,24 +7,87 @@
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
<a-radio-group v-model:value="type" @change="handleSearch">
|
||||
<a-radio-button value="已发布"
|
||||
>已发布({{ articleCount?.totalNum }})</a-radio-button
|
||||
>
|
||||
<a-radio-button value="待审核"
|
||||
>待审核({{ articleCount?.totalNum2 }})</a-radio-button
|
||||
>
|
||||
<a-radio-button value="已驳回"
|
||||
>已驳回({{ articleCount?.totalNum3 }})</a-radio-button
|
||||
>
|
||||
</a-radio-group>
|
||||
<a-tree-select
|
||||
allow-clear
|
||||
:tree-data="navigationList"
|
||||
tree-default-expand-all
|
||||
style="width: 280px"
|
||||
placeholder="请选择栏目"
|
||||
:value="where.categoryId || undefined"
|
||||
:dropdown-style="{ maxHeight: '360px', overflow: 'auto' }"
|
||||
@update:value="(value?: number) => (where.categoryId = value)"
|
||||
@change="onCategoryId"
|
||||
/>
|
||||
<ChooseDictionary
|
||||
v-if="showChooseDict"
|
||||
dict-code="NavigationModel"
|
||||
:placeholder="`选择模型`"
|
||||
style="width: 120px"
|
||||
v-model:value="where.model"
|
||||
@done="chooseModel"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
style="width: 280px"
|
||||
v-model:value="where.userId"
|
||||
@pressEnter="reload"
|
||||
@search="reload"
|
||||
/>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { getCount } from '@/api/cms/article';
|
||||
import type { ArticleCount, ArticleParam } from '@/api/cms/article/model';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { Navigation } from '@/api/cms/navigation/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
merchantId?: number;
|
||||
navigationList?: Navigation[];
|
||||
categoryId?: number;
|
||||
model?: string;
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const type = ref<string>();
|
||||
// 统计数据
|
||||
const articleCount = ref<ArticleCount>();
|
||||
const showChooseDict = ref<boolean>(false);
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<ArticleParam>({
|
||||
articleId: undefined,
|
||||
model: undefined,
|
||||
navigationId: undefined,
|
||||
categoryId: undefined,
|
||||
merchantId: undefined,
|
||||
status: undefined,
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'search', where?: ArticleParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
@@ -35,8 +98,63 @@
|
||||
emit('add');
|
||||
};
|
||||
|
||||
const handleSearch = (e) => {
|
||||
const text = e.target.value;
|
||||
if (text === '已发布') {
|
||||
where.status = 0;
|
||||
}
|
||||
if (text === '待审核') {
|
||||
where.status = 1;
|
||||
}
|
||||
if (text === '已驳回') {
|
||||
where.status = 2;
|
||||
}
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
console.log(where);
|
||||
getCount(where).then((data: any) => {
|
||||
articleCount.value = data;
|
||||
});
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 按模型查找
|
||||
const chooseModel = (item: Navigation) => {
|
||||
where.model = `${item.value}`;
|
||||
where.modelName = `${item.label}`;
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 按分类查询
|
||||
const onCategoryId = (id: number) => {
|
||||
where.categoryId = id;
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
type.value = '';
|
||||
reload();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
() => props.merchantId,
|
||||
() => {
|
||||
if (props.categoryId) {
|
||||
where.categoryId = props.categoryId;
|
||||
}
|
||||
reload();
|
||||
// if (Number(id) > 0) {
|
||||
// where.merchantId = id;
|
||||
// reload();
|
||||
// } else {
|
||||
// where.merchantId = undefined;
|
||||
// reload();
|
||||
// }
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
51
src/views/cms/cmsArticle/dictionary/source-select.vue
Normal file
51
src/views/cms/cmsArticle/dictionary/source-select.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<!-- 文章来源选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
optionFilterProp="label"
|
||||
:options="data"
|
||||
allow-clear
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
@blur="onBlur"
|
||||
@change="onChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string): void;
|
||||
(e: 'blur'): void;
|
||||
(e: 'change'): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择文章来源'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const data = getDictionaryOptions('articleSource');
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
emit('update:value', value);
|
||||
};
|
||||
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
|
||||
/* 选择事件 */
|
||||
const onChange = (e) => {
|
||||
emit('change', e);
|
||||
};
|
||||
</script>
|
||||
@@ -4,10 +4,11 @@
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="cmsArticleId"
|
||||
row-key="articleId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:scroll="{ x: 1200 }"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
@@ -15,18 +16,64 @@
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
:navigationList="navigationList"
|
||||
:merchantId="merchantId"
|
||||
:categoryId="categoryId"
|
||||
:model="model"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'title'">
|
||||
<span
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`/article/detail/${record.articleId}.html`,
|
||||
record,
|
||||
record.articleId
|
||||
)
|
||||
"
|
||||
>{{ record.title }}</span
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'categoryName'">
|
||||
<span
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`/article/${record.categoryId}`,
|
||||
record,
|
||||
record.categoryId
|
||||
)
|
||||
"
|
||||
>{{ record.categoryName }}</span
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type === 0">虚拟文章</a-tag>
|
||||
<a-tag v-if="record.type === 1">实物文章</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
<a-image
|
||||
v-if="isImage(record.image)"
|
||||
:src="record.image"
|
||||
:width="80"
|
||||
/>
|
||||
<span v-else class="text-gray-400">[文件]</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'salePrice'">
|
||||
¥{{ formatNumber(record.salePrice) }}
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
<a-tag
|
||||
:color="record.status == 0 ? 'green' : 'red'"
|
||||
class="cursor-pointer"
|
||||
@click="onUpdate(record)"
|
||||
>{{ record.statusText }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
@@ -45,25 +92,40 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CmsArticleEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<ArticleEdit
|
||||
v-model:visible="showEdit"
|
||||
:navigationList="navigationList"
|
||||
:categoryId="categoryId"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { createVNode, ref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import CmsArticleEdit from './components/cmsArticleEdit.vue';
|
||||
import { pageCmsArticle, removeCmsArticle, removeBatchCmsArticle } from '@/api/cms/cmsArticle';
|
||||
import ArticleEdit from './components/articleEdit.vue';
|
||||
import {
|
||||
pageCmsArticle,
|
||||
removeCmsArticle,
|
||||
removeBatchCmsArticle
|
||||
} from '@/api/cms/cmsArticle';
|
||||
import type { CmsArticle, CmsArticleParam } from '@/api/cms/cmsArticle/model';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
import router from '@/router';
|
||||
import { toTreeData } from 'ele-admin-pro';
|
||||
import { isImage, openSpmUrl } from '@/utils/common';
|
||||
import { listCmsNavigation } from '@/api/cms/cmsNavigation';
|
||||
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -76,19 +138,19 @@
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 店铺ID
|
||||
const merchantId = ref<number>();
|
||||
// 栏目ID
|
||||
const categoryId = ref<number>();
|
||||
// 当前模型
|
||||
const model = ref<number>();
|
||||
// 栏目数据
|
||||
const navigationList = ref<CmsNavigation[]>();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
if (categoryId.value) {
|
||||
where.categoryId = categoryId.value;
|
||||
}
|
||||
return pageCmsArticle({
|
||||
...where,
|
||||
@@ -101,194 +163,84 @@
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '文章ID',
|
||||
title: 'ID',
|
||||
dataIndex: 'articleId',
|
||||
key: 'articleId',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '文章标题',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '文章类型 0常规 1视频',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '文章模型',
|
||||
dataIndex: 'model',
|
||||
key: 'model',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '列表显示方式(10小图展示 20大图展示)',
|
||||
dataIndex: 'showType',
|
||||
key: 'showType',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '话题',
|
||||
dataIndex: 'topic',
|
||||
key: 'topic',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '文章分类ID',
|
||||
dataIndex: 'categoryId',
|
||||
key: 'categoryId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '封面图',
|
||||
dataIndex: 'image',
|
||||
key: 'image',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '来源',
|
||||
dataIndex: 'source',
|
||||
key: 'source',
|
||||
align: 'center',
|
||||
title: '文章标题',
|
||||
dataIndex: 'title',
|
||||
key: 'title'
|
||||
},
|
||||
{
|
||||
title: '虚拟阅读量(仅用作展示)',
|
||||
dataIndex: 'virtualViews',
|
||||
key: 'virtualViews',
|
||||
title: '栏目名称',
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '所属栏目',
|
||||
dataIndex: 'categoryId',
|
||||
key: 'categoryId',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '实际阅读量',
|
||||
dataIndex: 'actualViews',
|
||||
key: 'actualViews',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '发布来源客户端 (APP、H5、小程序等)',
|
||||
dataIndex: 'platform',
|
||||
key: 'platform',
|
||||
align: 'center',
|
||||
title: '虚拟阅读量',
|
||||
dataIndex: 'virtualViews',
|
||||
key: 'virtualViews',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '文章附件',
|
||||
dataIndex: 'files',
|
||||
key: 'files',
|
||||
title: '推荐',
|
||||
dataIndex: 'recommend',
|
||||
key: 'recommend',
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '视频地址',
|
||||
dataIndex: 'video',
|
||||
key: 'video',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '接受的文件类型',
|
||||
dataIndex: 'accept',
|
||||
key: 'accept',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '经度',
|
||||
dataIndex: 'longitude',
|
||||
key: 'longitude',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '纬度',
|
||||
dataIndex: 'latitude',
|
||||
key: 'latitude',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '所在省份',
|
||||
dataIndex: 'province',
|
||||
key: 'province',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '所在城市',
|
||||
dataIndex: 'city',
|
||||
key: 'city',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '所在辖区',
|
||||
dataIndex: 'region',
|
||||
key: 'region',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '街道地址',
|
||||
dataIndex: 'address',
|
||||
key: 'address',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '点赞数',
|
||||
dataIndex: 'likes',
|
||||
key: 'likes',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '评论数',
|
||||
dataIndex: 'commentNumbers',
|
||||
key: 'commentNumbers',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '提醒谁看',
|
||||
dataIndex: 'toUsers',
|
||||
key: 'toUsers',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '排序(数字越小越靠前)',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '状态, 0已发布, 1待审核 2已驳回 3违规内容',
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '是否删除, 0否, 1是',
|
||||
dataIndex: 'deleted',
|
||||
key: 'deleted',
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
sorter: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@@ -302,6 +254,9 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CmsArticleParam) => {
|
||||
if (where?.categoryId) {
|
||||
categoryId.value = where.categoryId;
|
||||
}
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
@@ -317,10 +272,18 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
const onUpdate = (row?: CmsArticle) => {
|
||||
// const isShow = row?.isShow == 0 ? 1 : 0;
|
||||
// updateCmsArticle({ ...row, isShow }).then((msg) => {
|
||||
// message.success(msg);
|
||||
// reload();
|
||||
// });
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CmsArticle) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeCmsArticle(row.cmsArticleId)
|
||||
removeCmsArticle(row.articleId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -345,7 +308,7 @@
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchCmsArticle(selection.value.map((d) => d.cmsArticleId))
|
||||
removeBatchCmsArticle(selection.value.map((d) => d.articleId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -359,11 +322,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: CmsArticle) => {
|
||||
return {
|
||||
@@ -377,13 +335,41 @@
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
|
||||
// 加载栏目数据
|
||||
if (!navigationList.value) {
|
||||
listCmsNavigation({}).then((res) => {
|
||||
navigationList.value = toTreeData({
|
||||
data: res?.map((d) => {
|
||||
d.value = d.navigationId;
|
||||
d.label = d.title;
|
||||
if (d.model != 'article') {
|
||||
d.disabled = true;
|
||||
}
|
||||
return d;
|
||||
}),
|
||||
idField: 'navigationId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.query,
|
||||
(query) => {
|
||||
console.log(query);
|
||||
if (query) {
|
||||
categoryId.value = Number(query.id);
|
||||
model.value = Number(query.type);
|
||||
reload();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'CmsArticle'
|
||||
name: 'CmsArticleV2'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
||||
@@ -53,13 +53,7 @@
|
||||
<span class="cursor-pointer" v-if="isDirectory(record)"></span>
|
||||
<span
|
||||
v-else
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`https://${record.tenantId}.wsdns.cn${record.path}`,
|
||||
record,
|
||||
record.navigationId
|
||||
)
|
||||
"
|
||||
@click="openSpmUrl(`${record.path}`, record, record.navigationId)"
|
||||
class="ele-text-placeholder cursor-pointer"
|
||||
>{{ record.path }}</span
|
||||
>
|
||||
@@ -207,10 +201,12 @@
|
||||
import { openSpmUrl } from '@/utils/common';
|
||||
import { getSiteInfo } from '@/api/layout';
|
||||
import { CmsDesign } from '@/api/cms/cmsDesign/model';
|
||||
import router from '@/router';
|
||||
import { getSiteDomain } from '@/utils/domain';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
// 网站项目域名
|
||||
const domain = ref(getSiteDomain());
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
@@ -305,7 +301,6 @@
|
||||
const searchText = ref('');
|
||||
const position = ref(1);
|
||||
const tenantId = ref<number>();
|
||||
const domain = ref<string>();
|
||||
|
||||
getSiteInfo().then((data) => {
|
||||
tenantId.value = data.tenantId;
|
||||
|
||||
@@ -1,40 +1,51 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
<a-space style="flex-wrap: wrap" v-if="website">
|
||||
<a-button class="ele-btn-icon" @click="edit">
|
||||
<span>网站设置</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
class="ele-btn-icon"
|
||||
@click="push(`/website/field/${website.websiteId}`)"
|
||||
>
|
||||
<span>参数配置</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
class="ele-btn-icon"
|
||||
@click="push(`/website/domain/${website?.websiteId}`)"
|
||||
>
|
||||
<span>域名管理</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch } from 'vue';
|
||||
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
||||
import { push } from '@/utils/common';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
website?: CmsWebsite;
|
||||
count?: 0;
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
(e: 'add', data: CmsWebsite): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
const edit = () => {
|
||||
emit('add', props.website);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<!-- :options="websiteType"-->
|
||||
<!-- :value="form.websiteType"-->
|
||||
<!-- placeholder="请选择主体类型"-->
|
||||
<!-- @change="onWebsiteType"-->
|
||||
<!-- @change="onCmsWebsiteType"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="当前版本" name="version">-->
|
||||
@@ -138,7 +138,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid, SelectProps } from 'ele-admin-pro';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addCmsWebsite, updateCmsWebsite } from '@/api/cms/cmsWebsite';
|
||||
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
@@ -147,6 +147,7 @@
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
import { checkExistence } from '@/api/cms/cmsDomain';
|
||||
import { updateCmsDomain } from '@/api/cms/cmsDomain';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
@@ -318,21 +319,17 @@
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form,
|
||||
tenantId: localStorage.getItem('TenantId')
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateCmsWebsite : addCmsWebsite;
|
||||
saveOrUpdate(formData)
|
||||
saveOrUpdate(form)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
if (form.domain) {
|
||||
localStorage.setItem('Domain', `https://${form.domain}`);
|
||||
} else {
|
||||
localStorage.setItem('Domain', `${form.websiteCode}.wsdns.cn`);
|
||||
}
|
||||
updateCmsDomain({
|
||||
websiteId: form.websiteId,
|
||||
domain: `${form.websiteCode}.wsdns.cn`
|
||||
});
|
||||
localStorage.setItem('Domain', `${form.websiteCode}.wsdns.cn`);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -9,6 +9,7 @@
|
||||
:datasource="datasource"
|
||||
:parse-data="parseData"
|
||||
:customRow="customRow"
|
||||
:need-page="false"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
@@ -97,7 +98,7 @@
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import WebsiteEdit from './components/cmsWebsiteEdit.vue';
|
||||
import WebsiteEdit from './components/websiteEdit.vue';
|
||||
import {
|
||||
pageCmsWebsite,
|
||||
removeCmsWebsite,
|
||||
@@ -107,6 +108,7 @@
|
||||
import type { CmsWebsite, CmsWebsiteParam } from '@/api/cms/cmsWebsite/model';
|
||||
import { openSpmUrl } from '@/utils/common';
|
||||
import { PageResult } from '@/api';
|
||||
import { getSiteDomain } from "@/utils/domain";
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
@@ -53,7 +53,13 @@
|
||||
<span class="cursor-pointer" v-if="isDirectory(record)"></span>
|
||||
<span
|
||||
v-else
|
||||
@click="openSpmUrl(`https://${record.tenantId}.wsdns.cn${record.path}`, record, record.navigationId)"
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`https://${domain}${record.path}`,
|
||||
record,
|
||||
record.navigationId
|
||||
)
|
||||
"
|
||||
class="ele-text-placeholder cursor-pointer"
|
||||
>{{ record.path }}</span
|
||||
>
|
||||
@@ -93,7 +99,13 @@
|
||||
}}</span>
|
||||
<span
|
||||
v-else
|
||||
@click="openSpmUrl(record.path, record, record.navigationId)"
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`https://${domain}${record.path}`,
|
||||
record,
|
||||
record.navigationId
|
||||
)
|
||||
"
|
||||
class="cursor-pointer"
|
||||
>{{ record.title }}</span
|
||||
>
|
||||
@@ -195,7 +207,6 @@
|
||||
import { openSpmUrl } from '@/utils/common';
|
||||
import { getSiteInfo } from '@/api/layout';
|
||||
import { Design } from '@/api/cms/design/model';
|
||||
import router from '@/router';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -297,7 +308,12 @@
|
||||
|
||||
getSiteInfo().then((data) => {
|
||||
tenantId.value = data.tenantId;
|
||||
domain.value = data.domain;
|
||||
// 网站域名
|
||||
domain.value = `${data.websiteCode}.wsdns.cn`;
|
||||
if (data.domain != '') {
|
||||
domain.value = data.domain;
|
||||
}
|
||||
localStorage.setItem('Domain', `${domain.value}`);
|
||||
});
|
||||
|
||||
// 表格数据源
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
v-model:value="form.websiteName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="赠送域名" name="websiteCode">
|
||||
<a-form-item label="专属域名" name="websiteCode">
|
||||
<a-input
|
||||
v-model:value="form.websiteCode"
|
||||
placeholder="huawei"
|
||||
@@ -43,7 +43,7 @@
|
||||
addon-after=".wsdns.cn"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="自定义域名" name="domain">
|
||||
<a-form-item label="顶级域名" name="domain">
|
||||
<a-input
|
||||
v-model:value="form.domain"
|
||||
placeholder="huawei.com"
|
||||
@@ -326,11 +326,6 @@
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
if (form.domain) {
|
||||
localStorage.setItem('Domain', `https://${form.domain}`);
|
||||
} else {
|
||||
localStorage.setItem('Domain', `${form.websiteCode}.wsdns.cn`);
|
||||
}
|
||||
updateCmsDomain({
|
||||
websiteId: form.websiteId,
|
||||
domain: `${form.websiteCode}.wsdns.cn`
|
||||
|
||||
@@ -307,7 +307,6 @@
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
localStorage.setItem('Domain', `${form.prefix}${form.domain}`);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<a
|
||||
@click="
|
||||
openSpmUrl(
|
||||
`https://${record.tenantId}.wsdns.cn/product/detail/${record.goodsId}`,
|
||||
`/product/detail/${record.goodsId}`,
|
||||
record,
|
||||
record.goodsId
|
||||
)
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
<template v-if="column.key === 'domain'">
|
||||
<text
|
||||
@click="
|
||||
openSpmUrl(`http://${record.domain}`, record, record.tenantId)
|
||||
openSpmUrl(
|
||||
`https://${record.domain}`,
|
||||
record,
|
||||
record.tenantId
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ record.domain }}
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
status: undefined,
|
||||
userId: undefined,
|
||||
tenantId: undefined,
|
||||
code: undefined,
|
||||
createTime: '',
|
||||
updateTime: ''
|
||||
});
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
<a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="网站主页">-->
|
||||
<!-- <a-space class="justify">-->
|
||||
<!-- <span class="cursor-pointer" @click="openSpmUrl(`https://${form.websiteUrl}`)">{{ `${form.websiteUrl}` }}</span>-->
|
||||
<!-- <a @click="onEdit('专属域名', 'websiteUrl', form.websiteUrl)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="开通时间">
|
||||
<span class="ele-text-heading">{{ form.createTime }}</span>
|
||||
</a-form-item>
|
||||
@@ -75,12 +81,8 @@
|
||||
<a-space class="justify">
|
||||
<div class="ele-text-heading">
|
||||
<span style="padding-right: 12px">{{ form.companyName ? form.companyName : "-" }}</span>
|
||||
<a-tag v-if="form.authentication == 1" color="green">已认证</a-tag>
|
||||
<a-tag v-else color="orange">未认证</a-tag>
|
||||
</div>
|
||||
<a @click="onEdit('公司名称', 'companyName', form.companyName)"
|
||||
>修改</a
|
||||
>
|
||||
<a @click="onEdit('主体名称', 'companyName', form.companyName)">修改</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="主体类型">
|
||||
@@ -89,6 +91,20 @@
|
||||
<a @click="onEdit('主体类型', 'companyType', form.companyType)">修改</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="实名认证">
|
||||
<a-space class="justify">
|
||||
<a-tag v-if="form.authentication == 1" color="green">已认证</a-tag>
|
||||
<a-tag v-else color="orange" class="cursor-pointer" @click="openSpmUrl(`https://websoft.top/user/auth`)">未认证</a-tag>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="所属行业">
|
||||
<a-space class="justify">
|
||||
<span>{{ form.industryParent }}/{{ form.industryChild }}</span>
|
||||
<a @click="onEdit('行业类型', 'industryParent', form.industryParent)"
|
||||
>修改</a
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="用户数量">
|
||||
<a-space class="justify ele-text-heading">
|
||||
<span>{{ form.users }}/{{ form.members }}</span>
|
||||
@@ -144,27 +160,11 @@
|
||||
<a @click="onEdit('应用类型', 'appType', form.appType)">修改</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="适用行业">
|
||||
<a-space class="justify">
|
||||
<span>{{ form.industryParent }}/{{ form.industryChild }}</span>
|
||||
<a @click="onEdit('行业类型', 'industryParent', form.industryParent)"
|
||||
>修改</a
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="赠送域名" name="websiteCode">-->
|
||||
<!-- <a-input-->
|
||||
<!-- v-model:value="form.domain"-->
|
||||
<!-- placeholder="huawei"-->
|
||||
<!-- addon-before="https://"-->
|
||||
<!-- addon-after=".wsdns.cn"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="租户编号">-->
|
||||
<!-- <span class="ele-text-heading">{{ form.tenantCode }}</span>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="模版ID" v-if="form.planId > 0">-->
|
||||
<!-- <span class="ele-text-heading ele-text-heading">{{ form.planId }}</span>-->
|
||||
<!-- <a-form-item label="专属域名">-->
|
||||
<!-- <a-space class="justify">-->
|
||||
<!-- <span class="cursor-pointer" @click="openSpmUrl(`https://${form.domain}`)">{{ `${form.domain}` }}</span>-->
|
||||
<!-- <a @click="onEdit('专属域名', 'domain', form.domain)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="当前版本">
|
||||
<a-space class="justify ele-text-heading">
|
||||
@@ -172,24 +172,6 @@
|
||||
<a @click="openUrl('/system/version')">更新</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="request合法域名">-->
|
||||
<!-- <a-space class="justify ele-text-heading">-->
|
||||
<!-- <span>{{ form.requestUrl ? form.requestUrl : '-' }}</span>-->
|
||||
<!-- <a @click="onEdit('request合法域名', 'requestUrl', form.requestUrl)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="socket合法域名">-->
|
||||
<!-- <a-space class="justify ele-text-heading">-->
|
||||
<!-- <span>{{ form.socketUrl ? form.socketUrl : '-' }}</span>-->
|
||||
<!-- <a @click="onEdit('socket合法域名', 'socketUrl', form.socketUrl)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="业务域名">-->
|
||||
<!-- <a-space class="justify ele-text-heading">-->
|
||||
<!-- <span>{{ form.modulesUrl ? form.modulesUrl : '-' }}</span>-->
|
||||
<!-- <a @click="onEdit('业务域名', 'modulesUrl', form.modulesUrl)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-divider style="padding-bottom: 20px" />
|
||||
<a-form-item
|
||||
v-if="form.tenantId"
|
||||
@@ -200,18 +182,6 @@
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-tab-pane>
|
||||
<!-- <a-tab-pane tab="开发设置" key="developer">-->
|
||||
<!-- <a-form-->
|
||||
<!-- :label-col="-->
|
||||
<!-- styleResponsive-->
|
||||
<!-- ? { lg: 2, md: 6, sm: 4, xs: 24 }-->
|
||||
<!-- : { flex: '100px' }-->
|
||||
<!-- "-->
|
||||
<!-- :wrapper-col="styleResponsive ? { offset: 1 } : { offset: 1 }"-->
|
||||
<!-- style="margin-top: 20px"-->
|
||||
<!-- >-->
|
||||
<!-- </a-form>-->
|
||||
<!-- </a-tab-pane>-->
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
<Field
|
||||
@@ -283,7 +253,7 @@ const form = reactive<Company>({
|
||||
freeDomain: undefined,
|
||||
phone: "",
|
||||
email: "",
|
||||
InvoiceHeader: "",
|
||||
invoiceHeader: "",
|
||||
startTime: "",
|
||||
expirationTime: "",
|
||||
appType: undefined,
|
||||
@@ -309,13 +279,12 @@ const form = reactive<Company>({
|
||||
status: undefined,
|
||||
userId: undefined,
|
||||
tenantId: undefined,
|
||||
tenantCode: "",
|
||||
modules: "",
|
||||
adminUrl: '',
|
||||
websiteUrl: '',
|
||||
requestUrl: "",
|
||||
socketUrl: "",
|
||||
serverUrl: "",
|
||||
modulesUrl: "",
|
||||
code: undefined,
|
||||
createTime: "",
|
||||
updateTime: ""
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user