Commit b15584ee authored by haiyoucuv's avatar haiyoucuv

init

parents
# 顶部的EditorConfig文件
root = true
# unix风格的换行符,每个文件都以换行符结尾
[*]
end_of_line = lf
insert_final_newline = true
# 设置默认字符集
charset = utf-8
# 去除行尾空白字符
trim_trailing_whitespace = true
# 使用空格缩进,设置2个空格缩进
indent_style = space
indent_size = 2
# 忽略eslint校验路径,例如:
# src/libs/@spark
\ No newline at end of file
module.exports = {
parser: '@babel/eslint-parser',
env: {
browser: true,
es6: true,
node: true,
},
globals: {
CFG: true,
wx: true,
FYGE: true,
SPARK_ESLINT_PLUGIN: true,
remScale: true,
},
plugins: ['html', 'react', '@spark/best-practices', '@spark/security'],
extends: ['eslint:recommended', 'plugin:react/recommended'],
settings: {
react: {
version: 'detect',
},
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 7,
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true,
},
babelOptions: {
configFile: './node_modules/@spark/code-inspector/static/babel.config.js',
},
},
rules: {
'no-undef': 'error',
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true }],
'no-dupe-keys': 'error',
'no-fallthrough': 'error',
'no-global-assign': 'error',
'no-implied-eval': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true, allowTaggedTemplates: true }],
'no-useless-escape': 'error',
'no-empty-pattern': 'error',
'no-empty-function': ['error', { allow: ['arrowFunctions', 'functions', 'methods'] }],
'no-var': 'error',
'no-dupe-class-members': 'error',
'no-unsafe-optional-chaining': 'error',
'no-const-assign': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'prefer-const': 'warn',
'no-extra-boolean-cast': 'warn',
'no-mixed-spaces-and-tabs': 'warn',
'no-alert': 'warn',
'no-new-wrappers': 'warn',
'no-useless-concat': 'warn',
'no-useless-return': 'warn',
'prefer-promise-reject-errors': ['warn', { allowEmptyReject: true }],
'spaced-comment': 'warn',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/jsx-pascal-case': 'error',
'jsx-quotes': 'warn',
// 'react/jsx-tag-spacing': 'error',
'react/require-resnder-return': 'error',
'semi': [1]
},
overrides: [
{
files: ['public/**/*.html'],
rules: {
'no-var': 'off',
'@spark/security/third-party-whitelist': 'error',
'@spark/best-practices/no-url-in-js': 'error',
'@spark/best-practices/no-arrow-function': 'error',
'@spark/best-practices/no-es6-variable-declaration': 'error',
},
},
{
files: ['src/**/*.{js,jsx}'],
rules: {
'@spark/best-practices/no-url-in-js': 'error',
},
},
],
};
.DS_Store
node_modules/
___cache/
__cache/
coverage/
npm-debug.log
selenium-debug.log
.idea
.builds
.project
.vscode
yarn-error.log
.yarn
.package-lock
yarn.lock
.cache
packages/**/package-lock.json
released
output.js
output.js.map
.psd
.psb
#src/assets/
dist/
!dist/index.html
\ No newline at end of file
registry = http://npm.dui88.com
\ No newline at end of file
module.exports = {
semi: true, // 结尾加分号
singleQuote: false, // 使用单引号
jsxSingleQuote: false, // jsx中使用单引号
bracketSpacing: true, // 括号和参数之间有空格
jsxBracketSameLine: true, // 标签属性较多时,标签箭头>另起一行
quoteProps: 'as-needed', // 属性加引号需要加时再加
printWidth: 120, // 每行字符个数
};
registry "http://npm.dui88.com"
\ No newline at end of file
import MD from 'spark-utils/out/md/index.js';
import { logClick, logExposure } from "@spark/utils/src-js/md";
let appId = CFG.appID;
const dcm = '202.' + CFG.projectId + '.0.0';
const domain = '//embedlog.duiba.com.cn';
const dom = `${CFG.channel}.0.0.0`;
const MDList = new Array(52).fill("").map((v, i) => {
return {
ele: `.md${i + 1}`,
data: {
dpm: `${appId}.110.${i + 1}.1`,
dcm,
domain,
appId,
dom,
},
once: false,
};
});
export default () =>
MD({
show: MDList, // 曝光
click: MDList // 点击
});
export function handleLogExposure(id, id2 = 1) {
logExposure({
dpm: `${appId}.110.${id}.${id2}`,
dcm,
domain,
appId,
dom,
});
}
export function handleLogClick(id, id2 = 1) {
logClick({
dpm: `${appId}.110.${id}.${id2}`,
dcm,
domain,
appId,
dom,
});
}
### 注意事项
xxxxxxx
### 迭代日志
## 20230202 [大雁链接](https://www.bilibili.com)
+ haha
+ haha1
+ haha2
\ No newline at end of file
/*
将此文件放到project/config/scripts/assets/目录下
在package.json文件的"scripts"字段下,分别修改dev和build命令:
"dev": "node ./config/scripts/assets/generateAssetList.js && node ./config/webpack.dev.config.js"
"build": "node ./config/scripts/assets/generateAssetList.js && node ./config/scripts/assets/index.js imgmin imgup && node ./config/webpack.prod.config.js"
*/
const fs = require('fs')
const path = require('path')
/* 请先配置:预加载的资源文件夹名称,或者设置预加载、异步加载资源路径*/
const preloadFolder = []; // 在/src/assets文件夹下,请设置需要预加载的资源文件目录,默认值预加载为loading文件夹, 其他均为异步加载
const otherFolder = ['loadingDemo']; // 在/src/assets文件夹下,不做任务处理的文件夹,不需要预加载, 也不需要异步加载
const initAssetList = { // 初始化预设资源处理
preLoadImg:[], // 设置预加载图片,例如:["loading/bg174.png","loading/上面.png","loading/底部173.png"]
asyncLoadImg:[] // 设置异步加载图片
}
/**
* 搜索文件夹里的文件
* @param {*} folderList 预加载文件夹名称数组
* @param {*} folderPath 文件夹地址,绝对路径
* @param {*} regExp 正则表达式,用于匹配目标文件
* @returns {string[]} 返回文件相对路径地址
*/
function searchFileFromFolder(folderPath='/src/assets', regExp=/\.(png|jpg|jpeg|svga|spi|json|mp3|wav)$/i) {
const preLoadImg = [], asyncLoadImg = [];
const searchOneDir = (absolutePath, relativePath) => {
fs.readdirSync(absolutePath).forEach(v => {
const absPath = absolutePath + '/' + v;
const relPath = relativePath ? relativePath + '/' + v : v;
if(fs.statSync(absPath).isFile()) {
if(regExp.test(v)){
if(preloadFolder.includes(relPath.split('/')[0])){
preLoadImg.push(relPath);
}else if(!otherFolder.includes(relPath.split('/')[0])){
asyncLoadImg.push(relPath)
}
}
}else {
searchOneDir(absPath, relPath);
}
});
}
searchOneDir(path.resolve('.') + folderPath, '');
console.log('资源预处理成功~')
return {
preLoadImg: [
...initAssetList.preLoadImg,
...preLoadImg
],
asyncLoadImg: [
...initAssetList.asyncLoadImg,
...asyncLoadImg
]
};
}
// 读资源目录
const assetList = searchFileFromFolder();
// 写资源列表json
fs.writeFileSync(path.resolve('.') + '/src/assetList.json', JSON.stringify(assetList))
\ No newline at end of file
const { assets } = require("spark-assets");
const args = process.argv.splice(2);
let argsObj = {
imgmin: false,
imgup: false
}
if (args.length == 1) {
argsObj.imgmin = 'imgmin' == args[0];
argsObj.imgup = 'imgup' == args[0];
} else if (args.length == 2) {
argsObj.imgmin = 'imgmin' == args[0];
argsObj.imgup = 'imgup' == args[1];
}
assets(argsObj)
\ No newline at end of file
exports.SPARK_CONFIG_DIR_KEY = ['OUTPUT_DIR', 'SOURCE_DIR', 'TEMP_DIR', 'ENTRY', 'TEMPLATE']
exports.SPARK_CONFIG = 'sparkrc.js'
//对应项目在线素材存储的cdn配置,用于迭代开发从线上拉取素材到本地
exports.SPARK_CDN_RES_CFG='sparkrescfg.json'
\ No newline at end of file
const loaderUtils = require('loader-utils');
module.exports = function (source) {
const options = loaderUtils.getOptions(this);
let result = source;
if (options.arr) {
options.arr.map(op => {
result = result.replace(op.replaceFrom, op.replaceTo);
})
} else {
result = source.replace(options.replaceFrom, options.replaceTo);
}
return result
};
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { exec } = require('child_process');
class GitToHtmlPlugin {
process(htmlPluginData) {
return new Promise(function (resolve) {
let gitStr = '';
exec('git remote -v & git branch --show-current & git config --global user.name', (_err, stdout, _stderr) => {
if (stdout) {
gitStr = `<script>CFG.___G___='${encodeURIComponent(stdout.replace(/\n/g, ';'))}'</script>`
}
htmlPluginData.html = htmlPluginData.html.replace('</body>', `${gitStr}</body>`);
resolve();
});
});
};
apply(compiler) {
compiler.hooks.compilation.tap('GitToHtmlPlugin', (compilation) => {
HtmlWebpackPlugin.getHooks(compilation).afterTemplateExecution.tapAsync(
"GitToHtmlPlugin",
async (html, cb) => {
await this.process(html);
cb(null, html);
}
);
});
}
}
module.exports = GitToHtmlPlugin;
const babel = require('@babel/core');
const HtmlWebpackPlugin = require("html-webpack-plugin");
class HtmlJsToES5Plugin {
process(htmlPluginData) {
return new Promise(function (resolve) {
const scriptRegExp = /<script>[\s\S]*?<\/script>/gis;
htmlPluginData.html = htmlPluginData.html.replace(scriptRegExp, function (match) {
const code = match.replace("<script>", "").replace("</script>", "");
const es5Code = babel.transform(code, { 'presets': ['@babel/preset-env'] }).code;
return `<script>${es5Code}</script>`;
});
resolve();
});
};
apply(compiler){
compiler.hooks.compilation.tap('HtmlJsToES5Plugin', (compilation) => {
HtmlWebpackPlugin.getHooks(compilation).afterTemplateExecution.tapAsync(
"HtmlJsToES5Plugin",
async (html, cb) => {
await this.process(html);
cb(null, html);
}
);
});
}
}
// exports.default = HtmlJsToES5Plugin;
module.exports = HtmlJsToES5Plugin;
// 端口是否被占用
const net = require("net");
exports.getProcessIdOnPort=function(port) {
try {
const execOptions = {
encoding: 'utf8',
stdio: [
'pipe',
'pipe',
'ignore',
],
};
return execSync('lsof -i:' + port + ' -P -t -sTCP:LISTEN', execOptions)
.split('\n')[0]
.trim();
} catch (e) {
return null;
}
}
exports.isPortAvailable = function (port, host = "localhost") {
return new Promise((resolve) => {
if (isNaN(port) || port != parseInt(port) || port < 0 || port > 65536) {
resolve(false);
}
try {
const tester = net.createServer()
// catch errors, and resolve false
.once('error', err => {
resolve(false);
})
// return true if succed
.once('listening', (err) => {
tester
.once('close', () => {
resolve(true);
})
.close()
})
.listen(port, host);
} catch (e) {
resolve(false);
}
})
}
const childProcessSync=async function(cmd, params, cwd, printLog = true) {
return new Promise((resolve, reject) => {
let proc = childProcess(cmd, params, cwd, printLog);
proc.on('close', (code) => {
if (code === 0) {
resolve(proc['logContent']);
} else {
reject(code);
}
});
});
}
const getGitBranch=async function(cwd) {
try {
const result = await childProcessSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], cwd, false);
if (!result.startsWith('fatal:')) {
return result.trim();
}
} catch (e) {
return undefined;
}
}
const getProjectNameByPackage=function() {
return require(`${process.cwd()}/package.json`).name
}
/**
* 理论上每个项目独一无二的文件夹名字-默认取分支名
* 如果当前未创建分支,取包名+日期
* (实际很多情况是直接clone老项目,包名相同,以防资源被替换,所以用日期加一下)
*/
exports.getCdnFolderName=async function() {
const branch = await getGitBranch(process.cwd());
const date = Date.now();
if (branch) {
return branch + "/" + date;
}
let foldername = getProjectNameByPackage() + "/" + date;
return foldername;
}
const path = require('path');
const { SPARK_CONFIG_DIR_KEY, SPARK_CONFIG } = require('./scripts/constant');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const ProgressBarPlugin = require("progress-bar-webpack-plugin");
module.exports = function (isProd) {
const appPath = process.cwd();
const sparkConfig = require(path.join(appPath, SPARK_CONFIG));
const cssReg = /\.(css|less)$/;
// 处理相对路径
SPARK_CONFIG_DIR_KEY.map((key) => {
sparkConfig[key] = path.resolve(appPath, sparkConfig[key]);
});
const stylePlugins = [
require("autoprefixer")({
overrideBrowserslist: ["> 1%", "last 2 versions", "not ie <= 8"],
})
];
if (sparkConfig.PX2REM) {
stylePlugins.push(
require("postcss-px2rem-exclude")({
remUnit: 100, // 注意算法,这是750设计稿,html的font-size按照750比例
exclude: /noRem/i,
})
);
}
const styleLoader = (cssOptions = {}) => {
return [
{
loader: "style-loader",
},
isProd && {
loader: MiniCssExtractPlugin.loader,
options: {
esModule: false,
},
},
{
loader: "css-loader",
options: {
...cssOptions,
importLoaders: 2, // 如果遇到css里面的 @import 执行后面两个loader。 不然如果import了less,css-loader是解析不了
},
},
{
loader: "postcss-loader",
options: {
sourceMap: isProd,
plugins: stylePlugins,
},
},
{
loader: require.resolve("less-loader"),
options: {
sourceMap: isProd,
lessOptions: {
modifyVars: {
"@RES_PATH": `"${isProd ? sparkConfig.RES_PATH_PROD + '/' : sparkConfig.RES_PATH}"`,
},
}
},
},
].filter(Boolean);
};
return {
entry: sparkConfig.ENTRY,
mode: isProd ? 'production' : 'development',
devtool: isProd ? "source-map" : "cheap-module-source-map",
output: {
path: path.resolve(__dirname, sparkConfig.OUTPUT_DIR),
filename: "js/[name].js",
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
alias: {
"@src": path.resolve(__dirname, sparkConfig.SOURCE_DIR),
},
},
module: {
strictExportPresence: true,
rules: [
{
test: cssReg,
use: styleLoader(),
// include: sparkConfig.SOURCE_DIR,
},
{
test: /\.(js|jsx)$/,
loader: require.resolve("babel-loader"),
// exclude: [path.resolve("node_modules")],
options: {
presets: [
require("@babel/preset-env").default,
require("@babel/preset-react").default
],
plugins: [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": false }],
require("@babel/plugin-transform-runtime").default,
],
sourceType: 'unambiguous'
},
},
{
test: [/\.(jpg|jpeg|png|svg|bmp)$/, /\.(eot|woff2?|ttf|svg)$/],
loader: require.resolve("url-loader"),
options: {
name: "[path][name].[ext]", // name默认是加上hash值。这里做了更改,不让加
outputPath: "images",
limit: 10240, // url-loader处理图片默认是转成base64, 这里配置如果小于10kb转base64,否则使用file-loader打包到images文件夹下
},
},
].filter(Boolean),
},
plugins: [
isProd &&
new MiniCssExtractPlugin({
filename: "styles/[name].[hash].css",
}),
new HtmlWebpackPlugin({
template: sparkConfig.TEMPLATE,
minify: !sparkConfig.UNMINIFY_INDEX && isProd,
}),
new CleanWebpackPlugin({
// cleanOnceBeforeBuildPatterns:['**/*', 'dist'] // 这里不用写 是默认的。 路径会根据output 输出的路径去清除
}),
new ProgressBarPlugin(),
].filter(Boolean),
optimization: {
minimize: isProd,
minimizer: [
// 替换的js压缩 因为uglifyjs不支持es6语法,
new TerserPlugin({
cache: true,
sourceMap: isProd,
extractComments: false, // 提取注释
parallel: true, // 多线程
terserOptions: {
compress: {
pure_funcs: ["console.log"],
},
},
}),
// 压缩css
new OptimizeCSSAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: require("cssnano"),
cssProcessorPluginOptions: {
preset: ["default", { discardComments: { removeAll: true } }],
},
canPrint: true,
}),
],
// 修改文件的ids的形成方式,避免单文件修改,会导致其他文件的hash值变化,影响缓存
moduleIds: "hashed",
splitChunks: {
chunks: "all",
minSize: 30000, // 小于这个限制的会打包进Main.js
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10, // 优先级权重,层级 相当于z-index。 谁值越大权会按照谁的规则打包
name: "vendors",
},
},
},
// chunks 映射关系的 list单独从 app.js里提取出来
runtimeChunk: {
name: (entrypoint) => `runtime-${entrypoint.name}`,
},
},
};
}
const { SPARK_CONFIG } = require("./scripts/constant");
const Webpack = require("webpack");
const webpackBaseConfig = require("./webpack.common.config");
const WebpackMerge = require("webpack-merge");
const WebpackDevServer = require("webpack-dev-server");
const opn = require("opn");
const apiMocker = require('mocker-api');
const path = require('path');
const { getProcessIdOnPort } = require("./scripts/utils");
const {isPortAvailable} = require("./scripts/utils");
const sparkConfig = require(path.resolve(SPARK_CONFIG));
const webpackDevConfig = function () {
return {
devServer: {
useLocalIp: true,
open: false,
hot: true,
host: "0.0.0.0",
// hotOnly: true
before(app) {
app.use(/^\/$/, async (req, res, next) => {
const send = res.send.bind(res);
res.send = (body) => {
let result = body.toString();
result = result.replace('${APPID}', 'test');
send(result);
}
next();
})
if (sparkConfig.API_MOCK) {
apiMocker(app, path.resolve('./mock/index.js'), {
changeHost: true,
})
}
}
},
plugins: [
// new Webpack.WatchIgnorePlugin([/[\\/]mock[\\/]/]),
new Webpack.HotModuleReplacementPlugin()
]
};
};
const buildDev = async function (config) {
const { port } = config;
return new Promise(async (resolve, reject) => {
const config = WebpackMerge(webpackBaseConfig(false), webpackDevConfig());
const compiler = Webpack(config);
const devServerOptions = Object.assign({}, config.devServer);
console.log('devServerOptions', devServerOptions);
const server = new WebpackDevServer(compiler, devServerOptions);
let i = 0;
for (; i < 100; i++) {
const canUse = await isPortAvailable(port + i, "0.0.0.0");
console.log(port + i, canUse)
if (canUse) {
break;
}
}
server.listen(
port + i || 8088,
"0.0.0.0",
() => {
console.log(`Starting server on http://localhost:${port}`);
opn(`http://localhost:${port + i || 8088}`);
resolve();
},
(err) => {
if (err) console.error("server linsten err--", err);
reject();
}
);
});
};
const args = process.argv.splice(2);
const port = args[0] || 8088
buildDev({
port: Number(port)
})
const path = require("path");
const chalk = require("chalk");
const fs = require('fs-extra');
const Webpack = require("webpack");
const WebpackMerge = require("webpack-merge");
const webpackBaseConfig = require("./webpack.common.config");
const {Uploader} = require("spark-assets");
const isProd = true;
const {getCdnFolderName} = require("./scripts/utils");
const {SPARK_CONFIG} = require("./scripts/constant");
const HtmlJsToES5Plugin = require("./scripts/plugins/HtmlJsToES5Plugin");
const {DepReporter} = require('spark-log-event');
// const sparkConfig = require('../sparkrc');
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
const GitToHtmlPlugin = require("./scripts/plugins/GitToHtmlPlugin");
const JavaScriptObfuscator = require("javascript-obfuscator");
const PATH_ROOT = 'spark/v2';
const webpackProdConfig = function (cdnFolderName, resPathProd) {
return {
output: {
publicPath: `//yun.duiba.com.cn/spark/v2/${cdnFolderName}/`,
filename: isProd ? "js/[name].[contenthash:8].js" : "js/[name].[contenthash:4].js",
},
resolveLoader: {
modules: ['node_modules', path.resolve(__dirname, './scripts/loaders')]
},
module: {
rules: [
{
test: /sparkrc\.js$/,
exclude: [path.resolve("node_modules")],
use: [
{
loader: 'replaceLoader',
options: {
arr: [
{
replaceFrom: /(MOCK_STATUS: true)|(MOCK_STATUS:true)|("MOCK_STATUS": true)|("MOCK_STATUS":true)/,
replaceTo: '"MOCK_STATUS": false'
},
{
replaceFrom: /(RES_PATH:'\/src\/assets\/')|(RES_PATH: '\/src\/assets\/')|("RES_PATH":"\/src\/assets\/")|("RES_PATH": "\/src\/assets\/")/,
replaceTo: `"RES_PATH":"${resPathProd}/"`
}
]
}
}
]
},
]
},
plugins: [
new Webpack.IgnorePlugin(/[\\/]mock[\\/]/),
new ScriptExtHtmlWebpackPlugin({
custom: {
test: /\.js$/,
attribute: 'crossorigin',
value: 'anonymous'
}
}),
new GitToHtmlPlugin(),
new HtmlJsToES5Plugin(),
new DepReporter(),
new Webpack.ContextReplacementPlugin(
/moment[/\\]locale$/,
/zh-cn/,
),
],
node: {
crypto: 'empty'
}
};
};
const buildProd = async function () {
const cdnFolderName = await getCdnFolderName();
const appPath = process.cwd();
const sparkConfig = require(path.join(appPath, SPARK_CONFIG));
const _webpackProdConfig = await webpackProdConfig(cdnFolderName, sparkConfig.RES_PATH_PROD || '');
//新增 JS_PATH_PROD 用作
const newSparkCfg = Object.assign({}, sparkConfig);
newSparkCfg['JS_PATH_PROD'] = `https://yun.duiba.com.cn/spark/v2/${cdnFolderName}/js`;
const str = `module.exports =${JSON.stringify(newSparkCfg, null, 2)}`;
fs.writeFileSync(path.join(appPath, SPARK_CONFIG), str);
return new Promise((resolve, reject) => {
const config = WebpackMerge(webpackBaseConfig(isProd), _webpackProdConfig);
const compiler = Webpack(config);
compiler.run(async (error, stats) => {
if (error) {
return reject(error);
}
console.log(
stats.toString({
chunks: false, // 使构建过程更静默无输出
colors: true, // 在控制台展示颜色
})
);
console.log(`${chalk.yellow("打包成功, 等待上传")}\n`);
const files = fs.readdirSync(config.output.path + "/js");
let fileName = "";
for (let i = 0; i < files.length; i++) {
if (files[i].endsWith('.js') && files[i].indexOf("main") == 0) {
fileName = files[i];
}
}
const js = fs.readFileSync(path.join(config.output.path, "js/" + fileName), "utf-8");
const resJs = JavaScriptObfuscator.obfuscate(
js,
{
debugProtectionInterval: 4000,
debugProtection: true,
// 单行输出
compact: true,
selfDefending: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.3,
// 注入死代码
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.2,
// 标识符名称生成器
// hexadecimal 16进制 包体增大较多
// mangled 短名称
// mangled-shuffled 与mangled相同,但带有洗牌字母表
// "identifier-names-generator": 'mangled-shuffled',
// 数字转表达式 如:
// const foo = 1234;
// const foo=-0xd93+-0x10b4+0x41*0x67+0x84e*0x3+-0xff8;
// numbersToExpressions: true,
log: true,
// 拆分字面字符串
splitStrings: true,
stringArray: true,
stringArrayRotate: true,
stringArrayCallsTransform: true,
stringArrayCallsTransformThreshold: 1,
stringArrayWrappersParametersMaxCount: 5,
stringArrayThreshold: 1,
// transformObjectKeys: true,
target: "browser-no-eval",
}
);
fs.writeFileSync(path.join(config.output.path, "js/" + fileName), resJs.getObfuscatedCode(), "utf-8");
const uploader = new Uploader();
await Promise.all([
await uploader.uploadDir(
config.output.path,
`${PATH_ROOT}/${cdnFolderName}`,
/.(html|map)$/
),
await uploader.uploadDir(
config.output.path + "/js",
`${PATH_ROOT}/${cdnFolderName}/js/map_123_map`,
/.(html|js|css|css\.map)$/
),
]);
resolve();
});
});
};
buildProd();
{
"version": "0.2",
"language": "en",
"words": [
"duiba",
"fyge",
"hanzi",
"projectx",
"webfonts",
"Weixin",
"webp"
]
}
{
"compilerOptions": {
"experimentalDecorators": true,
"baseUrl": "./",
"paths": {
"@src/*": ["src/*"]
}
},
"exclude": [
"node_modules"
]
}
\ No newline at end of file
{"numOfComponents":5048,"numOfProject":5162}
\ No newline at end of file
const {AES, enc, mode, pad} = require("crypto-js");
const getOptions = (iv) => {
return {
iv: enc.Utf8.parse(iv),
mode: mode.CBC,
padding: pad.ZeroPadding,
};
}
/** 加密 */
exports.AESEncrypt = (str, key, iv) => {
const options = getOptions(iv);
return AES.encrypt(str, enc.Utf8.parse(key), options).toString();
};
/** 解密 */
exports.AESDecrypt = (cipherText, key, iv) => {
const options = getOptions(iv);
return AES.decrypt(cipherText, enc.Utf8.parse(key), options)
.toString(enc.Utf8)
.trim()
.replace(//g, '')
.replace(//g, '')
.replace(/\v/g, '')
.replace(/\x00/g, '');
};
module.exports = {
"code": 200,
"data": "consectetur Excepteur occaecat tempor",
"message": "sint minim magna est mollit",
"status": true
}
\ No newline at end of file
module.exports = {
"success": true,
"message": "报错了~",
"code": null,
"data": {
"test_config_01": "前端配置项测试",
"test_config_03": null,
"test_config_02": "111",
"shareInfo": {
"title": "许愿迎新春",
"content": "参与活动生成你的专属烟花吧~",
"thumbnail": "https://yun.duiba.com.cn/polaris/%E6%9C%AA%E6%A0%87%E9%A2%98-1.501ac89a8b4c601209edf8b9c3b67fd5228f1ed8.jpg",
"imgUrl": "https://yun.duiba.com.cn/polaris/%E6%9C%AA%E6%A0%87%E9%A2%98-1.501ac89a8b4c601209edf8b9c3b67fd5228f1ed8.jpg"
},
"shareInfoZan": {
"title": "许愿迎新春",
"content": "参与活动生成你的专属烟花吧~",
"thumbnail": "https://yun.duiba.com.cn/polaris/%E6%9C%AA%E6%A0%87%E9%A2%98-1.501ac89a8b4c601209edf8b9c3b67fd5228f1ed8.jpg",
"imgUrl": "https://yun.duiba.com.cn/polaris/%E6%9C%AA%E6%A0%87%E9%A2%98-1.501ac89a8b4c601209edf8b9c3b67fd5228f1ed8.jpg"
},
"shareInfoInvite": {
"title": "许愿迎新春",
"content": "参与活动生成你的专属烟花吧~",
"thumbnail": "https://yun.duiba.com.cn/polaris/%E6%9C%AA%E6%A0%87%E9%A2%98-1.501ac89a8b4c601209edf8b9c3b67fd5228f1ed8.jpg",
"imgUrl": "https://yun.duiba.com.cn/polaris/%E6%9C%AA%E6%A0%87%E9%A2%98-1.501ac89a8b4c601209edf8b9c3b67fd5228f1ed8.jpg"
},
"Url": "https://lifeapp-test.picclife.cn/portal-web/app_manager/downloadapps.html?operate_link=https%3A%2F%2Flifeapp-api-test.picclife.cn%2Flifeapi%2Flifeapp-svc-rel-gw%2Fapi%2Fauth_code%2Fauthorize%2Fv1%3Factivity_code%3D6130%26redirect_type%3D0%26redirect_uri%3Dhttps%253A%252F%252F96094.activity-19.m.duiba.com.cn%252FcustomShare%252Fshare%253Fid%253DDid1NTk5NTk&isBindManager=1&isNeedAuth=1",
"SaleManUrl":"http://activity.m.duibatest.com.cn/projectx/pd2a9a8c1/index.html?appID=19487",
}
};
\ No newline at end of file
module.exports = {
"code": 200,
"data": "veniam Duis est consectetur",
"message": "esse quis dolore sed laborum",
"success": true
}
\ No newline at end of file
module.exports = {
"data": 3,
"success": true
}
\ No newline at end of file
module.exports = {
"code": 200,
"data": {
"totalCount": 63423987.750740975,
"currentPage": 11314315.075550228,
"totalPage": -36371444.33874133,
"record": [
{
"worksNum": "in Duis culpa reprehenderit",
"worksImg": "ut id",
"worksDesc": "proident reprehenderit sed quis",
"uploadTime": 99647971.65115526,
"worksTitle": "ex cupidatat ullamco magna",
"sex": "consequat voluptate deserunt sed minim"
},
{
"worksNum": "ad",
"worksImg": "sed eu",
"worksDesc": "ea Duis",
"uploadTime": 15444091.361747697,
"worksTitle": "tempor Lorem do officia irure",
"sex": "ut laboris sed do"
},
{
"worksNum": "ipsum consequat",
"worksImg": "nulla ut nisi",
"worksDesc": "et quis laboris",
"uploadTime": 69808334.32919586,
"worksTitle": "voluptate quis irure sunt",
"sex": "Lorem cillum quis consequat Duis"
}
]
},
"message": "qui consequat esse in fugiat",
"success": true
}
\ No newline at end of file
module.exports = {
"code": 200,
"data": "in dolore consequat",
"message": "ea",
"success": true
}
\ No newline at end of file
module.exports = {
"code": 200,
"data": {
"worksInfo": {
"status": 0,
"worksNum": "123123",
"worksTitle": "Duis",
"sex": "in ex commodo sit aute",
"worksImg": "aliqua sed irure",
"worksDesc": "magna ut ipsum incididunt",
"rankIndex": "-1"
},
"rankPrizeInfo": [
{
"prizeName": "officia laboris ex",
"prizeImg": "quis in ut",
"ranking": "aliqua"
},
{
"prizeName": "officia laboris ex",
"prizeImg": "quis in ut",
"ranking": "aliqua"
},
{
"prizeName": "in voluptate",
"prizeImg": "Duis cillum",
"ranking": "cupidatat dolore"
},
{
"prizeName": "voluptate eiusmod esse velit Lorem",
"prizeImg": "esse Duis tempor",
"ranking": "aliquip in"
}
],
"remainThumbsTimes": 9999,
"openTime": 40255347.05613828,
"currentTime": -59725751.158325166,
"rankInfos": [
{rank: 1, sex: "1", thumbsNum: 7, worksDesc: "过去的岁月勇敢的挑战自我,去体验,去挑战,我就是了不起的自己!"},
{rank: 2, sex: "2", thumbsNum: 6, worksDesc: "过去的岁月勇敢的挑战自我,去体验,去挑战,我就是了不起的自己!"},
{rank: 3, sex: "1", thumbsNum: 5, worksDesc: "过去的岁月勇敢的挑战自我,去体验,去挑战,我就是了不起的自己!"},
{rank: 4, sex: "2", thumbsNum: 4, worksDesc: "过去的岁月勇敢的挑战自我,去体验,去挑战,我就是了不起的自己!"},
],
"maxAwardRank": -22713682.647017077
},
"message": "enim mollit deserunt",
"success": true
};
\ No newline at end of file
module.exports = {
"data": "<p>以下是游戏规则:手速要快,点击红包雨。。333。。。。。。。。。。。。。。。。。。。。11111111111111sadasdadadsad5555555557777777777799999999999911111111111111111111111222222222222222222222222222222222222222222222222222222222222222333333333333333333333333333333333333333333333333333333333333311111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333331111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333333333333333</p>",
"success": true
}
\ No newline at end of file
module.exports = {
"code": 200,
"data": {
"prizeName": "voluptate quis",
"productInfos": [
{
"productImg": "anim exercitation enim",
"productText": "cillum sit proident anim in"
},
{
"productImg": "id",
"productText": "do Excepteur amet minim veniam"
}
],
"prizeId": "thanks",
"prizeImg": "elit dolor nisi aliqua"
},
"message": "ad",
"success": true
}
\ No newline at end of file
module.exports = {
"code": 200,
"data": {
"agreeFlag": false,
"ruleGuidePopFlag": false,
"examinePop": {
"needPop": false,
"result": true,
"sendDrawNum": -30112326
},
"rankPop": {
"needPop": false,
"result": true,
"prizeName": "sit minim dolore",
"rank": -76350536.98477012,
"prizeImg": "in amet"
},
"uid": "123123123",
"actStartTime": Date.now() - 10000,
"currentTime": Date.now(),
"actEndTime": Date.now() + 100000,
"guideFlag": true,
"ruleText": "cupidatat",
"showAgentIcon": true,
"agreeText": "ullamco ipsum cupidatat nulla Duis",
"agentCode": null,
"boundYkCode": "fugiat ex",
"agent": false,
"vaildUid": true,
awardDesc: "好久啊上课的话就撒撒点话费"
},
"message": "veniam",
"success": true
};
\ No newline at end of file
module.exports = {
"code": 200,
"data": "cillum",
"message": "amet ut occaecat ullamco",
"success": true,
}
\ No newline at end of file
const rule = require("./common/rule");
const drawNum = require("./common/drawNum");
const coopFrontVariable = require("./common/coopFrontVariable");
const coopSendCode = require("./common/coopSendCode");
const coopCheckCode = require("./common/coopCheckCode");
const saveOrUpdateWork = require("./common/saveOrUpdateWork");
const salesManIndex = require("./common/salesManIndex");
const examineIndex = require("./common/examineIndex");
const lockAgree = require("./common/lockAgree");
const productSearch = require("./common/productSearch");
const saleDraw = require("./common/saleDraw");
const {AESEncrypt} = require("./Crypto");
const proxy = {
...require("./project"),
"GET /projectRule.query": rule,
"GET /drawNum.query": drawNum,
"GET /coop_frontVariable.query": coopFrontVariable,
"POST /examine/coop_sendCode.do": coopSendCode,
"POST /examine/coop_checkCode.do": coopCheckCode,
"POST /works/saveOrUpdateWork.do": saveOrUpdateWork,
"GET /works/index.do": salesManIndex,
"POST /examine/examineIndex.do": examineIndex,
"GET /works/lockAgree.do": lockAgree,
"GET /works/productSearch.do": productSearch,
"GET /works/draw.do":saleDraw,
// 图片上传
"POST /customActivity/duiba/imgUploadUrl": {
code: null,
data: "//yun.duiba.com.cn/upload/20240627/ad414a55.png",
success: true,
desc: "sdgdfhbdfhbgdf",
timestamp: 1719456693066,
},
"GET /spring/start.do": {
"code": "code",
"success": true,
"message": "message",
"timeStamp": Date.now(),
"data": AESEncrypt(JSON.stringify({
"startId": "officia",
"countDown": 30
}), "1696BD3E5BB915A0", "cDOiBC1n2QrkAY2P"),
},
};
module.exports = proxy;
module.exports = {
"/customActivity/piccLife/check": {
"code": "ut",
"data": {
"bind": true, // 是否绑定,为true是
"url": "http://localhost:8089/", // 免登链接
"url": null
},
"desc": "sit magna",
"success": true,
"timestamp": -84973885.23733975
},
"/customActivity/piccLife/sendSmsCode": {
"code": "0900101",
"desc": "nostrud aliqua irure dolore mollit",
"success": true,
"timestamp": -15469760.648778364
},
"/customActivity/piccLife/bindWithCode": {
"code": "est quis nostrud esse",
"data": "aute", // 免登链接
"desc": "minim",
"success": true,
"timestamp": -35269541.090369485
},
"/inviteAssist_1/outside.do": {
"success": true,
"code": "est",
"message": "mollit",
"data": {
"actStartTimestamp": 64844732.27800217,
"actEndTimestamp": 98617892.73875144,
"currentTimestamp": 23618881.683875963,
"uid": "nisi",
"validUid": false,
"boundYkCode": "officia commodo"
}
}
}
module.exports = {
"GET /draw/index.do": {
"success": true,
"message": "报错了~",
"code": null,
timeStamp: Date.now(),
"data": {
"remainDrawTimes": 1, // 抽奖次数
"carouselVos": new Array(10).fill().map((_, index) => {
return {
"escapePhone": `132****211${index}`, // 轮播手机号
"prizeName": `奖品名称奖品名称奖品名称${index}`, // 奖品名称
"time": +new Date() - index * 24 * 60 * 60 * 1000, // 获得时间,13位时间戳
};
}),
"prizeVOs": [
{
prizeName: `奖品名称奖品名称奖品名称奖品名称1`,
prizeImg: `//yun.duiba.com.cn/polaris/jinmoqiang.9e5bbc004f69ab6a3f34d93daeda028616a9f00d.png`,
prizeId: `thanks1`,
},
{
prizeName: `奖品名称2`,
prizeImg: `//yun.duiba.com.cn/polaris/kouzhao.dc55dac6db1ff94c4666c2602d6cb0ac84139982.png`,
prizeId: `thanks2`,
},
{
prizeName: `奖品名称3`,
prizeImg: `//yun.duiba.com.cn/polaris/mac.fe55aa43e5a231d568973dcdd0b91e0263d5a12c.png`,
prizeId: `thanks3`,
},
{
prizeName: `奖品名称4`,
prizeImg: `//yun.duiba.com.cn/polaris/mgtv.e5f0709a2a4083bc57ce52ff200a50a2e56b2658.png`,
prizeId: `thanks4`,
},
{
prizeName: `奖品名称5`,
prizeImg: `//yun.duiba.com.cn/polaris/qq.73ad13cd0c6fd705327d12957c12e9d5b2e77baa.png`,
prizeId: `thanks5`,
},
{
prizeName: `奖品名称6`,
prizeImg: `//yun.duiba.com.cn/polaris/xx.e2f6a49a2954673d16d956d7b3bba25c2b6c667e.png`,
prizeId: `thanks6`,
},
{
prizeName: `奖品名称7`,
prizeImg: `//yun.duiba.com.cn/polaris/xx.e2f6a49a2954673d16d956d7b3bba25c2b6c667e.png`,
prizeId: `thanks7`,
},
{
prizeName: `谢谢参与`,
prizeImg: `https://yun.duiba.com.cn/spark/assets/f77861647e7b55e9c95e9c49d891a21526157a76.jpg`,
prizeId: `thanks`,
},
]
}
},
"GET /draw/doDraw.do": {
"code": null,
"data": {
"prizeId": 1,
"productInfos": {
"productId": "1",
"productInfos": [{
"productImg": "//yun.duiba.com.cn/polaris/1.7e95eb40b81b5b15997565f27d7ba22283010265.png",
"productText": "养老专属年龄广,裕享岁月财富长,三五交费投入短,保障期间随心选。"
}, {
"productImg": "//yun.duiba.com.cn/polaris/%E7%BB%84%2093704.1121f8d0e44dee56fbe1d8aa8cabad8312036c55.png",
"productText": "养老年金固定领,满期给付有保障,搭配万能好运作,岁岁丰裕金满堂。"
}]
}
},
"message": null,
"success": true,
"timeStamp": 1739176246085
},
};
\ No newline at end of file
const fs = require('fs')
let proxy = {}
fs.readdirSync(__dirname)
.some(filename => {
if (filename !== 'index.js') {
proxy = Object.assign(proxy, require('./' + filename))
}
})
module.exports = proxy;
module.exports = {
"GET /inviteAssist_1/index.do": {
code: null,
data: {
inviteUser: [],
maxRedNum: 666,
prizeVo: [
{
prizeId: "od74b603d",
prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
prizeName: "cs测试优惠券奖品6",
},
{
prizeId: "od74b603d",
prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
prizeName: "cs测试优惠券奖品6",
},
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
// {
// prizeId: "od74b603d",
// prizeImg: "//yun.dui88.com/images/202312/sg4xhsdksl.png",
// prizeName: "cs测试优惠券奖品6",
// },
],
},
message: null,
success: true,
timeStamp: 1735365189825,
},
"POST /inviteAssist_1/getInviteCode.do": {
code: -13246634.7225824,
message: "fugiat irure aliqua",
success: true,
data: {
dueTime: null,
extra: null,
inviteCode: "4KSYU0",
timestamp: 1673491076505,
},
},
"POST /inviteAssist_1/doAssist.do": {
code: "200304",
data: null,
message: "不能为自己助力",
success: false,
timeStamp: 1735356528944,
},
"GET /inviteAssist_1/draw.do": {
data: {
prizeVO: {
prizeId: "adipisicing",
prizeImg: "https://yun.dui88.com/images/202203/unet6gpw1c.jpeg",
prizeName: "ut dolor",
},
},
success: true,
code: null,
message: null,
},
};
\ No newline at end of file
module.exports = {
"GET /works/beThumbsRecords.do": {
"success": true,
"message": "报错了~",
"code": null,
timeStamp: Date.now(),
"data": {
totalCount: 128, // 记录总数
totalPage: 7, // 总页数
list: new Array(20).fill("").map((v, i) => {
return {
changeNum: i + 1, // 变更数量
changeDesc: `132****930${i}`, // 点赞用户昵称,托敏
changeType: i % 2, // 变更类型 1-加 2-减
time: Date.now() - 2 * 24 * 60 * 60 * 1000, // 变更时间,13位时间戳
}
}),
}
},
"GET /works/myThumbsRecords.do": {
"success": true,
"message": "报错了~",
"code": null,
timeStamp: Date.now(),
"data": {
totalCount: 128, // 记录总数
totalPage: 2, // 总页数
list: new Array(20).fill("").map((v, i) => {
return {
changeNum: i + 1, // 变更数量
changeDesc: i == 0 ? '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈' : `作品编号00000000000${i}`, // 点赞用户昵称,托敏
changeType: i % 2, // 变更类型 1-加 2-减
time: Date.now() - 2 * 24 * 60 * 60 * 1000, // 变更时间,13位时间戳
}
}),
}
},
}
\ No newline at end of file
module.exports = {
"GET /works/workDetail.do": {
"code": null,
"data": {
"remainThumbsTimes": 1,
"salesmanFlag": false,
"worksInfo": {
"meFlag": false,
"rank": 1,
"sex": "1",
"thumbsNum": 13,
"worksDesc": "作品描述01",
"worksImg": "https://yun.duiba.com.cn/upload/20250211/b4a78707.png",
"worksNum": "tkh2urj38i",
"worksTitle": "作品标题"
}
},
"message": null,
"success": true,
"timeStamp": 1738999317142
},
"GET /works/thumbsUp.do": {
"code": null,
"data": {
awardDrawTimes: 1
},
"message": 'null',
"success": true,
"timeStamp": 1738999317142
},
"GET /works/commentRecords.do": {
"code": null,
"data": {
"list": [
{
"avatar": null,
"content": "评论3",
"nickname": "157****1111",
"time": 1739005224000
},
{
"avatar": null,
"content": "霸王差距",
"nickname": "157****3681",
"time": 1737772863000
},
{
"avatar": null,
"content": "茶百道",
"nickname": "157****3681",
"time": 1737772853000
},
{
"avatar": null,
"content": "蜜雪冰城甜蜜蜜",
"nickname": "157****3681",
"time": 1737772844000
},
{
"avatar": null,
"content": "你为什么不喝",
"nickname": "4012516130575933",
"time": 1737772507000
},
{
"avatar": null,
"content": "他奶奶的",
"nickname": "4012516130575933",
"time": 1737772498000
},
{
"avatar": null,
"content": "他妈",
"nickname": "4012516130575933",
"time": 1737772488000
}
],
"totalCount": 7,
"totalPage": 1
},
"message": null,
"success": true,
"timeStamp": 1739005828760
}
}
\ No newline at end of file
This diff is collapsed.
module.exports = {
"GET /inviteAssist_1/outside.do": {
"success": true,
"code": "",
"message": "",
"data": {
"actStartTimestamp": 1704038400000,
"actEndTimestamp": 1735660799000,
"currentTimestamp": 1718613524280,
"uid": "15812345678",
"validUid": false,
"boundYkCode": "xxx",
"cardPrizeName": "10元京东卡"
}
}
}
\ No newline at end of file
module.exports = {
"GET /task_1/queryTasks.do": {
code: null,
data: {
endTimestamp: 1780196578000,
item: [
{
buttonText: "去完成",
code: "browse_zeng_yuan_1",
completedSize: 1,
desc: null,
extra: '{"answerTimes":0,"drawTimes":0}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "0l0cha7n",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 4,
jumpUrl: "//yun.duiba.com.cn/aurora/assets/27f733e7771780689de2169ed291cad18feeab42.png",
options: [
{
degree: null,
icon: null,
icon2: null,
id: "sp_draw_times",
index: null,
name: "完成任务发放答题次数占位道具",
prizeId: "sp_draw_times",
prizeType: null,
refId: null,
refType: null,
sendCount: 1,
},
],
playwayId: "customTask1",
prizePendingCode: "",
prizePendingCodeList: [{ code: "", index: 1 }],
ruleId: "spPrize@sp_draw_times@1",
sendPrize: true,
subTitle: "抽奖次数+1抽奖次数+1抽奖次数+1",
taskStatus: 0,
title: "邀请任务",
},
{
buttonText: "去完成",
code: "bt_3_1",
completedSize: 1,
desc: null,
extra: '{"answerTimes":0,"drawTimes":0}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "sc2o1emu",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 4,
jumpUrl: "https://doublerecording-prd-new.obs.cn-south-1.myhuaweicloud.com/bigCorse/%E6%B6%88%E4%BF%9D%E6%B4%BB%E5%8A%A8/VIP%E6%9C%8D%E5%8A%A1%E5%AE%A3%E4%BC%A0/2024%E5%B9%B4VIP%E6%9C%8D%E5%8A%A1%E5%AE%A3%E4%BC%A0%E8%A7%86%E9%A2%91%EF%BC%88%E5%B0%8F%E6%A0%BC%E5%BC%8F%EF%BC%89.mp4",
options: [
{
degree: null,
icon: null,
icon2: null,
id: "sp_draw_times",
index: null,
name: "完成任务发放答题次数占位道具",
prizeId: "sp_draw_times",
prizeType: null,
refId: null,
refType: null,
sendCount: 1,
},
],
playwayId: "customTask1",
prizePendingCode: "",
prizePendingCodeList: [{ code: "", index: 1 }],
ruleId: "spPrize@sp_draw_times@1",
sendPrize: true,
subTitle: "抽奖次数+1",
taskStatus: 0,
title: "看视频15s",
},
{
buttonText: "去完成",
code: "common_answer",
completedSize: 0,
desc: null,
extra: '{"taskCode":"task_third_1_asset_growth_1","answerTimes":1,"drawTimes":0,"gear":1}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "abwha4qz",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 3,
jumpUrl: "appjumpurl$$$ykjumpurl$$$otherjumpurl",
options: null,
playwayId: "customTask1",
prizePendingCode: null,
prizePendingCodeList: null,
ruleId: "spPrize@undefined@undefined",
sendPrize: null,
subTitle: "抽奖次数+1",
taskStatus: 1,
title: "答题任务",
},
{
buttonText: "去完成",
code: "common_sign",
completedSize: 0,
desc: null,
extra: '{"taskCode":"task_third_1_asset_growth_1","answerTimes":1,"drawTimes":0,"gear":1}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "abwha4qz",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 3,
jumpUrl: "appjumpurl$$$ykjumpurl$$$otherjumpurl",
options: null,
playwayId: "customTask1",
prizePendingCode: null,
prizePendingCodeList: null,
ruleId: "spPrize@undefined@undefined",
sendPrize: null,
subTitle: "抽奖次数+1",
taskStatus: 0,
title: "签到任务",
},
{
buttonText: "去完成",
code: "common_sign",
completedSize: 0,
desc: null,
extra: '{"taskCode":"task_third_1_asset_growth_1","answerTimes":1,"drawTimes":0,"gear":1}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "abwha4qz",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 3,
jumpUrl: "appjumpurl$$$ykjumpurl$$$otherjumpurl",
options: null,
playwayId: "customTask1",
prizePendingCode: null,
prizePendingCodeList: null,
ruleId: "spPrize@undefined@undefined",
sendPrize: null,
subTitle: "抽奖次数+1",
taskStatus: 1,
title: "签到任务",
},
{
buttonText: "去完成",
code: "common_sign",
completedSize: 0,
desc: null,
extra: '{"taskCode":"task_third_1_asset_growth_1","answerTimes":1,"drawTimes":0,"gear":1}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "abwha4qz",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 3,
jumpUrl: "appjumpurl$$$ykjumpurl$$$otherjumpurl",
options: null,
playwayId: "customTask1",
prizePendingCode: null,
prizePendingCodeList: null,
ruleId: "spPrize@undefined@undefined",
sendPrize: null,
subTitle: "抽奖次数+1",
taskStatus: 2,
title: "签到任务",
},
],
startTimestamp: 1713841378000,
timestamp: 1714284614182,
},
message: null,
success: true,
timeStamp: 1714284614467,
},
"POST /task_1/sendPrize.do": {
code: null,
data: {
extra: "1",
options: [
{
optionId: "officia",
optionImg: "id ipsum",
optionName: "nulla cupidatat",
position: 63597682.59836808,
prizeId: "incididunt",
prizeType: -3079265.394056648,
ruleId: "reprehenderit aute deserunt",
url: "sunt",
sendCount: 3,
},
{
optionId: "esse ut laboris dolor reprehenderit",
optionImg: "anim ut",
optionName: "occaecat tempor aliquip amet",
position: -93793131.65854914,
prizeId: "in enim Ut anim",
prizeType: -83505282.2731905,
ruleId: "incididunt et",
url: "ipsum eu laborum nostrud",
sendCount: 3,
},
{
optionId: "dolor do in et consectetur",
optionImg: "laborum Excepteur sit",
optionName: "irure officia eiusmod",
position: 62914584.39450729,
prizeId: "nostrud nisi et ipsum",
prizeType: -87226701.41384046,
ruleId: "in labore reprehenderit Duis est",
url: "pariatur sit",
sendCount: 3,
},
{
optionId: "irure in reprehenderit sed",
optionImg: "reprehenderit",
optionName: "fugiat",
position: 86398415.66680664,
prizeId: "dolor elit adipisicing",
prizeType: -51881234.24195088,
ruleId: "minim occaecat",
url: "enim eiusmod",
sendCount: 3,
},
],
},
message: null,
success: true,
},
"POST /task_1/finishTask.do": {
"data": {
"timestamp": -35003075.452821575,
"sendPrize": true,
"icon": "qui nisi amet magna",
"desc": "dolore voluptate",
"code": "browser_insurance_C",
"id": "nulla elit exercitation ea", // 任务id
"buttonText": "voluptate tempor",
"extra": "elit sit sunt laboris",
"options": [
{
"url": "in non",
"optionId": "dolore",
"sendCount": "id anim",
"index": 57723729.46539241,
"ruleId": "dolore",
"prizeId": "dolore laborum",
"optionName": "elit sed culpa adipisicing",
"optionImg": "quis",
"prizeType": -87661811
}
]
},
"success": true,
"code": null,
"message": null
},
};
This diff is collapsed.
{
"name": "temp_base",
"version": "3.6.8",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development node ./config/scripts/assets/generateAssetList.js && node ./config/webpack.dev.config.js",
"imgmin": "node ./config/scripts/assets/index.js imgmin",
"imgup": "node ./config/scripts/assets/index.js imgup",
"imgminup": "node ./config/scripts/assets/index.js imgmin imgup",
"spark:prebuild": "ncu @spark/pre-build -u && yarn && npx pre-build",
"lint": "eslint --ext .js,jsx,.html src public",
"prod": "rimraf ./dist &&cross-env NODE_ENV=production node ./config/webpack.prod.config.js",
"build": "rimraf ./dist &&cross-env NODE_ENV=production node ./config/scripts/assets/generateAssetList.js && node ./config/scripts/assets/index.js imgmin imgup && node ./config/webpack.prod.config.js"
},
"dependencies": {
"@spark/api-base": "^2.0.7",
"@spark/circle-turntable": "^1.0.3",
"@spark/dbdomain": "^1.0.25",
"@spark/share": "^2.0.340",
"@spark/svgaplayer": "^2.0.5",
"@spark/ui": "^2.0.8",
"@spark/utils": "^2.0.17",
"antd-mobile": "^5.38.1",
"classnames": "^2.5.1",
"crypto-js": "^4.2.0",
"dplayer": "^1.27.1",
"duiba-utils": "^1.0.2",
"history": "^4.10.1",
"javascript-obfuscator": "^4.1.0",
"mobx": "^6.2.0",
"mobx-react": "^7.1.0",
"qrcode": "^1.5.4",
"qs": "^6.9.4",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"sa-sdk-javascript": "^1.27.2",
"spark-utils": "^0.0.12",
"swiper": "8.3.2",
"terser-webpack-plugin": "4.2.3"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/eslint-parser": "^7.17.0",
"@babel/plugin-proposal-decorators": "^7.13.15",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10",
"@spark/eslint-plugin-best-practices": "^0.0.1-beta.2",
"@spark/eslint-plugin-security": "^0.0.1-beta.5",
"@spark/pre-build": "^0.0.1-beta.11",
"@types/crypto-js": "^4.2.2",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.2.2",
"chalk": "^4.1.0",
"clean-webpack-plugin": "^3.0.0",
"commander": "^11.1.0",
"cross-env": "^7.0.3",
"css-loader": "^3.6.0",
"eslint": "^8.22.0",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-react": "^7.29.4",
"fs-extra": "^9.0.1",
"html-webpack-plugin": "^4.5.1",
"less": "^4.1.0",
"less-loader": "^7.2.1",
"mini-css-extract-plugin": "^1.3.4",
"mocker-api": "^2.7.5",
"npm-check-updates": "^12.5.4",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"postcss-loader": "^3.0.0",
"postcss-px2rem-exclude": "0.0.6",
"prettier": "^2.0.5",
"progress-bar-webpack-plugin": "^2.1.0",
"rimraf": "^3.0.2",
"script-ext-html-webpack-plugin": "^2.1.5",
"spark-assets": "^2.6.5",
"spark-log-event": "^1.0.4",
"style-loader": "^1.2.1",
"url-loader": "^4.1.1",
"webpack": "^4.43.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.3.1",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2"
}
}
{"proSetting":{"projectxIDs":{"testId":[{"label":"test","value":"pe2caadcd"}],"prodId":[{"label":"test","value":"pb74a3aec"},{"label":"prod","value":"p7925c40f"}]},"skinVariables":[],"mockSetting":{"projectId":"","pageId":""}},"envSetting":{},"psdSetting":{"psdFSSetting":true,"psdCenterSetting":true}}
<!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">
<link rel="dns-prefetch" href="//yun.duiba.com.cn" />
<link rel="preconnect" href="//embedlog.duiba.com.cn">
<title>闪亮瞬间</title>
<script type="text/javascript">
if (localStorage && localStorage.isWebp) {
document
.getElementsByTagName('html')[0]
.setAttribute('duiba-webp', 'true');
}
</script>
<script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="//yun.duiba.com.cn/spark/v2/spark.base.fz.wxpollyfill.js"></script>
<script src="//yun.duiba.com.cn/js-libs/rem/1.1.3/rem.min.js"></script>
<script src="//yun.duiba.com.cn/h5/lib/zepto.min.js"></script>
<script src="https://m.picclife.cn/Life-H5/html/clause/PICCLifeJsBrage.js"></script>
<script>
var CFG = CFG || {};
CFG.projectId = location.pathname.split('/')[2] || '1';
function getUrlParam(name) {
var search = window.location.search;
var matched = search
.slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
return search.length ? matched && matched[2] : null;
}
CFG.operationId = '6130'
CFG.appID = "${APPID}";
CFG.domain = location.origin;
// 首页
CFG.indexUrl = "/projectx/" + CFG.projectId + "/index.html?appID=" + getUrlParam("appID");
// 普通分享落地页
CFG.shareUrl = "/projectx/" + CFG.projectId + "/sharepage.html?appID=" + getUrlParam("appID");
// CFG.shareUrl = '/projectx/' + CFG.projectId + '/share.html?appKey=4AoRyTuR6XNfjNa4w5exe1bPmqDS&openBs=openbs&appID=' + CFG.appID;
// 普通分享落地页
// CFG.fireShareUrl = "/projectx/" + CFG.projectId + "/firesharepage.html?appID=" + getUrlParam("appID");
// 我的奖品页
CFG.prizeUrl = "/projectx/" + CFG.projectId + "/prize.html?appID=" + getUrlParam("appID");
// 作品详情页
CFG.workPage = "/projectx/" + CFG.projectId + "/workPage.html?appID=" + getUrlParam("appID");
//actPlatforms
CFG.actPlatforms = getUrlParam("actPlatforms") || "";
//actPlatforms
CFG.agentCode = getUrlParam("agentCode") || "";
//actPlatforms
CFG.actId = getUrlParam("actId") || "";
// 特殊的业务员code
CFG.spcCode = getUrlParam("code") || "";
// 业务员code
CFG.workerCode = getUrlParam("ykCode") || CFG.spcCode;
// 渠道 1-9
CFG.channel = getUrlParam("channel") || "2";
// 默认渠道 除了友客渠道,其他统一按照2处理
// CFG.defaultChannel = CFG.channel == 5 ? 5 : CFG.channel == 3 ? 3 : 2;
CFG.defaultChannel = CFG.channel || "2";
// 助力参数
CFG.inviteCode = getUrlParam("inviteCode");
// 微信授权链接
CFG.indexLogin = "/wechat/access?apk=4AoRyTuR6XNfjNa4w5exe1bPmqDS&dbredirect=";
// 奖品页唤端链接
CFG.toAppPrizeUrl =
"https://lifeapp.picclife.cn/portal/app_manager/downloadapps.html?operate_link=https%3A%2F%2Flifeapp-api.picclife.cn%2Flifeapi%2Flifeapp-svc-gw%2Fapi%2Fauth_code%2Fauthorize%2Fv1%3Factivity_code%3D612102%26redirect_type%3D0%26redirect_uri%3Dhttps%3A%2F%2F96094.activity-19.m.duiba.com.cn%2FcustomShare%2Fshare%3Fid%3DDid1NTgxOTk&isBindManager=1&isNeedAuth=1";
CFG.sensorUrl = "https://mdglfxpt.piccgroup.cn:18443/sa?project=picclife_consumer";
//代理人仅分享渠道
CFG.agentShare = getUrlParam("agentShare") || 0;
// 环境,test测试,prod生产 todo
CFG.env = "prod"; //注意sdk 也分环境!
if (CFG.env == "test") {
// 测试
// eslint-disable-next-line @spark/best-practices/no-url-in-js
CFG.sensorUrl = "https://mdglfxpt-test.piccgroup.cn:18443/sa?project=picclife_consumer";
CFG.toAppPrizeUrl =
"https://lifeapp-test.picclife.cn/portal-web/app_manager/downloadapps.html?operate_link=https%3A%2F%2Flifeapp-api-test.picclife.cn%2Flifeapi%2Flifeapp-svc-rel-gw%2Fapi%2Fauth_code%2Fauthorize%2Fv1%3Factivity_code%3D612102%26redirect_type%3D0%26redirect_uri%3Dhttps%253A%252F%252F96094.activity-19.m.duiba.com.cn%252FcustomShare%252Fshare%253Fid%253DDid1NTgxNTE&isBindManager=1&isNeedAuth=1";
}
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`.
-->
</body>
</html>
\ No newline at end of file
{"proName":"20250122_RBShine","proDesc":"","proPath":"/Users/duibagroup/Documents/Duiba/人保-闪亮瞬间/20250122_RBShine","createTime":1737539929733}
module.exports ={
"OUTPUT_DIR": "dist",
"SOURCE_DIR": "src",
"TEMP_DIR": "./.temp",
"ENTRY": "src/app.jsx",
"TEMPLATE": "./public/index.html",
"API_MOCK": true,
"PX2REM": true,
"IMAGE_Q1": 0.6,
"IMAGE_Q2": 0.8,
"RES_PATH": "/src/assets/",
"RES_PATH_PROD": "//yun.duiba.com.cn/spark/v2/temp_base/1740713467902",
"JS_PATH_PROD": "https://yun.duiba.com.cn/spark/v2/temp_base/1740761360988/js"
}
\ No newline at end of file
{"assetsPathArr":["//yun.duiba.com.cn/spark/v2/temp_base/1678169645525/loadingDemo/上面.png","//yun.duiba.com.cn/spark/v2/temp_base/1678169645525/loadingDemo/底部173.png","//yun.duiba.com.cn/spark/v2/temp_base/1678169645525/loadingDemo/背景.jpg"]}
\ No newline at end of file
import API from "@src/api";
import {
setCookieId
} from "@src/api/utils";
/**
* 普通跳转客服
* 注意:小程序需要额外增加业务域名 https://duiba.qiyukf.com/
*/
export function jumpService() {
location.href = location.origin + '/faq/index'
}
export function appJump(url, hideNavbar = false, data = {}) {
API.tempSaveCookie().then((res) => {
if (res?.data) {
localStorage.setItem("db_temp_cookie", res.data);
// setCookieId(res.data);
}
}).finally(() => {
// app对应跳转方法
window.MarsJSBridge.invoke("pushPage", {
uri: url,
data,
pageParams: {
hideNavbar,
}
});
});
}
import { generateAPI } from "./utils.js";
const API = generateAPI({
/** 获取活动规则 */
getRule: "projectRule.query",
/** 获取前端配置项 */
getFrontVariable: "coop_frontVariable.query",
/** 参与接口 post请求 */
doJoin: {
uri: "join.do",
method: "post"
},
/** 签到 */
doSign: {
uri: "checkin_1/doSign.do",
withToken: true, // 携带token
},
// cookie丢失-临时保存cookie
tempSaveCookie: {
uri: "/autoLogin/tempSaveCookie",
showMsg: false,
},
// cookie丢失-重新设置cookie
resetCookie: "/autoLogin/resetCookie",
userLogin: {
uri: "userLogin.check",
showMsg: false,
},
buriedPoint: {
uri: "home/buriedPoint.do",
showMsg: false,
},
/** 获取任务列表 */
getTaskInfo: {
uri: "task_1/queryTasks.do",
},
/** 完成任务 */
doCompleted: {
uri: "task_1/doCompleted.do",
method: "post",
withToken: true,
},
/** 领取奖励 */
sendPrize: {
uri: "task_1/sendPrize.do",
method: "post",
withToken: true,
},
/** 绑定友客业务员信息接口 */
bindYk: {
uri: "agent/bindYk.do",
method: "post",
showMsg: false,
},
/** 生成唤端二维码 */
getLongLinkQrcode: `/customActivity/qrcode/getQrcode`,
// /** 获取邀请码 */
// getInviteCode: {
// uri: "customInvite1/getInviteCode.do",
// method: "post",
// withToken: true,
// },
// /** 助力 */
// doAssist: {
// uri: "customInvite1/doAssist.do",
// method: "post",
// withToken: true,
// showMsg: false,
// },
/** 落地页 */
coop_getLoadingInfo: "customInvite1/outside.do",
/** 获取地区 */
getParentCode: "/gaw/address/getChildrenByParentCode",
/** 抽奖首页 */
drawIndex: "draw/index.do",
/** 抽奖 */
drawJoin: {
uri: "draw/doDraw.do",
withToken: true,
},
/** 被点赞记录 */
beThumbsRecords: "works/beThumbsRecords.do",
/** 我的点赞记录 */
myThumbsRecords: "works/myThumbsRecords.do",
/** 校验验证码并登录 */
coopCheckCode: {
uri: "examine/coop_checkCode.do",
method: "post",
},
getCode: {
uri: "/customActivity/piccLife/sendSmsCode",
// showMsg: false,
},
/** 发送验证码 */
coopSendCode: {
uri: "examine/coop_sendCode.do",
method: "post",
},
/** 校验是否绑定手机号 */
checkBind: "/customActivity/piccLife/check",
/** 奖品页 */
prize: "/crecord/getrecordmn",
/** 助力 */
doAssist: {
uri: "inviteAssist_1/doAssist.do",
method: "post",
withToken: true,
// showMsg: false,
},
/** 获取邀请码 */
getInviteCode: {
uri: "inviteAssist_1/getInviteCode.do",
method: "post",
withToken: true,
},
/** 保存/修改作品信息*/
saveOrUpdateWork: {
uri: "works/saveOrUpdateWork.do",
method: "post",
contentType: "json",
headers: {
"Content-Type": "application/json",
},
},
/** 上传图片 */
uploadImg: {
uri: "/customActivity/duiba/imgUploadUrl",
method: "post",
contentType: "json",
},
/** 业务员首页*/
salesManIndex: {
uri: "works/index.do",
showMsg: false,
},
/** 审核玩法-审核首页*/
examineIndex: {
uri: "examine/examineIndex.do",
method: "post",
},
/** 同意隐私协议接口*/
lockAgree: {
uri: "works/lockAgree.do",
},
/** 投稿玩法-作品排行榜*/
productSearch: {
uri: "works/productSearch.do",
},
// 投稿玩法-作品详情
workDetail: 'works/workDetail.do',
// 投稿玩法-作品评论记录
commentRecords: 'works/commentRecords.do',
// 投稿玩法-作品评论
comment: {
uri: "works/comment.do",
method: "post",
contentType:"json",
},
// 投稿玩法-作品点赞
thumbsUp: {
uri: 'works/thumbsUp.do',
withToken: true,
},
/** 同意隐私协议接口 */
agreePrivacy: {
uri: "game/agreePrivacy.do",
withToken: true,
method: "post",
},
// 推送使用
outside: `inviteAssist_1/outside.do`,
bindPhone: {
uri: "/customActivity/piccLife/bindWithCode",
method: "post",
showMsg: false,
},
/** 业务员抽奖接口 */
salesManDraw: {
uri: "works/draw.do",
withToken: true,
}
});
// console.log('======', API)
export default API;
declare type Methods = 'get' | 'post';
declare interface APIArguments {
uri: string,
method?: Methods | Uppercase<Methods>,
headers?: any
withToken?: boolean
secret?: string,
secretKey?: string,
contentType?: string,
showMsg?:boolean,
showLoading?: boolean;
}
declare type APIConfig = APIArguments | string
declare interface GenerateAPIParams {
[key: string]: APIConfig
}
declare type RequestParamType = Record<string, any>
declare interface ResponseType<T = any> {
code: number,
success: boolean,
message: string,
data: T
}
export declare function generateAPI<
T extends GenerateAPIParams = GenerateAPIParams,
P = RequestParamType,
Q = ResponseType>
(apiList: T): {
[key in keyof T]: (args?: P) => Promise<Q>
}
import { callApi } from '@spark/api-base'
import { Loading, Toast } from '@spark/ui'
import { isFromShare, newUser } from 'duiba-utils';
import { errorHandler } from "@src/utils/errorHandler";
import API from "@src/api/index";
import { getPxToken } from "@src/built-in/getPxToken";
const mergeData = {
user_type: newUser ? '0' : '1',
is_from_share: isFromShare ? '0' : '1',
from: CFG.channel,
actPlatforms: CFG.actPlatforms || "",
agentCode: CFG.agentCode || "",
actId: CFG.actId || "",
}
// let tempCookieId = "";
//
// export function setCookieId(cookieId) {
// tempCookieId = cookieId;
// }
export function resetBackCookie(duibaTempCookieId) {
return new Promise((resolve) => {
callApi("/autoLogin/resetCookie", {
duibaTempCookieId
}).then((resp) => {
return resolve('success');
}, (e) => {
return resolve(e);
});
});
}
/**
* 请求方法get、post处理
* @param {*} value
* @returns
*/
function getRequestParams(value) {
if (typeof value === 'string') {
return {
uri: value,
method: 'get'
}
} else if (typeof value === 'object') {
const { uri, method = 'get', showMsg = true, showLoading = false, headers, withToken, secret, secretKey, contentType = 'form' } = value;
return {
uri,
method,
headers,
withToken,
secret,
secretKey,
contentType,
showLoading,
showMsg
}
} else {
console.error('getRequestParams: 传参有误');
}
}
/**
* 请求API通用处理
* @param {*} value
* @returns
*/
export function generateAPI(apiList) {
const api = {};
for (const key in apiList) {
const value = apiList[key];
const { method, uri, headers: mHeaders, withToken, secret, secretKey, contentType, showLoading, showMsg = true } = getRequestParams(value);
api[key] = async (params = {}, headers) => {
// cookie丢失的问题
// 如遇跳转Cookie丢失,打开如下代码
// const duibaTempCookieId = localStorage.getItem("db_temp_cookie");
// // const duibaTempCookieId = tempCookieId;
//
// if (duibaTempCookieId) {
// localStorage.removeItem("db_temp_cookie");
// // tempCookieId = "";
//
// const res = await API.userLogin()
// .catch(async () => {
// await resetBackCookie(duibaTempCookieId);
// });
//
// if (!res || !res.success) {
// await resetBackCookie(duibaTempCookieId);
// }
// }
// 根据接口配置showLoading展示loading
// 600ms内结束的请求不显示loading,避免闪烁
let query = false;
showLoading && setTimeout(() => {
if (!query) {
Loading.show();
}
}, 600);
let token;
if (withToken) { // 是否携带token
try {
token = await getPxToken(); // 获取token
} catch (e) {
Toast('网络异常,请稍后再试~');
query = true;
showLoading && Loading.hide();// 根据接口配置showLoading关闭loading
return ({ success: false, data: '' });
}
}
const mergedHeaders = { ...mHeaders, ...headers }
if (withToken && token) {
params.token = token;
}
params = { ...params, ...mergeData };
const result = await callApi(uri, params, method, mergedHeaders, false, secret, secretKey, contentType)
.catch(e => {
query = true;
// 捕获网络异常
showMsg && Toast(e.message || '网络异常,请稍后再试~');
showLoading && Loading.hide();
});
query = true;
showLoading && Loading.hide();// 根据接口配置showLoading关闭loading
return new Promise((resolve) => {
if (result) {
// 判断接口错误
if (!result.success && showMsg) {
errorHandler(result);
}
// 返回整个结果
resolve(result);
} else {
resolve({ success: false, data: '' });
}
})
}
}
return api;
}
/**
* 活动主入口
*/
import React, { Component } from "react";
import ReactDOM from "react-dom";
import { observer } from "mobx-react";
import "./app.less";
import store from "./store/index";
import Modal from "./modal/modal";
import "./utils/checkwebp"; // webp检查
import MD from "../MD"; // 埋点
MD();
// 此处为spark-cli动态生成
import LoadingDemo from "@src/pages/LoadingDemo/LoadingDemo";
import HomeDemo from "@src/pages/HomeDemo/HomeDemo";
import { PAGE_MAP } from "./utils/constants";
import SaleManPage from "@src/pages/SaleManPage/SaleManPage";
import Likelogpage from "./pages/likelogpage/likelogpage";
import Drawpage from "./pages/drawpage/drawpage";
import Sharepage from "./pages/sharepage/sharepage";
import AgentSharepage from "./pages/agentSharepage/sharepage";
import Prizepage from "./pages/prizepage/prizepage";
import Userhomepage from "./pages/userhomepage/userhomepage";
import Opuspage from "./pages/opuspage/opuspage";
import shareStore from "./store/share";
import { isWeChat, onInitShare, onUpdateShare } from "./utils/share";
import { isMiniprogram } from "./utils/utils";
import { domain, ensureDomain } from "@spark/dbdomain";
/**
* 所有页面场景
*/
const pageMap = {
[PAGE_MAP.LOADING_PAGE]: <LoadingDemo />,
[PAGE_MAP.HOME_PAGE]: <HomeDemo />,
[PAGE_MAP.SALE_PAGE]: <SaleManPage />,
[PAGE_MAP.SHARE_PAGE]: <Sharepage />,
[PAGE_MAP.AGENT_SHARE_PAGE]: <AgentSharepage />,
[PAGE_MAP.LIKE_LOG_PAGE]: <Likelogpage />,
[PAGE_MAP.DRAW_PAGE]: <Drawpage />,
[PAGE_MAP.PRIZE_PAGE]: <Prizepage />,
[PAGE_MAP.USER_HOME_PAGE]: <Userhomepage />,
[PAGE_MAP.OPUS_PAGE]: <Opuspage />
};
@observer
class App extends Component {
async componentDidMount() {
// 获取前端开发配置,依据项目需要,酌情添加 !!!
await store.getFrontVariable();
await onInitShare();
// 获取动态域名
await ensureDomain();
CFG.domain = domain;
if (isMiniprogram()) {
//小程序域名写死
CFG.domain = "https://96094.activity-24.m.duiba.com.cn";
}
console.info("分享默认渠道===", CFG.workerCode);
if (store.curPage != PAGE_MAP.SHARE_PAGE ) {
// 首页
// 初始化分享
let shareUrl = `${CFG.domain}${CFG.shareUrl}`;
shareUrl += `&ykCode=${CFG.workerCode || CFG.agentCode || ""}`;
shareUrl += `&channel=${CFG.defaultChannel}&agentCode=${CFG.agentCode || ""}&actPlatforms=${CFG.actPlatforms || ""
}&actId=${CFG.actId || ""}`;
onUpdateShare({
...JSON.parse(store.frontVariable.shareInfo),
url: `${CFG.domain}${CFG.indexLogin}${encodeURIComponent(shareUrl)}`,
});
} else if (store.curPage == PAGE_MAP.SHARE_PAGE) {
let shareUrl = `${CFG.domain}${CFG.shareUrl}${getUrlParam("inviteCode") ? "&inviteCode=" + getUrlParam("inviteCode") : ""
}${getUrlParam("worksNum") ? "&worksNum=" + getUrlParam("worksNum") : ""
}`;
shareUrl += `&ykCode=${CFG.workerCode || CFG.agentCode || ""}`;
if (CFG.channel)
shareUrl += `&channel=${CFG.defaultChannel}&agentCode=${CFG.agentCode || ""}&actPlatforms=${CFG.actPlatforms || ""
}&actId=${CFG.actId || ""}`;
let _shareInfo = JSON.parse(store.frontVariable.shareInfo);
if(getUrlParam("worksNum")) {
_shareInfo = JSON.parse(store.frontVariable.shareInfoZan);
} else if(getUrlParam("inviteCode")) {
_shareInfo = JSON.parse(store.frontVariable.shareInfoInvite);
}
onUpdateShare({
..._shareInfo,
url: `${CFG.domain}${CFG.indexLogin}${encodeURIComponent(shareUrl)}`,
});
}
}
render() {
const { curPage, pageData } = store;
return (
<>
{{ ...pageMap[curPage], props: { ...pageData } }}
<Modal />
</>
);
}
}
ReactDOM.render(<App />, document.getElementById("root"));
* {
margin: 0;
padding: 0;
-webkit-touch-callout: none; /*系统默认菜单被禁用*/
-khtml-user-select: none; /*早期浏览器*/
-moz-user-select: none; /*火狐*/
-ms-user-select: none; /*IE10*/
-webkit-tap-highlight-color: transparent;
user-select: text;
-webkit-user-select: text;
}
*:not(input,textarea) {
-webkit-touch-callout: none;
-webkit-user-select: none;
}
html,
body {
font-size: 24px;
width: 100%;
height: 100%;
-webkit-text-size-adjust: 100% !important;
text-size-adjust: 100% !important;
-moz-text-size-adjust: 100% !important;
overflow: hidden;
}
.modal_center {
left: 0 !important;
top: 0 !important;
bottom: 0 !important;
right: 0 !important;
margin: auto;
}
#root {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
.com_Container {
width: 100%;
height: 100%;
position: relative;
overflow-x: hidden;
overflow-y: auto;
}
.line() {
white-space: nowrap; /* 不换行 */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis; /* 使用省略号表示超出的文本 */
}
\ No newline at end of file
{"preLoadImg":[],"asyncLoadImg":["CodePop/bg.png","CodePop/code.png","commentPop/bg.png","commentPop/btn.png","commentPop/close.png","common/back.png","common/closeBtn.png","common/happyBtn.png","common/light.png","ConfirmPop/bg.png","ConfirmPop/cancel.png","ConfirmPop/confirm.png","drawChancePop/bg.png","drawChancePop/know_btn.png","drawChancePop/light.png","drawPage/bg.png","drawPage/cover.png","drawPage/draw_btn.png","drawPage/logo.png","drawPage/pointer.png","drawPage/prize_btn.png","drawPage/prize_info_bg.png","drawPage/prize_info_laba.png","drawPage/rule_btn.png","drawPage/title.png","drawPage/turantable_bg.png","drawPage/turantable_box.png","FillAddress/填写收货地址.png","FillAddress/提交信息按钮-不可点击.png","FillAddress/提交信息按钮-可点击.png","FillAddress/直线.png","FillAddress/返回按钮.png","FillAddress/选择按钮.png","GuidePop/bg.png","GuidePop/btn.png","GuidePop/card.png","GuidePop/ip.png","GuidePop/ip2.png","GuidePop/light.png","GuidePop/prize.png","GuidePop/title.png","GuidePop/upload.png","likeLogPage/back.png","likeLogPage/bg.png","likeLogPage/item_line.png","likeLogPage/list_bg.png","likeLogPage/title.png","LoadingPage/loadingBg.jpg","LoadingPage/loadingFill.png","LoadingPage/loadingIp.png","LoginPop/bg.png","LoginPop/cannotSubmit.png","LoginPop/canSubmitBtn.png","music/bgm.mp3","noPointPop/bg.png","noPointPop/btn.png","noPointPop/close.png","noPointPop/li8ght.png","NoPrizeCard/bg.png","NoPrizeCard/bg2.png","NoPrizeCard/camera.png","NoPrizeCard/exchange.png","NoPrizeCard/exchange2.png","NoPrizeCard/prizeImg.png","NoPrizeCard/title.png","opusPage/avatar.png","opusPage/back.png","opusPage/bg.png","opusPage/bg2.png","opusPage/big_pinglun.png","opusPage/dianzan.png","opusPage/infobg.png","opusPage/line.png","opusPage/pinglun.png","opusPage/zan.png","pointSucPop/bg.png","pointSucPop/box.png","pointSucPop/btn.png","pointSucPop/close.png","pointSucPop/light.png","PrivacyPop/bg.png","PrizePage/back.png","PrizePage/bg.png","PrizePage/bg2.png","PrizePage/bg_item.png","PrizePage/go-btn.png","PrizePage/gray_btn.png","PrizePage/img.png","PrizePage/stick.png","PrizePop/bg.png","RankNoPrizePop/bg.png","RankNoPrizePop/know.png","RankPrizePop/bg.png","RankPrizePop/light.png","RankPrizePop/prizePicture.png","ReviewFailedPop/bg.png","ReviewFailedPop/reSubmit.png","ReviewSucPop/chou.png","ReviewSucPop/gift.png","ReviewSucPop/light.png","ReviewSucPop/title.png","RulePop/bg.png","SaleManPage/bg.png","SaleManPage/bianhaoBg.png","SaleManPage/good.png","SaleManPage/idbg.png","SaleManPage/IP.png","SaleManPage/iptxt.png","SaleManPage/logo.png","SaleManPage/man.png","SaleManPage/music_close.png","SaleManPage/music_open.png","SaleManPage/myPhoto.png","SaleManPage/myRank.png","SaleManPage/myRank_btn.png","SaleManPage/nothing.png","SaleManPage/pass.png","SaleManPage/PeizeList_item_bg.png","SaleManPage/pic.png","SaleManPage/PictureBG.png","SaleManPage/pictureList_item_bianhaoBg.png","SaleManPage/prize.png","SaleManPage/rank.png","SaleManPage/rule.png","SaleManPage/shareBtn.png","SaleManPage/smalltitle.png","SaleManPage/title.png","SaleManPage/uoloadBtn.png","SaleManPage/uploadBg.png","SaleManPage/visit.png","SaleManPage/wait.png","SaleManPage/woman.png","sharePage/agentBg.png","sharePage/assist_btn.png","sharePage/assist_text.png","sharePage/bg.png","sharePage/btn.png","sharePage/hand.png","sharePage/join_btn.png","sharePage/logo.png","sharePage/normal.png","sharePage/share_btn.png","sharePage/zanBg.png","sharePage/zanBtn.png","SVG/1输出闪亮瞬间标题.svga","SVG/2输出去拜访icon.svga","SVG/3输出首页氛围.svga","SVG/4输出弹窗氛围.svga","SVG/5输出点击切换.svga","SVG/6输出礼盒氛围.svga","SVG/7输出礼盒动效.svga","TaskPop/already_btn.png","TaskPop/bg.png","TaskPop/bg_item.png","TaskPop/close.png","TaskPop/complete_btn.png","TaskPop/icon.png","TaskPop/longBackBtn.png","TaskPop/receive_btn.png","TaskPop/toShare_btn.png","UploadPop/bg.png","UploadPop/btn.png","UploadPop/cancel.png","UploadPop/confirm.png","UploadPop/gary_confirm.png","UploadPop/uplaod.png","UploadPop/white.png","userHomePage/3输出首页氛围.svga","userHomePage/bg.png","userHomePage/diolog.png","userHomePage/draw_btn.png","userHomePage/likeNum_icon.png","userHomePage/myLike_btn.png","userHomePage/nothing.png","userHomePage/prize_btn.png","userHomePage/produtBg.png","userHomePage/rule_btn.png","userHomePage/search_bg.png","userHomePage/search_btn.png","userHomePage/search_icon.png","userHomePage/sex1_icon.png","userHomePage/sex2_icon.png","userHomePage/task_btn.png","userHomePage/userIdBg.png","yinsirulepop/bg.png","yinsirulepop/btn.png","yinsirulepop/close.png"]}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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