123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- var app = getApp()
- Page({
- data: {
- erweima:'',
- poster:"",
- img:app.globalData.imgUrl
- },
- onLoad: function (options) {
- var that = this;
- wx.showLoading({
- title: '加载中...',
- mask:true
- })
- app.request('/user/getInviteWechatQrcode', '', 'GET').then(res => {
- console.log(res)
- if (res.statusCode == 200) {
- that.setData({erweima:res.data.path})
- }
- })
- app.request('/user/getInvitePoster', '', 'GET').then(res => {
- console.log(res)
- if (res.statusCode == 200) {
- that.setData({poster:res.data.path})
- }
- wx.hideLoading()
- })
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- saveImg(e){
-
-
- var that = this;
- wx.getSetting({
- success: (res) => {
- if (!res.authSetting['scope.writePhotosAlbum']) {
- wx.authorize({
- scope: 'scope.writePhotosAlbum',
- success:()=> {
-
- this.saveImg1(that.data.poster);
- },
- fail: (res) =>{
- wx.showModal({
- title: '保存失败',
- content: '请开启访问手机相册权限',
- success(res) {
- wx.openSetting()
- }
- })
- }
- })
- }else{
-
- this.saveImg1(that.data.poster);
- }
- },
- fail: (res) =>{
- console.log(res)
- }
- })
- },
- saveImg1(url){
- wx.getImageInfo({
- src: url,
- success:(res)=> {
- let path = res.path;
- wx.saveImageToPhotosAlbum({
- filePath:path,
- success:(res)=> {
- console.log(res);
- wx.showToast({
- title: '保存成功发给朋友吧~',
- icon:'none'
- })
- },
- fail:(res)=>{
- console.log(res);
- wx.showToast({
- title: '保存失败',
- icon:'none'
- })
- }
- })
- },
- fail:(res)=> {
-
- }
- })
- },
- onReady: function () {
- },
- onShow: function () {
- },
- onHide: function () {
- },
- onUnload: function () {
- },
- onPullDownRefresh: function () {
- },
- onReachBottom: function () {
- }
- })
|