Commit c9072808 authored by 王能飞's avatar 王能飞

Initial commit

parents
{
"compact": false
}
\ No newline at end of file
.tpl-temp
server/log/
server/view/
server/typings/auto-generated
server/app/view/
# expo
.expo/
# dependencies
node_modules
# output
.build_temp
output
# misc
.env.local
.env.development.local
.env.test.local
.env.production.local
### Bower ###
bower_components
.bower-cache
.bower-registry
.bower-tmp
### Git ###
*.orig
### Linux ###
*~
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# node-waf configuration
.lock-wscript
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
### ReactNative.Gradle Stack ###
.gradle
/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
### ReactNative.Buck Stack ###
buck-out/
.buckconfig.local
.buckd/
.buckversion
.fakebuckversion
### ReactNative.Android Stack ###
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
gen/
out/
# Gradle files
.gradle/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
.idea
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Google Services (e.g. APIs or Firebase)
google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
### SVN ###
.svn/
### VisualStudioCode ###
.vscode/
# metro
tmp
build
build_*/
server_build
dist
import { createAppConfig } from "@bytedance/mona";
export default createAppConfig({
pages: ["pages/Home/index", "pages/Info/index"],
window: {
transparentTitle: "always",
enablePullDownRefresh: false,
},
navigateToMiniProgramAppIdList: [],
});
"use strict";
var express = require("express");
var fs = require("fs");
var path = require("path");
var app = express();
var appPath = path.join(__dirname, "mock");
var defaultPluginOptions = {
port: 8890,
host: "127.0.0.1",
};
// post请求体相关
var bodyParser = require("body-parser");
app.use(bodyParser.json());
// 允许跨域
app.all("*", function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "PUT, GET, POST, DELETE, OPTIONS");
// 此处根据前端请求携带的请求头进行配置
res.header(
"Access-Control-Allow-Headers",
"Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild"
);
if (req.method == "OPTIONS") {
res.send(200);
} else {
next();
}
});
app.get("*", function (req, res) {
if (req.path !== "/favicon.ico") {
var path_1 = req.path.split("/")[1];
// console.log(path_1, "path>>>", appPath);
var _data = fs.readFileSync(appPath + "/" + path_1 + ".js", "utf-8");
var real = _data.replace("export default", "");
var _res = eval("(" + real + ")");
res.json(_res);
}
});
app.listen(defaultPluginOptions.port, function () {
console.log("\u76D1\u542C\u7AEF\u53E3 " + defaultPluginOptions.port);
});
export default {
success: true,
data: true,
};
export default {
success: true,
data: 2
}
\ No newline at end of file
export default {
success: true,
data: {
name: '测试卡片',
key: 'card1'
}
}
\ No newline at end of file
export default {
success: true,
data: {
id: '611bbb0d75cfb65e780cabd3',
image: 'https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png',
name: '测试奖品',
type: 5,
prizeId: '61137c12c752bbde95e9cfaf2d'
}
}
\ No newline at end of file
export default {
success: true,
data: {
id: '611bbb0d75cfb65e780cabd3',
image: 'https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png',
name: '测试奖品',
type: 1,
prizeId: '61137c12c752bbde95e9cfaf2d'
}
}
\ No newline at end of file
/** @format */
export default {
success: true,
code: "",
data: {
_id: "_id1",
image: "https://img.alicdn.com/bao/uploaded/i4/2104668892/O1CN01USZ4ob2FYaWuuMz5B_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品1商品1商品1商品1商品1商品1商品1",
stockType: 1,
stock: 100,
benefitType:1,
restStock: 60,
exchangeNum: 10
}
}
\ No newline at end of file
export default {
success: true,
data: {
title: '本地mock活动',
createTime: 1634714258263,
startTime: 1635141099575,
endTime: 1740921210000,
rule: `活动规则活动规则`,
activityStatus: 2, // 1:活动未开始 2:活动进行中 3:活动已结束
tasks: {
invite: {
reward: 2
}
}
}
}
\ No newline at end of file
export default {
success: true,
data: [{
id: "area1_npc1_1",
question: "你知道珀莱雅这只抗氧化?",
answer: 'A',
option: [{
type: "A",
name: "补水"
}, {
type: "B",
name: "清洁毛孔"
}, {
type: "C",
name: "提拉紧致"
}, {
type: "D",
name: "抗初老"
}]
}, {
id: "area1_npc1_2",
question: "你知道珀莱雅这只美白?",
answer: 'C',
option: [{
type: "A",
name: "抗初老"
}, {
type: "B",
name: "提拉紧致"
}, {
type: "C",
name: "清洁毛孔"
}, {
type: "D",
name: "补水 "
}]
}],
}
export default {
success: true,
data: {
rule1: {
cardTotal: 2,
cardInfo: {
card1: 1,
card2: 2
}
},
rule2: {
cardTotal: 4,
cardInfo: {
card1: 1,
card2: 2,
card3: 4,
card4: 3
}
}
}
}
\ No newline at end of file
This diff is collapsed.
/** @format */
export default {
success: true,
code: "",
data: {
list: [
{
_id: "_id1",
image: "https://img.alicdn.com/bao/uploaded/i4/2104668892/O1CN01USZ4ob2FYaWuuMz5B_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品1商品1商品1商品1商品1商品1商品1",
stockType: 1,
stock: 100,
restStock: 60,
exchangeNum: 10.0
},
{
_id: "_id2",
image: "https://img.alicdn.com/bao/uploaded/i1/2104668892/O1CN01q5OzKB2FYaX0GNCgB_!!2104668892.jpg",
ename: "10002",
type: 1,
name: "商品2商品2商品2商品2商品2商品2商品2",
stockType: 1,
stock: 200,
restStock: 160,
exchangeNum: 49.00
},
{
_id: "_id3",
image: "https://img.alicdn.com/bao/uploaded/i1/2104668892/O1CN013qnhYN2FYaX4H5nL6_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品3商品3商品3商品3商品3商品3商品3",
stockType: 1,
stock: 100,
restStock: 60,
exchangeNum: 39.00
},
{
_id: "_id3",
image: "https://img.alicdn.com/bao/uploaded/i3/2104668892/O1CN01oT50i82FYaWzDvASa_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品4商品3商品3商品3商品3商品3商品3",
stockType: 1,
stock: 100,
restStock: 60,
exchangeNum: 109.00
},
{
_id: "_id3",
image: "https://img.alicdn.com/bao/uploaded/i4/2104668892/O1CN01qgjeql2FYaX6mMTPd_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品5商品3商品3商品3商品3商品3商品3",
stockType: 1,
stock: 100,
restStock: 60,
exchangeNum: 299.00
},
{
_id: "_id3",
image: "https://img.alicdn.com/bao/uploaded/i1/2104668892/O1CN01YMeq4V2FYaWybYK8t_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品6商品3商品3商品3商品3商品3商品3",
stockType: 1,
stock: 100,
restStock: 60,
exchangeNum: 499.00
},
{
_id: "_id3",
image: "https://img.alicdn.com/bao/uploaded/i2/2104668892/O1CN01DHRmUG2FYaWpua6ci_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品7商品3商品3商品3商品3商品3商品3",
stockType: 1,
stock: 100,
restStock: 60,
exchangeNum: 99.00
},
{
_id: "_id3",
image: "https://img.alicdn.com/bao/uploaded/i1/2104668892/O1CN013zCECo2FYaX2wucsq_!!2104668892.jpg",
ename: "10001",
type: 1,
name: "商品8商品3商品3商品3商品3商品3商品3",
stockType: 1,
stock: 100,
restStock: 60,
exchangePrice: 69.00
}
]
}
}
export default {
"success": true,
"code": "qui",
"data": {
"expiredTime": 1638754752000,
"list": [
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 6,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 1,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "刘文test不限制",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 1,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 2,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "刘文test不限制",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 1,
"prizeDataType": 2,
"benefitType": 2,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 1,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "刘文test不限制",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 1,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "刘文test不限制",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 3,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "刘文test不限制",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
}
]
},
"message": "proident enim do mollit"
}
\ No newline at end of file
export default {
"success": true,
"code": "qui",
"data": {
"list": [
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137c12c752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 1,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 2,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 1,
"prizeDataType": 2,
"benefitType": 2,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 1,
"ename": "da3c1794891c472fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde953e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 1,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde935e9cfaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 3,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cefaf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 3,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfaf2d",
"activityId": "61137cc7086e65bf53fede10c",
"drawStatus": 3,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"prizeId": "61137cc752bbde95e9cfadf2d",
"activityId": "61137cc7086e65bf53fed10c",
"drawStatus": 3,
"prizeDataType": 2,
"benefitType": 1,
"remark": "今日领取达到上限,明日再来领取哦",
"useUrl": "https://feizhu.com",
"type": 3,
"ename": "da3c1794891c47fc92cd308ec17f4d48",
"name": "测试商品",
"image": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png"
},
]
},
"message": "proident enim do mollit"
}
\ No newline at end of file
This diff is collapsed.
/** @format */
export default {
success: true,
code: 'qui',
data: {
list: [
{
type: 'member',
rateType: 1,
key: 'member',
title: '加入会员',
times: 1,
reward: 100,
status: 1,
completeTimes: 0
},
{
type: 'follow',
rateType: 1,
key: 'follow',
title: '关注店铺',
times: 1,
reward: 100,
status: 1,
completeTimes: 0
},
{
type: 'invite',
rateType: 1,
key: 'invite',
title: '邀请',
times: 3,
reward: 100,
status: 1,
completeTimes: 1
},
{
type: 'collect',
rateType: 1,
key: 'collect',
title: '收藏',
times: 1,
reward: 100,
status: 1,
completeTimes: 0
},
{
type: 'addCart',
rateType: 1,
key: 'addCart',
title: '加购',
times: 1,
reward: 100,
status: 1,
completeTimes: 0
},
{
type: 'browse',
rateType: 1,
key: 'browse',
title: '浏览商品',
times: 1,
reward: 100,
status: 1,
completeTimes: 0
},
{
type: 'order',
rateType: 1,
key: 'order',
title: '下单商品',
itemIds:
'574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233,574141925233',
times: 1,
reward: 100,
status: 1,
completeTimes: 0
}
]
},
message: 'proident enim do mollit'
}
/** @format */
export default {
success: true,
data: {
gameTimes: 100,
game: {
game: {
testGame: {
isFirstGame: false,
gameTimes: 10,
todayGameTimes: 0
},
testAnswer: {
isFirstGame: false,
gameTimes: 10,
todayGameTimes: 0
}
}
},
user: {
userNick: '百变小模型',
avatar: 'test',
member: {
flag: false
}
},
task: {
remainTimes: {
invite: 0
}
},
card: {
card: {
testCard: {
drawTimes: 1,
resultantNum: 0,
useDrawTimes: 0,
cardInfo: {
card1: 1,
card2: 2
}
}
}
},
awards: {
drawTimes: {
testAward: {
today: '',
fixed: 1
},
exchangeValue: {
today: '',
fixed: 3,
credits: 300
}
}
}
}
}
export default {
"success": true,
"code": "qui",
"data": {
"userNick": "牛11号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 11,
"rankValue": 400000,
"pageSize": 100,
"total": 3,
"list": [
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛1号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 1,
"rankValue": 400000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛2号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 2,
"rankValue": 300000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛3号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 3,
"rankValue": 300000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛4号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 4,
"rankValue": 400000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛5号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 5,
"rankValue": 400000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛6号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 6,
"rankValue": 400000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛7号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 7,
"rankValue": 400000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛8号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 8,
"rankValue": 400000
},
{
"_id": "611bbb0d75cfb65e780cabd3",
"openId": "AAFOUyHsANr82axmE_vLV3kq",
"activityId": "61137cc7086e65bf53fed10c",
"userNick": "牛9号",
"avatar": "https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png",
"rank": 9,
"rankValue": 400000
}
]
},
"message": "proident enim do mollit"
}
\ No newline at end of file
export default {
success: true,
data: '1dfsadf'
}
\ No newline at end of file
export default {
success: true,
data: {
openId: "AAGcohTjANr0cYeooNo1lVPC",
firstLoginToday: false,
newUser: true,
inviteId: 'AAGcohTjANr0cYeooNo1lVPG',
userNick: '' ,// 用户昵称
avatar: '' // 用户头像
}
}
export default {
success: true,
data: true
}
\ No newline at end of file
export default {
success: true,
data: true
}
\ No newline at end of file
export default {
success: true,
data: true
}
\ No newline at end of file
export default {
success: true,
data: true
}
\ No newline at end of file
export default {
success: true,
data: {
reward: 10,
// 领取任务有优惠券或实物奖励时返回
// rewardResult: {
// }
}
}
\ No newline at end of file
export default {
success: true,
data: [
{
rank: 1,
rankValue: 20000,
name: '一等奖品',
image: 'https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png',
type: 3,
_id: '611bbb0d75cfb65e780cabd3'
}
]
}
\ No newline at end of file
export default {
success: true,
data: {
result: 1
}
}
\ No newline at end of file
export default {
success: true,
data: {
gameId: 'dddddd',
isFirstGame: false
}
}
\ No newline at end of file
export default {
success: true,
data: {
gameId: 'dddddd',
isFirstGame: false
}
}
\ No newline at end of file
export default {
success: true,
data: {
id: '611bbb0d75cfb65e780cabd3',
image: 'https://img.alicdn.com/imgextra/i2/353042333/O1CN01cCt2R31T6YigpqM07_!!353042333-2-isvtu.png',
name: '测试奖品',
type: 1,
prizeId: '61137c12c752bbde95e9cfaf2d',
reward: 5,
isReal: true
},
message: ''
}
\ No newline at end of file
export default {
success: true,
data: {
score: 1000,
maxScore: 2000
}
}
\ No newline at end of file
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.2](https://gitlab2.dui88.com/taobao-fe/tb-multi/compare/@tbmini/taro-plugin-mocker@1.2.1...@tbmini/taro-plugin-mocker@1.2.2) (2022-05-27)
**Note:** Version bump only for package @tbmini/taro-plugin-mocker
## [1.2.1](https://gitlab2.dui88.com/taobao-fe/tb-multi/compare/@tbmini/taro-plugin-mocker@1.2.0...@tbmini/taro-plugin-mocker@1.2.1) (2022-05-27)
### Bug Fixes
* **更新md:** 1 ([22d28aa](https://gitlab2.dui88.com/taobao-fe/tb-multi/commit/22d28aa82dd4da66044df567391b83d27f13ab4d))
# [1.2.0](https://gitlab2.dui88.com/taobao-fe/tb-multi/compare/@tbmini/taro-plugin-mocker@1.1.2...@tbmini/taro-plugin-mocker@1.2.0) (2022-01-11)
### Features
* **taro-plugin-mocker:** 解决跨域 ([36b65d9](https://gitlab2.dui88.com/taobao-fe/tb-multi/commit/36b65d96a5c668bf894ae5824c41b21b078978aa))
## [1.1.2](https://gitlab2.dui88.com/taobao-fe/tb-multi/compare/@tbmini/taro-plugin-mocker@1.1.1...@tbmini/taro-plugin-mocker@1.1.2) (2021-09-14)
**Note:** Version bump only for package @tbmini/taro-plugin-mocker
## [1.1.1](https://gitlab2.dui88.com/taobao-fe/tb-multi/compare/@tbmini/taro-plugin-mocker@1.1.0...@tbmini/taro-plugin-mocker@1.1.1) (2021-09-09)
**Note:** Version bump only for package @tbmini/taro-plugin-mocker
# 1.1.0 (2021-09-07)
### Features
* 🎸 taro本地mocj插件 ([c2e8c01](https://gitlab2.dui88.com/taobao-fe/tb-multi/commit/c2e8c017c8db4c020268faed3585308e3ec8dca6))
---
id: taro-plugin-mocker
---
> Taro 数据 Mock 插件
## 安装
在 Taro 项目根目录下安装
```bash
$ npm i @tbmini/taro-plugin-mocker --save
```
## 使用
### 引入插件
请确保 Taro CLI 已升级至 Taro 3 的最新版本。
修改项目 `config/index.js` 中的 plugins 配置为如下
```js
const config = {
...
plugins: [
...其余插件
'@tbmini/taro-plugin-mocker'
]
...
}
```
{
"name": "@tbmini/taro-plugin-mocker",
"version": "1.2.2",
"description": "taro 本地mock插件",
"author": "qinhaitao <qinhaitaocn@163.com>",
"homepage": "",
"license": "ISC",
"main": "dist/index.js",
"directories": {
"dist": "dist",
"test": "__tests__"
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git@gitlab2.dui88.com:taobao-fe/tb-multi.git"
},
"scripts": {
"build": "yarn run compile",
"clean": "rimraf -rf ./dist",
"compile": "tsc",
"start": "tsc -w"
},
"devDependencies": {
"@types/express": "^4.17.13"
},
"dependencies": {
"body-parser": "^1.19.0",
"chalk": "^5.0.1",
"chokidar": "^3.5.3",
"express": "^4.17.1",
"get-port": "^5.1.1",
"helper.js": "^1.4.18"
}
}
const express = require("express");
const fs = require("fs");
const path = require("path");
const app = express();
const appPath = path.join(__dirname, "..", "mock");
const defaultPluginOptions = {
port: 8890,
host: "127.0.0.1",
};
console.log(appPath);
// post请求体相关
const bodyParser = require("body-parser");
app.use(bodyParser.json());
// 允许跨域
app.all("*", function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "PUT, GET, POST, DELETE, OPTIONS");
// 此处根据前端请求携带的请求头进行配置
res.header(
"Access-Control-Allow-Headers",
"Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild"
);
if (req.method == "OPTIONS") {
res.send(200);
} else {
next();
}
});
app.get("*", function (req, res) {
if (req.path !== "/favicon.ico") {
const path = req.path.split("/")[1];
console.log(path, "path>>>");
const _data = fs.readFileSync(`${appPath}/${path}.js`, "utf-8");
const real = _data.replace("export default", "");
const _res = eval("(" + real + ")");
res.json(_res);
}
});
app.listen(defaultPluginOptions.port, () => {
console.log(`监听端口 ${defaultPluginOptions.port}`);
});
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"strict": true,
"lib": ["es6", "dom"],
"baseUrl": "./",
"rootDir": "src",
"noImplicitAny": false
},
"extends": "../../tsconfig.json",
"typeRoots": ["./node_modules/@types/", "./src/typings/**"],
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
}
\ No newline at end of file
This diff is collapsed.
import { createProjectConfig } from "@bytedance/mona";
export default createProjectConfig({
projectName: "mona_template",
appId: "",
input: "./src/app",
enableMultiBuild: true,
});
This diff is collapsed.
{
"name": "mona_template",
"version": "1.0.0",
"description": "Project created by mona-cli",
"author": "unknow",
"private": true,
"scripts": {
"build": "mona-service build",
"start": "mona-service start",
"start:mini": "mona-service start -t mini",
"build:mini": "mona-service build -t mini",
"compress": "mona-service build && mona-service compress",
"preview": "npm run build && mona-service preview -t mini",
"mock": "node ./mock.js"
},
"dependencies": {
"@bytedance/mona": "latest",
"@bytedance/mona-runtime": "latest",
"@bytedance/mona-service": "latest",
"@tinoe/glk": "^1.0.3-alpha.1",
"mockjs": "^1.1.0",
"normalize.css": "^8.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-json-view": "^1.21.3",
"react-router-dom": "^5.2.0",
"tinoe": "^1.0.3-alpha.1"
},
"devDependencies": {
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.0",
"typescript": "^4.0.2"
},
"license": "UNLICENSED",
"browserslist": {
"modern": [
"last 1 chrome version",
"last 1 firefox version"
]
}
}
import { miniRequest } from "@/utils";
import config from "@/config";
import { IResult } from "./typings/type";
type Params = Record<string, any>;
export type TRequest = (params?: Params) => Promise<IResult<any>>;
const { cloudName, requestType } = config;
const request = miniRequest({
cloudName,
envType: process.env.MONA_TARGET,
requestType,
});
export const login = (params: Login.Params) =>
request<Login.Res>("login", params);
import React from 'react';
import { useAppEvent } from '@bytedance/mona-runtime';
import '@/common/styles/base.less';
const App: React.FC = ({ children }) => {
useAppEvent('onLaunch', (options) => {
console.log(options)
})
useAppEvent('onShow', () => {
console.log('did show')
});
useAppEvent('onHide', () => {
console.log('did onHide')
});
useAppEvent('onError', () => {
console.log('did onError')
});
useAppEvent('onPageNotFound', () => {
console.log('did onPageNotFound')
});
return (
<div>{children}</div>
)
}
export default App;
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
\ No newline at end of file
@import "./theme.less";
body, page {
background-color: #ffffff;
min-height: 100vh;
color: #282c34;
font-size: 32px;
}
\ No newline at end of file
/** @format */
'use strict'
import React from 'react'
import { FC, useEffect } from 'react'
import { createSelectorQuery, Canvas, View } from '@bytedance/mona-runtime'
import { Stage, } from 'tinoe'
import games from './utils'
import games2 from './model'
import './index.less'
const clsPreFix = 'canvas-pancel-box'
export const CanvasPance: FC = () => {
useEffect(() => {
createSelectorQuery().select('#myCanvas').node(res => {
console.log(res)
}).exec(res => {
const canvas = res[0].node
console.log('canvas--->',canvas?.width,canvas?.height)
const stage = new Stage({ canvas })
console.log('stage--->',stage)
getLoader(stage)
})
// const canvas = document.getElementById('myCanvas')
// if(!canvas) return;
// const stage = new Stage({ canvas })
// console.log('stage--->',stage, Stage.platform.createImage())
// getLoader(stage)
},[])
const getLoader = async(stage: Stage) => {
// const model = await GLTFLoader.
await games(stage)
}
return(
<View className={clsPreFix}>
<Canvas id="myCanvas" canvasId="myCanvas" type="webgl" className={clsPreFix} />
</View>
)
}
// export const ModelPath = "https://duiba.oss-cn-hangzhou.aliyuncs.com/db_games/activity/lankou_avatar/lankou_0726/"
export const ModelPath =
"https://yun.duiba.com.cn/taobaomini/lancom_jd/dev/lankou_0726";
//常驻模型列表
export const GirlCommonModelList = [
{
id: "eye_left_girl",
name: "左眼模型女",
type: "common",
url: "girlEyeL-processed-pack.gltf",
},
{
id: "eye_right_girl",
name: "右眼模型女",
type: "common",
url: "girlEyeR-processed-pack.gltf",
},
];
export const BoyCommonModelList = [
{
id: "eye_left_boy",
name: "左眼模型男",
type: "common",
url: "boyEyeL-processed-pack.gltf",
},
{
id: "eye_right_boy",
name: "右眼模型男",
type: "common",
url: "boyEyeR-processed-pack.gltf",
},
{
id: "boyBody",
name: "身体模型男",
type: "common",
url: "malebody-processed-pack.gltf",
},
];
export const GirlClothList = [
{
id: "casualv1",
name: "一抹炫色",
type: "cloth",
url: "casualv1-processed-pack.gltf",
},
{
id: "casualv2",
name: "极简干练",
type: "cloth",
url: "casualv2-processed-pack.gltf",
},
{
id: "parisian2",
name: "现代街潮",
type: "cloth",
url: "parisian2-processed-pack.gltf",
},
{
id: "parisian1",
name: "慵懒时髦",
type: "cloth",
url: "parisian1-processed-pack.gltf",
},
{
id: "glamorousv1",
name: "都市新风",
type: "cloth",
url: "glamorousv1-processed-pack.gltf",
},
{
id: "glamorousv2",
name: "法式高雅",
type: "cloth",
url: "glamorousv2-processed-pack.gltf",
},
];
export const GirlMakeUpList = [
{
id: "m1",
name: "274杏仁奶茶",
type: "makeup",
url: "girlMakeup1-processed-pack.gltf",
},
{
id: "m2",
name: "196朱砂橘",
type: "makeup",
url: "girlMakeup2-processed-pack.gltf",
},
];
/**
* 头部模型列表
* 包含 帽子,头饰 / 眼镜
*/
export const GirlAccList = [
{
id: "hat1",
name: "遮阳帽(正红)",
type: "accessories",
subType: "headwear",
url: "hat1-processed-pack.gltf",
},
{
id: "hat2",
name: "遮阳帽(嫩绿)",
type: "accessories",
subType: "headwear",
url: "hat2-processed-pack.gltf",
},
{
id: "hat3",
name: "遮阳帽(宝蓝)",
type: "accessories",
subType: "headwear",
url: "hat3-processed-pack.gltf",
},
{
id: "hatV1",
name: "编织草帽(卡其)",
type: "accessories",
subType: "headwear",
url: "hatV1-processed-pack.gltf",
},
{
id: "hatV2",
name: "编织草帽(黑)",
type: "accessories",
subType: "headwear",
url: "hatV2-processed-pack.gltf",
},
{
id: "hatV3",
name: "编织草帽(红)",
type: "accessories",
subType: "headwear",
url: "hatV3-processed-pack.gltf",
},
{
id: "cap1",
name: "棒球帽(铜绿)",
type: "accessories",
subType: "headwear",
url: "cap1-processed-pack.gltf",
},
{
id: "cap2",
name: "棒球帽(墨蓝)",
type: "accessories",
subType: "headwear",
url: "cap2-processed-pack.gltf",
},
{
id: "cap3",
name: "棒球帽(深黑)",
type: "accessories",
subType: "headwear",
url: "cap3-processed-pack.gltf",
},
{
id: "rayban1",
name: "墨镜(糖果蓝)",
type: "accessories",
subType: "glass",
url: "rayban1-processed-pack.gltf",
},
{
id: "rayban2",
name: "墨镜(超A黑)",
type: "accessories",
subType: "glass",
url: "rayban2-processed-pack.gltf",
},
{
id: "rayban3",
name: "墨镜(复古红)",
type: "accessories",
subType: "glass",
url: "rayban3-processed-pack.gltf",
},
{
id: "tiara",
name: "公主冠冕",
type: "accessories",
subType: "headwear",
url: "tiara-processed-pack.gltf",
},
];
export const GirlHairList = [
{
id: "hair1",
name: "气质甜酷",
type: "hair",
url: "hair1-processed-pack.gltf",
},
{
id: "hair2",
name: "氛围美人",
type: "hair",
url: "hair2-processed-pack.gltf",
},
{
id: "hair3",
name: "元气马尾",
type: "hair",
url: "hair3-processed-pack.gltf",
},
{
id: "hair4",
name: "飒感帅气",
type: "hair",
url: "hair4-processed-pack.gltf",
},
{
id: "hairWithHat1",
name: "女士帽子发型1",
type: "hair",
url: "hairWithHat1-processed-pack.gltf",
},
{
id: "hairWithHat2",
name: "女士帽子发型2",
type: "hair",
url: "hairWithHat2-processed-pack.gltf",
},
{
id: "hairWithHat3",
name: "女士帽子发型3",
type: "hair",
url: "hairWithHat3-processed-pack.gltf",
},
{
id: "hairWithHat4",
name: "女士帽子发型4",
type: "hair",
url: "hairWithHat4-processed-pack.gltf",
},
];
export const PetModelList = [
{
id: "pet1",
name: "猫咪蔻蔻",
type: "pet",
url: "pet1-processed-pack.gltf",
},
{
id: "pet2",
name: "猫咪白白",
type: "pet",
url: "pet2.gltf",
},
{
id: "pet3",
name: "小鸟兰兰",
type: "pet",
url: "pet3-processed-pack.gltf",
},
{
id: "pet4",
name: "企鹅gogo",
type: "pet",
url: "pet4-processed-pack.gltf",
},
{
id: "pet5",
name: "狗狗旺旺",
type: "pet",
url: "pet5-processed-pack.gltf",
},
{
id: "pet6",
name: "狗狗柴柴",
type: "pet",
url: "pet6-processed.gltf",
},
];
export const BoyHairList = [
{
id: "c1",
name: "俊朗型男",
type: "hair",
url: "haircutmale2-processed-pack.gltf",
},
{
id: "c2",
name: "阳光少年",
type: "hair",
url: "haircutmale1-processed-pack.gltf",
},
];
export const BoyShoeList = [
{
id: "BoyShoe",
name: "男士鞋子",
type: "common",
url: "elegantboots-processed-pack.gltf",
},
];
export const BoyClothList = [
{
id: "E1",
name: "率性法式",
type: "cloth",
url: "elegantcloth1-processed-pack.gltf",
},
{
id: "E2",
name: "精致英伦",
type: "cloth",
url: "elegantcloth2-processed-pack.gltf",
},
{
id: "P1",
name: "活力运动",
type: "cloth",
url: "parisiancloth1-processed-pack.gltf",
},
{
id: "P2",
name: "复古单宁",
type: "cloth",
url: "parisiancloth2-processed-pack.gltf",
},
];
export const BoyMakeUpList = [
{
id: "malmakeup11",
name: "男士妆容1",
type: "makeup",
url: "bodyMakeUp1-Null-processed-pack.gltf",
},
];
export const BoyAccList = [
{
id: "malmakeup11",
name: "男士妆容1",
type: "makeup",
url: "NUll-processed-pack.gltf",
},
{
id: "malmakeup11",
name: "男士妆容1",
type: "makeup",
url: "hairA-processed-pack.gltf",
},
];
// pet1 / pet2 = catAudio
// pet5 / pet6 = dogAudio
// pet3 = birdAudio1
// pet4 = birdAudio2
export const PetAudioList = [
{
id: "catAudio",
name: "猫音效",
url: "catAudio.wav",
},
{
id: "dogAudio",
name: "狗音效",
url: "dogAudio.wav",
},
{
id: "birdAudio1",
name: "鸟音效1",
url: "birdAudio1.wav",
},
{
id: "birdAudio2",
name: "鸟音效2",
url: "birdAudio2.wav",
},
];
export const modelList = [
`${ModelPath}/girlEyeL-processed-pack.gltf`, //
`${ModelPath}/girlEyeR-processed-pack.gltf`, //
`${ModelPath}/girlMakeup1-processed-pack.gltf`,
`${ModelPath}/hair1-processed-pack.gltf`,
`${ModelPath}/casualv2-processed-pack.gltf`, // 衣服
`${ModelPath}/hat2-processed-pack.gltf`, // 帽子
`${ModelPath}/pet4-processed-pack.gltf`, // 宠物
];
.canvas-pancel-box {
position: fixed;
left: 0;
top: 0;
width: 750px;
height: 900px;
z-index: 100;
background-color: blanchedalmond;
canvas {
width: 100%;
height: 100%;
}
}
\ No newline at end of file
/** @format */
export * from "./CanvasPance";
// Copyright 2022 Bytedance Inc.
// SPDX-License-Identifier: MIT
import {
PerspectiveCamera,
AmbientLight,
DirectLight,
Stage,
Scene,
} from "tinoe";
import { GLTFLoader, AnimationManager } from "@tinoe/glk";
import { modelList } from "./constant";
export default async function init(stage: Stage) {
if (!stage) return;
const scene = new Scene(); // await GLTFLoader.loadAsScene(modelList[2]);
// scene.background.setValue('#aaa');
const camera = new PerspectiveCamera({
position: [0, 0, 50],
target: [0, 0, 0],
aspectRatio: stage.canvas.width / stage.canvas.height,
});
//camera.position.set(0, 2.2, 15);
scene.cameraManager.addCameras(camera);
/** 创建光源,并将光源加入到场景中 */
const ambientLight = new AmbientLight({
color: "#fff", //光的颜色
});
scene.lightManager.addLights(ambientLight);
const model = await GLTFLoader.load(modelList[0]);
const animationManager = scene.addPlugin(AnimationManager);
return { scene, animationManager };
}
import {
PerspectiveCamera,
Scene,
AmbientLight,
Mesh,
BlinnPhongMaterial,
SphereGeometry,
Stage,
PBRMaterial,
CubeGeometry,
Script,
TinoeEventType,
} from "tinoe";
import { Texture2DLoader } from "@tinoe/glk";
export default async function init(stage: Stage) {
/** 创建场景 */
const scene = new Scene();
/** 创建相机,并将相机加入到场景中 */
const camera = new PerspectiveCamera({
position: [0, 0, 2], // 位置
aspectRatio: stage.canvas.clientWidth / stage.canvas.clientHeight, // 宽高比
});
scene.cameraManager.addCameras(camera);
/** 创建光源,并将光源加入到场景中 */
const ambientLight = new AmbientLight({
color: "#fff", //光的颜色
});
scene.lightManager.addLights(ambientLight);
/** 5. 创建3D地球 */
// 创建球形几何体
const geom = new SphereGeometry();
// 创建材质
const mat = new BlinnPhongMaterial();
// 加载并上传地球纹理贴图
mat.diffuseTexture = await Texture2DLoader.load(
"https://s3-us-west-2.amazonaws.com/s.cdpn.io/141228/earthmap1k.jpg"
);
// 创建地球,并将其加入到场景中
const earth = new Mesh(geom, mat);
scene.addChildren(earth);
console.log(earth);
const scene2 = new Scene();
const camera2 = new PerspectiveCamera({
position: [0, 0, 4], // 位置
aspectRatio: 1, // 宽高比
});
scene2.cameraManager.addCameras(camera2);
scene2.lightManager.addLights(ambientLight);
scene2.addChildren(new Mesh(new CubeGeometry(), new PBRMaterial({})));
/** 启动渲染绘制 */
stage.loop(() => {
// stage.engine.enableBufferClear();
// stage.setViewport(0, 0, stage.canvas.clientWidth / 2, stage.canvas.clientHeight);
stage.run(scene);
// stage.engine.disableBufferClear();
// stage.setViewport(stage.canvas.clientWidth / 2, 0, stage.canvas.clientWidth / 2, stage.canvas.clientHeight);
// stage.run(scene2);
});
scene.on(TinoeEventType.CLICK, (ev) => {
console.log(ev.target);
});
scene2.on(TinoeEventType.CLICK, (ev) => {
console.log(ev.target);
});
stage.enableControl();
/** 添加动画效果 */
scene.scriptManager.addUpdater((dt: number) => {
earth.rotateY(dt * 10);
});
}
import { Button, View, login } from '@bytedance/mona-runtime'
import React, { FC } from 'react'
import Wrapper from '@/components/Wrapper';
import { onGetUserProfile } from '@/utils'
import './index.less'
import { IAuthInfo } from '@/typings/type';
/** 用户授权组件属性 */
type IProps = {
type?: 'user' | 'phone'
/** 授权成功回调 */
onSuccess?: (info: IAuthInfo | string) => void
}
const clspreFix = 'login-pancel-box'
export const LoginPancel: FC<IProps> = (props) => {
const { onSuccess, type = 'user' } = props
const onGetPhone = async (e?: any) => {
login()
return onSuccess && onSuccess(e?.detail?.iv || '')
}
const onGetUserInfo = async () => {
const res = await onGetUserProfile()
if(res) return onSuccess && onSuccess(res)
}
return (
<Wrapper>
<View className={clspreFix}>
{type === 'phone'? <Button onGetPhoneNumber={(e) => onGetPhone(e)} className={`${clspreFix}__btn`} openType="getPhoneNumber">{'获取手机号'}</Button> :
<Button className={`${clspreFix}__btn`} onTap={() => onGetUserInfo()}>登录</Button>}
</View>
</Wrapper>
)
}
\ No newline at end of file
---
id: Auth
title: 授权面板(淘宝)
---
<!-- @format -->
## Auth 授权面板(淘宝)
### 何时使用
淘宝小程序用户授权面板
### 引入
```jsx
import { Auth } from '@/base/components'
export default function Index() {
// 授权成功回调
const onLoginSuccess = loginInfo => {}
return <AuthLogin onSuccess={onLoginSuccess} />
}
```
### Props
| 参数 | 说明 | 类型 | 必选 | 默认值 |
| --------- | ------------ | ---------- | ---- | -------- |
| onSuccess | 授权成功回调 | _function(info)_ | | `()=>{}` |
.login-pancel-box {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
background-color: #EDEEEF; // f1ebdd
display: flex;
justify-content: center;
align-items: center;
&__btn {
width: 575px;
height: 89px;
line-height: 89px;
background: linear-gradient(90deg, #FE5200, #FF8E01);
border-radius: 45px;
font-size: 36px;
font-family: Alibaba;
font-weight: normal;
color: #FFFFFF;
text-align: center;
margin: 30px auto 0;
}
}
\ No newline at end of file
export * from "./Login";
.container {
text-align: center;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file
import React from 'react';
import { View } from '@bytedance/mona-runtime';
import styles from './index.module.less';
const Wrapper: React.FC = ({ children }) => {
return <View className={styles.container}>{children}</View>
}
export default Wrapper;
\ No newline at end of file
import Wrapper from "./Wrapper";
export { Wrapper };
export * from "./Login";
// export * from "./CanvasPance";
/** @format */
import { IProjectConfig } from "./typings/type";
export default {
env: <const>"test", // 云函数环境 test 测试环境 online 线上环境
requestType: <const>"local", // cloud: 云函数, yapi: yapi 接口, local: 本地mock, tornado: 风驰台接口 h5 接口 jst 云应用
cloudName: "newyear", // 主云函数项目名 CommonToC(若为运用,则填写 cloudAppId)
projectName: "mb", // 项目名称 h5
sellerId: "1585073968", // sellerId 890482188 743750137
venderId: "10276497", // h5 分享使用 1585073968
shopId: "10139787", // 店铺id h5 10139787
appKey: "5PPxnK4yhSaD2PRdcndpTrz2d02TYmjp", // h5 分享使用
h5API: `http://tbjd.duibatest.com.cn/${"mb"}/jdapi`,
activityUrl: `https://duiba-isv.isvjcloud.com/jd/${"mb"}/index.html`, // 活动地址 h5分享使用
tornadoAPI:
"https://tornado.duibadev.com.cn/tbServer/api?db=3000000053888192&proxyIp=172.16.227.10", // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
defaultActivityId: "61dd272eb90bdc27ce10c8d6", // 默认活动id 61adc281332017068568c0c1 6128a10c7389899579083d41 61b0824a29321af4dc9e02a0
} as IProjectConfig;
declare namespace AddStat {
interface Params {
activityId: string
key: string
}
type Res = boolean
}
\ No newline at end of file
declare namespace CompleteTask {
interface Params {
activityId?: string
key: string
isVip?: boolean // 完成会员任务填写此参数
inviteId?: string // 助力时填写此参数
itemId?: string // 指定商品类填写此参数
}
type Res = number
}
\ No newline at end of file
declare namespace DrawCard {
interface Params {
activityId: string
key?: string
}
interface Res {
name: string
key: string
}
}
\ No newline at end of file
declare namespace DrawLottery {
interface Params {
activityId: string
key: string
}
type Res = IDrawPrize
}
interface IDrawPrize {
id: string
image: string
name: string
type: number
benefitType?: number
prizeId?: string
}
\ No newline at end of file
declare namespace ExchangePrize {
interface Params {
activityId?:string
id?:string
_id?:string
isVip?:boolean
}
interface Res {
image:string
name:string
id:string
_id?:string
ename:string
type?:number
benefitType?:number
}
}
\ No newline at end of file
declare namespace GetActivityBaseInfoById {
interface Params {
activityId?: string
}
interface Res {
_id: string
title: string
startTime: number
endTime: number
rule: string
activityStatus: number
tasks: {
[key: string]: {
reward: number
rateType: number
}
}
shareImg?:string
shareTitle?:string
shareSubTitle?:string
}
}
\ No newline at end of file
declare namespace GetAnswerList {
interface Params {
activityId?: string
}
interface Submit {
activityId?: string
answer: Reply[]
}
type Res = AnswerList[]
type ReplyObj = Reply
type ReplyList = Reply[]
}
interface AnswerList {
id: string,
question: string,
answer: string
option: {
type: string,
name: string
}[]
}
interface Reply {
answer: string
id: string
}
\ No newline at end of file
declare namespace GetCardInfo {
interface Params {
activityId?: string
}
interface Res {
[key: string]: {
cardTotal: number
cardInfo: ICardInfo,
useDrawTimes?: number,
resultantNum?: number
}
}
}
interface ICardInfo {
[key: string]: number
}
\ No newline at end of file
declare namespace GetExchangeList {
interface Params {
activityId?:string
}
interface Res {
list:Array<IExchangeItem>
}
}
interface IExchangeItem {
image:string
name:string
type:number
exchangeNum:number //需要的兑换积分
limitNum:number //兑换限制数量
limitType:number //兑换限制类型:单个商品 每日限制,总量限制
id:string
useStock:number //剩余库存
status?:number
_id?:string
ename?:string
switchStock?:number //库存类型:2不限库存/1限制库存
stock?:number
benefitType?:number
}
type IExchange = {
modalType:number // 弹窗类型 关闭/确认/成功/失败
modalInfo?:{
confirmGoods?:IExchangeItem
exchangeSuc?:ExchangePrize.Res
exchangeFail?:ExchangePrize.Res
// [key:string]: (IExchangeItem | ExchangePrize.Res)
}
}
/** @format */
declare namespace GetGoodList {
interface Params {
activityId?: string
itemIds?: string
key: string
page?: number
}
type Res = {
list: IGoodItem[]
totalPage: number
}
}
interface IGoodItem {
itemId: string
collected?: boolean
image: string
name: string
price?: string
desc?: string
}
declare namespace GetMyAwardsList {
interface Params {
activityId: string
}
type Res = {
expiredTime?: number
list: IPrizeItem[]
}
}
interface IPrizeItem {
id: string
_id?: string
type: number
image: string
name: string
drawStatus: number
createTime: number
useUrl?: string
ename?: string
itemId?: string
benefitType?: number
remark?: string
shipStatus?: number
shipNum?: string
prizeId?: string
expiredTime?: number
}
\ No newline at end of file
declare namespace GetPrizeConfig {
interface Params {
activityId: string
key: string
}
type Res = {
list: IPrizeConfig[]
}
}
interface IPrizeConfig {
_id: string
prizeDataType: number
name: string
type: number
isBackUp: boolean
useUrl?: string
itemId?: string
skuId?: number
stock: number
useStock: number
switchStock: number
limitNum?: number
limitType?: number
benefitType?: number
rank?: string
credits?: number
probability?: string
image: string
prizeId?: string
}
\ No newline at end of file
/** @format */
declare namespace GetTaskList {
interface Params {
activityId?: string
isVip?: boolean
isFollow?: boolean
}
type Res = {
list: ITaskItem[]
}
}
interface ITaskItem {
type: 'follow' | 'member' | 'invite' | 'jump' | 'collect' | 'order' | 'sign' | 'addCart' | 'share' | 'browse'
rateType: number
key: string
title?: string
times: number
reward: number
completeTimes: number
todayCompleteTimes: number
status: number
itemIds?: string
sellerId?: number
jumpLink?: string // 跳转地址
jumpKeepTime?: number
limitTime?: number // 限时时间秒
userLimit?: number
name: string
}
declare namespace GetUserInfo {
interface Params {
activityId: string
}
interface Res {
user?: IUserInfo
task?: ITaskInfo
game?: IGameInfo
card?: ICardInfo
awards?: IAwardInfo
}
}
interface IUserInfo {
userNick: string
avatar: string
ticket: number
member: {
flag: boolean
newMember?: boolean
bememberTime?: number
bememberDay?: string
}
}
interface ITaskInfo {
remainTimes: {
[key: string]: number
},
lastLimit?: {
[key: string]: number
}
}
interface IGameInfo {
game: {
[key: string]: {
isFirstGame: boolean
gameTimes: number
todayGameTimes: number
}
}
}
interface ICardInfo {
card: {
[key: string]: {
useDrawTimes: number
cardTotal: number
resultantNum: number
drawTimes: number
cardInfo: {
[key: string]: number
}
}
}
}
interface IAwardInfo {
drawTimes: {
[key: string]: {
fixed: number,
}
}
exchangeValue?:{
[key: string] : number
} //当前拥有的积分
alreadyExchange?:{ //已经兑换的次数
[key: string] : number
}
rankValue?: {
[key: string]: {
fixed: {
value: number
}
}
}
}
\ No newline at end of file
declare namespace GetUserRankList {
interface Params {
activityId: string
key: string
}
interface Res {
list: Array<IRankItem>
avatar: string
userNick: string
rank: number | string
rankValue: number
total?: number
pageSize?: number
}
}
interface IRankItem {
avatar: string
userNick: string
rank: number | string
rankValue: number
_id?: string
activityId: string
openId: string
}
\ No newline at end of file
declare namespace GiftCard {
interface Params {
activityId?: string
key: string // 规则key
cardKey: string // 集卡键值
}
type Res = string | undefined
}
interface ICardItem {
name: string
key: string
lockImage: string
unLockImage: string
count: number
}
\ No newline at end of file
declare module Login {
interface Params {
activityId?: string
userNick: string
avatar: string
isFollow: boolean
isVip: boolean
inviteId?: string
}
interface Res {
newUser: boolean // 是否是新用户
openId: string // 用户唯一标识
firstLoginToday: boolean //当天是否第一次登陆
userNick: string // 用户昵称
avatar: string // 用户头像
inviteId?: string // 分享者openId(通过受邀链接进入的用户有此参数
isLogin?: boolean
remainTimes?: {
[key: string]: number
} // 待领取次数
}
}
\ No newline at end of file
declare namespace OpenLimitTask {
interface Params {
activityId?: string
key: string
}
interface Res {
isOpen: boolean
startTime?: number
endTime?: number
}
}
\ No newline at end of file
declare namespace ReceiveTask {
interface Params {
activityId?: string
key: string
}
interface Res {
reward: number // 奖励值
rewardResult?: { // 若奖励值为奖品则由此返回值
id: string
type: number
benefitType: number
image: string
name: string
}
}
}
\ No newline at end of file
declare namespace ReceiveEnamePrize {
interface Params {
activityId?: string
id: string
}
type Res = {
success: boolean
}
}
\ No newline at end of file
declare namespace ReceiveGiftCard {
interface Params {
activityId: string
key: string
cardTagId: string
}
interface Res {
key: string
}
}
\ No newline at end of file
declare namespace ReceiveMemberPrize {
interface Params {
activityId?: string
id: string
status?: number
}
type Res = {
success: boolean
}
}
\ No newline at end of file
declare namespace ReceiveObjectPrize {
interface Params {
activityId?: string
province: string
city: string
area: string
addressDetail: string
id: string
name: string
phone: string
streetName: string
}
type Res = {
success: boolean
}
}
\ No newline at end of file
declare namespace ReissuePrize {
interface Params {
activityId?: string
key: string
}
type Res = IRankPrize[]
}
interface IRankPrize {
rank: string
rankValue: number
name: string
image: string
type: number
_id: string
id: string
benefitType?: number
}
\ No newline at end of file
declare namespace ResultantCard {
interface Params {
activityId?: string
key: string // 规则key
}
type Res = {
result: number,
rewardResult?: number
} | IDrawPrize | {
name: string
key: string
}
}
\ No newline at end of file
declare namespace StartAnswer {
interface Params {
activityId: string
key?: string
}
interface Res {
gameId: string
isFirstGame?: boolean
}
}
\ No newline at end of file
declare namespace StartGame {
interface Params {
activityId: string
key?: string
}
interface Res {
gameId: string
isFirstGame?: boolean
}
}
\ No newline at end of file
declare namespace SubmitAnswer {
interface Params {
activityId: string
answer: string
key?: string
}
interface Res {
id: string
image: string
name: string
type: number
benefitType?: number
prizeId?: string
reward?: number
isReal?: boolean
}
}
\ No newline at end of file
declare namespace SubmitGame {
interface Params {
activityId: string
key?: string
gameId?: string
score: number
}
type Res = ISubmit
}
interface ISubmit {
level?: number
score?: number
stars?: number
isPass?: boolean
totalScore?: number
maxScore?: number
rank?: number
rewardResult?: IPrize
}
interface IPrize {
id: string
image: string
name: string
type: number
benefitType?: number
}
\ No newline at end of file
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.logo {
height: 30vmin;
pointer-events: none;
animation: spin infinite 20s linear;
}
.link {
margin-bottom: 8px;
}
\ No newline at end of file
import React, { useEffect } from 'react';
import { Navigator, View, Text, Image, navigateTo } from '@bytedance/mona-runtime'
import { Wrapper, LoginPancel } from '@/components';
import styles from './index.module.less';
import { login } from '@/api';
const Home = () => {
useEffect(() => {
login({ avatar: '', userNick: '', isFollow: false, isVip: false }).then(res => {
console.log('login>>>>', res)
})
},[])
return (
<Wrapper>
<View className={styles.header}>
<View>hello world </View>
<View onTap={() => navigateTo({ url: `/pages/Info/index?activityId=2223`})}>跳转 info</View>
</View>
{true && <LoginPancel type="user" />}
{/* {false && <CanvasPance />} */}
</Wrapper>
)
}
export default Home;
\ No newline at end of file
import { createPageConfig } from '@bytedance/mona';
export default createPageConfig({
navigationBarTitleText: 'home page'
})
\ No newline at end of file
import Wrapper from '@/components/Wrapper';
import { View, Text, Mona, PageProps, usePageEvent } from '@bytedance/mona-runtime';
import React from 'react';
const Info: React.FC<PageProps> = ({ search, searchParams }) => {
console.log(search, searchParams);
usePageEvent('onLoad',(options) => {
console.log('options--->',options)
})
return (
<Wrapper>
<View>
<View>I am route page <Text>/pages/Info/index</Text></View>
<View><Text onTap={() => { Mona.navigateBack(); }}>back to <Text>/pages/Home/index</Text></Text></View>
</View>
</Wrapper>
)
}
export default Info;
\ No newline at end of file
import { createPageConfig } from '@bytedance/mona';
export default createPageConfig({
navigationBarTitleText: 'info page'
})
\ No newline at end of file
declare module "*.png";
declare module "*.jpg";
declare module "*.jpeg";
declare module "*.gif";
declare module "*.webp";
declare module "*.ttf";
declare module "*.woff";
declare module "*.woff2";
declare module "*.scss";
declare module "*.less";
declare module "*.css";
declare module "*.json";
declare module "*.svg";
declare var tt: any;
interface IAuthInfo {
nickName: string;
avatar: string;
}
interface IConfig {
cloud?: any;
cloudName: string;
requestType: REQUEST_TYPE;
envType: ENV_TYPE;
mockUrl?: string;
}
export type IRequestFn = <T = any>(
apiName: string,
params?: Record<string, any>,
httpType?: "GET" | "POST"
) => Promise<IResult<T>>;
interface IRequestConfig<T = any> {
cloud: T;
cloudName: string;
mockUrl?: string;
}
type IResult<T = any> = IErrorResult | ISuccessResult<T>;
interface IProjectConfig {
env: "test" | "pre" | "online"; // 云函数环境 test 测试环境 pre 预发环境 online 线上环境
requestType: "local" | "yapi" | "cloud" | "tornado" | "h5" | "jst"; // cloud: 云函数, yapi: yapi 接口, local: 本地mock, tornado: 风驰台接口 h5 接口 jst 云应用
cloudName: string; // 主云函数项目名 (若为运用,则填写相应的 cloudAppId)
projectName: string; // 项目名称
sellerId: string; // sellerId
venderId: string; // h5 分享使用
shopId: string; // 店铺id
appKey: string; // h5 分享使用
h5API: string; // h5API地址
activityUrl: string; // 活动地址 h5分享使用
tornadoAPI: string; // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
defaultActivityId: string; // 默认活动id
}
import { IAuthInfo } from "@/typings/type";
export const onGetUserProfile = async (): Promise<IAuthInfo | false> => {
return new Promise((resolve, reject) => {
tt.getUserProfile({
success: (res: any) => {
console.log(res.userInfo);
const { nickName, avatarUrl } = res.userInfo;
resolve({ nickName, avatar: avatarUrl });
},
fail: (err: any) => {
console.log("onGetUserProfile>>>err", err);
resolve(false);
},
});
});
};
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