From befd1f21839939b54254bd316bbd158b136fcd15 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 12 十一月 2024 16:54:25 +0800
Subject: [PATCH] 简化主页
---
pages/inspection/param-util.js | 3
pages/inspection/ranking/index.js | 133 ++++-----
pages/usercenter/about/index.wxml | 2
services/inspection/fetchScene.js | 13
services/inspection/fetchInspection.js | 20
pages/inspection/ranking/problem-change-list.js | 37 ++
pages/inspection/ranking/problem-change-list.wxml | 62 ++++
pages/simple-home/index.js | 125 ++++++++
pages/home/news.wxml | 2
pages/inspection/ranking/problem-change-list.wxss | 79 +++++
pages/home/index.js | 1
pages/usercenter/login/login-home/index.wxml | 2
pages/simple-home/packge-info | 1
config/index.js | 2
pages/inspection/ranking/statistic.wxss | 4
pages/inspection/ranking/statistic.wxml | 4
behaviors/login.js | 36 +
pages/simple-home/index.wxml | 32 ++
pages/home/inspection-proxy.js | 4
pages/simple-home/index.wxss | 26 +
pages/simple-home/index.json | 21 +
pages/inspection/ranking/index.wxss | 88 ------
app.json | 3
/dev/null | 1
pages/inspection/ranking/index.wxml | 17
pages/home/options.wxml | 38 +-
pages/inspection/ranking/statistic.js | 31 ++
pages/inspection/ranking/sort-options.wxml | 16 +
pages/inspection/ranking/sort-options.js | 23 +
pages/inspection/ranking/sort-options.wxss | 3
30 files changed, 615 insertions(+), 214 deletions(-)
diff --git a/app.json b/app.json
index f5ecf7c..7558e58 100644
--- a/app.json
+++ b/app.json
@@ -35,7 +35,8 @@
"pages/inspection/scene/search/index",
"pages/inspection/scene/info/index",
"pages/inspection/scene/info/device-info/index",
- "pages/inspection/scene/info/device-status/index"
+ "pages/inspection/scene/info/device-status/index",
+ "pages/simple-home/index"
],
"tabBar": {
"custom": true,
diff --git a/behaviors/login.js b/behaviors/login.js
index 3b094f7..0fc0dfb 100644
--- a/behaviors/login.js
+++ b/behaviors/login.js
@@ -1,8 +1,4 @@
-import {
- fetchLoginPW,
- fetchUserInfo,
- fetchUserBaseInfo,
-} from '../services/usercenter/fetchUser';
+import { fetchLoginPW, fetchUserInfo, fetchUserBaseInfo } from '../services/usercenter/fetchUser';
import { loadConfig } from '../behaviors/loadConfig';
import dayjs from 'dayjs';
@@ -33,12 +29,10 @@
app.globalData.accessToken.suserId = data.suserId;
app.globalData.accessToken.openId = data.openId;
if (accessTokenPW.userName) {
- app.globalData.accessToken.userName =
- accessTokenPW.userName;
+ app.globalData.accessToken.userName = accessTokenPW.userName;
}
if (accessTokenPW.password) {
- app.globalData.accessToken.password =
- accessTokenPW.password;
+ app.globalData.accessToken.password = accessTokenPW.password;
}
wx.setStorage({
key: 'accessToken',
@@ -99,10 +93,28 @@
key: 'userInfo',
data: data,
success: result => {
- loadConfig().then(res => {
- wx.switchTab({
- url: '/pages/home/index',
+ loadConfig()
+ .then(res => {
+ // 鍒ゆ柇鐢ㄦ埛鏄惁杩涘叆绠�鍖栦富椤�
+ if (app.globalData.userConfig.ucExtension1 == 'simple') {
+ wx.redirectTo({
+ url: '/pages/simple-home/index',
+ });
+ } else {
+ wx.switchTab({
+ url: '/pages/home/index',
+ });
+ }
+ })
+ .finally(() => {
+ this.setData({
+ loading: false,
+ });
});
+ },
+ fail: err => {
+ this.setData({
+ loading: false,
});
},
});
diff --git a/config/index.js b/config/index.js
index 30ff19b..0d563f5 100644
--- a/config/index.js
+++ b/config/index.js
@@ -9,7 +9,7 @@
// 绾夸笂鐩戠
const inspectUrl = 'https://fyami.com.cn:447';
-// const inspectUrl = 'http://192.168.0.138:8082';
+// const inspectUrl = 'http://192.168.0.138:9001';
// const inspectUrl = 'http://192.168.0.138:8080';
// const inspectUrl = 'http://192.168.1.8:8080';
diff --git a/pages/home/index.js b/pages/home/index.js
index 1edb7d4..4193849 100644
--- a/pages/home/index.js
+++ b/pages/home/index.js
@@ -35,6 +35,7 @@
* 鍒濆鍔犺浇
* 褰撴墍鏈夌瓫閫夋潯浠堕兘鑾峰彇鍒板垵濮嬪�煎悗锛屾墽琛屼竴娆″垵濮嬪寲鍔犺浇
* 鍖呮嫭鍦烘櫙绫诲瀷銆佸尯鍩熴�佹椂闂翠笁涓�夐」锛屽叏閮ㄨ幏鍙栧垵濮嬪�煎悗锛屾墽琛屽姞杞�
+ * @see options-proxy.js
*/
optionsCount: 0,
init() {
diff --git a/pages/home/inspection-proxy.js b/pages/home/inspection-proxy.js
index 03efc81..06a155b 100644
--- a/pages/home/inspection-proxy.js
+++ b/pages/home/inspection-proxy.js
@@ -2,6 +2,7 @@
fetchInspectionStatistic,
fetchSubtaskSummaryByArea,
} from '../../services/inspection/fetchInspection';
+import dayjs from "dayjs";
/**
* 鐜板満宸℃煡鐩戠鐩稿叧淇℃伅鑾峰彇閫昏緫
@@ -16,6 +17,7 @@
fetchInspection(page) {
this.setData({ inspectionLoading: true });
const { provinceCode, cityCode, districtCode, townCode, sceneTypeValue, time } = this.data;
+ const eTime = dayjs(time).endOf('M').format('YYYY-MM-DD HH:mm:ss')
fetchSubtaskSummaryByArea({
provincecode: provinceCode,
citycode: cityCode,
@@ -23,7 +25,7 @@
towncode: townCode,
scensetypeid: sceneTypeValue[0],
starttime: time,
- endtime: time,
+ endtime: eTime,
})
.then(res => {
this.setData({
diff --git a/pages/home/news.wxml b/pages/home/news.wxml
index 9eec1ad..6188b14 100644
--- a/pages/home/news.wxml
+++ b/pages/home/news.wxml
@@ -1,3 +1,3 @@
-<train-card values="{{trainingList}}" />
+<!-- <train-card values="{{trainingList}}" /> -->
<info-cards cardTitle="鎵ф硶鍔ㄦ��" infoList="{{infoList}}" bindnavTo="navToInfoPage"></info-cards>
<load-more list-is-empty="{{!infoList.length}}" status="{{loadStatus}}" bind:retry="_startLoad" />
diff --git a/pages/home/options.wxml b/pages/home/options.wxml
index 1a95375..e067b88 100644
--- a/pages/home/options.wxml
+++ b/pages/home/options.wxml
@@ -1,24 +1,28 @@
<view class="home-supervision-title">
<!-- <view> -->
- <!-- <text>绾夸笂鐩戠</text> -->
- <!-- <text class="home-supervision-title__note">鏈湀鏈�鏂�</text> -->
+ <!-- <text>绾夸笂鐩戠</text> -->
+ <!-- <text class="home-supervision-title__note">鏈湀鏈�鏂�</text> -->
<!-- </view> -->
<!-- <view style="display: flex;align-items: center;"> -->
- <t-time-picker
- color="var(--td-font-white-1)"
- picker-class="picker-location"
- bind:timeInitValue="initTime"
- bind:timePickerChange="onTimePickerConfirm"
- >
- </t-time-picker>
- <location-picker
- color="var(--td-font-white-1)"
- style-mode="picker"
- picker-class="picker-location"
- bind:onChange="onLocationChange"
- bind:locationInitValue="initLocation"
- ></location-picker>
+ <t-time-picker
+ color="var(--td-font-white-1)"
+ picker-class="picker-location"
+ bind:timeInitValue="initTime"
+ bind:timePickerChange="onTimePickerConfirm"
+ >
+ </t-time-picker>
+ <location-picker
+ color="var(--td-font-white-1)"
+ style-mode="picker"
+ picker-class="picker-location"
+ bind:onChange="onLocationChange"
+ bind:locationInitValue="initLocation"
+ ></location-picker>
<!-- </view> -->
</view>
-<scene-picker sceneMode="{{1}}" bind:sceneInitValue="initScene" bind:scenePickerChange="onScenePickerConfirm">
+<scene-picker
+ sceneMode="{{1}}"
+ bind:sceneInitValue="initScene"
+ bind:scenePickerChange="onScenePickerConfirm"
+>
</scene-picker>
diff --git a/pages/inspection/param-util.js b/pages/inspection/param-util.js
index be3e09c..d65509d 100644
--- a/pages/inspection/param-util.js
+++ b/pages/inspection/param-util.js
@@ -1,7 +1,7 @@
import dayjs from 'dayjs';
export function _getParamsArea(data) {
- const { inspection, sceneTypeValue: scensetypeid, time, sort } = data;
+ const { inspection, sceneTypeValue: scensetypeid, time, sort, sortBy } = data;
const params = {
provincecode: inspection.provinceCode,
provincename: inspection.provinceName,
@@ -13,6 +13,7 @@
townname: inspection.townName,
scensetypeid: scensetypeid[0],
sort: sort,
+ sortBy: sortBy
};
const t = dayjs(time);
params.starttime = t.startOf('month').format('YYYY-MM-DD HH:mm:ss');
diff --git a/pages/inspection/ranking/index.js b/pages/inspection/ranking/index.js
index 9bfd155..81dbd2f 100644
--- a/pages/inspection/ranking/index.js
+++ b/pages/inspection/ranking/index.js
@@ -1,19 +1,22 @@
import dayjs from 'dayjs';
import { useLoading } from '../../../behaviors/loading';
+import { useProblemChangeList } from "./problem-change-list.js";
+import { useStatistic } from "./statistic.js";
+import { useSortOptions } from "./sort-options.js";
import { fetchSceneProSummary } from '../../../services/inspection/fetchScene';
import { fetchProblemsStatistic } from '../../../services/inspection/fetchInspection';
import { _getParamsArea } from '../param-util.js';
Page({
- behaviors: [useLoading],
+ behaviors: [useLoading, useProblemChangeList, useStatistic, useSortOptions],
data: {
- summaryList: [],
- sort: '',
- sortBy: 'pro',
- statistic: {
- proNum: 0,
- changeNum: 0,
- },
+ // summaryList: [],
+ // sort: '',
+ // sortBy: 'pro',
+ // statistic: {
+ // proNum: 0,
+ // changeNum: 0,
+ // },
},
onLoad(options) {
@@ -39,51 +42,51 @@
},
_fetchData(page) {
- const f1 = this.fetchSceneProSummary(page);
- const f2 = this.fetchProblems(page);
+ const params = _getParamsArea(this.data);
+ const f1 = this.fetchSceneProSummary(params, page);
+ const f2 = this.fetchProblems(params, page);
return Promise.all([f1, f2]).then(res => {
// 杩斿洖璇锋眰f1鐨勫垎椤典俊鎭�
return res[0];
});
},
- fetchSceneProSummary(page) {
- const params = _getParamsArea(this.data);
- const { sortBy } = this.data;
- return fetchSceneProSummary({ area: params, sortBy, page }).then(res => {
- if (res.success) {
- this.setData({
- summaryList: page == 1 ? res.data : this.data.summaryList.concat(res.data),
- });
- } else {
- this.setData({
- summaryList: [],
- });
- }
- return res.head;
- });
- },
+ // fetchSceneProSummary(params, page) {
+ // const params = _getParamsArea(this.data);
+ // return fetchSceneProSummary({ area: params, page }).then(res => {
+ // if (res.success) {
+ // this.setData({
+ // summaryList: page == 1 ? res.data : this.data.summaryList.concat(res.data),
+ // });
+ // } else {
+ // this.setData({
+ // summaryList: [],
+ // });
+ // }
+ // return res.head;
+ // });
+ // },
- fetchProblems(page) {
- const params = _getParamsArea(this.data);
- return fetchProblemsStatistic(params).then(res => {
- let proNum = 0,
- changeNum = 0,
- changePer = 0;
- res.data.forEach(r => {
- proNum += r.count;
- changeNum += r.changeCount;
- });
- if (proNum > 0) {
- changePer = Math.round((changeNum / proNum) * 1000) / 10;
- changePer += '%';
- }
- this.setData({
- statistic: { proNum, changeNum, changePer },
- });
- return res.head;
- });
- },
+ // fetchProblems(params, page) {
+ // const params = _getParamsArea(this.data);
+ // return fetchProblemsStatistic(params).then(res => {
+ // let proNum = 0,
+ // changeNum = 0,
+ // changePer = 0;
+ // res.data.forEach(r => {
+ // proNum += r.count;
+ // changeNum += r.changeCount;
+ // });
+ // if (proNum > 0) {
+ // changePer = Math.round((changeNum / proNum) * 1000) / 10;
+ // changePer += '%';
+ // }
+ // this.setData({
+ // statistic: { proNum, changeNum, changePer },
+ // });
+ // return res.head;
+ // });
+ // },
onTimePickerConfirm(e) {
const { timeValue } = e.detail;
@@ -124,29 +127,17 @@
this._startLoad();
},
- // 闂鏁版帓搴忔洿鏀�
- onProNumSortChange(e) {
- const { sorts } = e.detail;
- this.setData({
- sort: sorts,
- });
- this._startLoad();
- },
-
- // 鏁存敼鐜囨帓搴忔洿鏀�
- onChangePerSortChange(e) {},
-
- navToDetail(e) {
- const { index } = e.currentTarget.dataset;
- const summary = this.data.summaryList[index];
- wx.navigateTo({
- url: '/pages/inspection/detail/index',
- success: result => {
- result.eventChannel.emit('acceptInspectionDetailData', {
- scene: summary.scene,
- time: this.data.time,
- });
- },
- });
- },
+ // navToDetail(e) {
+ // const { index } = e.currentTarget.dataset;
+ // const summary = this.data.summaryList[index];
+ // wx.navigateTo({
+ // url: '/pages/inspection/detail/index',
+ // success: result => {
+ // result.eventChannel.emit('acceptInspectionDetailData', {
+ // scene: summary.scene,
+ // time: this.data.time,
+ // });
+ // },
+ // });
+ // },
});
diff --git a/pages/inspection/ranking/index.wxml b/pages/inspection/ranking/index.wxml
index 81b5714..2084d08 100644
--- a/pages/inspection/ranking/index.wxml
+++ b/pages/inspection/ranking/index.wxml
@@ -1,4 +1,4 @@
-<import src="/pages/common/template/template-loading.wxml" />
+<!-- <import src="/pages/common/template/template-loading.wxml" /> -->
<wxs src="./util.wxs" module="_" />
<view class="page">
@@ -27,11 +27,13 @@
bind:scenePickerChange="onScenePickerConfirm"
/>
</view>
- <view class="ranking-summary__item-abstract" style="margin-left: var(--td-spacer)">
+ <include src="/pages/inspection/ranking/statistic.wxml" />
+ <!-- <view class="ranking-summary__item-abstract" style="margin-left: var(--td-spacer)">
闂鎬昏{{statistic.proNum}}涓紝宸叉暣鏀箋{statistic.changeNum}}涓紝鏈暣鏀箋{statistic.proNum -
statistic.changeNum}}涓紝鏁存敼鐜噞{statistic.changePer}}
- </view>
- <view class="filter-wrap">
+ </view> -->
+ <include src="/pages/inspection/ranking/sort-options.wxml" />
+ <!-- <view class="filter-wrap">
<sort-btn
text="闂鏁�"
custom-class="flex-start "
@@ -48,11 +50,12 @@
defaultSort="{{changeSort}}"
bind:sortsChange="onSortChange"
></sort-btn>
- </view>
+ </view> -->
</view>
</t-sticky>
<view class="page-container">
- <template is="pulldown-loading" wx:if="{{pageLoading && summaryList.length != 0}}" />
+ <include src="./problem-change-list.wxml" />
+ <!-- <template is="pulldown-loading" wx:if="{{pageLoading && summaryList.length != 0}}" />
<block wx:if="{{summaryList.length > 0}}">
<view
class="ranking-summary__item"
@@ -111,7 +114,7 @@
list-is-empty="{{!summaryList.length}}"
status="{{loadStatus}}"
bind:retry="_startLoad"
- />
+ /> -->
</view>
<view class="page-footer"></view>
</view>
diff --git a/pages/inspection/ranking/index.wxss b/pages/inspection/ranking/index.wxss
index aa30bbc..83a1a31 100644
--- a/pages/inspection/ranking/index.wxss
+++ b/pages/inspection/ranking/index.wxss
@@ -1,4 +1,7 @@
@import '../../../components/filter/index.wxss';
+@import './problem-change-list.wxss';
+@import './statistic.wxss';
+@import './sort-options.wxss';
.page .page-header {
background: linear-gradient(var(--td-primary-color-7), var(--td-bg-color));
@@ -38,89 +41,4 @@
.fy-loading-indicator,
.fy-loading-text {
color: var(--td-text-color-placeholder) !important;
-}
-
-.ranking-summary__item {
- background-color: var(--td-bg-color-fade);
- border-radius: var(--td-border-radius);
- box-shadow: var(--td-shadow-4);
- padding: var(--td-spacer);
- margin-top: var(--td-spacer);
- display: flex;
- justify-content: space-between;
- gap: 2px;
- color: var(--td-text-color-primary);
-}
-
-.ranking-summary__item:active {
- background-color: var(--td-gray-color-1);
-}
-
-.ranking-summary__item .ranking-summary__item-name {
- --ei-font-size: var(--td-font-size-m);
- --ei-line-height: calc(var(--td-text-line-height) * var(--ei-font-size));
- font-size: var(--ei-font-size);
- line-height: var(--ei-line-height);
- height: calc(var(--ei-line-height) * 2);
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.ranking-summary__item-abstract {
- font-size: var(--td-font-size-s);
- color: var(--td-text-color-secondary);
-}
-
-.flex-v {
- position: relative;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-}
-
-.ranking-summary__item-tag__wrap{
- position: relative;
- display: flex;
- gap: 2px;
-}
-
-.ranking-summary__item-tag__wrap .ranking-summary__item-tag {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 2px;
-}
-
-.ranking-summary__item-tag .ranking-summary__tag-count {
- /* background-color: var(--td-primary-color-10); */
- width: 80rpx;
- height: 80rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- /* color: var(--td-text-color-anti); */
- border: 6rpx solid var(--td-success-color-5);
- border-radius: var(--td-border-radius);
- font-weight: 600;
-}
-
-.ranking-summary__tag-count__error {
- border-color: var(--td-error-color-5) !important;
-}
-
-.ranking-summary__tag-count__warning {
- border-color: var(--td-warning-color) !important;
-}
-
-.ranking-summary__nav-icon {
- position: relative;
- bottom: 0px;
- right: 0px;
- display: flex;
- justify-content: flex-end;
- /* margin-top: var(--td-spacer); */
- /* background-color: blanchedalmond; */
}
\ No newline at end of file
diff --git a/pages/inspection/ranking/problem-change-list.js b/pages/inspection/ranking/problem-change-list.js
new file mode 100644
index 0000000..de58b96
--- /dev/null
+++ b/pages/inspection/ranking/problem-change-list.js
@@ -0,0 +1,37 @@
+import { fetchSceneProSummary } from '../../../services/inspection/fetchScene';
+
+export const useProblemChangeList = Behavior({
+ data: {
+ summaryList: [],
+ },
+ methods: {
+ fetchSceneProSummary(params, page) {
+ return fetchSceneProSummary({ area: params, page }).then(res => {
+ if (res.success) {
+ this.setData({
+ summaryList: page == 1 ? res.data : this.data.summaryList.concat(res.data),
+ });
+ } else {
+ this.setData({
+ summaryList: [],
+ });
+ }
+ return res.head;
+ });
+ },
+
+ navToDetail(e) {
+ const { index } = e.currentTarget.dataset;
+ const summary = this.data.summaryList[index];
+ wx.navigateTo({
+ url: '/pages/inspection/detail/index',
+ success: result => {
+ result.eventChannel.emit('acceptInspectionDetailData', {
+ scene: summary.scene,
+ time: this.data.time,
+ });
+ },
+ });
+ },
+ },
+});
diff --git a/pages/inspection/ranking/problem-change-list.wxml b/pages/inspection/ranking/problem-change-list.wxml
new file mode 100644
index 0000000..2f086da
--- /dev/null
+++ b/pages/inspection/ranking/problem-change-list.wxml
@@ -0,0 +1,62 @@
+<import src="/pages/common/template/template-loading.wxml" />
+
+<!-- <template is="pulldown-loading" wx:if="{{pageLoading && summaryList.length != 0}}" /> -->
+<block wx:if="{{summaryList.length > 0}}">
+ <view
+ class="ranking-summary__item"
+ wx:for="{{summaryList}}"
+ data-index="{{index}}"
+ bind:tap="navToDetail"
+ >
+ <view style="flex: 1">
+ <view class="ranking-summary__item-name">{{item.scene.name}} </view>
+ <t-divider />
+ <view class="ranking-summary__item-tag__wrap">
+ <view class="ranking-summary__item-abstract">鍦板潃锛歿{item.scene.location}} </view>
+ </view>
+ </view>
+ <view class="flex-v">
+ <view class="ranking-summary__item-abstract flex-end"
+ >鏁存敼鐜囷細{{_.changePercent(item.proNum, item.changeNum)}}</view
+ >
+ <view class="ranking-summary__item-tag__wrap">
+ <view class="ranking-summary__item-tag">
+ <view class="ranking-summary__tag-count"> {{item.proNum}} </view>
+ <t-tag
+ max-width="{{130}}"
+ shape="square"
+ size="small"
+ theme="default"
+ variant="light-outline"
+ >闂</t-tag
+ >
+ </view>
+ <view class="ranking-summary__item-tag">
+ <view
+ class="ranking-summary__tag-count {{_.tagBorderColor(item.proNum, item.changeNum)}}"
+ >
+ <text>{{item.changeNum}}</text>
+ <view></view>
+ </view>
+ <t-tag
+ max-width="{{130}}"
+ shape="square"
+ size="small"
+ theme="default"
+ variant="light-outline"
+ >鏁存敼</t-tag
+ >
+ </view>
+ </view>
+ <view class="ranking-summary__nav-icon">
+ <t-icon name="chevron-right" size="24rpx" />
+ </view>
+ </view>
+ </view>
+</block>
+<t-empty-page wx:elif="{{!pageLoading}}" description="鏆傛棤鐩稿叧璁板綍" />
+<load-more
+ list-is-empty="{{!summaryList.length}}"
+ status="{{loadStatus}}"
+ bind:retry="_startLoad"
+/>
diff --git a/pages/inspection/ranking/problem-change-list.wxss b/pages/inspection/ranking/problem-change-list.wxss
new file mode 100644
index 0000000..18fc3e8
--- /dev/null
+++ b/pages/inspection/ranking/problem-change-list.wxss
@@ -0,0 +1,79 @@
+.ranking-summary__item {
+ background-color: var(--td-bg-color-fade);
+ border-radius: var(--td-border-radius);
+ box-shadow: var(--td-shadow-4);
+ padding: var(--td-spacer);
+ margin-top: var(--td-spacer);
+ display: flex;
+ justify-content: space-between;
+ gap: 2px;
+ color: var(--td-text-color-primary);
+}
+
+.ranking-summary__item:active {
+ background-color: var(--td-gray-color-1);
+}
+
+.ranking-summary__item .ranking-summary__item-name {
+ --ei-font-size: var(--td-font-size-m);
+ --ei-line-height: calc(var(--td-text-line-height) * var(--ei-font-size));
+ font-size: var(--ei-font-size);
+ line-height: var(--ei-line-height);
+ height: calc(var(--ei-line-height) * 2);
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.flex-v {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+
+.ranking-summary__item-tag__wrap{
+ position: relative;
+ display: flex;
+ gap: 2px;
+}
+
+.ranking-summary__item-tag__wrap .ranking-summary__item-tag {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 2px;
+}
+
+.ranking-summary__item-tag .ranking-summary__tag-count {
+ /* background-color: var(--td-primary-color-10); */
+ width: 80rpx;
+ height: 80rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ /* color: var(--td-text-color-anti); */
+ border: 6rpx solid var(--td-success-color-5);
+ border-radius: var(--td-border-radius);
+ font-weight: 600;
+}
+
+.ranking-summary__tag-count__error {
+ border-color: var(--td-error-color-5) !important;
+}
+
+.ranking-summary__tag-count__warning {
+ border-color: var(--td-warning-color) !important;
+}
+
+.ranking-summary__nav-icon {
+ position: relative;
+ bottom: 0px;
+ right: 0px;
+ display: flex;
+ justify-content: flex-end;
+ /* margin-top: var(--td-spacer); */
+ /* background-color: blanchedalmond; */
+}
\ No newline at end of file
diff --git a/pages/inspection/ranking/sort-options.js b/pages/inspection/ranking/sort-options.js
new file mode 100644
index 0000000..1443ecc
--- /dev/null
+++ b/pages/inspection/ranking/sort-options.js
@@ -0,0 +1,23 @@
+export const useSortOptions = Behavior({
+ data: {
+ sort: '',
+ sortBy: 'pro',
+ },
+ methods: {
+ onSortChange(e) {
+ const { sorts } = e.detail;
+ const { type } = e.currentTarget.dataset;
+ this.setData({
+ sort: sorts,
+ sortBy: type,
+ proSort: type == 'pro' ? sorts : 'default',
+ changeSort: type == 'changePer' ? sorts : 'default',
+ });
+ if (typeof this._startSortLoad === 'function') {
+ this._startSortLoad()
+ } else {
+ this._startLoad();
+ }
+ },
+ },
+});
\ No newline at end of file
diff --git a/pages/inspection/ranking/sort-options.wxml b/pages/inspection/ranking/sort-options.wxml
new file mode 100644
index 0000000..e729195
--- /dev/null
+++ b/pages/inspection/ranking/sort-options.wxml
@@ -0,0 +1,16 @@
+<view class="filter-wrap">
+ <sort-btn
+ text="闂鏁�"
+ icon-color="var(--td-warning-color-4)"
+ data-type="pro"
+ defaultSort="{{proSort}}"
+ bind:sortsChange="onSortChange"
+ ></sort-btn>
+ <sort-btn
+ text="鏁存敼鐜�"
+ icon-color="var(--td-warning-color-4)"
+ data-type="changePer"
+ defaultSort="{{changeSort}}"
+ bind:sortsChange="onSortChange"
+ ></sort-btn>
+</view>
diff --git a/pages/inspection/ranking/sort-options.wxss b/pages/inspection/ranking/sort-options.wxss
new file mode 100644
index 0000000..786bcbc
--- /dev/null
+++ b/pages/inspection/ranking/sort-options.wxss
@@ -0,0 +1,3 @@
+.filter-wrap {
+ background: initial;
+}
\ No newline at end of file
diff --git a/pages/inspection/ranking/statistic.js b/pages/inspection/ranking/statistic.js
new file mode 100644
index 0000000..e34c695
--- /dev/null
+++ b/pages/inspection/ranking/statistic.js
@@ -0,0 +1,31 @@
+import { fetchProblemsStatistic } from '../../../services/inspection/fetchInspection';
+
+export const useStatistic = Behavior({
+ data: {
+ statistic: {
+ proNum: 0,
+ changeNum: 0,
+ },
+ },
+ methods: {
+ fetchProblems(params, page) {
+ return fetchProblemsStatistic(params).then(res => {
+ let proNum = 0,
+ changeNum = 0,
+ changePer = 0;
+ res.data.forEach(r => {
+ proNum += r.count;
+ changeNum += r.changeCount;
+ });
+ if (proNum > 0) {
+ changePer = Math.round((changeNum / proNum) * 1000) / 10;
+ changePer += '%';
+ }
+ this.setData({
+ statistic: { proNum, changeNum, changePer },
+ });
+ return res.head;
+ });
+ },
+ },
+});
\ No newline at end of file
diff --git a/pages/inspection/ranking/statistic.wxml b/pages/inspection/ranking/statistic.wxml
new file mode 100644
index 0000000..9292d65
--- /dev/null
+++ b/pages/inspection/ranking/statistic.wxml
@@ -0,0 +1,4 @@
+<view class="ranking-summary__item-abstract" style="margin-left: var(--td-spacer)">
+ 闂鎬昏{{statistic.proNum}}涓紝宸叉暣鏀箋{statistic.changeNum}}涓紝鏈暣鏀箋{statistic.proNum -
+ statistic.changeNum}}涓紝鏁存敼鐜噞{statistic.changePer}}
+</view>
diff --git a/pages/inspection/ranking/statistic.wxss b/pages/inspection/ranking/statistic.wxss
new file mode 100644
index 0000000..68b5707
--- /dev/null
+++ b/pages/inspection/ranking/statistic.wxss
@@ -0,0 +1,4 @@
+.ranking-summary__item-abstract {
+ font-size: var(--td-font-size-s);
+ color: var(--td-text-color-secondary);
+}
\ No newline at end of file
diff --git a/pages/simple-home/index.js b/pages/simple-home/index.js
new file mode 100644
index 0000000..e5d85d5
--- /dev/null
+++ b/pages/simple-home/index.js
@@ -0,0 +1,125 @@
+import dayjs from "dayjs";
+import { useLoading } from '../../behaviors/loading';
+import { useOptions } from '../home/options-proxy.js';
+import { useInsepction } from '../home/inspection-proxy.js';
+// import { useSupervision } from '../home/supervision-proxy.js';
+// import { useNotice } from '../home/notice-proxy.js';
+// import { useNews } from '../home/news-proxy.js';
+import { useProblemChangeList } from '../inspection/ranking/problem-change-list.js';
+import { useStatistic } from '../inspection/ranking/statistic.js';
+import { useSortOptions } from '../inspection/ranking/sort-options.js';
+
+const app = getApp();
+
+Page({
+ behaviors: [
+ useLoading,
+ useOptions,
+ useInsepction,
+ // useSupervision,
+ // useNotice,
+ // useNews,
+ useStatistic,
+ useSortOptions,
+ useProblemChangeList,
+ ],
+ data: {
+ placeholder: '鎼滅储浼佷笟璇︽儏',
+ userName: app.globalData.userInfo.name,
+ },
+
+ onLoad(options) {
+ this.setData({ userName: app.globalData.userInfo.name });
+ },
+
+ onShow() {
+ // this.getTabBar().init();
+ },
+
+ onPullDownRefresh() {
+ this._startLoad();
+ },
+
+ onReachBottom() {
+ this._loadMore();
+ },
+
+ /**
+ * 鍒濆鍔犺浇
+ * 褰撴墍鏈夌瓫閫夋潯浠堕兘鑾峰彇鍒板垵濮嬪�煎悗锛屾墽琛屼竴娆″垵濮嬪寲鍔犺浇
+ * 鍖呮嫭鍦烘櫙绫诲瀷銆佸尯鍩熴�佹椂闂翠笁涓�夐」锛屽叏閮ㄨ幏鍙栧垵濮嬪�煎悗锛屾墽琛屽姞杞�
+ */
+ optionsCount: 0,
+ init() {
+ this.optionsCount++;
+ if (this.optionsCount == 3) this._startLoad();
+ },
+
+ _fetchData(page) {
+ const array = [];
+ // // 鎵ф硶鍔ㄦ��
+ // const f3 = this._enforcementNews(page);
+ // array.push(f3);
+ if (page == 1) {
+ // // 绾夸笂鐩戠
+ // this.fetchSupervision(page);
+ // 鐜板満宸℃煡
+ this.fetchInspection(page);
+ const params = this.getParam();
+ const f1 = this.fetchSceneProSummary(params, page);
+ array.push(f1);
+ const f2 = this.fetchProblems(params, page);
+ array.push(f2);
+ // // 宸ヤ綔鎻愰啋
+ // const f1 = this._fetchNotice(page);
+ // array.push(f1);
+ // const f4 = this._fetchUnReadNoticeNum(page);
+ // array.push(f4);
+ // // 瀹堟硶鍩硅
+ // const f2 = this._complianceTraining(page);
+ // array.push(f2);
+ }
+ return Promise.all(array).then(res => {
+ return res[0];
+ });
+ },
+
+ // 鎺掑簭鍒囨崲鍚庣殑鍔犺浇鍑芥暟
+ _startSortLoad() {
+ const params = this.getParam();
+ this.setData({ pageLoading: true });
+ this.fetchSceneProSummary(params, 1).finally(() => this.setData({ pageLoading: false }));
+ },
+
+ getParam() {
+ const { provinceCode, cityCode, districtCode, townCode, sceneTypeValue, time, sort, sortBy } =
+ this.data;
+ const params = {
+ provincecode: provinceCode,
+ // provincename: provinceName,
+ citycode: cityCode,
+ // cityname: cityName,
+ districtcode: districtCode,
+ // districtname: districtName,
+ towncode: townCode,
+ // townname: townName,
+ scensetypeid: sceneTypeValue[0],
+ sort: sort,
+ sortBy: sortBy,
+ };
+ const t = dayjs(time);
+ params.starttime = t.startOf('month').format('YYYY-MM-DD HH:mm:ss');
+ params.endtime = t.endOf('month').format('YYYY-MM-DD HH:mm:ss');
+
+ return params;
+ },
+
+ navToSearchPage() {
+ wx.navigateTo({
+ url: '/pages/enterprise/search/index',
+ success: result => {},
+ fail: res => {},
+ complete: res => {},
+ });
+ },
+});
diff --git a/pages/simple-home/index.json b/pages/simple-home/index.json
new file mode 100644
index 0000000..acccc4e
--- /dev/null
+++ b/pages/simple-home/index.json
@@ -0,0 +1,21 @@
+{
+ "navigationBarTitleText": "棣栭〉",
+ "onReachBottomDistance": 10,
+ "backgroundTextStyle": "light",
+ "enablePullDownRefresh": true,
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#389AFF",
+ "navigationStyle":"custom",
+ "usingComponents": {
+ "stat-card": "/components/stat-card/index",
+ "info-cards": "/components/info-cards/index",
+ "load-more": "/components/load-more/index",
+ "notice-card": "/components/notice-card/index",
+ "train-card": "/components/train-card/index",
+ "scene-picker": "/components/scene-picker/index",
+ "location-picker": "/components/picker/location-picker/index",
+ "t-time-picker": "/components/time-picker/index",
+ "sort-btn": "/components/sort-btn/index",
+ "t-empty-page": "/components/empty-page/index"
+ }
+}
\ No newline at end of file
diff --git a/pages/simple-home/index.wxml b/pages/simple-home/index.wxml
new file mode 100644
index 0000000..967e1b8
--- /dev/null
+++ b/pages/simple-home/index.wxml
@@ -0,0 +1,32 @@
+<import src="/pages/common/template/template-loading.wxml" />
+
+<t-navbar>
+ <view slot="left" class="t-class-navbar">
+ <t-icon name="user" size="36rpx" />
+ <view class="t-class-navbar-title"> {{userName}} </view>
+ </view>
+</t-navbar>
+<view class="page">
+ <template is="pulldown-loading" wx:if="{{pageLoading}}" />
+ <view class="page-header">
+ <!-- <view slot="left" bind:tap="navToSearchPage">
+ <t-search shape="square" placeholder="{{placeholder}}" disabled />
+ </view> -->
+ <include src="/pages/home/options.wxml" />
+ <include src="/pages/home/inspection.wxml" />
+ </view>
+
+ <view class="page-container">
+ <!-- <t-sticky> -->
+ <include src="/pages/inspection/ranking/statistic.wxml" />
+ <include src="/pages/inspection/ranking/sort-options.wxml" />
+ <!-- </t-sticky> -->
+ <!-- <view class="home-supervision-wrap"> -->
+ <include src="/pages/inspection/ranking/problem-change-list.wxml" />
+ <!-- <include src="/pages/home/supervision.wxml" /> -->
+ <!-- </view> -->
+ <!-- <include src="/pages/home/notice.wxml" />
+ <include src="/pages/home/news.wxml" /> -->
+ </view>
+ <view class="page-footer"></view>
+</view>
diff --git a/pages/simple-home/index.wxss b/pages/simple-home/index.wxss
new file mode 100644
index 0000000..7170ae8
--- /dev/null
+++ b/pages/simple-home/index.wxss
@@ -0,0 +1,26 @@
+@import '/components/filter/index.wxss';
+@import '/pages/home/index.wxss';
+@import '/pages/inspection/ranking/statistic.wxss';
+@import '/pages/inspection/ranking/sort-options.wxss';
+@import '/pages/inspection/ranking/problem-change-list.wxss';
+
+page {
+ --header-bottom-padding: 150rpx;
+}
+/* .page {
+ background: linear-gradient(var(--td-primary-color-7), var(--td-bg-color),);
+} */
+
+.page .page-header {
+ /* background: transparent; */
+ background: linear-gradient(var(--td-primary-color-7), var(--td-bg-color));
+ padding-bottom: var(--header-bottom-padding);
+ /* padding-bottom: initial; */
+ /* min-height: 380rpx; */
+ /* border-bottom-left-radius: 40%;
+ border-bottom-right-radius: 40%; */
+}
+
+/* .page .page-container {
+ margin-top: initial;
+} */
\ No newline at end of file
diff --git a/pages/simple-home/packge-info b/pages/simple-home/packge-info
new file mode 100644
index 0000000..c2e60f8
--- /dev/null
+++ b/pages/simple-home/packge-info
@@ -0,0 +1 @@
+绠�鍖栦富椤碉紝鐢ㄤ簬閮ㄥ垎娆$骇绠$悊鍛樻垨鏀垮簻閮ㄩ棬浣跨敤锛屼富瑕佸睍绀虹幇鍦虹洃绠$浉鍏冲唴瀹�
\ No newline at end of file
diff --git a/pages/usercenter/about/index.wxml b/pages/usercenter/about/index.wxml
index ffef7f9..32fbee5 100644
--- a/pages/usercenter/about/index.wxml
+++ b/pages/usercenter/about/index.wxml
@@ -38,7 +38,7 @@
</view> -->
</view>
<view class="page-footer">
- <view>涓氬姟鎸囧锛氫笂娴峰競鐢熸�佺幆澧冨眬鎵ф硶鎬婚槦</view>
+ <!-- <view>涓氬姟鎸囧锛氫笂娴峰競鐢熸�佺幆澧冨眬鎵ф硶鎬婚槦</view> -->
<view>鎶�鏈敮鎸侊細涓婃捣椋炵窘鐜繚绉戞妧鏈夐檺鍏徃</view>
</view>
</view>
diff --git a/pages/usercenter/login/login-home/index.wxml b/pages/usercenter/login/login-home/index.wxml
index 7ce38b1..061df5e 100644
--- a/pages/usercenter/login/login-home/index.wxml
+++ b/pages/usercenter/login/login-home/index.wxml
@@ -17,7 +17,7 @@
</view> -->
</view>
<view class="page-footer">
- <view>涓氬姟鎸囧锛氫笂娴峰競鐢熸�佺幆澧冨眬鎵ф硶鎬婚槦</view>
+ <!-- <view>涓氬姟鎸囧锛氫笂娴峰競鐢熸�佺幆澧冨眬鎵ф硶鎬婚槦</view> -->
<view>鎶�鏈敮鎸侊細涓婃捣椋炵窘鐜繚绉戞妧鏈夐檺鍏徃</view>
</view>
</view>
diff --git a/services/inspection/fetchInspection.js b/services/inspection/fetchInspection.js
index be9f290..522e895 100644
--- a/services/inspection/fetchInspection.js
+++ b/services/inspection/fetchInspection.js
@@ -11,11 +11,12 @@
// 鑾峰彇宸℃煡浠诲姟鏁板強鍚勮嚜闂鏁扮粺璁�
function fetchInspectionStatistic(area) {
// 涓や釜绯荤粺涔嬮棿鐨勫満鏅被鍨嬮渶瑕佽浆鎹�
- area.scensetypeid = transSceneType(area.scensetypeid);
+ const data = {...area}
+ data.scensetypeid = transSceneType(area.scensetypeid);
return post(
{
url: `/task/progress`,
- data: area,
+ data: data,
},
inspectUrl,
).then(res => {
@@ -25,11 +26,12 @@
// 鑾峰彇鍚勯棶棰樼被鍨嬪彂鐢熺殑鏁伴噺缁熻
function fetchProblemsStatistic(area) {
- area.scensetypeid = transSceneType(area.scensetypeid);
+ const data = {...area}
+ data.scensetypeid = transSceneType(area.scensetypeid);
return post(
{
url: `/problemlist/getStatisticalResult`,
- data: area,
+ data: data,
},
inspectUrl,
).then(res => {
@@ -39,12 +41,13 @@
//
function fetchSubtasksByProType({ area, pType }) {
- area.scensetypeid = transSceneType(area.scensetypeid);
+ const data = {...area}
+ data.scensetypeid = transSceneType(area.scensetypeid);
return post(
{
url: `/problemlist/type/subtask`,
params: { pType: pType },
- data: area,
+ data: data,
},
inspectUrl,
).then(res => {
@@ -87,11 +90,12 @@
}
function fetchSubtaskSummaryByArea(area) {
- area.scensetypeid = transSceneType(area.scensetypeid);
+ const data = {...area}
+ data.scensetypeid = transSceneType(area.scensetypeid);
return post(
{
url: `/subtask/summary/area`,
- data: area,
+ data: data,
},
inspectUrl,
).then(res => {
diff --git a/services/inspection/fetchScene.js b/services/inspection/fetchScene.js
index cc16dbb..51447bb 100644
--- a/services/inspection/fetchScene.js
+++ b/services/inspection/fetchScene.js
@@ -21,7 +21,8 @@
* 鏌ユ壘鍦烘櫙
*/
function searchScene(area, page = 1, perPage = 20) {
- area.scensetypeid = transSceneType(area.scensetypeid);
+ const data = {...area}
+ data.scensetypeid = transSceneType(area.scensetypeid);
return post(
{
url: `/scense/find`,
@@ -29,24 +30,24 @@
page: page,
per_page: perPage,
},
- data: area,
+ data: data,
},
inspectUrl,
).then(res => res.data);
}
//
-function fetchSceneProSummary({ area, sortBy, page = 1, per_page = 30 }) {
- area.scensetypeid = transSceneType(area.scensetypeid);
+function fetchSceneProSummary({ area, page = 1, per_page = 30 }) {
+ const data = {...area}
+ data.scensetypeid = transSceneType(area.scensetypeid);
return post(
{
url: `/problemlist/summary/scene`,
params: {
- sortBy: sortBy,
page: page,
per_page: per_page,
},
- data: area,
+ data: data,
},
inspectUrl,
).then(res => {
diff --git a/utils/time.js b/utils/time.js
deleted file mode 100644
index 232306b..0000000
--- a/utils/time.js
+++ /dev/null
@@ -1 +0,0 @@
-import dayjs from "dayjs";
\ No newline at end of file
--
Gitblit v1.9.3