提交 71023601 authored 作者: lidongxu's avatar lidongxu

fix(request.js): 修复飞书环境 token 过期后自动续新 Token 的问题

同上
上级 9e8d1c4f
......@@ -21,9 +21,9 @@ export default defineStore(
* @returns {Promise}
*/
login({ type, data }) {
const { username, password, code } = data
return new Promise((resolve, reject) => {
if (type === 'upass') {
const { username, password } = data
login({ username, password }).then(res => {
setToken(res.data.access_token)
this.token = res.data.access_token
......@@ -32,6 +32,7 @@ export default defineStore(
reject(error)
})
} else if (type === 'fs') {
const { code } = data
fsLogin({ code }).then(res => {
setToken(res.access_token)
this.token = res.access_token
......
......@@ -6,6 +6,7 @@ import { tansParams, blobValidate } from '@/utils/ruoyi'
import cache from '@/plugins/cache'
import { saveAs } from 'file-saver'
import useUserStore from '@/store/modules/user'
import { fsClientAuth } from '@/api'
let downloadLoadingInstance;
// 是否显示重新登录
......@@ -87,7 +88,7 @@ service.interceptors.response.use(async res => {
const code = await fsClientAuth()
await useUserStore().login({
type: 'fs',
code
data: { code }
})
// 重新发送本次失败的请求
return service(res.config)
......
......@@ -17,11 +17,11 @@
</el-form-item>
<el-form-item label="数据类型">
<el-select v-model="queryParams.typeList"
@change="queryChangeFn"
multiple
clearable
collapse-tags
collapse-tags-tooltip>
collapse-tags-tooltip
@change="queryChangeFn">
<el-option v-for="str in typeList"
:label="str"
:value="str">
......@@ -31,8 +31,6 @@
<el-form-item label="日期选择">
<el-date-picker v-model="queryParams.date"
type="daterange"
align="right"
unlink-panels
:clearable="false"
range-separator="至"
start-placeholder="开始日期"
......@@ -63,8 +61,8 @@ import LineCharts from './LineAndBar.vue'
import { getCmmListAPI } from '@/api'
import { generatorDayList, parseTime, getAdditionalColor, resetObjValue } from '@/utils'
import { useDatePickerOptions } from '@/hooks'
// 静态数据
// 静态数据
const loading = ref(true)
const brandList = ref([]) // 直播间列表
const typeList = ref(['销售额', '观看人次']) // 数据类型列表
......@@ -72,8 +70,8 @@ const { pickerOptions, nowMouth } = useDatePickerOptions() // 日期快捷方式
const queryParams = reactive({ // 查询表单
brandList: [],
date: nowMouth,
typeList: [typeList.value[0]]
date: [],
typeList: []
})
const allChartData = reactive({ // 图表所有数据
......@@ -226,6 +224,9 @@ const filterData = () => {
}
const init = async function () {
// 初始化参数
queryParams.date = nowMouth
queryParams.typeList = [typeList.value[0]]
// 请求数据
const data = await getList()
// 初始化直播间列表
......@@ -253,25 +254,8 @@ const legendChangeFn = () => {
const reset = async () => {
// 重置查询参数
queryParams.brandList = []
queryParams.date = dateList
queryParams.typeList = [dataTypeList[0]]
queryParams.date = []
queryParams.typeList = []
init()
}
</script>
<style scoped
lang="scss">
.tabs-container {
flex: 1;
display: flex;
flex-direction: column;
.chart_wrap {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
}
}
</style>
\ No newline at end of file
</script>
\ No newline at end of file
......@@ -46,6 +46,19 @@ const activeName = ref(list.value[0].name)
flex-direction: column;
}
}
::v-deep(.tabs-container) {
flex: 1;
display: flex;
flex-direction: column;
.chart_wrap {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div>
<div class="tabs-container">
<el-form :model="queryParams"
inline>
<el-form-item label="商品">
......@@ -32,7 +32,6 @@
<el-form-item label="日期选择">
<el-date-picker v-model="queryParams.date"
type="daterange"
unlink-panels
:clearable="false"
range-separator="至"
start-placeholder="开始日期"
......@@ -75,22 +74,19 @@ import TableList from '../components/TableList.vue';
import { getComPrdListAPI, getSycmListAPI } from '@/api'
import { generatorDayList, parseTime, getAdditionalColor, resetObjValue } from '@/utils'
import { useDatePickerOptions } from '@/hooks'
// 静态数据
const dateList = [new Date().setDate((new Date().getDate() - 30)), new Date().setDate((new Date().getDate() - 1))] // 最近 30 日日期数组
const dataTypeList = ['支付买家数', '交易增速', '独立访客范围', '流量增速'] // 数据类型
// 本页数据
const loading = ref(true)
const prdList = ref([]) // 商品列表
const typeList = ref(dataTypeList) // 数据类型
const { pickerOptions } = useDatePickerOptions()
const typeList = ref(['支付买家数', '交易增速', '独立访客范围', '流量增速']) // 数据类型
const { pickerOptions, nowMouth } = useDatePickerOptions()
const showType = ref('charts') // 展示类型('charts' / 'table')
const dateMerge = ref(false) // 表格中日期是否合并
const queryParams = reactive({ // 查询表单
prdList: [],
typeList: [typeList.value[0]],
date: dateList
typeList: [],
date: []
})
const allChartData = reactive({ // 图表所有数据
......@@ -356,6 +352,9 @@ const dateMergeFn = () => {
// 默认打开页面请求一次所有数据,并保存在数据源
async function init() {
// 初始化参数
queryParams.date = nowMouth
queryParams.typeList = [typeList.value[0]]
await getPrdList()
await getList()
};
......@@ -383,10 +382,9 @@ const queryChangeFn = async (arg) => {
// 重置
const reset = async () => {
// 重置查询参数
loading.value = true
queryParams.brandList = []
queryParams.date = dateList
queryParams.typeList = [dataTypeList[0]]
queryParams.date = []
queryParams.typeList = []
init()
}
</script>
......
<template>
<div>
<div class="tabs-container">
<el-form :model="queryParams"
inline>
<el-form-item label="店铺">
<el-select v-model="queryParams.brandList"
@change="queryChangeFn"
multiple
clearable
collapse-tags
collapse-tags-tooltip>
collapse-tags-tooltip
@change="queryChangeFn">
<el-option v-for="obj in brandList"
:label="obj.platformStore"
:value="obj.platformStore">
......@@ -17,10 +17,10 @@
</el-form-item>
<el-form-item label="数据类型">
<el-select v-model="queryParams.typeList"
@change="queryChangeFn"
multiple
clearable
collapse-tags>
collapse-tags
@change="queryChangeFn">
<el-option v-for="str in typeList"
:label="str"
:value="str">
......@@ -30,7 +30,6 @@
<el-form-item label="日期选择">
<el-date-picker v-model="queryParams.date"
type="daterange"
unlink-panels
:clearable="false"
range-separator="至"
start-placeholder="开始日期"
......@@ -74,22 +73,18 @@ import { getStoreListAPI, getSycmStoreListAPI } from '@/api'
import { generatorDayList, parseTime, getAdditionalColor, resetObjValue } from '@/utils'
import { useDatePickerOptions } from '@/hooks'
// 静态数据
const dateList = [new Date().setDate((new Date().getDate() - 30)), new Date().setDate((new Date().getDate() - 1))] // 最近 30 日日期数组
const dataTypeList = ['支付买家数', '交易增速', '独立访客范围', '流量增速'] // 数据类型
// 本页数据
const loading = ref(true)
const brandList = ref([]) // 店铺列表
const typeList = ref(dataTypeList) // 数据类型
const { pickerOptions } = useDatePickerOptions()
const typeList = ref(['支付买家数', '交易增速', '独立访客范围', '流量增速']) // 数据类型
const { pickerOptions, nowMouth } = useDatePickerOptions()
const showType = ref('charts') // 展示类型('charts' / 'table')
const dateMerge = ref(false) // 表格中日期是否合并
const queryParams = reactive({ // 查询表单
brandList: [],
typeList: [typeList.value[0]],
date: dateList
typeList: [],
date: [],
})
const allChartData = reactive({ // 图表所有数据
......@@ -106,8 +101,6 @@ const chartData = reactive({ // 图表内要用的数据
const allTableList = ref([])
const tableList = ref([])
// 获取竞店列表
const getStoreList = async () => {
const { data } = await getStoreListAPI()
......@@ -357,6 +350,9 @@ const dateMergeFn = () => {
// 默认打开页面请求一次所有数据,并保存在数据源
async function init() {
// 初始化参数
queryParams.date = nowMouth
queryParams.typeList = [typeList.value[0]]
await getStoreList()
await getList()
};
......@@ -384,12 +380,9 @@ const queryChangeFn = async (arg) => {
// 重置
const reset = async () => {
// 重置查询参数
loading.value = true
queryParams.brandList = []
queryParams.date = dateList
queryParams.typeList = [dataTypeList[0]]
queryParams.date = []
queryParams.typeList = []
init()
}
</script>
<style scoped></style>
\ No newline at end of file
</script>
\ No newline at end of file
......@@ -119,7 +119,6 @@ const loginByType = async (type, data) => {
type,
data
}).then(() => {
const query = route.query;
router.push({ path: redirect.value || "/" });
}).catch(() => {
loading.value = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论