| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | userInfo:wx.getStorageSync('userInfo'), |
| | | detail:{}, |
| | | userInfo: wx.getStorageSync('userInfo'), |
| | | detail: {}, |
| | | }, |
| | | |
| | | goRecord(){ |
| | | goRecord() { |
| | | wx.navigateTo({ |
| | | url: '/pages/inviteRecord/inviteRecord', |
| | | }) |
| | | }, |
| | | |
| | | downLoadCode(){ |
| | | downLoadCode() { |
| | | wx.downloadFile({ |
| | | url: this.data.detail.code, |
| | | success(res) { |
| | | if(res.statusCode ==200){ |
| | | let tempFilePath = res.tempFilePath; |
| | | wx.saveImageToPhotosAlbum({ |
| | | filePath: tempFilePath, |
| | | success (res) { |
| | | console.log('保存成功', res); |
| | | }, |
| | | fail (err) { |
| | | if (err.errMsg === "saveImageToPhotosAlbum:fail cancel") { |
| | | console.log('用户取消保存'); |
| | | } else { |
| | | console.log('保存失败', err); |
| | | } |
| | | } |
| | | }); |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '下载失败', |
| | | icon:'none' |
| | | }) |
| | | } |
| | | success(res) { |
| | | if (res.statusCode == 200) { |
| | | let tempFilePath = res.tempFilePath; |
| | | wx.saveImageToPhotosAlbum({ |
| | | filePath: tempFilePath, |
| | | success(res) { |
| | | console.log('保存成功', res); |
| | | }, |
| | | fail(err) { |
| | | if (err.errMsg === "saveImageToPhotosAlbum:fail cancel") { |
| | | console.log('用户取消保存'); |
| | | } else { |
| | | console.log('保存失败', err); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '下载失败', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | */ |
| | | onLoad(options) { |
| | | unit.post(app.globalData.Url + "/api/user/getCode") |
| | | .then((res) => { |
| | | console.log('shuju',res); |
| | | if(res.data.code==200){ |
| | | this.setData({ |
| | | detail:res.data.data |
| | | }) |
| | | } |
| | | }) |
| | | .then((res) => { |
| | | console.log('shuju', res); |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | detail: res.data.data |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |