Authored by weiqingting

限购码转测

@@ -9,6 +9,9 @@ var gulp=require('gulp'), @@ -9,6 +9,9 @@ var gulp=require('gulp'),
9 autoprefixer = require('gulp-autoprefixer'), 9 autoprefixer = require('gulp-autoprefixer'),
10 server = require('gulp-develop-server'), 10 server = require('gulp-develop-server'),
11 webpack = require('webpack'); 11 webpack = require('webpack');
  12 +var crypto = require('crypto');
  13 +var rename = require("gulp-rename");
  14 +var clean = require('gulp-clean');
12 15
13 16
14 var wconfig = require('./webpack.config'); 17 var wconfig = require('./webpack.config');
@@ -29,6 +32,7 @@ var dist_dir = { @@ -29,6 +32,7 @@ var dist_dir = {
29 }; 32 };
30 33
31 var cdn_domain = 'http://cdn.yoho.cn/'; 34 var cdn_domain = 'http://cdn.yoho.cn/';
  35 +var md5="";
32 36
33 var ftpConfig = { 37 var ftpConfig = {
34 host: '218.94.75.58', 38 host: '218.94.75.58',
@@ -41,7 +45,7 @@ gulp.task('default',["sass","js"]); @@ -41,7 +45,7 @@ gulp.task('default',["sass","js"]);
41 45
42 gulp.task('start',["default","default-watch","server"]); 46 gulp.task('start',["default","default-watch","server"]);
43 47
44 -gulp.task('build',["buildjs","assets","static-config"]); 48 +gulp.task('build',["clean","buildjs","assets","static-config"]);//"static-config"
45 49
46 //预编译css 50 //预编译css
47 gulp.task('sass', function() { 51 gulp.task('sass', function() {
@@ -64,13 +68,20 @@ gulp.task("default-watch",function(){ @@ -64,13 +68,20 @@ gulp.task("default-watch",function(){
64 gulp.watch('sass/**/*.scss', ['sass']); 68 gulp.watch('sass/**/*.scss', ['sass']);
65 gulp.watch('js/**/*.js', ['js']); 69 gulp.watch('js/**/*.js', ['js']);
66 }); 70 });
67 - 71 +gulp.task("clean",function(){
  72 + return gulp.src(dist_dir.js, {read: false})
  73 + .pipe(clean());
  74 +});
68 //发布js文件 75 //发布js文件
69 gulp.task("buildjs",["js"],function(){ 76 gulp.task("buildjs",["js"],function(){
70 - gulp.src(dist_dir.js + '/libs.js') 77 + md5="-"+crypto.createHash('md5').update(new Date().toString()).digest('hex');
  78 + console.log(md5);
  79 + gulp.src(path.join(public_dir,"dist") + '/*.js')
71 .pipe(uglify()) 80 .pipe(uglify())
72 - .pipe(md5())  
73 - .pipe(gulp.dest('./dist/libs')); 81 + .pipe(rename({
  82 + suffix:md5
  83 + }))
  84 + .pipe(gulp.dest(dist_dir.js));
74 }); 85 });
75 //发布静态资源 86 //发布静态资源
76 gulp.task('assets', function() { 87 gulp.task('assets', function() {
@@ -93,19 +104,15 @@ gulp.task("static-config",function(){ @@ -93,19 +104,15 @@ gulp.task("static-config",function(){
93 var files = fs.readdirSync('./dist/libs'); 104 var files = fs.readdirSync('./dist/libs');
94 var staticConfig={ 105 var staticConfig={
95 test:{ 106 test:{
96 - libs: '/dist/libs.js',  
97 - js: '/dist/index.js',  
98 - css:'/css/all.css' 107 + path:'/dist'
99 }, 108 },
100 preview: { 109 preview: {
101 - libs: cdn_domain + 'libs/' + files[0],  
102 - js: cdn_domain + config.name + '/' + config.version + '/index.js',  
103 - css: cdn_domain + config.name + '/' + config.version + '/all.css' 110 + path: cdn_domain + config.name + '/' + config.version,
  111 + md5:md5
104 }, 112 },
105 production: { 113 production: {
106 - libs: cdn_domain + 'libs/' + files[0],  
107 - js: cdn_domain + config.name + '/' + config.version + '/index.js',  
108 - css: cdn_domain + config.name + '/' + config.version + '/all.css' 114 + path: cdn_domain + config.name + '/' + config.version,
  115 + md5:md5
109 } 116 }
110 } 117 }
111 fs.writeFileSync('../server/staticConfig.js', "exports.staticDir = " + JSON.stringify(staticConfig)); 118 fs.writeFileSync('../server/staticConfig.js', "exports.staticDir = " + JSON.stringify(staticConfig));
@@ -132,7 +132,7 @@ var edit=require('../common/edit'); @@ -132,7 +132,7 @@ var edit=require('../common/edit');
132 res=res.data; 132 res=res.data;
133 if(res.code=="200"){ 133 if(res.code=="200"){
134 e.$tip('提交成功',function(){ 134 e.$tip('提交成功',function(){
135 - location.href="/coupon/index"; 135 + location.href="/market/coupon/index";
136 },'growl-success'); 136 },'growl-success');
137 }else{ 137 }else{
138 e.$tip(res.message); 138 e.$tip(res.message);
@@ -204,7 +204,7 @@ $('#basicTable').on('click', '.apply-success', function() { @@ -204,7 +204,7 @@ $('#basicTable').on('click', '.apply-success', function() {
204 return { 204 return {
205 id:item.id, 205 id:item.id,
206 status:1, 206 status:1,
207 - operations:reason 207 + operations:"申请通过"
208 }; 208 };
209 } 209 }
210 Bll.definetoast("您确定要通过该申请吗?",data,function(){ 210 Bll.definetoast("您确定要通过该申请吗?",data,function(){
@@ -114,11 +114,13 @@ var Bll={ @@ -114,11 +114,13 @@ var Bll={
114 //审核通过 114 //审核通过
115 $('#basicTable').on('click', '.apply-success', function() { 115 $('#basicTable').on('click', '.apply-success', function() {
116 var item=g.rows[$(this).data("index")]; 116 var item=g.rows[$(this).data("index")];
117 - var data= { 117 + var data=function(){
  118 + return{
118 id:item.id, 119 id:item.id,
119 status:1, 120 status:1,
120 reason:"预算不够" 121 reason:"预算不够"
121 }; 122 };
  123 + };
122 Bll.toast("确定要通过该申请吗?",data); 124 Bll.toast("确定要通过该申请吗?",data);
123 }); 125 });
124 126
@@ -23,15 +23,18 @@ @@ -23,15 +23,18 @@
23 "buildArgs": "--idleading {{name}}" 23 "buildArgs": "--idleading {{name}}"
24 }, 24 },
25 "devDependencies": { 25 "devDependencies": {
  26 + "crypto": "0.0.3",
26 "extract-text-webpack-plugin": "^1.0.1", 27 "extract-text-webpack-plugin": "^1.0.1",
27 "gulp": "^3.9.1", 28 "gulp": "^3.9.1",
28 "gulp-autoprefixer": "^3.1.0", 29 "gulp-autoprefixer": "^3.1.0",
  30 + "gulp-clean": "^0.3.1",
29 "gulp-concat": "^2.6.0", 31 "gulp-concat": "^2.6.0",
30 "gulp-develop-server": "^0.5.0", 32 "gulp-develop-server": "^0.5.0",
31 "gulp-md5": "^0.1.2", 33 "gulp-md5": "^0.1.2",
32 "gulp-plumber": "^1.1.0", 34 "gulp-plumber": "^1.1.0",
  35 + "gulp-rename": "^1.2.2",
  36 + "gulp-sass": "^2.0.4",
33 "gulp-uglify": "^1.5.2", 37 "gulp-uglify": "^1.5.2",
34 - "gulp-sass":"^2.0.4",  
35 "webpack": "^1.12.13" 38 "webpack": "^1.12.13"
36 }, 39 },
37 "scripts": { 40 "scripts": {
@@ -45,14 +45,14 @@ exports.post = function(data, req, res) { @@ -45,14 +45,14 @@ exports.post = function(data, req, res) {
45 res.redirect(url); 45 res.redirect(url);
46 46
47 } else { 47 } else {
48 - res.render('error/error_nolayout',{message:'登陆失败!',layout:false}); 48 + res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false});
49 } 49 }
50 }); 50 });
51 return; 51 return;
52 } else { 52 } else {
53 53
54 //否则跳转错误 54 //否则跳转错误
55 - res.render('error/error_nolayout',{message:'登陆失败!',layout:false}); 55 + res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false});
56 return; 56 return;
57 } 57 }
58 } 58 }
1 -exports.domain =require('../config/common.js').domain; 1 +exports.domain ="http://172.16.6.220:8080/yohobuy-platform-web";//require('../config/common.js').domain;
2 2
3 //路由配置 3 //路由配置
4 exports.res = [{ 4 exports.res = [{
1 1
2 <section> 2 <section>
3 <div class="notfoundpanel"> 3 <div class="notfoundpanel">
4 - <h3>出错了!</h3>  
5 <h3>{{message}}</h3> 4 <h3>{{message}}</h3>
6 <a href="{{reloadUrl}}">刷新</a> 5 <a href="{{reloadUrl}}">刷新</a>
7 </div> 6 </div>
@@ -13,7 +13,6 @@ @@ -13,7 +13,6 @@
13 <body class="pace-done"> 13 <body class="pace-done">
14 <section> 14 <section>
15 <div class="notfoundpanel"> 15 <div class="notfoundpanel">
16 - <h3>出错了!</h3>  
17 <h3>{{message}}</h3> 16 <h3>{{message}}</h3>
18 <a href="{{reloadUrl}}">刷新</a> 17 <a href="{{reloadUrl}}">刷新</a>
19 </div> 18 </div>
@@ -20,11 +20,11 @@ seajs.use('{{module}}',function(m){ @@ -20,11 +20,11 @@ seajs.use('{{module}}',function(m){
20 <script src="/dist/libs.js"></script> 20 <script src="/dist/libs.js"></script>
21 <script src="/dist/index.js"></script> 21 <script src="/dist/index.js"></script>
22 {{else}} 22 {{else}}
23 -<script src="{{_env.cur.libs}}"></script>  
24 -<script src="{{_env.cur.js}}"></script> 23 +<script src="{{_env.cur.path}}/lib{{_env.cur.md5}}.js"></script>
  24 +<script src="{{_env.cur.path}}/index{{_env.cur.md5}}.js"></script>
25 {{/if}} 25 {{/if}}
26 {{#if module}} 26 {{#if module}}
27 -<script src="/{{module}}.js"></script> 27 +<script src="{{_env.cur.path}}/{{module}}{{_env.cur.md5}}.js"></script>
28 {{/if}} 28 {{/if}}
29 {{/if}} 29 {{/if}}
30 30