|
|
@@ -20,7 +20,7 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- onLoad: function(options) {
|
|
|
+ onLoad: function (options) {
|
|
|
let that = this;
|
|
|
const user = wx.getStorageSync("USER");
|
|
|
this.setData({
|
|
|
@@ -31,20 +31,39 @@ Page({
|
|
|
})
|
|
|
this.getCode();
|
|
|
wx.setNavigationBarTitle({
|
|
|
- title: options.inviteCode ? '他/她的邀请码' : '我的邀请码'
|
|
|
+ title: options.inviteCode ? '他/她的邀请码' : '我的邀请码'
|
|
|
});
|
|
|
},
|
|
|
downloadQR() {
|
|
|
const that = this;
|
|
|
wx.getSetting({ //获取权限
|
|
|
success(res) {
|
|
|
+ console.log(res);
|
|
|
if (res.authSetting["scope.writePhotosAlbum"]) {
|
|
|
that.sendCode();
|
|
|
+ } else if (res.authSetting["scope.writePhotosAlbum"] == false) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请先授权相册',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ wx.openSetting({
|
|
|
+ scope: "scope.writePhotosAlbum",
|
|
|
+ success() {
|
|
|
+ that.sendCode();
|
|
|
+ }
|
|
|
+ });
|
|
|
} else {
|
|
|
wx.authorize({
|
|
|
scope: "scope.writePhotosAlbum",
|
|
|
success() {
|
|
|
that.sendCode();
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ console.log('未授权相册', e);
|
|
|
+ wx.showToast({
|
|
|
+ title: '请先授权相册',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -87,49 +106,49 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
- onReady: function() {
|
|
|
+ onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
- onShow: function() {
|
|
|
+ onShow: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
- onHide: function() {
|
|
|
+ onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
- onUnload: function() {
|
|
|
+ onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
- onPullDownRefresh: function() {
|
|
|
-
|
|
|
+ onPullDownRefresh: function () {
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
- onReachBottom: function() {
|
|
|
+ onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
- onShareAppMessage: function() {
|
|
|
+ onShareAppMessage: function () {
|
|
|
this.addScore();
|
|
|
return {
|
|
|
title: '青雲慧小程序-邀请码分享',
|
|
|
@@ -137,17 +156,17 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
//统计积分(每日小程序分享)
|
|
|
- addScore: function() {
|
|
|
- if(!util.getUserId()){
|
|
|
- return ;
|
|
|
+ addScore: function () {
|
|
|
+ if (!util.getUserId()) {
|
|
|
+ return;
|
|
|
}
|
|
|
wx.showLoading({
|
|
|
title: '努力加载中...',
|
|
|
})
|
|
|
app._post_form('scoreStu/share', "", {
|
|
|
stuId: util.getUserId()
|
|
|
- }, function(res) {
|
|
|
- if (res.code === 0) {}
|
|
|
+ }, function (res) {
|
|
|
+ if (res.code === 0) { }
|
|
|
})
|
|
|
},
|
|
|
getCode() {
|
|
|
@@ -156,9 +175,9 @@ Page({
|
|
|
title: '努力加载中...',
|
|
|
})
|
|
|
app._post_form('create/wxaqrcode', '', {
|
|
|
- inviteCode: that.data.inviteCode
|
|
|
- },
|
|
|
- function(res) {
|
|
|
+ inviteCode: that.data.inviteCode
|
|
|
+ },
|
|
|
+ function (res) {
|
|
|
if (res.code == 0) {
|
|
|
that.setData({
|
|
|
invitationCodeImg: res.data
|
|
|
@@ -169,7 +188,7 @@ Page({
|
|
|
copyText() {
|
|
|
wx.setClipboardData({
|
|
|
data: this.data.inviteCode || '',
|
|
|
- success: function(res) {
|
|
|
+ success: function (res) {
|
|
|
wx.showToast({
|
|
|
title: '已复制邀请码',
|
|
|
icon: 'none'
|