12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- // pages/mine/myqrcode/myqrcode.js
- const app = getApp()
- Page({
- data: {
- qrcodepath: null,
- loaddisplay: 'none',
- sqshow: false
- },
- finish: function () {
- this.setData({
- loaddisplay: 'none'
- })
- },
- onShow: function() {
- this.setData({
- sqshow: false
- })
- },
- onLoad: function (options) {
- this.setData({
- loaddisplay: true
- })
- var that = this
- wx.request({
- url: app.globalData.url + '/CreatePOP',
- method: 'get',
- data: {
- wv_phone: app.globalData.userphone
- },
- success: function (res) {
- that.setData({
- qrcodepath: res.data,
- loaddisplay: 'none'
- })
- },
- fail() {
- app.timeOut()
- }
- })
- let _this = this;
- _this.setData({
- navH: app.globalData.navHeight
- })
- },
- saveImgToPhotosAlbumTap: function () {
- var that = this
- wx.showLoading({
- title: '保存中......',
- icon: 'loading',
- duration: 5500
- })
- wx.downloadFile({
- url: this.data.qrcodepath,
- success: function (res) {
- wx.saveImageToPhotosAlbum({
- filePath: res.tempFilePath,
- success: function (res) {
- wx.hideLoading()
- wx.showToast({
- title: "保存成功",
- icon: "success",
- })
- },
- fail: function (res) {
- wx.hideLoading()
- wx.showToast({
- title: "保存失败,请点击按钮授权",
- icon: "none",
- })
- that.setData({
- sqshow: true
- })
- }
- })
- },
- fail: function () {
- wx.hideLoading()
- wx.showToast({
- title: "保存失败,请点击按钮授权",
- icon: "none",
- })
- that.setData({
- sqshow: true
- })
- }
- })
- }
- })
|