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

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

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