From 741d1f7b2e2ac1c3f89d80dfac7625e3427e2367 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 12 十月 2022 17:43:02 +0800
Subject: [PATCH] 2022.10.12

---
 pages/m_consult/behaviors/b_search.js                   |    2 
 pages/m_user/mine/mine.wxml                             |    6 
 pages/m_user/userlogin/userlogin.js                     |   68 -----
 pages/m_user/behaviors/b_login.js                       |    2 
 data/sceneInfo.js                                       |   44 +-
 base/behaviors/b_loadingStatus.js                       |    4 
 base/behaviors/b_loadingToast.js                        |   45 +++
 service/deviceservice.js                                |   29 ++
 pages/m_ledger/ledgerupload/ledgerupload.js             |   77 +-----
 pages/m_consult/behaviors/b_questions.js                |    6 
 pages/m_ledger/behaviors/b_uploadLedger.js              |   41 +++
 pages/m_user/mine/mine.js                               |   35 ++
 base/behaviors/b_upload.js                              |   36 +++
 pages/m_user/behaviors/b_inputCheck.js                  |   75 ++++--
 pages/m_user/base_c/c_scene-info/c_scene-info.wxml      |    2 
 service/baserequest.js                                  |    3 
 pages/m_user/base_c/c_scene-info/c_scene-info.wxss      |    4 
 service/userservice.js                                  |   24 +
 pages/m_user/base_c/c_scene-info/c_scene-info.js        |  201 ++++++++++++++--
 pages/m_user/sceneauthentication/sceneauthentication.js |   12 
 20 files changed, 496 insertions(+), 220 deletions(-)

diff --git a/base/behaviors/b_loadingStatus.js b/base/behaviors/b_loadingStatus.js
index 086f1da..ebbd92d 100644
--- a/base/behaviors/b_loadingStatus.js
+++ b/base/behaviors/b_loadingStatus.js
@@ -1,5 +1,6 @@
 /**
- * 鏁版嵁鍔犺浇鐩戝惉
+ * 鏁版嵁鍔犺浇鐘舵�佺洃鍚�
+ * @see './b_loadingToast.js' 鍜� '../../component/loadingstatus'
  */
 module.exports = Behavior({
   data: {
@@ -15,6 +16,7 @@
       if (loading) {
         this._loadStart()
         this._loading()
+        setTimeout(() => { this.setData({loading: false}) }, 20000);
       } else {
         this._loadComplete()
       }
diff --git a/base/behaviors/b_loadingToast.js b/base/behaviors/b_loadingToast.js
new file mode 100644
index 0000000..25e45ca
--- /dev/null
+++ b/base/behaviors/b_loadingToast.js
@@ -0,0 +1,45 @@
+const { clearTimeout } = require("timers");
+
+/**
+ * 鏁版嵁鍔犺浇寮圭獥
+ * 鏍规嵁鍔犺浇鐘舵�侊紝灞曠ず瀵瑰簲鐨勫脊绐�
+ * @see './b_loadingStatus.js'
+ */
+module.exports = Behavior({
+  data: {
+    loadingText: '鍔犺浇涓�',
+    loadCompleteText: '鍔犺浇瀹屾垚'
+  },
+  timeoutId: '',
+  methods: {
+    // 鍔犺浇寮�濮媡oast
+    loadStart() {
+      clearTimeout(this.timeoutId)
+      wx.showLoading({
+        title: this.data.loadingText,
+        mask: true,
+      })
+      this.timeoutId = setTimeout(() => {
+        wx.hideLoading()
+      }, 20000);
+    },
+    // 鍔犺浇涓璽oast
+    loading() {
+      
+    },
+    // 鍔犺浇瀹屾垚toast
+    loadComplete() {
+      clearTimeout(this.timeoutId)
+      wx.hideLoading({
+        success: (res) => {
+          wx.showToast({
+            title: this.data.loadCompleteText,
+            duration: 1000,
+            icon: 'success',
+            mask: true,
+          })
+        },
+      })
+    },
+  }
+})
\ No newline at end of file
diff --git a/base/behaviors/b_upload.js b/base/behaviors/b_upload.js
new file mode 100644
index 0000000..85f3e61
--- /dev/null
+++ b/base/behaviors/b_upload.js
@@ -0,0 +1,36 @@
+/**
+ * 鍥剧墖涓婁紶绠$悊
+ */
+module.exports = Behavior({
+  data: {
+    imgFiles: [],
+  },
+  lifetimes: {
+    attached: function () {}
+  },
+  methods: {
+    uploadFile(file) {
+      let data = file.detail.newFiles
+      console.log(data);
+      data.forEach(element => {
+        element.loading = false
+      });
+      this.setData({
+        imgFiles: data
+      })
+      console.log(imgFiles);
+    },
+    /**
+     * 鐩戝惉鍥剧墖鍒犻櫎鍔ㄤ綔
+     */
+    delImg(e) {
+      let imgIndex = e.detail.index
+      let imgFiles = this.data.imgFiles
+      imgFiles.splice(imgIndex, 1)
+      this.setData({
+        imgFiles
+      })
+      console.log(imgFiles);
+    },
+  }
+})
\ No newline at end of file
diff --git a/data/sceneInfo.js b/data/sceneInfo.js
index 5d3bb1d..4d8a3b2 100644
--- a/data/sceneInfo.js
+++ b/data/sceneInfo.js
@@ -4,21 +4,21 @@
   //椁愰ギ**************************************************************************************************
   map.set('1', [{
       name: "搴楅摵鍚嶇О",
-      id: "sceneName",
+      id: "biName",
       input: true,
       value: '',
       noValue: false,
     },
     {
       name: "搴楅摵绠�绉�",
-      id: "sceneNickName",
+      id: "biNickName",
       input: true,
       value: '',
       noValue: false,
     },
     {
       name: "缁忚惀鑿滅郴",
-      id: "cuisine",
+      id: "rbCuisine",
       type: 'checkbox',
       value: '',
       options: [
@@ -35,27 +35,27 @@
     },
     {
       name: "缁忚惀鍦板潃",
-      id: "address",
+      id: "biAddress",
       input: true,
       value: '',
       noValue: false,
     },
     {
       name: "灏遍浣嶆暟",
-      id: "totalSeating",
+      id: "rbTotalSeating",
       type: 'radio',
       value: '',
       options: [
         {name: '鏃�', value: '0', checked: true},
-        {name: '1~20', value: '1', },
-        {name: '21~50', value: '2', },
-        {name: '51~100', value: '3', },
-        {name: '100浠ヤ笂', value: '4', },
+        {name: '1~20', value: '20', },
+        {name: '21~50', value: '50', },
+        {name: '51~100', value: '100', },
+        {name: '100浠ヤ笂', value: '120', },
       ]
     },
     {
       name: "鍑�鍖栬澶囨暟閲�",
-      id: "purifyDeviceNum",
+      id: "fpNum",
       type: 'number',
       input: true,
       value: "",
@@ -64,7 +64,7 @@
     },
     {
       name: "鐩戞祴璁惧鏁伴噺",
-      id: "supervisionDeviceNum",
+      id: "mdNum",
       type: 'number',
       input: true,
       value: "",
@@ -73,7 +73,7 @@
     },
     {
       name: "鐏跺ご鏁伴噺",
-      id: "cookingRangeNum",
+      id: "rbCookingRangeNum",
       type: 'number',
       input: true,
       value: "",
@@ -82,7 +82,7 @@
     },
     {
       name: "骞村潎鐢ㄦ补閲�",
-      id: "annualAvgOil",
+      id: "rbCookingOilCapacity",
       type: 'number',
       input: true,
       value: "",
@@ -91,7 +91,7 @@
     },
     {
       name: "鐢ㄦ补绫诲瀷",
-      id: "oilType",
+      id: "rbCookingOilType",
       type: 'checkbox',
       value: "",
       options: [
@@ -102,31 +102,31 @@
     },
     {
       name: "鑱旂郴浜�",
-      id: "contract",
+      id: "biContract",
       input: true,
       value: '',
       noValue: false,
     },
     {
       name: "鑱旂郴鏂瑰紡",
-      id: "telephone",
+      id: "biTelephone",
       input: true,
       value: '',
       noValue: false,
     },
     {
       name: "琛楅晣",
-      id: "town",
+      id: "biLocation",
       type: 'picker',
       pickerMode: 'region',
-      // value: ['涓婃捣甯�', '涓婃捣甯�', '閲戝北鍖�', '鐭冲寲琛楅亾'],
       value: [],
+      displayValue: [],
       noValue: false,
       required: false,
     },
     {
       name: "闆嗕腑鍖�",
-      id: "concentrationArea",
+      id: "rbConcentrationArea",
       input: true,
       value: '',
       noValue: false,
@@ -134,7 +134,7 @@
     },
     {
       name: "鎺掑彛鏁伴噺",
-      id: "outfallCount",
+      id: "rbOutfallCount",
       type: 'number',
       input: true,
       value: '',
@@ -144,7 +144,7 @@
     },
     {
       name: "鎺掑彛浣嶇疆",
-      id: "outfallLocation",
+      id: "rbOutfallLocation",
       input: true,
       value: '',
       noValue: false,
@@ -152,7 +152,7 @@
     },
     {
       name: "鎺掑彛缂栧彿",
-      id: "outfallNum",
+      id: "rbOutfallNum",
       input: true,
       value: '',
       noValue: false,
diff --git a/pages/m_consult/behaviors/b_questions.js b/pages/m_consult/behaviors/b_questions.js
index 979186d..84dff26 100644
--- a/pages/m_consult/behaviors/b_questions.js
+++ b/pages/m_consult/behaviors/b_questions.js
@@ -25,9 +25,9 @@
     getQuestionsByType(page = 1, selectedValues, perPage = this.data.perPage) {
       this.selectedValues = selectedValues
       this.setData({loading: true})
-      const t = setTimeout(() => {
-        this.setData({loading: false})
-      }, 10000);
+      // const t = setTimeout(() => {
+      //   this.setData({loading: false})
+      // }, 10000);
       var that = this
       consultservice.getQuestionsByType(app.globalData.accessToken.userId, selectedValues[0], selectedValues[1], page, perPage, {
           onPage(head) {
diff --git a/pages/m_consult/behaviors/b_search.js b/pages/m_consult/behaviors/b_search.js
index 0d164ad..68fd30a 100644
--- a/pages/m_consult/behaviors/b_search.js
+++ b/pages/m_consult/behaviors/b_search.js
@@ -23,7 +23,7 @@
     search(obj, cPage = 1, perPage = this.data.perPage) {
       this.obj = obj
       this.setData({loading: true})
-      const t = setTimeout(() => { this.setData({loading: false}) }, 10000);
+      // const t = setTimeout(() => { this.setData({loading: false}) }, 10000);
       var that = this
       const {keyword, type} = obj
       consultservice.searchLaw(app.globalData.accessToken.userId, keyword, cPage, perPage, {
diff --git a/pages/m_ledger/behaviors/b_uploadLedger.js b/pages/m_ledger/behaviors/b_uploadLedger.js
new file mode 100644
index 0000000..3c2df1e
--- /dev/null
+++ b/pages/m_ledger/behaviors/b_uploadLedger.js
@@ -0,0 +1,41 @@
+import b_upload from "../../../base/behaviors/b_upload"
+import ledgerservice from"../../../service/ledgerservice"
+import b_loadingStatus from '../../../base/behaviors/b_loadingStatus'
+
+const app = getApp()
+
+/**
+ * 鍙拌处涓婁紶绠$悊
+ */
+module.exports = Behavior({
+  behaviors: [b_upload, b_loadingStatus],
+  data: {
+    ledger: {},
+    remark: '',
+  },
+  methods: {
+    _uploadLedger() {
+      if (this.data.imgFiles.length == 0) return
+      
+      var that = this
+      let path = []
+      this.data.imgFiles.forEach(f => {
+        path.push(f.url)
+      });
+      let ledger = this.data.ledger
+      ledger.remark1 = this.data.remark
+
+      this.setData({loading: true})
+      ledgerservice.uploadLedger(app.globalData.accessToken.userId, ledger, path, {
+        success (res) {
+          this.setData({loading: false})
+          if (typeof that._success === 'function') {
+            that._success(res)
+          }
+        },
+        complete (res) {
+        }
+      })
+    },
+  }
+})
\ No newline at end of file
diff --git a/pages/m_ledger/ledgerupload/ledgerupload.js b/pages/m_ledger/ledgerupload/ledgerupload.js
index 540b229..e3ce8ec 100644
--- a/pages/m_ledger/ledgerupload/ledgerupload.js
+++ b/pages/m_ledger/ledgerupload/ledgerupload.js
@@ -1,11 +1,14 @@
 // pages/m_ledger/ledgerupload/ledgerupload.js
-const ledgerservice = require("../../../service/ledgerservice")
-const moment = require('../../../utils/moment.min')
-const $f = require('../../../service/baserequest')
+import b_upload from "../behaviors/b_uploadLedger"
+import b_uploadLedger from '../behaviors/b_uploadLedger'
+import ledgerservice from "../../../service/ledgerservice"
+import moment from '../../../utils/moment.min'
+import b_loadingToast from '../../../base/behaviors/b_loadingToast'
+
 const app = getApp()
 
 Page({
-
+  behaviors: [b_upload, b_uploadLedger, b_loadingToast],
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
@@ -40,13 +43,6 @@
     })
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
-  onReady() {
-
-  },
-
   checkStatus() {
     if (this.data.ledger.path1) {
       let imgFiles = this.data.ledger.path1
@@ -75,17 +71,6 @@
     }
   },
 
-  uploadFile(file) {
-    let data = file.detail.newFiles
-    console.log(data);
-    data.forEach(element => {
-      element.loading = false
-    });
-    this.setData({
-      imgFiles: data
-    })
-  },
-
   onSubmit: function () {
     if (this.data.imgFiles.length == 0) {
       wx.showToast({
@@ -100,50 +85,18 @@
   },
 
   submitLedger() {
-    var that = this
-
     this.setData({
       showDialog: false,
     })
-    wx.showLoading({
-      title: '鎻愪氦涓�',
-      mask: true,
-      success: (res) => {},
-      fail: (res) => {},
-      complete: (res) => {},
+    this._uploadLedger()
+  },
+
+  _success(res) {
+    this.getOpenerEventChannel().emit('uploadOver', {
+      indexGroup: that.data.indexGroup
     })
-    setTimeout(() => {
-      wx.hideLoading()
-    }, 20000);
-    let path = []
-    this.data.imgFiles.forEach(f => {
-      path.push(f.url)
-    });
-    let ledger = this.data.ledger
-    ledger.remark1 = this.data.remark
-    ledgerservice.uploadLedger(app.globalData.accessToken.userId, ledger, path, {
-      success (res) {
-        wx.hideLoading({
-          success: (res) => {
-            wx.showToast({
-              title: '鎻愪氦鎴愬姛',
-              duration: 1000,
-              icon: 'success',
-              mask: true,
-              success: (res) => {
-                that.getOpenerEventChannel().emit('uploadOver', {
-                  indexGroup: that.data.indexGroup
-                })
-                wx.navigateBack({
-                  delta: 1,
-                })
-              },
-            })
-          },
-        })
-      },
-      complete (res) {
-      }
+    wx.navigateBack({
+      delta: 1,
     })
   },
 
diff --git a/pages/m_user/base_c/c_scene-info/c_scene-info.js b/pages/m_user/base_c/c_scene-info/c_scene-info.js
index 40ed78f..402c046 100644
--- a/pages/m_user/base_c/c_scene-info/c_scene-info.js
+++ b/pages/m_user/base_c/c_scene-info/c_scene-info.js
@@ -1,9 +1,15 @@
 // pages/m_user/base_c/c_scene-info/c_scene-info.js
-import b_inputCheck from '../../behaviors/b_inputCheck'
 import sceneInfo from '../../../../data/sceneInfo'
+import userservice from '../../../../service/userservice'
+import deviceservice from '../../../../service/deviceservice'
+import b_inputCheck from '../../behaviors/b_inputCheck'
+import b_uploadLedger from '../../../m_ledger/behaviors/b_uploadLedger'
+import b_loadingToast from '../../../../base/behaviors/b_loadingToast'
+
+const app = getApp()
 
 Component({
-  behaviors: [b_inputCheck],
+  behaviors: [b_inputCheck, b_uploadLedger, b_loadingToast],
   options: {
     addGlobalClass: true,
   },
@@ -18,11 +24,18 @@
     sceneType: {
       type: String,
       value: '1'
+    },
+    authStatus: {
+      type: Boolean,
+      value: false
     }
   },
 
   attached() {
-
+    this.setData({
+      loadingText: '涓婁紶涓�',
+      loadCompleteText: '涓婁紶瀹屾垚'
+    })
   },
 
   pageLifetimes: {
@@ -32,6 +45,8 @@
       this.setData({
         msg: info.get(this.data.sceneType)
       })
+      //鑾峰彇鍦烘櫙淇℃伅
+      this.getSceneInfo()
     },
     hide: function () {
       // 椤甸潰琚殣钘�
@@ -45,38 +60,174 @@
    * 缁勪欢鐨勫垵濮嬫暟鎹�
    */
   data: {
-
+    msg: [],
+    info: {}
   },
 
   /**
    * 缁勪欢鐨勬柟娉曞垪琛�
    */
   methods: {
-    selectChange(e) {
-      const index = e.currentTarget.dataset.index
-      const options = e.detail.options
-      this.setData({
-        [`msg[${index}].options`]: options
+    //鑾峰彇鍦烘櫙淇℃伅
+    getSceneInfo() {
+      var that = this
+      userservice.getBaseInfo(app.globalData.accessToken.userId, {
+        success(data) {
+          const msg = that.data.msg
+          switch (that.data.sceneType) {
+            case '1':
+              if (data.baseInfo != null) {
+                msg[0].value = data.baseInfo.biName
+                msg[1].value = data.baseInfo.biNickName
+                msg[3].value = data.baseInfo.biAddress
+                msg[10].value = data.baseInfo.biContact
+                msg[11].value = data.baseInfo.biTelephone
+                msg[12].value = data.baseInfo.biTownName == null ? [] : 
+                [
+                  data.baseInfo.biProvinceName, data.baseInfo.biCityName, data.baseInfo.biDistrictName, data.baseInfo.biTownName, 
+                  data.baseInfo.biProvinceCode, data.baseInfo.biCityCode, data.baseInfo.biDistrictCode, data.baseInfo.biTownCode, 
+                ]
+                msg[12].displayValue = data.baseInfo.biTownName == null ? [] : 
+                [
+                  data.baseInfo.biProvinceName, data.baseInfo.biCityName, data.baseInfo.biDistrictName, data.baseInfo.biTownName, 
+                ]
+              }
+              if (data.specialInfo != null) {
+                msg[2].value = data.specialInfo.rbCuisine
+                msg[2].options.forEach(o => {
+                  o.checked = false
+                });
+                msg[2].value.split(';').forEach(v => {
+                  for (let i = 0; i < msg[2].options.length; i++) {
+                    const o = msg[2].options[i];
+                    if (v == o.name) {
+                      o.checked = true
+                      break
+                    }else if (o.hasRemark) {
+                      o.checked = true
+                      o.remark += v
+                    }
+                  }
+                });
+                const s = data.specialInfo.rbTotalSeating
+                msg[4].value = data.specialInfo.rbTotalSeating
+                msg[4].options.forEach(o => {
+                  o.checked = false
+                });
+                if (s == 0) {
+                  msg[4].options[0].checked = true
+                } else if (s > 0 && s <= 20) {
+                  msg[4].options[1].checked = true
+                } else if (s > 20 && s <= 50) {
+                  msg[4].options[2].checked = true
+                } else if (s > 50 && s <= 100) {
+                  msg[4].options[3].checked = true
+                } else {
+                  msg[4].options[4].checked = true
+                }
+                msg[7].value = data.specialInfo.rbCookingRangeNum
+                msg[8].value = parseInt(data.specialInfo.rbCookingOilCapacity) * 12
+                msg[9].value = data.specialInfo.rbCookingOilType
+                msg[9].options.forEach(o => {
+                  o.checked = false
+                });
+                msg[9].value.split(';').forEach(v => {
+                  for (let i = 0; i < msg[9].options.length; i++) {
+                    const o = msg[9].options[i];
+                    if (v == o.name) {
+                      o.checked = true
+                      break
+                    }else if (o.hasRemark) {
+                      o.checked = true
+                      o.remark += v
+                    }
+                  }
+                });
+                msg[13].value = data.specialInfo.rbConcentrationArea
+                msg[14].value = data.specialInfo.rbOutfallCount
+                msg[15].value = data.specialInfo.rbOutfallLocation
+                msg[16].value = data.specialInfo.rbOutfallNum
+              }
+              deviceservice.getPurifyDeviceInfo(app.globalData.accessToken.userId, {
+                success(res) {
+                  if (res.length > 0) {
+                    that.setData({
+                      ['msg[5].value']: res[0].fpNum
+                    })
+                  }
+                }
+              })
+              deviceservice.getMoniterDeviceInfo(app.globalData.accessToken.userId, {
+                success(res) {
+                  if (res.length > 0) {
+                    that.setData({
+                      ['msg[6].value']: res[0].mdNum
+                    })
+                  }
+                }
+              })
+              break;
+            case '2':
+
+              break;
+            case '3':
+
+              break;
+            case '4':
+
+              break;
+            case '5':
+
+              break;
+            case '6':
+
+              break;
+            case '7':
+
+              break;
+            default:
+              break;
+          }
+          console.log(msg);
+          that.setData({
+            msg
+          })
+        }
       })
     },
 
-    pickerChange(e) {
-      console.log(e);
-      const {
-        index,
-        mode
-      } = e.currentTarget.dataset
-      let i = e.detail.value
-      if (mode == 'region') {
-        this.setData({
-          [`msg[${index}].value`]: i
-        })
-      } else if (mode == 'selector') {
-        this.setData({
-          [`msg[${index}].selectIndex`]: i,
-          [`msg[${index}].value`]: this.data.msg[index].options[i].value
-        })
+    //鎻愪氦鍦烘櫙淇℃伅
+    submit() {
+      var that = this
+      this.setData({loading: true})
+      //閽堝涓嶅悓鍦烘櫙锛屾暟鎹粨鏋勪細鏈変笉鍚岀殑瀹氬埗闇�姹�
+      switch (this.data.sceneType) {
+        case '1':
+          const m = this.data.msg[4]
+          for (let i = 0; i < m.options.length; i++) {
+            const o = m.options[i];
+            if (o.checked) {
+              this.setData({
+                [`info.${m.id}`]: o.value
+              })
+              break
+            }
+          }
+          break;
+        default:
+          break;
       }
+      const sceneInfoStr = JSON.stringify(this.data.info)
+      userservice.authScene(app.globalData.accessToken.openId, app.globalData.userInfo.extension2, sceneInfoStr, {
+        success(res) {
+          that.submintLedger()
+        },
+      })
+    },
+
+    //鎻愪氦鍥剧墖淇℃伅
+    submintLedger() {
+      this._uploadLedger()
     }
   }
 })
\ No newline at end of file
diff --git a/pages/m_user/base_c/c_scene-info/c_scene-info.wxml b/pages/m_user/base_c/c_scene-info/c_scene-info.wxml
index dd786c9..08ed0a7 100644
--- a/pages/m_user/base_c/c_scene-info/c_scene-info.wxml
+++ b/pages/m_user/base_c/c_scene-info/c_scene-info.wxml
@@ -22,7 +22,7 @@
             <picker wx:if="{{item.pickerMode == 'selector'}}" mode="selector" bindchange="pickerChange" data-index="{{index}}" data-mode="selector" value="{{item.selectIndex}}" range="{{item.options}}" range-key="name" class="value">
               <view class="picker-text">{{item.options[item.selectIndex].name}}</view>
             </picker>
-            <picker wx:elif="{{item.pickerMode == 'region'}}" mode="region" bindchange="pickerChange" data-index="{{index}}" data-mode="region" value="{{item.value}}" class="value" level="sub-district" custom-item="绌�">
+            <picker wx:elif="{{item.pickerMode == 'region'}}" mode="region" bindchange="pickerChange" data-index="{{index}}" data-mode="region" value="{{item.displayValue}}" class="value" level="sub-district" custom-item="绌�">
               <view class="picker-text" wx:if="{{item.value.length > 0}}">{{item.value[0] + (item.value[1] == item.value[0] ? '' : item.value[1]) + item.value[2] + item.value[3]}}</view>
               <view wx:else class="picker-text" style="color: #B2B2B2;">璇烽�夋嫨琛楅晣</view>
             </picker>
diff --git a/pages/m_user/base_c/c_scene-info/c_scene-info.wxss b/pages/m_user/base_c/c_scene-info/c_scene-info.wxss
index 1d2a509..3b1ec25 100644
--- a/pages/m_user/base_c/c_scene-info/c_scene-info.wxss
+++ b/pages/m_user/base_c/c_scene-info/c_scene-info.wxss
@@ -75,4 +75,8 @@
 
 .not-required {
   color: transparent;
+}
+
+.upload-title-class {
+  font-size: small;
 }
\ No newline at end of file
diff --git a/pages/m_user/behaviors/b_inputCheck.js b/pages/m_user/behaviors/b_inputCheck.js
index 39eb81f..db93e12 100644
--- a/pages/m_user/behaviors/b_inputCheck.js
+++ b/pages/m_user/behaviors/b_inputCheck.js
@@ -1,5 +1,7 @@
 /**
- * 
+ * 淇℃伅杈撳叆閫昏緫
+ * 鍖呮嫭杈撳叆淇℃伅瀛樺偍銆佽緭鍏ヨ鑼冩�ф娴嬨�侀敊璇彁绀虹瓑
+ * @see "/data/sceneInfo.js"
  */
 module.exports = Behavior({
   data: {
@@ -10,6 +12,33 @@
     attached: function () {}
   },
   methods: {
+    selectChange(e) {
+      const index = e.currentTarget.dataset.index
+      const options = e.detail.options
+      this.setData({
+        [`msg[${index}].options`]: options
+      })
+    },
+
+    pickerChange(e) {
+      console.log(e);
+      const {
+        index,
+        mode
+      } = e.currentTarget.dataset
+      let i = e.detail.value.concat(e.detail.code)
+      if (mode == 'region') {
+        this.setData({
+          [`msg[${index}].value`]: i
+        })
+      } else if (mode == 'selector') {
+        this.setData({
+          [`msg[${index}].selectIndex`]: i,
+          [`msg[${index}].value`]: this.data.msg[index].options[i].value
+        })
+      }
+    },
+
     changeMsg(e) {
       let id = e.detail.params.id
       let value = e.detail.params.value
@@ -24,30 +53,6 @@
             [nPath]: false
           })
         }
-      }
-    },
-
-    onSubmit: function () {
-      console.log('onSubmit');
-      if (!this.submitCheck()) return
-
-      let msg = this.data.msg
-      if (msg) {
-        let info = {}
-        msg.forEach(m => {
-          info[m.id] = m.value
-        });
-        // console.log(info);
-        this.setData({info})
-        this.triggerEvent('onSubmit', info)
-        // wx.showToast({
-        //   title: 'onSubmit',
-        //   duration: 1000,
-        //   icon: 'none',
-        //   success: (res) => {},
-        //   fail: (res) => {},
-        //   complete: (res) => {},
-        // })
       }
     },
 
@@ -109,7 +114,7 @@
           }
         }
         //杈撳叆妗�
-        else if (m.value === "") {
+        else if (m.value === "" || m.value === null || m.value === undefined) {
           this.showErrorMsg(i)
           return false
         }
@@ -164,6 +169,22 @@
           })
         }).exec();
       }).exec();
-    }
+    },
+
+    onSubmit: function () {
+      console.log('onSubmit');
+      if (!this.submitCheck()) return
+
+      let msg = this.data.msg
+      if (msg) {
+        let info = {}
+        msg.forEach(m => {
+          info[m.id] = m.value
+        });
+        this.setData({info})
+        this.triggerEvent('onSubmit', info)
+        this.submit()
+      }
+    },
   }
 })
\ No newline at end of file
diff --git a/pages/m_user/behaviors/b_login.js b/pages/m_user/behaviors/b_login.js
index b955c32..b6b0335 100644
--- a/pages/m_user/behaviors/b_login.js
+++ b/pages/m_user/behaviors/b_login.js
@@ -35,6 +35,7 @@
                     app.globalData.accessToken = res.data
                     app.globalData.accessToken.userId = data.userId
                     app.globalData.accessToken.suserId = data.suserId
+                    app.globalData.accessToken.openId = data.openId
                     if (accessTokenPW.userName) {
                       app.globalData.accessToken.userName = accessTokenPW.userName
                     }
@@ -53,6 +54,7 @@
                       password: accessTokenPW.password,
                       userId: data.userId,
                       suserId: data.suserId,
+                      openId: data.openId
                     }
                     wx.setStorage({
                       key: 'accessToken',
diff --git a/pages/m_user/mine/mine.js b/pages/m_user/mine/mine.js
index 2e3e91a..8f30e7f 100644
--- a/pages/m_user/mine/mine.js
+++ b/pages/m_user/mine/mine.js
@@ -1,4 +1,6 @@
 // pages/mine/mine.js
+import userservice from '../../../service/userservice'
+
 const app = getApp()
 
 Page({
@@ -7,7 +9,8 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-
+    //璁よ瘉鐘舵�侊紝[浼佷笟, 鍦烘櫙, 涓汉]
+    authStatus:[]
   },
 
   /**
@@ -16,6 +19,27 @@
   onLoad: function (options) {
     this.setData({
       userRealName: app.globalData.userInfo.realname
+    })
+    this.getAuthStatus()
+  },
+
+  //鑾峰彇鐢ㄦ埛璁よ瘉鐘舵��
+  getAuthStatus() {
+    var that = this
+    userservice.getAuthStatus(app.globalData.accessToken.openId, app.globalData.accessToken.userId, {
+      success(res) {
+        if (res.success) {
+          that.setData({
+            authStatus: res.data
+          })
+        }else{
+          wx.showToast({
+            title: res.message,
+            duration: 2000,
+            icon: 'error',
+          })
+        }
+      }
     })
   },
 
@@ -64,6 +88,8 @@
 
   //璁よ瘉
   gotoAuthentication(e) {
+    //绛夊緟璁よ瘉鐘舵�佸姞杞藉畬姣�
+    if (this.data.authStatus.length == 0) return
     var url = ""
     var index = e.currentTarget.dataset.index
     switch (index) {
@@ -82,7 +108,12 @@
     }
     if (url != "") {
       wx.navigateTo({
-        url: url
+        url: url,
+        success: (res) => {
+          res.eventChannel.emit('acceptDataFromOpenerPage', {
+            authStatus: this.data.authStatus[parseInt(index)]
+          })
+        },
       })
     } else {
       wx.showToast({
diff --git a/pages/m_user/mine/mine.wxml b/pages/m_user/mine/mine.wxml
index 2884abe..7358e45 100644
--- a/pages/m_user/mine/mine.wxml
+++ b/pages/m_user/mine/mine.wxml
@@ -17,15 +17,15 @@
     <view class="fyui-panel user-authentication">
       <view bindtap="gotoAuthentication" data-index="0">
         <image src="/res/icons/icon3.png"></image>
-        <view>浼佷笟璁よ瘉</view>
+        <view>{{authStatus[0] ? '淇敼浼佷笟淇℃伅' : '浼佷笟淇℃伅璁よ瘉'}}</view>
       </view>
       <view bindtap="gotoAuthentication" data-index="1">
         <image src="/res/icons/icon3.png"></image>
-        <view>搴楅摵璁よ瘉</view>
+        <view>{{authStatus[1] ? '淇敼搴楅摵淇℃伅' : '搴楅摵淇℃伅璁よ瘉'}}</view>
       </view>
       <view bindtap="gotoAuthentication" data-index="2">
         <image src="/res/icons/icon3.png"></image>
-        <view>涓汉璁よ瘉</view>
+        <view>{{authStatus[2] ? '淇敼涓汉淇℃伅' : '涓汉淇℃伅璁よ瘉'}}</view>
       </view>
     </view>
     <view class="fyui-panel">
diff --git a/pages/m_user/sceneauthentication/sceneauthentication.js b/pages/m_user/sceneauthentication/sceneauthentication.js
index 8e1a6bd..f6326ad 100644
--- a/pages/m_user/sceneauthentication/sceneauthentication.js
+++ b/pages/m_user/sceneauthentication/sceneauthentication.js
@@ -1,4 +1,6 @@
 // pages/m_user/sceneauthentication/sceneauthentication.js
+
+
 const app = getApp()
 
 Page({
@@ -7,19 +9,25 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-    
+
   },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad(options) {
-    console.log(app.globalData.userInfo.extension2);
     this.setData({
       sceneType: app.globalData.userInfo.extension2
     })
+    this.getOpenerEventChannel().on('acceptDataFromOpenerPage', (data) => {
+      this.setData({
+        authStatus: data.authStatus
+      })
+    })
   },
 
+  
+
   onSubmit(e) {
     console.log(e);
     const info = e.detail
diff --git a/pages/m_user/userlogin/userlogin.js b/pages/m_user/userlogin/userlogin.js
index de0231e..e218a45 100644
--- a/pages/m_user/userlogin/userlogin.js
+++ b/pages/m_user/userlogin/userlogin.js
@@ -1,8 +1,7 @@
 // pages/m_user/userlogin/userlogin.js
 import b_login from '../behaviors/b_login'
+import $f from "../../../service//baserequest"
 
-const $f = require("../../../service//baserequest")
-const userservice = require("../../../service/userservice")
 const app = getApp()
 
 Page({
@@ -41,7 +40,7 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
    */
   onReady: function () {
-    // this.login()
+    
   },
 
   /**
@@ -67,74 +66,11 @@
             key: 'userProfile',
           })
           this.loginPw(res.userInfo)
-  
-          // that.login()
         }
       })
     }
 
     
-  },
-
-  login() {
-    //鑾峰彇缂撳瓨鐨勭敤鎴疯处鎴峰瘑鐮�
-    var that = this
-    wx.getStorage({
-      key: 'accessToken',
-      success(res) { //鑾峰彇鎴愬姛鑷姩鐧诲綍
-        app.globalData.accessToken = res.data
-        that.setData({
-          userName: res.data.userName,
-          password: res.data.password
-        })
-
-        wx.showLoading({
-          title: '鐧诲綍涓�',
-          mask: true,
-        })
-        setTimeout(() => {
-          wx.hideLoading()
-        }, 10000);
-        userservice.login(that.data.userName, that.data.password, {
-          success(data) {
-            if (data.success) {
-              app.globalData.accessToken = {
-                userName: that.data.userName,
-                password: that.data.password,
-                userId: data.userId,
-                suserId: data.suserId,
-              }
-              wx.setStorage({
-                key: 'accessToken',
-                data: app.globalData.accessToken,
-              })
-              that.getUserInfo()
-            } else {
-              wx.showToast({
-                title: '璐︽埛鎴栧瘑鐮侀敊璇�',
-                duration: 1000,
-                icon: 'none',
-              })
-            }
-          },
-          complete() {
-            that.setData({
-              loading: false
-            })
-            wx.hideLoading()
-          }
-        })
-      },
-      fail(e) { //鑾峰彇澶辫触
-        //鍚庡彴鏌ヨ寰俊鏄惁缁戝畾璐﹀彿锛屾湭缁戝畾鍒欒烦杞敞鍐岀晫闈�
-        wx.navigateTo({
-          url: '/pages/m_user/userregistercompany/userregistercompany',
-          success: (result) => {},
-          fail: (res) => {},
-          complete: (res) => {},
-        })
-      }
-    })
   },
 
   _onLoginFail(e) {
diff --git a/service/baserequest.js b/service/baserequest.js
index c725821..fe6e570 100644
--- a/service/baserequest.js
+++ b/service/baserequest.js
@@ -11,8 +11,7 @@
 const util = require("../utils/util.js")
 
 const originProperties = ['url', 'data', 'header', 'method', 'success', 'fail', 'complete'];
-// const baseUrl = "http://127.0.0.1:8080"
-// const baseUrl = "http://192.168.1.106:8080"
+// const baseUrl = "http://192.168.0.137:8080"
 const baseUrl = "https://fyami.com.cn:447"
 // const basePicUrl = baseUrl + "/images/"
 const basePicUrl = "https://fyami.com.cn:447/images/"
diff --git a/service/deviceservice.js b/service/deviceservice.js
new file mode 100644
index 0000000..4ace174
--- /dev/null
+++ b/service/deviceservice.js
@@ -0,0 +1,29 @@
+const $f = require('./baserequest')
+
+module.exports = {
+  //鑾峰彇鍑�鍖栬澶囦俊鎭�
+  getPurifyDeviceInfo: function (userId, fun) {
+    let cb = {
+      url: `/device/purify/info`,
+      params: {
+        userId: userId
+      }
+    }
+    Object.assign(cb, fun)
+
+    $f.get(cb)
+  },
+
+  //鑾峰彇鐩戞祴璁惧淇℃伅
+  getMoniterDeviceInfo: function (userId, fun) {
+    let cb = {
+      url: `/device/monitor/info`,
+      params: {
+        userId: userId
+      }
+    }
+    Object.assign(cb, fun)
+
+    $f.get(cb)
+  },
+}
\ No newline at end of file
diff --git a/service/userservice.js b/service/userservice.js
index 608c675..62784a6 100644
--- a/service/userservice.js
+++ b/service/userservice.js
@@ -58,13 +58,31 @@
   },
 
   //鍦烘櫙淇℃伅璁よ瘉
-  authScene: function (userId, info, fun) {
+  authScene: function (wxUserId, sceneType, sceneInfo, fun) {
     let cb = {
-      url: '/wxuser/loginPW',
-      data: accessTokenPW,
+      url: '/auth/scene',
+      params: {
+        wxUserId: wxUserId,
+        sceneType: sceneType
+      },
+      data: sceneInfo,
     }
     Object.assign(cb, fun)
 
     $f.post(cb)
   },
+
+  //鑾峰彇鐢ㄦ埛璁よ瘉鐘舵��
+  getAuthStatus: function (wxUserId, userId, fun) {
+    let cb = {
+      url: `/auth/status`,
+      params: {
+        wxUserId: wxUserId,
+        userId: userId
+      }
+    }
+    Object.assign(cb, fun)
+
+    $f.get(cb)
+  },
 }
\ No newline at end of file

--
Gitblit v1.9.3