94 lines
1.5 KiB
JavaScript
94 lines
1.5 KiB
JavaScript
Page({
|
|
data: {
|
|
toolsList: [],
|
|
site: {}
|
|
},
|
|
|
|
// 跳转到其他小程序
|
|
navigateToMiniProgram(e) {
|
|
const {
|
|
appid,
|
|
path
|
|
} = e.currentTarget.dataset;
|
|
wx.navigateToMiniProgram({
|
|
appId: appid,
|
|
path: path,
|
|
success(res) {
|
|
console.log('跳转成功', res);
|
|
},
|
|
fail(err) {
|
|
console.error('跳转失败', err);
|
|
wx.showToast({
|
|
title: '跳转失败',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
onLoad() {
|
|
this.getdata();
|
|
},
|
|
|
|
// 加载工具数据
|
|
getdata() {
|
|
let that = this
|
|
let data = {}
|
|
data.ac = 'getlink'
|
|
data.miniapp_id = 7
|
|
wx.request({
|
|
url: 'https://yc.aiaud.cn/api/',
|
|
data,
|
|
header: {
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
},
|
|
method: 'POST',
|
|
success: function(res) {
|
|
that.setData({
|
|
toolsList: res.data.data.linklist,
|
|
site: res.data.data.site,
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
// 下拉刷新
|
|
onPullDownRefresh() {
|
|
this.getdata();
|
|
wx.stopPullDownRefresh();
|
|
},
|
|
|
|
// 分享
|
|
onShareAppMessage() {
|
|
return {
|
|
title: '数学公式集合',
|
|
path: '/pages/index/index'
|
|
};
|
|
},
|
|
onShareTimeline() {
|
|
let that = this
|
|
return {
|
|
title: '数学公式集合'
|
|
}
|
|
},
|
|
copywx: function() {
|
|
let that = this
|
|
wx.setClipboardData({
|
|
data: that.data.site.wxkf,
|
|
success: () => {
|
|
wx.showToast({
|
|
title: '复制成功',
|
|
icon: 'none',
|
|
duration: 1500
|
|
});
|
|
},
|
|
fail: (err) => {
|
|
wx.showToast({
|
|
title: '复制失败',
|
|
icon: 'none',
|
|
duration: 1500
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}); |