123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- const util = require('../../../utils/util.js');
- Component({
- properties: {
- show:{
- type: Boolean,
- observer: function (newVal) {
- this.setData({ show: newVal });
- if (this.data.show) {
- this.getPopupContent()
- }
- }
- },
- type:{
- type: Boolean,
- observer: function (newVal) {
- this.setData({ type: newVal });
- }
- }
- },
- data: {
- type:false,
- show:false,
- height:'60%',
- customerService:{}
- },
- methods: {
- // 获取弹窗内容
- getPopupContent(){
- var that = this;
- let data={};
- if (this.data.type) {
- data.city='总部'
- }
- util.ajax({
- func: "article/wx_info",
- load: false,
- data
- }, function (res) {
- if (res.code == 0) {
- that.setData({
- customerService:res.data
- })
- } else {
- util.showTips(res.reason);
- }
- })
- },
- // 关闭弹窗
- closeTip(e){
- this.colse(e.detail)
- },
- // 确定
- closePopup(){
- let that =this
- if (!util.isEmpty(this.data.customerService.wxlogo)) {
- wx.downloadFile({
- url:that.data.customerService.wxlogo,
- success(res) {
- wx.saveImageToPhotosAlbum({
- filePath:res.tempFilePath,
- success:(res)=>{
- setTimeout(() => {
- util.showTips('已保存至相册!')
- }, 100);
- setTimeout(() => {
- that.colse(false)
- }, 600);
- }
- })
- },
- fail(res){
- util.showTips('保存失败!')
- }
- })
- }
- },
- colse(data){
- this.triggerEvent("close",{
- status:data,
- type:'contact'
- } );
- }
- }
- })
|