Exemplo n.º 1
0
def phone():
    try:
        phones = [{
            'address': phone.address,
            'phone': phone.phone
        } for phone in PhoneList.query.all()]
    except:
        phones = []
    return render('/public/phone.html', phones=phones)
Exemplo n.º 2
0
def evaluate():
    openid = request.args.get('openid')
    if not openid:
        return abort(404), 404
    curArr = []
    user = UserProcessor.get_user(openid)
    userinfo = {'username': user.studentID, 'password': user.studentPWD}
    courseinfo = hbujwxt.evaluation_get_courses(userinfo)
    if request.method == 'GET':
        if not request.args.get('premsg'):
            return render('/wxweb/Evaluate/index.html', courseinfo=courseinfo)
        else:
            try:
                course = courseinfo['data']['course'][int(
                    request.args.get('premsg'))]
                courseinfo = hbujwxt.evaluation_get_detail(course[-1])
            except:
                courseinfo = {'code': status.CODE_FAILED}
            if courseinfo['code'] == status.CODE_SUCCESS:
                courseinfo['data']['course'] = course
            return render('/wxweb/Evaluate/detail.html', courseinfo=courseinfo)
    else:
        try:
            course = courseinfo['data']['course'][int(
                request.args.get('premsg'))]
            courseinfo = hbujwxt.evaluation_get_detail(course[-1])
            data = request.form.to_dict()
            if data == {}:
                return "<script>alert('请填写完整数据!');window.history.back();</script>"
            else:
                for key in data:
                    if data[key] is None:
                        return "<script>alert('请填写完整数据!');window.history.back();</script>"
                res = hbujwxt.evaluation_post(data)
                if res['code'] == status.CODE_SUCCESS:
                    return "<script>alert('评教成功!');window.history.go(-2);window.location.reload(true);</script>"
                else:
                    return "<script>alert('评教失败!');window.history.back();</script>"
        except:
            return "<script>alert('非法提交!');window.location.href='/wxweb/index?openid=%s';</script>" % openid
Exemplo n.º 3
0
def spareclassroom():
    if request.method == 'GET':
        return render('public/spareclassroom.html', spareinfo=spare_params())
    else:
        eduweek = request.form.get('eduweek')
        campus = request.form.get('campus')
        building = request.form.get('building')
        week = request.form.get('week')
        time = request.form.get('time')
        #print(eduweek, campus, building, week, time)
        if eduweek and campus and building and week and time:
            return jsonify(
                spare_classroom(eduweek, campus, building, week, time))
        else:
            return jsonify({'code': status.CODE_FAILED})
Exemplo n.º 4
0
def curriculum():
    openid = request.args.get('openid')
    if not openid:
        return abort(404), 404
    curArr = []
    user = UserProcessor.get_user(openid)
    if user is not None:
        res = hbujwxt.query_course_table(userinfo={
            'username': user.studentID,
            'password': user.studentPWD
        })
        if res['code'] == status.CODE_SUCCESS:
            curArr = res['data']
    timeinfo = {'month': month_now(), 'weekinfo': get_week_day()}
    curriculuminfo = get_course_table(curArr)
    return render('public/curriculum.html',
                  timeinfo=timeinfo,
                  curriculuminfo=curriculuminfo)
Exemplo n.º 5
0
def book():
    try:
        return render('/public/book.html',
                      bookinfo=book_query(request.args.get('book_name')))
    except:
        return abort(404), 404