上传静态图片前后端:
后端:
class UploadFieldsView(APIView):
def post(self,request):
# # 获取前端传递的图片
files = request.FILES.get('file')
# 写到文件中,并保存下来:
files_dir = settings.STATICFILES_DIRS[0]
# 进行拼接图片路由:
files_name = files_dir + files.name
# 打开文件:
with open(files_name,'wb') as f:
f.write(files.file.read())
# 返回数据:
return Response({'msg': '上传成功', 'code': 200, 'file_path': files_name, 'file_name': files.name})
前端:
<el-upload
action="http://127.0.0.1:8000/upload/files/"
:auto-upload="true" #自动上传
:on-success='uploadSucceed'
> #进行回调
<el-button size="small" type="primary">点击选择图片</el-button>
</el-upload >
#上传七牛云:
后端:
要生成token:
from qiniu import Auth, put_file, etag
access_key = 'ZdK2*************************OOV'
secret_key = '5mJjAR**************************21OXeW'
生成token:
class QiNiuFiles(APIView):
def get(self,request):
# 生成token
# 构建鉴权对象
q = Auth(access_key, secret_key)
#要上传的空间
bucket_name = 'h2112a1'
#生成上传 Token,可以指定过期时间等
token = q.upload_token(bucket_name)
return Response({'mas':'ok','code':200,'qn_token':token})
前端:
baseUrl:"http://rg10m1lgc.bkt.clouddn.com/", 七牛云路径:
回调时使用
<el-upload
action="https://upload-cn-east-2.qiniup.com" 上传路径
:on-success="uploadSuccess" 回调
:data="upload_data" 接收token
:on-error="uploadError" 打印错误
>
<el-button @click="files" style="width:70px;height:70px;background-color:orange;" type="primary">+<br>视频/图片</el-button>
</el-upload>
uploadSuccess(resp){
this.imgUrl = this.baseUrl + resp.key
console.log("imgurl>>>", this.imgUrl)
},
#打印错误
uploadError(err){
console.log(err)
},
git的操作:
上传数据:
第一步:新建一个文件夹 进入该文件夹 右键 选择 Git Bash Here 进入git命令界面 前提是安装了git
第二步:初始化该文件夹 让该文件夹成为git本地仓库
$ git init
第三步:码云上创建一个项目(略)并和本地新建的文件夹绑定
$ git remote add origin https://gitee.com/august-fine/asinsort.git
第四步:拉取远程仓库代码(防止冲突)
$ git pull --rebase origin master
第五步:将代码复制到该文件夹下后 git添加文件下所有文件 注意空格+点
$ git add .
第六步:提交到本地仓库 -m 操作注解(必须写)
$ git commit -m ‘初始化项目’
第七步:推送到远程仓库
$ git push -u origin master
推送子分支
git add *
git commit -m p6_2
git push
git push --set-upstream origin users(子分支)
1.查看分支:git branch -v
2.创建分支:git branch <分支名>
3.切换分支:git switch <分支名>
4.合并分支: 1切换到主分支git checkout master,合并分支dev 到主分支git merge dev
5.删除分支:git branch -d <分支名>
合并分支:git merge 子分支名
display: flex; 跟浮动一样
justify-content:start;
start:左对齐
end:右对齐
center:居中对齐
space-between:两端对齐
border-radius
color : #999999 文字颜色
font-family : 宋体 文字字型
font-size : 10pt 文字大小
font-style:itelic 文字斜体育
font-variant:small-caps 小字体
letter-spacing : 1pt 文字间距
line-height : 200% 设定行高
font-weight:bold 文字粗体
vertical-align:sub 下标字
vertical-align:super 上标字
text-decoration:line-through 加?h除线
text-decoration:overline 加顶线
text-decoration:underline 加底线
text-decoration:none ?h除连接底线
text-transform : capitalize 首字大写
text-transform : uppercase 英文大写
text-transform : lowercase 英文写
text-align:right 文字*右对齐
text-align:left 文字*左对齐
text-align:center 文字置中对齐
这些是一些简单的文字效果,可以应用到css的页面中。
---背景
background-color:black 背景颜色
background-image : url(image/bg.gif) 背景图片
background-attachment : fixed 固定背景
background-repeat : repeat 重复排列-网页预设
background-repeat : no-repeat 不重复排列
background-repeat : repeat-x 在x轴重复排列
background-repeat : repeat-y 在y轴重复排列
background-position : 90% 90% 背景图片x与y轴的位置
---链接
A 所有超连接
A:link 超连接文字格式
A:visited 浏览过的连接文字格式
A:active 按下连接的格式
A:hover 鼠标移至连接
---边框
border-top : 1px solid black 上框
border-bottom : 1px solid #6699cc 下框
border-left : 1px solid #6699cc 左框
border-right : 1px solid #6699cc 右框
border: 1px solid #6699cc 四边框
---虚线
<TEXTAREA STYLE="border:1px dashed pink">
---实线
<TEXTAREA STYLE="border:1px solid pink">