You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.0 KiB
JavaScript

const app = getApp()
// let app = null;
Component({
data: {
labelColor: ["#c41d7f", "#096dd9", "#531dab", "#d46b08", "#389e0d", "#08979c", "#cf1322"],
bgColor: ["#fff0f6", "#e6f7ff", "#f9f0ff", "#fff7e6", "#f6ffed", "#e6fffb", "#fff1f0"],
corpUserFlag: false,
serviceInfo: {}
},
properties: {
// 抽屉高度
showModal: {
type: Boolean,
value: false,
},
},
lifetimes: {
attached: function () {
this.setData({
serviceInfo: app.globalData.serviceInfo,
});
// 在组件实例进入页面节点树时执行
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
},
ready () {
// console.log('app.globalData.loginUserInfo.corpUserFlag', app.globalData.loginUserInfo.corpUserFlag);
console.log('this.properties.loginUserInfo', this.properties.loginUserInfo);
// app.getLoginUserTokenInfo().then(() => {
// });
},
methods: {
closeDialog () {
this.setData({
showModal: false
})
},
saveImage: function (e) {
console.log('saveImage', e.currentTarget.dataset.src);
const imageUrl = e.currentTarget.dataset.src;
// 给出确认弹窗
wx.downloadFile({
url: imageUrl,
success: res => {
if (res.statusCode === 200) {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
wx.showToast({
title: '保存成功',
icon: 'success'
});
},
fail: err => {
console.error('保存失败', err);
wx.showToast({
title: '保存失败',
icon: 'none'
});
}
});
}
},
fail: err => {
console.error('下载失败', err);
wx.showToast({
title: '下载失败',
icon: 'none'
});
}
});
},
}
})