PHP

遇到问题:

1.跨域问题

failed to load response data:no data fond for response with give

header("Content-Type: text/html;charset=utf-8");
header('Access-Control-Allow-Origin: *');

2.遇到这种无法读取undefined的属性(读取'getAttribute')  ,  导致些图表不出来
echarts.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute')

解决方法: 封装的JS,在页面也要转入值到JS函数里

前端

1.最大DIV加入 id="Market" v-cloak 对应el: '#Market', 才能把值写入
2.<h4>{{topCounts['order_amount_total']}}</h4>

3.循环 与IF

  <div class="countItme" v-for="item in topCounts" v-if="item.count_name=='市场活跃度排行'">
    <div class="countNum">{{item.count}}</div>
    <div class="countText">{{item.count_name}}</div>
  </div>



<script src="./js/index.js"></script>
<script src="./js/vue.js"></script>
<script type="text/javascript">
var vm = new Vue({
el: '#Screen',
data:{
topCounts:[],
StatisticsList:[],
orderList:[],
dotList:[],
user7todayList:[],
order7todaylist:[], //1、定义变量
},
created:function(){
var that = this;
that.commImg = commImg();
that.token = localStorage.getItem('caiToken');
that.id = localStorage.getItem('id');
that.ame = localStorage.getItem('name');
},
mounted:function(){
var that = this;
var postData = {"id":that.id,"token":that.token};

//轮询
lunxun = setInterval(function(){
that.getStatistics(postData);
},10000);

that.getStatistics(postData,1);
that.getStatistics_list(postData,1);
that.order_list(postData,1);
that.doc_list(postData,1);
that.user7today_list(postData,1);
that.order7today_list(postData,1); //定义函数
},
methods:{
getStatistics:function(postData,curIndex){
var that = this;
that.getData('statistics',postData,function(res){
if(res.code==0){
that.$forceUpdate()
return false;
}else{
that.topCounts = res;
}
that.$forceUpdate()//强制刷新

});
},

getStatistics_list:function(postData,curIndex){
var that = this;
that.getData('statistics_list',postData,function(res){
if(res.code==0){
that.$forceUpdate()
return false;
}else{
that.StatisticsList = res.list;
}
that.$forceUpdate()
});
},

getData:function(aggregate,postData,onSuccess){
var url1 = commUrl() + aggregate;
var params = postData;
$.post(url1,params,function(res){
if(res.code == -1){
alert(res.msg);
}else if(res.code == 1){
onSuccess(res.data);
}else{
alert(res.msg);
return false;
}
},'json')
},

order_list:function(postData,curIndex){
var that = this;
that.getData('order_list',postData,function(res){
if(res.code==0){
that.$forceUpdate()
return false;
}else{
that.orderList = res.list; //3.值写入变量
}
that.$forceUpdate() //强制刷新

});
},

doc_list:function(postData,curIndex){
var that = this;
that.getData('dot',postData,function(res){
if(res.code==0){
that.$forceUpdate()
return false;
}else{
that.dotList = res.list;
}
that.$forceUpdate() //强制刷新

});
},

order7today_list:function(postData,curIndex){
var that = this;
that.getData('order7today_list',postData,function(res){
if(res.code==0){
that.$forceUpdate()
return false;
}else{
that.user7todayList = res.list;
}
that.$forceUpdate()

var ledger2X=[];
var ledger2Y=[];
$.each(res.list, function(index,item) {
ledger2X.push(item.x2);
ledger2Y.push(item.x1);
});
Echart2(ledger2X,ledger2Y);
});
},

user7today_list:function(postData,curIndex){
var that = this;
that.getData('user7today_list',postData,function(res){
if(res.code==0){
that.$forceUpdate()
return false;
}else{
that.user7todaylist = res.list;
}
that.$forceUpdate()
var ledger3X=[];
var ledger3Y=[];
$.each(res.list, function(index,item) {
ledger3X.push(item.x2);
ledger3Y.push(item.x1);
});
Echart3(ledger3X,ledger3Y);
});
},
}
});
</script>

index.js
function Echart3(xData,yData){
// 中间省略的数据 准备三项
var item = {
name: '',
value: 1200,
// 柱子颜色
itemStyle: {
color: '#254065'
},
// 鼠标经过柱子颜色
emphasis: {
itemStyle: {
color: '#254065'
}
},
// 工具提示隐藏
tooltip: {
extraCssText: 'opacity:0'
}
};
option = {
// 工具提示
tooltip: {
// 触发类型 经过轴触发axis 经过轴触发item
trigger: 'item',
// 轴触发提示才有效
axisPointer: {
// 默认为直线,可选为:'line' 线效果 | 'shadow' 阴影效果
type: 'shadow'
}
},
// 图表边界控制
grid: {
// 距离 上右下左 的距离
left: '0',
right: '3%',
bottom: '3%',
top: '5%',
// 大小是否包含文本【类似于boxsizing】
containLabel: true,
//显示边框
show: true,
//边框颜色
borderColor: 'rgba(0, 240, 255, 0.3)'
},
// 控制x轴
xAxis: [
{
// 使用类目,必须有data属性
type: 'category',
// 使用 data 中的数据设为刻度文字
data: xData, //['上海', '广州', '北京', '深圳', '合肥', '', '......', '', '杭州', '厦门', '济南', '成都', '重庆'],
// 刻度设置
axisTick: {
// true意思:图形在刻度中间
// false意思:图形在刻度之间
alignWithLabel: false,
show: false
},
//文字
axisLabel: {
color: '#4c9bfd'
}
}
],
// 控制y轴
yAxis: [
{
// 使用数据的值设为刻度文字
type: 'value',
axisTick: {
// true意思:图形在刻度中间
// false意思:图形在刻度之间
alignWithLabel: false,
show: false
},
//文字
axisLabel: {
color: '#4c9bfd'
},
splitLine: {
lineStyle: {
color: 'rgba(0, 240, 255, 0.3)'
}
},
}
],
// 控制x轴
series: [

{
// series配置
// 颜色
itemStyle: {
// 提供的工具函数生成渐变颜色
color: new echarts.graphic.LinearGradient(
// (x1,y2) 点到点 (x2,y2) 之间进行渐变
0, 0, 0, 1,
[
{ offset: 0, color: '#00fffb' }, // 0 起始颜色
{ offset: 1, color: '#0061ce' } // 1 结束颜色
]
)
},
// 图表数据名称
name: '用户统计',
// 图表类型
type: 'bar',
// 柱子宽度
barWidth: '60%',
// 数据
data: yData, //[2100, 1900, 1700, 1560, 1400, item, item, item, 900, 750, 600, 480, 240]
}
]
};
var myechart = echarts.init($('.users .bar')[0]);
myechart.setOption(option);
};

nodsjs POST请求的更多相关文章

  1. Angular2入门系列教程7-HTTP(一)-使用Angular2自带的http进行网络请求

    上一篇:Angular2入门系列教程6-路由(二)-使用多层级路由并在在路由中传递复杂参数 感觉这篇不是很好写,因为涉及到网络请求,如果采用真实的网络请求,这个例子大家拿到手估计还要自己写一个web ...

  2. Android请求网络共通类——Hi_博客 Android App 开发笔记

    今天 ,来分享一下 ,一个博客App的开发过程,以前也没开发过这种类型App 的经验,求大神们轻点喷. 首先我们要创建一个Andriod 项目 因为要从网络请求数据所以我们先来一个请求网络的共通类. ...

  3. 重温Http协议--请求报文和响应报文

    http协议是位于应用层的协议,我们在日常浏览网页比如在导航网站请求百度首页的时候,会先通过http协议把请求做一个类似于编码的工作,发送给百度的服务器,然后在百度服务器响应请求时把相应的内容再通过h ...

  4. Taurus.MVC 2.2 开源发布:WebAPI 功能增强(请求跨域及Json转换)

    背景: 1:有用户反馈了关于跨域请求的问题. 2:有用户反馈了参数获取的问题. 3:JsonHelper的增强. 在综合上面的条件下,有了2.2版本的更新,也因此写了此文. 开源地址: https:/ ...

  5. nodejs之get/post请求的几种方式

    最近一段时间在学习前端向服务器发送数据和请求数据,下面总结了一下向服务器发送请求用get和post的几种不同请求方式: 1.用form表单的方法:(1)get方法 前端代码: <form act ...

  6. ajax异步请求

    做前端开发的朋友对于ajax异步更新一定印象深刻,作为刚入坑的小白,今天就和大家一起聊聊关于ajax异步请求的那点事.既然是ajax就少不了jQuery的知识,推荐大家访问www.w3school.c ...

  7. C# MVC 5 - 生命周期(应用程序生命周期&请求生命周期)

    本文是根据网上的文章总结的. 1.介绍 本文讨论ASP.Net MVC框架MVC的请求生命周期. MVC有两个生命周期,一为应用程序生命周期,二为请求生命周期. 2.应用程序生命周期 应用程序生命周期 ...

  8. nodejs进阶(5)—接收请求参数

    1. get请求参数接收 我们简单举一个需要接收参数的例子 如果有个查找功能,查找关键词需要从url里接收,http://localhost:8000/search?keyword=地球.通过前面的进 ...

  9. 无法向会话状态服务器发出会话状态请求。请确保 ASP.NET State Service (ASP.NET 状态服务)已启动,并且客户端端口与服务器端口相同。如果服务器位于远程计算机上,请检查。。。

    异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 无法向会话状态服务器发出会话状态请求.请确保 ASP.NET State Ser ...

  10. [转]利用URLConnection来发送POST和GET请求

    URL的openConnection()方法将返回一个URLConnection对象,该对象表示应用程序和 URL 之间的通信链接.程序可以通过URLConnection实例向该URL发送请求.读取U ...

随机推荐

  1. SQL初级知识点

    一,表 表中的列叫做字段,行叫记录也叫元组. 主键:唯一的标识表中的某一条记录 外键:一个表的主键作为另一个表的外键,表示两个表之间的关系.一般将外键写在记录的一方,比如部门号和员工号,应该将部门号作 ...

  2. Spring系列之基于 Java 的容器配置-9

    目录 组合基于 Java 的配置 使用`@Import`注解 有条件地包含`@Configuration`类或`@Bean`方法 结合 Java 和 XML 配置 组合基于 Java 的配置 Spri ...

  3. 微信点击链接:debugx5.qq.com提示您使用的不是x5内核

    微信点击链接:debugx5.qq.com提示您使用的不是x5内核 因为要测试小程序,需要webview调试功能,正常来说在微信任意一个聊天窗口,输入:debugx5.qq.com,点击该链接就可以, ...

  4. linux 文件系统和包管理工具rpm,yum

    文件系统 1.什么是文件系统? 文件系统是一种存储和组织计算机中数据文件的机制或方法,他使得对计算机内的数据的存储.访问和查找变得更容易,简单. 文件系统落到计算机里其实就是一个应用软件 ext2 e ...

  5. egret tween 屏幕震动动画 ts

    let orig = { x: this.x, y: this.y }; var dir = 1; var tox = 0; var toy = 0; var count = 40; // if (n ...

  6. 【Unity】2021接Bugly踩坑记录

    写在前面 因为在工作项目中用到Bugly,所以我在自己的测试工程中尝试接入Bugly,却没有成功,明明一切是按照说明书操作,为什么会不成功?当时在网上找了很久的资料,最后试成功了,这里把当时遇到的问题 ...

  7. elasticsearch开发学习及踩坑实录

    1.elasticsearch7.+需要jdk11 / elasticsearch6.+需要jdk8 , 如果是Java开发的同学本地开发使用jdk8 , 可以下载一个解压版的jdk11 , 然后修改 ...

  8. 异常:Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.2.RELEASE:repackage (repackage) 解决办法

    异常:Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.2.RELEASE:repackage ...

  9. 调用d2l.plt.imshow(img)不报错、不显示图像的问题

    解决方案: 加入如下所示的代码: import matplotlib.pyplot as plt d2l.plt.imshow(img) plt.show()

  10. MySQL 导出单表数据

    1.导出指定表的数据 mysqldump -t database -u username -ppassword --tables table_name1 table_name2 table_name3 ...