Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-11 11:20:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
152a4c04ca820fc3778190141894129d1f596b6c
152a4c04
1 parent
6889816d
测试分享模块-路由入口页面
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
0 deletions
src/router.js
src/utils/share.js
src/views/me/donateList.vue
src/router.js
View file @
152a4c0
import
{
createRouter
,
createWebHashHistory
}
from
'vue-router'
;
import
routes
from
'./route.js'
;
// TODO: 微信分享测试
import
share
from
'@/utils/share'
// 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置,但我们在这里
// 暂时保持简单
...
...
@@ -9,4 +12,14 @@ const router = createRouter({
routes
});
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
next
()
})
router
.
afterEach
((
to
,
from
,
next
)
=>
{
// console.warn(to);
// console.warn(wx);
// share(to)
})
export
default
router
;
\ No newline at end of file
...
...
src/utils/share.js
0 → 100644
View file @
152a4c0
import
wx
from
'weixin-js-sdk'
import
axios
from
'@/utils/axios'
;
const
fn
=
(
to
)
=>
{
// 路由名
let
ruleName
=
location
.
href
.
split
(
'#/'
)[
1
].
split
(
'?'
)[
0
];
const
icon
=
'https://cdn.lifeat.cn/webappgroup/betterLifelogo.png'
const
shareInfoMap
=
{
'client/index'
:
{
title
:
'童声无界'
,
desc
:
'引导页'
,
icon
},
'client/chooseSchool'
:
{
title
:
'选择幼儿园'
,
desc
:
'引导页'
,
icon
},
default
:
{
title
:
to
.
name
,
desc
:
window
.
location
.
href
,
icon
},
}
let
infoMap
=
shareInfoMap
[
ruleName
]
?
shareInfoMap
[
ruleName
]
:
shareInfoMap
[
'default'
];
// console.warn(ruleName);
console
.
warn
(
infoMap
);
console
.
warn
(
wx
);
console
.
warn
(
axios
);
}
export
default
fn
// 这个判断后加的为了减少请求次数,据后端说有次数限制,当需要分享的页面才去请求接口。
// if (shareInfoMap[ruleName]) {
// // request 是封装的请求
// request.post('/wxmp/sign/jsSdk', {
// url: location.href,
// }).then(res => {
// let { timestamp, nonceStr, signature, appId } = res;
// wx.config({
// debug: false,
// appId,
// timestamp,
// nonceStr,
// signature,
// jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData']
// });
// wx.error(function (errres) {
// console.info(errres)
// })
// wx.ready(() => { //需在用户可能点击分享按钮前就先调用
// console.info('ready')
// //分享朋友
// wx.updateAppMessageShareData({
// title: infoMap.title, // 分享标题
// desc: infoMap.desc, // 分享描述
// link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
// imgUrl: infoMap.icon, // 分享图标
// success: function () {
// console.info("成功")
// // 设置成功
// },
// fail: function (erres) {
// console.info('失败:', erres)
// }
// })
// //分享到 朋友圈
// wx.updateTimelineShareData({
// title: infoMap.title, // 分享标题
// link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
// imgUrl: infoMap.icon, // 分享图标
// success: function () {
// console.info("成功")
// // 设置成功
// },
// fail: function (erres) {
// console.info('失败:', erres)
// }
// })
// });
// }).catch(err => {
// console.info('err:', err)
// })
// }
\ No newline at end of file
src/views/me/donateList.vue
View file @
152a4c0
...
...
@@ -73,6 +73,9 @@ import { Toast } from 'vant';
const $route = useRoute();
const $router = useRouter();
// TODO: 我的捐赠列表
// TODO: 我的捐赠证书列表
const show = ref(false);
const rawList = ref([
...
...
Please
register
or
login
to post a comment