Browse Source

🎨 补充发贴图提交链接到后端

快乐的梦鱼 2 weeks ago
parent
commit
e833738ef7

+ 4 - 1
src/pages/home/chat/dependent/post/publish.vue

@@ -197,13 +197,16 @@ function publish() {
   (uni as any).shareToOfficialAccount({
     ...data,
     success: (postObj: { postUrl: string }) => {
-      //TODO: 换接口
       LightVillageApi.publishMessage(new PostMessage().setSelfValues({
         title: title.value,
         content: content.value,
         images: images.value.map((image) => image.url),
         image: images.value[0].url,
         path: `/pages/index`,
+        villageId: querys.value.villageId,
+        userId: authStore.userId,
+        jumpUrl: postObj.postUrl,
+        topicName: querys.value.tag || '亮乡源',
       })).then(() => {
         console.log('发布成功');
       }).catch((e) => {

+ 15 - 3
src/pages/home/composeabe/OfficialAccount.ts

@@ -1,8 +1,20 @@
-export function useOfficialAccount() {
+import LightVillageApi, { PostMessage } from "@/api/light/LightVillageApi";
 
+export function useOfficialAccount(getInfoObj: () => any) {
 
-  function onPublishSuccess(res: any) {
-    console.log(res);
+  function onPublishSuccess(postObj: { postUrl: string }) {
+    const res = getInfoObj();
+    LightVillageApi.publishMessage(new PostMessage().setSelfValues({
+      path: `/pages/index`,
+      villageId: res.villageId,
+      userId: res.userId,
+      jumpUrl: postObj.postUrl,
+      topicName: res.tag || '亮乡源',
+    })).then(() => {
+      console.log('发布成功');
+    }).catch((e) => {
+      console.error(e);
+    });
   }
 
   return {