123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <template>
- <view class="share-container">
- <form >
- <view class="share-begin">
- <button open-type="share" form-type="submit" class="alias-submit" type="primary" >开始分享推荐</button>
- </view>
- <view>
- <button class="alias-submit" type="primary" @click="queryResult" >查看分享结果</button>
- </view>
- </form>
- </view>
- </template>
- <script>
- import { mapMutations, mapState } from 'vuex'
-
- export default {
- computed: {
- ...mapState('m_user', ['userinfo'])
- },
- methods: {
- /**
- * 分享处理函数,可以响应2类事件,1是button,2是右上角的menu中的Send to Chat
- * button用法:<button class="forshare" open-type="share">share</button>
- * menu用法:不用引入变量,当页面有这个函数时, Send to Chat会启用,否则灰色
- * path中的uid=txj123,txj123应该换为真实的用户号,当这个分享的卡片被打开时,小程序可以取到这个号
- */
- onShareAppMessage: function () {
- //console.log(this.userinfo)
- return {
- title:'来自 ' + this.userinfo.alias + ' 的分享',
- path: '/pages/home/home?uid=' + this.userinfo.uid,
- imageUrl: '/static/share.jpg', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
- }
- },
- queryResult:function(){
- uni.navigateTo({
- url: '/subpkg/my/share/my_share_result'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .share-container{
- height: 100%;
- padding: 0 20rpx;
- // background-color: #fff;
- }
- .share-begin{
- padding-top: 50rpx;
- margin-top: -50rpx;
- }
- .alias-submit {
- margin-top: 50rpx;
- border-radius: 30rpx;
- background-color: #35b882;
- }
- </style>
|