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 //#region -----------------------------------------------start
const hot_dialog_visible = ref(false); const hot_dialog_visible = ref(false);
interface formData { interface formData {
link: linkData; link: pageLinkList;
name: string; name: string;
} }
const form = ref<formData>({ const form = ref<formData>({

View File

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

View File

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

View File

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

View File

@ -96,8 +96,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { get_math } from '@/utils'; import { get_math } from '@/utils';
import ShopAPI from '@/api/shop'; import ShopAPI from '@/api/shop';
import { ShopStore } from '@/store'; import { shopStore } from '@/store';
const shop_store = ShopStore(); const shop_store = shopStore();
interface shop_list { interface shop_list {
id: number; id: number;
name: string; 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 { ref } from 'vue';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
export const ShopStore = defineStore('shop', () => { export const shopStore = defineStore('shop', () => {
interface product_list { interface product_list {
id: number; id: number;
name: string; name: string;

View File

@ -28,27 +28,3 @@ export const urlValueStore = defineStore('urlValue', () => {
set_is_url_value_api, 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; box_shadow_spread: number;
}; };
// 图片/视频/文件的数据类型 // 图片/视频/文件的数据类型
export interface uploadList { type uploadList = {
id?: number; id?: number;
url: string; url: string;
original?: string; original?: string;
@ -62,7 +62,7 @@ declare global {
size?: number; size?: number;
type?: string; type?: string;
error?: boolean; error?: boolean;
} };
/** /**
* *
*/ */
@ -100,20 +100,31 @@ declare global {
box_shadow_spread: number; box_shadow_spread: number;
background_img_url: uploadList[]; background_img_url: uploadList[];
}; };
/** /**
* *
*/ */
type linkData = { type pageLinkList = {
id?: number; id?: string;
name?: string; name?: string;
link?: String; type?: string;
data?: Data[]; page?: string;
data?: pageLinkList[];
items?: pageLinkList[];
icon?: string; icon?: string;
link?: string;
lng?: number; lng?: number;
lat?: number; lat?: number;
hasChildren?: boolean; 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_start: rectCoords;
drag_end: rectCoords; drag_end: rectCoords;
name: string; name: string;
link: linkData; link: pageLinkList;
}; };
} }
export {}; export {};