Commit f9ea55c6 by 周志凯

抓拍记录出入口初始化未显示解决

1 parent bd6b24cd
......@@ -20,6 +20,7 @@ export function fetch(method = 'GET', url, params = null, headers = {}) {
}
// 第二种写法
// 接口基类
const http = (options) => {
const { method = 'get', data, url, headers = {} } = options;
method = method.toLocaleUpperCase();
......@@ -40,65 +41,66 @@ const http = (options) => {
}
export default {
// 接口应用层
// 集团列表
loadAccountList(data, headers) {
loadAccountList({ method, data, headers }) {
return http({
url: configApi.LOAD_ACCOUNT_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
},
// 商场列表
loadMallList(data, headers) {
loadMallList(method, data, headers) {
return http({
url: configApi.LOAD_MALL_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
},
// 楼层列表
loadFloorList(data, headers) {
loadFloorList(method, data, headers) {
return http({
url: configApi.LOAD_FLOOR_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
},
// 店铺列表
loadZoneList(data, headers) {
loadZoneList(method, data, headers) {
return http({
url: configApi.LOAD_ZONE_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
},
// 监控点列表
loadGateList(data, headers) {
loadGateList(method, data, headers) {
return http({
url: configApi.LOAD_GATE_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
},
// 字典列表
loadDictList(data, headers) {
loadDictList(method, data, headers) {
return http({
url: configApi.LOAD_DICT_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
},
// 抓拍记录列表
loadFacerecognitionList(data, headers) {
loadFacerecognitionList(method, data, headers) {
return http({
url: configApi.LOAD_FACERECOGNITION_LIST,
method: 'get',
method: method,
data: data,
headers: headers
})
......
import range from './range.js'
const START_YEAR = 1900
const END_YEAR = 2100
const UNIT_YEAR = '年'
const UNIT_MONTH = '月'
const UNIT_DAY = '日'
const UNIT_HOUR = '时'
const UNIT_MINUTES = '分'
const UNIT_SECONDS = '秒'
function isLeepYear(y) {
return (y % 4 === 0) && (y % 100 !== 0 || y % 400 === 0)
}
function autoPrefixer(num) {
return num < 10 ? '0' + num : num;
}
function getDays(y, m) {
y = Number(y)
m = Number(m)
let endDay = null
switch (m){
case 1:
case 2:
endDay = isLeepYear(y) ? 29 : 28
break;
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
endDay = 31
break;
default:
endDay = 30
break;
}
const days = range(1, endDay, true, UNIT_DAY)
return days.map((day) => {
return {
value: day
// ,children: []
}
})
}
const yearData = range(START_YEAR, END_YEAR, false, UNIT_YEAR);
const monthData = range(1, 12, false, UNIT_MONTH);
const hourData = range(0, 23, true, UNIT_HOUR);
const minutesData = range(0, 59, true, UNIT_MINUTES);
const secondsData = range(0, 59, true, UNIT_SECONDS);
console.log(hourData)
console.log(minutesData)
console.log(secondsData)
const cascadeMonthData = monthData.map((month) => {
return {
value: month,
children: []
}
})
const dateData = yearData.map((year) => {
const item = {
value: year,
children: cascadeMonthData.slice()
}
item.children.forEach((month) => {
month.children = getDays(year.slice(0, -1), month.value.slice(0, -1))
})
return item;
})
// const customDateData = yearData.map((year) => {
// const item = {
// value: year,
// children: cascadeMonthData.slice()
// }
// item.children.forEach((month) => {
// month.children = getDays(year.slice(0, -1), month.value.slice(0, -1))
// month.children.forEach((day) => {
// day.children = hourData.map(hour => {
// return {
// value: hour,
// children: []
// }
// });
// day.children.forEach((hourItem) => {
// hourItem.children = minutesData.map(minute => {
// return {
// value: minute,
// children: []
// }
// })
// hourItem.children.forEach(minuteItem => {
// minuteItem.children = secondsData.map(second => {
// return { value: second }
// })
// })
// })
// })
// })
// return item;
// })
const date = new Date()
const dateAnchor = [
{ value: `${autoPrefixer(date.getFullYear())}${UNIT_YEAR}` },
{ value: `${autoPrefixer(date.getMonth() + 1)}${UNIT_MONTH}` },
{ value: `${autoPrefixer(date.getDate())}${UNIT_DAY}` },
]
// console.log('customDateData', customDateData)
export default {
getDateData() {
return dateData
}
}
\ No newline at end of file
export default function(n, m, polyfill = false, unit = '') {
let arr = [];
for(let i = n; i <= m; i++) {
let value = (polyfill && i < 10 ? '0' + i : i) + unit;
arr.push(value)
}
return arr;
}
/*生成指定规格数据*/
// let range = (n, m, polyfill = false, unit = '') => {
// let arr = [];
// for(let i = n; i <= m; i++) {
// let value = (polyfill && i < 10 ? '0' + i : i) + unit;
// arr.push(value)
// }
// return arr;
// }
//
// export default {
// range
// }
\ No newline at end of file
......@@ -8,6 +8,7 @@
@rightClick="conditionFun"></headerComp>
<view class="prefix-elem"></view>
<view class="capture-main">
<view class="empty-capture-item" v-if="captureList.length <= 0">{{ captureList.length > 0 ? '' : '暂无数据' }}</view>
<view class="capture-item" v-for="(item, index) in captureList" :key="item.pic">
<view class="capture-image">
<!-- <span class="capture-date">{{ item.counttime }}</span> -->
......@@ -74,7 +75,8 @@
itemMax: 0,
loadMoreText: '加载中...',
placeholderSrc: defaultImg,
windowHeight: 0
windowHeight: 0,
dataTipText: ''
}
},
onUnload() {
......@@ -159,6 +161,7 @@
// console.log('getCaptureList:', this.checkedMallId, this.checkedGateId)
let atoken = this.getStorage('atoken');
this.captureList = [];
this.dataTipText = '';
uni.showLoading({
title: '加载中'
})
......@@ -210,6 +213,9 @@
setTimeout(() => {
this.load()
}, 100)
},
fail: (err) => {
console.log(err)
}
})
},
......@@ -304,6 +310,13 @@
margin-bottom: 101.44upx;
box-sizing: border-box;
}
.empty-capture-item {
text-align: center;
font-size: 28.98upx;
margin-top: 36.23upx;
color: #c9c9c9;
}
.capture-item {
float: left;
width: 24%;
......
......@@ -104,9 +104,9 @@
cacheTimeStr: '',
startCacheTimeStr: '',
endCacheTimeStr: '',
cachePickerIdx: [],
startPickerIdx: [],
endPickerIdx: []
endPickerIdx: [],
cachePickerIdx: [],
}
},
created() {
......@@ -125,6 +125,13 @@
if(!this.selectedStartTime || !this.selectedEndTime) {
this.$store.dispatch('malls/getDateData', 15);
}
if(!this.capturePersonType.name) {
this.capturePersonType = {
id: 1,
name: '全部类型',
value: ''
}
}
},
computed: {
i18n() {
......@@ -226,66 +233,56 @@
this.$refs.pickerStart.show();
},
endDateHandle() {
// console.log('endDateHandle', this.currentEndDate)
this.$refs.pickerEnd.show();
},
dateConfirm(item) {
this.startCacheTimeStr = this.formatterTimeToStr(item);
// console.log(this.startCacheTimeStr, item, !this.endCacheTimeStr, !this.endPickerIdx.length, this.comparsionSize(this.startPickerIdx, this.endPickerIdx))
// if(!this.endCacheTimeStr && !this.endPickerIdx.length) {
// return;
// } else {
// console.log(111)
this.startPickerIdx = item;
if(this.endPickerIdx.length && this.comparsionSize(this.startPickerIdx, this.endPickerIdx)) {
this.$store.dispatch('malls/updateStartEndDate', {
startDate: this.startCacheTimeStr,
startPickerIdx: this.startPickerIdx
if(!this.comparsionSize(this.currentEndDate, this.startPickerIdx)) {
uni.showToast({
icon: 'none',
title: '开始日期不能大于结束日期'
})
// setTimeout(() => {
// this.startDateHandle()
// }, 500)
} else {
this.$store.dispatch('malls/updateStartEndDate', {
startDate: this.startCacheTimeStr,
startPickerIdx: this.startPickerIdx
})
// this.$store.dispatch('malls/updateStartEndDate', {
// endDate: '',
// endPickerIdx: []
// })
}
// }
},
endDateConfirm(item) {
this.endCacheTimeStr = this.formatterTimeToStr(item);
// if(!this.startCacheTimeStr
// && !this.startPickerIdx.length
// && !this.comparsionSize(this.endPickerIdx, this.startPickerIdx)) {
// return;
// } else {
this.endPickerIdx = item;
if(this.startPickerIdx.length && this.comparsionSize(this.endPickerIdx, this.startPickerIdx)) {
this.$store.dispatch('malls/updateStartEndDate', {
endDate: this.endCacheTimeStr,
endPickerIdx: this.endPickerIdx
if(!this.comparsionSize(this.endPickerIdx, this.currentStartDate)) {
uni.showToast({
icon: 'none',
title: '结束日期不能小于开始日期'
})
// setTimeout(() => {
// this.endDateHandle()
// }, 500)
return;
} else {
this.$store.dispatch('malls/updateStartEndDate', {
endDate: this.endCacheTimeStr,
endPickerIdx: this.endPickerIdx
})
this.$store.dispatch('malls/updateStartEndDate', {
// startDate: '',
// startPickerIdx: [],
endDate: '',
endPickerIdx: []
})
}
// }
},
comparsionSize(item1, item2) {
if(item1.length && item2.length) {
console.log('comparsionSize', item1, item2)
return item1.some((val1, idx1) => val1.value > item2[idx1].value);
// console.log('comparsionSize', item1, item2)
let isMoreStart = true;
item1.forEach((val1, idx1) => {
if((val1.value).replace(/[\u4E00-\u9FA5]/g, '') < (item2[idx1].value).replace(/[\u4E00-\u9FA5]/g, '')) {
isMoreStart = false;
}
})
// console.log(isMoreStart);
return isMoreStart
} else {
return false;
}
......
// 生成年月日时分秒数据
let dic = {
'Y': '年',
'EnY': 'year',
'M': '月',
'EnM': 'month',
'D': '日',
'EnD': 'day',
'h': '时',
'Enh': 'hour',
'm': '分',
'Enm': 'minutes',
's': '秒',
'Ens': 'seconds',
}
function createDateData(formatString) {
// if(dic[formatString])
}
\ No newline at end of file
const conditionList = {
state: {
mallId: '',
gateId: ''
},
mutations: {
updMallId(state, newMallId) {
state.mallId = newMallId;
import dateInstance from '../../common/date.js'
import fetch from '../../api/fetch.js'
import { CONDITIONS } from '../mutation-types.js'
const state = {
// 门店
storeMallList: [], // 门店/商场列表
checkedMallId: null, // 单选门店
multiCheckedMallId: [], // 多选门店
// 监控点
storeGateList: [], // 监控点/出入口列表
checkedGateId: null, // 单选监控点
multiCheckedGateId: [], // 多选监控点
// 时间
dateData: [], // 基本时间数据 年月日
// 天级日期
selectedDayTime: '', // 选中天级日期字符串
dayAnchor: [], // 选中天级日期picker下标
// 开始结束日期
selectedStartDayTime: '', // 选中开始日期时间字符串
startDayAnchor: [], // 选中开始日期时间picker下标
selectedEndDayTime: '', // 选中结束日期时间字符串
endDayAnchor: [], // 选中结束日期时间picker下标
}
const getter = {};
const mutations = {
// 门店/商场
[CONDITIONS.SET_MALLS] (state, mallList) {
state.mallList = mallList;
},
updGateId(state, newGateId) {
state.gateId = newGateId;
[CONDITIONS.CHECKED_MALL_ID] (state, mallId) {
state.checkedMallId = mallId;
},
[CONDITIONS.CHECKED_MULTI_MALL_ID] (state, multiMallId) {
state.multiCheckedMallId = multiMallId;
},
actions: {
GetMallId({ commit, state }) {
getMallId().then(res => {
//
}
const actions = {
getMalls({ commit }, { data, header }) {
fetch.loadAccountList('get', data, header)
.then(res => {
console.log('actions fetch mallList-=-=-=-=-=->', res)
let result = res.data;
let buildMallData = result.data.map(item => {
item._selected = false; // 结合数据展现新增属性
return item;
})
},
GetGateId({ commit, state }) {
getGateId().then(res => {
//
commit(CONDITIONS.SET_MALLS, buildMallData)
let mallId = null
, multiMallId = [];
multiMallId = buildMallData.map((item, index) => {
if(index == 0) {
mallId = {
id: item.id,
name: item.name
};
}
return {
id: item.id,
name: item.name
};
});
commit(CONDITIONS.CHECKED_MALL_ID, mallId)
commit(CONDITIONS.CHECKED_MULTI_MALL_ID, multiMallId)
})
},
getGates({ commit }, { data, header }) {
fetch.loadGateList({
data, header
})
.then(res => {
console.log('actions fetch gateList-=-=-=-=-=->', res)
let result = res.data;
let buildGateData = result.data.map(item => {
item._selected = false; // 结合数据展现新增属性
return item;
})
commit(CONDITIONS.SET_GATES, buildGateData)
let gateId = null
, multiGateId = [];
multiGateId = buildGateData.map((item, index) => {
if(index == 0) {
gateId = {
id: item.id,
name: item.name
};
}
return {
id: item.id,
name: item.name
};
});
commit(CONDITIONS.CHECKED_GATE_ID, gateId)
commit(CONDITIONS.CHECKED_MULTI_GATE_ID, multiGateId)
})
},
}
const conditionList = {
state: state,
getters: getter,
mutations: mutations,
actions: actions
}
export default conditionList;
\ No newline at end of file
import dateArr from '../dateData.js';
import { MALLS } from '../mutation-types.js'
import dateInstance from '../../common/date.js'
// initial state
const state = {
......@@ -103,6 +104,8 @@ const actions = {
})
},
getDateData({ commit }, frontDay) {
let commonDate = dateInstance.getDateData()
console.log('commonDate', commonDate)
dateArr.getCustomTime(customTimeData => {
let startDate = null
, endDate = null
......@@ -154,7 +157,7 @@ const actions = {
, pickerSt = []
, pickerEt = [];
endDate = new Date();
startDate = frontTime(endDate, 7);
startDate = frontTime(endDate, 0);
endTime = formatterDayTime(endDate);
startTime = formatterDayTime(startDate);
pickerSt = computedPickerIdx(startTime);
......
......@@ -23,3 +23,24 @@ export const MALLS = {
export const GATES = {
SET_GATES: 'setGates'
}
export const CONDITIONS = {
// 门店
SET_MALLS: 'setMalls',
CHECKED_MALL_ID: 'checkedMallId',
CHECKED_MULTI_MALL_ID: 'checkedMultiMallId',
// 出入口
SET_GATES: 'setGates',
CHECKED_GATE_ID: 'checkedGateId',
CHECKED_MULTI_GATE_ID: 'checkedMultiGateId',
// 基础时间
SET_DATEDATA: 'setDateData',
// 天级日期
SET_SELECTED_DAY_TIME: 'setSelectedDayTime',
SET_DAY_ANCHOR: 'setDayAnchor',
// 开始结束日期
SET_SELECTED_START_DAY_TIME: 'setSelectedStartDayTime',
SET_START_DAY_ANCHOR: 'setStartDayAnchor',
SET_SELECTED_END_DAY_TIME: 'setSelectedEndDayTime',
SET_END_DAY_ANCHOR: 'setEndDayAnchor'
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!