提交 cca287f8 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into dev

......@@ -6,6 +6,7 @@ const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800;
const APP_PVER_TIME = 300;
const OPERATING_TIME = 10;
const DIFF_TIME = 60 * 1000 * 60 * 24;
const statConfig = require('uni-stat-config').default || require('uni-stat-config');
const UUID_KEY = '__DC_STAT_UUID';
......@@ -299,12 +300,12 @@ const calibration = (eventName, options) => {
};
const Report_Data_Time = 'Report_Data_Time';
const Report_Status = 'Report_Status';
const isReportData = () => {
return new Promise((resolve, reject) => {
let start_time = '';
let end_time = new Date().getTime();
let diff_time = 60 * 1000 * 60 * 24;
let diff_time = DIFF_TIME;
try {
start_time = uni.getStorageSync(Report_Data_Time);
} catch (e) {
......@@ -320,6 +321,7 @@ const isReportData = () => {
enable
}) => {
uni.setStorageSync(Report_Data_Time, end_time);
uni.setStorageSync(Report_Status, enable);
if (enable === 1) {
resolve();
}
......@@ -328,11 +330,10 @@ const isReportData = () => {
})
};
const Report_Status = 'Report_Status';
const requestData = (done) => {
let formData = {
usv: STAT_VERSION,
conf: encodeURIComponent({
conf: JSON.stringify({
ak: statConfig.appid
})
};
......@@ -341,7 +342,9 @@ const requestData = (done) => {
method: 'GET',
data: formData,
success: (res) => {
const {data} = res;
const {
data
} = res;
if (data.ret === 0) {
typeof done === 'function' && done({
enable: data.enable
......@@ -421,7 +424,7 @@ class Util {
}
getIsReportData(){
getIsReportData() {
return isReportData()
}
......@@ -714,7 +717,7 @@ class Util {
this._sendRequest(optionsData);
}
_sendRequest(optionsData) {
this.getIsReportData().then(()=>{
this.getIsReportData().then(() => {
uni.request({
url: STAT_URL,
method: 'POST',
......@@ -741,9 +744,11 @@ class Util {
* h5 请求
*/
imageRequest(data) {
this.getIsReportData().then(() => {
let image = new Image();
let options = getSgin(GetEncodeURIComponentOptions(data)).options;
image.src = STAT_H5_URL + '?' + options;
});
}
sendEvent(key, value) {
......
......@@ -8,3 +8,4 @@ export const STAT_KEY = 'qkTHEIegZGcL5iy3'
export const PAGE_PVER_TIME = 1800
export const APP_PVER_TIME = 300
export const OPERATING_TIME = 10
export const DIFF_TIME = 60 * 1000 * 60 * 24
......@@ -2,7 +2,8 @@ import {
PAGE_PVER_TIME,
APP_PVER_TIME,
STAT_URL,
STAT_VERSION
STAT_VERSION,
DIFF_TIME
} from './config';
const statConfig = require('uni-stat-config').default || require('uni-stat-config');
const UUID_KEY = '__DC_STAT_UUID';
......@@ -299,12 +300,12 @@ export const calibration = (eventName, options) => {
}
const Report_Data_Time = 'Report_Data_Time'
const Report_Status = 'Report_Status'
export const isReportData = () => {
return new Promise((resolve, reject) => {
let start_time = ''
let end_time = new Date().getTime()
let diff_time = 60 * 1000 * 60 * 24
let diff_time = DIFF_TIME
try {
start_time = uni.getStorageSync(Report_Data_Time)
} catch (e) {
......@@ -320,6 +321,7 @@ export const isReportData = () => {
enable
}) => {
uni.setStorageSync(Report_Data_Time, end_time)
uni.setStorageSync(Report_Status, enable)
if (enable === 1) {
resolve();
}
......@@ -328,11 +330,10 @@ export const isReportData = () => {
})
}
const Report_Status = 'Report_Status'
const requestData = (done) => {
let formData = {
usv: STAT_VERSION,
conf: encodeURIComponent({
conf: JSON.stringify({
ak: statConfig.appid
})
}
......@@ -341,7 +342,9 @@ const requestData = (done) => {
method: 'GET',
data: formData,
success: (res) => {
const {data} = res
const {
data
} = res
if (data.ret === 0) {
typeof done === 'function' && done({
enable: data.enable
......
......@@ -86,7 +86,7 @@ class Util {
}
getIsReportData(){
getIsReportData() {
return isReportData()
}
......@@ -379,7 +379,7 @@ class Util {
this._sendRequest(optionsData)
}
_sendRequest(optionsData) {
this.getIsReportData().then(()=>{
this.getIsReportData().then(() => {
uni.request({
url: STAT_URL,
method: 'POST',
......@@ -406,9 +406,11 @@ class Util {
* h5 请求
*/
imageRequest(data) {
this.getIsReportData().then(() => {
let image = new Image();
let options = getSgin(GetEncodeURIComponentOptions(data)).options;
image.src = STAT_H5_URL + '?' + options
})
}
sendEvent(key, value) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册