develoop
youhang 5 months ago
parent 067ed5bdb6
commit 2766e17c03
  1. 37
      generated/core/OpenAPI.ts
  2. 29
      src/views/MyCourseStudy/ContainerCla.vue

@ -2,31 +2,34 @@
/* istanbul ignore file */ /* istanbul ignore file */
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiRequestOptions } from './ApiRequestOptions'
// 引入设置token的方法
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>; import { GET_TKOEN } from '@/utils/token'
type Headers = Record<string, string>; type Resolver<T> = (options: ApiRequestOptions) => Promise<T>
type Headers = Record<string, string>
export type OpenAPIConfig = { export type OpenAPIConfig = {
BASE: string; BASE: string
VERSION: string; VERSION: string
WITH_CREDENTIALS: boolean; WITH_CREDENTIALS: boolean
CREDENTIALS: 'include' | 'omit' | 'same-origin'; CREDENTIALS: 'include' | 'omit' | 'same-origin'
TOKEN?: string | Resolver<string> | undefined; TOKEN?: string | Resolver<string> | undefined
USERNAME?: string | Resolver<string> | undefined; USERNAME?: string | Resolver<string> | undefined
PASSWORD?: string | Resolver<string> | undefined; PASSWORD?: string | Resolver<string> | undefined
HEADERS?: Headers | Resolver<Headers> | undefined; HEADERS?: Headers | Resolver<Headers> | undefined
ENCODE_PATH?: ((path: string) => string) | undefined; ENCODE_PATH?: ((path: string) => string) | undefined
}; }
export const OpenAPI: OpenAPIConfig = { export const OpenAPI: OpenAPIConfig = {
BASE: 'http://39.106.16.162:8080', BASE: 'http://39.106.16.162:8080',
VERSION: '1.0.0', VERSION: '1.0.0',
WITH_CREDENTIALS: false, WITH_CREDENTIALS: false,
CREDENTIALS: 'include', CREDENTIALS: 'include',
TOKEN: undefined, TOKEN: GET_TKOEN('TOKEN'),
USERNAME: undefined, USERNAME: undefined,
PASSWORD: undefined, PASSWORD: undefined,
HEADERS: undefined, HEADERS: {
Authorization: 'Bearer ' + GET_TKOEN('TOKEN'),
},
ENCODE_PATH: undefined, ENCODE_PATH: undefined,
}; }

@ -27,9 +27,15 @@
</div> </div>
</div> </div>
<div class="Page-1"> <div class="Page-1">
<el-pagination v-model:current-page="params.current" v-model:page-size="params.pageSize" <el-pagination
:page-sizes="[6, 8, 12, 15]" layout="total, sizes, prev, pager, next, jumper" :total="total" v-model:current-page="params.current"
@size-change="handleSizeChange" @current-change="handleCurrentChange" /> v-model:page-size="params.pageSize"
:page-sizes="[6, 8, 12, 15]"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div> </div>
</el-tab-pane> </el-tab-pane>
</template> </template>
@ -42,21 +48,22 @@ const container = ref()
function handleResize() { function handleResize() {
const style = getComputedStyle(container.value) const style = getComputedStyle(container.value)
const width = Number(style.width.slice(0, -2)) const width = Number(style.width.slice(0, -2))
if (width >= 350 * 4.5) container.value.style.gridTemplateColumns = "repeat(4, 350px)" if (width >= 350 * 4.5)
else container.value.style.gridTemplateColumns = "repeat(auto-fill, 350px)" container.value.style.gridTemplateColumns = 'repeat(4, 350px)'
else container.value.style.gridTemplateColumns = 'repeat(auto-fill, 350px)'
} }
function debounce(func: any, delay: any) { function debounce(func: any, delay: any) {
let timer: any let timer: any
return function () { return function () {
clearTimeout(timer); clearTimeout(timer)
timer = setTimeout(() => { timer = setTimeout(() => {
// @ts-ignore // @ts-ignore
func.apply(this, arguments); func.apply(this, arguments)
}, delay); }, delay)
}; }
} }
const deHR = debounce(handleResize, 500) const deHR = debounce(handleResize, 500)
const myObserver = new ResizeObserver((deHR)) const myObserver = new ResizeObserver(deHR)
onMounted(() => myObserver.observe(container.value)) onMounted(() => myObserver.observe(container.value))
// =============================== // ===============================
const total = ref(0) const total = ref(0)
@ -92,7 +99,7 @@ let params = ref<CourseFavourQueryRequest>({
}) })
const getDatalist = async () => { const getDatalist = async () => {
const res = await SeCourseFavourControllerService.listPostByPageUsingPost( const res = await SeCourseFavourControllerService.listPostByPageUsingPost1(
params.value, params.value,
) )
datalist.value = res.data.records datalist.value = res.data.records

Loading…
Cancel
Save