Commit f9ea55c6 by 周志凯

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

1 parent bd6b24cd
...@@ -20,6 +20,7 @@ export function fetch(method = 'GET', url, params = null, headers = {}) { ...@@ -20,6 +20,7 @@ export function fetch(method = 'GET', url, params = null, headers = {}) {
} }
// 第二种写法 // 第二种写法
// 接口基类
const http = (options) => { const http = (options) => {
const { method = 'get', data, url, headers = {} } = options; const { method = 'get', data, url, headers = {} } = options;
method = method.toLocaleUpperCase(); method = method.toLocaleUpperCase();
...@@ -40,65 +41,66 @@ const http = (options) => { ...@@ -40,65 +41,66 @@ const http = (options) => {
} }
export default { export default {
// 接口应用层
// 集团列表 // 集团列表
loadAccountList(data, headers) { loadAccountList({ method, data, headers }) {
return http({ return http({
url: configApi.LOAD_ACCOUNT_LIST, url: configApi.LOAD_ACCOUNT_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers headers: headers
}) })
}, },
// 商场列表 // 商场列表
loadMallList(data, headers) { loadMallList(method, data, headers) {
return http({ return http({
url: configApi.LOAD_MALL_LIST, url: configApi.LOAD_MALL_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers headers: headers
}) })
}, },
// 楼层列表 // 楼层列表
loadFloorList(data, headers) { loadFloorList(method, data, headers) {
return http({ return http({
url: configApi.LOAD_FLOOR_LIST, url: configApi.LOAD_FLOOR_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers headers: headers
}) })
}, },
// 店铺列表 // 店铺列表
loadZoneList(data, headers) { loadZoneList(method, data, headers) {
return http({ return http({
url: configApi.LOAD_ZONE_LIST, url: configApi.LOAD_ZONE_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers headers: headers
}) })
}, },
// 监控点列表 // 监控点列表
loadGateList(data, headers) { loadGateList(method, data, headers) {
return http({ return http({
url: configApi.LOAD_GATE_LIST, url: configApi.LOAD_GATE_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers headers: headers
}) })
}, },
// 字典列表 // 字典列表
loadDictList(data, headers) { loadDictList(method, data, headers) {
return http({ return http({
url: configApi.LOAD_DICT_LIST, url: configApi.LOAD_DICT_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers headers: headers
}) })
}, },
// 抓拍记录列表 // 抓拍记录列表
loadFacerecognitionList(data, headers) { loadFacerecognitionList(method, data, headers) {
return http({ return http({
url: configApi.LOAD_FACERECOGNITION_LIST, url: configApi.LOAD_FACERECOGNITION_LIST,
method: 'get', method: method,
data: data, data: data,
headers: headers 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 \ 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 \ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
@rightClick="conditionFun"></headerComp> @rightClick="conditionFun"></headerComp>
<view class="prefix-elem"></view> <view class="prefix-elem"></view>
<view class="capture-main"> <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-item" v-for="(item, index) in captureList" :key="item.pic">
<view class="capture-image"> <view class="capture-image">
<!-- <span class="capture-date">{{ item.counttime }}</span> --> <!-- <span class="capture-date">{{ item.counttime }}</span> -->
...@@ -74,7 +75,8 @@ ...@@ -74,7 +75,8 @@
itemMax: 0, itemMax: 0,
loadMoreText: '加载中...', loadMoreText: '加载中...',
placeholderSrc: defaultImg, placeholderSrc: defaultImg,
windowHeight: 0 windowHeight: 0,
dataTipText: ''
} }
}, },
onUnload() { onUnload() {
...@@ -159,6 +161,7 @@ ...@@ -159,6 +161,7 @@
// console.log('getCaptureList:', this.checkedMallId, this.checkedGateId) // console.log('getCaptureList:', this.checkedMallId, this.checkedGateId)
let atoken = this.getStorage('atoken'); let atoken = this.getStorage('atoken');
this.captureList = []; this.captureList = [];
this.dataTipText = '';
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}) })
...@@ -210,6 +213,9 @@ ...@@ -210,6 +213,9 @@
setTimeout(() => { setTimeout(() => {
this.load() this.load()
}, 100) }, 100)
},
fail: (err) => {
console.log(err)
} }
}) })
}, },
...@@ -304,6 +310,13 @@ ...@@ -304,6 +310,13 @@
margin-bottom: 101.44upx; margin-bottom: 101.44upx;
box-sizing: border-box; box-sizing: border-box;
} }
.empty-capture-item {
text-align: center;
font-size: 28.98upx;
margin-top: 36.23upx;
color: #c9c9c9;
}
.capture-item { .capture-item {
float: left; float: left;
width: 24%; width: 24%;
......
...@@ -104,9 +104,9 @@ ...@@ -104,9 +104,9 @@
cacheTimeStr: '', cacheTimeStr: '',
startCacheTimeStr: '', startCacheTimeStr: '',
endCacheTimeStr: '', endCacheTimeStr: '',
cachePickerIdx: [],
startPickerIdx: [], startPickerIdx: [],
endPickerIdx: [] endPickerIdx: [],
cachePickerIdx: [],
} }
}, },
created() { created() {
...@@ -125,6 +125,13 @@ ...@@ -125,6 +125,13 @@
if(!this.selectedStartTime || !this.selectedEndTime) { if(!this.selectedStartTime || !this.selectedEndTime) {
this.$store.dispatch('malls/getDateData', 15); this.$store.dispatch('malls/getDateData', 15);
} }
if(!this.capturePersonType.name) {
this.capturePersonType = {
id: 1,
name: '全部类型',
value: ''
}
}
}, },
computed: { computed: {
i18n() { i18n() {
...@@ -226,66 +233,56 @@ ...@@ -226,66 +233,56 @@
this.$refs.pickerStart.show(); this.$refs.pickerStart.show();
}, },
endDateHandle() { endDateHandle() {
// console.log('endDateHandle', this.currentEndDate)
this.$refs.pickerEnd.show(); this.$refs.pickerEnd.show();
}, },
dateConfirm(item) { dateConfirm(item) {
this.startCacheTimeStr = this.formatterTimeToStr(item); this.startCacheTimeStr = this.formatterTimeToStr(item);
// console.log(this.startCacheTimeStr, item, !this.endCacheTimeStr, !this.endPickerIdx.length, this.comparsionSize(this.startPickerIdx, this.endPickerIdx)) this.startPickerIdx = item;
// if(!this.endCacheTimeStr && !this.endPickerIdx.length) { if(!this.comparsionSize(this.currentEndDate, this.startPickerIdx)) {
// return; uni.showToast({
// } else { icon: 'none',
// console.log(111) title: '开始日期不能大于结束日期'
this.startPickerIdx = item; })
if(this.endPickerIdx.length && this.comparsionSize(this.startPickerIdx, this.endPickerIdx)) { // setTimeout(() => {
this.$store.dispatch('malls/updateStartEndDate', { // this.startDateHandle()
startDate: this.startCacheTimeStr, // }, 500)
startPickerIdx: this.startPickerIdx } else {
}) this.$store.dispatch('malls/updateStartEndDate', {
} else { startDate: this.startCacheTimeStr,
this.$store.dispatch('malls/updateStartEndDate', { startPickerIdx: this.startPickerIdx
startDate: this.startCacheTimeStr, })
startPickerIdx: this.startPickerIdx }
})
// this.$store.dispatch('malls/updateStartEndDate', {
// endDate: '',
// endPickerIdx: []
// })
}
// }
}, },
endDateConfirm(item) { endDateConfirm(item) {
this.endCacheTimeStr = this.formatterTimeToStr(item); this.endCacheTimeStr = this.formatterTimeToStr(item);
// if(!this.startCacheTimeStr this.endPickerIdx = item;
// && !this.startPickerIdx.length if(!this.comparsionSize(this.endPickerIdx, this.currentStartDate)) {
// && !this.comparsionSize(this.endPickerIdx, this.startPickerIdx)) { uni.showToast({
// return; icon: 'none',
// } else { title: '结束日期不能小于开始日期'
this.endPickerIdx = item; })
if(this.startPickerIdx.length && this.comparsionSize(this.endPickerIdx, this.startPickerIdx)) { // setTimeout(() => {
this.$store.dispatch('malls/updateStartEndDate', { // this.endDateHandle()
endDate: this.endCacheTimeStr, // }, 500)
endPickerIdx: this.endPickerIdx return;
}) } else {
} else { this.$store.dispatch('malls/updateStartEndDate', {
this.$store.dispatch('malls/updateStartEndDate', { endDate: this.endCacheTimeStr,
endDate: this.endCacheTimeStr, endPickerIdx: this.endPickerIdx
endPickerIdx: this.endPickerIdx })
}) }
this.$store.dispatch('malls/updateStartEndDate', {
// startDate: '',
// startPickerIdx: [],
endDate: '',
endPickerIdx: []
})
}
// }
}, },
comparsionSize(item1, item2) { comparsionSize(item1, item2) {
if(item1.length && item2.length) { if(item1.length && item2.length) {
console.log('comparsionSize', item1, item2) // console.log('comparsionSize', item1, item2)
return item1.some((val1, idx1) => val1.value > item2[idx1].value); 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 { } else {
return false; 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 \ No newline at end of file
const conditionList = { import dateInstance from '../../common/date.js'
state: { import fetch from '../../api/fetch.js'
mallId: '', import { CONDITIONS } from '../mutation-types.js'
gateId: ''
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;
},
[CONDITIONS.CHECKED_MALL_ID] (state, mallId) {
state.checkedMallId = mallId;
}, },
mutations: { [CONDITIONS.CHECKED_MULTI_MALL_ID] (state, multiMallId) {
updMallId(state, newMallId) { state.multiCheckedMallId = multiMallId;
state.mallId = newMallId;
},
updGateId(state, newGateId) {
state.gateId = newGateId;
},
}, },
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;
})
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)
}) })
}, },
GetGateId({ commit, state }) { getGates({ commit }, { data, header }) {
getGateId().then(res => { 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; export default conditionList;
\ No newline at end of file \ No newline at end of file
import dateArr from '../dateData.js'; import dateArr from '../dateData.js';
import { MALLS } from '../mutation-types.js' import { MALLS } from '../mutation-types.js'
import dateInstance from '../../common/date.js'
// initial state // initial state
const state = { const state = {
...@@ -103,6 +104,8 @@ const actions = { ...@@ -103,6 +104,8 @@ const actions = {
}) })
}, },
getDateData({ commit }, frontDay) { getDateData({ commit }, frontDay) {
let commonDate = dateInstance.getDateData()
console.log('commonDate', commonDate)
dateArr.getCustomTime(customTimeData => { dateArr.getCustomTime(customTimeData => {
let startDate = null let startDate = null
, endDate = null , endDate = null
...@@ -154,7 +157,7 @@ const actions = { ...@@ -154,7 +157,7 @@ const actions = {
, pickerSt = [] , pickerSt = []
, pickerEt = []; , pickerEt = [];
endDate = new Date(); endDate = new Date();
startDate = frontTime(endDate, 7); startDate = frontTime(endDate, 0);
endTime = formatterDayTime(endDate); endTime = formatterDayTime(endDate);
startTime = formatterDayTime(startDate); startTime = formatterDayTime(startDate);
pickerSt = computedPickerIdx(startTime); pickerSt = computedPickerIdx(startTime);
......
...@@ -22,4 +22,25 @@ export const MALLS = { ...@@ -22,4 +22,25 @@ export const MALLS = {
export const GATES = { export const GATES = {
SET_GATES: 'setGates' 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 \ 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!