chengjie 6 years ago
parent
commit
0cb8c80145
4 changed files with 53 additions and 24 deletions
  1. 1 1
      app.js
  2. 39 5
      pages/main/add.js
  3. 6 10
      pages/main/add.wxml
  4. 7 8
      pages/main/add.wxss

+ 1 - 1
app.js

@@ -26,7 +26,7 @@ App({
26
     }
26
     }
27
   },
27
   },
28
   globalData: {
28
   globalData: {
29
-    Version: "1.3.6",
29
+    Version: "1.3.7",
30
     IsProduction: true,
30
     IsProduction: true,
31
     ShareTitle: "高效学习从秒过开始",
31
     ShareTitle: "高效学习从秒过开始",
32
     SharePath: "pages/index/index",
32
     SharePath: "pages/index/index",

+ 39 - 5
pages/main/add.js

@@ -31,7 +31,8 @@ Page({
31
     SoundSign: "[读]",
31
     SoundSign: "[读]",
32
     LineSign: "[线]",
32
     LineSign: "[线]",
33
     HighlighterSign: "[光]",
33
     HighlighterSign: "[光]",
34
-    BtnArray: ["+", "-", "×", "÷", "=", "<", ">"],
34
+    MathSymbolCommon: [],
35
+    BtnArray: ["+", "-", "×", "÷", "=", "<", ">", "≤", "≥", "º", "¹", "²", "³", "⁴", "ⁿ", "₁", "₂", "₃", "₄", "·", "≈", "≠", "±", "(", ")", "[", "]", "{", "}", "《", "》", "%", "°", "℃", "∵", "∴", "π", "|", "‖", "∠", "⊥", "△", "☐", "◇", "▽", "♡", "☆", "⊙", "∈", "∪", "∩", "⊆", "⊂", "⊇", "⊃", "∞", "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩"],
35
     IsPracticeTime: false,
36
     IsPracticeTime: false,
36
     IsRecorder: false,
37
     IsRecorder: false,
37
     PracticeTimeArr: PracticeTimeArr
38
     PracticeTimeArr: PracticeTimeArr
@@ -80,6 +81,7 @@ Page({
80
     app.globalData.TempFieldNumber = 0;
81
     app.globalData.TempFieldNumber = 0;
81
     app.globalData.TempMiaoguoCardID = that.data.MiaoguoCardID;
82
     app.globalData.TempMiaoguoCardID = that.data.MiaoguoCardID;
82
 
83
 
84
+    common.getStorageValue(that, "MathSymbolCommon", [], function () {});
83
   },
85
   },
84
   onShow: function () {
86
   onShow: function () {
85
     var that = this;
87
     var that = this;
@@ -653,6 +655,32 @@ Page({
653
         HighlighterSign: "[光]",
655
         HighlighterSign: "[光]",
654
       });
656
       });
655
     }
657
     }
658
+    else{
659
+      if (btnName !== "(     )" && btnName !=="_____"){
660
+        var b=false;
661
+        for (var i = 0; i < this.data.MathSymbolCommon.length; i++) {
662
+          if (this.data.MathSymbolCommon[i] == btnName) {
663
+            if (e.currentTarget.dataset.type=="common")
664
+              b=true;
665
+            else
666
+              this.data.MathSymbolCommon.splice(i,1);
667
+            break;
668
+          }
669
+        }
670
+        if (!b)
671
+          this.data.MathSymbolCommon.unshift(btnName);
672
+
673
+        if (this.data.MathSymbolCommon.length > 6)
674
+          this.data.MathSymbolCommon.pop();
675
+
676
+        this.setData({
677
+          MathSymbolCommon: this.data.MathSymbolCommon,
678
+        });
679
+        wx.setStorageSync("MathSymbolCommon", this.data.MathSymbolCommon)
680
+      }
681
+    }
682
+
683
+    //console.log("btnName:" + btnName);
656
 
684
 
657
     if (!this.data.Focus) {
685
     if (!this.data.Focus) {
658
       this.data.FieldContent = this.data.FieldContent + btnName;
686
       this.data.FieldContent = this.data.FieldContent + btnName;
@@ -670,6 +698,8 @@ Page({
670
   },
698
   },
671
   //焦点聚焦
699
   //焦点聚焦
672
   onBindFocus: function () {
700
   onBindFocus: function () {
701
+    //console.log("onBindFocus");
702
+    btnName = "";
673
     this.setData({
703
     this.setData({
674
       Focus: true,
704
       Focus: true,
675
     });
705
     });
@@ -706,15 +736,16 @@ Page({
706
       str2 = this.data.FieldContent.substring(tempCursor, this.data.FieldContent.length);
736
       str2 = this.data.FieldContent.substring(tempCursor, this.data.FieldContent.length);
707
     }
737
     }
708
     //console.log("str1:" + str1);
738
     //console.log("str1:" + str1);
739
+    //console.log("btnName:" + btnName);
709
     //console.log("str2:" + str2);
740
     //console.log("str2:" + str2);
710
     var cur = 1;
741
     var cur = 1;
711
     if (btnName == "[读]" || btnName == "[线]" || btnName == "[光]") {
742
     if (btnName == "[读]" || btnName == "[线]" || btnName == "[光]") {
712
       cur = 3;
743
       cur = 3;
713
     } else if (btnName == "[/读]" || btnName == "[/线]" || btnName == "[/光]") {
744
     } else if (btnName == "[/读]" || btnName == "[/线]" || btnName == "[/光]") {
714
       cur = 4;
745
       cur = 4;
715
-    } else if (btnName == "(   )") {
716
-      cur = 5;
717
-    } else if (btnName == "_____") {
746
+    } else if (btnName === "(     )") {
747
+      cur = 7;
748
+    } else if (btnName === "_____") {
718
       cur = 5;
749
       cur = 5;
719
     }
750
     }
720
 
751
 
@@ -728,7 +759,10 @@ Page({
728
     btnName = "";
759
     btnName = "";
729
 
760
 
730
   },
761
   },
731
-
762
+  bindscrollHandler:function(){
763
+    //console.log("bindscrollHandler");
764
+    btnName = "";
765
+  },
732
   onSearchField: function (e) {
766
   onSearchField: function (e) {
733
     app.globalData.TempFieldNumber = this.data.FieldNumber;
767
     app.globalData.TempFieldNumber = this.data.FieldNumber;
734
     wx.navigateTo({
768
     wx.navigateTo({

+ 6 - 10
pages/main/add.wxml

@@ -163,22 +163,18 @@
163
 
163
 
164
   <view class='lineFooter'></view>
164
   <view class='lineFooter'></view>
165
   <view class='panelBtnItem FlexColumn'>
165
   <view class='panelBtnItem FlexColumn'>
166
-    <view class="panelBtnSmall FlexRow">
166
+    <scroll-view scroll-x="true" class="panelBtnSmall" bindscroll="bindscrollHandler">
167
       <view class="btn0"></view>
167
       <view class="btn0"></view>
168
-      <view class="btn1 FlexRow" bindtap="addSymbol" data-id="(     )">
168
+      <view class="btn1 btn" bindtap="addSymbol" wx:for="{{MathSymbolCommon}}" wx:key="index" data-id="{{item}}" data-type="common">{{item}}</view>
169
+      <view class="btn" bindtap="addSymbol" data-id="(     )">
169
         <image class="universalpic_editbar_brackets_gray" src='../images/universalpic_editbar_brackets_gray.png' />
170
         <image class="universalpic_editbar_brackets_gray" src='../images/universalpic_editbar_brackets_gray.png' />
170
       </view>
171
       </view>
171
-      <view class="btn1 FlexRow" bindtap="addSymbol" data-id="_____">
172
+      <view class="btn" bindtap="addSymbol" data-id="_____">
172
         <image class="universalpic_editbar_underline_gray" src='../images/universalpic_editbar_underline_gray.png' />
173
         <image class="universalpic_editbar_underline_gray" src='../images/universalpic_editbar_underline_gray.png' />
173
       </view>
174
       </view>
174
       <view class="btn" bindtap="addSymbol" wx:for="{{BtnArray}}" wx:key="index" data-id="{{item}}">{{item}}</view>
175
       <view class="btn" bindtap="addSymbol" wx:for="{{BtnArray}}" wx:key="index" data-id="{{item}}">{{item}}</view>
175
-      <view class="btn1 FlexRow" bindtap="addSymbol" data-id="²">
176
-        <image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_sqr_gray.png' />
177
-      </view>
178
-      <view class="btn1 FlexRow" bindtap="addSymbol" data-id="³">
179
-        <image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_cube_gray.png' />
180
-      </view>
181
-    </view>
176
+      
177
+    </scroll-view>
182
     <view class='lineFooter'></view>
178
     <view class='lineFooter'></view>
183
     <view class='panelBtn FlexRow'>
179
     <view class='panelBtn FlexRow'>
184
       <view class='text1' bindtap="closeAddItem" data-idsave="false">取消</view>
180
       <view class='text1' bindtap="closeAddItem" data-idsave="false">取消</view>

+ 7 - 8
pages/main/add.wxss

@@ -461,15 +461,17 @@
461
   width:100%;
461
   width:100%;
462
   height: 120rpx;
462
   height: 120rpx;
463
   background-color: #fff;
463
   background-color: #fff;
464
-  justify-content: flex-start;
464
+  display: flex;
465
+  white-space: nowrap;
465
 }
466
 }
466
 
467
 
467
 .panelBtnSmall .btn0 {
468
 .panelBtnSmall .btn0 {
468
   width: 10rpx;
469
   width: 10rpx;
470
+  display: inline-block;
469
 }
471
 }
470
 
472
 
471
 .panelBtnSmall .btn {
473
 .panelBtnSmall .btn {
472
-  font-family: 'Roboto-Black';
474
+  /* font-family: 'Roboto-Black'; */
473
   width: 80rpx;
475
   width: 80rpx;
474
   background-color: #fff;
476
   background-color: #fff;
475
   border: 1rpx solid #9b9b9b;
477
   border: 1rpx solid #9b9b9b;
@@ -478,17 +480,14 @@
478
   text-align: center;
480
   text-align: center;
479
   line-height: 80rpx;
481
   line-height: 80rpx;
480
   height: 80rpx;
482
   height: 80rpx;
483
+  margin-top: 20rpx;
481
   margin-right: 10rpx;
484
   margin-right: 10rpx;
482
   font-size: 36rpx;
485
   font-size: 36rpx;
486
+  display: inline-block;
483
 }
487
 }
484
 
488
 
485
 .panelBtnSmall .btn1 {
489
 .panelBtnSmall .btn1 {
486
-  width: 80rpx;
487
-  height: 80rpx;
488
-  background-color: #fff;
489
-  border: 1rpx solid #9b9b9b;
490
-  border-radius: 10rpx;
491
-  margin-right: 10rpx;
490
+  background-color: #f0f0f0;
492
 }
491
 }
493
 
492
 
494
 .universalpic_editbar_brackets_gray {
493
 .universalpic_editbar_brackets_gray {