guotianliang před 4 roky
rodič
revize
17bf80d410

+ 1 - 0
app.js

@@ -91,6 +91,7 @@ App({
         localName:"PM2.5",
         unit:"μg/m³",
         funcid:"PM2d5",
+        baseNumer:1000,
         imgSrc:"../../static/images/PM2.5.png"
       },
       hcho:{

+ 3 - 0
components/questionnaire/questionnaire.js

@@ -154,10 +154,13 @@ Component({
         }
 
         await notShowQuestion(data)
+      }else{
+        $.storage.set('nextRemind',true);
       }
       this.setData({
         tipsshow:false
       })
+     
       this.data.dialogRadio==1?this.emitClose(true):this.emitClose();
     },
     submitFeed(){

+ 56 - 3
pages/adjust/index.js

@@ -3,7 +3,7 @@ import router from './../../utils/router'
 import {getSetting,getLocation} from './../../utils/auth'
 const AUTH = require('../../utils/auth')
 import icons from "../../utils/icon"
-import {getPropertyData,submitAdjust,getCurrentSeason} from '../../requests/api';
+import {getPropertyData,submitAdjust,getCurrentSeason,queryUseranswer} from '../../requests/api';
 import Toast from '../../vant-weapp/dist/toast/toast';
 import {
   userCheck,
@@ -22,6 +22,8 @@ Page({
    * 页面的初始数据
    */
   data: {
+    surveyShow:false,
+    lottieShow:true,
     spaceDetail:null,
     effectTime:-1,
     statusList: icons.statusList,
@@ -97,6 +99,56 @@ Page({
     },
     picInitUrl:$.store.get("picInitUrl"),
   },
+  // 关闭问卷
+  surveyClose(value){
+    this.setData({surveyShow:false,lottieShow:true});
+
+    if(value.detail.good){
+      wx.showToast({
+        title:"感谢您的反馈",
+        image:"../../static/images/bixin.png",
+        duration: 2000
+      })
+    }
+  },
+  // 检查是否需要填写问卷
+  async userAnswer(){
+    let day = new Date();
+    let year = day.getFullYear();
+    let month = day.getMonth() + 1;
+    month=month<10?('0'+month):month;
+    let today = day.getDate();
+    today=today<10?('0'+today):today;
+    let seasonType="";
+    const dataSeason={
+      projectId:$.store.get('projectId')||$.storage.get('projectId'),
+      date:`${year}${month}${today}`
+    }
+    await getCurrentSeason(dataSeason).then(res=>{
+      if(res.result=="success"){
+        seasonType= res.data;
+      }
+    })
+    let projectId= $.store.get('projectId');
+    let tenantId= $.store.get('tenantId');
+    let data={
+      "criteria":{
+           "userId": $.store.get('userId'),
+           "projectId": projectId,
+           "tenantId": tenantId,
+           "startTime": {
+            "$ge": `${year}${month}${today}`
+           },
+            "endTime": {
+                "$le":`${year}${month}${today}`
+            },
+        "seasonType": seasonType
+       }
+    }
+    queryUseranswer(data).then(res=>{
+      !res.count&&this.setData({surveyShow:true,lottieShow:false})
+    })
+  },
   goBack(){
     router.pop()
   },
@@ -149,10 +201,11 @@ Page({
     return {level,levelTxt}
   },
   // 检查是否过引导
-  checkGuide(){
+  checkGuide(value){
     if(this.data.spaceDetail.isClose.toString()=="true"){
       return
     }
+    ($.storage.get('guideInit')&&!$.storage.get('nextRemind')&&value)&&this.userAnswer();
     !$.storage.get('guideInit')&&this.getPageheight();
     this.setData({'guideInit':!$.storage.get('guideInit')})
   },
@@ -801,7 +854,7 @@ Page({
       (content[0].hcho||content[0].hcho==0)&&(content[0].hcholevel = this.checkLevel(content[0].hcho,"hcho"));
     }
     this.setData({spaceDetail:content[0]},()=>{
-      this.checkGuide();
+      this.checkGuide(value);
       this.getnowSeason();
       // if(this.data.spaceDetail.nextOpenTime){
       //   let value = this.formatTimeall(this.data.spaceDetail.nextOpenTime);

+ 2 - 1
pages/adjust/index.json

@@ -7,7 +7,8 @@
     "van-radio": "../../vant-weapp/dist/radio/index",
     "van-radio-group": "../../vant-weapp/dist/radio-group/index",
     "van-toast": "../../vant-weapp/dist/toast/index",
-    "van-loading": "../../vant-weapp/dist/loading/index"
+    "van-loading": "../../vant-weapp/dist/loading/index",
+    "questionnaire": "../../components/questionnaire/questionnaire"
   },
   "navigationStyle":"custom",
   "navigationBarTextStyle":"white"

+ 6 - 4
pages/adjust/index.wxml

@@ -32,7 +32,7 @@
     <!-- banner -->
     <view class="adjust_main">
         <view class="space_bg">
-            <image src="{{imgbaseUrl}}{{spaceDetail.pic}}&width=1125&height=750"  wx:if="{{spaceDetail.pic}}"/>
+            <image src="{{imgbaseUrl}}{{spaceDetail.pic}}"  wx:if="{{spaceDetail.pic}}"/>
             <image src="{{picInitUrl}}" lazy-load="{{true}}" wx:if="{{!spaceDetail.pic}}"/>
         </view>
         <view class="space_msg">
@@ -55,7 +55,7 @@
                     <view class="icon_name flex_row">
                     <image src="{{value.imgSrc}}" /> {{value.name}}
                     </view>
-                    <view class="parame_num"><text>{{(spaceDetail[key]&&(spaceDetail[key]+'')) || '--'}}</text>{{value.unit}}</view>
+                    <view class="parame_num"><text>{{filter.initItemNum(spaceDetail.projectId,spaceDetail[key],value.name)}}</text>{{value.unit}}</view>
                     <view class="parame_tag tag{{key}}bg{{spaceDetail[key+'level'].level}}" wx:if="{{(spaceDetail[key]||spaceDetail[key]==0)}}">
                         <text>{{spaceDetail[key+'level'].levelTxt}}</text>
                     </view>
@@ -271,7 +271,7 @@
 >
     <view class="seconddetail">
         <view class="secondtxt flex_row secondtxt_title">
-            <view class="lottie">
+            <view class="lottie" hidden="{{!lottieShow}}">
                 <lottie id="lottieup" animationData="{{spacestatusList[secondIcon-1].canvasDate}}" width="25" height="25" />
             </view>
             {{secondSpaceStatus}}
@@ -280,4 +280,6 @@
         <view class="closedown iknow" bindtap="commitClose">关闭</view>
     </view>
 </van-action-sheet>
-<van-toast id="van-toast" />
+<questionnaire class="pagecontainer" wx:if="{{surveyShow}}" bind:surveyClose="surveyClose"></questionnaire>
+<van-toast id="van-toast" />
+<wxs src="../../utils/filter.wxs" module="filter" />

+ 3 - 2
pages/detail/index.js

@@ -147,10 +147,12 @@ Page({
     // 目标  { time: "1951",release:0, sales: 38,标准区间: [ 25, 45 ] },
     let baseArr=propertyData&&propertyData.slice(1) || [];
     let tragetChart = [];
+    let falgPro = (this.data.funcid==="PM2d5"&&this.data.projectId==="Pj1101080259");
     (baseArr.length>1)&&baseArr.forEach(item=>{
-        item[1] = item[1]=="-9999"?null:item[1];
+        item[1] = item[1]=="-9999"?null:(falgPro?item[1]*1000:item[1]);
     });
     if(baseArr.length===dayTarget.length){
+      
       dayTarget.forEach((item,index)=>{
         let time ='';
         item.time&&(time = item.time.slice(0,2)+':'+item.time.slice(2,4));
@@ -165,7 +167,6 @@ Page({
         tragetChart.push(initObj);
       })
     }
-
     this.setData({tragetChart})
   },
   /**

+ 5 - 5
pages/index/index.js

@@ -110,15 +110,15 @@ Page({
        }
     }
     queryUseranswer(data).then(res=>{
-      !res.count&&this.setData({surveyShow:true,lottieShow:false})
+      (!res.count&&!res.content)&&this.setData({surveyShow:true,lottieShow:false})
     })
   },
    // 检查是否过引导
-  checkGuide(){
+  checkGuide(value){
     if(!this.data.tenantName){
       return
     }
-    this.userAnswer();
+    (!$.storage.get('guideUser')&&!value&&!$.storage.get('nextRemind'))&&this.userAnswer();
     !$.storage.get('guideUser')&&this.getPageheight();
     this.setData({'guideUser':!$.storage.get('guideUser')})
   },
@@ -406,7 +406,6 @@ Page({
     let sortArr=[value,...objList[name].range].sort((a,b)=>{return a-b});
 
     let level=sortArr.findIndex(item=>item===value);
-    console.log(level,349)
     let levelTxt = objList[name].text[level];
     return {level,levelTxt}
   },
@@ -501,13 +500,14 @@ Page({
       $.storage.set('wxqcode', q);
       // console.log($.storage.get('wxqcode'),"123")
     }
+    $.storage.set('nextRemind',false);
     await this.inItUserdate();
     console.log($.storage.get('wxqcode'),$.storage.get('logined'),"449")
     // if($.storage.get('wxqcode')&&$.storage.get('logined')){
     //   this.checkCode($.storage.get('wxqcode'));
     // }
     this.getWeatherNum();
-    this.checkGuide();
+    this.checkGuide(options.q);
     // 加载数据
     // this.getData();
   },

+ 2 - 1
pages/index/index.wxml

@@ -69,7 +69,7 @@
                                 <view class="icon_name flex_row">
                                     <image src="{{value.imgSrc}}" /> {{value.name}}
                                 </view>
-                                <view class="parame_num"><text>{{(item[key]||item[key]==0)?item[key]:'--'}}</text>{{value.unit}}</view>
+                                <view class="parame_num"><text>{{filter.initItemNum(item.projectId,item[key],value.name)}}</text>{{value.unit}}</view>
                                 <view class="parame_tag tag{{key}}bg{{item[key+'level'].level}}" wx:if="{{(item[key]||item[key]==0)}}">
                                     <text>{{item[key+'level'].levelTxt}}</text>
                                 </view>
@@ -109,3 +109,4 @@
     </cover-view>
 </cover-view>
 <questionnaire class="pagecontainer" wx:if="{{surveyShow}}" bind:surveyClose="surveyClose"></questionnaire>
+<wxs src="../../utils/filter.wxs" module="filter" />

+ 7 - 1
utils/filter.wxs

@@ -9,10 +9,16 @@ var mathFormat = function (num) {
   }
   return formatnum
 }
-
+var initItemNum = function(project,value,name) {
+  if(project==="Pj1101080259"&&name==="PM2.5"){
+    value = value*1000;
+  }
+  return (value||value==0)?value:'--'
+}
 /*
  * 导出
  */
 module.exports = {
   mathFormat: mathFormat,
+  initItemNum:initItemNum
 }