#
whycq
2023-10-17 94ed9c21bf8364b71e881476d572a4df192607f3
#
2个文件已修改
49 ■■■■ 已修改文件
pages/api/index.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/api/index.js
@@ -85,6 +85,28 @@
        header: {'token':uni.getStorageSync('token')},
        method: 'POST',
    }).then((res)=> {
        res = res[1].data
        if (res.code === 200) {
            item = {
                code: res.code,
                data: res.data
            }
        } else  if(res.code === 403){
            item = {code: 403,msg: '请重新登录'}
        }
    },(result)=>{
        // console.log(res);
    })
    return item
}
async function getMonthData() {
    let item = [];
    let ress = await uni.request({
        url: `${common.baseUrl}/dashboard/currentMonthData/auth`,
        header: {'token':uni.getStorageSync('token')},
        method: 'POST',
    }).then((res)=> {
        console.log(res);
        res = res[1].data
        if (res.code === 200) {
@@ -105,5 +127,6 @@
     getCompanyData,
     getPersonData,
     getStaffRank,
     getCompanyPostList
     getCompanyPostList,
     getMonthData
}
pages/index/index.vue
@@ -83,7 +83,7 @@
                    {username: '李世豪1级',money:'112万元'}
                ],
                bgs: ['bg-blue','bg-red'],
                red: '#aaffff',
                red: '#4286db',
                notices: [
                    {notice: '这条测试公告被修改了asdas这条测试公告被修改了这条测试公告被修改了',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
                    {notice: '这是一条测试公告',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
@@ -97,7 +97,14 @@
                    {notice: '这是一条测试公告',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
                    {notice: '这是一条测试公告',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
                    {notice: '浙江中扬立库技术有限公司是中扬集团旗下专业的智能仓储物流设备源头服务商,致力于让制造与物流更高效。集团年销售额超5亿人民币,是中国立体仓库大型厂家之一,集科研、生产、销售、售后为一体的国家高新技术企业,浙江省“专精特新”企业,浙江省“尖兵、领雁”企业,浙江省重点培育企业,综合实力位居行业前列',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'}
                ]
                ],
                Column: {
                    categories: ["1月", "2月", "3月", "4月", "5月", "6月","7月", "8月", "9月", "10月", "11月", "12月"],
                    series: [{
                        name: "销售额",
                        data: [35, 36, 31, 33, 13, 34,18, 27, 21, 24, 6, 28]
                    }]
                }
                
                
            }
@@ -112,6 +119,7 @@
            this.getPersonData()
            this.getStaffRank()
            this.getCompanyPostList()
            this.getMonthData()
        },
        mounted() {
            
@@ -121,7 +129,7 @@
              setTimeout(() => {
                  //因部分数据格式一样,这里不同图表引用同一数据源的话,需要深拷贝一下构造不同的对象
                  //开发者需要自行处理服务器返回的数据,应与标准数据格式一致,注意series的data数值应为数字格式
                  this.chartsDataColumn4=JSON.parse(JSON.stringify(demodata.Column))
                  this.chartsDataColumn4=JSON.parse(JSON.stringify(this.Column))
              }, 1500);
            },
            backGroundRepeat() {
@@ -166,13 +174,21 @@
            },
            async getCompanyPostList() {
                let res = await getCompanyData.getCompanyPostList()
                console.log(res);
                if (res.code === 200) {
                    this.notices = res.data.records.splice(0,5)
                } else if (res.code === 403) {
                    this.backLogin(res)
                }
            },
            async getMonthData() {
                let res = await getCompanyData.getMonthData()
                if (res.code === 200) {
                    this.Column.series[0].data = res.data
                } else if (res.code === 403) {
                    this.backLogin(res)
                }
            },
            backLogin(res) {
                uni.showToast({title: res.msg, icon: "none", position: 'top'})
                setTimeout(() => {