修改js,json等文件时候,只复制被修改文件,而非全文件覆盖.
Showing
6 changed files
with
305 additions
and
217 deletions
... | @@ -6,6 +6,7 @@ | ... | @@ -6,6 +6,7 @@ |
6 | 6 | ||
7 | var path = require('path'); | 7 | var path = require('path'); |
8 | var gulp = require('gulp'); | 8 | var gulp = require('gulp'); |
9 | var changed = require('gulp-changed'); | ||
9 | var sass = require('gulp-sass'); | 10 | var sass = require('gulp-sass'); |
10 | var rename = require('gulp-rename'); | 11 | var rename = require('gulp-rename'); |
11 | var imagemin = require('gulp-imagemin'); | 12 | var imagemin = require('gulp-imagemin'); |
... | @@ -27,275 +28,282 @@ var config = null; | ... | @@ -27,275 +28,282 @@ var config = null; |
27 | 28 | ||
28 | // 获取用户配置 | 29 | // 获取用户配置 |
29 | try { | 30 | try { |
30 | config = require('./config.custom.js'); | 31 | config = require('./config.custom.js'); |
31 | } catch (e) { | 32 | } catch (e) { |
32 | try { | 33 | try { |
33 | config = require('./config.js'); | 34 | config = require('./config.js'); |
34 | } catch (e) { | 35 | } catch (e) { |
35 | log(gutil.colors.red('丢失配置文件(config.js/config.custom.js)')); | 36 | log(gutil.colors.red('丢失配置文件(config.js/config.custom.js)')); |
36 | } | 37 | } |
37 | } | 38 | } |
38 | 39 | ||
39 | // 相关路径配置 | 40 | // 相关路径配置 |
40 | var paths = { | 41 | var paths = { |
41 | src: { | 42 | src: { |
42 | baseDir: 'src', | 43 | baseDir: 'src', |
43 | imgDir: 'src/image', | 44 | imgDir: 'src/image', |
44 | spriteDir: 'src/assets/sprites', | 45 | spriteDir: 'src/assets/sprites', |
45 | scssDir: 'src/assets/scss', | 46 | scssDir: 'src/assets/scss', |
46 | imgFiles: 'src/image/**/*', | 47 | imgFiles: 'src/image/**/*', |
47 | scssFiles: 'src/**/*.scss', | 48 | scssFiles: 'src/**/*.scss', |
48 | baseFiles: ['src/**/*.{png,js,json,wxml,wxss,wxs,ts,woff2}', '!src/assets/**/*', '!src/image/**/*'], | 49 | baseFiles: ['src/**/*.{png,js,json,wxml,wxss,wxs,ts,woff2}', '!src/assets/**/*', '!src/image/**/*'], |
49 | assetsDir: 'src/assets', | 50 | busFiles: ['src/**/*.{js,json}', '!src/assets/**/*', '!src/image/**/*', '!src/ui/**/*'], |
50 | assetsImgFiles: 'src/assets/images/**/*.{png,jpg,jpeg,svg,gif}', | 51 | assetsDir: 'src/assets', |
51 | wxmlFiles: ['src/**/*.wxml'], | 52 | assetsImgFiles: 'src/assets/images/**/*.{png,jpg,jpeg,svg,gif}', |
52 | jsFiles: 'src/**/*.js' | 53 | wxmlFiles: ['src/**/*.wxml'], |
53 | }, | 54 | jsFiles: 'src/**/*.js' |
54 | dist: { | 55 | }, |
55 | baseDir: 'dist', | 56 | dist: { |
56 | imgDir: 'dist/image', | 57 | baseDir: 'dist', |
57 | wxssFiles: 'dist/**/*.wxss', | 58 | imgDir: 'dist/image', |
58 | }, | 59 | wxssFiles: 'dist/**/*.wxss', |
59 | tmp: { | 60 | }, |
60 | baseDir: 'tmp', | 61 | tmp: { |
61 | imgDir: 'tmp/assets/images', | 62 | baseDir: 'tmp', |
62 | imgFiles: 'tmp/assets/images/**/*.{png,jpg,jpeg,svg,gif}' | 63 | imgDir: 'tmp/assets/images', |
63 | } | 64 | imgFiles: 'tmp/assets/images/**/*.{png,jpg,jpeg,svg,gif}' |
65 | } | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | // 雪碧图的配置 | 68 | // 雪碧图的配置 |
67 | var lazyspriteConfig = { | 69 | var lazyspriteConfig = { |
68 | imagePath: paths.src.spriteDir, | 70 | imagePath: paths.src.spriteDir, |
69 | stylesheetInput: paths.src.scssDir, | 71 | stylesheetInput: paths.src.scssDir, |
70 | stylesheetRelative: paths.src.assetsDir, | 72 | stylesheetRelative: paths.src.assetsDir, |
71 | spritePath: paths.src.assetsDir + '/images', | 73 | spritePath: paths.src.assetsDir + '/images', |
72 | smartUpdate: false, | 74 | smartUpdate: false, |
73 | cssSeparator: '-', | 75 | cssSeparator: '-', |
74 | outputExtralCSS: true, | 76 | outputExtralCSS: true, |
75 | nameSpace: 'icon-' | 77 | nameSpace: 'icon-' |
76 | }; | 78 | }; |
77 | 79 | ||
78 | // Log for output msg. | 80 | // Log for output msg. |
79 | function log() { | 81 | function log() { |
80 | var data = Array.prototype.slice.call(arguments); | 82 | var data = Array.prototype.slice.call(arguments); |
81 | gutil.log.apply(false, data); | 83 | gutil.log.apply(false, data); |
82 | } | 84 | } |
83 | 85 | ||
84 | // 压缩图片 | 86 | // 压缩图片 |
85 | function imageMin() { | 87 | function imageMin() { |
86 | // return gulp.src(paths.src.imgFiles, {si≤nce: gulp.lastRun(imageMin)}) | 88 | // return gulp.src(paths.src.imgFiles, {si≤nce: gulp.lastRun(imageMin)}) |
87 | return gulp.src(paths.src.imgFiles) | 89 | return gulp.src(paths.src.imgFiles) |
88 | .pipe(newer(paths.dist.imgDir)) | 90 | .pipe(newer(paths.dist.imgDir)) |
89 | .pipe(imagemin({ | 91 | .pipe(imagemin({ |
90 | progressive: true, | 92 | progressive: true, |
91 | svgoPlugins: [{ | 93 | svgoPlugins: [{ |
92 | removeViewBox: false | 94 | removeViewBox: false |
93 | }] | 95 | }] |
94 | })) | 96 | })) |
95 | .pipe(gulp.dest(paths.dist.imgDir)); | 97 | .pipe(gulp.dest(paths.dist.imgDir)); |
96 | } | 98 | } |
97 | 99 | ||
98 | // assets 文件夹下的图片处理 | 100 | // assets 文件夹下的图片处理 |
99 | function assetsImgMin() { | 101 | function assetsImgMin() { |
100 | return gulp.src(paths.src.assetsImgFiles) | 102 | return gulp.src(paths.src.assetsImgFiles) |
101 | .pipe(newer(paths.tmp.imgDir)) | 103 | .pipe(newer(paths.tmp.imgDir)) |
102 | .pipe(imagemin({ | 104 | .pipe(imagemin({ |
103 | progressive: true, | 105 | progressive: true, |
104 | svgoPlugins: [{ | 106 | svgoPlugins: [{ |
105 | removeViewBox: false | 107 | removeViewBox: false |
106 | }] | 108 | }] |
107 | })) | 109 | })) |
108 | .pipe(gulp.dest(paths.tmp.imgDir)) | 110 | .pipe(gulp.dest(paths.tmp.imgDir)) |
109 | } | 111 | } |
110 | 112 | ||
111 | // Sass 编译 | 113 | // Sass 编译 |
112 | function sassCompile() { | 114 | function sassCompile() { |
113 | var res = config.assetsCDN + config.qcloud.prefix + '/'; | 115 | var res = config.assetsCDN + config.qcloud.prefix + '/'; |
114 | // 缩放比例 1为750 | 116 | // 缩放比例 1为750 |
115 | var pxtorpxOpts = { | 117 | var pxtorpxOpts = { |
116 | times: 1 | 118 | times: 1 |
117 | }; | 119 | }; |
118 | return gulp.src(paths.src.scssFiles) | 120 | return gulp.src(paths.src.scssFiles) |
119 | .pipe(sass({ | 121 | .pipe(sass({ |
120 | errLogToConsole: true, | 122 | errLogToConsole: true, |
121 | outputStyle: 'expanded' | 123 | outputStyle: 'expanded' |
122 | }) | 124 | }) |
123 | .on('error', sass.logError)) | 125 | .on('error', sass.logError)) |
124 | .pipe(gulpif(Boolean(argv.debug), debug({ | 126 | .pipe(gulpif(Boolean(argv.debug), debug({ |
125 | title: '`sassCompile` Debug:' | 127 | title: '`sassCompile` Debug:' |
126 | }))) | 128 | }))) |
127 | // .pipe(postcss([lazysprite(lazyspriteConfig), pxtorpx(pxtorpxOpts), base64()])) | 129 | // .pipe(postcss([lazysprite(lazyspriteConfig), pxtorpx(pxtorpxOpts), base64()])) |
128 | .pipe(postcss([pxtorpx(pxtorpxOpts)])) | 130 | .pipe(postcss([pxtorpx(pxtorpxOpts)])) |
129 | .pipe(rename({ | 131 | .pipe(rename({ |
130 | 'extname': '.wxss' | 132 | 'extname': '.wxss' |
131 | })) | 133 | })) |
132 | .pipe(replace('.scss', '.wxss')) | 134 | .pipe(replace('.scss', '.wxss')) |
133 | // .pipe(replace('%ASSETS_IMG%/', res)) | 135 | // .pipe(replace('%ASSETS_IMG%/', res)) |
134 | // .pipe(replace('src/assets/images', res)) // 雪碧图CSS RUL 中的图片路径 | 136 | // .pipe(replace('src/assets/images', res)) // 雪碧图CSS RUL 中的图片路径 |
135 | .pipe(gulp.dest(paths.dist.baseDir)) | 137 | .pipe(gulp.dest(paths.dist.baseDir)) |
136 | } | 138 | } |
137 | 139 | ||
140 | // 复制业务文件 只复制修改过的文件 | ||
141 | function copyModifyFiles() { | ||
142 | return gulp.src(paths.src.busFiles) | ||
143 | .pipe(changed(paths.dist.baseDir)) | ||
144 | .pipe(gulp.dest(paths.dist.baseDir)); | ||
145 | } | ||
138 | 146 | ||
139 | // 复制基础文件 | 147 | // 复制基础文件 |
140 | function copyBasicFiles() { | 148 | function copyBasicFiles() { |
141 | return gulp.src(paths.src.baseFiles, {}) | 149 | return gulp.src(paths.src.baseFiles, {}) |
142 | .pipe(gulp.dest(paths.dist.baseDir)); | 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 | return gulp.src(paths.src.wxmlFiles) |
156 | return gulp.src(paths.src.wxmlFiles) | 164 | // .pipe(replace('%ASSETS_IMG%/', res)) |
157 | // .pipe(replace('%ASSETS_IMG%/', res)) | 165 | .pipe(gulp.dest(paths.dist.baseDir)) |
158 | .pipe(gulp.dest(paths.dist.baseDir)) | ||
159 | } | 166 | } |
160 | 167 | ||
161 | // clean 任务, dist 目录 | 168 | // clean 任务, dist 目录 |
162 | function cleanDist() { | 169 | function cleanDist() { |
163 | return del(paths.dist.baseDir); | 170 | return del(paths.dist.baseDir); |
164 | } | 171 | } |
165 | 172 | ||
166 | // clean tmp 目录 | 173 | // clean tmp 目录 |
167 | function cleanTmp() { | 174 | function cleanTmp() { |
168 | return del(paths.tmp.baseDir); | 175 | return del(paths.tmp.baseDir); |
169 | } | 176 | } |
170 | 177 | ||
171 | // 腾讯云上传任务 | 178 | // 腾讯云上传任务 |
172 | function qcloudCDN(cb) { | 179 | function qcloudCDN(cb) { |
173 | if (config.enabledQcloud) { | 180 | if (config.enabledQcloud) { |
174 | // return gulp.src(paths.src.assetsImgFiles, {since: gulp.lastRun(qcloudCDN)}) | 181 | // return gulp.src(paths.src.assetsImgFiles, {since: gulp.lastRun(qcloudCDN)}) |
175 | return gulp.src(paths.tmp.imgFiles) | 182 | return gulp.src(paths.tmp.imgFiles) |
176 | .pipe(cache('qcloudCache')) | 183 | .pipe(cache('qcloudCache')) |
177 | .pipe(qcloudUpload({ | 184 | .pipe(qcloudUpload({ |
178 | appid: config.qcloud.appid, | 185 | appid: config.qcloud.appid, |
179 | secretId: config.qcloud.secretId, | 186 | secretId: config.qcloud.secretId, |
180 | secretKey: config.qcloud.secretKey, | 187 | secretKey: config.qcloud.secretKey, |
181 | bucket: config.qcloud.bucket, | 188 | bucket: config.qcloud.bucket, |
182 | region: config.qcloud.region, | 189 | region: config.qcloud.region, |
183 | prefix: config.qcloud.prefix, | 190 | prefix: config.qcloud.prefix, |
184 | overWrite: config.qcloud.overWrite, | 191 | overWrite: config.qcloud.overWrite, |
185 | headers: config.qcloud.headers | 192 | headers: config.qcloud.headers |
186 | })); | 193 | })); |
187 | } | 194 | } |
188 | cb(); | 195 | cb(); |
189 | } | 196 | } |
190 | 197 | ||
191 | 198 | ||
192 | var watchHandler = function (type, file) { | 199 | var watchHandler = function (type, file) { |
193 | var extname = path.extname(file); | 200 | var extname = path.extname(file); |
194 | // SCSS 文件 | 201 | // SCSS 文件 |
195 | if (extname === '.scss') { | 202 | if (extname === '.scss') { |
196 | if (type === 'removed') { | 203 | if (type === 'removed') { |
197 | var tmp = file.replace('src/', 'dist/').replace(extname, '.wxss'); | 204 | var tmp = file.replace('src/', 'dist/').replace(extname, '.wxss'); |
198 | del([tmp]); | 205 | del([tmp]); |
199 | } else { | 206 | } else { |
200 | sassCompile(); | 207 | sassCompile(); |
201 | } | 208 | } |
202 | } | 209 | } |
203 | // 图片文件 | 210 | // 图片文件 |
204 | else if (extname === '.png' || extname === '.jpg' || extname === '.jpeg' || extname === '.svg' || extname === '.gif') { | 211 | else if (extname === '.png' || extname === '.jpg' || extname === '.jpeg' || extname === '.svg' || extname === '.gif') { |
205 | if (type === 'removed') { | 212 | if (type === 'removed') { |
206 | if (file.indexOf('assets') > -1) { | 213 | if (file.indexOf('assets') > -1) { |
207 | del([file.replace('src/', 'tmp/')]); | 214 | del([file.replace('src/', 'tmp/')]); |
208 | } else { | 215 | } else { |
209 | del([file.replace('src/', 'dist/')]); | 216 | del([file.replace('src/', 'dist/')]); |
210 | } | 217 | } |
211 | } else { | 218 | } else { |
212 | imageMin(); | 219 | imageMin(); |
213 | // assetsImgMin(); | 220 | // assetsImgMin(); |
214 | // qcloudCDN(); | 221 | // qcloudCDN(); |
215 | wxmlImgRewrite(); | 222 | wxmlImgRewrite(); |
216 | } | 223 | } |
217 | } | 224 | } |
218 | 225 | ||
219 | // wxml | 226 | // wxml |
220 | else if (extname === '.wxml') { | 227 | else if (extname === '.wxml') { |
221 | if (type === 'removed') { | 228 | if (type === 'removed') { |
222 | var tmp = file.replace('src/', 'dist/') | 229 | var tmp = file.replace('src/', 'dist/') |
223 | del([tmp]); | 230 | del([tmp]); |
224 | } else { | 231 | } else { |
225 | copyWXML(); | 232 | copyWXML(); |
226 | wxmlImgRewrite(); | 233 | wxmlImgRewrite(); |
227 | } | 234 | } |
228 | } | 235 | } |
229 | 236 | ||
230 | // 其余文件 | 237 | // 其余文件 |
231 | else { | 238 | else { |
232 | if (type === 'removed') { | 239 | if (type === 'removed') { |
233 | var tmp = file.replace('src/', 'dist/'); | 240 | var tmp = file.replace('src/', 'dist/'); |
234 | del([tmp]); | 241 | del([tmp]); |
235 | } else { | 242 | } else { |
236 | copyBasicFiles(); | 243 | // copyBasicFiles(); |
237 | // copyWXML(); | 244 | copyModifyFiles(); // 复制修改过的业务文件 |
238 | wxmlImgRewrite(); | 245 | // copyWXML(); |
239 | } | 246 | wxmlImgRewrite(); |
240 | } | 247 | } |
248 | } | ||
241 | }; | 249 | }; |
242 | 250 | ||
243 | //监听文件 | 251 | //监听文件 |
244 | function watch(cb) { | 252 | function watch(cb) { |
245 | var watcher = gulp.watch([ | 253 | var watcher = gulp.watch([ |
246 | paths.src.baseDir, | 254 | paths.src.baseDir, |
247 | paths.tmp.imgDir | 255 | paths.tmp.imgDir |
248 | ], { | 256 | ], { |
249 | ignored: /[\/\\]\./ | 257 | ignored: /[\/\\]\./ |
250 | }); | 258 | }); |
251 | watcher | 259 | watcher |
252 | .on('change', function (file) { | 260 | .on('change', function (file) { |
253 | log(gutil.colors.yellow(file) + ' is changed'); | 261 | log(gutil.colors.yellow(file) + ' is changed'); |
254 | watchHandler('changed', file); | 262 | watchHandler('changed', file); |
255 | }) | 263 | }) |
256 | .on('add', function (file) { | 264 | .on('add', function (file) { |
257 | log(gutil.colors.yellow(file) + ' is added'); | 265 | log(gutil.colors.yellow(file) + ' is added'); |
258 | watchHandler('add', file); | 266 | watchHandler('add', file); |
259 | }) | 267 | }) |
260 | .on('unlink', function (file) { | 268 | .on('unlink', function (file) { |
261 | log(gutil.colors.yellow(file) + ' is deleted'); | 269 | log(gutil.colors.yellow(file) + ' is deleted'); |
262 | watchHandler('removed', file); | 270 | watchHandler('removed', file); |
263 | }); | 271 | }); |
264 | 272 | ||
265 | cb(); | 273 | cb(); |
266 | } | 274 | } |
267 | 275 | ||
268 | //注册默认任务 | 276 | //注册默认任务 |
269 | gulp.task('default', gulp.series( | 277 | gulp.task('default', gulp.series( |
270 | cleanTmp, | 278 | cleanTmp, |
271 | copyBasicFiles, | 279 | copyBasicFiles, |
272 | gulp.parallel( | 280 | gulp.parallel( |
273 | sassCompile, | 281 | sassCompile, |
274 | imageMin, | 282 | imageMin, |
275 | copyWXML | 283 | copyWXML |
276 | ), | 284 | ), |
277 | wxmlImgRewrite, | 285 | wxmlImgRewrite, |
278 | // assetsImgMin, | 286 | // assetsImgMin, |
279 | // qcloudCDN, | 287 | // qcloudCDN, |
280 | watch | 288 | watch |
281 | )); | 289 | )); |
282 | 290 | ||
283 | //注册测试任务 | 291 | //注册测试任务 |
284 | gulp.task('test', gulp.series( | 292 | gulp.task('test', gulp.series( |
285 | cleanTmp, | 293 | cleanTmp, |
286 | copyBasicFiles, | 294 | copyBasicFiles, |
287 | gulp.parallel( | 295 | gulp.parallel( |
288 | sassCompile, | 296 | sassCompile, |
289 | imageMin, | 297 | imageMin, |
290 | copyWXML | 298 | copyWXML |
291 | ), | 299 | ), |
292 | wxmlImgRewrite, | 300 | wxmlImgRewrite, |
293 | // assetsImgMin, | 301 | // assetsImgMin, |
294 | // qcloudCDN | 302 | // qcloudCDN |
295 | )); | 303 | )); |
296 | 304 | ||
297 | // 删除任务 | 305 | // 删除任务 |
298 | gulp.task('clean', gulp.parallel( | 306 | gulp.task('clean', gulp.parallel( |
299 | cleanTmp, | 307 | cleanTmp, |
300 | cleanDist | 308 | cleanDist |
301 | )); | 309 | )); | ... | ... |
... | @@ -43,7 +43,7 @@ module.exports = { | ... | @@ -43,7 +43,7 @@ module.exports = { |
43 | auctionSubmit: '/auction/submit', // post 拍卖出价提交 | 43 | auctionSubmit: '/auction/submit', // post 拍卖出价提交 |
44 | auctionRecordList: '/auction/record/list', // post 拍卖出价列表 | 44 | auctionRecordList: '/auction/record/list', // post 拍卖出价列表 |
45 | auctionRecordLast: '/auction/record/last', // post 获得最高价 和列表 | 45 | auctionRecordLast: '/auction/record/last', // post 获得最高价 和列表 |
46 | auctionMine: '/auction/member', // post 我的拍卖产品 | 46 | auctionMine: '/auction/member/list', // post 我的拍卖产品 |
47 | 47 | ||
48 | // 秒杀 | 48 | // 秒杀 |
49 | seckillList: '/seckill/list', // post 秒杀列表 | 49 | seckillList: '/seckill/list', // post 秒杀列表 | ... | ... |
... | @@ -172,6 +172,7 @@ Page({ | ... | @@ -172,6 +172,7 @@ Page({ |
172 | element.recordTime = new Date(element.recordTime).toString("yyyy.MM.dd hh:mm:ss"); | 172 | element.recordTime = new Date(element.recordTime).toString("yyyy.MM.dd hh:mm:ss"); |
173 | element.memberPhone = element.memberPhone.substr(0, 3) + '****' + element.memberPhone.substr(7); | 173 | element.memberPhone = element.memberPhone.substr(0, 3) + '****' + element.memberPhone.substr(7); |
174 | }); | 174 | }); |
175 | priceInfo = []; | ||
175 | this.setData({ | 176 | this.setData({ |
176 | priceInfo: priceInfo, | 177 | priceInfo: priceInfo, |
177 | maxPrice: result.maxPrice || 0, | 178 | maxPrice: result.maxPrice || 0, | ... | ... |
... | @@ -47,25 +47,28 @@ | ... | @@ -47,25 +47,28 @@ |
47 | <view class="t1">延时周期:{{productInfo.delayPeriod}}</view> | 47 | <view class="t1">延时周期:{{productInfo.delayPeriod}}</view> |
48 | </view> | 48 | </view> |
49 | <view class="auction-table"> | 49 | <view class="auction-table"> |
50 | <view class="tab"> | 50 | <view wx:if="{{priceInfo && priceInfo.length > 0}}"> |
51 | <!-- 表头 --> | 51 | <view class="tab"> |
52 | <view class="tab-item"> | 52 | <!-- 表头 --> |
53 | <view class="item item1">状态</view> | 53 | <view class="tab-item"> |
54 | <view class="item item2">竞拍者</view> | 54 | <view class="item item1">状态</view> |
55 | <view class="item item3">出价</view> | 55 | <view class="item item2">竞拍者</view> |
56 | <view class="item item4">时间</view> | 56 | <view class="item item3">出价</view> |
57 | </view> | 57 | <view class="item item4">时间</view> |
58 | <!-- 表体 --> | 58 | </view> |
59 | <view wx:for="{{priceInfo}}" wx:key="index" class="tab-item {{index != 0 ? 'tab-item2':''}}"> | 59 | <!-- 表体 --> |
60 | <view class="item item1"> | 60 | <view wx:for="{{priceInfo}}" wx:key="index" class="tab-item {{index != 0 ? 'tab-item2':''}}"> |
61 | <view class="block">{{index == 0 ? "领先" : "淘汰"}}</view> | 61 | <view class="item item1"> |
62 | <view class="block">{{index == 0 ? "领先" : "淘汰"}}</view> | ||
63 | </view> | ||
64 | <view class="item item2">{{item.memberPhone}}</view> | ||
65 | <view class="item item3">¥{{item.priceStr}}</view> | ||
66 | <view class="item item4">{{item.recordTime}}</view> | ||
62 | </view> | 67 | </view> |
63 | <view class="item item2">{{item.memberPhone}}</view> | ||
64 | <view class="item item3">¥{{item.priceStr}}</view> | ||
65 | <view class="item item4">{{item.recordTime}}</view> | ||
66 | </view> | 68 | </view> |
69 | <view bindtap="onShowAuctionBidDetailHandler" class="tips">查看所有{{priceTotal}}次出价></view> | ||
67 | </view> | 70 | </view> |
68 | <view bindtap="onShowAuctionBidDetailHandler" class="tips">查看所有{{priceTotal}}次出价></view> | 71 | <view wx:else>大家都很矜持,该拍卖还未有人出价</view> |
69 | </view> | 72 | </view> |
70 | </view> | 73 | </view> |
71 | </view> | 74 | </view> | ... | ... |
1 | import { | 1 | import { |
2 | getBindtapData | 2 | getBindtapData |
3 | } from '../../utils/util'; | 3 | } from '../../utils/util'; |
4 | let Date = require('../../utils/date.js'); | ||
4 | 5 | ||
5 | let app = getApp(); | 6 | let app = getApp(); |
6 | Page({ | 7 | Page({ |
7 | data: {}, | 8 | data: { |
9 | authorizeVisible: false, | ||
10 | total: 0, | ||
11 | page: 1, | ||
12 | size: 10, | ||
13 | dataList: [], | ||
14 | }, | ||
8 | onShareAppMessage() {}, | 15 | onShareAppMessage() {}, |
9 | showAuth() { | 16 | showAuth() { |
10 | this.setData({ | 17 | this.setData({ |
11 | authorizeVisible: true | 18 | authorizeVisible: true |
12 | }) | 19 | }) |
13 | }, | 20 | }, |
14 | onLoad(options) {}, | 21 | onShow() { |
22 | |||
23 | }, | ||
24 | onLoad(options) { | ||
25 | this.resetPage(); | ||
26 | this.initData(); | ||
27 | }, | ||
28 | initData() { | ||
29 | this.queryAuctionList(); | ||
30 | }, | ||
31 | |||
32 | // 到达底部 | ||
33 | onReachBottom() { | ||
34 | if (this.data.dataList.length < this.data.total) { | ||
35 | this.setData({ | ||
36 | page: this.data.page + 1 | ||
37 | }); | ||
38 | this.queryAuctionList(); | ||
39 | } | ||
40 | }, | ||
41 | |||
42 | // 重置页面列表 点击搜索条件时需要 | ||
43 | resetPage() { | ||
44 | this.setData({ | ||
45 | page: 1, | ||
46 | dataList: [] | ||
47 | }) | ||
48 | }, | ||
49 | |||
50 | // 拍卖列表 | ||
51 | queryAuctionList() { | ||
52 | return new Promise((resolve, reject) => { | ||
53 | app.post({ | ||
54 | url: app.api.auctionMine, | ||
55 | data: { | ||
56 | page: this.data.page, | ||
57 | size: this.data.size, | ||
58 | } | ||
59 | }).then((result) => { | ||
60 | if (!result) return; | ||
61 | if (!result.list) return; | ||
62 | let dataList = result.list; | ||
63 | dataList.forEach(element => { | ||
64 | element.dateStr = new Date(element.startTime).toString("yyyy.MM.dd hh:mm") + " - " + new Date(element.endTime).toString("yyyy.MM.dd hh:mm"); | ||
65 | }); | ||
66 | dataList = this.data.dataList.concat(dataList); | ||
67 | this.setData({ | ||
68 | dataList: dataList, | ||
69 | total: result.total | ||
70 | }) | ||
71 | resolve(); | ||
72 | }) | ||
73 | }) | ||
74 | }, | ||
75 | |||
15 | // 隐藏蒙层 | 76 | // 隐藏蒙层 |
16 | hideMask() { | 77 | hideMask() { |
17 | this.setData({ | 78 | this.setData({ | ... | ... |
... | @@ -4,7 +4,22 @@ | ... | @@ -4,7 +4,22 @@ |
4 | <!-- <view class="app__top-shadow"></view> --> | 4 | <!-- <view class="app__top-shadow"></view> --> |
5 | <view class="app__content main"> | 5 | <view class="app__content main"> |
6 | <view class="top-space"></view> | 6 | <view class="top-space"></view> |
7 | <view class="content">我的竞拍订单</view> | 7 | <view class="content"> |
8 | <view class="list"> | ||
9 | <view wx:for="{{dataList}}" wx:key="{{index}}" class="border list-item"> | ||
10 | <view class="prize"> | ||
11 | <image class="image" mode="aspectFill" src="{{item.auctionImage && item.auctionImage[0] || ''}}" /> | ||
12 | </view> | ||
13 | <view class="cont"> | ||
14 | <view class="tt tit">{{item.auctionName}}</view> | ||
15 | <view class="tt t2">活动区域:{{item.district}}</view> | ||
16 | <view class="tt t3">{{item.dateStr}}</view> | ||
17 | <view class="tt t4 m1">{{item.dateStr}}</view> | ||
18 | <view class="tt t4">{{item.dateStr}}</view> | ||
19 | </view> | ||
20 | </view> | ||
21 | </view> | ||
22 | </view> | ||
8 | </view> | 23 | </view> |
9 | </view> | 24 | </view> |
10 | <van-popup show="{{ authorizeVisible }}"> | 25 | <van-popup show="{{ authorizeVisible }}"> | ... | ... |
-
Please register or sign in to post a comment