添加moment时间格式化

duhanyu
杜函宇 2 years ago
parent d1bae0273e
commit 4d2f172a71

@ -48,6 +48,7 @@
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"jsencrypt": "3.0.0-rc.1",
"moment": "^2.29.4",
"nprogress": "0.2.0",
"postcss-px2rem": "^0.3.0",
"quill": "1.3.7",

@ -15,6 +15,10 @@ import router from './router'
import directive from './directive' // directive
import plugins from './plugins' // plugins
import { download } from '@/utils/request'
import moment from "moment";
import "moment/locale/zh-cn";
moment.locale("zh-cn");
Vue.prototype.$moment = moment;
import './assets/icons' // icon
import './permission' // permission control

@ -3,44 +3,74 @@
<div class="titleInput" ref="titleInput">
<el-input
placeholder="请输入国籍"
v-model="form.nationalityRange"
v-model="afterParams.nationalityRange"
class="input-with-select"
>
<el-button slot="append" icon="el-icon-search"></el-button>
<el-button
slot="append"
icon="el-icon-search"
@click="search"
></el-button>
</el-input>
</div>
<div class="peopleContent" v-loading="loads">
<div class="subMan" v-for="(item, index) in arrList" :key="index">
<div class="leftSub">
<div
class="leftAvatar"
:style="`background-image:url('${require('../../../../assets/images/profile.jpg')}')`"
></div>
<div class="leftName">
<div>周爱</div>
<div class="mainTag">
<div>{{ item.ageRange }}</div>
<div>
{{ item.sexRange }}
<div v-loading="loads">
<div class="peopleContent" v-if="arrList.length > 0">
<div class="subMan" v-for="(item, index) in arrList" :key="index">
<div class="leftSub">
<div
class="leftAvatar"
:style="`background-image:url('${require('../../../../assets/images/profile.jpg')}')`"
></div>
<div class="leftName">
<div>周爱</div>
<div class="mainTag">
<div>{{ item.ageRange }}</div>
<div>
{{ item.sexRange }}
</div>
<div>{{ item.educationRange }}</div>
</div>
<div>{{ item.educationRange }}</div>
</div>
</div>
</div>
<div class="rightSub">
<div class="lookDetail">查看</div>
<div class="rightSub">
<div class="lookDetail" @click="looks(item.id)"></div>
</div>
</div>
</div>
<div v-else class="noneStyle" >暂无数据</div>
</div>
<div class="pagination" ref="pagination">
<my-pagination :total="total" @pagesChange="pagesChange"></my-pagination>
</div>
<!-- 查看该人员的详情 -->
<el-dialog
:visible.sync="peopelDetail"
width="40%"
@close="cancel"
:destroy-on-close="true"
>
<div slot="title">
<div class="titleText">查看人员详情</div>
</div>
<div class="center-content">
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item
v-for="(item, index) in beforeData"
:key="index"
>
<template slot="label"> {{ item.name }} </template>
{{ item.value }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-dialog>
</div>
</template>
<script>
import { peopleList, peopleGet } from "@/api/volunteer/hdgl";
import myPagination from "@/views/components/myPagination/index.vue";
import { peopleList } from "@/api/volunteer/hdgl";
export default {
data() {
return {
@ -48,20 +78,95 @@ export default {
form: {
pageSize: 10,
pageNum: 1,
},
afterParams: {
nationalityRange: "",
},
total: 0,
loads: false,
//=========
peopelDetail: false,
beforeData: [
{
name: "年龄",
label: "ageRange",
value: "",
},
{
name: "文化程度",
label: "educationRange",
value: "",
},
{
name: "小区",
label: "housingRange",
value: "",
},
{
name: "行业类型",
label: "industryRange",
value: "",
},
{
name: "兴趣爱好",
label: "interestRange",
value: "",
},
{
name: "国籍",
label: "nationalityRange",
value: "",
},
{
name: "政治面貌",
label: "politicalRange",
value: "",
},
{
name: "专业类型",
label: "professionalRange",
value: "",
},
{
name: "院校",
label: "schoolRange",
value: "",
},
{
name: "性别",
label: "sexRange",
value: "",
},
],
};
},
created() {
this.getList();
},
methods: {
cancel() {
this.peopelDetail = false;
},
looks(e) {
peopleGet(e).then((res) => {
this.beforeData.forEach((value, index) => {
for (let key in res.data) {
if (value.label == key) {
this.beforeData[index].value = res.data[key];
}
}
});
this.peopelDetail = true;
});
},
search() {
this.form = { ...this.form, ...this.afterParams };
this.getList();
},
getList() {
this.loads = true;
peopleList().then((res) => {
console.log(res);
peopleList(this.form).then((res) => {
this.arrList = res.rows;
this.total = res.total;
this.loads = false;
@ -82,6 +187,63 @@ export default {
</script>
<style lang="scss" scoped>
.noneStyle {
height: 490px;
margin-bottom: 12px;
display: flex;
align-items: center;
justify-content: center;
font-family: "Alibaba-PuHuiTi-Medium.otf";
color: #606266;
font-size: 14px;
}
.center-content {
padding: 20px 30px;
}
::v-deep .margin-top td {
font-family: "Alibaba-PuHuiTi-Regular";
}
::v-deep .margin-top th {
font-family: "Alibaba-PuHuiTi-Regular";
width: 20%;
}
::v-deep .el-dialog {
border-radius: 10px;
margin-bottom: 20px;
}
::v-deep .el-dialog__header {
padding: 10px;
padding-left: 15px;
background: #f7f5f5;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
::v-deep .el-dialog__body {
padding: 0;
}
::v-deep .el-dialog__footer {
padding: 0;
}
::v-deep .el-dialog__headerbtn {
top: 12px;
}
.titleText {
font-family: "Alibaba-PuHuiTi-Regular";
font-weight: bold;
color: #4c4949;
padding-left: 15px;
font-size: 16px;
position: relative;
&::before {
position: absolute;
top: 3.8px;
left: 0;
content: "";
width: 5px;
height: 15px;
background: #f8414d;
}
}
::v-deep .titleInput .el-input__inner {
border-right: none;
}

@ -54,7 +54,16 @@
show-overflow-tooltip
>
</el-table-column>
<el-table-column prop="duration" label="活动状态" align="center">
<el-table-column prop="endTime" label="活动状态" align="center">
<template slot-scope="scope">
<div
:class="
$moment().isAfter(scope.row.endTime) ? 'color1' : 'color2'
"
>
{{ $moment().isAfter(scope.row.endTime) ? "停止" : "进行中" }}
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
@ -240,6 +249,7 @@
></el-input>
</el-form-item>
</div>
<div class="inputBox">
<el-form-item label="院校:" prop="schoolRange">
<el-input
@ -480,6 +490,12 @@ export default {
};
</script>
<style lang="scss" scoped>
.color1 {
color: #f71052;
}
.color2 {
color: #23b06c;
}
.titlePagin {
margin: 12px 0;
display: flex;

Loading…
Cancel
Save