| | |
| | | // pages/store/staff.jsdownloadImg |
| | | import { getUserCard } from '../../api/index' |
| | | import { downloadImg } from '../../utils/common' |
| | | import { |
| | | getUserCard |
| | | } from '../../api/index' |
| | | // import { downloadImg } from '../../utils/common' |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | */ |
| | | data: { |
| | | bottomLift: 0, |
| | | isShow: false, |
| | | userCard:'', |
| | | isShow: true, |
| | | userCard: '', |
| | | isShow2: false, |
| | | userInfo:{} |
| | | userInfo: {} |
| | | }, |
| | | |
| | | /** |
| | |
| | | onLoad(options) { |
| | | var app = getApp().globalData |
| | | var userType = options.userType |
| | | |
| | | if(userType == 1){ |
| | | |
| | | if (userType == 1) { |
| | | //如果查询自己的信息 |
| | | this.setData({userInfo: wx.getStorageSync('member')}) |
| | | this.setData({ |
| | | userInfo: wx.getStorageSync('member') |
| | | }) |
| | | console.log(this.data) |
| | | } |
| | | } |
| | | this.setData({ |
| | | bottomLift: app.bottomLift |
| | | }) |
| | | }, |
| | | showQrcode(){ |
| | | this.setData({isShow:true}) |
| | | showQrcode() { |
| | | this.setData({ |
| | | isShow: true |
| | | }) |
| | | }, |
| | | closeCard(){ |
| | | this.setData({isShow2: false}) |
| | | closeCard() { |
| | | this.setData({ |
| | | isShow2: false |
| | | }) |
| | | }, |
| | | |
| | | |
| | | saveCard(){ |
| | | downloadImg(this.data.userCard); |
| | | saveCard() { |
| | | wx.downloadFile({ |
| | | url: this.data.userCard, |
| | | success: function (res) { |
| | | console.log('下载成功', res); |
| | | wx.saveImageToPhotosAlbum({ |
| | | filePath: res.tempFilePath, |
| | | success(result) { |
| | | console.log(result) |
| | | wx.showToast({ |
| | | title: '保存成功', |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }) |
| | | } |
| | | }) |
| | | // wx.saveFile({ |
| | | // tempFilePath: res.tempFilePath, |
| | | // success: function (res) { |
| | | // console.log(res.savedFilePath) |
| | | // } |
| | | // }) |
| | | } |
| | | }) |
| | | }, |
| | | openModal() { |
| | | if(this.data.userCard !=null && this.data.userCard != ''){ |
| | | this.setData({isShow2: true}) |
| | | if (this.data.userCard != null && this.data.userCard != '') { |
| | | this.setData({ |
| | | isShow2: true |
| | | }) |
| | | return; |
| | | } |
| | | getUserCard().then(res =>{ |
| | | this.setData({userCard: res.data}) |
| | | this.setData({isShow2: true}) |
| | | }) |
| | | getUserCard().then(res => { |
| | | this.setData({ |
| | | userCard: res.data |
| | | }) |
| | | this.setData({ |
| | | isShow2: true |
| | | }) |
| | | }) |
| | | }, |
| | | onClose() { |
| | | this.setData({isShow: false}) |
| | | this.setData({ |
| | | isShow: false |
| | | }) |
| | | }, |
| | | |
| | | /** |