1.文章接口联调

sws 2024-08-21
v1.0.0
sws 2024-08-21 10:03:44 +08:00
parent 10ed9418ef
commit cff877f15f
10 changed files with 94 additions and 41 deletions

35
src/api/article.ts Normal file
View File

@ -0,0 +1,35 @@
import request from '@/utils/request';
class ArticleAPI {
/** 链接初始化接口 */
static getInit() {
return request({
url: `diyapi/linkinit`,
method: 'post',
});
}
/** 文章指定数据 */
static getAppointList(data: any) {
return request({
url: `diyapi/articleappointdata`,
method: 'post',
data,
});
}
/** 文章自动数据 */
static getAutoList(data: any) {
return request({
url: `diyapi/articleautodata`,
method: 'post',
data,
});
}
}
export default ArticleAPI;
// 分类树结构
export interface Tree {
/** 主键 */
id: string;
}

View File

@ -357,7 +357,7 @@ const add_event = () => {
//#region -----------------------------------------------start
const hot_dialog_visible = ref(false);
interface formData {
link: linkData;
link: pageLinkList;
name: string;
}
const form = ref<formData>({

View File

@ -62,7 +62,7 @@
</template>
<script lang="ts" setup>
import type { FormInstance, FormRules } from 'element-plus';
import { urlValueStore, urlValue, pageLinkList } from '@/store';
import { urlValueStore } from '@/store';
const url_value_store = urlValueStore();
const props = defineProps({
status: {
@ -188,7 +188,7 @@ const on_submit = () => {
if (!ruleFormRef.value) return;
ruleFormRef.value.validate((valid: boolean) => {
if (valid) {
let new_value: linkData = {
let new_value: pageLinkList = {
name: form.key,
link: form.key,
};

View File

@ -97,6 +97,8 @@
</template>
<script setup lang="ts">
import { get_math } from '@/utils';
import ArticleAPI from '@/api/article';
import { articleStore } from '@/store/article';
const props = defineProps({
value: {
type: Object,

View File

@ -72,8 +72,8 @@
<script setup lang="ts">
import { get_math } from '@/utils';
import ShopAPI from '@/api/shop';
import { ShopStore } from '@/store';
const shop_store = ShopStore();
import { shopStore } from '@/store';
const shop_store = shopStore();
interface shop_list {
id: number;
name: string;

View File

@ -96,8 +96,8 @@
<script setup lang="ts">
import { get_math } from '@/utils';
import ShopAPI from '@/api/shop';
import { ShopStore } from '@/store';
const shop_store = ShopStore();
import { shopStore } from '@/store';
const shop_store = shopStore();
interface shop_list {
id: number;
name: string;

29
src/store/article.ts Normal file
View File

@ -0,0 +1,29 @@
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
export const articleStore = defineStore('article', () => {
// 链接是否需要调接口判断
const is_article_api = ref(false);
// 链接数据
const article = ref<article_list[]>([]);
// 存储链接数据
const set_article = (data: article_list[]) => {
article.value = data;
is_article_api.value = true;
};
// 如果为false 则转为true
const set_is_article_api = (bool: boolean) => {
is_article_api.value = bool;
};
return {
article,
is_article_api,
set_article,
set_is_article_api,
};
});
interface article_list {
id: number;
name: string;
url?: string;
}

View File

@ -1,7 +1,7 @@
import { ref } from 'vue';
import { defineStore } from 'pinia';
export const ShopStore = defineStore('shop', () => {
export const shopStore = defineStore('shop', () => {
interface product_list {
id: number;
name: string;

View File

@ -28,27 +28,3 @@ export const urlValueStore = defineStore('urlValue', () => {
set_is_url_value_api,
};
});
export interface pageLinkList {
id?: string;
name: string;
type?: string;
page?: string;
data?: pageLinkList[];
items?: pageLinkList[];
icon?: string;
link?: string;
lng?: number;
lat?: number;
hasChildren?: boolean;
children?: pageLinkList[];
}
// 分类树结构
export interface urlValue {
goods_category: any[];
brand_list: any[];
brand_category: any[];
article_category_list: any[];
page_link_list: pageLinkList[];
}

29
src/types/global.d.ts vendored
View File

@ -53,7 +53,7 @@ declare global {
box_shadow_spread: number;
};
// 图片/视频/文件的数据类型
export interface uploadList {
type uploadList = {
id?: number;
url: string;
original?: string;
@ -62,7 +62,7 @@ declare global {
size?: number;
type?: string;
error?: boolean;
}
};
/**
*
*/
@ -100,20 +100,31 @@ declare global {
box_shadow_spread: number;
background_img_url: uploadList[];
};
/**
*
*/
type linkData = {
id?: number;
type pageLinkList = {
id?: string;
name?: string;
link?: String;
data?: Data[];
type?: string;
page?: string;
data?: pageLinkList[];
items?: pageLinkList[];
icon?: string;
link?: string;
lng?: number;
lat?: number;
hasChildren?: boolean;
children?: linkData[];
children?: pageLinkList[];
};
// 分类树结构
type urlValue = {
goods_category: any[];
brand_list: any[];
brand_category: any[];
article_category_list: any[];
page_link_list: pageLinkList[];
};
/**
@ -135,7 +146,7 @@ declare global {
drag_start: rectCoords;
drag_end: rectCoords;
name: string;
link: linkData;
link: pageLinkList;
};
}
export {};