diff --git a/projects/lottery/zhangjun/.gitignore b/projects/lottery/zhangjun/.gitignore new file mode 100644 index 0000000..5f99b9b --- /dev/null +++ b/projects/lottery/zhangjun/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +node_modules/ +build/ diff --git a/projects/lottery/zhangjun/.prettierignore b/projects/lottery/zhangjun/.prettierignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/projects/lottery/zhangjun/.prettierignore @@ -0,0 +1 @@ +node_modules/ diff --git a/projects/lottery/zhangjun/.prettierrc b/projects/lottery/zhangjun/.prettierrc new file mode 100644 index 0000000..a822f83 --- /dev/null +++ b/projects/lottery/zhangjun/.prettierrc @@ -0,0 +1,25 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": false, + "parser": "babylon", + "singleQuote": true, + "trailingComma": "none", + "bracketSpacing": true, + "jsxBracketSameLine": false, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json", "trailingComma": "none" } + }, + { + "files": ".babelrc", + "options": { "parser": "json", "trailingComma": "none" } + }, + { + "files": "*.json", + "options": { "trailingComma": "none" } + } + ] +} diff --git a/projects/lottery/zhangjun/LICENSE b/projects/lottery/zhangjun/LICENSE new file mode 100644 index 0000000..e0c64ad --- /dev/null +++ b/projects/lottery/zhangjun/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 fe-boilerplate + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/lottery/zhangjun/README.md b/projects/lottery/zhangjun/README.md new file mode 100644 index 0000000..ab48120 --- /dev/null +++ b/projects/lottery/zhangjun/README.md @@ -0,0 +1,200 @@ +# draw + +抽奖的小demo + +> psm: 1.1.2 + +### 0.0 线上入口 + +- http://??? + +### 0.1 相关人员 + +负责人 zj + +| 角色 | 人员 | +| -------- | ----------- | +| 产品经理 | xxx,yyy | +| 前端开发 | xxx | +| 后台开发 | xxx,yyy,zzz | +| 交互设计 | xxx,yyy | + +### 0.2 需求 & 设计图 + +* [需求文档](xxx) +* [设计图](xxx) + +---- + +## 1. 如何运行 + +### 1.0 安装依赖 + +```sh + +# 安装 node +$ brew install node + +# 安装 fe +$ npm i fe -g + +# 安装 yarn (可选) +$ npm i yarn -g +``` + +> node 版本 [8.0+] + +严格使用 [prettier](https://prettier.io/), 请基于自己的编辑器配置 [Editor Support](https://prettier.io/docs/en/editors.html) + +### 1.1 开发环境配置 + +#### 1.1.1 项目配置 + +`fe.json` + +示例: + +```json +{ + "CLIENT_DIR": "client", + "ENTRY_FILE": "index.js", + "CLIENT_MODE": "vue" +} +``` + +参考完整配置: https://code.byted.org/fe/fe/blob/master/config/fe.json + +#### 1.1.2 生产环境配置 + +所有生产环境变量请在 `.env` 中配置 + +```yaml +## .env + +# production | development +NODE_ENV=production +SERVER_PORT=4000 +SERVER_IP=127.0.0.1 +CORS_ORIGIN=* +CORS_METHODS=GET,HEAD,PUT,PATCH,POST,DELETE +``` + +### 1.2 开发过程 + +工作流 + +`fe dev` > `fe build` > `fe start` + +升级依赖 + +```sh +# 查看更新版本 +$ yarn outdated +# 安全升级 +$ yarn update +# 升级到 latest +$ yarn upgrade --latest +``` + +#### 1.2.1 命令 + +```sh +$ cd draw + +# 开发 +$ fe dev + +# 编译 +$ fe build + +# 在生产环境启动(自动编译) +$ fe start +``` + +#### 1.2.2 代理配置 + +`config/proxy.config.js` + +```js +// Proxies for devServer +// usage @see http-proxy-middleware +module.exports = (config, runtime) => { + const dev = process.env.NODE_ENV !== 'production' + + // Only in dev mode + // For production use `app.use(proxy)` in business modules + dev && + Object.assign(config, { + '/__api': { + target: 'http://localhost:3000', + pathRewrite: { '^/__api': '/api' } + } + }) + return config +} +``` + +#### 1.2.3 自定义 postcss + +`config/postcss.config.js` + +```js +module.exports = (config, runtime) => { + config.plugins = config.plugins.concat([ + // require('postcss-write-svg')({ + // utf8: false + // }), + require('postcss-px-to-viewport')({ + viewportWidth: 750, + viewportHeight: 1334, + unitPrecision: 3, + viewportUnit: 'vw', + selectorBlackList: ['.nvw', '.hairlines'], + minPixelValue: 1, + mediaQuery: false + }), + require('postcss-viewport-units')() + // require('cssnano')({ + // preset: 'advanced', + // autoprefixer: false, + // 'postcss-zindex': false + // }) + ]) + return config +} +``` + +> 注意: 使用的插件请安装并保存到 `package.json` + +#### 1.2.4 自定义 polyfills + +`config/polyfills.js` + +默认已集成: + +- Promise +- fetch +- Object.assign +- vh|vw|vmin|vmax + +#### 1.2.5 自定义 nuxt + +`config/nuxt.config.js` + +示例: + +```js +module.exports = (config, runtime) => { + return config +} +``` + +参考完整配置: https://code.byted.org/fe/fe/blob/master/config/plugins/nuxt.config.js + +### 1.3 发布 + +> TODO + +### 1.4 错误告警及监控 + +> TODO diff --git a/projects/lottery/zhangjun/client/assets/.gitkeep b/projects/lottery/zhangjun/client/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/projects/lottery/zhangjun/client/assets/Oval 1.png b/projects/lottery/zhangjun/client/assets/Oval 1.png new file mode 100644 index 0000000..3665960 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/Oval 1.png differ diff --git a/projects/lottery/zhangjun/client/assets/Ovalbg.png b/projects/lottery/zhangjun/client/assets/Ovalbg.png new file mode 100644 index 0000000..90a2cfb Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/Ovalbg.png differ diff --git a/projects/lottery/zhangjun/client/assets/dot-1.png b/projects/lottery/zhangjun/client/assets/dot-1.png new file mode 100644 index 0000000..69d37a0 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/dot-1.png differ diff --git a/projects/lottery/zhangjun/client/assets/global.styl b/projects/lottery/zhangjun/client/assets/global.styl new file mode 100644 index 0000000..6c0fce1 --- /dev/null +++ b/projects/lottery/zhangjun/client/assets/global.styl @@ -0,0 +1,74 @@ +// 边框默认颜色 +$defaultBorderColor = rgba(0, 0, 0, .08) + +// retina 边框函数基础声明,不包含 border 部分,主要用于在 retina-border 函数里继承 +#retina-border-basic + position: relative + &::before + content: '' + position: absolute + width: 100% + height: 100% + top: 0 + left:0 + transform-origin: left top + box-sizing: border-box + pointer-events: none + @media + (-webkit-min-device-pixel-ratio: 2), + (min-resolution: 2dppx) + &::before + width: 200% + height: 200% + transform: scale(.5) + @media + (-webkit-min-device-pixel-ratio: 3), + (min-resolution: 3dppx) + &::before + width: 300% + height: 300% + transform: scale(1 / 3) + +// 设置圆角(如果圆角大于0,则添加圆角的代码) +retina-border-radius(borderRadius) + if unit(borderRadius, px) > 0 + border-radius: borderRadius + @media + (-webkit-min-device-pixel-ratio: 2), + (min-resolution: 2dppx) + &::before + border-radius: unit(borderRadius, px) * 2 + @media + (-webkit-min-device-pixel-ratio: 3), + (min-resolution: 3dppx) + &::before + border-radius: unit(borderRadius, px) * 3 + +// retina 边框函数声明 +retina-border(borderWidth = 1px, borderStyle = solid, borderColor = $defaultBorderColor,borderRadius = 0) + @extends #retina-border-basic + retina-border-radius(borderRadius) + &::before + border-width: borderWidth + border-style: borderStyle + border-color: borderColor + +// 全边框 +.retina-border-all + retina-border(1px) + +// 上边框 +.retina-border-top + retina-border(1px 0 0) + +// 右边框 +.retina-border-right + retina-border(0 1px 0 0) + +// 下边框 +.retina-border-bottom + retina-border(0 0 1px) + +// 左边框 +.retina-border-left + retina-border(0 0 0 1px) diff --git a/projects/lottery/zhangjun/client/assets/go.png b/projects/lottery/zhangjun/client/assets/go.png new file mode 100644 index 0000000..90bd84b Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/go.png differ diff --git a/projects/lottery/zhangjun/client/assets/group.png b/projects/lottery/zhangjun/client/assets/group.png new file mode 100644 index 0000000..5d6c7f6 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/group.png differ diff --git a/projects/lottery/zhangjun/client/assets/helper.styl b/projects/lottery/zhangjun/client/assets/helper.styl new file mode 100644 index 0000000..a52ef3d --- /dev/null +++ b/projects/lottery/zhangjun/client/assets/helper.styl @@ -0,0 +1,50 @@ +$defaultBorderColor = rgba(0, 0, 0, .08) + +#retina-border-basic + position: relative + &::before + content: '' + position: absolute + width: 100% + height: 100% + top: 0 + left:0 + transform-origin: left top + box-sizing: border-box + pointer-events: none + @media + (-webkit-min-device-pixel-ratio: 2), + (min-resolution: 2dppx) + &::before + width: 200% + height: 200% + transform: scale(.5) + @media + (-webkit-min-device-pixel-ratio: 3), + (min-resolution: 3dppx) + &::before + width: 300% + height: 300% + transform: scale(1 / 3) + +retina-border(borderWidth = 1px, borderStyle = solid, borderColor = $defaultBorderColor) + @extends #retina-border-basic + &::before + border-width: borderWidth + border-style: borderStyle + border-color: borderColor + +// .retina-border-all +// retina-border(1px) + +// .retina-border-top +// retina-border(1px 0 0) + +// .retina-border-right +// retina-border(0 1px 0 0) + +// .retina-border-bottom +// retina-border(0 0 1px) + +// .retina-border-left +// retina-border(0 0 0 1px) diff --git a/projects/lottery/zhangjun/client/assets/lark.png b/projects/lottery/zhangjun/client/assets/lark.png new file mode 100644 index 0000000..1442ad5 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/lark.png differ diff --git a/projects/lottery/zhangjun/client/assets/lottery_bg-1.jpg b/projects/lottery/zhangjun/client/assets/lottery_bg-1.jpg new file mode 100644 index 0000000..46f8fac Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/lottery_bg-1.jpg differ diff --git a/projects/lottery/zhangjun/client/assets/lottery_bg.jpg b/projects/lottery/zhangjun/client/assets/lottery_bg.jpg new file mode 100644 index 0000000..0b3ddcc Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/lottery_bg.jpg differ diff --git a/projects/lottery/zhangjun/client/assets/modal_bg.png b/projects/lottery/zhangjun/client/assets/modal_bg.png new file mode 100644 index 0000000..4eed0e5 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/modal_bg.png differ diff --git a/projects/lottery/zhangjun/client/assets/modal_bg2.png b/projects/lottery/zhangjun/client/assets/modal_bg2.png new file mode 100644 index 0000000..64fa301 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/modal_bg2.png differ diff --git a/projects/lottery/zhangjun/client/assets/ok.png b/projects/lottery/zhangjun/client/assets/ok.png new file mode 100644 index 0000000..66b36a3 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/ok.png differ diff --git a/projects/lottery/zhangjun/client/assets/receives_btn.png b/projects/lottery/zhangjun/client/assets/receives_btn.png new file mode 100644 index 0000000..47f8256 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/receives_btn.png differ diff --git a/projects/lottery/zhangjun/client/assets/reset.styl b/projects/lottery/zhangjun/client/assets/reset.styl new file mode 100644 index 0000000..b404548 --- /dev/null +++ b/projects/lottery/zhangjun/client/assets/reset.styl @@ -0,0 +1,195 @@ +* + margin 0 + padding 0 + +*, +*:before, +*:after + box-sizing inherit + -moz-box-sizing inherit + +html + box-sizing border-box + -moz-box-sizing border-box + // use new font stack + // from: https://make.wordpress.org/core/2016/07/07/native-fonts-in-4-6/ + // with "Yahei" fallback for chinese + // font-family -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft Yahei", "微软雅黑", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif + font-family system-ui + -ms-text-size-adjust 100% + -webkit-text-size-adjust 100% + +body + // vertical-align baseline + background-color transparent + // -webkit-backface-visibility hidden + +ul, +li, +ol + list-style none + +fieldset, +img, +iframe + border 0 + +a::-moz-focus-inner, +button::-moz-focus-inner, +input::-moz-focus-inner + border 0 + margin 0 + padding 0 + +input::-webkit-inner-spin-button, +input::-webkit-outer-spin-button + -webkit-appearance none + margin 0 + +input::-webkit-search-decoration, +input::-webkit-search-cancel-button + display none + +input:-webkit-autofill, +input:-webkit-autofill:hover, +input:-webkit-autofill:focus +input:-webkit-autofill, +textarea:-webkit-autofill, +textarea:-webkit-autofill:hover +textarea:-webkit-autofill:focus, +select:-webkit-autofill, +select:-webkit-autofill:hover, +select:-webkit-autofill:focus + -webkit-box-shadow 0 0 0px 1000px white inset + // -webkit-text-fill-color none + // transition background-color 5000s ease-in-out 0s + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +nav, +section, +summary + display block + +audio, +canvas, +video + display inline-block + +progress + vertical-align baseline + +address, +caption, +cite, +code, +dfn, +em, +i, +th, +var + font-style normal + font-weight normal + +template, +[hidden] + display none + +svg:not(:root) + overflow hidden + +caption, +th + text-align left + +h1, +h2, +h3, +h4, +h5, +h6 + font-size 100% + font-weight normal + +a + background-color transparent + -webkit-text-decoration-skip objects + text-decoration none + +a:focus, +a:hover, +a:active, +input:focus, +textarea:focus + outline 0 + +img + vertical-align middle + -ms-interpolation-mode bicubic + +table + font-size inherit + font 100% + border-collapse collapse + border-spacing 0 + +td + vertical-align top + +th + text-align inherit + +iframe + display block + +textarea + resize none + overflow auto + vertical-align top + +button, +input, +select, +textarea + font-size 100% + font inherit + text-transform none + +button, +input + line-height normal + overflow visible + -webkit-appearance none + +button + cursor pointer + +button[disabled], +input[disabled] + cursor default + +[type="checkbox"], +[type="radio"] + padding 0 + +abbr, +acronym + border 0 + font-variant normal + +b, +strong + font-weight bolder + +code, +kbd, +pre, +samp + font-family monospace, monospace + font-size 1em diff --git a/projects/lottery/zhangjun/client/assets/share_arrow.png b/projects/lottery/zhangjun/client/assets/share_arrow.png new file mode 100644 index 0000000..f8f5265 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/share_arrow.png differ diff --git a/projects/lottery/zhangjun/client/assets/share_btn.png b/projects/lottery/zhangjun/client/assets/share_btn.png new file mode 100644 index 0000000..a5b5905 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/share_btn.png differ diff --git a/projects/lottery/zhangjun/client/assets/sorry.png b/projects/lottery/zhangjun/client/assets/sorry.png new file mode 100644 index 0000000..aa22671 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/sorry.png differ diff --git a/projects/lottery/zhangjun/client/assets/title.png b/projects/lottery/zhangjun/client/assets/title.png new file mode 100644 index 0000000..1bd4611 Binary files /dev/null and b/projects/lottery/zhangjun/client/assets/title.png differ diff --git a/projects/lottery/zhangjun/client/layouts/default.vue b/projects/lottery/zhangjun/client/layouts/default.vue new file mode 100644 index 0000000..fa71714 --- /dev/null +++ b/projects/lottery/zhangjun/client/layouts/default.vue @@ -0,0 +1,52 @@ + + + + diff --git a/projects/lottery/zhangjun/client/pages/detail.vue b/projects/lottery/zhangjun/client/pages/detail.vue new file mode 100644 index 0000000..9d67c21 --- /dev/null +++ b/projects/lottery/zhangjun/client/pages/detail.vue @@ -0,0 +1,48 @@ + + + diff --git a/projects/lottery/zhangjun/client/pages/index.vue b/projects/lottery/zhangjun/client/pages/index.vue new file mode 100644 index 0000000..0e1961f --- /dev/null +++ b/projects/lottery/zhangjun/client/pages/index.vue @@ -0,0 +1,51 @@ + + + diff --git a/projects/lottery/zhangjun/client/pages/lottery.vue b/projects/lottery/zhangjun/client/pages/lottery.vue new file mode 100644 index 0000000..158eb5a --- /dev/null +++ b/projects/lottery/zhangjun/client/pages/lottery.vue @@ -0,0 +1,279 @@ + + + diff --git a/projects/lottery/zhangjun/client/utils/dial.js b/projects/lottery/zhangjun/client/utils/dial.js new file mode 100644 index 0000000..398bd13 --- /dev/null +++ b/projects/lottery/zhangjun/client/utils/dial.js @@ -0,0 +1,47 @@ +// window.onload = function() {} + +//画出转盘 +function drawLottery(lottery_index) { + if (canvas.getContext) { + var arc = Math.PI / (_lottery.title.length / 2) //根据奖品个数计算圆周角度 + ctx.clearRect(0, 0, w, h) //在给定矩形内清空一个矩形 + ctx.strokeStyle = '#e95455' //strokeStyle 属性设置或返回用于笔触的颜色、渐变或模式 + ctx.font = '16px Microsoft YaHei' //font 属性设置或返回画布上文本内容的当前字体属性 + for (var i = 0; i < _lottery.title.length; i++) { + var angle = _lottery.startAngle + i * arc + ctx.fillStyle = _lottery.colors[i] + + //创建阴影(两者同时使用) shadowBlur:阴影的模糊级数 shadowColor:阴影颜色 【注:相当耗费资源】 + //ctx.shadowBlur = 1; + //ctx.shadowColor = "#fff"; + + ctx.beginPath() + //arc(x,y,r,起始角,结束角,绘制方向) 方法创建弧/曲线(用于创建圆或部分圆) + ctx.arc(w / 2, h / 2, _lottery.outsideRadius, angle, angle + arc, false) + ctx.arc(w / 2, h / 2, _lottery.insideRadius, angle + arc, angle, true) + ctx.stroke() + ctx.fill() + ctx.save() + + //----绘制奖品开始---- + //中奖后改变背景色 + if (lottery_index != undefined && i == lottery_index) { + ctx.fillStyle = _lottery.endColor + ctx.fill() + } + ctx.fillStyle = '#fff' + + var text = _lottery.title[i], + line_height = 17, + x, + y + x = w / 2 + Math.cos(angle + arc / 2) * _lottery.textRadius + y = h / 2 + Math.sin(angle + arc / 2) * _lottery.textRadius + ctx.translate(x, y) //translate方法重新映射画布上的 (0,0) 位置 + ctx.rotate(angle + arc / 2 + Math.PI / 2) //rotate方法旋转当前的绘图 + ctx.fillText(text, -ctx.measureText(text).width / 2, 0) //measureText()方法返回包含一个对象,该对象包含以像素计的指定字体宽度 + ctx.restore() //把当前画布返回(调整)到上一个save()状态之前 + //----绘制奖品结束---- + } + } +} diff --git a/projects/lottery/zhangjun/config/.gitkeep b/projects/lottery/zhangjun/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/projects/lottery/zhangjun/config/nuxt.config.js b/projects/lottery/zhangjun/config/nuxt.config.js new file mode 100644 index 0000000..783b6c2 --- /dev/null +++ b/projects/lottery/zhangjun/config/nuxt.config.js @@ -0,0 +1,3 @@ +module.exports = (config, runtime) => { + return config +} diff --git a/projects/lottery/zhangjun/config/polyfills.js b/projects/lottery/zhangjun/config/polyfills.js new file mode 100644 index 0000000..65c4a7c --- /dev/null +++ b/projects/lottery/zhangjun/config/polyfills.js @@ -0,0 +1 @@ +// Add custom polyfills here diff --git a/projects/lottery/zhangjun/config/postcss.config.js b/projects/lottery/zhangjun/config/postcss.config.js new file mode 100644 index 0000000..d1885e5 --- /dev/null +++ b/projects/lottery/zhangjun/config/postcss.config.js @@ -0,0 +1,23 @@ +module.exports = (config, runtime) => { + config.plugins = config.plugins.concat([ + // require('postcss-write-svg')({ + // utf8: false + // }), + require('postcss-px-to-viewport')({ + viewportWidth: 750, + viewportHeight: 1334, + unitPrecision: 3, + viewportUnit: 'vw', + selectorBlackList: ['.nvw', '.hairlines'], + minPixelValue: 1, + mediaQuery: false + }), + require('postcss-viewport-units')() + // require('cssnano')({ + // preset: 'advanced', + // autoprefixer: false, + // 'postcss-zindex': false + // }) + ]) + return config +} diff --git a/projects/lottery/zhangjun/config/proxy.config.js b/projects/lottery/zhangjun/config/proxy.config.js new file mode 100644 index 0000000..7470a16 --- /dev/null +++ b/projects/lottery/zhangjun/config/proxy.config.js @@ -0,0 +1,16 @@ +// Proxies for devServer +// usage @see http-proxy-middleware +module.exports = (config, runtime) => { + const dev = process.env.NODE_ENV !== 'production' + + // Only in dev mode + // For production use `app.use(proxy)` in business modules + dev && + Object.assign(config, { + '/__api': { + target: 'http://localhost:3000', + pathRewrite: { '^/__api': '/api' } + } + }) + return config +} diff --git a/projects/lottery/zhangjun/fe.json b/projects/lottery/zhangjun/fe.json new file mode 100644 index 0000000..66ef9df --- /dev/null +++ b/projects/lottery/zhangjun/fe.json @@ -0,0 +1,5 @@ +{ + "CLIENT_DIR": "client", + "ENTRY_FILE": "index.js", + "CLIENT_MODE": "vue" +} \ No newline at end of file diff --git a/projects/lottery/zhangjun/index.js b/projects/lottery/zhangjun/index.js new file mode 100644 index 0000000..a4ebaff --- /dev/null +++ b/projects/lottery/zhangjun/index.js @@ -0,0 +1,81 @@ +module.exports = async (app, options) => { + app.get('/api/lottery', async (req, res) => { + const list = [ + { + id: 1, + name: '10元话费', // 奖品名称 + weight: 10 // 权重 + }, + { + id: 2, + name: '40积分', + weight: 32 // 权重 + }, + { + id: 3, + name: '10元话费', + weight: 10 // 权重 + }, + { + id: 4, + // icon: require("../assets/img/point_five.png"), + name: '易趣豆5', + weight: 8 // 权重 + }, + { + id: 5, + name: '易趣豆5', + weight: 8 // 权重 + }, + { + id: 6, + name: '易趣豆5', + weight: 8 // 权重 + }, + { + id: 7, + name: '1元话费', + weight: 6 // 权重 + }, + { + id: 8, + name: '1元话费', + weight: 6 // 权重 + }, + { + id: 9, + name: '1元话费', + weight: 6 // 权重 + }, + { + id: 10, + name: '1元话费', + weight: 6 // 权重 + } + ] //奖品列表 + let randomList = [] + list.forEach((item, index) => { + for (var j = 0; j < list[index].weight; j++) { + randomList.push({ + id: list[index].id, + name: list[index].name + }) + } + let randomValue = randomList[Math.floor(Math.random() * 100)] + console.log('randomList', randomValue) + }) + return { + prize_list: list, + randomList: randomList, + num: randomList[Math.floor(Math.random() * randomList.length)] + } + }) + + app.post('/api', async (req, res) => { + return { + hello: 'ServerData-post' + } + }) + + app.register(require('./server/modules/user/'), { prefix: '/api/user' }) +} diff --git a/projects/lottery/zhangjun/package-lock.json b/projects/lottery/zhangjun/package-lock.json new file mode 100644 index 0000000..aa8e932 --- /dev/null +++ b/projects/lottery/zhangjun/package-lock.json @@ -0,0 +1,162 @@ +{ + "name": "draw", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "http://npm.byted.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "http://npm.byted.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "babel-plugin-transform-runtime": { + "version": "6.23.0", + "resolved": "http://npm.byted.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz", + "integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=", + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "http://npm.byted.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "2.5.6", + "regenerator-runtime": "0.11.1" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "http://npm.byted.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "supports-color": { + "version": "2.0.0", + "resolved": "http://npm.byted.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "core-js": { + "version": "2.5.6", + "resolved": "http://npm.byted.org/core-js/-/core-js-2.5.6.tgz", + "integrity": "sha1-D+bUW/PKw6w2Sp1y3nV29OsiG50=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "http://npm.byted.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "http://npm.byted.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "http://npm.byted.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "js-base64": { + "version": "2.4.5", + "resolved": "http://npm.byted.org/js-base64/-/js-base64-2.4.5.tgz", + "integrity": "sha1-4pPNPHyC8HDXAPx6HKCi5p8QH5I=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "http://npm.byted.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "postcss": { + "version": "5.2.18", + "resolved": "http://npm.byted.org/postcss/-/postcss-5.2.18.tgz", + "integrity": "sha1-ut+hSX1GJE9jkPWLMZgw2RB4U8U=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "js-base64": "2.4.5", + "source-map": "0.5.7", + "supports-color": "3.2.3" + } + }, + "postcss-px-to-viewport": { + "version": "0.0.3", + "resolved": "http://npm.byted.org/postcss-px-to-viewport/-/postcss-px-to-viewport-0.0.3.tgz", + "integrity": "sha1-dhJZryCtcK2wH1A2lzNydteDE2M=", + "dev": true, + "requires": { + "object-assign": "4.1.1", + "postcss": "5.2.18" + } + }, + "postcss-viewport-units": { + "version": "0.1.4", + "resolved": "http://npm.byted.org/postcss-viewport-units/-/postcss-viewport-units-0.1.4.tgz", + "integrity": "sha1-M9w/muZZp6WuXqiJyDYSpSbFKpo=", + "dev": true, + "requires": { + "postcss": "5.2.18" + } + }, + "prettier": { + "version": "1.12.1", + "resolved": "http://npm.byted.org/prettier/-/prettier-1.12.1.tgz", + "integrity": "sha1-wa0g6APndJ+vkFpAnSNn4Gu+cyU=", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "http://npm.byted.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk=" + }, + "source-map": { + "version": "0.5.7", + "resolved": "http://npm.byted.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://npm.byted.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "supports-color": { + "version": "3.2.3", + "resolved": "http://npm.byted.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } +} diff --git a/projects/lottery/zhangjun/package.json b/projects/lottery/zhangjun/package.json new file mode 100644 index 0000000..ac63941 --- /dev/null +++ b/projects/lottery/zhangjun/package.json @@ -0,0 +1,23 @@ +{ + "name": "draw", + "version": "0.1.0", + "private": true, + "description": "抽奖的小demo", + "main": "index.js", + "scripts": { + "dev": "fe dev", + "start": "fe start", + "build": "fe build", + "test": "fe test" + }, + "keywords": [], + "author": "", + "dependencies": { + "babel-plugin-transform-runtime": "^6.23.0" + }, + "devDependencies": { + "postcss-px-to-viewport": "^0.0.3", + "postcss-viewport-units": "^0.1.4", + "prettier": "^1.10.2" + } +} diff --git a/projects/lottery/zhangjun/public/.gitkeep b/projects/lottery/zhangjun/public/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/projects/lottery/zhangjun/public/lark.png b/projects/lottery/zhangjun/public/lark.png new file mode 100644 index 0000000..1442ad5 Binary files /dev/null and b/projects/lottery/zhangjun/public/lark.png differ diff --git a/projects/lottery/zhangjun/server/modules/lottery/index.js b/projects/lottery/zhangjun/server/modules/lottery/index.js new file mode 100644 index 0000000..3448120 --- /dev/null +++ b/projects/lottery/zhangjun/server/modules/lottery/index.js @@ -0,0 +1,7 @@ +module.exports = async (app, options) => { + app.get('/all', async (req, res) => { + return { + hello: 'ServerData124' + } + }) +} diff --git a/projects/lottery/zhangjun/server/modules/user/index.js b/projects/lottery/zhangjun/server/modules/user/index.js new file mode 100644 index 0000000..a61b9cc --- /dev/null +++ b/projects/lottery/zhangjun/server/modules/user/index.js @@ -0,0 +1,7 @@ +module.exports = async (app, options) => { + app.get('/all', async (req, res) => { + return { + lotteryList: 'ServerData124' + } + }) +} diff --git a/projects/lottery/zhangjun/yarn.lock b/projects/lottery/zhangjun/yarn.lock new file mode 100644 index 0000000..2600700 --- /dev/null +++ b/projects/lottery/zhangjun/yarn.lock @@ -0,0 +1,89 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +escape-string-regexp@^1.0.2: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +js-base64@^2.1.9: + version "2.4.3" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582" + +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +postcss-px-to-viewport@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/postcss-px-to-viewport/-/postcss-px-to-viewport-0.0.3.tgz#761259af20ad70adb01f503697337276d7831363" + dependencies: + object-assign "^4.0.1" + postcss "^5.0.2" + +postcss-viewport-units@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/postcss-viewport-units/-/postcss-viewport-units-0.1.4.tgz#33dc3f9ae659a7a5ae5ea889c83612a526c52a9a" + dependencies: + postcss "^5.2.8" + +postcss@^5.0.2, postcss@^5.2.8: + version "5.2.18" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5" + dependencies: + chalk "^1.1.3" + js-base64 "^2.1.9" + source-map "^0.5.6" + supports-color "^3.2.3" + +prettier@^1.10.2: + version "1.11.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75" + +source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +supports-color@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0"