Compare commits

...

2 Commits

Author SHA1 Message Date
ylj20011123
57c0135413 update 2025-08-15 19:46:40 +08:00
ylj20011123
ff19b35f7b update 2025-08-14 19:32:58 +08:00
31 changed files with 5779 additions and 307 deletions

12
App.vue
View File

@ -19,7 +19,6 @@ export default {
...data.data,
ip: data.ip,
};
console.log("obj", obj);
uni.setStorageSync("userInfo", obj);
},
fail(error) {
@ -28,7 +27,7 @@ export default {
});
},
},
onLaunch: function (options) {
onLaunch: async function (options) {
uni.getSystemInfo({
success: function (e) {
// #ifndef MP
@ -54,9 +53,10 @@ export default {
let _this = this;
if (this.user.WeChat_MiniProToken) {
this.memberLogin();
await this.memberLogin()
// await this.memberLogin();
} else {
this.getLoginCode();
await this.getLoginCode();
}
this.setVisitChannels(options.scene);
@ -106,6 +106,7 @@ export default {
<style>
@import url("./common/uni.css");
/*每个页面公共css */
page {
font-size: 26rpx;
@ -128,10 +129,12 @@ page {
.process-box.uni-active {
padding-bottom: 30rpx;
}
.process-box process-unit:nth-last-child(1) .prosess-unit::before {
content: "";
width: 0rpx;
}
.ico,
.ico-s {
display: block;
@ -203,6 +206,7 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked {
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
font-size: 30rpx;
}
/* #endif */
button::after {
border: none;

View File

@ -199,7 +199,7 @@ function addUserBehavior(obj) {
userName: userDate.UserName,
phoneNumber: userDate.Membership_Phone,
userId: userDate.UserId ? userDate.UserId : '',
wechatAppId: 'wxa99ef047735c031e',
wechatAppId: 'wx6e28691bea93c6ec',
intoRoute: obj.intoRoute,
outtoRoute: obj.outtoRoute,
visitChannels: obj.visitChannels,
@ -235,7 +235,7 @@ function addUserBehaviorNew(obj) {
userName: userDate.UserName,
phoneNumber: userDate.Membership_Phone,
userId: userDate.UserId ? userDate.UserId : '',
wechatAppId: 'wxa99ef047735c031e',
wechatAppId: 'wx6e28691bea93c6ec',
intoRoute: obj.intoRoute,
outtoRoute: obj.outtoRoute,
visitChannels: obj.visitChannels,

View File

@ -59,7 +59,7 @@
"optimization": {
"subPackages": true
},
"appid": "wxa99ef047735c031e",
"appid": "wx6e28691bea93c6ec",
"setting": {
"urlCheck": false,
"es6": true,

View File

@ -29,9 +29,38 @@
}
],
"subPackages": [ //
{
"root": "pages/attendanceStatus",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "出勤情况",
"navigationStyle": "custom"
}
},
{
"path": "emergencyEvents",
"style": {
"navigationBarTitleText": "应急事件",
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#ffffff"
}
},
{
"path": "emergencyEventsDetail",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#F5F6F7"
}
}
]
},
{
"root": "pages/authorityApproval",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "权限审批",
@ -49,7 +78,8 @@
},
{
"root": "pages/merchantAccount",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -67,7 +97,8 @@
},
{
"root": "pages/settlementApproval",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"enablePullDownRefresh": true,
@ -90,7 +121,8 @@
},
{
"root": "pages/auditingPop",
"pages": [{
"pages": [
{
"path": "jointlySign",
"style": {
"navigationBarTitleText": "会签"
@ -116,10 +148,10 @@
}
]
},
{
"root": "pages/nationalPage",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -176,7 +208,8 @@
},
{
"root": "pages/earlyWarning",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -214,7 +247,8 @@
},
{
"root": "pages/revenue",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -239,7 +273,8 @@
},
{
"root": "pages/revenueStatistics",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -264,17 +299,20 @@
},
{
"root": "pages/newamine",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}
}]
]
},
{
"root": "pages/commercialBINew",
"pages": [{
"pages": [
{
"path": "flowAnalysis",
"style": {
"navigationBarTitleText": "",
@ -293,19 +331,19 @@
},
{
"root": "pages/summaryOfPortraits",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}
}]
]
},
{ // BI
"root": "pages/commercialBI",
"pages": [
{
"path": "guestPortrait",
"style": {
@ -415,19 +453,19 @@
{
//
"root": "pages/projectProfitSharing",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}
}]
]
},
{
"root": "pages/plan",
"pages": [
{
"path": "areaPlanMonth",
"style": {
@ -447,7 +485,8 @@
//
{
"root": "pages/examine",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -466,7 +505,8 @@
},
{
"root": "pages/projectWarning",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "分润比例切换"
@ -483,17 +523,20 @@
},
{
"root": "pages/robot",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "数智助手",
"navigationStyle": "custom"
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "数智助手",
"navigationStyle": "custom"
}
}
}]
]
},
{
"root": "pages/map",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "",
@ -517,7 +560,8 @@
},
{
"root": "pages/operatingStatements",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "经营报表",
@ -548,7 +592,8 @@
},
{
"root": "pages/tender",
"pages": [{
"pages": [
{
"path": "tender",
"style": {
"enablePullDownRefresh": true,
@ -584,7 +629,8 @@
},
{
"root": "pages/serviceAreaReimbursement",
"pages": [{
"pages": [
{
"path": "serviceAreaReimbursement",
"style": {
"enablePullDownRefresh": true,
@ -602,7 +648,8 @@
},
{
"root": "pages/dataSummary",
"pages": [{
"pages": [
{
"path": "dataSummary",
"style": {
"enablePullDownRefresh": true,
@ -626,7 +673,8 @@
},
{
"root": "pages/businessApproval",
"pages": [{
"pages": [
{
"path": "businessApproval",
"style": {
"enablePullDownRefresh": true,
@ -643,7 +691,8 @@
},
{
"root": "pages/everdayRenven",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"enablePullDownRefresh": false,
@ -689,7 +738,8 @@
},
{
"root": "pages/suggestion",
"pages": [{
"pages": [
{
"path": "suggestion",
"style": {
"enablePullDownRefresh": true,
@ -706,7 +756,8 @@
},
{
"root": "pages/contract",
"pages": [{
"pages": [
{
"path": "contract",
"style": {
"enablePullDownRefresh": true,
@ -723,7 +774,8 @@
},
{
"root": "pages/cashAudit",
"pages": [{
"pages": [
{
"path": "list",
"style": {
"enablePullDownRefresh": true,
@ -746,7 +798,8 @@
},
{
"root": "pages/investment",
"pages": [{
"pages": [
{
"path": "investment",
"style": {
"enablePullDownRefresh": true,
@ -763,7 +816,8 @@
},
{
"root": "pages/expenseApproval",
"pages": [{
"pages": [
{
"path": "expenseApproval",
"style": {
"enablePullDownRefresh": true,
@ -781,7 +835,8 @@
},
{
"root": "pages/commodity_temp",
"pages": [{
"pages": [
{
"path": "index",
"style": {
"enablePullDownRefresh": true,
@ -799,27 +854,32 @@
},
{
"root": "pages/testPage",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "测试页面"
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "测试页面"
}
}
}]
]
},
{
"root": "pages/billOfLading",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "提单"
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": "提单"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}
}, {
"path": "detail",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}]
]
}
],
"globalStyle": {
@ -833,13 +893,13 @@
"selectedColor": "#3295f9",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/images/tab/home.png",
"selectedIconPath": "static/images/tab/homeActive.png",
"text": ""
},
{
"pagePath": "pages/userCenter/userCenter",
"iconPath": "static/images/tab/user.png",

View File

@ -0,0 +1,651 @@
<!-- 应急事件 -->
<template>
<view class="main">
<view class="emergencyList pad15">
<view class="emergencyItem" v-for="(item, index) in showList" :key="index" @click="handleShowDetail(item)"
:style="{
marginBottom: index + 1 === showList.length ? '0' : '',
border: item.status === 1 ? '2rpx solid #f4db9c' : item.status === 2 ? '2rpx solid #d3d3d3' : ''
}">
<view class="emergencyItemTitle">
<view class="emergencyItemTitleLeft">
{{ type === 1 ? item.title || "" : type === 2 ? item.service || "" : "" }}
</view>
<view class="emergencyItemTitleRight">
<view class="emergencyItemStatus" :style="{
background: item.status === 1 ? '#ecbd44' : item.status === 2 ? '#d3d3d3' : '',
color: item.status === 1 ? '#fff' : item.status === 2 ? '#fff' : ''
}">
{{ item.status === 1 ? '已完成' : item.status ===
2 ? '处理中' : '' }}</view>
</view>
</view>
<view class="emergencyDesc">{{ item.desc || "" }}</view>
<view class="line"></view>
<view class="otherMessageRow">
<image class="otherMessageIcon" src="https://eshangtech.com/cyy_DIB/personIcon.png" />
<view class="otherMessageValue">{{ item.person }}</view>
</view>
<view class="otherMessageRow">
<image class="otherMessageIcon" src="https://eshangtech.com/cyy_DIB/phoneLabelIcon.png" />
<view class="otherMessageValue">{{ item.phone }}</view>
</view>
<view class="otherMessageRow" style="margin-bottom: 0;">
<image class="otherMessageIcon" src="https://eshangtech.com/cyy_DIB/timeIcon.png" />
<view class="otherMessageValue">{{ item.time }}</view>
</view>
</view>
<!-- <view :class="item.status === 1 ? 'event-item left-ok' : item.status === 2 ? 'event-item' : ''"
v-for="(item, index) in showList" :key="index" @click="handleShowDetail(item)">
<view class="event-header">
<view class="event-title">{{ type === 1 ? item.title || "" : type === 2 ? item.service || "" : "" }}
</view>
<view class="event-meta">
<view class="event-time">
<text>🕐</text><text>{{ item.time || "" }}</text>
</view>
<view class="event-priority priority-high" :style="{
background: item.status === 1 ? '#E7F8EE' : item.status === 2 ? '#f9dfe2' : '',
color: item.status === 1 ? '#3DC272' : item.status === 2 ? '#ff4757' : ''
}">
{{ item.status === 1 ? '已完成' : item.status ===
2 ? '处理中' : '' }}</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line">{{ item.desc || "" }}</text>
</view>
</view>
</view> -->
</view>
<!-- 应急事件详情 -->
<uni-popup ref="popup" border-radius="10px 10px 0 0" @change="handlePopupChange">
<!-- 应急事件的 -->
<view class="eventsPopupBox" v-if="eventsDetail && type === 1">
<view class="eventsItem">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/personIcon.png" />
<view class="eventsHaveLabel">联系人</view>
</view>
<view class="eventsValue">{{ eventsDetail.person || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/phoneLabelIcon.png" />
<view class="eventsHaveLabel">联系电话</view>
</view>
<view class="eventsValue">{{ eventsDetail.phone || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/timeIcon.png" />
<view class="eventsHaveLabel">处理用时</view>
</view>
<view class="eventsValue">{{ eventsDetail.haveTime || "" }}</view>
</view>
<view class="line"></view>
<view class="eventsItem">
<view class="eventsLabel">标题</view>
<view class="eventsValue">{{ eventsDetail.title || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">事件片区</view>
<view class="eventsValue">{{ eventsDetail.area || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">事件服务区</view>
<view class="eventsValue">{{ eventsDetail.service || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">死亡人数</view>
<view class="eventsValue">{{ eventsDetail.diePerson || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">事件概况</view>
<view class="eventsValue">{{ eventsDetail.desc || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">事件损失情况</view>
<view class="eventsValue">{{ eventsDetail.lossDesc || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">处理结果</view>
<view class="eventsValue">{{ eventsDetail.res || "" }}</view>
</view>
<view class="eventsItemPic">
<view class="eventsLabel">事件现场照片</view>
<view class="eventsPic" v-if="eventsDetail.imgList && eventsDetail.imgList.length > 0">
<view class="eventsPicItem" v-for="(item, index) in eventsDetail.imgList" :key="index"
@click="showImg(eventsDetail.imgList, index)">
<image class="eventsPicImg" :src="item.url" />
</view>
</view>
</view>
</view>
<!-- 日常问题 -->
<view class="eventsPopupBox" v-if="eventsDetail && type === 2">
<!-- <view class="eventsItem">
<view class="eventsLabel">处理状态</view>
<view class="eventsValue"></view>
</view> -->
<view class="eventsItem">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/personIcon.png" />
<view class="eventsHaveLabel">联系人</view>
</view>
<view class="eventsValue">{{ eventsDetail.person || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/phoneLabelIcon.png" />
<view class="eventsHaveLabel">联系电话</view>
</view>
<view class="eventsValue">{{ eventsDetail.phone || "" }}</view>
</view>
<view class="line"></view>
<view class="eventsItem">
<view class="eventsLabel">事件片区</view>
<view class="eventsValue">{{ eventsDetail.area || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">事件服务区</view>
<view class="eventsValue">{{ eventsDetail.service || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">类型</view>
<view class="eventsValue">{{ eventsDetail.type || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">问题描述</view>
<view class="eventsValue">{{ eventsDetail.desc || "" }}</view>
</view>
<view class="eventsSmallTitle">协调处理情况</view>
<view class="eventsItem">
<view class="eventsLabel">协调处理结果</view>
<view class="eventsValue">{{ eventsDetail.startRes || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理人</view>
<view class="eventsValue">{{ eventsDetail.startPerson || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理完成时间</view>
<view class="eventsValue">{{ eventsDetail.startTime || "" }}</view>
</view>
<view class="eventsSmallTitle">经营公司协调处理情况</view>
<view class="eventsItem">
<view class="eventsLabel">协调处理结果</view>
<view class="eventsPic">{{ eventsDetail.endRes || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理人</view>
<view class="eventsValue">{{ eventsDetail.endPerson || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理完成时间</view>
<view class="eventsValue">{{ eventsDetail.endTime || "" }}</view>
</view>
<view class="eventsItemPic">
<view class="eventsLabel">事件现场照片</view>
<view class="eventsPic" v-if="eventsDetail.imgList && eventsDetail.imgList.length > 0">
<view class="eventsPicItem" v-for="(item, index) in eventsDetail.imgList" :key="index"
@click="showImg(eventsDetail.imgList, index)">
<image class="eventsPicImg" :src="item.url" />
</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
dataList: [
{
title: "中和停车区下行停水",
time: "2023-09-26 13:30:38",
area: "昭通片区管理补",//
service: "中和加油站-上行",//
eventType: "事件类型1",//
person: "徐琴",//
phone: "13408871099",//
theInjured: "",//
haveTime: "待定",//
diePerson: "0",//
desc: "水泵房故障,导致停水,急需处理",//
lossDesc: "因突发情况 卫生间卫生无法保障",//
res: "已联系施工方,未处理",//
imgList: [{ url: "https://eshangtech.com/cyy_DIB/1695785143848.jpg" }],//
status: 1,
},
{
title: "楼坝服务区停水",
time: "2023-08-02 13:57:27",
area: "昭通片区管理补",//
service: "楼坝服务区-下行",//
eventType: "事件类型1",//
person: "孔令婷",//
phone: "19987196597",//
theInjured: "",//
haveTime: "7小时",//
diePerson: "0",//
desc: "楼坝街道主水管道被路面改造施工的挖机挖断目前正在抢修中预计7小时后可正常供水服务区现用水箱里的储水进行供水。",//
lossDesc: "无",//
res: "正在进行抢修预计7小时后可正常供水服务区现用水箱里的储水进行供水。",//
imgList: null,//
status: 2,
} // status 1 2
],
everyDayList: [
{
area: "版纳片区管理部", //
service: "小勐养服务区-上行", //
time: "2024-09-12 09:14:47",
type: "其他", //
desc: "小勐养服务区上行卫生间5号蹲坑隔板底座损坏已修复。",//
person: "杨杰",//
phone: "13628710377",//
startRes: "修复完毕,建议结束流程",//
startPerson: "刀天华",//
startTime: "2024-09-12 09:43:53",//
endRes: "",//
endPerson: "",//
endTime: "流转后自动显示",//
imgList: [
{ url: "https://eshangtech.com/cyy_DIB/1726104387683_mmexport1726104287279.jpg" },
{ url: "https://eshangtech.com/cyy_DIB/1726104504808_IMG_20240912_091809.jpg" }
],//
status: 1,
},
{
area: "昆东片区管理部", //
service: "阳宗服务区-上行", //
time: "2024-08-08 13:45:25",
type: "维修上报", //
desc: "关于昆东片区管理部阳宗服务区上行更换入口车辆引导标识牌的请示",//
person: "唐林波",//
phone: "15287959258",//
startRes: "按照公司相关流程进行更换标识牌审批事宜",//
startPerson: "申锐娟",//
startTime: "流转后自动显示",//
endRes: "",//
endPerson: "",//
endTime: "流转后自动显示",//
imgList: null,//
status: 2,
}
],
showList: [],
eventsDetail: null,
type: 0
}
},
onLoad(query) {
if (query.type) {
this.type = Number(query.type)
if (this.type === 1) {
this.showList = this.dataList
} else {
this.showList = this.everyDayList
uni.setNavigationBarTitle({
title: '日常问题'
})
}
}
},
methods: {
handleShowDetail(obj) {
// this.$refs.popup.open('center')
// this.eventsDetail = obj
this.$util.toNextRoute("navigateTo", `/pages/attendanceStatus/emergencyEventsDetail?detail=${JSON.stringify(obj)}&type=${this.type}`);
},
handlePopupChange(e) {
this.showPopup = e.show
console.log('e', e);
if (!e.show) {
this.userDetail = null
}
},
//
showImg(list, index) {
console.log('list', list);
console.log('indexindex', index);
let urls = []
list.forEach((item) => {
urls.push(item.url)
})
uni.previewImage({
urls: urls,
current: list[index].url,
});
},
}
}
</script>
<style lang="less" scoped>
@bg: #f8f9fa;
@muted: #666;
@card: #fff;
@shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
@primary: #27B25F;
@primary2: #4CCC7F;
@ok: #2ed573;
@warn: #ff9f43;
@danger: #ff4757;
/* 抽屉页(特情/设施) */
.main {
width: 100vw;
height: 100vh;
.emergency-details-header {
background: linear-gradient(135deg, @danger, #ff3838);
color: #fff;
padding: 40rpx;
position: relative;
box-shadow: @shadow;
&.facilities-theme {
background: linear-gradient(135deg, #20bf6b, #0fb9b1);
}
.emergency-back-btn {
position: absolute;
left: 30rpx;
top: 30rpx;
background: rgba(255, 255, 255, .2);
border: none;
color: #fff;
font-size: 36rpx;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.h1 {
text-align: center;
display: block;
margin-bottom: 6rpx;
}
.current-area {
text-align: center;
display: block;
opacity: .9;
}
}
.emergencyList {
padding: 30rpx;
.emergencyItem {
width: 100%;
border-radius: 8rpx;
background-color: #fff;
box-shadow: @shadow;
box-sizing: border-box;
padding: 24rpx;
margin-bottom: 24rpx;
.emergencyItemTitle {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
.emergencyItemTitleLeft {
font-size: 28rpx;
font-weight: 600;
display: inline-block;
width: 80%;
}
.emergencyItemStatus {
font-size: 24rpx;
padding: 4rpx 16rpx;
border-radius: 32rpx;
}
}
.emergencyDesc {
font-size: 24rpx;
}
.line {
width: 100%;
height: 2rpx;
background-color: #dad9d3;
margin: 24rpx 0;
}
.otherMessageRow {
width: 100%;
margin-bottom: 8rpx;
display: flex;
align-items: flex-start;
.otherMessageIcon {
width: 30rpx;
height: 30rpx;
margin-right: 16rpx;
margin-top: 6rpx;
}
.otherMessageValue {
font-size: 24rpx;
}
}
}
}
.add-event-btn {
position: fixed;
bottom: 160rpx;
right: 40rpx;
width: 96rpx;
height: 96rpx;
background: linear-gradient(135deg, @primary, @primary2);
border-radius: 50%;
border: none;
color: #fff;
font-size: 40rpx;
box-shadow: 0 8rpx 24rpx rgba(74, 144, 226, .4);
}
.promo-banner {
margin: 30rpx;
border-radius: 24rpx;
overflow: hidden;
box-shadow: @shadow;
.promo-image {
width: 100%;
height: 240rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 48rpx;
position: relative;
overflow: hidden;
.promo-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(transparent, rgba(0, 0, 0, .7));
padding: 40rpx 30rpx 30rpx;
color: #fff;
.promo-title {
font-size: 32rpx;
font-weight: 700;
margin-bottom: 8rpx;
}
.promo-subtitle {
font-size: 24rpx;
opacity: .9;
}
}
}
}
.facilities-section {
margin: 30rpx;
background: #fff;
border-radius: 24rpx;
overflow: hidden;
box-shadow: @shadow;
.facilities-header {
background: linear-gradient(135deg, #20bf6b, #0fb9b1);
color: #fff;
padding: 30rpx;
font-weight: 700;
font-size: 32rpx;
display: flex;
align-items: center;
gap: 16rpx;
}
}
.eventsPopupBox {
width: 90vw;
height: 80vh;
background-color: #fff;
border-radius: 16rpx;
box-sizing: border-box;
padding: 24rpx;
overflow-y: auto;
.eventsItemTitle {
width: 100%;
font-size: 28rpx;
font-weight: 600;
}
.eventsItem {
width: 100%;
margin-bottom: 16rpx;
display: flex;
align-items: flex-start;
.eventsHaveImgLabel {
display: flex;
width: 200rpx;
align-items: center;
.eventsHaveImg {
width: 30rpx;
height: 30rpx;
margin-right: 16rpx;
margin-top: 6rpx;
}
.eventsHaveLabel {
width: 154rpx;
font-size: 26rpx;
}
}
.eventsLabel {
width: 200rpx;
text-align: left;
font-size: 26rpx;
}
.eventsValue {
flex: 1;
font-size: 24rpx;
}
}
.line {
width: 100%;
height: 2rpx;
background-color: #dad9d3;
margin: 24rpx 0;
}
.eventsSmallTitle {
margin: 16rpx 0;
width: 100%;
font-size: 28rpx;
font-weight: 600;
}
.eventsItemPic {
width: 100%;
.eventsLabel {
width: 200rpx;
text-align: left;
font-size: 26rpx;
}
.eventsPic {
flex: 1;
display: flex;
align-items: center;
font-size: 24rpx;
.eventsPicItem {
width: 100rpx;
height: 100rpx;
margin-right: 8rpx;
margin-bottom: 8rpx;
.eventsPicImg {
width: 100%;
height: 100%;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,405 @@
<template>
<view class="main">
<view class="detailBox">
<view class="pageTitle">{{ detailObj.title || "" }}</view>
<view class="userDetailBox" :style="{ marginTop: pageType === 1 ? '' : '0' }">
<view class="userDetailBoxTop">
<view class="userDetailBoxService">{{ detailObj.service || "" }}</view>
<view class="userDetailBoxServiceRight">
<view class="userDetailBoxStatus" :style="{
background: detailObj.status === 1 ? '#ecbd44' : detailObj.status === 2 ? '#d3d3d3' : '',
color: detailObj.status === 1 ? '#fff' : detailObj.status === 2 ? '#fff' : ''
}">
{{ detailObj.status === 1 ? '已完成' : detailObj.status ===
2 ? '处理中' : '' }}</view>
</view>
</view>
<view class="eventsItem" style="margin-top: 24rpx;">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/personIcon.png" />
<view class="eventsHaveLabel">联系人</view>
</view>
<view class="eventsValue">{{ detailObj.person || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/phoneLabelIcon.png" />
<view class="eventsHaveLabel">联系电话</view>
</view>
<view class="eventsValue">{{ detailObj.phone || "" }}</view>
</view>
<view class="eventsItem" style="margin-bottom: 0;">
<view class="eventsHaveImgLabel">
<image class="eventsHaveImg" src="https://eshangtech.com/cyy_DIB/timeIcon.png" />
<view class="eventsHaveLabel">处理用时</view>
</view>
<view class="eventsValue">{{ detailObj.haveTime || "" }}</view>
</view>
</view>
</view>
<view class="pageText" v-if="pageType === 1">应急事件</view>
<view class="pageText" v-if="pageType === 2">日常问题</view>
<view class="detailBox" v-if="pageType === 1">
<view class="userDetailBox noBoxShow">
<!-- <view class="eventsItem">
<view class="eventsLabel">标题</view>
<view class="eventsValue">{{ detailObj.title || "" }}</view>
</view> -->
<view class="eventsItem">
<view class="eventsLabel">事件片区</view>
<view class="eventsValue">{{ detailObj.area || "" }}</view>
</view>
<!-- <view class="eventsItem">
<view class="eventsLabel">事件服务区</view>
<view class="eventsValue">{{ detailObj.service || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">死亡人数</view>
<view class="eventsValue">{{ detailObj.diePerson || "" }}</view>
</view> -->
<view class="eventsItem">
<view class="eventsLabel">事件概况</view>
<view class="eventsValue">{{ detailObj.desc || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">事件损失情况</view>
<view class="eventsValue">{{ detailObj.lossDesc || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">处理结果</view>
<view class="eventsValue">{{ detailObj.res || "" }}</view>
</view>
<view class="eventsItemPic">
<view class="eventsLabel">事件现场照片</view>
<view class="eventsPic" v-if="detailObj.imgList && detailObj.imgList.length > 0">
<view class="eventsPicItem" v-for="(item, index) in detailObj.imgList" :key="index"
@click="showImg(detailObj.imgList, index)">
<image class="eventsPicImg" :src="item.url" />
</view>
</view>
</view>
</view>
</view>
<view class="detailBox" v-if="pageType === 2" style="padding-bottom: 24rpx;">
<view class="userDetailBox noBoxShow">
<view class="eventsItem">
<view class="eventsLabel">事件片区</view>
<view class="eventsValue">{{ detailObj.area || "" }}</view>
</view>
<!-- <view class="eventsItem">
<view class="eventsLabel">事件服务区</view>
<view class="eventsValue">{{ detailObj.service || "" }}</view>
</view> -->
<view class="eventsItem">
<view class="eventsLabel">类型</view>
<view class="eventsValue">{{ detailObj.type || "" }}</view>
</view>
<view class="eventsItem" style="margin-bottom: 0;">
<view class="eventsLabel">问题描述</view>
<view class="eventsValue">{{ detailObj.desc || "" }}</view>
</view>
</view>
</view>
<view class="pageText" v-if="pageType === 2">协调处理情况</view>
<view class="detailBox" v-if="pageType === 2" style="padding-bottom: 24rpx;">
<view class="eventsItem">
<view class="eventsLabel">协调处理结果</view>
<view class="eventsValue">{{ detailObj.startRes || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理人</view>
<view class="eventsValue">{{ detailObj.startPerson || "" }}</view>
</view>
<view class="eventsItem" style="margin-bottom: 0;">
<view class="eventsLabel">办理完成时间</view>
<view class="eventsValue">{{ detailObj.startTime || "" }}</view>
</view>
</view>
<view class="pageText" v-if="pageType === 2">经营公司协调处理情况</view>
<view class="detailBox" v-if="pageType === 2" style="padding-bottom: 24rpx;">
<view class="eventsItem">
<view class="eventsLabel">协调处理结果</view>
<view class="eventsPic">{{ detailObj.endRes || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理人</view>
<view class="eventsValue">{{ detailObj.endPerson || "" }}</view>
</view>
<view class="eventsItem">
<view class="eventsLabel">办理完成时间</view>
<view class="eventsValue">{{ detailObj.endTime || "" }}</view>
</view>
<view class="eventsItemPic" style="margin-bottom: 0;">
<view class="eventsLabel">事件现场照片</view>
<view class="eventsPic" v-if="detailObj.imgList && detailObj.imgList.length > 0">
<view class="eventsPicItem" v-for="(item, index) in detailObj.imgList" :key="index"
@click="showImg(detailObj.imgList, index)">
<image class="eventsPicImg" :src="item.url" />
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
detailObj: null,
pageType: 0
}
},
onLoad(query) {
if (query.detail) {
this.detailObj = JSON.parse(query.detail)
}
if (query.type) {
this.pageType = Number(query.type)
}
if (this.pageType === 1) {
uni.setNavigationBarTitle({
title: '应急事件'
})
} else {
uni.setNavigationBarTitle({
title: '日常问题'
})
}
},
methods: {
//
showImg(list, index) {
console.log('list', list);
console.log('indexindex', index);
let urls = []
list.forEach((item) => {
urls.push(item.url)
})
uni.previewImage({
urls: urls,
current: list[index].url,
});
},
}
}
</script>
<style scoped lang="scss">
.main {
width: 100vw;
min-height: 100vh;
background-color: #f0f2f3;
box-sizing: border-box;
padding-bottom: constant(safe-area-inset-bottom);
/* 兼容旧版 iOS */
padding-bottom: env(safe-area-inset-bottom);
/* 兼容新版 */
.detailBox {
width: 100%;
box-sizing: border-box;
padding: 24rpx 24rpx 48rpx;
background-color: #fff;
.pageTitle {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
}
.userDetailBox {
width: calc(100% - 32rpx);
margin-top: 24rpx;
margin-left: 16rpx;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
padding: 16rpx 24rpx;
.userDetailBoxTop {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.userDetailBoxService {
font-size: 28rpx;
}
.userDetailBoxStatus {
display: inline-block;
font-size: 24rpx;
padding: 4rpx 16rpx;
border-radius: 32rpx;
}
}
.eventsItem {
width: 100%;
margin-bottom: 16rpx;
display: flex;
align-items: flex-start;
.eventsHaveImgLabel {
display: flex;
width: 200rpx;
align-items: center;
.eventsHaveImg {
width: 30rpx;
height: 30rpx;
margin-right: 16rpx;
margin-top: 6rpx;
}
.eventsHaveLabel {
width: 154rpx;
font-size: 24rpx;
}
}
.eventsLabel {
width: 200rpx;
text-align: left;
font-size: 24rpx;
}
.eventsValue {
flex: 1;
font-size: 24rpx;
}
}
.eventsItemPic {
width: 100%;
.eventsLabel {
width: 200rpx;
text-align: left;
font-size: 24rpx;
}
.eventsPic {
flex: 1;
display: flex;
align-items: center;
font-size: 24rpx;
.eventsPicItem {
width: 100rpx;
height: 100rpx;
margin-right: 8rpx;
margin-bottom: 8rpx;
.eventsPicImg {
width: 100%;
height: 100%;
}
}
}
}
}
.noBoxShow {
box-shadow: none;
margin-top: 0;
padding: 0 24rpx;
margin-left: 0;
}
.eventsItem {
width: 100%;
margin-bottom: 16rpx;
display: flex;
align-items: flex-start;
.eventsHaveImgLabel {
display: flex;
width: 200rpx;
align-items: center;
.eventsHaveImg {
width: 30rpx;
height: 30rpx;
margin-right: 16rpx;
margin-top: 6rpx;
}
.eventsHaveLabel {
width: 154rpx;
font-size: 24rpx;
}
}
.eventsLabel {
width: 200rpx;
text-align: left;
font-size: 24rpx;
}
.eventsValue {
flex: 1;
font-size: 24rpx;
}
}
.eventsItemPic {
width: 100%;
.eventsLabel {
width: 200rpx;
text-align: left;
font-size: 24rpx;
}
.eventsPic {
flex: 1;
display: flex;
align-items: center;
font-size: 24rpx;
.eventsPicItem {
width: 100rpx;
height: 100rpx;
margin-right: 8rpx;
margin-bottom: 8rpx;
.eventsPicImg {
width: 100%;
height: 100%;
}
}
}
}
}
.pageText {
width: 100%;
box-sizing: border-box;
padding: 16rpx 40rpx;
font-size: 24rpx;
color: #8d8e8e;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,469 @@
<!-- 服务设施管理 -->
<template>
<view class="emergency-details">
<view class="emergency-details-header facilities-theme">
<button class="emergency-back-btn" @tap="closeFacilitiesPage"></button>
<text class="h1">🏪 服务设施管理</text>
<text class="current-area">设备状态监控与维护</text>
</view>
<!-- 宣传横幅 -->
<view class="promo-banner" @tap="viewServiceDetails">
<view class="promo-image">
<text>🏞</text>
<view class="promo-content">
<view class="promo-title">阳澄湖服务区</view>
<view class="promo-subtitle">品质服务 · 舒适体验 · 安全便民</view>
</view>
</view>
</view>
<!-- 概览 -->
<view class="section m15">
<view class="section-header">📊 设施状态概览</view>
<view class="stats-grid p15 noMargin">
<view class="stat-card">
<view class="stat-number ok">7</view>
<view class="stat-label">正常运行</view>
</view>
<view class="stat-card">
<view class="stat-number warn">1</view>
<view class="stat-label">维护中</view>
</view>
<view class="stat-card">
<view class="stat-number danger">0</view>
<view class="stat-label">故障停用</view>
</view>
</view>
</view>
<!-- 设施列表 -->
<view class="facilities-section">
<view class="facilities-header">🏪 服务设施详情</view>
<view class="event-list noPad">
<!-- 加油站 -->
<view class="event-item left-ok">
<view class="event-header">
<view class="event-title"> 加油站服务</view>
<view class="event-meta">
<view class="event-priority priority-low ok">运行正常</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line"> 92#汽油7.8/ 95#汽油8.3/</text>
<text class="line"> 0#柴油7.2/</text>
<text class="line"> 24小时营业支持现金刷卡手机支付</text>
</view>
<view class="event-actions">
<button class="event-action-btn btn-primary" @tap="checkFuelStock">库存查询</button>
<button class="event-action-btn btn-success" @tap="contactFuelStaff">联系加油员</button>
</view>
</view>
</view>
<!-- 充电桩 -->
<view class="event-item left-ok">
<view class="event-header">
<view class="event-title">🔌 新能源充电桩</view>
<view class="event-meta">
<view class="event-priority priority-low ok">运行正常</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line"> 快充桩860kW 慢充桩47kW</text>
<text class="line"> 当前使用6个桩在充电中</text>
<text class="line"> 支持国标充电接口扫码即充</text>
</view>
<view class="event-actions">
<button class="event-action-btn btn-primary" @tap="checkChargingStatus">充电状态</button>
<button class="event-action-btn btn-warning" @tap="reportChargingIssue">故障上报</button>
</view>
</view>
</view>
<!-- 餐厅 -->
<view class="event-item left-ok">
<view class="event-header">
<view class="event-title">🍽 餐厅服务</view>
<view class="event-meta">
<view class="event-priority priority-low ok">营业中</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line"> 营业时间06:00-23:00</text>
<text class="line"> 特色苏式小笼包阳澄湖大闸蟹套餐</text>
<text class="line"> 座位80当前客流量适中</text>
</view>
<view class="event-actions">
<button class="event-action-btn btn-primary" @tap="viewMenu">查看菜单</button>
<button class="event-action-btn btn-success" @tap="contactChef">联系厨房</button>
</view>
</view>
</view>
<!-- 便利店 -->
<view class="event-item left-ok">
<view class="event-header">
<view class="event-title">🛒 便利店</view>
<view class="event-meta">
<view class="event-priority priority-low ok">营业中</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line"> 24小时营业</text>
<text class="line"> 商品日用品零食饮料汽车用品纪念品</text>
<text class="line"> 特色阳澄湖特产江南小食</text>
</view>
<view class="event-actions">
<button class="event-action-btn btn-primary" @tap="checkInventory">库存管理</button>
<button class="event-action-btn btn-success" @tap="contactCashier">联系收银</button>
</view>
</view>
</view>
<!-- 停车场 -->
<view class="event-item left-warn">
<view class="event-header">
<view class="event-title">🅿 停车场</view>
<view class="event-meta">
<view class="event-priority priority-medium">部分维护</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line"> 总车位200 大车位50</text>
<text class="line"> 当前可用180B区20个车位灯光维修中</text>
<text class="line"> 免费停车24小时开放</text>
</view>
<view class="event-actions">
<button class="event-action-btn btn-warning"
@tap="contactMaintenance('parking')">联系维修</button>
<button class="event-action-btn btn-primary" @tap="checkParkingStatus">车位状态</button>
</view>
</view>
</view>
<!-- 其他设施 -->
<view class="event-item left-ok">
<view class="event-header">
<view class="event-title">🏢 其他设施服务</view>
<view class="event-meta">
<view class="event-priority priority-low ok">服务正常</view>
</view>
</view>
<view class="event-content">
<view class="event-description">
<text class="line"> 🚻 洗手间24小时开放含无障碍设施</text>
<text class="line"> 📶 免费WiFi全区覆盖密码YCH888</text>
<text class="line"> 🔧 汽修服务8:00-18:00应急救援24小时</text>
</view>
<view class="event-actions">
<button class="event-action-btn btn-primary" @tap="viewAllServices">查看详情</button>
<button class="event-action-btn btn-success" @tap="contactService">联系服务</button>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<style lang="less" scoped>
@bg: #f8f9fa;
@muted: #666;
@card: #fff;
@shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
@primary: #27B25F;
@primary2: #4CCC7F;
@ok: #2ed573;
@warn: #ff9f43;
@danger: #ff4757;
.emergency-details {
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 100%;
max-width: 750rpx;
height: 100%;
background: @bg;
z-index: 1000;
overflow-y: auto;
.emergency-details-header {
background: linear-gradient(135deg, @danger, #ff3838);
color: #fff;
padding: 40rpx;
position: relative;
box-shadow: @shadow;
&.facilities-theme {
background: linear-gradient(135deg, #20bf6b, #0fb9b1);
}
.emergency-back-btn {
position: absolute;
left: 30rpx;
top: 30rpx;
background: rgba(255, 255, 255, .2);
border: none;
color: #fff;
font-size: 36rpx;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.h1 {
text-align: center;
display: block;
margin-bottom: 6rpx;
}
.current-area {
text-align: center;
display: block;
opacity: .9;
}
}
.event-list {
padding: 30rpx;
.event-item {
background: #fff;
border-radius: 24rpx;
margin-bottom: 30rpx;
overflow: hidden;
box-shadow: @shadow;
border-left: 8rpx solid @danger;
&.warning {
border-left-color: @warn;
}
&.resolved {
border-left-color: @ok;
opacity: .85;
}
&.left-ok {
border-left-color: @ok;
}
&.left-warn {
border-left-color: @warn;
}
.event-header {
padding: 30rpx;
border-bottom: 1rpx solid #f1f3f4;
background: #fff;
.event-title {
font-weight: 700;
font-size: 32rpx;
margin-bottom: 10rpx;
display: flex;
align-items: center;
gap: 16rpx;
}
.event-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 24rpx;
color: @muted;
.event-time {
display: flex;
align-items: center;
gap: 8rpx;
}
.event-priority {
padding: 6rpx 16rpx;
border-radius: 20rpx;
font-size: 22rpx;
font-weight: 700;
&.priority-high {
background: #ffe6e6;
color: #d32f2f;
}
&.priority-medium {
background: #fff3e0;
color: #f57c00;
}
&.priority-low {
background: #e8f5e8;
color: #388e3c;
}
&.ok {
background: #e8f5e8;
color: #2e7d32;
}
}
}
}
.event-content {
padding: 30rpx;
.event-description {
margin-bottom: 24rpx;
line-height: 1.6;
color: #333;
.line {
display: block;
}
}
.event-actions {
display: flex;
gap: 20rpx;
flex-wrap: wrap;
margin-bottom: 16rpx;
.event-action-btn {
padding: 16rpx 24rpx;
border: none;
border-radius: 12rpx;
font-size: 24rpx;
font-weight: 700;
color: #fff;
&.btn-primary {
background: @primary;
}
&.btn-success {
background: @ok;
}
&.btn-warning {
background: @warn;
color: #fff;
}
}
}
.event-status {
display: flex;
align-items: center;
gap: 10rpx;
font-size: 24rpx;
margin-top: 10rpx;
padding: 16rpx 20rpx;
background: @bg;
border-radius: 12rpx;
.status-dot {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
&.status-processing {
background: @warn;
}
&.status-resolved {
background: @ok;
}
&.status-pending {
background: @danger;
}
}
}
}
}
}
.add-event-btn {
position: fixed;
bottom: 160rpx;
right: 40rpx;
width: 96rpx;
height: 96rpx;
background: linear-gradient(135deg, @primary, @primary2);
border-radius: 50%;
border: none;
color: #fff;
font-size: 40rpx;
box-shadow: 0 8rpx 24rpx rgba(74, 144, 226, .4);
}
.promo-banner {
margin: 30rpx;
border-radius: 24rpx;
overflow: hidden;
box-shadow: @shadow;
.promo-image {
width: 100%;
height: 240rpx;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 48rpx;
position: relative;
overflow: hidden;
.promo-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(transparent, rgba(0, 0, 0, .7));
padding: 40rpx 30rpx 30rpx;
color: #fff;
.promo-title {
font-size: 32rpx;
font-weight: 700;
margin-bottom: 8rpx;
}
.promo-subtitle {
font-size: 24rpx;
opacity: .9;
}
}
}
}
.facilities-section {
margin: 30rpx;
background: #fff;
border-radius: 24rpx;
overflow: hidden;
box-shadow: @shadow;
.facilities-header {
background: linear-gradient(135deg, #20bf6b, #0fb9b1);
color: #fff;
padding: 30rpx;
font-weight: 700;
font-size: 32rpx;
display: flex;
align-items: center;
gap: 16rpx;
}
}
}
</style>

View File

@ -1,47 +1,66 @@
<template>
<div class="main">
<image class="typeImg" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/noData.svg"></image>
<p class="text" v-if="type==='index'">抱歉,数据为第三方接口传输无法进行画像分析</p>
<p class="noAuthor" v-else-if="type==='noAuthor'">抱歉您没有权限查看数智化看板请联系管理员进行授权</p>
<p class="text" v-else>抱歉,第三方数据未传,无法分析</p>
<image class="typeImg" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/noData.svg"></image>
<p class="text" v-if="type === 'index'">抱歉,数据为第三方接口传输无法进行画像分析</p>
<p class="noAuthor" v-else-if="type === 'noAuthor'">抱歉您没有权限查看数智化看板请联系管理员进行授权</p>
<p class="homeIndex" v-else-if="type === 'homeIndex'">抱歉您没有权限查看数智化看板请联系管理员进行授权</p>
<p class="text" v-else>抱歉,第三方数据未传,无法分析</p>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: "noData",
data(){
return {
type:''
}
},
onLoad(query){
if (query.type){
this.type = query.type
}
let userInfo = uni.getStorageSync('vuex')
userInfo = JSON.parse(userInfo)
console.log('userInfo',userInfo)
console.log(userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee'])
if (userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee']===1){
setTimeout(()=>{
uni.switchTab({
url:`/pages/index/index`
})
},200)
}
},
onUnload() {
this.$util.addUserBehavior()
},
methods:{
name: "noData",
data() {
return {
type: ''
}
},
computed: {
...mapGetters({ user: "getUser" }),
},
watch: {
user: {
handler(newValue, value) {
if (this.type === 'homeIndex') {
if (newValue && newValue.WeChat_UserId && newValue.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
uni.switchTab({
url: `/pages/index/index`
})
}
}
}
}
},
onLoad(query) {
if (query.type) {
this.type = query.type
}
let userInfo = uni.getStorageSync('vuex')
userInfo = JSON.parse(userInfo)
if (userInfo.userData.AuthorityInfo['89a1f248-2113-4d57-84b1-c2e6edb9e8ee'] === 1) {
setTimeout(() => {
uni.switchTab({
url: `/pages/index/index`
})
}, 200)
}
},
onUnload() {
this.$util.addUserBehavior()
},
methods: {
}
}
</script>
<style scoped lang="scss">
.main{
.main {
width: 100%;
display: flex;
flex-direction: column;
@ -49,18 +68,21 @@ export default {
align-items: center;
margin-top: 12px;
padding: 16px 0;
.img{
width:60px;
.img {
width: 60px;
height: 60px;
margin-bottom: 8px;
}
.typeImg{
.typeImg {
width: 80px;
height: 80px;
margin-top: 40vh;
margin-bottom: 16px;
}
.text{
.text {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;

View File

@ -1,58 +1,59 @@
<template>
<view class="content">
<!-- num 是字符串会被切成片渲染 -->
<view class="l-num" :style="{width: key===',' || key==='.'?'12rpx':'28rpx'}" v-for="(key,value) in num" :key="value">
<view class="l-num" :style="{ width: key === ',' || key === '.' ? '12rpx' : '24rpx' }" v-for="(key, value) in num"
:key="value">
<template v-if="key !== '.' && key !== ','">
<view class="l-son" :style="'transform: translateY(-'+(key*52)+'rpx);'" >
<view class="l-num l-posi" v-for="(s,i) in range" :style="'transform: translateY('+(i*52)+'rpx);'" :key="i">
{{s}}
<view class="l-son" :style="'transform: translateY(-' + (key * 52) + 'rpx);'">
<view class="l-num l-posi" v-for="(s, i) in range" :style="'transform: translateY(' + (i * 52) + 'rpx);'" :key="i">
{{ s }}
</view>
</view>
</template>
<!-- 小数点 -->
<view class="l-num l-posi" v-else>{{key}}</view>
<view class="l-num l-posi" v-else>{{ key }}</view>
</view>
</view>
</template>
<script>
let range = new Array(10).fill(0).map((e,i) => i);
let range = new Array(10).fill(0).map((e, i) => i);
export default {
data() {
return {
num:'0.00', //
value:'', //
range:range,//0-9
num: '0.00', //
value: '', //
range: range,//0-9
turnTime: 100//
}
},
props:{
number:{
props: {
number: {
type: String,
default:''
default: ''
}
},
watch:{
number:{
handler(value){
watch: {
number: {
handler(value) {
this.value = value;
this._getNumber();
},
immediate:true,
deep:true
immediate: true,
deep: true
}
},
onLoad() {},
onLoad() { },
methods: {
//
_getNumber(){
_getNumber() {
let value = this.value
let num = this.num;
if(num == value){
if (num == value) {
return
}
//
@ -61,17 +62,17 @@ export default {
let newShowNumber = []
let newNowNumber = []
this.showNumber.forEach(item=>{
if (item!==',' && item!=='.'){
this.showNumber.forEach(item => {
if (item !== ',' && item !== '.') {
newShowNumber.push(Number(item))
}else{
} else {
newShowNumber.push(item)
}
})
this.nowNumber.forEach(item=>{
if (item!==',' && item!=='.'){
this.nowNumber.forEach(item => {
if (item !== ',' && item !== '.') {
newNowNumber.push(Number(item))
}else{
} else {
newNowNumber.push(item)
}
})
@ -84,46 +85,46 @@ export default {
let key = sl > ol ? 'nowNumber' : 'showNumber';
// 1100 1 ==> 001
this._formatNumber(key,sl,ol);
this._formatNumber(key, sl, ol);
//
this._turnNumber();
},
_formatNumber(key,oldV,newV){
_formatNumber(key, oldV, newV) {
let length = Math.abs(oldV - newV);
let arr = new Array(length).fill(0);
this[key] = arr.concat(this[key]);
},
_turnNumber(){
_turnNumber() {
let _this = this;
//
_this.showNumber.forEach((e,i) => {
//
if(e == _this.nowNumber[i]) return;
_this.showNumber.forEach((e, i) => {
//
if (e == _this.nowNumber[i]) return;
let inter = setInterval(() => {
//
if(e == _this.nowNumber[_this._index(i)]){
let inter = setInterval(() => {
//
if (e == _this.nowNumber[_this._index(i)]) {
clearInterval(inter);
} else {
if (e !== ',' && e !== '.') {
// -- ++
_this.showNumber[_this._index(i)] = e > _this.nowNumber[_this._index(i)] ? --e : ++e;
//
_this.num = parseFloat(_this.showNumber.join('')).toFixed(2);
_this.num = _this.$util.fmoney(_this.num, 2)
} else {
clearInterval(inter);
}else{
if (e!==',' && e!=='.'){
// -- ++
_this.showNumber[_this._index(i)] = e > _this.nowNumber[_this._index(i)] ? --e : ++e;
//
_this.num = parseFloat(_this.showNumber.join('')).toFixed(2);
_this.num = _this.$util.fmoney(_this.num,2)
}else{
clearInterval(inter);
}
}
},_this.turnTime);
}
}, _this.turnTime);
})
},
// i
_index(i){
_index(i) {
return i
}
}
@ -131,17 +132,17 @@ export default {
</script>
<style>
.content{
.content {
width: 100%;
text-align: center;
}
.l-input{
.l-input {
padding: 30rpx;
}
.l-num{
font-size: 48rpx;
.l-num {
font-size: 32rpx;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: #160002;
@ -153,14 +154,14 @@ export default {
position: relative;
}
.l-son{
.l-son {
width: 100%;
height: calc(100% * 10);
position: relative;
transition:all 0.5s;
transition: all 0.5s;
}
.l-posi{
.l-posi {
position: absolute;
top: 0;
left: 0;

View File

@ -15,7 +15,7 @@
</view>
<!-- 月份的轮播框 -->
<view class="monthListBox" :style="{ marginTop: menu.bottom + 8 + 'px' }">
<view class="monthListBox" :style="{ paddingTop: menu.bottom + 8 + 'px' }">
<swiper class="swiperBox" previous-margin="40rpx" next-margin="40rpx" :current="selectIndex"
@animationfinish="handleChangeSwiper">
<swiper-item class="swiperItem" v-for="(item, index) in monthList" :key="index">
@ -85,7 +85,7 @@
}"></view>
<span class="itemName">{{
subItem.name
}}</span>
}}</span>
</view>
<view class="itemCenter">
{{
@ -103,7 +103,7 @@
: '',
}">{{
subItem.addQOQ ? `${subItem.addQOQ}` : ""
}}</view>
}}</view>
</view>
</view>
</view>
@ -211,15 +211,15 @@
<!-- 即时营收 -->
<view class="instantRevenue" style="margin-top: 24rpx">
<view class="revenue" @click="handlePage">
<view class="instantRevenue" style="margin-top: 24rpx;">
<view class="revenue" @click="handlePage" style="padding-bottom: 0;">
<view class="revenueTop">
<view class="revenyeTopLeft">
<image class="monthIcon"
src="https://eshangtech.com/ShopICO/ahyd-BID/newIndex3/monthIcon.svg" />
<text class="dateText">{{
$util.handleGetMonthDay(nowDay)
}}</text>
}}</text>
<text class="day">/{{ howDay }}</text>
</view>
<view class="revenyeTopRight">
@ -233,6 +233,24 @@
<text class="moneyLabel">实时对客销售/</text>
</view>
</view>
<!-- <view class="revenue revenueOther">
<view class="otherRealDataBox">
<view class="revenueMoneyItem" v-for="(subItem, subIndex) in otherRealData"
:style="{ marginTop: subIndex >= 2 ? '24rpx' : '' }">
<view class="revenueMoneyItemLeft">
<image class="leftIcon" :src="subItem.icon" />
</view>
<view class="revenueMoneyItemRight">
<view class="moneyLabel">{{ subItem.label || "" }}</view>
<view class="moneyText">{{ subItem.value || "" }}<span class="moneyUnit">{{ subItem.unit
|| "" }}</span>
</view>
</view>
</view>
</view>
</view> -->
</view>
<!-- 实时水电加油尿素充电 -->
@ -247,8 +265,10 @@
<view class="revenueMoneyItemRight">
<view class="moneyLabel">{{ subItem.label || "" }}</view>
<view class="moneyText">{{ subItem.value || "" }}<span class="moneyUnit">{{ subItem.unit
|| "" }}</span>
<view class="moneyText">
<span class="money">{{ subItem.value || "" }}</span>
<span class="moneyUnit">/{{ subItem.unit
|| "" }}</span>
</view>
</view>
</view>
@ -272,6 +292,17 @@
</view>
<view class="funItem" @click="handleGoAttendanceStatus">
<view class="funItemContent">
<view class="funIconBox">
<image class="funIcon"
src="https://eshangtech.com/ShopICO/ahyd-BID/warning/operateWarning.svg" />
</view>
<text class="funText">出勤情况</text>
</view>
</view>
<view class="funItem" @click="goToRobot">
<view class="funItemContent">
<view class="funIconBox">
@ -295,10 +326,11 @@ import RateCharts from "./components/rateCharts.vue";
import NumberScroll from "./components/numberScroll.vue";
import Tabbar from "../../components/tabbar/tabbar.vue";
import { timestampToTimeMonth } from "../../util/dateTime";
import { mapState, mapGetters } from 'vuex'
export default {
data() {
const lastDay = this.$util.cutDate(new Date(), 'YYYY-MM-DD', -1) //
const nowDay = this.$util.cutDate(new Date(), 'YYYY-MM-DD') //
const nowDay = this.$util.cutDate(new Date(), 'YYYY-MM-DD') //
return {
menu: {},//
startDate: "2024-01-01",//
@ -316,6 +348,8 @@ export default {
single: "",
ydModal: false, // 驿
modalRateList: [],//
useInfo: {},
isReturn: true,
}
},
components: {
@ -323,9 +357,42 @@ export default {
NumberScroll,
Tabbar,
},
async onLoad() {
this.menu = uni.getMenuButtonBoundingClientRect();
computed: {
...mapGetters({ user: "getUser" }),
},
watch: {
user: {
handler(newValue, value) {
console.log('watchwatchwatchwatchwatch');
let _this = this
console.log('newValuenewValuenewValue', newValue);
let userInfo = JSON.parse(JSON.stringify(newValue));
_this.useInfo = JSON.parse(JSON.stringify(newValue));
if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
_this.isReturn = false;
} else if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] !== 1) {
uni.redirectTo({
url: `/pages/commercialBI/noData?type=homeIndex`,
});
} else {
_this.topShowData = null
_this.moneyRateList = []
_this.profitSharingList = []
_this.modalRateList = []
}
console.log('userInfouserInfouserInfo', _this.useInfo);
console.log('userInfouserisReturnisReturnisReturnisReturnInfouserInfo', _this.isReturn);
if (!_this.isReturn) {
_this.handleGetOnLoad()
}
}
}
},
onLoad() {
let _this = this
this.menu = uni.getMenuButtonBoundingClientRect();
uni.getLocation({
type: "gcj02",
altitude: true,
@ -335,54 +402,157 @@ export default {
longitude: res.longitude,
};
uni.setStorageSync("seatInfo", JSON.stringify(seatInfo));
_this.handleGetNearService(seatInfo.latitude, seatInfo.longitude)
},
fail: (err) => {
},
});
this.single = timestampToTimeMonth(new Date(this.lastDay).getTime());
console.log('this.singlethis.singlethis.single', this.single);
//
this.handleGetIndexInfo()
//
await this.handleGetTopData()
//
this.handleRealRevenue()
// 尿
this.handleGetYNRealData()
uni.setStorageSync("lastDay", this.lastDay);
console.log('useruseruseruser', this.user);
//
// let userInfo = uni.getStorageSync("vuex");
let userInfo = JSON.parse(JSON.stringify(this.user));
_this.useInfo = JSON.parse(JSON.stringify(this.user));
// console.log('userInfouserInfo', userInfo);
console.log('userInfouserInfo', userInfo);
if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
_this.isReturn = false;
} else if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] !== 1) {
uni.redirectTo({
url: `/pages/commercialBI/noData?type=homeIndex`,
});
}
console.log('userInfouserInfouserInfo', _this.useInfo);
console.log('userInfouserisReturnisReturnisReturnisReturnInfouserInfo', _this.isReturn);
if (!_this.isReturn) {
_this.handleGetOnLoad()
}
},
onShow() {
// tabbar tabbar
uni.hideTabBar();
},
onPullDownRefresh: function () {
let _this = this
let userInfo = JSON.parse(JSON.stringify(this.user));
if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] === 1) {
_this.isReturn = false;
} else if (userInfo && userInfo.WeChat_UserId && userInfo.AuthorityInfo["89a1f248-2113-4d57-84b1-c2e6edb9e8ee"] !== 1) {
uni.redirectTo({
url: `/pages/commercialBI/noData?type=homeIndex`,
});
}
if (!_this.isReturn) {
_this.handleGetOnLoad()
}
uni.stopPullDownRefresh();
},
methods: {
// onLoad
async handleGetOnLoad() {
//
this.handleGetIndexInfo()
//
await this.handleGetTopData()
//
this.handleRealRevenue()
// 尿
this.handleGetYNRealData()
},
handleShowYDModal() {
this.ydModal = !this.ydModal;
},
goToRobot() {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
this.$util.toNextRoute("navigateTo", `/pages/robot/index`);
// this.$util.toNextRoute("navigateTo", `/pages/testPage/index`);
},
//
handleGoAttendanceStatus() {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
this.$util.toNextRoute(
"navigateTo",
`/pages/attendanceStatus/index`
);
},
//
handleGoOperate() {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
this.$util.toNextRoute(
"navigateTo",
`/pages/operatingStatements/index?time=${this.single}`
);
},
handlePage() {
this.$util.toNextRoute(
"navigateTo",
`/pages/everdayRenven/index?time=${this.lastDay}&GroupType=1000&ProvinceCode=530000&ServerpartIds=`
);
},
handleGoMap() {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
this.$util.toNextRoute("navigateTo", "/pages/map/index?type=index");
},
//
@ -398,31 +568,31 @@ export default {
list.forEach((item) => {
if (item.dataType === 2000) {
result.push({
label: `今日油品`,
label: `油品`,
value: this.$util.fmoney(item.totalCount),
unit: item.totalCountUnit,
icon: "http://saas.eshangtech.com/cyy_DIB/oilIcon.png"
icon: "https://eshangtech.com/cyy_DIB/oilIcon.png"
})
} else if (item.dataType === 3000) {
result.push({
label: `今日加水`,
label: `加水`,
value: this.$util.fmoney(item.totalCount),
unit: item.totalCountUnit,
icon: "http://saas.eshangtech.com/cyy_DIB/addWaterIcon.png"
icon: "https://eshangtech.com/cyy_DIB/addWaterIcon.png"
})
} else if (item.dataType === 4000) {
result.push({
label: `今日尿素`,
label: `尿素`,
value: this.$util.fmoney(item.totalCount),
unit: item.totalCountUnit,
icon: "http://saas.eshangtech.com/cyy_DIB/ureaIcon.png"
icon: "https://eshangtech.com/cyy_DIB/ureaIcon.png"
})
} else if (item.dataType === 5000) {
result.push({
label: `今日充电`,
label: `充电`,
value: this.$util.fmoney(item.totalTicket),
unit: item.totalTicketUnit,
icon: "http://saas.eshangtech.com/cyy_DIB/chargeIcon.png"
icon: "https://eshangtech.com/cyy_DIB/chargeIcon.png"
})
}
})
@ -558,6 +728,21 @@ export default {
"星期五",
"星期六",
][holiday];
},
//
async handleGetNearService(latitude, longitude) {
let req = {
Province_Code: "530000",
longitude: latitude,
latitude: longitude,
ShowService: true,
PageIndex: 1,
PageSize: 1
}
const data = await request.$webGet('CommercialApi/BaseInfo/GetServerpartList', req)
console.log('sdjkajdas', data);
let list = data.Result_Data.List
uni.setStorageSync('currentService', list[0])
}
}
}
@ -568,7 +753,7 @@ export default {
.main {
width: 100vw;
height: 100vh;
background-image: url("https://saas.eshangtech.com/minTestImg/pageBg.png");
background-image: url("https://eshangtech.com/minTestImg/pageBg.png");
background-size: 100% 100%;
background-repeat: no-repeat;
@ -580,7 +765,7 @@ export default {
top: 0;
left: 0;
z-index: 99;
background-image: url("https://saas.eshangtech.com/minTestImg/pageBg.png");
background-image: url("https://eshangtech.com/minTestImg/pageBg.png");
.topContent {
display: flex;
@ -665,7 +850,7 @@ export default {
.swiperItemContentUnit {
font-family: 'PingFangSC';
font-weight: 400;
font-size: 28rpx;
font-size: 24rpx;
color: #A69E9F;
line-height: 40rpx;
text-align: left;
@ -684,7 +869,7 @@ export default {
.leftRevenueValue {
font-family: 'DINAlternate';
font-weight: bold;
font-size: 40rpx;
font-size: 30rpx;
color: #160002;
line-height: 40rpx;
text-align: left;
@ -698,7 +883,7 @@ export default {
.addValue {
font-family: 'DINAlternate';
font-weight: bold;
font-size: 30rpx;
font-size: 28rpx;
line-height: 40rpx;
text-align: left;
font-style: normal;
@ -707,7 +892,7 @@ export default {
.rightNav {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
font-size: 24rpx;
color: #A69E9F;
line-height: 40rpx;
text-align: left;
@ -886,7 +1071,7 @@ export default {
.revenueNum {
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
font-size: 32rpx;
font-size: 28rpx;
color: #160002;
line-height: 44rpx;
text-align: left;
@ -896,7 +1081,7 @@ export default {
.revenueAdd {
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
font-size: 32rpx;
font-size: 28rpx;
color: #e83944;
line-height: 44rpx;
text-align: left;
@ -925,7 +1110,7 @@ export default {
.swiperItemContentUnit {
font-family: 'PingFangSC';
font-weight: 400;
font-size: 28rpx;
font-size: 24rpx;
color: #A69E9F;
line-height: 40rpx;
text-align: left;
@ -958,7 +1143,7 @@ export default {
.addValue {
font-family: 'DINAlternate';
font-weight: bold;
font-size: 30rpx;
font-size: 28rpx;
line-height: 40rpx;
text-align: left;
font-style: normal;
@ -1006,7 +1191,7 @@ export default {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 24rpx;
padding: 24rpx 24rpx;
background: linear-gradient(180deg, #F0E4ED 0%, #F0E8F1 18%, #FFFFFF 100%);
border-radius: 16rpx;
display: flex;
@ -1038,7 +1223,7 @@ export default {
}
.day {
font-size: 28rpx;
font-size: 24rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
color: #a69e9f;
@ -1060,7 +1245,7 @@ export default {
}
.revenueMoney {
height: 52rpx;
height: 70rpx;
display: flex;
align-items: center;
justify-content: space-between;
@ -1068,19 +1253,21 @@ export default {
.moneyText {
font-size: 44rpx;
font-family: DINAlternate, DINAlternate;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: #160002;
line-height: 52rpx;
margin-right: 8rpx;
}
.moneyLabel {
font-size: 28rpx;
font-family: PingFangSC, PingFang SC;
height: 100%;
font-size: 24rpx;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: 400;
color: #a69e9f;
line-height: 40rpx;
display: inline-flex;
align-items: center;
margin-bottom: 12rpx;
}
}
@ -1117,30 +1304,41 @@ export default {
width: calc(100% - 86rpx);
.moneyLabel {
font-size: 30rpx;
font-size: 28rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
color: #a69e9f;
color: #000;
line-height: 30rpx;
margin-bottom: 16rpx;
// margin-bottom: 16rpx;
}
.moneyText {
font-size: 32rpx;
font-family: 'DINAlternate';
font-weight: bold;
color: #160002;
line-height: 32rpx;
margin-right: 8rpx;
width: 100%;
margin-top: 12rpx;
display: flex;
align-items: center;
justify-content: space-between;
.money {
font-size: 28rpx;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: #160002;
line-height: 32rpx;
text-align: left;
display: inline-block;
width: 110rpx;
}
.moneyUnit {
width: 70rpx;
font-size: 24rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
color: #a69e9f;
line-height: 30rpx;
margin-left: 16rpx;
margin-left: 8rpx;
white-space: nowrap;
}
}
}
@ -1195,7 +1393,7 @@ export default {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
color: #160002;
line-height: 40rpx;
line-height: 30rpx;
}
}
}

View File

@ -328,8 +328,11 @@ export default {
uni.navigateBack({
delta: 1
})
}
else {
} else if (this.type === 'attendanceStatus') {
uni.navigateBack({
delta: 1
})
} else {
if (this.chartType) {
uni.navigateBack({
delta: 1

View File

@ -159,7 +159,7 @@
</p>
<p :class="item.TOILETCOUNT ? 'text' : 'unText'">潮汐厕位<text style="margin-left: 4px">{{
item.TOILETCOUNT ? '('
+ item.TOILETCOUNT + ')':'' }}</text></p>
+ item.TOILETCOUNT + ')' : '' }}</text></p>
<p :class="item.HASSHOWERROOM ? 'text' : 'unText'">车辆加水</p>
</div>
</div>
@ -181,10 +181,10 @@
<div class="item">
<p :class="item.PACKING ? 'text' : 'unText'">客车车位<text style="margin-left: 4px">{{ item.PACKING ? '('
+
item.PACKING + ')':'' }}</text></p>
item.PACKING + ')' : '' }}</text></p>
<p :class="item.DANPACKING ? 'text' : 'unText'">危化品车位<text style="margin-left: 4px">{{ item.DANPACKING
? '('
+ item.DANPACKING +')':'' }}</text></p>
+ item.DANPACKING + ')' : '' }}</text></p>
</div>
</div>
</div>
@ -243,6 +243,7 @@ export default {
currentImg: 0,//
come: '',// ,
topBgRealLength: 0,//
seatInfo: {}
}
},
props: {
@ -338,10 +339,14 @@ export default {
}
},
async handleSearch(seat) {
let currentService = uni.getStorageSync("currentService");
let seatInfo = uni.getStorageSync("seatInfo");
this.seatInfo = JSON.parse(seatInfo);
let reqs = {
longitude: seat.longitude,
ServerpartId: seat.Serverpart_ID,
latitude: seat.latitude
longitude: this.seatInfo.longitude,
ServerpartId: currentService.Serverpart_ID || currentService.SERVERPART_ID,
latitude: this.seatInfo.latitude,
}
const totalData = await request.$webGet('CommercialApi/BaseInfo/GetServerpartInfo', reqs)
console.log('totalData', totalData)

View File

@ -60,6 +60,10 @@ export default {
lastDay: {
type: String,
default: ""
},
isReturn: {
type: Boolean,
default: true
}
},
data() {
@ -73,6 +77,20 @@ export default {
methods: {
//
handleGoFirst(item) {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
if (item.isNotice) {
this.$util.toNextRoute('navigateTo', item.homeUrl)
} else {
@ -81,6 +99,20 @@ export default {
},
//
handleGoSecond(item) {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
let version = uni.getStorageSync('version')
if (version === 1) {
this.$util.toNextRoute('navigateTo', '/pages/summaryOfPortraits/index?index=' + item.type)
@ -90,6 +122,20 @@ export default {
},
//
handleGoFourth(item) {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
let version = uni.getStorageSync('version')
if (version === 1) {
if (item.summaryOfPortraits) {
@ -104,6 +150,20 @@ export default {
//
handleGo(item) {
if (this.isReturn) {
let _this = this
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
_this.$util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
return
}
if (item.value === 2) {
if (item.value === 2) {
let currentService = uni.getStorageSync('currentService')

View File

@ -26,12 +26,12 @@
</view>
<view class="message">
<view class="people">
<p class="name">{{ user.Membership_Name }}</p>
<p class="name">{{ user.Membership_Name || user.WeChat_UserName }}</p>
<!-- <view class="person"> <view class="personName">{{user.DepartmentName}}</view> </view>-->
<view class="person" v-if="user.DepartmentName">{{ user.DepartmentName }}</view>
</view>
<p class="phone">{{ handleGetPhone(user.Membership_Phone) }}</p>
<p class="address">{{ user.OwnerUnitName }}</p>
<p class="address">{{ user.OwnerUnitName || "" }}</p>
</view>
</view>
<view v-else>
@ -47,7 +47,8 @@
</view>
<view class="menu" :style="{ top: -(117 - menu.bottom) + 'px' }">
<userList v-for="(item, index) in dataList" :key="index" :item="item" :lastDay="lastDay"></userList>
<userList v-for="(item, index) in dataList" :key="index" :item="item" :lastDay="lastDay" :isReturn="isReturn">
</userList>
</view>
<Tabbar ref="tabbar" :page="page"></Tabbar>
@ -187,6 +188,7 @@ export default {
],
isTrue: false, //
special: false,
isReturn: true,
};
},
components: {
@ -261,6 +263,18 @@ export default {
});
//
let userInfo = uni.getStorageSync("vuex");
if (
userInfo.userData &&
userInfo.userData.WeChat_UserId &&
userInfo.userData.AuthorityInfo[
"89a1f248-2113-4d57-84b1-c2e6edb9e8ee"
] === 1
) {
this.isReturn = false;
}
if (
userInfo.userData.AuthorityInfo[
"89a1f248-2113-4d57-84b1-c2e6edb9e8ee"
@ -337,14 +351,14 @@ export default {
width: 100%;
height: 250px;
// background: linear-gradient(315deg, #ff8d95 0%, #ffdca8 100%);
background-image: url("https://saas.eshangtech.com/minTestImg/pageBg.png");
background-image: url("https://eshangtech.com/minTestImg/pageBg.png");
background-size: 100vw 100vh;
background-repeat: no-repeat;
position: relative;
.headerTop {
width: 100%;
background-image: url("https://saas.eshangtech.com/minTestImg/pageBg.png");
background-image: url("https://eshangtech.com/minTestImg/pageBg.png");
background-size: 100vw 100vh;
background-repeat: no-repeat;
position: fixed;

View File

@ -1,5 +1,5 @@
{
"appid": "wxa99ef047735c031e",
"appid": "wx6e28691bea93c6ec",
"compileType": "miniprogram",
"libVersion": "2.25.3",
"packOptions": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>云南图标/卫生间_2</title>
<defs>
<linearGradient x1="50%" y1="100%" x2="50%" y2="1.84889275e-30%" id="linearGradient-1">
<stop stop-color="#27B25F" offset="0%"></stop>
<stop stop-color="#11BC55" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="100%" x2="50%" y2="1.84889275e-30%" id="linearGradient-2">
<stop stop-color="#27B25F" offset="0%"></stop>
<stop stop-color="#4CCC7F" offset="100%"></stop>
</linearGradient>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="云南小程序-切图" transform="translate(-87.000000, -37.000000)" fill-rule="nonzero">
<g id="编组" transform="translate(87.000000, 37.000000)">
<circle id="椭圆形" fill="url(#linearGradient-1)" opacity="0.100000001" cx="16" cy="16" r="16"></circle>
<path d="M21.4637385,11.8011725 L18.2390216,21.4753234 C18.0643738,21.9992667 17.4980539,22.2824267 16.9741105,22.1077789 C16.7301391,22.0264551 16.5268764,21.8542657 16.4065504,21.6269833 L14.4619849,17.9539153 C14.368178,17.7767245 14.2232755,17.631822 14.0460847,17.5380151 L10.3730167,15.5934496 C9.88491409,15.3350424 9.69870923,14.7298766 9.95711648,14.241774 C10.0774425,14.0144916 10.2807052,13.8423022 10.5246766,13.7609784 L20.1988275,10.5362615 C20.7227708,10.3616137 21.2890908,10.6447737 21.4637385,11.168717 C21.5321608,11.3739838 21.5321608,11.5959057 21.4637385,11.8011725 Z" id="三角形" fill="url(#linearGradient-2)"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -62,6 +62,8 @@ const actions = {
getLoginCode({ dispatch, state }) {
uni.login({ // 登录
success(res) {
console.log('resresresresres', res);
dispatch('memberLogin', res.code) // 获取用户数据
}
})
@ -75,40 +77,36 @@ const actions = {
commit('setUserTodoList', res.Data)
})
},
memberLogin({ dispatch, state, commit }, _code) {
let _user = state.userData
request.$get('WeChat_Login', {
async memberLogin({ dispatch, state, commit }, _code) {
const data = await request.$get('WeChat_Login', {
// request.$webGet('WebAPI_Push/WeChat/Login',{
WeChat_Code: _code || '',
}).then(data => {
if (data.Result_Code === 100) {
let user = data.Result_Data
if (user.Membership_Id) {
dispatch('updateUser', data.Result_Data)
// _this.addUserBehavior(1002) // 记录用户行为
} else {
commit('setUser', user)
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
}
} else if (data.Result_Code === 200) { // session过期
dispatch('getLoginCode')
} else {
console.log(data)
}
})
if (data.Result_Code === 100) {
let user = data.Result_Data
if (user.Membership_Id) {
const enrichedUser = await dispatch('updateUser', data.Result_Data)
commit('setUser', enrichedUser)
return enrichedUser
// _this.addUserBehavior(1002) // 记录用户行为
} else {
commit('setUser', user)
uni.showModal({
title: '温馨提示',
content: '请您授权登录后再操作。',
success(res) {
if (res.confirm) {
util.toNextRoute('redirectTo', '/pages/register/register')
}
}
})
}
} else if (data.Result_Code === 200) { // session过期
dispatch('getLoginCode')
} else {
console.log(data)
}
},
async updateUser({ dispatch, commit, state }, user) {
let _user = user || state.userData
@ -116,36 +114,37 @@ const actions = {
if (!_id) return
// console.log(_user)
await request.$get('WeChat_GetBusinessMemberInfo', { Membership_Id: _id }).then(async res => {
// request.$webGet('WebAPI_Push/Member/GetMemberInfo',{Membership_Id:_id,memberShipId:_id}).then(res=>{
if (res.Result_Code == 100) {
let data = res.Result_Data
console.log('datadatadatadatadata', data);
data.WeChat_MiniProToken = _user.WeChat_MiniProToken
data.WeChat_UserId = _user.WeChat_UserId
data.WeChat_UserName = _user.WeChat_UserName
let UserCityList = data.UserCityAuthority ? data.UserCityAuthority.split(' ') : []
let str = ''
if (UserCityList && UserCityList.length > 0) {
UserCityList.forEach(item => {
if (str) {
str += `,${item}`
} else {
str = item
}
})
}
const serverPart = await request.$webGet('/EShangApiMain/BaseInfo/GetServerpartDDL', { ServerpartCodes: str })
data.serverPartList = serverPart.Result_Data.List
commit('setUser', data)
dispatch('getTodoList')
} else {
uni.redirectTo({
url: `/pages/commercialBI/noData?type=noAuthor`
let res = await request.$get('WeChat_GetBusinessMemberInfo', { Membership_Id: _id })
if (res.Result_Code == 100) {
let data = res.Result_Data
console.log('WeChat_GetBusinessMemberInfoWeChat_GetBusinessMemberInfo', data);
commit('setUser', data)
data.WeChat_MiniProToken = _user.WeChat_MiniProToken
data.WeChat_UserId = _user.WeChat_UserId
data.WeChat_UserName = _user.WeChat_UserName
let UserCityList = data.UserCityAuthority ? data.UserCityAuthority.split(' ') : []
let str = ''
if (UserCityList && UserCityList.length > 0) {
UserCityList.forEach(item => {
if (str) {
str += `,${item}`
} else {
str = item
}
})
}
})
const serverPart = await request.$webGet('/EShangApiMain/BaseInfo/GetServerpartDDL', { ServerpartCodes: str })
data.serverPartList = serverPart.Result_Data.List
commit('setUser', data)
// dispatch('getTodoList')
return data
} else {
uni.redirectTo({
url: `/pages/commercialBI/noData?type=noAuthor`
})
}
}
}
export default new Vuex.Store({

View File

@ -0,0 +1,30 @@
## 1.4.122024-09-21
- 修复 calendar在选择日期范围后重新选择日期需要点两次的Bug
## 1.4.112024-01-10
- 修复 回到今天时,月份显示不一致问题
## 1.4.102023-04-10
- 修复 某些情况 monthSwitch 未触发的Bug
## 1.4.92023-02-02
- 修复 某些情况切换月份错误的Bug
## 1.4.82023-01-30
- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/161964)
## 1.4.72022-09-16
- 优化 支持使用 uni-scss 控制主题色
## 1.4.62022-09-08
- 修复 表头年月切换导致改变当前日期为选择月1号且未触发change事件的Bug
## 1.4.52022-02-25
- 修复 条件编译 nvue 不支持的 css 样式的Bug
## 1.4.42022-02-25
- 修复 条件编译 nvue 不支持的 css 样式的Bug
## 1.4.32021-09-22
- 修复 startDate、 endDate 属性失效的Bug
## 1.4.22021-08-24
- 新增 支持国际化
## 1.4.12021-08-05
- 修复 弹出层被 tabbar 遮盖的Bug
## 1.4.02021-07-30
- 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.3.162021-05-12
- 新增 组件示例地址
## 1.3.152021-02-04
- 调整为uni_modules目录规范

View File

@ -0,0 +1,544 @@
/**
* @1900-2100区间内的公历农历互转
* @charset UTF-8
* @github https://github.com/jjonline/calendar.js
* @Author Jea杨(JJonline@JJonline.Cn)
* @Time 2014-7-21
* @Time 2016-8-13 Fixed 2033hexAttribution Annals
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year
* @Version 1.0.3
* @公历转农历calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
* @农历转公历calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
*/
/* eslint-disable */
var calendar = {
/**
* 农历1900-2100的润大小信息表
* @Array Of Property
* @return Hex
*/
lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
/** Add By JJonline@JJonline.Cn**/
0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
0x0d520], // 2100
/**
* 公历每个月份的天数普通表
* @Array Of Property
* @return Number
*/
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
/**
* 天干地支之天干速查表
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
* @return Cn string
*/
Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'],
/**
* 天干地支之地支速查表
* @Array Of Property
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
* @return Cn string
*/
Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'],
/**
* 天干地支之地支速查表<=>生肖
* @Array Of Property
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
* @return Cn string
*/
Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'],
/**
* 24节气速查表
* @Array Of Property
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
* @return Cn string
*/
solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'],
/**
* 1900-2100各年的24节气日期速查表
* @Array Of Property
* @return 0x string For splice
*/
sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f',
'97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
'97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa',
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f',
'97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa',
'97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f',
'97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e',
'97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
'97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f',
'97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
'97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
'9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f',
'97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
'97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722',
'7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
'97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
'97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722',
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
'97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
'97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
'9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722',
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
'97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
'9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
'7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
'7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
'97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
'9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
'97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
'9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721',
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2',
'977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
'7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd',
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
'977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
'977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721',
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5',
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722',
'7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
'7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35',
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721',
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd',
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35',
'7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721',
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
'665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
'7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'],
/**
* 数字转中文速查表
* @Array Of Property
* @trans ['日','一','二','三','四','五','六','七','八','九','十']
* @return Cn string
*/
nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'],
/**
* 日期转农历称呼速查表
* @Array Of Property
* @trans ['初','十','廿','卅']
* @return Cn string
*/
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'],
/**
* 月份转农历称呼速查表
* @Array Of Property
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
* @return Cn string
*/
nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'],
/**
* 返回农历y年一整年的总天数
* @param lunar Year
* @return Number
* @eg:var count = calendar.lYearDays(1987) ;//count=387
*/
lYearDays: function (y) {
var i; var sum = 348
for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 }
return (sum + this.leapDays(y))
},
/**
* 返回农历y年闰月是哪个月若y年没有闰月 则返回0
* @param lunar Year
* @return Number (0-12)
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
*/
leapMonth: function (y) { // 闰字编码 \u95f0
return (this.lunarInfo[y - 1900] & 0xf)
},
/**
* 返回农历y年闰月的天数 若该年没有闰月则返回0
* @param lunar Year
* @return Number (02930)
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
*/
leapDays: function (y) {
if (this.leapMonth(y)) {
return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
}
return (0)
},
/**
* 返回农历y年m月非闰月的总天数计算m为闰月时的天数请使用leapDays方法
* @param lunar Year
* @return Number (-12930)
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
*/
monthDays: function (y, m) {
if (m > 12 || m < 1) { return -1 }// 月份参数从1至12参数错误返回-1
return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29)
},
/**
* 返回公历(!)y年m月的天数
* @param solar Year
* @return Number (-128293031)
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
*/
solarDays: function (y, m) {
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
var ms = m - 1
if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29
return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28)
} else {
return (this.solarMonth[ms])
}
},
/**
* 农历年份转换为干支纪年
* @param lYear 农历年的年份数
* @return Cn string
*/
toGanZhiYear: function (lYear) {
var ganKey = (lYear - 3) % 10
var zhiKey = (lYear - 3) % 12
if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干
if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]
},
/**
* 公历月日判断所属星座
* @param cMonth [description]
* @param cDay [description]
* @return Cn string
*/
toAstro: function (cMonth, cDay) {
var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座
},
/**
* 传入offset偏移量返回干支
* @param offset 相对甲子的偏移量
* @return Cn string
*/
toGanZhi: function (offset) {
return this.Gan[offset % 10] + this.Zhi[offset % 12]
},
/**
* 传入公历(!)y年获得该年第n个节气的公历日期
* @param y公历年(1900-2100)n二十四节气中的第几个节气(1~24)从n=1(小寒)算起
* @return day Number
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
*/
getTerm: function (y, n) {
if (y < 1900 || y > 2100) { return -1 }
if (n < 1 || n > 24) { return -1 }
var _table = this.sTermInfo[y - 1900]
var _info = [
parseInt('0x' + _table.substr(0, 5)).toString(),
parseInt('0x' + _table.substr(5, 5)).toString(),
parseInt('0x' + _table.substr(10, 5)).toString(),
parseInt('0x' + _table.substr(15, 5)).toString(),
parseInt('0x' + _table.substr(20, 5)).toString(),
parseInt('0x' + _table.substr(25, 5)).toString()
]
var _calday = [
_info[0].substr(0, 1),
_info[0].substr(1, 2),
_info[0].substr(3, 1),
_info[0].substr(4, 2),
_info[1].substr(0, 1),
_info[1].substr(1, 2),
_info[1].substr(3, 1),
_info[1].substr(4, 2),
_info[2].substr(0, 1),
_info[2].substr(1, 2),
_info[2].substr(3, 1),
_info[2].substr(4, 2),
_info[3].substr(0, 1),
_info[3].substr(1, 2),
_info[3].substr(3, 1),
_info[3].substr(4, 2),
_info[4].substr(0, 1),
_info[4].substr(1, 2),
_info[4].substr(3, 1),
_info[4].substr(4, 2),
_info[5].substr(0, 1),
_info[5].substr(1, 2),
_info[5].substr(3, 1),
_info[5].substr(4, 2)
]
return parseInt(_calday[n - 1])
},
/**
* 传入农历数字月份返回汉语通俗表示法
* @param lunar month
* @return Cn string
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
*/
toChinaMonth: function (m) { // 月 => \u6708
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
var s = this.nStr3[m - 1]
s += '\u6708'// 加上月字
return s
},
/**
* 传入农历日期数字返回汉字表示法
* @param lunar day
* @return Cn string
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
*/
toChinaDay: function (d) { // 日 => \u65e5
var s
switch (d) {
case 10:
s = '\u521d\u5341'; break
case 20:
s = '\u4e8c\u5341'; break
case 30:
s = '\u4e09\u5341'; break
default :
s = this.nStr2[Math.floor(d / 10)]
s += this.nStr1[d % 10]
}
return (s)
},
/**
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是立春
* @param y year
* @return Cn string
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
*/
getAnimal: function (y) {
return this.Animals[(y - 4) % 12]
},
/**
* 传入阳历年月日获得详细的公历农历object信息 <=>JSON
* @param y solar year
* @param m solar month
* @param d solar day
* @return JSON object
* @eg:console.log(calendar.solar2lunar(1987,11,01));
*/
solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31
// 年份限定、上限
if (y < 1900 || y > 2100) {
return -1// undefined转换为数字变为NaN
}
// 公历传参最下限
if (y == 1900 && m == 1 && d < 31) {
return -1
}
// 未传参 获得当天
if (!y) {
var objDate = new Date()
} else {
var objDate = new Date(y, parseInt(m) - 1, d)
}
var i; var leap = 0; var temp = 0
// 修正ymd参数
var y = objDate.getFullYear()
var m = objDate.getMonth() + 1
var d = objDate.getDate()
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000
for (i = 1900; i < 2101 && offset > 0; i++) {
temp = this.lYearDays(i)
offset -= temp
}
if (offset < 0) {
offset += temp; i--
}
// 是否今天
var isTodayObj = new Date()
var isToday = false
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) {
isToday = true
}
// 星期几
var nWeek = objDate.getDay()
var cWeek = this.nStr1[nWeek]
// 数字表示周几顺应天朝周一开始的惯例
if (nWeek == 0) {
nWeek = 7
}
// 农历年
var year = i
var leap = this.leapMonth(i) // 闰哪个月
var isLeap = false
// 效验闰月
for (i = 1; i < 13 && offset > 0; i++) {
// 闰月
if (leap > 0 && i == (leap + 1) && isLeap == false) {
--i
isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数
} else {
temp = this.monthDays(year, i)// 计算农历普通月天数
}
// 解除闰月
if (isLeap == true && i == (leap + 1)) { isLeap = false }
offset -= temp
}
// 闰月导致数组下标重叠取反
if (offset == 0 && leap > 0 && i == leap + 1) {
if (isLeap) {
isLeap = false
} else {
isLeap = true; --i
}
}
if (offset < 0) {
offset += temp; --i
}
// 农历月
var month = i
// 农历日
var day = offset + 1
// 天干地支处理
var sm = m - 1
var gzY = this.toGanZhiYear(year)
// 当月的两个节气
// bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始
var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始
// 依据12节气修正干支月
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11)
if (d >= firstNode) {
gzM = this.toGanZhi((y - 1900) * 12 + m + 12)
}
// 传入的日期的节气与否
var isTerm = false
var Term = null
if (firstNode == d) {
isTerm = true
Term = this.solarTerm[m * 2 - 2]
}
if (secondNode == d) {
isTerm = true
Term = this.solarTerm[m * 2 - 1]
}
// 日柱 当月一日与 1900/1/1 相差天数
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10
var gzD = this.toGanZhi(dayCyclical + d - 1)
// 该日期所属的星座
var astro = this.toAstro(m, d)
return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro }
},
/**
* 传入农历年月日以及传入的月份是否闰月获得详细的公历农历object信息 <=>JSON
* @param y lunar year
* @param m lunar month
* @param d lunar day
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
* @return JSON object
* @eg:console.log(calendar.lunar2solar(1987,9,10));
*/
lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1
var isLeapMonth = !!isLeapMonth
var leapOffset = 0
var leapMonth = this.leapMonth(y)
var leapDay = this.leapDays(y)
if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值
var day = this.monthDays(y, m)
var _day = day
// bugFix 2016-9-25
// if month is leap, _day use leapDays method
if (isLeapMonth) {
_day = this.leapDays(y, m)
}
if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验
// 计算农历的时间差
var offset = 0
for (var i = 1900; i < y; i++) {
offset += this.lYearDays(i)
}
var leap = 0; var isAdd = false
for (var i = 1; i < m; i++) {
leap = this.leapMonth(y)
if (!isAdd) { // 处理闰月
if (leap <= i && leap > 0) {
offset += this.leapDays(y); isAdd = true
}
}
offset += this.monthDays(y, i)
}
// 转换闰月农历 需补充该年闰月的前一个月的时差
if (isLeapMonth) { offset += day }
// 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0)
var calObj = new Date((offset + d - 31) * 86400000 + stmap)
var cY = calObj.getUTCFullYear()
var cM = calObj.getUTCMonth() + 1
var cD = calObj.getUTCDate()
return this.solar2lunar(cY, cM, cD)
}
}
export default calendar

View File

@ -0,0 +1,12 @@
{
"uni-calender.ok": "ok",
"uni-calender.cancel": "cancel",
"uni-calender.today": "today",
"uni-calender.MON": "MON",
"uni-calender.TUE": "TUE",
"uni-calender.WED": "WED",
"uni-calender.THU": "THU",
"uni-calender.FRI": "FRI",
"uni-calender.SAT": "SAT",
"uni-calender.SUN": "SUN"
}

View File

@ -0,0 +1,8 @@
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}

View File

@ -0,0 +1,12 @@
{
"uni-calender.ok": "确定",
"uni-calender.cancel": "取消",
"uni-calender.today": "今日",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
}

View File

@ -0,0 +1,12 @@
{
"uni-calender.ok": "確定",
"uni-calender.cancel": "取消",
"uni-calender.today": "今日",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
}

View File

@ -0,0 +1,187 @@
<template>
<view class="uni-calendar-item__weeks-box" :class="{
'uni-calendar-item--disable':weeks.disable,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) ,
'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple,
}"
@click="choiceDate(weeks)">
<view class="uni-calendar-item__weeks-box-item">
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
<text class="uni-calendar-item__weeks-box-text" :class="{
'uni-calendar-item--isDay-text': weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable,
}">{{weeks.date}}</text>
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{
'uni-calendar-item--isDay-text':weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple,
}">{{todayText}}</text>
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
'uni-calendar-item--isDay-text':weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable,
}">{{weeks.isDay ? todayText : (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
'uni-calendar-item--extra':weeks.extraInfo.info,
'uni-calendar-item--isDay-text':weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable,
}">{{weeks.extraInfo.info}}</text>
</view>
</view>
</template>
<script>
import { initVueI18n } from '@dcloudio/uni-i18n'
import i18nMessages from './i18n/index.js'
const { t } = initVueI18n(i18nMessages)
export default {
emits:['change'],
props: {
weeks: {
type: Object,
default () {
return {}
}
},
calendar: {
type: Object,
default: () => {
return {}
}
},
selected: {
type: Array,
default: () => {
return []
}
},
lunar: {
type: Boolean,
default: false
}
},
computed: {
todayText() {
return t("uni-calender.today")
},
},
methods: {
choiceDate(weeks) {
this.$emit('change', weeks)
}
}
}
</script>
<style lang="scss" scoped>
$uni-font-size-base:14px;
$uni-text-color:#333;
$uni-font-size-sm:12px;
$uni-color-error: #e43d33;
$uni-opacity-disabled: 0.3;
$uni-text-color-disable:#c0c0c0;
$uni-primary: #2979ff !default;
.uni-calendar-item__weeks-box {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
}
.uni-calendar-item__weeks-box-text {
font-size: $uni-font-size-base;
color: $uni-text-color;
}
.uni-calendar-item__weeks-lunar-text {
font-size: $uni-font-size-sm;
color: $uni-text-color;
}
.uni-calendar-item__weeks-box-item {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
width: 100rpx;
height: 100rpx;
}
.uni-calendar-item__weeks-box-circle {
position: absolute;
top: 5px;
right: 5px;
width: 8px;
height: 8px;
border-radius: 8px;
background-color: $uni-color-error;
}
.uni-calendar-item--disable {
background-color: rgba(249, 249, 249, $uni-opacity-disabled);
color: $uni-text-color-disable;
}
.uni-calendar-item--isDay-text {
color: $uni-primary;
}
.uni-calendar-item--isDay {
background-color: $uni-primary;
opacity: 0.8;
color: #fff;
}
.uni-calendar-item--extra {
color: $uni-color-error;
opacity: 0.8;
}
.uni-calendar-item--checked {
background-color: $uni-primary;
color: #fff;
opacity: 0.8;
}
.uni-calendar-item--multiple {
background-color: $uni-primary;
color: #fff;
opacity: 0.8;
}
.uni-calendar-item--before-checked {
background-color: #ff5a5f;
color: #fff;
}
.uni-calendar-item--after-checked {
background-color: #ff5a5f;
color: #fff;
}
</style>

View File

@ -0,0 +1,567 @@
<template>
<view class="uni-calendar">
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view>
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}">
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
<view class="uni-calendar__header-btn-box" @click="close">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text>
</view>
<view class="uni-calendar__header-btn-box" @click="confirm">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{okText}}</text>
</view>
</view>
<view class="uni-calendar__header">
<view class="uni-calendar__header-btn-box" @click.stop="pre">
<view class="uni-calendar__header-btn uni-calendar--left"></view>
</view>
<picker mode="date" :value="date" fields="month" @change="bindDateChange">
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text>
</picker>
<view class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view>
</view>
<text class="uni-calendar__backtoday" @click="backToday">{{todayText}}</text>
</view>
<view class="uni-calendar__box">
<view v-if="showMonth" class="uni-calendar__box-bg">
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
</view>
<view class="uni-calendar__weeks">
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{monText}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{TUEText}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{WEDText}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{THUText}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{FRIText}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{SATText}}</text>
</view>
</view>
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import Calendar from './util.js';
import CalendarItem from './uni-calendar-item.vue'
import { initVueI18n } from '@dcloudio/uni-i18n'
import i18nMessages from './i18n/index.js'
const { t } = initVueI18n(i18nMessages)
/**
* Calendar 日历
* @description 日历组件可以查看日期选择任意范围内的日期打点操作常用场景如酒店日期预订火车机票选择购买日期上下班打卡等
* @tutorial https://ext.dcloud.net.cn/plugin?id=56
* @property {String} date 自定义当前时间默认为今天
* @property {Boolean} lunar 显示农历
* @property {String} startDate 日期选择范围-开始日期
* @property {String} endDate 日期选择范围-结束日期
* @property {Boolean} range 范围选择
* @property {Boolean} insert = [true|false] 插入模式,默认为false
* @value true 弹窗模式
* @value false 插入模式
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
* @property {Array} selected 打点期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
* @property {Boolean} showMonth 是否选择月份为背景
* @event {Function} change 日期改变`insert :ture` 时生效
* @event {Function} confirm 确认选择`insert :false` 时生效
* @event {Function} monthSwitch 切换月份时触发
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
*/
export default {
components: {
CalendarItem
},
emits:['close','confirm','change','monthSwitch'],
props: {
date: {
type: String,
default: ''
},
selected: {
type: Array,
default () {
return []
}
},
lunar: {
type: Boolean,
default: false
},
startDate: {
type: String,
default: ''
},
endDate: {
type: String,
default: ''
},
range: {
type: Boolean,
default: false
},
insert: {
type: Boolean,
default: true
},
showMonth: {
type: Boolean,
default: true
},
clearDate: {
type: Boolean,
default: true
}
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: '',
aniMaskShow: false
}
},
computed:{
/**
* for i18n
*/
okText() {
return t("uni-calender.ok")
},
cancelText() {
return t("uni-calender.cancel")
},
todayText() {
return t("uni-calender.today")
},
monText() {
return t("uni-calender.MON")
},
TUEText() {
return t("uni-calender.TUE")
},
WEDText() {
return t("uni-calender.WED")
},
THUText() {
return t("uni-calender.THU")
},
FRIText() {
return t("uni-calender.FRI")
},
SATText() {
return t("uni-calender.SAT")
},
SUNText() {
return t("uni-calender.SUN")
},
},
watch: {
date(newVal) {
// this.cale.setDate(newVal)
this.init(newVal)
},
startDate(val){
this.cale.resetSatrtDate(val)
this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks
},
endDate(val){
this.cale.resetEndDate(val)
this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks
},
selected(newVal) {
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
this.weeks = this.cale.weeks
}
},
created() {
this.cale = new Calendar({
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range,
})
this.init(this.date)
},
methods: {
// 穿
clean() {},
bindDateChange(e) {
const value = e.detail.value + '-1'
this.setDate(value)
const { year,month } = this.cale.getDate(value)
this.$emit('monthSwitch', {
year,
month
})
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
this.cale.setDate(date)
this.weeks = this.cale.weeks
this.nowDate = this.calendar = this.cale.getInfo(date)
},
/**
* 打开日历弹窗
*/
open() {
//
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus()
// this.cale.setDate(this.date)
this.init(this.date)
}
this.show = true
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true
}, 50)
})
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false
this.$nextTick(() => {
setTimeout(() => {
this.show = false
this.$emit('close')
}, 300)
})
},
/**
* 确认按钮
*/
confirm() {
this.setEmit('confirm')
this.close()
},
/**
* 变化触发
*/
change() {
if (!this.insert) return
this.setEmit('change')
},
/**
* 选择月份触发
*/
monthSwitch() {
let {
year,
month
} = this.nowDate
this.$emit('monthSwitch', {
year,
month: Number(month)
})
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name) {
let {
year,
month,
date,
fullDate,
lunar,
extraInfo
} = this.calendar
this.$emit(name, {
range: this.cale.multipleStatus,
year,
month,
date,
fulldate: fullDate,
lunar,
extraInfo: extraInfo || {}
})
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable) return
this.calendar = weeks
//
this.cale.setMultiple(this.calendar.fullDate)
this.weeks = this.cale.weeks
this.change()
},
/**
* 回到今天
*/
backToday() {
const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`
const date = this.cale.getDate(new Date())
const todayYearMonth = `${date.year}-${date.month}`
this.init(date.fullDate)
if(nowYearMonth !== todayYearMonth) {
this.monthSwitch()
}
this.change()
},
/**
* 上个月
*/
pre() {
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
this.setDate(preDate)
this.monthSwitch()
},
/**
* 下个月
*/
next() {
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
this.setDate(nextDate)
this.monthSwitch()
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date)
this.weeks = this.cale.weeks
this.nowDate = this.cale.getInfo(date)
}
}
}
</script>
<style lang="scss" scoped>
$uni-bg-color-mask: rgba($color: #000000, $alpha: 0.4);
$uni-border-color: #EDEDED;
$uni-text-color: #333;
$uni-bg-color-hover:#f1f1f1;
$uni-font-size-base:14px;
$uni-text-color-placeholder: #808080;
$uni-color-subtitle: #555555;
$uni-text-color-grey:#999;
.uni-calendar {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
}
.uni-calendar__mask {
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
background-color: $uni-bg-color-mask;
transition-property: opacity;
transition-duration: 0.3s;
opacity: 0;
/* #ifndef APP-NVUE */
z-index: 99;
/* #endif */
}
.uni-calendar--mask-show {
opacity: 1
}
.uni-calendar--fixed {
position: fixed;
/* #ifdef APP-NVUE */
bottom: 0;
/* #endif */
left: 0;
right: 0;
transition-property: transform;
transition-duration: 0.3s;
transform: translateY(460px);
/* #ifndef APP-NVUE */
bottom: calc(var(--window-bottom));
z-index: 99;
/* #endif */
}
.uni-calendar--ani-show {
transform: translateY(0);
}
.uni-calendar__content {
background-color: #fff;
}
.uni-calendar__header {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
align-items: center;
height: 50px;
border-bottom-color: $uni-border-color;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar--fixed-top {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: space-between;
border-top-color: $uni-border-color;
border-top-style: solid;
border-top-width: 1px;
}
.uni-calendar--fixed-width {
width: 50px;
}
.uni-calendar__backtoday {
position: absolute;
right: 0;
top: 25rpx;
padding: 0 5px;
padding-left: 10px;
height: 25px;
line-height: 25px;
font-size: 12px;
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
color: $uni-text-color;
background-color: $uni-bg-color-hover;
}
.uni-calendar__header-text {
text-align: center;
width: 100px;
font-size: $uni-font-size-base;
color: $uni-text-color;
}
.uni-calendar__header-btn-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
}
.uni-calendar__header-btn {
width: 10px;
height: 10px;
border-left-color: $uni-text-color-placeholder;
border-left-style: solid;
border-left-width: 2px;
border-top-color: $uni-color-subtitle;
border-top-style: solid;
border-top-width: 2px;
}
.uni-calendar--left {
transform: rotate(-45deg);
}
.uni-calendar--right {
transform: rotate(135deg);
}
.uni-calendar__weeks {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.uni-calendar__weeks-item {
flex: 1;
}
.uni-calendar__weeks-day {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
height: 45px;
border-bottom-color: #F5F5F5;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar__weeks-day-text {
font-size: 14px;
}
.uni-calendar__box {
position: relative;
}
.uni-calendar__box-bg {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.uni-calendar__box-bg-text {
font-size: 200px;
font-weight: bold;
color: $uni-text-color-grey;
opacity: 0.1;
text-align: center;
/* #ifndef APP-NVUE */
line-height: 1;
/* #endif */
}
</style>

View File

@ -0,0 +1,360 @@
import CALENDAR from './calendar.js'
class Calendar {
constructor({
date,
selected,
startDate,
endDate,
range
} = {}) {
// 当前日期
this.date = this.getDate(new Date()) // 当前初入日期
// 打点信息
this.selected = selected || [];
// 范围开始
this.startDate = startDate
// 范围结束
this.endDate = endDate
this.range = range
// 多选状态
this.cleanMultipleStatus()
// 每周日期
this.weeks = {}
// this._getWeek(this.date.fullDate)
}
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.selectDate = this.getDate(date)
this._getWeek(this.selectDate.fullDate)
}
/**
* 清理多选状态
*/
cleanMultipleStatus() {
this.multipleStatus = {
before: '',
after: '',
data: []
}
}
/**
* 重置开始日期
*/
resetSatrtDate(startDate) {
// 范围开始
this.startDate = startDate
}
/**
* 重置结束日期
*/
resetEndDate(endDate) {
// 范围结束
this.endDate = endDate
}
/**
* 获取任意时间
*/
getDate(date, AddDayCount = 0, str = 'day') {
if (!date) {
date = new Date()
}
if (typeof date !== 'object') {
date = date.replace(/-/g, '/')
}
const dd = new Date(date)
switch (str) {
case 'day':
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
break
case 'month':
if (dd.getDate() === 31 && AddDayCount>0) {
dd.setDate(dd.getDate() + AddDayCount)
} else {
const preMonth = dd.getMonth()
dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期
const nextMonth = dd.getMonth()
// 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
if(AddDayCount<0 && preMonth!==0 && nextMonth-preMonth>AddDayCount){
dd.setMonth(nextMonth+(nextMonth-preMonth+AddDayCount))
}
// 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
if(AddDayCount>0 && nextMonth-preMonth>AddDayCount){
dd.setMonth(nextMonth-(nextMonth-preMonth-AddDayCount))
}
}
break
case 'year':
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
break
}
const y = dd.getFullYear()
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期不足10补0
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号不足10补0
return {
fullDate: y + '-' + m + '-' + d,
year: y,
month: m,
date: d,
day: dd.getDay()
}
}
/**
* 获取上月剩余天数
*/
_getLastMonthDays(firstDay, full) {
let dateArr = []
for (let i = firstDay; i > 0; i--) {
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate()
dateArr.push({
date: beforeDate,
month: full.month - 1,
lunar: this.getlunar(full.year, full.month - 1, beforeDate),
disable: true
})
}
return dateArr
}
/**
* 获取本月天数
*/
_currentMonthDys(dateData, full) {
let dateArr = []
let fullDate = this.date.fullDate
for (let i = 1; i <= dateData; i++) {
let nowDate = full.year + '-' + (full.month < 10 ?
full.month : full.month) + '-' + (i < 10 ?
'0' + i : i)
// 是否今天
let isDay = fullDate === nowDate
// 获取打点信息
let info = this.selected && this.selected.find((item) => {
if (this.dateEqual(nowDate, item.date)) {
return item
}
})
// 日期禁用
let disableBefore = true
let disableAfter = true
if (this.startDate) {
// let dateCompBefore = this.dateCompare(this.startDate, fullDate)
// disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
disableBefore = this.dateCompare(this.startDate, nowDate)
}
if (this.endDate) {
// let dateCompAfter = this.dateCompare(fullDate, this.endDate)
// disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
disableAfter = this.dateCompare(nowDate, this.endDate)
}
let multiples = this.multipleStatus.data
let checked = false
let multiplesStatus = -1
if (this.range) {
if (multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, nowDate)
})
}
if (multiplesStatus !== -1) {
checked = true
}
}
let data = {
fullDate: nowDate,
year: full.year,
date: i,
multiple: this.range ? checked : false,
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate),
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate),
month: full.month,
lunar: this.getlunar(full.year, full.month, i),
disable: !(disableBefore && disableAfter),
isDay
}
if (info) {
data.extraInfo = info
}
dateArr.push(data)
}
return dateArr
}
/**
* 获取下月天数
*/
_getNextMonthDays(surplus, full) {
let dateArr = []
for (let i = 1; i < surplus + 1; i++) {
dateArr.push({
date: i,
month: Number(full.month) + 1,
lunar: this.getlunar(full.year, Number(full.month) + 1, i),
disable: true
})
}
return dateArr
}
/**
* 获取当前日期详情
* @param {Object} date
*/
getInfo(date) {
if (!date) {
date = new Date()
}
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate)
return dateInfo
}
/**
* 比较时间大小
*/
dateCompare(startDate, endDate) {
// 计算截止时间
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
if (startDate <= endDate) {
return true
} else {
return false
}
}
/**
* 比较时间是否相等
*/
dateEqual(before, after) {
// 计算截止时间
before = new Date(before.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间
after = new Date(after.replace('-', '/').replace('-', '/'))
if (before.getTime() - after.getTime() === 0) {
return true
} else {
return false
}
}
/**
* 获取日期范围内所有日期
* @param {Object} begin
* @param {Object} end
*/
geDateAll(begin, end) {
var arr = []
var ab = begin.split('-')
var ae = end.split('-')
var db = new Date()
db.setFullYear(ab[0], ab[1] - 1, ab[2])
var de = new Date()
de.setFullYear(ae[0], ae[1] - 1, ae[2])
var unixDb = db.getTime() - 24 * 60 * 60 * 1000
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
for (var k = unixDb; k <= unixDe;) {
k = k + 24 * 60 * 60 * 1000
arr.push(this.getDate(new Date(parseInt(k))).fullDate)
}
return arr
}
/**
* 计算阴历日期显示
*/
getlunar(year, month, date) {
return CALENDAR.solar2lunar(year, month, date)
}
/**
* 设置打点
*/
setSelectInfo(data, value) {
this.selected = value
this._getWeek(data)
}
/**
* 获取多选状态
*/
setMultiple(fullDate) {
let {
before,
after
} = this.multipleStatus
if (!this.range) return
if (before && after) {
this.multipleStatus.before = fullDate
this.multipleStatus.after = ''
this.multipleStatus.data = []
} else {
if (!before) {
this.multipleStatus.before = fullDate
} else {
this.multipleStatus.after = fullDate
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
}
}
this._getWeek(fullDate)
}
/**
* 获取每周数据
* @param {Object} dateData
*/
_getWeek(dateData) {
const {
year,
month
} = this.getDate(dateData)
let firstDay = new Date(year, month - 1, 1).getDay()
let currentDay = new Date(year, month, 0).getDate()
let dates = {
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
nextMonthDays: [], // 下个月开始几天
weeks: []
}
let canlender = []
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData))
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays)
let weeks = {}
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
for (let i = 0; i < canlender.length; i++) {
if (i % 7 === 0) {
weeks[parseInt(i / 7)] = new Array(7)
}
weeks[parseInt(i / 7)][i % 7] = canlender[i]
}
this.canlender = canlender
this.weeks = weeks
}
//静态方法
// static init(date) {
// if (!this.instance) {
// this.instance = new Calendar(date);
// }
// return this.instance;
// }
}
export default Calendar

View File

@ -0,0 +1,86 @@
{
"id": "uni-calendar",
"displayName": "uni-calendar 日历",
"version": "1.4.12",
"description": "日历组件",
"keywords": [
"uni-ui",
"uniui",
"日历",
"",
"打卡",
"日历选择"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@ -0,0 +1,103 @@
## Calendar 日历
> **组件名uni-calendar**
> 代码块: `uCalendar`
日历组件
> **注意事项**
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
> - 本组件农历转换使用的js是 [@1900-2100区间内的公历、农历互转](https://github.com/jjonline/calendar.js)
> - 仅支持自定义组件模式
> - `date`属性传入的应该是一个 String ,如: 2019-06-27 ,而不是 new Date()
> - 通过 `insert` 属性来确定当前的事件是 @change 还是 @confirm 。理应合并为一个事件,但是为了区分模式,现使用两个事件,这里需要注意
> - 弹窗模式下无法阻止后面的元素滚动,如有需要阻止,请在弹窗弹出后,手动设置滚动元素为不可滚动
### 安装方式
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
### 基本用法
在 ``template`` 中使用组件
```html
<view>
<uni-calendar
:insert="true"
:lunar="true"
:start-date="'2019-3-2'"
:end-date="'2019-5-20'"
@change="change"
/>
</view>
```
### 通过方法打开日历
需要设置 `insert``false`
```html
<view>
<uni-calendar
ref="calendar"
:insert="false"
@confirm="confirm"
/>
<button @click="open">打开日历</button>
</view>
```
```javascript
export default {
data() {
return {};
},
methods: {
open(){
this.$refs.calendar.open();
},
confirm(e) {
console.log(e);
}
}
};
```
## API
### Calendar Props
| 属性名 | 类型 | 默认值| 说明 |
| - | - | - | - |
| date | String |- | 自定义当前时间,默认为今天 |
| lunar | Boolean | false | 显示农历 |
| startDate | String |- | 日期选择范围-开始日期 |
| endDate | String |- | 日期选择范围-结束日期 |
| range | Boolean | false | 范围选择 |
| insert | Boolean | false | 插入模式,可选值ture插入模式false弹窗模式默认为插入模式 |
|clearDate |Boolean |true |弹窗模式是否清空上次选择内容 |
| selected | Array |- | 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] |
|showMonth | Boolean | true | 是否显示月份为背景 |
### Calendar Events
| 事件名 | 说明 |返回值|
| - | - | - |
| open | 弹出日历组件,`insert :false` 时生效|- |
## 组件示例
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/calendar/calendar](https://hellouniapp.dcloud.net.cn/pages/extUI/calendar/calendar)

View File

@ -29,9 +29,9 @@ export default {
data.provinceCode = '530000' // 如果用户没有省份编码信息,则默认浙江省
data.time = data.time || (new Date()).getTime()
data = Object.assign(data, publicOptions);
data.WeChat_AppId = 'wxa99ef047735c031e'
data.WeChat_AppId = 'wx6e28691bea93c6ec'
data.WeChat_MiniProToken = Store.state.userData.WeChat_MiniProToken || ''
data.WeChatAppId = 'wxa99ef047735c031e'
data.WeChatAppId = 'wx6e28691bea93c6ec'
data.memberShipId = !data.memberShipId ? (Store.state.userData.Membership_Id || '') :
data.memberShipId // ||'3255' 1170386 1125717 //
@ -60,7 +60,7 @@ export default {
'ServerpartCodes': Store.state.userData.UserCityAuthority,
'ProvinceCode': '530000',
'ModuleGuid': ModuleGuid,
'WeChat_AppId': 'wxa99ef047735c031e',
'WeChat_AppId': 'wx6e28691bea93c6ec',
'memberShipId': !data.memberShipId ? (Store.state.userData.Membership_Id || '') : data.memberShipId,
'SourcePlatform': 'minProgram'
}
@ -69,7 +69,7 @@ export default {
'ServerpartCodes': Store.state.userData.UserCityAuthority,
'ProvinceCode': '530000',
'ModuleGuid': ModuleGuid,
'WeChat_AppId': 'wxa99ef047735c031e',
'WeChat_AppId': 'wx6e28691bea93c6ec',
'memberShipId': !data.memberShipId ? (Store.state.userData.Membership_Id || '') : data.memberShipId,
'SourcePlatform': 'minProgram',
"UserId": Store.state.userData.UserId,