mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-10 03:16:47 +08:00
feat:增加项目列表
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2022-11-21 17:28:10
|
||||
* @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
|
||||
* @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 { onMounted } from "vue";
|
||||
import router from "@/router";
|
||||
console.log("版本0.9.1------------");
|
||||
console.log("版本0.9.2------------");
|
||||
const store = useStore();
|
||||
onMounted(() => {
|
||||
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
|
||||
* @Date: 2022-12-18 15:56:03
|
||||
* @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
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
-->
|
||||
@@ -49,7 +49,7 @@
|
||||
</button>
|
||||
<button class="searchBtn" @click="resetClick">重置</button>
|
||||
</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">
|
||||
<img
|
||||
style="width: 253px; height: 144px; border-radius: 4px"
|
||||
@@ -101,6 +101,21 @@
|
||||
已结束
|
||||
</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>
|
||||
</template>
|
||||
@@ -116,48 +131,75 @@ import {
|
||||
|
||||
import { useRouter } from "vue-router";
|
||||
import store from "@/store";
|
||||
import { toDate } from "../../api/method";
|
||||
const projectClassify = [];
|
||||
const studyProgress = [];
|
||||
const pageSize = ref("");
|
||||
const currentPage = ref("");
|
||||
const projectTotal = ref("");
|
||||
|
||||
//搜索--------------start-----------------------------------------
|
||||
const projectList = ref([]); //项目列表
|
||||
const pageSize = ref(60); //每页条数
|
||||
const currentPage = ref(1); //当前页数
|
||||
const projectTotal = ref(""); //项目总数
|
||||
const projectname = 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 = () => {
|
||||
console.log("点击搜索", projectname.value, searchTime.value);
|
||||
let beginTime = null;
|
||||
let endTime = null;
|
||||
|
||||
if (searchTime.value) {
|
||||
beginTime = new Date(searchTime.value[0]).getTime();
|
||||
endTime = new Date(searchTime.value[1]).getTime();
|
||||
beginTime.value = toDate(
|
||||
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);
|
||||
request(PROJECT_LIST, {
|
||||
// beginTime: beginTime,
|
||||
// endTime: endTime,
|
||||
key: projectname.value,
|
||||
pageNo: currentPage,
|
||||
pageSize: pageSize,
|
||||
}).then(() => {
|
||||
commonFetch();
|
||||
});
|
||||
console.log("beginTime", beginTime.value, endTime.value);
|
||||
getProject();
|
||||
};
|
||||
//重置
|
||||
const resetClick = () => {
|
||||
searchTime.value = "";
|
||||
projectname.value = "";
|
||||
currentPage.value = 1;
|
||||
beginTime.value = "";
|
||||
endTime.value = "";
|
||||
getProject();
|
||||
console.log("点击重置");
|
||||
};
|
||||
//搜索--------------end-----------------------------------------
|
||||
const userInfo = computed(() => store.state.userInfo);
|
||||
const { data } = usePage(PROJECT_LIST, {});
|
||||
console.log("datadata", data);
|
||||
const router = useRouter();
|
||||
|
||||
const goProjectDetails = (value) => {
|
||||
router.push({
|
||||
path: "/projectdetails",
|
||||
|
||||
@@ -164,7 +164,7 @@ import store from "@/store";
|
||||
|
||||
const detail = ref();
|
||||
const userInfo = computed(() => store.state.userInfo);
|
||||
const { data } = usePage(ROUTER_LIST, {});
|
||||
const { data } = usePage(ROUTER_LIST, { pageSize: 60 });
|
||||
console.log("datadata", data);
|
||||
const router = useRouter();
|
||||
const returnclick = () => {
|
||||
@@ -193,7 +193,11 @@ async function gofun({ routerId, name: routerName }) {
|
||||
path: "/pathdetails",
|
||||
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() {}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user