c7d81d9a by simon

版本提交

1 parent da367509
Showing 98 changed files with 245 additions and 222 deletions
...@@ -8,20 +8,20 @@ ...@@ -8,20 +8,20 @@
8 */ 8 */
9 9
10 module.exports = { 10 module.exports = {
11 "enabledQcloud": false, //是否开启腾讯云COS 上传功能 11 "enabledQcloud": false, //是否开启腾讯云COS 上传功能
12 // 腾讯云COS 上传功能配置表 12 // 腾讯云COS 上传功能配置表
13 "qcloud": { 13 "qcloud": {
14 "appid": "wxc57ed87f2569f701", 14 "appid": "wx61c217d6f1553ccc",
15 "secretId": "xxx", 15 "secretId": "xxx",
16 "secretKey": "xxxxx", 16 "secretKey": "xxxxx",
17 "bucket": "xxxx", 17 "bucket": "xxxx",
18 "region": "sh", 18 "region": "sh",
19 "prefix": "what-ever/you-want", 19 "prefix": "/weapp/marubi/wish-list",
20 "overWrite": true, 20 "overWrite": true,
21 "headers": { 21 "headers": {
22 "Cache-Control": "max-age=5184000" 22 "Cache-Control": "max-age=5184000"
23 } 23 }
24 }, 24 },
25 // 静态资源CDN 域名,配合CDN 功能实用,线上请确保在mp管理端已经注册域名 25 // 静态资源CDN 域名,配合CDN 功能实用,线上请确保在mp管理端已经注册域名
26 "assetsCDN": "https://res.jianhui.org/" 26 "assetsCDN": "https://kdcdn.oss-cn-shenzhen.aliyuncs.com"
27 }; 27 };
......
...@@ -27,275 +27,285 @@ var config = null; ...@@ -27,275 +27,285 @@ var config = null;
27 27
28 // 获取用户配置 28 // 获取用户配置
29 try { 29 try {
30 config = require('./config.custom.js'); 30 config = require('./config.custom.js');
31 } catch (e) { 31 } catch (e) {
32 try { 32 try {
33 config = require('./config.js'); 33 config = require('./config.js');
34 } catch (e) { 34 } catch (e) {
35 log(gutil.colors.red('丢失配置文件(config.js/config.custom.js)')); 35 log(gutil.colors.red('丢失配置文件(config.js/config.custom.js)'));
36 } 36 }
37 } 37 }
38 38
39 // 相关路径配置 39 // 相关路径配置
40 var paths = { 40 var paths = {
41 src: { 41 src: {
42 baseDir: 'src', 42 baseDir: 'src',
43 imgDir: 'src/image', 43 imgDir: 'src/image',
44 spriteDir: 'src/assets/sprites', 44 spriteDir: 'src/assets/sprites',
45 scssDir: 'src/assets/scss', 45 scssDir: 'src/assets/scss',
46 imgFiles: 'src/image/**/*', 46 imgFiles: 'src/image/**/*',
47 scssFiles: 'src/**/*.scss', 47 scssFiles: 'src/**/*.scss',
48 baseFiles: ['src/**/*.{png,js,json,wxml,wxss,wxs,ts,woff2}', '!src/assets/**/*', '!src/image/**/*'], 48 baseFiles: ['src/**/*.{png,js,json,wxml,wxss,wxs,ts,woff2}', '!src/assets/**/*', '!src/image/**/*'],
49 assetsDir: 'src/assets', 49 targetFiles: ['src/**/*.{png,js,json}', '!src/assets/**/*', '!src/image/**/*'], //modify 观察时只复制部分,baseFiles是为了涵盖其他第三方引用,如ui
50 assetsImgFiles: 'src/assets/images/**/*.{png,jpg,jpeg,svg,gif}', 50 assetsDir: 'src/assets',
51 wxmlFiles: ['src/**/*.wxml'], 51 assetsImgFiles: 'src/assets/images/**/*.{png,jpg,jpeg,svg,gif}',
52 jsFiles: 'src/**/*.js' 52 wxmlFiles: ['src/**/*.wxml'],
53 }, 53 jsFiles: 'src/**/*.js'
54 dist: { 54 },
55 baseDir: 'dist', 55 dist: {
56 imgDir: 'dist/image', 56 baseDir: 'dist',
57 wxssFiles: 'dist/**/*.wxss', 57 imgDir: 'dist/image',
58 }, 58 wxssFiles: 'dist/**/*.wxss',
59 tmp: { 59 },
60 baseDir: 'tmp', 60 tmp: {
61 imgDir: 'tmp/assets/images', 61 baseDir: 'tmp',
62 imgFiles: 'tmp/assets/images/**/*.{png,jpg,jpeg,svg,gif}' 62 imgDir: 'tmp/assets/images',
63 } 63 imgFiles: 'tmp/assets/images/**/*.{png,jpg,jpeg,svg,gif}'
64 }
64 }; 65 };
65 66
66 // 雪碧图的配置 67 // 雪碧图的配置
67 var lazyspriteConfig = { 68 var lazyspriteConfig = {
68 imagePath: paths.src.spriteDir, 69 imagePath: paths.src.spriteDir,
69 stylesheetInput: paths.src.scssDir, 70 stylesheetInput: paths.src.scssDir,
70 stylesheetRelative: paths.src.assetsDir, 71 stylesheetRelative: paths.src.assetsDir,
71 spritePath: paths.src.assetsDir + '/images', 72 spritePath: paths.src.assetsDir + '/images',
72 smartUpdate: false, 73 smartUpdate: false,
73 cssSeparator: '-', 74 cssSeparator: '-',
74 outputExtralCSS: true, 75 outputExtralCSS: true,
75 nameSpace: 'icon-' 76 nameSpace: 'icon-'
76 }; 77 };
77 78
78 // Log for output msg. 79 // Log for output msg.
79 function log() { 80 function log() {
80 var data = Array.prototype.slice.call(arguments); 81 var data = Array.prototype.slice.call(arguments);
81 gutil.log.apply(false, data); 82 gutil.log.apply(false, data);
82 } 83 }
83 84
84 // 压缩图片 85 // 压缩图片
85 function imageMin() { 86 function imageMin() {
86 // return gulp.src(paths.src.imgFiles, {si≤nce: gulp.lastRun(imageMin)}) 87 // return gulp.src(paths.src.imgFiles, {si≤nce: gulp.lastRun(imageMin)})
87 return gulp.src(paths.src.imgFiles) 88 return gulp.src(paths.src.imgFiles)
88 .pipe(newer(paths.dist.imgDir)) 89 .pipe(newer(paths.dist.imgDir))
89 .pipe(imagemin({ 90 .pipe(imagemin({
90 progressive: true, 91 progressive: true,
91 svgoPlugins: [{ 92 svgoPlugins: [{
92 removeViewBox: false 93 removeViewBox: false
93 }] 94 }]
94 })) 95 }))
95 .pipe(gulp.dest(paths.dist.imgDir)); 96 .pipe(gulp.dest(paths.dist.imgDir));
96 } 97 }
97 98
98 // assets 文件夹下的图片处理 99 // assets 文件夹下的图片处理
99 function assetsImgMin() { 100 function assetsImgMin() {
100 return gulp.src(paths.src.assetsImgFiles) 101 return gulp.src(paths.src.assetsImgFiles)
101 .pipe(newer(paths.tmp.imgDir)) 102 .pipe(newer(paths.tmp.imgDir))
102 .pipe(imagemin({ 103 .pipe(imagemin({
103 progressive: true, 104 progressive: true,
104 svgoPlugins: [{ 105 svgoPlugins: [{
105 removeViewBox: false 106 removeViewBox: false
106 }] 107 }]
107 })) 108 }))
108 .pipe(gulp.dest(paths.tmp.imgDir)) 109 .pipe(gulp.dest(paths.tmp.imgDir))
109 } 110 }
110 111
111 // Sass 编译 112 // Sass 编译
112 function sassCompile() { 113 function sassCompile() {
113 var res = config.assetsCDN + config.qcloud.prefix + '/'; 114 var res = config.assetsCDN + config.qcloud.prefix + '/';
114 // 缩放比例 1为750 115 // 缩放比例 1为750
115 var pxtorpxOpts = { 116 var pxtorpxOpts = {
116 times: 1 117 times: 1
117 }; 118 };
118 return gulp.src(paths.src.scssFiles) 119 return gulp.src(paths.src.scssFiles)
119 .pipe(sass({ 120 .pipe(sass({
120 errLogToConsole: true, 121 errLogToConsole: true,
121 outputStyle: 'expanded' 122 outputStyle: 'expanded'
122 }) 123 })
123 .on('error', sass.logError)) 124 .on('error', sass.logError))
124 .pipe(gulpif(Boolean(argv.debug), debug({ 125 .pipe(gulpif(Boolean(argv.debug), debug({
125 title: '`sassCompile` Debug:' 126 title: '`sassCompile` Debug:'
126 }))) 127 })))
127 // .pipe(postcss([lazysprite(lazyspriteConfig), pxtorpx(pxtorpxOpts), base64()])) 128 // .pipe(postcss([lazysprite(lazyspriteConfig), pxtorpx(pxtorpxOpts), base64()]))
128 .pipe(postcss([pxtorpx(pxtorpxOpts)])) 129 .pipe(postcss([pxtorpx(pxtorpxOpts)]))
129 .pipe(rename({ 130 .pipe(rename({
130 'extname': '.wxss' 131 'extname': '.wxss'
131 })) 132 }))
132 .pipe(replace('.scss', '.wxss')) 133 .pipe(replace('.scss', '.wxss'))
133 .pipe(replace('%ASSETS_IMG%/', res)) 134 // .pipe(replace('%ASSETS_IMG%/', res))
134 .pipe(replace('src/assets/images', res)) // 雪碧图CSS RUL 中的图片路径 135 .pipe(replace('../../image/oss/', res)) // 自定义图片地址
135 .pipe(gulp.dest(paths.dist.baseDir)) 136 .pipe(replace('src/assets/images', res)) // 雪碧图CSS RUL 中的图片路径
137 .pipe(gulp.dest(paths.dist.baseDir))
136 } 138 }
137 139
138 140
139 // 复制基础文件 141 // 复制基础文件
140 function copyBasicFiles() { 142 function copyBasicFiles() {
141 return gulp.src(paths.src.baseFiles, {}) 143 return gulp.src(paths.src.baseFiles, {})
142 .pipe(gulp.dest(paths.dist.baseDir)); 144 .pipe(gulp.dest(paths.dist.baseDir));
145 }
146
147 // 复制基础文件 modify
148 function copyTargetFiles() {
149 return gulp.src(paths.src.targetFiles, {})
150 .pipe(gulp.dest(paths.dist.baseDir));
143 } 151 }
144 152
145 // 复制 WXML 153 // 复制 WXML
146 function copyWXML() { 154 function copyWXML() {
147 return gulp.src(paths.src.wxmlFiles, {}) 155 return gulp.src(paths.src.wxmlFiles, {})
148 .pipe(gulp.dest(paths.dist.baseDir)); 156 .pipe(gulp.dest(paths.dist.baseDir));
149 } 157 }
150 158
151 159
152 // 重写WXML 中 image 标签中的图片路径 160 // 重写WXML 中 image 标签中的图片路径
153 function wxmlImgRewrite() { 161 function wxmlImgRewrite() {
154 var res = config.assetsCDN + config.qcloud.prefix + '/'; 162 var res = config.assetsCDN + config.qcloud.prefix + '/';
155 // console.log(res); 163 // console.log(res);
156 return gulp.src(paths.src.wxmlFiles) 164 return gulp.src(paths.src.wxmlFiles)
157 .pipe(replace('%ASSETS_IMG%/', res)) 165 // .pipe(replace('%ASSETS_IMG%/', res))
158 .pipe(gulp.dest(paths.dist.baseDir)) 166 .pipe(replace('../../image/oss/', res))
167 .pipe(gulp.dest(paths.dist.baseDir))
159 } 168 }
160 169
161 // clean 任务, dist 目录 170 // clean 任务, dist 目录
162 function cleanDist() { 171 function cleanDist() {
163 return del(paths.dist.baseDir); 172 return del(paths.dist.baseDir);
164 } 173 }
165 174
166 // clean tmp 目录 175 // clean tmp 目录
167 function cleanTmp() { 176 function cleanTmp() {
168 return del(paths.tmp.baseDir); 177 return del(paths.tmp.baseDir);
169 } 178 }
170 179
171 // 腾讯云上传任务 180 // 腾讯云上传任务
172 function qcloudCDN(cb) { 181 function qcloudCDN(cb) {
173 if (config.enabledQcloud) { 182 if (config.enabledQcloud) {
174 // return gulp.src(paths.src.assetsImgFiles, {since: gulp.lastRun(qcloudCDN)}) 183 // return gulp.src(paths.src.assetsImgFiles, {since: gulp.lastRun(qcloudCDN)})
175 return gulp.src(paths.tmp.imgFiles) 184 return gulp.src(paths.tmp.imgFiles)
176 .pipe(cache('qcloudCache')) 185 .pipe(cache('qcloudCache'))
177 .pipe(qcloudUpload({ 186 .pipe(qcloudUpload({
178 appid: config.qcloud.appid, 187 appid: config.qcloud.appid,
179 secretId: config.qcloud.secretId, 188 secretId: config.qcloud.secretId,
180 secretKey: config.qcloud.secretKey, 189 secretKey: config.qcloud.secretKey,
181 bucket: config.qcloud.bucket, 190 bucket: config.qcloud.bucket,
182 region: config.qcloud.region, 191 region: config.qcloud.region,
183 prefix: config.qcloud.prefix, 192 prefix: config.qcloud.prefix,
184 overWrite: config.qcloud.overWrite, 193 overWrite: config.qcloud.overWrite,
185 headers: config.qcloud.headers 194 headers: config.qcloud.headers
186 })); 195 }));
187 } 196 }
188 cb(); 197 cb();
189 } 198 }
190 199
191 200
192 var watchHandler = function (type, file) { 201 var watchHandler = function (type, file) {
193 var extname = path.extname(file); 202 var extname = path.extname(file);
194 // SCSS 文件 203 // SCSS 文件
195 if (extname === '.scss') { 204 if (extname === '.scss') {
196 if (type === 'removed') { 205 if (type === 'removed') {
197 var tmp = file.replace('src/', 'dist/').replace(extname, '.wxss'); 206 var tmp = file.replace('src/', 'dist/').replace(extname, '.wxss');
198 del([tmp]); 207 del([tmp]);
199 } else { 208 } else {
200 sassCompile(); 209 sassCompile();
201 } 210 }
202 } 211 }
203 // 图片文件 212 // 图片文件
204 else if (extname === '.png' || extname === '.jpg' || extname === '.jpeg' || extname === '.svg' || extname === '.gif') { 213 else if (extname === '.png' || extname === '.jpg' || extname === '.jpeg' || extname === '.svg' || extname === '.gif') {
205 if (type === 'removed') { 214 if (type === 'removed') {
206 if (file.indexOf('assets') > -1) { 215 if (file.indexOf('assets') > -1) {
207 del([file.replace('src/', 'tmp/')]); 216 del([file.replace('src/', 'tmp/')]);
208 } else { 217 } else {
209 del([file.replace('src/', 'dist/')]); 218 del([file.replace('src/', 'dist/')]);
210 } 219 }
211 } else { 220 } else {
212 imageMin(); 221 imageMin();
213 assetsImgMin(); 222 assetsImgMin();
214 qcloudCDN(); 223 qcloudCDN();
215 wxmlImgRewrite(); 224 wxmlImgRewrite();
216 } 225 }
217 } 226 }
218 227
219 // wxml 228 // wxml
220 else if (extname === '.wxml') { 229 else if (extname === '.wxml') {
221 if (type === 'removed') { 230 if (type === 'removed') {
222 var tmp = file.replace('src/', 'dist/') 231 var tmp = file.replace('src/', 'dist/')
223 del([tmp]); 232 del([tmp]);
224 } else { 233 } else {
225 copyWXML(); 234 copyWXML();
226 wxmlImgRewrite(); 235 wxmlImgRewrite();
227 } 236 }
228 } 237 }
229 238
230 // 其余文件 239 // 其余文件
231 else { 240 else {
232 if (type === 'removed') { 241 if (type === 'removed') {
233 var tmp = file.replace('src/', 'dist/'); 242 var tmp = file.replace('src/', 'dist/');
234 del([tmp]); 243 del([tmp]);
235 } else { 244 } else {
236 copyBasicFiles(); 245 copyTargetFiles(); // modify
237 // copyWXML(); 246 // copyBasicFiles();
238 // wxmlImgRewrite(); 247 // copyWXML();
239 } 248 // wxmlImgRewrite();
240 } 249 }
250 }
241 }; 251 };
242 252
243 //监听文件 253 //监听文件
244 function watch(cb) { 254 function watch(cb) {
245 var watcher = gulp.watch([ 255 var watcher = gulp.watch([
246 paths.src.baseDir, 256 paths.src.baseDir,
247 paths.tmp.imgDir 257 paths.tmp.imgDir
248 ], { 258 ], {
249 ignored: /[\/\\]\./ 259 ignored: /[\/\\]\./
250 }); 260 });
251 watcher 261 watcher
252 .on('change', function (file) { 262 .on('change', function (file) {
253 log(gutil.colors.yellow(file) + ' is changed'); 263 log(gutil.colors.yellow(file) + ' is changed');
254 watchHandler('changed', file); 264 watchHandler('changed', file);
255 }) 265 })
256 .on('add', function (file) { 266 .on('add', function (file) {
257 log(gutil.colors.yellow(file) + ' is added'); 267 log(gutil.colors.yellow(file) + ' is added');
258 watchHandler('add', file); 268 watchHandler('add', file);
259 }) 269 })
260 .on('unlink', function (file) { 270 .on('unlink', function (file) {
261 log(gutil.colors.yellow(file) + ' is deleted'); 271 log(gutil.colors.yellow(file) + ' is deleted');
262 watchHandler('removed', file); 272 watchHandler('removed', file);
263 }); 273 });
264 274
265 cb(); 275 cb();
266 } 276 }
267 277
268 //注册默认任务 278 //注册默认任务
269 gulp.task('default', gulp.series( 279 gulp.task('default', gulp.series(
270 cleanTmp, 280 cleanTmp,
271 copyBasicFiles, 281 copyBasicFiles,
272 gulp.parallel( 282 gulp.parallel(
273 sassCompile, 283 sassCompile,
274 imageMin, 284 imageMin,
275 copyWXML 285 copyWXML
276 ), 286 ),
277 wxmlImgRewrite, 287 wxmlImgRewrite,
278 assetsImgMin, 288 assetsImgMin,
279 qcloudCDN, 289 qcloudCDN,
280 watch 290 watch
281 )); 291 ));
282 292
283 //注册测试任务 293 //注册测试任务
284 gulp.task('test', gulp.series( 294 gulp.task('test', gulp.series(
285 cleanTmp, 295 cleanTmp,
286 copyBasicFiles, 296 copyBasicFiles,
287 gulp.parallel( 297 gulp.parallel(
288 sassCompile, 298 sassCompile,
289 imageMin, 299 imageMin,
290 copyWXML 300 copyWXML
291 ), 301 ),
292 wxmlImgRewrite, 302 wxmlImgRewrite,
293 assetsImgMin, 303 assetsImgMin,
294 qcloudCDN 304 qcloudCDN
295 )); 305 ));
296 306
297 // 删除任务 307 // 删除任务
298 gulp.task('clean', gulp.parallel( 308 gulp.task('clean', gulp.parallel(
299 cleanTmp, 309 cleanTmp,
300 cleanDist 310 cleanDist
301 )); 311 ));
......
1 { 1 {
2 "pages": [ 2 "pages": [
3 "pages/index/index",
3 "pages/prize-detail/prize-detail", 4 "pages/prize-detail/prize-detail",
4 "pages/user-table/user-table", 5 "pages/user-table/user-table",
5 "pages/index/index",
6 "pages/authorize/authorize", 6 "pages/authorize/authorize",
7 "pages/coop/coop", 7 "pages/coop/coop",
8 "pages/register/register", 8 "pages/register/register",
......
...@@ -116,3 +116,15 @@ ...@@ -116,3 +116,15 @@
116 .van-popup { 116 .van-popup {
117 background-color: transparent !important; 117 background-color: transparent !important;
118 } 118 }
119
120
121 button {
122 border: none;
123 margin: 0;
124 padding: 0;
125 }
126
127 button::after {
128 border: none;
129 }
130
......

338 KB | W: | H:

87 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

21 KB | W: | H:

5.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

17.7 KB | W: | H:

6.9 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

28.2 KB | W: | H:

6.29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

15.7 KB | W: | H:

7.59 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

22.9 KB | W: | H:

6.72 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

20.2 KB | W: | H:

5.39 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

17.5 KB | W: | H:

5.03 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

16.4 KB | W: | H:

4.91 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

29.6 KB | W: | H:

5.81 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

18.2 KB | W: | H:

5.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

19.9 KB | W: | H:

6.39 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
...@@ -166,14 +166,15 @@ Page({ ...@@ -166,14 +166,15 @@ Page({
166 y: 0, 166 y: 0,
167 url: '../../image/draw/draw-c1.png', 167 url: '../../image/draw/draw-c1.png',
168 }, 168 },
169 // // 头像 169 // 头像
170 // { 170 {
171 // width: 102, 171 width: 102,
172 // height: 102, 172 height: 102,
173 // x: 35, 173 x: 35,
174 // y: 700, 174 y: 779,
175 // url: userInfo.avatar, 175 borderRadius: 102,
176 // }, 176 url: userInfo.avatar,
177 },
177 // 小程序码 178 // 小程序码
178 { 179 {
179 width: 118, 180 width: 118,
......