|
|
@@ -7,6 +7,8 @@ var tempCursor = 0, btnName = "";
|
|
7
|
7
|
var arrSoundMark = [];
|
|
8
|
8
|
var isUpload = true;
|
|
9
|
9
|
|
|
|
10
|
+var isAndroid = false;
|
|
|
11
|
+
|
|
10
|
12
|
var isEdit = true;
|
|
11
|
13
|
|
|
12
|
14
|
Page({
|
|
|
@@ -21,7 +23,7 @@ Page({
|
|
21
|
23
|
var id = options.id;
|
|
22
|
24
|
var fieldid = options.fieldid;
|
|
23
|
25
|
tempCursor = 0, btnName = "", arrSoundMark = [];
|
|
24
|
|
- isEdit=true;
|
|
|
26
|
+ isEdit = true;
|
|
25
|
27
|
|
|
26
|
28
|
var that = this;
|
|
27
|
29
|
that.setData({
|
|
|
@@ -33,11 +35,16 @@ Page({
|
|
33
|
35
|
wx.setNavigationBarTitle({
|
|
34
|
36
|
title: '编辑 段落' + fieldid,
|
|
35
|
37
|
});
|
|
|
38
|
+
|
|
|
39
|
+ var systemInfo = wx.getSystemInfoSync();
|
|
|
40
|
+ if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
|
|
|
41
|
+ isAndroid = true;
|
|
|
42
|
+ }
|
|
36
|
43
|
},
|
|
37
|
44
|
onShow: function () {
|
|
38
|
|
- console.log("onShow:"+isEdit);
|
|
|
45
|
+ console.log("onShow:" + isEdit);
|
|
39
|
46
|
var that = this;
|
|
40
|
|
- if (isEdit){
|
|
|
47
|
+ if (isEdit) {
|
|
41
|
48
|
var list = wx.getStorageSync("CardList");
|
|
42
|
49
|
|
|
43
|
50
|
var card = {};
|
|
|
@@ -67,17 +74,10 @@ Page({
|
|
67
|
74
|
}
|
|
68
|
75
|
}
|
|
69
|
76
|
},
|
|
70
|
|
- bindinputField: function (e) {
|
|
71
|
|
- console.log("bindinputField:" + isEdit);
|
|
72
|
|
- if (isEdit) {
|
|
73
|
|
- this.setData({
|
|
74
|
|
- Field: e.detail.value,
|
|
75
|
|
- });
|
|
76
|
|
- }
|
|
77
|
|
- },
|
|
78
|
|
- addSymbol: function (e) {
|
|
79
|
|
- console.log("addSymbol:" + isEdit);
|
|
80
|
|
- btnName = e.currentTarget.dataset.id;
|
|
|
77
|
+ bindFormSubmit: function (e) {
|
|
|
78
|
+ console.log(e.detail.value);
|
|
|
79
|
+ console.log(e.detail.target.id);
|
|
|
80
|
+ btnName = e.detail.target.id;
|
|
81
|
81
|
if (btnName == "[读]") {
|
|
82
|
82
|
this.setData({
|
|
83
|
83
|
SoundSign: "[/读]",
|
|
|
@@ -97,86 +97,173 @@ Page({
|
|
97
|
97
|
this.setData({
|
|
98
|
98
|
LineSign: "[线]",
|
|
99
|
99
|
});
|
|
100
|
|
- }
|
|
101
|
|
-
|
|
102
|
|
- if (!this.data.Focus){
|
|
103
|
|
- this.data.Field=this.data.Field+btnName;
|
|
104
|
|
- this.setData({
|
|
105
|
|
- Field: this.data.Field,
|
|
106
|
|
- });
|
|
107
|
100
|
}
|
|
108
|
|
- //console.log("addSymbol:" + this.data.Field);
|
|
109
|
|
- },
|
|
110
|
|
- onBindFocus:function(){
|
|
|
101
|
+ console.log("tempCursor:" + tempCursor);
|
|
|
102
|
+ if (tempCursor == undefined)
|
|
|
103
|
+ tempCursor = this.data["Field"].length;
|
|
|
104
|
+ var str1 = "", str2 = "";
|
|
|
105
|
+ if (this.data.Field.length > 0) {
|
|
|
106
|
+ str1 = this.data.Field.substr(0, tempCursor);
|
|
|
107
|
+ str2 = this.data.Field.substring(tempCursor, this.data.Field.length);
|
|
|
108
|
+ }
|
|
|
109
|
+ //console.log("str1:" + str1);
|
|
|
110
|
+ //console.log("str2:" + str2);
|
|
|
111
|
+ var cur = 1;
|
|
|
112
|
+ if (btnName == "[读]" || btnName == "[线]") {
|
|
|
113
|
+ cur = 3;
|
|
|
114
|
+ }
|
|
|
115
|
+ else if (btnName == "[/读]" || btnName == "[/线]") {
|
|
|
116
|
+ cur = 4;
|
|
|
117
|
+ }
|
|
|
118
|
+
|
|
|
119
|
+ this.data.Field = str1 + btnName + str2;
|
|
111
|
120
|
this.setData({
|
|
112
|
|
- Focus: true,
|
|
|
121
|
+ Field: this.data.Field,
|
|
|
122
|
+ //Focus:false,
|
|
|
123
|
+ Cursor: tempCursor + cur,
|
|
113
|
124
|
});
|
|
|
125
|
+
|
|
|
126
|
+ btnName = "";
|
|
|
127
|
+
|
|
|
128
|
+ },
|
|
|
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
|
+ // });
|
|
114
|
173
|
},
|
|
115
|
174
|
onBindblur: function (e) {
|
|
116
|
175
|
console.log("onBindblur:" + isEdit);
|
|
117
|
|
- var that=this;
|
|
118
|
|
- if (isEdit) {
|
|
119
|
|
- that.androidFunction();
|
|
120
|
|
-
|
|
121
|
|
- //console.log(e);
|
|
122
|
|
- tempCursor = e.detail.cursor;
|
|
123
|
|
- //console.log("tempCursor:" + tempCursor);
|
|
124
|
|
- if (tempCursor == undefined)
|
|
125
|
|
- tempCursor = this.data["Field"].length;
|
|
126
|
|
- var str1 = "", str2 = "";
|
|
127
|
|
- if (this.data.Field.length > 0) {
|
|
128
|
|
- str1 = this.data.Field.substr(0, tempCursor);
|
|
129
|
|
- str2 = this.data.Field.substring(tempCursor, this.data.Field.length);
|
|
130
|
|
- }
|
|
131
|
|
- //console.log("str1:" + str1);
|
|
132
|
|
- //console.log("str2:" + str2);
|
|
133
|
|
- var cur = 1;
|
|
134
|
|
- if (btnName == "[读]" || btnName == "[线]") {
|
|
135
|
|
- cur = 3;
|
|
136
|
|
- }
|
|
137
|
|
- else if (btnName == "[/读]" || btnName == "[/线]") {
|
|
138
|
|
- cur = 4;
|
|
139
|
|
- }
|
|
|
176
|
+ // var that=this;
|
|
|
177
|
+ // if (isEdit) {
|
|
|
178
|
+ // that.androidFunction();
|
|
140
|
179
|
|
|
141
|
|
- this.data.Field = str1 + btnName + str2;
|
|
142
|
|
- this.setData({
|
|
143
|
|
- Field: this.data.Field,
|
|
144
|
|
- Focus:false,
|
|
145
|
|
- Cursor: tempCursor + cur,
|
|
146
|
|
- });
|
|
|
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
|
+ // }
|
|
147
|
199
|
|
|
148
|
|
- btnName = "";
|
|
|
200
|
+ // this.data.Field = str1 + btnName + str2;
|
|
|
201
|
+ // this.setData({
|
|
|
202
|
+ // Field: this.data.Field,
|
|
|
203
|
+ // Focus:false,
|
|
|
204
|
+ // Cursor: tempCursor + cur,
|
|
|
205
|
+ // });
|
|
149
|
206
|
|
|
150
|
|
-
|
|
151
|
|
- }
|
|
|
207
|
+ // btnName = "";
|
|
|
208
|
+
|
|
|
209
|
+
|
|
|
210
|
+ // }
|
|
152
|
211
|
},
|
|
153
|
212
|
onSearch: function (e) {
|
|
154
|
|
- wx.setStorageSync("TempFieldNumber", this.data.FieldNumber);
|
|
155
|
|
- wx.navigateTo({
|
|
156
|
|
- url: './searchWeb',
|
|
157
|
|
- });
|
|
158
|
|
- this.updateField();
|
|
|
213
|
+ // wx.setStorageSync("TempFieldNumber", this.data.FieldNumber);
|
|
|
214
|
+ // wx.navigateTo({
|
|
|
215
|
+ // url: './searchWeb',
|
|
|
216
|
+ // });
|
|
|
217
|
+ // this.updateField();
|
|
159
|
218
|
},
|
|
160
|
219
|
clear: function () {
|
|
161
|
220
|
console.log("clear:" + isEdit);
|
|
162
|
|
- this.setData({
|
|
163
|
|
- Field: "",
|
|
164
|
|
- Focus: false,
|
|
165
|
|
- Cursor: 0,
|
|
166
|
|
- });
|
|
167
|
|
- this.updateField();
|
|
|
221
|
+ // this.setData({
|
|
|
222
|
+ // Field: "",
|
|
|
223
|
+ // Focus: false,
|
|
|
224
|
+ // Cursor: 0,
|
|
|
225
|
+ // });
|
|
|
226
|
+ // this.updateField();
|
|
168
|
227
|
},
|
|
169
|
|
- closeAddItem: function (e) {
|
|
170
|
|
- var isSave = e.currentTarget.dataset.idsave;
|
|
171
|
|
- if (isSave == "true") {
|
|
172
|
|
- isUpload = false;
|
|
173
|
|
- wx.removeStorageSync("TempCardInfoAddItem");
|
|
174
|
|
- this.updateField();
|
|
175
|
|
- }
|
|
176
|
|
- wx.navigateBack({
|
|
177
|
|
- delta: 1,
|
|
178
|
|
- });
|
|
|
228
|
+
|
|
|
229
|
+ 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
|
+ // });
|
|
179
|
256
|
},
|
|
|
257
|
+
|
|
|
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
|
+ // },
|
|
180
|
267
|
updateField: function (history) {
|
|
181
|
268
|
var str = this.data.Field;
|
|
182
|
269
|
str = main.decryptUrl(str);
|
|
|
@@ -199,43 +286,18 @@ Page({
|
|
199
|
286
|
}
|
|
200
|
287
|
wx.setStorageSync("CardList", list);
|
|
201
|
288
|
},
|
|
202
|
|
- uploadImage: function () {
|
|
203
|
|
- console.log("uploadImage:" + isEdit);
|
|
204
|
|
- var that=this;
|
|
205
|
|
- that.androidFunction();
|
|
206
|
|
- wx.chooseImage({
|
|
207
|
|
- count: 1,
|
|
208
|
|
- sizeType: ['compressed'],
|
|
209
|
|
- sourceType: ['album', 'camera'],
|
|
210
|
|
- success(res) {
|
|
211
|
|
- // tempFilePath可以作为img标签的src属性显示图片
|
|
212
|
|
- const tempFilePaths = res.tempFilePaths;
|
|
213
|
|
- //console.log(tempFilePaths[0]);
|
|
214
|
|
-
|
|
215
|
|
- that.data.Field = that.data.Field + "[图 url='" + tempFilePaths[0] + "'][/图]";
|
|
216
|
|
-
|
|
217
|
|
- //console.log("uploadImageEnd:" + that.data.Field);
|
|
218
|
|
-
|
|
219
|
|
- that.setData({
|
|
220
|
|
- Field: that.data.Field,
|
|
221
|
|
- Focus: false,
|
|
222
|
|
- });
|
|
223
|
|
- that.updateField();
|
|
224
|
|
-
|
|
225
|
|
- },
|
|
226
|
|
- fail:function(){
|
|
227
|
|
- }
|
|
228
|
|
- });
|
|
229
|
|
- },
|
|
230
|
|
- androidFunction:function(){
|
|
231
|
|
- isEdit=false;
|
|
232
|
|
- var systemInfo = wx.getSystemInfoSync();
|
|
233
|
|
- if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
|
|
234
|
|
- setTimeout(function () {
|
|
235
|
|
- isEdit = true;
|
|
236
|
|
- }, 1000);
|
|
|
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();
|
|
237
|
295
|
}
|
|
|
296
|
+ wx.navigateBack({
|
|
|
297
|
+ delta: 1,
|
|
|
298
|
+ });
|
|
238
|
299
|
},
|
|
|
300
|
+
|
|
239
|
301
|
onShareAppMessage: function () {
|
|
240
|
302
|
return {
|
|
241
|
303
|
title: app.globalData.ShareTitle,
|