提交视频播放,并修复一些问题

master
newrain001 2 years ago
parent dfdb61c3d1
commit e53d6e4eec
  1. 6
      App/csdn.json
  2. 4
      App/csdn.py
  3. 26
      App/migrations/0018_videoupload.py
  4. 22
      App/migrations/0019_auto_20220507_0021.py
  5. 18
      App/migrations/0020_videoupload_video_desc.py
  6. 12
      App/models.py
  7. 2
      App/qingcloud.py
  8. 7
      App/urls.py
  9. 66
      App/views.py
  10. 14
      djangoProject/settings.py
  11. BIN
      static/images/archive.png
  12. 16
      templates/function/edit.html
  13. 4
      templates/function/user.html
  14. 229
      templates/index.html
  15. 42
      templates/nav/dashboard.html
  16. 13
      templates/nav/upload.html
  17. 22
      templates/template.html

@ -2,16 +2,16 @@
"https://blog.csdn.net/NewRain_wang/article/details/124244031": {
"title": "蓝鲸智云平台部署[6.0.5]",
"text": "蓝鲸智云平台部署生产环境部署版本6.5主机ip配置系统节点bk1192.168.96.1884c16gcentos7.6主控节点bk2192.168.96.2104c16gcentos7.6作业节点bk3192.168.96.2114c16gcentos7.6作业节点基础套餐下载地址证书下载地址环境准备[三节点执行]1、yum源配置# 官方建议,腾讯云yum源wget -O /etc/yum.repos.d/CentOS",
"image": "https://images.unsplash.com/photo-1533327325824-76bc4e62d560?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=MnwxfDB8MXxyYW5kb218MHx8Ym9vayxsaWJyYXJ5fHx8fHx8MTY1MTY1NDU2OQ&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=500"
"image": "https://images.unsplash.com/photo-1525715843408-5c6ec44503b1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=200&ixid=MnwxfDB8MXxyYW5kb218MHx8Ym9vayxsaWJyYXJ5fHx8fHx8MTY1MTgwNzc2Mg&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=300"
},
"https://blog.csdn.net/NewRain_wang/article/details/123978684": {
"title": "prometheus 监控K8S集群",
"text": "prometheus 监控k8s集群介绍名称配置版本系统版本master4核8G1.20.1centos7.6node12核4G1.20.1centos7.6node22核4G1.20.1centos7.6node32核4G1.20.1centos7.6prometheus-operator-v0.9.0-prometheus-operator下载地址prometheus-镜像下载地址prometheus-",
"image": "https://images.unsplash.com/photo-1533327325824-76bc4e62d560?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=MnwxfDB8MXxyYW5kb218MHx8Ym9vayxsaWJyYXJ5fHx8fHx8MTY1MTY1NDU2OQ&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=500"
"image": "https://images.unsplash.com/photo-1576684878197-b1e4e54dbaa9?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=200&ixid=MnwxfDB8MXxyYW5kb218MHx8Ym9vayxsaWJyYXJ5fHx8fHx8MTY1MTgwNzc4NA&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=300"
},
"https://blog.csdn.net/NewRain_wang/article/details/123856034": {
"title": "helm 安装与使用 [kubeadm]",
"text": "获取helm源码包wget https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gztar zxvf helm-v3.2.4-linux-amd64.tar.gzmv linux-amd64/helm /usr/local/bin/yum install -y socat helm init --client-only --stable-repo-url https://aliacs-app-catalog.oss-cn-hangzhou.aliyunc",
"image": "https://images.unsplash.com/photo-1484415063229-3d6335668531?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=500&ixid=MnwxfDB8MXxyYW5kb218MHx8Ym9vayxsaWJyYXJ5fHx8fHx8MTY1MTY1NDU3MA&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=500"
"image": "https://images.unsplash.com/photo-1576684878197-b1e4e54dbaa9?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=200&ixid=MnwxfDB8MXxyYW5kb218MHx8Ym9vayxsaWJyYXJ5fHx8fHx8MTY1MTgwNzc4NQ&ixlib=rb-1.2.1&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=300"
}
}

@ -6,8 +6,8 @@ from django_apscheduler.jobstores import DjangoJobStore, register_job, register_
scheduler = BackgroundScheduler()
scheduler.add_jobstore(DjangoJobStore(), "default")
def get_image(resolving='500x500'):
a = requests.head(f'https://source.unsplash.com/{resolving}/?book,library',headers={
def get_image(resolving='300x200',keyword='library'):
a = requests.head(f'https://source.unsplash.com/{resolving}/?{keyword}',headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'})
image = a.headers['Location']
if image:

@ -0,0 +1,26 @@
# Generated by Django 3.2.9 on 2022-05-06 16:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('App', '0017_auto_20220505_2143'),
]
operations = [
migrations.CreateModel(
name='videoUpload',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(max_length=100)),
('video_time', models.DateField(auto_now_add=True)),
('video_title', models.CharField(max_length=200)),
('video_desc', models.CharField(max_length=2000)),
('video_path', models.FileField(upload_to='')),
('views', models.IntegerField(default=0)),
('video_image', models.URLField(default='', max_length=10000)),
],
),
]

@ -0,0 +1,22 @@
# Generated by Django 3.2.9 on 2022-05-06 16:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('App', '0018_videoupload'),
]
operations = [
migrations.RemoveField(
model_name='videoupload',
name='video_desc',
),
migrations.AddField(
model_name='videoupload',
name='video_size',
field=models.IntegerField(default=0),
),
]

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2022-05-08 06:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('App', '0019_auto_20220507_0021'),
]
operations = [
migrations.AddField(
model_name='videoupload',
name='video_desc',
field=models.TextField(default=''),
),
]

@ -60,5 +60,17 @@ class thumbs(models.Model):
username = models.CharField(max_length=100)
thumbs_time = models.DateTimeField(auto_now_add=True)
paper_id = models.ForeignKey(paper, on_delete=models.CASCADE)
def __str__(self):
return self.username
class videoUpload(models.Model):
username = models.CharField(max_length=100)
video_time = models.DateField(auto_now_add=True)
video_title = models.CharField(max_length=200)
video_size = models.IntegerField(default=0)
video_path = models.FileField()
video_desc = models.TextField(default="")
views = models.IntegerField(default=0)
video_image = models.URLField(max_length=10000, default='')
def __str__(self):
return self.username

@ -16,7 +16,7 @@ def hashfile(file):
def putImage(file):
file_name = file.name
file_size = file.size
file_path = os.path.abspath(os.path.join(settings.MEDIA_ROOT, file_name))
file_path = os.path.abspath(os.path.join(settings.MEDIA_ROOT,'images', file_name))
with open(file_path , 'wb') as f:
for chunk in file.chunks():
f.write(chunk)

@ -1,5 +1,7 @@
from django.urls import path
from App import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', views.index, name='index'),
@ -17,4 +19,7 @@ urlpatterns = [
path('edit/<id>', views.editMD, name='editMD'),
path('paperlist/', views.paperList, name='paperList'),
path('paperview/<id>', views.paperDetail, name='paperDetail'),
]
path('video/', views.videoView, name='videoView'),
path('videolist/', views.videoList, name='videoList'),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

@ -1,5 +1,7 @@
import os
from django.contrib.auth import authenticate
from django.db.models import F
from django.db.models import F, QuerySet, Count
from django.http import JsonResponse
from django.shortcuts import HttpResponse, render, redirect, reverse
from django.contrib.auth.decorators import login_required
@ -90,7 +92,7 @@ def register(request):
return render(request, 'register.html')
# @cache_page(60 * 15)
@cache_page(60)
@login_required
def dashboard(request, type):
username = auth.get_user(request).username
@ -113,6 +115,9 @@ def dashboard(request, type):
elif type == 'blog':
data = getData(username, t, 'blog')
table = paper.objects.order_by('-paper_time').all()[:100]
elif type == 'video':
data = getData(username, t, 'video')
table = videoUpload.objects.order_by('-video_time').all()[:100]
else:
data = table = ""
return render(request, 'nav/dashboard.html', {'data': data, 'table': table, 'type': type})
@ -121,8 +126,38 @@ def dashboard(request, type):
@csrf_exempt
@login_required
def upload(request):
ftype = request.GET.get('type')
if request.method == 'POST':
if request.GET.get('type') == 'editmd':
if ftype == 'videos':
file = request.FILES.getlist('file', None)
data = {'status': 'success', 'msg': []}
today = str(datetime.date.today())
file_path = os.path.join(settings.MEDIA_ROOT, 'videos',today)
for i in file:
if '@' in i.name:
file_type = i.name.split('@')[0]
i.name = i.name.split('@')[1]
else:
file_type = 'other'
file_path = os.path.join(file_path, file_type)
if not os.path.exists(file_path):
os.makedirs(file_path)
file_path = os.path.join(file_path, i.name)
video = videoUpload.objects.filter(username=auth.get_user(request).username, video_title=i.name,
video_size=i.size)
if video.exists():
import shutil
shutil.move(os.path.join(settings.MEDIA_ROOT,str(video.get().video_path).replace('/upload/','')), file_path)
video.update(video_time=today, video_path=os.path.join('/upload/videos/',file_path.split(r"videos")[-1][1:].replace('\\','/')))
else:
image = get_image('215x280', file_type)
videoUpload.objects.create(username=auth.get_user(request).username, video_title=i.name, video_size=i.size, video_time=today, video_path=os.path.join('/upload/videos/',file_path.split(r"videos")[-1][1:].replace('\\','/')), video_image=image, video_desc=file_type)
with open(file_path, 'wb') as f:
for chunk in i.chunks():
f.write(chunk)
if data:
return HttpResponse(json.dumps(data))
elif ftype == 'editmd':
file = request.FILES.get('editormd-image-file')
url_path = putImage(file)
if Upload.objects.filter(username=auth.get_user(request).username, file_name=file.name,file_size=file.size).exists():
@ -140,11 +175,10 @@ def upload(request):
else:
url_path = putImage(i)
data['msg'].append(url_path)
Upload.objects.create(username=auth.get_user(request).username, file_name=i.name, file_path=i.name,
file_size=i.size, url_path=url_path['url']).save()
Upload.objects.create(username=auth.get_user(request).username, file_name=i.name, file_path=i.name, file_size=i.size, url_path=url_path['url']).save()
if data:
return HttpResponse(json.dumps(data))
return render(request, 'nav/upload.html')
return render(request, 'nav/upload.html', {'type': ftype})
# 功能函数
def getData(username, time, type='login'):
@ -157,6 +191,8 @@ def getData(username, time, type='login'):
data.update({str(date): Upload.objects.filter(username=username, upload_time__startswith=date).count()})
elif type == 'blog':
data.update({str(date): paper.objects.filter(paper_time__startswith=date).count()})
elif type == 'video':
data.update({str(date): videoUpload.objects.filter(video_time__startswith=date).count()})
return data
@ -168,7 +204,7 @@ def getAddr(ip):
@login_required
def listImage(request):
image = Upload.objects.filter(username=auth.get_user(request).username).all()
image = Upload.objects.filter(username=auth.get_user(request).username).all().order_by('-upload_time')
return render(request, 'nav/image.html', {'image': image})
@login_required
@ -222,7 +258,7 @@ def editMD(request, id=None):
return render(request, 'function/edit.html', {'data': data})
def paperList(request):
data = paper.objects.all()
data = paper.objects.all().order_by('-paper_time')
thumbs_up = {}
for i in data:
thumbs_up[i.id] = thumbs.objects.filter(paper_id=i.id).count()
@ -239,3 +275,17 @@ def paperDetail(request, id):
if data:
paper.objects.filter(id=id).update(views=paper.objects.filter(id=id).get().views+1)
return render(request, 'function/viewmd.html', {'data': data, 'thumbs': thumbs.objects.filter(paper_id=id).count()})
def videoView(request):
if request.method == 'GET':
video_path = request.GET.get('videopath')
return render(request, 'nav/videoview.html', {'path': video_path})
def videoList(request):
desc = videoUpload.objects.all().values('video_desc').distinct()
data = {}
for i in desc:
data[i["video_desc"]] = videoUpload.objects.filter(video_desc=i["video_desc"]).all()
for k,v in data.items():
print(v)
return render(request, 'nav/videolist.html', {'data':data })

@ -15,7 +15,6 @@ from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
@ -23,11 +22,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-*%g27%_dv27+0ust)qk#g08cr6!fj7_kh!*+3*=njbk9y&s4vh'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
@ -73,7 +71,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'djangoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
@ -102,7 +99,6 @@ CACHES = {
}
AUTH_USER_MODEL = 'App.User'
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
@ -121,7 +117,6 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
@ -135,16 +130,17 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'upload'),
)
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_ROOT = 'upload/'
MEDIA_URL = '/upload/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'upload')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

@ -1,16 +1,16 @@
<!DOCTYPE html>
<html lang="zh">
<head>
{% extends 'template.html' %}
{% load static %}
{% block title %}
<meta charset="utf-8"/>
<title>文章发表</title>
<title>文章编辑</title>
<link rel="stylesheet" href="{% static 'css/style.css' %}"/>
<link rel="stylesheet" href="{% static 'css/editormd.css' %}"/>
<link rel="stylesheet" href="{% static 'css/station/bootstrap.min.css' %}"/>
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon"/>
</head>
{% endblock %}
{% block content %}
<body onbeforeunload="event.returnValue='未保存'">
<div id="layout" style="height: 800px;background: #f6f6f6;">
<div id="layout" style="height: 800px;background: #f6f6f6;padding-top: 70px">
<form action="" method="post">
<header style="margin-left: 200px">
<div class="row g-3">
@ -73,4 +73,6 @@
{% endif %}
</script>
</body>
</html>
{% endblock %}
{% block foot %}
{% endblock %}

@ -27,7 +27,7 @@
<p>显示5次最近登录时数据,获取所有数据请联系管理员</p>
<ul class="icon-list">
{% for i in login_data %}
<li><a href="{% url 'App:userinfo' %}" rel="noopener" target="_blank">登录时间:{{ i.login_time }}&nbsp;&nbsp;&nbsp;&nbsp;登录地址:{{ i.client_addr }}</a>
<li>登录时间:{{ i.login_time }}&nbsp;&nbsp;登录地址:{{ i.client_addr }}
</li>
{% endfor %}
</ul>
@ -38,7 +38,7 @@
<ul class="icon-list">
{% for i in image_data %}
<li>
<a href="{{ i.url_path }}">图片链接</a>&nbsp;&nbsp;上传时间:{{ i.upload_time }}&nbsp;&nbsp;图片名称:{{ i.file_name }}
<a href="{{ i.url_path }}">图片链接</a>&nbsp;&nbsp;{{ i.upload_time }}&nbsp;&nbsp;{{ i.file_name |truncatechars:20 }}
</li>
{% endfor %}
</ul>

@ -1,131 +1,164 @@
{% extends 'template.html' %}
{% block title %}
<title>主页</title>
<title>主页</title>
{% endblock %}
{% block link %}
{% load static %}
<link rel="stylesheet" href="{% static 'css/station/carousel.css' %}">
{% endblock %}
{% block login %}
<header style="padding-top: 70px">
<header style="padding-top: 70px">
<div class="px-3 py-2 border-bottom mb-3">
<div class="container d-flex flex-wrap justify-content-center">
<form class="col-12 col-lg-auto mb-2 mb-lg-0 me-lg-auto">
<input type="search" class="form-control" placeholder="Search..." aria-label="Search">
</form>
{% if not name %}
<div class="text-end">
<a href="{% url 'App:login' %}"><button type="button" class="btn btn-light text-dark me-2">登录</button></a>
<a href="{% url 'App:register' %}"><button type="button" class="btn btn-primary">注册</button></a>
</div>
{% else %}
<div class="text-end">
<a href="{% url 'App:logout' %}"><button type="button" class="btn btn-light text-dark me-2">退出登录</button></a>
</div>
{% endif %}
{% if not name %}
<div class="text-end">
<a href="{% url 'App:login' %}">
<button type="button" class="btn btn-light text-dark me-2">登录</button>
</a>
<a href="{% url 'App:register' %}">
<button type="button" class="btn btn-primary">注册</button>
</a>
</div>
{% else %}
<div class="text-end">
<a href="{% url 'App:logout' %}">
<button type="button" class="btn btn-light text-dark me-2">退出登录</button>
</a>
</div>
{% endif %}
</div>
</div>
</header>
{% endblock %}
{% block content %}
<div id="myCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#myCarousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#myCarousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#myCarousel" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="{% static 'images/index/index1.jpg' %}" alt="First slide"> %}" alt="">
<div class="container">
<div class="carousel-caption text-start">
<h1>NewRain 个人网盘</h1>
<p>教学资料,随堂视频,各种资料开源下载</p>
<p><a class="btn btn-lg btn-primary" href="https://www.beyourself.org.cn" target="_blank">点击访问</a></p>
</div>
<div id="myCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#myCarousel" data-bs-slide-to="0" class="active" aria-current="true"
aria-label="Slide 1"></button>
<button type="button" data-bs-target="#myCarousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#myCarousel" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
</div>
<div class="carousel-item">
<img src="{% static 'images/index/index2.jpg' %}" alt="First slide"> %}" alt="">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="{% static 'images/index/index1.jpg' %}" alt="First slide"> %}" alt="">
<div class="container">
<div class="carousel-caption">
<h1>NewRain 代码仓库</h1>
<p>教学代码实例,多看多敲,开卷!</p>
<p><a class="btn btn-lg btn-primary" href="https://gitee.com/newrain001" target="_blank">点击跳转</a></p>
</div>
</div>
</div>
<div class="carousel-item">
<img src="{% static 'images/index/index3.jpg' %}" alt="First slide"> %}" alt="">
<div class="container">
<div class="carousel-caption text-start">
<h1>NewRain 个人网盘</h1>
<p>教学资料,随堂视频,各种资料开源下载</p>
<p><a class="btn btn-lg btn-primary" href="https://www.beyourself.org.cn"
target="_blank">点击访问</a></p>
</div>
</div>
</div>
<div class="carousel-item">
<img src="{% static 'images/index/index2.jpg' %}" alt="First slide"> %}" alt="">
<div class="container">
<div class="carousel-caption text-end">
<h1>面试内容整理</h1>
<p>美好生活,来源于自我努力</p>
<p><a class="btn btn-lg btn-primary" href="https://interview.beyourself.org.cn" target="_blank">点击查看</a></p>
</div>
<div class="container">
<div class="carousel-caption">
<h1>NewRain 代码仓库</h1>
<p>教学代码实例,多看多敲,开卷!</p>
<p><a class="btn btn-lg btn-primary" href="https://gitee.com/newrain001"
target="_blank">点击跳转</a></p>
</div>
</div>
</div>
<div class="carousel-item">
<img src="{% static 'images/index/index3.jpg' %}" alt="First slide"> %}" alt="">
<div class="container">
<div class="carousel-caption text-end">
<h1>面试内容整理</h1>
<p>美好生活,来源于自我努力</p>
<p><a class="btn btn-lg btn-primary" href="https://interview.beyourself.org.cn" target="_blank">点击查看</a>
</p>
</div>
</div>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#myCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#myCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#myCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#myCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="container marketing">
<div class="container marketing">
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140" src="{% static 'images/tuchuang.jpg' %}" role="img" aria-label="Placeholder: 140x140" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#777"/></img>
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140"
src="{% static 'images/tuchuang.jpg' %}" role="img" aria-label="Placeholder: 140x140"
preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title>
<rect width="100%" height="100%" fill="#777"/>
</img>
<h2>便捷图床</h2>
<p>将图片上传到云端对象存储,并获取便捷的链接方式,请放心,您的图片会被永久保存,也可以随时下载,您的图片可以再<a href="{% url 'App:image' %}">我的相册</a>中查看</p>
<p><a class="btn btn-secondary" href="{% url 'App:upload' %}">点击跳转</a></p>
</div>
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140" src="{% static 'images/work.jpg' %}" role="img" aria-label="Placeholder: 140x140" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#777"/></img>
<h2>便捷图床</h2>
<p>将图片上传到云端对象存储,并获取便捷的链接方式,请放心,您的图片会被永久保存,也可以随时下载,您的图片可以再<a href="{% url 'App:image' %}">我的相册</a>中查看</p>
<p><a class="btn btn-secondary" href="{% url 'App:upload' %}">点击跳转</a></p>
</div>
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140"
src="{% static 'images/work.jpg' %}" role="img" aria-label="Placeholder: 140x140"
preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title>
<rect width="100%" height="100%" fill="#777"/>
</img>
<h2>事件处理</h2>
<p>请在规定时间内完成规定任务,此功能仅支持内部使用,任务下达会在课堂中提醒,任务完成过程中请截图保留。未完成将得到奖励、</p>
<p><a class="btn btn-secondary" href="{% url 'App:listTask' %}">点击查看</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140" src="{% static 'images/paper.jpg' %}" role="img" aria-label="Placeholder: 140x140" preserveAspectRatio="xMidYMid slice" focusable="false"></img>
<h2>事件处理</h2>
<p>请在规定时间内完成规定任务,此功能仅支持内部使用,任务下达会在课堂中提醒,任务完成过程中请截图保留。未完成将得到奖励、</p>
<p><a class="btn btn-secondary" href="{% url 'App:listTask' %}">点击查看</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140"
src="{% static 'images/paper.jpg' %}" role="img" aria-label="Placeholder: 140x140"
preserveAspectRatio="xMidYMid slice" focusable="false"></img>
<h2>文章发表</h2>
<p>发表文章,如果你有好的文章,又愿意共享,请点击此处,注意:文章格式采用markdown格式编写,markdown格式编写,请自行学习。点击查看<a href="{% url 'App:paperList' %}">博文列表</a></p>
<p><a class="btn btn-secondary" href="{% url 'App:editMD' 'new' %}">立即开始</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<h2>文章发表</h2>
<p>发表文章,如果你有好的文章,又愿意共享,请点击此处,注意:文章格式采用markdown格式编写,markdown格式编写,请自行学习。点击查看<a
href="{% url 'App:paperList' %}">博文列表</a></p>
<p><a class="btn btn-secondary" href="{% url 'App:editMD' 'new' %}">立即开始</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="bd-placeholder-img rounded-circle" width="140" height="140"
src="{% static 'images/paper.jpg' %}" role="img" aria-label="Placeholder: 140x140"
preserveAspectRatio="xMidYMid slice" focusable="false"></img>
<hr class="featurette-divider">
{% for k,v in data.items %}
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading"><a href="{{ k }}" target="_blank" style="text-decoration: none;">{{ v.title }}</a></h2>
<hr>
<p class="lead">{{ v.text }}</p>
</div>
<div class="col-md-5">
<img class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500" height="500" src="{{ v.image }}" role="img" aria-label="Placeholder: 500x500" preserveAspectRatio="xMidYMid slice" focusable="false"></img>
</div>
</div>
<hr>
{% endfor %}
<!-- /END THE FEATURETTES -->
<h2>视频上传</h2>
<p>随堂视频播放<a
href="{% url 'App:videoList' %}">视频库</a></p>
<p><a class="btn btn-secondary" href="{% url 'App:upload' %}?type=videos">立即上传</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<hr>
{% for k,v in data.items %}
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading"><a href="{{ k }}" target="_blank"
style="text-decoration: none;">{{ v.title }}</a></h2>
<hr>
<p class="lead">{{ v.text | truncatechars:100 }}</p>
</div>
<div class="col-md-5">
<img class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500"
height="500" src="{{ v.image }}" role="img" aria-label="Placeholder: 500x500"
preserveAspectRatio="xMidYMid slice" focusable="false"></img>
</div>
</div>
<hr>
{% endfor %}
<!-- /END THE FEATURETTES -->
</div><!-- /.container -->
</div><!-- /.container -->
{% endblock %}

@ -7,7 +7,8 @@
{% block content %}
<div style="padding-top: 80px">
<div class="row">
<nav id="sidebarMenu" style="padding-top: 70px" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<nav id="sidebarMenu" style="padding-top: 70px"
class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3">
<ul class="nav flex-column">
<li class="nav-item">
@ -29,9 +30,9 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{% url 'App:dashboard' 'video' %}?time=week">
<span data-feather="users"></span>
Customers
视频数据
</a>
</li>
<li class="nav-item">
@ -175,6 +176,41 @@
</tbody>
</table>
</div>
{% elif type == 'video' %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">视频数据</h1>
</div>
<canvas class="my-4 w-100" id="myChart" width="900" height="380"></canvas>
<h2>[仅显示最近100条]</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">上传时间</th>
<th scope="col">上传用户</th>
<th scope="col">视频标题</th>
<th scope="col">视频类型</th>
<th scope="col">视频大小</th>
<th scope="col">视频路径</th>
<th scope="col">浏览</th>
</tr>
</thead>
<tbody>
{% for i in table %}
<tr>
<td>{{ i.video_time }}</td>
<td>{{ i.username }}</td>
<td>{{ i.video_title }}</td>
<td>{{ i.video_desc }}</td>
<td>{{ i.video_size |filesizeformat }}</td>
<td>{{ i.video_path }}</td>
<td>{{ i.views }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</main>
</div>

@ -10,9 +10,7 @@
<link href="{% static 'css/upload/fileinput.css' %}" media="all" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="{% static 'css/upload/all.css' %}" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="container my-4">
<div class="container my-4" style="padding-top: 80px">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></script>
<script src="{% static 'js/fileinput.js' %}" type="text/javascript"></script>
@ -35,8 +33,8 @@
$('#file-fr').fileinput({
theme: 'fas',
language: 'zh',
uploadUrl: '{% url 'App:upload' %}',
allowedFileExtensions: ['jpg', 'png', 'gif'],
uploadUrl: '{% url 'App:upload' %}?type={{ type }}',
allowedFileExtensions: ['jpg', 'png', 'gif','mp4'],
uploadExtraData: function () {
return {
'csrfmiddlewaretoken': $('input[name=csrfmiddlewaretoken]').val()
@ -64,7 +62,7 @@
$("#test-upload").fileinput({
'theme': 'fas',
'showPreview': false,
'allowedFileExtensions': ['jpg', 'png', 'gif'],
'allowedFileExtensions': ['jpg', 'png', 'gif','mp4'],
'elErrorContainer': '#errorBlock'
});
@ -79,5 +77,4 @@
{% endblock %}
{% block foot %}
{% endblock %}
</html>
{% endblock %}

@ -73,6 +73,15 @@
<symbol id="grid" viewBox="0 0 16 16">
<path d="M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5v-3zM2.5 2a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3zm6.5.5A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5v-3zm1.5-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3zM1 10.5A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5v-3zm1.5-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3zm6.5.5A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5v-3zm1.5-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3z"/>
</symbol>
<symbol id="video" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
class="bi bi-collection-play-fill" viewBox="0 0 16 16">
<path d="M2.5 3.5a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-11zm2-2a.5.5 0 0 1 0-1h7a.5.5 0 0 1 0 1h-7zM0 13a1.5 1.5 0 0 0 1.5 1.5h13A1.5 1.5 0 0 0 16 13V6a1.5 1.5 0 0 0-1.5-1.5h-13A1.5 1.5 0 0 0 0 6v7zm6.258-6.437a.5.5 0 0 1 .507.013l4 2.5a.5.5 0 0 1 0 .848l-4 2.5A.5.5 0 0 1 6 12V7a.5.5 0 0 1 .258-.437z"/>
</symbol>
<symbol id="task" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
class="bi bi-card-checklist" viewBox="0 0 16 16">
<path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z"/>
<path d="M7 5.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm-1.496-.854a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0zM7 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm-1.496-.854a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0z"/>
</symbol>
</svg>
<main>
@ -106,8 +115,9 @@
</li>
<li>
<a href="{% url 'App:listTask' %}" class="nav-link text-white">
<img class="bi d-block mx-auto mb-1" width="24" height="24"
src="{% static 'images/archive.png' %}">
<svg class="bi d-block mx-auto mb-1" width="24" height="24">
<use xlink:href="#task"/>
</svg>
任务列表
</a>
</li>
@ -119,6 +129,14 @@
相册
</a>
</li>
<li>
<a href="{% url 'App:videoList' %}" class="nav-link text-white">
<svg class="bi d-block mx-auto mb-1" width="24" height="24">
<use xlink:href="#video"/>
</svg>
视频站
</a>
</li>
<li>
<a href="{% url 'App:paperList' %}" class="nav-link text-white">
<svg class="bi d-block mx-auto mb-1" width="24" height="24">

Loading…
Cancel
Save