riku
2022-08-08 0f51940bc899827f84019d2c0c165b23014d8eca
承诺书和智能咨询模块

1. 承诺书模块基本逻辑走通;
2. 智能咨询模块完成主页面和搜索页面部分UI;
已修改13个文件
已删除3个文件
已添加18个文件
1129 ■■■■■ 文件已修改
app.json 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.wxss 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/searchbar/searchbar.js 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/searchbar/searchbar.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/searchbar/searchbar.wxml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/searchbar/searchbar.wxss 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consulthome/consulthome.js 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consulthome/consulthome.json 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consulthome/consulthome.wxml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consulthome/consulthome.wxss 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consultsearch/consultsearch.js 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consultsearch/consultsearch.json 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consultsearch/consultsearch.wxml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/module_consult/consultsearch/consultsearch.wxss 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promise/promise.js 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promise/promise.wxml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promisefile/promisefile.js 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promiseinfo/promiseinfo.js 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promiseinfo/promiseinfo.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promiseresult/promiseresult.js 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promiseresult/promiseresult.wxml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/promiseresult/promiseresult.wxss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/con_lib.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/con_lib_bg.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/con_pro.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/con_pro_bg.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/con_qa.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/con_qa_bg.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/promisefile.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/seal.png 补丁 | 查看 | 原始文档 | blame | 历史
res/icons/sign.png 补丁 | 查看 | 原始文档 | blame | 历史
service/baserequest.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/promiseservice.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -1,4 +1,5 @@
{
  "entryPagePath": "pages/module_consult/consultsearch/consultsearch",
  "pages": [
    "pages/login/login",
    "pages/home/home",
@@ -15,7 +16,9 @@
    "pages/notice/notice",
    "pages/gradereport/gradereport",
    "pages/test/test",
    "pages/promisesign/promisesign"
    "pages/promisesign/promisesign",
    "pages/module_consult/consulthome/consulthome",
    "pages/module_consult/consultsearch/consultsearch"
  ],
  "window": {
    "backgroundTextStyle": "light",
app.wxss
@@ -7,7 +7,9 @@
  --fyui-text-color_2: #7F7F7F;
  --fyui-text-color_3: #B2B2B2;
  --fyui-BG_1: #F5F5F5;
  --fyui-BG-COLOR-ACTIVE: #ececec5d;
}
/********************************** é€šç”¨-start ***********************************/
.statusbar-title {
  text-align: center;
@@ -19,6 +21,7 @@
  display: flex;
  justify-content: space-between;
}
.flex-v {
  position: relative;
  display: flex;
@@ -51,6 +54,17 @@
  transform: rotate(90deg);
  margin: 0 4px;
}
.fyui-mask {
  background: rgba(0, 0, 0, .2);
  position: absolute;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0
}
/********************************** é€šç”¨-end ***********************************/
/********************************** ä¸»ç•Œé¢èƒŒæ™¯-start ***********************************/
@@ -96,11 +110,12 @@
  text-align: center;
  /* z-index: 1; */
}
/********************************** ä¸»ç•Œé¢èƒŒæ™¯-end ***********************************/
/********************************** æ¨ªå‘图标文本-start ***********************************/
.fyui-cell {
  padding: 8px 16px;
  padding: 8px 8px;
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
@@ -114,13 +129,13 @@
.fyui-cell__hd {
  display: flex;
  align-items: center;
  margin-right: 8px;
}
.fyui-cell__bd {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  margin-left: 8px;
}
.fyui-cell__ft {
@@ -145,7 +160,7 @@
  mask-image: url(data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.454%206.58l1.06-1.06%205.78%205.779a.996.996%200%20010%201.413l-5.78%205.779-1.06-1.061%205.425-5.425-5.425-5.424z%22%20fill%3D%22%23B2B2B2%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);
  position: absolute;
  top: 50%;
  right: 16px;
  right: 8px;
  margin-top: -12px
}
@@ -159,6 +174,11 @@
  -webkit-align-items: center;
  align-items: flex-start;
  height: 80px;
  background-color: white;
}
.fyui-box:active {
  background-color: var(--fyui-BG-COLOR-ACTIVE);
}
.fyui-box .fyui-box__hd {
@@ -255,6 +275,7 @@
  color: var(--fyui-text-color_3);
  justify-content: space-between;
}
/********************************** æ¨ªå‘图标文本-end ***********************************/
/********************************** å†…容面板-start ***********************************/
@@ -282,4 +303,5 @@
  font-size: 14px;
  color: var(--fyui-text-color_2);
}
/********************************** å†…容面板-end ***********************************/
component/searchbar/searchbar.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,253 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/     // The module cache
/******/     var installedModules = {};
/******/
/******/     // The require function
/******/     function __webpack_require__(moduleId) {
/******/
/******/         // Check if module is in cache
/******/         if(installedModules[moduleId]) {
/******/             return installedModules[moduleId].exports;
/******/         }
/******/         // Create a new module (and put it into the cache)
/******/         var module = installedModules[moduleId] = {
/******/             i: moduleId,
/******/             l: false,
/******/             exports: {}
/******/         };
/******/
/******/         // Execute the module function
/******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/         // Flag the module as loaded
/******/         module.l = true;
/******/
/******/         // Return the exports of the module
/******/         return module.exports;
/******/     }
/******/
/******/
/******/     // expose the modules object (__webpack_modules__)
/******/     __webpack_require__.m = modules;
/******/
/******/     // expose the module cache
/******/     __webpack_require__.c = installedModules;
/******/
/******/     // define getter function for harmony exports
/******/     __webpack_require__.d = function(exports, name, getter) {
/******/         if(!__webpack_require__.o(exports, name)) {
/******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/         }
/******/     };
/******/
/******/     // define __esModule on exports
/******/     __webpack_require__.r = function(exports) {
/******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/         }
/******/         Object.defineProperty(exports, '__esModule', { value: true });
/******/     };
/******/
/******/     // create a fake namespace object
/******/     // mode & 1: value is a module id, require it
/******/     // mode & 2: merge all properties of value into the ns
/******/     // mode & 4: return value when already ns object
/******/     // mode & 8|1: behave like require
/******/     __webpack_require__.t = function(value, mode) {
/******/         if(mode & 1) value = __webpack_require__(value);
/******/         if(mode & 8) return value;
/******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/         var ns = Object.create(null);
/******/         __webpack_require__.r(ns);
/******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/         return ns;
/******/     };
/******/
/******/     // getDefaultExport function for compatibility with non-harmony modules
/******/     __webpack_require__.n = function(module) {
/******/         var getter = module && module.__esModule ?
/******/             function getDefault() { return module['default']; } :
/******/             function getModuleExports() { return module; };
/******/         __webpack_require__.d(getter, 'a', getter);
/******/         return getter;
/******/     };
/******/
/******/     // Object.prototype.hasOwnProperty.call
/******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/     // __webpack_public_path__
/******/     __webpack_require__.p = "";
/******/
/******/
/******/     // Load entry module and return exports
/******/     return __webpack_require__(__webpack_require__.s = 26);
/******/ })
/************************************************************************/
/******/ ({
/***/ 26:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
  options: {
    addGlobalClass: true
  },
  properties: {
    extClass: {
      type: String,
      value: ''
    },
    focus: {
      type: Boolean,
      value: false
    },
    autoFocus: {
      type: Boolean,
      value: true
    },
    placeholder: {
      type: String,
      value: '搜索'
    },
    value: {
      type: String,
      value: ''
    },
    search: {
      // è¿”回Promise的函数
      // @ts-ignore
      type: Function,
      value: null
    },
    throttle: {
      // 500ms内只会调用一次search函数
      type: Number,
      value: 500
    },
    cancelText: {
      type: String,
      value: '取消'
    },
    cancel: {
      type: Boolean,
      value: true
    },
    tips: {
      type: String,
      value: "搜索"
    }
  },
  data: {
    result: [] // æœç´¢ç»“æžœ
  },
  /* @ts-ignore */
  lastSearch: Date.now(),
  lifetimes: {
    // @ts-ignore
    attached() {
      // @ts-ignore
      if (this.data.focus) {
        this.setData({
          searchState: true
        });
      }
    }
  },
  methods: {
    clearInput() {
      // @ts-ignore
      this.setData({
        value: '',
        focus: true,
        result: []
      }); // @ts-ignore
      this.triggerEvent('clear');
    },
    // @ts-ignore
    inputFocus(e) {
      // this.setData({
      //     searchState: true
      // })
      // @ts-ignore
      this.triggerEvent('focus', e.detail);
    },
    // @ts-ignore
    inputBlur(e) {
      this.setData({
        focus: false
      });
      this.triggerEvent('blur', e.detail);
    },
    showInput() {
      this.setData({
        focus: true,
        searchState: true
      });
    },
    hideInput() {
      this.setData({
        searchState: false
      });
      this.triggerEvent('hide');
    },
    // @ts-ignore
    inputChange(e) {
      this.setData({
        value: e.detail.value
      });
      this.triggerEvent('input', e.detail);
      // if (Date.now() - this.lastSearch < this.data.throttle) {
      //   return;
      // }
      if (typeof this.data.search !== 'function') {
        return;
      }
      this.lastSearch = Date.now();
      this.timerId = setTimeout(() => {
        if (Date.now() - this.lastSearch < this.data.throttle) {
          return;
        }
        this.data.search(e.detail.value).then(json => {
          this.setData({
            result: json
          });
        }).catch(err => {
          console.error('search error', err);
        });
      }, this.data.throttle);
    },
    // @ts-ignore
    selectResult(e) {
      const {
        index
      } = e.currentTarget.dataset;
      const item = this.data.result[index];
      this.triggerEvent('selectresult', {
        index,
        item
      });
    }
  }
});
/***/ })
/******/ });
component/searchbar/searchbar.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
{
    "component": true,
    "usingComponents": {
        "mp-cells": "../cells/cells",
        "mp-cell": "../cell/cell"
    }
}
component/searchbar/searchbar.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
<view class="weui-search-bar {{searchState ? 'weui-search-bar_focusing' : ''}} {{extClass}} margin-16-h search-bar">
    <view class="weui-search-bar__form">
        <view class="weui-search-bar__box box">
            <icon class="weui-icon-search" type="search" size="12"></icon>
            <input type="text" class="weui-search-bar__input input" placeholder="{{placeholder}}" value="{{value}}" focus="{{focus}}" bindblur="inputBlur" bindfocus="inputFocus" bindinput="inputChange" />
            <text class="weui-icon-clear" hover-class="weui-active" wx:if="{{value.length > 0}}" bindtap="clearInput"></text>
        </view>
        <label class="weui-search-bar__label" bindtap="showInput">
            <icon class="weui-icon-search" type="search" size="12"></icon>
            <text class="weui-search-bar__text">{{tips}}</text>
        </label>
    </view>
    <view wx:if="{{cancel && searchState}}" class="weui-search-bar__cancel-btn" bindtap="hideInput">{{cancelText}}</view>
</view>
<mp-cells ext-class=" {{'searchbar-result ' + extClass}}" wx:if="{{searchState && result.length > 0}}">
    <mp-cell class="result" bindtap="selectResult" body-class="weui-cell_primary" data-index="{{index}}" wx:for="{{result}}" wx:key="index" hover>
        <view>{{item.text}}</view>
    </mp-cell>
</mp-cells>
component/searchbar/searchbar.wxss
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
.weui-search-bar {
  position: relative;
  padding: 8px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  box-sizing: border-box;
  background-color: white;
  -webkit-text-size-adjust: 100%;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center
}
.weui-search-bar__label text {
  display: inline-block;
  font-size: 12px;
  vertical-align: middle
}
.weui-search-bar__box text {
  display: inline-block;
  font-size: 12px;
  vertical-align: middle
}
.search-bar {
  /* position: relative; */
  /* height: 60rpx; */
  /* border-radius: 2rpx; */
  padding: 4px;
}
.search-bar .box {
  /* height: 52rpx; */
  /* font-size: 12px; */
  /* margin: 0; */
  /* background-color: tomato; */
}
.search-bar .input {
  padding: 0;
  font-size: 12px;
}
.weui-search-bar__label {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 16rpx;
  z-index: 2;
  font-size: 0;
  border-radius: 4px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: left;
  -webkit-align-items: left;
  align-items: left;
  -webkit-box-pack: left;
  -webkit-justify-content: left;
  justify-content: left;
  color: var(--weui-FG-1);
  background: var(--weui-BG-2)
}
.weui-search-bar__cancel-btn {
  font-size: 12px;
}
pages/home/home.js
@@ -141,8 +141,8 @@
        break;
      case "2":
        //智能在线咨询
        url = ""
        return;
        url = "/pages/module_consult/consulthome/consulthome"
        break;
      case "3":
        //在线守法学习
        
@@ -155,7 +155,6 @@
        let bodyUrl = e.currentTarget.dataset.url
        let fileType = e.currentTarget.dataset.filetype
        wx.downloadFile({
          // ç¤ºä¾‹ url,并非真实存在
          url: bodyUrl,
          success: function (res) {
            const filePath = res.tempFilePath
pages/module_consult/consulthome/consulthome.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,91 @@
// pages/module_consult/consulthome/consulthome.js
Page({
  /**
   * é¡µé¢çš„初始数据
   */
  data: {
    searchTips: '请输入关键字搜索',
    hotTopics: [{
      pic: '',
      title: '某某某某某某某某某某某某某某某某某某',
      abstract: '某某某某某某某某某某某某某某某某某某某某某',
      time: '2022-02-04',
      author: '作者',
      itemCount: '5',
      tags: ['tag1', 'tag2']
    },{
      pic: '',
      title: '某某某某某某某某某某某某某某某某某某',
      abstract: '某某某某某某某某某某某某某某某某某某某某某',
      time: '2022-02-04',
      author: '作者',
      itemCount: '5',
      tags: ['tag1', 'tag2']
    },{
      pic: '',
      title: '某某某某某某某某某某某某某某某某某某',
      abstract: '某某某某某某某某某某某某某某某某某某某某某',
      time: '2022-02-04',
      author: '作者',
      itemCount: '5',
      tags: ['tag1', 'tag2']
    }]
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoad: function (options) {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面初次渲染完成
   */
  onReady: function () {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面显示
   */
  onShow: function () {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面隐藏
   */
  onHide: function () {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面卸载
   */
  onUnload: function () {
  },
  /**
   * é¡µé¢ç›¸å…³äº‹ä»¶å¤„理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  },
  /**
   * é¡µé¢ä¸Šæ‹‰è§¦åº•事件的处理函数
   */
  onReachBottom: function () {
  },
  /**
   * ç”¨æˆ·ç‚¹å‡»å³ä¸Šè§’分享
   */
  onShareAppMessage: function () {
  }
})
pages/module_consult/consulthome/consulthome.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
{
  "navigationBarTitleText": "智能咨询",
  "navigationBarBackgroundColor": "#57E4CB",
  "navigationBarTextStyle": "white",
  "usingComponents": {
    "mp-icon": "/component/icon/icon"
  }
}
pages/module_consult/consulthome/consulthome.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
<!--pages/module_consult/consulthome/consulthome.wxml-->
<view class="page">
  <view class="page__hd">
    <view class="search-bar" bindtap="search">
      <mp-icon icon="search" size="15" color="black"></mp-icon>
      <text>{{searchTips}}</text>
    </view>
  </view>
  <view class="page__bd">
    <view class="flex-h">
      <view class="card">
        <image src="/res/icons/con_pro_bg.png" class="card-bg" mode="scaleToFill"/>
        <view class="card-title">常见问题</view>
        <view class="card-abstract">常见企业环保问题</view>
        <image src="/res/icons/con_pro.png" mode="aspectFit" class="icon"></image>
      </view>
      <view class="divider"></view>
      <view class="card middle">
        <image src="/res/icons/con_lib_bg.png" class="card-bg" mode="scaleToFill"/>
        <view class="card-title">环保知识库</view>
        <view class="card-abstract">环保法律法规</view>
        <image src="/res/icons/con_lib.png" mode="aspectFit" class="icon"></image>
      </view>
      <view class="divider"></view>
      <view class="card">
        <image src="/res/icons/con_qa_bg.png" class="card-bg" mode="scaleToFill"/>
        <view class="card-title">智能咨询</view>
        <view class="card-abstract">环保专家 åœ¨çº¿å’¨è¯¢</view>
        <image src="/res/icons/con_qa.png" mode="aspectFit" class="icon"></image>
      </view>
    </view>
    <view class="fyui-cell fyui-cell_select">
      <view class="fyui-cell__bd">热门</view>
      <view class="fyui-cell__ft">更多</view>
    </view>
    <view wx:for="{{hotTopics}}" wx:key="index">
      <view class="fyui-box  fyui-box__text">
        <view class="fyui-box__hd">
          <text class="" wx:for="{{item.tags}}" wx:key="i" data-index="i" wx:for-item="tag">{{tag}}</text>
          {{item.title}}
        </view>
        <view class="fyui-box__bd">
          <view class="fyui-box__content">{{item.abstract}}</view>
        </view>
        <view class="fyui-box__ft">
          <view>{{item.time}}</view>
          <view>{{item.author}}</view>
        </view>
      </view>
    </view>
  </view>
  <view class="page__ft">
  </view>
</view>
pages/module_consult/consulthome/consulthome.wxss
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
/* pages/module_consult/consulthome/consulthome.wxss */
.page__bd {
  padding: 10px;
}
.search-bar {
  min-width: 50vw;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 24px;
  color: var(--fyui-text-color_2);
  text-align: left;
  background-color: white;
  border-radius: 10px;
}
.card {
  position: relative;
  /* background-color: cyan; */
  border-radius: 10px;
  padding: 6px;
  text-align: center;
  flex: 1;
}
.card:active {
  background-color: var(--fyui-BG-COLOR-ACTIVE);
}
.card .card-bg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
}
.divider {
  width: 8px;
}
.card .card-title {
  font-size: 18px;
  font-weight: bold;
}
.card .card-abstract {
  font-size: 12px;
  color: var(--fyui-text-color_2);
}
.card .icon {
  height: 56px;
  width: 60px;
}
/* --fyui-box */
.fyui-box__tag {
  justify-content: space-evenly;
}
pages/module_consult/consultsearch/consultsearch.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,87 @@
// pages/module_consult/consultsearch/consultsearch.js
Page({
  /**
   * é¡µé¢çš„初始数据
   */
  data: {
    focus: false,
    placeholder: '搜索',
    value: '',
    histroy: [],
    hotTopic: [],
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoad: function (options) {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面初次渲染完成
   */
  onReady: function () {
  },
  clearInput() {
    // @ts-ignore
    this.setData({
      value: '',
      focus: true,
      result: []
    }); // @ts-ignore
    this.triggerEvent('clear');
  },
  // @ts-ignore
  inputFocus(e) {
    // this.setData({
    //     searchState: true
    // })
    // @ts-ignore
    this.triggerEvent('focus', e.detail);
  },
  // @ts-ignore
  inputBlur(e) {
    this.setData({
      focus: false
    });
    this.triggerEvent('blur', e.detail);
  },
  // @ts-ignore
  inputChange(e) {
    this.setData({
      value: e.detail.value
    });
    this.triggerEvent('input', e.detail);
    // if (Date.now() - this.lastSearch < this.data.throttle) {
    //   return;
    // }
    if (typeof this.data.search !== 'function') {
      return;
    }
    this.lastSearch = Date.now();
    this.timerId = setTimeout(() => {
      if (Date.now() - this.lastSearch < this.data.throttle) {
        return;
      }
      this.data.search(e.detail.value).then(json => {
        this.setData({
          result: json
        });
      }).catch(err => {
        console.error('search error', err);
      });
    }, this.data.throttle);
  },
})
pages/module_consult/consultsearch/consultsearch.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
{
  "navigationBarTitleText": "搜索",
  "navigationBarBackgroundColor": "#57E4CB",
  "navigationBarTextStyle": "white",
  "usingComponents": {
    "mp-icon": "/component/icon/icon"
  }
}
pages/module_consult/consultsearch/consultsearch.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
<!--pages/module_consult/consultsearch/consultsearch.wxml-->
<view class="page">
  <view class="page__hd">
    <view class="search-bar" bindtap="search">
      <mp-icon icon="search" size="15" color="black"></mp-icon>
      <text>{{searchTips}}</text>
      <input type="text" class="search-bar__input" placeholder="{{placeholder}}" value="{{value}}" focus="{{focus}}" bindblur="inputBlur" bindfocus="inputFocus" bindinput="inputChange" />
      <text class="weui-icon-clear" hover-class="weui-active" wx:if="{{value.length > 0}}" bindtap="clearInput"></text>
    </view>
    <view class="btn" bindtap="search">搜索</view>
  </view>
  <view class="page__bd">
    <view wx:if="{{histroy.length > 0}}">
      <view>历史记录</view>
      <text wx:for="{{history}}"></text>
    </view>
    <view>大家都在搜</view>
    <view wx:for="{{hotTopic}}">
      <text>{{index + 1}}</text>
      <text>{{item}}</text>
      <image src=""></image>
    </view>
  </view>
  <view class="page__ft"></view>
</view>
pages/module_consult/consultsearch/consultsearch.wxss
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
/* pages/module_consult/consultsearch/consultsearch.wxss */
.page__hd {
  /* background-color: white; */
  padding: 10px;
  display: flex;
  align-items: center;
}
.page__bd {
  padding-left: 10px;
  padding-right: 10px;
}
.search-bar {
  flex: 1;
  position: relative;
  min-width: 50vw;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 24px;
  color: var(--fyui-text-color_2);
  text-align: left;
  background-color: white;
  border-radius: 20px;
  border: 2px solid #57E4CB;
  display: flex;
  align-items: center;
}
.search-bar .weui-icon-clear {
  /* position: absolute;
  top: 50%;
  right: 0;
  margin-top: -16px; */
  padding-left: 8px;
  width: 16px;
  height: 16px;
  -webkit-mask-size: 16px;
  mask-size: 16px;
  /* display: block; */
}
.search-bar .search-bar__input {
  width: 100%;
  border: 0;
  font-size: 14px;
  line-height: 20px;
  box-sizing: content-box;
  background: transparent;
  caret-color: var(--weui-BRAND);
  color: var(--weui-FG-0);
}
.btn {
  border-radius: 20px;
  line-height: 20px;
  font-size: 14px;
  width: 70px;
  background: linear-gradient(to top right, #42E4D5, #94DBF2);
  padding: 4px 2px;
  text-align: center;
  color: white;
  margin-left: 4px;
}
pages/promise/promise.js
@@ -1,5 +1,6 @@
// pages/promise/promise.js
const moment = require('../../utils/moment.min')
const promiseservice = require("../../service/promiseservice")
const app = getApp()
Page({
@@ -10,48 +11,32 @@
  data: {
    text1: "已开启!请及时完成承诺",
    text3: "去承诺",
    status: 0,
    promise: [{
      period: '承诺周期:2021å¹´1月~2021å¹´12月',
      time: '2021å¹´1月6日完成'
    }, {
      period: '承诺周期:2020å¹´1月~2020å¹´12月',
      time: '2020å¹´1月6日完成'
      time: '2021å¹´1月6日完成',
      picPath: '',
      pdfPath: ''
    }],
    newPromise: [{
      period: '承诺周期:2022å¹´1月~2022å¹´12月',
      time: '2022å¹´5月10日完成'
    },{
      period: '承诺周期:2021å¹´1月~2021å¹´12月',
      time: '2021å¹´1月6日完成'
    }, {
      period: '承诺周期:2020å¹´1月~2020å¹´12月',
      time: '2020å¹´1月6日完成'
    }],
    deadline: "----å¹´--月--日",
    deadline: "承诺截止时间:----å¹´--月--日",
  },
  promiseHistory: [],
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoad: function (options) {
    this._initPlanYear()
    this.getCommitment()
  },
    /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面显示
   */
  onShow: function () {
    var that = this
    wx.getStorage({
      key: "promise",
      success(res) {
        if(res.data){
          that.setData({
            promise: that.data.newPromise
          })
        }
      }
    })
  },
  /**
@@ -63,45 +48,99 @@
    var period = `${now.year()}/${now.month()+1}-${now.month()+1}`
    var deadline = now.endOf('year').format("YYYYå¹´MM月DD日")
    this.setData({
      planYear: `${year}å¹´`,
      maxYear: year,
      thisPeiod: period,
      deadline: deadline
      year: year,
      deadline: `承诺截止时间:${deadline}`
    })
  },
  /**
   * é¡µé¢è·³è½¬
   * åˆ¤æ–­å½“前周期内的承诺是否完成
   */
  goto: function (e) {
    var url = ""
    var index = e.currentTarget.dataset.index
    switch (index) {
      case "0":
        //去承诺
        url = `/pages/promiseinfo/promiseinfo`
        break;
      case "1":
        //查看承诺结果
        url = `/pages/promiseresult/promiseresult`
        break;
      case "2":
        //
        url = ""
        return;
      case "3":
        //
        url = ""
        break;
      case "4":
        break;
      case "5":
        break;
    }
    if (url != "") {
      wx.navigateTo({
        url: url
  checkStatus() {
    if (this.promiseHistory.length > 0) {
      var first = this.promiseHistory[0]
      var firstYear = moment(first.cmCreateTime).year()
      if (firstYear >= this.data.year) {
        var deadline = moment().add(1, 'years').endOf('year').format("YYYYå¹´MM月DD日")
        this.setData({
          text1: "很棒!本次承诺已完成",
          text3: "查看承诺",
          status: 1,
          deadline: `下次承诺时间:${deadline}`
      })
    }
    }
  },
  /**
   * èŽ·å–åŽ†å²è®°å½•
   */
  getCommitment() {
    var that = this
    promiseservice.getCommitment(app.globalData.accessToken.userId, {
      success(data) {
        that.promiseHistory = data
        let promise = []
        data.forEach(d => {
          const time = moment(d.cmCreateTime)
          promise.push({
            period: `承诺周期:${time.year()}å¹´1月~${time.year()}å¹´12月`,
            time: `${time.format('YYYYå¹´MM月DD日')}完成`,
            picPath: d.cmUrl,
            pdfPath: d.cmPdfUrl
          })
        });
        that.setData({
          promise
        })
        that.checkStatus()
      }
    })
  },
  /**
   * è·³è½¬è‡³åŽ»æ‰¿è¯º
   */
  gotoPromise(e) {
    var status = e.currentTarget.dataset.status
    if (status == 0) {
      wx.navigateTo({
        url: '/pages/promiseinfo/promiseinfo'
      })
    } else {
      this.gotoResult(0)
    }
  },
  /**
   * è·³è½¬è‡³æ‰¿è¯ºè¯¦æƒ…
   */
  gotoDetail(e) {
    var i = e.currentTarget.dataset.index
    this.gotoResult(i)
  },
  gotoResult (i) {
    var p = this.data.promise[i]
    wx.navigateTo({
      url: '/pages/promiseresult/promiseresult',
      success: function (res) {
        // é€šè¿‡ eventChannel å‘被打开页面传送数据
        res.eventChannel.emit('acceptDataFromOpenerPage', {
          promise: {
            picPath: p.picPath,
            pdfPath: p.pdfPath
          }
        })
      }
    })
  },
  /**
   * è·³è½¬è‡³åŽ†å²è®°å½•
   */
  gotoHistory() {
  }
})
pages/promise/promise.wxml
@@ -5,21 +5,21 @@
  <view class="page__hd">
    <view>
      <view class="title">{{text1}}</view>
      <view class="tag">承诺截止时间:{{deadline}}</view>
      <view class="tag">{{deadline}}</view>
    </view>
    <view class="btn" bindtap="goto" data-index="0">{{text3}}</view>
    <view class="btn" bindtap="gotoPromise" data-status="{{status}}">{{text3}}</view>
  </view>
  <view class="page__bd">
    <view class="fyui-cell fyui-cell_select title">
      <view class="fyui-cell__bd">历史承诺</view>
      <view class="fyui-cell__ft">查看更多</view>
    </view>
    <view wx:for="{{promise}}" wx:key="index" data-index="index">
    <view wx:for="{{promise}}" wx:key="index">
      <view class="p-cell fyui-panel">
        <view class="p-title"> å®ˆæ³• | æ‰¿è¯º</view>
        <view class="p-content">{{item.period}}</view>
        <view class="p-tag">{{item.time}}</view>
        <view class="p-btn" bindtap="goto" data-index="1">去看看</view>
        <view class="p-btn" bindtap="gotoDetail" data-index="{{index}}">去看看</view>
      </view>
    </view>
  </view>
pages/promisefile/promisefile.js
@@ -74,25 +74,56 @@
  },
  onSubmit: function () {
    wx.setStorage({
      key: "promise",
      data: true,
    })
    // wx.setStorage({
    //   key: "promise",
    //   data: true,
    // })
    // wx.navigateTo({
    //   url: '/pages/promiseresult/promiseresult',
    // })
    wx.showLoading({
      title: '承诺书生成中',
      mask: true,
      success: (res) => {},
      fail: (res) => {},
      complete: (res) => {},
    })
    setTimeout(() => {
      wx.hideLoading()
    }, 20000);
    let signPic = this.data.imgFiles[0]
    promiseservice.createCommitment(app.globalData.accessToken.userId, this.commitmentVo, signPic, {
      success(data) {
        console.log(data);
        if (data.data.success) {
          wx.navigateTo({
            url: '/pages/promiseresult/promiseresult',
            success: function (res) {
              // é€šè¿‡ eventChannel å‘被打开页面传送数据
              res.eventChannel.emit('acceptDataFromOpenerPage', {
                promise: {
                  picPath: data.data[0],
                  pdfPath: data.data[1],
                }
              })
            }
          })
        }
      },
      fail(res) {
        console.log(res);
      },
      complete(res) {
        console.log(res);
        wx.hideLoading({
          success: (res) => {
            wx.showToast({
              title: '生成完成',
              duration: 1500,
              icon: 'success',
            })
          },
        })
      }
    })
pages/promiseinfo/promiseinfo.js
@@ -38,7 +38,8 @@
      id: "number",
      input: true,
      value: "",
      noValue: false
        noValue: false,
        required: false
    },
    {
      name: "法人姓名",
@@ -57,11 +58,26 @@
    },
  ],
    commitTypes: [
      {value: 'type1', name: '环保主体责任承诺', checked: true},
      {value: 'type2', name: '环境行政许可事项', checked: false},
      {value: 'type3', name: '环保专项资金或其他资金补助', checked: false},
      {value: 'type4', name: '其他环保申报事项', checked: false}
    commitTypes: [{
        value: 'type1',
        name: '环保主体责任承诺',
        checked: true
      },
      {
        value: 'type2',
        name: '环境行政许可事项',
        checked: false
      },
      {
        value: 'type3',
        name: '环保专项资金或其他资金补助',
        checked: false
      },
      {
        value: 'type4',
        name: '其他环保申报事项',
        checked: false
      }
    ],
    commitTypeIndex: 0,
  },
@@ -71,6 +87,29 @@
   */
  onLoad: function (options) {
    let st = this.data.sceneTypeMap[app.globalData.userInfo.extension2]
    switch (st) {
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
        this.setData({
          'msg[2].name': '报建号'
        })
        break;
      case '1':
      case '7':
        this.setData({
          'msg[2].name': '环评审批文号'
        })
        break;
      default:
        this.setData({
          'msg[2].name': '环评审批文号'
        })
        break;
    }
    this.setData({
      sceneType: st
    })
@@ -181,7 +220,7 @@
    let msgLength = msg.length
    //确认信息完整度
    for (let i = 0; i < msgLength; i++) {
      if (msg[i].value === "") {
      if (msg[i].required != false && msg[i].value === "") {
        let error = msg[i].name + "不可为空"
        let path = "msg[" + i + "].noValue"
        this.setData({
@@ -196,6 +235,34 @@
        })
        return false
      }
      //身份证位数判断
      if (i == 4) {
        if (msg[i].value.length < msg[i].maxLength) {
          let error = msg[i].name + "位数错误"
          let path = "msg[" + i + "].noValue"
          this.setData({
            errorMsg: error,
            [path]: true
          })
          return false
        }
      }
    }
    var cList = []
    for (let i = 0; i < this.data.commitTypes.length; i++) {
      const t = this.data.commitTypes[i];
      if (t.checked) {
        cList.push(t)
      }
    }
    if (cList.length == 0) {
      this.setData({
        errorMsg: '至少选择一项承诺类型',
      })
      return false
    }
    return true
pages/promiseinfo/promiseinfo.wxml
@@ -18,7 +18,7 @@
      </view>
      <view class="last">
        <checkbox-group bindchange="checkboxChange">
          <label wx:for="{{commitTypes}}" wx:key="{{item.value}}" class="weui-cell weui-check__label">
          <label wx:for="{{commitTypes}}" wx:key="value" class="weui-cell weui-check__label">
            <view class="weui-cell__hd">
              <checkbox value="{{item.value}}" checked="{{item.checked}}"></checkbox>
            </view>
pages/promiseresult/promiseresult.js
@@ -1,18 +1,31 @@
// pages/promiseresult/promiseresult.js
const $f = require("../../service/baserequest")
Page({
  /**
   * é¡µé¢çš„初始数据
   */
  data: {
    promise: {
      picPath: '',
      pdfPath: '',
    }
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
      console.log(data);
      data.promise.picPath = $f.basePicUrl + data.promise.picPath
      data.promise.pdfPath = $f.basePicUrl + data.promise.pdfPath
      that.setData({
        promise: data.promise
      })
    })
  },
  /**
pages/promiseresult/promiseresult.wxml
@@ -1,4 +1,5 @@
<!--pages/promiseresult/promiseresult.wxml-->
<view class="page">
<image src="/res/icons/promisefile.png"></image>
<view class="">
<image src="{{promise.picPath}}" class="image"     show-menu-by-longpress="true" mode="widthFix"></image>
<!-- <image src="https://fyami.com.cn:447/images/commitment-restaurant-1659927781518.jpg" class="image"     show-menu-by-longpress="true" mode="widthFix"></image> -->
</view>
pages/promiseresult/promiseresult.wxss
@@ -1,7 +1,5 @@
/* pages/promiseresult/promiseresult.wxss */
image {
  width: 90vw;
  height: 90vh;
  margin: auto;
  margin-top: 16px;
  width: 100%;
  height: 100vh;
}
res/icons/con_lib.png
res/icons/con_lib_bg.png
res/icons/con_pro.png
res/icons/con_pro_bg.png
res/icons/con_qa.png
res/icons/con_qa_bg.png
res/icons/promisefile.png
Binary files differ
res/icons/seal.png
Binary files differ
res/icons/sign.png
Binary files differ
service/baserequest.js
@@ -11,10 +11,11 @@
const originProperties = ['url', 'data', 'header', 'method', 'success', 'fail', 'complete'];
// const baseUrl = "http://127.0.0.1:8080"
const baseUrl = "http://192.168.0.116:8080"
// const baseUrl = "https://fyami.com.cn:447/"
const basePicUrl = baseUrl + "images/"
const baseFileUrl = baseUrl + "meeting/file/"
const baseUrl = "http://192.168.0.106:8080"
// const baseUrl = "https://fyami.com.cn:447"
// const basePicUrl = baseUrl + "/images/"
const basePicUrl = "https://fyami.com.cn:447/images/"
const baseFileUrl = baseUrl + "/meeting/file/"
function request(fun) { 
  if (fun.params != undefined) {
service/promiseservice.js
@@ -17,4 +17,18 @@
      complete: (res) => {fun.complete(res)},
    })
  },
  //获取用户承诺书历史记录
  getCommitment: function(userId, fun, page = 1, perPage = 30) {
    let cb = {
      url: '/commitment/letter',
      params: {
        userId: userId,
        page: page,
        per_page: perPage
      },
    }
    Object.assign(cb, fun)
    $f.get(cb)
  }
}