<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Springboot+Vue實(shí)現(xiàn)網(wǎng)頁內(nèi)容生成圖片功能

          共 6421字,需瀏覽 13分鐘

           ·

          2020-09-10 02:27

          點(diǎn)擊上方?web項(xiàng)目開發(fā)選擇?設(shè)為星標(biāo)

          優(yōu)質(zhì)文章,及時送達(dá)

          --

          案例功能效果圖

          文章詳情頁面

          把文章詳情生成圖片頁面


          環(huán)境介紹

          前端:vue

          后端:springboot
          jdk:1.8及以上

          數(shù)據(jù)庫:mysql


          完整源碼獲取方式



          源碼獲取方式


          碼關(guān)注回復(fù)【分享圖片】獲取完整源碼


          如果你在運(yùn)行這個代碼的過程中有遇到問題,請加小編微信xxf960513,我拉你進(jìn)對應(yīng)微信學(xué)習(xí)群!!幫助你快速掌握這個功能代碼!



          核心代碼介紹


          AtricleCtrle.java

                @RestController@RequestMapping("/article")@CrossOriginpublic class ArticleCtrler {  @Autowired  private ArticleService articleService;  @ApiOperation(value="添加文章")  @PostMapping("/addarticle")  public Object addarticle(@Valid Article vo)  {    try     {      articleService.insert(vo);       return Result.success(null);    }    catch (Exception e)     {      e.printStackTrace();    }     return Result.error(CodeMsg.SERVER_ERROR);  }  @PostMapping("/loadPage")  @ApiOperation(value="文章分頁列表")  public Object loadPage(@Valid Article_Condit vo)  {    try     {      PageInfo
          loadPage = articleService.loadPage(vo); return Result.success(loadPage); } catch (Exception e) { e.printStackTrace(); } return Result.error(CodeMsg.SERVER_ERROR); }}

          ArticleService.interface

          ??@Service@Transactionalpublic class ArticleServiceImpl implements ArticleService {  @Autowired  private ArticleDao articleDao;  @Override  public void insert(Article vo) {    vo.setCreatedatetime(new Timestamp(new Date().getTime()));    vo.setCreateuserid("system");    articleDao.save(vo);  }  @Override  public PageInfo
          loadPage(Article_Condit vo) { PageHelper.startPage(vo.getPageIndex()==null?0:vo.getPageIndex(), vo.getPageSize()==null?0:vo.getPageSize()); List
          findByCondit = articleDao.findByCondit(vo); return new PageInfo
          (findByCondit); }}

          ArticleDao.java

          @Repositorypublic interface ArticleDao {  void save(Article vo);  List
          findByCondit(Article_Condit vo);}

          main.js

          import?Vue?from?'vue'import App from './App'import router from './router'import axios from 'axios'import ElementUI from 'element-ui';import 'element-ui/lib/theme-chalk/index.css';
          Vue.use(ElementUI);import $ from 'jquery'
          axios.defaults.baseURL = 'http://127.0.0.1:8080';Vue.prototype.HOST='/email'
          Vue.config.productionTip = falseVue.prototype.$axios = axios
          /* eslint-disable no-new */new Vue({ el: '#app', router, components: { App }, template: ''})

          index.vue

          <template>  <div class="wrap">    <div class="top">      <h1>文章列表h1>      <el-button type="primary" @click="goToEdit">添加文章el-button>    div>
          <div class="card-wrap"> <div v-for="(item, index) in art" :key="index" class="box-card" @click="goToDetail(item)"> <el-card> <div class="title">{{ item.title }}div> <div class="des">{{ item.description }}div> <div class="time">{{ item.createdatetime }}div> el-card> div> div> div>template>
          <script>import axios from 'axios'export default { components: {}, props: {}, data() { return { art: [] } }, computed: {}, watch: {}, created() {}, mounted() { axios .post('http://139.159.147.237:8080/yxyz/article/loadPage') .then((res) => { console.log(res.data, 'res') if (res.data && res.data.data && res.data.data.list) { console.log(res.data.data.list, this, 'res') const list = res.data.data.list this.art = list } }) .catch(function(error) { console.log(error) }) }, methods: { goToEdit() { this.$router.push('/about') }, goToDetail(item) { console.log(123) this.$router.push({ name: 'detail', params: { item: item } }) } }}script>
          <style scoped lang="scss">.wrap { margin-top: 50px;}.top { display: flex; justify-content: center; align-items: center; position: relative; button { position: absolute; right: 0; }}.card-wrap { display: flex; flex-wrap: wrap;}.box-card { margin-bottom: 20px; margin-right: 20px; width: 30%; .title { font-weight: bold; font-size: 16px; text-align: left; margin-bottom: 10px; } .des { font-size: 14px; text-align: left; margin-bottom: 10px; } .time { font-size: 14px; text-align: left; }}style>

          detail.vue

          <template>  <div class="">    <h2>文章詳情h2>    <el-card>      <div class="title">{{ detail.title }}div>      <div class="des">{{ detail.description }}div>      <div class="con" v-html="detail.content" />      <div class="time">{{ detail.createdatetime }}div>    el-card>  div>template>
          <script>export default { components: {}, props: {}, data() { return { detail: {} } }, computed: {}, watch: {}, created() { console.log(this.$route) const item = this.$route.params.item
          this.detail = item }, mounted() {}, methods: {}}script>
          <style scoped lang="scss">.title { font-weight: bold; font-size: 16px; text-align: left; margin-bottom: 10px;}.des { font-size: 14px; text-align: left; margin-bottom: 10px;}.con { font-size: 14px; text-align: left; margin-bottom: 10px;}.time { font-size: 14px; text-align: left;}style>

          application.yml

          spring:  profiles:    active: dev

          application-dev.yml

          server:  port: 8080  servlet:    context-path: /yxyzspring:  datasource:    name: yxyz    url: jdbc:mysql://localhost/test?serverTimezone=GMT%2b8&characterEncoding=UTF8    username: root    password: 123 # 使用druid數(shù)據(jù)源    type: com.alibaba.druid.pool.DruidDataSource    driver-class-name: com.mysql.cj.jdbc.Driver    filters: stat    maxActive: 20    initialSize: 1    maxWait: 60000    minIdle: 1    timeBetweenEvictionRunsMillis: 60000    minEvictableIdleTimeMillis: 300000    validationQuery: select 'x'    testWhileIdle: true    testOnBorrow: false    testOnReturn: false    poolPreparedStatements: true    maxOpenPreparedStatements: 20## 該配置節(jié)點(diǎn)為獨(dú)立的節(jié)點(diǎn)mybatis:  mapper-locations: classpath:mapping/*Mapper.xml #注意:一定要對應(yīng)mapper映射xml文件的所在路徑  type-aliases-package: com.yxyz.vo # 注意:對應(yīng)實(shí)體類的路徑#打印sql最終填充的參數(shù)值  log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

          t_article.sql

          SET?FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for t_article-- ----------------------------DROP TABLE IF EXISTS `t_article`;CREATE TABLE `t_article` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `title` varchar(255) NOT NULL,  `description` varchar(512) NOT NULL,  `content` text NOT NULL,  `articletype` varchar(16) DEFAULT NULL,  `createdatetime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,  `createuserid` varchar(32) DEFAULT NULL,  PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8;


          --完--

          推薦案例


          溫暖提示

          為了方便大家更好的學(xué)習(xí),本公眾號經(jīng)常分享一些完整的單個功能案例代碼給大家去練習(xí),如果本公眾號沒有你要學(xué)習(xí)的功能案例,你可以聯(lián)系小編(微信:xxf960513)提供你的小需求給我,我安排我們這邊的開發(fā)團(tuán)隊(duì)免費(fèi)幫你完成你的案例。
          注意:只能提單個功能的需求不能要求功能太多,比如要求用什么技術(shù),有幾個頁面,頁面要求怎么樣?


          請長按識別二維碼

          想學(xué)習(xí)更多的java功能案例請關(guān)注

          Java項(xiàng)目開發(fā)

          如果你覺得這個案例以及我們的分享思路不錯,對你有幫助,請分享給身邊更多需要學(xué)習(xí)的朋友。別忘了《留言+點(diǎn)在看》給作者一個鼓勵哦!

          瀏覽 94
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产精品久久久久毛片SUV | 日本a在线 | 国产看逼逼| 大鸡巴在线播放 | 九九在线视频 |