@@ -15,7 +15,7 @@ const assemblyHallPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/assembly-hall/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -26,7 +26,7 @@ const mediatorPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/mediator/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -37,7 +37,7 @@ const mediatorGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/mediator/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -49,7 +49,7 @@ const seekHelpPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/seek-help/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -60,7 +60,7 @@ const seekHelpCreateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/seek-help/create', | |||
method: 'post', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -72,23 +72,25 @@ const seekHelpGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/seek-help/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
const massesDetailUpdate = function(data) { | |||
// 点单状态变化如:接单 | |||
return request({ | |||
url: '/admin-api/people/seek-help/update', | |||
method: 'put', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
const seekHelpApi = function(data) { | |||
// 点单 进行帮助 | |||
return request({ | |||
url: `/admin-api/people/seek-help/help/${data.id}`, | |||
method: 'put', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -99,7 +101,7 @@ const lawsRegulationPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/laws-regulation/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -111,7 +113,7 @@ const lawsRegulationGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/laws-regulation/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -123,7 +125,7 @@ const casesListApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/cases/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -135,7 +137,7 @@ const getCasesIdApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/cases/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -147,7 +149,7 @@ const createCasesApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/cases/create', | |||
method: 'post', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -159,7 +161,7 @@ const newsGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/news/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -171,7 +173,7 @@ const hospitalPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/hospital/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -183,7 +185,7 @@ const hospitalGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/hospital/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -194,7 +196,7 @@ const doctorPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/doctor/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -206,7 +208,7 @@ const assemblyIdApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/assemblymen/create', | |||
method: 'post', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -218,7 +220,7 @@ const assemblyhallIdApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/assembly-hall/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -230,7 +232,7 @@ const commentPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/comment/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -242,7 +244,7 @@ const commentCreateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/comment/create', | |||
method: 'post', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -254,7 +256,7 @@ const assemblyHallGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/assembly-hall/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -265,7 +267,7 @@ const partyBranchApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-branch/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -277,7 +279,7 @@ const newsPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/news/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -289,7 +291,7 @@ const partyBranchGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-branch/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -300,7 +302,7 @@ const excellentPartMemberPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/excellent-party-member/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -312,7 +314,7 @@ const deptListApi = function(data) { | |||
return request({ | |||
url: '/admin-api/system/dept/list', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -324,7 +326,7 @@ const excellentPartMemberGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/excellent-party-member/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -336,7 +338,7 @@ const agencyPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/agency/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -348,7 +350,7 @@ const villageAffairsPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/village-affairs/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -360,7 +362,7 @@ const agencyContentPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/agency-content/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -372,7 +374,7 @@ const CrateAppraiseApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/seek-help/appraise', | |||
method: 'put', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -384,7 +386,7 @@ const agencyContentGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/agency-content/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -396,7 +398,7 @@ const agencyGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/agency/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -408,7 +410,7 @@ const agencyContentGetOrgIdApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/agency-content/getOrgId', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -420,7 +422,7 @@ const villageAffairsGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/village-affairs/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -432,7 +434,7 @@ const partyEventPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-event/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -444,7 +446,7 @@ const partyEventGetApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-event/get', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -456,7 +458,7 @@ const patientCreateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/patient/create', | |||
method: 'post', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -467,7 +469,7 @@ const getGridListApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/grid/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
/** | |||
@@ -478,7 +480,7 @@ const getGridMemberListApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/grid-member/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
@@ -487,11 +489,135 @@ const activityPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/activity/page', | |||
method: 'get', | |||
data: data | |||
data: data, | |||
}); | |||
}; | |||
// 活动风采-详情 | |||
const activityDetailApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/activity/get', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 党员注册 | |||
const partyMemberCreate = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-member/create', | |||
method: 'POST', | |||
data: data, | |||
}); | |||
}; | |||
// 党员详情 | |||
const partyMemberInfoApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-member/info', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 党员修改 | |||
const partyMemberUpdate = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-member/update', | |||
method: 'put', | |||
data: data, | |||
}); | |||
}; | |||
// 志愿服务 | |||
const volunteerProjectApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/volunteer-project/page', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 志愿服务-详情 | |||
const getVolunteerProjectApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/volunteer-project/get', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 志愿服务-发布 | |||
const getVolunteerProjectCreateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/volunteer-project/create', | |||
method: 'post', | |||
data: data, | |||
}); | |||
}; | |||
// 志愿服务-详情 | |||
// const getVolunteerProjectApi = function (data) { | |||
// return request({ | |||
// url: '/admin-api/people/volunteer-project/get', | |||
// method: 'get', | |||
// data: data, | |||
// }); | |||
// }; | |||
// 党组织 | |||
const partyOrganizationAllApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-organization/list-all', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 党组织-修改 | |||
const partyOrganizationCreateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-organization/create', | |||
method: 'post', | |||
data: data, | |||
}); | |||
}; | |||
// 党组织-修改 | |||
const partyOrganizationUpdateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-organization/update', | |||
method: 'put', | |||
data: data, | |||
}); | |||
}; | |||
// 党组织-详情 | |||
const partyOrganizationInfoApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/party-organization/info', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 志愿服务申领列表 | |||
const applyVolunteerProjecPageApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/apply-volunteer-project/page', | |||
method: 'get', | |||
data: data, | |||
}); | |||
}; | |||
// 志愿服务申领列表 | |||
const applyVolunteerProjecCreateApi = function(data) { | |||
return request({ | |||
url: '/admin-api/people/apply-volunteer-project/create', | |||
method: 'post', | |||
data: data, | |||
}); | |||
}; | |||
export { | |||
assemblyHallPageApi, | |||
@@ -535,5 +661,18 @@ export { | |||
patientCreateApi, | |||
getGridListApi, | |||
getGridMemberListApi, | |||
activityPageApi | |||
activityPageApi, | |||
activityDetailApi, | |||
partyMemberCreate, | |||
volunteerProjectApi, | |||
getVolunteerProjectApi, | |||
partyOrganizationAllApi, | |||
partyOrganizationCreateApi, | |||
partyOrganizationUpdateApi, | |||
getVolunteerProjectCreateApi, | |||
applyVolunteerProjecPageApi, | |||
applyVolunteerProjecCreateApi, | |||
partyOrganizationInfoApi, | |||
partyMemberInfoApi, | |||
partyMemberUpdate, | |||
}; |
@@ -0,0 +1,86 @@ | |||
<template> | |||
<view> | |||
<custom-nav-bar position="fixed" color="black" left-text="" left-arrow /> | |||
<view class="dateil"> | |||
<view class="title multi-line">{{detailObj.activityTitle}}</view> | |||
<view class="flex flex-v-center"> | |||
<view class="nickName">发布人:{{detailObj.userName}}</view> | |||
<view class="time">{{getDateTime(detailObj.createTime,1)}}</view> | |||
</view> | |||
<view class="line"></view> | |||
<mp-html class="rich-text" :content="detailObj.activityContent" /> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import * as peopleApi from '@/api/peopleApi'; | |||
import * as publicApi from '@/api/publicApi'; | |||
import utils from '@/utils/util.map' | |||
export default { | |||
data() { | |||
return { | |||
options: {}, | |||
detailObj: {}, | |||
} | |||
}, | |||
onLoad(options) { | |||
this.options = options; | |||
this.activityDetail(); | |||
}, | |||
methods: { | |||
getDateTime(time) { | |||
return utils.getDateTime(time, 1) | |||
}, | |||
async activityDetail() { | |||
const that = this; | |||
const res = await peopleApi.activityDetailApi({ | |||
id: this.options.id, | |||
}); | |||
if (res.data) { | |||
that.detailObj = res.data | |||
} | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
.dateil { | |||
padding: 10rpx 40rpx; | |||
.title { | |||
font-size: 34rpx; | |||
font-weight: 500; | |||
color: #333333; | |||
} | |||
.nickName { | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #FF7F34; | |||
margin-top: 32rpx; | |||
margin-right: 32rpx; | |||
} | |||
.time { | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #999999; | |||
margin-top: 32rpx; | |||
} | |||
.line { | |||
margin: 40rpx 0 32rpx 0; | |||
height: 1px; | |||
background: #EFEFEF; | |||
} | |||
.rich-text { | |||
line-height: 54rpx; | |||
} | |||
} | |||
</style> |
@@ -12,36 +12,49 @@ | |||
</view> | |||
</view> | |||
<view class="activity"> | |||
<block v-for="(item,index) in 7" :key="index"> | |||
<view class="activity" v-if="newsPageList.length !== 0"> | |||
<block v-for="(item,index) in newsPageList" :key="index"> | |||
<view class="activity-item" @click="headerDetail(item)"> | |||
<image class="activity-image" src="/src/images/share-icon.png" mode=""></image> | |||
<image class="activity-image" :src="item.activityCoverImg" mode="aspectFill"></image> | |||
<view class="activity-type" v-if="index < 5" :class="`activity-type${index}`">NO.{{index+1}}</view> | |||
<view class="activity-title">惠苑路社区西南角家乐福超市对面xxxxx</view> | |||
<view class="activity-time">2023-11-23 周四</view> | |||
<view class="activity-title multi-line">{{item.activityTitle}}</view> | |||
<view class="activity-time">{{getDateTime(item.createTime)}}</view> | |||
<view class="activity-rigth"> | |||
<text>发布者的名字</text> | |||
<image src="/src/static/logo.png" mode=""></image> | |||
<text>{{item.userName}}</text> | |||
<image :src="item.avatar || '@/images/default-avatar.png'" mode=""></image> | |||
</view> | |||
</view> | |||
</block> | |||
</view> | |||
<van-empty | |||
<van-empty v-else | |||
image="https://jiexiu.xuqidata.com:8083/jiexiujumin/e1bb4242ccc209c332b84a3fde862cc156b31634152d5df503642438bfdded50.png" | |||
:image-size="['78%','100%']" description="没有找到您要查询的信息" /> | |||
</view> | |||
</template> | |||
<script> | |||
import * as peopleApi from '@/api/peopleApi'; | |||
import * as publicApi from '@/api/publicApi'; | |||
import utils from '@/utils/util.map' | |||
export default { | |||
data() { | |||
return { | |||
searchValue: '' | |||
option: {}, | |||
searchValue: '', | |||
newsPageList: [] | |||
} | |||
}, | |||
onLoad(option) { | |||
this.option = option | |||
this.merchantPageApi(false) | |||
}, | |||
methods: { | |||
getDateTime(time) { | |||
return utils.getDateTime(time, 2) | |||
}, | |||
onSearch(e) { | |||
this.searchValue = e.detail.value | |||
if (e.detail.value !== '') { | |||
return; | |||
} | |||
@@ -52,6 +65,50 @@ | |||
this.searchValue = e.detail.value | |||
this.merchantPageApi(); | |||
}, | |||
// 分页参数处理事件 | |||
generalQueryData(reset = false) { | |||
const { | |||
pageNo, | |||
pageSize, | |||
} = this; | |||
const params = { | |||
pageNo: 1, | |||
pageSize: 14, | |||
}; | |||
if (reset) { | |||
return params; | |||
} | |||
return { | |||
...params, | |||
pageNo: pageNo + 1, | |||
pageSize | |||
}; | |||
}, | |||
async merchantPageApi(reset = true) { | |||
const params = this.generalQueryData(reset); | |||
const param = { | |||
pageNo: 1, | |||
pageSize: 10, | |||
}; | |||
if (this.searchValue) { | |||
param.key = this.searchValue; | |||
} | |||
const res = await peopleApi.activityPageApi(param); | |||
if (res.data) { | |||
this.newsPageList = res.data.list | |||
} | |||
}, | |||
headerDetail(item) { | |||
uni.navigateTo({ | |||
url: './detail?id=' + item.id | |||
}) | |||
} | |||
}, | |||
onReachBottom() { | |||
if (this.newsPageList.length === this.total) { | |||
return; | |||
} | |||
this.merchantPageApi(false); | |||
} | |||
} | |||
</script> | |||
@@ -128,17 +185,11 @@ | |||
height: 180rpx; | |||
} | |||
.activity-title { | |||
margin-top: 16rpx; | |||
font-size: 30rpx; | |||
font-weight: 400; | |||
color: #000000; | |||
} | |||
.activity-title { | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #999999; | |||
color: #000000; | |||
padding: 0 16rpx; | |||
} | |||
.activity-time { | |||
@@ -146,6 +197,7 @@ | |||
font-weight: 400; | |||
margin-top: 8rpx; | |||
color: #999999; | |||
padding: 0 16rpx; | |||
} | |||
.activity-rigth { | |||
@@ -182,7 +234,7 @@ | |||
} | |||
.activity-type0 { | |||
background: linear-gradient(291deg, #0A992D 0%, #11D03E 100%); | |||
background: linear-gradient(270deg, #E71E00 0%, #FF5E33 100%); | |||
} | |||
.activity-type1 { | |||
@@ -208,7 +260,7 @@ | |||
} | |||
.van-empty__image { | |||
width: 75%; | |||
width: 75% !important; | |||
height: 100%; | |||
} | |||
</style> |
@@ -6,23 +6,34 @@ | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>单位名称</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.workName" type="text" | |||
data-name="workName" placeholder="请输入单位名称" /> | |||
<block v-else>{{form.workName}}</block> | |||
</view> | |||
<view class="form-body"> | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>支部名称</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
<block v-if="!disabled"> | |||
<picker @change="bindPickerChange" range-key="label" data-list="educationList" data-name="branchName" | |||
:value="form.branchName" :range="educationList"> | |||
<view style="color: #000000" v-if="form.branchName !== ''">{{ form.branchName }} | |||
</view> | |||
<view style="color: #999" v-if="form.branchName === ''">请选择支部名称</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</block> | |||
<block v-else> | |||
<view style="color: #000000" v-if="educationList.length !== 0">{{ form.branchName }} | |||
</view> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -30,59 +41,81 @@ | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>单位地址</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.workAddress" type="text" | |||
data-name="workAddress" placeholder="请输入单位地址" /> | |||
<block v-else> | |||
{{form.workAddress}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>支部书记</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.secretaryName" | |||
type="text" data-name="secretaryName" placeholder="请输入支部书记" /> | |||
<block v-else> | |||
{{form.secretaryName}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>联系方式</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.secretaryMobile" | |||
type="text" data-name="secretaryMobile" placeholder="请输入联系方式" /> | |||
<block v-else> | |||
{{form.secretaryMobile}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>党建联系人</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.partyBuildName" | |||
type="text" data-name="partyBuildName" placeholder="请输入党建联系人" /> | |||
<block v-else> | |||
{{form.partyBuildName}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>联系方式</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.partyBuildMobile" | |||
type="text" data-name="partyBuildMobile" placeholder="请输入联系方式" /> | |||
<block v-else> | |||
{{form.partyBuildMobile}} | |||
</block> | |||
</view> | |||
<view class="form-body"> | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>结对共建社区</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
<block v-if="!disabled"> | |||
<view :class="form.communityId ? 'picker-line' : 'picker-text'" data-name="结对共建社区" @tap="onOpenVisible"> | |||
{{ form.communityName }} | |||
</view> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</block> | |||
<block v-else> | |||
{{form.communityName}} | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -91,13 +124,18 @@ | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>结对共建小区</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
<block v-if="!disabled"> | |||
<view :class="form.villageId ? 'picker-line' : 'picker-text'" data-name="结对共建小区" @tap="onOpenVisible"> | |||
{{ form.villageName }} | |||
</view> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</block> | |||
<block v-else> | |||
{{form.villageName}} | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -105,64 +143,251 @@ | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>支部党员人数</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input class="flex1 textarea-class" v-if="!disabled" @input="headleInput" :value="form.partyMemberNum" | |||
type="text" data-name="partyMemberNum" placeholder="请输入支部党员人数" /> | |||
<block v-else> | |||
{{form.partyMemberNum}} | |||
</block> | |||
</view> | |||
<view class="form-button"> | |||
<van-button v-if="checked" @click="submit" block color="#FE3B53">提交</van-button> | |||
<van-button v-else disabled block color="#C1C1C1">提交</van-button> | |||
<block v-if="!disabled"> | |||
<block v-if="options.userid === undefined"> | |||
<van-button v-if="checked" @click="handSubmit" data-name="新增" block color="#FE3B53">提交</van-button> | |||
<van-button v-else block color="#D9E2EE">提交</van-button> | |||
</block> | |||
<block v-else> | |||
<van-button @click="handSubmit" data-name="修改" block color="#FE3B53">提交</van-button> | |||
</block> | |||
</block> | |||
<block v-else> | |||
<van-button @click="headerEite" block color="#FE3B53">编辑</van-button> | |||
</block> | |||
</view> | |||
</view> | |||
<van-popup v-model:show="isVisible" round position="bottom"> | |||
<van-cascader v-model="currentValue" :title="cascaderTitle" :options="optionData" :field-names="defaultFieldNames" | |||
@finish="onCloseVisible" @close="onCloseVisible" @change="onChangeVisible" /> | |||
</van-popup> | |||
</view> | |||
</template> | |||
<script> | |||
import * as peopleApi from '@/api/peopleApi'; | |||
import * as publicApi from '@/api/publicApi'; | |||
import utils from '@/utils/util' | |||
import util from '@/utils/util.map' | |||
import { | |||
Form | |||
} from 'vant'; | |||
export default { | |||
data() { | |||
return { | |||
form: {}, | |||
columns: [], | |||
fileList: [], | |||
checked: '1', | |||
options: {}, | |||
disabled: false, | |||
form: { | |||
workName: '', | |||
branchName: '', | |||
workAddress: '', | |||
secretaryName: '', | |||
secretaryMobile: '', | |||
partyBuildName: '', | |||
partyBuildMobile: '', | |||
communityId: '', | |||
communityName: '请选择结对共建社区', | |||
villageId: '', | |||
villageName: '请选择结对共建小区', | |||
partyMemberNum: '', | |||
}, | |||
minDate: new Date(2020, 0, 1), | |||
maxDate: new Date(2025, 5, 1), | |||
educationList: [], | |||
checked: false, | |||
// 级连选择器数据 start | |||
cascaderTitle: '', | |||
isVisible: false, | |||
FiledVisible: true, | |||
optionData: [], | |||
currentTile: '请选择', | |||
// 选择后的名称 | |||
currentValue: null, | |||
// 选择后的id | |||
// 级联选择默认显示字段 | |||
// 级连选择器数据 end | |||
defaultFieldNames: { | |||
text: 'name', | |||
value: 'id', | |||
children: 'children' | |||
}, | |||
} | |||
}, | |||
methods: { | |||
bindPickerChange() { | |||
onLoad(options) { | |||
this.options = options | |||
this.getTypeApi('people_party_organization_branch', 'educationList'); | |||
this.deptTreeApi(); | |||
if (options.userid !== undefined) { | |||
this.disabled = true | |||
this.partyOrganizationInfo(); | |||
} | |||
}, | |||
methods: { | |||
async partyOrganizationInfo() { | |||
const res = await peopleApi.partyOrganizationInfoApi({}); | |||
if (res.data) { | |||
this.form = res.data | |||
} | |||
}, | |||
headleInput() { | |||
async deptTreeApi() { | |||
// 获取所在村/社区 | |||
const res = await publicApi.deptTreeApi(); | |||
if (res.data && res.data.length) { | |||
this.optionData = res.data | |||
} | |||
}, | |||
// 获取群众点单字典 | |||
async getTypeApi(dictType, list) { | |||
const res = await publicApi.getDictDataApi({ | |||
dictType: dictType, | |||
pageNo: 1, | |||
pageSize: 100, | |||
}); | |||
if (res.code === 0) { | |||
this[list] = res.data.list | |||
} | |||
}, | |||
bindPickerChange(e) { | |||
const { | |||
name, | |||
list | |||
} = e.target.dataset; | |||
if (name === 'branchName') { | |||
this.form[name] = this[list][e.detail.value].label | |||
} else { | |||
this.form[name] = e.detail.value | |||
} | |||
}, | |||
async afterRead(event) { | |||
headleInput(event) { | |||
const { | |||
file | |||
} = event; | |||
name | |||
} = event.target.dataset; | |||
this.form[name] = event.detail.value | |||
const res = await getApp().globalData.upload({ | |||
file | |||
}); | |||
if (res.code !== 0) { | |||
uni.showToast({ | |||
title: '上传图片失败', | |||
icon: 'none' | |||
if (name === 'partyMemberNum') { | |||
this.checked = true | |||
} | |||
}, | |||
onOpenVisible(e) { | |||
this.isVisible = true | |||
this.cascaderTitle = e.currentTarget.dataset.name | |||
}, | |||
onCloseVisible() { | |||
this.isVisible = false | |||
}, | |||
onChangeVisible(e) { | |||
if (this.cascaderTitle === '结对共建社区') { | |||
this.form.communityName = e.selectedOptions[e.tabIndex].name | |||
this.form.communityId = e.value | |||
} else { | |||
this.form.villageName = e.selectedOptions[e.tabIndex].name | |||
this.form.villageId = e.value | |||
} | |||
}, | |||
handSubmit(e) { | |||
// 校验必填字段 | |||
const formKey = Object.keys(utils.filterParams(this.form)); | |||
console.log(formKey) | |||
console.log(this.form) | |||
const required = [ | |||
'workName', | |||
'branchName', | |||
'workAddress', | |||
'secretaryName', | |||
'secretaryMobile', | |||
'partyBuildName', | |||
'partyBuildMobile', | |||
'partyMemberNum', | |||
'communityId', | |||
'villageId', | |||
]; | |||
const isRequired = required.every((e) => formKey.includes(e)); | |||
if (!isRequired) { | |||
return wx.showToast({ | |||
title: '星号为必填!', | |||
icon: 'none', | |||
}); | |||
return false; | |||
} | |||
// this.fileList.push({url:res.data}) | |||
this.appealEnclosure.push(res.data); | |||
const { | |||
name | |||
} = e.target.dataset; | |||
if (name === '修改') { | |||
console.log('修改'); | |||
this.addSubmitUpdate(); | |||
} else { | |||
this.addSubmit(); | |||
} | |||
}, | |||
beforeDelete(file, dateil) { | |||
this.appealEnclosure.splice(dateil.index, 1); | |||
this.fileList.splice(dateil.index, 1) | |||
async addSubmitUpdate() { | |||
const res = await peopleApi.partyOrganizationUpdateApi(this.form); | |||
if (res.data) { | |||
wx.showToast({ | |||
title: '修改成功', | |||
icon: 'none', | |||
}); | |||
let time = setTimeout(() => { | |||
wx.navigateBack({ | |||
delta: 1, | |||
}); | |||
clearTimeout(time); | |||
}, 1500); | |||
} else { | |||
wx.showToast({ | |||
title: res.msg, | |||
icon: 'none', | |||
}); | |||
} | |||
}, | |||
submit() { | |||
} | |||
async addSubmit() { | |||
const res = await peopleApi.partyOrganizationCreateApi(this.form); | |||
if (res.data) { | |||
wx.showToast({ | |||
title: '注册成功,请重新登录,获取权限功能', | |||
icon: 'none', | |||
}); | |||
let time = setTimeout(() => { | |||
wx.navigateBack({ | |||
delta: 1, | |||
}); | |||
clearTimeout(time); | |||
}, 1500); | |||
} else { | |||
wx.showToast({ | |||
title: res.msg, | |||
icon: 'none', | |||
}); | |||
} | |||
}, | |||
headerEite() { | |||
this.disabled = false | |||
}, | |||
} | |||
} | |||
</script> | |||
@@ -7,100 +7,144 @@ | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>所属党委</text> | |||
<text class="red">*</text> | |||
<text class="red" v-if="!disabled">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
<block v-if="!disabled"> | |||
<picker @change="bindPickerChange" data-name="partyOrganName" range-key="branchName" | |||
:value="form.partyOrganName" :range="partyOrganizationList"> | |||
<view style="color: #000000" v-if="form.partyOrganId !== ''">{{ form.partyOrganName }}</view> | |||
<view style="color: #999" v-if="form.partyOrganId === ''">请选择所属党委</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</block> | |||
<block v-else> | |||
{{form.partyOrganName}} | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="form-body"> | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>常住地社区</text> | |||
<text class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>常住地社区</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value picker flex flex-v-center flex-between"> | |||
<block v-if="!disabled"> | |||
<view :class="form.communityId ? 'picker-line' : 'picker-text'" data-name="常住地社区" @tap="onOpenVisible"> | |||
{{ form.communityName }} | |||
</view> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png" @tap="onOpenVisible"></image> | |||
</block> | |||
<block v-else> | |||
{{ form.communityName }} | |||
</block> | |||
</view> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>常住小区</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value picker flex flex-v-center flex-between"> | |||
<block v-if="!disabled"> | |||
<view :class="form.villageId ? 'picker-line' : 'picker-text'" @tap="onOpenVisible">{{ form.villageName }} | |||
</view> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png" @tap="onOpenVisible"></image> | |||
</block> | |||
<block v-else> | |||
{{form.villageName}} | |||
</block> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
</view> | |||
<view class="flex"> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>楼栋(街)</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<block v-if="!disabled"> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.street" type="text" data-name="street" | |||
placeholder="请输入" /> | |||
</block> | |||
<block v-else> | |||
{{form.street}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>单元(巷)</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.lane" type="text" | |||
data-name="lane" placeholder="请输入" /> | |||
<block v-else> | |||
{{form.lane}} | |||
</block> | |||
</view> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>房号</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class pd-left" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class pd-left" @input="headleInput" :value="form.houseCode" | |||
type="text" data-name="houseCode" placeholder="请输入" /> | |||
<block v-else> | |||
{{form.houseCode}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>姓名</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" | |||
data-name="name" placeholder="请输入" /> | |||
<block v-else> | |||
{{form.name}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>性别</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<van-radio-group v-model="checked" shape="dot" direction="horizontal"> | |||
<van-radio name="1" icon-size="32rpx" checked-color="#FE3B53">男</van-radio> | |||
<van-radio name="2" icon-size="32rpx" checked-color="#FE3B53">女</van-radio> | |||
</van-radio-group> | |||
<block v-if="!disabled"> | |||
<van-radio-group v-model="form.sex" data-name="sex" shape="dot" direction="horizontal"> | |||
<van-radio :name="1" icon-size="32rpx" checked-color="#FE3B53">男</van-radio> | |||
<van-radio :name="2" icon-size="32rpx" checked-color="#FE3B53">女</van-radio> | |||
</van-radio-group> | |||
</block> | |||
<block v-else> | |||
{{form.sex=== 1 ? '男' : '女'}} | |||
</block> | |||
</view> | |||
<view class="form-body"> | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>出生年月</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
<block v-if="!disabled"> | |||
<picker mode="date" :value="form.birthDate" :start="startDate" data-name="birthDate" :end="endDate" | |||
@change="bindPickerChange"> | |||
<view class="uni-input" v-if="form.birthDate !== ''">{{form.birthDate}}</view> | |||
<view class="uni-input" style="color: #999;" v-if="form.birthDate === ''">请选择出生年月</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</block> | |||
<block v-else> | |||
{{getDateTime(form.birthDate)}} | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -109,13 +153,22 @@ | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>学历</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
<block v-if="!disabled"> | |||
<picker @change="bindPickerChange" range-key="label" data-name="education" :value="form.education" | |||
:range="educationList"> | |||
<view style="color: #000000" v-if="form.education !== ''">{{ educationList[form.education].label }} | |||
</view> | |||
<view style="color: #999" v-if="form.education === ''">请选择</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</block> | |||
<block v-else> | |||
<view style="color: #000000" v-if="educationList.length !== 0">{{ educationList[form.education].label }} | |||
</view> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -123,81 +176,308 @@ | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>工作单位</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.workAddress" type="text" | |||
data-name="workAddress" placeholder="请输入" /> | |||
<block v-else> | |||
{{form.workAddress}} | |||
</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>职务</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.duties" type="text" | |||
data-name="duties" placeholder="请输入" /> | |||
<block v-else>{{form.duties}}</block> | |||
</view> | |||
<view class="form-body form-col"> | |||
<view class="label"> | |||
<text>联系方式</text> | |||
<text class="red">*</text> | |||
<text v-if="!disabled" class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input v-if="!disabled" class="flex1 textarea-class" @input="headleInput" :value="form.mobile" type="text" | |||
data-name="mobile" placeholder="请输入" /> | |||
<block v-else>{{form.mobile}}</block> | |||
</view> | |||
<view class="form-button"> | |||
<van-button v-if="checked" @click="submit" block color="#FE3B53">提交</van-button> | |||
<van-button v-else disabled block color="#C1C1C1">提交</van-button> | |||
<block v-if="!disabled"> | |||
<block v-if="options.userid === undefined"> | |||
<van-button v-if="checked" @click="handSubmit" data-name="新增" block color="#FE3B53">提交</van-button> | |||
<van-button v-else block color="#D9E2EE">提交</van-button> | |||
</block> | |||
<block v-else> | |||
<van-button @click="handSubmit" data-name="修改" block color="#FE3B53">提交</van-button> | |||
</block> | |||
</block> | |||
<block v-else> | |||
<van-button @click="headerEite" block color="#FE3B53">编辑</van-button> | |||
</block> | |||
</view> | |||
</view> | |||
<van-popup v-model:show="isVisible" round position="bottom"> | |||
<van-cascader v-model="currentValue" :title="cascaderTitle" :options="optionData" :field-names="defaultFieldNames" | |||
@finish="onCloseVisible" @close="onCloseVisible" @change="onChangeVisible" /> | |||
</van-popup> | |||
</view> | |||
</template> | |||
<script> | |||
import * as peopleApi from '@/api/peopleApi'; | |||
import * as publicApi from '@/api/publicApi'; | |||
import utils from '@/utils/util' | |||
import util from '@/utils/util.map' | |||
export default { | |||
data() { | |||
const currentDate = this.getDate({ | |||
format: true | |||
}) | |||
return { | |||
form: {}, | |||
options: {}, | |||
disabled: false, | |||
form: { | |||
partyOrganId: '', | |||
partyOrganName: '', | |||
street: '', | |||
lane: '', | |||
houseCode: '', | |||
name: '', | |||
sex: '1', | |||
birthDate: '', | |||
education: '', | |||
workAddress: '', | |||
duties: '', | |||
mobile: '', | |||
communityId: '', | |||
communityName: '请选择', | |||
villageId: '', | |||
villageName: '请选择', | |||
}, | |||
minDate: new Date(2020, 0, 1), | |||
maxDate: new Date(2025, 5, 1), | |||
columns: [], | |||
educationList: [], | |||
fileList: [], | |||
checked: '1', | |||
partyOrganizationList: [], | |||
// 级连选择器数据 start | |||
cascaderTitle: '', | |||
isVisible: false, | |||
FiledVisible: true, | |||
optionData: [], | |||
currentTile: '请选择', | |||
// 选择后的名称 | |||
currentValue: null, | |||
// 选择后的id | |||
// 级联选择默认显示字段 | |||
// 级连选择器数据 end | |||
defaultFieldNames: { | |||
text: 'name', | |||
value: 'id', | |||
children: 'children' | |||
}, | |||
} | |||
}, | |||
computed: { | |||
startDate() { | |||
return this.getDate('start'); | |||
}, | |||
endDate() { | |||
return this.getDate('end'); | |||
} | |||
}, | |||
async onLoad(options) { | |||
this.options = options | |||
this.getTypeApi('people_party_member_education', 'educationList'); | |||
this.deptTreeApi(); | |||
this.partyOrganizationAll(); | |||
if (options.userid !== undefined) { | |||
this.disabled = true | |||
this.partyOrganizationInfo(); | |||
} | |||
}, | |||
methods: { | |||
bindPickerChange() { | |||
getDateTime(time) { | |||
return util.getDateTime(time, 2) | |||
}, | |||
headerEite() { | |||
this.disabled = false | |||
}, | |||
async partyOrganizationInfo() { | |||
const res = await peopleApi.partyMemberInfoApi({}); | |||
if (res.data) { | |||
this.form = res.data | |||
} | |||
}, | |||
async deptTreeApi() { | |||
// 获取所在村/社区 | |||
const res = await publicApi.deptTreeApi(); | |||
if (res.data && res.data.length) { | |||
this.optionData = res.data | |||
} | |||
}, | |||
async partyOrganizationAll() { | |||
const res = await peopleApi.partyOrganizationAllApi(); | |||
if (res.data) { | |||
this.partyOrganizationList = res.data | |||
} | |||
}, | |||
// 获取群众点单字典 | |||
async getTypeApi(dictType, list) { | |||
const vm = this; | |||
const res = await publicApi.getDictDataApi({ | |||
dictType: dictType, | |||
pageNo: 1, | |||
pageSize: 100 | |||
}); | |||
if (res.code === 0) { | |||
vm[list] = res.data.list | |||
} | |||
}, | |||
bindPickerChange(e) { | |||
let name = e.target.dataset.name | |||
if (name === 'partyOrganName') { | |||
this.form.partyOrganId = this.partyOrganizationList[e.detail.value].id | |||
this.form.partyOrganName = this.partyOrganizationList[e.detail.value].branchName | |||
} else { | |||
this.form[name] = e.detail.value | |||
} | |||
}, | |||
headleInput(event) { | |||
const { | |||
value | |||
} = event.detail; | |||
let name = event.target.dataset.name | |||
this.form[name] = value; | |||
}, | |||
handSubmit(event) { | |||
// 校验必填字段 | |||
console.log(this.form) | |||
const formKey = Object.keys(utils.filterParams(this.form)); | |||
console.log("formKey", formKey) | |||
const required = [ | |||
'partyOrganId', | |||
'communityId', | |||
'villageId', | |||
'street', | |||
'lane', | |||
'houseCode', | |||
'name', | |||
'sex', | |||
'birthDate', | |||
'education', | |||
'workAddress', | |||
'duties', | |||
'mobile', | |||
]; | |||
const isRequired = required.every((e) => formKey.includes(e)); | |||
if (!isRequired) { | |||
return wx.showToast({ | |||
title: '星号为必填!', | |||
icon: 'none', | |||
}); | |||
} | |||
const { | |||
name | |||
} = event.target.dataset; | |||
console.log(name) | |||
if (name === '修改') { | |||
console.log('修改'); | |||
this.addSubmitUpdate(); | |||
} else { | |||
this.addSubmit(); | |||
} | |||
}, | |||
headleInput() { | |||
async addSubmitUpdate() { | |||
const res = await peopleApi.partyMemberUpdate(this.form); | |||
if (res.data) { | |||
wx.showToast({ | |||
title: '修改成功', | |||
icon: 'none', | |||
}); | |||
let time = setTimeout(() => { | |||
wx.navigateBack({ | |||
delta: 1, | |||
}); | |||
clearTimeout(time); | |||
}, 1500); | |||
} else { | |||
wx.showToast({ | |||
title: res.msg, | |||
icon: 'none', | |||
}); | |||
} | |||
}, | |||
async afterRead(event) { | |||
const { | |||
file | |||
} = event; | |||
async addSubmit() { | |||
const res = await peopleApi.partyMemberCreate(this.form); | |||
if (res.data) { | |||
wx.showToast({ | |||
title: '注册成功,请重新登录,获取权限功能', | |||
icon: 'none', | |||
}); | |||
const res = await getApp().globalData.upload({ | |||
file | |||
}); | |||
if (res.code !== 0) { | |||
uni.showToast({ | |||
title: '上传图片失败', | |||
icon: 'none' | |||
let time = setTimeout(() => { | |||
wx.navigateBack({ | |||
delta: 1, | |||
}); | |||
clearTimeout(time); | |||
}, 1500); | |||
} else { | |||
wx.showToast({ | |||
title: res.msg, | |||
icon: 'none', | |||
}); | |||
return false; | |||
} | |||
// this.fileList.push({url:res.data}) | |||
this.appealEnclosure.push(res.data); | |||
}, | |||
beforeDelete(file, dateil) { | |||
this.appealEnclosure.splice(dateil.index, 1); | |||
this.fileList.splice(dateil.index, 1) | |||
getDate(type) { | |||
const date = new Date(); | |||
let year = date.getFullYear(); | |||
let month = date.getMonth() + 1; | |||
let day = date.getDate(); | |||
if (type === 'start') { | |||
year = year - 60; | |||
} else if (type === 'end') { | |||
year = year + 2; | |||
} | |||
month = month > 9 ? month : '0' + month; | |||
day = day > 9 ? day : '0' + day; | |||
return `${year}-${month}-${day}`; | |||
}, | |||
onCheckbox(event) { | |||
this.checked = event | |||
}, | |||
onOpenVisible(e) { | |||
this.isVisible = true | |||
this.cascaderTitle = e.currentTarget.dataset.name | |||
}, | |||
submit() { | |||
onCloseVisible() { | |||
this.isVisible = false | |||
}, | |||
onChangeVisible(e) { | |||
if (this.cascaderTitle === '常住地社区') { | |||
this.form.communityName = e.selectedOptions[e.tabIndex].name | |||
this.form.communityId = e.value | |||
} else { | |||
this.form.villageName = e.selectedOptions[e.tabIndex].name | |||
this.form.villageId = e.value | |||
} | |||
} | |||
} | |||
} | |||
@@ -4,40 +4,42 @@ | |||
<view class="detail"> | |||
<view class="detail-bg"> | |||
<view>标题标题标题标题标题标题标题标</view> | |||
<view class="type">申领中</view> | |||
<view class="detail-heade"> | |||
<image class="image" src="../../../../static/logo.png" mode=""></image> | |||
<text class="nickname">张无忌</text> | |||
<view class="msg">党员志愿服务</view> | |||
<view class="multi-line" style="width: 80%;">{{detaileObj.title}}</view> | |||
<view :class="`type${detaileObj.serviceStatus}`">{{getStatusText(statusList,detaileObj.serviceStatus)}} | |||
</view> | |||
<view class=" detail-heade"> | |||
<image class="image" :src="detaileObj.avatar" mode=""></image> | |||
<text class="nickname">{{detaileObj.nickName}}</text> | |||
<view class="msg">{{getStatusText(projectTypeList,detaileObj.serviceType)}}</view> | |||
</view> | |||
</view> | |||
<view class="conent">惠苑路社区西南角,家乐福超市对面xxxx</view> | |||
<view class="conent">{{detaileObj.content}}</view> | |||
<view class="detail-grid"> | |||
<block v-for="(item,index) in 9" :key="index"> | |||
<image src="/src/static/logo.png" mode=""></image> | |||
<block v-for="(item,index) in detaileObj.pics" :key="index"> | |||
<image @click="previewImage(item,index)" :src="item"></image> | |||
</block> | |||
</view> | |||
<view class="validity">申领有效期:<text class="time">2023-11-02~2023-12-0</text></view> | |||
<view class="validity">申领有效期:<text | |||
class="time">{{getDateTime(detaileObj.createTime)}}~{{getDateTime(detaileObj.effectDate)}}</text></view> | |||
<view class="flex-between"> | |||
<text class="title-name">志愿服务</text> | |||
<text class="num"><text class="action">90</text>/90</text> | |||
<text class="num"><text class="action">{{total}}</text>/{{detaileObj.needNum}}</text> | |||
</view> | |||
<view class="user"> | |||
<block v-for="item in 10" :key="item"> | |||
<block v-for="item in applyVolunteerProjec" :key="item"> | |||
<view class="user-item"> | |||
<image class="user-image" src="/src/static/logo.png"></image> | |||
<text class="nickname">张文远</text> | |||
<image class="user-image" :src="item.avatar"></image> | |||
<text class="nickname">{{item.userName}}</text> | |||
</view> | |||
</block> | |||
</view> | |||
<view class="but">申领</view> | |||
<view class="but" v-if="detaileObj.serviceStatus !== 2" @click="applyFor">申领</view> | |||
</view> | |||
<view style="height: 50rpx;"></view> | |||
@@ -45,14 +47,100 @@ | |||
</template> | |||
<script> | |||
import * as peopleApi from '@/api/peopleApi'; | |||
import * as publicApi from '@/api/publicApi'; | |||
import utils from '@/utils/util.map' | |||
export default { | |||
data() { | |||
return { | |||
options: {}, | |||
detaileObj: {}, | |||
statusList: [], | |||
projectTypeList: [], | |||
educationList: [], | |||
total: 0, | |||
applyVolunteerProjec: [], | |||
} | |||
}, | |||
onLoad(options) { | |||
this.options = options | |||
this.getTypeApi('people_volunteer_project_type', 'projectTypeList'); | |||
this.getTypeApi('people_volunteer_project_serviceStatus', 'statusList'); | |||
this.getVolunteerProject(); | |||
this.applyVolunteerProjecPageApi(); | |||
}, | |||
methods: { | |||
getStatusText(list, key) { | |||
return utils.getStatusText(list, key) | |||
}, | |||
getDateTime(time) { | |||
return utils.getDateTime(time, 4) | |||
}, | |||
// 获取群众点单字典 | |||
async getTypeApi(dictType, list) { | |||
const res = await publicApi.getDictDataApi({ | |||
dictType: dictType, | |||
pageNo: 1, | |||
pageSize: 100, | |||
}); | |||
if (res.code === 0) { | |||
this[list] = res.data.list; | |||
} | |||
}, | |||
async getVolunteerProject() { | |||
const res = await peopleApi.getVolunteerProjectApi({ | |||
id: this.options.id, | |||
}); | |||
if (res.data) { | |||
this.detaileObj = res.data | |||
} | |||
}, | |||
async applyVolunteerProjecPageApi() { | |||
const res = await peopleApi.applyVolunteerProjecPageApi({ | |||
volunteerProjectId: this.options.id, | |||
pageSize: 100, | |||
pageNo: 1, | |||
}); | |||
if (res.data) { | |||
this.applyVolunteerProjec = res.data.list | |||
this.total = res.data.total | |||
} | |||
}, | |||
previewImage(item, index) { | |||
uni.previewImage({ | |||
current: item, | |||
urls: this.detaileObj.pics, | |||
}); | |||
}, | |||
async applyFor() { | |||
const res = await peopleApi.applyVolunteerProjecCreateApi({ | |||
volunteerProjectId: this.options.id, | |||
userId: uni.getStorageSync('userInfoData').userId, | |||
}); | |||
if (res.data) { | |||
const { | |||
applyVolunteerProjec | |||
} = this; | |||
let appitme = []; | |||
appitme.push({ | |||
userName: uni.getStorageSync('userInfoData').nickName, | |||
avatar: uni.getStorageSync('userInfoData').avatar, | |||
}), | |||
applyVolunteerProjec.push(...appitme); | |||
uni.showToast({ | |||
title: '申领成功', | |||
icon: 'none', | |||
}); | |||
this.applyVolunteerProjec = applyVolunteerProjec | |||
this.total = this.total + 1 | |||
} else { | |||
uni.showToast({ | |||
title: res.msg, | |||
icon: 'none', | |||
}); | |||
} | |||
}, | |||
} | |||
} | |||
</script> | |||
@@ -135,7 +223,7 @@ | |||
} | |||
} | |||
.type { | |||
.type0 { | |||
position: absolute; | |||
top: 0; | |||
right: 0; | |||
@@ -147,6 +235,19 @@ | |||
padding: 12rpx 22rpx 12rpx 36rpx; | |||
} | |||
.type1 { | |||
position: absolute; | |||
top: 0; | |||
right: 0; | |||
background: linear-gradient(270deg, #5B638E 0%, #7B96BF 100%); | |||
border-radius: 0px 8rpx 0px 1000rpx; | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #fff; | |||
padding: 12rpx 22rpx 12rpx 36rpx; | |||
} | |||
.title-name { | |||
display: inline-block; | |||
position: relative; | |||
@@ -187,16 +288,18 @@ | |||
} | |||
.user { | |||
width: 100%; | |||
margin-top: 48rpx; | |||
display: grid; | |||
align-items: center; | |||
grid-template-columns: repeat(4, 1fr); | |||
grid-gap: 12rpx; | |||
padding-right: 10rpx; | |||
.user-item { | |||
background: linear-gradient(90deg, #FFD9DA 0%, #FF8C8F 100%); | |||
border-radius: 232132318px; | |||
padding: 12rpx 16rpx; | |||
padding: 12rpx 10rpx 12rpx 16rpx; | |||
display: flex; | |||
align-items: center; | |||
@@ -7,54 +7,68 @@ | |||
<view class="party-grid"> | |||
<block v-for="(item,index) in recursionTwoObj" :key="index"> | |||
<navigator v-if="item.clickUrl" class="line-navigator" :url="updateQuery(item.clickUrl, item)" | |||
hover-class="none"></navigator> | |||
<view style="width: 100%;height: 100%;;"> | |||
<image class="icon" :src="item.icon" mode=""></image> | |||
<view class="title">{{item.name}}</view> | |||
</view> | |||
<block v-if="headerUserRoles(item,userRoles)"> | |||
<navigator v-if="item.clickUrl" class="line-navigator" :url="updateQuery(item.clickUrl, item)" | |||
hover-class="none" style="width: 100%;height: 100%;;"> | |||
<view style="width: 100%;height: 100%;;"> | |||
<image class="icon" :src="item.icon" mode=""></image> | |||
<view class="title">{{item.name}}</view> | |||
</view> | |||
</navigator> | |||
</block> | |||
</block> | |||
</view> | |||
<view class="title-name">志愿服务</view> | |||
<view class="flex flex-between flex-v-center"> | |||
<view class="title-name">志愿服务</view> | |||
<view class="change" @click="headerChange"> | |||
<van-icon size="32rpx" name="/static/images/change.png" /><text>换一换</text> | |||
</view> | |||
</view> | |||
<view class="swiper"> | |||
<swiper style="height: 225px;" circular indicator-active-color="#C0CFDE" indicator-color="#fff" | |||
:indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration"> | |||
<swiper-item v-for="(item,index) in 4" :key="index"> | |||
<view> | |||
<swiper style="height: 250px;" v-if="volunteerProjectList.length !== 0" circular indicator-active-color="#C0CFDE" | |||
indicator-color="#fff" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" | |||
:duration="duration"> | |||
<swiper-item v-for="(item,index) in volunteerProjectList" :key="index"> | |||
<view @click.stop="headerApplyFor(item)"> | |||
<view class="swiper-piso"> | |||
<image class="swiper-icon" src="/src/images/share-icon.png" mode=""></image> | |||
<view class="type">服务中</view> | |||
<image class="swiper-icon" :src="item.pics[0]" mode="aspectFill"></image> | |||
<view :class="`type${item.serviceStatus}`">{{getStatusText(statusList,item.serviceStatus)}}</view> | |||
</view> | |||
<view class="swiper-item"> | |||
<view class="swiper-item" :style="item.serviceStatus !== 2 ? '' :'grid-template-columns: 95%'"> | |||
<view> | |||
<view class="item-title">创造更好营商环境申报</view> | |||
<view class="msg">北京经开区政务服务中心联合融媒体中心策划</view> | |||
<view class="item-title uniline">{{item.title}}</view> | |||
<view class="msg multi-line">{{item.content}}</view> | |||
</view> | |||
<view class="but">申领</view> | |||
<view class="but" v-if="item.serviceStatus !== 2" @click.stop="headerApplyFor(item)">申领</view> | |||
</view> | |||
</view> | |||
</swiper-item> | |||
</swiper> | |||
<van-empty v-else description="暂无活动风采" /> | |||
</view> | |||
<view class="title-name">活动风采</view> | |||
<view class="title-name" style="margin-top:30rpx">活动风采</view> | |||
<!-- 活动风采 --> | |||
<view class="activity"> | |||
<block v-for="(item,index) in 5" :key="index"> | |||
<view class="activity" v-if="newsPageList.length !== 0"> | |||
<block v-for="(item,index) in newsPageList" :key="index"> | |||
<view class="activity-item" @click="headerDetail(item)"> | |||
<image class="activity-image" src="/src/images/share-icon.png" mode=""></image> | |||
<image class="activity-image" :src="item.activityCoverImg" mode="aspectFill"></image> | |||
<view class="activity-type" v-if="index < 4" :class="`activity-type${index}`">NO.{{index+1}}</view> | |||
<view class="activity-title">惠苑路社区西南角家乐福超市对面xxxxx</view> | |||
<view class="activity-time">2023-11-23 周四</view> | |||
<view class="activity-title multi-line">{{item.activityTitle}}</view> | |||
<view class="activity-time">{{getDateTime(item.createTime)}}</view> | |||
<view class="activity-rigth"> | |||
<text>发布者的名字</text> | |||
<image src="/src/static/logo.png" mode=""></image> | |||
<text>{{item.userName}}</text> | |||
<image :src="item.avatar || '/images/default-avatar.png'" mode=""></image> | |||
</view> | |||
</view> | |||
</block> | |||
</view> | |||
<van-empty v-else description="暂无活动风采" /> | |||
</view> | |||
</template> | |||
@@ -65,13 +79,19 @@ | |||
export default { | |||
data() { | |||
return { | |||
userRoles: uni.getStorageSync('userRoles'), | |||
option: {}, | |||
statusList: [], | |||
recursionObj: {}, | |||
recursionTwoObj: [], | |||
newsPageList: [], | |||
pageNo: 1, | |||
pageSize: 12, | |||
total: 0, | |||
volunteerProjectList: [], | |||
volunteerProjectTotal: 0, | |||
voluntPageNo: 1, | |||
background: ['color1', 'color2', 'color3'], | |||
indicatorDots: true, | |||
autoplay: false, | |||
@@ -81,13 +101,57 @@ | |||
}, | |||
onLoad(option) { | |||
this.option = option | |||
this.userRoles = uni.getStorageSync('userRoles') | |||
this.getTypeApi('people_volunteer_project_serviceStatus', 'statusList'); | |||
this.recursionApi(); | |||
this.volunteerProject(); | |||
this.newsPageApi(false) | |||
}, | |||
methods: { | |||
headerUserRoles(item, key) { | |||
if (item.remark !== '') { | |||
return key === item.remark ? true : false; | |||
} else { | |||
return true; | |||
} | |||
}, | |||
updateQuery(url, name) { | |||
return utils.updateQuery(url, name); | |||
}, | |||
getDateTime(time) { | |||
return utils.getDateTime(time, 2) | |||
}, | |||
getStatusText(list, key) { | |||
return utils.getStatusText(list, key) | |||
}, | |||
// 获取群众点单字典 | |||
async getTypeApi(dictType, list) { | |||
const res = await publicApi.getDictDataApi({ | |||
dictType: dictType, | |||
pageNo: 1, | |||
pageSize: 100, | |||
}); | |||
if (res.code === 0) { | |||
this[list] = res.data.list; | |||
} | |||
}, | |||
// 志愿服务 | |||
async volunteerProject() { | |||
const res = await peopleApi.volunteerProjectApi({ | |||
pageNo: this.voluntPageNo, | |||
pageSize: 10, | |||
}); | |||
if (res.data) { | |||
this.volunteerProjectList = res.data.list | |||
this.volunteerProjectTotal = res.data.total | |||
} | |||
}, | |||
// 志愿服务申领 | |||
headerApplyFor(item) { | |||
wx.navigateTo({ | |||
url: `./detail?id=${item.id}`, | |||
}); | |||
}, | |||
async recursionApi() { | |||
const res = await publicApi.recursionApi({ | |||
bannerType: 1, | |||
@@ -134,8 +198,23 @@ | |||
}, | |||
headerDetail(item) { | |||
uni.navigateTo({ | |||
url: './detail?id=' + item.id | |||
url: '../activity-mien/detail?id=' + item.id | |||
}) | |||
}, | |||
headerChange() { | |||
const { | |||
volunteerProjectTotal, | |||
voluntPageNo | |||
} = this; | |||
if (voluntPageNo * 10 < volunteerProjectTotal) { | |||
this.voluntPageNo = voluntPageNo + 1, | |||
this.volunteerProject(); | |||
} else { | |||
uni.showToast({ | |||
title: '我到底了', | |||
icon: 'none', | |||
}); | |||
} | |||
} | |||
}, | |||
onReachBottom() { | |||
@@ -159,13 +238,13 @@ | |||
text-align: center; | |||
align-items: center; | |||
grid-gap: 24rpx; | |||
height: 100%; | |||
// height: 100%; | |||
padding: 40rpx 38rpx 0 38rpx; | |||
margin-bottom: 60rpx; | |||
margin-bottom: 38rpx; | |||
.icon { | |||
width: 100%; | |||
height: 100%; | |||
height: 80rpx; | |||
} | |||
.title { | |||
@@ -183,7 +262,7 @@ | |||
font-size: 36rpx; | |||
font-weight: 500; | |||
color: #333333; | |||
padding: 30rpx 30rpx 0 30rpx; | |||
padding: 0rpx 30rpx 0 30rpx; | |||
z-index: 3; | |||
&::after { | |||
@@ -219,7 +298,8 @@ | |||
margin-top: 38rpx; | |||
display: grid; | |||
align-items: center; | |||
grid-template-columns: 80% 20%; | |||
grid-template-columns: 75% 20%; | |||
justify-content: space-between; | |||
.item-title { | |||
font-size: 30rpx; | |||
@@ -262,17 +342,10 @@ | |||
height: 180rpx; | |||
} | |||
.activity-title { | |||
margin-top: 16rpx; | |||
font-size: 30rpx; | |||
font-weight: 400; | |||
color: #000000; | |||
} | |||
.activity-title { | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #999999; | |||
color: #000000; | |||
} | |||
.activity-time { | |||
@@ -280,6 +353,7 @@ | |||
font-weight: 400; | |||
margin-top: 8rpx; | |||
color: #999999; | |||
padding: 0 16rpx; | |||
} | |||
.activity-rigth { | |||
@@ -309,7 +383,7 @@ | |||
padding: 8rpx 26rpx; | |||
} | |||
.type { | |||
.type0 { | |||
position: absolute; | |||
top: 0; | |||
right: 0; | |||
@@ -321,6 +395,18 @@ | |||
padding: 12rpx 22rpx 12rpx 36rpx; | |||
} | |||
.type1 { | |||
position: absolute; | |||
top: 0; | |||
right: 0; | |||
border-radius: 0px 8rpx 0px 1000rpx; | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #fff; | |||
padding: 12rpx 22rpx 12rpx 36rpx; | |||
background: linear-gradient(270deg, #5B638E 0%, #7B96BF 100%); | |||
} | |||
.activity-type { | |||
position: absolute; | |||
top: 0; | |||
@@ -329,11 +415,11 @@ | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #fff; | |||
padding: 12rpx 22rpx 12rpx 36rpx; | |||
padding: 12rpx 31rpx 12rpx 15rpx; | |||
} | |||
.activity-type0 { | |||
background: linear-gradient(291deg, #0A992D 0%, #11D03E 100%); | |||
background: linear-gradient(270deg, #E71E00 0%, #FF5E33 100%); | |||
} | |||
.activity-type1 { | |||
@@ -347,4 +433,22 @@ | |||
.activity-type3 { | |||
background: linear-gradient(291deg, #4a507b 0%, #6882b1 100%); | |||
} | |||
.navigator-wrap { | |||
width: 100%; | |||
height: 100%; | |||
} | |||
.change { | |||
font-size: 24rpx; | |||
font-weight: 400; | |||
color: #999999; | |||
padding-right: 30rpx; | |||
display: flex; | |||
align-items: center; | |||
text { | |||
margin-left: 20rpx; | |||
} | |||
} | |||
</style> |
@@ -10,8 +10,11 @@ | |||
<text class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
<picker @change="bindPickerChange" range-key="label" data-name="serviceType" data-list="projectTypeList" | |||
:value="form.serviceType" :range="projectTypeList"> | |||
<view style="color: #000000" v-if="form.serviceType !== ''">{{form.serviceTypeName }} | |||
</view> | |||
<view style="color: #999" v-if="form.serviceType === ''">请选择点单类型</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</view> | |||
@@ -23,8 +26,8 @@ | |||
<text>标题</text> | |||
<text class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.title" type="text" data-name="title" | |||
placeholder="请输入标题" /> | |||
</view> | |||
</view> | |||
@@ -49,7 +52,7 @@ | |||
<text>所需人数</text> | |||
<text class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.needNum" type="text" data-name="needNum" | |||
placeholder="请输入" /> | |||
</view> | |||
@@ -58,8 +61,8 @@ | |||
<text>发布者</text> | |||
<text class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.publicUserName" type="text" | |||
data-name="publicUserName" placeholder="请输入" /> | |||
</view> | |||
<view class="form-body form-col"> | |||
@@ -67,22 +70,12 @@ | |||
<text>申领有效期</text> | |||
<text class="red">*</text> | |||
</view> | |||
<input class="flex1 textarea-class" @input="headleInput" :value="form.name" type="text" data-name="name" | |||
placeholder="请输入" /> | |||
</view> | |||
<view class="form-body"> | |||
<view class="flex flex-v-center flex-between"> | |||
<view class="label"> | |||
<text>申领有效期</text> | |||
<text class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker mode="date" :value="form.effectDate" data-name="effectDate" @change="bindPickerChange"> | |||
<view class="uni-input" v-if="form.effectDate !== ''">{{form.effectDate}}</view> | |||
<view class="uni-input" style="color: #999;" v-if="form.effectDate === ''">请选择有效期</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</view> | |||
</view> | |||
@@ -93,8 +86,12 @@ | |||
<text class="red">*</text> | |||
</view> | |||
<view class="label-value flex flex-v-center"> | |||
<picker @change="bindPickerChange" range-key="label" :value="form.type" :range="columns"> | |||
<!-- <view style="color: #000000">{{ columns[form.type].label }}</view> --> | |||
<picker @change="bindPickerChange" range-key="label" data-name="serviceStatus" data-list="serviceStatusList" | |||
:value="form.serviceStatus" :range="serviceStatusList"> | |||
<view style="color: #000000" v-if="form.serviceStatus !== ''"> | |||
{{form.serviceStatusName }} | |||
</view> | |||
<view style="color: #999" v-if="form.serviceStatus === ''">请选择点单类型</view> | |||
</picker> | |||
<image class="ic-xia" src="/static/packages/people/images/ic-xia.png"></image> | |||
</view> | |||
@@ -102,7 +99,7 @@ | |||
</view> | |||
<view class="form-button"> | |||
<van-button v-if="checked" @click="submit" block color="#FE3B53">发布信息</van-button> | |||
<van-button v-if="checked" @click="handSubmit" block color="#FE3B53">发布信息</van-button> | |||
<van-button v-else disabled block color="#C1C1C1">发布信息</van-button> | |||
</view> | |||
@@ -110,21 +107,71 @@ | |||
</template> | |||
<script> | |||
import * as peopleApi from '@/api/peopleApi'; | |||
import * as publicApi from '@/api/publicApi'; | |||
import utils from '@/utils/util' | |||
import util from '@/utils/util.map' | |||
export default { | |||
data() { | |||
return { | |||
form: {}, | |||
appealEnclosure: [], | |||
fileList: [], | |||
projectTypeList: [], | |||
serviceStatusList: [], | |||
form: { | |||
projectType: '', | |||
serviceType: '', | |||
serviceTypeName: '', | |||
title: '', | |||
content: '', | |||
needNum: '', | |||
publicUserName: '', | |||
effectDate: '', | |||
serviceStatus: '', | |||
serviceStatusName: '', | |||
}, | |||
checked: false, | |||
columns: [], | |||
fileList: [] | |||
minDate: new Date(2020, 0, 1), | |||
maxDate: new Date(2025, 5, 1), | |||
} | |||
}, | |||
onLoad(options) { | |||
this.options = options | |||
this.getTypeApi('people_volunteer_project_type', 'projectTypeList'); | |||
this.getTypeApi('people_volunteer_project_serviceStatus', 'serviceStatusList'); | |||
}, | |||
methods: { | |||
bindPickerChange() { | |||
// 获取群众点单字典 | |||
async getTypeApi(dictType, list) { | |||
const res = await publicApi.getDictDataApi({ | |||
dictType: dictType, | |||
pageNo: 1, | |||
pageSize: 100, | |||
}); | |||
if (res.code === 0) { | |||
this[list] = res.data.list | |||
} | |||
}, | |||
headleInput() { | |||
bindPickerChange(e) { | |||
const { | |||
name, | |||
list | |||
} = e.target.dataset; | |||
if (name === 'serviceStatus' || name == 'serviceType') { | |||
this.form[name] = this[list][e.detail.value].value | |||
this.checked = true | |||
this.form[`${name}Name`] = this[list][e.detail.value].label | |||
} else { | |||
this.form[name] = e.detail.value | |||
} | |||
}, | |||
headleInput(event) { | |||
const { | |||
name | |||
} = event.target.dataset; | |||
this.form[name] = event.detail.value | |||
}, | |||
async afterRead(event) { | |||
const { | |||
@@ -146,11 +193,57 @@ | |||
}, | |||
beforeDelete(file, dateil) { | |||
this.appealEnclosure.splice(dateil.index, 1); | |||
this.fileList.splice(dateil.index, 1) | |||
}, | |||
submit() { | |||
handSubmit() { | |||
// 校验必填字段 | |||
const formKey = Object.keys(utils.filterParams(this.form)); | |||
const required = [ | |||
'serviceType', | |||
'title', | |||
'content', | |||
'needNum', | |||
'publicUserName', | |||
'effectDate', | |||
'serviceStatus', | |||
]; | |||
const isRequired = required.every((e) => formKey.includes(e)); | |||
if (!isRequired) { | |||
return wx.showToast({ | |||
title: '星号为必填!', | |||
icon: 'none', | |||
}); | |||
} | |||
this.addSubmit(); | |||
}, | |||
async addSubmit() { | |||
const res = await peopleApi.getVolunteerProjectCreateApi({ | |||
...this.form, | |||
pics: this.appealEnclosure, | |||
userId: wx.getStorageSync('userInfoData').userId, | |||
}); | |||
if (res.data) { | |||
wx.showToast({ | |||
title: '发布成功', | |||
icon: 'none', | |||
}); | |||
} | |||
let time = setTimeout(() => { | |||
wx.navigateBack({ | |||
delta: 1, | |||
success: () => { | |||
const page = getCurrentPages().pop(); | |||
page.onLoad(); | |||
}, | |||
}); | |||
clearTimeout(time); | |||
}, 1000); | |||
} else { | |||
wx.showToast({ | |||
title: res.msg, | |||
icon: 'none', | |||
}); | |||
} | |||
}, | |||
} | |||
} | |||
</script> | |||
@@ -257,6 +257,11 @@ | |||
"name": "people", | |||
"style": {} | |||
}, | |||
{ | |||
"path": "pages/activity-mien/detail", | |||
"name": "people", | |||
"style": {} | |||
}, | |||
{ | |||
"path": "pages/volunteering/index", | |||
"name": "people", | |||
@@ -33,7 +33,8 @@ | |||
<view class="flex my-mune"> | |||
<view class="flex flex-col mune-item flex-center" v-for="(itemName, idx) in recursionOneList" :key="idx"> | |||
<navigator class="line-navigator" v-if="itemName.clickUrl" :url="updateQuery(itemName.clickUrl, itemName)" hover-class="none"></navigator> | |||
<navigator class="line-navigator" v-if="itemName.clickUrl" :url="updateQuery(itemName.clickUrl, itemName)" | |||
hover-class="none"></navigator> | |||
<text class="name">{{ itemName.name }}</text> | |||
@@ -68,7 +69,8 @@ | |||
<navigator :url="itemName.clickUrl + userInfo.id + '&partyMemberFlag=' + myInfo.partyMemberFlag" | |||
class="cell-right" hover-class="none"> | |||
<view class="cell-right-number" v-if="itemName.name === '党员接单'"> | |||
<view class="cell-right-number" | |||
v-if="itemName.name === '党员接单' || itemName.name =='党员认证' || itemName.name === '党组织认证'"> | |||
<!-- {{myInfo.partyMemberFlag===0?'未认证':'已认证'}} --> | |||
</view> | |||
<view class="cell-right-number" v-else> | |||
@@ -145,8 +147,8 @@ | |||
this.getUserInfo(); | |||
}, | |||
methods: { | |||
updateQuery(url,item){ | |||
return utils.updateQuery(url,item) | |||
updateQuery(url, item) { | |||
return utils.updateQuery(url, item) | |||
}, | |||
async getUserInfoApi() { | |||
const res = await myApi.getUserInfoApi(); | |||
@@ -192,6 +194,28 @@ | |||
} | |||
]; | |||
const recursionList = [{ | |||
bannerType: 4, | |||
clickUrl: '/packages/people/pages/party-branch/create?userid=', | |||
cssStyle: wx.getStorageSync('userRoles') === '党组织' ? '' : 'display:none', | |||
icon: '/static/images/tissue.png', | |||
id: 125, | |||
name: '党组织认证', | |||
parentId: 96, | |||
remark: '党组织认证', | |||
sort: 1, | |||
}, | |||
{ | |||
bannerType: 4, | |||
clickUrl: '/packages/people/pages/party-newspaper/create?userid=', | |||
cssStyle: null, | |||
icon: '/static/images/member.png', | |||
id: 123, | |||
name: '党员认证', | |||
parentId: 96, | |||
remark: '党员认证', | |||
sort: 1, | |||
}, | |||
{ | |||
bannerType: 4, | |||
clickUrl: '/packages/my/pages/my-masses/my-masses?id=', | |||
cssStyle: null, | |||
@@ -295,21 +319,21 @@ | |||
*/ | |||
async login() { | |||
uni.navigateTo({ | |||
url: '/pages/phone/index' | |||
url: '/pages/phone/index' | |||
}); | |||
// 我的诉求 | |||
// const res = await app.globalData.register({ | |||
// code: this.code | |||
// }); | |||
// if (res) { | |||
// uni.showToast({ | |||
// title: '登录成功', | |||
// icon: 'none' | |||
// }); | |||
// this.getInitData(); | |||
// } else { | |||
// } | |||
// 我的诉求 | |||
// const res = await app.globalData.register({ | |||
// code: this.code | |||
// }); | |||
// if (res) { | |||
// uni.showToast({ | |||
// title: '登录成功', | |||
// icon: 'none' | |||
// }); | |||
// this.getInitData(); | |||
// } else { | |||
// } | |||
}, | |||
// 获取我的信息 | |||
@@ -3,12 +3,12 @@ | |||
* @return {*} 校验只要是数字(包含正负整数,0以及正负浮点数)就返回true | |||
*/ | |||
function isNumber(val) { | |||
var regPos = /^\d+(\.\d+)?$/; //非负浮点数 | |||
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数 | |||
if (regPos.test(val) && regNeg.test(val)) { | |||
return true; | |||
} | |||
return false; | |||
var regPos = /^\d+(\.\d+)?$/; //非负浮点数 | |||
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数 | |||
if (regPos.test(val) && regNeg.test(val)) { | |||
return true; | |||
} | |||
return false; | |||
} | |||
/** | |||
@@ -17,17 +17,17 @@ function isNumber(val) { | |||
* @param t 时间 | |||
*/ | |||
const throttle = (ft, t) => { | |||
let flag = true; | |||
const interval = t; | |||
return function (self, ...args) { | |||
if (flag) { | |||
fn.apply(self, args); | |||
flag = false; | |||
setTimeout(() => { | |||
flag = true; | |||
}, interval); | |||
} | |||
}; | |||
let flag = true; | |||
const interval = t; | |||
return function(self, ...args) { | |||
if (flag) { | |||
fn.apply(self, args); | |||
flag = false; | |||
setTimeout(() => { | |||
flag = true; | |||
}, interval); | |||
} | |||
}; | |||
}; | |||
/** | |||
@@ -36,17 +36,17 @@ const throttle = (ft, t) => { | |||
* @param t 时间 | |||
*/ | |||
const debounce = (fn, t = 300) => { | |||
let timeId = null; | |||
const delay = t; | |||
return function (self, ...args) { | |||
if (timeId) { | |||
clearTimeout(timeId); | |||
} | |||
timeId = setTimeout(() => { | |||
timeId = null; | |||
fn.apply(self, args); | |||
}, delay); | |||
}; | |||
let timeId = null; | |||
const delay = t; | |||
return function(self, ...args) { | |||
if (timeId) { | |||
clearTimeout(timeId); | |||
} | |||
timeId = setTimeout(() => { | |||
timeId = null; | |||
fn.apply(self, args); | |||
}, delay); | |||
}; | |||
}; | |||
// 防抖示例 | |||
@@ -72,13 +72,13 @@ const debounce = (fn, t = 300) => { | |||
* @param {Object} date | |||
*/ | |||
function getDateString(date = new Date()) { | |||
return { | |||
year: date.getFullYear(), | |||
month: date.getMonth() + 1, | |||
day: date.getDate(), | |||
hour: date.getHours(), | |||
minute: date.getMinutes() | |||
}; | |||
return { | |||
year: date.getFullYear(), | |||
month: date.getMonth() + 1, | |||
day: date.getDate(), | |||
hour: date.getHours(), | |||
minute: date.getMinutes() | |||
}; | |||
} | |||
/** | |||
@@ -90,18 +90,18 @@ function getDateString(date = new Date()) { | |||
* @description 可以选择的时候添加 selectable = true,反之, selectable = false | |||
*/ | |||
function setSelectTreeLevel(tree, level) { | |||
if (!Array.isArray(tree)) { | |||
throw new Error('tree is not array!'); | |||
if (!Array.isArray(tree)) { | |||
throw new Error('tree is not array!'); | |||
} | |||
const list = JSON.parse(JSON.stringify(tree)); | |||
return list.map((item) => { | |||
const itemObj = item; | |||
itemObj.selectable = itemObj.code === level; | |||
if (Array.isArray(itemObj.children) && itemObj.children.length > 0) { | |||
itemObj.children = setSelectTreeLevel(itemObj.children, level); | |||
} | |||
const list = JSON.parse(JSON.stringify(tree)); | |||
return list.map((item) => { | |||
const itemObj = item; | |||
itemObj.selectable = itemObj.code === level; | |||
if (Array.isArray(itemObj.children) && itemObj.children.length > 0) { | |||
itemObj.children = setSelectTreeLevel(itemObj.children, level); | |||
} | |||
return itemObj; | |||
}); | |||
return itemObj; | |||
}); | |||
} | |||
/** | |||
@@ -111,19 +111,19 @@ function setSelectTreeLevel(tree, level) { | |||
* @returns {Array} 处理完成的树 | |||
*/ | |||
function handleChildren(tree) { | |||
if (!Array.isArray(tree)) { | |||
throw new Error('tree is not array!'); | |||
if (!Array.isArray(tree)) { | |||
throw new Error('tree is not array!'); | |||
} | |||
const list = JSON.parse(JSON.stringify(tree)); | |||
return list.map((item) => { | |||
// eslint-disable-next-line no-param-reassign | |||
if (item.children === null) { | |||
item.children = []; | |||
} else { | |||
handleChildren(item.children); | |||
} | |||
const list = JSON.parse(JSON.stringify(tree)); | |||
return list.map((item) => { | |||
// eslint-disable-next-line no-param-reassign | |||
if (item.children === null) { | |||
item.children = []; | |||
} else { | |||
handleChildren(item.children); | |||
} | |||
return item; | |||
}); | |||
return item; | |||
}); | |||
} | |||
/** | |||
@@ -132,14 +132,14 @@ function handleChildren(tree) { | |||
* @returns {string} 时间格式,可选。默认yyyy-mm-dd hh:MM:ss,年为"yyyy",月为"mm",日为"dd",时为"hh",分为"MM",秒为"ss",格式可以自由搭配,如: yyyy:mm:dd yyyy-mm-dd yyyy年mm月dd日,yyyy年mm月dd日 hh时MM分ss秒,yyyy/mm/dd/,MM:ss等组合 | |||
*/ | |||
function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd hh:MM:ss') { | |||
const time = new Date(dateTime); | |||
const Y = time.getFullYear(); | |||
const M = time.getMonth() + 1 < 10 ? "0" + (time.getMonth() + 1) : time.getMonth() + 1; | |||
const D = time.getDate() < 10 ? "0" + time.getDate() : time.getDate(); | |||
const h = time.getHours() < 10 ? "0" + time.getHours() : time.getHours(); | |||
const m = time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes(); | |||
const s = time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds(); | |||
return Y + "-" + M + "-" + D + " " + h + ":" + m; | |||
const time = new Date(dateTime); | |||
const Y = time.getFullYear(); | |||
const M = time.getMonth() + 1 < 10 ? "0" + (time.getMonth() + 1) : time.getMonth() + 1; | |||
const D = time.getDate() < 10 ? "0" + time.getDate() : time.getDate(); | |||
const h = time.getHours() < 10 ? "0" + time.getHours() : time.getHours(); | |||
const m = time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes(); | |||
const s = time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds(); | |||
return Y + "-" + M + "-" + D + " " + h + ":" + m; | |||
} | |||
/** | |||
@@ -147,19 +147,21 @@ function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd hh:MM:ss') { | |||
* @returns {string} url | |||
*/ | |||
function getCurrentPageUrlWithArgs() { | |||
const pages = getCurrentPages(); // 获取加载的页面 | |||
const currentPage = pages[pages.length - 1]; // 获取当前页面的对象 | |||
const url = currentPage.route; // 当前页面url | |||
const { options } = currentPage; // 如果要获取url中所带的参数可以查看options | |||
const pages = getCurrentPages(); // 获取加载的页面 | |||
const currentPage = pages[pages.length - 1]; // 获取当前页面的对象 | |||
const url = currentPage.route; // 当前页面url | |||
const { | |||
options | |||
} = currentPage; // 如果要获取url中所带的参数可以查看options | |||
//拼接url的参数 | |||
let urlWithArgs = `${url}?`; | |||
for (const key in options) { | |||
const value = options[key]; | |||
urlWithArgs += `${key}=${value}&`; | |||
} | |||
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1); | |||
return '/' + urlWithArgs; | |||
//拼接url的参数 | |||
let urlWithArgs = `${url}?`; | |||
for (const key in options) { | |||
const value = options[key]; | |||
urlWithArgs += `${key}=${value}&`; | |||
} | |||
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1); | |||
return '/' + urlWithArgs; | |||
} | |||
/** | |||
@@ -167,35 +169,53 @@ function getCurrentPageUrlWithArgs() { | |||
* @returns {Object} res | |||
*/ | |||
function setRichText(res) { | |||
if (res.data && res.data.createTime) { | |||
res.data.createTime = timeFormat(res.data.createTime); | |||
if (res.data.content) { | |||
res.data.content = res.data.content.replace(/(\<img|\<p)/gi, function ($0, $1) { | |||
return { | |||
'<img': '<img style="width:100%;height:auto;display:block;" ', | |||
'<p': '<p style="text-indent: 24px;" ', | |||
'<article': '<div', | |||
'</article': '</div', | |||
'<header': '<div', | |||
'</header': '</div' | |||
}[$1]; | |||
}); | |||
} | |||
return res.data; | |||
if (res.data && res.data.createTime) { | |||
res.data.createTime = timeFormat(res.data.createTime); | |||
if (res.data.content) { | |||
res.data.content = res.data.content.replace(/(\<img|\<p)/gi, function($0, $1) { | |||
return { | |||
'<img': '<img style="width:100%;height:auto;display:block;" ', | |||
'<p': '<p style="text-indent: 24px;" ', | |||
'<article': '<div', | |||
'</article': '</div', | |||
'<header': '<div', | |||
'</header': '</div' | |||
} [$1]; | |||
}); | |||
} | |||
return res.data; | |||
} | |||
} | |||
/** | |||
* @param {Object} 传递对象检测对象值是否为空,有则返回键名 | |||
* @returns {[]} { obj: '123', a: '' } => ['obj'] | |||
*/ | |||
function filterParams(obj) { | |||
const _newPar = {}; | |||
for (const key in obj) { | |||
// 如果对象属性的值不为空,就保存该属性(如果属性的值全部是空格,属于为空。) | |||
if (obj[key] && obj[key].toString().replace(/(^\s*)|(\s*$)/g, '') !== '') { | |||
// 保存属性 | |||
_newPar[key] = obj[key]; | |||
} | |||
} | |||
return _newPar; | |||
} | |||
export default { | |||
data() { | |||
return {}; | |||
}, | |||
getDateString, | |||
isNumber, | |||
debounce, | |||
throttle, | |||
// pages, | |||
setSelectTreeLevel, | |||
handleChildren, | |||
timeFormat, | |||
getCurrentPageUrlWithArgs, | |||
setRichText | |||
}; | |||
data() { | |||
return {}; | |||
}, | |||
getDateString, | |||
isNumber, | |||
debounce, | |||
throttle, | |||
// pages, | |||
setSelectTreeLevel, | |||
handleChildren, | |||
timeFormat, | |||
getCurrentPageUrlWithArgs, | |||
setRichText, | |||
filterParams | |||
}; |
@@ -10,7 +10,7 @@ function log(obj) { | |||
* JSON字符串转JSON对象 | |||
* @param str JSON字符串 | |||
*/ | |||
var str2Json = function (str) { | |||
var str2Json = function(str) { | |||
if (!str) return; | |||
var json = JSON.parse(str); | |||
@@ -21,7 +21,7 @@ var str2Json = function (str) { | |||
* 检查字符串是否是null或'' | |||
* @param str 字符串 | |||
*/ | |||
var isNull = function (str) { | |||
var isNull = function(str) { | |||
return str ? str : '---'; | |||
}; | |||
@@ -43,7 +43,7 @@ function getFullUrl(fileHost, url) { | |||
* @param fileHost 静态资源基地址 | |||
* @param filesStr 文件数组(JSON字符串) | |||
*/ | |||
var getSingleFullUrl = function (fileHost, filesStr) { | |||
var getSingleFullUrl = function(fileHost, filesStr) { | |||
if (!filesStr) return false; | |||
var files = str2Json(filesStr); | |||
@@ -60,7 +60,7 @@ var getSingleFullUrl = function (fileHost, filesStr) { | |||
* @param arr 字符串数组 | |||
* @param str 检测的字符串 | |||
*/ | |||
var isIncluded = function (arr, str) { | |||
var isIncluded = function(arr, str) { | |||
return arr.indexOf(str) >= 0; | |||
}; | |||
@@ -70,7 +70,7 @@ var isIncluded = function (arr, str) { | |||
* @param str 展示的日期司机 默认0 | |||
* 0 (年-月-日 时:分:秒) 1 (x年-x月-x日 时:分:秒) 2 (x年-x月-x日) 3 (时:分:秒) | |||
*/ | |||
var getDateTime = function (value, type) { | |||
var getDateTime = function(value, type) { | |||
//不能使用 new Date() | |||
var time = new Date(value); | |||
var year = time.getFullYear(); | |||
@@ -100,6 +100,7 @@ var getDateTime = function (value, type) { | |||
second, | |||
year + '年' + month + '月' + date + '日', | |||
hour + ':' + minute + ':' + second, | |||
year + '-' + month + '-' + date + ' ', | |||
]; | |||
if (!type) { | |||
return arr[0]; | |||
@@ -151,6 +152,20 @@ function formatStr(str) { | |||
return str.substring(0, 1) + new Array(str.length).join('*') | |||
} | |||
function getStatusText(list, status) { | |||
if (!list) { | |||
return '状态列表有误'; | |||
} | |||
var item = null; | |||
for (var i = 0; i < list.length; i++) { | |||
if (list[i].value === status + '') { | |||
item = list[i]; | |||
break; | |||
} | |||
} | |||
return item ? item.label : '未知'; | |||
} | |||
export default { | |||
log: log, | |||
str2Json: str2Json, | |||
@@ -161,5 +176,6 @@ export default { | |||
getDateTime: getDateTime, | |||
setMorKm: setMorKm, | |||
updateQuery: updateQuery, | |||
formatStr: formatStr | |||
formatStr: formatStr, | |||
getStatusText: getStatusText | |||
}; |