瀏覽代碼

[修改][小程序分享图片和标题]

tags/湖南版5.1.4
luqc 6 年之前
父節點
當前提交
f97ce75b4f
共有 2 個文件被更改,包括 32 次插入2 次删除
  1. +4
    -0
      config/config.js
  2. +28
    -2
      pages/main/index.js

+ 4
- 0
config/config.js 查看文件

@@ -155,6 +155,10 @@ var config = {
* 描述
*/
getWeapNote:'/mall/getWeapNote',
/**
* 商场信息(小程序分享)
*/
getMallInfo: '/mall/mallInfo',
/**
* 小程序获取游戏路径
*/


+ 28
- 2
pages/main/index.js 查看文件

@@ -34,6 +34,8 @@ Page({
alphaData: null,
swiperCurrent: 0,
title: null,
weappShareTitle:'',//分享标题
weappShareCoverImg:'',//分享图片
desc: null,
scrollTop: 0,
showGame: false,
@@ -365,6 +367,7 @@ Page({
that.getUserInfo();
that.getBannerlist();
that.topicShow();
that.getMallInfo(app.globalData.token);
if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token);
}
@@ -460,6 +463,28 @@ Page({
this.alphaClick();
})
},
/**
* mallinfo
*/
getMallInfo: function (token) {
let that = this;
Http.get({
url: config.api.getMallInfo,
data: {
token: token,
}
}).then(res => {
console.log(res.data+"eeee");
that.setData({
weappShareTitle: res.data.weappShareTitle,
weappShareCoverImg: res.data.weappShareCoverImg,
});
})
.catch(err => {

})
;
},
/**
* banner
*/
@@ -617,8 +642,9 @@ Page({
// 用户点击右上角分享
onShareAppMessage: function() {
return {
title: this.data.title,
desc: this.data.desc,
title: this.data.weappShareTitle,
imageUrl: this.data.weappShareCoverImg,
// desc: this.data.desc,
success: function(res) {
wx.showToast({
title: "分享成功",


Loading…
取消
儲存