学习记录拿用户id

develoop
wenyu441069198 4 months ago
parent f13728da3c
commit d7b4e7a9c5
  1. 4
      .env.development
  2. 12
      src/views/courseResources/index.vue

@ -1,5 +1,5 @@
# 变量必须以 VITE_ 为前缀才能暴露给外部读取 # 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development' NODE_ENV = 'development'
VITE_APP_TITLE = '无糖运营平台' VITE_APP_TITLE = '无糖运营平台'
# VITE_APP_BASE_API = 'http://127.0.0.1:8008' VITE_APP_BASE_API = 'http://127.0.0.1:8080'
VITE_APP_BASE_API = 'http://39.106.16.162:8080' # VITE_APP_BASE_API = 'http://39.106.16.162:8080'

@ -14,6 +14,9 @@ import { LearningRecordsControllerService } from '../../../generated/services/Le
import { CourseResourceControllerService } from '../../../generated/services/CourseResourceControllerService' import { CourseResourceControllerService } from '../../../generated/services/CourseResourceControllerService'
import resourceAdd from './componse/resourceAdd.vue' import resourceAdd from './componse/resourceAdd.vue'
import useUserStore from '@/store/modules/user'
import { onMounted } from 'vue'
const total = ref(0) const total = ref(0)
const pptresourceList = ref([]) const pptresourceList = ref([])
@ -77,10 +80,14 @@ const onDeleteResource = async (ids) => {
ElMessage({ type: 'success', message: '删除成功' }) ElMessage({ type: 'success', message: '删除成功' })
getpptresourceList() getpptresourceList()
} }
const userStore = useUserStore()
onMounted(()=>{
userStore.getUserInfo()
})
const param = ref({ const param = ref({
coursesId: '', coursesId: '',
userId: '1', coursesName: '',
userId: userStore.data.id,
open: '1', open: '1',
download: '0', download: '0',
content: '', content: '',
@ -91,6 +98,7 @@ const param = ref({
const generateRecords = async (rescource) => { const generateRecords = async (rescource) => {
param.value.content = rescource.img param.value.content = rescource.img
param.value.coursesId = rescource.id.toString() param.value.coursesId = rescource.id.toString()
param.value.coursesName = rescource.name
await LearningRecordsControllerService.saveRecordsUsingPost1(param.value) await LearningRecordsControllerService.saveRecordsUsingPost1(param.value)
// console.log(param) // console.log(param)
} }

Loading…
Cancel
Save