diff --git a/index.html b/index.html
index 9ab1f01..57ab2b1 100644
--- a/index.html
+++ b/index.html
@@ -1,15 +1,17 @@
-
-
-
+
+
+
+
@@ -19,8 +21,8 @@
PowerX Dashboard
-
-
-
+
+
+
diff --git a/package-lock.json b/package-lock.json
index a6cebe7..1179226 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18,7 +18,7 @@
"@fullcalendar/timegrid": "^6.1.6",
"@fullcalendar/vue3": "^6.1.6",
"@vueuse/core": "^9.3.0",
- "@yaoyaochi/weyui": "^1.3.3",
+ "@yaoyaochi/weyui": "^1.4.0",
"axios": "^0.24.0",
"dayjs": "^1.11.7",
"lodash": "^4.17.21",
@@ -2205,9 +2205,9 @@
}
},
"node_modules/@yaoyaochi/weyui": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/@yaoyaochi/weyui/-/weyui-1.3.3.tgz",
- "integrity": "sha512-KDKBlXcK3DlfaVnbRLBRtNfyl1riW7JABw952lxT0NEqjhNKZ17yZJKoY8l1kpR8THIHT8NO3kv9R+IsZdJ8Vw=="
+ "version": "1.4.0",
+ "resolved": "http://npm.moonwife.top/@yaoyaochi/weyui/-/weyui-1.4.0.tgz",
+ "integrity": "sha512-I6BTi9ER7WQZxLvBQXTrrDIUMd7Gu4Dbj53A2RAdE3W147aN02hvJwTRuI8P7ylX1VKNFaoln1NiecZgS2OYeA=="
},
"node_modules/acorn": {
"version": "8.10.0",
diff --git a/package.json b/package.json
index 89a6932..49006a5 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"@fullcalendar/timegrid": "^6.1.6",
"@fullcalendar/vue3": "^6.1.6",
"@vueuse/core": "^9.3.0",
- "@yaoyaochi/weyui": "^1.3.3",
+ "@yaoyaochi/weyui": "^1.4.0",
"axios": "^0.24.0",
"dayjs": "^1.11.7",
"lodash": "^4.17.21",
diff --git a/src/api/wechat/official-account/media.ts b/src/api/wechat/official-account/media.ts
index e6f792b..4f8cfb5 100644
--- a/src/api/wechat/official-account/media.ts
+++ b/src/api/wechat/official-account/media.ts
@@ -1,7 +1,7 @@
import axios from 'axios';
import { PrefixUriAdmin } from '@/api';
-const UriOAMedia = '/wechat/official-account/medias';
+export const UriOAMedia = '/wechat/official-account/medias';
export interface GetMediaRequest {
mediaId: string;
@@ -36,3 +36,34 @@ export function GetMediaOtherList(request: GetMediaOtherListRequest) {
request,
);
}
+
+export interface UploadMediaRequest {
+ media: any;
+}
+
+export interface UploadMediaReply {
+ success: boolean;
+ data: any;
+}
+
+export function UploadMedia(request: UploadMediaRequest) {
+ return axios.post
(
+ `${PrefixUriAdmin + UriOAMedia}`,
+ request,
+ );
+}
+
+export interface DeleteMediaRequest {
+ mediaId: string;
+}
+
+export interface DeleteMediaReply {
+ success: boolean;
+ data: any;
+}
+
+export function DeleteMedia(request: DeleteMediaRequest) {
+ return axios.delete(
+ `${PrefixUriAdmin + UriOAMedia}/${request.mediaId}`,
+ );
+}
diff --git a/src/views/wechat/official-account/media/index.vue b/src/views/wechat/official-account/media/index.vue
index cf65374..0362942 100644
--- a/src/views/wechat/official-account/media/index.vue
+++ b/src/views/wechat/official-account/media/index.vue
@@ -1,19 +1,20 @@
@@ -22,9 +23,17 @@
import { onMounted, ref } from 'vue';
import { WOffiAccountMedia } from '@yaoyaochi/weyui';
import {
+ DeleteMedia,
GetMedia,
GetMediaOtherList,
+ UriOAMedia,
} from '@/api/wechat/official-account/media';
+ import { PrefixUriAdmin } from '@/api';
+ import { getToken } from '@/utils/auth';
+
+ const header = ref>({});
+ const token = getToken();
+ header.value.Authorization = `Bearer ${token}`;
const total = ref(0); // 总条数
const pageSize = ref(10); // 每页条数
@@ -36,10 +45,11 @@
const refreshMediaList = async (type: string) => {
const res = await GetMediaOtherList({
- type: dataType.value,
+ type,
offset: current.value,
count: pageSize.value,
});
+ console.log(res);
mediaData.value.item = res.data.item;
total.value = res.data.total_count;
};
@@ -56,6 +66,15 @@
}
};
+ const onDeleteMedia = async (itemId: string) => {
+ // 删除图片
+ console.log(itemId);
+ const res = await DeleteMedia({ mediaId: itemId });
+ if (res.data.success) {
+ await refreshMediaList(dataType.value);
+ }
+ };
+
const onChangeTab = async (item: any) => {
// 切换tab
dataType.value = item;