diff --git a/package-lock.json b/package-lock.json
index 0627df6..e4b4e02 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,8 +11,7 @@
"lib-flexible": "^0.3.2",
"next": "14.1.3",
"react": "^18",
- "react-dom": "^18",
- "weixin-js-sdk": "^1.6.5"
+ "react-dom": "^18"
},
"devDependencies": {
"@commitlint/cli": "^19.1.0",
@@ -8627,11 +8626,6 @@
}
}
},
- "node_modules/weixin-js-sdk": {
- "version": "1.6.5",
- "resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz",
- "integrity": "sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ=="
- },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz",
diff --git a/package.json b/package.json
index ed46175..c3c8016 100644
--- a/package.json
+++ b/package.json
@@ -12,8 +12,7 @@
"lib-flexible": "^0.3.2",
"next": "14.1.3",
"react": "^18",
- "react-dom": "^18",
- "weixin-js-sdk": "^1.6.5"
+ "react-dom": "^18"
},
"devDependencies": {
"@commitlint/cli": "^19.1.0",
diff --git a/public/img/share.png b/public/img/share.png
new file mode 100644
index 0000000..a87c44e
Binary files /dev/null and b/public/img/share.png differ
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 9010caf..612632b 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -34,6 +34,8 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
`})();`,
}}
/>
+ {/* eslint-disable-next-line @next/next/no-sync-scripts */}
+
{children}
diff --git a/src/components/WXComponent/WXShareBtn.tsx b/src/components/WXComponent/WXShareBtn.tsx
index 1b0fab6..1a0c2f2 100644
--- a/src/components/WXComponent/WXShareBtn.tsx
+++ b/src/components/WXComponent/WXShareBtn.tsx
@@ -2,8 +2,6 @@
import { /** useState, */ useEffect, useRef } from 'react';
-import wx from 'weixin-js-sdk';
-
// import ImageWithBasePath from '@/components/ImageWithBasePath';
import { APPID } from '@/const';
@@ -29,7 +27,8 @@ export default function WXShareBtn() {
// };
useEffect(() => {
- if (!inWX) return;
+ const wx = window.wx;
+ if (!inWX || !wx) return;
const { origin, pathname, searchParams } = new URL(window.location.href);
const code = searchParams.get('code');
@@ -56,7 +55,12 @@ export default function WXShareBtn() {
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名
- jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'onMenuShareTimeline'], // 必填,需要使用的JS接口列表
+ jsApiList: [
+ 'updateAppMessageShareData',
+ 'updateTimelineShareData',
+ 'onMenuShareAppMessage',
+ 'onMenuShareTimeline',
+ ], // 必填,需要使用的JS接口列表
});
wx.ready(function () {
// setWxPrepared(true);
@@ -70,11 +74,12 @@ export default function WXShareBtn() {
title: '雀乐', // 分享标题
link: `${origin}${pathname}${queryArr.length > 0 ? `?${queryArr.join('&')}` : ''}`, // 分享链接
desc: '一起记录独立音乐', // 分享描述
- imgUrl: 'https://indie.s3.bitiful.net/share.png', // 分享图标
+ imgUrl: 'https://m.indie.cn/img/share.png', // 分享图标
success() {},
cancel() {},
};
wx.updateAppMessageShareData(shareParam);
+ wx.updateTimelineShareData(shareParam);
wx.onMenuShareAppMessage(shareParam);
wx.onMenuShareTimeline(shareParam);
});
diff --git a/yarn.lock b/yarn.lock
index 955fc60..9e7c425 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4778,11 +4778,6 @@ util-deprecate@^1.0.2:
optionalDependencies:
fsevents "~2.3.3"
-weixin-js-sdk@^1.6.5:
- version "1.6.5"
- resolved "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
- integrity sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ==
-
which-boxed-primitive@^1.0.2:
version "1.0.2"
resolved "https://registry.npmmirror.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz"