commit 51e7e86d7e13800a07b5bfb1717f38592576cfa2 Author: “foreverxiaoyu” Date: Tue May 30 22:51:38 2023 +0800 Initial commit diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..aa15e3e --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +app.py \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..ec81f75 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306 + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..368a099 --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/flask_html.iml b/.idea/flask_html.iml new file mode 100644 index 0000000..c9bd61f --- /dev/null +++ b/.idea/flask_html.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..708852c --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..9f737c1 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f8b344f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d819af4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..577caa0 --- /dev/null +++ b/app.py @@ -0,0 +1,384 @@ +import random +import string + +from flask import Flask, render_template, request, redirect, url_for, flash, session, get_flashed_messages, jsonify, g +from datetime import timedelta +import os + +from flask_mail import Message +from flask_migrate import Migrate +from werkzeug.security import generate_password_hash, check_password_hash +from werkzeug.utils import secure_filename + +import config +from exts import db, mail +from forms import RegisterForm, LoginForm +from models import UserModel, EmailCaptchaModel, VideoUri, FavoriteVideo +from sqlalchemy.orm import sessionmaker + +app = Flask(__name__) +app.config.from_object(config) +app.config['SESSION_TYPE'] = 'filesystem' +app.config['SECRET_KEY'] = os.urandom(24) # 随机数密钥 +app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=500) # 生成过期日期 + +db.init_app(app) +mail.init_app(app) + +migration = Migrate(app, db) + +video_information = [] +connected_video_information = [] + + +@app.route('/index') +def index(): + return render_template("index.html") + + +@app.before_request +def my_before_request(): + username = session.get('username') + if username: + user = UserModel.query.filter_by(username=username).first() + setattr(g, "user", user) + # print(f"{username}+cookie") # 已成功,测试用 + else: + setattr(g, "user", None) + + +@app.route('/resources') +def resources(): + Session_Mysql = sessionmaker() + session_Mysql = Session_Mysql() + id = session.get('user_id') + user_id = id + user = UserModel.query.filter_by(id=user_id).first() + # if user: + # session['user_url'] = user.user_avatar_url + # print(session.get('user_url')) + # session.update('user_url') 开了就会报错,不想解决了,就是要去更新session['user_url']的值,但是不知道怎么更新 + video = session_Mysql.query(VideoUri.id, VideoUri.video_img_src, VideoUri.video_url, + VideoUri.video_tite).filter_by() + video_lists = db.session.execute(video).all() + video_information.clear() + for video_list in video_lists: + video_information.append({ + 'video_id': video_list[0], + 'video_href': video_list[2], + 'video_img_src': video_list[1], + 'video_title': video_list[3] + }) + + user_name = session.get('username') + id = session.get('user_id') + favorite = session_Mysql.query(FavoriteVideo.video_id).filter_by(favorite_id=id) + favorite_list = db.session.execute(favorite).all() # 根据用户id获得所有收藏视频id + connected_video_information.clear() + for i in favorite_list: # 遍历 + for j in i: + video = session_Mysql.query(VideoUri.id, VideoUri.video_img_src, VideoUri.video_url, + VideoUri.video_tite).filter_by(id=j) + video_list = db.session.execute(video).all() + for k in video_list: # 更新视频收藏表 + connected_video_information.append({ + 'video_id': k[0], + 'video_href': k[2], + 'video_img_src': k[1], + 'video_title': k[3] + }) + print(f"connected_video_information={connected_video_information}") + # print(f"video_information={video_information}") + # print(f"first_session['video_information']={session.get('video_information')}") + + return render_template("resources.html", video_information=video_information, + connected_video_information=connected_video_information, user= user) + + +@app.context_processor +def my_context_processor(): + return {'user': g.user} + + +# g.user是全局变量,可以在html中使用 +# user的表 + + +# 测试用,实际要sql操作 +# 有关数据库的操作(以UserModel表为例) +# 1.添加行 +# user = UserModel(email=email, username=username, password=generate_password_hash(password),stu_id=stu_id) +# db.session.add(user) +# db.session.commit() +# 2.删除行,下面的所有first保证有值输出(在数据库中找不到会用NONE代替),以免报错 +# user = UserModel.query.filter_by(email=email).first() +# UserModel表 表里的email字段=传入的email +# db.session.delete(user) +# db.session.commit() +# 3.修改行 +# user = UserModel.query.filter_by(email=email).first() +# user.username = username +# db.session.commit() +# 4.查询行 +# user = UserModel.query.filter_by(email=email).first() +# print(user.username) +# 5.查询所有行 +# users = UserModel.query.all() +# for user in users: +# print(user.username) + +# 测试用,实际要sql操作 + + +@app.route('/login', methods=['POST', 'GET']) +def login(): + if request.method == 'POST': + form = LoginForm(request.form) + if form.validate(): + email = form.email.data + password = form.password.data + user = UserModel.query.filter_by(email=email).first() + if not user: + print("邮箱未注册") + return redirect('/login') + # 下面是验证密码是否正确,check_password_hash()函数的第一个参数是数据库中的密码,第二个参数是用户输入的密码 + if check_password_hash(user.password, password): + print("登录成功") + # return jsonify({'code': 200, 'message': '登录成功'}) + session['username'] = user.username + session['user_id'] = user.id + session['user_avatar_url'] = user.user_avatar_url + session['user_signature'] = user.user_say + print(f"session['user_signature']={session.get('user_signature')}") + # print(f"{session['username']}+test") # 已成功,测试用 + return render_template("resources.html", user_name=user.username, video_information=video_information) + else: + print("密码错误") + return redirect('/login') + else: + print(form.errors) + return redirect('/login') + return render_template('login.html') + return render_template('login.html') + + +@app.route('/users_manage', methods=['POST', 'GET']) +def users_managing(): + user_id = session.get('user_id') + user = UserModel.query.filter_by(id=user_id).first() + return render_template('user_manage.html', user=user) + + +@app.route('/upload-avatar', methods=['POST', 'GET']) +def upload_avatar(): + file = request.files['avatar'] + user_id = session.get('user_id') + user = UserModel.query.filter_by(id=user_id).first() + if file: + # Generate a secure filename + filename = secure_filename(file.filename) + print(f"filename={filename}") + + # Specify the directory path for saving uploaded files + upload_folder = 'static/imgs/users' + os.makedirs(upload_folder, exist_ok=True) + + # Save the file with the new name in the upload folder + new_filename = str(filename) # Provide the desired new filename with the appropriate extension + file.save(os.path.join(upload_folder, new_filename)) + user.user_avatar_url = f"imgs/users/{new_filename}" + db.session.commit() + print(f"user.user_avatar_url={session.get('user_url')}") + # Continue processing or return a response + return 'File uploaded successfully.' + return 'No file uploaded.' + + +@app.route('/upload-stu_id', methods=['POST', 'GET']) +def upload_stu_id(): + update_stu_id_dict = request.get_json() + user_id = update_stu_id_dict['user_id'] + user = UserModel.query.filter_by(id=user_id).first() + user.stu_id = update_stu_id_dict['stu_id'] + db.session.commit() + print(f"user.stu_id={user.stu_id}") + return jsonify(list({'statick', 'ok'})) + + +@app.route('/upload-email', methods=['POST', 'GET']) +def upload_email(): + return 'ok' + + +@app.route('/upload-address', methods=['POST', 'GET']) +def upload_address(): + update_address_dict = request.get_json() + user_id = update_address_dict['user_id'] + user = UserModel.query.filter_by(id=user_id).first() + user.address = update_address_dict['address'] + db.session.commit() + return jsonify(list({'statick', 'ok'})) + + +@app.route('/upload-enterprise', methods=['POST', 'GET']) +def upload_enterprise(): + update_enterprise_dict = request.get_json() + user_id = update_enterprise_dict['user_id'] + user = UserModel.query.filter_by(id=user_id).first() + user.enterprise = update_enterprise_dict['enterprise'] + db.session.commit() + return jsonify(list({'statick', 'ok'})) + + +@app.route('/user_data', methods=['GET']) +def user_data(): + username = session.get('username') + user_id = session.get('user_id') + user_url = session.get('user_avatar_url') + user_signature = session.get('user_signature') + print(f"{user_url}+1111111111111") # 已成功,测试用 + # print(f"{username}+1111111111111") # 已成功,测试用 + if username: + # 根据需要获取用户数据的逻辑,例如从数据库中查询用户信息 + # ... + # 构造包含用户名的响应数据 + # data = {'username': username} + data = {'username': username, 'user_id': user_id, 'user_url': user_url, 'user_signature': user_signature} + print(jsonify(data)) + print(data) + # 返回 JSON 格式的响应数据 + return jsonify(data) + else: + # 如果用户未登录,则返回空数据或错误信息 + return jsonify({'error': 'User not logged in'}) + + +@app.route('/logout') +def logout(): + session.clear() + return redirect('/index') + + +'''@app.route('/user/favorite') +def get_favorite(): + Session_Mysql = sessionmaker() + session_Mysql = Session_Mysql() + user = get_flashed_messages(session['username']) #从session中获取用户名 + id = session_Mysql.query(UserModel.id).filter_by(username=user) #查找id + favorite = session_Mysql.query(FavoriteVideo.video_id).filter_by(favorite_id=id) #用id查找收藏的视频id + favorite_uri_list = [] #创建收藏视频地址的列表 + for i in favorite: + favorite_uri_list.append(session_Mysql.query(VideoUri.video_uri).filter_by(id=i)) + session['favorite_list'] = favorite_uri_list #将视频地址列表放入session中 + return render_template()这里填一个页面 +''' # 这个可能需要改进,还要完成用户收藏页面(应该也可以直接在用户页面显示) + + +@app.route('/register', methods=['GET', 'POST']) +def register(): + if request.method == 'GET': + return render_template('register.html') + else: + form = RegisterForm(request.form) + if form.validate(): + email = form.email.data + username = form.username.data + password = form.password.data + stu_id = form.stu_id.data + user = UserModel(email=email, username=username, password=generate_password_hash(password), stu_id=stu_id) + db.session.add(user) + db.session.commit() + return redirect('/login') + else: + print(form.errors) + return redirect('/register') + + +@app.route('/captcha/email') +def captcha_email(): + email = request.args.get('email') + source = string.digits * 4 + captcha = ''.join(random.sample(source, 4)) + message = Message(subject="数据库作业验证码", recipients=[email], body=f"验证码为:{captcha}") + mail.send(message) + email_captcha = EmailCaptchaModel(email=email, captcha=captcha) + db.session.add(email_captcha) + db.session.commit() + # RESTful API + # {code: 200/400/500, message: '', data: {}} + return jsonify({"code": 200, "message": '', "data": None}) + + +@app.after_request +def add_header(response): + response.cache_control.no_store = True + return response + + +@app.route('/resources/video/collection_update', methods=['POST']) +def update_video_collection(): + data = request.get_json() # Get the JSON data from the request + print(data) + username = data['username'] + video_href = data['video_href'] + id = data['id'] + user_id = data['user_id'] + # video_tite = data['video_tite'] + favo = FavoriteVideo.query.filter_by(video_id=id, + favorite_id=user_id).first() # 这里查找是否已经收藏过了,如果为空则没有收藏,因为进入resources时就已经更新过了 + if favo is None: + fav = FavoriteVideo(video_id=id, favorite_id=user_id) + db.session.add(fav) + db.session.commit() + video = VideoUri.query.filter_by(id=id).first() + video_information.append({ + 'video_id': id, + 'video_href': video_href, + 'video_img_src': video.video_img_src, + # 'video_tite': video_tite, + }) + return jsonify({'static': 'OK'}) + + +@app.route('/resources/video/collecting_cancel', methods=['POST']) +def cancel_collecting(): + data = request.get_json() + print(data) + username = data['username'] + video_href = data['video_href'] + id = data['id'] + user_id = data['user_id'] + fav = FavoriteVideo.query.filter_by(favorite_id=user_id, video_id=id).first() + db.session.delete(fav) + db.session.commit() + return jsonify({'static': 'OK'}) + + +@app.route('/resources/video/init', methods=['POST']) +def videoPage_init(): + local_connected_video_information = [] + Session_Mysql = sessionmaker() + session_Mysql = Session_Mysql() + id = request.get_json()['user_id'] + favorite = session_Mysql.query(FavoriteVideo.video_id).filter_by(favorite_id=id) + favorite_list = db.session.execute(favorite).all() # 根据用户id获得所有收藏视频id + local_connected_video_information.clear() + for i in favorite_list: # 遍历 + for j in i: + video = session_Mysql.query(VideoUri.id, VideoUri.video_img_src, VideoUri.video_url, + VideoUri.video_tite).filter_by(id=j) + video_list = db.session.execute(video).all() + print(f"video_list: {video_list}") + for k in video_list: # 更新视频收藏表 + local_connected_video_information.append({ + 'video_id': k[0], + 'video_href': k[2], + 'video_img_src': k[1], + 'video_tite': k[3] + }) + print(f"local_connected_video_information: {local_connected_video_information}") + return jsonify(local_connected_video_information) + + +if __name__ == '__main__': + app.run(debug=True) diff --git a/config.py b/config.py new file mode 100644 index 0000000..bd0c4c9 --- /dev/null +++ b/config.py @@ -0,0 +1,14 @@ +HOSTNAME = '127.0.0.1' +PORT = '3306' +USERNAME = 'root' +PASSWORD = '123456' +DATABASE = 'database_homework' +DB_URI = f'mysql+pymysql://{USERNAME}:{PASSWORD}@{HOSTNAME}:{PORT}/{DATABASE}' +SQLALCHEMY_DATABASE_URI = DB_URI + +MAIL_SERVER = "smtp.163.com" +MAIL_USE_SSL = True +MAIL_PORT = 465 +MAIL_USERNAME = "forever_love233@163.com" +MAIL_PASSWORD = "" +MAIL_DEFAULT_SENDER = "forever_love233@163.com" \ No newline at end of file diff --git a/decorators.py b/decorators.py new file mode 100644 index 0000000..87cf37d --- /dev/null +++ b/decorators.py @@ -0,0 +1,12 @@ +from functools import wraps +from flask import g, redirect, url_for + + +def login_required(func): + @wraps(func) + def inner(*args, **kwargs): + if g.user: + return func(*args, **kwargs) + else: + return redirect(url_for('login')) + return inner diff --git a/exts.py b/exts.py new file mode 100644 index 0000000..8380517 --- /dev/null +++ b/exts.py @@ -0,0 +1,5 @@ +from flask_sqlalchemy import SQLAlchemy +from flask_mail import Mail + +db = SQLAlchemy() +mail = Mail() diff --git a/forms.py b/forms.py new file mode 100644 index 0000000..1640f99 --- /dev/null +++ b/forms.py @@ -0,0 +1,45 @@ +import wtforms +from wtforms.validators import Email, Length +from models import UserModel, EmailCaptchaModel + + +class RegisterForm(wtforms.Form): + username = wtforms.StringField(validators=[Length(min=3, max=20, message='用户名长度不正确')]) + email = wtforms.StringField(validators=[Email(message='邮箱格式不正确')]) + captcha = wtforms.StringField(validators=[Length(min=4, max=4, message='验证码长度不正确')]) + password = wtforms.StringField(validators=[Length(min=6, max=20, message='密码长度不正确')]) + stu_id = wtforms.StringField(validators=[Length(min=10, max=20, message='学号长度不正确')]) + + def validate_email(self, filed): + email = filed.data + user = UserModel.query.filter_by(email=email).first() + if user: + raise wtforms.ValidationError(message='邮箱已经被注册') + + def validate_captcha(self, filed): + captcha = filed.data + email = self.email.data + email_captcha = EmailCaptchaModel.query.filter_by(email=email, captcha=captcha).first() + if not email_captcha: + raise wtforms.ValidationError(message='邮箱验证码不正确') + # else: + # db.session.delete(email_captcha) + # db.session.commit() + + +class LoginForm(wtforms.Form): + email = wtforms.StringField(validators=[Email(message='邮箱格式不正确')]) + password = wtforms.StringField(validators=[Length(min=6, max=20, message='密码长度不正确')]) + + # def validate_email(self, filed): + # email = filed.data + # user = UserModel.query.filter_by(email=email).first() + # if not user: + # raise wtforms.ValidationError(message='邮箱未注册') + # + # def validate_password(self, filed): + # password = filed.data + # email = self.email.data + # user = UserModel.query.filter_by(email=email).first() + # if not user.check_password(password): + # raise wtforms.ValidationError(message='密码错误') diff --git a/lib/党史党章/中国共产党章程-标注版.docx b/lib/党史党章/中国共产党章程-标注版.docx new file mode 100644 index 0000000..2be373b Binary files /dev/null and b/lib/党史党章/中国共产党章程-标注版.docx differ diff --git a/lib/党史党章/党史-研究院.docx b/lib/党史党章/党史-研究院.docx new file mode 100644 index 0000000..788f6f0 Binary files /dev/null and b/lib/党史党章/党史-研究院.docx differ diff --git a/lib/党史党章/党章.docx b/lib/党史党章/党章.docx new file mode 100644 index 0000000..b966fed Binary files /dev/null and b/lib/党史党章/党章.docx differ diff --git a/lib/党史党章/参考资料.docx b/lib/党史党章/参考资料.docx new file mode 100644 index 0000000..63e9a9a Binary files /dev/null and b/lib/党史党章/参考资料.docx differ diff --git a/lib/论文库/2021年人工智能领域科技发展综述_韩雨.pdf b/lib/论文库/2021年人工智能领域科技发展综述_韩雨.pdf new file mode 100644 index 0000000..f4a5801 Binary files /dev/null and b/lib/论文库/2021年人工智能领域科技发展综述_韩雨.pdf differ diff --git a/lib/论文库/AI标准化白皮书(2021).pdf b/lib/论文库/AI标准化白皮书(2021).pdf new file mode 100644 index 0000000..3a489f2 Binary files /dev/null and b/lib/论文库/AI标准化白皮书(2021).pdf differ diff --git a/lib/论文库/人工智能生产内容白皮书.pdf b/lib/论文库/人工智能生产内容白皮书.pdf new file mode 100644 index 0000000..96c266a Binary files /dev/null and b/lib/论文库/人工智能生产内容白皮书.pdf differ diff --git a/lib/论文库/人工智能白皮书2022.pdf b/lib/论文库/人工智能白皮书2022.pdf new file mode 100644 index 0000000..5a15bc0 Binary files /dev/null and b/lib/论文库/人工智能白皮书2022.pdf differ diff --git a/lib/论文库/人工智能的伦理困境与正解_娄延强.pdf b/lib/论文库/人工智能的伦理困境与正解_娄延强.pdf new file mode 100644 index 0000000..ed92196 Binary files /dev/null and b/lib/论文库/人工智能的伦理困境与正解_娄延强.pdf differ diff --git a/lib/论文库/人工智能的过去、现在和未来_答凯艳.pdf b/lib/论文库/人工智能的过去、现在和未来_答凯艳.pdf new file mode 100644 index 0000000..65eb2b0 Binary files /dev/null and b/lib/论文库/人工智能的过去、现在和未来_答凯艳.pdf differ diff --git a/lib/论文库/双循环战略提升中国人工智能产业竞争力途径_董天宇.pdf b/lib/论文库/双循环战略提升中国人工智能产业竞争力途径_董天宇.pdf new file mode 100644 index 0000000..552cd1a Binary files /dev/null and b/lib/论文库/双循环战略提升中国人工智能产业竞争力途径_董天宇.pdf differ diff --git a/lib/论文库/护理提供者在诊断成像.pdf b/lib/论文库/护理提供者在诊断成像.pdf new file mode 100644 index 0000000..d8a3aaa Binary files /dev/null and b/lib/论文库/护理提供者在诊断成像.pdf differ diff --git a/lib/论文库/眼动荧光.pdf b/lib/论文库/眼动荧光.pdf new file mode 100644 index 0000000..203d31e Binary files /dev/null and b/lib/论文库/眼动荧光.pdf differ diff --git a/migrations/README b/migrations/README new file mode 100644 index 0000000..0e04844 --- /dev/null +++ b/migrations/README @@ -0,0 +1 @@ +Single-database configuration for Flask. diff --git a/migrations/alembic.ini b/migrations/alembic.ini new file mode 100644 index 0000000..ec9d45c --- /dev/null +++ b/migrations/alembic.ini @@ -0,0 +1,50 @@ +# A generic, single database configuration. + +[alembic] +# template used to generate migration files +# file_template = %%(rev)s_%%(slug)s + +# set to 'true' to run the environment during +# the 'revision' command, regardless of autogenerate +# revision_environment = false + + +# Logging configuration +[loggers] +keys = root,sqlalchemy,alembic,flask_migrate + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = WARN +handlers = console +qualname = + +[logger_sqlalchemy] +level = WARN +handlers = +qualname = sqlalchemy.engine + +[logger_alembic] +level = INFO +handlers = +qualname = alembic + +[logger_flask_migrate] +level = INFO +handlers = +qualname = flask_migrate + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(levelname)-5.5s [%(name)s] %(message)s +datefmt = %H:%M:%S diff --git a/migrations/env.py b/migrations/env.py new file mode 100644 index 0000000..89f80b2 --- /dev/null +++ b/migrations/env.py @@ -0,0 +1,110 @@ +import logging +from logging.config import fileConfig + +from flask import current_app + +from alembic import context + +# this is the Alembic Config object, which provides +# access to the values within the .ini file in use. +config = context.config + +# Interpret the config file for Python logging. +# This line sets up loggers basically. +fileConfig(config.config_file_name) +logger = logging.getLogger('alembic.env') + + +def get_engine(): + try: + # this works with Flask-SQLAlchemy<3 and Alchemical + return current_app.extensions['migrate'].db.get_engine() + except TypeError: + # this works with Flask-SQLAlchemy>=3 + return current_app.extensions['migrate'].db.engine + + +def get_engine_url(): + try: + return get_engine().url.render_as_string(hide_password=False).replace( + '%', '%%') + except AttributeError: + return str(get_engine().url).replace('%', '%%') + + +# add your model's MetaData object here +# for 'autogenerate' support +# from myapp import mymodel +# target_metadata = mymodel.Base.metadata +config.set_main_option('sqlalchemy.url', get_engine_url()) +target_db = current_app.extensions['migrate'].db + +# other values from the config, defined by the needs of env.py, +# can be acquired: +# my_important_option = config.get_main_option("my_important_option") +# ... etc. + + +def get_metadata(): + if hasattr(target_db, 'metadatas'): + return target_db.metadatas[None] + return target_db.metadata + + +def run_migrations_offline(): + """Run migrations in 'offline' mode. + + This configures the context with just a URL + and not an Engine, though an Engine is acceptable + here as well. By skipping the Engine creation + we don't even need a DBAPI to be available. + + Calls to context.execute() here emit the given string to the + script output. + + """ + url = config.get_main_option("sqlalchemy.url") + context.configure( + url=url, target_metadata=get_metadata(), literal_binds=True + ) + + with context.begin_transaction(): + context.run_migrations() + + +def run_migrations_online(): + """Run migrations in 'online' mode. + + In this scenario we need to create an Engine + and associate a connection with the context. + + """ + + # this callback is used to prevent an auto-migration from being generated + # when there are no changes to the schema + # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html + def process_revision_directives(context, revision, directives): + if getattr(config.cmd_opts, 'autogenerate', False): + script = directives[0] + if script.upgrade_ops.is_empty(): + directives[:] = [] + logger.info('No changes in schema detected.') + + connectable = get_engine() + + with connectable.connect() as connection: + context.configure( + connection=connection, + target_metadata=get_metadata(), + process_revision_directives=process_revision_directives, + **current_app.extensions['migrate'].configure_args + ) + + with context.begin_transaction(): + context.run_migrations() + + +if context.is_offline_mode(): + run_migrations_offline() +else: + run_migrations_online() diff --git a/migrations/script.py.mako b/migrations/script.py.mako new file mode 100644 index 0000000..2c01563 --- /dev/null +++ b/migrations/script.py.mako @@ -0,0 +1,24 @@ +"""${message} + +Revision ID: ${up_revision} +Revises: ${down_revision | comma,n} +Create Date: ${create_date} + +""" +from alembic import op +import sqlalchemy as sa +${imports if imports else ""} + +# revision identifiers, used by Alembic. +revision = ${repr(up_revision)} +down_revision = ${repr(down_revision)} +branch_labels = ${repr(branch_labels)} +depends_on = ${repr(depends_on)} + + +def upgrade(): + ${upgrades if upgrades else "pass"} + + +def downgrade(): + ${downgrades if downgrades else "pass"} diff --git a/migrations/versions/1f57157eb709_.py b/migrations/versions/1f57157eb709_.py new file mode 100644 index 0000000..09658f2 --- /dev/null +++ b/migrations/versions/1f57157eb709_.py @@ -0,0 +1,42 @@ +"""empty message + +Revision ID: 1f57157eb709 +Revises: bb32a1d42ccd +Create Date: 2023-05-28 09:53:06.971726 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '1f57157eb709' +down_revision = 'bb32a1d42ccd' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.alter_column('address', + existing_type=mysql.VARCHAR(length=100), + nullable=True) + batch_op.alter_column('enterprise', + existing_type=mysql.VARCHAR(length=100), + nullable=True) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.alter_column('enterprise', + existing_type=mysql.VARCHAR(length=100), + nullable=False) + batch_op.alter_column('address', + existing_type=mysql.VARCHAR(length=100), + nullable=False) + + # ### end Alembic commands ### diff --git a/migrations/versions/4bc1decf051d_.py b/migrations/versions/4bc1decf051d_.py new file mode 100644 index 0000000..ec9da72 --- /dev/null +++ b/migrations/versions/4bc1decf051d_.py @@ -0,0 +1,36 @@ +"""empty message + +Revision ID: 4bc1decf051d +Revises: 1f57157eb709 +Create Date: 2023-05-28 09:54:00.011898 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '4bc1decf051d' +down_revision = '1f57157eb709' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.alter_column('user_say', + existing_type=mysql.VARCHAR(length=500), + nullable=True) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.alter_column('user_say', + existing_type=mysql.VARCHAR(length=500), + nullable=False) + + # ### end Alembic commands ### diff --git a/migrations/versions/bb32a1d42ccd_.py b/migrations/versions/bb32a1d42ccd_.py new file mode 100644 index 0000000..2ff725a --- /dev/null +++ b/migrations/versions/bb32a1d42ccd_.py @@ -0,0 +1,65 @@ +"""empty message + +Revision ID: bb32a1d42ccd +Revises: +Create Date: 2023-05-28 09:46:20.663367 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'bb32a1d42ccd' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('email_captcha', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('email', sa.String(length=100), nullable=False), + sa.Column('captcha', sa.String(length=100), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('user', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('username', sa.String(length=100), nullable=False), + sa.Column('password', sa.String(length=500), nullable=False), + sa.Column('email', sa.String(length=100), nullable=False), + sa.Column('stu_id', sa.String(length=100), nullable=False), + sa.Column('user_say', sa.String(length=500), nullable=False), + sa.Column('join_time', sa.DateTime(), nullable=True), + sa.Column('address', sa.String(length=100), nullable=False), + sa.Column('enterprise', sa.String(length=100), nullable=False), + sa.Column('user_avatar_url', sa.String(length=100), nullable=False), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('email'), + sa.UniqueConstraint('stu_id') + ) + op.create_table('videouri', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('video_url', sa.String(length=100), nullable=False), + sa.Column('video_img_src', sa.String(length=100), nullable=False), + sa.Column('video_tite', sa.String(length=100), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('favorite', + sa.Column('favorite_id', sa.Integer(), nullable=False), + sa.Column('video_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['favorite_id'], ['user.id'], ), + sa.ForeignKeyConstraint(['video_id'], ['videouri.id'], ), + sa.PrimaryKeyConstraint('favorite_id', 'video_id') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('favorite') + op.drop_table('videouri') + op.drop_table('user') + op.drop_table('email_captcha') + # ### end Alembic commands ### diff --git a/models.py b/models.py new file mode 100644 index 0000000..4f47a4b --- /dev/null +++ b/models.py @@ -0,0 +1,47 @@ +# 此文件用于定义数据库表的模型 +# 使用命令行创建数据库表 +# flask db init # 初始化(只要执行一次) +# flask db migrate #检查模型文件,生成迁移文件 +# flask db upgrade # 更新数据库 +# 后续添加表只要执行 migrate 和 upgrade 命令即可 + +from exts import db +from datetime import datetime + + +class UserModel(db.Model): + __tablename__ = 'user' + id = db.Column(db.Integer, primary_key=True, autoincrement=True) #也是视频收藏号,与视频收藏表关联,得到收藏号去视频收藏表中查找收藏的视频id + username = db.Column(db.String(100), nullable=False) + password = db.Column(db.String(500), nullable=False) + email = db.Column(db.String(100), nullable=False, unique=True) + stu_id = db.Column(db.String(100), nullable=False, unique=True) + user_say = db.Column(db.String(500), nullable=True) + join_time = db.Column(db.DateTime, default=datetime.now) + address = db.Column(db.String(100), nullable=True) + enterprise = db.Column(db.String(100), nullable=True) + user_avatar_url = db.Column(db.String(100), nullable=False, default='/static/imgs/users/root.png') + + +class VideoUri(db.Model): + __tablename__ = 'videouri' + id = db.Column(db.Integer, primary_key=True, autoincrement=True) #视频id + video_url = db.Column(db.String(100), nullable=False) + video_img_src = db.Column(db.String(100), nullable=False) + video_tite = db.Column(db.String(100), nullable=False) + + +class FavoriteVideo(db.Model): + __tablename__ = 'favorite' + favorite_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) + video_id = db.Column(db.Integer, db.ForeignKey('videouri.id'), primary_key=True) + + +class EmailCaptchaModel(db.Model): + __tablename__ = 'email_captcha' + id = db.Column(db.Integer, primary_key=True, autoincrement=True) + email = db.Column(db.String(100), nullable=False) + captcha = db.Column(db.String(100), nullable=False) + + + diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..9a0b889 --- /dev/null +++ b/readme.txt @@ -0,0 +1,20 @@ +V1.1 modify by jxy +1.添加了注册,登录功能,且与数据库连接上了,与数据库连接详见config.py +2.添加了有关数据库表的创建以及相关表的操作的代码注释 +3.添加了register.html以及register.js +4.修改了login.html,将部分代码移植到了register.html中,去除了login.js的使用(原因:email是key,而username可能重复,所以提交form是将username改成了email) +问题 +1.还要在login.html和login.js中加入从/login跳转到/register的功能 + +V1.2 by ktp +1.修改了数据库结构 +2.添加了一段关于收藏视频页面的代码(注释部分) + +V1.3 modify by jxy +1.重构了底层代码,已弃用原来的网页cookie以及g.user在resources.html的使用,改用本地的session(cookie还是有,只不过没用) +2.与HJ的代码进行了整合 +3.加入从/login跳转到/register的功能 +4.修改了V1.2的英语单词拼写错误以及部分表 +计划: +1.用户登录后可以上传视频(video_url,以及pic_url) + diff --git a/static/css/cen.css b/static/css/cen.css new file mode 100644 index 0000000..a5f009b --- /dev/null +++ b/static/css/cen.css @@ -0,0 +1,41 @@ +a{ + text-decoration-line: none; + color:unset; + height: 0;width: 0; +} +footer{ + height: 20px; + margin:0 auto ; + text-align: center; + clear: both; +} + +footer a{ + color: white; + font-weight: 100; font-size: 3px; + text-decoration: none; + margin: 2px; +} +footer a:hover{ + color: blue; +} +body,div,span,ul,li,p,footer{ + margin: 0; + padding: 0; + text-decoration: none;list-style: none; +} +.none{ + margin: 0 auto; + width: 960px;height: 100px; + border: solid 3px rgba(78, 234, 234, 0.234); + text-align: center; + color: black; + background-color:#fff; + +} +.none div{ + color: antiquewhite; + font-size: 30px; + font-weight: 1500; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} \ No newline at end of file diff --git a/static/css/index.css b/static/css/index.css new file mode 100644 index 0000000..eea4f59 --- /dev/null +++ b/static/css/index.css @@ -0,0 +1,257 @@ +*{ + background-repeat: repeat-y; +} +#main_div_mainPageImg{ + border: 0;padding: 0; + height: 400px;width: 100%; + margin: 0; + background: url(../imgs/pexels-faik-akmd-1025469.png) no-repeat top ; + /*兼容浏览器版本*/ + -webkit-background-size: cover; + -o-background-size: cover; + background-size: cover; + overflow: hidden; +} +body{ + background-image: linear-gradient(to bottom, rgb(0, 19, 32) 50%, rgba(90, 130, 157, 0.684)); +} +#main_div{ + width: 1080px;height: 800px; + margin: 0 auto;border: 0;padding: 0; + opacity: 100%; + background-image:linear-gradient(to bottom, rgb(0, 19, 32) 20% ,rgba(90, 130, 157, 0.684)) +} + +#navs { + display: flex; + width:1077px; height: 30px; + padding: 0;margin: 0; + border: unset; + text-decoration: none;list-style: none; +} +#navs li{ + flex-direction: row-reverse; + padding: 2px; + float:left; + width: 215px; height: 30px ; + margin: 0 1px 0; + border: 0; + /*border-left :1px solid rgb(12, 114, 203); border-right :1px solid rgb(12, 114, 203);*/ + transition: all 0.6s;/*all 包括了transform*/ + transform-style: preserve-3d; + position:relative; +} +#navs li:hover{ + transform: rotateX(-90deg); +} +#navs li a{ + position: absolute;/*子绝父相 */ + left: 0; top:0; + display:block; + width: 214px;height: 100%; + text-align:center; + text-decoration:none; /* 去掉下划线 */ + +} +#navs li a:first-child{ + color:#fff; + background:#3A4953; + transform: translateZ(15px); +} +#navs li a:last-child{ + color:rgb(0, 0, 0); + background:#e1ecf4; + transform: rotateX(90deg) translateZ(15px); /* x转向后z轴方向也“躺平了” */ +} + + + +#main_page{ + margin:0 ;padding: 0; + /* background-color: chartreuse; */ + float: left; +} +#local{ + margin: 0;padding: 0; + height: 340px; width: 1077px; +} +/* 轮播图 */ +#local_pics{ + margin: 10px; padding: 0; + width: 480px;height:340px ; + position: relative; + text-align: center; + display: inline-block; +} +#main_page_local_pics{ + float: left; + margin:0px; + padding: 0; + list-style:none; + width: 480px; + height:270px; + position:absolute; + overflow: hidden; + background-color: #6b6de056; +} +#main_page_local_pics li{ + float: left; + position:absolute; + list-style: none; + z-index: 0; + opacity: 0; +} +#local_pics_text{ + float: left; + position:relative; + top: 270px; + width: 480px;height: 50px; + text-align: center; + background-color:#3A4953; +} +#mainPageImgsDescription{ + color: white; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + font-weight: 200;font-size: 3px; + float: left; clear: all; + width: 480px;height: 25px; +} +.Thepoint{ + padding: 0; + list-style:none; + /* background-color: crimson; */ + z-index: 100; + margin-left: 170px; +} +.points{ + float: left; + height: 6px; + width: 6px; + margin-right: 10px; + border-style: solid; + border-radius: 100%; + background-color: rgb(255, 255, 255); + border-width:3px; + border-color: aliceblue; +} +.points.active{ + background-color: black; + border-color:dodgerblue; + transition: all .5s; +} +.points:hover{ + cursor: pointer; +} +.change{ + height: 30px; + width: 30px; + border-width: 0px; + border-radius: 50%; + position:absolute; + opacity: 50%; + background-color: unset; + color: rgb(255, 255, 255); font-weight: 1800; font-size:25px; + z-index: 100; + top:130px; +} +.change:hover{ + cursor: pointer; +} +.change:active{ + background-color: rgb(204, 206, 207); +} +#change-left{ + left: 10px; +} +#change-right{ + right:10px; +} +#developers_said{ + margin:20px 100px; + width: 330px; + height: 340px; + display: inline-block; + vertical-align:top; +} +#developers_said span{ + color: #e1ecf4; + font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; + margin: 10px 20px 3px; + font-size: 20px;font-weight: 600; +} +marquee{ + padding: 10px; margin-top: 40px ; + width: 330px; + height: 150px; + border: 3px solid #9d9d9d; + background-color: rgba(90, 130, 157, 0.684); + +} +marquee blockquote{ + font-size: 6px; + font-weight: 300; + color:snow; + transition: all 0.5s; +} +marquee:hover blockquote{ + color:skyblue; + font-size:8px ;font-weight: 450; +} +#main_down{ + width: 1080px;height: 400px; +} +#main_down ul{ + display: flex; + flex-direction:row;/*row:行 column:列*/ + justify-content: space-around; +} +#main_down li{ + display:inline-block; + padding: 5px 10px 5px; + margin-top: 20px; + width: 160px;height: 290px; + border-radius: 12px; + border: double #839fbbb7; + text-align: center; + transition:all 1s; + /* background-color: chartreuse; */ +} +#main_down li a{ + text-decoration: none; +} +#main_down li span{ + margin: 0 auto; + font-size: medium; + font-weight: 800; + color: #b2b4b680; +} +#main_down li:hover{ + transform: rotateY(360deg); + box-shadow:inset 0 -10px 40px -2px #9b9b9b; + background-color: #ffffff; +} +#main_down li:hover span{ + color: black; +} +#main_down li p{ + margin: 20px 5px; + color: white; + font-size: small; + font-weight: 200; +} +#main_down li:hover p{ + margin: 20px 5px; + color: #9b9b9b; + font-size: small; + font-weight: 200; +} +#main_down li:nth-child(1) div{background-image: url(../icons/群星华绽.png);} +#main_down li:nth-child(2) div{background-image: url(../icons/资源.png);} +#main_down li:nth-child(3) div{background-image: url(../icons/开发中.png);} +#main_down li:nth-child(4) div{background-image: url(../icons/记录1.png);} +#main_down li div{ + margin: 0 auto; + width:60px ;height: 60px; + border-radius: 50%; + background-repeat: no-repeat;background-size: contain; +} \ No newline at end of file diff --git a/static/css/login.css b/static/css/login.css new file mode 100644 index 0000000..6c7f7ef --- /dev/null +++ b/static/css/login.css @@ -0,0 +1,152 @@ + +.login-container { + width: 600px; + height: 60%; + margin: 0 auto; + margin-top: 10%; + border-radius: 15px; + box-shadow: 0 10px 50px 0px #CCFFFF; +} +.left-container { + display: inline-block; + width: 330px; + border-top-left-radius: 15px; + border-bottom-left-radius: 15px; + padding: 60px; +} +.title { + color: #fff; + font-size: 18px; + font-weight: 200; +} +.title span { + border-bottom: 3px solid rgb(237, 221, 22); +} +.input-container { + padding: 20px 0; +} +input { + border: 0; + background: none; + outline: none; + color: #fff; + margin: 20px 0; + display: block; + width: 100%; + padding: 5px 0; + transition: .2s; + border-bottom: 1px solid rgb(199, 191, 219); +} +input:hover +{ + border-bottom-color: #fff; +} +::-webkit-input-placeholder { + color: rgb(199, 191, 219); +} +.message-container { + font-size: 14px; + transition: .2s; + color: rgb(199, 191, 219); + cursor: pointer; +} +.message-container:hover { + color: #fff; +} +.right-container { + width: 145px; + display: inline-block; + height: calc(100% - 120px); + vertical-align: top; + padding: 60px 0; +} +.regist-container { + text-align: center; + color: #fff; + font-size: 18px; + font-weight: 200; +} +.regist-container span { + border-bottom: 3px solid rgb(237, 221, 22); + cursor: pointer; +} +.action-container { + font-size: 10px; + color: #fff; + text-align: center; + position: relative; + top: 200px; +} +#enroll_enrolling{ + top:200px; +} +#enroll_return{ + top:100px; +} + +.action-container span { + border: 1px solid rgb(237, 221, 22); + padding: 10px; + display: inline; + line-height: 20px; + border-radius: 20px; + position: absolute; + bottom: 10px; + left: calc(72px - 20px); + transition: .2s; + cursor: pointer; +} + +.action-container span:hover { + background-color: rgb(237, 221, 22); + color: rgb(95, 76, 194); +} + +.enroll-container { + display: inline-block; + width: 330px; + border-top-left-radius: 15px; + border-bottom-left-radius: 15px; +} + +#login_video{ + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -10; + object-fit: cover; +} +.btn_btn-primary_btn-block{ + background-color: unset; + border: solid gold 2px; + color: snow; + font-size: 10px; + font-weight: bolder; + cursor: pointer; +} +.btn_btn-primary_btn-block:hover{ + background-color: gold; + color: rgb(95, 76, 194); +} +#submit_login{ + color: #fff; + text-align: center; + border: solid gold 2px; + cursor: pointer; +} +#submit_login :hover{ + background-color: gold; + color: rgb(95, 76, 194); +} +#submit_login div{ + display: inline; + line-height: 20px; + border-radius: 20px; + position: absolute; + bottom: 10px; + left: calc(72px - 20px); + transition: .2s; + cursor: pointer; +} diff --git a/static/css/myDocs.css b/static/css/myDocs.css new file mode 100644 index 0000000..126eb3f --- /dev/null +++ b/static/css/myDocs.css @@ -0,0 +1,9 @@ +#preview{ + width: 500px; height: 400px; +} +#preview iframe{ + margin: 0; + width: 500px; height: 400px; + + +} \ No newline at end of file diff --git a/static/css/resources.css b/static/css/resources.css new file mode 100644 index 0000000..f19406d --- /dev/null +++ b/static/css/resources.css @@ -0,0 +1,515 @@ +main{ + width: 100%;height:50rem; + position: relative; + border: solid rgb(13, 75, 106) 1px;box-shadow: 5px 0 5px black; + /*background-image: radial-gradient(rgba(90, 130, 157, 0.684),rgb(0, 19, 32))*/ + background-image: url("../imgs/OrionPleiades-Imgur.jpg"); +} +.head_bar{ + position: absolute; + z-index: 1; + left:50%;top:2rem; + transform:translate(-50%, -50%); + width: 8rem; + height: 1.5rem; + padding-top: 0.25rem; + text-align: center; + color: rgb(255, 255, 255); + font-size: 15px; + font-weight: 1000; + font-family: monospace; +} +.head_bar::before { + content: ''; /* To generate the box */ + position: absolute; + top: 0; right: 0; bottom: 0; left: 0; + z-index: -1; + border: solid rgb(13, 75, 106) 1px; + box-shadow: 0 0 5px rgb(8, 163, 230),0 -5px 5px black; + background:#234189; + transform: perspective(.5em) rotateX(-5deg); +} + +.left_nav ul{ + position: absolute; + left: 10rem;top: 3rem; + width: 25%;height:5rem; + display: flex;/* 该布局仅仅影响其直接子元素。 */ + flex-direction: row; + justify-content: space-around; +} +.left_navs{ + padding-top: 0.4rem; + width: 3rem; height:2.5rem; + border: solid rgb(142, 176, 192) 1px;box-shadow: 0 0 5px rgba(162, 209, 231, 0.618); + border-bottom-left-radius: 2rem; border-bottom-right-radius: 2rem; + text-align: center; + color: rgb(239, 239, 239); + font-size: 10px; + font-weight: 600; + font-family: monospace; + background: rgba(0, 19, 32, 0.578); + + transition: all 0.5s; + -moz-transition: all 0.5s; + -webkit-transition: all 0.5s; + -o-transition:all 0.5s; + +} +.left_navs_chosed{ + padding-top: 0.4rem; + width: 3rem; height:3.5rem; + border: solid rgb(142, 176, 192) 1px;box-shadow: 0 -2px 10px rgba(162, 209, 231, 0.618); + color: rgb(0, 19, 32, 0.578); + text-align: center; + font-size: 10px; + font-weight: 1000; + font-family: monospace; + background:rgb(239, 239, 239); + + transition: all 0.5s; + -moz-transition: all 0.5s; + -webkit-transition: all 0.5s; + -o-transition:all 0.5s; +} +#login +{ + padding: 1rem; + position: absolute; + right: 10rem;top: 3rem; + width: 5rem;height:5rem; +} +.user_profile{ + position: relative; + width: 8%; + height: 8%; + top:14%; + left: 82%; + background: snow; + text-align: center; + transition: opacity 1s; + z-index: 5; + opacity: 0; +} +.user_profile div{ + margin: 1px; + color: black; + border: #66aee6 solid; + font-weight: bolder; + font-family: fangsong; +} +main div #id_p +{ + height: 32px; + width: 32px; + border-radius: 16px; + background-color: #ececec; + display: inline-block; + background-size: contain; + background-position: center; + background-repeat: no-repeat; + background-image:none; + +} +main div #id_n +{ + color: #ececec; + text-align: center; + font-size: 14px; + font-weight: 2000; + font-family: monospace; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100px; + display: inline-block; +} + +.main_window{ + position:relative; + left:50%;top:46%; + width: 80%;height: 80%; + transform:translate(-50%, -50%); + border: solid rgb(142, 176, 192) 1px;border-top: none; box-shadow: 0 4px 7px rgba(162, 209, 231, 0.618); + background: rgba(0, 19, 32, 0.578); +} + +.container{ + /*--box-size: 30%; !* 定义一个名为--box-size的变量,值为50% *!*/ + display: flex; + align-items: center; + flex-direction: column; + flex-wrap: wrap; + box-sizing: border-box; + padding: 10px; + border: 1px solid #ccc; + height: 100%; + width:100%; +} +img{ + border-radius: 5%; +} +/*资源详情*/ +/* 四个悬浮球的共同样式 */ +.floating-ball { + margin:30px 30px 10px; + position: relative; + color: #fff; + padding: 10px; + transition: all 0.3s ease; + + border-radius: 50%; + background: radial-gradient(circle, #224E79,#333333); + /*设置交叉轴的对齐方式为居中,同时可以使用将主轴方向设置为垂直方向,*/ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 16px; + font-weight: bold; + text-align: center; + cursor: pointer; + box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2); +} + +/* 悬浮球的鼠标悬停样式 */ +.floating-ball:hover { + box-shadow: 0 0 20px #66aee6; + background: radial-gradient(circle, snow,#66aee6); + font-size: 18px; + font-weight: bolder; + color: #333333; +} + +/* 悬浮球的标签样式 */ +.floating-ball span { + width: 100px; + height: 30px; + margin: 20px; + font-size: 14px; + display: block; + font-weight: bold; +} + +/* 悬浮球的介绍文字样式 */ +.floating-ball p { + width: 100px; + height: 300px; + font-size: 12px; +} + + + +/*video*/ +.left-box { + padding: 10px; + display: flex; + flex-direction: column; + width: 25%; height: 100%; +} +.play_status{ + float: left; + width: 1rem;height: 1rem; + border-radius: 50%; + background: green; +} +#main_video_span{ + float: right; + width: 70%;height: 80%; + color: white; + text-align: right; + margin-top: 5%; + border-bottom: #fff000 solid; + +} +.video_card_text-body{ + float: right; + font-size: x-small; + font-weight: 300; + color: snow; + clear: both; + margin: 10% 2% 2%; +} +#video_left_autoplay{ + width: 100%;height: auto; + margin: 3px; + border: solid rgb(142, 176, 192) 1px;border-top: none; box-shadow: 0 4px 7px rgba(162, 209, 231, 0.618); +} +#video_text{ + width: 100%;height: 60%; + margin: 2px;padding: 5%; + font-family:fangsong; + font-size: medium; + font-weight: 300; + color: snow; + overflow-y: scroll; + +} +.right-box { + display: flex; + flex-wrap: wrap; + padding: 10px; + width: 70%;height: 100%; + overflow-y: scroll; + overflow-x: hidden; + -ms-overflow-style:none; /* IE and Edge 隐藏 IE、Edge的滚动条*/ +} +right-box::-webkit-scrollbar { + display: none; /* 隐藏 Chrome、Safari 和 Opera 的滚动条 */ + width: 0; + height: 0; +} + +.video_card_texts{ + width: 25%;height: 30%; + border: 1px solid #ddd; + border-radius: 5px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + overflow: hidden; + margin: 20px; +} + +.video_cards { + display: flex; + flex-wrap: wrap; + width: 20%; + height: 23%; + border-radius: 10px; + box-shadow: 0 0 20px 3px rgba(0, 123, 255, 0.8); + margin: 20px; +} + +.video_card-img-top-div { + width: 100%; + height: 100%; + text-align: center; + padding: 2px; +} +.video_card_text { + width: 100%; + padding: 10px; + background: linear-gradient(rgba(0, 123, 255, 0.8), transparent); + border-radius: 0 0 10px 10px; + transition: background-color 0.3s ease; +} +.video_card_text div{ + float: left; + width: 15px; + height: 15px; + margin: 2px; + background-repeat: no-repeat; + background-size: contain; + cursor: pointer; +} +.video_card_text a { + float: right; + width: 70%; + height: 100%; + display: block; + color: #fff; + font-size: xx-small; +} + +.video_card_text:hover { + background: linear-gradient(rgba(0, 105, 217, 0.8), transparent); +} + +/* "我的"界面*/ + +/* Container */ +#index_mine { + justify-content: space-between; + font-family: Arial, sans-serif; + color: #fff; + padding: 10px; +} +#left-box-mine{ + padding: 5%; + margin: 0 auto 0; +} +#left-box-mine div{ + width: 50%; + height: 60%; + padding: 10%; + border: white solid 1px; + border-radius: 6%; + box-shadow: 0 0 1rem .5rem #E4FEFF; +} + +.left-box img { + width: 50%; + height: 30%; + border-radius: 50%; + margin: 10% 25% 0; + +} +.signature { + width: 50%; + height: 20%; + margin: 10% 25% 0; +} +.user-options{ + width: 80%;height: 10%; + float: left; + display: flex; + flex-direction:row;/*row:行 column:列*/ + justify-content: flex-start; +} +.user-options li{ + width: 30%;height: 10%; + padding: 5%; + margin: 5%; + color: white; + font-family: 黑体, serif; + font-size: x-small; + font-weight: normal; + cursor: pointer; +} +.user-options li:hover{ + color: #66aee6; +} +.user-options li:first-child{ + float: left; +} +.user-options li:last-child{ + float: right; +} +#right-box-mine{ + display: unset; + padding: 10px; + margin-right: 3%; + width: 60%;height: 100%; + overflow-y: scroll; + overflow-x: hidden; +} +#right-box-mine::-webkit-scrollbar { + display: none; /* 隐藏 Chrome、Safari 和 Opera 的滚动条 */ + width: 0; + height: 0; +} +#right-box-mine h2 { + margin-bottom: 20px; +} +.mine_rightbox_chosed{ + padding: 0; + margin: 0; + width: 90%;height: 10%; + background-color: #00152b; +} +.mine_rightbox_chosed ul{ + width: 80%;height: 100%; + float: left; + display: flex; + flex-direction:row;/*row:行 column:列*/ + justify-content: flex-start; +} +.mine_rightbox_chosed ul li{ + width: 15%;height: 50%; + float: left; + padding: 2%; + margin: 1%; + color: white; + font-family: 黑体, serif; + font-size: x-small; + font-weight: normal; + border-top-left-radius: 10%; + border-top-right-radius: 10%; + cursor: pointer; + transition: all 1s; +} +.mine_command{ + float: right; + color: #66aee6; + font-family: fangsong; + font-weight: bold; + cursor:pointer; +} +.mine_command:hover{ + color: snow; +} +.record-row { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + border: #E4FEFF solid 1px; + box-shadow: 0 0 1rem .5rem #436495; +} + +.record-block { + width: 100%; + height: 30%; + background-color: #032541; + padding: 20px; + border-radius: 5px; + margin-bottom: 20px; +} +.NoContent{ + display: block; + width: 100%; + height: 70%; + margin: 0 auto 0; + color: gray; +} +.record-block h3 { + color: #fff; + margin-bottom: 10px; +} + +.record-block ul { + display: flex; + flex-wrap: wrap-reverse; + width: 100%; + height: 100%; + list-style-type: none; + padding: 0; + margin-bottom: 10px; +} + +.record-block ul li { + width: 25%; + height: 25%; + margin: 2% 2% 5px; + box-shadow: 0 0 2px 0 #E4FEFF; + +} +.record-block .delete_icon{ + display: none; + float: right; + width: 15px; + height: 15px; + margin: 2px; + background-repeat: no-repeat; + background-size: contain; + cursor: pointer; +} +#mine_video_card_text{ + width: 85%; +} +#mine_video_card_text a{ + float: unset; + width: 100%; +} + + +/*.video_card_text-img-top {*/ +/* width: 100%;*/ +/* height: 100%;*/ +/* object-fit: cover;*/ +/*}*/ + +/*.video_card_text {*/ +/* display: block;*/ +/* width: 100%;*/ +/* margin-top: 10px;*/ +/* background-color: #007bff;*/ +/* border-radius: 5px;*/ +/*}*/ +/*.video_card_text a {*/ +/* color: #fff;*/ +/* text-align: center;*/ +/* font-size: 1em;*/ +/* text-decoration: none;*/ +/*}*/ +/*.video_card_text:hover{*/ +/* background-color: #0069d9;*/ +/*}*/ diff --git a/static/css/user_manage.css b/static/css/user_manage.css new file mode 100644 index 0000000..0d9b954 --- /dev/null +++ b/static/css/user_manage.css @@ -0,0 +1,121 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +.container { + position: absolute; + left: 25%; + top: 25%; + width: 50%; + height: 100vh; + background-color: white; +} + +.user-info { + display: flex; + align-items: center; + padding: 20px; + border-bottom: 1px solid #ccc; +} + +.user-avatar { + width: 80px; + height: 80px; + border-radius: 50%; + margin-right: 20px; +} + +.user-id { + font-size: 24px; + font-weight: bold; +} + +.user-signature { + font-size: 16px; + color: #666; +} + +.user-list { + list-style: none; +} + +.user-list-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 15px 20px; + border-bottom: 1px solid #ccc; +} + +.user-list-item-label { + font-size: 18px; +} + +.user-list-item-value { + font-size: 18px; + color: #333; +} + +.user-list-item-icon { + width: 20px; + height: 20px; + margin-left: 10px; +} + +.user-list-item-dropdown { + display: none; + background: white; + width: 200px; + border-radius: 5px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +.user-list-item-dropdown-input { + width: calc(100% - 20px); + margin: 10px auto; + padding-left: 10px; + border-radius: 5px; + border: none; +} + +.user-list-item-dropdown-button { + width: calc(100% - 40px); + margin-left: auto; + margin-right:auto; + margin-bottom :10px ; + padding :10px ; + background-color :#2196f3 ; + color :white ; + border-radius :5px ; + border :none ; + cursor :pointer ; +} + .return_btn{ + position: absolute; + left: 80%; + top: 55%; + width: 6%; + height: 5%; + margin-left: auto; + margin-right:auto; + margin-bottom :10px ; + box-shadow: 0 0 10px #66aee6; + border: solid 1px #66aee6; + border-radius: 40%; + text-align: center; + font-size: 20px; + font-weight: bolder; + background-color: #66aee6; + font-family: "Microsoft YaHei"; + color: snow; + transition: all 1s; + cursor: pointer; + } + .return_btn:hover{ + background-color: snow; + color: #66aee6; + box-shadow: 0 0 10px darkgray; + border: solid 1px #arkgray; + } diff --git a/static/doc/党史党章/中国共产党章程-标注版.docx b/static/doc/党史党章/中国共产党章程-标注版.docx new file mode 100644 index 0000000..2be373b Binary files /dev/null and b/static/doc/党史党章/中国共产党章程-标注版.docx differ diff --git a/static/doc/党史党章/党史-研究院.docx b/static/doc/党史党章/党史-研究院.docx new file mode 100644 index 0000000..788f6f0 Binary files /dev/null and b/static/doc/党史党章/党史-研究院.docx differ diff --git a/static/doc/党史党章/党章.docx b/static/doc/党史党章/党章.docx new file mode 100644 index 0000000..b966fed Binary files /dev/null and b/static/doc/党史党章/党章.docx differ diff --git a/static/doc/党史党章/参考资料.docx b/static/doc/党史党章/参考资料.docx new file mode 100644 index 0000000..63e9a9a Binary files /dev/null and b/static/doc/党史党章/参考资料.docx differ diff --git a/static/doc/论文库/2021年人工智能领域科技发展综述_韩雨.pdf b/static/doc/论文库/2021年人工智能领域科技发展综述_韩雨.pdf new file mode 100644 index 0000000..f4a5801 Binary files /dev/null and b/static/doc/论文库/2021年人工智能领域科技发展综述_韩雨.pdf differ diff --git a/static/doc/论文库/AI标准化白皮书(2021).pdf b/static/doc/论文库/AI标准化白皮书(2021).pdf new file mode 100644 index 0000000..3a489f2 Binary files /dev/null and b/static/doc/论文库/AI标准化白皮书(2021).pdf differ diff --git a/static/doc/论文库/人工智能生产内容白皮书.pdf b/static/doc/论文库/人工智能生产内容白皮书.pdf new file mode 100644 index 0000000..96c266a Binary files /dev/null and b/static/doc/论文库/人工智能生产内容白皮书.pdf differ diff --git a/static/doc/论文库/人工智能白皮书2022.pdf b/static/doc/论文库/人工智能白皮书2022.pdf new file mode 100644 index 0000000..5a15bc0 Binary files /dev/null and b/static/doc/论文库/人工智能白皮书2022.pdf differ diff --git a/static/doc/论文库/人工智能的伦理困境与正解_娄延强.pdf b/static/doc/论文库/人工智能的伦理困境与正解_娄延强.pdf new file mode 100644 index 0000000..ed92196 Binary files /dev/null and b/static/doc/论文库/人工智能的伦理困境与正解_娄延强.pdf differ diff --git a/static/doc/论文库/人工智能的过去、现在和未来_答凯艳.pdf b/static/doc/论文库/人工智能的过去、现在和未来_答凯艳.pdf new file mode 100644 index 0000000..65eb2b0 Binary files /dev/null and b/static/doc/论文库/人工智能的过去、现在和未来_答凯艳.pdf differ diff --git a/static/doc/论文库/双循环战略提升中国人工智能产业竞争力途径_董天宇.pdf b/static/doc/论文库/双循环战略提升中国人工智能产业竞争力途径_董天宇.pdf new file mode 100644 index 0000000..552cd1a Binary files /dev/null and b/static/doc/论文库/双循环战略提升中国人工智能产业竞争力途径_董天宇.pdf differ diff --git a/static/doc/论文库/护理提供者在诊断成像.pdf b/static/doc/论文库/护理提供者在诊断成像.pdf new file mode 100644 index 0000000..d8a3aaa Binary files /dev/null and b/static/doc/论文库/护理提供者在诊断成像.pdf differ diff --git a/static/doc/论文库/眼动荧光.pdf b/static/doc/论文库/眼动荧光.pdf new file mode 100644 index 0000000..203d31e Binary files /dev/null and b/static/doc/论文库/眼动荧光.pdf differ diff --git a/static/icons/删除.png b/static/icons/删除.png new file mode 100644 index 0000000..c1694bc Binary files /dev/null and b/static/icons/删除.png differ diff --git a/static/icons/喜欢.png b/static/icons/喜欢.png new file mode 100644 index 0000000..4e0ffc2 Binary files /dev/null and b/static/icons/喜欢.png differ diff --git a/static/icons/喜欢后.png b/static/icons/喜欢后.png new file mode 100644 index 0000000..990073c Binary files /dev/null and b/static/icons/喜欢后.png differ diff --git a/static/icons/开发中.png b/static/icons/开发中.png new file mode 100644 index 0000000..f0af645 Binary files /dev/null and b/static/icons/开发中.png differ diff --git a/static/icons/收藏.png b/static/icons/收藏.png new file mode 100644 index 0000000..c9e76f9 Binary files /dev/null and b/static/icons/收藏.png differ diff --git a/static/icons/收藏后.png b/static/icons/收藏后.png new file mode 100644 index 0000000..2ae7e9b Binary files /dev/null and b/static/icons/收藏后.png differ diff --git a/static/icons/文档.png b/static/icons/文档.png new file mode 100644 index 0000000..6e63202 Binary files /dev/null and b/static/icons/文档.png differ diff --git a/static/icons/未登录用户.png b/static/icons/未登录用户.png new file mode 100644 index 0000000..d416de9 Binary files /dev/null and b/static/icons/未登录用户.png differ diff --git a/static/icons/群星华绽.png b/static/icons/群星华绽.png new file mode 100644 index 0000000..ef079ae Binary files /dev/null and b/static/icons/群星华绽.png differ diff --git a/static/icons/记录1.png b/static/icons/记录1.png new file mode 100644 index 0000000..92c2b3e Binary files /dev/null and b/static/icons/记录1.png differ diff --git a/static/icons/资源.png b/static/icons/资源.png new file mode 100644 index 0000000..eab6028 Binary files /dev/null and b/static/icons/资源.png differ diff --git a/static/imgs/OrionPleiades-Imgur.jpg b/static/imgs/OrionPleiades-Imgur.jpg new file mode 100644 index 0000000..b40fae1 Binary files /dev/null and b/static/imgs/OrionPleiades-Imgur.jpg differ diff --git a/static/imgs/background_img1.jpg b/static/imgs/background_img1.jpg new file mode 100644 index 0000000..fa6d6d1 Binary files /dev/null and b/static/imgs/background_img1.jpg differ diff --git a/static/imgs/main0.png b/static/imgs/main0.png new file mode 100644 index 0000000..9e9515f Binary files /dev/null and b/static/imgs/main0.png differ diff --git a/static/imgs/main1.png b/static/imgs/main1.png new file mode 100644 index 0000000..9bbac65 Binary files /dev/null and b/static/imgs/main1.png differ diff --git a/static/imgs/main2.jpeg b/static/imgs/main2.jpeg new file mode 100644 index 0000000..0a991a3 Binary files /dev/null and b/static/imgs/main2.jpeg differ diff --git a/static/imgs/main3.png b/static/imgs/main3.png new file mode 100644 index 0000000..4460cd7 Binary files /dev/null and b/static/imgs/main3.png differ diff --git a/static/imgs/main4.png b/static/imgs/main4.png new file mode 100644 index 0000000..e187f14 Binary files /dev/null and b/static/imgs/main4.png differ diff --git a/static/imgs/main5.png b/static/imgs/main5.png new file mode 100644 index 0000000..ebd1629 Binary files /dev/null and b/static/imgs/main5.png differ diff --git a/static/imgs/main6.png b/static/imgs/main6.png new file mode 100644 index 0000000..3174178 Binary files /dev/null and b/static/imgs/main6.png differ diff --git a/static/imgs/pexels-faik-akmd-1025469.png b/static/imgs/pexels-faik-akmd-1025469.png new file mode 100644 index 0000000..1bb24e8 Binary files /dev/null and b/static/imgs/pexels-faik-akmd-1025469.png differ diff --git a/static/imgs/pexels-felix-mittermeier-956981.jpg b/static/imgs/pexels-felix-mittermeier-956981.jpg new file mode 100644 index 0000000..a4faef1 Binary files /dev/null and b/static/imgs/pexels-felix-mittermeier-956981.jpg differ diff --git a/static/imgs/temp1.jpg b/static/imgs/temp1.jpg new file mode 100644 index 0000000..ba551c2 Binary files /dev/null and b/static/imgs/temp1.jpg differ diff --git a/static/imgs/temp2.jpg b/static/imgs/temp2.jpg new file mode 100644 index 0000000..ed56105 Binary files /dev/null and b/static/imgs/temp2.jpg differ diff --git a/static/imgs/temp3.jpg b/static/imgs/temp3.jpg new file mode 100644 index 0000000..a61d67b Binary files /dev/null and b/static/imgs/temp3.jpg differ diff --git a/static/imgs/temp4.jpg b/static/imgs/temp4.jpg new file mode 100644 index 0000000..749640f Binary files /dev/null and b/static/imgs/temp4.jpg differ diff --git a/static/imgs/temp5.jpg b/static/imgs/temp5.jpg new file mode 100644 index 0000000..fe5b4ee Binary files /dev/null and b/static/imgs/temp5.jpg differ diff --git a/static/imgs/temp6.jpg b/static/imgs/temp6.jpg new file mode 100644 index 0000000..52caeff Binary files /dev/null and b/static/imgs/temp6.jpg differ diff --git a/static/imgs/test.jpg b/static/imgs/test.jpg new file mode 100644 index 0000000..9fcbb93 Binary files /dev/null and b/static/imgs/test.jpg differ diff --git a/static/imgs/users/Boy.bmp b/static/imgs/users/Boy.bmp new file mode 100644 index 0000000..2b2f1bf Binary files /dev/null and b/static/imgs/users/Boy.bmp differ diff --git a/static/imgs/users/girl.png b/static/imgs/users/girl.png new file mode 100644 index 0000000..1f00a1e Binary files /dev/null and b/static/imgs/users/girl.png differ diff --git a/static/imgs/users/new_filename.jpg b/static/imgs/users/new_filename.jpg new file mode 100644 index 0000000..1f00a1e Binary files /dev/null and b/static/imgs/users/new_filename.jpg differ diff --git a/static/imgs/users/root.png b/static/imgs/users/root.png new file mode 100644 index 0000000..964f15c Binary files /dev/null and b/static/imgs/users/root.png differ diff --git a/static/imgs/xtu-afternoon.png b/static/imgs/xtu-afternoon.png new file mode 100644 index 0000000..06d9bb3 Binary files /dev/null and b/static/imgs/xtu-afternoon.png differ diff --git a/static/imgs/桑卡拉.webp b/static/imgs/桑卡拉.webp new file mode 100644 index 0000000..56a96f2 Binary files /dev/null and b/static/imgs/桑卡拉.webp differ diff --git a/static/js/experrments.js b/static/js/experrments.js new file mode 100644 index 0000000..fb273e6 --- /dev/null +++ b/static/js/experrments.js @@ -0,0 +1,6 @@ +function cont(){ + if(confirm("这里是实践测试网站,相关功能可能并不成熟,是否继续?")) + return true; + else return false; +} +document.ready = cont(); diff --git a/static/js/index.js b/static/js/index.js new file mode 100644 index 0000000..a9edcb8 --- /dev/null +++ b/static/js/index.js @@ -0,0 +1,97 @@ + + +function Gid(id){ + return document.getElementById(id); +} +let lock = false; + +// 轮播图 +let lis = document.getElementsByClassName("mainpage_imgs") +lis[0].style.zIndex = '10'; +lis[0].style.opacity = '1'; +let points=document.getElementsByClassName("points"); +let timer=null;//计时器 + + +let index=0; +let len = lis.length +let preIndex = 0 +function goNext(){ + mainpageImgs_descChange(index); + lis[preIndex].style.zIndex = '0'; + lis[preIndex].style.opacity = '0'; + + lis[index].style.zIndex = '10'; + lis[index].style.opacity = '1'; + lis[index].style.transition ='opacity .5s'; + + + for(let Choose = 0;Choose <=6 ; Choose++){ + if (Choose !==index){ + points[Choose].className = "points" ; + } + else + points[Choose].className = "points active" ; + } + + +}//对目标元素显示 + + +//按钮切换 +Gid("change-right").addEventListener("click",function(){ + preIndex = index; + index=(index+1)%7; + goNext(); +}) +Gid("change-left").addEventListener("click",function(){ + preIndex = index; + if(index==0) index=6; + else index--; + goNext(); +}) +//辅助切换 +function points_change(thePrt){ + preIndex = index; + index=thePrt; + goNext(); +} +for(let i=0;i+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&v(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!y||!y.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ve(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ye(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ve(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.cssHas=ce(function(){try{return C.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],y=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||y.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),d.cssHas||y.push(":has"),y=y.length&&new RegExp(y.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),v=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType&&e.documentElement||e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&v(p,e)?-1:t==C||t.ownerDocument==p&&v(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!y||!y.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),v.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",v.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",v.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return B(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=_e(v.pixelPosition,function(e,t){if(t)return t=Be(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 { + resources.hide(); + doc.show(); + }); + + videoBall.addEventListener('click', () => { + // 点击视频悬浮球时的操作 + resources.hide(); + $("#video_left_autoplay").play(); + video.show(); + }); + + myBall.addEventListener('click', () => { + // 点击我的悬浮球时的操作 + resources.hide(); + mine.show(); + }); + + musicBall.addEventListener('click', () => { + // 点击音乐悬浮球时的操作 + resources.hide(); + music.show(); + }); + + + //登录球 + let login_user = $('#login') + let user_profile = $('.user_profile') + if (username !== null) { + user_profile.children('#profile').text(localStorage.getItem('user_signature')) + user_profile.find('#user_id').text(localStorage.getItem('user_id')) + } + login_user.on('click', function () { + if (username === null) { + login_config() + } else { + // ****** 打开管理界面******// + window.open('/users_manage') + } + }) + login_user.on('mouseenter', function () { + user_profile.css('opacity', '100%') + }) + login_user.on('mouseleave', function () { + user_profile.css('opacity', '0') + }) + + //……………………非“资源详情页”……………………// + //video + let play_status = $(".play_status"); + play_status.css("background-color", "green"); + //主页的视频 + video_left_autoplay.addEventListener("pause", function () { + $(".play_status").css("background-color", "red"); + + + }) + video_left_autoplay.addEventListener("play", function () { + $(".play_status").css("background-color", "green"); + + + }) + video_left_autoplay.addEventListener("click", function () { + }); + //收藏 + $(".video_cards .video_card_text").each(function () { + let this_video_card_id = $(this).attr("id"); + $(this).on('click', ".collection_icon", function () { //事件委托 + let id = this_video_card_id + let video_href = $(this).siblings('a').attr("href");//.siblings() 表示选中兄弟元素, + + if ($.inArray(id, collection_list) === -1) // 直接用in是不行的,in处理的是对象 + { //不要写成this.……,这个是dom对象 + if (send_collecting_request(id, video_href)) { + collection_list.push(id) + console.log('collection_list:' + collection_list) + $(this).css("background-image", "url('/static/icons/收藏后.png')"); // 不要加“../” + alert("收藏成功") + } else { + alert("收藏失败,请你稍后再试!") + } + } else { + // 发送请求取消收藏请求 + if (send_NoCollecting_request(id, video_href)) { + collection_list.splice($.inArray(id, collection_list), 1) //splice(索引,数量),splice()在未找到是会删去最后一个元素,这里已经排除了这种情况 + console.log('collection_list:' + collection_list) + $(this).css("background-image", "url('/static/icons/收藏.png')"); // 不要加“../” + alert("取消收藏成功") + } else { + alert("收藏失败,请你稍后再试!") + } + + } + }) + $(this).on('click', ".likeit_icon", function () { + let id = this_video_card_id + // let video_href = $(this).siblings('a').attr("href"); + + if ($.inArray(id, liked_list) === -1) + // { //不要写成this.……,这个是dom对象 + // if(send_Liking_request(id,video_href)){ + // collection_list.push(id) + // console.log($.inArray(id, collection_list)) + { + liked_list.push(id) + $(this).css("background-image", "url('/static/icons/喜欢后.png')"); + } // 不要加“../” + // alert("已添加") + // } + // else + // { + // } + + else { + // 发送请求取消喜欢的请求 + // if(send_NoLiked_request(id,video_href)) + // { + // collection_list.splice(this_video_card_id) + $(this).css("background-image", "url('/static/icons/喜欢.png')"); // 不要加“../” + // } + // else + // { + // } + } + }) + }) + let rightBox = document.querySelector('.right-box'); + let isScrolling = false; + + rightBox.addEventListener('scroll', function () { + isScrolling = true; + }); + + let scroll_t = setInterval(function () { + if (isScrolling) { + isScrolling = false; + + let visibleRows = Math.ceil(rightBox.clientHeight / 220); + let totalRows = document.querySelectorAll('.row').length; + + if (visibleRows + rightBox.scrollTop >= totalRows) { + // 加载更多数据 + } + } + }, 250); + +// **********************“我的界面”控制********************// + //左侧部分 + + let user_options = $('.user-options') + user_options.children('li').eq(0).on('click', function () { + alert('更改信息') + }) + user_options.children('li').eq(1).on('click', function () { + reLoad() + }) + + //右侧部分 + let page_index_before = 0; + let mine_righe_page_change = $(".mine_rightbox_chosed ul li") + mine_righe_page_change.eq(0).css({ + 'background-color': '#00215A', 'border': '#E4FEFF solid 1px', + 'box-shadow': '0 0 1rem .5rem #436495', 'color': '#F3F3F3', 'font-weight': '700' + }) //eq()方法选择对应索引的元素 + mine_righe_page_change.each(function (index) { + $(this).on("click", function () { + mine_righe_page_change.eq(page_index_before).css({ + 'background-color': 'unset', 'font-size': 'x-small', 'box-shadow': 'none', 'border': 'none' + , 'color': 'white', 'font-weight': 'normal' + }) + mine_righe_page_change.eq(index).css({ + 'background-color': '#00215A', 'border': '#E4FEFF solid 1px', + 'box-shadow': '0 0 1rem .5rem #436495', 'color': '#F3F3F3', 'font-weight': '700' + }) + page_index_before = index + }) + }) + + let command = $('.mine_command') + let is_Nocommand = true + let delete_icon = $('.delete_icon') + command.on('click', function () { + if (is_Nocommand) { + is_Nocommand = false + delete_icon.css('display', 'block') + } else { + is_Nocommand = true + delete_icon.css('display', 'none') + } + }) + $('.record-block ul li').each(function () { + $(this).children('.delete_icon').on('click', function () { + let video_id = $(this).parent('li').attr('id') + let video_href = $(this).siblings('#mine_video_card_text').children('a').attr('href') + if (send_NoCollecting_request(video_id, video_href)) { + console.log("delete:" + video_id) + collection_list.splice(video_id) + $(this).parent('li').remove() + update_video_list() + } + }) + }) + +}); + +function login_config() { + if (username === null) { + if (confirm("您还未登入,是否登入用户")) { + window.open("/login") + } + } +} + +function cont() { + return confirm("网站测试中,相关功能可能并不成熟,是否继续?"); +} + +// function user_init() { +// $.get('/user_data', function(response) { +// localStorage.setItem('username', response.username); // 使用响应中的用户名 +// localStorage.setItem('user_id', response.user_id); +// localStorage.setItem('user_url',response.user_url); // 用户头像地址 +// // 在这里可以根据需要对获取到的数据进行处理 +// // 更新界面等操作 +// console.log(response) +// console.log(response.user_avatar_url) +// window.close(); +// }); +// +// username = localStorage.getItem('username'); +// user_id = localStorage.getItem('user_id') +// let user_head_img = localStorage.getItem('user_url') +// +// if (username !== null) { +// $('#id_n').text(username); +// alert(`欢迎您:${username}`) +// $('#id_p').css('background-image', 'url(' + user_head_img + ')') +// console.log("user_id:" + user_id) +// console.log(user_head_img) +// $(".signature").text("欢迎您," + username + "") +// clearInterval(timer) +// // 从后端获取该用户的收藏喜欢信息 +// let user = { +// 'user_id': user_id, +// 'username': username, +// } +// $.ajax({ +// type: 'POST', +// url: '/resources/video/init', +// contentType: 'application/json', +// data: JSON.stringify(user), +// success: function (response) { +// if (response.length === 0) $('#NoVideo').css('display', 'block') +// else $('#NoVideo').css('display', 'none') +// for (let i = 0; i < response.length; i++) { +// let videoId = response[i].video_id; +// collection_list.push(videoId); // 将 video_id 值添加到数组中 +// console.log(response) +// } +// +// }, +// error: function (e) { +// console.log(e) +// alert('用户信息获取失败!请检测登录状态或检测网络') +// }, +// dataType: "json" +// }); +// } +// } + +function user_init() { + username = localStorage.getItem('username'); + user_id = localStorage.getItem('user_id'); + let user_head_img = localStorage.getItem('user_url') + user_head_img = "/static/" + user_head_img + + if (username !== null) { + $('#id_n').text(username); + alert(`欢迎您:${username}`) + $('#id_p').css('background-image', 'url(' + user_head_img + ')') + console.log("user_id:" + user_id) + console.log(user_head_img) + $(".signature").text("欢迎您," + username + "") + clearInterval(timer) + // 从后端获取该用户的收藏喜欢信息 + let user = { + 'user_id': user_id, + 'username': username, + } + $.ajax({ + type: 'POST', + url: '/resources/video/init', + contentType: 'application/json', + data: JSON.stringify(user), + success: function (response) { + if (response.length === 0) $('#NoVideo').css('display', 'block') + else $('#NoVideo').css('display', 'none') + for (let i = 0; i < response.length; i++) { + let videoId = response[i].video_id; + collection_list.push(videoId); // 将 video_id 值添加到数组中 + $(".video_cards").find('#'+videoId).children('.collection_icon').css("background-image", "url('/static/icons/收藏后.png')") + } + console.log(collection_list) + }, + error: function (e) { + console.log(e) + alert('用户信息获取失败!请检测登录状态或检测网络') + }, + dataType: "json" + }); + } +} +// 为每个悬浮球随机生成运动方向和速度 +function getRandomPos() { + var len = $(".floating-ball"); + var w = len.width() - 150; // 可移动范围 + var h = len.height() - 150; + var left = Math.floor(Math.random() * w); // 随机生成位置 + var top = Math.floor(Math.random() * h); + return { + left: left, + top: top + }; +} + +function moveBall($ball) { + var pos = getRandomPos(); + pos = getRandomPos(); + $ball.animate({ + left: pos.left, + top: pos.top + }, 5000, function () { + moveBall($ball); + }); +} + + +// 发送收藏视频请求 +function send_collecting_request(video_id, video_href) { + let collect_video = { + 'user_id': user_id, + 'username': username, + 'video_href': video_href, + 'id': video_id + } + let static_flag = true + $.ajax({ + type: 'POST', + url: '/resources/video/collection_update', + contentType: 'application/json', + data: JSON.stringify(collect_video), + success: function (response) { + console.log(response) + static_flag = true + }, + error: function () { + static_flag = false + }, + dataType: "json" + }); + return static_flag +} + +//取消视频收藏 +function send_NoCollecting_request(video_id, video_href) { + let collect_video = { + 'user_id': user_id, + 'username': username, + 'video_tite': video_tite, + 'video_href': video_href, + 'id': video_id + } + let static_flag = true + $.ajax({ + type: 'POST', + url: '/resources/video/collecting_cancel', + contentType: 'application/json', + data: JSON.stringify(collect_video), + success: function (response) { + console.log(response) + static_flag = true + }, + error: function () { + static_flag = false + }, + dataType: "json" + }); + return static_flag +} + +// 检测collection-list中的内容,用于我的页面的局部更新 +function update_video_list() { + if (collection_list.length === 0) $('#NoVideo').css('display', 'block') + else $('#NoVideo').css('display', 'none') +} + +function close_all() { + resources.hide() + music.hide() + doc.hide() + mine.hide() + video.hide() + video_left_autoplay.pause() +} + +function reLoad() { + // 清除浏览器中的localStorage内容 + localStorage.clear(); + // 刷新页面 + location.reload(); +} + +document.ready = cont(); + + diff --git a/static/js/user_manage.js b/static/js/user_manage.js new file mode 100644 index 0000000..39ee5fc --- /dev/null +++ b/static/js/user_manage.js @@ -0,0 +1,207 @@ +$(document).ready(function(){ + let user_id = localStorage.getItem('user_id') + let username = localStorage.getItem('username') + + // Get the list items and dropdowns + let emailItem = $("#email-item"); + let emailDropdown = $("#email-dropdown"); + let addressItem = $("#address-item"); + let addressDropdown = $("#address-dropdown"); + let enterpriseItem = $("#enterprise-item"); + let enterpriseDropdown = $("#enterprise-dropdown"); + let stu_idItem = $("#stu_id-item"); + let stu_idDropdown = $("#stu_id-dropdown"); + let useravatarItem = $("#user_avatar-item"); + let useravatarDropdown = $("#user_avatar-dropdown"); + + // Get the input fields and buttons + let emailInput = $("#email-input"); + let emailButton = $("#email-button"); + let addressInput = $("#address-input"); + let addressButton = $("#address-button"); + let enterpriseInput = $("#enterprise-input"); + let enterpriseButton = $("#enterprise-button"); + + let stu_idInput = $("#stu_id-input"); + let stu_idButton = $("#stu_id-button"); + let useravatarInput = $("#user_avatar-input"); + let useravatarButton = $("#user_avatar-button"); + + + let user_list_item = $('.user-list-item') + user_list_item.each(function (){ + $(this).children('img').on('click',function (){ + $(this).siblings('.user-list-item-dropdown').css('display','block') + }) + $(this).children('.user-list-item-dropdown').children('button').eq(1).on('click',function (){ + $(this).parent('.user-list-item-dropdown').css('display','none') + }) + }) + + // Change the list item value when clicking on the buttons + emailButton.click(function() { + let newEmail = emailInput.val(); + if (change_email(user_id,newEmail)) { + emailItem.find(".user-list-item-value").text(newEmail); + emailInput.val(""); + alert("Email changed successfully!"); + } else { + alert("Email changed successfully!"); + } + + }); + + addressButton.click(function() { + let newAddress = addressInput.val(); + if (change_address(user_id,newAddress)) { + addressItem.find(".user-list-item-value").text(newAddress); + addressInput.val(""); + alert("Address changed successfully!"); + } else { + alert("Address changed successfully!"); + } + }); + + enterpriseButton.click(function() { + let newEnterprise = enterpriseInput.val(); + if (change_enterprise(user_id,newEnterprise)){ + enterpriseItem.find(".user-list-item-value").text(newEnterprise); + enterpriseInput.val(""); + alert("Enterprise changed successfully!"); + } else { + alert("Enterprise changed successfully!"); + } + }); + + stu_idButton.click(function() { + let newstu_id = stu_idInput.val(); + console.log(user_id) + console.log(newstu_id) + if (change_stu_id(user_id,newstu_id) !== 'true') { + enterpriseItem.find(".user-list-item-value").text(newstu_id); + enterpriseInput.val(""); + alert("stu_id changed successfully!"); + } else { + alert("stu_id changed successfully!"); + } + }); + + useravatarInput.on("change", function() { + var file = this.files[0]; // Get the selected file + // Create a new FormData object + var formData = new FormData(); + formData.append("avatar", file); // Append the file to the FormData object + + alert("ok") + + $.ajax({ + url: "/upload-avatar", // Replace with your server-side endpoint for handling the avatar upload + type: "POST", + data: formData, + processData: false, + contentType: false, + success: function(response) { + console.log("Avatar uploaded successfully!"); + }, + error: function(e) { + console.log(e) + } + }); + }) + // Add more event handlers here + $('.return_btn').on('click',function (){ + window.parent.location.reload() + window.close() + }) + +}) + + +function change_stu_id(user_id,changed_data){ + let sta = false; + let data = { + 'user_id':user_id, + 'stu_id':changed_data, + } + $.ajax({ + url: "/upload-stu_id", // Replace with your server-side endpoint for handling the avatar upload + type: "POST", + data: JSON.stringify(data), + contentType: 'application/json', + success: function(response) { + console.log("Avatar uploaded successfully!"); + sta = true; + }, + error: function(xhr, status, error) { + console.error("Error uploading avatar:", error); + sta = false; + } + }); + return sta +} +function change_email(user_id,changed_data){ + let sta = 'false'; + let data = { + 'user_id':user_id, + 'email':changed_data, + } + $.ajax({ + url: "/upload-email", // Replace with your server-side endpoint for handling the avatar upload + type: "POST", + data: JSON.stringify(data), + contentType:'application/json', + success: function() { + console.log("email uploaded successfully!"); + sta = 'true' + }, + error: function() { + console.log("error") + sta = 'false' + } + }); + return sta +} +function change_address(user_id,changed_data){ + let sta = false; + let data = { + 'user_id':user_id, + 'address':changed_data, + } + $.ajax({ + url: "/upload-address", // Replace with your server-side endpoint for handling the avatar upload + type: "POST", + data: JSON.stringify(data), + contentType: 'application/json', + success: function(response) { + console.log("address uploaded successfully!"); + sta = true + }, + error: function(xhr, status, error) { + console.error("Error uploading address:", error); + sta = false + } + }); + return sta +} +function change_enterprise(user_id,changed_data){ + let sta = false; + let data = { + 'user_id':user_id, + 'enterprise':changed_data, + } + $.ajax({ + url: "/upload-enterprise", // Replace with your server-side endpoint for handling the avatar upload + type: "POST", + data: JSON.stringify(data), + contentType: 'application/json', + success: function(response) { + console.log("enterprise uploaded successfully!"); + sta = true + }, + error: function(xhr, status, error) { + console.error("Error uploading enterprise:", error); + sta = false + } + }); + return sta +} \ No newline at end of file diff --git a/static/video/Sparkling - 27212.mp4 b/static/video/Sparkling - 27212.mp4 new file mode 100644 index 0000000..6a43881 Binary files /dev/null and b/static/video/Sparkling - 27212.mp4 differ diff --git a/static/video/xtuxgmv.mp4 b/static/video/xtuxgmv.mp4 new file mode 100644 index 0000000..9c6b95c Binary files /dev/null and b/static/video/xtuxgmv.mp4 differ diff --git a/templates/control.html b/templates/control.html new file mode 100644 index 0000000..22259b2 --- /dev/null +++ b/templates/control.html @@ -0,0 +1,27 @@ + + + + + none + + + +{% if age < 18 %} +
您未成年,已进入青少年模式!
+ +{% elif age >= 18%} +
你好,同志!
+ +{% endif %} + +
    + {% for li in data %} +
  • 姓名:{{li.name}}
  • +
  • 年龄:{{li.age}}
  • + + {% endfor %} +
+ + + + \ No newline at end of file diff --git a/templates/experments.html b/templates/experments.html new file mode 100644 index 0000000..6018fb1 --- /dev/null +++ b/templates/experments.html @@ -0,0 +1,22 @@ + + + + + + + + 开发-前进 + + + + +
+ +
+
+
更多内容正在整理中,敬请期待……
+
+ + + \ No newline at end of file diff --git a/templates/from.html b/templates/from.html new file mode 100644 index 0000000..80cd8f1 --- /dev/null +++ b/templates/from.html @@ -0,0 +1,59 @@ + + + + + + + Title + + +

注册页面

+
+

+ + +

+

+ + +

+

+ + +

+

+ + + 女 + 保密 +

+

+ + 读书 + 户外 + 电影 + 其他 +

+

+ + +

+

+ + +

+ +

+ +

+

+ +

+
+ + + \ No newline at end of file diff --git a/templates/hello.html b/templates/hello.html new file mode 100644 index 0000000..f69276b --- /dev/null +++ b/templates/hello.html @@ -0,0 +1,15 @@ + + + + + Title + + +

hello world

+
+ + + +
+ + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..87f69a8 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,130 @@ + + + + + + + + + 群星——天启 + + + + + + + +
+
+
+ +
+
+
+
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
+
<
+
>
+
+ ^AI,人类与地外文明,共同奏响驶向群星的交响^ +
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
+
+
+
+ 开发者说 + +
你好,陌生人。群星-天启是一个以个人开发学习为目的的网页实战项目,其所有内容皆为原创。
+
你好,朋友。本网站将为你提供您或许会感兴趣的内容,但鄙人时间有限,网页的功能还在完善。还请多多海涵!
+
你好,未曾谋面的你,如果您的时间尚且宽裕,还希望停下脚步见证关于“群星-天启”的前进!
+
+
+
+ +
+
+ +
+ + + + + + + + + diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..cb037e6 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,77 @@ + + + + + + + + 登录 + + + + + +{# #} + + + + + + + \ No newline at end of file diff --git a/templates/myDocs.html b/templates/myDocs.html new file mode 100644 index 0000000..27056ca --- /dev/null +++ b/templates/myDocs.html @@ -0,0 +1,29 @@ + + + + + + + 文档-群星 + + + + + +
+ + + +
+ + + + + + \ No newline at end of file diff --git a/templates/page_child1.html b/templates/page_child1.html new file mode 100644 index 0000000..460bb3d --- /dev/null +++ b/templates/page_child1.html @@ -0,0 +1,18 @@ +{% extends 'page_main.html' %} + +{% block title %} + 子页面继承 +{% endblock %} + +{% block body %} +
+ +
子页面1
+
+ 111111 +
+ + + +
+{% endblock%} \ No newline at end of file diff --git a/templates/page_main.html b/templates/page_main.html new file mode 100644 index 0000000..57283f4 --- /dev/null +++ b/templates/page_main.html @@ -0,0 +1,15 @@ + + + + + {% block title %} {% endblock%} + + +
导航 这里不变
+

/{/%entends 父文件名/}’与’/{ /%block block名 /% /} 子内容 /{ /%block block名 /% /}‘实现模板继承

+{% block body %} + +{% endblock%} + + + \ No newline at end of file diff --git a/templates/records.html b/templates/records.html new file mode 100644 index 0000000..c870317 --- /dev/null +++ b/templates/records.html @@ -0,0 +1,18 @@ + + + + + + + + 记录-流水 + + + +
+
+
+
更多内容正在整理中,敬请期待……
+
+ + \ No newline at end of file diff --git a/templates/register.html b/templates/register.html new file mode 100644 index 0000000..7f3bc0e --- /dev/null +++ b/templates/register.html @@ -0,0 +1,71 @@ + + + + + + + + 注册 + + + +{##} + + + + + + + + + + \ No newline at end of file diff --git a/templates/resources.html b/templates/resources.html new file mode 100644 index 0000000..304b567 --- /dev/null +++ b/templates/resources.html @@ -0,0 +1,202 @@ + + + + + + + 资源-互联 + + + + + +
资源-互联
+
+
+
    +
  • 资源详情
  • +
  • 视频
  • +
  • 音乐
  • +
  • 文档
  • +
  • 我的
  • +
  • 回到首页
  • +
+
+
+ + 未登录 +
+ +
+ +
+
+ 文档 + 待定 +
+
+ 视频 + 待定 +
+
+ 我的 + 待定 +
+
+ 音乐 + 待定 +
+
+ + +
+
+ + +
+
+ 欢迎来到湘潭大学 +
+
+      湘潭大学简称“湘大”,是一代伟人毛泽东同志亲自倡办的综合性全国重点大学、国家“双一流”建设高校。 + 学校创办于1958年,同年9月10日,毛泽东同志亲笔题写“湘潭大学”校名,并亲切嘱托“一定要把湘潭大学办好”。1974年,邓小平、李先念等中央领导同志批准湘潭大学复校。 + 1978年,学校被国务院确定为全国16所文理工综合性重点大学之一。1981年,学校成为全国首批硕士学位授权单位。复校以来,华国锋、江泽民、李鹏等党和国家领导人先后对学校的建设发展给予了高度重视与亲切关怀。 + 2018年9月6日,习近平总书记对学校作出重要批示,希望湘潭大学扎根伟人故里,努力把学校办得更好、更有特色。2022年2月,学校入选国家“双一流”建设高校。 +
+
+
+ + + + {% for data in video_information %} +
+
+ Video Preview +
+ + +
+ {% endfor %} + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+
+ {% if user %} + User Avatar + {% else %} + User Avatar + {% endif %} + +

未登录

+
+
    +
  • 更改信息
  • +
  • 登出
  • +
+
+ +
+
+
    +
  • 我收藏的
  • +
  • 我喜欢的
  • +
+
管理
+
+
+
+

我推的视频

+ +
    + + {#数据来自后端,自动预加载#} + {% for data in connected_video_information %} +
  • +
    +
    + Video Preview +
    + + +
  • + {% endfor %} +
+
+
+

我推的音乐

+ +{#
    #} +{#
  • Song 1
  • #} +{#
  • Song 2
  • #} +{#
  • Song 3
  • #} +{#
#} +
+
+

我推的文档

+ +
    +{#
  • Document 1
  • #} +{#
  • Document 2
  • #} +{#
  • Document 3
  • #} +
+
+
+ + +
+
+ + +
+ +
+ + + + + + \ No newline at end of file diff --git a/templates/user_manage.html b/templates/user_manage.html new file mode 100644 index 0000000..76b0f68 --- /dev/null +++ b/templates/user_manage.html @@ -0,0 +1,107 @@ + + + + + + + 用户信息管理 + + + +
+ +
    +
  • + Email邮箱 + {% if user %} + {{ user.email }} + {% else %} + 未设置 + {% endif %} + Edit icon +
    + + + +
    +
  • +
  • + 地址 + {% if user %} + {{ user.address }} + {% else %} + 未设置 + {% endif %} + Edit icon +
    + + + +
    +
  • +
  • + 企业或组织 + {% if user %} + {{ user.enterprise }} + {% else %} + 未设置 + {% endif %} + Edit icon +
    + + + +
    +
  • +
  • + 学号 + {% if user %} + {{ user.stu_id }} + {% else %} + 0000 + {% endif %} + Edit icon +
    + + + +
    +
  • +
  • + 更改我的头像 + Edit icon +
    + + + +
    +
  • + + +
+ +
+
+ 返回 +
+ + + + + + \ No newline at end of file