Browse Source

Merge branch 'next'

# Conflicts:
#	js/model/sys/article/index.js
XMTT 7 years ago
parent
commit
70d4a19806

+ 11 - 4
css/model/sys/article.css

@ -6,9 +6,6 @@
6 6
    width: 35px;
7 7
}
8 8
9
.sys_article_index .content{
10
    width: 50px;
11
}
12 9
.sys_article_index .table {
13 10
    table-layout: fixed;
14 11
}
@ -18,5 +15,15 @@
18 15
}
19 16
20 17
.sys_article_index .number {
21
    width: 6%;
18
    width: 4%;
19
}
20
21
.sys_article_sort {
22
    width: 600px;
23
    height: 200px;
24
}
25
26
.sys_article_sort .content{
27
    font-size: 25px;
28
    font-weight: bold;
22 29
}

+ 1 - 1
css/model/sys/content.css

@ -18,5 +18,5 @@
18 18
}
19 19
20 20
.sys_content_index .number {
21
    width: 6%;
21
    width: 4%;
22 22
}

+ 6 - 0
css/model/sys/professornew.css

@ -25,3 +25,9 @@
25 25
.sys_professornew_data .icon-close {
26 26
    display: none;
27 27
}
28
29
.sys_professornew_new {
30
    width: 500px;
31
    height: 250px;
32
    padding: 0 20px 10px;
33
}

+ 3 - 0
html/model/sys/article/index.html

@ -48,6 +48,9 @@
48 48
            <div class="btn opt-view">
49 49
                查看
50 50
            </div>
51
            <div class="btn opt-sort-num">
52
                设置权重
53
            </div>
51 54
            <div class="btn opt-del">
52 55
                删除
53 56
            </div>

+ 28 - 0
html/model/sys/article/sort.html

@ -0,0 +1,28 @@
1
<div class="sys_article_sort centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2"></div>
8
            <div class="col-4 item-caption content ">设置权重</div>
9
10
        </div>
11
        <div class="row">
12
            <div class="col-2 item-caption">权重值</div>
13
            <div class="col-6">
14
                <div class="form-item text" defVal="" name="sortNum"></div>
15
            </div>
16
        </div>
17
18
        <div class="row">
19
            <div class="col-10"></div>
20
            <div class="col-2">
21
                <div class="btn pull-right opt-save">
22
                    <i class="icon-check"></i> SAVE
23
                </div>
24
            </div>
25
        </div>
26
27
    </div>
28
</div>

+ 7 - 7
html/model/sys/professornew/index.html

@ -33,12 +33,12 @@
33 33
    <div class="container page-split"></div>
34 34
    <div class="container tpl-btns">
35 35
        <div class="row">
36
            <!--<div class="btn opt-new">-->
37
                <!--新增账户-->
38
            <!--</div>-->
39
            <!--<div class="btn opt-edit">-->
40
                <!--修改账户信息-->
41
            <!--</div>-->
36
            <div class="btn opt-new">
37
                新增账户
38
            </div>
39
            <div class="btn opt-edit">
40
                修改账户信息
41
            </div>
42 42
            <!--<div class="btn opt-details">-->
43 43
                <!--编辑用户资料-->
44 44
            <!--</div>-->
@ -74,7 +74,7 @@
74 74
            </thead>
75 75
            <tbody>
76 76
            <tr ch-dir="list">
77
                <td class="opt-check"><i class="icon icon-st-check" professorid="{{id}}"></i></td>
77
                <td class="opt-check"><i class="icon icon-st-check" na="{{name}}" professorid="{{id}}"></i></td>
78 78
                <td>{{-_index}}</td>
79 79
                <td>{{name}}</td>
80 80
                <td>{{title}}</td>

+ 35 - 0
html/model/sys/professornew/new.html

@ -0,0 +1,35 @@
1
<div class="sys_professornew_new centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2 item-caption">手机</div>
8
            <div class="col-6">
9
                <div class="form-item text trim" placeholder="手机或邮箱至少输入一项" name="mobile"></div>
10
            </div>
11
        </div>
12
        <div class="row">
13
            <div class="col-2 item-caption">邮箱</div>
14
            <div class="col-6">
15
                <div class="form-item text trim" placeholder="手机或邮箱至少输入一项" name="email"></div>
16
            </div>
17
        </div>
18
        <div class="row me">
19
            <div class="col-2 item-caption">用户名</div>
20
            <div class="col-6">
21
                <div class="form-item text required trim pname" placeholder="姓名最长为10个字" name="name"></div>
22
            </div>
23
        </div>
24
        <div class="row">
25
            <div class="col-10"></div>
26
            <div class="col-2">
27
                <div class="btn pull-right opt-save">
28
                    <i class="icon-check"></i> SAVE
29
                </div>
30
31
            </div>
32
        </div>
33
    </div>
34
35
</div>

+ 18 - 0
js/model/sys/article/index.js

@ -79,6 +79,24 @@ spa_define(function () {
79 79
                        util.alert("请选择一个用户");
80 80
                    }
81 81
                });
82
                root.find(".opt-sort-num").on("click", function() {
83
                    var $article = root.find("td.opt-check>i.checked");
84
                    if($article.length) {
85
                        if($article.length > 1) {
86
                            util.alert("只能选择一篇文章");
87
                        } else {
88
                            $.util.get("../ajax/article/id/"+$article.attr("articleId"),null,function(rd){
89
                                if(rd){
90
                                    spa.showModal("sys_article_sort", { data:rd, hand: function() { pdg.load() } })
91
                                }else{
92
                                    util.alertMsg("文章", function(){pdg.load();});
93
                                }
94
                            },{});
95
                        }
96
                    } else {
97
                        util.alert("请选择一篇文章");
98
                    }
99
                });
82 100
                root.find(".opt-view").on("click", function () {
83 101
                    var $org = root.find("td.opt-check>i.checked");
84 102
                    if ($org.length) {

+ 44 - 0
js/model/sys/article/sort.js

@ -0,0 +1,44 @@
1
/**
2
 * Created by TT on 2017/8/3.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_article_sort");
10
                var form = fb.build(root.find(".newForm"));
11
                form.val({sortNum: data.data.sortNum, id: data.data.id});
12
13
                var saveBtn = root.find(".opt-save"),
14
                    save = function () {
15
                        if (form.val().sortNum) {
16
                            var sortNum = form.val().sortNum;
17
                            var reg = new RegExp("^(\\d|[1-9]\\d|100)$");
18
                            if (!reg.test(sortNum)) {
19
                                util.alert("权重值必须是0-100的正整数");
20
                                return;
21
                            }
22
                        } else {
23
                            form.val({sortNum: 0});
24
                        }
25
                        util.post("../ajax/article/sortNum", {
26
                            articleId: data.data.articleId,
27
                            sortNum: form.val().sortNum
28
                        }, function () {
29
                            spa.closeModal();
30
                            if (data.hand) {
31
                                data.hand();
32
                            }
33
                        }, {});
34
                    };
35
36
                root.find(".modal-ctrl .icon-times").on("click", function () {
37
                    spa.closeModal();
38
                });
39
40
                saveBtn.on("click", save);
41
            }
42
        }
43
    });
44
});

+ 0 - 1
js/model/sys/professornew/data.js

@ -36,7 +36,6 @@ spa_define(function () {
36 36
                };
37 37
                saveBtn.on("click", save);
38 38
                form.val(data.data);
39
                form.val({authStatus: 3});
40 39
            }
41 40
        }
42 41
    });

+ 80 - 0
js/model/sys/professornew/edit.js

@ -0,0 +1,80 @@
1
/**
2
 * Created by TT on 2017/8/8.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_professornew_new");
10
                $(".sys_professornew_new .pname").addClass("showOnly");
11
                $(".sys_professornew_new .me").after('<div class="row me"> ' +
12
                    '<div class="col-2 item-caption">邀请码</div> ' +
13
                    '<div class="col-4"> ' +
14
                    '<div class="form-item text showOnly" name="inviteCode"></div> ' +
15
                    '</div> ');
16
                var form = fb.build(root.find(".newForm"));
17
                var trim = function (str) {
18
                    return str.replace(/(^\s*)|(\s*$)/g, "");
19
                };
20
                var saveBtn = root.find(".opt-save"),
21
                    save = function () {
22
                        if (form.val().mobile) {
23
                            var mobile = trim(form.val().mobile);
24
                            var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
25
                            if (!hunPhone.test(mobile)) {
26
                                util.alert("注册电话格式有误,请检查后重新填写");
27
                                return;
28
                            }
29
                        }
30
                        if (form.val().email) {
31
                            var email = trim(form.val().email);
32
                            var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
33
                            if (!gunf.test(email)) {
34
                                util.alert("注册邮箱格式有误,请检查后重新填写");
35
                                return;
36
                            }
37
                        }
38
                        if (form.val().mobile || form.val().email) {
39
                            if (form.val().mobile != data.data.mobile || form.val().email != data.data.email) {
40
                                util.get("../ajax/sys/professor/updateCheck", {
41
                                    mobile: form.val().mobile,
42
                                    email: form.val().email,
43
                                    id:data.data.id
44
                                }, function (code) {
45
                                    if (code == 1) {
46
                                        util.post("../ajax/sys/professor/updateAccount", {
47
                                            mobile: form.val().mobile,
48
                                            email: form.val().email,
49
                                            id:data.data.id
50
                                        },closeThis,{"40001":"该邮箱已被注册","40002":"该电话已被注册"});
51
                                    } else if (code == 2){
52
                                        util.alert("该邮箱已被注册");
53
                                    }else if (code == 3){
54
                                        util.alert("该手机已被注册");
55
                                    }
56
                                });
57
                            } else {
58
                                closeThis();
59
                            }
60
                        } else {
61
                            util.alert("手机或邮箱至少输入一项");
62
                        }
63
                    };
64
65
                root.find(".modal-ctrl .icon-times").on("click", function () {
66
                    spa.closeModal();
67
                });
68
                var handler = data.hand;
69
                var closeThis = function () {
70
                    spa.closeModal();
71
                    if (handler) {
72
                        handler();
73
                    }
74
                };
75
                form.val({mobile:data.data.mobilePhone,email:data.data.email,name:data.name,inviteCode:data.data.inviteCode});
76
                saveBtn.on("click", save);
77
            }
78
        };
79
    })
80
});

+ 29 - 30
js/model/sys/professornew/index.js

@ -43,36 +43,35 @@ spa_define(function () {
43 43
                    var $this = $(this);
44 44
                    $this.toggleClass("checked");
45 45
                });
46
                // root.find(".opt-new").on("click", function () {
47
                //     spa.showModal("sys_org_new", function () {
48
                //         pdg.load()
49
                //     });
50
                // });
51
                // root.find(".opt-edit").on("click", function () {
52
                //     var $org = root.find("td.opt-check>i.checked");
53
                //     if ($org.length) {
54
                //         if ($org.length > 1) {
55
                //             util.alert("只能选择一个用户");
56
                //         } else {
57
                //             util.get("../ajax/sys/org/queryAccount/" + $org.attr("orgId"), null, function (data) {
58
                //                 if (data) {
59
                //                     spa.showModal("sys_org_edit", {
60
                //                         data: data,
61
                //                         hand: function () {
62
                //                             pdg.load()
63
                //                         }
64
                //                     })
65
                //                 } else {
66
                //                     util.alert("用户不存在了", function () {
67
                //                         pdg.load();
68
                //                     });
69
                //                 }
70
                //             }, {});
71
                //         }
72
                //     } else {
73
                //         util.alert("请选择一个用户");
74
                //     }
75
                // });
46
                root.find(".opt-new").on("click", function () {
47
                    spa.showModal("sys_professornew_new", function () {
48
                        pdg.load()
49
                    });
50
                });
51
                root.find(".opt-edit").on("click", function () {
52
                    var $org = root.find("td.opt-check>i.checked");
53
                    if ($org.length) {
54
                        if ($org.length > 1) {
55
                            util.alert("只能选择一个用户");
56
                        } else {
57
                            util.get("../ajax/sys/professor/luserId/" + $org.attr("professorId"), null, function (data) {
58
                                if (data) {
59
                                        spa.showModal("sys_professornew_edit", {
60
                                            data: data,name:$org.attr("na"), hand: function () {
61
                                                pdg.load()
62
                                            }
63
                                        })
64
                                } else {
65
                                    util.alert("用户不存在了", function () {
66
                                        pdg.load();
67
                                    });
68
                                }
69
                            }, {});
70
                        }
71
                    } else {
72
                        util.alert("请选择一个用户");
73
                    }
74
                });
76 75
                // root.find(".opt-details").on("click", function () {
77 76
                //     var $org = root.find("td.opt-check>i.checked");
78 77
                //     if ($org.length) {

+ 70 - 0
js/model/sys/professornew/new.js

@ -0,0 +1,70 @@
1
/**
2
 * Created by TT on 2017/8/4.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_professornew_new");
10
                var form = fb.build(root.find(".newForm"));
11
                var trim = function (str) { //删除左右两端的空格			  
12
                    return str.replace(/(^\s*)|(\s*$)/g, "");
13
                };
14
                var saveBtn = root.find(".opt-save"),
15
                    save = function () {
16
                        if (form.val().mobile) {
17
                            var mobile = trim(form.val().mobile);
18
                            var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
19
                            if (!hunPhone.test(mobile)) {
20
                                util.alert("注册电话格式有误,请检查后重新填写");
21
                                return;
22
                            }
23
                        }
24
                        if (form.val().email) {
25
                            var email = trim(form.val().email);
26
                            var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
27
                            if (!gunf.test(email)) {
28
                                util.alert("注册邮箱格式有误,请检查后重新填写");
29
                                return;
30
                            }
31
                        }
32
                        if (form.val().name) {
33
                            var name = trim(form.val().name);
34
                            if (name.length > 10) {
35
                                util.alert("姓名最长为10个字");
36
                                return;
37
                            }
38
                        }else {
39
                            util.alert("请填写用户名称");
40
                            return;
41
                        }
42
                        if (form.val().mobile || form.val().email) {
43
                            util.get("../ajax/sys/professor/createCheck", {
44
                                mobile: form.val().mobile,
45
                                email: form.val().email
46
                            },function (success) {
47
                                if (success){
48
                                    form.doPost("../ajax/sys/professor/createAccount", function () {
49
                                        spa.closeModal();
50
                                        if (data) {
51
                                            data();
52
                                        }
53
                                    }, {});
54
                                }else {
55
                                    util.alert("该账号已存在");
56
                                }
57
                            });
58
                        } else {
59
                            util.alert("手机或邮箱至少输入一项");
60
                        }
61
                    };
62
63
                root.find(".modal-ctrl .icon-times").on("click", function () {
64
                    spa.closeModal();
65
                });
66
                saveBtn.on("click", save);
67
            }
68
        }
69
    });
70
});