46 changed files with 1457 additions and 589 deletions
@ -0,0 +1,117 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import type { ApiResult, PageResult } from '@/api'; |
||||
|
import type { CmsProduct, CmsProductParam } from './model'; |
||||
|
import { SERVER_API_URL } from '~/config'; |
||||
|
import type { ArticleParam } from "@/api/cms/article/model"; |
||||
|
|
||||
|
/** |
||||
|
* 分页查询产品 |
||||
|
*/ |
||||
|
export async function pageCmsProduct(params: CmsProductParam) { |
||||
|
const res = await request.get<ApiResult<PageResult<CmsProduct>>>( |
||||
|
SERVER_API_URL + '/cms/cms-product/page', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询产品列表 |
||||
|
*/ |
||||
|
export async function listCmsProduct(params?: CmsProductParam) { |
||||
|
const res = await request.get<ApiResult<CmsProduct[]>>( |
||||
|
SERVER_API_URL + '/cms/cms-product', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 添加产品 |
||||
|
*/ |
||||
|
export async function addCmsProduct(data: CmsProduct) { |
||||
|
const res = await request.post<ApiResult<unknown>>( |
||||
|
SERVER_API_URL + '/cms/cms-product', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改产品 |
||||
|
*/ |
||||
|
export async function updateCmsProduct(data: CmsProduct) { |
||||
|
const res = await request.put<ApiResult<unknown>>( |
||||
|
SERVER_API_URL + '/cms/cms-product', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除产品 |
||||
|
*/ |
||||
|
export async function removeCmsProduct(id?: number) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
SERVER_API_URL + '/cms/cms-product/' + id |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除产品 |
||||
|
*/ |
||||
|
export async function removeBatchCmsProduct(data: (number | undefined)[]) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
SERVER_API_URL + '/cms/cms-product/batch', |
||||
|
{ |
||||
|
data |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询产品 |
||||
|
*/ |
||||
|
export async function getCmsProduct(id: number) { |
||||
|
const res = await request.get<ApiResult<CmsProduct>>( |
||||
|
SERVER_API_URL + '/cms/cms-product/' + id |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
export async function getCount(params: ArticleParam) { |
||||
|
const res = await request.get(SERVER_API_URL + '/cms/cms-product/data', { |
||||
|
params |
||||
|
}); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
import type { PageParam } from '@/api'; |
||||
|
|
||||
|
/** |
||||
|
* 产品 |
||||
|
*/ |
||||
|
export interface CmsProduct { |
||||
|
// 自增ID
|
||||
|
productId?: number; |
||||
|
// 类型 0软件产品 1实物商品 2虚拟商品
|
||||
|
type?: number; |
||||
|
// 产品编码
|
||||
|
code?: string; |
||||
|
// 产品标题
|
||||
|
title?: string; |
||||
|
// 封面图
|
||||
|
image?: string; |
||||
|
// 产品详情
|
||||
|
content?: string; |
||||
|
// 父级分类ID
|
||||
|
parentId?: number; |
||||
|
// 产品分类ID
|
||||
|
categoryId?: number; |
||||
|
// 产品规格 0单规格 1多规格
|
||||
|
specs?: number; |
||||
|
// 货架
|
||||
|
position?: string; |
||||
|
// 单位名称 (个)
|
||||
|
unitName?: string; |
||||
|
// 进货价格
|
||||
|
price?: number; |
||||
|
// 销售价格
|
||||
|
salePrice?: number; |
||||
|
// 库存计算方式(10下单减库存 20付款减库存)
|
||||
|
deductStockType?: number; |
||||
|
// 轮播图
|
||||
|
files?: any; |
||||
|
// 销量
|
||||
|
sales?: number; |
||||
|
// 库存
|
||||
|
stock?: number; |
||||
|
// 消费赚取积分
|
||||
|
gainIntegral?: string; |
||||
|
// 推荐
|
||||
|
recommend?: number; |
||||
|
// 商户ID
|
||||
|
merchantId?: number; |
||||
|
// 状态(0:未上架,1:上架)
|
||||
|
isShow?: string; |
||||
|
// 状态, 0上架 1待上架 2待审核 3审核不通过
|
||||
|
status?: number; |
||||
|
// 备注
|
||||
|
comments?: string; |
||||
|
// 排序号
|
||||
|
sortNumber?: number; |
||||
|
// 用户ID
|
||||
|
userId?: number; |
||||
|
// 是否删除, 0否, 1是
|
||||
|
deleted?: number; |
||||
|
// 租户id
|
||||
|
tenantId?: number; |
||||
|
// 创建时间
|
||||
|
createTime?: string; |
||||
|
// 修改时间
|
||||
|
updateTime?: string; |
||||
|
// 父级分类名称
|
||||
|
parentName?: string; |
||||
|
// 父级分类路径
|
||||
|
parentPath?: string; |
||||
|
// 分类名称
|
||||
|
categoryName?: string; |
||||
|
// 评分
|
||||
|
rate?: number; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 产品搜索条件 |
||||
|
*/ |
||||
|
export interface CmsProductParam extends PageParam { |
||||
|
productId?: number; |
||||
|
status?: number; |
||||
|
keywords?: string; |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import type { ApiResult, PageResult } from '@/api'; |
||||
|
import type { CmsProductSpec, CmsProductSpecParam } from './model'; |
||||
|
import { MODULES_API_URL } from '@/config/setting'; |
||||
|
|
||||
|
/** |
||||
|
* 分页查询规格 |
||||
|
*/ |
||||
|
export async function pageCmsProductSpec(params: CmsProductSpecParam) { |
||||
|
const res = await request.get<ApiResult<PageResult<CmsProductSpec>>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec/page', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询规格列表 |
||||
|
*/ |
||||
|
export async function listCmsProductSpec(params?: CmsProductSpecParam) { |
||||
|
const res = await request.get<ApiResult<CmsProductSpec[]>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 添加规格 |
||||
|
*/ |
||||
|
export async function addCmsProductSpec(data: CmsProductSpec) { |
||||
|
const res = await request.post<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改规格 |
||||
|
*/ |
||||
|
export async function updateCmsProductSpec(data: CmsProductSpec) { |
||||
|
const res = await request.put<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除规格 |
||||
|
*/ |
||||
|
export async function removeCmsProductSpec(id?: number) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec/' + id |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除规格 |
||||
|
*/ |
||||
|
export async function removeBatchCmsProductSpec(data: (number | undefined)[]) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec/batch', |
||||
|
{ |
||||
|
data |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询规格 |
||||
|
*/ |
||||
|
export async function getCmsProductSpec(id: number) { |
||||
|
const res = await request.get<ApiResult<CmsProductSpec>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec/' + id |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
import type { PageParam } from '@/api'; |
||||
|
|
||||
|
/** |
||||
|
* 规格 |
||||
|
*/ |
||||
|
export interface CmsProductSpec { |
||||
|
// 规格ID
|
||||
|
specId?: number; |
||||
|
// 规格名称
|
||||
|
specName?: string; |
||||
|
// 规格值
|
||||
|
specValue?: string; |
||||
|
// 创建用户
|
||||
|
userId?: number; |
||||
|
// 更新者
|
||||
|
updater?: number; |
||||
|
// 备注
|
||||
|
comments?: string; |
||||
|
// 状态, 0正常, 1待修,2异常已修,3异常未修
|
||||
|
status?: number; |
||||
|
// 排序号
|
||||
|
sortNumber?: number; |
||||
|
// 租户id
|
||||
|
tenantId?: number; |
||||
|
// 创建时间
|
||||
|
createTime?: string; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 规格搜索条件 |
||||
|
*/ |
||||
|
export interface CmsProductSpecParam extends PageParam { |
||||
|
specId?: number; |
||||
|
keywords?: string; |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import type { ApiResult, PageResult } from '@/api'; |
||||
|
import type { CmsProductSpecValue, CmsProductSpecValueParam } from './model'; |
||||
|
import { MODULES_API_URL } from '@/config/setting'; |
||||
|
|
||||
|
/** |
||||
|
* 分页查询规格值 |
||||
|
*/ |
||||
|
export async function pageCmsProductSpecValue(params: CmsProductSpecValueParam) { |
||||
|
const res = await request.get<ApiResult<PageResult<CmsProductSpecValue>>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value/page', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询规格值列表 |
||||
|
*/ |
||||
|
export async function listCmsProductSpecValue(params?: CmsProductSpecValueParam) { |
||||
|
const res = await request.get<ApiResult<CmsProductSpecValue[]>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 添加规格值 |
||||
|
*/ |
||||
|
export async function addCmsProductSpecValue(data: CmsProductSpecValue) { |
||||
|
const res = await request.post<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改规格值 |
||||
|
*/ |
||||
|
export async function updateCmsProductSpecValue(data: CmsProductSpecValue) { |
||||
|
const res = await request.put<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除规格值 |
||||
|
*/ |
||||
|
export async function removeCmsProductSpecValue(id?: number) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value/' + id |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除规格值 |
||||
|
*/ |
||||
|
export async function removeBatchCmsProductSpecValue(data: (number | undefined)[]) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value/batch', |
||||
|
{ |
||||
|
data |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询规格值 |
||||
|
*/ |
||||
|
export async function getCmsProductSpecValue(id: number) { |
||||
|
const res = await request.get<ApiResult<CmsProductSpecValue>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-spec-value/' + id |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
import type { PageParam } from '@/api'; |
||||
|
|
||||
|
/** |
||||
|
* 规格值 |
||||
|
*/ |
||||
|
export interface CmsProductSpecValue { |
||||
|
// 规格值ID
|
||||
|
specValueId?: number; |
||||
|
// 规格组ID
|
||||
|
specId?: number; |
||||
|
// 规格值
|
||||
|
specValue?: string; |
||||
|
// 备注
|
||||
|
comments?: string; |
||||
|
// 排序号
|
||||
|
sortNumber?: number; |
||||
|
// 租户id
|
||||
|
tenantId?: number; |
||||
|
// 创建时间
|
||||
|
createTime?: string; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 规格值搜索条件 |
||||
|
*/ |
||||
|
export interface CmsProductSpecValueParam extends PageParam { |
||||
|
specValueId?: number; |
||||
|
keywords?: string; |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import type { ApiResult, PageResult } from '@/api'; |
||||
|
import type { CmsProductUrl, CmsProductUrlParam } from './model'; |
||||
|
import { MODULES_API_URL } from '@/config/setting'; |
||||
|
|
||||
|
/** |
||||
|
* 分页查询域名 |
||||
|
*/ |
||||
|
export async function pageCmsProductUrl(params: CmsProductUrlParam) { |
||||
|
const res = await request.get<ApiResult<PageResult<CmsProductUrl>>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url/page', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询域名列表 |
||||
|
*/ |
||||
|
export async function listCmsProductUrl(params?: CmsProductUrlParam) { |
||||
|
const res = await request.get<ApiResult<CmsProductUrl[]>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 添加域名 |
||||
|
*/ |
||||
|
export async function addCmsProductUrl(data: CmsProductUrl) { |
||||
|
const res = await request.post<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改域名 |
||||
|
*/ |
||||
|
export async function updateCmsProductUrl(data: CmsProductUrl) { |
||||
|
const res = await request.put<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除域名 |
||||
|
*/ |
||||
|
export async function removeCmsProductUrl(id?: number) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url/' + id |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除域名 |
||||
|
*/ |
||||
|
export async function removeBatchCmsProductUrl(data: (number | undefined)[]) { |
||||
|
const res = await request.delete<ApiResult<unknown>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url/batch', |
||||
|
{ |
||||
|
data |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询域名 |
||||
|
*/ |
||||
|
export async function getCmsProductUrl(id: number) { |
||||
|
const res = await request.get<ApiResult<CmsProductUrl>>( |
||||
|
MODULES_API_URL + '/cms/cms-product-url/' + id |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
import type { PageParam } from '@/api'; |
||||
|
|
||||
|
/** |
||||
|
* 域名 |
||||
|
*/ |
||||
|
export interface CmsProductUrl { |
||||
|
// 自增ID
|
||||
|
id?: number; |
||||
|
// 产品ID
|
||||
|
productId?: number; |
||||
|
// 域名类型
|
||||
|
type?: string; |
||||
|
// 域名
|
||||
|
domain?: string; |
||||
|
// 账号
|
||||
|
account?: string; |
||||
|
// 密码
|
||||
|
password?: string; |
||||
|
// 商户ID
|
||||
|
merchantId?: number; |
||||
|
// 备注
|
||||
|
comments?: string; |
||||
|
// 排序(数字越小越靠前)
|
||||
|
sortNumber?: number; |
||||
|
// 状态, 0正常, 1待确认
|
||||
|
status?: number; |
||||
|
// 创建时间
|
||||
|
createTime?: string; |
||||
|
// 租户id
|
||||
|
tenantId?: number; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 域名搜索条件 |
||||
|
*/ |
||||
|
export interface CmsProductUrlParam extends PageParam { |
||||
|
id?: number; |
||||
|
keywords?: string; |
||||
|
} |
@ -1,61 +1,74 @@ |
|||||
import type { PageParam } from '@/api'; |
import type { PageParam } from '@/api'; |
||||
import {Company} from "@/api/system/company/model"; |
|
||||
|
|
||||
/** |
/** |
||||
* 产品 |
* 产品 |
||||
*/ |
*/ |
||||
export interface Product { |
export interface Product { |
||||
|
// 自增ID
|
||||
productId?: number; |
productId?: number; |
||||
name?: string; |
|
||||
|
// 类型 0软件产品 1实物商品 2虚拟商品
|
||||
|
type?: number; |
||||
|
// 产品编码
|
||||
code?: string; |
code?: string; |
||||
type?: string; |
|
||||
logo?: string; |
|
||||
money?: number; |
|
||||
salesInitial?: number; |
|
||||
salesActual?: number; |
|
||||
stockTotal?: number; |
|
||||
|
// 产品标题
|
||||
|
title?: string; |
||||
|
// 封面图
|
||||
image?: string; |
image?: string; |
||||
backgroundColor?: string; |
|
||||
backgroundImage?: string; |
|
||||
backgroundGif?: string; |
|
||||
buyUrl?: string; |
|
||||
adminUrl?: string; |
|
||||
downUrl?: string; |
|
||||
source?: string; |
|
||||
|
// 产品详情
|
||||
content?: string; |
content?: string; |
||||
virtualViews?: string; |
|
||||
actualViews?: string; |
|
||||
userId?: string; |
|
||||
companyId?: number; |
|
||||
nickname?: string; |
|
||||
username?: string; |
|
||||
userAvatar?: string; |
|
||||
shopId?: string; |
|
||||
|
// 父级分类ID
|
||||
|
parentId?: number; |
||||
|
// 产品分类ID
|
||||
|
categoryId?: number; |
||||
|
// 产品规格 0单规格 1多规格
|
||||
|
specs?: number; |
||||
|
// 货架
|
||||
|
position?: string; |
||||
|
// 单位名称 (个)
|
||||
|
unitName?: string; |
||||
|
// 进货价格
|
||||
|
price?: string; |
||||
|
// 销售价格
|
||||
|
salePrice?: string; |
||||
|
// 库存计算方式(10下单减库存 20付款减库存)
|
||||
|
deductStockType?: number; |
||||
|
// 轮播图
|
||||
files?: string; |
files?: string; |
||||
sortNumber?: number; |
|
||||
comments?: string; |
|
||||
serverUrl?: string; |
|
||||
|
// 销量
|
||||
|
sales?: number; |
||||
|
// 库存
|
||||
|
stock?: number; |
||||
|
// 消费赚取积分
|
||||
|
gainIntegral?: string; |
||||
|
// 推荐
|
||||
|
recommend?: number; |
||||
|
// 商户ID
|
||||
|
merchantId?: number; |
||||
|
// 状态(0:未上架,1:上架)
|
||||
|
isShow?: string; |
||||
|
// 状态, 0上架 1待上架 2待审核 3审核不通过
|
||||
status?: number; |
status?: number; |
||||
callbackUrl?: string; |
|
||||
|
// 备注
|
||||
|
comments?: string; |
||||
|
// 排序号
|
||||
|
sortNumber?: number; |
||||
|
// 用户ID
|
||||
|
userId?: number; |
||||
|
// 是否删除, 0否, 1是
|
||||
|
deleted?: number; |
||||
|
// 租户id
|
||||
|
tenantId?: number; |
||||
|
// 创建时间
|
||||
createTime?: string; |
createTime?: string; |
||||
|
// 修改时间
|
||||
updateTime?: string; |
updateTime?: string; |
||||
company?: Company; |
|
||||
tenantId?: number; |
|
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 产品搜索条件 |
* 产品搜索条件 |
||||
*/ |
*/ |
||||
export interface ProductParam extends PageParam { |
export interface ProductParam extends PageParam { |
||||
title?: string; |
|
||||
code?: string; |
|
||||
productId?: number; |
productId?: number; |
||||
categoryId?: string; |
|
||||
status?: string; |
|
||||
sortNumber?: string; |
|
||||
createTime?: string; |
|
||||
username?: string; |
|
||||
nickname?: string; |
|
||||
// 商户编号
|
|
||||
merchantCode?: string; |
|
||||
|
status?: number; |
||||
|
keywords?: string; |
||||
} |
} |
||||
|
@ -0,0 +1,87 @@ |
|||||
|
<template> |
||||
|
<div class="text-center flex flex-col items-center pb-10"> |
||||
|
<h2 class="text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl lg:text-5xl"> |
||||
|
{{ title }} |
||||
|
</h2> |
||||
|
<div class="sub-title"> |
||||
|
<p class="text-gray-500 dark:text-gray-400 py-3"> |
||||
|
{{ comments }} |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="md:w-screen-xl m-auto relative md:flex md:p-0 p-4"> |
||||
|
<el-row :gutter="24" class="flex"> |
||||
|
<template v-for="(item,index) in list" :key="index"> |
||||
|
<el-col :span="6" :xs="24" class="mb-5 min-w-xs"> |
||||
|
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer"> |
||||
|
<el-image |
||||
|
:src="`https://oss.wsdns.cn/20240925/e5e47100f4b6471395b3b81f834d2902.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90`" |
||||
|
fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer"/> |
||||
|
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> |
||||
|
<p class="text-gray-700 dark:text-white text-base font-semibold flex flex-col gap-1.5"> |
||||
|
<div class="flex-1 text-xl cursor-pointer">{{ item.title }}</div> |
||||
|
<div class="text-red-500">¥{{ item.price }}</div> |
||||
|
</p> |
||||
|
<p v-if="item.price > 0" class="flex items-center gap-1.5 py-2 text-gray-500 justify-between"> |
||||
|
<div class="text-gray-500">{{ item.comments }}</div> |
||||
|
</p> |
||||
|
<div class="button-group flex justify-center mt-3"> |
||||
|
<el-button class="w-full" :icon="ElIconView" @click="openSpmUrl('/item', item,item.goodsId,true)"> |
||||
|
查看详情 |
||||
|
</el-button> |
||||
|
<el-button type="primary" v-if="item.price > 0" class="w-full" :icon="ElIconShoppingCart">购买 |
||||
|
</el-button> |
||||
|
<el-button v-else class="w-full" :icon="ElIconShoppingCart">下载</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
</el-col> |
||||
|
</template> |
||||
|
</el-row> |
||||
|
</div> |
||||
|
<div v-if="disabled" class="px-1 text-center text-gray-500 min-h-xs"> |
||||
|
没有更多了 |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import {openSpmUrl} from "~/utils/common"; |
||||
|
import dayjs from "dayjs"; |
||||
|
import {useServerRequest} from "~/composables/useServerRequest"; |
||||
|
import type {ApiResult, PageResult} from "~/api"; |
||||
|
import type {Product} from "~/api/oa/product/model"; |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
disabled?: boolean; |
||||
|
title?: string; |
||||
|
comments?: string; |
||||
|
}>(), |
||||
|
{ |
||||
|
title: '卡片标题', |
||||
|
comments: '卡片描述' |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'done'): void; |
||||
|
}>(); |
||||
|
|
||||
|
const runtimeConfig = useRuntimeConfig(); |
||||
|
const list = ref<Product[]>([]); |
||||
|
|
||||
|
// 请求数据 |
||||
|
const reload = async () => { |
||||
|
const {data: response} = await useServerRequest<ApiResult<PageResult<Product>>>('/cms/cms-product/page', { |
||||
|
baseURL: runtimeConfig.public.apiServer, params: { |
||||
|
limit: 8 |
||||
|
} |
||||
|
}) |
||||
|
if (response.value?.data) { |
||||
|
if (response.value?.data.list) { |
||||
|
list.value = response.value?.data.list; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
reload(); |
||||
|
</script> |
@ -1,104 +0,0 @@ |
|||||
<template> |
|
||||
<div class="banner m-auto relative sm:flex"> |
|
||||
<svg viewBox="0 0 1440 181" fill="none" xmlns="http://www.w3.org/2000/svg" |
|
||||
class="pointer-events-none absolute w-full top-[-2px] transition-all text-green-5 flex-shrink-0 opacity-100 duration-[400ms] opacity-80 -z-10"> |
|
||||
<mask id="path-1-inside-1_414_5526" fill="white"> |
|
||||
<path d="M0 0H1440V181H0V0Z"></path> |
|
||||
</mask> |
|
||||
<path d="M0 0H1440V181H0V0Z" fill="url(#paint0_linear_414_5526)" fill-opacity="0.22"></path> |
|
||||
<path d="M0 2H1440V-2H0V2Z" fill="url(#paint1_linear_414_5526)" mask="url(#path-1-inside-1_414_5526)"></path> |
|
||||
<defs> |
|
||||
<linearGradient id="paint0_linear_414_5526" x1="720" y1="0" x2="720" y2="181" gradientUnits="userSpaceOnUse"> |
|
||||
<stop stop-color="currentColor"></stop> |
|
||||
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop> |
|
||||
</linearGradient> |
|
||||
<linearGradient id="paint1_linear_414_5526" x1="0" y1="90.5" x2="1440" y2="90.5" gradientUnits="userSpaceOnUse"> |
|
||||
<stop stop-color="currentColor" stop-opacity="0"></stop> |
|
||||
<stop offset="0.395" stop-color="currentColor"></stop> |
|
||||
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop> |
|
||||
</linearGradient> |
|
||||
</defs> |
|
||||
</svg> |
|
||||
<div class="md:w-screen-xl m-auto"> |
|
||||
<Breadcrumb :data="form" /> |
|
||||
<div class="py-8 sm:py-16" _path="/templates" _dir="" _draft="false" _partial="false" _locale="" |
|
||||
_id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates" |
|
||||
_extension="yml"> |
|
||||
<div class="gap-8 sm:gap-y-16 lg:items-center" v-if="form"> |
|
||||
<div class="w-full"> |
|
||||
<h1 |
|
||||
class="text-2xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-3xl lg:text-4xl"> |
|
||||
<span v-if="form.title">{{ form.title }}</span> |
|
||||
</h1> |
|
||||
<div class="mt-4 text-lg text-gray-500 dark:text-gray-400"> |
|
||||
{{ form.description }} |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script setup lang="ts"> |
|
||||
import {useConfigInfo} from "~/composables/configState"; |
|
||||
import Breadcrumb from "~/components/Breadcrumb.vue"; |
|
||||
import type {Article} from "~/api/cms/article/model"; |
|
||||
import type {ArticleCategory} from "~/api/cms/category/model"; |
|
||||
import useFormData from "~/utils/use-form-data"; |
|
||||
import type {Navigation} from "~/api/cms/navigation/model"; |
|
||||
import {useServerRequest} from "~/composables/useServerRequest"; |
|
||||
import type {ApiResult} from "~/api"; |
|
||||
|
|
||||
|
|
||||
const route = useRoute(); |
|
||||
const token = useToken(); |
|
||||
const sysDomain = useSysDomain(); |
|
||||
|
|
||||
withDefaults( |
|
||||
defineProps<{ |
|
||||
form?: Article; |
|
||||
title?: string; |
|
||||
desc?: string; |
|
||||
buyUrl?: string; |
|
||||
}>(), |
|
||||
{ |
|
||||
title: 'Templates', |
|
||||
desc: 'Explore community templates to get up and running in a few seconds.', |
|
||||
demoUrl: '/product/website', |
|
||||
buyUrl: 'https://github.com/websoft9/ansible-templates' |
|
||||
} |
|
||||
); |
|
||||
|
|
||||
const config = useConfigInfo(); |
|
||||
|
|
||||
|
|
||||
|
|
||||
// 配置信息 |
|
||||
const { form, assignFields } = useFormData<ArticleCategory>({ |
|
||||
categoryId: undefined, |
|
||||
categoryName: undefined, |
|
||||
parentId: undefined, |
|
||||
parentName: undefined, |
|
||||
parentPath: undefined, |
|
||||
parentStatus: undefined, |
|
||||
categoryPath: undefined, |
|
||||
currentTitle: undefined, |
|
||||
style: undefined, |
|
||||
title: undefined, |
|
||||
description: undefined |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
// 请求数据 |
|
||||
const reload = async () => { |
|
||||
const {data: response} = await useServerRequest<ApiResult<Navigation>>(`/cms/cms-article-category/${route.params.categoryId}`) |
|
||||
if(response.value?.data){ |
|
||||
assignFields(response.value.data) |
|
||||
form.categoryName = response.value.data.title |
|
||||
form.description = response.value.data.title |
|
||||
} |
|
||||
} |
|
||||
reload(); |
|
||||
|
|
||||
</script> |
|
@ -0,0 +1,103 @@ |
|||||
|
<template> |
||||
|
<PageBanner :layout="layout" title="社区" desc="分享研发成果 交流技术经验" /> |
||||
|
<el-tabs v-model="activeName" class="md:w-screen-xl m-auto relative sm:flex pb-2" @tab-click="handleClick"> |
||||
|
<el-tab-pane label="轻松一刻" name="happy"></el-tab-pane> |
||||
|
<el-tab-pane label="企业官网" name="website"></el-tab-pane> |
||||
|
<el-tab-pane label="企业商城" name="weShop"></el-tab-pane> |
||||
|
<el-tab-pane label="内容管理" name="cms"></el-tab-pane> |
||||
|
<el-tab-pane label="点餐外卖" name="food"></el-tab-pane> |
||||
|
<el-tab-pane label="派单系统" name="task"></el-tab-pane> |
||||
|
<el-tab-pane label="办公OA" name="oa"></el-tab-pane> |
||||
|
<el-tab-pane label="问答" name="ask"></el-tab-pane> |
||||
|
<el-tab-pane label="分享" name="share"></el-tab-pane> |
||||
|
</el-tabs> |
||||
|
<CardList :list="list" :disabled="disabled" @done="onSearch" /> |
||||
|
|
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import type {ApiResult, PageResult} from "~/api"; |
||||
|
import {useServerRequest} from "~/composables/useServerRequest"; |
||||
|
import {useWebsite} from "~/composables/configState"; |
||||
|
import type {Navigation} from "~/api/cms/navigation/model"; |
||||
|
import type {CompanyParam} from "~/api/system/company/model"; |
||||
|
import type {Article} from "~/api/cms/article/model"; |
||||
|
import CardList from './components/CardList.vue'; |
||||
|
|
||||
|
const route = useRoute(); |
||||
|
|
||||
|
// 页面信息 |
||||
|
const runtimeConfig = useRuntimeConfig(); |
||||
|
const list = ref<Article[]>([]); |
||||
|
const page = ref<number>(1); |
||||
|
const resultText = ref(''); |
||||
|
const layout = ref<any>(); |
||||
|
const disabled = ref<boolean>(false); |
||||
|
const activeName = ref(undefined) |
||||
|
|
||||
|
// 获取状态 |
||||
|
const form = ref<Navigation>(); |
||||
|
const website = useWebsite(); |
||||
|
|
||||
|
// 搜索表单 |
||||
|
const where = reactive<CompanyParam>({ |
||||
|
keywords: '' |
||||
|
}); |
||||
|
|
||||
|
const handleClick = (e:any) => { |
||||
|
console.log(e.index) |
||||
|
} |
||||
|
|
||||
|
const onSearch = () => { |
||||
|
if(!disabled.value){ |
||||
|
page.value++; |
||||
|
reload(route.path); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 请求数据 |
||||
|
const reload = async (path: string) => { |
||||
|
const {data: response} = await useServerRequest<ApiResult<PageResult<Article>>>('/cms/cms-article/page',{baseURL: runtimeConfig.public.apiServer, params: { |
||||
|
page: page.value, |
||||
|
limit: 8, |
||||
|
userId: route.params.userId, |
||||
|
keywords: where.keywords |
||||
|
}}) |
||||
|
if(response.value?.data){ |
||||
|
if (list.value.length < response.value?.data.count) { |
||||
|
disabled.value = false; |
||||
|
if (response.value?.data.list) { |
||||
|
list.value = list.value.concat(response.value?.data.list); |
||||
|
} |
||||
|
}else { |
||||
|
disabled.value = true; |
||||
|
} |
||||
|
if(response.value.data.count == 0){ |
||||
|
resultText.value = '暂无相关结果' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const { data: nav } = await useServerRequest<ApiResult<Navigation>>('/cms/cms-navigation/getNavigationByPath',{query: {path: route.path}}) |
||||
|
if(nav.value?.data){ |
||||
|
form.value = nav.value?.data; |
||||
|
} |
||||
|
// 页面布局 |
||||
|
if(form.value?.layout){ |
||||
|
layout.value = JSON.parse(form.value?.layout) |
||||
|
} |
||||
|
|
||||
|
useHead({ |
||||
|
title: `社区 - ${website.value.websiteName}`, |
||||
|
bodyAttrs: { |
||||
|
class: "page-container", |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
watch( |
||||
|
() => route.path, |
||||
|
(path) => { |
||||
|
reload(path); |
||||
|
}, |
||||
|
{ immediate: true } |
||||
|
); |
||||
|
</script> |
@ -1,87 +0,0 @@ |
|||||
<template> |
|
||||
<div class="banner m-auto relative sm:flex"> |
|
||||
<svg viewBox="0 0 1440 181" fill="none" xmlns="http://www.w3.org/2000/svg" |
|
||||
class="pointer-events-none absolute w-full top-[-2px] transition-all text-green-5 flex-shrink-0 opacity-100 duration-[400ms] opacity-80 -z-10"> |
|
||||
<mask id="path-1-inside-1_414_5526" fill="white"> |
|
||||
<path d="M0 0H1440V181H0V0Z"></path> |
|
||||
</mask> |
|
||||
<path d="M0 0H1440V181H0V0Z" fill="url(#paint0_linear_414_5526)" fill-opacity="0.22"></path> |
|
||||
<path d="M0 2H1440V-2H0V2Z" fill="url(#paint1_linear_414_5526)" mask="url(#path-1-inside-1_414_5526)"></path> |
|
||||
<defs> |
|
||||
<linearGradient id="paint0_linear_414_5526" x1="720" y1="0" x2="720" y2="181" gradientUnits="userSpaceOnUse"> |
|
||||
<stop stop-color="currentColor"></stop> |
|
||||
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop> |
|
||||
</linearGradient> |
|
||||
<linearGradient id="paint1_linear_414_5526" x1="0" y1="90.5" x2="1440" y2="90.5" gradientUnits="userSpaceOnUse"> |
|
||||
<stop stop-color="currentColor" stop-opacity="0"></stop> |
|
||||
<stop offset="0.395" stop-color="currentColor"></stop> |
|
||||
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop> |
|
||||
</linearGradient> |
|
||||
</defs> |
|
||||
</svg> |
|
||||
<div class="md:w-screen-xl m-auto md:p-0 px-4"> |
|
||||
<div class="py-8 sm:py-16" _path="/templates" _dir="" _draft="false" _partial="false" _locale="" |
|
||||
_id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates" |
|
||||
_extension="yml"> |
|
||||
<div class="gap-8 sm:gap-y-16 grid lg:grid-cols-2 lg:items-center" v-if="layout"> |
|
||||
<div class=""> |
|
||||
<h1 |
|
||||
class="text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl lg:text-5xl"> |
|
||||
<span v-if="layout.title">{{ layout.title }}</span> |
|
||||
<span v-if="layout.name">{{ layout.name }}</span> |
|
||||
</h1> |
|
||||
|
|
||||
<div class="mt-4 text-lg text-gray-500 dark:text-gray-400"> |
|
||||
{{ layout.description }} |
|
||||
</div> |
|
||||
|
|
||||
<el-space class="mt-4"> |
|
||||
<el-button |
|
||||
v-if="layout.buyUrl" |
|
||||
:icon="ElIconBottom" |
|
||||
size="large" |
|
||||
@click="openSpmUrl(`http://git.gxwebsoft.com/gxwebsoft/websoft-cms.git`, {},0,true)" |
|
||||
> |
|
||||
下载模版 |
|
||||
</el-button> |
|
||||
<el-button |
|
||||
:icon="ElIconMemo" |
|
||||
size="large" |
|
||||
v-if="layout.docUrl" |
|
||||
@click="openSpmUrl(`/docs`)" |
|
||||
> |
|
||||
帮助文档 |
|
||||
</el-button> |
|
||||
</el-space> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script setup lang="ts"> |
|
||||
import {useConfigInfo} from "~/composables/configState"; |
|
||||
import {openSpmUrl} from "~/utils/common"; |
|
||||
|
|
||||
const token = useToken(); |
|
||||
const sysDomain = useSysDomain(); |
|
||||
|
|
||||
withDefaults( |
|
||||
defineProps<{ |
|
||||
layout?: any; |
|
||||
title?: string; |
|
||||
desc?: string; |
|
||||
buyUrl?: string; |
|
||||
}>(), |
|
||||
{ |
|
||||
title: 'Templates', |
|
||||
desc: 'Explore community templates to get up and running in a few seconds.', |
|
||||
demoUrl: '/product/website', |
|
||||
buyUrl: 'https://github.com/websoft9/ansible-templates' |
|
||||
} |
|
||||
); |
|
||||
|
|
||||
const config = useConfigInfo(); |
|
||||
|
|
||||
</script> |
|
@ -0,0 +1,48 @@ |
|||||
|
<template> |
||||
|
<div class="md:w-screen-xl m-auto relative sm:flex" v-infinite-scroll="load"> |
||||
|
<el-row :gutter="24" class="flex"> |
||||
|
<template v-for="(item,index) in list" :key="index"> |
||||
|
<el-col :span="6" class="mb-5 min-w-xs"> |
||||
|
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/detail`,item,item.articleId,true)"> |
||||
|
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" /> |
||||
|
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> |
||||
|
<p class="text-gray-700 dark:text-white text-base font-semibold flex items-center gap-1.5"> |
||||
|
<span class="flex-1 text-xl cursor-pointer max-h-[57px] overflow-hidden">{{ item.title }}</span> |
||||
|
</p> |
||||
|
<p class="flex items-center gap-1.5 py-2 text-gray-500"> |
||||
|
<el-avatar :src="item.avatar" :size="20" /> |
||||
|
<span>{{ item.nickname }} · {{ dayjs(item.createTime).format('MM-DD hh:mm') }}</span> |
||||
|
</p> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
</el-col> |
||||
|
</template> |
||||
|
</el-row> |
||||
|
</div> |
||||
|
<div v-if="disabled" class="px-1 text-center text-gray-500 min-h-xs"> |
||||
|
没有更多了 |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import {openSpmUrl} from "~/utils/common"; |
||||
|
import dayjs from "dayjs"; |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
list?: any[]; |
||||
|
disabled?: boolean; |
||||
|
}>(), |
||||
|
{} |
||||
|
); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'done'): void; |
||||
|
}>(); |
||||
|
|
||||
|
const load = () => { |
||||
|
if(!props.disabled){ |
||||
|
emit('done') |
||||
|
} |
||||
|
} |
||||
|
</script> |
@ -0,0 +1,91 @@ |
|||||
|
<template> |
||||
|
<PageBanner :title="`${form?.title}`" :desc="`${form?.comments}`" /> |
||||
|
<CardList :list="list" :disabled="disabled" @done="onSearch" /> |
||||
|
|
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import type {ApiResult, PageResult} from "~/api"; |
||||
|
import {useServerRequest} from "~/composables/useServerRequest"; |
||||
|
import {useWebsite} from "~/composables/configState"; |
||||
|
import type {Navigation} from "~/api/cms/navigation/model"; |
||||
|
import type {CompanyParam} from "~/api/system/company/model"; |
||||
|
import type {Article} from "~/api/cms/article/model"; |
||||
|
import CardList from './components/CardList.vue'; |
||||
|
import type {ArticleCategory} from "~/api/cms/category/model"; |
||||
|
|
||||
|
const route = useRoute(); |
||||
|
|
||||
|
// 页面信息 |
||||
|
const runtimeConfig = useRuntimeConfig(); |
||||
|
const list = ref<Article[]>([]); |
||||
|
const page = ref<number>(1); |
||||
|
const resultText = ref(''); |
||||
|
const layout = ref<any>(); |
||||
|
const disabled = ref<boolean>(false); |
||||
|
const activeName = ref(undefined) |
||||
|
|
||||
|
// 获取状态 |
||||
|
const form = ref<ArticleCategory>(); |
||||
|
const website = useWebsite(); |
||||
|
|
||||
|
// 搜索表单 |
||||
|
const where = reactive<CompanyParam>({ |
||||
|
keywords: '' |
||||
|
}); |
||||
|
|
||||
|
const handleClick = (e:any) => { |
||||
|
console.log(e.index) |
||||
|
} |
||||
|
|
||||
|
const onSearch = () => { |
||||
|
if(!disabled.value){ |
||||
|
page.value++; |
||||
|
reload(route.path); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 请求数据 |
||||
|
const reload = async (path: string) => { |
||||
|
const {data: response} = await useServerRequest<ApiResult<PageResult<Article>>>('/cms/cms-article/page',{baseURL: runtimeConfig.public.apiServer, params: { |
||||
|
page: page.value,limit: 8,categoryId: getIdBySpm(4), keywords: where.keywords |
||||
|
}}) |
||||
|
if(response.value?.data){ |
||||
|
if (list.value.length < response.value?.data.count) { |
||||
|
disabled.value = false; |
||||
|
if (response.value?.data.list) { |
||||
|
list.value = list.value.concat(response.value?.data.list); |
||||
|
} |
||||
|
}else { |
||||
|
disabled.value = true; |
||||
|
} |
||||
|
if(response.value.data.count == 0){ |
||||
|
resultText.value = '暂无相关结果' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const { data: nav } = await useServerRequest<ApiResult<Navigation>>(`/cms/cms-navigation/${getIdBySpm(4)}`) |
||||
|
if(nav.value?.data){ |
||||
|
form.value = nav.value?.data; |
||||
|
console.log(form); |
||||
|
} |
||||
|
// 页面布局 |
||||
|
// if(form.value?.layout){ |
||||
|
// layout.value = JSON.parse(form.value?.layout) |
||||
|
// } |
||||
|
|
||||
|
useHead({ |
||||
|
title: `文章列表 - ${website.value.websiteName}`, |
||||
|
bodyAttrs: { |
||||
|
class: "page-container", |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
watch( |
||||
|
() => route.path, |
||||
|
(path) => { |
||||
|
reload(path); |
||||
|
}, |
||||
|
{ immediate: true } |
||||
|
); |
||||
|
</script> |
@ -0,0 +1,64 @@ |
|||||
|
<template> |
||||
|
<el-affix v-if="form" :offset="offset" @change="onAffix"> |
||||
|
<el-button type="text" color="gray"> |
||||
|
<div class="text-xl text-gray-600 ">你可能还喜欢</div> |
||||
|
<el-icon class="el-icon--right text-gray-600" color="#999999"> |
||||
|
<ArrowRightBold/> |
||||
|
</el-icon> |
||||
|
</el-button> |
||||
|
<template v-for="(item,index) in list" :key="index"> |
||||
|
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer mt-3" |
||||
|
@click="openSpmUrl(`/detail`,item,item.articleId,true)"> |
||||
|
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer"/> |
||||
|
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> |
||||
|
<p class="text-gray-700 dark:text-white text-base font-semibold flex items-center gap-1.5"> |
||||
|
<span class="flex-1 text-xl cursor-pointer max-h-[57px] overflow-hidden">{{ item.title }}</span> |
||||
|
</p> |
||||
|
<p class="flex items-center gap-1.5 py-2 text-gray-500"> |
||||
|
<el-avatar :src="item.avatar" :size="20"/> |
||||
|
<span>{{ item.nickname }} · {{ dayjs(item.createTime).format('MM-DD hh:mm') }}</span> |
||||
|
</p> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
</template> |
||||
|
</el-affix> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ArrowRightBold } from '@element-plus/icons-vue' |
||||
|
import {getIdBySpm, openSpmUrl} from "~/utils/common"; |
||||
|
import dayjs from "dayjs"; |
||||
|
import type {Article} from "~/api/cms/article/model"; |
||||
|
import {useServerRequest} from "~/composables/useServerRequest"; |
||||
|
import type {ApiResult, PageResult} from "~/api"; |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
title?: string; |
||||
|
form?: Article; |
||||
|
}>(), |
||||
|
{} |
||||
|
); |
||||
|
|
||||
|
const list = ref<Article[]>([]); |
||||
|
const isAffix = ref<any>(); |
||||
|
const offset = ref(70) |
||||
|
|
||||
|
const onAffix = (e: any) => { |
||||
|
isAffix.value = e; |
||||
|
} |
||||
|
|
||||
|
const {data: response} = await useServerRequest<ApiResult<PageResult<Article>>>('/cms/cms-article/page', { |
||||
|
params: { |
||||
|
categoryId: getIdBySpm(4), |
||||
|
limit: 3 |
||||
|
} |
||||
|
}) |
||||
|
if (response.value?.data) { |
||||
|
list.value = response.value.data.list; |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="less"> |
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue