赞
踩
import Vue from ‘vue’
import App from ‘./App’
import router from ‘./router’
import ElementUI from ‘element-ui’
import ‘element-ui/lib/theme-chalk/index.css’
import ‘default-passive-events’
import ‘./http’;
Vue.config.productionTip = false
Vue.use(ElementUI)
/* eslint-disable no-new */
new Vue({
el: ‘#app’,
router,
components: { App },
template: ‘’
})
访问:http://localhost:8080/#/Write
在BlogController当中创建对应的上传图片的接口
@PostMapping(“image”)
public ResponseEntity uploadImage(@RequestParam(“file”) MultipartFile file,HttpServletRequest request) throws IOException {
String name = file.getOriginalFilename();
IdWorker idWorker = new IdWorker(new Random().nextInt(10), 1);
long l = idWorker.nextId();
name = l+name;
String property = System.getProperty(“user.dir”);
file.transferTo(new File(System.getProperty(“user.dir”)+“\src\main\webapp\img\”+name));
return ResponseEntity.ok(name);
}
<el-upload
class=“avatar-uploader”
action=“http://localhost:9090/blog/image”
:show-file-list=“false”
:on-success=“handleAvatarSuccess”
:before-upload=“beforeAvatarUpload”>
上传图片成功
上传文章缩略图:
<el-upload
class=“avatar-uploader”
action=“http://localhost:9090/blog/image”
:show-file-list=“false”
:on-success=“handleAvatarSuccess”
:before-upload=“beforeAvatarUpload”>
是否原创:
<el-switch
v-model=“checked”
active-color=“#13ce66”
inactive-color=“#ff4949”>
<el-input style=“margin-top: 50px; margin-bottom: 50px;width: 80%”
type=“textarea”
:rows=“10”
placeholder=“文章摘要”
v-model=“abstract_text”>
文章内容:
<quill-editor
ref=“myQuillEditor”
v-model=“content”
:options=“editorOption”
style=“height: 500px”
/>
<el-button type=“primary” @click=“submit” style=“margin-top:150px”>提交
https://code100.blog.csdn.net/article/details/123302546
getInfo() {
this.$http.get(‘blog/queryBlogByPage?title=’ + this.title + ‘&page=’ + this.page + ‘&rows=’ + this.rows)
.then(response => (
this.info = response.data,
this.total = this.info.total,
this.totalPage = this.info.totalPage,
this.items = this.info.items
)).catch(function (error) { // 请求失败处理
console.log(error);
});
},
getInfo() {
this.$http.get(‘/blog/queryBlogArticleById?id=’ + this.id )
.then(response => (
this.info = response.data,
this.title = this.info.title
)).catch(function (error) { // 请求失败处理
console.log(error);
});
},
selectBlog() {
this.page = 1;
this.rows = 10;
let startTime = (new Date(((this.value1+“”).split(“,”)[0]))).getTime();
let endTime = (new Date(((this.value1+“”).split(“,”)[1]))).getTime();
this.startBlogTime = startTime;
this.endBlogTime = endTime;
this.getInfo();
},
like(){
this.$http.get(‘blog/blogLikeId?id=’ + this.id );
this.getInfo();
},
package cn.itbluebox.springbootcsdn.service.Impl;
import cn.itbluebox.springbootcsdn.domain.Consumer;
import cn.itbluebox.springbootcsdn.enums.ExceptionEnum;
import cn.itbluebox.springbootcsdn.exception.BlException;
import cn.itbluebox.springbootcsdn.mapper.ConsumerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional(propagation = Propagation.REQUIRED)
public class ConsumerService {
@Autowired
private ConsumerMapper consumerMapper;
public Boolean checkData(String data, Integer type) {
Consumer consumer = new Consumer();
//判断数据类型
switch (type) {
case 1:
consumer.setEmail(data);
break;
case 2:
consumer.setPhone(Long.parseLong(data));
break;
default:
return null;
}
return consumerMapper.selectCount(consumer) == 0;
}
public Consumer queryUser(String email, String password) {
// 查询
Consumer consumer = new Consumer();
consumer.setEmail(email);
consumer.setPassword(password);
Consumer consumer1 = this.consumerMapper.selectOne(consumer);
// 校验用户名
if (consumer1 == null) {
return null;
}
// 用户名密码都正确
return consumer1;
}
public String saveConsumer(Consumer consumer) {
int insert = consumerMapper.insert(consumer);
if (insert != 1) {
throw new BlException(ExceptionEnum.CONSUMER_SAVE_ERROR);
}
return insert + “”;
}
public Consumer queryConsumerById(Long id) {
Consumer consumer = new Consumer();
consumer.setId(id);
Consumer consumer1 = consumerMapper.selectOne(consumer);
consumer1.setPassword(“”);
return consumer1;
}
}
package cn.itbluebox.springbootcsdn.properties;
import cn.itbluebox.springbootcsdn.utils.RsaUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import javax.annotation.PostConstruct;
import java.io.File;
import java.security.PrivateKey;
import java.security.PublicKey;
@ConfigurationProperties(prefix = “sc.jwt”)
@Data
@Slf4j
public class JwtProperties {
private String secret; // 密钥
private String pubKeyPath;// 公钥
private String priKeyPath;// 私钥
private int expire;// token过期时间
private PublicKey publicKey; // 公钥
private PrivateKey privateKey; // 私钥
private String cookieName;
private Integer cookieMaxAge;
// private static final Logger logger = LoggerFactory.getLogger(JwtProperties.class);
/**
*/
@PostConstruct
public void init(){
try {
File pubKey = new File(pubKeyPath);
File priKey = new File(priKeyPath);
if (!pubKey.exists() || !priKey.exists()) {
// 生成公钥和私钥
RsaUtils.generateKey(pubKeyPath, priKeyPath, secret);
}
// 获取公钥和私钥
this.publicKey = RsaUtils.getPublicKey(pubKeyPath);
this.privateKey = RsaUtils.getPrivateKey(priKeyPath);
} catch (Exception e) {
log.error(“初始化公钥和私钥失败!”, e);
throw new RuntimeException();
}
}
}
package cn.itbluebox.springbootcsdn.web;
import cn.itbluebox.springbootcsdn.enums.ExceptionEnum;
import cn.itbluebox.springbootcsdn.exception.BlException;
import cn.itbluebox.springbootcsdn.properties.JwtProperties;
import cn.itbluebox.springbootcsdn.service.Impl.AuthService;
import cn.itbluebox.springbootcsdn.utils.CookieUtils;
import cn.itbluebox.springbootcsdn.utils.JwtUtils;
import cn.itbluebox.springbootcsdn.utils.UserInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
@EnableConfigurationProperties(JwtProperties.class)
@Slf4j
public class AuthController {
@Autowired
private AuthService authService;
@Autowired
private JwtProperties prop;
/**
登录授权
@return
*/
@GetMapping(“accredit”)
public ResponseEntity authentication(
@RequestParam(“email”) String email,
@RequestParam(“password”) String password,
HttpServletRequest request,
HttpServletResponse response) {
// 登录校验
System.out.println(" 登录校验 登录校验 登录校验 登录校验");
String token = authService.authentication(email, password);
if (StringUtils.isBlank(token)) {
log.info(“用户授权失败”);
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
}
Cookie cookie = CookieUtils.setGetCookie(request, response, prop.getCookieName(), token, prop.getCookieMaxAge(), true);
return ResponseEntity.ok(cookie);
}
@GetMapping(“verify”)
public ResponseEntity verify(
@CookieValue(“SC_TOKEN”) String token,
HttpServletRequest request,
HttpServletResponse response
) {
//解析token
System.out.println(“解析token解析token解析token解析token解析token”);
try {
UserInfo userInfo = JwtUtils.getUserInfo(prop.getPublicKey(), token);
//刷新token,重新生成token
String newToken = JwtUtils.generateToken(userInfo, prop.getPrivateKey(), prop.getExpire());
//写回cookie
CookieUtils.setCookie(request, response, prop.getCookieName(), newToken, prop.getCookieMaxAge(), true);
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以扫码获取(备注前端)
在面试前我花了三个月时间刷了很多大厂面试题,最近做了一个整理并分类,主要内容包括html,css,JavaScript,ES6,计算机网络,浏览器,工程化,模块化,Node.js,框架,数据结构,性能优化,项目等等。
包含了腾讯、字节跳动、小米、阿里、滴滴、美团、58、拼多多、360、新浪、搜狐等一线互联网公司面试被问到的题目,涵盖了初中级前端技术点。
HTML5新特性,语义化
浏览器的标准模式和怪异模式
xhtml和html的区别
使用data-的好处
meta标签
canvas
HTML废弃的标签
IE6 bug,和一些定位写法
css js放置位置和原因
什么是渐进式渲染
html模板语言
meta viewport原理
一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!
AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算
dtJbZx-1712188287327)]
[外链图片转存中…(img-0IQSVVZz-1712188287327)]
[外链图片转存中…(img-iYWezWS0-1712188287328)]
[外链图片转存中…(img-2u5MEDWp-1712188287328)]
[外链图片转存中…(img-nWM5aFP9-1712188287328)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以扫码获取(备注前端)
[外链图片转存中…(img-MeltuGix-1712188287329)]
在面试前我花了三个月时间刷了很多大厂面试题,最近做了一个整理并分类,主要内容包括html,css,JavaScript,ES6,计算机网络,浏览器,工程化,模块化,Node.js,框架,数据结构,性能优化,项目等等。
包含了腾讯、字节跳动、小米、阿里、滴滴、美团、58、拼多多、360、新浪、搜狐等一线互联网公司面试被问到的题目,涵盖了初中级前端技术点。
HTML5新特性,语义化
浏览器的标准模式和怪异模式
xhtml和html的区别
使用data-的好处
meta标签
canvas
HTML废弃的标签
IE6 bug,和一些定位写法
css js放置位置和原因
什么是渐进式渲染
html模板语言
meta viewport原理
一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!
AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。