chengjie преди 6 години
родител
ревизия
5addd1b270

+ 1 - 1
app.js

@@ -13,7 +13,7 @@ App({
13 13
     this.globalData.systemInfo = wx.getSystemInfoSync();
14 14
   },
15 15
   globalData: {
16
-    Version: "1.0.0.3",
16
+    Version: "1.0.0.9",
17 17
     IsProduction: false,
18 18
     ShareTitle: "可以用来记忆一切的工具",
19 19
     SharePath: "pages/index/index",

BIN
pages/images/universalpic_show_black_30x30.png


BIN
pages/images/universalpic_show_white_30x30.png


+ 62 - 44
pages/main/addItem.js

@@ -6,7 +6,7 @@ const app = getApp();
6 6
 var field = "";
7 7
 var tempCursor = 0, btnName = "";
8 8
 var arrSoundMark = [];
9
-var isUpload = true;
9
+var isUnload = true;
10 10
 
11 11
 var isEdit = true;
12 12
 
@@ -34,30 +34,38 @@ Page({
34 34
       title: '编辑 段落' + fieldid,
35 35
     });
36 36
   },
37
-  onShow: function () {
37
+  onShow: function (e) {
38
+    console.log("onShow:" + JSON.stringify(e));
38 39
     var that = this;
39
-    var list = wx.getStorageSync("CardList");
40
+    if (isEdit) {
41
+      var list = wx.getStorageSync("CardList");
40 42
 
41
-    var card = {};
42
-    for (var i = 0; i < list.length; i++) {
43
-      if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
44
-        var content = main.encryptUrl(list[i].Content[this.data.FieldNumber].Content);
45
-        this.setData({
46
-          Field: content,
47
-        });
43
+      var card = {};
44
+      for (var i = 0; i < list.length; i++) {
45
+        if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
46
+          var content = main.encryptUrl(list[i].Content[this.data.FieldNumber].Content);
47
+          this.setData({
48
+            Field: content,
49
+          });
48 50
 
49
-        if (!wx.getStorageSync("TempCardInfoAddItem")) {
50
-          wx.setStorageSync("TempCardInfoAddItem", content);
51
-        }
51
+          if (!wx.getStorageSync("TempCardInfoAddItem")) {
52
+            wx.setStorageSync("TempCardInfoAddItem", content);
53
+          }
52 54
 
53
-        break;
55
+          break;
56
+        }
54 57
       }
55 58
     }
59
+    isUnload = true;
56 60
 
57
-    isUpload = true;
61
+    if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
62
+      setTimeout(function () {
63
+        isEdit = true;
64
+      }, 600);
65
+    }
58 66
   },
59 67
   onUnload: function () {
60
-    if (isUpload) {
68
+    if (isUnload) {
61 69
       var content = wx.getStorageSync("TempCardInfoAddItem");
62 70
       if (content != undefined) {
63 71
         this.updateField(content);
@@ -71,10 +79,13 @@ Page({
71 79
       this.setData({
72 80
         Field: e.detail.value,
73 81
       });
74
-      //console.log("bindinputField:" + field);
82
+      console.log("bindinputField:" + field);
75 83
     }
76 84
   },
77 85
   addSymbol: function (e) {
86
+    console.log("addSymbol");
87
+    isEdit = true;
88
+    var that = this;
78 89
     btnName = e.currentTarget.dataset.id;
79 90
     if (btnName == "[读]") {
80 91
       this.setData({
@@ -95,23 +106,30 @@ Page({
95 106
       this.setData({
96 107
         LineSign: "[线]",
97 108
       });
98
-    } 
109
+    }
99 110
 
100
-    if (!this.data.Focus){
101
-      field=field+btnName;
111
+    if (!this.data.Focus) {
112
+      field = field + btnName;
102 113
       this.setData({
103 114
         Field: field,
104 115
       });
105 116
     }
106 117
     //console.log("addSymbol:" + field); 
118
+
119
+    setTimeout(function () {
120
+      that.setData({
121
+        Focus: true,
122
+      });
123
+    }, 600);
107 124
   },
108
-  onBindFocus:function(){
125
+  onBindFocus: function () {
109 126
     this.setData({
110 127
       Focus: true,
111 128
     });
112 129
   },
113 130
   onBindblur: function (e) {
114
-    //console.log("onBindblur:" + field + " btnName:" + btnName);
131
+    var that = this;
132
+    console.log("onBindblur:" + field + " btnName:" + btnName + " isEdit:" + isEdit);
115 133
     if (isEdit) {
116 134
       var systemInfo = wx.getSystemInfoSync();
117 135
       if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
@@ -141,7 +159,7 @@ Page({
141 159
       field = str1 + btnName + str2;
142 160
       this.setData({
143 161
         Field: field,
144
-        Focus:false,
162
+        Focus: false,
145 163
         Cursor: tempCursor + cur,
146 164
       });
147 165
 
@@ -150,7 +168,7 @@ Page({
150 168
       if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
151 169
         setTimeout(function () {
152 170
           isEdit = true;
153
-        }, 500);
171
+        }, 600);
154 172
       }
155 173
     }
156 174
   },
@@ -162,17 +180,21 @@ Page({
162 180
     this.updateField();
163 181
   },
164 182
   clear: function () {
183
+    console.log("clear");
165 184
     this.setData({
166 185
       Field: "",
167
-      Focus: true,
186
+      Focus: false,
168 187
       Cursor: 0,
169 188
     });
189
+    btnName = "";
190
+    field = "";
191
+    isEdit = false;
170 192
     this.updateField();
171 193
   },
172 194
   closeAddItem: function (e) {
173 195
     var isSave = e.currentTarget.dataset.idsave;
174 196
     if (isSave == "true") {
175
-      isUpload = false;
197
+      isUnload = false;
176 198
       wx.removeStorageSync("TempCardInfoAddItem");
177 199
       this.updateField();
178 200
     }
@@ -203,10 +225,9 @@ Page({
203 225
     wx.setStorageSync("CardList", list);
204 226
   },
205 227
   uploadImage: function () {
206
-    wx.showLoading({
207
-      title: '请稍候',
208
-    });
209
-    var that=this;
228
+    console.log("uploadImageStart");
229
+    isEdit = false;
230
+    var that = this;
210 231
     wx.chooseImage({
211 232
       count: 1,
212 233
       sizeType: ['compressed'],
@@ -214,22 +235,19 @@ Page({
214 235
       success(res) {
215 236
         // tempFilePath可以作为img标签的src属性显示图片
216 237
         const tempFilePaths = res.tempFilePaths;
217
-        console.log(tempFilePaths[0]);
218
-
219
-        var url = common.Encrypt("MiaoguoUploadFile");
220
-        wx.uploadFile({
221
-          url: app.globalData.serverUrl + url,
222
-          filePath: tempFilePaths[0],
223
-          name: 'file',
224
-          success(res) {
225
-            wx.hideLoading();
226
-            var str = "[图 url='" + tempFilePaths[0] + "']" + "https://#####4#####/" +res.data+ "[/图]";
227
-            that.addSymbol({ currentTarget: { dataset: { id: str } } });
228
-          }
238
+        //console.log(tempFilePaths[0]);
239
+        field = field + "[图 url='" + tempFilePaths[0] + "']" + tempFilePaths[0] + "[/图]";
240
+
241
+        console.log("uploadImageEnd:" + field);
242
+
243
+        that.setData({
244
+          Field: field,
245
+          Focus: false,
229 246
         });
247
+
230 248
       },
231
-      fail:function(){
232
-        wx.hideLoading();
249
+      fail: function () {
250
+
233 251
       }
234 252
     });
235 253
   },

+ 6 - 6
pages/main/addItem.wxml

@@ -4,25 +4,25 @@
4 4
       <view class="panelSave1 FlexRow" bindtap="onSearch">
5 5
         <view class="add">+</view> 资料
6 6
       </view>
7
-      <view class="panelSave2 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{SoundSign}}" wx:if="{{SoundSign=='[读]'}}">
7
+      <view class="panelSave2 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{SoundSign}}" hidden="{{SoundSign=='[/读]'}}">
8 8
         <image class="universalpic_read_begin_gray_20x20" src='../images/universalpic_read_begin_gray_20x20.png' />
9 9
       </view>
10
-      <view class="panelSave3 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{SoundSign}}" wx:if="{{SoundSign=='[/读]'}}">
10
+      <view class="panelSave3 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{SoundSign}}" hidden="{{SoundSign=='[读]'}}">
11 11
         <image class="universalpic_read_end_white_38x22" src='../images/universalpic_read_end_white_38x22.png' />
12 12
       </view>
13
-      <view class="panelSave2 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{LineSign}}" wx:if="{{LineSign=='[线]'}}">
13
+      <view class="panelSave2 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{LineSign}}" hidden="{{LineSign=='[/线]'}}">
14 14
         <image class="universalpic_editbar_underline_gray_14x20" src='../images/universalpic_editbar_underline_gray_14x20.png' />
15 15
       </view>
16
-      <view class="panelSave3 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{LineSign}}" wx:if="{{LineSign=='[/线]'}}">
16
+      <view class="panelSave3 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{LineSign}}" hidden="{{LineSign=='[线]'}}">
17 17
         <image class="universalpic_underline_end_white_30x22" src='../images/universalpic_underline_end_white_30x22.png' />
18 18
       </view>
19
-      <view class="panelSave2 panelSave1 FlexRow" bindtap="uploadImage">
19
+      <view class="panelSave2 panelSave1 FlexRow" catchtap="uploadImage">
20 20
         <image class="universalpic_picture_gray_26x26" src='../images/universalpic_picture_gray_26x26.png' />
21 21
       </view>
22 22
 
23 23
     </view>
24 24
     <view class='right FlexRow'>
25
-      <view class="clear" bindtap="clear">清空</view>
25
+      <view class="clear" catchtap="clear">清空</view>
26 26
     </view>
27 27
   </view>
28 28
   <view class='lineFooter'></view>

+ 2 - 1
pages/main/detail.js

@@ -200,7 +200,8 @@ Page({
200 200
 
201 201
     function formatList(list) {
202 202
       for (var i = 0; i < list.length; i++) {
203
-        list[i].ContentNew = main.changeStringToView(list[i].Content);
203
+        if (list[i].Content)
204
+          list[i].ContentNew = main.changeStringToView(list[i].Content);
204 205
       }
205 206
       return list;
206 207
     }

+ 5 - 5
pages/main/detail.wxml

@@ -57,9 +57,9 @@
57 57
 
58 58
         <text class="textPinyin" wx:if="{{item.Type=='sound'}}" catchtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="1">{{item.Content}}</text>
59 59
 
60
-        <image class="imageBishun" wx:if="{{item.Type=='image'  && !item.Url}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" />
60
+        <image class="imageBishun" wx:if="{{item.Type=='image'  && !item.Url}}" src='{{item.Content}}' catchtap='showImage' data-name="{{item.Content}}" />
61 61
 
62
-        <image class="imageFree" mode='widthFix' wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' bindtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
62
+        <image class="imageFree" mode='widthFix' wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' catchtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
63 63
 
64 64
   </block>
65 65
   </view>
@@ -73,7 +73,7 @@
73 73
     </view>
74 74
 
75 75
     <view class='right2 FlexRow' wx:if="{{IsShowAnswer[0]==0}}">
76
-      <image class="universalpic_hide_white_34x34" src='../images/universalpic_hide_{{Color.IconColor}}_20p_34x34.png' />
76
+      <image class="universalpic_show_white_30x30" src='../images/universalpic_show_{{Color.IconColor}}_30x30.png' />
77 77
     </view>
78 78
     <view class='right2 FlexRow' catchtap='onShowAnswer' data-start="true" wx:if="{{IsShowAnswer[0]==1}}">
79 79
       <image class="universalpic_hide_white_34x34" src='../images/universalpic_hide_{{Color.IconColor}}_34x34.png' />
@@ -103,9 +103,9 @@
103 103
 
104 104
         <text class="textPinyin" wx:if="{{item.Type=='sound'}}" catchtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="{{itemParent}}">{{item.Content}}</text>
105 105
 
106
-        <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" />
106
+        <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' catchtap='showImage' data-name="{{item.Content}}" />
107 107
 
108
-        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' bindtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
108
+        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' catchtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
109 109
 
110 110
         </block>
111 111
       </view>

+ 5 - 0
pages/main/detail.wxss

@@ -132,6 +132,11 @@
132 132
   background-color: rgba(255,255,255,0.2);
133 133
   margin-top: 66rpx;
134 134
 }
135
+.universalpic_show_white_30x30{
136
+  width: 36rpx;
137
+  height: 36rpx;
138
+  margin: 52rpx 50rpx 0 50rpx;
139
+}
135 140
 
136 141
 .universalpic_hide_white_34x34 {
137 142
   width: 36rpx;

+ 1 - 1
pages/main/searchCardList.wxml

@@ -20,7 +20,7 @@
20 20
           </view>
21 21
         </view>
22 22
         <view class="panelItem2">
23
-          {{item.LimitTimeStr}}
23
+          {{item.CreateTimeStr}}
24 24
         </view>
25 25
       </view>
26 26
     </block>

+ 1 - 1
pages/main/searchWeb1.wxss

@@ -25,7 +25,7 @@
25 25
 .universalpic_search_gray_30x30{
26 26
   width:30rpx;
27 27
   height:30rpx;
28
-  margin: 0 10rpx 0 30rpx;
28
+  margin: 0 20rpx 0 30rpx;
29 29
 }
30 30
 
31 31
 .input{