浏览代码

钉钉第二期(初)

347617796@qq.com 4 年之前
父节点
当前提交
0c51210fed
共有 68 个文件被更改,包括 7082 次插入1127 次删除
  1. 207 0
      Component/aParse/aDiscode.js
  2. 194 0
      Component/aParse/aParse.acss
  3. 841 0
      Component/aParse/aParse.axml
  4. 149 0
      Component/aParse/aParse.js
  5. 1 0
      Component/aParse/aParse.json
  6. 291 0
      Component/aParse/html2json.js
  7. 180 0
      Component/aParse/htmlparser.js
  8. 2518 0
      Component/aParse/showdown.js
  9. 17 14
      Component/selectSectionStaff_tow/selectSectionStaff_tow.js
  10. 20 4
      Component/selectSxZp/selectSxZp.js
  11. 77 45
      app.acss
  12. 1 0
      app.js
  13. 4 2
      app.json
  14. 3 0
      pages/deploy/upgradeDetail/upgradeDetail.acss
  15. 4 1
      pages/deploy/upgradeDetail/upgradeDetail.axml
  16. 11 12
      pages/deploy/upgradeDetail/upgradeDetail.js
  17. 24 22
      pages/statistics/C_ranking/C_ranking.js
  18. 5 5
      pages/statistics/assaign/assaign.axml
  19. 64 116
      pages/statistics/assaign/assaign.js
  20. 173 0
      pages/statistics/assaign_set/assaign_set.acss
  21. 77 0
      pages/statistics/assaign_set/assaign_set.axml
  22. 348 0
      pages/statistics/assaign_set/assaign_set.js
  23. 6 0
      pages/statistics/assaign_set/assaign_set.json
  24. 57 28
      pages/statistics/getTask/getTask.acss
  25. 13 20
      pages/statistics/getTask/getTask.axml
  26. 21 133
      pages/statistics/getTask/getTask.js
  27. 19 17
      pages/statistics/glz_execute/glz_execute.js
  28. 49 28
      pages/statistics/grant/grant.js
  29. 2 2
      pages/statistics/index/index.js
  30. 4 0
      pages/statistics/myGrant/myGrant.acss
  31. 12 10
      pages/statistics/myGrant/myGrant.axml
  32. 45 9
      pages/statistics/myGrant/myGrant.js
  33. 2 5
      pages/statistics/my_issue/my_issue.acss
  34. 62 22
      pages/statistics/my_issue/my_issue.axml
  35. 19 14
      pages/statistics/my_issue/my_issue.js
  36. 30 13
      pages/statistics/my_task/my_task.axml
  37. 59 84
      pages/statistics/my_task/my_task.js
  38. 2 2
      pages/statistics/offerAreward/offerAreward.axml
  39. 66 117
      pages/statistics/offerAreward/offerAreward.js
  40. 173 0
      pages/statistics/offerAreward_set/offerAreward_set.acss
  41. 76 0
      pages/statistics/offerAreward_set/offerAreward_set.axml
  42. 340 0
      pages/statistics/offerAreward_set/offerAreward_set.js
  43. 6 0
      pages/statistics/offerAreward_set/offerAreward_set.json
  44. 8 0
      pages/statistics/openPerform/openPerform.acss
  45. 4 4
      pages/statistics/openPerform/openPerform.axml
  46. 56 20
      pages/statistics/openPerform/openPerform.js
  47. 1 0
      pages/statistics/prizeBuckleDetail/prizeBuckleDetail.js
  48. 68 13
      pages/statistics/recordOne/recordOne.js
  49. 11 0
      pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail.acss
  50. 38 44
      pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail.axml
  51. 18 18
      pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail.js
  52. 2 2
      pages/statistics/schedule/schedule.axml
  53. 30 14
      pages/statistics/schedule/schedule.js
  54. 18 1
      pages/statistics/taskDetail/taskDetail.acss
  55. 33 12
      pages/statistics/taskDetail/taskDetail.axml
  56. 46 9
      pages/statistics/taskDetail/taskDetail.js
  57. 44 5
      pages/statistics/workDetail/workDetail.acss
  58. 61 47
      pages/statistics/workDetail/workDetail.axml
  59. 127 22
      pages/statistics/workDetail/workDetail.js
  60. 17 15
      pages/statistics/workpoints/workpoints.axml
  61. 70 15
      pages/statistics/workpoints/workpoints.js
  62. 68 50
      pages/workbench/apply/apply.js
  63. 22 58
      pages/workbench/index/index.axml
  64. 13 4
      pages/workbench/index/index.js
  65. 24 22
      pages/workbench/prize_buckle/prize_buckle.js
  66. 26 24
      pages/workbench/statistics_A/statistics_A.js
  67. 3 1
      pages/workbench/statistics_B/statistics_B.js
  68. 2 2
      utils/util.js

+ 207 - 0
Component/aParse/aDiscode.js

@@ -0,0 +1,207 @@
+// HTML 支持的数学符号
+function strNumDiscode(str) {
+  str = str.replace(/∀/g, '∀');
+  str = str.replace(/∂/g, '∂');
+  str = str.replace(/&exists;/g, '∃');
+  str = str.replace(/∅/g, '∅');
+  str = str.replace(/∇/g, '∇');
+  str = str.replace(/∈/g, '∈');
+  str = str.replace(/∉/g, '∉');
+  str = str.replace(/∋/g, '∋');
+  str = str.replace(/∏/g, '∏');
+  str = str.replace(/∑/g, '∑');
+  str = str.replace(/−/g, '−');
+  str = str.replace(/∗/g, '∗');
+  str = str.replace(/√/g, '√');
+  str = str.replace(/∝/g, '∝');
+  str = str.replace(/∞/g, '∞');
+  str = str.replace(/∠/g, '∠');
+  str = str.replace(/∧/g, '∧');
+  str = str.replace(/∨/g, '∨');
+  str = str.replace(/∩/g, '∩');
+  str = str.replace(/∩/g, '∪');
+  str = str.replace(/∫/g, '∫');
+  str = str.replace(/∴/g, '∴');
+  str = str.replace(/∼/g, '∼');
+  str = str.replace(/≅/g, '≅');
+  str = str.replace(/≈/g, '≈');
+  str = str.replace(/≠/g, '≠');
+  str = str.replace(/≤/g, '≤');
+  str = str.replace(/≥/g, '≥');
+  str = str.replace(/⊂/g, '⊂');
+  str = str.replace(/⊃/g, '⊃');
+  str = str.replace(/⊄/g, '⊄');
+  str = str.replace(/⊆/g, '⊆');
+  str = str.replace(/⊇/g, '⊇');
+  str = str.replace(/⊕/g, '⊕');
+  str = str.replace(/⊗/g, '⊗');
+  str = str.replace(/⊥/g, '⊥');
+  str = str.replace(/⋅/g, '⋅');
+  return str;
+}
+
+//HTML 支持的希腊字母
+function strGreeceDiscode(str) {
+  str = str.replace(/Α/g, 'Α');
+  str = str.replace(/Β/g, 'Β');
+  str = str.replace(/Γ/g, 'Γ');
+  str = str.replace(/Δ/g, 'Δ');
+  str = str.replace(/Ε/g, 'Ε');
+  str = str.replace(/Ζ/g, 'Ζ');
+  str = str.replace(/Η/g, 'Η');
+  str = str.replace(/Θ/g, 'Θ');
+  str = str.replace(/Ι/g, 'Ι');
+  str = str.replace(/Κ/g, 'Κ');
+  str = str.replace(/Λ/g, 'Λ');
+  str = str.replace(/Μ/g, 'Μ');
+  str = str.replace(/Ν/g, 'Ν');
+  str = str.replace(/Ξ/g, 'Ν');
+  str = str.replace(/Ο/g, 'Ο');
+  str = str.replace(/Π/g, 'Π');
+  str = str.replace(/Ρ/g, 'Ρ');
+  str = str.replace(/Σ/g, 'Σ');
+  str = str.replace(/Τ/g, 'Τ');
+  str = str.replace(/Υ/g, 'Υ');
+  str = str.replace(/Φ/g, 'Φ');
+  str = str.replace(/Χ/g, 'Χ');
+  str = str.replace(/Ψ/g, 'Ψ');
+  str = str.replace(/Ω/g, 'Ω');
+
+  str = str.replace(/α/g, 'α');
+  str = str.replace(/β/g, 'β');
+  str = str.replace(/γ/g, 'γ');
+  str = str.replace(/δ/g, 'δ');
+  str = str.replace(/ε/g, 'ε');
+  str = str.replace(/ζ/g, 'ζ');
+  str = str.replace(/η/g, 'η');
+  str = str.replace(/θ/g, 'θ');
+  str = str.replace(/ι/g, 'ι');
+  str = str.replace(/κ/g, 'κ');
+  str = str.replace(/λ/g, 'λ');
+  str = str.replace(/μ/g, 'μ');
+  str = str.replace(/ν/g, 'ν');
+  str = str.replace(/ξ/g, 'ξ');
+  str = str.replace(/ο/g, 'ο');
+  str = str.replace(/π/g, 'π');
+  str = str.replace(/ρ/g, 'ρ');
+  str = str.replace(/ς/g, 'ς');
+  str = str.replace(/σ/g, 'σ');
+  str = str.replace(/τ/g, 'τ');
+  str = str.replace(/υ/g, 'υ');
+  str = str.replace(/φ/g, 'φ');
+  str = str.replace(/χ/g, 'χ');
+  str = str.replace(/ψ/g, 'ψ');
+  str = str.replace(/ω/g, 'ω');
+  str = str.replace(/ϑ/g, 'ϑ');
+  str = str.replace(/ϒ/g, 'ϒ');
+  str = str.replace(/ϖ/g, 'ϖ');
+  str = str.replace(/·/g, '·');
+  return str;
+}
+
+// 
+
+function strcharacterDiscode(str) {
+  // 加入常用解析
+  str = str.replace(/ /g, ' ');
+  str = str.replace(/"/g, "'");
+  str = str.replace(/&/g, '&');
+  // str = str.replace(/</g, '‹');
+  // str = str.replace(/>/g, '›');
+
+  str = str.replace(/&lt;/g, '<');
+  str = str.replace(/&gt;/g, '>');
+  str = str.replace(/&#8226;/g, '•');
+
+  return str;
+}
+
+// HTML 支持的其他实体
+function strOtherDiscode(str) {
+  str = str.replace(/&OElig;/g, 'Œ');
+  str = str.replace(/&oelig;/g, 'œ');
+  str = str.replace(/&Scaron;/g, 'Š');
+  str = str.replace(/&scaron;/g, 'š');
+  str = str.replace(/&Yuml;/g, 'Ÿ');
+  str = str.replace(/&fnof;/g, 'ƒ');
+  str = str.replace(/&circ;/g, 'ˆ');
+  str = str.replace(/&tilde;/g, '˜');
+  str = str.replace(/&ensp;/g, '');
+  str = str.replace(/&emsp;/g, '');
+  str = str.replace(/&thinsp;/g, '');
+  str = str.replace(/&zwnj;/g, '');
+  str = str.replace(/&zwj;/g, '');
+  str = str.replace(/&lrm;/g, '');
+  str = str.replace(/&rlm;/g, '');
+  str = str.replace(/&ndash;/g, '–');
+  str = str.replace(/&mdash;/g, '—');
+  str = str.replace(/&lsquo;/g, '‘');
+  str = str.replace(/&rsquo;/g, '’');
+  str = str.replace(/&sbquo;/g, '‚');
+  str = str.replace(/&ldquo;/g, '“');
+  str = str.replace(/&rdquo;/g, '”');
+  str = str.replace(/&bdquo;/g, '„');
+  str = str.replace(/&dagger;/g, '†');
+  str = str.replace(/&Dagger;/g, '‡');
+  str = str.replace(/&bull;/g, '•');
+  str = str.replace(/&hellip;/g, '…');
+  str = str.replace(/&permil;/g, '‰');
+  str = str.replace(/&prime;/g, '′');
+  str = str.replace(/&Prime;/g, '″');
+  str = str.replace(/&lsaquo;/g, '‹');
+  str = str.replace(/&rsaquo;/g, '›');
+  str = str.replace(/&oline;/g, '‾');
+  str = str.replace(/&euro;/g, '€');
+  str = str.replace(/&trade;/g, '™');
+
+  str = str.replace(/&larr;/g, '←');
+  str = str.replace(/&uarr;/g, '↑');
+  str = str.replace(/&rarr;/g, '→');
+  str = str.replace(/&darr;/g, '↓');
+  str = str.replace(/&harr;/g, '↔');
+  str = str.replace(/&crarr;/g, '↵');
+  str = str.replace(/&lceil;/g, '⌈');
+  str = str.replace(/&rceil;/g, '⌉');
+
+  str = str.replace(/&lfloor;/g, '⌊');
+  str = str.replace(/&rfloor;/g, '⌋');
+  str = str.replace(/&loz;/g, '◊');
+  str = str.replace(/&spades;/g, '♠');
+  str = str.replace(/&clubs;/g, '♣');
+  str = str.replace(/&hearts;/g, '♥');
+
+  str = str.replace(/&diams;/g, '♦');
+  str = str.replace(/&#39;/g, '\'');
+  return str;
+}
+
+function strMoreDiscode(str) {
+  str = str.replace(/\r\n/g, "");
+  str = str.replace(/\n/g, "");
+
+  str = str.replace(/code/g, "wxxxcode-style");
+  return str;
+}
+
+function strDiscode(str) {
+  str = strNumDiscode(str);
+  str = strGreeceDiscode(str);
+  str = strcharacterDiscode(str);
+  str = strOtherDiscode(str);
+  str = strMoreDiscode(str);
+  return str;
+}
+function urlToHttpUrl(url, rep) {
+
+  var patt1 = new RegExp("^//");
+  var result = patt1.test(url);
+  if (result) {
+    url = rep + ":" + url;
+  }
+  return url;
+}
+
+module.exports = {
+  strDiscode: strDiscode,
+  urlToHttpUrl: urlToHttpUrl
+}

+ 194 - 0
Component/aParse/aParse.acss

@@ -0,0 +1,194 @@
+.aParse{
+    margin: 0 5px;
+    font-family: Helvetica,sans-serif;
+    font-size: 28rpx;
+    color: #666;
+    line-height: 1.8;
+}
+view{
+    word-break:break-all; overflow:auto;
+}
+.aParse-inline{
+    display: inline;
+    margin: 0;
+    padding: 0;
+}
+/*//标题 */
+.aParse-div{margin: 0;padding: 0;}
+.aParse-h1{ font-size:2em; margin: .67em 0 }
+.aParse-h2{ font-size:1.5em; margin: .75em 0 }
+.aParse-h3{ font-size:1.17em; margin: .83em 0 }
+.aParse-h4{ margin: 1.12em 0}
+.aParse-h5 { font-size:.83em; margin: 1.5em 0 }
+.aParse-h6{ font-size:.75em; margin: 1.67em 0 }
+
+.aParse-h1 {
+  font-size: 18px;
+  font-weight: 400;
+  margin-bottom: .9em;
+}
+.aParse-h2 {
+  font-size: 16px;
+  font-weight: 400;
+  margin-bottom: .34em;
+}
+.aParse-h3 {
+  font-weight: 400;
+  font-size: 15px;
+  margin-bottom: .34em;
+}
+.aParse-h4 {
+  font-weight: 400;
+  font-size: 14px;
+  margin-bottom: .24em;
+}
+.aParse-h5 {
+  font-weight: 400;
+  font-size: 13px;
+  margin-bottom: .14em;
+}
+.aParse-h6 {
+  font-weight: 400;
+  font-size: 12px;
+  margin-bottom: .04em;
+}
+
+.aParse-h1, .aParse-h2, .aParse-h3, .aParse-h4, .aParse-h5, .aParse-h6, .aParse-b, .aParse-strong  { font-weight: bolder }
+
+.aParse-i,.aParse-cite,.aParse-em,.aParse-var,.aParse-address{font-style:italic}
+.aParse-pre,.aParse-tt,.aParse-code,.aParse-kbd,.aParse-samp{font-family:monospace}
+.aParse-pre{white-space:pre}
+.aParse-big{font-size:1.17em}
+.aParse-small,.aParse-sub,.aParse-sup{font-size:.83em}
+.aParse-sub{vertical-align:sub}
+.aParse-sup{vertical-align:super}
+.aParse-s,.aParse-strike,.aParse-del{text-decoration:line-through}
+/*aparse-自定义个性化的css样式*/
+/*增加video的css样式*/
+.aParse-strong,.aParse-s{display: inline}
+.aParse-a{
+    color: deepskyblue;
+    word-break:break-all;
+    overflow:auto;
+}
+
+.aParse-video{
+    text-align: center;
+    margin: 10px 0;
+}
+
+.aParse-video-video{
+    width:100%;
+}
+
+.aParse-img{
+    /*background-color: #efefef;*/
+    overflow: hidden;
+}
+
+.aParse-blockquote {
+    margin: 0;
+    padding:10px 0 10px 5px;
+    font-family:Courier, Calibri,"宋体";
+    background:#f5f5f5;
+    border-left: 3px solid #dbdbdb;
+}
+
+.aParse-code,.aParse-axxcode-style{
+    display: inline;
+    background:#f5f5f5;
+}
+.aParse-ul{
+    margin: 20rpx 10rpx;
+}
+
+.aParse-li,.aParse-li-inner{
+    display: flex;
+    align-items: baseline;
+    margin: 10rpx 0;
+}
+.aParse-li-text{
+    
+    align-items: center;
+    line-height: 20px;
+}
+
+.aParse-li-circle{
+    display: inline-flex;
+    width: 5px;
+    height: 5px;
+    background-color: #333;
+    margin-right: 5px;
+}
+
+.aParse-li-square{
+    display: inline-flex;
+    width: 10rpx;
+    height: 10rpx;
+    background-color: #333;
+    margin-right: 5px;
+}
+.aParse-li-ring{
+    display: inline-flex;
+    width: 10rpx;
+    height: 10rpx;
+    border: 2rpx solid #333;
+    border-radius: 50%;
+    background-color: #fff;
+    margin-right: 5px;
+}
+
+/*.aParse-table{
+    width: 100%;
+    height: 400px;
+}
+.aParse-thead,.aParse-tfoot,.aParse-tr{
+    display: flex;
+    flex-direction: row;
+}
+.aParse-th,.aParse-td{
+    display: flex;
+    width: 580px;
+    overflow: auto;
+}*/
+
+.aParse-u {
+  text-decoration: underline;
+}
+.aParse-hide{
+    display: none;
+}
+.AEmojiView{
+    align-items: center;
+}
+.aEmoji{
+    width: 16px;
+    height:16px;
+}
+.aParse-tr{
+	display: flex;
+	border-right:1px solid #e0e0e0;
+	border-bottom:1px solid #e0e0e0;
+	border-top:1px solid #e0e0e0;
+}
+.aParse-th,
+.aParse-td{
+	flex:1;
+	padding:5px;
+	font-size:28rpx;
+	border-left:1px solid #e0e0e0;
+	word-break: break-all;
+}
+.aParse-td:last{
+	border-top:1px solid #e0e0e0;
+}
+.aParse-th{
+	background:#f0f0f0;
+	border-top:1px solid #e0e0e0;
+}
+.aParse-del{
+    display: inline;
+}
+.aParse-figure {
+  overflow: hidden;
+}

+ 841 - 0
Component/aParse/aParse.axml

@@ -0,0 +1,841 @@
+
+<!--基础元素-->
+<template name="aParseVideo">
+  <!--增加video标签支持,并循环添加-->
+  <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+    <video class="{{item.classStr}} aParse-{{item.tag}}-video" src="{{item.attr.src}}"></video>
+  </view>
+</template>
+<template name="aParseImg">
+  <image class="{{item.classStr}} aParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="{{item.attr.src}}" mode="aspectFit" bindload="aParseImgLoad" bindtap="aParseImgTap" mode="widthFix" style="width:{{item.width}}px;" />
+</template>
+<template name="AEmojiView">
+  <view class="AEmojiView aParse-inline" style="{{item.styleStr}}">
+    <block a:for="{{item.textArray}}" a:key="">
+      <block class="{{item.text == '\\n' ? 'aParse-hide':''}}" a:if="{{item.node == 'text'}}">{{item.text}}</block>
+      <block a:elif="{{item.node == 'element'}}">
+        <image class="aEmoji" src="{{item.baseSrc}}{{item.text}}" />
+      </block>
+    </block>
+  </view>
+</template>
+<template name="AParseBr">
+  <text>\n</text>
+</template>
+<!--入口模版-->
+<template name="aParse">
+  <block a:for="{{aParseData}}" a:key="">
+    <template is="aParse0" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse0">
+  <!--<template is="aParse1" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse1" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse1" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse1" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'table'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse1" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse1" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse1" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse1">
+  <!--<template is="aParse2" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse2" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse2" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse2" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse2" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse2" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse2">
+  <!--<template is="aParse3" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse3" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse3" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse3" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse3" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse3" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse3">
+  <!--<template is="aParse4" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse4" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse4" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse4" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse4" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse4" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse4">
+  <!--<template is="aParse5" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse5" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse5" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse5" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse5" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse5" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse5">
+  <!--<template is="aParse6" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse6" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse6" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse6" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse6" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse6" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse6">
+  <!--<template is="aParse7" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse7" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse7" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse7" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse7" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse7" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse7">
+  <!--<template is="aParse8" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse8" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse8" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse8" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse8" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse8" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse8">
+  <!--<template is="aParse9" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse9" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse9" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse9" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse9" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse9" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse9">
+  <!--<template is="aParse10" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse10" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse10" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse10" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse10" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse10" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse10">
+  <!--<template is="aParse11" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse11" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse11" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse11" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse11" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse11" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>
+<!--循环模版-->
+<template name="aParse11">
+  <!--<template is="aParse12" data="{{item}}" />-->
+  <!--判断是否是标签节点-->
+  <block a:if="{{item.node == 'element'}}">
+    <block a:if="{{item.tag == 'button'}}">
+      <button type="default" size="mini">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse12" data="{{item}}" />
+        </block>
+      </button>
+    </block>
+    <!--li类型-->
+    <block a:elif="{{item.tag == 'li'}}">
+      <view class="{{item.classStr}} aParse-li" style="{{item.styleStr}}">
+        <view class="{{item.classStr}} aParse-li-inner">
+          <view class="{{item.classStr}} aParse-li-text">
+            <view class="{{item.classStr}} aParse-li-circle"></view>
+          </view>
+          <view class="{{item.classStr}} aParse-li-text">
+            <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+              <template is="aParse12" data="{{item}}" />
+            </block>
+          </view>
+        </view>
+      </view>
+    </block>
+    <!--video类型-->
+    <block a:elif="{{item.tag == 'video'}}">
+      <template is="aParseVideo" data="{{item}}" />
+    </block>
+    <!--img类型-->
+    <block a:elif="{{item.tag == 'img'}}">
+      <template is="aParseImg" data="{{item}}" />
+    </block>
+    <!--a类型-->
+    <block a:elif="{{item.tag == 'a'}}">
+      <view bindtap="aParseTagATap" class="aParse-inline {{item.classStr}} aParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse12" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <block a:elif="{{item.tag == 'br'}}">
+      <template is="AParseBr"></template>
+    </block>
+    <!--其他块级标签-->
+    <block a:elif="{{item.tagType == 'block'}}">
+      <view class="{{item.classStr}} aParse-{{item.tag}}" style="{{item.styleStr}}">
+        <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+          <template is="aParse12" data="{{item}}" />
+        </block>
+      </view>
+    </block>
+    <!--内联标签-->
+    <view a:else class="{{item.classStr}} aParse-{{item.tag}} aParse-{{item.tagType}}" style="{{item.styleStr}}">
+      <block a:for="{{item.nodes}}" a:for-item="item" a:key="">
+        <template is="aParse12" data="{{item}}" />
+      </block>
+    </view>
+  </block>
+  <!--判断是否是文本节点-->
+  <block a:elif="{{item.node == 'text'}}">
+    <!--如果是,直接进行-->
+    <template is="AEmojiView" data="{{item}}" />
+  </block>
+</template>

+ 149 - 0
Component/aParse/aParse.js

@@ -0,0 +1,149 @@
+
+/**
+ * utils函数引入
+ **/
+import showdown from './showdown.js';
+import HtmlToJson from './html2json.js';
+/**
+ * 配置及公有属性
+ **/
+var realWindowWidth = 0;
+var realWindowHeight = 0;
+dd.getSystemInfo({
+  success: function(res) {
+    realWindowWidth = res.windowWidth
+    realWindowHeight = res.windowHeight
+  }
+})
+/**
+ * 主函数入口区
+ **/
+function aParse(bindName = 'aParseData', type = 'html', data = '<div class="color:red;">数据不能为空</div>', target, imagePadding) {
+  var that = target;
+  var transData = {};//存放转化后的数据
+  if (type == 'html') {
+    transData = HtmlToJson.html2json(data, bindName);
+    console.log(JSON.stringify(transData, ' ', ' '));
+  } else if (type == 'md' || type == 'markdown') {
+    var converter = new showdown.Converter();
+    var html = converter.makeHtml(data);
+    transData = HtmlToJson.html2json(html, bindName);
+    console.log(JSON.stringify(transData, ' ', ' '));
+  }
+  transData.view = {};
+  transData.view.imagePadding = 0;
+  if (typeof (imagePadding) != 'undefined') {
+    transData.view.imagePadding = imagePadding
+  }
+  var bindData = {};
+  bindData[bindName] = transData;
+  that.setData(bindData)
+  that.aParseImgLoad = aParseImgLoad;
+  that.aParseImgTap = aParseImgTap;
+}
+// 图片点击事件
+function aParseImgTap(e) {
+  var that = this;
+  var nowImgUrl = e.target.dataset.src;
+  var tagFrom = e.target.dataset.from;
+  if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
+    dd.previewImage({
+      current: nowImgUrl, // 当前显示图片的http链接
+      urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
+    })
+  }
+}
+
+/**
+ * 图片视觉宽高计算函数区 
+ **/
+function aParseImgLoad(e) {
+  var that = this;
+  var tagFrom = e.target.dataset.from;
+  var idx = e.target.dataset.idx;
+  if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
+    calMoreImageInfo(e, idx, that, tagFrom)
+  }
+}
+// 假循环获取计算图片视觉最佳宽高
+function calMoreImageInfo(e, idx, that, bindName) {
+  var temData = that.data[bindName];
+  if (!temData || temData.images.length == 0) {
+    return;
+  }
+  var temImages = temData.images;
+  //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
+  var recal = aAutoImageCal(e.detail.width, e.detail.height, that, bindName);
+  // temImages[idx].width = recal.imageWidth;
+  // temImages[idx].height = recal.imageheight; 
+  // temData.images = temImages;
+  // var bindData = {};
+  // bindData[bindName] = temData;
+  // that.setData(bindData);
+  var index = temImages[idx].index
+  var key = `${bindName}`
+  for (var i of index.split('.')) key += `.nodes[${i}]`
+  var keyW = key + '.width'
+  var keyH = key + '.height'
+  that.setData({
+    [keyW]: recal.imageWidth,
+    [keyH]: recal.imageheight,
+  })
+}
+
+// 计算视觉优先的图片宽高
+function aAutoImageCal(originalWidth, originalHeight, that, bindName) {
+  //获取图片的原始长宽
+  var windowWidth = 0, windowHeight = 0;
+  var autoWidth = 0, autoHeight = 0;
+  var results = {};
+  var padding = that.data[bindName].view.imagePadding;
+  windowWidth = realWindowWidth - 2 * padding;
+  windowHeight = realWindowHeight;
+  //判断按照那种方式进行缩放
+  // console.log("windowWidth" + windowWidth);
+  if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
+    autoWidth = windowWidth;
+    // console.log("autoWidth" + autoWidth);
+    autoHeight = (autoWidth * originalHeight) / originalWidth;
+    // console.log("autoHeight" + autoHeight);
+    results.imageWidth = autoWidth;
+    results.imageheight = autoHeight;
+  } else {//否则展示原来的数据
+    results.imageWidth = originalWidth;
+    results.imageheight = originalHeight;
+  }
+  return results;
+}
+
+function aParseTemArray(temArrayName, bindNameReg, total, that) {
+  var array = [];
+  var temData = that.data;
+  var obj = null;
+  for (var i = 0; i < total; i++) {
+    var simArr = temData[bindNameReg + i].nodes;
+    array.push(simArr);
+  }
+
+  temArrayName = temArrayName || 'aParseTemArray';
+  obj = JSON.parse('{"' + temArrayName + '":""}');
+  obj[temArrayName] = array;
+  that.setData(obj);
+}
+
+/**
+ * 配置emojis
+ * 
+ */
+
+function emojisInit(reg = '', baseSrc = "/aParse/emojis/", emojis) {
+  HtmlToJson.emojisInit(reg, baseSrc, emojis);
+}
+
+module.exports = {
+  aParse: aParse,
+  aParseTemArray: aParseTemArray,
+  emojisInit: emojisInit
+}
+
+

+ 1 - 0
Component/aParse/aParse.json

@@ -0,0 +1 @@
+{}

+ 291 - 0
Component/aParse/html2json.js

@@ -0,0 +1,291 @@
+
+
+var __placeImgeUrlHttps = "https";
+var __emojisReg = '';
+var __emojisBaseSrc = '';
+var __emojis = {};
+var aDiscode = require('./aDiscode.js');
+var HTMLParser = require('./htmlparser.js');
+// Empty Elements - HTML 5
+var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
+// Block Elements - HTML 5
+var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
+
+// Inline Elements - HTML 5
+var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
+
+// Elements that you can, intentionally, leave open
+// (and which close themselves)
+var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
+
+// Attributes that have their values filled in disabled="disabled"
+var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
+
+// Special Elements (can contain anything)
+var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
+function makeMap(str) {
+    var obj = {}, items = str.split(",");
+    for (var i = 0; i < items.length; i++)
+        obj[items[i]] = true;
+    return obj;
+}
+
+function q(v) {
+    return '"' + v + '"';
+}
+
+function removeDOCTYPE(html) {
+    return html
+        .replace(/<\?xml.*\?>\n/, '')
+        .replace(/<.*!doctype.*\>\n/, '')
+        .replace(/<.*!DOCTYPE.*\>\n/, '');
+}
+
+function trimHtml(html) {
+  return html
+        .replace(/\r?\n+/g, '')
+        .replace(/<!--.*?-->/ig, '')
+        .replace(/\/\*.*?\*\//ig, '')
+        .replace(/[ ]+</ig, '<')
+}
+
+
+function html2json(html, bindName) {
+    //处理字符串
+    html = removeDOCTYPE(html);
+    html = trimHtml(html);
+    html = aDiscode.strDiscode(html);
+    //生成node节点
+    var bufArray = [];
+    var results = {
+        node: bindName,
+        nodes: [],
+        images:[],
+        imageUrls:[]
+    };
+    var index = 0;
+    HTMLParser(html, {
+        start: function (tag, attrs, unary) {
+            //debug(tag, attrs, unary);
+            // node for this element
+            var node = {
+                node: 'element',
+                tag: tag,
+            };
+
+            if (bufArray.length === 0) {
+                node.index = index.toString()
+                index += 1
+            } else {
+                var parent = bufArray[0];
+                if (parent.nodes === undefined) {
+                    parent.nodes = [];
+                }
+                node.index = parent.index + '.' + parent.nodes.length
+            }
+
+            if (block[tag]) {
+                node.tagType = "block";
+            } else if (inline[tag]) {
+                node.tagType = "inline";
+            } else if (closeSelf[tag]) {
+                node.tagType = "closeSelf";
+            }
+
+            if (attrs.length !== 0) {
+                node.attr = attrs.reduce(function (pre, attr) {
+                    var name = attr.name;
+                    var value = attr.value;
+                    if (name == 'class') {
+                        console.dir(value);
+                        //  value = value.join("")
+                        node.classStr = value;
+                    }
+                    // has multi attibutes
+                    // make it array of attribute
+                    if (name == 'style') {
+                        console.dir(value);
+                        //  value = value.join("")
+                        node.styleStr = value;
+                    }
+                    if (value.match(/ /)) {
+                        value = value.split(' ');
+                    }
+                    
+
+                    // if attr already exists
+                    // merge it
+                    if (pre[name]) {
+                        if (Array.isArray(pre[name])) {
+                            // already array, push to last
+                            pre[name].push(value);
+                        } else {
+                            // single value, make it array
+                            pre[name] = [pre[name], value];
+                        }
+                    } else {
+                        // not exist, put it
+                        pre[name] = value;
+                    }
+
+                    return pre;
+                }, {});
+            }
+
+            //对img添加额外数据
+            if (node.tag === 'img') {
+                node.imgIndex = results.images.length;
+                var imgUrl = node.attr.src;
+                if (imgUrl[0] == '') {
+                    imgUrl.splice(0, 1);
+                }
+                imgUrl = aDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
+                node.attr.src = imgUrl;
+                node.from = bindName;
+                results.images.push(node);
+                results.imageUrls.push(imgUrl);
+            }
+            
+            // 处理font标签样式属性
+            if (node.tag === 'font') {
+                var fontSize = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
+                var styleAttrs = {
+                    'color': 'color',
+                    'face': 'font-family',
+                    'size': 'font-size'
+                };
+                if (!node.attr.style) node.attr.style = [];
+                if (!node.styleStr) node.styleStr = '';
+                for (var key in styleAttrs) {
+                    if (node.attr[key]) {
+                        var value = key === 'size' ? fontSize[node.attr[key]-1] : node.attr[key];
+                        node.attr.style.push(styleAttrs[key]);
+                        node.attr.style.push(value);
+                        node.styleStr += styleAttrs[key] + ': ' + value + ';';
+                    }
+                }
+            }
+
+            //临时记录source资源
+            if(node.tag === 'source'){
+                results.source = node.attr.src;
+            }
+            
+            if (unary) {
+                // if this tag doesn't have end tag
+                // like <img src="hoge.png"/>
+                // add to parents
+                var parent = bufArray[0] || results;
+                if (parent.nodes === undefined) {
+                    parent.nodes = [];
+                }
+                parent.nodes.push(node);
+            } else {
+                bufArray.unshift(node);
+            }
+        },
+        end: function (tag) {
+            //debug(tag);
+            // merge into parent tag
+            var node = bufArray.shift();
+            if (node.tag !== tag) console.error('invalid state: mismatch end tag');
+
+            //当有缓存source资源时于于video补上src资源
+            if(node.tag === 'video' && results.source){
+                node.attr.src = results.source;
+                delete results.source;
+            }
+            
+            if (bufArray.length === 0) {
+                results.nodes.push(node);
+            } else {
+                var parent = bufArray[0];
+                if (parent.nodes === undefined) {
+                    parent.nodes = [];
+                }
+                parent.nodes.push(node);
+            }
+        },
+        chars: function (text) {
+            //debug(text);
+            var node = {
+                node: 'text',
+                text: text,
+                textArray:transEmojiStr(text)
+            };
+            
+            if (bufArray.length === 0) {
+                node.index = index.toString()
+                index += 1
+                results.nodes.push(node);
+            } else {
+                var parent = bufArray[0];
+                if (parent.nodes === undefined) {
+                    parent.nodes = [];
+                }
+                node.index = parent.index + '.' + parent.nodes.length
+                parent.nodes.push(node);
+            }
+        },
+        comment: function (text) {
+            //debug(text);
+            // var node = {
+            //     node: 'comment',
+            //     text: text,
+            // };
+            // var parent = bufArray[0];
+            // if (parent.nodes === undefined) {
+            //     parent.nodes = [];
+            // }
+            // parent.nodes.push(node);
+        },
+    });
+    return results;
+};
+
+function transEmojiStr(str){
+  // var eReg = new RegExp("["+__reg+' '+"]");
+//   str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
+  
+  var emojiObjs = [];
+  //如果正则表达式为空
+  if(__emojisReg.length == 0 || !__emojis){
+      var emojiObj = {}
+      emojiObj.node = "text";
+      emojiObj.text = str;
+      array = [emojiObj];
+      return array;
+  }
+  //这个地方需要调整
+  str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
+  var eReg = new RegExp("[:]");
+  var array = str.split(eReg);
+  for(var i = 0; i < array.length; i++){
+    var ele = array[i];
+    var emojiObj = {};
+    if(__emojis[ele]){
+      emojiObj.node = "element";
+      emojiObj.tag = "emoji";
+      emojiObj.text = __emojis[ele];
+      emojiObj.baseSrc= __emojisBaseSrc;
+    }else{
+      emojiObj.node = "text";
+      emojiObj.text = ele;
+    }
+    emojiObjs.push(emojiObj);
+  }
+  
+  return emojiObjs;
+}
+
+function emojisInit(reg='',baseSrc="/aParse/emojis/",emojis){
+    __emojisReg = reg;
+    __emojisBaseSrc=baseSrc;
+    __emojis=emojis;
+}
+
+module.exports = {
+    html2json: html2json,
+    emojisInit:emojisInit
+};
+

+ 180 - 0
Component/aParse/htmlparser.js

@@ -0,0 +1,180 @@
+
+// Regular Expressions for parsing tags and attributes
+var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
+	endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
+	attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
+
+// Empty Elements - HTML 5
+var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
+
+// Block Elements - HTML 5
+var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
+
+// Inline Elements - HTML 5
+var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
+
+// Elements that you can, intentionally, leave open
+// (and which close themselves)
+var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
+
+// Attributes that have their values filled in disabled="disabled"
+var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
+
+// Special Elements (can contain anything)
+var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
+
+function HTMLParser(html, handler) {
+	var index, chars, match, stack = [], last = html;
+	stack.last = function () {
+		return this[this.length - 1];
+	};
+
+	while (html) {
+		chars = true;
+
+		// Make sure we're not in a script or style element
+		if (!stack.last() || !special[stack.last()]) {
+
+			// Comment
+			if (html.indexOf("<!--") == 0) {
+				index = html.indexOf("-->");
+
+				if (index >= 0) {
+					if (handler.comment)
+						handler.comment(html.substring(4, index));
+					html = html.substring(index + 3);
+					chars = false;
+				}
+
+				// end tag
+			} else if (html.indexOf("</") == 0) {
+				match = html.match(endTag);
+
+				if (match) {
+					html = html.substring(match[0].length);
+					match[0].replace(endTag, parseEndTag);
+					chars = false;
+				}
+
+				// start tag
+			} else if (html.indexOf("<") == 0) {
+				match = html.match(startTag);
+
+				if (match) {
+					html = html.substring(match[0].length);
+					match[0].replace(startTag, parseStartTag);
+					chars = false;
+				}
+			}
+
+			if (chars) {
+				index = html.indexOf("<");
+				var text = ''
+				while (index === 0) {
+                                  text += "<";
+                                  html = html.substring(1);
+                                  index = html.indexOf("<");
+				}
+				text += index < 0 ? html : html.substring(0, index);
+				html = index < 0 ? "" : html.substring(index);
+
+				if (handler.chars)
+					handler.chars(text);
+			}
+
+		} else {
+
+			html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
+				text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2");
+				if (handler.chars)
+					handler.chars(text);
+
+				return "";
+			});
+
+
+			parseEndTag("", stack.last());
+		}
+
+		if (html == last)
+			throw "Parse Error: " + html;
+		last = html;
+	}
+
+	// Clean up any remaining tags
+	parseEndTag();
+
+	function parseStartTag(tag, tagName, rest, unary) {
+		tagName = tagName.toLowerCase();
+
+		if (block[tagName]) {
+			while (stack.last() && inline[stack.last()]) {
+				parseEndTag("", stack.last());
+			}
+		}
+
+		if (closeSelf[tagName] && stack.last() == tagName) {
+			parseEndTag("", tagName);
+		}
+
+		unary = empty[tagName] || !!unary;
+
+		if (!unary)
+			stack.push(tagName);
+
+		if (handler.start) {
+			var attrs = [];
+
+			rest.replace(attr, function (match, name) {
+				var value = arguments[2] ? arguments[2] :
+					arguments[3] ? arguments[3] :
+						arguments[4] ? arguments[4] :
+							fillAttrs[name] ? name : "";
+
+				attrs.push({
+					name: name,
+					value: value,
+					escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
+				});
+			});
+
+			if (handler.start) {
+				handler.start(tagName, attrs, unary);
+			}
+
+		}
+	}
+
+	function parseEndTag(tag, tagName) {
+		// If no tag name is provided, clean shop
+		if (!tagName)
+			var pos = 0;
+
+		// Find the closest opened tag of the same type
+		else {
+			tagName = tagName.toLowerCase();
+			for (var pos = stack.length - 1; pos >= 0; pos--)
+				if (stack[pos] == tagName)
+					break;
+		}
+		if (pos >= 0) {
+			// Close all the open elements, up the stack
+			for (var i = stack.length - 1; i >= pos; i--)
+				if (handler.end)
+					handler.end(stack[i]);
+
+			// Remove the open elements from the stack
+			stack.length = pos;
+		}
+	}
+};
+
+
+function makeMap(str) {
+	var obj = {}, items = str.split(",");
+	for (var i = 0; i < items.length; i++)
+		obj[items[i]] = true;
+	return obj;
+}
+
+module.exports = HTMLParser;

+ 2518 - 0
Component/aParse/showdown.js

@@ -0,0 +1,2518 @@
+function getDefaultOpts(simple) {
+  'use strict';
+
+  var defaultOptions = {
+    omitExtraWLInCodeBlocks: {
+      defaultValue: false,
+      describe: 'Omit the default extra whiteline added to code blocks',
+      type: 'boolean'
+    },
+    noHeaderId: {
+      defaultValue: false,
+      describe: 'Turn on/off generated header id',
+      type: 'boolean'
+    },
+    prefixHeaderId: {
+      defaultValue: false,
+      describe: 'Specify a prefix to generated header ids',
+      type: 'string'
+    },
+    headerLevelStart: {
+      defaultValue: false,
+      describe: 'The header blocks level start',
+      type: 'integer'
+    },
+    parseImgDimensions: {
+      defaultValue: false,
+      describe: 'Turn on/off image dimension parsing',
+      type: 'boolean'
+    },
+    simplifiedAutoLink: {
+      defaultValue: false,
+      describe: 'Turn on/off GFM autolink style',
+      type: 'boolean'
+    },
+    literalMidWordUnderscores: {
+      defaultValue: false,
+      describe: 'Parse midword underscores as literal underscores',
+      type: 'boolean'
+    },
+    strikethrough: {
+      defaultValue: false,
+      describe: 'Turn on/off strikethrough support',
+      type: 'boolean'
+    },
+    tables: {
+      defaultValue: false,
+      describe: 'Turn on/off tables support',
+      type: 'boolean'
+    },
+    tablesHeaderId: {
+      defaultValue: false,
+      describe: 'Add an id to table headers',
+      type: 'boolean'
+    },
+    ghCodeBlocks: {
+      defaultValue: true,
+      describe: 'Turn on/off GFM fenced code blocks support',
+      type: 'boolean'
+    },
+    tasklists: {
+      defaultValue: false,
+      describe: 'Turn on/off GFM tasklist support',
+      type: 'boolean'
+    },
+    smoothLivePreview: {
+      defaultValue: false,
+      describe: 'Prevents weird effects in live previews due to incomplete input',
+      type: 'boolean'
+    },
+    smartIndentationFix: {
+      defaultValue: false,
+      description: 'Tries to smartly fix identation in es6 strings',
+      type: 'boolean'
+    }
+  };
+  if (simple === false) {
+    return JSON.parse(JSON.stringify(defaultOptions));
+  }
+  var ret = {};
+  for (var opt in defaultOptions) {
+    if (defaultOptions.hasOwnProperty(opt)) {
+      ret[opt] = defaultOptions[opt].defaultValue;
+    }
+  }
+  return ret;
+}
+
+/**
+ * Created by Tivie on 06-01-2015.
+ */
+
+// Private properties
+var showdown = {},
+    parsers = {},
+    extensions = {},
+    globalOptions = getDefaultOpts(true),
+    flavor = {
+      github: {
+        omitExtraWLInCodeBlocks:   true,
+        prefixHeaderId:            'user-content-',
+        simplifiedAutoLink:        true,
+        literalMidWordUnderscores: true,
+        strikethrough:             true,
+        tables:                    true,
+        tablesHeaderId:            true,
+        ghCodeBlocks:              true,
+        tasklists:                 true
+      },
+      vanilla: getDefaultOpts(true)
+    };
+
+/**
+ * helper namespace
+ * @type {{}}
+ */
+showdown.helper = {};
+
+/**
+ * TODO LEGACY SUPPORT CODE
+ * @type {{}}
+ */
+showdown.extensions = {};
+
+/**
+ * Set a global option
+ * @static
+ * @param {string} key
+ * @param {*} value
+ * @returns {showdown}
+ */
+showdown.setOption = function (key, value) {
+  'use strict';
+  globalOptions[key] = value;
+  return this;
+};
+
+/**
+ * Get a global option
+ * @static
+ * @param {string} key
+ * @returns {*}
+ */
+showdown.getOption = function (key) {
+  'use strict';
+  return globalOptions[key];
+};
+
+/**
+ * Get the global options
+ * @static
+ * @returns {{}}
+ */
+showdown.getOptions = function () {
+  'use strict';
+  return globalOptions;
+};
+
+/**
+ * Reset global options to the default values
+ * @static
+ */
+showdown.resetOptions = function () {
+  'use strict';
+  globalOptions = getDefaultOpts(true);
+};
+
+/**
+ * Set the flavor showdown should use as default
+ * @param {string} name
+ */
+showdown.setFlavor = function (name) {
+  'use strict';
+  if (flavor.hasOwnProperty(name)) {
+    var preset = flavor[name];
+    for (var option in preset) {
+      if (preset.hasOwnProperty(option)) {
+        globalOptions[option] = preset[option];
+      }
+    }
+  }
+};
+
+/**
+ * Get the default options
+ * @static
+ * @param {boolean} [simple=true]
+ * @returns {{}}
+ */
+showdown.getDefaultOptions = function (simple) {
+  'use strict';
+  return getDefaultOpts(simple);
+};
+
+/**
+ * Get or set a subParser
+ *
+ * subParser(name)       - Get a registered subParser
+ * subParser(name, func) - Register a subParser
+ * @static
+ * @param {string} name
+ * @param {function} [func]
+ * @returns {*}
+ */
+showdown.subParser = function (name, func) {
+  'use strict';
+  if (showdown.helper.isString(name)) {
+    if (typeof func !== 'undefined') {
+      parsers[name] = func;
+    } else {
+      if (parsers.hasOwnProperty(name)) {
+        return parsers[name];
+      } else {
+        throw Error('SubParser named ' + name + ' not registered!');
+      }
+    }
+  }
+};
+
+/**
+ * Gets or registers an extension
+ * @static
+ * @param {string} name
+ * @param {object|function=} ext
+ * @returns {*}
+ */
+showdown.extension = function (name, ext) {
+  'use strict';
+
+  if (!showdown.helper.isString(name)) {
+    throw Error('Extension \'name\' must be a string');
+  }
+
+  name = showdown.helper.stdExtName(name);
+
+  // Getter
+  if (showdown.helper.isUndefined(ext)) {
+    if (!extensions.hasOwnProperty(name)) {
+      throw Error('Extension named ' + name + ' is not registered!');
+    }
+    return extensions[name];
+
+    // Setter
+  } else {
+    // Expand extension if it's wrapped in a function
+    if (typeof ext === 'function') {
+      ext = ext();
+    }
+
+    // Ensure extension is an array
+    if (!showdown.helper.isArray(ext)) {
+      ext = [ext];
+    }
+
+    var validExtension = validate(ext, name);
+
+    if (validExtension.valid) {
+      extensions[name] = ext;
+    } else {
+      throw Error(validExtension.error);
+    }
+  }
+};
+
+/**
+ * Gets all extensions registered
+ * @returns {{}}
+ */
+showdown.getAllExtensions = function () {
+  'use strict';
+  return extensions;
+};
+
+/**
+ * Remove an extension
+ * @param {string} name
+ */
+showdown.removeExtension = function (name) {
+  'use strict';
+  delete extensions[name];
+};
+
+/**
+ * Removes all extensions
+ */
+showdown.resetExtensions = function () {
+  'use strict';
+  extensions = {};
+};
+
+/**
+ * Validate extension
+ * @param {array} extension
+ * @param {string} name
+ * @returns {{valid: boolean, error: string}}
+ */
+function validate(extension, name) {
+  'use strict';
+
+  var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
+    ret = {
+      valid: true,
+      error: ''
+    };
+
+  if (!showdown.helper.isArray(extension)) {
+    extension = [extension];
+  }
+
+  for (var i = 0; i < extension.length; ++i) {
+    var baseMsg = errMsg + ' sub-extension ' + i + ': ',
+        ext = extension[i];
+    if (typeof ext !== 'object') {
+      ret.valid = false;
+      ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
+      return ret;
+    }
+
+    if (!showdown.helper.isString(ext.type)) {
+      ret.valid = false;
+      ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
+      return ret;
+    }
+
+    var type = ext.type = ext.type.toLowerCase();
+
+    // normalize extension type
+    if (type === 'language') {
+      type = ext.type = 'lang';
+    }
+
+    if (type === 'html') {
+      type = ext.type = 'output';
+    }
+
+    if (type !== 'lang' && type !== 'output' && type !== 'listener') {
+      ret.valid = false;
+      ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
+      return ret;
+    }
+
+    if (type === 'listener') {
+      if (showdown.helper.isUndefined(ext.listeners)) {
+        ret.valid = false;
+        ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
+        return ret;
+      }
+    } else {
+      if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
+        ret.valid = false;
+        ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
+        return ret;
+      }
+    }
+
+    if (ext.listeners) {
+      if (typeof ext.listeners !== 'object') {
+        ret.valid = false;
+        ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
+        return ret;
+      }
+      for (var ln in ext.listeners) {
+        if (ext.listeners.hasOwnProperty(ln)) {
+          if (typeof ext.listeners[ln] !== 'function') {
+            ret.valid = false;
+            ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
+              ' must be a function but ' + typeof ext.listeners[ln] + ' given';
+            return ret;
+          }
+        }
+      }
+    }
+
+    if (ext.filter) {
+      if (typeof ext.filter !== 'function') {
+        ret.valid = false;
+        ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
+        return ret;
+      }
+    } else if (ext.regex) {
+      if (showdown.helper.isString(ext.regex)) {
+        ext.regex = new RegExp(ext.regex, 'g');
+      }
+      if (!ext.regex instanceof RegExp) {
+        ret.valid = false;
+        ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
+        return ret;
+      }
+      if (showdown.helper.isUndefined(ext.replace)) {
+        ret.valid = false;
+        ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
+        return ret;
+      }
+    }
+  }
+  return ret;
+}
+
+/**
+ * Validate extension
+ * @param {object} ext
+ * @returns {boolean}
+ */
+showdown.validateExtension = function (ext) {
+  'use strict';
+
+  var validateExtension = validate(ext, null);
+  if (!validateExtension.valid) {
+    console.warn(validateExtension.error);
+    return false;
+  }
+  return true;
+};
+
+/**
+ * showdownjs helper functions
+ */
+
+if (!showdown.hasOwnProperty('helper')) {
+  showdown.helper = {};
+}
+
+/**
+ * Check if var is string
+ * @static
+ * @param {string} a
+ * @returns {boolean}
+ */
+showdown.helper.isString = function isString(a) {
+  'use strict';
+  return (typeof a === 'string' || a instanceof String);
+};
+
+/**
+ * Check if var is a function
+ * @static
+ * @param {string} a
+ * @returns {boolean}
+ */
+showdown.helper.isFunction = function isFunction(a) {
+  'use strict';
+  var getType = {};
+  return a && getType.toString.call(a) === '[object Function]';
+};
+
+/**
+ * ForEach helper function
+ * @static
+ * @param {*} obj
+ * @param {function} callback
+ */
+showdown.helper.forEach = function forEach(obj, callback) {
+  'use strict';
+  if (typeof obj.forEach === 'function') {
+    obj.forEach(callback);
+  } else {
+    for (var i = 0; i < obj.length; i++) {
+      callback(obj[i], i, obj);
+    }
+  }
+};
+
+/**
+ * isArray helper function
+ * @static
+ * @param {*} a
+ * @returns {boolean}
+ */
+showdown.helper.isArray = function isArray(a) {
+  'use strict';
+  return a.constructor === Array;
+};
+
+/**
+ * Check if value is undefined
+ * @static
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
+ */
+showdown.helper.isUndefined = function isUndefined(value) {
+  'use strict';
+  return typeof value === 'undefined';
+};
+
+/**
+ * Standardidize extension name
+ * @static
+ * @param {string} s extension name
+ * @returns {string}
+ */
+showdown.helper.stdExtName = function (s) {
+  'use strict';
+  return s.replace(/[_-]||\s/g, '').toLowerCase();
+};
+
+function escapeCharactersCallback(wholeMatch, m1) {
+  'use strict';
+  var charCodeToEscape = m1.charCodeAt(0);
+  return '~E' + charCodeToEscape + 'E';
+}
+
+/**
+ * Callback used to escape characters when passing through String.replace
+ * @static
+ * @param {string} wholeMatch
+ * @param {string} m1
+ * @returns {string}
+ */
+showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
+
+/**
+ * Escape characters in a string
+ * @static
+ * @param {string} text
+ * @param {string} charsToEscape
+ * @param {boolean} afterBackslash
+ * @returns {XML|string|void|*}
+ */
+showdown.helper.escapeCharacters = function escapeCharacters(text, charsToEscape, afterBackslash) {
+  'use strict';
+  // First we have to escape the escape characters so that
+  // we can build a character class out of them
+  var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
+
+  if (afterBackslash) {
+    regexString = '\\\\' + regexString;
+  }
+
+  var regex = new RegExp(regexString, 'g');
+  text = text.replace(regex, escapeCharactersCallback);
+
+  return text;
+};
+
+var rgxFindMatchPos = function (str, left, right, flags) {
+  'use strict';
+  var f = flags || '',
+    g = f.indexOf('g') > -1,
+    x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
+    l = new RegExp(left, f.replace(/g/g, '')),
+    pos = [],
+    t, s, m, start, end;
+
+  do {
+    t = 0;
+    while ((m = x.exec(str))) {
+      if (l.test(m[0])) {
+        if (!(t++)) {
+          s = x.lastIndex;
+          start = s - m[0].length;
+        }
+      } else if (t) {
+        if (!--t) {
+          end = m.index + m[0].length;
+          var obj = {
+            left: {start: start, end: s},
+            match: {start: s, end: m.index},
+            right: {start: m.index, end: end},
+            wholeMatch: {start: start, end: end}
+          };
+          pos.push(obj);
+          if (!g) {
+            return pos;
+          }
+        }
+      }
+    }
+  } while (t && (x.lastIndex = s));
+
+  return pos;
+};
+
+/**
+ * matchRecursiveRegExp
+ *
+ * (c) 2007 Steven Levithan <stevenlevithan.com>
+ * MIT License
+ *
+ * Accepts a string to search, a left and right format delimiter
+ * as regex patterns, and optional regex flags. Returns an array
+ * of matches, allowing nested instances of left/right delimiters.
+ * Use the "g" flag to return all matches, otherwise only the
+ * first is returned. Be careful to ensure that the left and
+ * right format delimiters produce mutually exclusive matches.
+ * Backreferences are not supported within the right delimiter
+ * due to how it is internally combined with the left delimiter.
+ * When matching strings whose format delimiters are unbalanced
+ * to the left or right, the output is intentionally as a
+ * conventional regex library with recursion support would
+ * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
+ * "<" and ">" as the delimiters (both strings contain a single,
+ * balanced instance of "<x>").
+ *
+ * examples:
+ * matchRecursiveRegExp("test", "\\(", "\\)")
+ * returns: []
+ * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
+ * returns: ["t<<e>><s>", ""]
+ * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
+ * returns: ["test"]
+ */
+showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
+  'use strict';
+
+  var matchPos = rgxFindMatchPos (str, left, right, flags),
+    results = [];
+
+  for (var i = 0; i < matchPos.length; ++i) {
+    results.push([
+      str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
+      str.slice(matchPos[i].match.start, matchPos[i].match.end),
+      str.slice(matchPos[i].left.start, matchPos[i].left.end),
+      str.slice(matchPos[i].right.start, matchPos[i].right.end)
+    ]);
+  }
+  return results;
+};
+
+/**
+ *
+ * @param {string} str
+ * @param {string|function} replacement
+ * @param {string} left
+ * @param {string} right
+ * @param {string} flags
+ * @returns {string}
+ */
+showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
+  'use strict';
+
+  if (!showdown.helper.isFunction(replacement)) {
+    var repStr = replacement;
+    replacement = function () {
+      return repStr;
+    };
+  }
+
+  var matchPos = rgxFindMatchPos(str, left, right, flags),
+      finalStr = str,
+      lng = matchPos.length;
+
+  if (lng > 0) {
+    var bits = [];
+    if (matchPos[0].wholeMatch.start !== 0) {
+      bits.push(str.slice(0, matchPos[0].wholeMatch.start));
+    }
+    for (var i = 0; i < lng; ++i) {
+      bits.push(
+        replacement(
+          str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
+          str.slice(matchPos[i].match.start, matchPos[i].match.end),
+          str.slice(matchPos[i].left.start, matchPos[i].left.end),
+          str.slice(matchPos[i].right.start, matchPos[i].right.end)
+        )
+      );
+      if (i < lng - 1) {
+        bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
+      }
+    }
+    if (matchPos[lng - 1].wholeMatch.end < str.length) {
+      bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
+    }
+    finalStr = bits.join('');
+  }
+  return finalStr;
+};
+
+/**
+ * POLYFILLS
+ */
+if (showdown.helper.isUndefined(console)) {
+  console = {
+    warn: function (msg) {
+      'use strict';
+      alert(msg);
+    },
+    log: function (msg) {
+      'use strict';
+      alert(msg);
+    },
+    error: function (msg) {
+      'use strict';
+      throw msg;
+    }
+  };
+}
+
+/**
+ * Created by Estevao on 31-05-2015.
+ */
+
+/**
+ * Showdown Converter class
+ * @class
+ * @param {object} [converterOptions]
+ * @returns {Converter}
+ */
+showdown.Converter = function (converterOptions) {
+  'use strict';
+
+  var
+      /**
+       * Options used by this converter
+       * @private
+       * @type {{}}
+       */
+      options = {},
+
+      /**
+       * Language extensions used by this converter
+       * @private
+       * @type {Array}
+       */
+      langExtensions = [],
+
+      /**
+       * Output modifiers extensions used by this converter
+       * @private
+       * @type {Array}
+       */
+      outputModifiers = [],
+
+      /**
+       * Event listeners
+       * @private
+       * @type {{}}
+       */
+      listeners = {};
+
+  _constructor();
+
+  /**
+   * Converter constructor
+   * @private
+   */
+  function _constructor() {
+    converterOptions = converterOptions || {};
+
+    for (var gOpt in globalOptions) {
+      if (globalOptions.hasOwnProperty(gOpt)) {
+        options[gOpt] = globalOptions[gOpt];
+      }
+    }
+
+    // Merge options
+    if (typeof converterOptions === 'object') {
+      for (var opt in converterOptions) {
+        if (converterOptions.hasOwnProperty(opt)) {
+          options[opt] = converterOptions[opt];
+        }
+      }
+    } else {
+      throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
+      ' was passed instead.');
+    }
+
+    if (options.extensions) {
+      showdown.helper.forEach(options.extensions, _parseExtension);
+    }
+  }
+
+  /**
+   * Parse extension
+   * @param {*} ext
+   * @param {string} [name='']
+   * @private
+   */
+  function _parseExtension(ext, name) {
+
+    name = name || null;
+    // If it's a string, the extension was previously loaded
+    if (showdown.helper.isString(ext)) {
+      ext = showdown.helper.stdExtName(ext);
+      name = ext;
+
+      // LEGACY_SUPPORT CODE
+      if (showdown.extensions[ext]) {
+        console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
+          'Please inform the developer that the extension should be updated!');
+        legacyExtensionLoading(showdown.extensions[ext], ext);
+        return;
+      // END LEGACY SUPPORT CODE
+
+      } else if (!showdown.helper.isUndefined(extensions[ext])) {
+        ext = extensions[ext];
+
+      } else {
+        throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
+      }
+    }
+
+    if (typeof ext === 'function') {
+      ext = ext();
+    }
+
+    if (!showdown.helper.isArray(ext)) {
+      ext = [ext];
+    }
+
+    var validExt = validate(ext, name);
+    if (!validExt.valid) {
+      throw Error(validExt.error);
+    }
+
+    for (var i = 0; i < ext.length; ++i) {
+      switch (ext[i].type) {
+
+        case 'lang':
+          langExtensions.push(ext[i]);
+          break;
+
+        case 'output':
+          outputModifiers.push(ext[i]);
+          break;
+      }
+      if (ext[i].hasOwnProperty(listeners)) {
+        for (var ln in ext[i].listeners) {
+          if (ext[i].listeners.hasOwnProperty(ln)) {
+            listen(ln, ext[i].listeners[ln]);
+          }
+        }
+      }
+    }
+
+  }
+
+  /**
+   * LEGACY_SUPPORT
+   * @param {*} ext
+   * @param {string} name
+   */
+  function legacyExtensionLoading(ext, name) {
+    if (typeof ext === 'function') {
+      ext = ext(new showdown.Converter());
+    }
+    if (!showdown.helper.isArray(ext)) {
+      ext = [ext];
+    }
+    var valid = validate(ext, name);
+
+    if (!valid.valid) {
+      throw Error(valid.error);
+    }
+
+    for (var i = 0; i < ext.length; ++i) {
+      switch (ext[i].type) {
+        case 'lang':
+          langExtensions.push(ext[i]);
+          break;
+        case 'output':
+          outputModifiers.push(ext[i]);
+          break;
+        default:// should never reach here
+          throw Error('Extension loader error: Type unrecognized!!!');
+      }
+    }
+  }
+
+  /**
+   * Listen to an event
+   * @param {string} name
+   * @param {function} callback
+   */
+  function listen(name, callback) {
+    if (!showdown.helper.isString(name)) {
+      throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
+    }
+
+    if (typeof callback !== 'function') {
+      throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
+    }
+
+    if (!listeners.hasOwnProperty(name)) {
+      listeners[name] = [];
+    }
+    listeners[name].push(callback);
+  }
+
+  function rTrimInputText(text) {
+    var rsp = text.match(/^\s*/)[0].length,
+        rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
+    return text.replace(rgx, '');
+  }
+
+  /**
+   * Dispatch an event
+   * @private
+   * @param {string} evtName Event name
+   * @param {string} text Text
+   * @param {{}} options Converter Options
+   * @param {{}} globals
+   * @returns {string}
+   */
+  this._dispatch = function dispatch (evtName, text, options, globals) {
+    if (listeners.hasOwnProperty(evtName)) {
+      for (var ei = 0; ei < listeners[evtName].length; ++ei) {
+        var nText = listeners[evtName][ei](evtName, text, this, options, globals);
+        if (nText && typeof nText !== 'undefined') {
+          text = nText;
+        }
+      }
+    }
+    return text;
+  };
+
+  /**
+   * Listen to an event
+   * @param {string} name
+   * @param {function} callback
+   * @returns {showdown.Converter}
+   */
+  this.listen = function (name, callback) {
+    listen(name, callback);
+    return this;
+  };
+
+  /**
+   * Converts a markdown string into HTML
+   * @param {string} text
+   * @returns {*}
+   */
+  this.makeHtml = function (text) {
+    //check if text is not falsy
+    if (!text) {
+      return text;
+    }
+
+    var globals = {
+      gHtmlBlocks:     [],
+      gHtmlMdBlocks:   [],
+      gHtmlSpans:      [],
+      gUrls:           {},
+      gTitles:         {},
+      gDimensions:     {},
+      gListLevel:      0,
+      hashLinkCounts:  {},
+      langExtensions:  langExtensions,
+      outputModifiers: outputModifiers,
+      converter:       this,
+      ghCodeBlocks:    []
+    };
+
+    // attacklab: Replace ~ with ~T
+    // This lets us use tilde as an escape char to avoid md5 hashes
+    // The choice of character is arbitrary; anything that isn't
+    // magic in Markdown will work.
+    text = text.replace(/~/g, '~T');
+
+    // attacklab: Replace $ with ~D
+    // RegExp interprets $ as a special character
+    // when it's in a replacement string
+    text = text.replace(/\$/g, '~D');
+
+    // Standardize line endings
+    text = text.replace(/\r\n/g, '\n'); // DOS to Unix
+    text = text.replace(/\r/g, '\n'); // Mac to Unix
+
+    if (options.smartIndentationFix) {
+      text = rTrimInputText(text);
+    }
+
+    // Make sure text begins and ends with a couple of newlines:
+    //text = '\n\n' + text + '\n\n';
+    text = text;
+    // detab
+    text = showdown.subParser('detab')(text, options, globals);
+
+    // stripBlankLines
+    text = showdown.subParser('stripBlankLines')(text, options, globals);
+
+    //run languageExtensions
+    showdown.helper.forEach(langExtensions, function (ext) {
+      text = showdown.subParser('runExtension')(ext, text, options, globals);
+    });
+
+    // run the sub parsers
+    text = showdown.subParser('hashPreCodeTags')(text, options, globals);
+    text = showdown.subParser('githubCodeBlocks')(text, options, globals);
+    text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
+    text = showdown.subParser('hashHTMLSpans')(text, options, globals);
+    text = showdown.subParser('stripLinkDefinitions')(text, options, globals);
+    text = showdown.subParser('blockGamut')(text, options, globals);
+    text = showdown.subParser('unhashHTMLSpans')(text, options, globals);
+    text = showdown.subParser('unescapeSpecialChars')(text, options, globals);
+
+    // attacklab: Restore dollar signs
+    text = text.replace(/~D/g, '$$');
+
+    // attacklab: Restore tildes
+    text = text.replace(/~T/g, '~');
+
+    // Run output modifiers
+    showdown.helper.forEach(outputModifiers, function (ext) {
+      text = showdown.subParser('runExtension')(ext, text, options, globals);
+    });
+    return text;
+  };
+
+  /**
+   * Set an option of this Converter instance
+   * @param {string} key
+   * @param {*} value
+   */
+  this.setOption = function (key, value) {
+    options[key] = value;
+  };
+
+  /**
+   * Get the option of this Converter instance
+   * @param {string} key
+   * @returns {*}
+   */
+  this.getOption = function (key) {
+    return options[key];
+  };
+
+  /**
+   * Get the options of this Converter instance
+   * @returns {{}}
+   */
+  this.getOptions = function () {
+    return options;
+  };
+
+  /**
+   * Add extension to THIS converter
+   * @param {{}} extension
+   * @param {string} [name=null]
+   */
+  this.addExtension = function (extension, name) {
+    name = name || null;
+    _parseExtension(extension, name);
+  };
+
+  /**
+   * Use a global registered extension with THIS converter
+   * @param {string} extensionName Name of the previously registered extension
+   */
+  this.useExtension = function (extensionName) {
+    _parseExtension(extensionName);
+  };
+
+  /**
+   * Set the flavor THIS converter should use
+   * @param {string} name
+   */
+  this.setFlavor = function (name) {
+    if (flavor.hasOwnProperty(name)) {
+      var preset = flavor[name];
+      for (var option in preset) {
+        if (preset.hasOwnProperty(option)) {
+          options[option] = preset[option];
+        }
+      }
+    }
+  };
+
+  /**
+   * Remove an extension from THIS converter.
+   * Note: This is a costly operation. It's better to initialize a new converter
+   * and specify the extensions you wish to use
+   * @param {Array} extension
+   */
+  this.removeExtension = function (extension) {
+    if (!showdown.helper.isArray(extension)) {
+      extension = [extension];
+    }
+    for (var a = 0; a < extension.length; ++a) {
+      var ext = extension[a];
+      for (var i = 0; i < langExtensions.length; ++i) {
+        if (langExtensions[i] === ext) {
+          langExtensions[i].splice(i, 1);
+        }
+      }
+      for (var ii = 0; ii < outputModifiers.length; ++i) {
+        if (outputModifiers[ii] === ext) {
+          outputModifiers[ii].splice(i, 1);
+        }
+      }
+    }
+  };
+
+  /**
+   * Get all extension of THIS converter
+   * @returns {{language: Array, output: Array}}
+   */
+  this.getAllExtensions = function () {
+    return {
+      language: langExtensions,
+      output: outputModifiers
+    };
+  };
+};
+
+/**
+ * Turn Markdown link shortcuts into XHTML <a> tags.
+ */
+showdown.subParser('anchors', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('anchors.before', text, options, globals);
+
+  var writeAnchorTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
+    if (showdown.helper.isUndefined(m7)) {
+      m7 = '';
+    }
+    wholeMatch = m1;
+    var linkText = m2,
+        linkId = m3.toLowerCase(),
+        url = m4,
+        title = m7;
+
+    if (!url) {
+      if (!linkId) {
+        // lower-case and turn embedded newlines into spaces
+        linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
+      }
+      url = '#' + linkId;
+
+      if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
+        url = globals.gUrls[linkId];
+        if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
+          title = globals.gTitles[linkId];
+        }
+      } else {
+        if (wholeMatch.search(/\(\s*\)$/m) > -1) {
+          // Special case for explicit empty url
+          url = '';
+        } else {
+          return wholeMatch;
+        }
+      }
+    }
+
+    url = showdown.helper.escapeCharacters(url, '*_', false);
+    var result = '<a href="' + url + '"';
+
+    if (title !== '' && title !== null) {
+      title = title.replace(/"/g, '&quot;');
+      title = showdown.helper.escapeCharacters(title, '*_', false);
+      result += ' title="' + title + '"';
+    }
+
+    result += '>' + linkText + '</a>';
+
+    return result;
+  };
+
+  // First, handle reference-style links: [link text] [id]
+  /*
+   text = text.replace(/
+   (							// wrap whole match in $1
+   \[
+   (
+   (?:
+   \[[^\]]*\]		// allow brackets nested one level
+   |
+   [^\[]			// or anything else
+   )*
+   )
+   \]
+
+   [ ]?					// one optional space
+   (?:\n[ ]*)?				// one optional newline followed by spaces
+
+   \[
+   (.*?)					// id = $3
+   \]
+   )()()()()					// pad remaining backreferences
+   /g,_DoAnchors_callback);
+   */
+  text = text.replace(/(\[((?:\[[^\]]*]|[^\[\]])*)][ ]?(?:\n[ ]*)?\[(.*?)])()()()()/g, writeAnchorTag);
+
+  //
+  // Next, inline-style links: [link text](url "optional title")
+  //
+
+  /*
+   text = text.replace(/
+   (						// wrap whole match in $1
+   \[
+   (
+   (?:
+   \[[^\]]*\]	// allow brackets nested one level
+   |
+   [^\[\]]			// or anything else
+   )
+   )
+   \]
+   \(						// literal paren
+   [ \t]*
+   ()						// no id, so leave $3 empty
+   <?(.*?)>?				// href = $4
+   [ \t]*
+   (						// $5
+   (['"])				// quote char = $6
+   (.*?)				// Title = $7
+   \6					// matching quote
+   [ \t]*				// ignore any spaces/tabs between closing quote and )
+   )?						// title is optional
+   \)
+   )
+   /g,writeAnchorTag);
+   */
+  text = text.replace(/(\[((?:\[[^\]]*]|[^\[\]])*)]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,
+                      writeAnchorTag);
+
+  //
+  // Last, handle reference-style shortcuts: [link text]
+  // These must come last in case you've also got [link test][1]
+  // or [link test](/foo)
+  //
+
+  /*
+   text = text.replace(/
+   (                // wrap whole match in $1
+   \[
+   ([^\[\]]+)       // link text = $2; can't contain '[' or ']'
+   \]
+   )()()()()()      // pad rest of backreferences
+   /g, writeAnchorTag);
+   */
+  text = text.replace(/(\[([^\[\]]+)])()()()()()/g, writeAnchorTag);
+
+  text = globals.converter._dispatch('anchors.after', text, options, globals);
+  return text;
+});
+
+showdown.subParser('autoLinks', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('autoLinks.before', text, options, globals);
+
+  var simpleURLRegex  = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)(?=\s|$)(?!["<>])/gi,
+      delimUrlRegex   = /<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)>/gi,
+      simpleMailRegex = /(?:^|[ \n\t])([A-Za-z0-9!#$%&'*+-/=?^_`\{|}~\.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?:$|[ \n\t])/gi,
+      delimMailRegex  = /<(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi;
+
+  text = text.replace(delimUrlRegex, replaceLink);
+  text = text.replace(delimMailRegex, replaceMail);
+  // simpleURLRegex  = /\b(((https?|ftp|dict):\/\/|www\.)[-.+~:?#@!$&'()*,;=[\]\w]+)\b/gi,
+  // Email addresses: <address@domain.foo>
+
+  if (options.simplifiedAutoLink) {
+    text = text.replace(simpleURLRegex, replaceLink);
+    text = text.replace(simpleMailRegex, replaceMail);
+  }
+
+  function replaceLink(wm, link) {
+    var lnkTxt = link;
+    if (/^www\./i.test(link)) {
+      link = link.replace(/^www\./i, 'http://www.');
+    }
+    return '<a href="' + link + '">' + lnkTxt + '</a>';
+  }
+
+  function replaceMail(wholeMatch, m1) {
+    var unescapedStr = showdown.subParser('unescapeSpecialChars')(m1);
+    return showdown.subParser('encodeEmailAddress')(unescapedStr);
+  }
+
+  text = globals.converter._dispatch('autoLinks.after', text, options, globals);
+
+  return text;
+});
+
+/**
+ * These are all the transformations that form block-level
+ * tags like paragraphs, headers, and list items.
+ */
+showdown.subParser('blockGamut', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('blockGamut.before', text, options, globals);
+
+  // we parse blockquotes first so that we can have headings and hrs
+  // inside blockquotes
+  text = showdown.subParser('blockQuotes')(text, options, globals);
+  text = showdown.subParser('headers')(text, options, globals);
+
+  // Do Horizontal Rules:
+  var key = showdown.subParser('hashBlock')('<hr />', options, globals);
+  text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, key);
+  text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, key);
+
+  text = showdown.subParser('lists')(text, options, globals);
+  text = showdown.subParser('codeBlocks')(text, options, globals);
+  text = showdown.subParser('tables')(text, options, globals);
+
+  // We already ran _HashHTMLBlocks() before, in Markdown(), but that
+  // was to escape raw HTML in the original Markdown source. This time,
+  // we're escaping the markup we've just created, so that we don't wrap
+  // <p> tags around block-level tags.
+  text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
+  text = showdown.subParser('paragraphs')(text, options, globals);
+
+  text = globals.converter._dispatch('blockGamut.after', text, options, globals);
+
+  return text;
+});
+
+showdown.subParser('blockQuotes', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
+  /*
+   text = text.replace(/
+   (								// Wrap whole match in $1
+   (
+   ^[ \t]*>[ \t]?			// '>' at the start of a line
+   .+\n					// rest of the first line
+   (.+\n)*					// subsequent consecutive lines
+   \n*						// blanks
+   )+
+   )
+   /gm, function(){...});
+   */
+
+  text = text.replace(/((^[ \t]{0,3}>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) {
+    var bq = m1;
+
+    // attacklab: hack around Konqueror 3.5.4 bug:
+    // "----------bug".replace(/^-/g,"") == "bug"
+    bq = bq.replace(/^[ \t]*>[ \t]?/gm, '~0'); // trim one level of quoting
+
+    // attacklab: clean up hack
+    bq = bq.replace(/~0/g, '');
+
+    bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
+    bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
+    bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
+
+    bq = bq.replace(/(^|\n)/g, '$1  ');
+    // These leading spaces screw with <pre> content, so we need to fix that:
+    bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
+      var pre = m1;
+      // attacklab: hack around Konqueror 3.5.4 bug:
+      pre = pre.replace(/^  /mg, '~0');
+      pre = pre.replace(/~0/g, '');
+      return pre;
+    });
+
+    return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
+  });
+
+  text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
+  return text;
+});
+
+/**
+ * Process Markdown `<pre><code>` blocks.
+ */
+showdown.subParser('codeBlocks', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
+  /*
+   text = text.replace(text,
+   /(?:\n\n|^)
+   (								// $1 = the code block -- one or more lines, starting with a space/tab
+   (?:
+   (?:[ ]{4}|\t)			// Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
+   .*\n+
+   )+
+   )
+   (\n*[ ]{0,3}[^ \t\n]|(?=~0))	// attacklab: g_tab_width
+   /g,function(){...});
+   */
+
+  // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
+  text += '~0';
+
+  var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g;
+  text = text.replace(pattern, function (wholeMatch, m1, m2) {
+    var codeblock = m1,
+        nextChar = m2,
+        end = '\n';
+
+    codeblock = showdown.subParser('outdent')(codeblock);
+    codeblock = showdown.subParser('encodeCode')(codeblock);
+    codeblock = showdown.subParser('detab')(codeblock);
+    codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
+    codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
+
+    if (options.omitExtraWLInCodeBlocks) {
+      end = '';
+    }
+
+    codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
+
+    return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
+  });
+
+  // attacklab: strip sentinel
+  text = text.replace(/~0/, '');
+
+  text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
+  return text;
+});
+
+/**
+ *
+ *   *  Backtick quotes are used for <code></code> spans.
+ *
+ *   *  You can use multiple backticks as the delimiters if you want to
+ *     include literal backticks in the code span. So, this input:
+ *
+ *         Just type ``foo `bar` baz`` at the prompt.
+ *
+ *       Will translate to:
+ *
+ *         <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
+ *
+ *    There's no arbitrary limit to the number of backticks you
+ *    can use as delimters. If you need three consecutive backticks
+ *    in your code, use four for delimiters, etc.
+ *
+ *  *  You can use spaces to get literal backticks at the edges:
+ *
+ *         ... type `` `bar` `` ...
+ *
+ *       Turns to:
+ *
+ *         ... type <code>`bar`</code> ...
+ */
+showdown.subParser('codeSpans', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('codeSpans.before', text, options, globals);
+
+  /*
+   text = text.replace(/
+   (^|[^\\])					// Character before opening ` can't be a backslash
+   (`+)						// $2 = Opening run of `
+   (							// $3 = The code block
+   [^\r]*?
+   [^`]					// attacklab: work around lack of lookbehind
+   )
+   \2							// Matching closer
+   (?!`)
+   /gm, function(){...});
+   */
+
+  if (typeof(text) === 'undefined') {
+    text = '';
+  }
+  text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
+    function (wholeMatch, m1, m2, m3) {
+      var c = m3;
+      c = c.replace(/^([ \t]*)/g, '');	// leading whitespace
+      c = c.replace(/[ \t]*$/g, '');	// trailing whitespace
+      c = showdown.subParser('encodeCode')(c);
+      return m1 + '<code>' + c + '</code>';
+    }
+  );
+
+  text = globals.converter._dispatch('codeSpans.after', text, options, globals);
+  return text;
+});
+
+/**
+ * Convert all tabs to spaces
+ */
+showdown.subParser('detab', function (text) {
+  'use strict';
+
+  // expand first n-1 tabs
+  text = text.replace(/\t(?=\t)/g, '    '); // g_tab_width
+
+  // replace the nth with two sentinels
+  text = text.replace(/\t/g, '~A~B');
+
+  // use the sentinel to anchor our regex so it doesn't explode
+  text = text.replace(/~B(.+?)~A/g, function (wholeMatch, m1) {
+    var leadingText = m1,
+        numSpaces = 4 - leadingText.length % 4;  // g_tab_width
+
+    // there *must* be a better way to do this:
+    for (var i = 0; i < numSpaces; i++) {
+      leadingText += ' ';
+    }
+
+    return leadingText;
+  });
+
+  // clean up sentinels
+  text = text.replace(/~A/g, '    ');  // g_tab_width
+  text = text.replace(/~B/g, '');
+
+  return text;
+
+});
+
+/**
+ * Smart processing for ampersands and angle brackets that need to be encoded.
+ */
+showdown.subParser('encodeAmpsAndAngles', function (text) {
+  'use strict';
+  // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
+  // http://bumppo.net/projects/amputator/
+  text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&amp;');
+
+  // Encode naked <'s
+  text = text.replace(/<(?![a-z\/?\$!])/gi, '&lt;');
+
+  return text;
+});
+
+/**
+ * Returns the string, with after processing the following backslash escape sequences.
+ *
+ * attacklab: The polite way to do this is with the new escapeCharacters() function:
+ *
+ *    text = escapeCharacters(text,"\\",true);
+ *    text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
+ *
+ * ...but we're sidestepping its use of the (slow) RegExp constructor
+ * as an optimization for Firefox.  This function gets called a LOT.
+ */
+showdown.subParser('encodeBackslashEscapes', function (text) {
+  'use strict';
+  text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
+  text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, showdown.helper.escapeCharactersCallback);
+  return text;
+});
+
+/**
+ * Encode/escape certain characters inside Markdown code runs.
+ * The point is that in code, these characters are literals,
+ * and lose their special Markdown meanings.
+ */
+showdown.subParser('encodeCode', function (text) {
+  'use strict';
+
+  // Encode all ampersands; HTML entities are not
+  // entities within a Markdown code span.
+  text = text.replace(/&/g, '&amp;');
+
+  // Do the angle bracket song and dance:
+  text = text.replace(/</g, '&lt;');
+  text = text.replace(/>/g, '&gt;');
+
+  // Now, escape characters that are magic in Markdown:
+  text = showdown.helper.escapeCharacters(text, '*_{}[]\\', false);
+
+  // jj the line above breaks this:
+  //---
+  //* Item
+  //   1. Subitem
+  //            special char: *
+  // ---
+
+  return text;
+});
+
+/**
+ *  Input: an email address, e.g. "foo@example.com"
+ *
+ *  Output: the email address as a mailto link, with each character
+ *    of the address encoded as either a decimal or hex entity, in
+ *    the hopes of foiling most address harvesting spam bots. E.g.:
+ *
+ *    <a href="&#x6D;&#97;&#105;&#108;&#x74;&#111;:&#102;&#111;&#111;&#64;&#101;
+ *       x&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;&#111;&#109;">&#102;&#111;&#111;
+ *       &#64;&#101;x&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;&#111;&#109;</a>
+ *
+ *  Based on a filter by Matthew Wickline, posted to the BBEdit-Talk
+ *  mailing list: <http://tinyurl.com/yu7ue>
+ *
+ */
+showdown.subParser('encodeEmailAddress', function (addr) {
+  'use strict';
+
+  var encode = [
+    function (ch) {
+      return '&#' + ch.charCodeAt(0) + ';';
+    },
+    function (ch) {
+      return '&#x' + ch.charCodeAt(0).toString(16) + ';';
+    },
+    function (ch) {
+      return ch;
+    }
+  ];
+
+  addr = 'mailto:' + addr;
+
+  addr = addr.replace(/./g, function (ch) {
+    if (ch === '@') {
+      // this *must* be encoded. I insist.
+      ch = encode[Math.floor(Math.random() * 2)](ch);
+    } else if (ch !== ':') {
+      // leave ':' alone (to spot mailto: later)
+      var r = Math.random();
+      // roughly 10% raw, 45% hex, 45% dec
+      ch = (
+        r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
+      );
+    }
+    return ch;
+  });
+
+  addr = '<a href="' + addr + '">' + addr + '</a>';
+  addr = addr.replace(/">.+:/g, '">'); // strip the mailto: from the visible part
+
+  return addr;
+});
+
+/**
+ * Within tags -- meaning between < and > -- encode [\ ` * _] so they
+ * don't conflict with their use in Markdown for code, italics and strong.
+ */
+showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text) {
+  'use strict';
+
+  // Build a regex to find HTML tags and comments.  See Friedl's
+  // "Mastering Regular Expressions", 2nd Ed., pp. 200-201.
+  var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;
+
+  text = text.replace(regex, function (wholeMatch) {
+    var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, '$1`');
+    tag = showdown.helper.escapeCharacters(tag, '\\`*_', false);
+    return tag;
+  });
+
+  return text;
+});
+
+/**
+ * Handle github codeblocks prior to running HashHTML so that
+ * HTML contained within the codeblock gets escaped properly
+ * Example:
+ * ```ruby
+ *     def hello_world(x)
+ *       puts "Hello, #{x}"
+ *     end
+ * ```
+ */
+showdown.subParser('githubCodeBlocks', function (text, options, globals) {
+  'use strict';
+
+  // early exit if option is not enabled
+  if (!options.ghCodeBlocks) {
+    return text;
+  }
+
+  text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
+
+  text += '~0';
+
+  text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, language, codeblock) {
+    var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
+
+    // First parse the github code block
+    codeblock = showdown.subParser('encodeCode')(codeblock);
+    codeblock = showdown.subParser('detab')(codeblock);
+    codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
+    codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
+
+    codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
+
+    codeblock = showdown.subParser('hashBlock')(codeblock, options, globals);
+
+    // Since GHCodeblocks can be false positives, we need to
+    // store the primitive text and the parsed text in a global var,
+    // and then return a token
+    return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
+  });
+
+  // attacklab: strip sentinel
+  text = text.replace(/~0/, '');
+
+  return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
+});
+
+showdown.subParser('hashBlock', function (text, options, globals) {
+  'use strict';
+  text = text.replace(/(^\n+|\n+$)/g, '');
+  return '\n\n~K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
+});
+
+showdown.subParser('hashElement', function (text, options, globals) {
+  'use strict';
+
+  return function (wholeMatch, m1) {
+    var blockText = m1;
+
+    // Undo double lines
+    blockText = blockText.replace(/\n\n/g, '\n');
+    blockText = blockText.replace(/^\n/, '');
+
+    // strip trailing blank lines
+    blockText = blockText.replace(/\n+$/g, '');
+
+    // Replace the element text with a marker ("~KxK" where x is its key)
+    blockText = '\n\n~K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
+
+    return blockText;
+  };
+});
+
+showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
+  'use strict';
+
+  var blockTags = [
+      'pre',
+      'div',
+      'h1',
+      'h2',
+      'h3',
+      'h4',
+      'h5',
+      'h6',
+      'blockquote',
+      'table',
+      'dl',
+      'ol',
+      'ul',
+      'script',
+      'noscript',
+      'form',
+      'fieldset',
+      'iframe',
+      'math',
+      'style',
+      'section',
+      'header',
+      'footer',
+      'nav',
+      'article',
+      'aside',
+      'address',
+      'audio',
+      'canvas',
+      'figure',
+      'hgroup',
+      'output',
+      'video',
+      'p'
+    ],
+    repFunc = function (wholeMatch, match, left, right) {
+      var txt = wholeMatch;
+      // check if this html element is marked as markdown
+      // if so, it's contents should be parsed as markdown
+      if (left.search(/\bmarkdown\b/) !== -1) {
+        txt = left + globals.converter.makeHtml(match) + right;
+      }
+      return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
+    };
+
+  for (var i = 0; i < blockTags.length; ++i) {
+    text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^(?: |\\t){0,3}<' + blockTags[i] + '\\b[^>]*>', '</' + blockTags[i] + '>', 'gim');
+  }
+
+  // HR SPECIAL CASE
+  text = text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
+    showdown.subParser('hashElement')(text, options, globals));
+
+  // Special case for standalone HTML comments:
+  text = text.replace(/(<!--[\s\S]*?-->)/g,
+    showdown.subParser('hashElement')(text, options, globals));
+
+  // PHP and ASP-style processor instructions (<?...?> and <%...%>)
+  text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
+    showdown.subParser('hashElement')(text, options, globals));
+  return text;
+});
+
+/**
+ * Hash span elements that should not be parsed as markdown
+ */
+showdown.subParser('hashHTMLSpans', function (text, config, globals) {
+  'use strict';
+
+  var matches = showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');
+
+  for (var i = 0; i < matches.length; ++i) {
+    text = text.replace(matches[i][0], '~L' + (globals.gHtmlSpans.push(matches[i][0]) - 1) + 'L');
+  }
+  return text;
+});
+
+/**
+ * Unhash HTML spans
+ */
+showdown.subParser('unhashHTMLSpans', function (text, config, globals) {
+  'use strict';
+
+  for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
+    text = text.replace('~L' + i + 'L', globals.gHtmlSpans[i]);
+  }
+
+  return text;
+});
+
+/**
+ * Hash span elements that should not be parsed as markdown
+ */
+showdown.subParser('hashPreCodeTags', function (text, config, globals) {
+  'use strict';
+
+  var repFunc = function (wholeMatch, match, left, right) {
+    // encode html entities
+    var codeblock = left + showdown.subParser('encodeCode')(match) + right;
+    return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
+  };
+
+  text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^(?: |\\t){0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^(?: |\\t){0,3}</code>\\s*</pre>', 'gim');
+  return text;
+});
+
+showdown.subParser('headers', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('headers.before', text, options, globals);
+
+  var prefixHeader = options.prefixHeaderId,
+      headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
+
+  // Set text-style headers:
+  //	Header 1
+  //	========
+  //
+  //	Header 2
+  //	--------
+  //
+      setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
+      setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
+
+  text = text.replace(setextRegexH1, function (wholeMatch, m1) {
+
+    var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
+        hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
+        hLevel = headerLevelStart,
+        hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
+    return showdown.subParser('hashBlock')(hashBlock, options, globals);
+  });
+
+  text = text.replace(setextRegexH2, function (matchFound, m1) {
+    var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
+        hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
+        hLevel = headerLevelStart + 1,
+      hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
+    return showdown.subParser('hashBlock')(hashBlock, options, globals);
+  });
+
+  // atx-style headers:
+  //  # Header 1
+  //  ## Header 2
+  //  ## Header 2 with closing hashes ##
+  //  ...
+  //  ###### Header 6
+  //
+  text = text.replace(/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm, function (wholeMatch, m1, m2) {
+    var span = showdown.subParser('spanGamut')(m2, options, globals),
+        hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
+        hLevel = headerLevelStart - 1 + m1.length,
+        header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
+
+    return showdown.subParser('hashBlock')(header, options, globals);
+  });
+
+  function headerId(m) {
+    var title, escapedId = m.replace(/[^\w]/g, '').toLowerCase();
+
+    if (globals.hashLinkCounts[escapedId]) {
+      title = escapedId + '-' + (globals.hashLinkCounts[escapedId]++);
+    } else {
+      title = escapedId;
+      globals.hashLinkCounts[escapedId] = 1;
+    }
+
+    // Prefix id to prevent causing inadvertent pre-existing style matches.
+    if (prefixHeader === true) {
+      prefixHeader = 'section';
+    }
+
+    if (showdown.helper.isString(prefixHeader)) {
+      return prefixHeader + title;
+    }
+    return title;
+  }
+
+  text = globals.converter._dispatch('headers.after', text, options, globals);
+  return text;
+});
+
+/**
+ * Turn Markdown image shortcuts into <img> tags.
+ */
+showdown.subParser('images', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('images.before', text, options, globals);
+
+  var inlineRegExp    = /!\[(.*?)]\s?\([ \t]*()<?(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(['"])(.*?)\6[ \t]*)?\)/g,
+      referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[(.*?)]()()()()()/g;
+
+  function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
+
+    var gUrls   = globals.gUrls,
+        gTitles = globals.gTitles,
+        gDims   = globals.gDimensions;
+
+    linkId = linkId.toLowerCase();
+
+    if (!title) {
+      title = '';
+    }
+
+    if (url === '' || url === null) {
+      if (linkId === '' || linkId === null) {
+        // lower-case and turn embedded newlines into spaces
+        linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
+      }
+      url = '#' + linkId;
+
+      if (!showdown.helper.isUndefined(gUrls[linkId])) {
+        url = gUrls[linkId];
+        if (!showdown.helper.isUndefined(gTitles[linkId])) {
+          title = gTitles[linkId];
+        }
+        if (!showdown.helper.isUndefined(gDims[linkId])) {
+          width = gDims[linkId].width;
+          height = gDims[linkId].height;
+        }
+      } else {
+        return wholeMatch;
+      }
+    }
+
+    altText = altText.replace(/"/g, '&quot;');
+    altText = showdown.helper.escapeCharacters(altText, '*_', false);
+    url = showdown.helper.escapeCharacters(url, '*_', false);
+    var result = '<img src="' + url + '" alt="' + altText + '"';
+
+    if (title) {
+      title = title.replace(/"/g, '&quot;');
+      title = showdown.helper.escapeCharacters(title, '*_', false);
+      result += ' title="' + title + '"';
+    }
+
+    if (width && height) {
+      width  = (width === '*') ? 'auto' : width;
+      height = (height === '*') ? 'auto' : height;
+
+      result += ' width="' + width + '"';
+      result += ' height="' + height + '"';
+    }
+
+    result += ' />';
+    return result;
+  }
+
+  // First, handle reference-style labeled images: ![alt text][id]
+  text = text.replace(referenceRegExp, writeImageTag);
+
+  // Next, handle inline images:  ![alt text](url =<width>x<height> "optional title")
+  text = text.replace(inlineRegExp, writeImageTag);
+
+  text = globals.converter._dispatch('images.after', text, options, globals);
+  return text;
+});
+
+showdown.subParser('italicsAndBold', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('italicsAndBold.before', text, options, globals);
+
+  if (options.literalMidWordUnderscores) {
+    //underscores
+    // Since we are consuming a \s character, we need to add it
+    text = text.replace(/(^|\s|>|\b)__(?=\S)([\s\S]+?)__(?=\b|<|\s|$)/gm, '$1<strong>$2</strong>');
+    text = text.replace(/(^|\s|>|\b)_(?=\S)([\s\S]+?)_(?=\b|<|\s|$)/gm, '$1<em>$2</em>');
+    //asterisks
+    text = text.replace(/(\*\*)(?=\S)([^\r]*?\S[*]*)\1/g, '<strong>$2</strong>');
+    text = text.replace(/(\*)(?=\S)([^\r]*?\S)\1/g, '<em>$2</em>');
+
+  } else {
+    // <strong> must go first:
+    text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, '<strong>$2</strong>');
+    text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, '<em>$2</em>');
+  }
+
+  text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
+  return text;
+});
+
+/**
+ * Form HTML ordered (numbered) and unordered (bulleted) lists.
+ */
+showdown.subParser('lists', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('lists.before', text, options, globals);
+  /**
+   * Process the contents of a single ordered or unordered list, splitting it
+   * into individual list items.
+   * @param {string} listStr
+   * @param {boolean} trimTrailing
+   * @returns {string}
+   */
+  function processListItems (listStr, trimTrailing) {
+    // The $g_list_level global keeps track of when we're inside a list.
+    // Each time we enter a list, we increment it; when we leave a list,
+    // we decrement. If it's zero, we're not in a list anymore.
+    //
+    // We do this because when we're not inside a list, we want to treat
+    // something like this:
+    //
+    //    I recommend upgrading to version
+    //    8. Oops, now this line is treated
+    //    as a sub-list.
+    //
+    // As a single paragraph, despite the fact that the second line starts
+    // with a digit-period-space sequence.
+    //
+    // Whereas when we're inside a list (or sub-list), that line will be
+    // treated as the start of a sub-list. What a kludge, huh? This is
+    // an aspect of Markdown's syntax that's hard to parse perfectly
+    // without resorting to mind-reading. Perhaps the solution is to
+    // change the syntax rules such that sub-lists must start with a
+    // starting cardinal number; e.g. "1." or "a.".
+    globals.gListLevel++;
+
+    // trim trailing blank lines:
+    listStr = listStr.replace(/\n{2,}$/, '\n');
+
+    // attacklab: add sentinel to emulate \z
+    listStr += '~0';
+
+    var rgx = /(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,
+        isParagraphed = (/\n[ \t]*\n(?!~0)/.test(listStr));
+
+    listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
+      checked = (checked && checked.trim() !== '');
+      var item = showdown.subParser('outdent')(m4, options, globals),
+          bulletStyle = '';
+
+      // Support for github tasklists
+      if (taskbtn && options.tasklists) {
+        bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
+        item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
+          var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
+          if (checked) {
+            otp += ' checked';
+          }
+          otp += '>';
+          return otp;
+        });
+      }
+      // m1 - Leading line or
+      // Has a double return (multi paragraph) or
+      // Has sublist
+      if (m1 || (item.search(/\n{2,}/) > -1)) {
+        item = showdown.subParser('githubCodeBlocks')(item, options, globals);
+        item = showdown.subParser('blockGamut')(item, options, globals);
+      } else {
+        // Recursion for sub-lists:
+        item = showdown.subParser('lists')(item, options, globals);
+        item = item.replace(/\n$/, ''); // chomp(item)
+        if (isParagraphed) {
+          item = showdown.subParser('paragraphs')(item, options, globals);
+        } else {
+          item = showdown.subParser('spanGamut')(item, options, globals);
+        }
+      }
+      item =  '\n<li' + bulletStyle + '>' + item + '</li>\n';
+      return item;
+    });
+
+    // attacklab: strip sentinel
+    listStr = listStr.replace(/~0/g, '');
+
+    globals.gListLevel--;
+
+    if (trimTrailing) {
+      listStr = listStr.replace(/\s+$/, '');
+    }
+
+    return listStr;
+  }
+
+  /**
+   * Check and parse consecutive lists (better fix for issue #142)
+   * @param {string} list
+   * @param {string} listType
+   * @param {boolean} trimTrailing
+   * @returns {string}
+   */
+  function parseConsecutiveLists(list, listType, trimTrailing) {
+    // check if we caught 2 or more consecutive lists by mistake
+    // we use the counterRgx, meaning if listType is UL we look for UL and vice versa
+    var counterRxg = (listType === 'ul') ? /^ {0,2}\d+\.[ \t]/gm : /^ {0,2}[*+-][ \t]/gm,
+      subLists = [],
+      result = '';
+
+    if (list.search(counterRxg) !== -1) {
+      (function parseCL(txt) {
+        var pos = txt.search(counterRxg);
+        if (pos !== -1) {
+          // slice
+          result += '\n\n<' + listType + '>' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n\n';
+
+          // invert counterType and listType
+          listType = (listType === 'ul') ? 'ol' : 'ul';
+          counterRxg = (listType === 'ul') ? /^ {0,2}\d+\.[ \t]/gm : /^ {0,2}[*+-][ \t]/gm;
+
+          //recurse
+          parseCL(txt.slice(pos));
+        } else {
+          result += '\n\n<' + listType + '>' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n\n';
+        }
+      })(list);
+      for (var i = 0; i < subLists.length; ++i) {
+
+      }
+    } else {
+      result = '\n\n<' + listType + '>' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n\n';
+    }
+
+    return result;
+  }
+
+  // attacklab: add sentinel to hack around khtml/safari bug:
+  // http://bugs.webkit.org/show_bug.cgi?id=11231
+  text += '~0';
+
+  // Re-usable pattern to match any entire ul or ol list:
+  var wholeList = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
+
+  if (globals.gListLevel) {
+    text = text.replace(wholeList, function (wholeMatch, list, m2) {
+      var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
+      return parseConsecutiveLists(list, listType, true);
+    });
+  } else {
+    wholeList = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
+    //wholeList = /(\n\n|^\n?)( {0,3}([*+-]|\d+\.)[ \t]+[\s\S]+?)(?=(~0)|(\n\n(?!\t| {2,}| {0,3}([*+-]|\d+\.)[ \t])))/g;
+    text = text.replace(wholeList, function (wholeMatch, m1, list, m3) {
+
+      var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
+      return parseConsecutiveLists(list, listType);
+    });
+  }
+
+  // attacklab: strip sentinel
+  text = text.replace(/~0/, '');
+
+  text = globals.converter._dispatch('lists.after', text, options, globals);
+  return text;
+});
+
+/**
+ * Remove one level of line-leading tabs or spaces
+ */
+showdown.subParser('outdent', function (text) {
+  'use strict';
+
+  // attacklab: hack around Konqueror 3.5.4 bug:
+  // "----------bug".replace(/^-/g,"") == "bug"
+  text = text.replace(/^(\t|[ ]{1,4})/gm, '~0'); // attacklab: g_tab_width
+
+  // attacklab: clean up hack
+  text = text.replace(/~0/g, '');
+
+  return text;
+});
+
+/**
+ *
+ */
+showdown.subParser('paragraphs', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('paragraphs.before', text, options, globals);
+  // Strip leading and trailing lines:
+  text = text.replace(/^\n+/g, '');
+  text = text.replace(/\n+$/g, '');
+
+  var grafs = text.split(/\n{2,}/g),
+      grafsOut = [],
+      end = grafs.length; // Wrap <p> tags
+
+  for (var i = 0; i < end; i++) {
+    var str = grafs[i];
+    // if this is an HTML marker, copy it
+    if (str.search(/~(K|G)(\d+)\1/g) >= 0) {
+      grafsOut.push(str);
+    } else {
+      str = showdown.subParser('spanGamut')(str, options, globals);
+      str = str.replace(/^([ \t]*)/g, '<p>');
+      str += '</p>';
+      grafsOut.push(str);
+    }
+  }
+
+  /** Unhashify HTML blocks */
+  end = grafsOut.length;
+  for (i = 0; i < end; i++) {
+    var blockText = '',
+        grafsOutIt = grafsOut[i],
+        codeFlag = false;
+    // if this is a marker for an html block...
+    while (grafsOutIt.search(/~(K|G)(\d+)\1/) >= 0) {
+      var delim = RegExp.$1,
+          num   = RegExp.$2;
+
+      if (delim === 'K') {
+        blockText = globals.gHtmlBlocks[num];
+      } else {
+        // we need to check if ghBlock is a false positive
+        if (codeFlag) {
+          // use encoded version of all text
+          blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text);
+        } else {
+          blockText = globals.ghCodeBlocks[num].codeblock;
+        }
+      }
+      blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs
+
+      grafsOutIt = grafsOutIt.replace(/(\n\n)?~(K|G)\d+\2(\n\n)?/, blockText);
+      // Check if grafsOutIt is a pre->code
+      if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
+        codeFlag = true;
+      }
+    }
+    grafsOut[i] = grafsOutIt;
+  }
+  text = grafsOut.join('\n\n');
+  // Strip leading and trailing lines:
+  text = text.replace(/^\n+/g, '');
+  text = text.replace(/\n+$/g, '');
+  return globals.converter._dispatch('paragraphs.after', text, options, globals);
+});
+
+/**
+ * Run extension
+ */
+showdown.subParser('runExtension', function (ext, text, options, globals) {
+  'use strict';
+
+  if (ext.filter) {
+    text = ext.filter(text, globals.converter, options);
+
+  } else if (ext.regex) {
+    // TODO remove this when old extension loading mechanism is deprecated
+    var re = ext.regex;
+    if (!re instanceof RegExp) {
+      re = new RegExp(re, 'g');
+    }
+    text = text.replace(re, ext.replace);
+  }
+
+  return text;
+});
+
+/**
+ * These are all the transformations that occur *within* block-level
+ * tags like paragraphs, headers, and list items.
+ */
+showdown.subParser('spanGamut', function (text, options, globals) {
+  'use strict';
+
+  text = globals.converter._dispatch('spanGamut.before', text, options, globals);
+  text = showdown.subParser('codeSpans')(text, options, globals);
+  text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals);
+  text = showdown.subParser('encodeBackslashEscapes')(text, options, globals);
+
+  // Process anchor and image tags. Images must come first,
+  // because ![foo][f] looks like an anchor.
+  text = showdown.subParser('images')(text, options, globals);
+  text = showdown.subParser('anchors')(text, options, globals);
+
+  // Make links out of things like `<http://example.com/>`
+  // Must come after _DoAnchors(), because you can use < and >
+  // delimiters in inline links like [this](<url>).
+  text = showdown.subParser('autoLinks')(text, options, globals);
+  text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
+  text = showdown.subParser('italicsAndBold')(text, options, globals);
+  text = showdown.subParser('strikethrough')(text, options, globals);
+
+  // Do hard breaks:
+  text = text.replace(/  +\n/g, ' <br />\n');
+
+  text = globals.converter._dispatch('spanGamut.after', text, options, globals);
+  return text;
+});
+
+showdown.subParser('strikethrough', function (text, options, globals) {
+  'use strict';
+
+  if (options.strikethrough) {
+    text = globals.converter._dispatch('strikethrough.before', text, options, globals);
+    text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '<del>$1</del>');
+    text = globals.converter._dispatch('strikethrough.after', text, options, globals);
+  }
+
+  return text;
+});
+
+/**
+ * Strip any lines consisting only of spaces and tabs.
+ * This makes subsequent regexs easier to write, because we can
+ * match consecutive blank lines with /\n+/ instead of something
+ * contorted like /[ \t]*\n+/
+ */
+showdown.subParser('stripBlankLines', function (text) {
+  'use strict';
+  return text.replace(/^[ \t]+$/mg, '');
+});
+
+/**
+ * Strips link definitions from text, stores the URLs and titles in
+ * hash references.
+ * Link defs are in the form: ^[id]: url "optional title"
+ *
+ * ^[ ]{0,3}\[(.+)\]: // id = $1  attacklab: g_tab_width - 1
+ * [ \t]*
+ * \n?                  // maybe *one* newline
+ * [ \t]*
+ * <?(\S+?)>?          // url = $2
+ * [ \t]*
+ * \n?                // maybe one newline
+ * [ \t]*
+ * (?:
+ * (\n*)              // any lines skipped = $3 attacklab: lookbehind removed
+ * ["(]
+ * (.+?)              // title = $4
+ * [")]
+ * [ \t]*
+ * )?                 // title is optional
+ * (?:\n+|$)
+ * /gm,
+ * function(){...});
+ *
+ */
+showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
+  'use strict';
+
+  var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm;
+
+  // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
+  text += '~0';
+
+  text = text.replace(regex, function (wholeMatch, linkId, url, width, height, blankLines, title) {
+    linkId = linkId.toLowerCase();
+    globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url);  // Link IDs are case-insensitive
+
+    if (blankLines) {
+      // Oops, found blank lines, so it's not a title.
+      // Put back the parenthetical statement we stole.
+      return blankLines + title;
+
+    } else {
+      if (title) {
+        globals.gTitles[linkId] = title.replace(/"|'/g, '&quot;');
+      }
+      if (options.parseImgDimensions && width && height) {
+        globals.gDimensions[linkId] = {
+          width:  width,
+          height: height
+        };
+      }
+    }
+    // Completely remove the definition from the text
+    return '';
+  });
+
+  // attacklab: strip sentinel
+  text = text.replace(/~0/, '');
+
+  return text;
+});
+
+showdown.subParser('tables', function (text, options, globals) {
+  'use strict';
+
+  if (!options.tables) {
+    return text;
+  }
+
+  var tableRgx = /^[ \t]{0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|~0)/gm;
+
+  function parseStyles(sLine) {
+    if (/^:[ \t]*--*$/.test(sLine)) {
+      return ' style="text-align:left;"';
+    } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
+      return ' style="text-align:right;"';
+    } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
+      return ' style="text-align:center;"';
+    } else {
+      return '';
+    }
+  }
+
+  function parseHeaders(header, style) {
+    var id = '';
+    header = header.trim();
+    if (options.tableHeaderId) {
+      id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
+    }
+    header = showdown.subParser('spanGamut')(header, options, globals);
+
+    return '<th' + id + style + '>' + header + '</th>\n';
+  }
+
+  function parseCells(cell, style) {
+    var subText = showdown.subParser('spanGamut')(cell, options, globals);
+    return '<td' + style + '>' + subText + '</td>\n';
+  }
+
+  function buildTable(headers, cells) {
+    var tb = '<table>\n<thead>\n<tr>\n',
+        tblLgn = headers.length;
+
+    for (var i = 0; i < tblLgn; ++i) {
+      tb += headers[i];
+    }
+    tb += '</tr>\n</thead>\n<tbody>\n';
+
+    for (i = 0; i < cells.length; ++i) {
+      tb += '<tr>\n';
+      for (var ii = 0; ii < tblLgn; ++ii) {
+        tb += cells[i][ii];
+      }
+      tb += '</tr>\n';
+    }
+    tb += '</tbody>\n</table>\n';
+    return tb;
+  }
+
+  text = globals.converter._dispatch('tables.before', text, options, globals);
+
+  text = text.replace(tableRgx, function (rawTable) {
+
+    var i, tableLines = rawTable.split('\n');
+
+    // strip wrong first and last column if wrapped tables are used
+    for (i = 0; i < tableLines.length; ++i) {
+      if (/^[ \t]{0,3}\|/.test(tableLines[i])) {
+        tableLines[i] = tableLines[i].replace(/^[ \t]{0,3}\|/, '');
+      }
+      if (/\|[ \t]*$/.test(tableLines[i])) {
+        tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
+      }
+    }
+
+    var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
+        rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}),
+        rawCells = [],
+        headers = [],
+        styles = [],
+        cells = [];
+
+    tableLines.shift();
+    tableLines.shift();
+
+    for (i = 0; i < tableLines.length; ++i) {
+      if (tableLines[i].trim() === '') {
+        continue;
+      }
+      rawCells.push(
+        tableLines[i]
+          .split('|')
+          .map(function (s) {
+            return s.trim();
+          })
+      );
+    }
+
+    if (rawHeaders.length < rawStyles.length) {
+      return rawTable;
+    }
+
+    for (i = 0; i < rawStyles.length; ++i) {
+      styles.push(parseStyles(rawStyles[i]));
+    }
+
+    for (i = 0; i < rawHeaders.length; ++i) {
+      if (showdown.helper.isUndefined(styles[i])) {
+        styles[i] = '';
+      }
+      headers.push(parseHeaders(rawHeaders[i], styles[i]));
+    }
+
+    for (i = 0; i < rawCells.length; ++i) {
+      var row = [];
+      for (var ii = 0; ii < headers.length; ++ii) {
+        if (showdown.helper.isUndefined(rawCells[i][ii])) {
+
+        }
+        row.push(parseCells(rawCells[i][ii], styles[ii]));
+      }
+      cells.push(row);
+    }
+
+    return buildTable(headers, cells);
+  });
+
+  text = globals.converter._dispatch('tables.after', text, options, globals);
+
+  return text;
+});
+
+/**
+ * Swap back in all the special characters we've hidden.
+ */
+showdown.subParser('unescapeSpecialChars', function (text) {
+  'use strict';
+
+  text = text.replace(/~E(\d+)E/g, function (wholeMatch, m1) {
+    var charCodeToReplace = parseInt(m1);
+    return String.fromCharCode(charCodeToReplace);
+  });
+  return text;
+});
+module.exports = showdown;

+ 17 - 14
Component/selectSectionStaff_tow/selectSectionStaff_tow.js

@@ -163,23 +163,26 @@ Component({
         var selectUserId = this.data.selectUserId;
         var arr = [];
         var ids = [];
-        if (that.props.lead) {//只显示管理者
+        if (that.props.islead) {//只显示管理者  
           list.map((item) => {
             item.checked = false;
-            if (item.name == 'admin' || item.name == 'creator' || item.name == 'point_manager'||item.name=='dept_manager') {
-
-             
-            }
-            if (selectUserId.length > 0) {
-              selectUserId.forEach(item2 => {
-                if (item.id == item2.id) {
-                  item.checked = true;
-                  ids.push(item);
-                }
-              })
+            var isManager=false;
+            item.role_list.forEach(roleItem=>{
+              if (roleItem.name == 'admin' || roleItem.name == 'creator' || roleItem.name == 'point_manager' || roleItem.name == 'dept_manager') {
+                    isManager=true;
+              }
+            })
+            if (isManager) {
+              arr.push(item);
+              if (selectUserId.length > 0) {
+                selectUserId.forEach(item2 => {
+                  if (item.id == item2.id) {
+                    item.checked = true;
+                    ids.push(item);
+                  }
+                })
+              }
             }
-
-
           })
         } else {
           list.map((item) => {

+ 20 - 4
Component/selectSxZp/selectSxZp.js

@@ -9,7 +9,7 @@ Component({
       {
         name: '积分类型',
         child: [
-          { name: "全部", code: 0, checked: false },
+          { name: "全部", code: 0, checked: true },
           { name: "绩效分", code: 1, checked: false },
           { name: "A分", code: 2, checked: false },
           { name: "B分", code: 3, checked: false },
@@ -18,7 +18,7 @@ Component({
       {
         name: '任务状态',
         child: [
-          { name: "全部", code: "all", checked: false },
+          { name: "全部", code: "all", checked: true },
           { name: "进行中", code: "running", checked: false },
           { name: "已完成", code: "complete", checked: false },
         ],
@@ -26,7 +26,7 @@ Component({
       {
         name: '排序',
         child: [
-          { name: "按发布时间", code: "publish", checked: false },
+          { name: "按发布时间", code: "publish", checked: true },
           { name: "按截止时间", code: "expire", checked: false },
         ],
       }
@@ -61,7 +61,7 @@ Component({
   props: {
     onConfirm: (data) => console.log(data),
     onClose: (data) => console.log(data),
-    defaultSx: ['0', 'all', 'publish'],
+    defaultSx: [0, 'all', 'publish'],
     typeIndex: 1,
   },
   didMount() {
@@ -82,6 +82,22 @@ Component({
           }
         })
       })
+    } else {
+      this.props.defaultSx = [0, 'all', 'publish'];
+      sxArr.map(item => {
+        item.child.map(item2 => {
+          item2.checked = false;
+          if (this.props.defaultSx[0] == item2.code) {
+            item2.checked = true;
+          }
+          if (this.props.defaultSx[1] == item2.code) {
+            item2.checked = true;
+          }
+          if (this.props.defaultSx[2] == item2.code) {
+            item2.checked = true;
+          }
+        })
+      })
     }
     this.setData({ isShow: this.props.isShow, sxArr: sxArr, typeIndex: this.props.typeIndex })
   },

+ 77 - 45
app.acss

@@ -10,9 +10,11 @@
 		-webkit-tap-highlight-color: transparent;
 		font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
 	}
-	.nodeBer{
-		border:none!important;
+
+	.nodeBer {
+		border: none!important;
 	}
+
 	view, text {
 		line-height: 40rpx;
 	}
@@ -29,6 +31,10 @@
 		color: #E6A23C!important;
 	}
 
+	.yellow2 {
+		color: #fc0!important;
+	}
+
 	.green {
 		color: #67C23A!important;
 	}
@@ -36,12 +42,15 @@
 	.fontColorZ {
 		color: #303133!important;
 	}
+
 	.fontColorF {
 		color: #606266 !important;
 	}
-	.fontColorX{
+
+	.fontColorX {
 		color: #969799 !important;
 	}
+
 	.fontColorT {
 		color: #C0C4CC!important;
 	}
@@ -107,7 +116,7 @@
 		position: relative;
 		padding: 20rpx 0;
 		/* width: 120%; */
-		white-space:nowrap
+		white-space: nowrap
 	}
 
 	.tab text::after {
@@ -122,9 +131,11 @@
 		opacity: .8;
 		content: '';
 	}
-  .tab .activeView{
+
+	.tab .activeView {
 		color: #26a2ff;
 	}
+
 	.tab .activeView::after {
 		margin-top: -0.02rem;
 		-webkit-transform: rotate(135deg);
@@ -141,15 +152,17 @@
 		background: rgba(0, 0, 0, 0.4);
 		z-index: 999;
 	}
-	.meng{
+
+	.meng {
 		position: fixed;
 		bottom: 0;
-		background-color: rgba(0,0,0,.5);
+		background-color: rgba(0, 0, 0, .5);
 		left: 0;
 		right: 0;
 		top: 80rpx;
 	}
-	.delVal{
+
+	.delVal {
 		height: 40rpx;
 		width: 40rpx;
 		border-radius: 100%;
@@ -161,19 +174,21 @@
 	}
 
 	/* 弹窗过程 */
-	.pop-up{
-  position: fixed;
-  right: 10rpx;
-  width: 100rpx;
-  height: 100rpx;
-  border-radius: 50%;
-  background: #fff;
-  text-align: center;
-  bottom: 200rpx;
-  box-sizing: border-box;
-  line-height: 100rpx;
-   box-shadow: 0 0 0.12rem rgba(0,0,0,.05);
-}
+
+	.pop-up {
+		position: fixed;
+		right: 10rpx;
+		width: 100rpx;
+		height: 100rpx;
+		border-radius: 50%;
+		background: #fff;
+		text-align: center;
+		bottom: 200rpx;
+		box-sizing: border-box;
+		line-height: 100rpx;
+		box-shadow: 0 0 0.12rem rgba(0, 0, 0, .05);
+	}
+
 	.showPop {
 		animation: showLayer 0.2s linear both;
 	}
@@ -191,7 +206,7 @@
 
 	.redBox {
 		border-radius: 6rpx;
-		background: rgba(245, 108, 108, 0.1);
+		background: rgba(245,108,108,.1);
 		color: #F56C6C;
 		font-size: 28rpx;
 		padding: 0 6rpx;
@@ -199,15 +214,23 @@
 
 	.greenBox {
 		border-radius: 6rpx;
-		background: rgba(103, 194, 58, 0.1);
+		background: rgba(103,194,58,.1);
 		color: #67C23A;
 		font-size: 28rpx;
 		padding: 0 6rpx;
 	}
 
+	.yellowBox2{
+		border-radius: 6rpx;
+		background: rgba(255,204,0,.1);
+		color: #fc0;
+		font-size: 28rpx;
+		padding: 0 6rpx;
+	}
+
 	.yellowBox {
 		border-radius: 6rpx;
-		background: rgba(230, 162, 60, 0.1);
+		background: rgba(230,162,60,.1);
 		color: #E6A23C;
 		font-size: 28rpx;
 		padding: 0 6rpx;
@@ -215,12 +238,20 @@
 
 	.blueBox {
 		border-radius: 6rpx;
-		background: rgba(238, 162, 255, 0.1);
+		background: rgba(38,162,255,.1);
 		color: #26A2FF;
 		font-size: 28rpx;
 		padding: 0 6rpx;
 	}
 
+	.textBox {
+		border-radius: 6rpx;
+		background: rgba(48,49,51,.1);
+		color: #303133;
+		font-size: 28rpx;
+		padding: 0 6rpx;
+	}
+
 	.margin-bottom {
 		margin-bottom: 20rpx;
 	}
@@ -246,38 +277,39 @@
 		text-align: left;
 	}
 
-	.noDatas{
+	.noDatas {
 		text-align: center;
 		padding: 16rpx 0;
 		color: #909399
 	}
 
+	.radio_ {
+		width: 40rpx !important;
+		height: 40rpx !important;
+		border: 1px solid #ccc;
+		border-radius: 50% !important;
+		background: #fff;
+		position: relative;
+		margin: 0 20rpx 0 24rpx;
+	}
 
-.radio_{
-  width: 40rpx !important;
-  height: 40rpx !important;
-  border: 1px solid #ccc;
-  border-radius: 50% !important;
-  background: #fff;
-	position: relative;
-	margin: 0 20rpx 0 24rpx;
-}
-.active .radio_{
-  border: 1px solid #26A2FF;
-}
-.active .radio_::before{
-		content:'';
-    width: 20rpx !important;
-    height: 20rpx !important;
-    border-radius: 50% !important;
-    background: #26A2FF;
+	.active .radio_ {
+		border: 1px solid #26A2FF;
+	}
+
+	.active .radio_::before {
+		content: '';
+		width: 20rpx !important;
+		height: 20rpx !important;
+		border-radius: 50% !important;
+		background: #26A2FF;
 		position: absolute;
 		display: block;
 		top: 50%;
 		left: 50%;
 		margin-top: -10rpx;
 		margin-left: -9.5rpx;
-}
+	}
 
 	/* 盒子模型 */
 

+ 1 - 0
app.js

@@ -18,6 +18,7 @@ App({
     month: formatTime(new Date()).month,//当前月
     day: formatTime(new Date()).day,//当前日
     month_tow:formatTime(new Date()).month_tow,//当前月份
+    allDate:formatTime(new Date()).allDate,//带时分
     types: [],
     userData: '',
     token: '',

+ 4 - 2
app.json

@@ -50,7 +50,9 @@
     "pages/statistics/openPerform/openPerform",
     "pages/statistics/taskDetail/taskDetail",
     "pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail",
-    "pages/statistics/getTask/getTask"
+    "pages/statistics/getTask/getTask",
+    "pages/statistics/assaign_set/assaign_set",
+    "pages/statistics/offerAreward_set/offerAreward_set"
   ],
   "window": {
     "defaultTitle": "功道云",
@@ -82,4 +84,4 @@
       }
     ]
   }
-}
+}

+ 3 - 0
pages/deploy/upgradeDetail/upgradeDetail.acss

@@ -1,3 +1,6 @@
+
+@import "../../../Component/aParse/aParse.acss";
+
 .title{
   text-align: center;
   padding: 0.28rem

+ 4 - 1
pages/deploy/upgradeDetail/upgradeDetail.axml

@@ -1,4 +1,7 @@
+<import src="../../../Component/aParse/aParse.axml"/>
 <view>
   <view class="title">{{obj.version}}</view>
-  <rich-text nodes="{{nodes}}" onTap="tap"></rich-text>
+  <view style="padding:28rpx;">
+      <template is="aParse" data="{{aParseData:article.nodes}}"/>
+  </view>
 </view>

+ 11 - 12
pages/deploy/upgradeDetail/upgradeDetail.js

@@ -1,20 +1,9 @@
 var app = getApp();
 var that;
+var AParse = require('../../../Component/aParse/aParse.js');
 Page({
   data: {
     obj: {},
-    nodes: [{
-      
-      name: 'div',
-      attrs: {
-        class: 'wrapper',
-        style: 'color: orange;',
-      },
-      children: [{
-        type: 'text',
-        text: 'Hello World!',
-      }],
-    }],
   },
   onLoad(e) {
     that = this;
@@ -24,7 +13,17 @@ Page({
     }
   },
   getList(id) {
+    /**
+ * 使用说明:
+* AParse.AParse(bindName , type, data, target,imagePadding)
+* 1.bindName绑定的数据名(必填)
+* 2.type可以为html或者md(必填)
+* 3.data为传入的具体数据(必填)
+* 4.target为Page对象,一般为this(必填)
+* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)
+*/
     app.$get("api/version/info", { version_id: id }).then((res) => {
+      AParse.aParse('article', 'html', res.data.data.update_msg, that, 5);
       this.setData({
         obj: res.data.data
       })

+ 24 - 22
pages/statistics/C_ranking/C_ranking.js

@@ -6,7 +6,7 @@ Page({
     month: app.globalData.month,
     showRuleTwo: false,//显示规则组件
     ruleVal: "规则分类",
-    date:app.globalData.month,
+    date: app.globalData.month,
     isPx: true,
     id: '',
     page: 1,
@@ -17,21 +17,21 @@ Page({
     if (e.date_interval == 3) {
       this.setData({
         dateType: e.date_interval,
-        month:app.globalData.year,
-        date:app.globalData.year,
+        month: app.globalData.year,
+        date: app.globalData.year,
       })
     } else if (e.date_interval == 2) { // 传进入如果是季度
       this.setData({
-        month:app.globalData.year+String(this.getJ()+1),
+        month: app.globalData.year + String(this.getJ() + 1),
         dateType: e.date_interval
       })
     } else {
-      var str=String(app.globalData.month_tow);
-      if(app.globalData.month_tow<10){
-          str="0"+String(app.globalData.month_tow)
+      var str = String(app.globalData.month_tow);
+      if (app.globalData.month_tow < 10) {
+        str = "0" + String(app.globalData.month_tow)
       }
       this.setData({
-        month:app.globalData.year+String(str),
+        month: app.globalData.year + String(str),
         dateType: e.date_interval
       })
     }
@@ -90,7 +90,7 @@ Page({
       // type: 'normal',
       group_id: that.data.id,
     }
-    app.$get('api/integral/statistics/groups/rank',data).then((res) => {
+    app.$get('api/integral/statistics/groups/rank', data).then((res) => {
       var data = res.data.data.list;
       if (is) {
         if (data.length == 0) {
@@ -113,29 +113,31 @@ Page({
     this.getData(true);
   },
   selectDay() {
-    var str="yyyy-MM";
-    if(this.data.dateType==3){
-        str="yyyy"
+    var str = "yyyy-MM";
+    if (this.data.dateType == 3) {
+      str = "yyyy"
     }
     this.setData({ showDate: true })
     dd.datePicker({
       format: str,
       currentDate: this.data.date,
       success: (res) => {
-        if(res.date&&that.data.dateType!=3){
-        var str=res.date.substr(0,4)
-        var str2=res.date.substr(res.date.length-2,2)
-        this.setData({
-          month: String(str)+String(str2),
-          date:res.date
-        })
-        this.getData();
-        }else{
+        if (res.date) {
+          if (that.data.dateType != 3) {
+            var str = res.date.substr(0, 4)
+            var str2 = res.date.substr(res.date.length - 2, 2)
+            this.setData({
+              month: String(str) + String(str2),
+              date: res.date
+            })
+            this.getData();
+          } else {
             this.setData({
               month: res.date,
-              date:res.date
+              date: res.date
             })
             this.getData();
+          }
         }
       },
       complete: (res) => {

+ 5 - 5
pages/statistics/assaign/assaign.axml

@@ -2,7 +2,7 @@
   <view>
     <view class="inputs">
       <view class="li">
-        <textarea class="textarea" maxlength="100" value="{{items.remark}}" onInput="bindTextAreaBlur" placeholder="请输入任务内容" data-index="{{index}}"></textarea>
+        <textarea class="textarea" maxlength="100" value="{{items.task_name}}" onInput="bindTextAreaBlur" placeholder="请输入任务内容" data-index="{{index}}"></textarea>
         <image mode="scaleToFill" src="../../../image/addImg.png"  class="addImg" catchTap="openImg"/>
       </view>
       <view style="background:#fff;padding:0 28rpx;" a:if="{{items.file_list[0]}}" class="flex-box flex-v-ce">
@@ -15,7 +15,7 @@
         <view class="label isBt" style="position: relative;top:10rpx;">任务积分</view>
         <text class="red" style="position: relative;top:10rpx;">+</text>
         <view class="flex-1">
-          <input value="{{item.point2}}"  placeholder="0" type="number" onInput="bindKeyInput"  class="flex-1"/>
+          <input value="{{items.base_point}}"  placeholder="0" type="number" onInput="bindKeyInput"  class="flex-1"/>
         </view>
       </view>
       <view class="flex-box flex-v-ce form-top" catchTap="openSelect" data-num="1">
@@ -47,7 +47,7 @@
         <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
       </view>
       <view class="li">
-        <textarea maxlength="100" value="{{item.remark}}" onInput="bindTextAreaBlur" placeholder="请输入任务描述" data-index="{{index}}"></textarea>
+        <textarea maxlength="100" value="{{items.task_remark}}" onInput="bindTextAreaBlur2" placeholder="请输入任务描述" data-index="{{index}}"></textarea>
       </view>
       <view class="flex-box flex-v-ce li">
         <view class="label">重复周期</view>
@@ -62,7 +62,7 @@
         <view class="label" style="position: relative;top:10rpx;">逾期扣分</view>
         <text class="green" style="position: relative;top:10rpx;">-</text>
         <view class="flex-1">
-          <input value="{{item.point2}}"  placeholder="每逾期一天扣多少分" type="number" onInput="bindKeyInput2"  class="flex-1"/>
+          <input value="{{items.timeout_deduction_point}}"  placeholder="每逾期一天扣多少分" type="number" onInput="bindKeyInput2"  class="flex-1"/>
         </view>
       </view>
     </view>
@@ -72,6 +72,6 @@
   </view>
   <view class="box" animation="{{animationInfo}}">
     <select-section-staff isLeadership="{{true}}" isBoss="{{true}}" selectUser="{{users}}" onClose="onClose" onConfirm="onSelectUser" a:if="{{isShowType=='1'}}"/>
-    <select-section-staff-two superior_list="{{superior_list}}" islead="{{true}}" selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='2'}}"/>
+    <select-section-staff-two  islead="{{true}}" selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='2'}}"/>
   </view>
 </view>

+ 64 - 116
pages/statistics/assaign/assaign.js

@@ -11,17 +11,16 @@ Page({
       task_remark: '',//任务详细描述
       base_point: '',//任务参考积分
       expire_time: '',//截至时间 格式:2020-02-02 12:00
-      package_id: '',//绩效任务包id 绩效任务包发布工作时必须大于0,其余工作发布为0
-      weight: '',//绩效权重 绩效任务包发布工作时必须大于0,其余工作发布为0
+      package_id: 0,//绩效任务包id 绩效任务包发布工作时必须大于0,其余工作发布为0
+      weight: 0,//绩效权重 绩效任务包发布工作时必须大于0,其余工作发布为0
       file_list: [],//附件地址列表
       reviewer_id: '',//审批者id
       revieweName: '',
       timeout_deduction_point: '',//逾期扣分/月
-      unqualified: '',//评分标准 不合格-分数
       qualified: '',//
-      satisfied: '',//
-      super_satisfied: '',//
-      cate_id: '',// 共组分类id   
+      cate_id: 0,// 共组分类id   
+      task_cycle: 0,//重复周期
+      task_expire_day: 1
     },
     reviewerObj: [],//默认审批人
     objectArray: [
@@ -52,9 +51,9 @@ Page({
     })
   },
   bindObjPickerChange(e) {
-    console.log('picker发送选择改变,携带值为', e.detail.value);
     this.setData({
       arrIndex: e.detail.value,
+      [`items.task_cycle`]: e.detail.value
     });
   },
   openType(e) {
@@ -74,6 +73,7 @@ Page({
     var point = `items.base_point`;
     this.setData({
       [point]: e.detail.value,
+      [`items.qualified`]: e.detail.value
     });
   },
   //积分输入
@@ -213,125 +213,70 @@ Page({
 
   //备注输入
   bindTextAreaBlur: function (e) {
-    var index = e.target.dataset.index;
-    var remark = `items[${index}].remark`
     this.setData({
-      [remark]: e.detail.value,
+      [`items.task_name`]: e.detail.value,
+    });
+  },
+  //备注输入
+  bindTextAreaBlur2: function (e) {
+    this.setData({
+      [`items.task_remark`]: e.detail.value,
     });
   },
+
+
   showToast(text) {
     app.globalData.showToast(text);
   },
   formSubmit() {
     var items = this.data.items;
-    var userData = this.data.users;
-    var arr = [];
-    var isTg = true;
-    var pt_id = app.getTypesItem(this.data.isGzType).id
-    if (userData.length == 0) {
-      this.showToast('请选择奖扣对象')
+    console.log(items);
+    if (!items.task_name) {
+      this.showToast('请输入任务内容')
       return;
     }
-    for (var i = 0; i < items.length; i++) {
-      var obj = {};
-      var item = items[i];
-      var num = item.checked ? item.point : item.point2
-      var point;
-      if (item.checked) {
-        if (item.isArrindex != true) {
-          point = 0 - num;
-        } else {
-          point = num;
-        }
-        if (point < item.selectRule.min_point || point > item.selectRule.max_point) {
-          this.showToast(`第${i + 1}条,积分分值超出可输入范围`);
-          isTg = false;
-        }
-      } else {
-        if (item.isArrindex2 != true) {
-          point = 0 - num;
-        } else {
-          point = num;
-        }
-      }
-      if (item.checked) {
-        if (!item.rule_id) {
-          this.showToast(`第${i + 1}条请选择规则`);
-          isTg = false;
-          break;
-        }
-      } else {
-        if (!item.rule_id2) {
-          this.showToast(`第${i + 1}条请选择分类`);
-          isTg = false;
-          break;
-        }
-      }
-      if (point == 0 || !point) {
-        this.showToast(`第${i + 1}条积分分值不能为0或者为空`);
-        isTg = false;
-        break;
-      }
-
-      if (!item.remark) {
-        this.showToast(`第${i + 1}条事件内容不能为空`);
-        isTg = false;
-        break;
-      }
-      obj.rule_id = item.checked ? item.rule_id : item.rule_id2;
-      obj.item_id = item.checked ? item.item_id : 0;
-      obj.point = point;
-      obj.remark = item.remark;
-      obj.event_time = item.event_time;
-      obj.pt_id = pt_id;
-      obj.reviewer_id = item.reviewer_id ? item.reviewer_id : 0;
-      obj.files = item.files;
-      arr.push(obj);
+    if (!items.base_point) {
+      this.showToast('请输入任务记分')
+      return;
     }
-    var userIds = []
-    userData.map(item => {
-      userIds.push(item.id)
-    })
-    if (isTg) {
-      var data = {
-        members: JSON.stringify(userIds),
-        items: JSON.stringify(arr)
-      }
-      this.setData({ disabled: true });
-      var url = this.data.type == 'B' ? 'api/integral/point/entry' : 'api/integral/review/a/entry'
-      app.$post(url, data).then((res) => {
-        var is = true, msg;
-
-        if (this.data.type == 'B') {
-          res.data.data.list.forEach(item => {
-            if (item.status != 1) {
-              is = false;
-              msg = item.msg;
-            }
-          })
-        } else {
-          res.data.data.forEach(item => {
-            if (item.status != 1) {
-              is = false;
-              msg = item.rule_item;
-            }
-          })
-        }
-
-        if (is) {
-          this.showToast('提交成功');
-          setTimeout(() => {
-            this.setData({ disabled: false });
-            dd.navigateBack({ delta: 1 })
-          }, 1000);
-        } else {
-          this.setData({ disabled: false });
-          this.showToast(msg);
-        }
-      }).catch(err => {
-        this.setData({ disabled: false });
-      })
+    if (items.targets.length == 0) {
+      this.showToast('请选择执行对象')
+      return;
     }
+    if (!items.reviewer_id) {
+      this.showToast('请选择审批人')
+      return;
+    }
+    if (!items.expire_time) {
+      this.showToast('请选择截止时间')
+      return;
+    }
+    // items.file_list=JSON.stringify(items.file_list);
+    // items.targets=JSON.stringify(items.targets);
+    if(!items.task_remark){
+      delete items.task_remark
+    }
+    if(!items.timeout_deduction_point){
+      delete items.timeout_deduction_point
+    }
+    items.file_list=items.file_list.toString();
+    items.targets=items.targets.toString();
+    this.setData({ disabled: true });
+    var url;
+    if (items.task_cycle == 0) {
+        url = '/api/integral/work/publish'
+    } else {
+        url ='/api/integral/schedule/publish/work'
+    }
+    app.$post(url,items).then((res) => {
+        this.showToast(res.data.msg);
+        setTimeout(() => {
+          this.setData({ disabled: false });
+          dd.navigateBack({ delta: 1 })
+        }, 1000);
+    }).finally(err => {
+      this.setData({ disabled: false });
+    })
   },
   switchChange(e) {
     var index = e.target.dataset.index;
@@ -355,11 +300,14 @@ Page({
   },
   //选择执行人
   onSelectUser(item) {
-    this.setData({ superior_list: [] });
+    var arr = [];
     if (item.length > 0) {
+      item.forEach(user => {
+        arr.push(user.id);
+      })
       that.setData({
         users: item.length > 0 ? item : [],
-        superior_list: app.globalData.userData.employee_detail.superior_list
+        [`items.targets`]: arr
       })
     }
 

+ 173 - 0
pages/statistics/assaign_set/assaign_set.acss

@@ -0,0 +1,173 @@
+.form-top{
+  background-color: #fff;
+  padding:28rpx;
+  border-bottom: 1px solid #f1f1f1;
+}
+.form-top .flex-1{
+  text-align: right;
+  color: #969799;
+}
+.label{
+  position: relative;
+  width: 160rpx;
+  font-size: 32rpx
+}
+.isBt::before{
+  position: absolute;
+  content: "*";
+  color: #F56C6C;
+  left: -16rpx;
+}
+.inputs .li{
+  background-color: #fff;
+  padding:28rpx;
+  position: relative;
+}
+.li view:nth-child(2){
+  text-align: right;
+  color: #969799;
+}
+.title{
+  padding: 16rpx 28rpx;
+  font-size: 28rpx;
+}
+textarea{
+  padding-left: 10rpx;
+  padding-right: 0;
+  height: 150rpx;
+  position: relative;
+}
+.textarea::before{
+  position: absolute;
+  content: "*";
+  color: #F56C6C;
+  left: -16rpx;
+}
+.add{
+  background-color: #fff;
+  padding: 28rpx 28rpx;
+  color: #26A2FF;
+  margin: 28rpx 0;
+  margin-bottom: 40rpx; 
+}
+.addImg{
+  width: 50rpx;
+  height: 50rpx;
+  position: absolute;
+  bottom: 20rpx;
+  z-index: 998;
+}
+.rightImg{
+  width: 30rpx;
+  height: 30rpx;
+  margin-left: 10rpx;
+}
+.btn-area{
+  position: fixed;
+  background: #fff;
+  bottom: 0;
+  width: 100%;
+  border-top: 1px solid #f1f1f1;
+  padding: 10rpx;
+}
+.defBtn{
+  width: 90%;
+  margin: 0 auto;
+  border-radius: 10rpx;
+  height: 90rpx;
+  text-align: center;
+  line-height: 90rpx;
+}
+.showImg{
+  width: 160rpx;
+  height: 160rpx;
+  margin-bottom: 28rpx;
+  margin-right:40rpx; 
+  margin-top: 28rpx;
+}
+.detele{
+  color: #fff;
+  position: absolute;
+  height: 40rpx;
+  width: 40rpx;
+  border-radius: 100%;
+  background-color: #969799;
+  text-align: center;
+  line-height: 40rpx;
+  right: 10rpx;
+  top: 10rpx;
+}
+.box{
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0,0,0,0.2);
+  z-index: 999;
+  transform: translate(0,100%);
+}
+.inputs{
+  margin-bottom: 200rpx;
+}
+ .inputs .li .input_text{
+  text-align: left;
+  font-size: 24rpx;
+}
+.inputs .li input{
+  width: 100%;
+}
+.jiang{
+  border: 1px solid #f1f1f1;
+  border-radius: 4rpx;
+  width: 40rpx;
+  text-align: center
+}
+.picker-box{
+  width: 110rpx;
+  border-radius: 50rpx;
+  background-color: #f1f1f1;
+  position: relative;
+  height: 60rpx;
+}
+.picker-box text{
+ text-align: center;
+ line-height: 60rpx;
+ font-size: 24rpx;
+}
+.yuan{
+  width: 50rpx;
+  height: 50rpx;
+  background: #26A2FF;
+  border-radius: 100rpx;
+  position: absolute;
+  top: 5rpx;
+}
+.picker-left{
+  left: 5rpx;
+}
+.picker-right{
+  right: 5rpx;
+}
+.userList{
+  height: 40rpx;
+  font-size: 32rpx;
+}
+.van-radio {
+    position: relative;
+    display: inline-block;
+    text-align: center;
+    width: 1.28rem;
+    height: .48rem;
+    background: #f5f7fa;
+    border-radius: .28rem;
+    z-index: 1;
+    color: #222;
+    line-height: 0.48rem;
+    font-size: 0.24rem;
+    margin-left: 20rpx;
+}
+.isTypes{
+  background: #26A2FF;
+  color: #fff
+}

+ 77 - 0
pages/statistics/assaign_set/assaign_set.axml

@@ -0,0 +1,77 @@
+<view>
+  <view>
+    <view class="inputs">
+      <view class="li">
+        <textarea class="textarea" maxlength="100" value="{{items.task_name}}" onInput="bindTextAreaBlur" placeholder="请输入任务内容" data-index="{{index}}"></textarea>
+        <image mode="scaleToFill" src="../../../image/addImg.png"  class="addImg" catchTap="openImg"/>
+      </view>
+      <view style="background:#fff;padding:0 28rpx;" a:if="{{items.file_list[0]}}" class="flex-box flex-v-ce">
+        <view a:for="{{items.file_list}}" key="index" a:for-item="imgs" a:for-index="imgIndex" style="position:relative">
+          <text class="detele" data-itemIndx="{{index}}" data-index="{{imgIndex}}" catchTap="deteleImg">×</text>
+          <image mode="scaleToFill" class="showImg" src="{{imgs}}" data-index="{{imgIndex}}" data-item="{{items.file_list}}" catchTap="showImg"/>
+        </view>
+      </view>
+      <view class="flex-box li margin-bottom" style="padding:15rpx 28rpx;margin-top:24rpx">
+        <view class="label isBt" style="position: relative;top:10rpx;">任务积分</view>
+        <text class="red" style="position: relative;top:10rpx;">+</text>
+        <view class="flex-1">
+          <input value="{{items.base_point}}"  placeholder="0" type="number" onInput="bindKeyInput"  class="flex-1"/>
+        </view>
+      </view>
+      <view class="flex-box flex-v-ce form-top" catchTap="openSelect" data-num="1">
+        <view class="label isBt">执行人</view>
+        <view class="flex-1 font-flex-word userList">
+          <block a:for="{{users}}">
+            <text style="font-size:32rpx">{{item.name}},</text>
+          </block>
+        </view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view>
+      <view class="flex-box flex-v-ce li"  data-num="2" data-item="{{{id:items.reviewer_id,name:items.revieweName}}}" catchTap="openSelect">
+        <view class="label isBt">审批人</view>
+        <view class="flex-1">{{items.revieweName}}</view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view>
+      <!-- <view class="flex-box flex-v-ce li">
+        <view class="label isBt">任务类型</view>
+        <view class="flex-1 flex-box-end flex-flex-v-ce">
+            <view a:for="{{types}}">
+                <text a:if="{{item.code!=='JX'}}"  catchTap="openType" data-id="{{item.id}}" class="van-radio {{items.pt_id==item.id? 'isTypes':''}}">{{item.name}}</text>
+            </view>
+        </view>
+      </view> -->
+
+      <view class="flex-box flex-v-ce li  margin-bottom" catchTap="openDate" data-index="{{index}}">
+        <view class="label isBt">截止时间</view>
+        <view class="flex-1">{{items.expire_time}}</view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view>
+      <view class="li">
+        <textarea maxlength="100" value="{{items.task_remark}}" onInput="bindTextAreaBlur2" placeholder="请输入任务描述" data-index="{{index}}"></textarea>
+      </view>
+      <!-- <view class="flex-box flex-v-ce li">
+        <view class="label">重复周期</view>
+        <view class="flex-1">
+          <picker onChange="bindObjPickerChange" value="{{arrIndex}}" range="{{objectArray}}" range-key="name">
+              <view class="row-extra">{{objectArray[arrIndex].name}}</view>
+          </picker>
+        </view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view> -->
+      <view class="flex-box li" style="padding:15rpx 28rpx;">
+        <view class="label" style="position: relative;top:10rpx;">逾期扣分</view>
+        <text class="green" style="position: relative;top:10rpx;">-</text>
+        <view class="flex-1">
+          <input value="{{items.timeout_deduction_point}}"  placeholder="每逾期一天扣多少分" type="number" onInput="bindKeyInput2"  class="flex-1"/>
+        </view>
+      </view>
+    </view>
+    <view class="btn-area">
+      <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">确定修改</button>
+    </view>
+  </view>
+  <view class="box" animation="{{animationInfo}}">
+    <select-section-staff isLeadership="{{true}}" isAllSelect="{{false}}" isBoss="{{true}}" selectUser="{{users}}" onClose="onClose" onConfirm="onSelectUser" a:if="{{isShowType=='1'}}"/>
+    <select-section-staff-two  islead="{{true}}" selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='2'}}"/>
+  </view>
+</view>

+ 348 - 0
pages/statistics/assaign_set/assaign_set.js

@@ -0,0 +1,348 @@
+var app = getApp()
+var that;
+var animation;
+Page({
+  data: {
+    users: [],
+    items: {
+      targets: [],//工作执行者列表,以逗号分割的字符串或直接传入数组
+      pt_id: 3,//积分种类id
+      task_name: '',//任务名
+      task_remark: '',//任务详细描述
+      base_point: '',//任务参考积分
+      expire_time: '',//截至时间 格式:2020-02-02 12:00
+      package_id: 0,//绩效任务包id 绩效任务包发布工作时必须大于0,其余工作发布为0
+      weight: 0,//绩效权重 绩效任务包发布工作时必须大于0,其余工作发布为0
+      file_list: [],//附件地址列表
+      reviewer_id: '',//审批者id
+      revieweName: '',
+      timeout_deduction_point: '',//逾期扣分/月
+      qualified: '',//
+      cate_id: 0,// 共组分类id   
+      task_cycle: 0,//重复周期
+      task_expire_day: 1
+    },
+    reviewerObj: [],//默认审批人
+    objectArray: [
+      {
+        id: 0,
+        name: '不重复',
+      },
+      {
+        id: 1,
+        name: '每天重复',
+      },
+      {
+        id: 2,
+        name: '每周重复',
+      },
+      {
+        id: 3,
+        name: '每月重复',
+      },
+    ],
+    arrIndex: 0
+  },
+  onLoad(e) {
+    that = this;
+    dd.setNavigationBar({ title: "任务编辑" });
+    if (e.item) {
+      var item = JSON.parse(e.item);
+      console.log(item)
+      this.setData({
+        reviewerObj:[{name:item.reviewer_name,id:item.reviewer_id}],
+        users:[{name:item.employee_name,id:item.employee_id}],
+        items: {
+          id:item.id,
+          targets: [item.employee_id],//工作执行者列表,以逗号分割的字符串或直接传入数组
+          pt_id: item.pt_id,//积分种类id
+          task_name: item.task_name,//任务名
+          task_remark: item.task_remark,//任务详细描述
+          base_point: item.point_config.base_point,//任务参考积分
+          expire_time: item.expire_time,//截至时间 格式:2020-02-02 12:00
+          package_id: 0,//绩效任务包id 绩效任务包发布工作时必须大于0,其余工作发布为0
+          weight: 0,//绩效权重 绩效任务包发布工作时必须大于0,其余工作发布为0
+          file_list: item.task_file_list,//附件地址列表
+          reviewer_id:item.reviewer_id,//审批者id
+          revieweName:item.reviewer_name,
+          timeout_deduction_point: item.point_config.timeout_deduction_point,//逾期扣分/月
+          qualified:item.point_config.base_point,//
+          cate_id: 0,// 共组分类id   
+          task_cycle:0,//重复周期
+          task_expire_day: 1
+        },
+      })
+    }
+    that.setData({
+      types: app.globalData.types
+    })
+  },
+  bindObjPickerChange(e) {
+    this.setData({
+      arrIndex: e.detail.value,
+      [`items.task_cycle`]: e.detail.value
+    });
+  },
+  openType(e) {
+    var id = e.target.dataset.id;
+    that.setData({
+      [`items.pt_id`]: id
+    })
+  },
+  onShow() {
+    animation = dd.createAnimation({
+      duration: 200,
+      timeFunction: "linear",
+    });
+  },
+  //积分输入
+  bindKeyInput(e) {
+    var point = `items.base_point`;
+    this.setData({
+      [point]: e.detail.value,
+      [`items.qualified`]: e.detail.value
+    });
+  },
+  //积分输入
+  bindKeyInput2(e) {
+    var point = `items.timeout_deduction_point`;
+    this.setData({
+      [point]: e.detail.value,
+    });
+  },
+
+  //显示图片
+  showImg(e) {
+    var index = e.target.dataset.index;
+    var item = e.target.dataset.item
+    dd.previewImage({
+      current: index,
+      urls: item
+    });
+  },
+  //关闭规则
+  onClose() {
+    animation.translateY(1200).step();
+    that.setData({
+      animationInfo: animation.export()
+    });
+    that.setData({ isShowType: '' });
+  },
+  //选择弹窗
+  openSelect(e) {
+    var num = e.target.dataset.num;
+
+    if (e.target.dataset.item) {
+      if (e.target.dataset.item.id) {
+        that.setData({ reviewerObj: [e.target.dataset.item] });
+      } else {
+        that.setData({ reviewerObj: [] });
+      }
+    }
+    that.setData({
+      isShowType: num,
+    });
+    animation.translateY(0).step();
+    that.setData({
+      animationInfo: animation.export()
+    });
+  },
+  //删除图片
+  deteleImg(e) {
+    var index = e.target.dataset.index;//获取itemS集合中对应的files
+    var files = that.data.items.file_list;//获取itemS集合中对应的files
+    var files_box = `items.file_list`;//
+    app.globalData.arrRemoveObj(files, files[index]);
+    that.setData({
+      [files_box]: files
+    });
+
+  },
+  //图片选择
+  openImg(e) {
+    var files = that.data.items.file_list;
+    if (files.length >= 3) {
+      app.globalData.showToast("只能上传三张");
+      return false;
+    }
+    dd.chooseImage({
+      count: 1,
+      success: (res) => {
+        that.postImg(res.filePaths[0]);
+      },
+    });
+  },
+  postImg(img_url) {
+    var files_box = `items.file_list`;
+    var files = that.data.items.file_list;
+    dd.httpRequest({
+      url: app.globalData.imgHttpUrl,
+      method: 'POST',
+      data: {
+        md5: that.random_string(32),
+        'name': app.globalData.day
+      },
+      success: function (res) {
+        if (app.globalData.userData.site_id) {
+          var key = 'intesys/dd/' + app.globalData.userData.site_id + "/" + app.globalData.day + '/' + that.random_string(32) + '.png';
+        } else {
+          var key = 'intesys/dd/' + app.globalData.day + '/' + that.random_string(32) + '.png';
+        }
+        var obj = res.data.data;
+        dd.uploadFile({
+          url: app.globalData.ALIOSS_URL,
+          fileType: 'image',
+          fileName: 'file',
+          filePath: img_url,
+          formData: {
+            key: key,
+            policy: obj.policy,
+            OSSAccessKeyId: obj.accessid,
+            success_action_status: 200,
+            signature: obj.signature
+          },
+          success: (res) => {
+            if (res.statusCode == 200) {
+              if (files.length > 0) {
+                files.push('http://cdn.intesys.g107.com/' + key)
+              } else {
+                files = ['http://cdn.intesys.g107.com/' + key];
+              }
+              that.setData({
+                [files_box]: files
+              });
+              console.log(that.data.items);
+              app.globalData.showToast("已上传");
+            }
+          },
+          fail: (err) => {
+            console.log(err);
+          }
+        });
+
+      },
+      fail: function (res) {
+        app.globalData.showToast("上传失败");
+      }
+
+    })
+  },
+  random_string(len) {
+    len = len || 32
+    var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
+    var maxPos = chars.length
+    var pwd = ''
+    for (let i = 0; i < len; i++) {
+      pwd += chars.charAt(Math.floor(Math.random() * maxPos))
+    }
+    return pwd
+  },
+
+  //备注输入
+  bindTextAreaBlur: function (e) {
+    this.setData({
+      [`items.task_name`]: e.detail.value,
+    });
+  },
+  //备注输入
+  bindTextAreaBlur2: function (e) {
+    this.setData({
+      [`items.task_remark`]: e.detail.value,
+    });
+  },
+
+
+  showToast(text) {
+    app.globalData.showToast(text);
+  },
+  formSubmit() {
+    var items = this.data.items;
+    var page1 = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
+    console.log(items);
+    if (!items.task_name) {
+      this.showToast('请输入任务内容')
+      return;
+    }
+    if (!items.base_point) {
+      this.showToast('请输入任务记分')
+      return;
+    }
+    if (items.targets.length == 0) {
+      this.showToast('请选择执行对象')
+      return;
+    }
+    if (!items.reviewer_id) {
+      this.showToast('请选择审批人')
+      return;
+    }
+    if (!items.expire_time) {
+      this.showToast('请选择截止时间')
+      return;
+    }
+    if (!items.task_remark) {
+      delete items.task_remark
+    }
+    if (!items.timeout_deduction_point) {
+      delete items.timeout_deduction_point
+    }
+    items.file_list = items.file_list.toString();
+    items.targets = items.targets.toString();
+    this.setData({ disabled: true });
+    app.$post('api/integral/work/update', items).then((res) => {
+        page1.getDetail(items.id,function(){
+            app.globalData.showToast(res.data.msg);
+            setTimeout(() => {
+              dd.navigateBack({ delta: 1 })
+            }, 1000);
+        })
+    }).finally(err => {
+      this.setData({ disabled: false });
+    })
+  },
+  switchChange(e) {
+    var index = e.target.dataset.index;
+    var item = `items[${index}].checked`;
+    that.setData({
+      [item]: e.detail.value
+    })
+  },
+  //选择时间
+  openDate(e) {
+    var item = `items.expire_time`
+    dd.datePicker({
+      format: 'yyyy-MM-dd HH:mm',
+      currentDate: that.data.items.expire_time,
+      success: (res) => {
+        that.setData({
+          [item]: res.date
+        })
+      },
+    });
+  },
+  //选择执行人
+  onSelectUser(item) {
+    var arr = [];
+    if (item.length > 0) {
+      item.forEach(user => {
+        arr.push(user.id);
+      })
+      that.setData({
+        users: item.length > 0 ? item : [],
+        [`items.targets`]: arr
+      })
+    }
+
+  },
+  //选择审批人
+  onSelectUser2(item) {
+    var elm = item.length > 0 ? item[0] : { id: '', name: '' };
+    var reviewer_id = `items.reviewer_id`
+    var revieweName = `items.revieweName`
+    that.setData({
+      [reviewer_id]: elm.id,
+      [revieweName]: elm.name,
+    });
+
+  },
+});
+

+ 6 - 0
pages/statistics/assaign_set/assaign_set.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "select-section-staff-two":"/Component/selectSectionStaff_tow/selectSectionStaff_tow",
+    "select-section-staff":"/Component/selectSectionStaff/selectSectionStaff"
+  }
+}

+ 57 - 28
pages/statistics/getTask/getTask.acss

@@ -1,41 +1,51 @@
-
-.header{
+.header {
   background: #fff;
   position: sticky;
   top: 0;
 }
-.selectItems{
-     text-align: center;
+
+.selectItems {
+  text-align: center;
 }
-.selectItems .selectImg{
-    border-left: 1px solid #f1f1f1;
-    padding: 0 20rpx;
+
+.selectItems .selectImg {
+  border-left: 1px solid #f1f1f1;
+  padding: 0 20rpx;
 }
-.selectImg image{
-    width: 30rpx;
-    height: 30rpx;
+
+.selectImg image {
+  width: 30rpx;
+  height: 30rpx;
 }
-.selectItems .flex-1{
-    padding: 24rpx 0;
-    text-align: center;
-    font-size: 32rpx;
-    position: relative;
+
+.selectItems .flex-1 {
+  padding: 24rpx 0;
+  text-align: center;
+  font-size: 32rpx;
+  position: relative;
 }
-.selectItems .active::before{
-      position: absolute;
-      content: " ";
-      height: 4rpx;
-      width: 100rpx;
-      background: #26A2FF;
-      bottom: 0rpx; 
-      left: 50%;
-      margin-left: -50rpx;
+
+.selectItems .active::before {
+  position: absolute;
+  content: " ";
+  height: 4rpx;
+  width: 100rpx;
+  background: #26A2FF;
+  bottom: 0rpx;
+  left: 50%;
+  margin-left: -50rpx;
 }
-.main{
-    background: #fff;
+
+.name{
+  font-size: 36rpx;
 }
+
+.main {
+  background: #fff;
+}
+
 .scroll {
-  height:  calc(100vh - 115rpx);
+  height: calc(100vh - 115rpx);
 }
 
 .defBtn {
@@ -54,16 +64,19 @@
 .li-top .flex-1 {
   padding-right: 50rpx;
 }
-.li-top text{
+
+.li-top text {
   font-size: 36rpx;
   font-weight: 600
 }
+
 .task {
   background: #f5f7fa;
   color: #909399;
   font-size: .28rem;
   padding: .05rem .32rem .15rem;
 }
+
 .li {
   padding: 24rpx 28rpx;
 }
@@ -74,3 +87,19 @@
   font-size: 28rpx;
 }
 
+.main-right {
+  margin-left: 10rpx;
+}
+.date{
+  font-size: 28rpx;
+}
+.context {
+  font-size: .32rem;
+  color: #323233;
+  display: -webkit-box;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical;
+  padding: 12rpx 0;
+}

+ 13 - 20
pages/statistics/getTask/getTask.axml

@@ -7,42 +7,35 @@
   </view>
   <view class="main scroll">
     <scroll-view class="scroll" a:if="{{(activeIndex==1)&&list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
-      <view class="li border-bottom"  a:for="{{list}}">
-        <view class="flex-box li-top" catchTap="openDetail" data-item="{{item}}">
-          <view class="flex-1">临时任务1:帮我买瓶82年的雪碧(每天)我买瓶82年的雪碧(每天)我买瓶82年的雪碧(每天)</view>
-          <text class="fontColorX">50</text>
+      <view class="li border-bottom"  a:for="{{list}}" catchTap="openDetail" data-item="{{item}}">
+        <view class="flex-box li-top">
+          <view class="flex-1">{{item.task_name}}</view>
+          <text class="fontColorX">{{item.base_point}}</text>
         </view>
         <view class="flex-box li-bottom">
-          <text class="flex-1 fontColorX" catchTap="openDetail" data-item="{{item}}">2020-08-08 01:11 截止</text>
-          <button type="primary" class="defBtn" data-item="{{item}}" onTap="openPerform">领取任务</button>
+          <text class="flex-1 fontColorX">{{item.end_time}} 截止</text>
+          <button type="primary" class="defBtn" data-item="{{item}}" a:if="{{item.status == '1' && userId != item.owner_id}}">领取任务</button>
         </view>
       </view>
       <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
     </scroll-view>
     <scroll-view class="scroll" a:if="{{activeIndex==2&&list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
       <view class="flex-box li border-bottom" data-index="1" a:for="{{list}}" catchTap="openDetail" data-item="{{item}}">
-        <img-box name="{{item.employee_name}}" imgUrl="{{item.employee_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+        <img-box name="{{item.receiver_name}}" imgUrl="{{item.employee_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
         <view class="flex-1 main-right">
           <view class="flex-box flex-v-ce">
-            <view class="name flex-1">{{item.employee_name}}</view>
-            <view class="red" a:if="{{item.point>0}}">+{{item.point}} {{item.pt_name}}</view>
-            <view class="green" a:else>{{item.point}} {{item.pt_name}}</view>
+            <view class="name flex-1">{{item.receiver_name}}领取{{item.pt_name}}任务</view>
+            <view class="red" a:if="{{item.base_point>0}}">+{{item.base_point}} {{item.pt_name}}</view>
+            <view class="green" a:else>{{item.base_point}} {{item.pt_name}}</view>
           </view>
-          <view class="context" a:if="{{item.remark}}">{{item.remark}}</view>
+          <view class="context" a:if="{{item.task_name}}">{{item.task_name}}</view>
           <view class="flex-box flex-v-ce">
-            <view class="date flex-1">{{item.event_time}}</view>
-            <view class="redBox" a:if="{{item.point>0}}">奖分成功</view>
-            <view class="greenBox" a:else>扣分成功</view>
+            <view class="date fontColorX flex-1">{{item.expire_time}} 截止</view>
           </view>
         </view>
       </view>
       <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
     </scroll-view>
-    <no-data a:if="{{list.length==0}}"></no-data>
-  </view>
-  <view class="pop-up">
-    <picker onChange="bindPickerChange" value="{{index}}" range="{{array}}">
-      <image class="img" mode="scaleToFill" src="../../../image/Bj.png"/>
-    </picker>
+    <no-data a:if="{{list.length==0}}" content="你来迟了,任务已经被抢光了..."></no-data>
   </view>
 </view>

+ 21 - 133
pages/statistics/getTask/getTask.js

@@ -3,136 +3,32 @@ var app = getApp()
 var that;
 Page({
   data: {
-    date: app.globalData.month,
     activeIndex: 1,
     page: 1,
-    showZp: false,//显示sx选择
-    parameter1: { //我指派的参数
-      pt_id: 0,//类型
-      status: 'all',//状态
-      sort: 'publish',//排序
-    },
-    parameter2: { //我的悬赏
-      pt_id: 0,
-      order_by: 'create_time',
-    },
-    list:[1,2,3]
+    hall_type: 'waiting',
+    list: [],
+    userId: '',
   },
-  onLoad(e) {
-    if (e.index) {
-      this.setData({
-        activeIndex: e.index,
-      })
-    }
+  onLoad() {
     that = this;
-    dd.setNavigationBar({ title: "我发布的任务" });
-  },
-
-  //显示选择员工
-  selectSx() {
-    if (this.data.activeIndex == 3) {
-      app.globalData.showToast("重复任务暂不支持筛选")
-      return
-    }
-    this.setData({ showZp: true })
-  },
-  //关闭弹窗
-  onClose() {
+    dd.setNavigationBar({ title: "悬赏任务大厅" });
     this.setData({
-      showZp: false,
+      userId: app.globalData.userData.id
     })
   },
-  //选择筛选
-  onConfirmSx(data) {
-    console.log(data);
-    if (this.data.activeIndex == 1) {
-      this.setData({
-        sxObj: data,
-        page: 1,
-        parameter1: { //我指派的参数
-          pt_id: data[0],//类型
-          status: data[1],//状态
-          sort: data[2],//排序
-        }
-      })
-    } else {
-      this.setData({
-        sxObj: data,
-        page: 1,
-        parameter2: { //我指派的参数
-          pt_id: data[0],//类型
-          order_by: data[3] == 'publish' ? 'create_time' : 'expire_time',
-        }
-      })
-    }
-    this.getData(this.data.activeIndex);
-  },
   onShow() {
-    // if (this.data.page == 1) {
-    //   dd.hideLoading();
-    //   that.getData(that.data.activeIndex);
-    // }
-  },
-  onReset() {
-    this.setData({
-      keyword: '',
-      isVal: false,
-      page: 1,
-    })
-    this.getData(that.data.activeIndex);
-  },
-  bindPickerChange(e) {
-    dd.confirm({
-      title: '删除任务',
-      content: '删除此任务将会删除其相关记录和积分数据,确认删除吗?',
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      success: (result) => {
-        if (result.confirm) {
-
-        }
-      },
-    });
-  },
-  bindKeyInput(e) {
-    this.setData({
-      keyword: e.detail.value,
-      isVal: e.detail.value ? true : false,
-      page: 1,
-    })
-    this.getData(that.data.activeIndex);
+    if (this.data.page == 1) {
+      dd.hideLoading();
+      that.getData();
+    }
   },
-
-  getData(index, is) {
-    var urlS = ['api/integral/work/list/publisher', 'api/integral/task/publish/list', 'integral/schedule/list'];
-    var data;
-    if (index == 1) {
-      var parameter1 = this.data.parameter1;
-      data = {
-        page: that.data.page,
-        page_size: 20,
-        source_type: 1,
-        pt_id: parameter1.pt_id,//类型
-        status: parameter1.status,//状态
-        sort: parameter1.sort,//排序
-      }
-    } else if (index == 2) {
-      var parameter2 = this.data.parameter2;
-      data = {
-        page: that.data.page,
-        page_size: 20,
-        status: 'all',
-        source_type: 1,
-        pt_id: parameter2.pt_id,//类型
-        order_by: parameter2.order_by,//类型
-      }
-    } else {
-      data = {
-        page: that.data.page,
-        page_size: 20,
-      }
+  getData(is) {
+    var data = {
+      page: that.data.page,
+      page_size: 20,
+      hall_type: this.data.hall_type
     }
-    app.$get(urlS[index - 1], data).then((res) => {
+    app.$get('api/integral/task/hall', data).then((res) => {
       var data = res.data.data.list;
       var list = that.data.list;
       data.forEach(element => {
@@ -164,19 +60,11 @@ Page({
     this.setData({
       activeIndex: index,
       page: 1,
-      // list: [],
-      sxObj:[],
-      parameter1: { //我指派的参数
-        pt_id: 0,//类型
-        status: 'all',//状态
-        sort: 'publish',//排序
-      },
-      parameter2: { //我的悬赏
-        pt_id: 0,
-        order_by: 'create_time',
-      }
+      list: [],
+      sxObj: [],
+      hall_type: index == 1 ? 'waiting' : 'catch'
     })
-    // this.getData(index);
+    this.getData();
   },
   openDetail(e) {
     var id = e.target.dataset.item.id;
@@ -188,7 +76,7 @@ Page({
   onScrollToLower() {
     if (!that.data.isData) {
       this.setData({ page: ++that.data.page })
-      this.getData(that.data.activeIndex, true);
+      this.getData(true);
     }
   },
 });

+ 19 - 17
pages/statistics/glz_execute/glz_execute.js

@@ -26,11 +26,11 @@ Page({
     var data;
     data = {
       page: that.data.page,
-      page_size:20,
+      page_size: 20,
       month: that.data.month,
       dept_id: that.data.tissueVal,
     }
-    app.$get('api/integral/statistics/prize/list',data).then((res) => {
+    app.$get('api/integral/statistics/prize/list', data).then((res) => {
       var data = res.data.data.list || [];
       if (that.data.activeIndex == 0) {
         data.sort(that.sotrs('reward_count'));
@@ -49,7 +49,7 @@ Page({
           list: list.concat(data)
         })
       } else {
-                this.setData({list:[]});
+        this.setData({ list: [] });
         this.setData({
           list: data,
           isData: false
@@ -59,15 +59,15 @@ Page({
   },
   //上啦加载
   onScrollToLower() {
-    if(!that.data.isData){
+    if (!that.data.isData) {
       this.setData({ page: ++that.data.page })
       this.getData(true);
     }
   },
   openDetail(e) {
-    var item= e.target.dataset.item;
+    var item = e.target.dataset.item;
     dd.navigateTo({
-      url: '../../workbench/prize_buckle/prize_buckle?id='+item.id+'&month='+that.data.month
+      url: '../../workbench/prize_buckle/prize_buckle?id=' + item.id + '&month=' + that.data.month
     })
   },
   // showPicker(){
@@ -76,33 +76,35 @@ Page({
   //   });
   // },
   bindPickerChange(e) {
-    var list=that.data.list;
+    var list = that.data.list;
     if (e.detail.value == 0) {
       list.sort(that.sotrs('reward_count'));
     } else {
       list.sort(that.sotrs('deduct_count'));
     }
-   this.setData({
+    this.setData({
       activeIndex: e.detail.value,
-      list:list,
+      list: list,
       showPicker: false
     });
   },
   openDate() {
-    this.setData({ showDate:true })
+    this.setData({ showDate: true })
     dd.datePicker({
       format: 'yyyy-MM',
       currentDate: this.data.month,
       success: (res) => {
-        this.setData({
-          month: res.date,
-          page: 1
-        })
-        that.getData();
+        if (res.data) {
+          this.setData({
+            month: res.date,
+            page: 1
+          })
+          that.getData();
+        }
       },
-     complete:(res)=>{
+      complete: (res) => {
         that.setData({
-           showDate: false
+          showDate: false
         })
       }
     });

+ 49 - 28
pages/statistics/grant/grant.js

@@ -3,55 +3,76 @@ var that;
 var animation;
 Page({
   data: {
-    users:[],
-    item:{
-        remark:'',
-        id:''
+    users: [],
+    item: {
+      remark: '',
+      employee_id: []
     },
-    defaultVal:'',
+    defaultVal: '',
   },
   onLoad() {
     that = this;
     dd.setNavigationBar({ title: "发放奖票" });
     this.setData({ isAdministrator: app.globalData.isAdministrator })
   },
-    //备注输入
+  //备注输入
   bindTextAreaBlur: function (e) {
     this.setData({
       [`item.remark`]: e.detail.value,
     });
   },
-  formSubmit(){
-      if(that.data.users.length==0){
-         app.globalData.showToast('请选择奖扣对象');
-         return;
-      }
-      if(!that.data.item.remark){
-         app.globalData.showToast('请输入奖票原因');
-         return;
-      }
+  formSubmit() {
+    if (that.data.users.length == 0) {
+      app.globalData.showToast('请选择奖扣对象');
+      return;
+    }
+    if (!that.data.item.remark) {
+      app.globalData.showToast('请输入奖票原因');
+      return;
+    }
+    var items=[];
+    var obj;
+    that.data.users.forEach(item=>{
+        obj={
+            employee_id:item.id,
+            count:1,
+            remark:this.data.item.remark,
+        }
+        items.push(obj);
+    })
+    this.setData({ disabled: true });
+    app.$post('api/integral/ticket/create', {items:JSON.stringify(items)}).then((res) => {
+      app.globalData.showToast("奖票成功")
+      setTimeout(() => {
+        dd.navigateBack({ delta: 1 })
+      }, 1000);
+    }).finally(err => {
+      this.setData({ disabled: false });
+    })
   },
   //选择人
   onSelectUser(item) {
     //空数据
-    this.setData({ superior_list: [] });
+    var arr = [];
     if (item.length > 0) {
-        that.setData({
-          users: item.length > 0 ? item : [],
-        })
+      item.forEach(user => {
+        arr.push(user.id);
+      })
+      that.setData({
+        users: item.length > 0 ? item : [],
+        [`item.employee_id`]: arr
+      })
     }
   },
   // 选择积分事件
-  onSelectEnevt(item,key){
-     that.setData({
-        item:{
-          remark:item.remark,
-          id:item.id
-        },
-        defaultVal:key
+  onSelectEnevt(item, key) {
+    that.setData({
+      [`item.remark`]:item.remark,
+      [`item.id`]:item.id,
+      defaultVal: key
     })
   },
-    //选择弹窗
+  //选择弹窗
   openSelect(e) {
     var num = e.target.dataset.num;
     that.setData({
@@ -68,7 +89,7 @@ Page({
       timeFunction: "linear",
     });
   },
-    //关闭规则
+  //关闭规则
   onClose() {
     animation.translateY(1200).step();
     that.setData({

+ 2 - 2
pages/statistics/index/index.js

@@ -29,7 +29,7 @@ Page({
       {
         code: '统计分析', child: [
           { name: '排行榜', imgUrl: '../../../image/att_statistics.png', url: '../userRamking/userRamking', code: 'creator admin ' },
-          { name: '考勤分排名', imgUrl: '../../../image/att_statistics.png', url: '../glz_execute/glz_execute', code: 'creator admin employee' },
+          { name: '考勤分排名', imgUrl: '../../../image/att_statistics.png', url: '../check_top/check_top', code: 'creator admin employee' },
           { name: '积分事件', imgUrl: '../../../image/event_list_a.png', url: '../integralEvent/integralEvent', code: 'creator admin employee' },
         ]
       },
@@ -38,7 +38,7 @@ Page({
           { name: '组织架构', imgUrl: '../../../image/dept.png', url: '../../deploy/organization/organization', code: 'creator admin employee' },
           { name: '积分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/integralRule/integralRule', code: 'creator admin employee' },
           { name: '考勤分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/setCheck/setCheck', code: 'creator admin employee' },
-          { name: '工作汇报分规则', imgUrl: '../../../image/e66f.jpg', url: '../my_approve/my_approve', code: 'creator admin employee' },
+          // { name: '工作汇报分规则', imgUrl: '../../../image/e66f.jpg', url: '../my_approve/my_approve', code: 'creator admin employee' },
         ]
       },
 

+ 4 - 0
pages/statistics/myGrant/myGrant.acss

@@ -161,4 +161,8 @@
   color: #fff;
   background: #c6edff;
   background: linear-gradient(-160deg, #26a2ff, #5cb6f9);
+}
+
+.scroll {
+  height: calc(100vh - 3.35rem);
 }

+ 12 - 10
pages/statistics/myGrant/myGrant.axml

@@ -1,11 +1,11 @@
 <view>
   <view class="head flex-box flex-center-center">
     <view class="flex-1">
-      <view>188</view>
+      <view>{{month_total}}</view>
       <view>本月奖票</view>
     </view>
     <view class="flex-1">
-      <view>122</view>
+      <view>{{total}}</view>
       <view>累计奖票</view>
     </view>
   </view>
@@ -19,15 +19,17 @@
   </view>
   <view class="main margin-bottom">
     <view class="title" style="padding-bottom:0rpx">本月奖票</view>
-    <view class="ticket-list__item" a:for="{{list}}">
-      <view class="flex-box flex-v-ce">
-        <view class="ticket_left flex-3">加雪种</view>
-        <view class="ticket_right flex-1">
-          <view style="font-size: 0.42rem; line-height: 0.6rem;">01-06</view>
-          <view style="font-size: 0.32rem; line-height: 0.6rem;">2021</view>
+    <scroll-view class="scroll" a:if="{{list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
+      <view class="ticket-list__item" a:for="{{list}}">
+        <view class="flex-box flex-v-ce">
+          <view class="ticket_left flex-3">{{item.remark.customize}}</view>
+          <view class="ticket_right flex-1">
+            <view style="font-size: 0.42rem; line-height: 0.6rem;">{{item.create_time.substring(item.create_time.length-5)}}</view>
+            <view style="font-size: 0.32rem; line-height: 0.6rem;">{{item.create_time.slice(0,4)}}</view>
+          </view>
         </view>
       </view>
-    </view>
-    <no-data a:if="{{list.length==0}}" content="没有奖票" />
+    </scroll-view>
+     <no-data a:if="{{list.length==0}}" content="没有奖票" />
   </view>
 </view>

+ 45 - 9
pages/statistics/myGrant/myGrant.js

@@ -1,17 +1,18 @@
 
 var app = getApp()
 var that;
-var chart1;
-var chart2;
 Page({
   data: {
     date: app.globalData.month,
-    list: [1, 2, 3]
+    list: [],
+    page: 1,
+    month_total: 0,
+    total: 0
   },
   onLoad() {
     that = this;
-    chart1, chart2 = '';
     dd.setNavigationBar({ title: "我的奖票" });
+    this.getData();
   },
   //选择时间
   openDate(e) {
@@ -22,14 +23,49 @@ Page({
         that.setData({
           date: res.date
         })
+        if (res.date) {
+          that.getData();
+        }
       },
     });
   },
-    //获取积分事件
-  getList() {
-    app.$get("api/integral/statistics/integral", { month:that.data.date, page: 1, page_size: 5}).then((res) => {
-      var data = res.data.data.list;
-
+  //上啦加载
+  onScrollToLower() {
+    if (!that.data.isData) {
+      this.setData({ page: ++that.data.page })
+    }
+  },
+  getData(is) {
+    var data = {
+      page: this.data.page,
+      page_size: 20,
+      employee_id: app.globalData.userData.id,
+      month: this.data.date
+    }
+    app.$get('/api/integral/ticket', data).then((res) => {
+      var data = res.data.data.month_list;
+      var list = that.data.list;
+      this.setData({
+        month_total: res.data.data.month_total,
+        total: res.data.data.total
+      })
+      if (is) {
+        if (data.length < 20) {
+          this.setData({
+            list: list.concat(data),
+            isData: true
+          })
+        } else {
+          this.setData({
+            list: list.concat(data)
+          })
+        }
+      } else {
+        this.setData({
+          list: data,
+          isData: false
+        })
+      }
     })
   },
   //打开更多

+ 2 - 5
pages/statistics/my_issue/my_issue.acss

@@ -64,18 +64,15 @@
     padding: 10rpx 0; 
 }
 .main-right .date{
-   /* font-size: 24rpx; */
+   font-size: 24rpx;
    color: #909399;
-   
 }
 
 .main-right text{
   color: #26A2FF;
   font-size: 28rpx;
 }
-.main-right view:nth-child(1){
-  margin-right: 20rpx;
-}
+
 .index{
   border-radius: 6rpx;
   background:rgba(245, 108, 108, 0.1);

+ 62 - 22
pages/statistics/my_issue/my_issue.axml

@@ -1,36 +1,56 @@
 <view>
   <view class="header margin-bottom">
-    <!-- <form onReset="onReset">
-      <view class="search flex-box flex-v-ce">
-        <image mode="scaleToFill" src="../../../image/ss.png"></image>
-        <input placeholder="请输入姓名或事件内容搜索" onInput="bindKeyInput" class="flex-1"></input>
-        <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
-      </view>
-    </form> -->
+    <!--<form onReset="onReset"><view class="search flex-box flex-v-ce"><image mode="scaleToFill" src="../../../image/ss.png"></image><input placeholder="请输入姓名或事件内容搜索" onInput="bindKeyInput" class="flex-1"></input><button a:if="{{isVal}}" class="delVal" formType="reset">×</button></view></form> -->
     <view class="flex-box flex-v-ce selectItems border-bottom">
       <view data-index="1" class="{{activeIndex == 1? 'active':''}} flex-2" catchTap="activeItem">我指派的</view>
       <view data-index="2" class="{{activeIndex == 2? 'active':''}} flex-2" catchTap="activeItem">我悬赏的</view>
       <view data-index="3" class="{{activeIndex == 3? 'active':''}} flex-2" catchTap="activeItem" style="border-right:1px solid #f1f1f1">重复任务</view>
       <view catchTap="selectSx" class="flex-1">
-         <image mode="scaleToFill" class="sxImg" src="../../../image/sx.png"/>
+        <image mode="scaleToFill" class="sxImg" src="../../../image/sx.png"/>
       </view>
     </view>
   </view>
   <view class="main scroll">
     <scroll-view class="scroll" a:if="{{(activeIndex==1||activeIndex==2)&&list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
       <view class="flex-box li border-bottom" data-index="1" a:for="{{list}}" catchTap="openDetail" data-item="{{item}}">
-        <img-box name="{{item.employee_name}}" imgUrl="{{item.employee_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+        <img-box name="{{item.employee_name}}" a:if="{{activeIndex==1}}" imgUrl="{{item.employee_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+        <block a:if="{{activeIndex==2}}">
+            <img-box name="{{item.owner_name}}" a:if="{{item.receiver_id==0}}" imgUrl="{{item.owner_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+             <img-box name="{{item.receiver_name}}" a:else imgUrl="{{item.receiver_img_url}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
+        </block>
         <view class="flex-1 main-right">
           <view class="flex-box flex-v-ce">
-            <view class="name flex-1">{{item.employee_name}}</view>
-            <view class="red" a:if="{{item.point>0}}">+{{item.point}} {{item.pt_name}}</view>
-            <view class="green" a:else>{{item.point}} {{item.pt_name}}</view>
+            <view class="name flex-1" a:if="{{activeIndex==1}}">{{item.employee_name}}</view>
+            <block a:else>
+                 <view class="name flex-1" a:if="{{item.status == 2 || item.status == 3 || item.receiver_id !=0 && item.status == 4}}">{{item.receiver_name}}的{{item.pt_name}}任务</view>
+                 <view class="name flex-1" a:if="{{item.status == 1 || item.status == -1 || item.receiver_id ==0 &&item.status == 4}}">我发布的{{item.pt_name}}任务</view>
+            </block>
+            <block a:if="{{activeIndex==1}}">
+              <view class="red" a:if="{{item.point_config.base_point>0}}">+{{item.point_config.base_point}} {{item.pt_name}}</view>
+              <view class="green" a:else>{{item.point_config.base_point}} {{item.pt_name}}</view>
+            </block>
+            <block a:else>
+              <view class="red" a:if="{{item.base_point>0}}">+{{item.base_point}} {{item.pt_name}}</view>
+              <view class="green" a:else>{{item.base_point}} {{item.pt_name}}</view>
+            </block>
           </view>
-          <view class="context" a:if="{{item.remark}}">{{item.remark}}</view>
+          <view class="context" a:if="{{item.task_name}}">{{item.task_name}}</view>
           <view class="flex-box flex-v-ce">
-            <view class="date flex-1">{{item.event_time}}</view>
-            <view class="redBox" a:if="{{item.point>0}}">奖分成功</view>
-            <view class="greenBox" a:else>扣分成功</view>
+            <view class="date flex-1">{{item.expire_time}}截止</view>
+            <block a:if="{{activeIndex==1}}">
+              <view class="yellowBox2" a:if="{{item.status==1}}">进行中</view>
+              <view class="greenBox" a:elif="{{item.status==2}}">已完成</view>
+              <view class="redBox" a:elif="{{item.status==3}}">退回</view>
+              <view class="greenBox" a:elif="{{item.status==4}}">已审批</view>
+              <view class="textBox" a:else>已撤回</view>
+            </block>
+            <block a:else>
+              <view class="yellowBox" a:if="{{item.status==1}}">待领取</view>
+              <view class="yellowBox2" a:elif="{{item.status==2}}">进行中</view>
+              <view class="greenBox" a:elif="{{item.status==3}}">已完成</view>
+              <view class="textBox" a:elif="{{item.status==4}}">已撤回</view>
+              <view class="redBox" a:else>已过期</view>
+            </block>
           </view>
         </view>
       </view>
@@ -38,12 +58,32 @@
     </scroll-view>
     <scroll-view class="scroll" a:if="{{activeIndex==3&&list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
       <view class="li2 border-bottom" data-index="2" a:for="{{list}}" catchTap="openDetail" data-item="{{item}}">
-          <view style="margin-bottom:10rpx;">排位吃饭</view>
-          <view class="flex-box flex-v-ce fontColorX" style="font-size:28rpx;">
-            <image mode="scaleToFill" src="../../../image/sj2.png"/>
-            <text>每天自动发布</text>
-            <text> 完成截止为1点</text>
-          </view>
+        <view style="margin-bottom:10rpx;">{{item.name}}</view>
+        <view class="flex-box flex-v-ce fontColorX" style="font-size:28rpx;">
+          <image mode="scaleToFill" src="../../../image/sj2.png"/>
+          <text a:if="{{item.task_cycle == 1}}">每天自动发布</text>
+          <text a:if="{{item.task_cycle == 2}}">
+            <text a:if="{{item.task_cycle_value == 1}}">每周一自动发布</text>
+            <text a:if="{{item.task_cycle_value == 2}}">每周二自动发布</text>
+            <text a:if="{{item.task_cycle_value == 3}}">每周三自动发布</text>
+            <text a:if="{{item.task_cycle_value == 4}}">每周四自动发布</text>
+            <text a:if="{{item.task_cycle_value == 5}}">每周五自动发布</text>
+            <text a:if="{{item.task_cycle_value == 6}}">每周六自动发布</text>
+            <text a:if="{{item.task_cycle_value == 7}}">每周日自动发布</text>
+          </text>
+          <text a:if="{{item.task_cycle == 3}}">每月自动发布</text>
+          <text a:if="{{item.task_cycle == 1}}"> 完成截止为{{item.task_cycle_value}}点</text>
+          <text a:if="{{item.task_cycle == 2}}"> 完成截止为
+            <text a:if="{{item.task_cycle_value == 1}}">周一</text>
+            <text a:if="{{item.task_cycle_value == 2}}">周二</text>
+            <text a:if="{{item.task_cycle_value == 3}}">周三</text>
+            <text a:if="{{item.task_cycle_value == 4}}">周四</text>
+            <text a:if="{{item.task_cycle_value == 5}}">周五</text>
+            <text a:if="{{item.task_cycle_value == 6}}">周六</text>
+            <text a:if="{{item.task_cycle_value == 7}}">周日</text>
+          </text>
+          <text a:if="{{item.task_cycle == 3}}"> 完成截止为次月{{item.task_cycle_value}}号</text>
+        </view>
       </view>
       <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
     </scroll-view>

+ 19 - 14
pages/statistics/my_issue/my_issue.js

@@ -16,7 +16,7 @@ Page({
       pt_id: 0,
       order_by: 'create_time',
     },
-    list:[1,2,3]
+    list: []
   },
   onLoad(e) {
     if (e.index) {
@@ -44,7 +44,6 @@ Page({
   },
   //选择筛选
   onConfirmSx(data) {
-    console.log(data);
     if (this.data.activeIndex == 1) {
       this.setData({
         sxObj: data,
@@ -61,17 +60,19 @@ Page({
         page: 1,
         parameter2: { //我指派的参数
           pt_id: data[0],//类型
-          order_by: data[3] == 'publish' ? 'create_time' : 'expire_time',
+          order_by: data[2] == 'publish' ? 'create_time' : 'expire_time',
         }
       })
     }
+    this.setData({list:[]})
     this.getData(this.data.activeIndex);
   },
   onShow() {
-    // if (this.data.page == 1) {
-    //   dd.hideLoading();
-    //   that.getData(that.data.activeIndex);
-    // }
+    if (this.data.page == 1) {
+      dd.hideLoading();
+      this.setData({list:[]})
+      that.getData(that.data.activeIndex);
+    }
   },
   onReset() {
     this.setData({
@@ -92,7 +93,7 @@ Page({
   },
 
   getData(index, is) {
-    var urlS = ['api/integral/work/list/publisher', 'api/integral/task/publish/list', 'integral/schedule/list'];
+    var urlS = ['api/integral/work/list/publisher', 'api/integral/task/publish/list', 'api/integral/schedule/list'];
     var data;
     if (index == 1) {
       var parameter1 = this.data.parameter1;
@@ -152,8 +153,8 @@ Page({
     this.setData({
       activeIndex: index,
       page: 1,
-      // list: [],
-      sxObj:[],
+      list: [],
+      sxObj: [],
       parameter1: { //我指派的参数
         pt_id: 0,//类型
         status: 'all',//状态
@@ -164,14 +165,18 @@ Page({
         order_by: 'create_time',
       }
     })
-    // this.getData(index);
+    this.getData(index);
   },
   openDetail(e) {
-    var id = e.target.dataset.item.id;
     var index = e.target.dataset.index;
-    if (index == '1') {
+    var id = e.target.dataset.item.id;
+    if (that.data.activeIndex == 1) {
+      dd.navigateTo({
+        url: '../workDetail/workDetail?id=' + id
+      })
+    } else if (that.data.activeIndex == 2) {
       dd.navigateTo({
-        url: '../prizeBuckleDetail/prizeBuckleDetail?id=' + id
+        url: '../taskDetail/taskDetail?id=' + id
       })
     } else {
       dd.navigateTo({

+ 30 - 13
pages/statistics/my_task/my_task.axml

@@ -12,31 +12,48 @@
   </view>
   <view class="main scroll">
     <scroll-view class="scroll" a:if="{{(activeIndex==1)&&list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
-      <view class="task">今日任务</view>
-      <view class="li border-bottom"  a:for="{{list}}">
+      <view class="task" a:if="{{toList.length>0}}">今日任务</view>
+      <view class="li border-bottom" a:for="{{toList}}" a:if="{{toList.length>0}}">
         <view class="flex-box li-top" catchTap="openDetail" data-item="{{item}}">
-          <view class="flex-1">临时任务1:帮我买瓶82年的雪碧(每天)我买瓶82年的雪碧(每天)我买瓶82年的雪碧(每天)</view>
-          <text class="fontColorX">50</text>
+          <view class="flex-1">{{item.task_name}}</view>
+          <text class="fontColorX">{{item.point_config.base_point}}</text>
         </view>
         <view class="flex-box li-bottom">
-          <text class="flex-1 fontColorX" catchTap="openDetail" data-item="{{item}}">2020-08-08 01:11 截止</text>
-          <button type="primary" class="defBtn" data-item="{{item}}" onTap="openPerform">完成任务</button>
+          <text class="flex-1 fontColorX" catchTap="openDetail" data-item="{{item}}">{{item.expire_time}} 截止</text>
+          <button type="primary" class="defBtn" a:if="{{item.status == 1}}" data-is="{{true}}" data-item="{{item}}" onTap="openPerform">完成任务</button>
+          <text class="yellowBox" a:if="{{item.status == 2}}">待审批</text>
+          <text class="redBox" a:if="{{item.review_status == 2}}">审批驳回</text>
+          <text class="greenBox" a:if="{{item.review_status == 1}}">审批通过</text>
         </view>
       </view>
       <view class="task">待完成任务</view>
+      <view class="li border-bottom" a:for="{{list}}">
+        <view class="flex-box li-top" catchTap="openDetail" data-item="{{item}}">
+          <view class="flex-1">{{item.task_name}}</view>
+          <text class="fontColorX">{{item.point_config.base_point}}</text>
+        </view>
+        <view class="flex-box li-bottom">
+          <text class="flex-1 fontColorX {{item.isCs? 'red':''}}" catchTap="openDetail" data-item="{{item}}">{{item.expire_time}} 截止</text>
+          <button type="primary" class="defBtn" a:if="{{item.status == 1}}" data-item="{{item}}" onTap="openPerform">完成任务</button>
+          <text class="yellowBox" a:if="{{item.status == 2}}">待审批</text>
+          <text class="redBox" a:if="{{item.status == 3}}">审批驳回</text>
+          <text class="greenBox" a:if="{{item.status == 4}}">审批通过</text>
+        </view>
+      </view>
       <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
     </scroll-view>
     <scroll-view class="scroll" a:if="{{(activeIndex==2||activeIndex==3)&&list.length>0}}" scroll-y="{{true}}" onScrollToLower="onScrollToLower">
-      <view class="li border-bottom"  a:for="{{list}}">
+      <view class="li border-bottom" a:for="{{list}}">
         <view class="flex-box li-top" catchTap="openDetail" data-item="{{item}}">
-          <view class="flex-1">临时任务1:帮我买瓶82年的雪碧(每天)我买瓶82年的雪碧(每天)我买瓶82年的雪碧(每天)</view>
-          <text class="fontColorX">50</text>
+          <view class="flex-1">{{item.task_name}}</view>
+          <text class="fontColorX">{{item.point_config.base_point}}</text>
         </view>
         <view class="flex-box li-bottom">
-          <text class="flex-1 fontColorX" catchTap="openDetail" data-item="{{item}}">2020-08-08 01:11 截止</text>
-          <text class="yellow">待处理</text>
-          <text class="red">已通过</text>
-          <text class="green">已驳回</text>
+          <text class="flex-1 fontColorX" catchTap="openDetail" data-item="{{item}}">{{item.expire_time}} 截止</text>
+          <button type="primary" class="defBtn" a:if="{{item.status == 1}}" data-item="{{item}}" onTap="openPerform">完成任务</button>
+          <text class="yellow" a:if="{{item.review_status == 0}}">待处理</text>
+          <text class="green" a:if="{{item.review_status == 1}}">已通过</text>
+          <text class="red" a:if="{{item.review_status == 2}}">已驳回</text>
         </view>
       </view>
       <view class="noDatas" a:if="{{isData}}">没有更多咯</view>

+ 59 - 84
pages/statistics/my_task/my_task.js

@@ -6,17 +6,14 @@ Page({
     date: app.globalData.month,
     activeIndex: 1,
     page: 1,
-    list: [1, 2, 3],
+    toList: [], // 放今天待完成
+    list: [],
     showZp: false,//显示sx选择
-    parameter1: { //我指派的参数
+    parameter: { //我指派的参数
       pt_id: 0,//类型
-      status: 'all',//状态
+      status: 'running',//状态
       sort: 'publish',//排序
     },
-    parameter2: { //我的悬赏
-      pt_id: 0,
-      order_by: 'create_time',
-    }
   },
   onLoad(e) {
     if (e.index) {
@@ -25,6 +22,8 @@ Page({
       })
     }
     that = this;
+    this.getToDay();
+    that.getData();
     dd.setNavigationBar({ title: "我的任务" });
   },
 
@@ -40,84 +39,41 @@ Page({
   },
   //选择筛选
   onConfirmSx(data) {
-    console.log(data);
-    if (this.data.activeIndex == 1) {
-      this.setData({
-        sxObj: data,
-        page: 1,
-        parameter1: { //我指派的参数
-          pt_id: data[0],//类型
-          status: data[1],//状态
-          sort: data[2],//排序
-        }
-      })
-    } else {
-      this.setData({
-        sxObj: data,
-        page: 1,
-        parameter2: { //我指派的参数
-          pt_id: data[0],//类型
-          order_by: data[3] == 'publish' ? 'create_time' : 'expire_time',
-        }
-      })
-    }
-    this.getData(this.data.activeIndex);
-  },
-  onShow() {
-    // if (this.data.page == 1) {
-    //   dd.hideLoading();
-    //   that.getData(that.data.activeIndex);
-    // }
-  },
-  onReset() {
     this.setData({
-      keyword: '',
-      isVal: false,
+      sxObj: data,
       page: 1,
+      parameter: { //我指派的参数
+        pt_id: data[0],//类型
+        status: this.data.parameter.status,
+        sort: data[2]
+      }
     })
-    this.getData(that.data.activeIndex);
+    this.getData(this.data.activeIndex);
   },
-
-  bindKeyInput(e) {
-    this.setData({
-      keyword: e.detail.value,
-      isVal: e.detail.value ? true : false,
-      page: 1,
+  //今天完成的任务
+  getToDay() {
+    app.$get('api/integral/work/list', { status: 'running', today: '1', page: '1', page_size: '50', sort: 'publish', source_type: 0, pt_id: 0 }).then((res) => {
+      this.setData({
+        toList: res.data.data.list
+      })
     })
-    this.getData(that.data.activeIndex);
   },
 
   getData(index, is) {
-    var urlS = ['api/integral/work/list/publisher', 'api/integral/task/publish/list', 'integral/schedule/list'];
-    var data;
-    if (index == 1) {
-      var parameter1 = this.data.parameter1;
-      data = {
-        page: that.data.page,
-        page_size: 20,
-        source_type: 1,
-        pt_id: parameter1.pt_id,//类型
-        status: parameter1.status,//状态
-        sort: parameter1.sort,//排序
-      }
-    } else if (index == 2) {
-      var parameter2 = this.data.parameter2;
-      data = {
-        page: that.data.page,
-        page_size: 20,
-        status: 'all',
-        source_type: 1,
-        pt_id: parameter2.pt_id,//类型
-        order_by: parameter2.order_by,//类型
-      }
-    } else {
-      data = {
-        page: that.data.page,
-        page_size: 20,
-      }
+    var parameter = this.data.parameter;
+    var data = {
+      page: that.data.page,
+      page_size: 20,
+      source_type: 0,//作来源种类 0-全部 1-直接指派(任务池领取以外的类型) 2-任务池领取 3-任务模板指派 4-每月绩效任务包
+      pt_id: parameter.pt_id,//类型
+      status: parameter.status,//工作状态 all-全部 running-进行中 complete-工作已完成 refuse-拒绝 reviewed-已审批 revocation-发布者撤回
+      sort: parameter.sort,//排序种类 expire-过期时间倒序 publish-指派时间倒序
     }
-    app.$get(urlS[index - 1], data).then((res) => {
+    app.$get('api/integral/work/list', data).then((res) => {
       var data = res.data.data.list;
+      data.forEach(item => {
+        item.isCs = item.expire_time < app.globalData.allDate;
+      })
       var list = that.data.list;
       data.forEach(element => {
         if (element.pt_id) {
@@ -145,29 +101,48 @@ Page({
   },
   activeItem(e) {
     var index = e.target.dataset.index;
+    var status = "";
+    if (index == 1) {
+      status = "running"
+    } else if (index == 2) {
+      status = "complete"
+    } else {
+      status = "reviewed"
+    }
     this.setData({
       activeIndex: index,
       page: 1,
-      // list: [],
+      list: [],
       sxObj: [],
-      parameter1: { //我指派的参数
+      parameter: {
         pt_id: 0,//类型
-        status: 'all',//状态
+        status: status,//状态
         sort: 'publish',//排序
-      },
-      parameter2: { //我的悬赏
-        pt_id: 0,
-        order_by: 'create_time',
       }
     })
-    // this.getData(index);
+    this.getData(index);
   },
   openPerform(e) {
     var id = e.target.dataset.item.id;
+    var is = e.target.dataset.is ? true : false
     dd.navigateTo({
-      url: '../openPerform/openPerform?id=' + id
+      url: '../openPerform/openPerform?id=' + id + '&is=' + is
     })
   },
+  //过滤List,通常用于删除了某条数据,刷新列表
+  filtrationList(index,id) {
+    if (index == 1) {
+      this.getToDay()
+    } else {
+      var list=this.data.list;
+      for (let i in list) {
+        if (list[i].id == id) {
+          list.splice(i, 1)
+        }
+      }
+      this.setData({ list:list})
+    }
+  },
   openDetail(e) {
     var id = e.target.dataset.item.id;
     dd.navigateTo({

+ 2 - 2
pages/statistics/offerAreward/offerAreward.axml

@@ -37,7 +37,7 @@
         <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
       </view>
       <view class="li">
-        <textarea maxlength="100" value="{{item.remark}}" onInput="bindTextAreaBlur" placeholder="请输入任务描述" data-index="{{index}}"></textarea>
+        <textarea maxlength="100" value="{{item.remark}}" onInput="bindTextAreaBlur2" placeholder="请输入任务描述" data-index="{{index}}"></textarea>
       </view>
       <view class="flex-box flex-v-ce li">
         <view class="label">重复周期</view>
@@ -71,6 +71,6 @@
   </view>
   <view class="box" animation="{{animationInfo}}">
     <select-section-bottom defaultSection="{{defaultSection}}" onClose="onClose" onConfirm="onSelectSection" a:if="{{isShowType=='1'}}"/>
-    <select-section-staff-two superior_list="{{superior_list}}" isLeadership="{{false}}" selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='2'}}"/>
+    <select-section-staff-two islead="{{true}}"  selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='2'}}"/>
   </view>
 </view>

+ 66 - 117
pages/statistics/offerAreward/offerAreward.js

@@ -4,23 +4,19 @@ var animation;
 Page({
   data: {
     items: {
-      targets: [],//工作执行者列表,以逗号分割的字符串或直接传入数组
+      dept_ids: [],//可见范围
       pt_id: 3,//积分种类id
       task_name: '',//任务名
       task_remark: '',//任务详细描述
       base_point: '',//任务参考积分
       expire_time: '',//截至时间 格式:2020-02-02 12:00
-      package_id: '',//绩效任务包id 绩效任务包发布工作时必须大于0,其余工作发布为0
-      weight: '',//绩效权重 绩效任务包发布工作时必须大于0,其余工作发布为0
       file_list: [],//附件地址列表
       reviewer_id: '',//审批者id
       revieweName: '',
       timeout_deduction_point: '',//逾期扣分/月
-      unqualified: '',//评分标准 不合格-分数
-      qualified: '',//
-      satisfied: '',//
-      super_satisfied: '',//
-      cate_id: '',// 共组分类id   
+      task_cycle: 0,
+      task_expire_day: 1,
+      task_type:1,
     },
     reviewerObj: [],//默认审批人
     objectArray: [
@@ -42,7 +38,7 @@ Page({
       },
     ],
     arrIndex: 0,
-    defaultSection:[],//选择的部门
+    defaultSection: [],//选择的部门
   },
   onLoad() {
     that = this;
@@ -54,6 +50,7 @@ Page({
   bindObjPickerChange(e) {
     this.setData({
       arrIndex: e.detail.value,
+      [`items.task_cycle`]: e.detail.value
     });
   },
   openType(e) {
@@ -101,10 +98,17 @@ Page({
     that.setData({ isShowType: '' });
   },
   //选择部门
-  onSelectSection(e){
-      this.setData({
-        defaultSection:e
+  onSelectSection(e) {
+    var arr = [];
+    if (e.length > 0) {
+      e.forEach(user => {
+        arr.push(user.id);
+      })
+      that.setData({
+        defaultSection: e,
+        [`items.dept_ids`]: arr
       })
+    }
   },
   //选择弹窗
   openSelect(e) {
@@ -215,124 +219,69 @@ Page({
 
   //备注输入
   bindTextAreaBlur: function (e) {
-    var index = e.target.dataset.index;
-    var remark = `items[${index}].remark`
     this.setData({
-      [remark]: e.detail.value,
+      [`items.task_name`]: e.detail.value,
+    });
+  },
+  //备注输入
+  bindTextAreaBlur2: function (e) {
+    this.setData({
+      [`items.task_remark`]: e.detail.value,
     });
   },
+
   showToast(text) {
     app.globalData.showToast(text);
   },
   formSubmit() {
     var items = this.data.items;
-    var arr = [];
-    var isTg = true;
-    var pt_id = app.getTypesItem(this.data.isGzType).id
-    if (userData.length == 0) {
-      this.showToast('请选择奖扣对象')
+    console.log(items);
+    if (!items.task_name) {
+      this.showToast('请输入任务内容')
       return;
     }
-    for (var i = 0; i < items.length; i++) {
-      var obj = {};
-      var item = items[i];
-      var num = item.checked ? item.point : item.point2
-      var point;
-      if (item.checked) {
-        if (item.isArrindex != true) {
-          point = 0 - num;
-        } else {
-          point = num;
-        }
-        if (point < item.selectRule.min_point || point > item.selectRule.max_point) {
-          this.showToast(`第${i + 1}条,积分分值超出可输入范围`);
-          isTg = false;
-        }
-      } else {
-        if (item.isArrindex2 != true) {
-          point = 0 - num;
-        } else {
-          point = num;
-        }
-      }
-      if (item.checked) {
-        if (!item.rule_id) {
-          this.showToast(`第${i + 1}条请选择规则`);
-          isTg = false;
-          break;
-        }
+    if (!items.base_point) {
+      this.showToast('请输入任务记分')
+      return;
+    }
+    if (!items.reviewer_id) {
+      this.showToast('请选择审批人')
+      return;
+    }
+    if (!items.expire_time) {
+      this.showToast('请选择截止时间')
+      return;
+    }
+    // items.file_list=JSON.stringify(items.file_list);
+    // items.targets=JSON.stringify(items.targets);
+    if(!items.task_remark){
+      delete items.task_remark
+    }
+    if(!items.timeout_deduction_point){
+      delete items.timeout_deduction_point
+    }
+    if(items.dept_ids.length==0){
+      delete items.dept_ids
+    }else{
+      items.dept_ids=items.dept_ids.toString();
+    }
+    items.file_list=items.file_list.toString();
+    this.setData({ disabled: true });
+        var url;
+    if (items.task_cycle == 0) {
+        url = '/api/integral/task/publish'
       } else {
-        if (!item.rule_id2) {
-          this.showToast(`第${i + 1}条请选择分类`);
-          isTg = false;
-          break;
-        }
-      }
-      if (point == 0 || !point) {
-        this.showToast(`第${i + 1}条积分分值不能为0或者为空`);
-        isTg = false;
-        break;
-      }
-
-      if (!item.remark) {
-        this.showToast(`第${i + 1}条事件内容不能为空`);
-        isTg = false;
-        break;
-      }
-      obj.rule_id = item.checked ? item.rule_id : item.rule_id2;
-      obj.item_id = item.checked ? item.item_id : 0;
-      obj.point = point;
-      obj.remark = item.remark;
-      obj.event_time = item.event_time;
-      obj.pt_id = pt_id;
-      obj.reviewer_id = item.reviewer_id ? item.reviewer_id : 0;
-      obj.files = item.files;
-      arr.push(obj);
+        url = '/api/integral/schedule/publish/task'
     }
-    var userIds = []
-    userData.map(item => {
-      userIds.push(item.id)
-    })
-    if (isTg) {
-      var data = {
-        members: JSON.stringify(userIds),
-        items: JSON.stringify(arr)
-      }
-      this.setData({ disabled: true });
-      var url = this.data.type == 'B' ? 'api/integral/point/entry' : 'api/integral/review/a/entry'
-      app.$post(url, data).then((res) => {
-        var is = true, msg;
-
-        if (this.data.type == 'B') {
-          res.data.data.list.forEach(item => {
-            if (item.status != 1) {
-              is = false;
-              msg = item.msg;
-            }
-          })
-        } else {
-          res.data.data.forEach(item => {
-            if (item.status != 1) {
-              is = false;
-              msg = item.rule_item;
-            }
-          })
-        }
-
-        if (is) {
-          this.showToast('提交成功');
-          setTimeout(() => {
-            this.setData({ disabled: false });
-            dd.navigateBack({ delta: 1 })
-          }, 1000);
-        } else {
+    app.$post(url,items).then((res) => {
+        this.showToast(res.data.msg);
+        setTimeout(() => {
           this.setData({ disabled: false });
-          this.showToast(msg);
-        }
-      }).catch(err => {
-        this.setData({ disabled: false });
-      })
-    }
+          dd.navigateBack({ delta: 1 })
+        }, 1000);
+    }).finally(err => {
+      this.setData({ disabled: false });
+    })
   },
   switchChange(e) {
     var index = e.target.dataset.index;

+ 173 - 0
pages/statistics/offerAreward_set/offerAreward_set.acss

@@ -0,0 +1,173 @@
+.form-top{
+  background-color: #fff;
+  padding:28rpx;
+  border-bottom: 1px solid #f1f1f1;
+}
+.form-top .flex-1{
+  text-align: right;
+  color: #969799;
+}
+.label{
+  position: relative;
+  width: 160rpx;
+  font-size: 32rpx
+}
+.isBt::before{
+  position: absolute;
+  content: "*";
+  color: #F56C6C;
+  left: -16rpx;
+}
+.inputs .li{
+  background-color: #fff;
+  padding:28rpx;
+  position: relative;
+}
+.li view:nth-child(2){
+  text-align: right;
+  color: #969799;
+}
+.title{
+  padding: 16rpx 28rpx;
+  font-size: 28rpx;
+}
+textarea{
+  padding-left: 10rpx;
+  padding-right: 0;
+  height: 150rpx;
+  position: relative;
+}
+.textarea::before{
+  position: absolute;
+  content: "*";
+  color: #F56C6C;
+  left: -16rpx;
+}
+.add{
+  background-color: #fff;
+  padding: 28rpx 28rpx;
+  color: #26A2FF;
+  margin: 28rpx 0;
+  margin-bottom: 40rpx; 
+}
+.addImg{
+  width: 50rpx;
+  height: 50rpx;
+  position: absolute;
+  bottom: 20rpx;
+  z-index: 998;
+}
+.rightImg{
+  width: 30rpx;
+  height: 30rpx;
+  margin-left: 10rpx;
+}
+.btn-area{
+  position: fixed;
+  background: #fff;
+  bottom: 0;
+  width: 100%;
+  border-top: 1px solid #f1f1f1;
+  padding: 10rpx;
+}
+.defBtn{
+  width: 90%;
+  margin: 0 auto;
+  border-radius: 10rpx;
+  height: 90rpx;
+  text-align: center;
+  line-height: 90rpx;
+}
+.showImg{
+  width: 160rpx;
+  height: 160rpx;
+  margin-bottom: 28rpx;
+  margin-right:40rpx; 
+  margin-top: 28rpx;
+}
+.detele{
+  color: #fff;
+  position: absolute;
+  height: 40rpx;
+  width: 40rpx;
+  border-radius: 100%;
+  background-color: #969799;
+  text-align: center;
+  line-height: 40rpx;
+  right: 10rpx;
+  top: 10rpx;
+}
+.box{
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0,0,0,0.2);
+  z-index: 999;
+  transform: translate(0,100%);
+}
+.inputs{
+  margin-bottom: 200rpx;
+}
+ .inputs .li .input_text{
+  text-align: left;
+  font-size: 24rpx;
+}
+.inputs .li input{
+  width: 100%;
+}
+.jiang{
+  border: 1px solid #f1f1f1;
+  border-radius: 4rpx;
+  width: 40rpx;
+  text-align: center
+}
+.picker-box{
+  width: 110rpx;
+  border-radius: 50rpx;
+  background-color: #f1f1f1;
+  position: relative;
+  height: 60rpx;
+}
+.picker-box text{
+ text-align: center;
+ line-height: 60rpx;
+ font-size: 24rpx;
+}
+.yuan{
+  width: 50rpx;
+  height: 50rpx;
+  background: #26A2FF;
+  border-radius: 100rpx;
+  position: absolute;
+  top: 5rpx;
+}
+.picker-left{
+  left: 5rpx;
+}
+.picker-right{
+  right: 5rpx;
+}
+.userList{
+  height: 40rpx;
+  font-size: 32rpx;
+}
+.van-radio {
+    position: relative;
+    display: inline-block;
+    text-align: center;
+    width: 1.28rem;
+    height: .48rem;
+    background: #f5f7fa;
+    border-radius: .28rem;
+    z-index: 1;
+    color: #222;
+    line-height: 0.48rem;
+    font-size: 0.24rem;
+    margin-left: 20rpx;
+}
+.isTypes{
+  background: #26A2FF;
+  color: #fff
+}

+ 76 - 0
pages/statistics/offerAreward_set/offerAreward_set.axml

@@ -0,0 +1,76 @@
+<view>
+  <view>
+    <view class="inputs">
+      <view class="li">
+        <textarea class="textarea" maxlength="100" value="{{items.task_name}}" onInput="bindTextAreaBlur" placeholder="请输入任务内容" data-index="{{index}}"></textarea>
+        <image mode="scaleToFill" src="../../../image/addImg.png" class="addImg" catchTap="openImg"/>
+      </view>
+      <view style="background:#fff;padding:0 28rpx;" a:if="{{items.file_list[0]}}" class="flex-box flex-v-ce">
+        <view a:for="{{items.file_list}}" key="index" a:for-item="imgs" a:for-index="imgIndex" style="position:relative">
+          <text class="detele" data-itemIndx="{{index}}" data-index="{{imgIndex}}" catchTap="deteleImg">×</text>
+          <image mode="scaleToFill" class="showImg" src="{{imgs}}" data-index="{{imgIndex}}" data-item="{{items.file_list}}" catchTap="showImg"/>
+        </view>
+      </view>
+      <view class="flex-box li margin-bottom" style="padding:15rpx 28rpx;margin-top:24rpx">
+        <view class="label isBt" style="position: relative;top:10rpx;">任务积分</view>
+        <text class="red" style="position: relative;top:10rpx;">+</text>
+        <view class="flex-1">
+          <input value="{{items.base_point}}" placeholder="0" type="number" onInput="bindKeyInput" class="flex-1"/>
+        </view>
+      </view>
+      <view class="flex-box flex-v-ce li" data-num="2" data-item="{{{id:items.reviewer_id,name:items.revieweName}}}" catchTap="openSelect">
+        <view class="label isBt">审批人</view>
+        <view class="flex-1">{{items.revieweName}}</view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view>
+      <view class="flex-box flex-v-ce li">
+        <view class="label isBt">任务类型</view>
+        <view class="flex-1 flex-box-end flex-flex-v-ce">
+          <view a:for="{{types}}">
+            <text a:if="{{item.code!=='JX'}}" catchTap="openType" data-id="{{item.id}}" class="van-radio {{items.pt_id==item.id? 'isTypes':''}}">{{item.name}}</text>
+          </view>
+        </view>
+      </view>
+      <view class="flex-box flex-v-ce li  margin-bottom" catchTap="openDate" data-index="{{index}}">
+        <view class="label isBt">截止时间</view>
+        <view class="flex-1">{{items.expire_time}}</view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view>
+      <view class="li">
+        <textarea maxlength="100" value="{{items.task_remark}}" onInput="bindTextAreaBlur2" placeholder="请输入任务描述" data-index="{{index}}"></textarea>
+      </view>
+      <!-- <view class="flex-box flex-v-ce li">
+        <view class="label">重复周期</view>
+        <view class="flex-1">
+          <picker onChange="bindObjPickerChange" value="{{arrIndex}}" range="{{objectArray}}" range-key="name">
+            <view class="row-extra">{{objectArray[arrIndex].name}}</view>
+          </picker>
+        </view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view> -->
+      <view class="flex-box li" style="padding:15rpx 28rpx;">
+        <view class="label" style="position: relative;top:10rpx;">逾期扣分</view>
+        <text class="green" style="position: relative;top:10rpx;">-</text>
+        <view class="flex-1">
+          <input value="{{items.timeout_deduction_point}}" placeholder="每逾期一天扣多少分" type="number" onInput="bindKeyInput2" class="flex-1"/>
+        </view>
+      </view>
+      <view class="flex-box flex-v-ce li" data-num="1" catchTap="openSelect">
+        <view class="label">可见范围</view>
+        <view class="flex-1 font-flex-word userList">
+          <block a:for="{{defaultSection}}">
+            <text style="font-size:32rpx">{{item.name}},</text>
+          </block>
+        </view>
+        <image mode="scaleToFill" src="../../../image/right.png" class="rightImg"/>
+      </view>
+    </view>
+    <view class="btn-area">
+      <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">确定修改</button>
+    </view>
+  </view>
+  <view class="box" animation="{{animationInfo}}">
+    <select-section-bottom defaultSection="{{defaultSection}}" onClose="onClose" onConfirm="onSelectSection" a:if="{{isShowType=='1'}}"/>
+    <select-section-staff-two islead="{{true}}"  selectUser="{{reviewerObj}}" onClose="onClose" onConfirm="onSelectUser2" a:if="{{isShowType=='2'}}"/>
+  </view>
+</view>

+ 340 - 0
pages/statistics/offerAreward_set/offerAreward_set.js

@@ -0,0 +1,340 @@
+var app = getApp()
+var that;
+var animation;
+Page({
+  data: {
+    items: {
+      dept_ids: [],//可见范围
+      pt_id: 3,//积分种类id
+      task_name: '',//任务名
+      task_remark: '',//任务详细描述
+      base_point: '',//任务参考积分
+      expire_time: '',//截至时间 格式:2020-02-02 12:00
+      file_list: [],//附件地址列表
+      reviewer_id: '',//审批者id
+      revieweName: '',
+      timeout_deduction_point: '',//逾期扣分/月
+      task_cycle: 0,
+      task_expire_day: 1,
+      task_type:1,
+    },
+    reviewerObj: [],//默认审批人
+    objectArray: [
+      {
+        id: 0,
+        name: '不重复',
+      },
+      {
+        id: 1,
+        name: '每天重复',
+      },
+      {
+        id: 2,
+        name: '每周重复',
+      },
+      {
+        id: 3,
+        name: '每月重复',
+      },
+    ],
+    arrIndex: 0,
+    defaultSection: [],//选择的部门
+  },
+  onLoad(e) {
+    that = this;
+    dd.setNavigationBar({ title: "悬赏任务编辑" });
+    if (e.item) {
+      var item = JSON.parse(e.item);
+      var arr=[];
+      if(item.department_info.length>0){
+        item.department_info.forEach(item=>{
+          arr.push(item.id);
+        })
+      }
+      this.setData({
+        reviewerObj:[{name:item.reviewer_name,id:item.reviewer_id}],
+        users:[{name:item.employee_name,id:item.employee_id}],
+        defaultSection:item.department_info,
+        items: {
+          dept_ids:arr,
+          id:item.id,
+          pt_id: item.pt_id,//积分种类id
+          task_name: item.task_name,//任务名
+          task_remark: item.task_remark,//任务详细描述
+          base_point: item.point_config.base_point,//任务参考积分
+          expire_time: item.expire_time,//截至时间 格式:2020-02-02 12:00
+          file_list: item.task_file_list,//附件地址列表
+          reviewer_id:item.reviewer_id,//审批者id
+          revieweName:item.reviewer_name,
+          timeout_deduction_point: item.point_config.timeout_deduction_point,//逾期扣分/月
+          task_cycle: 0,
+          task_expire_day: 1,
+          task_type:1,
+        },
+        types: app.globalData.types
+      })
+    }
+  },
+  bindObjPickerChange(e) {
+    this.setData({
+      arrIndex: e.detail.value,
+      [`items.task_cycle`]: e.detail.value
+    });
+  },
+  openType(e) {
+    var id = e.target.dataset.id;
+    that.setData({
+      [`items.pt_id`]: id
+    })
+  },
+  onShow() {
+    animation = dd.createAnimation({
+      duration: 200,
+      timeFunction: "linear",
+    });
+  },
+  //积分输入
+  bindKeyInput(e) {
+    var point = `items.base_point`;
+    this.setData({
+      [point]: e.detail.value,
+    });
+  },
+  //积分输入
+  bindKeyInput2(e) {
+    var point = `items.timeout_deduction_point`;
+    this.setData({
+      [point]: e.detail.value,
+    });
+  },
+
+  //显示图片
+  showImg(e) {
+    var index = e.target.dataset.index;
+    var item = e.target.dataset.item
+    dd.previewImage({
+      current: index,
+      urls: item
+    });
+  },
+  //关闭规则
+  onClose() {
+    animation.translateY(1200).step();
+    that.setData({
+      animationInfo: animation.export()
+    });
+    that.setData({ isShowType: '' });
+  },
+  //选择部门
+  onSelectSection(e) {
+    var arr = [];
+    if (e.length > 0) {
+      e.forEach(user => {
+        arr.push(user.id);
+      })
+      that.setData({
+        defaultSection: e,
+        [`items.dept_ids`]: arr
+      })
+    }
+  },
+  //选择弹窗
+  openSelect(e) {
+    var num = e.target.dataset.num;
+    if (e.target.dataset.item) {
+      if (e.target.dataset.item.id) {
+        that.setData({ reviewerObj: [e.target.dataset.item] });
+      } else {
+        that.setData({ reviewerObj: [] });
+      }
+    }
+    that.setData({
+      isShowType: num,
+    });
+    animation.translateY(0).step();
+    that.setData({
+      animationInfo: animation.export()
+    });
+  },
+  //删除图片
+  deteleImg(e) {
+    var index = e.target.dataset.index;//获取itemS集合中对应的files
+    var files = that.data.items.file_list;//获取itemS集合中对应的files
+    var files_box = `items.file_list`;//
+    app.globalData.arrRemoveObj(files, files[index]);
+    that.setData({
+      [files_box]: files
+    });
+
+  },
+  //图片选择
+  openImg(e) {
+    var files = that.data.items.file_list;
+    if (files.length >= 3) {
+      app.globalData.showToast("只能上传三张");
+      return false;
+    }
+    dd.chooseImage({
+      count: 1,
+      success: (res) => {
+        that.postImg(res.filePaths[0]);
+      },
+    });
+  },
+  postImg(img_url) {
+    var files_box = `items.file_list`;
+    var files = that.data.items.file_list;
+    dd.httpRequest({
+      url: app.globalData.imgHttpUrl,
+      method: 'POST',
+      data: {
+        md5: that.random_string(32),
+        'name': app.globalData.day
+      },
+      success: function (res) {
+        if (app.globalData.userData.site_id) {
+          var key = 'intesys/dd/' + app.globalData.userData.site_id + "/" + app.globalData.day + '/' + that.random_string(32) + '.png';
+        } else {
+          var key = 'intesys/dd/' + app.globalData.day + '/' + that.random_string(32) + '.png';
+        }
+        var obj = res.data.data;
+        dd.uploadFile({
+          url: app.globalData.ALIOSS_URL,
+          fileType: 'image',
+          fileName: 'file',
+          filePath: img_url,
+          formData: {
+            key: key,
+            policy: obj.policy,
+            OSSAccessKeyId: obj.accessid,
+            success_action_status: 200,
+            signature: obj.signature
+          },
+          success: (res) => {
+            if (res.statusCode == 200) {
+              if (files.length > 0) {
+                files.push('http://cdn.intesys.g107.com/' + key)
+              } else {
+                files = ['http://cdn.intesys.g107.com/' + key];
+              }
+              that.setData({
+                [files_box]: files
+              });
+              console.log(that.data.items);
+              app.globalData.showToast("已上传");
+            }
+          },
+          fail: (err) => {
+            console.log(err);
+          }
+        });
+      },
+      fail: function (res) {
+        app.globalData.showToast("上传失败");
+      }
+    })
+  },
+  random_string(len) {
+    len = len || 32
+    var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
+    var maxPos = chars.length
+    var pwd = ''
+    for (let i = 0; i < len; i++) {
+      pwd += chars.charAt(Math.floor(Math.random() * maxPos))
+    }
+    return pwd
+  },
+
+  //备注输入
+  bindTextAreaBlur: function (e) {
+    this.setData({
+      [`items.task_name`]: e.detail.value,
+    });
+  },
+  //备注输入
+  bindTextAreaBlur2: function (e) {
+    this.setData({
+      [`items.task_remark`]: e.detail.value,
+    });
+  },
+
+  showToast(text) {
+    app.globalData.showToast(text);
+  },
+  formSubmit() {
+    var items = this.data.items;
+    console.log(items);
+    if (!items.task_name) {
+      this.showToast('请输入任务内容')
+      return;
+    }
+    if (!items.base_point) {
+      this.showToast('请输入任务记分')
+      return;
+    }
+    if (!items.reviewer_id) {
+      this.showToast('请选择审批人')
+      return;
+    }
+    if (!items.expire_time) {
+      this.showToast('请选择截止时间')
+      return;
+    }
+     var page1 = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
+    if(!items.task_remark){
+      delete items.task_remark
+    }
+    if(!items.timeout_deduction_point){
+      delete items.timeout_deduction_point
+    }
+    if(items.dept_ids.length==0){
+      delete items.dept_ids
+    }else{
+      items.dept_ids=items.dept_ids.toString();
+    }
+    items.file_list=items.file_list.toString();
+    this.setData({ disabled: true });
+    app.$post('api/integral/task/update',items).then((res) => {
+        page1.getDetail(items.id,function(){
+            app.globalData.showToast(res.data.msg);
+            setTimeout(() => {
+              dd.navigateBack({ delta: 1 })
+            }, 1000);
+        })
+    }).finally(err => {
+      this.setData({ disabled: false });
+    })
+  },
+  switchChange(e) {
+    var index = e.target.dataset.index;
+    var item = `items[${index}].checked`;
+    that.setData({
+      [item]: e.detail.value
+    })
+  },
+  //选择时间
+  openDate(e) {
+    var item = `items.expire_time`
+    dd.datePicker({
+      format: 'yyyy-MM-dd HH:mm',
+      currentDate: that.data.items.expire_time,
+      success: (res) => {
+        that.setData({
+          [item]: res.date
+        })
+      },
+    });
+  },
+  //选择审批人
+  onSelectUser2(item) {
+    var elm = item.length > 0 ? item[0] : { id: '', name: '' };
+    var reviewer_id = `items.reviewer_id`
+    var revieweName = `items.revieweName`
+    that.setData({
+      [reviewer_id]: elm.id,
+      [revieweName]: elm.name,
+    });
+
+  },
+});
+

+ 6 - 0
pages/statistics/offerAreward_set/offerAreward_set.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "select-section-staff-two":"/Component/selectSectionStaff_tow/selectSectionStaff_tow",
+    "select-section-bottom":"/Component/selectSectionBottom/selectSectionBottom"
+  }
+}

+ 8 - 0
pages/statistics/openPerform/openPerform.acss

@@ -22,6 +22,13 @@ textarea{
   height: 200rpx;
   position: relative;
 }
+.showImg{
+  width: 160rpx;
+  height: 160rpx;
+  margin-bottom: 28rpx;
+  margin-right:40rpx; 
+  margin-top: 28rpx;
+}
 .detele{
   color: #fff;
   position: absolute;
@@ -34,6 +41,7 @@ textarea{
   right: 10rpx;
   top: 10rpx;
 }
+
 .addImg{
   width: 50rpx;
   height: 50rpx;

+ 4 - 4
pages/statistics/openPerform/openPerform.axml

@@ -2,13 +2,13 @@
   <view style="height:20rpx"></view>
   <view class="main">
     <view class="itme-li">
-      <textarea maxlength="100" value="{{item.remark}}" onInput="bindTextAreaBlur" placeholder="请输入备注(选填)" data-index="{{index}}"></textarea>
+      <textarea maxlength="100" value="{{items.remark}}" onInput="bindTextAreaBlur" placeholder="请输入备注(选填)" data-index="{{index}}"></textarea>
       <image mode="scaleToFill" src="../../../image/addImg.png" data-index="{{index}}" class="addImg" catchTap="openImg"/>
     </view>
-    <view style="background:#fff;padding:0 28rpx;" a:if="{{item.files[0]}}" class="flex-box flex-v-ce">
-      <view a:for="{{item.files}}" key="index" a:for-item="imgs" a:for-index="imgIndex" style="position:relative">
+    <view style="background:#fff;padding:0 28rpx;" a:if="{{items.files[0]}}" class="flex-box flex-v-ce">
+      <view a:for="{{items.files}}" key="index" a:for-item="imgs" a:for-index="imgIndex" style="position:relative">
         <text class="detele" data-itemIndx="{{index}}" data-index="{{imgIndex}}" catchTap="deteleImg">×</text>
-        <image mode="scaleToFill" class="showImg" src="{{imgs}}" data-index="{{imgIndex}}" data-item="{{item.files}}" catchTap="showImg"/>
+        <image mode="scaleToFill" class="showImg" src="{{imgs}}" data-index="{{imgIndex}}" data-item="{{items.files}}" catchTap="showImg"/>
       </view>
     </view>
   </view>

+ 56 - 20
pages/statistics/openPerform/openPerform.js

@@ -1,31 +1,68 @@
 var app = getApp();
 var that;
-var animation;
 Page({
   data: {
-    users: [],
-    item: {
-      remark: '',
-      id: ''
+    items: {
+      work_id: '',
+      state: 1,
+      files: [],
+      remark: ''
     },
-    defaultVal: '',
+    id: '',
+    is: false,//是不是今日任务
   },
-  onLoad() {
+  onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "完成任务" });
+    if (e.id) {
+      this.setData({
+        id: e.id,
+        is: e.is,
+        [`items.work_id`]: e.id,
+      })
+    }
+  },
+  //备注输入
+  bindTextAreaBlur: function (e) {
+    var remark = `items.remark`
+    this.setData({
+      [remark]: e.detail.value,
+    });
   },
   formSubmit() {
-    var page1 = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
-    console.log(page1)
-    dd.navigateBack({
-      delta: 1
+    var page = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
+    var data = this.data.items;
+    data.files = data.files.toString();
+    this.setData({ disabled: true })
+    app.$post('api/integral/work', data).then(res => {
+      app.globalData.showToast(res.data.msg);
+      if (this.data.is == 'true') {
+        page.filtrationList(1);
+        setTimeout(() => {
+          dd.navigateBack({ delta: 1 })
+        }, 1000);
+      } else if (this.data.is == 'false') {
+        page.filtrationList(2, data.work_id);
+        setTimeout(() => {
+          dd.navigateBack({ delta: 1 })
+        }, 1000);
+      } else if (this.data.is == "detail") {
+        page.getDetail(this.data.id, function () {
+          setTimeout(() => {
+            dd.navigateBack({ delta: 1 })
+          }, 1000);
+        })
+      }
+    }).finally(e => {
+      this.setData({ disabled: false })
     })
+
   },
   //删除图片
   deteleImg(e) {
-    var { itemIndx, index } = e.target.dataset;
-    var files = that.data.items[itemIndx].files;//获取itemS集合中对应的files
-    var files_box = `items[${itemIndx}].files`;//
+    var index = e.target.dataset.index;
+    var files = that.data.items.files;//获取itemS集合中对应的files
+    var files_box = `items.files`;//
     app.globalData.arrRemoveObj(files, files[index]);
     that.setData({
       [files_box]: files
@@ -34,8 +71,7 @@ Page({
   },
   //图片选择
   openImg(e) {
-    var index2 = e.target.dataset.index;
-    var files = that.data.items[index2].files;
+    var files = that.data.items.files;
     if (files.length >= 3) {
       app.globalData.showToast("只能上传三张");
       return false;
@@ -43,13 +79,13 @@ Page({
     dd.chooseImage({
       count: 1,
       success: (res) => {
-        that.postImg(res.filePaths[0], index2);
+        that.postImg(res.filePaths[0]);
       },
     });
   },
-  postImg(img_url, index) {
-    var files_box = `items[${index}].files`;
-    var files = this.data.items[index].files;
+  postImg(img_url) {
+    var files_box = `items.files`;
+    var files = this.data.items.files;
     dd.httpRequest({
       url: app.globalData.imgHttpUrl,
       method: 'POST',

+ 1 - 0
pages/statistics/prizeBuckleDetail/prizeBuckleDetail.js

@@ -9,6 +9,7 @@ Page({
   onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "事件详情" });
+    console.log()
     if(e.id){
         that.getDetail(e.id);
     }

+ 68 - 13
pages/statistics/recordOne/recordOne.js

@@ -3,23 +3,78 @@ var that;
 var animation;
 Page({
   data: {
-    users:[],
-    item:{
-        remark:'',
-        id:''
+    defaultVal: '',
+    process: {
+      recorder_id: app.globalData.userData.id,
+      recorder: app.globalData.userData.name,
+      remark: '',
+      point: 0,
+      img_url: app.globalData.userData.img_url,
+      time: app.globalData.allDate
     },
-    defaultVal:'',
+    items:[],
+    id:'',
+    isArrindex:true,//正还是负
   },
-  onLoad() {
+  onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "任务过程" });
+    console.log(e.id,JSON.parse(e.item));
+    if(e.id){
+      this.setData({
+        id:e.id,
+        items:JSON.parse(e.item),
+        process: {
+          recorder_id: app.globalData.userData.id,
+          recorder: app.globalData.userData.name,
+          remark: '',
+          point: 0,
+          img_url: app.globalData.userData.img_url,
+          time: app.globalData.allDate
+        },
+      })
+    }
   },
-  formSubmit(){
-    var page1=getCurrentPages()[getCurrentPages().length-2]//上一个页面的数据
-    
-    console.log(page1)
-    dd.navigateBack({
-      delta: 1
+    //备注输入
+  bindTextAreaBlur: function (e) {
+    this.setData({
+      [`process.remark`]: e.detail.value,
+    });
+  },
+  bindKeyInput(e) {
+    this.setData({
+      [`process.point`]: e.detail.value,
+    });
+  },
+  formSubmit() {
+    var page1 = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
+    if(this.data.process.point==0||!this.data.process.point){
+          app.globalData.showToast("请输入记分");
+          return;
+    }
+    var data={
+      work_id:this.data.id,
+      process:[]
+    }
+    var items=this.data.items;
+    var process=this.data.process;
+    this.data.isArrindex === false ? process.point = process.point * -1 : process.point = process.point * 1
+    items.unshift(process)
+    data.process=JSON.stringify(items);
+    app.$post("api/integral/work", data).then((res) => {
+        page1.getDetail(this.data.id,function(){
+            app.globalData.showToast(res.data.msg);
+            setTimeout(() => {
+              dd.navigateBack({ delta: 1 })
+            }, 1000);
+        })
     })
-  }
+    console.log(page1)
+  },
+  //选择奖还是扣(细则)
+  bindPickerChange() {
+    this.setData({
+      isArrindex: !this.data.isArrindex,
+    });
+  },
 });

+ 11 - 0
pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail.acss

@@ -56,6 +56,17 @@
   height: 90rpx;
   margin: 0 10rpx;
 }
+.btn-area{
+  margin-top: 1.5rem
+}
+.defBtn2{
+  width: 90%;
+  margin: 0 auto;
+  border-radius: 10rpx;
+  height: 90rpx;
+  text-align: center;
+  line-height: 90rpx;
+}
 
 .main-item{
   background: #fff;

+ 38 - 44
pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail.axml

@@ -1,66 +1,60 @@
 <view>
   <view class="header margin-bottom">
-    <view class="header-top flex-box flex-v-ce  margin-bottom">
-      <view class="flex-box flex-v-ce flex-1 ">
-        <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
-        <view class="top-left">
-          <view class="name">郭家裕悬赏的A分任务</view>
-          <view class="yellow">已过期</view>
-        </view>
-      </view>
-      <view class="name">10</view>
-    </view>
     <view class="header-main">
-      <view class="margin-bottom">排位吃饭</view>
-      <view class="flex-box flex-v-ce">
+      <view class="flex-box ">
+        <view class="laber">任务内容</view>
+        <view class="flex-1">{{dataDetail.name}}</view>
+      </view>
+      <view class="flex-box flex-v-ce" a:if="{{dataDetail.remark}}">
         <view class="laber">任务描述</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.remark}}</view>
       </view>
       <view class="flex-box flex-v-ce">
-        <view class="laber">任务记分</view>
-        <view class="flex-1">积分申请</view>
+        <view class="laber">任务类型</view>
+        <view class="flex-1">{{dataDetail.pt_name}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">逾期扣分</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.point_config.timeout_deduction_point}}分/天</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">执行周期</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.task_cycle_mark}}</view>
       </view>
-      <view class="flex-box">
-        <view class="laber">任务图片</view>
+      <view class="flex-box flex-v-ce" a:if="{{dataDetail.department_info.length>0}}">
+        <view class="laber">可见范围</view>
+        <view class="flex-1">
+          <text a:for="{{dataDetail.department_info}}">{{item.name}},</text>
+        </view>
+      </view>
+      <view class="flex-box" a:if="{{dataDetail.file_list.length>0}}">
+        <view class="laber">任务附件</view>
         <view class="flex-1 flex-box flex-v-ce imgs">
-          <image mode="scaleToFill" data-index="{{imgIndex}}" data-item="{{item.files}}" src="../../../image/start1.png" catchTap="showImg"/>
-          <image mode="scaleToFill" src="../../../image/start1.png"/>
-          <image mode="scaleToFill" src="../../../image/start1.png"/>
+          <image mode="scaleToFill" data-index="{{index}}" a:for="{{dataDetail.file_list}}" data-item="{{dataDetail.file_list}}" src="{{item}}" catchTap="showImg"/>
         </view>
       </view>
     </view>
-  </view>
-  <view class="main">
-    <view class="margin-top main-item">
-      <view class="margin-bottom">审批者</view>
-      <view class="flex-box">
-        <view class="flex-box-v flex-center-center img-item" a:for="{{[1,2,3]}}">
-          <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
-          <text>城建</text>
+    <view class="main">
+      <view class="margin-top main-item">
+        <view class="margin-bottom">审批者</view>
+        <view class="flex-box">
+          <view class="flex-box-v flex-center-center img-item">
+            <img-box name="{{dataDetail.owner_name}}" imgUrl="{{dataDetail.img_url}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+            <text>{{dataDetail.owner_name}}</text>
+          </view>
         </view>
       </view>
-    </view>
-    <view class="margin-top main-item">
-      <view class="margin-bottom">执行者</view>
-      <view class="flex-box">
-        <view class="flex-box-v flex-center-center img-item" a:for="{{[1,2,3]}}">
-          <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
-          <text>城建</text>
+      <view class="margin-top main-item" >
+        <view class="margin-bottom">执行者</view>
+        <view class="flex-box">
+          <view class="flex-box-v flex-center-center img-item" a:for="{{dataDetail.target_info}}">
+            <img-box name="{{item.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+            <text>{{item.name}}</text>
+          </view>
         </view>
       </view>
     </view>
-  </view>
-  <view class="pop-up">
-    <picker onChange="bindPickerChange" value="{{index}}" range="{{array}}">
-      <image class="img" mode="scaleToFill" src="../../../image/Bj.png"/>
-    </picker>
-  </view>
-</view>
+    <view class="btn-area">
+      <button type="warn" loading="{{disabled}}" class="defBtn2" disabled="{{disabled}}" catchTap="formSubmit">删除重复任务</button>
+    </view>
+  </view>

+ 18 - 18
pages/statistics/repetitive_tasks_detail/repetitive_tasks_detail.js

@@ -5,12 +5,17 @@ Page({
   data: {
     date: app.globalData.month,
     activeIndex: 1,
-    array: ['删除任务'],
+    id: '',
   },
   onLoad(e) {
     that = this;
-    dd.setNavigationBar({ title: "任务详情" });
-    // that.getDetail(e.event_id);
+    dd.setNavigationBar({ title: "重复任务详情" });
+    if (e.id) {
+      that.getDetail(e.id);
+      this.setData({
+        id: e.id,
+      })
+    }
   },
   //显示图片
   showImg(e) {
@@ -21,7 +26,7 @@ Page({
       urls: item
     });
   },
-  bindPickerChange(e) {
+  formSubmit() {
     dd.confirm({
       title: '删除任务',
       content: '删除此任务将会删除其相关记录和积分数据,确认删除吗?',
@@ -29,7 +34,12 @@ Page({
       cancelButtonText: '取消',
       success: (result) => {
         if (result.confirm) {
-
+          app.$get('api/integral/schedule/delete', { schedule_id: this.data.id }).then(res => {
+            app.globalData.showToast(res.data.msg);
+            setTimeout(() => {
+              dd.navigateBack({ delta: 1 })
+            }, 1000);
+          })
         }
       },
     });
@@ -43,21 +53,11 @@ Page({
       urls: item
     });
   },
-  activeItem(e) {
-    var index = e.target.dataset.index;
-    this.setData({ activeIndex: index })
-  },
-  openSearch() {
-    app.globalData.showToast("暂不支持筛选");
-  },
   getDetail(id) {
-    app.$get("api/integral/statistics/integral/info", { event_id: 533 }).then((res) => {
+    app.$get("api/integral/schedule", { schedule_id: id }).then((res) => {
+      var data=res.data.data;
+      data.img_url=app.globalData.userData.img_url;
       this.setData({ dataDetail: res.data.data })
     })
   },
-  openSchedule() {
-    dd.navigateTo({
-      url: '../schedule/schedule'
-    })
-  },
 });

+ 2 - 2
pages/statistics/schedule/schedule.axml

@@ -5,8 +5,8 @@
       <view class="title">任务进度</view>
     </view>
     <view class="slider">
-      <slider value="33" onChange="slider4change" min="25" max="50"></slider>
-      <view style="font-size: 0.28rem; padding-top: 0.24rem;">已完成0%</view>
+      <slider value="{{items.progress}}" onChange="slider4change" min="0" max="100" show-value></slider>
+      <view style="font-size: 0.28rem; padding-top: 0.24rem;">已完成{{items.progress}}%</view>
     </view>
   </view>
   <view class="btn-area" style="margin-top:28rpx;">

+ 30 - 14
pages/statistics/schedule/schedule.js

@@ -1,25 +1,41 @@
 var app = getApp();
 var that;
-var animation;
 Page({
   data: {
-    users:[],
-    item:{
-        remark:'',
-        id:''
+    items:{
+        work_id:'',
+        progress:''
     },
-    defaultVal:'',
   },
-  onLoad() {
+  onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "更新进度" });
+    if (e.id) {
+      this.setData({
+        [`items.work_id`]:e.id,
+        [`items.progress`]:e.progress
+      })
+    }
   },
-  formSubmit(){
-    var page1=getCurrentPages()[getCurrentPages().length-2]//上一个页面的数据
-    
-    console.log(page1)
-    dd.navigateBack({
-      delta: 1
+  slider4change(e){
+    this.setData({
+        [`items.progress`]:e.detail.value
     })
-  }
+  },
+  formSubmit() {
+    var page = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
+    var data=this.data.items;
+    this.setData({disabled:true})
+    app.$post('api/integral/work',data).then(res => {
+      page.getDetail(data.work_id,function(){
+        app.globalData.showToast(res.data.msg);
+        setTimeout(() => {
+          dd.navigateBack({ delta: 1 })
+        }, 1000);
+      })
+    }).finally(e=>{
+       this.setData({disabled:false})
+    })
+
+  },
 });

+ 18 - 1
pages/statistics/taskDetail/taskDetail.acss

@@ -43,7 +43,8 @@
 
 .name {
   font-weight: 700;
-  color: #222
+  color: #222;
+   max-width: 4.5rem;
 }
 .img{
   width: 40rpx;
@@ -51,3 +52,19 @@
   position: relative;
   top: 10rpx;
 }
+.defBtn{
+  width: 90%;
+  margin: 0 auto;
+  border-radius: 10rpx;
+  height: 90rpx;
+  text-align: center;
+  line-height: 90rpx;
+}
+.imgs image{
+  width: 90rpx;
+  height: 90rpx;
+  margin: 0 10rpx;
+}
+.btn-area{
+  margin-top: 1.5rem;
+}

+ 33 - 12
pages/statistics/taskDetail/taskDetail.axml

@@ -2,40 +2,61 @@
   <view class="header margin-bottom">
     <view class="header-top flex-box flex-v-ce  margin-bottom">
       <view class="flex-box flex-v-ce flex-1 ">
-        <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+        <img-box name="{{dataDetail.receiver_name}}" a:if="{{dataDetail.receiver_id!=0}}" imgUrl="{{dataDetail.receiver_img_url}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+        <img-box name="{{dataDetail.owner_name}}" a:if="{{dataDetail.receiver_id==0}}" imgUrl="{{dataDetail.owner_img_url}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
         <view class="top-left">
-          <view class="name">郭家裕悬赏的A分任务</view>
-          <view class="yellow">已过期</view>
+          <view class="name font-flex-word" a:if="{{dataDetail.status == 1 || dataDetail.status == -1 || dataDetail.receiver_id ==0 &&dataDetail.status == 4}}">{{dataDetail.owner_name}}悬赏的{{dataDetail.pt_name}}任务</view>
+          <view class="name font-flex-word" a:if="{{dataDetail.status == 2 || dataDetail.status == 3 || dataDetail.receiver_id !=0 && dataDetail.status == 4}}">{{dataDetail.receiver_name}}的{{dataDetail.pt_name}}任务</view>
+          <view class="yellow" a:if="{{dataDetail.status==1}}">待领取</view>
+          <view class="yellow2" a:elif="{{dataDetail.status==2}}">进行中</view>
+          <view class="green" a:elif="{{dataDetail.status==3}}">已完成</view>
+          <view class="red" a:elif="{{dataDetail.status==4}}">已撤回</view>
+          <view class="red" a:else>已过期</view>
         </view>
       </view>
-       <view class="name">10</view>
+      <view class="name">{{dataDetail.point_config.base_point}}</view>
     </view>
     <view class="header-main">
       <view class="flex-box flex-v-ce">
         <view class="laber">任务内容</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.task_name}}</view>
       </view>
-      <view class="flex-box flex-v-ce">
+      <view class="flex-box flex-v-ce" a:if="{{dataDetail.task_remark}}">
         <view class="laber">任务描述</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.task_remark}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">任务类型</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.pt_name}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">截止时间</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.expire_time}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">逾期扣分</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.point_config.timeout_deduction_point}}分/天</view>
+      </view>
+      <view class="flex-box flex-v-ce" a:if="{{dataDetail.department_info.length>0}}">
+        <view class="laber">可见范围</view>
+        <view class="flex-1">
+            <text a:for="{{dataDetail.department_info}}">{{item.name}},</text>
+        </view>
       </view>
+      <view class="flex-box" a:if="{{dataDetail.task_file_list.length>0}}">
+        <view class="laber">任务图片</view>
+        <view class="flex-1 flex-box flex-v-ce imgs">
+          <image mode="scaleToFill" data-index="{{index}}" a:for="{{dataDetail.task_file_list}}" data-item="{{dataDetail.task_file_list}}" src="{{item}}" catchTap="showImg"/>
+        </view>
+      </view>
+    </view>
+    <view class="btn-area" a:if="{{dataDetail.status == '1' && userId != dataDetail.owner_id && dataDetail.reviewer_id != userId}}">
+      <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">领取任务</button>
     </view>
   </view>
-  <view class="pop-up">
+  <view class="pop-up" a:if="{{isPublisher}}">
     <picker onChange="bindPickerChange" value="{{index}}" range="{{array}}">
       <image class="img" mode="scaleToFill" src="../../../image/Bj.png"/>
-    </picker>    
+    </picker>
   </view>
 </view>

+ 46 - 9
pages/statistics/taskDetail/taskDetail.js

@@ -6,15 +6,23 @@ Page({
     date: app.globalData.month,
     activeIndex: 1,
     array: ['编辑任务', '删除任务'],
+    isPublisher: true,//是不是发布者
+    userId: '',
+    id: '',
   },
   onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "任务详情" });
-    // that.getDetail(e.event_id);
+    if (e.id) {
+      that.getDetail(e.id);
+      this.setData({
+        id: e.id,
+        userId: app.globalData.userData.id
+      })
+    }
   },
   bindPickerChange(e) {
-    console.log(e.detail.value,this.data.array.length)
-    if ((e.detail.value + 1) == this.data.array.length) {
+    if (this.data.array[e.detail.value] == '删除任务') {
       dd.confirm({
         title: '删除任务',
         content: '删除此任务将会删除其相关记录和积分数据,确认删除吗?',
@@ -22,16 +30,30 @@ Page({
         cancelButtonText: '取消',
         success: (result) => {
           if (result.confirm) {
-
+            app.$get("api/integral/task/delete", { task_id: this.data.id }).then((res) => {
+              app.globalData.showToast(res.data.msg);
+              setTimeout(() => {
+                dd.navigateBack({ delta: 1 })
+              }, 1000);
+            })
           }
         },
       });
-    } else {
+    } else if (this.data.array[e.detail.value] == '编辑任务') {//编辑任务
       dd.navigateTo({
-        url: '../schedule/schedule'
+        url: '../offerAreward_set/offerAreward_set?item=' + JSON.stringify(this.data.dataDetail)
       })
     }
   },
+  //领取任务
+  formSubmit() {
+    app.$post("api/integral/task", { task_id: this.data.dataDetail.id }).then((res) => {
+      app.globalData.showToast('已领取');
+      setTimeout(() => {
+        dd.navigateBack({ delta: 1 })
+      }, 1000);
+    })
+  },
   //显示图片
   showImg(e) {
     var index = e.target.dataset.index;
@@ -48,9 +70,24 @@ Page({
   openSearch() {
     app.globalData.showToast("暂不支持筛选");
   },
-  getDetail(id) {
-    app.$get("api/integral/statistics/integral/info", { event_id: 533 }).then((res) => {
-      this.setData({ dataDetail: res.data.data })
+  getDetail(id, func = function () { }) {
+    app.$get("api/integral/task", { task_id: id }).then((res) => {
+      func();
+      var data = res.data.data;
+      data.pt_name = app.getTypesItem(data.pt_id).name;
+      if (data.status == 1 && data.status_mark == '待领取') {
+        this.setData({
+          array: ['编辑任务', '删除任务'],
+        })
+      } else {
+        this.setData({
+          array: ['删除任务'],
+        })
+      }
+      this.setData({
+        dataDetail: data,
+        isPublisher: data.owner_id == this.data.userId ? true : false
+      })
     })
   },
   openSchedule() {

+ 44 - 5
pages/statistics/workDetail/workDetail.acss

@@ -15,7 +15,7 @@
 }
 .header-main .laber{
   color: #909399;
-  width: 140rpx;
+  width: 180rpx;
 }
 .header-main .flex-box{
  padding: 10rpx 0;
@@ -24,9 +24,11 @@
 .top-left{
   margin-left: 16rpx;
 }
+.name{
+   margin-bottom: 10rpx
+}
 .top-left view:nth-child(2){
   color: rgb(144, 147, 153);
-  margin-top: 10rpx
 }
 .top-right{
   margin-left: 16rpx;
@@ -45,11 +47,22 @@
   font-weight: 600
 }
 .slider{
-   padding:0 .24rem ;
+   margin:0 .24rem ;
    padding-top: 0;
    padding-bottom: 0.5rem;
+   position: relative;
+}
+.slider slider{
+  padding: 0 0.3rem
+}
+.slider slider::after{
+  content: "%";
+  position: absolute;
+  color: #909399;
+  height: 20rpx;
+  right: -10rpx;
+  top: 0rpx;
 }
-
 .selectItems{
      background: #fff;
      text-align: center;
@@ -109,9 +122,35 @@
   height: 90rpx;
   margin: 0 10rpx;
 }
-.img{
+.img2{
   width: 40rpx;
   height: 40rpx;
   position: relative;
   top: 10rpx;
+}
+.noTask{
+  padding: 0.5rem 0;
+  color: #909399
+}
+.noTask image{
+  width: 1.5rem;
+  height: 1.5rem;
+  margin-bottom: 20rpx;
+}
+.btn-area{
+  position: fixed;
+  z-index: 2;
+  bottom: 0;
+  border-top: 1px solid #f1f1f1;
+  padding: 10rpx;
+  width: 100%;
+  background: #fff;
+}
+.defBtn{
+  width: 90%;
+  margin: 0 auto;
+  border-radius: 10rpx;
+  height: 90rpx;
+  text-align: center;
+  line-height: 90rpx;
 }

+ 61 - 47
pages/statistics/workDetail/workDetail.axml

@@ -2,56 +2,55 @@
   <view class="header margin-bottom">
     <view class="header-top flex-box flex-v-ce  margin-bottom">
       <view class="flex-box flex-v-ce flex-1 ">
-        <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+        <img-box name="{{dataDetail.employee_name}}" imgUrl="{{dataDetail.img_url}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
         <view class="top-left">
-          <view class="name">吴俊逸</view>
-          <view>产品运营部</view>
+          <view class="name">{{dataDetail.employee_name}}</view>
+          <view a:if="{{dataDetail.dept_list[0]}}">{{dataDetail.dept_list[0].dept_name}}</view>
+          <view a:else>暂无部门</view>
         </view>
       </view>
       <view class="top-right">
-        <view>10</view>
-        <view>B分</view>
+        <view>{{dataDetail.point_config.base_point}}</view>
+        <view>{{dataDetail.pt_name}}</view>
       </view>
       <view class="top-right">
-        <view>0</view>
+        <view>{{dataDetail.point_config.timeout_deduction_point}}</view>
         <view>最终分</view>
       </view>
     </view>
     <view class="header-main">
       <view class="flex-box flex-v-ce">
         <view class="laber">工作内容</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.task_name}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">截止时间</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.expire_time}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">逾期扣分</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.point_config.timeout_deduction_point}}分/天</view>
       </view>
-      <view class="flex-box flex-v-ce">
+      <view class="flex-box flex-v-ce" a:if="{{dataDetail.task_remark}}">
         <view class="laber">任务备注</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.task_remark}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">审批人</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.reviewer_name}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">发布人</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.publisher_name}}</view>
       </view>
       <view class="flex-box flex-v-ce">
         <view class="laber">积分种类</view>
-        <view class="flex-1">积分申请</view>
+        <view class="flex-1">{{dataDetail.pt_name}}</view>
       </view>
-      <view class="flex-box">
+      <view class="flex-box" a:if="{{dataDetail.task_file_list.length>0}}">
         <view class="laber">任务图片</view>
         <view class="flex-1 flex-box flex-v-ce imgs">
-            <image mode="scaleToFill"  data-index="{{imgIndex}}" data-item="{{item.files}}" src="../../../image/start1.png" catchTap="showImg"/>
-            <image mode="scaleToFill" src="../../../image/start1.png"/>
-            <image mode="scaleToFill" src="../../../image/start1.png"/>
+          <image mode="scaleToFill" data-index="{{index}}" a:for="{{dataDetail.task_file_list}}" data-item="{{dataDetail.task_file_list}}" src="{{item}}" catchTap="showImg"/>
         </view>
       </view>
     </view>
@@ -59,10 +58,10 @@
   <view class="main border-bottom">
     <view class="flex-box flex-v-ce titles">
       <view class="title flex-1">任务进度</view>
-      <view class="blue" style="font-size:28rpx" catchTap="openSchedule">更新进度</view>
+      <view class="blue" style="font-size:28rpx" catchTap="openSchedule" a:if="{{dataDetail.employee_id ==userId  && dataDetail.status == 1 && dataDetail.progress != 100}}">更新进度</view>
     </view>
     <view class="slider">
-      <slider value="33" onChange="slider4change" min="25" max="50"></slider>
+      <slider value="{{dataDetail.progress}}" disabled="true" onChange="slider4change" min="0" max="100" show-value></slider>
     </view>
   </view>
   <view class="footer">
@@ -70,49 +69,64 @@
       <view data-index="1" class="{{activeIndex == 1? 'active':''}} flex-1" catchTap="activeItem">任务过程</view>
       <view data-index="2" class="{{activeIndex == 2? 'active':''}} flex-1" catchTap="activeItem">记分记录</view>
       <view a:if="{{activeIndex == 1}}" class="flex-box-end flex-2 blue ji">
-        <text style="padding-right:24rpx">+记一条</text>
+        <text style="padding-right:24rpx" catchTap="openJyt" a:if="{{dataDetail.employee_id == userId && (dataDetail.status < 3)}}">+记一条</text>
       </view>
       <view a:if="{{activeIndex == 2}}" class="flex-box-end flex-2 blue ji">
-        <text style="padding-right:24rpx">记分</text>
+        <text style="padding-right:24rpx" catchTap="openJf"  a:if="{{(dataDetail.employee_id != userId) && (dataDetail.status < 3)}}">记分</text>
       </view>
     </view>
-    <view a:if="{{activeIndex == 1}}">
-      <view class="flex-box gc_item">
-        <view class="flex-box  flex-1">
-          <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
-          <view class="top-left">
-            <view class="flex-box">
-              <view class="fontColorX flex-1">吴俊逸</view>
-              <view style="font-size:28rpx">2021-01-08 18:11</view>
+    <view a:if="{{activeIndex == 1}}" style="margin-bottom:0.8rem">
+      <view class="flex-box gc_item" a:for="{{process}}" a:if="{{item.recorder_id==dataDetail.employee_id}}">
+          <view class="flex-box  flex-1">
+            <img-box name="{{item.recorder}}" imgUrl="{{item.img_url}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+            <view class="top-left flex-1">
+              <view class="flex-box flex-v-ce">
+                <view class="fontColorX flex-1">{{item.recorder}}</view>
+                <view style="font-size:28rpx">{{item.time}}</view>
+              </view>
+              <view style="color:#222;margin-right:80rpx;">{{item.remark}}</view>
+            </view>
+            <view class="delete" a:if="{{dataDetail.employee_id ==userId  && (dataDetail.status == 1) && dataDetail.progress != 100}}">
+              <image mode="scaleToFill" data-index="{{index}}" src="../../../image/delete.png" class="img" catchTap="deleteItem"></image>
             </view>
-            <view style="color:#222;margin-right:80rpx;">产品运营部产品运营部产品运营部产品运营部产品运营部</view>
-          </view>
-          <view class="delete">
-            <image mode="scaleToFill" src="../../../image/delete.png" class="img"></image>
           </view>
-        </view>
+      </view>
+      <view class="flex-box-v flex-center-center noTask" a:if="{{dataDetail.gc.length==0}}">
+        <image mode="scaleToFill" src="../../../image/noTask.png"/>
+        <text style="font-size:24rpx">还没有任务过程去记一条吧</text>
       </view>
     </view>
-    <view a:else>
-      <view class="sum">合计20</view>
-      <view class="flex-box gc_item">
+    <view a:else style="margin-bottom:0.8rem">
+      <view class="sum" a:if="{{total&&total>0}}">合计 +{{total}}</view>
+      <view class="sum" a:if="{{total&&total<0}}">合计  {{total}}</view>
+      <view class="flex-box gc_item" a:for="{{process}}" a:if="{{item.recorder_id==dataDetail.publisher_id}}">
         <view class="flex-box flex-1">
-          <img-box name="{{dataDetail.name}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
-          <view class="top-left">
-            <view class="flex-box">
-              <view class="fontColorX flex-1">吴俊逸</view>
-              <view style="font-size:28rpx">2021-01-08 18:11</view>
+          <img-box name="{{item.recorder}}" imgUrl="{{item.img_url}}" height="90rpx" width="90rpx" fSize="28rpx"></img-box>
+          <view class="top-left flex-1">
+            <view class="flex-box flex-v-ce">
+              <view class="fontColorX flex-1">{{item.recorder}}</view>
+              <view style="font-size:28rpx">{{item.time}}</view>
             </view>
-            <view style="color:#222;margin-right:80rpx;">产品运营部产品运营部产品运营部产品运营部产品运营部</view>
+            <view a:if="{{item.point*1 > 0}}" style="margin-bottom:10rpx;">+{{item.point}}</view>
+            <view a:if="{{item.point*1 < 0}}" style="margin-bottom:10rpx;">{{item.point}}</view>
+            <view style="color:#222;margin-right:80rpx;">{{item.remark}}</view>
           </view>
-          <view class="delete">
-            <image mode="scaleToFill" src="../../../image/delete.png" class="img"></image>
+          <view class="delete" a:if="{{dataDetail.employee_id !=userId  && dataDetail.status<3}}">
+            <image mode="scaleToFill" data-index="{{index}}" src="../../../image/delete.png" class="img"  catchTap="deleteItem"></image>
           </view>
         </view>
       </view>
+      <view class="flex-box-v flex-center-center noTask" a:if="{{dataDetail.jf.length==0}}">
+        <image mode="scaleToFill" src="../../../image/noTask.png"/>
+        <text style="font-size:24rpx">还没有任务记录去记一条吧</text>
+      </view>
     </view>
   </view>
-  <view class="pop-up">
+  <view class="btn-area" style="margin-top:28rpx;" a:if="{{(dataDetail.reviewer_id == userId && dataDetail.status == 2)||(dataDetail.employee_id == userId && dataDetail.status == 1)}}">
+      <button type="default" loading="{{disabled}}" a:if="{{dataDetail.reviewer_id == userId && dataDetail.status == 2}}" class="defBtn" disabled="{{disabled}}" catchTap="openWc">去审批</button>
+      <button type="default" loading="{{disabled}}" a:if="{{dataDetail.employee_id == userId && dataDetail.status == 1}}" class="defBtn" disabled="{{disabled}}" catchTap="openPerform">完成</button>
+  </view>
+  <view class="pop-up" a:if="{{isPublisher}}">
     <picker onChange="bindPickerChange" value="{{index}}" range="{{array}}">
       <image class="img2" mode="scaleToFill" src="../../../image/Bj.png"/>
     </picker>

+ 127 - 22
pages/statistics/workDetail/workDetail.js

@@ -5,24 +5,62 @@ Page({
   data: {
     date: app.globalData.month,
     activeIndex: 1,
+    id: '',
+    userId: '',
+    process: [],
+    array: ['编辑任务', '删除任务'],
+    isPublisher: true,//是不是发布者
   },
   onLoad(e) {
     that = this;
-    dd.setNavigationBar({ title: "事件详情" });
-    // that.getDetail(e.event_id);
+    dd.setNavigationBar({ title: "工作详情" });
+    if (e.id) {
+      this.setData({
+        id: e.id,
+        userId: app.globalData.userData.id
+      })
+      that.getDetail(e.id);
+    }
   },
-    bindPickerChange(e) {
-    dd.confirm({
-      title: '删除任务',
-      content: '删除此任务将会删除其相关记录和积分数据,确认删除吗?',
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      success: (result) => {
-        if (result.confirm) {
-
-        }
-      },
-    });
+  // 判断当前账号与发布工作者是否同一人;
+  current_none(data) {
+    var actions = []
+    // 这里比较复杂,因为团队绩效的工作详情跟我的发布的工作详情都调用这个页面
+    if (data.status == 1) {
+      if (data.pt_id != 1) {
+        actions.push('编辑任务')
+        actions.push('删除任务')
+      } else {
+        actions.push('删除任务')
+      }
+    } else {
+      actions.push('删除任务')
+    }
+    this.setData({ array: actions })
+  },
+  bindPickerChange(e) {
+    if (this.data.array[e.detail.value] == '删除任务') {
+      dd.confirm({
+        title: '删除任务',
+        content: '删除此任务将会删除其相关记录和积分数据,确认删除吗?',
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        success: (result) => {
+          if (result.confirm) {
+            app.$get("api/integral/work/delete", { work_id: this.data.id }).then((res) => {
+              app.globalData.showToast(res.data.msg);
+              setTimeout(() => {
+                dd.navigateBack({ delta: 1 })
+              }, 1000);
+            })
+          }
+        },
+      });
+    } else if (this.data.array[e.detail.value] == '编辑任务') {//编辑任务
+      dd.navigateTo({
+        url: '../assaign_set/assaign_set?item=' + JSON.stringify(this.data.dataDetail)
+      })
+    }
   },
   //显示图片
   showImg(e) {
@@ -37,17 +75,84 @@ Page({
     var index = e.target.dataset.index;
     this.setData({ activeIndex: index })
   },
-  openSearch() {
-    app.globalData.showToast("暂不支持筛选");
+  openJyt() {
+    dd.navigateTo({
+      url: '../workpoints/workpoints?item=' + JSON.stringify(this.data.process) + '&id=' + this.data.dataDetail.id + '&isJf=' + false
+    })
   },
-  getDetail(id) {
-    app.$get("api/integral/statistics/integral/info", { event_id: 533 }).then((res) => {
-      this.setData({ dataDetail: res.data.data })
+  openJf(e) {
+    dd.navigateTo({
+      url: '../workpoints/workpoints?item=' + JSON.stringify(this.data.process) + '&id=' + this.data.dataDetail.id + '&isJf=' + true
     })
   },
-  openSchedule(){
+  deleteItem(e) {
+    dd.confirm({
+      title: '提示',
+      content: '确定永久删除此项?',
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      success: (result) => {
+        if (result.confirm) {
+          var index = e.target.dataset.index;
+          var data = {
+            work_id: this.data.id,
+            process: this.data.process
+          }
+          data.process.splice(index, 1)
+          if(data.process.length==0){
+            data.process="[1]"
+          }else{
+            data.process = JSON.stringify(data.process);
+          }
+          app.$post("api/integral/work",data).then((res) => {
+            app.globalData.showToast(res.data.msg);
+            this.getDetail(this.data.id);
+          })
+        }
+      },
+    });
+  },
+  getDetail(id, fun = function () { }) {
+    this.setData({
+        total:0
+    })
+    app.$get("api/integral/work", { work_id: id }).then((res) => {
+      fun();
+      this.current_none(res.data.data)
+      var process = res.data.data.process.list || [];
+      var data = res.data.data;
+      data.jf = [];
+      data.gc = [];
+      process.forEach(item => {
+        if (item.recorder_id == data.publisher_id) {
+          data.jf.push(item)
+        } else {
+          data.gc.push(item)
+        }
+      })
+      this.setData({
+        dataDetail: data,
+        total: res.data.data.process.total,
+        process: process,
+        isPublisher: data.publisher_id == this.data.userId ? true : false
+      })
+    })
+  },
+  openWc(){
+    console.log("asdas")
+    dd.navigateTo({
+      url: '../../workbench/approve/approve?id=' + this.data.dataDetail.review_id
+    })
+  },
+  // 完成任务
+  openPerform() {
     dd.navigateTo({
-      url: '../schedule/schedule'
-    }) 
+      url: '../openPerform/openPerform?id=' + this.data.dataDetail.id + '&is=detail' 
+    })
+  },
+  openSchedule() {
+    dd.navigateTo({
+      url: '../schedule/schedule?id=' + this.data.dataDetail.id + "&progress=" + this.data.dataDetail.progress
+    })
   },
 });

+ 17 - 15
pages/statistics/workpoints/workpoints.axml

@@ -2,26 +2,28 @@
   <view style="height:20rpx"></view>
   <view class="main">
     <view class="itme-li">
-      <textarea maxlength="100" value="{{item.remark}}" onInput="bindTextAreaBlur" placeholder="请认真填写做这件事的关键过程"></textarea>
+      <textarea maxlength="100" value="{{process.remark}}" onInput="bindTextAreaBlur" placeholder="请认真填写做这件事的关键过程"></textarea>
     </view>
-    <view class="text">任务执行过程可以记录奖分和扣分,任务完成后可提供评分参考</view>
-    <view class="flex-box" style="padding:15rpx 28rpx;background:#fff" >
-      <view class="label isBt" style="position: relative;top:8rpx;">积分</view>
-      <text class="red" style="position: relative;top:8rpx;" a:if="{{item.isArrindex2==true}}">+</text>
-      <text class="green" a:else style="position: relative;top:8rpx;">-</text>
-      <view class="flex-1">
-        <view class="flex-box flex-v-ce">
-          <input value="{{item.point2}}" name="{{index}}" placeholder="0" type="number" onInput="bindKeyInput2" data-index="{{index}}" class="flex-1"/>
-          <view class="picker-box" data-index="{{index}}" catchTap="bindPickerChange">
-            <view class="{{item.isArrindex2==true? 'picker-right':'picker-left'}} yuan"></view>
-            <view class="flex-box flex-v-ce" class="picker">
-              <text class="red flex-1">奖</text>
-              <text class="green flex-1">扣</text>
+    <block a:if="{{isJf}}">
+      <view class="text">任务执行过程可以记录奖分和扣分,任务完成后可提供评分参考</view>
+      <view class="flex-box" style="padding:15rpx 28rpx;background:#fff">
+        <view class="label isBt" style="position: relative;top:8rpx;">积分</view>
+        <text class="red" style="position: relative;top:8rpx;" a:if="{{isArrindex==true}}">+</text>
+        <text class="green" a:else style="position: relative;top:8rpx;">-</text>
+        <view class="flex-1">
+          <view class="flex-box flex-v-ce">
+            <input value="{{process.point}}" name="{{index}}" placeholder="0" type="number" onInput="bindKeyInput" data-index="{{index}}" class="flex-1"/>
+            <view class="picker-box" data-index="{{index}}" catchTap="bindPickerChange">
+              <view class="{{isArrindex==true? 'picker-right':'picker-left'}} yuan"></view>
+              <view class="flex-box flex-v-ce" class="picker">
+                <text class="red flex-1">奖</text>
+                <text class="green flex-1">扣</text>
+              </view>
             </view>
           </view>
         </view>
       </view>
-    </view>
+    </block>
   </view>
   <view class="btn-area" style="margin-top:28rpx;">
     <button type="default" loading="{{disabled}}" class="defBtn" disabled="{{disabled}}" catchTap="formSubmit">提交</button>

+ 70 - 15
pages/statistics/workpoints/workpoints.js

@@ -3,33 +3,88 @@ var that;
 var animation;
 Page({
   data: {
-    users: [],
-    item: {
+    defaultVal: '',
+    process: {
+      recorder_id: app.globalData.userData.id,
+      recorder: app.globalData.userData.name,
       remark: '',
-      id: ''
+      point: 0,
+      img_url: app.globalData.userData.img_url,
+      time: app.globalData.allDate
     },
-    defaultVal: '',
+    items: [],
+    id: '',
+    isArrindex: true,//正还是负
+    isJf: false,
   },
-  onLoad() {
+  onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "任务过程" });
+    if (e.id) {
+      this.setData({
+        isJf: JSON.parse(e.isJf),
+        id: e.id,
+        items: JSON.parse(e.item),
+        process: {
+          recorder_id: app.globalData.userData.id,
+          recorder: app.globalData.userData.name,
+          remark: '',
+          point: 0,
+          img_url: app.globalData.userData.img_url,
+          time: app.globalData.allDate
+        },
+      })
+    }
+  },
+  //备注输入
+  bindTextAreaBlur: function (e) {
+    this.setData({
+      [`process.remark`]: e.detail.value,
+    });
+  },
+  bindKeyInput(e) {
+    this.setData({
+      [`process.point`]: e.detail.value,
+    });
   },
   formSubmit() {
     var page1 = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
-
-    console.log(page1)
-    dd.navigateBack({
-      delta: 1
+    if (!this.data.process.remark) {
+      app.globalData.showToast("请输入记录过程");
+      return;
+    }
+    
+    if (this.data.isJf) {
+      if (this.data.process.point == 0 || !this.data.process.point) {
+        app.globalData.showToast("请输入记分");
+        return;
+      }
+    }
+    var data = {
+      work_id: this.data.id,
+      process: []
+    }
+    var items = this.data.items;
+    var process = this.data.process;
+    this.data.isArrindex === false ? process.point = process.point * -1 : process.point = process.point * 1
+    items.unshift(process)
+    data.process = JSON.stringify(items);
+    this.setData({ disabled: true })
+    app.$post("api/integral/work", data).then((res) => {
+      page1.getDetail(this.data.id, function () {
+        app.globalData.showToast(res.data.msg);
+        setTimeout(() => {
+          dd.navigateBack({ delta: 1 })
+        }, 1000);
+      })
+    }).finally(e => {
+      this.setData({ disabled: false })
     })
   },
   //选择奖还是扣(细则)
-  bindPickerChange(e) {
-    var index = e.target.dataset.index;
-    var isArrindex = `items[${index}].isArrindex`;
-    var isTrue = that.data.items[index].isArrindex
+  bindPickerChange() {
     this.setData({
-      [isArrindex]: !isTrue,
+      isArrindex: !this.data.isArrindex,
     });
   },
-
 });

+ 68 - 50
pages/workbench/apply/apply.js

@@ -7,7 +7,7 @@ Page({
     userName: '',//用户名称
     items: [{//录入选项列表
       employee_id: '',
-			employeeName: '', 
+      employeeName: '',
       checked: true,//判断是否开启指定规则
       rule_id: '',//积分分类id
       item_id: '',//积分细则id 不选可以为0
@@ -21,42 +21,44 @@ Page({
     isShowType: true,//是显示选择规则还是显示选择分类
     activeIndex: '',
     isArr: ['奖', '扣'],
-    reviewerObj:[],//选中的审批人
-    employeeObj:[],//选中的录入对象
+    reviewerObj: [],//选中的审批人
+    employeeObj: [],//选中的录入对象
     disabled: false,
-    superior_list:[],//录入人的上级
-    getReviewerObj:{},//默认当前的缓存对象
+    superior_list: [],//录入人的上级
+    getReviewerObj: {},//默认当前的缓存对象
     defaultRuleId: '',
+    qrcode: {},//扫码进入
   },
-  onLoad() {
+  onLoad(e) {
+    if (e.item) { this.setData({ qrcode: e.item }) }//获取扫码进入参数
     that = this;
     dd.setNavigationBar({ title: "申请积分" });
-    this.getReviewerObj(app.globalData.userData.id,function(res){
+    this.getReviewerObj(app.globalData.userData.id, function (res) {
       that.setData({
-        getReviewerObj:res,
+        getReviewerObj: res,
         items: [{//录入选项列表
           checked: true,//判断是否开启指定规则
-          employee_id:app.globalData.isCreator? '':app.globalData.userData.id,
-          employeeName:app.globalData.isCreator? '': app.globalData.userData.name,
+          employee_id: app.globalData.isCreator ? '' : app.globalData.userData.id,
+          employeeName: app.globalData.isCreator ? '' : app.globalData.userData.name,
           rule_id: '',//积分分类id
           item_id: '',//积分细则id 不选可以为0
           remark: '',//备注
           event_time: app.globalData.day,//事件时间
-          reviewer_id:res.id,
-          revieweName:res.name,
+          reviewer_id: res.id,
+          revieweName: res.name,
           files: '',//附件数组列表
         }],
       })
     })
   },
   //获取缓存的审批人
-  getReviewerObj(id,fuc){
+  getReviewerObj(id, fuc) {
     dd.getStorage({
       key: String(id),
-      success: function(res) {
-        if(res.data){
+      success: function (res) {
+        if (res.data) {
           fuc(res.data);
-        }else{
+        } else {
           fuc({});
         }
       }
@@ -64,10 +66,25 @@ Page({
   },
 
   onShow() {
+    dd.hideLoading();
     animation = dd.createAnimation({
       duration: 200,
       timeFunction: "linear",
     });
+    if (this.data.qrcode.id) {
+      var item = this.data.qrcode
+      var selectRule = `items[0].selectRule`
+      var remark = `items[0].remark`
+      var employee_id = `items[0].employee_id`
+      var employeeName = `items[0].employeeName`
+      that.setData({
+        [employee_id]:app.globalData.userData.id,
+        [employeeName]: app.globalData.userData.name,
+        [selectRule]: item,
+        [remark]: item.remark,
+      })
+    }
+    console.log(this.data.qrcode);
   },
   //显示图片
   showImg(e) {
@@ -106,27 +123,27 @@ Page({
       this.getEmployeeList([item.employee_id], function (res) {//获取共同上级
         var reviewer_id = `items[${index}].reviewer_id`
         var revieweName = `items[${index}].revieweName`
-        let is=false;//是否还在
-        res.forEach(items=>{
-          if(items.id==item.id){//判断缓存起来的审批人是否还在审批人列表中
-              is=true;
+        let is = false;//是否还在
+        res.forEach(items => {
+          if (items.id == item.id) {//判断缓存起来的审批人是否还在审批人列表中
+            is = true;
           }
         })
-        if(is){
-          that.setData({ 
+        if (is) {
+          that.setData({
             superior_list: res,
             isShowType: num,
             activeIndex: index,
             reviewerObj: [item]
           })
-        }else{
-         that.setData({ 
+        } else {
+          that.setData({
             superior_list: res,
             isShowType: num,
             activeIndex: index,
             reviewerObj: [],
-            [reviewer_id]:'',
-            [revieweName]:''
+            [reviewer_id]: '',
+            [revieweName]: ''
           })
         }
         animation.translateY(0).step();
@@ -134,12 +151,12 @@ Page({
           animationInfo: animation.export()
         });
       });
-    }else{
+    } else {
       if (e.target.dataset.ruleId) {
-          that.setData({ defaultRuleId: e.target.dataset.ruleId });
+        that.setData({ defaultRuleId: e.target.dataset.ruleId });
       }
-      that.setData({ 
-        employeeObj:num==3? [e.target.dataset.item]:[],
+      that.setData({
+        employeeObj: num == 3 ? [e.target.dataset.item] : [],
         isShowType: num,
         activeIndex: index,
       });
@@ -304,18 +321,18 @@ Page({
             dd.navigateBack({
               delta: 1
             })
-           this.setData({ disabled: false });  
+            this.setData({ disabled: false });
           }, 1000);
         }
       }).catch(err => {
         this.setData({ disabled: false });
-      }).finally(()=>{
+      }).finally(() => {
         console.log(arr);
-        if(arr.length>0){
-          arr.forEach(item=>{
+        if (arr.length > 0) {
+          arr.forEach(item => {
             dd.setStorage({
               key: String(item.employee_id),
-              data: {id:item.reviewer_id,name:item.revieweName},
+              data: { id: item.reviewer_id, name: item.revieweName },
             });
           })
         }
@@ -345,25 +362,25 @@ Page({
     });
     dd.getStorage({
       key: String(elm.id),
-      success: function(res) {
-        if(res.data){
+      success: function (res) {
+        if (res.data) {
           that.setData({
-            [reviewer_id]:res.data.id,
-            [revieweName]:res.data.name
-          });  
-        }else{
+            [reviewer_id]: res.data.id,
+            [revieweName]: res.data.name
+          });
+        } else {
           that.setData({
-            [reviewer_id]:'',
-            [revieweName]:''
-          });  
+            [reviewer_id]: '',
+            [revieweName]: ''
+          });
         }
       }
     });
   },
-    //获取人员(上级人员)
+  //获取人员(上级人员)
   getEmployeeList(userIdArr, callBack) {
     app.$get("api/employee/superior", { employee_id: userIdArr, filter_applyor: 1 }).then((res) => {
-      callBack(res.data.data.list||[])
+      callBack(res.data.data.list || [])
     })
   },
   //选择审批人
@@ -380,15 +397,15 @@ Page({
   //添加一条
   addArr() {
     var arr = {//录入选项列表
-      employee_id:app.globalData.isCreator? '':app.globalData.userData.id,
-      employeeName:app.globalData.isCreator? '': app.globalData.userData.name,
+      employee_id: app.globalData.isCreator ? '' : app.globalData.userData.id,
+      employeeName: app.globalData.isCreator ? '' : app.globalData.userData.name,
       checked: true,//判断是否开启指定规则
       rule_id: '',//积分分类id
       item_id: '',//积分细则id 不选可以为0
       remark: '',//备注
       event_time: app.globalData.day,//事件时间
-      reviewer_id:this.data.getReviewerObj.id,
-      revieweName:this.data.getReviewerObj.name,
+      reviewer_id: this.data.getReviewerObj.id,
+      revieweName: this.data.getReviewerObj.name,
       files: '',//附件数组列表
     };
     var list = that.data.items
@@ -420,6 +437,7 @@ Page({
   },
   //选择规则
   onSelectItem(item) {
+    console.log(item)
     var index = this.data.activeIndex;
     var selectRule = `items[${index}].selectRule`
     var remark = `items[${index}].remark`

+ 22 - 58
pages/workbench/index/index.axml

@@ -11,43 +11,15 @@
   </view>
   <view class="headed margin-bottom">
     <view class="top"></view>
-
     <view class="menuList flex-box flex-d-wrap">
-        <view a:for="{{menuList}}" class="menu-item" data-url="{{item.url}}" onTap="openUrl">
-            <image mode="scaleToFill" src="{{item.imgUrl}}"/>
-            <view>{{item.name}}</view>
-            <text class="menuNum font-flex-word" a:if="{{item.name=='审批'&&total}}">{{total}}</text>
-        </view>
-    </view>
-    <!-- <view class="headed-box">
-      <view a:if="{{isAdministrator}}" class="flex-box headed-box-item">
-        <view class="flex-box flex-center-center flex-1 left" data-index="3" onTap="openView">
-          <image mode="scaleToFill" src="../../../image/jkbf.png"></image>
-          <text>奖扣B分</text>
-        </view>
-        <view class="flex-box  flex-center-center flex-1" data-index="4" onTap="openView">
-          <image mode="scaleToFill" src="../../../image/jkaf.png"></image>
-          <text>奖扣A分</text>
-        </view>
+      <view a:for="{{menuList}}" class="menu-item" data-url="{{item.url}}" onTap="openUrl">
+        <image mode="scaleToFill" src="{{item.imgUrl}}"/>
+        <view>{{item.name}}</view>
+        <text class="menuNum font-flex-word" a:if="{{item.name=='审批'&&total}}">{{total}}</text>
+        <text class="menuNum font-flex-word" a:if="{{item.name=='任务'&&workTotal}}">{{workTotal}}</text>
       </view>
-
-      <view class="flex-box headed-box-item">
-        <view class="flex-box  flex-center-center flex-1 left" data-index="5" onTap="openView">
-          <image mode="scaleToFill" src="../../../image/sqjf.png"></image>
-          <text>申请积分</text>
-        </view>
-        <view class="flex-box  flex-center-center flex-1" data-index="6" onTap="openView">
-          <image mode="scaleToFill" src="../../../image/sp.png"></image>
-          <text>
-            审批
-            <text class="red">({{total}})</text>
-          </text>
-        </view>
-      </view>
-      
-    </view> -->
+    </view>
   </view>
-
   <view class="main margin-bottom">
     <view class="main-title flex-box flex-v-ce" onTap="openView" data-index="10">
       <text class="flex-1" style="font-size:32rpx">排行榜</text>
@@ -57,20 +29,18 @@
       <view class="flex-box flex-v-ce flex-1">
         <view class="ranking_name font-flex-word"> {{ item.group_name.slice(0,2)}}</view>
         <view class="ranking_num flex-1">
-            <view>{{ item.group_name }}</view>
-            <text class="fontColorF" a:if="{{getRole_four}}">第 {{ item.rank }} 名:{{item.employee_name}}</text>
-            <text class="fontColorF" a:else>第 {{ item.rank }} 名</text>
+          <view>{{ item.group_name }}</view>
+          <text class="fontColorF" a:if="{{getRole_four}}">第 {{ item.rank }} 名:{{item.employee_name}}</text>
+          <text class="fontColorF" a:else>第 {{ item.rank }} 名</text>
         </view>
-        <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image> 
+        <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image>
       </view>
     </view>
-    <view  class="rankingLists" onTap="openView" data-index="10">
-        <text>查看所有排行榜</text>
-        <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image> 
+    <view class="rankingLists" onTap="openView" data-index="10">
+      <text>查看所有排行榜</text>
+      <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image>
     </view>
   </view>
-
-
   <!-- 奖扣展示 -->
   <view a:if="{{userData.task&&isAdministrator}}" class="main margin-bottom">
     <view class="main-title flex-box flex-v-ce">
@@ -100,36 +70,30 @@
       </view>
     </view>
   </view>
-
   <!-- 管理者奖扣 -->
   <view class="bottom margin-bottom" a:if="{{isAdministrator}}">
     <view class="flex-box flex-v-ce bottom-title">
       <view class="flex-1">管理者奖扣</view>
-       <view class="chart-legend__wrap">
-          <text class="chart-legend__pink">奖分</text>
-          <text class="chart-legend__green">扣分</text>
-       </view>
+      <view class="chart-legend__wrap">
+        <text class="chart-legend__pink">奖分</text>
+        <text class="chart-legend__green">扣分</text>
+      </view>
     </view>
     <view class="f2-chart" a:if="{{pieTotal>0}}">
       <f2 onInit="onInitChart3"></f2>
     </view>
-     <no-data a:if="{{pieTotal==0}}" content="无数据"></no-data>
+    <no-data a:if="{{pieTotal==0}}" content="无数据"></no-data>
+    <view class="rankingLists" onTap="openView" style="border-top:1px solid #f1f1f1" data-index="11" a:if="{{pieTotal>0}}">
+      <text>查看所有管理者奖扣</text>
+      <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image>
+    </view>
   </view>
-
-
   <view class="bottom margin-bottom">
     <view class="bottom-title">近30天B分趋势</view>
     <view class="f2-chart">
       <f2 onInit="onInitChart"></f2>
     </view>
   </view>
-  <!-- <view class="bottom margin-bottom">
-    <view class="bottom-title">本月B分积分构成</view>
-    <view a:if="{{pieData.length>0}}" class="f2-chart">
-      <f2 onInit="onInitChart2"></f2>
-    </view>
-    <no-data a:if="{{pieData.length==0}}" content="无数据"></no-data>
-  </view> -->
   <view class="bottom">
     <view class="bottom-title">积分事件</view>
     <view a:for="{{incidentLsit}}" class="flex-box bottom-time" data-item="{{item}}" data-index="8" onTap="openView">

+ 13 - 4
pages/workbench/index/index.js

@@ -15,7 +15,7 @@ Page({
     getRole_four: app.globalData.isCreator,//是否创始人
     setECharts: [],//柱形图数据
     pieTotal: 1,
-    total:188,
+    total:'',
     menuList: [
       { name: '审批', imgUrl: '../../../image/sp.png', url: '../my_approve/my_approve', code: 'creator admin employee' },
       { name: '任务', imgUrl: '../../../image/a7.png', url: '../../statistics/my_task/my_task', code: 'admin employee' },
@@ -36,7 +36,7 @@ Page({
 
   onShow(query) {
     if (app.globalData.userData) {
-      // that.getUserData();
+      that.getUserData();
       that.setData({ isAdministrator: app.globalData.isAdministrator, getRole_four: app.globalData.isCreator })
     } else {
       app.login(app.globalData.corpId, function (is) {
@@ -48,7 +48,7 @@ Page({
           }else if(!app.globalData.isCreator&&!app.globalData.isAdministrator){
             that.setMenuList("employee");
           }
-          // that.getUserData();
+          that.getUserData();
           that.setData({ isAdministrator: app.globalData.isAdministrator, getRole_four: app.globalData.isCreator })
         } else {
           dd.reLaunch({
@@ -114,6 +114,7 @@ Page({
         { url: '../../statistics/prizeBuckleDetail/prizeBuckleDetail', query: 'id=' + e.target.dataset.item.id },
         { url: '../../statistics/integralEvent/integralEvent', query: '' },
         { url: '../../statistics/userRamking/userRamking', query: '' },
+        { url: '../../statistics/glz_execute/glz_execute', query: '' },
       ];
     } else {
       urls = [
@@ -127,6 +128,7 @@ Page({
         { url: '../../statistics/prizeBuckleDetail/prizeBuckleDetail', query: '' },
         { url: '../../statistics/integralEvent/integralEvent', query: '' },
         { url: '../../statistics/userRamking/userRamking', query: '' },
+         { url: '../../statistics/glz_execute/glz_execute', query: '' },
       ];
     }
     dd.navigateTo({
@@ -265,7 +267,8 @@ Page({
     var http3 = app.$get2("api/integral/review/list", { type: 'waiting', page: 1, pt_id: 0 })
     var ranking = app.$get('api/integral/statistics/ranking/list', { page: 1, page_size: 5 })// 获取排行榜
     var task = app.$get('api/integral/statistics/task/pie', { month: app.globalData.month })// 管理者奖扣任务柱状图
-    Promise.all([http1, http2, http3, ranking, task]).then(function (values) {
+    var work = app.$get('api/integral/work/list', { status: 'running',page: 1,pt_id: 0})// 管理者奖扣任务柱状图
+    Promise.all([http1, http2, http3, ranking, task,work]).then(function (values) {
       if (values[0]) {
         let data = values[0].data.data;
         var task = data.task;
@@ -330,6 +333,12 @@ Page({
           }
         }
       }
+      if (values[5]) {
+        let data = values[5].data.data;
+        that.setData({
+          workTotal: data.total
+        })
+      }
     })
   },
   //获取积分事件

+ 24 - 22
pages/workbench/prize_buckle/prize_buckle.js

@@ -6,15 +6,15 @@ var chart2;
 Page({
   data: {
     date: app.globalData.month,
-    employee_id:0,
-    isDb:false,
-    showtu:false,
-    chartData:[]
+    employee_id: 0,
+    isDb: false,
+    showtu: false,
+    chartData: []
   },
   onLoad(e) {
     that = this;
     dd.setNavigationBar({ title: "奖扣统计" });
-    chart1,chart2='';
+    chart1, chart2 = '';
     if (e.id && e.month) {
       that.setData({
         date: e.month,
@@ -44,7 +44,7 @@ Page({
         return textCfg;
       },
     });
-    chart1.line().position('time*value').color('type', [ '#F56C6C', '#67C23A']);
+    chart1.line().position('time*value').color('type', ['#F56C6C', '#67C23A']);
     chart1.render();
     return chart1;
   },
@@ -69,7 +69,7 @@ Page({
         return textCfg;
       },
     });
-    chart2.line().position('time*value').color('type', [ '#F56C6C', '#67C23A']);
+    chart2.line().position('time*value').color('type', ['#F56C6C', '#67C23A']);
     chart2.render();
     that.getIncidentLsit();
     return chart2;
@@ -77,7 +77,7 @@ Page({
 
   getIncidentLsit() {
     app.$get("api/integral/statistics/prize", { employee_id: that.data.employee_id, month: that.data.date }).then((res) => {
-      const {chart } = res.data.data;
+      const { chart } = res.data.data;
       const { reward, deduct } = chart;
       var rewardArr = reward.map((item) => {
         return { time: item.date, value: item.point, type: '奖分' };
@@ -99,26 +99,28 @@ Page({
   },
   //时间选择
   openDate() {
-    that.setData({showDate: true});
+    that.setData({ showDate: true });
     dd.datePicker({
       format: 'yyyy-MM',
       currentDate: that.data.date,
       success: (res) => {
-        that.setData({
-          date: res.date,
-          isDb:false
-        })
+        if (res.date) {
+          that.setData({
+            date: res.date,
+            isDb: false
+          })
           that.getUserData();
           that.getIncidentLsit();
+        }
       },
-      complete:(res)=>{
+      complete: (res) => {
         that.setData({
-           showDate: false
+          showDate: false
         })
       }
     });
   },
-    //获取个人统计
+  //获取个人统计
   getUserData() {
     app.$get("api/integral/statistics", { employee_id: that.data.employee_id, month: that.data.date }).then((res) => {
       var data = res.data.data;
@@ -126,12 +128,12 @@ Page({
       dd.setNavigationBar({ title: data.name });
       var ratio = task.reward.point === 0 || task.deduction.point === 0 ? '-' : `${task.ratio.ratio}:1`
       var target_ratio = task.ratio.target_ratio <= 0 ? '0:0' : `${task.ratio.target_ratio}:1`
-      if(data.task.reward.point>=data.task.reward.target_point&&data.task.deduction.point>=data.task.deduction.target_point&&data.task.exec.count>=data.task.exec.target_count){
-          if(task.ratio.ratio>=task.ratio.target_ratio){
-              this.setData({
-                isDb: true
-              }) 
-          }
+      if (data.task.reward.point >= data.task.reward.target_point && data.task.deduction.point >= data.task.deduction.target_point && data.task.exec.count >= data.task.exec.target_count) {
+        if (task.ratio.ratio >= task.ratio.target_ratio) {
+          this.setData({
+            isDb: true
+          })
+        }
       }
       data.ratio = {
         ratio: ratio,

+ 26 - 24
pages/workbench/statistics_A/statistics_A.js

@@ -13,7 +13,7 @@ Page({
     dd.setNavigationBar({ title: "我的A分统计" });
   },
   //打开更多
-  openMore(){
+  openMore() {
     dd.navigateTo({
       url: '../../statistics/integralEvent/integralEvent?month=' + this.data.date + '&type=AF'
     })
@@ -28,14 +28,14 @@ Page({
       }
     });
     chart1.tooltip({
-    showCrosshairs: true,
-    showItemMarker: false,
-    onShow: function onShow(ev) {
-      const items = ev.items;
-      items[0].name ="月份:"+items[0].origin.date;
-      items[0].value ="分值:"+items[0].value;
-    }
-  });
+      showCrosshairs: true,
+      showItemMarker: false,
+      onShow: function onShow(ev) {
+        const items = ev.items;
+        items[0].name = "月份:" + items[0].origin.date;
+        items[0].value = "分值:" + items[0].value;
+      }
+    });
     chart1.line().position('date*value');
     chart1.point().position('date*value').style({
       stroke: '#fff',
@@ -45,9 +45,9 @@ Page({
     that.getIncidentLsit();
     return chart1;
   },
-  
+
   openDate() {
-     that.setData({showDate: true});
+    that.setData({ showDate: true });
     dd.datePicker({
       format: 'yyyy-MM',
       currentDate: that.data.date,
@@ -55,27 +55,29 @@ Page({
         that.setData({
           date: res.date
         })
-        that.getIncidentLsit();
+        if (res.date) {
+          that.getIncidentLsit();
+        }
       },
-      complete:(res)=>{
+      complete: (res) => {
         that.setData({
-           showDate: false
+          showDate: false
         })
       }
     });
   },
   //获取积分事件
   getIncidentLsit() {
-      app.$get("api/integral/statistics/a", {  employee_id: 0, month: that.data.date }).then((res) => {
-          const {a, chart,list} = res.data.data
-          const points = chart.reward.map((rewardItem, index) => {
-            return { date: rewardItem.month, value: rewardItem.point - (chart.deduction[index].point || 0) }
-          })
-          chart1.changeData(points);
-          that.setData({
-            data_a: a,
-            dataList:list
-          });
+    app.$get("api/integral/statistics/a", { employee_id: 0, month: that.data.date }).then((res) => {
+      const { a, chart, list } = res.data.data
+      const points = chart.reward.map((rewardItem, index) => {
+        return { date: rewardItem.month, value: rewardItem.point - (chart.deduction[index].point || 0) }
       })
+      chart1.changeData(points);
+      that.setData({
+        data_a: a,
+        dataList: list
+      });
+    })
   },
 });

+ 3 - 1
pages/workbench/statistics_B/statistics_B.js

@@ -100,7 +100,9 @@ Page({
         that.setData({
           date: res.date
         })
-        that.getIncidentLsit();
+        if(res.date){
+          that.getIncidentLsit();
+        }
       },
       complete: (res) => {
         that.setData({

+ 2 - 2
utils/util.js

@@ -6,12 +6,12 @@ const formatTime = (date) => {
   const hour = date.getHours()
   const minute = date.getMinutes()
   const second = date.getSeconds()
-  
   return {
     year:year,
     month:[year, month].map(formatNumber).join('-'),
     day:[year, month, day].map(formatNumber).join('-'),
-    month_tow:month
+    month_tow:month,
+    allDate:[year, month, day].map(formatNumber).join('-')+" "+hour+":"+minute
   }
 }