Browse Source

上传代码

master
前端-胡立永 8 months ago
parent
commit
ec1918126e
5 changed files with 67 additions and 6 deletions
  1. +8
    -0
      main.js
  2. +29
    -0
      mixins/share.js
  3. +11
    -3
      pages/publish/actorDetail.vue
  4. +11
    -3
      pages/publish/postDetail.vue
  5. +8
    -0
      pages_mine/publish/worksDetail.vue

+ 8
- 0
main.js View File

@ -28,6 +28,12 @@ uni.$uv.setConfig({
// //
//wxe7ae8cbe1673834c //wxe7ae8cbe1673834c
// 导入并挂载全局的分享方法
import share from '@/mixins/share.js'
Vue.mixin(share)
//组件注册 //组件注册
import configPopup from '@/components/config/configPopup.vue' import configPopup from '@/components/config/configPopup.vue'
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
@ -35,6 +41,8 @@ import navbar from '@/components/base/navbar.vue'
Vue.component('configPopup', configPopup) Vue.component('configPopup', configPopup)
Vue.component('navbar', navbar) Vue.component('navbar', navbar)
const app = new Vue({ const app = new Vue({
...App, ...App,
store, store,


+ 29
- 0
mixins/share.js View File

@ -0,0 +1,29 @@
export default {
data() {
return {
// 默认的全局分享内容
share: {
title: '真视界',
path: '/pages/index/index', // 全局分享的路径,比如 首页
// imageUrl: '/static/image/login/logo.png', // 全局分享的图片(可本地可网络)
}
}
},
// 定义全局分享
// 1.发送给朋友
onShareAppMessage(res) {
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl,
}
},
//2.分享到朋友圈
onShareTimeline(res) {
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl,
}
},
}

+ 11
- 3
pages/publish/actorDetail.vue View File

@ -133,9 +133,17 @@
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
return { return {
title: this.item.details.title,
desc: this.item.details.content && this.item.details.content.slice(0, 30),
path: '/pages/publish/actorDetail?id=' + this.id
title: this.item.details.title,
desc: this.item.details.content && this.item.details.content.slice(0, 30),
path: '/pages/publish/actorDetail?id=' + this.id
}
},
//2.
onShareTimeline(res) {
return {
title: this.item.details.title,
desc: this.item.details.content && this.item.details.content.slice(0, 30),
path: '/pages/publish/actorDetail?id=' + this.id
} }
}, },
onShow() { onShow() {


+ 11
- 3
pages/publish/postDetail.vue View File

@ -74,9 +74,17 @@
// console.log(res.target) // console.log(res.target)
// } // }
return { return {
title: this.item.title,
desc: this.item.content && this.item.content.slice(0, 30),
path: '/pages/publish/postDetail?id=' + this.id
title: this.item.title,
desc: this.item.content && this.item.content.slice(0, 30),
path: '/pages/publish/postDetail?id=' + this.id
}
},
//2.
onShareTimeline(res) {
return {
title: this.item.title,
desc: this.item.content && this.item.content.slice(0, 30),
path: '/pages/publish/postDetail?id=' + this.id
} }
}, },
methods: { methods: {


+ 8
- 0
pages_mine/publish/worksDetail.vue View File

@ -113,6 +113,14 @@
path: '/pages_mine/publish/worksDetail?id=' + this.id path: '/pages_mine/publish/worksDetail?id=' + this.id
} }
}, },
//2.
onShareTimeline(res) {
return {
title: this.item.title,
desc: this.item.content && this.item.content.slice(0, 30),
path: '/pages_mine/publish/worksDetail?id=' + this.id
}
},
methods: { methods: {
leftClick(){ leftClick(){
uni.navigateBack(-1) uni.navigateBack(-1)


Loading…
Cancel
Save