获取数据
1、查看后端的接口
2、在axios目录下的api.js文件里获取后端的接口(每个接口写发都差不多,只要改接口名称就好 如:getNotice)
export const getNotice = (query, tenantkey_A, tenantid_A, username) => {
//获取通知消息
let time_A = getTime()
let sha_A = hex_sha1("/v1/user/getNotice" + tenantkey_A + time_A)
return service({
url: "user/getNotice",
method: 'get',
processData: false,
headers: {
ts: time_A,
siginfo: sha_A,
tenantid: tenantid_A,
username: username
},
params: query
}).then(res => res)
};
3、在需要的文件里面调用这个方法
import host from "../../host.js";
import {
loginout, getNotice } from "../../axios/api";
export default {
name: "Menu",
data() {
return {
contrForPrioNum: this.$store.state.userInfo.prionum,
tenantid_A: this.$store.state.userInfo.tenantid,
tenantkey_A: this.$store.state.userInfo.tenantkey,
userName: this.$store.state.userInfo.username