feat:修改传参

This commit is contained in:
lixg
2023-02-08 09:49:15 +08:00
parent 5f60601581
commit 0691c96083
10 changed files with 42 additions and 59 deletions

View File

@@ -22,9 +22,11 @@
import { computed, onMounted } from "vue"; import { computed, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { boeRequest } from "@/api/request"; import { boeRequest, request } from "@/api/request";
import { GET_USER_INFO } from "@/api/ThirdApi"; import { GET_USER_INFO } from "@/api/ThirdApi";
import { getCookie } from "@/api/utils"; import { getCookie } from "@/api/utils";
import { USER_INFO } from "@/api/api";
console.log("版本1.2.0------------"); console.log("版本1.2.0------------");
const store = useStore(); const store = useStore();
const router = useRouter(); const router = useRouter();
@@ -34,14 +36,20 @@ onMounted(() => {
}); });
function getUserInfo() { function getUserInfo() {
if (
import.meta.env.MODE === "development" ||
import.meta.env.MODE === "test"
) {
request(USER_INFO, {}).then((res) => {
store.commit("SET_USER", res.data);
});
} else {
boeRequest(GET_USER_INFO).then((res) => { boeRequest(GET_USER_INFO).then((res) => {
console.log(222222222); res.result.avatar =
console.log(res); res.result.avatar || "/800e23f7-b58c-4192-820d-0c6a2b7544cc.png";
res.result.avatar = res.result.avatar
? res.result.avatar
: "/800e23f7-b58c-4192-820d-0c6a2b7544cc.png";
store.commit("SET_USER", res.result); store.commit("SET_USER", res.result);
}); });
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -2,12 +2,13 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-13 11:42:48 * @Date: 2023-01-13 11:42:48
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-02-06 18:39:13 * @LastEditTime: 2023-02-07 17:36:05
* @FilePath: /stu_h5/src/api/api.js * @FilePath: /stu_h5/src/api/api.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
export const BASE = 'http://localhost:3000' export const BASE = 'http://localhost:3000'
export const LOGIN = '/admin/CheckUser/userLogin post' export const LOGIN = '/admin/CheckUser/userLogin post'
export const USER_INFO = '/admin/CheckUser/userInfo'
export const FILE_UPLOAD = import.meta.env.VITE_BASE_API + '/file/upload' export const FILE_UPLOAD = import.meta.env.VITE_BASE_API + '/file/upload'
export const ROUTER_CHAPTER_LIST = '/stu/router/chapterList post' export const ROUTER_CHAPTER_LIST = '/stu/router/chapterList post'
export const ROUTER_LIST = '/stu/router/list post' export const ROUTER_LIST = '/stu/router/list post'

View File

@@ -172,12 +172,13 @@ import { ElMessage } from "element-plus";
import { useRoute, useRouter } from "vue-router/dist/vue-router"; import { useRoute, useRouter } from "vue-router/dist/vue-router";
const { const {
query: { courseId, chapterOrStageId, infoId, id, btype, studentId }, query: { courseId, chapterOrStageId, infoId, id, btype },
} = useRoute(); } = useRoute();
const userInfo = computed(() => store.state.userInfo);
const { data } = useRequest(VOTE_DETAIL2, { const { data } = useRequest(VOTE_DETAIL2, {
chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0, chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
courseId: courseId, courseId: courseId,
studentId: studentId, studentId: userInfo.value.id,
targetId: infoId, targetId: infoId,
type: btype, type: btype,
}); });
@@ -207,26 +208,7 @@ let timer = setInterval(() => {
onUnmounted(() => { onUnmounted(() => {
clearInterval(timer); clearInterval(timer);
}); });
const state = reactive({
ballot: [
{
id: 1,
content: "录播课",
},
{
id: 2,
content: "PPT+配音",
},
{
id: 3,
content: "HTML5",
},
{
id: 4,
content: "OTHER",
},
],
});
// 答题时间 // 答题时间
const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"); const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
// 选择题目 // 选择题目
@@ -314,9 +296,10 @@ const submitVote = () => {
request(VOTE_DETAIL2, { request(VOTE_DETAIL2, {
chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0, chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0,
courseId: courseId, courseId: courseId,
studentId: studentId, studentId: userInfo.value.id,
targetId: infoId, targetId: infoId,
type: btype, type: btype,
taskId: id,
}) })
.then((res) => { .then((res) => {
console.log("投票结果", res); console.log("投票结果", res);

View File

@@ -403,7 +403,7 @@ const {
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId }); const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId });
console.log("datadatadatadatadatadatadata", data); console.log("datadatadatadatadatadatadata", data);
console.log("项目状态字段传递", projectStatus, projectEndTime); // console.log("项目状态字段传递", projectStatus, projectEndTime);
const teacherInfo = useUserInfo(computed(() => data.value?.planDto?.teacherId)); const teacherInfo = useUserInfo(computed(() => data.value?.planDto?.teacherId));

View File

@@ -102,18 +102,9 @@ const returnclick = () => {
router.back(); router.back();
}; };
const { const {
query: { query: { courseId: workId, type, id: taskId, infoId },
courseId: workId,
type,
id: taskId,
pName,
sName,
projectStatus,
projectEndTime,
infoId,
},
} = useRoute(); } = useRoute();
console.log("type", type); // console.log("type", type);
const { data } = const { data } =
taskId && taskId !== "undefined" taskId && taskId !== "undefined"
? useRequest(TASK_WORK_DETAIL, { workId, taskId }) ? useRequest(TASK_WORK_DETAIL, { workId, taskId })

View File

@@ -312,7 +312,7 @@ const commitClick = () => {
}); });
router.push({ router.push({
path: "/surveydetail", path: "/investigatpage",
query: { query: {
courseId: data.value.assessmentId, courseId: data.value.assessmentId,
infoId: data.value.liveId, infoId: data.value.liveId,

View File

@@ -72,17 +72,17 @@ const {
status, status,
chapterOrStageId, chapterOrStageId,
infoId, infoId,
studentId,
}, },
} = useRoute(); } = useRoute();
const router = useRouter(); const router = useRouter();
console.log("外链信息", linkId); console.log("外链信息", linkId);
const { data } = useRequest(LINK_DETAILS(linkId)); const { data } = useRequest(LINK_DETAILS(linkId));
console.log("外链信息", data); console.log("外链信息", data);
const userInfo = computed(() => store.state.userInfo);
const goOuterChain = () => { const goOuterChain = () => {
status != 1 && status != 1 &&
request(STUDY_RECORD, { request(STUDY_RECORD, {
studentId: studentId, studentId: userInfo.value.id,
targetId: infoId, targetId: infoId,
logo: type, logo: type,
stageOrChapterId: chapterOrStageId, stageOrChapterId: chapterOrStageId,

View File

@@ -138,7 +138,7 @@ const returnclick = () => {
}; };
const { data } = useRequest(ROUTER_PROCESS, { routerId }); const { data } = useRequest(ROUTER_PROCESS, { routerId });
const userInfo = computed(() => store.state.userInfo); const userInfo = computed(() => store.state.userInfo);
console.log("lalalallala", data); console.log("lalalallala", data, userInfo);
const activeName = ref("first"); const activeName = ref("first");
const handleClick = (tab, event) => { const handleClick = (tab, event) => {

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-19 11:28:11 * @Date: 2023-01-19 11:28:11
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-02-06 16:35:56 * @LastEditTime: 2023-02-07 16:01:06
* @FilePath: /stu_h5/src/views/projectdetails/ProjectPath.vue * @FilePath: /stu_h5/src/views/projectdetails/ProjectPath.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
@@ -179,14 +179,14 @@ const handleClick = (tab, event) => {
console.log("selectTab", selectTab.value); console.log("selectTab", selectTab.value);
}; };
const goDetails = () => { const goDetails = () => {
router.push({
path: "/pathmappage",
query: { routerId: 290 },
});
// router.push({ // router.push({
// path: "/projectdetails", // path: "/pathmappage",
// query: { projectId: 3 }, // query: { routerId: 290 },
// }); // });
router.push({
path: "/projectdetails",
query: { projectId: 485 },
});
}; };
</script> </script>

View File

@@ -228,7 +228,7 @@ const types = ref({
5: import.meta.env.VITE_BOE_EXAM_DETAIL_URL, //考试 5: import.meta.env.VITE_BOE_EXAM_DETAIL_URL, //考试
// 5: "/externalexam", // 5: "/externalexam",
6: "/livebroadcast", 6: "/livebroadcast",
7: ({ targetId }) => window.open(targetId, "_top"), 7: "/outerchain", //外联
8: "/discusspage", 8: "/discusspage",
9: "/moreactive", 9: "/moreactive",
// 10: ({ evaType, targetId }) => // 10: ({ evaType, targetId }) =>
@@ -241,7 +241,7 @@ const types = ref({
// "_top" // "_top"
// ), //测评 // ), //测评
10: "/evaluation", //测评 10: "/evaluation", //测评
11: "/surveydetail", 11: "/investigatpage",
12: "/ballotpage", 12: "/ballotpage",
13: "/projectdetails", 13: "/projectdetails",
}, },