设置新的请求头

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) => { request.interceptors.request.use((config) => {
const userStore = useUserStore() const userStore = useUserStore()
// 设置请求头设置token // 设置请求头设置token
config.headers.token = userStore.token config.headers.Authorization = `Bearer ${userStore.token}`
return config return config
}) })
//响应拦截器 //响应拦截器

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

Loading…
Cancel
Save