12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import wechath5 from '@/utils/wechath5'
- import {
- isWeixinClient
- } from '@/utils/tools'
- import {
- baseURL,
- basePath
- } from '@/config/app'
- const state = {
- communityItem: {}
- };
- const mutations = {
- setCommunity(state, data) {
- state.communityItem = data
- }
- };
- const actions = {
-
- communityShare({
- state,
- commit
- }) {
- const item = state.communityItem;
- console.log(item)
-
- if (isWeixinClient()) {
- const option = {
- shareTitle: `${item.user.nickname},TA的内容超级棒`,
- shareLink: `${baseURL}${basePath}/${item.url}?id=${item.id}`,
- shareImage: item.image,
- shareDesc: item.content
- }
- wechath5.share(option)
- }
-
-
- uni.share({
- provider: "weixin",
- scene: "WXSceneSession",
- type: 0,
- href: `${baseURL}${basePath}/${item.url}?id=${item.id}`,
- title: `${item.user.nickname},TA的内容超级棒`,
- summary: item.content,
- imageUrl: item.image,
- success: (res) => {
- console.log('分享成功');
- },
- fail: (err) => {
- console.log(err)
- uni.showToast({
- icon: 'none',
- title: err.errMsg
- })
- }
- });
-
- }
- };
- export default {
- state,
- mutations,
- actions
- };
|