Commit 883e62bd authored by wildfirecode13's avatar wildfirecode13

1

parent 9963cb28
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script src="teddi.umd.js"></script>
<script>
const timer = new teddi.Countdown( 86400 * 2 +3600*1 + 60*1 +1, 'ddhhmmss',1000);
timer.on('update', (data) => {
const {dd,hh,mm,ss} = data;
document.getElementById('root').innerHTML = `${dd}:${hh}:${mm}:${ss}`;
// document.getElementById('root').innerHTML = `${hh}:${mm}:${ss}`;
// document.getElementById('root').innerHTML = `${mm}:${ss}`;
}, this);
timer.start();
</script>
</body>
</html>
\ No newline at end of file
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.teddi = factory());
}(this, (function () { 'use strict';
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function getAugmentedNamespace(n) {
if (n.__esModule) return n;
var a = Object.defineProperty({}, '__esModule', {value: true});
Object.keys(n).forEach(function (k) {
var d = Object.getOwnPropertyDescriptor(n, k);
Object.defineProperty(a, k, d.get ? d : {
enumerable: true,
get: function () {
return n[k];
}
});
});
return a;
}
function createCommonjsModule(fn) {
var module = { exports: {} };
return fn(module, module.exports), module.exports;
}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
}
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
var tslib_es6 = /*#__PURE__*/Object.freeze({
__proto__: null,
__extends: __extends,
get __assign () { return __assign; },
__rest: __rest,
__decorate: __decorate,
__param: __param,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__createBinding: __createBinding,
__exportStar: __exportStar,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet
});
var event = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventEmitter = void 0;
var EventEmitter = /** @class */ (function () {
function EventEmitter() {
this.events = new Map();
}
EventEmitter.prototype.on = function (event, fn, context) {
var listeners = this.events.get(event);
if (listeners) {
listeners.push({ once: false, fn: fn, context: context });
}
else {
this.events.set(event, [{ once: false, fn: fn, context: context }]);
}
return this;
};
EventEmitter.prototype.once = function (event, fn, context) {
var listeners = this.events.get(event);
if (listeners) {
listeners.push({ once: true, fn: fn, context: context });
}
else {
this.events.set(event, [{ once: true, fn: fn, context: context }]);
}
return this;
};
EventEmitter.prototype.off = function (event, fn, context, once) {
var listeners = this.events.get(event);
if (listeners) {
if (fn) {
for (var i = 0; i < listeners.length; i++) {
var l = listeners[i];
if (fn === l.fn &&
(!once || l.once) &&
(!context || l.context === context)) {
listeners.splice(i--, 1);
}
}
}
else {
this.events.delete(event);
}
}
return this;
};
EventEmitter.prototype.offAll = function () {
this.events.clear();
return this;
};
EventEmitter.prototype.emit = function (event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var listeners = this.events.get(event);
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
var listener = listeners[i];
if (listener.once)
listeners.splice(i--, 1);
listener.fn.apply(listener.context, args);
}
}
return this;
};
return EventEmitter;
}());
exports.EventEmitter = EventEmitter;
});
var cache = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeLocalCache = exports.setLocalCache = exports.getLocalCache = void 0;
var getLocalCache = function (key) {
if (localStorage && localStorage.getItem)
return localStorage.getItem(key) === '1';
return false;
};
exports.getLocalCache = getLocalCache;
var setLocalCache = function (key) {
if (localStorage && localStorage.setItem) {
localStorage.setItem(key, '1');
return true;
}
return false;
};
exports.setLocalCache = setLocalCache;
var removeLocalCache = function (key) {
if (localStorage && localStorage.setItem) {
localStorage.setItem(key, '0');
return true;
}
return false;
};
exports.removeLocalCache = removeLocalCache;
});
var tslib_1 = /*@__PURE__*/getAugmentedNamespace(tslib_es6);
var Countdown_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.Countdown = void 0;
function getTimeNum(n) {
return n >= 10 ? "" + n : "0" + n;
}
var Countdown = /** @class */ (function (_super) {
tslib_1.__extends(Countdown, _super);
function Countdown(repeatCount, format, delay) {
var _this = _super.call(this) || this;
_this._running = false;
_this._repeatCount = repeatCount;
_this._format = format;
_this._counter = 0;
_this._delay = delay || 1000;
return _this;
}
Countdown.prototype.getCountdown = function () {
if (this._format == "ddhhmmss")
return this.getDDHHMMSS();
if (this._format == "hhmmss")
return this.getHHMMSS();
if (this._format == "mmss")
return this.getMMSS();
};
Countdown.prototype.getDDHHMMSS = function () {
var left = this._repeatCount - this._counter;
var days = Math.floor(left / 86400);
var dayMod = left % 86400;
var hours = Math.floor(dayMod / 3600);
var hoursMod = dayMod % 3600;
var minutes = Math.floor(hoursMod / 60);
var seconds = hoursMod % 60;
return {
dd: getTimeNum(days),
hh: getTimeNum(hours),
mm: getTimeNum(minutes),
ss: getTimeNum(seconds)
};
};
Countdown.prototype.getHHMMSS = function () {
var left = this._repeatCount - this._counter;
var hours = Math.floor(left / 3600);
var minutes = Math.floor((left % 3600) / 60);
var seconds = left - hours * 3600 - minutes * 60;
return {
hh: getTimeNum(hours),
mm: getTimeNum(minutes),
ss: getTimeNum(seconds)
};
};
Countdown.prototype.getMMSS = function () {
var left = this._repeatCount - this._counter;
var minutes = Math.floor(left / 60);
var seconds = left % 60;
return {
mm: getTimeNum(minutes),
ss: getTimeNum(seconds)
};
};
Countdown.prototype.start = function () {
var _this = this;
this._running = true;
this.emit("update", this.getCountdown());
this._timer = setInterval(function () {
_this._counter++;
_this.emit("update", _this.getCountdown());
if (_this._counter == _this._repeatCount) {
_this.stop();
}
}, this._delay);
};
Countdown.prototype.stop = function () {
this._running = false;
clearInterval(this._timer);
this.emit("complete");
};
Countdown.prototype.reset = function ($seconds) {
clearInterval(this._timer);
this._counter = 0;
this._repeatCount = $seconds;
};
Object.defineProperty(Countdown.prototype, "running", {
// set seconds(val: number) {
// this._seconds = val;
// }
get: function () {
return this._running;
},
enumerable: false,
configurable: true
});
return Countdown;
}(event.EventEmitter));
exports.Countdown = Countdown;
});
var Timer_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.Timer = void 0;
var Timer = /** @class */ (function (_super) {
tslib_1.__extends(Timer, _super);
function Timer(repeatCount, delay) {
if (delay === void 0) { delay = 1000; }
var _this = _super.call(this) || this;
_this._running = false;
_this._isPause = false;
_this.repeatCount = repeatCount;
_this.delay = delay;
_this.currentCount = 0;
return _this;
}
Timer.prototype.start = function () {
var _this = this;
this._running = true;
this._timer = setInterval(function () {
if (_this._isPause)
return;
_this.currentCount++;
_this.emit("timer");
if (_this.currentCount == _this.repeatCount) {
_this.stop();
_this.emit("complete");
}
}, this.delay);
};
Timer.prototype.pause = function () {
this._isPause = true;
};
Timer.prototype.resume = function () {
this._isPause = false;
};
Timer.prototype.stop = function () {
this._running = false;
clearInterval(this._timer);
};
Timer.prototype.reset = function () {
this.stop();
this.currentCount = 0;
this.start();
};
return Timer;
}(event.EventEmitter));
exports.Timer = Timer;
});
var tools = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.wait = exports.getDateTimer = void 0;
var getDateTimer = function () {
var now = new Date();
now.setHours(0, 0, 0, 0);
return now.getTime();
};
exports.getDateTimer = getDateTimer;
/**
*
* @param ms
*/
var wait = function (ms) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve();
}, ms);
});
};
exports.wait = wait;
});
var time = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
tslib_1.__exportStar(Countdown_1, exports);
tslib_1.__exportStar(Timer_1, exports);
tslib_1.__exportStar(tools, exports);
});
var ui = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.debounce = void 0;
/**
* 防连点
* @param fn 点击处理方法
* @param wait 等待时间,单位毫秒,默认2000
*/
var debounce = function (fn, wait, immediate) {
if (wait === void 0) { wait = 2000; }
if (immediate === void 0) { immediate = true; }
var timer;
return function () {
if (timer)
clearTimeout(timer);
if (immediate) {
// 如果已经执行过,不再执行
var callNow = !timer;
timer = setTimeout(function () {
timer = null;
}, wait);
if (callNow) {
fn();
}
}
else {
timer = setTimeout(function () {
fn();
}, wait);
}
};
};
exports.debounce = debounce;
});
var net = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPxToken = void 0;
/**
* 获取星速台token
*/
var getPxToken = function () {
return new Promise(function (resolve, reject) {
if (location.href.indexOf('localhost') > -1) {
resolve('local-token');
}
else {
window.getPxToken(function (e, token) {
if (!e) {
resolve(token);
}
else {
reject(e);
}
});
}
});
};
exports.getPxToken = getPxToken;
});
var src = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
tslib_1.__exportStar(event, exports);
tslib_1.__exportStar(cache, exports);
tslib_1.__exportStar(time, exports);
tslib_1.__exportStar(ui, exports);
tslib_1.__exportStar(net, exports);
});
var index = /*@__PURE__*/getDefaultExportFromCjs(src);
return index;
})));
import MD from 'spark-utils/out/md/index.js';
let appId = CFG.appID;
const dcm = '202.' + CFG.projectId + '.0.0';
const domain = '//embedlog.duiba.com.cn';
let MDList = [
{
ele: `.test-md1`,
data: {
dpm: `${appId}.110.5.1`,
dcm,
domain,
appId
},
once: false
}
];
export default () =>
MD({
show: MDList, // 曝光
click: MDList // 点击
});
export const join = {
"success": true,
"data": {
message: "参与成功"
}
};
export * from './rule';
import { Random } from 'mockjs';
export const rule = {
"success": true,
"data": `活动规则: ${Random.cparagraph(20, 40)}`
};
import Mock from 'mockjs';
import proxy from './proxy';
Object.keys(proxy).map(method => {
Object.keys(proxy[method]).map(URI => {
let data = proxy[method][URI];
Mock.mock(new RegExp(URI), method, opt => {
console.log(`%c[mock] 链接:${opt.url} 类型:${method} 参数:${method === 'post' && JSON.stringify(opt.body) || ''}`, "color: rgb(63, 172, 203)", data);
return data
});
})
})
\ No newline at end of file
import * as common from './common';
import * as collect_0722 from './collect_0722';
let projectId = window.CFG.projectId || '';
export default {
get: {
[`/projectx/${projectId}/projectRule.query`]: common.rule
},
post: {
[`/projectx/${projectId}/join.do`]: collect_0722.join
}
};
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "sparkproject-1607161386004",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "spark dev --type h5",
"prod": "spark build --type h5 --env prod",
"tb": "spark build --type taobao"
},
"dependencies": {
"axios": "^0.19.2",
"css-loader": "^3.6.0",
"duiba-utils": "^1.0.1",
"fyge-tbmini": "^1.3.1",
"postcss-loader": "^3.0.0",
"prettier": "^2.0.5",
"qs": "^6.9.4",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",
"spark-utils": "^0.0.2",
"style-loader": "^1.2.1",
"teddi": "file:.."
},
"devDependencies": {
"mockjs": "^1.1.0"
}
}
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<script src="getTokenKey" id="scriptkey"></script>
<script id="scriptjs" src="//yun.duiba.com.cn/js-libs/px-token/0.0.4/px-token.min.js"></script>
<title>React App</title>
<script>
!(function (e, i) {
var t = e.documentElement,
n = navigator.userAgent.match(/iphone|ipod|ipad/gi),
a = n ? Math.min(i.devicePixelRatio, 3) : 1,
m = 'orientationchange' in window ? 'orientationchange' : 'resize';
t.dataset.dpr = a;
for (
var d, l, c = !1, o = e.getElementsByTagName('meta'), r = 0;
r < o.length;
r++
)
(l = o[r]), 'viewport' == l.name && ((c = !0), (d = l));
if (c)
d.content =
'width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no';
else {
var o = e.createElement('meta');
(o.name = 'viewport'),
(o.content =
'width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no'),
t.firstElementChild.appendChild(o);
}
var s = function () {
var e = t.clientWidth;
e / a > 750 && (e = 750 * a),
(window.remScale = e / 750),
(t.style.fontSize = 200 * (e / 750) + 'px');
};
s(), e.addEventListener && i.addEventListener(m, s, !1);
})(document, window);
</script>
<script src="//yun.duiba.com.cn/h5/lib/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.1/howler.js"></script>
<script>
function getApp() {
return {
cloud: {},
cloudName: "clientTemplate2C",
requestType: "mock"
}
}
var CFG = CFG || {};
CFG.projectId = location.pathname.split('/')[2] || '1';
function getUrlParam(name) {
const search = window.location.search;
const matched = search
.slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
return search.length ? matched && matched[2] : null;
}
// CFG.appID = getUrlParam("appID")||1
CFG.appID = '${appId}';
if (!getUrlParam("appID")) {
alert("【警告】检测到活动url中没有appID参数\n缺少该参数会导致埋点、分享、app信息获取错误。")
}
</script>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script>
document.onclick = () => {
var sound = new Howl({
src: ['https://yun.duiba.com.cn/db_games/activity/game/1592379098/resource/assets/sounds/click.mp3']
});
sound.play();
}
</script>
</body>
</html>
module.exports = {
OUTPUT_DIR: "dist",
SOURCE_DIR: "src",
TEMP_DIR: "./.temp",
ENTRY: "src/app.jsx",
TEMPLATE: "./public/index.html",
MOCK_STATUS: false
};
let projectId = window.CFG.projectId || '';
const apiCfg = {
getRule:`/projectx/${projectId}/projectRule.query`,
doJoin: {
uri: `/projectx/${projectId}/join.do`,
method: "post"
}
}
export default apiCfg;
\ No newline at end of file
import apiCfg from './apicfg';
import request from './request';
const apiList = {
...apiCfg
}
const API = generateAPI(apiList);
export default API;
function getRequestParams(value) {
if (typeof value === 'string') {
return {
uri: value,
method: 'get'
}
} else if (typeof value === 'object') {
const { uri, method = 'post' } = value;
return {
uri,
method
}
} else {
console.error('getRequestParams: 传参有误');
}
};
function generateAPI(apiList) {
const api = {};
for(let key in apiList){
let value = apiList[key];
const { method, uri } = getRequestParams(value);
api[key] = params => request[method](uri, method === 'post' ? params : { params });
}
return api;
}
import Qs from "qs";
import axios from "axios";
// 分享召回工具类
import { isFromShare, newUser } from 'duiba-utils';
let mergeData = {
user_type: newUser ? '0' : '1',
is_from_share: isFromShare ? '0' : '1',
_t: Date.now()
}
const TIMEOUT = 10000;
const instance = axios.create({
timeout: TIMEOUT, // 请求超时时间
});
instance.interceptors.request.use(
(config) => {
if (config.method === "get") {
config.data = true;
}
config.method === "post"
? (config.data = Qs.stringify({ ...config.data, ...mergeData }))
: (config.params = { ...config.params, ...mergeData });
config.headers["Content-Type"] = "application/x-www-form-urlencoded";
return config;
},
(error) => {
//请求错误处理
Promise.reject(error);
}
);
// 响应拦截器
instance.interceptors.response.use(
// 请求成功
(res) => {
const { status } = res || -1000;
return (status >= 200 && status <= 400) ? res.data : res
}
);
export default instance;
import React, { Component } from "react";
import ReactDOM from "react-dom";
import "./app.less";
import { MOCK_STATUS } from '../sparkrc';
MOCK_STATUS && (require('../mock/index'));
import MD from '../MD';
MD();
//此处为spark-cli动态生成
import Pageindex from "./pages/pageindex/pageindex.jsx";
class App extends Component {
render() {
return (
<Pageindex></Pageindex>
);
}
}
ReactDOM.render(<App />, document.getElementById("root"));
* {
margin: 0;
padding: 0;
}
html,
body {
font-size: 24px;
width: 100%;
height: 100%;
}
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import {Countdown} from 'teddi'
import './pageindex.less';
class Pageindex extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
componentDidMount(){
}
render() {
return <div className="index ">
</div>;
}
}
export default Pageindex;
.index {
top: 0px;
left: 0px;
width: 750px;
height: 1624px;
display: block;
position: absolute;
}
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import './pageindex.less';
import { Countdown } from 'teddi'
class Pageindex extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
componentDidMount() {
const countdown = new Countdown(86400 * 2 + 3600 * 1 + 60 * 1 + 1, 'ddhhmmss');
countdown.on('update', (data) => {
const { dd, hh, mm, ss } = data;
console.log(data)
}, this);
countdown.start();
}
render() {
return <div className="index ">
<div> </div>
</div>;
}
}
export default Pageindex;
.index {
top: 0px;
left: 0px;
width: 750px;
height: 1624px;
display: block;
position: absolute;
}
/**
* 目前没有用到
* @param {*} resList
* @param {*} uuid
*/
const getSrcByUuid = (resList, uuid) => {
resList = resList || [];
for (let i = 0; i < resList.length; i++) {
if (resList[i].uuid == uuid) {
return resList[i].url
}
}
}
module.exports = {
getSrcByUuid
}
\ No newline at end of file
const resList = {};
export default resList;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment