You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							206 lines
						
					
					
						
							5.8 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							206 lines
						
					
					
						
							5.8 KiB
						
					
					
				
								// subpages/communitySelfInsp/pages/synthesis/synthesis.js
							 | 
						|
								const app = getApp()
							 | 
						|
								import {getSynthesis} from '../../../../utils/api'
							 | 
						|
								Page({
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面的初始数据
							 | 
						|
								     */
							 | 
						|
								    data: {
							 | 
						|
								        agencyName:'',//组织名称
							 | 
						|
								        tableData:[],
							 | 
						|
								        monthName:'',//月份
							 | 
						|
								        personQty:'',//提交人数
							 | 
						|
								        synthesisScore:'',//综合得分
							 | 
						|
								        inspRecordId:'',//自查表Id
							 | 
						|
								        fontSize:'',
							 | 
						|
								        maskStatus:false,
							 | 
						|
								        shareFlag:false,
							 | 
						|
								        status:0
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面加载
							 | 
						|
								     */
							 | 
						|
								    onLoad(options) {
							 | 
						|
								        // 获取参数
							 | 
						|
								        this.setData({
							 | 
						|
								            statusHeight: app.globalData.deviceInfo.statusHeight,
							 | 
						|
								            navigationHeight: app.globalData.deviceInfo.navigationHeight,
							 | 
						|
								            inspRecordId: decodeURIComponent(options.inspRecordId),
							 | 
						|
								            agencyName:decodeURIComponent(options.agencyName),
							 | 
						|
								            monthName:decodeURIComponent(options.monthName),
							 | 
						|
								            qrCodeImgUrl:decodeURIComponent(options.qrCodeImgUrl),
							 | 
						|
								            questionnaireUrl:decodeURIComponent(options.questionnaireUrl),
							 | 
						|
								            status:decodeURIComponent(options.status)
							 | 
						|
								          })
							 | 
						|
								          console.log(this.data.status);
							 | 
						|
								          // 获取当前日期
							 | 
						|
								        const currentDate = new Date();
							 | 
						|
								        const currentMonth = currentDate.getMonth() + 1;
							 | 
						|
								        if(currentMonth == options.monthName){
							 | 
						|
								            this.setData({
							 | 
						|
								                shareFlag:true
							 | 
						|
								            })
							 | 
						|
								        }else{
							 | 
						|
								            this.setData({
							 | 
						|
								                shareFlag:false
							 | 
						|
								            })
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								          this.getSynthesis()
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    getSynthesis(){
							 | 
						|
								        let parm = {
							 | 
						|
								            period:'',
							 | 
						|
								            inspRecordId:this.data.inspRecordId
							 | 
						|
								        }
							 | 
						|
								        getSynthesis(parm).then(res=>{
							 | 
						|
								            this.setData({
							 | 
						|
								                tableData:res.data.categoryDatas,
							 | 
						|
								                // monthName:res.data.monthName,
							 | 
						|
								                synthesisScore:res.data.synthesisScore,
							 | 
						|
								                personQty:res.data.personQty,
							 | 
						|
								                agencyName:res.data.agencyName,
							 | 
						|
								                inspRecordId:res.data.inspRecordId
							 | 
						|
								            })
							 | 
						|
								            const textContent = res.data.agencyName; // 替换为你实际的内容
							 | 
						|
								            if (textContent.length > 5) { // 选择一个合适的长度作为调整字体大小的标准
							 | 
						|
								              this.setData({
							 | 
						|
								                fontSize: '38rpx'  // 选择一个适当的较小字体大小
							 | 
						|
								              });
							 | 
						|
								            }
							 | 
						|
								        }).catch((err)=>{
							 | 
						|
								            console.log(err);
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面初次渲染完成
							 | 
						|
								     */
							 | 
						|
								    onReady() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面显示
							 | 
						|
								     */
							 | 
						|
								    onShow() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面隐藏
							 | 
						|
								     */
							 | 
						|
								    onHide() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 生命周期函数--监听页面卸载
							 | 
						|
								     */
							 | 
						|
								    onUnload() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面相关事件处理函数--监听用户下拉动作
							 | 
						|
								     */
							 | 
						|
								    onPullDownRefresh() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 页面上拉触底事件的处理函数
							 | 
						|
								     */
							 | 
						|
								    onReachBottom() {
							 | 
						|
								
							 | 
						|
								    },
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * 用户点击右上角分享
							 | 
						|
								     */
							 | 
						|
								    onShareAppMessage() {
							 | 
						|
								        return{
							 | 
						|
								            title:`${this.data.agencyName}${this.data.monthName}月份满意度调查`,
							 | 
						|
								            path:'/pages/webView/webView?url=' +  encodeURIComponent(this.data.questionnaireUrl),
							 | 
						|
								            imageUrl:'../../../../images/work/shareBg.png'
							 | 
						|
								          }
							 | 
						|
								    },
							 | 
						|
								   
							 | 
						|
								    toDissatisfactionDetails(e){
							 | 
						|
								        console.log(e);
							 | 
						|
								        let category = e.currentTarget.dataset.item.satisfactionCategory
							 | 
						|
								        wx.navigateTo({
							 | 
						|
								          url: `/subpages/communitySelfInsp/pages/dissatisfactionDetails/dissatisfactionDetails?inspRecordId=${this.data.inspRecordId}&category=${category}`,
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    showCodeImg(){
							 | 
						|
								        this.setData({
							 | 
						|
								            maskStatus:true
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    hideCodeImg(){
							 | 
						|
								        this.setData({
							 | 
						|
								            maskStatus:false
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								    downImage(){
							 | 
						|
								            let imageUrl = this.data.qrCodeImgUrl; // 替换为您要下载的图片的URL
							 | 
						|
								            // 下载图片
							 | 
						|
								            wx.downloadFile({
							 | 
						|
								                url: imageUrl,
							 | 
						|
								                success: function(res) {
							 | 
						|
								                    console.log(res);
							 | 
						|
								                    let imagePath = res.tempFilePath;
							 | 
						|
								    
							 | 
						|
								                    // 请求保存到相册的权限
							 | 
						|
								                    wx.getSetting({
							 | 
						|
								                        success (res) {
							 | 
						|
								                            if (!res.authSetting['scope.writePhotosAlbum']) {
							 | 
						|
								                                wx.authorize({
							 | 
						|
								                                    scope: 'scope.writePhotosAlbum',
							 | 
						|
								                                    success() {
							 | 
						|
								                                        saveImage(imagePath);
							 | 
						|
								                                    }
							 | 
						|
								                                })
							 | 
						|
								                            } else {
							 | 
						|
								                                saveImage(imagePath);
							 | 
						|
								                            }
							 | 
						|
								                        }
							 | 
						|
								                    });
							 | 
						|
								                },
							 | 
						|
								                fail: function() {
							 | 
						|
								                    wx.showToast({
							 | 
						|
								                        title: '下载失败',
							 | 
						|
								                        icon: 'none'
							 | 
						|
								                    });
							 | 
						|
								                }
							 | 
						|
								            });
							 | 
						|
								    
							 | 
						|
								            function saveImage(imagePath) {
							 | 
						|
								                // 保存图片到相册
							 | 
						|
								                wx.saveImageToPhotosAlbum({
							 | 
						|
								                    filePath: imagePath,
							 | 
						|
								                    success: function() {
							 | 
						|
								                        wx.showToast({
							 | 
						|
								                            title: '保存成功',
							 | 
						|
								                            icon: 'success'
							 | 
						|
								                        });
							 | 
						|
								                    },
							 | 
						|
								                    fail: function() {
							 | 
						|
								                        wx.showToast({
							 | 
						|
								                            title: '保存失败',
							 | 
						|
								                            icon: 'none'
							 | 
						|
								                        });
							 | 
						|
								                    }
							 | 
						|
								                });
							 | 
						|
								            }
							 | 
						|
								    },
							 | 
						|
								    back(){
							 | 
						|
								        wx.navigateBack({
							 | 
						|
								            delta: 1
							 | 
						|
								        })
							 | 
						|
								    },
							 | 
						|
								})
							 |