Parcourir la source

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

tags/湖南版5.1.4
luqc il y a 6 ans
Parent
révision
f97ce75b4f
2 fichiers modifiés avec 32 ajouts et 2 suppressions
  1. +4
    -0
      config/config.js
  2. +28
    -2
      pages/main/index.js

+ 4
- 0
config/config.js Voir le fichier

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


+ 28
- 2
pages/main/index.js Voir le fichier

@@ -34,6 +34,8 @@ Page({
alphaData: null, alphaData: null,
swiperCurrent: 0, swiperCurrent: 0,
title: null, title: null,
weappShareTitle:'',//分享标题
weappShareCoverImg:'',//分享图片
desc: null, desc: null,
scrollTop: 0, scrollTop: 0,
showGame: false, showGame: false,
@@ -365,6 +367,7 @@ Page({
that.getUserInfo(); that.getUserInfo();
that.getBannerlist(); that.getBannerlist();
that.topicShow(); that.topicShow();
that.getMallInfo(app.globalData.token);
if (app.couponChannelListCallback) { if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token); app.couponChannelListCallback(app.globalData.token);
} }
@@ -460,6 +463,28 @@ Page({
this.alphaClick(); 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 * banner
*/ */
@@ -617,8 +642,9 @@ Page({
// 用户点击右上角分享 // 用户点击右上角分享
onShareAppMessage: function() { onShareAppMessage: function() {
return { return {
title: this.data.title,
desc: this.data.desc,
title: this.data.weappShareTitle,
imageUrl: this.data.weappShareCoverImg,
// desc: this.data.desc,
success: function(res) { success: function(res) {
wx.showToast({ wx.showToast({
title: "分享成功", title: "分享成功",


Chargement…
Annuler
Enregistrer