mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-13 04:46:48 +08:00
feat:增加项目列表
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lixg lixg@dongwu-inc.com
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
* @Date: 2022-11-21 17:28:10
|
* @Date: 2022-11-21 17:28:10
|
||||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
* @LastEditTime: 2022-12-15 11:54:03
|
* @LastEditTime: 2022-12-19 14:24:01
|
||||||
* @FilePath: /fe-stu/src/App.vue
|
* @FilePath: /fe-stu/src/App.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
|
||||||
-->
|
-->
|
||||||
@@ -42,7 +42,7 @@ import { GET_USER_INFO } from "@/api/ThirdApi";
|
|||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
console.log("版本0.9.1------------");
|
console.log("版本0.9.2------------");
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
|
|||||||
40
src/api/method.js
Normal file
40
src/api/method.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
|
* @Date: 2022-12-19 11:35:37
|
||||||
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
|
* @LastEditTime: 2022-12-19 11:38:29
|
||||||
|
* @FilePath: /fe-stu/src/views/project/method.js
|
||||||
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
|
*/
|
||||||
|
// 修改时间格式---------start-----------------------------
|
||||||
|
function formatNumber(n) {
|
||||||
|
n = n.toString();
|
||||||
|
return n[1] ? n : "0" + n;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toDate(number, format) {
|
||||||
|
var formateArr = ["Y", "M", "D", "h", "m", "s"];
|
||||||
|
var returnArr = [];
|
||||||
|
|
||||||
|
if (number === 0) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
var date = new Date(number * 1000);
|
||||||
|
}
|
||||||
|
returnArr.push(date.getFullYear());
|
||||||
|
returnArr.push(formatNumber(date.getMonth() + 1));
|
||||||
|
returnArr.push(formatNumber(date.getDate()));
|
||||||
|
|
||||||
|
returnArr.push(formatNumber(date.getHours()));
|
||||||
|
returnArr.push(formatNumber(date.getMinutes()));
|
||||||
|
returnArr.push(formatNumber(date.getSeconds()));
|
||||||
|
|
||||||
|
for (var i in returnArr) {
|
||||||
|
format = format.replace(formateArr[i], returnArr[i]);
|
||||||
|
}
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
// 修改时间格式---------end-----------------------------
|
||||||
|
export {
|
||||||
|
toDate
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lixg lixg@dongwu-inc.com
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
* @Date: 2022-12-18 15:56:03
|
* @Date: 2022-12-18 15:56:03
|
||||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
* @LastEditTime: 2022-12-18 23:02:05
|
* @LastEditTime: 2022-12-19 14:15:43
|
||||||
* @FilePath: /fe-stu/src/views/project/ProjectList.vue
|
* @FilePath: /fe-stu/src/views/project/ProjectList.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
|
||||||
-->
|
-->
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button class="searchBtn" @click="resetClick">重置</button>
|
<button class="searchBtn" @click="resetClick">重置</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="projectList" v-for="(i, k) in data" :key="k">
|
<div class="projectList" v-for="(i, k) in projectList" :key="k">
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<img
|
<img
|
||||||
style="width: 253px; height: 144px; border-radius: 4px"
|
style="width: 253px; height: 144px; border-radius: 4px"
|
||||||
@@ -101,6 +101,21 @@
|
|||||||
已结束
|
已结束
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div
|
||||||
|
style="display: flex; justify-content: center; margin-top: 30px"
|
||||||
|
v-if="projectTotal > 10"
|
||||||
|
>
|
||||||
|
<div class="demo-pagination-block">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="currentPage"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:small="small"
|
||||||
|
layout="prev, pager, next, jumper"
|
||||||
|
:total="projectTotal"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -116,48 +131,75 @@ import {
|
|||||||
|
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import { toDate } from "../../api/method";
|
||||||
const projectClassify = [];
|
const projectClassify = [];
|
||||||
const studyProgress = [];
|
const studyProgress = [];
|
||||||
const pageSize = ref("");
|
const projectList = ref([]); //项目列表
|
||||||
const currentPage = ref("");
|
const pageSize = ref(60); //每页条数
|
||||||
const projectTotal = ref("");
|
const currentPage = ref(1); //当前页数
|
||||||
|
const projectTotal = ref(""); //项目总数
|
||||||
//搜索--------------start-----------------------------------------
|
|
||||||
const projectname = ref(""); //项目名称
|
const projectname = ref(""); //项目名称
|
||||||
const searchTime = ref(""); //选择时间
|
const searchTime = ref(""); //选择时间
|
||||||
|
const beginTime = ref(""); //结束时间
|
||||||
|
const endTime = ref(""); //开始时间
|
||||||
|
|
||||||
|
const userInfo = computed(() => store.state.userInfo);
|
||||||
|
|
||||||
|
//获取项目列表--------start------------------------------------
|
||||||
|
const getProject = () => {
|
||||||
|
request(PROJECT_LIST, {
|
||||||
|
beginTime: beginTime.value,
|
||||||
|
endTime: endTime.value,
|
||||||
|
key: projectname.value,
|
||||||
|
pageNo: currentPage.value,
|
||||||
|
pageSize: pageSize.value,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log("获取成功", res);
|
||||||
|
if (res.code === 200) {
|
||||||
|
projectList.value = res.data.rows;
|
||||||
|
projectTotal.value = Number(res.data.total);
|
||||||
|
console.log("projectTotal.value", projectTotal.value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("获取失败", err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
getProject();
|
||||||
|
|
||||||
|
//获取项目列表--------end------------------------------------
|
||||||
|
//搜索--------------start-----------------------------------------
|
||||||
|
|
||||||
//搜索
|
//搜索
|
||||||
const searchClick = () => {
|
const searchClick = () => {
|
||||||
console.log("点击搜索", projectname.value, searchTime.value);
|
console.log("点击搜索", projectname.value, searchTime.value);
|
||||||
let beginTime = null;
|
|
||||||
let endTime = null;
|
|
||||||
if (searchTime.value) {
|
if (searchTime.value) {
|
||||||
beginTime = new Date(searchTime.value[0]).getTime();
|
beginTime.value = toDate(
|
||||||
endTime = new Date(searchTime.value[1]).getTime();
|
new Date(searchTime.value[0]).getTime() / 1000,
|
||||||
|
"Y-M-D h:m:s"
|
||||||
|
);
|
||||||
|
endTime.value = toDate(
|
||||||
|
new Date(searchTime.value[1]).getTime() / 1000,
|
||||||
|
"Y-M-D h:m:s"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
console.log("beginTime", beginTime, endTime);
|
console.log("beginTime", beginTime.value, endTime.value);
|
||||||
request(PROJECT_LIST, {
|
getProject();
|
||||||
// beginTime: beginTime,
|
|
||||||
// endTime: endTime,
|
|
||||||
key: projectname.value,
|
|
||||||
pageNo: currentPage,
|
|
||||||
pageSize: pageSize,
|
|
||||||
}).then(() => {
|
|
||||||
commonFetch();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
//重置
|
//重置
|
||||||
const resetClick = () => {
|
const resetClick = () => {
|
||||||
searchTime.value = "";
|
searchTime.value = "";
|
||||||
projectname.value = "";
|
projectname.value = "";
|
||||||
|
currentPage.value = 1;
|
||||||
|
beginTime.value = "";
|
||||||
|
endTime.value = "";
|
||||||
|
getProject();
|
||||||
console.log("点击重置");
|
console.log("点击重置");
|
||||||
};
|
};
|
||||||
//搜索--------------end-----------------------------------------
|
//搜索--------------end-----------------------------------------
|
||||||
const userInfo = computed(() => store.state.userInfo);
|
|
||||||
const { data } = usePage(PROJECT_LIST, {});
|
|
||||||
console.log("datadata", data);
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const goProjectDetails = (value) => {
|
const goProjectDetails = (value) => {
|
||||||
router.push({
|
router.push({
|
||||||
path: "/projectdetails",
|
path: "/projectdetails",
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ import store from "@/store";
|
|||||||
|
|
||||||
const detail = ref();
|
const detail = ref();
|
||||||
const userInfo = computed(() => store.state.userInfo);
|
const userInfo = computed(() => store.state.userInfo);
|
||||||
const { data } = usePage(ROUTER_LIST, {});
|
const { data } = usePage(ROUTER_LIST, { pageSize: 60 });
|
||||||
console.log("datadata", data);
|
console.log("datadata", data);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const returnclick = () => {
|
const returnclick = () => {
|
||||||
@@ -193,7 +193,11 @@ async function gofun({ routerId, name: routerName }) {
|
|||||||
path: "/pathdetails",
|
path: "/pathdetails",
|
||||||
query: { routerId, routerName },
|
query: { routerId, routerName },
|
||||||
})
|
})
|
||||||
:window.open(`http://u-pre.boe.com/pc/forward?to=/fe-student/pathdetails¶ms=${encodeURIComponent(`routerId=${routerId}&routerName=${routerName}`)}`)
|
: window.open(
|
||||||
|
`http://u-pre.boe.com/pc/forward?to=/fe-student/pathdetails¶ms=${encodeURIComponent(
|
||||||
|
`routerId=${routerId}&routerName=${routerName}`
|
||||||
|
)}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
function toUnTask() {}
|
function toUnTask() {}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user