设置新的请求头

develoop
lijiaqi 5 months ago
parent 0da2b2cc06
commit 29d5b9e8a8
  1. 2
      src/utils/request.ts
  2. 88
      src/views/course/basicCourseInformation.vue

@ -11,7 +11,7 @@ const request = axios.create({
request.interceptors.request.use((config) => {
const userStore = useUserStore()
// 设置请求头设置token
config.headers.token = userStore.token
config.headers.Authorization = `Bearer ${userStore.token}`
return config
})
//响应拦截器

@ -2,16 +2,15 @@
import { ref, onMounted } from 'vue'
// import axios from 'axios'
import courseEdit from './components/courseEdit.vue'
import { Plus, Search } from '@element-plus/icons-vue'
import { Plus } from '@element-plus/icons-vue'
import {
getCourseListApi,
deleteCourseApi,
getCourseObjectApi,
getTeacherListApi,
} from '../../api/user/crouse'
import { ElMessageBox, ElMessage } from 'element-plus'
// import router from '@/router'
import { useRouter, useRoute } from 'vue-router'
import { useRouter } from 'vue-router'
const router = useRouter()
// const route = useRoute()
// console.log(route)
@ -167,8 +166,12 @@ const CloseCouresNameChangeEvent = () => {
<el-form inline>
<el-form-item label="课程教师:" class="short-form-item">
<el-select v-model="params.teacher">
<el-option v-for="teachers in teacherList" :key="teachers.username" :value="teachers.username"
:label="teachers.name"></el-option>
<el-option
v-for="teachers in teacherList"
:key="teachers.username"
:value="teachers.username"
:label="teachers.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="课程类别:" class="short-form-item">
@ -199,14 +202,14 @@ const CloseCouresNameChangeEvent = () => {
<div class="course">
<ul class="course_list">
<li @click="onAddCourse()">
<li @click="onAddCourse()" class="add_course">
<div class="plus">
<el-icon class="avatar-uploader-icon">
<Plus />
</el-icon>
</div>
<h2 class="course_name">{{ course_name }}</h2>
<h2>{{ course_name }}</h2>
<!-- <p class="teacher_name">讲师{{ courseList.teacher }}</p>
<p class="credit">
<span>{{ credit_name }}</span>
@ -232,21 +235,36 @@ const CloseCouresNameChangeEvent = () => {
<Delete />
</el-icon>
<el-button class="object" round plain @click="onGetCourseObject(item.id)">
<el-button
class="object"
round
plain
@click="onGetCourseObject(item.id)"
>
查看课程目标
</el-button>
</li>
</ul>
</div>
<el-pagination v-model:current-page="params.pageNo" v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]" :background="true" layout="jumper,total, sizes, prev, pager, next " :total="total"
@size-change="handleSizeChange" @current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center" />
<el-pagination
v-model:current-page="params.pageNo"
v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]"
:background="true"
layout="jumper,total, sizes, prev, pager, next "
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center"
/>
</div>
<course-edit ref="drawer" @success="onSuccess" @couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent" @creditChange="creditChangeEvent"
@classhoursChange="classhoursChangeEvent" @ClosecreditChange="ClosecreditChangeEvent"
@CloseclasshoursChange="CloseclasshoursChangeEvent" :flog="flog"></course-edit>
<course-edit
ref="drawer"
@success="onSuccess"
@couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent"
:flog="flog"
></course-edit>
</div>
</div>
</template>
@ -293,7 +311,6 @@ const CloseCouresNameChangeEvent = () => {
}
.course {
// display: flex;
// flex: 0 0 25%;
// justify-content: space-between;
@ -331,6 +348,9 @@ const CloseCouresNameChangeEvent = () => {
margin-left: 30px;
margin-top: 10px;
font-weight: bold;
&:hover {
cursor: pointer;
}
}
img {
@ -353,19 +373,6 @@ const CloseCouresNameChangeEvent = () => {
color: #0052ff;
}
}
h2 {
font-family: Inter-Bold;
color: #333;
font-size: 24px;
margin-left: 30px;
margin-top: 10px;
font-weight: bold;
&:hover {
cursor: pointer;
}
}
}
.del {
@ -386,17 +393,34 @@ const CloseCouresNameChangeEvent = () => {
.plus {
width: 100%;
height: 178px;
&:hover {
cursor: pointer;
}
// background-position: center center;
.el-icon.avatar-uploader-icon {
font-size: 28px;
font-size: 50px;
color: #8c939d;
width: 100%;
height: 178px;
margin-top: 20px;
text-align: center;
}
}
.add_course {
border: 2px dashed rgb(143, 139, 139);
h2 {
font-size: 40px;
text-align: center;
font-family: Inter-Bold;
color: #535050;
font-weight: bold;
margin-top: 20px;
&:hover {
cursor: pointer;
}
}
}
.short-form-item {
width: 250px;
margin-right: 65px;

Loading…
Cancel
Save