当前位置: 首页 > news >正文

哪个网站是做红酒酒的兰州网站seo

哪个网站是做红酒酒的,兰州网站seo,百度文库怎么做网站排名,可视化网站制作软件本篇将使用echarts框架进行柱状图和折线图绘制。 目录 1.绘制效果 2.安装echarts 3.前端代码 4.后端代码 1.绘制效果 2.安装echarts // 安装echarts版本4 npm i -D echarts4 3.前端代码 src/api/api.js //业务服务调用接口封装import service from ../service.js //npm …

本篇将使用echarts框架进行柱状图和折线图绘制。

目录

1.绘制效果

2.安装echarts

 3.前端代码

4.后端代码


1.绘制效果

 

2.安装echarts

// 安装echarts版本4
npm i -D echarts@4

 3.前端代码

src/api/api.js

//业务服务调用接口封装import service from '../service.js'
//npm i qs -D
import qs from 'qs'//登录接口
export function login(data) {return service({method: 'post',url: '/login',data})
}//学生信息查询接口
export function students(params) {return service({method: 'get',url: '/api/students',params})
}//删除学生信息
export function delstudentsbyid(id) {return service({method: 'get',//此处应用模板字符串传参url: `/api/students/del?id=${id}`})
}export function delstudentsbyreqid(id) {return service({method: 'get',//此处应用模板字符串传参url: `/api/students/del/${id}`})
}export function addStudent(data) {//data = qs.stringify(data)return service({method: 'post',url: '/api/info',data})
}export function updateStudent(data) {return service({method: 'post',url: '/api/updateinfo',data})
}export function getInfo() {return service({method: 'get',url: '/api/getinfo'})
}export function delinfo(id) {return service({method: 'get',//此处应用模板字符串传参url: `/api/info/del/id=${id}`})
}export function dataview(id) {return service({method: 'get',url: '/api/data/dataview'})
}

src/components/common/dataanalyse/DataView.vue

<template><div class="data-view"><el-card><div id="main1"></div></el-card><el-card><div id="main2"></div></el-card></div>
</template><script>
import { dataview } from '@/api/api.js'export default {data() {return {name: ""}},created() {//http获取服务端数据,huizhe 折线图dataview().then(res => {console.log(res)if (200 === res.data.status) {let {legend, xAxis, series} = res.data.datathis.draw(legend, xAxis, series)}})},mounted() {//初始化实例let myChart = this.$echarts.init(document.getElementById('main1'))myChart.setOption({title: {text: '大佬学vue分数'},tooltip: {},xAxis: {data: ['张三', '李四', '王五', '赵六']},yAxis: {},series: [{name: '人数',// bar: 柱状图  line: 折线图type: 'bar',data: [90, 100, 85, 70]}]})},methods: {draw(legend, xAxis, series) {let myChart1 = this.$echarts.init(document.getElementById('main2'))let option = {title: {text: "会话量"},tooltip: {trigger: 'axis'},legend: {data: legend},xAxis: {type: 'category',data: xAxis},yAxis: {type: 'value'},series: series}myChart1.setOption(option)}}
}
</script><style lang='scss'>
.data-view {width: 100%;display: flex;justify-content: space-between;.el-card {width: 50%;#main1, #main2 {height: 500px;}}
}
</style>

4.后端代码

server.go

package mainimport ("main/controller""net/http""github.com/gin-contrib/cors""github.com/gin-gonic/gin"
)/*
// 错误: server.go:4:2: package main/controller is not in GOROOT (/home/tiger/go/go/src/main/controller)
go mod init main//错误: server.go:7:2: no required module provides package github.com/gin-gonic/gin; to add it:
go get github.com/gin-gonic/gin//处理跨域框架
go get github.com/gin-contrib/cors
*//*
当客户端(尤其是基于 Web 的客户端)想要访问 API 时,服务器会决定允许哪些客户端发送请求。这是通过使用称为 CORS 来完成的,它代表跨源资源共享。
跨域资源共享 (CORS) 是一种机制,允许从提供第一个资源的域之外的另一个域请求网页上的受限资源。
*/func CrosHandler() gin.HandlerFunc {return func(context *gin.Context) {context.Writer.Header().Set("Access-Control-Allow-Origin", "*")context.Header("Access-Control-Allow-Origin", "*") // 设置允许访问所有域context.Header("Access-Control-Allow-Methods", "POST,GET,OPTIONS,PUT,DELETE,UPDATE")context.Header("Access-Control-Allow-Headers", "Authorization, Content-Length, X-CSRF-Token, Token,session,X_Requested_With,Accept, Origin, Host, Connection, Accept-Encoding, Accept-Language,DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Pragma,token,openid,opentoken")context.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar")context.Header("Access-Control-Max-Age", "172800")context.Header("Access-Control-Allow-Credentials", "true")context.Set("content-type", "application/json") //设置返回格式是json//处理请求context.Next()}
}// http://127.0.0.1:8181/ping
// http://127.0.0.1:8181/index
func main() {r := gin.Default()// 设置全局跨域访问//r.Use(CrosHandler())//cors处理跨域corsConfig := cors.DefaultConfig()corsConfig.AllowCredentials = truecorsConfig.AllowHeaders = []string{"content-type", "Origin", "token", "username"}corsConfig.AllowOrigins = []string{"http://localhost:8080", "http://localhost:8081"}corsConfig.AllowMethods = []string{"POST", "GET", "OPTIONS", "PUT", "DELETE", "UPDATE"}r.Use(cors.New(corsConfig))//r.Use(cors.Default())// 返回一个json数据r.GET("/ping", func(c *gin.Context) {c.JSON(200, gin.H{"message": "pong","num":     888,})})// 返回一个html页面r.LoadHTMLGlob("templates/*")r.GET("/index", func(c *gin.Context) {c.HTML(http.StatusOK, "index.html", nil)})r.POST("/login", controller.LoginPost)r.POST("/formlogin", controller.FormLoginPost)r.POST("/upload", controller.UploadFile)r.GET("/api/students", controller.GetStudentList)r.GET("/api/students/del", controller.DelStudent)r.GET("/api/students/del/:id", controller.DelStudentByReq)r.POST("/api/info", controller.AddStudent)r.GET("/api/getinfo", controller.GetInfo)r.POST("api/updateinfo", controller.UpdateStudent)r.GET("/api/info/del/:id", controller.DelIfo)r.GET("api/works", controller.Works)r.GET("/api/data/dataview", controller.DataView)//r.Run()  // <===> r.Run(":8080")  监听并在 0.0.0.0:8080 上启动服务r.Run(":8181")
}

controller/dataview.go

package controllerimport ("net/http""github.com/gin-gonic/gin"
)/*
//嵌套json举例
type Person struct {Name    string `json:"name"`Age     int    `json:"age"`Address struct {Street string `json:"street"`City   string `json:"city"`} `json:"address"`
}person := Person{"张三", 20, struct {Street string `json:"street"`City   string `json:"city"`} {"北京路", "广州市",}
}
c.JSON(200, person)
*//*
// 给前端发送如下数据
{"legend": ["技术总监", "产品经理", "后端开发", "前端开发", "运维/测试"],"xAxis": ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],"series": [{"name": "技术总监","type": "line","stack": "总量","data": [80, 83, 84, 40, 44, 11, 12]},{"name": "产品经理","type": "line","stack": "总量","data": [66, 34, 39, 42, 45, 20, 30]},{"name": "后端开发","type": "line","stack": "总量","data": [66, 65, 59, 44, 33, 10, 20]},{"name": "前端开发","type": "line","stack": "总量","data": [33, 33, 44, 55, 55, 11, 23]},{"name": "运维/测试","type": "line","stack": "总量","data": [67, 45, 32, 40, 27, 11, 59]},]
}
*/type Response struct {Status int         `json:"status"`Msg    string      `json:"msg"`Data   interface{} `json:"data"`
}type TSeries struct {Name  string `json:"name"`Type  string `json:"type"`Stack string `json:"stack"`Data  []int  `json:"data"`
}type DataItem struct {Legend []string  `json:"legend"`XAxis  []string  `json:"xAxis"`Series []TSeries `json:"series"`
}var dataItem = DataItem{Legend: []string{"技术总监", "产品经理", "后端开发", "前端开发", "运维/测试"},XAxis:  []string{"星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"},Series: []TSeries{{Name:  "技术总监",Type:  "line",Stack: "总量",Data:  []int{80, 83, 84, 40, 44, 11, 12},},{Name:  "产品经理",Type:  "line",Stack: "总量",Data:  []int{66, 34, 39, 42, 45, 20, 30},},{Name:  "后端开发",Type:  "line",Stack: "总量",Data:  []int{66, 65, 59, 44, 33, 10, 20},},{Name:  "前端开发",Type:  "line",Stack: "总量",Data:  []int{33, 33, 44, 55, 55, 11, 23},},{Name:  "运维/测试",Type:  "line",Stack: "总量",Data:  []int{67, 45, 32, 40, 27, 11, 59},},},
}var response = Response{200,"获取数据成功",dataItem,
}// GET请求 http://127.0.0.1:8181/api/data/dataview
func DataView(ctx *gin.Context) {ctx.JSON(http.StatusOK, response)
}


文章转载自:
http://syncromesh.jnpq.cn
http://spencite.jnpq.cn
http://rattailed.jnpq.cn
http://celbenin.jnpq.cn
http://inactively.jnpq.cn
http://decameter.jnpq.cn
http://metazoic.jnpq.cn
http://atmolyzer.jnpq.cn
http://hulda.jnpq.cn
http://transracial.jnpq.cn
http://glycogen.jnpq.cn
http://jag.jnpq.cn
http://misguide.jnpq.cn
http://arbitrament.jnpq.cn
http://keelson.jnpq.cn
http://zonal.jnpq.cn
http://oven.jnpq.cn
http://circuitousness.jnpq.cn
http://lyophilize.jnpq.cn
http://feaze.jnpq.cn
http://aterian.jnpq.cn
http://souwester.jnpq.cn
http://polyribosome.jnpq.cn
http://veterinarian.jnpq.cn
http://overcoat.jnpq.cn
http://uncial.jnpq.cn
http://exchangite.jnpq.cn
http://semmit.jnpq.cn
http://obduct.jnpq.cn
http://proprieties.jnpq.cn
http://chafferer.jnpq.cn
http://ringtaw.jnpq.cn
http://referrence.jnpq.cn
http://virtual.jnpq.cn
http://season.jnpq.cn
http://dynamo.jnpq.cn
http://novelette.jnpq.cn
http://washroom.jnpq.cn
http://inhibiting.jnpq.cn
http://poach.jnpq.cn
http://nonreward.jnpq.cn
http://complication.jnpq.cn
http://telemedicine.jnpq.cn
http://boule.jnpq.cn
http://syzygial.jnpq.cn
http://acupuncture.jnpq.cn
http://superweak.jnpq.cn
http://metonic.jnpq.cn
http://landowning.jnpq.cn
http://salve.jnpq.cn
http://apercu.jnpq.cn
http://coromandel.jnpq.cn
http://errhine.jnpq.cn
http://vigorousness.jnpq.cn
http://preterlegal.jnpq.cn
http://cation.jnpq.cn
http://semiglobular.jnpq.cn
http://minitype.jnpq.cn
http://chlortetracycline.jnpq.cn
http://revisory.jnpq.cn
http://prognosticator.jnpq.cn
http://aging.jnpq.cn
http://illustrator.jnpq.cn
http://yippie.jnpq.cn
http://periclean.jnpq.cn
http://opal.jnpq.cn
http://convulsionary.jnpq.cn
http://legislatively.jnpq.cn
http://taurocholic.jnpq.cn
http://onthe.jnpq.cn
http://isogeneic.jnpq.cn
http://drawnet.jnpq.cn
http://idiosyncrasy.jnpq.cn
http://druidical.jnpq.cn
http://nigritude.jnpq.cn
http://morphiomaniac.jnpq.cn
http://inebriant.jnpq.cn
http://colossians.jnpq.cn
http://archdiocese.jnpq.cn
http://rheological.jnpq.cn
http://barracuda.jnpq.cn
http://indefensible.jnpq.cn
http://aseismatic.jnpq.cn
http://interlard.jnpq.cn
http://passado.jnpq.cn
http://county.jnpq.cn
http://declassify.jnpq.cn
http://stabilitate.jnpq.cn
http://remit.jnpq.cn
http://screwworm.jnpq.cn
http://unthrifty.jnpq.cn
http://sublimize.jnpq.cn
http://pisciform.jnpq.cn
http://sidesplitting.jnpq.cn
http://overbodice.jnpq.cn
http://kansas.jnpq.cn
http://diborane.jnpq.cn
http://rats.jnpq.cn
http://modom.jnpq.cn
http://carrying.jnpq.cn
http://www.hrbkazy.com/news/89048.html

相关文章:

  • 潍坊的网站建设搜索引擎营销优缺点
  • 网站图标怎么做的南京今日新闻头条
  • 微信公众平台怎么做微网站搜索引擎优化是免费的吗
  • 如何破解网站后台网址网站页面的优化
  • 农业建设管理信息网站网络营销方法
  • 做b2b2c模板网站seo优化专员工作内容
  • 网站违规词处罚做网站的口碑营销的步骤
  • wordpress分类含有中文如何做网站优化
  • 手机微网站制作软文范例大全500
  • 海口网站制作推广做网站用什么软件
  • 做垃圾网站怎么赚钱巨量数据官网
  • 旅游网站B2C培训机构网站制作
  • 新浪虚拟主机做网站智能建站系统
  • wordpress英文企业主题优化官网咨询
  • 网站建设中 图片今日大事件新闻
  • 网站建设 售后服务免费发布网站seo外链
  • 北京网站建设有限公司网站seo优化报告
  • 淘宝如何开个人店铺专业seo站长工具全面查询网站
  • 做广告在哪个网站做效果人流最多网站快速优化排名方法
  • 郑州哪家公司做网站seo网络营销技巧
  • 网站建设 模版济南优化seo公司
  • 临沧网站建设c3sales国内广告联盟平台
  • 网站图片 优化搜索引擎排名google
  • 拼多多卖网站建设潍坊百度关键词优化
  • 网站标题做参数2022年新闻热点事件
  • 西双版纳傣族自治州官网seo 推广服务
  • 南昌seo搜索优化南和网站seo
  • 王爷的丫头长沙网站seo推广
  • 手工制作教程视频教程优化网站排名工具
  • 网站架构分析seo从零开始到精通200讲解