chengjie 6 years ago
parent
commit
59dae4e753

+ 3 - 2
app.js

@@ -13,8 +13,8 @@ App({
13 13
     this.globalData.systemInfo = wx.getSystemInfoSync();
14 14
   },
15 15
   globalData: {
16
-    Version: "1.0.0.9",
17
-    IsProduction: false,
16
+    Version: "1.0.0.10",
17
+    IsProduction: true,
18 18
     ShareTitle: "可以用来记忆一切的工具",
19 19
     SharePath: "pages/index/index",
20 20
     ShareImage: '',
@@ -26,6 +26,7 @@ App({
26 26
     audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
27 27
     audioUrlYoudao: "https://dict.youdao.com/dictvoice?rate=5&le=auto&audio=",
28 28
     pinyinUrl: "https://pinyin.kylx365.com/sounds/[pinyin].m4a",
29
+    uploadImageUrl:"https://miaguo-1253256735.file.myqcloud.com/",
29 30
     BaiduToken: "",//百度开发平台token
30 31
     systemInfo: null,
31 32
     userInfo: null,

+ 1 - 3
app.json

@@ -1,8 +1,7 @@
1 1
 {
2 2
   "pages": [    
3
-
4
-    "pages/main/addItem",
5 3
     "pages/index/index",
4
+    "pages/main/addItem",
6 5
     "pages/index/accredit",
7 6
     "pages/main/default",
8 7
     "pages/main/cardInfo",
@@ -16,7 +15,6 @@
16 15
     "pages/main/searchWeb",
17 16
     "pages/main/detail",
18 17
     "pages/main/colorplan",
19
-    "pages/main/uploadinmage",
20 18
     "pages/main/setting"
21 19
   ],
22 20
   "window": {

+ 127 - 69
pages/main/add.js

@@ -126,88 +126,146 @@ Page({
126 126
       });
127 127
     }
128 128
     else {
129
-      var userid = app.globalData.userInfo.UserID;
130
-      var isTodayStudy = 0;
131
-      if (that.data.IsTodayStudy && that.data.UpdateType=="add2")
132
-        isTodayStudy = 1;
129
+      that.uploadImageAll(that.data.Field, function (field) {
130
+        that.data.Field=field;
131
+        var userid = app.globalData.userInfo.UserID;
132
+        var isTodayStudy = 0;
133
+        if (that.data.IsTodayStudy && that.data.UpdateType == "add2")
134
+          isTodayStudy = 1;
133 135
 
134
-      var tags = [];
135
-      for (var i = 0; i < that.data.Tags.length; i++) {
136
-        if (that.data.Tags[i])
137
-          tags.push(that.data.Tags[i]);
138
-      }
139
-      var param1 = {
140
-        Tags: tags,
141
-        Field1: "",
142
-        Field2: "",
143
-        Field3: "",
144
-        IsTodayStudy: isTodayStudy,
145
-        ID: that.data.MiaoguoCardID,
146
-      };
147
-      for (var i = 1; i <= 3; i++) {
148
-        for (var key in that.data.Field[i]) {
149
-          var item = that.data.Field[i][key];
150
-          var str = "";
151
-          if (item.Type == "image") {
152
-            if (item.Url){
153
-              str = "[图 url='"+item.Url+"']" + item.Content + "[/图]";
136
+        var tags = [];
137
+        for (var i = 0; i < that.data.Tags.length; i++) {
138
+          if (that.data.Tags[i])
139
+            tags.push(that.data.Tags[i]);
140
+        }
141
+        var param1 = {
142
+          Tags: tags,
143
+          Field1: "",
144
+          Field2: "",
145
+          Field3: "",
146
+          IsTodayStudy: isTodayStudy,
147
+          ID: that.data.MiaoguoCardID,
148
+        };
149
+        for (var i = 1; i <= 3; i++) {
150
+          for (var key in that.data.Field[i]) {
151
+            var item = that.data.Field[i][key];
152
+            var str = "";
153
+            if (item.Type == "image") {
154
+              if (item.Url) {
155
+                str = "[图 url='" + item.Url + "']" + item.Content + "[/图]";
156
+              }
157
+              else
158
+                str = "[图]" + item.Content + "[/图]";
154 159
             }
155
-            else
156
-              str = "[图]" + item.Content + "[/图]";
157
-          }
158
-          else if (item.Type == "line") {
159
-            for (var j = 0; j < item.Content.length; j++) {
160
-              if (item.Content[j].key == "normal")
161
-                str += item.Content[j].value;
162
-              if (item.Content[j].key == "line") {
163
-                str += "[线]" + item.Content[j].value + "[/线]";
160
+            else if (item.Type == "line") {
161
+              for (var j = 0; j < item.Content.length; j++) {
162
+                if (item.Content[j].key == "normal")
163
+                  str += item.Content[j].value;
164
+                if (item.Content[j].key == "line") {
165
+                  str += "[线]" + item.Content[j].value + "[/线]";
166
+                }
164 167
               }
165 168
             }
169
+            else if (item.Type == "sound") {
170
+              if (item.SoundMark)
171
+                str = "[读 src='" + item.SoundMark + "']" + item.Content + "[/读]";
172
+              else
173
+                str = "[读]" + item.Content + "[/读]";
174
+            }
175
+            else if (item.Type == "normal") {
176
+              str = item.Content;
177
+            }
178
+            else if (item.Type == "return") {
179
+              str = "\n";
180
+            }
181
+            param1["Field" + i] += str;
166 182
           }
167
-          else if (item.Type == "sound") {
168
-            if (item.SoundMark)
169
-              str = "[读 src='" + item.SoundMark + "']" + item.Content + "[/读]";
170
-            else
171
-              str = "[读]" + item.Content + "[/读]";
172
-          }
173
-          else if (item.Type == "normal") {
174
-            str = item.Content;
175
-          }
176
-          else if (item.Type == "return") {
177
-            str = "\n";
178
-          }
179
-          param1["Field" + i] += str;
180
-        }
181
-        param1["Field" + i] = main.changeViewToString(param1["Field" + i]);
183
+          param1["Field" + i] = main.changeViewToString(param1["Field" + i]);
182 184
 
183
-      }
184
-      // var param2 = {
185
-      //   param: common.Encrypt(JSON.stringify(param1))
186
-      // }
187
-      main.postData('AddMiaoguoCard?Type=' + that.data.UpdateType + '&UserID=' + userid, param1, function (data) {
188
-        if (that.data.UpdateType == "edit" || that.data.UpdateType == "edit2") {
189
-          that.saveNewData();
190
-          that.onClose();
191 185
         }
192
-        else {
193
-          wx.showToast({
194
-            title: '已保存!',
195
-            image: "../images/universalpic_saved_white_120x120.png",
196
-          });
197
-
198
-          if (that.data.UpdateType == "add2") {
199
-            that.initAddCard();
186
+        // var param2 = {
187
+        //   param: common.Encrypt(JSON.stringify(param1))
188
+        // }
189
+        main.postData('AddMiaoguoCard?Type=' + that.data.UpdateType + '&UserID=' + userid, param1, function (data) {
190
+          if (that.data.UpdateType == "edit" || that.data.UpdateType == "edit2") {
191
+            that.saveNewData();
192
+            that.onClose();
200 193
           }
194
+          else {
195
+            wx.showToast({
196
+              title: '已保存!',
197
+              image: "../images/universalpic_saved_white_120x120.png",
198
+            });
199
+
200
+            if (that.data.UpdateType == "add2") {
201
+              that.initAddCard();
202
+            }
201 203
 
202
-          var taskToday = wx.getStorageSync("TaskToday");
203
-          taskToday.CardNumber++;
204
-          wx.setStorageSync("TaskToday", taskToday);
204
+            var taskToday = wx.getStorageSync("TaskToday");
205
+            taskToday.CardNumber++;
206
+            wx.setStorageSync("TaskToday", taskToday);
205 207
 
206
-          that.saveNewData();
207
-        }
208
+            that.saveNewData();
209
+          }
210
+        });
208 211
       });
209 212
     }
210 213
   },
214
+  uploadImageAll: function (arr, callback) {
215
+    var that=this;
216
+    var arrSource=[], arrResult=[];
217
+    for(var i=0;i<arr.length;i++){
218
+      for(var j=0;j<arr[i].length;j++){
219
+        if (arr[i][j].Type == "image" && arr[i][j].Url && !arr[i][j].Content){
220
+          //console.log("Source:" +arr[i][j].Url);
221
+          arrSource.push(arr[i][j].Url);
222
+          that.uploadImage(arr[i][j].Url, function (data) {
223
+            //console.log("Target:"+data);
224
+            data = app.globalData.uploadImageUrl+data;
225
+            arrResult.push(data);
226
+          });
227
+        }
228
+      }
229
+    }
230
+
231
+    var interval=setInterval(function(){
232
+      //console.log(arrResult.length);
233
+      if (arrResult.length >= arrSource.length){
234
+        clearInterval(interval);
235
+        var ari=0;
236
+        for (var i = 0; i < arr.length; i++) {
237
+          for (var j = 0; j < arr[i].length; j++) {
238
+            if (arr[i][j].Type == "image" && arr[i][j].Url && !arr[i][j].Content) {
239
+              arr[i][j].Content=arrResult[ari++];
240
+            }
241
+          }
242
+        }
243
+        //console.log(JSON.stringify(arr));
244
+        callback(arr);
245
+      }
246
+    },500);
247
+  },
248
+  uploadImage:function(file,callback){
249
+    var url = common.Encrypt("MiaoguoUploadFile");
250
+    wx.uploadFile({
251
+      url: app.globalData.serverUrl + url,
252
+      filePath: file,
253
+      name: 'file',
254
+      success(res) {
255
+        wx.hideLoading();
256
+        callback(res.data);
257
+      },
258
+      fail: function (err) {
259
+        wx.hideLoading();
260
+        wx.showModal({
261
+          title: '上传图片失败',
262
+          showCancel: false,
263
+          content: JSON.stringify(err),
264
+        });
265
+      }
266
+    });
267
+
268
+  },
211 269
   saveNewData: function () {
212 270
     var list = wx.getStorageSync("CardList");
213 271
     for (var i = 0; i < list.length; i++) {

+ 159 - 185
pages/main/addItem.js

@@ -3,12 +3,11 @@ import main from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5 5
 
6
-var tempCursor = 0, btnName = "";
6
+var tempCursor = 0,
7
+  btnName = "";
7 8
 var arrSoundMark = [];
8
-var isUpload = true;
9
-
9
+var isUnload = true;
10 10
 var isAndroid = false;
11
-
12 11
 var isEdit = true;
13 12
 
14 13
 Page({
@@ -23,7 +22,6 @@ Page({
23 22
     var id = options.id;
24 23
     var fieldid = options.fieldid;
25 24
     tempCursor = 0, btnName = "", arrSoundMark = [];
26
-    isEdit = true;
27 25
 
28 26
     var that = this;
29 27
     that.setData({
@@ -36,72 +34,121 @@ Page({
36 34
       title: '编辑 段落' + fieldid,
37 35
     });
38 36
 
39
-    var systemInfo = wx.getSystemInfoSync();
40
-    if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
37
+    if (app.globalData.systemInfo.system.indexOf("Android") >= 0) {
41 38
       isAndroid = true;
42 39
     }
43 40
   },
44 41
   onShow: function () {
45
-    console.log("onShow:" + isEdit);
42
+    console.log("onShow");
46 43
     var that = this;
47
-    if (isEdit) {
48
-      var list = wx.getStorageSync("CardList");
49
-
50
-      var card = {};
51
-      for (var i = 0; i < list.length; i++) {
52
-        if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
53
-          var content = main.encryptUrl(list[i].Content[this.data.FieldNumber].Content);
54
-          this.setData({
55
-            Field: content,
56
-          });
57
-
58
-          if (!wx.getStorageSync("TempCardInfoAddItem")) {
59
-            wx.setStorageSync("TempCardInfoAddItem", content);
60
-          }
61
-
62
-          break;
44
+
45
+    if (isAndroid && !isEdit) {
46
+      return;
47
+    }
48
+
49
+    var list = wx.getStorageSync("CardList");
50
+    var card = {};
51
+    for (var i = 0; i < list.length; i++) {
52
+      if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
53
+        var content = main.encryptUrl(list[i].Content[this.data.FieldNumber].Content);
54
+        this.setData({
55
+          Field: content,
56
+        });
57
+
58
+        if (!wx.getStorageSync("TempCardInfoAddItem")) {
59
+          wx.setStorageSync("TempCardInfoAddItem", content);
63 60
         }
61
+
62
+        break;
64 63
       }
65 64
     }
66
-    isUpload = true;
65
+
66
+    isUnload = true;
67 67
   },
68 68
   onUnload: function () {
69
-    if (isUpload) {
69
+    if (isUnload) {
70 70
       var content = wx.getStorageSync("TempCardInfoAddItem");
71 71
       if (content != undefined) {
72 72
         this.updateField(content);
73 73
         wx.removeStorageSync("TempCardInfoAddItem");
74 74
       }
75 75
     }
76
+    isEdit = true;
76 77
   },
77
-  bindFormSubmit: function (e) {
78
-    console.log(e.detail.value);
79
-    console.log(e.detail.target.id);
80
-    btnName = e.detail.target.id;
78
+  bindinputField: function (e) {
79
+    var that = this;
80
+    if (isAndroid && !isEdit) {
81
+      return;
82
+    }
83
+
84
+    this.setData({
85
+      Field: e.detail.value,
86
+    });
87
+    console.log("bindinputField:" + e.detail.value);
88
+    //this.updateField();
89
+
90
+  },
91
+  addSymbol: function (e) {
92
+    console.log("addSymbol");
93
+    isEdit = true;
94
+    var that = this;
95
+
96
+    btnName = e.currentTarget.dataset.id;
81 97
     if (btnName == "[读]") {
82 98
       this.setData({
83 99
         SoundSign: "[/读]",
84 100
       });
85
-    }
86
-    else if (btnName == "[/读]") {
101
+    } else if (btnName == "[/读]") {
87 102
       this.setData({
88 103
         SoundSign: "[读]",
89 104
       });
90
-    }
91
-    else if (btnName == "[线]") {
105
+    } else if (btnName == "[线]") {
92 106
       this.setData({
93 107
         LineSign: "[/线]",
94 108
       });
95
-    }
96
-    else if (btnName == "[/线]") {
109
+    } else if (btnName == "[/线]") {
97 110
       this.setData({
98 111
         LineSign: "[线]",
99 112
       });
100 113
     }
101
-    console.log("tempCursor:" + tempCursor);
114
+
115
+    if (!this.data.Focus) {
116
+      this.data.Field = this.data.Field + btnName;
117
+      this.setData({
118
+        Field: this.data.Field,
119
+      });
120
+    }
121
+    //console.log("addSymbol:" + this.data.Field);
122
+
123
+    setTimeout(function () {
124
+      that.setData({
125
+        Focus: true,
126
+      });
127
+    }, 300);
128
+  },
129
+  onBindFocus: function () {
130
+    this.setData({
131
+      Focus: true,
132
+    });
133
+  },
134
+  onBindblur: function (e) {
135
+    var that = this;
136
+    console.log("onBindblur:" + isEdit + " Filed:" + this.data.Field);
137
+    if (isAndroid && !isEdit) {
138
+      setTimeout(function () {
139
+        isEdit = true;
140
+      }, 500);
141
+      return;
142
+    }
143
+    isEdit = false;
144
+
145
+    this.updateField();
146
+    tempCursor = e.detail.cursor;
147
+    //console.log("tempCursor:" + tempCursor);
102 148
     if (tempCursor == undefined)
103 149
       tempCursor = this.data["Field"].length;
104
-    var str1 = "", str2 = "";
150
+    var str1 = "",
151
+      str2 = "";
105 152
     if (this.data.Field.length > 0) {
106 153
       str1 = this.data.Field.substr(0, tempCursor);
107 154
       str2 = this.data.Field.substring(tempCursor, this.data.Field.length);
@@ -111,159 +158,98 @@ Page({
111 158
     var cur = 1;
112 159
     if (btnName == "[读]" || btnName == "[线]") {
113 160
       cur = 3;
114
-    }
115
-    else if (btnName == "[/读]" || btnName == "[/线]") {
161
+    } else if (btnName == "[/读]" || btnName == "[/线]") {
116 162
       cur = 4;
163
+    } else if (btnName == "(     )") {
164
+      cur = 7;
165
+    } else if (btnName == "_____") {
166
+      cur = 5;
117 167
     }
118 168
 
119 169
     this.data.Field = str1 + btnName + str2;
120 170
     this.setData({
121 171
       Field: this.data.Field,
122
-      //Focus:false,
172
+      Focus: false,
123 173
       Cursor: tempCursor + cur,
124 174
     });
125 175
 
126 176
     btnName = "";
127 177
 
128 178
   },
129
-  bindinputField: function (e) {
130
-    console.log("bindinputField:" + isEdit);
131
-    // if (isEdit) {
132
-    //   this.setData({
133
-    //     Field: e.detail.value,
134
-    //   });
135
-    // }
136
-  },
137
-  addSymbol: function (e) {
138
-    console.log("addSymbol:" + isEdit);
139
-    // btnName = e.currentTarget.dataset.id;
140
-    // if (btnName == "[读]") {
141
-    //   this.setData({
142
-    //     SoundSign: "[/读]",
143
-    //   });
144
-    // }
145
-    // else if (btnName == "[/读]") {
146
-    //   this.setData({
147
-    //     SoundSign: "[读]",
148
-    //   });
149
-    // }
150
-    // else if (btnName == "[线]") {
151
-    //   this.setData({
152
-    //     LineSign: "[/线]",
153
-    //   });
154
-    // }
155
-    // else if (btnName == "[/线]") {
156
-    //   this.setData({
157
-    //     LineSign: "[线]",
158
-    //   });
159
-    // } 
160
-
161
-    // if (!this.data.Focus){
162
-    //   this.data.Field=this.data.Field+btnName;
163
-    //   this.setData({
164
-    //     Field: this.data.Field,
165
-    //   });
166
-    // }
167
-  },
168
-  onBindFocus: function () {
169
-    console.log("onBindFocus:" + isEdit);
170
-    // this.setData({
171
-    //   Focus: true,
172
-    // });
173
-  },
174
-  onBindblur: function (e) {
175
-    console.log("onBindblur:" + isEdit);
176
-    // var that=this;
177
-    // if (isEdit) {
178
-    //   that.androidFunction();
179
-
180
-    //   //console.log(e);
181
-    tempCursor = e.detail.cursor;
182
-    //   //console.log("tempCursor:" + tempCursor);
183
-    //   if (tempCursor == undefined)
184
-    //     tempCursor = this.data["Field"].length;
185
-    //   var str1 = "", str2 = "";
186
-    //   if (this.data.Field.length > 0) {
187
-    //     str1 = this.data.Field.substr(0, tempCursor);
188
-    //     str2 = this.data.Field.substring(tempCursor, this.data.Field.length);
189
-    //   }
190
-    //   //console.log("str1:" + str1);
191
-    //   //console.log("str2:" + str2);
192
-    //   var cur = 1;
193
-    //   if (btnName == "[读]" || btnName == "[线]") {
194
-    //     cur = 3;
195
-    //   }
196
-    //   else if (btnName == "[/读]" || btnName == "[/线]") {
197
-    //     cur = 4;
198
-    //   }
199
-
200
-    //   this.data.Field = str1 + btnName + str2;
201
-    //   this.setData({
202
-    //     Field: this.data.Field,
203
-    //     Focus:false,
204
-    //     Cursor: tempCursor + cur,
205
-    //   });
206
-
207
-    //   btnName = "";
208
-
209
-
210
-    // }
211
-  },
212 179
   onSearch: function (e) {
213
-    // wx.setStorageSync("TempFieldNumber", this.data.FieldNumber);
214
-    // wx.navigateTo({
215
-    //   url: './searchWeb',
216
-    // });
217
-    // this.updateField();
180
+    wx.setStorageSync("TempFieldNumber", this.data.FieldNumber);
181
+    wx.navigateTo({
182
+      url: './searchWeb',
183
+    });
184
+    this.updateField();
218 185
   },
219 186
   clear: function () {
220
-    console.log("clear:" + isEdit);
221
-    // this.setData({
222
-    //   Field: "",
223
-    //   Focus: false,
224
-    //   Cursor: 0,
225
-    // });
226
-    // this.updateField();
187
+    var that = this;
188
+    console.log("clear");
189
+    this.setData({
190
+      Field: "",
191
+      Focus: true,
192
+      Cursor: 0,
193
+    });
194
+    btnName = "";
195
+    isEdit = false;
196
+    this.updateField();
197
+
198
+  },
199
+  closeAddItem: function (e) {
200
+    var isSave = e.currentTarget.dataset.idsave;
201
+    if (isSave == "true") {
202
+      isUnload = false;
203
+      wx.removeStorageSync("TempCardInfoAddItem");
204
+      this.updateField();
205
+    }
206
+    wx.navigateBack({
207
+      delta: 1,
208
+    });
227 209
   },
228 210
 
229 211
   uploadImage: function () {
230
-    console.log("uploadImage:" + isEdit);
231
-    // var that=this;
232
-    // that.androidFunction();
233
-    // wx.chooseImage({
234
-    //   count: 1,
235
-    //   sizeType: ['compressed'],
236
-    //   sourceType: ['album', 'camera'],
237
-    //   success(res) {
238
-    //     // tempFilePath可以作为img标签的src属性显示图片
239
-    //     const tempFilePaths = res.tempFilePaths;
240
-    //     //console.log(tempFilePaths[0]);
241
-
242
-    //     that.data.Field = that.data.Field + "[图 url='" + tempFilePaths[0] + "'][/图]";
243
-
244
-    //     //console.log("uploadImageEnd:" + that.data.Field);
245
-
246
-    //     that.setData({
247
-    //       Field: that.data.Field,
248
-    //       Focus: false,
249
-    //     });
250
-    //     that.updateField();
251
-
252
-    //   },
253
-    //   fail:function(){
254
-    //   }
255
-    // });
256
-  },
212
+    console.log("uploadImageStart");
213
+    var that = this;
214
+
215
+    wx.chooseImage({
216
+      count: 1,
217
+      sizeType: ['compressed'],
218
+      sourceType: ['album', 'camera'],
219
+      success(res) {
220
+        // tempFilePath可以作为img标签的src属性显示图片
221
+        const tempFilePaths = res.tempFilePaths;
222
+        //console.log(tempFilePaths[0]);
223
+        //that.data.Field = that.data.Field + "[图 url='" + tempFilePaths[0] + "']" + tempFilePaths[0] + "[/图]";
224
+
225
+
226
+        if (tempCursor == undefined)
227
+          tempCursor = that.data.Field.length;
228
+        var str1 = "",
229
+          str2 = "";
230
+        if (that.data.Field.length > 0) {
231
+          str1 = that.data.Field.substr(0, tempCursor);
232
+          str2 = that.data.Field.substring(tempCursor, that.data.Field.length);
233
+        }
234
+
235
+        var str0 = "[图 url='" + tempFilePaths[0] + "'][/图]";
236
+
237
+        that.data.Field = str1 + str0 + str2;
238
+
239
+        console.log("uploadImageEnd:" + that.data.Field);
240
+
241
+        that.setData({
242
+          Field: that.data.Field,
243
+          Focus: false,
244
+        });
245
+        that.updateField();
246
+      },
247
+      fail: function () {
248
+
249
+      }
250
+    });
257 251
 
258
-  // androidFunction:function(){
259
-  //   isEdit=false;
260
-  //   var systemInfo = wx.getSystemInfoSync();
261
-  //   if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
262
-  //     setTimeout(function () {
263
-  //       isEdit = true;
264
-  //     }, 1000);
265
-  //   }
266
-  // },
252
+  },
267 253
   updateField: function (history) {
268 254
     var str = this.data.Field;
269 255
     str = main.decryptUrl(str);
@@ -286,18 +272,6 @@ Page({
286 272
     }
287 273
     wx.setStorageSync("CardList", list);
288 274
   },
289
-  closeAddItem: function (e) {
290
-    var isSave = e.currentTarget.dataset.idsave;
291
-    if (isSave == "true") {
292
-      isUpload = false;
293
-      wx.removeStorageSync("TempCardInfoAddItem");
294
-      this.updateField();
295
-    }
296
-    wx.navigateBack({
297
-      delta: 1,
298
-    });
299
-  },
300
-
301 275
   onShareAppMessage: function () {
302 276
     return {
303 277
       title: app.globalData.ShareTitle,
@@ -305,4 +279,4 @@ Page({
305 279
       imageUrl: app.globalData.ShareImage,
306 280
     }
307 281
   },
308
-})
282
+})

+ 46 - 58
pages/main/addItem.wxml

@@ -1,66 +1,54 @@
1 1
 <view class="container FlexColumn" style='height:{{Containnerheight}}rpx;'>
2
-  <form bindsubmit='bindFormSubmit'>
3
-    <view class="panelTag FlexRow">
4
-      <view class='left FlexRow'>
5
-        <button class="panelSave1 FlexRow" form-type="submit" id="onSearch">
6
-          <view class="add">+</view> 资料
7
-        </button>
8
-        <button class="panelSave2 panelSave1 FlexRow" data-id="{{SoundSign}}" hidden="{{SoundSign=='[/读]'}}" form-type="submit" id="[读]">
9
-          <image class="universalpic_read_begin_gray_20x20" src='../images/universalpic_read_begin_gray_20x20.png' />
10
-        </button>
11
-        <button class="panelSave3 panelSave1 FlexRow" data-id="{{SoundSign}}" hidden="{{SoundSign=='[读]'}}" form-type="submit" id="[/读]">
12
-          <image class="universalpic_read_end_white_38x22" src='../images/universalpic_read_end_white_38x22.png' />
13
-        </button>
14
-        <button class="panelSave2 panelSave1 FlexRow" data-id="{{LineSign}}" hidden="{{LineSign=='[/线]'}}" form-type="submit" id="[线]">
15
-          <image class="universalpic_editbar_underline_gray_14x20" src='../images/universalpic_editbar_underline_gray_14x20.png' />
16
-        </button>
17
-        <button class="panelSave3 panelSave1 FlexRow" data-id="{{LineSign}}" hidden="{{LineSign=='[线]'}}" form-type="submit" id="[/线]">
18
-          <image class="universalpic_underline_end_white_30x22" src='../images/universalpic_underline_end_white_30x22.png' />
19
-        </button>
20
-        <button class="panelSave2 panelSave1 FlexRow" form-type="submit" id="uploadImage">
21
-          <image class="universalpic_picture_gray_26x26" src='../images/universalpic_picture_gray_26x26.png' />
22
-        </button>
23
-
2
+  <view class="panelTag FlexRow">
3
+    <view class='left FlexRow'>
4
+      <view class="panelSave1 FlexRow" bindtap="onSearch">
5
+        <view class="add">+</view> 资料
6
+      </view>
7
+      <view class="panelSave2 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{SoundSign}}" hidden="{{SoundSign=='[/读]'}}">
8
+        <image class="universalpic_read_begin_gray_20x20" src='../images/universalpic_read_begin_gray_20x20.png' />
9
+      </view>
10
+      <view class="panelSave3 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{SoundSign}}" hidden="{{SoundSign=='[读]'}}">
11
+        <image class="universalpic_read_end_white_38x22" src='../images/universalpic_read_end_white_38x22.png' />
12
+      </view>
13
+      <view class="panelSave2 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{LineSign}}" hidden="{{LineSign=='[/线]'}}">
14
+        <image class="universalpic_editbar_underline_gray_14x20" src='../images/universalpic_editbar_underline_gray_14x20.png' />
15
+      </view>
16
+      <view class="panelSave3 panelSave1 FlexRow" bindtap="addSymbol" data-id="{{LineSign}}" hidden="{{LineSign=='[线]'}}">
17
+        <image class="universalpic_underline_end_white_30x22" src='../images/universalpic_underline_end_white_30x22.png' />
24 18
       </view>
25
-      <view class='right FlexRow'>
26
-        <button class="clear" form-type="submit" id="clear">清空</button>
19
+      <view class="panelSave2 panelSave1 FlexRow" catchtap="uploadImage">
20
+        <image class="universalpic_picture_gray_26x26" src='../images/universalpic_picture_gray_26x26.png' />
27 21
       </view>
22
+
28 23
     </view>
29
-    <view class='lineFooter'></view>
30
-    <view class='panelInput'>
31
-      <textarea class="input" maxlength='-1' show-confirm-bar="true" value="{{Field}}" focus="{{Focus}}" cursor="{{Cursor}}" bindinput="bindinputField" bindblur="onBindblur" bindfocus="onBindFocus" data-id='{{FieldNumber}}' name="textarea" />
24
+    <view class='right FlexRow'>
25
+      <view class="clear" catchtap="clear">清空</view>
32 26
     </view>
33
-    <cover-view class='lineFooter'></cover-view>
34
-    <cover-view class="panelTag0 panelTag FlexRow">
35
-      <cover-view class="btn0"></cover-view>
36
-      <cover-view class="btnPanel">
37
-        <button class="btn FlexRow" form-type="submit" id="(     )">
38
-          <cover-image class="universalpic_editbar_brackets_gray" src='../images/universalpic_editbar_brackets_gray.png' />
39
-        </button>
40
-      </cover-view>
41
-      <cover-view class="btnPanel">
42
-        <button class="btn FlexRow" form-type="submit" id="_____">
43
-          <cover-image class="universalpic_editbar_underline_gray" src='../images/universalpic_editbar_underline_gray.png' />
44
-        </button>
45
-      </cover-view>
46
-      <cover-view class="btnPanel" wx:for="{{BtnArray}}" wx:key="index">
47
-        <button class="btn FlexRow" form-type="submit" id="{{item}}" >
48
-          {{item}}
49
-        </button>
50
-      </cover-view>
51
-      <cover-view class="btnPanel">
52
-        <button class="btn FlexRow" form-type="submit" id="²">
53
-          <cover-image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_sqr_gray.png' />
54
-        </button>
55
-      </cover-view>
27
+  </view>
28
+  <view class='lineFooter'></view>
29
+  <view class='panelInput'>
30
+    <textarea class="input" maxlength='-1' show-confirm-bar="true" value="{{Field}}" focus="{{Focus}}" cursor="{{Cursor}}" bindinput="bindinputField" bindblur="onBindblur" bindfocus="onBindFocus" data-id='{{FieldNumber}}' />
31
+  </view>
32
+  <cover-view class='lineFooter'></cover-view>
33
+  <cover-view class="panelTag0 panelTag FlexRow">
34
+    <cover-view class="btn0"></cover-view>
35
+    <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="(     )">
36
+      <cover-image class="universalpic_editbar_brackets_gray" src='../images/universalpic_editbar_brackets_gray.png' />
56 37
     </cover-view>
57
-
58
-    <cover-view class='lineFooter'></cover-view>
59
-    <cover-view class='panelBtn FlexRow'>
60
-      <button class='text1' bindtap="closeAddItem" data-idsave="false">取消</button>
61
-      <cover-view class='line2'></cover-view>
62
-      <button class='text2 text1' bindtap="closeAddItem" data-idsave="true">确定</button>
38
+    <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="_____">
39
+      <cover-image class="universalpic_editbar_underline_gray" src='../images/universalpic_editbar_underline_gray.png' />
63 40
     </cover-view>
64
-    <cover-view class='lineFooter'></cover-view>
65
-  </form>
41
+    <cover-view class="btn" bindtap="addSymbol" wx:for="{{BtnArray}}" wx:key="index" data-id="{{item}}">{{item}}</cover-view>
42
+    <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="²">
43
+      <cover-image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_sqr_gray.png' />
44
+    </cover-view>
45
+  </cover-view>
46
+  <cover-view class='lineFooter'></cover-view>
47
+  <cover-view class='panelBtn FlexRow'>
48
+    <cover-view class='text1' bindtap="closeAddItem" data-idsave="false">取消</cover-view>
49
+    <cover-view class='line1'></cover-view>
50
+    <cover-view class='text2 text1' bindtap="closeAddItem" data-idsave="true">确定</cover-view>
51
+  </cover-view>
52
+  <cover-view class='lineFooter'></cover-view>
53
+
66 54
 </view>

+ 29 - 35
pages/main/addItem.wxss

@@ -23,22 +23,20 @@
23 23
 .panelSave1 {
24 24
   width: 148rpx;
25 25
   background-color: #fff;
26
-  border: 1rpx solid #9b9b9b;
27
-  color: #787878;
26
+  border:1rpx solid #9B9B9B;
27
+  color:#787878;
28 28
   text-align: center;
29 29
   height: 80rpx;
30 30
   line-height: 80rpx;
31 31
   border-radius: 10rpx;
32 32
   font-size: 28rpx;
33
-  padding-left: 0;
34
-  padding-right: 0;
35 33
 }
36 34
 
37 35
 .panelSave2 {
38 36
   width: 80rpx;
39 37
   height: 80rpx;
40 38
   background-color: #fff;
41
-  border: 1rpx solid #9b9b9b;
39
+  border:1rpx solid #9B9B9B;
42 40
   margin-left: 10rpx;
43 41
 }
44 42
 
@@ -46,8 +44,8 @@
46 44
   width: 80rpx;
47 45
   height: 80rpx;
48 46
   margin-left: 10rpx;
49
-  background-color: #0071ef;
50
-  border: 1rpx solid #0071ef;
47
+  background-color: #0071EF;
48
+  border:1rpx solid #0071EF;
51 49
 }
52 50
 
53 51
 .universalpic_read_begin_gray_20x20 {
@@ -55,22 +53,22 @@
55 53
   height: 20rpx;
56 54
 }
57 55
 
58
-.universalpic_read_end_white_38x22 {
56
+.universalpic_read_end_white_38x22{
59 57
   width: 38rpx;
60 58
   height: 22rpx;
61 59
 }
62 60
 
63
-.universalpic_editbar_underline_gray_14x20 {
61
+.universalpic_editbar_underline_gray_14x20{
64 62
   width: 14rpx;
65 63
   height: 20rpx;
66 64
 }
67 65
 
68
-.universalpic_underline_end_white_30x22 {
66
+.universalpic_underline_end_white_30x22{
69 67
   width: 31rpx;
70 68
   height: 22rpx;
71 69
 }
72 70
 
73
-.universalpic_picture_gray_26x26 {
71
+.universalpic_picture_gray_26x26{
74 72
   width: 26rpx;
75 73
   height: 26rpx;
76 74
 }
@@ -86,13 +84,11 @@
86 84
   height: 80rpx;
87 85
   color: #0071ef;
88 86
   background-color: #fff;
89
-  border: 1rpx solid #9b9b9b;
87
+  border:1rpx solid #9B9B9B;
90 88
   text-align: center;
91 89
   border-radius: 10rpx;
92 90
   line-height: 80rpx;
93 91
   font-size: 24rpx;
94
-  padding-left: 0;
95
-  padding-right: 0;
96 92
 }
97 93
 
98 94
 .line1 {
@@ -117,35 +113,35 @@
117 113
   width: 20rpx;
118 114
 }
119 115
 
120
-.panelTag .btnPanel{
121
-  width: 80rpx;
122
-  height: 80rpx;
123
-  margin-right: 10rpx;
124
-  border: 1rpx solid #9b9b9b;
125
-  border-radius: 10rpx;
126
-}
127
-
128 116
 .panelTag .btn {
129 117
   font-family: 'Roboto-Black';
130 118
   width: 80rpx;
131 119
   background-color: #fff;
132
-  color: #787878;
133
-  
120
+  border:1rpx solid #9B9B9B;
121
+  color:#787878;
122
+  border-radius: 10rpx;
134 123
   text-align: center;
135 124
   line-height: 80rpx;
136 125
   height: 80rpx;
126
+  margin-right: 10rpx;
137 127
   font-size: 36rpx;
138
-  
139 128
 }
140
-.panelTag .btn[native] {
141
-  border: none;
129
+
130
+.panelTag .btn1 {
131
+  width: 80rpx;
132
+  height: 80rpx;
133
+  background-color: #fff;
134
+  border:1rpx solid #9B9B9B;
135
+  border-radius: 10rpx;
136
+  margin-right: 10rpx;
142 137
 }
138
+
143 139
 .universalpic_editbar_brackets_gray {
144 140
   width: 34rpx;
145 141
   height: 26rpx;
146 142
 }
147 143
 
148
-.universalpic_editbar_underline_gray {
144
+.universalpic_editbar_underline_gray{
149 145
   width: 18rpx;
150 146
   height: 28rpx;
151 147
 }
@@ -167,7 +163,7 @@
167 163
 .input {
168 164
   margin: 30rpx 30rpx 0 30rpx;
169 165
   width: 690rpx;
170
-  height: 220rpx;
166
+  height:220rpx;
171 167
 }
172 168
 
173 169
 .panelBtn {
@@ -176,26 +172,24 @@
176 172
   z-index: 10;
177 173
 }
178 174
 
179
-.panelBtn .line2 {
175
+.panelBtn .line1 {
180 176
   width: 4rpx;
181 177
   height: 30rpx;
182 178
   background-color: #d2d2d2;
183 179
 }
184 180
 
185 181
 .panelBtn .text1 {
186
-  width: 370rpx;
182
+  width: 374rpx;
187 183
   line-height: 100rpx;
188 184
   text-align: center;
189 185
   font-size: 28rpx;
190 186
   color: #a20602;
191
-  padding-left: 0;
192
-  padding-right: 0;
193 187
 }
194 188
 
195 189
 .panelBtn .text2 {
196 190
   color: #0071ef;
197 191
 }
198 192
 
199
-.lineFooter {
193
+.lineFooter{
200 194
   z-index: 10;
201
-}
195
+}

+ 9 - 0
pages/main/detail.js

@@ -668,6 +668,15 @@ Page({
668 668
     this.setData({
669 669
       TaskInfo: this.data.TaskInfo,
670 670
     });
671
+
672
+    main.getData('UpdateCardImageUrl?MiaoguoCardID=' + this.data.TaskInfo[0].ID, function (data) {
673
+
674
+    });
675
+  },
676
+  onClose:function(){
677
+    wx.navigateBack({
678
+      delta: 1,
679
+    });
671 680
   },
672 681
   onShareAppMessage: function () {
673 682
     return {

+ 2 - 0
pages/main/detail.wxml

@@ -129,6 +129,8 @@
129 129
       <view style='color:{{Color.FrontColor1}};'>单张题卡平均用时</view>
130 130
       <view class="time">{{Speed2}}</view>
131 131
     </view>
132
+
133
+    <view class='panelLastFooter' bindtap='onClose'>关闭</view>
132 134
   </view>
133 135
 
134 136
   <view class='footer' wx:if="{{NumberNew+NumberReview+NumberHistory>0}}"></view>

+ 10 - 1
pages/main/detail.wxss

@@ -381,7 +381,16 @@
381 381
   font-family: 'Roboto-Black';
382 382
 }
383 383
 
384
-
384
+.panelLastFooter{
385
+  width: 100%;
386
+  height:130rpx;
387
+  border-top:1rpx solid rgba(0, 0, 0, 0.2);
388
+  font-size:36rpx;
389
+  text-align: center;
390
+  line-height: 130rpx;
391
+  position: fixed;
392
+  bottom: 0;
393
+}
385 394
 .practice_introduction_marks_a{
386 395
   width: 22rpx;
387 396
   height: 16rpx;

+ 5 - 1
pages/main/searchCardList.js

@@ -70,7 +70,7 @@ Page({
70 70
           result.push(str.substring(str.indexOf("[图]") + 3, str.indexOf("[/图]")));
71 71
         else {
72 72
           str = str.substr(str.indexOf("[图") + 2);
73
-          result.push(str.substring(str.indexOf("url='") + 7, str.indexOf("]")-1));
73
+          result.push(str.substring(str.indexOf(" url='") + 6, str.indexOf("]")-1));
74 74
           str = str.substring(str.indexOf("]") + 1, str.indexOf("[/图]"));
75 75
           result.push(str);
76 76
         }
@@ -131,6 +131,10 @@ Page({
131 131
     this.setData({
132 132
       List: this.data.List,
133 133
     });
134
+
135
+    main.getData('UpdateCardImageUrl?MiaoguoCardID='+id, function (data) {
136
+      
137
+    });
134 138
   },
135 139
   gotoNextPage: function (e) {
136 140
     wx.showLoading({

+ 0 - 39
pages/main/uploadinmage.js

@@ -1,39 +0,0 @@
1
-import common from '../../utils/util';
2
-import main from '../../utils/main';
3
-
4
-const app = getApp();
5
-
6
-Page({
7
-  data: {
8
-  },
9
-  onLoad: function () {
10
-    wx.hideShareMenu();
11
-    var that = this;
12
-    that.setData({
13
-      Containnerheight: main.getWindowHeight(),
14
-    });
15
-  },
16
-  upload:function(){
17
-    wx.chooseImage({
18
-      count: 1,
19
-      sizeType: ['original', 'compressed'],
20
-      sourceType: ['album', 'camera'],
21
-      success(res) {
22
-        // tempFilePath可以作为img标签的src属性显示图片
23
-        const tempFilePaths = res.tempFilePaths;
24
-        var url = common.Encrypt("MiaoguoUploadFile");
25
-        wx.uploadFile({
26
-          url: app.globalData.serverUrlLocalhost +url, // 仅为示例,非真实的接口地址
27
-          filePath: tempFilePaths[0],
28
-          name: 'file',
29
-          formData: {
30
-            filename: 'test'
31
-          },
32
-          success(res) {
33
-            
34
-          }
35
-        })
36
-      }
37
-    });
38
-  },
39
-});

+ 0 - 3
pages/main/uploadinmage.json

@@ -1,3 +0,0 @@
1
-{
2
-  "usingComponents": {}
3
-}

+ 0 - 2
pages/main/uploadinmage.wxml

@@ -1,2 +0,0 @@
1
-<!--pages/main/uploadinmage.wxml-->
2
-<button bindtap='upload'>上传图片</button>

+ 0 - 1
pages/main/uploadinmage.wxss

@@ -1 +0,0 @@
1
-/* pages/main/uploadinmage.wxss */