Browse Source

专家学术领域的字数限制改为15字

XMTT 7 years ago
parent
commit
6bb18ee6f0
2 changed files with 49 additions and 2 deletions
  1. 1 1
      html/model/sys/userInfo/details.html
  2. 48 1
      js/model/sys/userInfo/details.js

+ 1 - 1
html/model/sys/userInfo/details.html

@ -79,7 +79,7 @@
79 79
        <div class="row">
80 80
            <div class="col-2 item-caption">学术领域</div>
81 81
            <div class="col-4">
82
                <div class="form-item text" placeholder="添加内容不能超过10个字" name="newSubject"></div>
82
                <div class="form-item text" placeholder="添加内容不能超过15个字" name="newSubject"></div>
83 83
            </div>
84 84
            <div class="col-2">
85 85
                <div class="btn pull-right opt-subject">

+ 48 - 1
js/model/sys/userInfo/details.js

@ -198,6 +198,53 @@ spa_define(function () {
198 198
                    }
199 199
                };
200 200
201
                var part3 = function (one, list) {
202
                    oValue = one;
203
                    oJudge = list || [];
204
                    var repeat,
205
                        b;
206
                    if (!oValue) {
207
                        util.alert('提示', '请先填写内容');
208
                        return;
209
                    }
210
                    if (oValue.length > 15) {
211
                        util.alert('提示', '添加内容不能超过15个字');
212
                        return;
213
                    } else {
214
                        var oValueList = oValue.split(","),
215
                            length = oValueList.length;
216
                        for (var j = 0; j < length; j++) {
217
                            for (var n = j + 1; n < oValueList.length + 1;) {
218
                                if (oValueList[j] == oValueList[n]) {
219
                                    oValueList.remove(n);
220
                                    repeat = false;
221
                                } else {
222
                                    n++;
223
                                }
224
                            }
225
                        }
226
                        for (var j = 0; j < oValueList.length;) {
227
                            for (var i = 0; i < oJudge.length; i++) {
228
                                if (oValueList[j] == oJudge[i]) {
229
                                    oValueList.remove(j);
230
                                    repeat = false;
231
                                    b = true;
232
                                }
233
                            }
234
                            if (b) {
235
                                b = false
236
                            } else j++;
237
                        }
238
                        if (repeat == false) {
239
                            util.alert('提示', '添加内容不能重复');
240
                        }
241
                        for (var m = 0; m < oValueList.length; m++) {
242
                            ca.items.push({code: oValueList[m], caption: oValueList[m]});
243
                            oJudge.push(oValueList[m]);
244
                        }
245
                    }
246
                };
247
201 248
                var split = function (data) {
202 249
                    var index = data.split(",");
203 250
                    var arr = [];
@ -257,7 +304,7 @@ spa_define(function () {
257 304
                    form.val({newIndustry: "", industryList: oJudge});
258 305
                });
259 306
                root.find(".opt-subject").on("click", function () {
260
                    part(form.val().newSubject, form.val().subjectList);
307
                    part3(form.val().newSubject, form.val().subjectList);
261 308
                    form.val({newSubject: "", subjectList: oJudge});
262 309
                });
263 310
                root.find(".opt-ra").on("click", function () {