| | |
| | | /** |
| | | * æ°æ®å è½½çå¬ |
| | | * æ°æ®å è½½ç¶æçå¬ |
| | | * @see './b_loadingToast.js' å '../../component/loadingstatus' |
| | | */ |
| | | module.exports = Behavior({ |
| | | data: { |
| | |
| | | if (loading) { |
| | | this._loadStart() |
| | | this._loading() |
| | | setTimeout(() => { this.setData({loading: false}) }, 20000); |
| | | } else { |
| | | this._loadComplete() |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | const { clearTimeout } = require("timers"); |
| | | |
| | | /** |
| | | * æ°æ®å è½½å¼¹çª |
| | | * æ ¹æ®å è½½ç¶æï¼å±ç¤ºå¯¹åºçå¼¹çª |
| | | * @see './b_loadingStatus.js' |
| | | */ |
| | | module.exports = Behavior({ |
| | | data: { |
| | | loadingText: 'å è½½ä¸', |
| | | loadCompleteText: 'å è½½å®æ' |
| | | }, |
| | | timeoutId: '', |
| | | methods: { |
| | | // å è½½å¼å§toast |
| | | loadStart() { |
| | | clearTimeout(this.timeoutId) |
| | | wx.showLoading({ |
| | | title: this.data.loadingText, |
| | | mask: true, |
| | | }) |
| | | this.timeoutId = setTimeout(() => { |
| | | wx.hideLoading() |
| | | }, 20000); |
| | | }, |
| | | // å è½½ä¸toast |
| | | loading() { |
| | | |
| | | }, |
| | | // å è½½å®ætoast |
| | | loadComplete() { |
| | | clearTimeout(this.timeoutId) |
| | | wx.hideLoading({ |
| | | success: (res) => { |
| | | wx.showToast({ |
| | | title: this.data.loadCompleteText, |
| | | duration: 1000, |
| | | icon: 'success', |
| | | mask: true, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | } |
| | | }) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * å¾çä¸ä¼ 管ç |
| | | */ |
| | | 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); |
| | | }, |
| | | } |
| | | }) |
| | |
| | | //é¤é¥®************************************************************************************************** |
| | | 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: [ |
| | |
| | | }, |
| | | { |
| | | 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: "", |
| | |
| | | }, |
| | | { |
| | | name: "çæµè®¾å¤æ°é", |
| | | id: "supervisionDeviceNum", |
| | | id: "mdNum", |
| | | type: 'number', |
| | | input: true, |
| | | value: "", |
| | |
| | | }, |
| | | { |
| | | name: "ç¶å¤´æ°é", |
| | | id: "cookingRangeNum", |
| | | id: "rbCookingRangeNum", |
| | | type: 'number', |
| | | input: true, |
| | | value: "", |
| | |
| | | }, |
| | | { |
| | | name: "å¹´åç¨æ²¹é", |
| | | id: "annualAvgOil", |
| | | id: "rbCookingOilCapacity", |
| | | type: 'number', |
| | | input: true, |
| | | value: "", |
| | |
| | | }, |
| | | { |
| | | name: "ç¨æ²¹ç±»å", |
| | | id: "oilType", |
| | | id: "rbCookingOilType", |
| | | type: 'checkbox', |
| | | value: "", |
| | | options: [ |
| | |
| | | }, |
| | | { |
| | | 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, |
| | |
| | | }, |
| | | { |
| | | name: "æå£æ°é", |
| | | id: "outfallCount", |
| | | id: "rbOutfallCount", |
| | | type: 'number', |
| | | input: true, |
| | | value: '', |
| | |
| | | }, |
| | | { |
| | | name: "æå£ä½ç½®", |
| | | id: "outfallLocation", |
| | | id: "rbOutfallLocation", |
| | | input: true, |
| | | value: '', |
| | | noValue: false, |
| | |
| | | }, |
| | | { |
| | | name: "æå£ç¼å·", |
| | | id: "outfallNum", |
| | | id: "rbOutfallNum", |
| | | input: true, |
| | | value: '', |
| | | noValue: false, |
| | |
| | | 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) { |
| | |
| | | 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, { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) { |
| | | } |
| | | }) |
| | | }, |
| | | } |
| | | }) |
| | |
| | | // 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], |
| | | /** |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å次渲æå®æ |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | checkStatus() { |
| | | if (this.data.ledger.path1) { |
| | | let imgFiles = this.data.ledger.path1 |
| | |
| | | } |
| | | }, |
| | | |
| | | 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({ |
| | |
| | | }, |
| | | |
| | | submitLedger() { |
| | | var that = this |
| | | |
| | | this.setData({ |
| | | showDialog: false, |
| | | }) |
| | | wx.showLoading({ |
| | | title: 'æäº¤ä¸', |
| | | mask: true, |
| | | success: (res) => {}, |
| | | fail: (res) => {}, |
| | | complete: (res) => {}, |
| | | }) |
| | | 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', { |
| | | this._uploadLedger() |
| | | }, |
| | | |
| | | _success(res) { |
| | | this.getOpenerEventChannel().emit('uploadOver', { |
| | | indexGroup: that.data.indexGroup |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | complete (res) { |
| | | } |
| | | }) |
| | | }, |
| | | |
| | |
| | | // 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, |
| | | }, |
| | |
| | | sceneType: { |
| | | type: String, |
| | | value: '1' |
| | | }, |
| | | authStatus: { |
| | | type: Boolean, |
| | | value: false |
| | | } |
| | | }, |
| | | |
| | | attached() { |
| | | |
| | | this.setData({ |
| | | loadingText: 'ä¸ä¼ ä¸', |
| | | loadCompleteText: 'ä¸ä¼ 宿' |
| | | }) |
| | | }, |
| | | |
| | | pageLifetimes: { |
| | |
| | | this.setData({ |
| | | msg: info.get(this.data.sceneType) |
| | | }) |
| | | //è·ååºæ¯ä¿¡æ¯ |
| | | this.getSceneInfo() |
| | | }, |
| | | hide: function () { |
| | | // 页é¢è¢«éè |
| | |
| | | * ç»ä»¶çåå§æ°æ® |
| | | */ |
| | | 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') { |
| | | //æäº¤åºæ¯ä¿¡æ¯ |
| | | 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({ |
| | | [`msg[${index}].value`]: i |
| | | [`info.${m.id}`]: o.value |
| | | }) |
| | | } else if (mode == 'selector') { |
| | | this.setData({ |
| | | [`msg[${index}].selectIndex`]: i, |
| | | [`msg[${index}].value`]: this.data.msg[index].options[i].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() |
| | | } |
| | | } |
| | | }) |
| | |
| | | <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> |
| | |
| | | .not-required { |
| | | color: transparent; |
| | | } |
| | | |
| | | .upload-title-class { |
| | | font-size: small; |
| | | } |
| | |
| | | /** |
| | | * |
| | | * ä¿¡æ¯è¾å
¥é»è¾ |
| | | * å
æ¬è¾å
¥ä¿¡æ¯åå¨ãè¾å
¥è§èæ§æ£æµãé误æç¤ºç |
| | | * @see "/data/sceneInfo.js" |
| | | */ |
| | | module.exports = Behavior({ |
| | | data: { |
| | |
| | | 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 |
| | |
| | | [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) => {}, |
| | | // }) |
| | | } |
| | | }, |
| | | |
| | |
| | | } |
| | | } |
| | | //è¾å
¥æ¡ |
| | | else if (m.value === "") { |
| | | else if (m.value === "" || m.value === null || m.value === undefined) { |
| | | this.showErrorMsg(i) |
| | | return false |
| | | } |
| | |
| | | }) |
| | | }).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() |
| | | } |
| | | }, |
| | | } |
| | | }) |
| | |
| | | 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 |
| | | } |
| | |
| | | password: accessTokenPW.password, |
| | | userId: data.userId, |
| | | suserId: data.suserId, |
| | | openId: data.openId |
| | | } |
| | | wx.setStorage({ |
| | | key: 'accessToken', |
| | |
| | | // pages/mine/mine.js |
| | | import userservice from '../../../service/userservice' |
| | | |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | |
| | | //认è¯ç¶æï¼[ä¼ä¸, åºæ¯, 个人] |
| | | authStatus:[] |
| | | }, |
| | | |
| | | /** |
| | |
| | | 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', |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | |
| | | |
| | | //è®¤è¯ |
| | | gotoAuthentication(e) { |
| | | //çå¾
认è¯ç¶æå è½½å®æ¯ |
| | | if (this.data.authStatus.length == 0) return |
| | | var url = "" |
| | | var index = e.currentTarget.dataset.index |
| | | switch (index) { |
| | |
| | | } |
| | | if (url != "") { |
| | | wx.navigateTo({ |
| | | url: url |
| | | url: url, |
| | | success: (res) => { |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | authStatus: this.data.authStatus[parseInt(index)] |
| | | }) |
| | | }, |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | |
| | | <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"> |
| | |
| | | // pages/m_user/sceneauthentication/sceneauthentication.js |
| | | |
| | | |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å è½½ |
| | | */ |
| | | 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 |
| | |
| | | // 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({ |
| | |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å次渲æå®æ |
| | | */ |
| | | onReady: function () { |
| | | // this.login() |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | 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) { |
| | |
| | | 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/" |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | }, |
| | | } |
| | |
| | | }, |
| | | |
| | | //åºæ¯ä¿¡æ¯è®¤è¯ |
| | | 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) |
| | | }, |
| | | } |