feat: 合并代码

This commit is contained in:
mayubo@gmail.com 2025-07-10 10:00:52 +08:00
commit bc345b71ac
27 changed files with 1338 additions and 553 deletions

View File

@ -1,38 +1,47 @@
export const apiArr = { export const apiArr = {
list: '/api/v1/wechat/community/list', // 获取社区列表 list: '/api/v1/wechat/community/list', // 获取社区列表
info: '/api/v1/wechat/community/info', // 获取单个社区信息 info: '/api/v1/wechat/community/info', // 获取单个社区信息
isJoin: '/api/v1/wechat/community/is-join', // 用户是否加入社区、楼宇、房间 isJoin: '/api/v1/wechat/community/is-join', // 用户是否加入社区、楼宇、房间
tipsList: '/api/v1/wechat/community/tips/list', // 获取全部通知列表 tipsList: '/api/v1/wechat/community/tips/list', // 获取全部通知列表
oneTips: '/api/v1/wechat/community/tips/one', // 获取单个社区通知 oneTips: '/api/v1/wechat/community/tips/one', // 获取单个社区通知
apply: '/api/v1/wechat/community/apply', // 申请加入小区 apply: '/api/v1/wechat/community/apply', // 申请加入小区
getFacilityList:'/api/v1/wechat/community/facility/list', //获取楼号, getFacilityList: '/api/v1/wechat/community/facility/list', //获取楼号,
getRoomList:'/api/v1/wechat/community/room/list', //获取房间号 getRoomList: '/api/v1/wechat/community/room/list', //获取房间号
ownerList: '/api/v1/wechat/community/owner/list', // 获取社区业主列表 ownerList: '/api/v1/wechat/community/owner/list', // 获取社区业主列表
submit:"/api/v1/wechat/community/owner/feedback-create", //报修提交 submit: "/api/v1/wechat/community/owner/feedback-create", //报修提交
getListByRepair:"/api/v1/wechat/community/owner/feedback-list",//报事报修列表 getListByRepair: "/api/v1/wechat/community/owner/feedback-list",//报事报修列表
getInfoById:"/api/v1/wechat/community/owner/feedback-info", //报事报修根据id查询详情 getInfoById: "/api/v1/wechat/community/owner/feedback-info", //报事报修根据id查询详情
getUserCommunity:"/api/v1/wechat/community/owner/mylist",//获取用户社区信息 getUserCommunity: "/api/v1/wechat/community/owner/mylist",//获取用户社区信息
get_host_info: 'https://zhsq.hshuishang.com/Miniapi/Index/get_host_info', get_host_info: 'https://zhsq.hshuishang.com/Miniapi/Index/get_host_info',
get_community_area_list:"https://zhsq.hshuishang.com/Miniapi/Community/get_community_area_list", get_community_area_list: "https://zhsq.hshuishang.com/Miniapi/Community/get_community_area_list",
carList: '/api/v1/wechat/community/car/list', // 获取社区列表 carList: '/api/v1/wechat/community/car/list', // 获取社区列表
addCar: '/api/v1/wechat/community/car/add', // 添加车辆 addCar: '/api/v1/wechat/community/car/add', // 添加车辆
getCarList: '/api/v1/wechat/community/car/list', //获取车辆列表 getCarList: '/api/v1/wechat/community/car/list', //获取车辆列表
deleteItem: "/api/v1/wechat/community/car/del",//删除车牌 deleteItem: "/api/v1/wechat/community/car/del",//删除车牌
getBanner:"/api/v1/wechat/home-page/banner-list",//获取banner图 getBanner: "/api/v1/wechat/home-page/banner-list",//获取banner图
getButton:"/api/v1/wechat/home-page/button-list",//获取button getButton: "/api/v1/wechat/home-page/button-list",//获取button
getHotWords:"/api/v1/wechat/home-page/search-hot-word/info",//搜索热词 getHotWords: "/api/v1/wechat/home-page/search-hot-word/info",//搜索热词
getAllList:"/api/v2/wechat/community/get-all-list",//获取小区信息列表 getAllList: "/api/v2/wechat/community/get-all-list",//获取小区信息列表
commRoomSelect:"/api/v2/wechat/community-room/comm-room-select",//房源筛选器 commRoomSelect: "/api/v2/wechat/community-room/comm-room-select",//房源筛选器
commInfo:"/api/v2/wechat/mpuser-crud/community-owner/info",//我的房产信息小区列表 commInfo: "/api/v2/wechat/mpuser-crud/community-owner/info",//我的房产信息小区列表
create:"/api/v2/wechat/community-owners/create",//创建新的业主信息 create: "/api/v2/wechat/community-owners/create",//创建新的业主信息
getOrderList:"/api/v2/wechat/community-orders/get-all-list",//获取账单
getCommunityRoomList:"/api/v2/wechat/community-room/list", //获取房源列表
getUserGovenmentMoney:"/api/v2/wechat/government-housing-fund-flow-crud/user", //获取用户公积金
createPayOrder:"/api/v2/wechat/community-order-pay/create", //创建缴费
getPayOrderInfo:"/api/v2/wechat/community-order-pay/get-one", //根据缴费信息获取支付信息
getPayOrderList:"/api/v2/wechat/community-order-pay/get-page", //查询缴费记录
OrderPay:"/api/v2/wechat/community-order-pay/preorder",//预下单
}; };

View File

@ -18,4 +18,5 @@ export const apiArr = {
categoryPage: '/api/v2/wechat/announcement-category-crud/page', // 公告分类信息分页 categoryPage: '/api/v2/wechat/announcement-category-crud/page', // 公告分类信息分页
infoPage: '/api/v2/wechat/announcement-crud/page', // 公告信息分页 infoPage: '/api/v2/wechat/announcement-crud/page', // 公告信息分页
getAnnounceInfo:"/api/v2/wechat/announcement-crud/info" ,//公告详情
}; };

View File

@ -0,0 +1,385 @@
page {
background-color: #F6F6FA;
}
.container {
display: flex;
flex-direction: column;
min-height: calc(100vh - 120rpx);
width: 100%;
}
.searchBox {
display: flex;
align-items: center;
padding: 0 20rpx;
/* margin-top: 35rpx; */
justify-content: space-between;
background-color: #fff;
}
.searchBox_add {
display: flex;
align-items: center;
font-weight: 400;
font-size: 30rpx;
color: #000000;
}
.searchBox_add image {
width: 30rpx;
height: 30rpx;
margin-right: 16rpx;
}
.myRealEstate {
font-weight: 700;
padding-top: 36rpx;
font-weight: normal;
font-size: 36rpx;
color: #222222;
text-align: center;
background-color: #fff;
padding-bottom: 27rpx;
}
.myRealEstate .btn {
width: 600rpx;
height: 90rpx;
background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%);
border-radius: 100rpx 100rpx 100rpx 100rpx;
font-weight: normal;
font-size: 36rpx;
color: #FFFFFF;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
margin-top: 30rpx;
}
.nearby {
padding: 0 20rpx;
margin-top: 20rpx;
background-color: #fff;
padding-top: 20rpx;
box-sizing: border-box;
flex: 1;
}
.nearbyTit {
display: flex;
justify-content: space-between;
}
.nearbyTit_left {
font-size: 36rpx;
color: #222222;
font-weight: 700;
}
.nearbyTit_right {
font-size: 26rpx;
color: #999999;
display: flex;
align-items: center;
}
.nearbyTit_right image {
width: 30rpx;
height: 30rpx;
}
.empty {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-weight: normal;
font-size: 28rpx;
color: #999999;
margin-top: 110rpx;
width: 100%;
}
.empty image {
width: 366rpx;
height: 226rpx;
margin-bottom: 27rpx;
}
.communityItem {
border-bottom: 1rpx solid #EBEBEB;
margin-top: 32rpx;
}
.communityItem_msg {
font-size: 26rpx;
color: #999999;
margin-top: 20rpx;
padding-bottom: 30rpx;
}
.communityItem_Box {
display: flex;
}
.communityItem_Box_left {
width: 180rpx;
overflow: hidden;
height: 180rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
margin-right: 20rpx;
}
.communityItem_Box_left image {
width: 100%;
height: 100%;
}
.communityItem_Box_right {
flex: 1;
}
.communityItem_Box_right_tit {
font-size: 32rpx;
color: #222222;
margin-bottom: 8rpx;
}
.communityItem_Box_right_com {
font-size: 26rpx;
color: #555555;
margin-top: 8rpx;
height: 72rpx;
line-height: 36rpx;
-webkit-line-clamp: 2;
/* 限制显示 2 行 */
-webkit-box-orient: vertical;
/* 垂直排列 */
overflow: hidden;
/* 超出部分隐藏 */
text-overflow: ellipsis;
display: -webkit-box;
}
.communityItem_Box_right_msg {
margin-top: 14rpx;
}
.communityItem_Box_right_msg_right {
width: 140rpx;
height: 40rpx;
background: #FF370B;
border-radius: 100rpx 100rpx 100rpx 100rpx;
font-size: 26rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
.communityItem_Box_right_msg {
display: flex;
align-items: center;
justify-content: space-between;
}
.communityItem_Box_right_msg_left {
display: flex;
align-items: center;
}
.communityItem_Box_right_msg_left1 {
width: 110rpx;
height: 40rpx;
background: rgba(255, 81, 42, 0.1);
border-radius: 100rpx 100rpx 100rpx 100rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
color: #555555;
margin-right: 20rpx;
}
.communityItem_Box_right_msg_left1 image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.communityItem_Box_right_msg_left2 {
width: 110rpx;
height: 40rpx;
background: #FFF2DA;
border-radius: 100rpx 100rpx 100rpx 100rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
color: #555555;
}
.communityItem_Box_right_msg_left2 image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.myRealEstateEmpty {
display: flex;
}
.myRealEstates {
width: 710rpx;
height: 200rpx;
margin: 0 auto;
position: relative;
}
.myRealEstates image {
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
z-index: 1;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.name {
font-size: 50rpx;
color: #FFFFFF;
text-shadow: 0px 2px 2px rgba(0, 0, 0, 0.6);
text-align: center;
position: relative;
z-index: 2;
padding-top: 24rpx;
}
.Visitor {
font-weight: normal;
font-size: 24rpx;
color: #FFFFFF;
width: 380rpx;
display: flex;
align-items: center;
justify-content: center;
height: 52rpx;
margin: 0 auto;
margin-top: 30rpx;
position: relative;
z-index: 2;
background: rgba(0, 0, 0, 0.3);
border-radius: 10rpx 10rpx 10rpx 10rpx;
}
.tabList {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx;
box-sizing: border-box;
width: 100%;
font-weight: normal;
font-size: 30rpx;
color: #222222;
background-color: #f6f6fa;
}
.active {
position: relative;
color: #222222;
font-weight: 700;
}
.active::after {
content: '';
width: 52rpx;
height: 22rpx;
background: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_active.png);
background-size: cover;
position: absolute;
left: 50%;
bottom: -20rpx;
transform: translateX(-50%);
}
.ConList{
background-color: #fff;
}
.ConItem {
display: flex;
padding: 30rpx 0;
margin: 0 20rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #EBEBEB;;
}
.ConItem_left {
width: 180rpx;
height: 160rpx;
margin-right: 20rpx;
}
.ConItem_right {
flex: 1;
}
.ConItem_right_tit {
font-size: 32rpx;
color: #222222;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ConItem_right_time {
font-size: 26rpx;
color: #999999;
margin-top: 10rpx;
}
.ConItem_right_msg {
display: flex;
align-items: center;
margin-top: 30rpx;
}
.ConItem_right_msg2 {
font-weight: normal;
font-size: 24rpx;
color: #FFFFFF;
width: 80rpx;
height: 36rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #FFFFFF;
border-radius: 5rpx 5rpx 5rpx 5rpx;
background: #FF370B;
margin-right: 13rpx;
}
.ConItem_right_msg1 {
width: 80rpx;
height: 36rpx;
background: #D9D9D9;
border-radius: 5rpx 5rpx 5rpx 5rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #222222;
}

View File

@ -0,0 +1,98 @@
<template>
<view class="container">
<view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
<view class="searchBox_add">
<u-icon bold color="#000" size="40" name="arrow-left" @click="back"></u-icon>
</view>
</view>
<div class="myRealEstate">
<div class="myRealEstates">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communityNav.png" mode="aspectFill"></image>
<div class="name">滏阳锦苑</div>
<div class="Visitor">访客身份 点击立即入驻本社区</div>
</div>
</div>
<div class="tabList">
<div @click="changeTab(0)" :class="active == 0 ? 'active' : ''">全部公告</div>
<div @click="changeTab(1)" :class="active == 1 ? 'active' : ''">安全消防</div>
<div @click="changeTab(2)" :class="active == 2 ? 'active' : ''">小区通知</div>
<div @click="changeTab(3)" :class="active == 3 ? 'active' : ''">社区活动</div>
<div @click="changeTab(4)" :class="active == 4 ? 'active' : ''">党建</div>
</div>
<div class="ConList">
<div class="ConItem" v-for="item in 3" @click="desc">
<div class="ConItem_left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_act2Img.png" mode="aspectFill"></image>
</div>
<div class="ConItem_right">
<div class="ConItem_right_tit">关于小区停车场治理通告</div>
<div class="ConItem_right_time">2025年5月27日 11:14:29</div>
<div class="ConItem_right_msg">
<div class="ConItem_right_msg2">
最新
</div>
<div class="ConItem_right_msg1">
置顶
</div>
</div>
</div>
</div>
</div>
</view>
</template>
<script>
import {
request,
picUrl,
uniqueByField,
menuButtonInfo,
NavgateTo
} from '../../../utils';
import {
apiArr
} from '../../../api/community';
export default {
data() {
return {
top: "",
localHeight: "",
active: 0
}
},
onLoad(options) {
const meun = menuButtonInfo();
this.top = meun.top;
// this.top = meun.height + meun.top;
this.localHeight = meun.height;
},
methods: {
changeTab(index) {
this.active = index;
},
back() {
uni.navigateBack({
delta: 1
});
},
desc(){
NavgateTo('../noticeDesc/index');
},
},
}
</script>
<style>
@import url("./index.css");
</style>

View File

@ -14,14 +14,15 @@
<image @click="searchByName" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"></image> <image @click="searchByName" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"></image>
</div> </div>
<!-- @click="chooseCommunity(item)" -->
<div class="communityList"> <div class="communityList">
<div class="communityItem" v-for="item in communityList"> <div class="communityItem" v-for="item in communityList" :key="item.community_id" @click="nextStep(item)">
<div class="communityItem_left"> <div class="communityItem_left">
<div class="communityItem_tit">{{item.name}}</div> <div class="communityItem_tit">{{item.name}}</div>
<div class="communityItem_address">{{item.addr}}</div> <div class="communityItem_address">{{item.addr}}</div>
</div> </div>
<div class="communityItem_right"> <div class="communityItem_right">
<image @click="nextStep(item)" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communityMore.png"></image> <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communityMore.png"></image>
</div> </div>
</div> </div>
</div> </div>
@ -158,6 +159,7 @@
filteredFloorsList: [], filteredFloorsList: [],
searchList: [], searchList: [],
city: uni.getStorageSync('location'), city: uni.getStorageSync('location'),
currentCommunity:""
} }
}, },
methods: { methods: {
@ -191,7 +193,6 @@
}) })
}, },
async nextStep(item) { async nextStep(item) {
console.log(item)
this.communityId = item.community_id ? item.community_id : this.communityId; this.communityId = item.community_id ? item.community_id : this.communityId;
this.facilityName = this.facilityName ? this.facilityName : item.label; this.facilityName = this.facilityName ? this.facilityName : item.label;
this.fName = this.step == 4 ? this.fName : (this.facilityName ? item.label : '') this.fName = this.step == 4 ? this.fName : (this.facilityName ? item.label : '')
@ -249,7 +250,23 @@
// //
NavgateTo(fullPath); NavgateTo(fullPath);
} },
//
chooseCommunity(e){
this.currentCommunity = e
this.getRoomSelect()
},
//
getRoomSelect(){
request(apiArr.commRoomSelect,"POST",{
community_ids:this.currentCommunity.community_id,
}).then(res=>{
console.log(res);
this.step = 2
})
},
}, },
onLoad(options) { onLoad(options) {

View File

@ -67,7 +67,7 @@
</div> </div>
<div class="newsList"> <div class="newsList">
<div class="newsItem" v-for="item in infoList" :key="item.id"> <div class="newsItem" v-for="item in infoList" @click="detail(item)" :key="item.id">
<div class="newsItem_left"> <div class="newsItem_left">
<div class="newsItem_left_tit">{{item.title}}</div> <div class="newsItem_left_tit">{{item.title}}</div>
<div class="newsItem_left_sub">{{item.author}}</div> <div class="newsItem_left_sub">{{item.author}}</div>
@ -173,17 +173,23 @@
// this.top = meun.height + meun.top; // this.top = meun.height + meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
// this.getCommunityList() // this.getCommunityList()
if(!uni.getStorageSync('changeCommData').id){
uni.setStorageSync("changeCommData",{name:"森呼吸二期",id:14})
}
this.communityVal = uni.getStorageSync('changeCommData').name this.communityVal = uni.getStorageSync('changeCommData').name
await this.getfunctionNum() await this.getfunctionNum()
this.getAdvertising() this.getAdvertising()
this.getCategoryList() this.getCategoryList()
}, },
methods: { methods: {
desc() { // desc() {
NavgateTo("../communityDetail/index") // NavgateTo("../communityDetail/index")
}, // },
apply() { apply() {
NavgateTo("../applyOwer/index") NavgateTo("../applyOwer/index")
}, },
@ -457,7 +463,13 @@
list_image: picUrl + item.list_image, list_image: picUrl + item.list_image,
}; };
}); });
} },
detail(e){
console.log(e);
NavgateTo('../noticeDesc/index?id=' + e.id)
},
}, },

View File

@ -1,25 +1,30 @@
<template> <template>
<view class="container"> <view class="container">
<view class="empty" v-if="false"> <view class="empty" v-if="false">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_newEmpty.png" alt="" /> <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_newEmpty.png"
alt="" />
没有添加任何房产 没有添加任何房产
</view> </view>
<div class="communityList"> <div class="communityList">
<div class="communityItem" v-for="item in communityList"> <div class="communityItem" v-for="item in communityList" :key="item.community_id"
@click="choseCommunity(item)">
<div class="communityItem_left"> <div class="communityItem_left">
<div class="communityItem_left_img"> <div class="communityItem_left_img">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/test.png"></image> <image :src="item.pic" mode="aspectFill"></image>
</div> </div>
<div class="communityItem_left_msg" @click="toUpview(item)"> <div class="communityItem_left_msg">
<div class="communityItem_left_msg_tit">{{item.name}}<span> {{item.room_owner_list.length}} <div class="communityItem_left_msg_tit">{{ item.name }}<span> {{ item.room_owner_list.length }}
</span></div> </span></div>
<div class="communityItem_left_msg_msg">{{item.addr}}</div> <div class="communityItem_left_msg_msg">{{ item.addr }}</div>
</div> </div>
</div> </div>
<div class="communityItem_right"> <div class="communityItem_right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"></image> <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"
v-if="item.community_id != currentCommunity.id"></image>
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"
v-if="item.community_id == currentCommunity.id"></image>
</div> </div>
</div> </div>
</div> </div>
@ -29,52 +34,66 @@
</template> </template>
<script> <script>
import { import {
request, request,
NavgateTo, NavgateTo,
isPhone isPhone,
} from '../../../utils'; picUrl
import { } from '../../../utils';
apiArr import {
} from '../../../api/community'; apiArr
export default { } from '../../../api/community';
data() { export default {
return { data() {
communityList: [], return {
page_num: 1, communityList: [],
page_size: 10, page_num: 1,
} page_size: 10,
currentCommunity: {}
}
},
methods: {
addCommunity() {
NavgateTo("/packages/community/addCommunity/index")
}, },
methods: { async getList() {
addCommunity() { await request(apiArr.commInfo, "POST", {
NavgateTo("/packages/community/addCommunity/index") user_id: uni.getStorageSync('userId'),
}, longitude: uni.getStorageSync('location').lng,
async getList() { latitude: uni.getStorageSync('location').lat,
await request(apiArr.commInfo, "POST", { page_num: this.page_num,
user_id: uni.getStorageSync('userId'), page_size: this.page_size
longitude: uni.getStorageSync('location').lng, }).then(res => {
latitude: uni.getStorageSync('location').lat, res.rows.forEach(item => {
page_num: this.page_num, item.pic = item.pic.startsWith('http') ? item.pic : picUrl + item.pic
page_size: this.page_size });
}).then(res => { this.communityList = res.rows
this.communityList = res.rows })
console.log(res)
})
},
toUpview(item) {
uni.setStorageSync('changeCommData', { id: item.community_id, name: item.name });
NavgateTo("/packages/community/index/index")
}
}, },
// toUpview(item) {
// uni.setStorageSync('changeCommData', { id: item.community_id, name: item.name });
// NavgateTo("/packages/community/index/index")
// },
onLoad(options) { choseCommunity(e) {
this.getList(); this.currentCommunity = e
uni.setStorageSync('changeCommData', { id: e.community_id, name: e.name });
uni.setStorageSync('currentCommunityAddr',e.addr);
NavgateTo("/packages/community/index/index")
}, },
},
onReachBottom() {}, onLoad(options) {
} this.currentCommunity = uni.getStorageSync('changeCommData')
console.log(this.currentCommunity, 'currentCommunity');
this.getList();
},
onReachBottom() { },
}
</script> </script>
<style> <style>
@import url("./index.css"); @import url("./index.css");
</style> </style>

View File

@ -6,18 +6,11 @@
</view> </view>
</view> </view>
<div class="myRealEstate">
<div class="myRealEstates">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communityNav.png" mode="aspectFill"></image>
<div class="name">滏阳锦苑</div>
<div class="Visitor">访客身份 点击立即入驻本社区</div>
</div>
</div>
<div class="Tit">再生资源回收让我们一起行动起来</div> <div class="Tit">{{Info.title}}</div>
<div class="subTit">衡水繁花似锦物业管理有限公司 2025年6月6日10:37:27</div> <div class="subTit">{{Info.author}} {{Info.publish_time}}</div>
<div class="Con"> <div class="Con">
再生资源回收是一项对我们社会和小区都有益的活动通过回收再利用废纸废金属废塑料废玻璃和废电子产品等再生资源我们不仅可以保护环境还能为我们的小区带来诸多好处 <rich-text :nodes="Info.content"></rich-text>
</div> </div>
</view> </view>
@ -25,15 +18,16 @@
</template> </template>
<script> <script>
import { import {
request, request,
picUrl, picUrl,
uniqueByField, uniqueByField,
menuButtonInfo menuButtonInfo,
} from '../../../utils'; NavgateTo
} from '../../../utils';
import { import {
apiArr apiArr
} from '../../../api/community'; } from '../../../api/v2Community';
export default { export default {
@ -41,7 +35,8 @@ export default {
return { return {
top: "", top: "",
localHeight: "", localHeight: "",
active: 0 id:"",
Info:""
} }
}, },
onLoad(options) { onLoad(options) {
@ -49,12 +44,20 @@ export default {
this.top = meun.top; this.top = meun.top;
// this.top = meun.height + meun.top; // this.top = meun.height + meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
this.id = options.id
this.getInfo()
}, },
methods: { methods: {
changeTab(index) { //
this.active = index; getInfo(){
request(apiArr.getAnnounceInfo,"POST",{
id:Number(this.id)
}).then(res=>{
console.log(res);
this.Info = res
})
}, },
back() { back() {
uni.navigateBack({ uni.navigateBack({

View File

@ -293,7 +293,9 @@ image {
color: #FF370B; color: #FF370B;
font-weight: 700; font-weight: 700;
} }
.sucess{
color: #222222;
}
.boxshadow { .boxshadow {
background: rgba(0, 0, 0, 0.16); background: rgba(0, 0, 0, 0.16);

View File

@ -8,12 +8,13 @@
<div class="community"> <div class="community">
<div class="community_left"> <div class="community_left">
<image mode="aspectFill" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/test.png" alt="" /> <image mode="aspectFill"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/test.png" alt="" />
</div> </div>
<div class="community_right" @click="changeShow"> <div class="community_right" @click="changeShow">
<div class="community_right_text"> <div class="community_right_text">
<div class="community_right_text1">世纪名城1号楼1单元101室</div> <div class="community_right_text1">{{ currentRoom.name }}</div>
<div class="community_right_text2">衡水市上海公馆6A</div> <div class="community_right_text2">{{ currentCommunityAddr }}</div>
</div> </div>
<div class="community_right_more"> <div class="community_right_more">
<u-icon bold color="#999999" size="30" name="arrow-right" @click="back"></u-icon> <u-icon bold color="#999999" size="30" name="arrow-right" @click="back"></u-icon>
@ -34,11 +35,11 @@
<div class="homeMoney_box_left2">可抵扣账户金额</div> <div class="homeMoney_box_left2">可抵扣账户金额</div>
</div> </div>
<div class="homeMoney_box_right"> <div class="homeMoney_box_right">
<div class="homeMoney_box_right1"><span></span>9735.00</div> <div class="homeMoney_box_right1"><span></span>{{ balanceMoney }}</div>
<div class="homeMoney_box_right2"> <div class="homeMoney_box_right2" @click="more">
查看详情 查看详情
<div style="margin-left: 12rpx;"> <div style="margin-left: 12rpx;">
<u-icon bold color="#894B11" size="30" name="arrow-right" @click="back"></u-icon> <u-icon bold color="#894B11" size="30" name="arrow-right" ></u-icon>
</div> </div>
</div> </div>
</div> </div>
@ -46,29 +47,32 @@
</div> </div>
<div class="payList" v-if="active == 0"> <div class="payList" v-if="active == 0">
<div class="payItem" v-for="item in 1"> <div class="payItem" v-for="(item, index) in Bill" :key="index">
<div class="payItem_tit"> <div class="payItem_tit">
<div class="payItem_left"> <div class="payItem_left">
<checkbox value="1"></checkbox> <checkbox :checked="item.check" @click="checkChange(item, index)"></checkbox>
<div style="margin-left: 24rpx;">2025</div> <div style="margin-left: 24rpx;">{{ item.order_date }}</div>
</div> </div>
<div class="payItem_right"> <div class="payItem_right">
<span></span> <span></span>
4900.00 {{ item.unpaid_amount }}
<p>未缴</p> <p>未缴</p>
<div style="margin-left: 40rpx;"> <div style="margin-left: 40rpx;" @click="changeCheck(item, index)">
<u-icon bold color="#894B11" size="30" name="arrow-down" @click="back"></u-icon> <u-icon bold color="#894B11" size="30" name="arrow-down" v-if="!item.more"></u-icon>
<u-icon bold color="#894B11" size="30" name="arrow-up" @click="back" v-if="false"></u-icon> <u-icon bold color="#894B11" size="30" name="arrow-up" v-if="item.more"></u-icon>
</div> </div>
</div> </div>
</div> </div>
<div class="payItem_List" v-for="item in 0"> <div class="payItem_List" v-for="(items, indes) in item.community_order_rows" v-if="item.more"
<checkbox value="1"></checkbox> :key="items.order_id">
<div class="Item_time">2025</div> <checkbox :checked="items.check" @click="itemsCheckChange(items, indes, index)"></checkbox>
<div class="Item_type">车位管理费</div> <div class="Item_time" v-if="items.billing_cycle == 1">{{ items.order_date }}</div>
<div class="Item_money">4500.00</div> <div class="Item_time" v-if="items.billing_cycle == 2">{{ items.order_datetime }}</div>
<div class="Item_status">未付款</div> <div class="Item_type">{{ items.community_fee_type.type_name }}</div>
<div class="Item_money">{{ items.money }}</div>
<div class="Item_status" v-if="items.status == 0">未付款</div>
<div class="Item_status sucess" v-if="items.status == 1">已付款</div>
</div> </div>
</div> </div>
</div> </div>
@ -78,7 +82,9 @@
<div class="PayTypeItem"> <div class="PayTypeItem">
<div class="PayTypeItem_left"> <div class="PayTypeItem_left">
<div class="PayTypeItem_img"> <div class="PayTypeItem_img">
<image mode="aspectFill" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png" alt="" /> <image mode="aspectFill"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
alt="" />
</div> </div>
<div class="PayTypeItem_con"> <div class="PayTypeItem_con">
<div class="PayTypeItem_con_tit">微信支付</div> <div class="PayTypeItem_con_tit">微信支付</div>
@ -87,14 +93,16 @@
</div> </div>
<div class="PayTypeItem_right"> <div class="PayTypeItem_right">
<radio></radio> <radio :checked="payType == 1" @click="changePayType(1)"></radio>
</div> </div>
</div> </div>
<div class="line3"></div> <div class="line3"></div>
<div class="PayTypeItem"> <div class="PayTypeItem">
<div class="PayTypeItem_left"> <div class="PayTypeItem_left">
<div class="PayTypeItem_img"> <div class="PayTypeItem_img">
<image mode="aspectFill" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_homeMoney.png" alt="" /> <image mode="aspectFill"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_homeMoney.png"
alt="" />
</div> </div>
<div class="PayTypeItem_con"> <div class="PayTypeItem_con">
<div class="PayTypeItem_con_tit">物业公积金支付</div> <div class="PayTypeItem_con_tit">物业公积金支付</div>
@ -103,7 +111,7 @@
</div> </div>
<div class="PayTypeItem_right"> <div class="PayTypeItem_right">
<radio></radio> <radio :checked="payType == 2" @click="changePayType(2)"></radio>
</div> </div>
</div> </div>
</div> </div>
@ -112,46 +120,46 @@
<div class="bottom_left"> <div class="bottom_left">
<span>合计</span> <span>合计</span>
<p></p> <p></p>
4900.00 {{ currentMoney }}
</div> </div>
<div class="bottom_right"> <div class="bottom_right" @click="OrderPay">
立即支付 立即支付
</div> </div>
</div> </div>
<div class="payHisList" v-if="active == 1"> <div class="payHisList" v-if="active == 1">
<div class="payHisItem" v-for="item in 3"> <div class="payHisItem" v-for="item in payOrderList" :key="item.id">
<div class="row"> <div class="row">
<div class="row_label">缴费金额</div> <div class="row_label">缴费金额</div>
<div class="row_con1">53.1</div> <div class="row_con1">{{ item.money }}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="row_label2">刚刚</div> <div class="row_label2"></div>
<div class="row_con2">2025-06-06 18:10支付</div> <div class="row_con2">{{ item.pay_time }}支付</div>
</div> </div>
<div class="line4"></div> <div class="line4"></div>
<div class="row"> <div class="row">
<div class="row_label">绑定房源</div> <div class="row_label">绑定房源</div>
<div class="row_con3"> <div class="row_con3">
<div class="row_con3_1">6个账单</div> <div class="row_con3_1">{{ item.community_order.length }}个账单</div>
<div class="row_con3_2">明细可从收据查看</div> <div class="row_con3_2">明细可从收据查看</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="row_label">应缴费金额</div> <div class="row_label">应缴费金额</div>
<div class="row_con4">4704.00</div> <div class="row_con4">{{ item.money }}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="row_label">物业费公积金抵扣金额</div> <div class="row_label">物业费公积金抵扣金额</div>
<div class="row_con4">-4704.00</div> <div class="row_con4">-{{ item.reduction_money }}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="row_label">缴费单号</div> <div class="row_label">缴费单号</div>
<div class="row_con4">25061700200003 </div> <div class="row_con4">{{ item.order_pay_no }} </div>
</div> </div>
<div class="line4"></div> <div class="line4"></div>
<div class="Receipt">收据</div> <div class="Receipt">收据</div>
@ -168,8 +176,8 @@
</div> </div>
<div class="lines"></div> <div class="lines"></div>
<div class="communityList"> <div class="communityList">
<div class="communityItem" v-for="item in 8"> <div class="communityItem" v-for="item in roomList" :key="item.room_id">
<div class="communityItem_text">2323世纪名城1号楼1单元101室</div> <div class="communityItem_text">{{ item.facility_name }}{{ item.floor }} {{ item.number }}</div>
<div class="communityItem_radio"> <div class="communityItem_radio">
<radio></radio> <radio></radio>
</div> </div>
@ -188,11 +196,13 @@
<span></span>4900.00 <span></span>4900.00
</div> </div>
<div class="lines"></div> <div class="lines"></div>
<div class="BanlenceList"> <div class="BanlenceList">
<div class="banlenceItem"> <div class="banlenceItem">
<div class="banlenceItem_left"> <div class="banlenceItem_left">
<image mode="aspectFill" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png" alt="" /> <image mode="aspectFill"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
alt="" />
微信支付 微信支付
</div> </div>
<div class="banlenceItem_right"> <div class="banlenceItem_right">
@ -202,7 +212,9 @@
<div class="line3"></div> <div class="line3"></div>
<div class="banlenceItem"> <div class="banlenceItem">
<div class="banlenceItem_left"> <div class="banlenceItem_left">
<image mode="aspectFill" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_homeMoney.png" alt="" /> <image mode="aspectFill"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_homeMoney.png"
alt="" />
物业公积金支付 物业公积金支付
</div> </div>
<div class="banlenceItem_right"> <div class="banlenceItem_right">
@ -229,6 +241,7 @@ import {
picUrl, picUrl,
uniqueByField, uniqueByField,
menuButtonInfo, menuButtonInfo,
formatDate,
NavgateTo NavgateTo
} from '../../../utils'; } from '../../../utils';
import { import {
@ -241,9 +254,24 @@ export default {
return { return {
top: "", top: "",
localHeight: "", localHeight: "",
active: 1, active: 0,
show: false, show: false,
show2: false, show2: false,
roomList: [],
currentRoom: {},
currentCommunity: "", //
currentCommunityAddr: "", //
Bill: "", //
balanceMoney: "",//
currentMoney: 0, //
payType: '1',
payInfoId: "",//id
page_size: 10,
page_num: 1,
payOrderList: [],
flag: false,
} }
}, },
onLoad(options) { onLoad(options) {
@ -251,12 +279,20 @@ export default {
this.top = meun.top; this.top = meun.top;
// this.top = meun.height + meun.top; // this.top = meun.height + meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
this.currentCommunity = uni.getStorageSync('changeCommData')
this.currentCommunityAddr = uni.getStorageSync("currentCommunityAddr")
this.getRoomSelect()
this.getUserGovenmentMoney()
}, },
methods: { methods: {
changeTab(index) { changeTab(index) {
this.active = index; this.active = index;
if (index == 1) {
this.page_num = 1
this.getPayList()
}
}, },
back() { back() {
uni.navigateBack({ uni.navigateBack({
@ -269,6 +305,179 @@ export default {
changeShow2() { changeShow2() {
this.show2 = !this.show this.show2 = !this.show
}, },
//
getRoomSelect() {
request(apiArr.getCommunityRoomList, 'POST', {
community_id: this.currentCommunity.id,
page_num: 1,
page_size: 50
}).then(res => {
this.roomList = res.rows
this.currentRoom = this.roomList[0]
this.getOrderList()
})
},
//
async getUserGovenmentMoney() {
request(apiArr.getUserGovenmentMoney, "POST", {}).then(res => {
console.log(res, '公积金');
this.balanceMoney = res.balance_after
})
},
//
async getOrderList() {
await request(apiArr.getOrderList, 'POST', {
room_id: this.currentRoom.room_id,
page_num: 1,
page_size: 50
}).then(res => {
console.log(res, '账单');
res.rows.forEach(item => {
item.check = false
item.more = false
item.community_order_rows.forEach(ite => {
ite.check = false
})
});
this.Bill = res.rows
})
},
//
changeCheck(e, index) {
this.Bill[index].more = !this.Bill[index].more
},
//
checkChange(e, index) {
this.Bill[index].check = !this.Bill[index].check
this.Bill[index].community_order_rows.forEach(item => {
if (this.Bill[index].check) {
item.check = true
} else {
item.check = false
}
})
//
let money = 0
this.Bill.forEach(item => {
item.community_order_rows.forEach(ite => {
if (ite.check) {
money += ite.money
}
})
})
this.currentMoney = money
},
//
itemsCheckChange(e, indes, index) {
this.Bill[index].community_order_rows[indes].check = !this.Bill[index].community_order_rows[indes].check
//
let isAll = this.Bill[index].community_order_rows.every(item => {
return item.check
})
if (isAll) {
this.Bill[index].check = true
} else {
this.Bill[index].check = false
}
//Billcommunity_order_rows
let money = 0
this.Bill.forEach(item => {
item.community_order_rows.forEach(ite => {
if (ite.check) {
money += ite.money
}
})
})
this.currentMoney = money
},
//
changePayType(e) {
this.payType = e
},
//
async createPay() {
let order_ids = []
this.Bill.forEach(item => {
item.community_order_rows.forEach(items => {
if (items.check) {
order_ids.push(items.order_id)
}
})
})
let name_mini = ''
if(this.payType == 1){
name_mini = '微信'
}else{
name_mini = '物业公积金'
}
if(!this.currentMoney){
return uni.showToast({
title: '请选择账单',
duration: 2000
});
}
await request(apiArr.createPayOrder, "POST", {
order_ids: order_ids,
community_id: this.currentCommunity.id,
room_id: this.currentRoom.room_id,
pay_user_id: uni.getStorageSync('userId'),
user_name: uni.getStorageSync('nickName'),
pay_user_name: uni.getStorageSync('nickName'),
//
pay_time: formatDate(new Date()),
money: this.currentMoney,
name_mini
}).then(res => {
console.log(res);
this.payInfoId = res.id
this.getPayInfo()
})
},
//
async getPayInfo() {
await request(apiArr.getPayOrderInfo, "POST", { order_pay_id: 6}).then(res => {
this.OrderPay()
})
},
//
async OrderPay(){
// this.payInfoId
await request(apiArr.OrderPay, "POST", { order_pay_id: 6}).then(res => {
console.log(res);
})
},
//
getPayList() {
request(apiArr.getPayOrderList, "POST",
{
room_id: this.currentRoom.room_id,
page_num: this.page_num,
page_size: this.page_size
}).then(res => {
console.log(res);
let flag = false
if (res.rows && res.rows.length == this.page_size) {
flag = true
} else {
flag = false
}
this.flag = flag
this.payOrderList = this.payOrderList.concat(res.rows)
})
},
//
more(){
NavgateTo("../providentFund/index")
},
}, },

View File

@ -183,7 +183,7 @@
{ {
"path": "noticeDesc/index", "path": "noticeDesc/index",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "公告详情",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },

View File

@ -5,8 +5,8 @@
<view class="login-tip" style="font-size: 40rpx; color: #000000;">欢迎来到榴园社区</view> <view class="login-tip" style="font-size: 40rpx; color: #000000;">欢迎来到榴园社区</view>
<view v-if="loginChannel === 'android' || loginChannel === 'ios'" class="app_login"> <view v-if="loginChannel === 'android' || loginChannel === 'ios'" class="app_login">
<input class="input" type="number" maxlength="11" data-name="userId" @input='headerInputClick' :value="userId" <input class="input" type="number" maxlength="11" data-name="userId" @input='headerInputClick'
placeholder="请输入手机号" /> :value="userId" placeholder="请输入手机号" />
<input class="input" password data-name="passWord" @input='headerInputClick' :value="passWord" <input class="input" password data-name="passWord" @input='headerInputClick' :value="passWord"
placeholder="请输入密码" /> placeholder="请输入密码" />
<view class="tips">未注册用户填写手机号后点击登录即可无需输入密码</view> <view class="tips">未注册用户填写手机号后点击登录即可无需输入密码</view>
@ -14,15 +14,12 @@
</view> </view>
<view v-if="loginChannel === 'mp-weixin'" class=""> <view v-if="loginChannel === 'mp-weixin'" class="">
<view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;">为了更好的体验申请获取您的公开信息</view> <view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;">为了更好的体验申请获取您的公开信息
</view>
<view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 14rpx;">头像昵称等</view> <view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 14rpx;">头像昵称等</view>
<view class="login-button"> <view class="login-button">
<button <button class="login-btn" open-type="getPhoneNumber" @click="headerLoginClick"
class="login-btn" @getphonenumber="getPhoneNumber">
open-type="getPhoneNumber"
@click="headerLoginClick"
@getphonenumber="getPhoneNumber"
>
授权登录 授权登录
</button> </button>
</view> </view>
@ -37,203 +34,203 @@
</template> </template>
<script> <script>
import { apiArr } from '../../api/login'; import { apiArr } from '../../api/login';
import { apiArr as apiArr2 } from '../../api/v2User'; import { apiArr as apiArr2 } from '../../api/v2User';
import { request } from '../../utils'; import { request } from '../../utils';
export default { export default {
data() { data() {
return { return {
isLogin: false, isLogin: false,
loginChannel: '', // loginChannel: '', //
userId: '', userId: '',
passWord: '', passWord: '',
} }
},
methods: {
headerInputClick(e) {
const { name } = e.currentTarget.dataset;
const { value } = e.detail;
this[name] = value
}, },
methods: {
headerInputClick(e) { headerLoginClick() {
const { name } = e.currentTarget.dataset; let that = this
const { value } = e.detail; uni.showLoading({
this[name] = value title: '登录中...',
}, mask: true
});
if (this.loginChannel === 'android' || this.loginChannel === 'ios') {
this.appLogin();
return;
}
headerLoginClick() { uni.login({
let that = this onlyAuthorize: true,
uni.showLoading({ success: (res) => {
title: '登录中...', request(apiArr.login, 'POST', {
mask: true code: res.code,
}); phone: '',
if (this.loginChannel === 'android' || this.loginChannel === 'ios') { password: '',
this.appLogin(); }, { silent: false }).then((loginRes) => {
return; //
uni.setStorageSync('ctoken', loginRes.token);
uni.setStorageSync('is_deal', loginRes.is_deal);
uni.setStorageSync('is_dev', loginRes.is_dev);
uni.setStorageSync('is_shop', loginRes.is_shop);
//
request(apiArr.loginInfo, 'POST', {
token: loginRes.token
}, { silent: false }).then((res2) => {
if (res2.error) return;
// userId 使
uni.setStorageSync('userId', res2.user_id);
uni.setStorageSync('openId', res2.open_id);
uni.setStorageSync('shopId', res2.wshop_id);
this.isLogin = true;
that.getUserInfo()
})
}, (err) => {
uni.hideLoading();
console.log('登录接口错误', err);
})
} }
})
},
uni.login({ //
onlyAuthorize: true, getPhoneNumber(event) {
success: (res) => { console.log('小程序登录获取手机号', event);
request(apiArr.login, 'POST', { const { isLogin } = this;
code: res.code, // uni.setStorageSync('phone', '18332119617');
phone: '', // this.tohome();
password: '', // return
}, { silent: false }).then((loginRes) => { if (event.detail.errMsg === "getPhoneNumber:ok") {
// request(apiArr.loginGetUserPhone, 'POST', {
uni.setStorageSync('ctoken', loginRes.token); code: event.detail.code
uni.setStorageSync('is_deal', loginRes.is_deal); }, { silent: false }).then((res) => {
uni.setStorageSync('is_dev', loginRes.is_dev); uni.hideLoading();
uni.setStorageSync('is_shop', loginRes.is_shop); if (isLogin) {
uni.setStorageSync('phone', res.phone);
uni.showToast({
// title: '登录成功',
request(apiArr.loginInfo, 'POST', { icon: 'success',
token: loginRes.token mask: true,
}, { silent: false } ).then((res2) => { duration: 2000,
if (res2.error) return; success: () => {
// userId 使 setTimeout(() => {
uni.setStorageSync('userId', res2.user_id); this.tohome();
uni.setStorageSync('openId', res2.open_id); }, 2000)
uni.setStorageSync('shopId', res2.wshop_id); }
this.isLogin = true; });
that.getUserInfo() } else {
uni.showToast({
}) title: '登录失败',
}, (err) => { icon: 'error',
uni.hideLoading(); mask: true,
console.log('登录接口错误', err); duration: 2000,
}) })
} }
}) })
}, } else {
uni.hideLoading();
uni.removeStorageSync('ctoken');
uni.removeStorageSync('userId');
uni.removeStorageSync('openId');
uni.removeStorageSync('phone');
uni.removeStorageSync('is_deal');
uni.removeStorageSync('is_dev');
uni.removeStorageSync('is_shop');
uni.removeStorageSync('shopId');
uni.removeStorageSync('order_dispatch_permission');
console.error('用户拒绝授权:', event.detail.errMsg);
}
},
// getUserInfo() {
getPhoneNumber(event) { request(apiArr2.getUserInfo, "POST", {
console.log('小程序登录获取手机号', event); user_id: uni.getStorageSync('userId')
const { isLogin } = this; }).then(res => {
// uni.setStorageSync('phone', '18332119617'); console.log('111111', res);
// this.tohome(); const { community_worker } = res;
// return uni.setStorageSync('order_dispatch_permission', community_worker && community_worker[0].order_dispatch_permission == 1 || false);
if (event.detail.errMsg === "getPhoneNumber:ok") { uni.setStorageSync('nickName', res.nick_name);
request(apiArr.loginGetUserPhone, 'POST', { console.log(res)
code: event.detail.code })
}, { silent: false }).then((res) => { },
uni.hideLoading();
if (isLogin) { // app
uni.setStorageSync('phone', res.phone); async appLogin() {
uni.showToast({ try {
title: '登录成功', const loginRes = await request(apiArr.login, 'POST', {
icon: 'success', code: '',
mask: true, phone: this.userId,
duration: 2000, password: this.passWord
success: () => { }, { silent: false });
setTimeout(() => { uni.setStorageSync('ctoken', loginRes.token);
this.tohome(); uni.setStorageSync('is_deal', loginRes.is_deal);
}, 2000) uni.setStorageSync('is_dev', loginRes.is_dev);
} uni.setStorageSync('is_shop', loginRes.is_shop);
});
} else { //
uni.showToast({ const loginInfoRes = await request(apiArr.loginInfo, 'POST', {
title: '登录失败', token: loginRes.token
icon: 'error', }, { slient: false });
mask: true, uni.setStorageSync('userId', loginInfoRes.user_id);
duration: 2000, uni.setStorageSync('openId', loginInfoRes.open_id);
}) uni.setStorageSync('shopId', loginInfoRes.wshop_id);
uni.setStorageSync('phone', this.userId); // app
this.isLogin = true;
uni.hideLoading();
if (loginRes.msg) {
uni.showModal({
title: '提示',
content: loginRes.msg,
showCancel: false,
complete: (res) => {
if (res.confirm) {
this.tohome();
}
} }
}) })
} else { } else {
uni.hideLoading(); this.tohome();
uni.removeStorageSync('ctoken');
uni.removeStorageSync('userId');
uni.removeStorageSync('openId');
uni.removeStorageSync('phone');
uni.removeStorageSync('is_deal');
uni.removeStorageSync('is_dev');
uni.removeStorageSync('is_shop');
uni.removeStorageSync('shopId');
uni.removeStorageSync('order_dispatch_permission');
console.error('用户拒绝授权:', event.detail.errMsg);
} }
}, } catch (error) {
uni.hideLoading();
getUserInfo(){ //TODO handle the exception
request(apiArr2.getUserInfo,"POST",{ console.log('app登录异常', error);
user_id:uni.getStorageSync('userId')
}).then(res=>{
console.log('111111', res);
const { community_worker } = res;
uni.setStorageSync('order_dispatch_permission', community_worker && community_worker[0].order_dispatch_permission == 1 || false);
console.log(res)
})
},
// app
async appLogin() {
try {
const loginRes = await request(apiArr.login, 'POST', {
code: '',
phone: this.userId,
password: this.passWord
}, { silent: false });
uni.setStorageSync('ctoken', loginRes.token);
uni.setStorageSync('is_deal', loginRes.is_deal);
uni.setStorageSync('is_dev', loginRes.is_dev);
uni.setStorageSync('is_shop', loginRes.is_shop);
//
const loginInfoRes = await request(apiArr.loginInfo, 'POST', {
token: loginRes.token
}, { slient: false });
uni.setStorageSync('userId', loginInfoRes.user_id);
uni.setStorageSync('openId', loginInfoRes.open_id);
uni.setStorageSync('shopId', loginInfoRes.wshop_id);
uni.setStorageSync('phone', this.userId); // app
this.isLogin = true;
uni.hideLoading();
if (loginRes.msg) {
uni.showModal({
title: '提示',
content: loginRes.msg,
showCancel: false,
complete: (res) => {
if (res.confirm) {
this.tohome();
}
}
})
} else {
this.tohome();
}
} catch (error) {
uni.hideLoading();
//TODO handle the exception
console.log('app登录异常', error);
}
},
//
tohome: function() {
// console.log(123);
uni.redirectTo({
url: '/pages/index/index'
});
} }
}, },
onLoad() {
const systemInfo = uni.getSystemInfoSync();
console.log('platformplatform', systemInfo) //
// this.loginChannel = systemInfo.osName; tohome: function () {
// return; // console.log(123);
if (systemInfo.uniPlatform === 'mp-weixin') { uni.redirectTo({
this.loginChannel = systemInfo.uniPlatform; url: '/pages/index/index'
} else { });
this.loginChannel = systemInfo.osName; }
} },
onLoad() {
const systemInfo = uni.getSystemInfoSync();
console.log('platformplatform', systemInfo)
// this.loginChannel = systemInfo.osName;
// return;
if (systemInfo.uniPlatform === 'mp-weixin') {
this.loginChannel = systemInfo.uniPlatform;
} else {
this.loginChannel = systemInfo.osName;
} }
} }
}
</script> </script>
<style> <style>
@import url("./login.css"); @import url("./login.css");
</style> </style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2841,7 +2841,7 @@ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/inte
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.validateEmail = exports.uploadVideo = exports.upload = exports.uniqueByField = exports.request = exports.picUrl = exports.menuButtonInfo = exports.isPhone = exports.getProviderPromise = exports.floatCalculate = exports.debounce = exports.calculateDistance = exports.NavgateTo = void 0; exports.validateEmail = exports.uploadVideo = exports.upload = exports.uniqueByField = exports.request = exports.picUrl = exports.menuButtonInfo = exports.isPhone = exports.getProviderPromise = exports.formatDate = exports.floatCalculate = exports.debounce = exports.calculateDistance = exports.NavgateTo = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11)); var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@ -3253,7 +3253,22 @@ var debounce = function debounce(fn) {
}, delay); }, delay);
}; };
}; };
/**
* 格式化日期
* @param {date} 时间戳
*/
exports.debounce = debounce; exports.debounce = debounce;
var formatDate = function formatDate(date) {
var year = date.getFullYear();
var month = String(date.getMonth() + 1).padStart(2, '0');
var day = String(date.getDate()).padStart(2, '0');
var hours = String(date.getHours()).padStart(2, '0');
var minutes = String(date.getMinutes()).padStart(2, '0');
var seconds = String(date.getSeconds()).padStart(2, '0');
return "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
};
exports.formatDate = formatDate;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"])) /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }), /***/ }),
@ -3327,7 +3342,22 @@ var apiArr = {
commInfo: "/api/v2/wechat/mpuser-crud/community-owner/info", commInfo: "/api/v2/wechat/mpuser-crud/community-owner/info",
//我的房产信息小区列表 //我的房产信息小区列表
create: "/api/v2/wechat/community-owners/create" //创建新的业主信息 create: "/api/v2/wechat/community-owners/create",
//创建新的业主信息
getOrderList: "/api/v2/wechat/community-orders/get-all-list",
//获取账单
getCommunityRoomList: "/api/v2/wechat/community-room/list",
//获取房源列表
getUserGovenmentMoney: "/api/v2/wechat/government-housing-fund-flow-crud/user",
//获取用户公积金
createPayOrder: "/api/v2/wechat/community-order-pay/create",
//创建缴费
getPayOrderInfo: "/api/v2/wechat/community-order-pay/get-one",
//根据缴费信息获取支付信息
getPayOrderList: "/api/v2/wechat/community-order-pay/get-page",
//查询缴费记录
OrderPay: "/api/v2/wechat/community-order-pay/preorder" //预下单
}; };
exports.apiArr = apiArr; exports.apiArr = apiArr;
@ -6694,7 +6724,9 @@ var apiArr = {
categoryPage: '/api/v2/wechat/announcement-category-crud/page', categoryPage: '/api/v2/wechat/announcement-category-crud/page',
// 公告分类信息分页 // 公告分类信息分页
infoPage: '/api/v2/wechat/announcement-crud/page' // 公告信息分页 infoPage: '/api/v2/wechat/announcement-crud/page',
// 公告信息分页
getAnnounceInfo: "/api/v2/wechat/announcement-crud/info" //公告详情
}; };
exports.apiArr = apiArr; exports.apiArr = apiArr;

View File

@ -3,18 +3,5 @@
"projectname": "uniapp-ZHSQ", "projectname": "uniapp-ZHSQ",
"setting": { "setting": {
"compileHotReLoad": true "compileHotReLoad": true
},
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/shopcity/shopcity",
"pathName": "pages/shopcity/shopcity",
"query": "",
"scene": null,
"launchMode": "default"
}
]
}
} }
} }

View File

@ -10,24 +10,24 @@ export const picUrl = 'https://test.hshuishang.com'; // 图片地址前缀
* @param {Boolean} options.isLogin - 是否需要校验登录态默认为 true * @param {Boolean} options.isLogin - 是否需要校验登录态默认为 true
*/ */
export const NavgateTo = (path, options = {}) => { export const NavgateTo = (path, options = {}) => {
const { isLogin = true } = options; const { isLogin = true } = options;
const ctoken = uni.getStorageSync('ctoken'); const ctoken = uni.getStorageSync('ctoken');
if (isLogin) { if (isLogin) {
if (!ctoken) { if (!ctoken) {
uni.redirectTo({ url: '/pages/login/login' }) uni.redirectTo({ url: '/pages/login/login' })
return return
} else { } else {
if(path == '1'){ if (path == '1') {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
return return
} }
uni.navigateTo({ uni.navigateTo({
url: path url: path
}); });
return; return;
} }
} }
uni.navigateTo({ url: path }) uni.navigateTo({ url: path })
} }
@ -45,25 +45,25 @@ export const NavgateTo = (path, options = {}) => {
export const request = (url, method = 'POST', data = {}, options = {}) => { export const request = (url, method = 'POST', data = {}, options = {}) => {
const { silent = true, nested = false } = options; const { silent = true, nested = false } = options;
let ctoken = null; let ctoken = null;
if (options.token) { if (options.token) {
ctoken = options.token; ctoken = options.token;
} else { } else {
ctoken = uni.getStorageSync('ctoken'); // 后续接口强依赖强校验该字段 ctoken = uni.getStorageSync('ctoken'); // 后续接口强依赖强校验该字段
} }
if (silent) { if (silent) {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
}; };
let params = { let params = {
user_id: uni.getStorageSync('userId'), user_id: uni.getStorageSync('userId'),
...data, ...data,
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url: RequsetUrl + url, url: RequsetUrl + url,
@ -71,67 +71,67 @@ export const request = (url, method = 'POST', data = {}, options = {}) => {
data: params, data: params,
header: { header: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': ctoken, 'Authorization': ctoken,
// ...header, // ...header,
}, },
success: (res) => { success: (res) => {
// console.log('请求成功,接口返参', res); // console.log('请求成功,接口返参', res);
if (res.statusCode == 401 || (res.statusCode == 500 && res.data.msg == "效验令牌失败")) { if (res.statusCode == 401 || (res.statusCode == 500 && res.data.msg == "效验令牌失败")) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '请登录后查看', content: '请登录后查看',
confirmText:"去登陆", confirmText: "去登陆",
complete: (res) => { complete: (res) => {
if (res.cancel) { if (res.cancel) {
uni.hideLoading(); uni.hideLoading();
uni.redirectTo({ uni.redirectTo({
url: '/pages/index/index' url: '/pages/index/index'
}); });
return return
} }
if (res.confirm) { if (res.confirm) {
uni.redirectTo({ uni.redirectTo({
url: '/pages/login/login', url: '/pages/login/login',
}) })
} }
} }
}) })
return return
} }
if (res.statusCode === 200) { if (res.statusCode === 200) {
if (silent) { if (silent) {
uni.hideLoading(); uni.hideLoading();
} }
if (options?.nested) { if (options?.nested) {
let data = { let data = {
...res.data, ...res.data,
} }
resolve(data); // 请求成功 resolve(data); // 请求成功
return; return;
} }
resolve(res.data.data); // 请求成功 resolve(res.data.data); // 请求成功
} else { } else {
console.log('走到这列'); console.log('走到这列');
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: res.data.msg || '请求失败', title: res.data.msg || '请求失败',
icon: 'none' icon: 'none'
}) })
reject({ reject({
code: res.statusCode, code: res.statusCode,
message: res.data.msg || '请求失败', message: res.data.msg || '请求失败',
data: res.data, data: res.data,
}); });
} }
}, },
fail: (err) => { fail: (err) => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: res.data.msg || '请求失败', title: res.data.msg || '请求失败',
icon: 'none' icon: 'none'
}) })
reject({ reject({
code: -1, code: -1,
message: '接口异常,请稍后重试', message: '接口异常,请稍后重试',
@ -149,11 +149,11 @@ export const request = (url, method = 'POST', data = {}, options = {}) => {
* @returns {Boolean} 手机号是否正确 * @returns {Boolean} 手机号是否正确
*/ */
export const isPhone = (option) => { export const isPhone = (option) => {
if(option.length != 11){ if (option.length != 11) {
return false return false
} }
if (!(/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(option))) { if (!(/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(option))) {
return false return false
} else { } else {
return true return true
} }
@ -167,46 +167,46 @@ export const isPhone = (option) => {
* @returns {number} - 运算结果 * @returns {number} - 运算结果
*/ */
export const floatCalculate = (num1, num2, operator) => { export const floatCalculate = (num1, num2, operator) => {
// 获取小数位数 // 获取小数位数
function getPrecision(num) { function getPrecision(num) {
const str = num.toString(); const str = num.toString();
const decimalIndex = str.indexOf('.'); const decimalIndex = str.indexOf('.');
return decimalIndex === -1 ? 0 : str.length - decimalIndex - 1; return decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
} }
// 计算放大倍数 // 计算放大倍数
const precision1 = getPrecision(num1); const precision1 = getPrecision(num1);
const precision2 = getPrecision(num2); const precision2 = getPrecision(num2);
const maxPrecision = Math.max(precision1, precision2); const maxPrecision = Math.max(precision1, precision2);
const factor = Math.pow(10, maxPrecision); const factor = Math.pow(10, maxPrecision);
// 将数字转换为整数 // 将数字转换为整数
const intNum1 = Math.round(num1 * factor); const intNum1 = Math.round(num1 * factor);
const intNum2 = Math.round(num2 * factor); const intNum2 = Math.round(num2 * factor);
// 根据运算符进行计算 // 根据运算符进行计算
let result; let result;
switch (operator) { switch (operator) {
case '+': case '+':
result = (intNum1 + intNum2) / factor; result = (intNum1 + intNum2) / factor;
break; break;
case '-': case '-':
result = (intNum1 - intNum2) / factor; result = (intNum1 - intNum2) / factor;
break; break;
case '*': case '*':
result = (intNum1 * intNum2) / (factor * factor); result = (intNum1 * intNum2) / (factor * factor);
break; break;
case '/': case '/':
result = intNum1 / intNum2; result = intNum1 / intNum2;
break; break;
case '+=': case '+=':
result = (intNum1 + intNum2) / factor; result = (intNum1 + intNum2) / factor;
break; break;
default: default:
throw new Error('不支持的运算符'); throw new Error('不支持的运算符');
} }
return result; return result;
} }
/** /**
@ -221,11 +221,11 @@ export const upload = (filename, fn) => {
}) })
uni.uploadFile({ uni.uploadFile({
url: RequsetUrl + '/api/v1/public/upload-image', url: RequsetUrl + '/api/v1/public/upload-image',
filePath: filename, filePath: filename,
name: 'image', name: 'image',
formData: { formData: {
'uid': uni.getStorageSync('uid'), 'uid': uni.getStorageSync('uid'),
}, },
success: (f) => { success: (f) => {
uni.hideLoading(); uni.hideLoading();
@ -239,7 +239,7 @@ export const upload = (filename, fn) => {
icon: 'none' icon: 'none'
}) })
}, },
complete: () => {} complete: () => { }
}); });
} }
@ -255,11 +255,11 @@ export const uploadVideo = (filename, fn) => {
mask: true mask: true
}) })
uni.uploadFile({ uni.uploadFile({
url: RequsetUrl + '/api/v1/public/upload-video', url: RequsetUrl + '/api/v1/public/upload-video',
filePath: filename, filePath: filename,
name: 'file', name: 'file',
formData: { formData: {
'uid': uni.getStorageSync('uid'), 'uid': uni.getStorageSync('uid'),
}, },
success: (f) => { success: (f) => {
uni.hideLoading(); uni.hideLoading();
@ -273,7 +273,7 @@ export const uploadVideo = (filename, fn) => {
icon: 'none' icon: 'none'
}) })
}, },
complete: () => {} complete: () => { }
}); });
} }
@ -285,47 +285,47 @@ export const uploadVideo = (filename, fn) => {
* @param {string} lon2 第二个点的经度 * @param {string} lon2 第二个点的经度
* @returns {number} 距离 * @returns {number} 距离
*/ */
export const calculateDistance = (lat1, lon1, lat2, lon2)=>{ export const calculateDistance = (lat1, lon1, lat2, lon2) => {
// 将经纬度转换为弧度 // 将经纬度转换为弧度
const toRad = (value) => (value * Math.PI) / 180; const toRad = (value) => (value * Math.PI) / 180;
const R = 6371; // 地球半径(单位:千米) const R = 6371; // 地球半径(单位:千米)
const dLat = toRad(lat2 - lat1); const dLat = toRad(lat2 - lat1);
const dLon = toRad(lon2 - lon1); const dLon = toRad(lon2 - lon1);
const a = const a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2); Math.sin(dLon / 2) * Math.sin(dLon / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = R * c; // 最终距离(单位:千米) const distance = R * c; // 最终距离(单位:千米)
return distance; return distance;
} }
// //
export const menuButtonInfo = () => { export const menuButtonInfo = () => {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
const platform = systemInfo.platform; const platform = systemInfo.platform;
if (platform === 'ios') { if (platform === 'ios') {
// TODO: ios待测试 // TODO: ios待测试
return { return {
height: systemInfo.statusBarHeight, height: systemInfo.statusBarHeight,
top: 44, top: 44,
}; };
} }
if (platform === 'android') { if (platform === 'android') {
return { return {
height: systemInfo.statusBarHeight, height: systemInfo.statusBarHeight,
top: 44, // 自定义导航栏默认高度 top: 44, // 自定义导航栏默认高度
}; };
} }
if (systemInfo.uniPlatform === 'mp-weixin') { if (systemInfo.uniPlatform === 'mp-weixin') {
// 微信小程序、支付宝小程序等,平台标识以 'mp-' 开头 // 微信小程序、支付宝小程序等,平台标识以 'mp-' 开头
return uni.getMenuButtonBoundingClientRect() return uni.getMenuButtonBoundingClientRect()
} else { } else {
return 'Unknown'; return 'Unknown';
} }
} }
/** /**
@ -334,38 +334,38 @@ export const menuButtonInfo = () => {
* @returns {Promise} 返回一个Promise对象 * @returns {Promise} 返回一个Promise对象
*/ */
export const getProviderPromise = (opt) => { export const getProviderPromise = (opt) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.getProvider({ uni.getProvider({
service: opt, service: opt,
success: (res) => { success: (res) => {
console.log('获取支付服务提供商成功:', res.provider); console.log('获取支付服务提供商成功:', res.provider);
resolve(res.provider); resolve(res.provider);
}, },
fail: (err) => { fail: (err) => {
console.error('获取支付服务提供商失败:', err); console.error('获取支付服务提供商失败:', err);
reject(err); reject(err);
} }
});
}); });
});
} }
//数组去重 //数组去重
export const uniqueByField = (arr, field) => { export const uniqueByField = (arr, field) => {
const seen = {}; const seen = {};
return arr.filter(item => { return arr.filter(item => {
const key = item[field]; const key = item[field];
return seen.hasOwnProperty(key) ? false : (seen[key] = true); return seen.hasOwnProperty(key) ? false : (seen[key] = true);
}); });
} }
// 校验邮箱地址是否合法 // 校验邮箱地址是否合法
export const validateEmail = (email) => { export const validateEmail = (email) => {
// 正则表达式验证邮箱格式 // 正则表达式验证邮箱格式
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!regex.test(email)) { if (!regex.test(email)) {
return false; return false;
} }
return true return true
} }
@ -378,16 +378,16 @@ export const validateEmail = (email) => {
*/ */
export const debounce = (fn, delay = 300, immediate = false) => { export const debounce = (fn, delay = 300, immediate = false) => {
let timer = null; let timer = null;
return function(...args) { return function (...args) {
const context = this; const context = this;
if (timer) clearTimeout(timer); if (timer) clearTimeout(timer);
if (immediate && !timer) { if (immediate && !timer) {
fn.apply(context, args); fn.apply(context, args);
} }
timer = setTimeout(() => { timer = setTimeout(() => {
if (!immediate) { if (!immediate) {
fn.apply(context, args); fn.apply(context, args);
@ -398,3 +398,17 @@ export const debounce = (fn, delay = 300, immediate = false) => {
} }
/**
* 格式化日期
* @param {date} 时间戳
*/
export const formatDate = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}