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
This diff is collapsed.
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 diff is collapsed.
{
"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