Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-mobile
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
10 years ago
Commit
5b43c400a6c9b63748156bef8bd09e59786f7ff2
1 parent
404b7992
master
...
develop
feature/collect
feature/customerService
feature/homePage
feature/newFestival
feature/newSale
feature/ps-list
feature/redEnvelope
feature/vip-bill
release/saunter-home
home build
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
162 additions
and
2 deletions
home-page/gulpfile.js
home-page/index.js
home-page/package.json
home-page/public/sea.js
home-page/gulpfile.js
View file @
5b43c40
...
...
@@ -5,7 +5,19 @@
*/
var
gulp
=
require
(
'gulp'
),
fs
=
require
(
'fs'
),
ftp
=
require
(
'gulp-ftp'
),
gutil
=
require
(
'gulp-util'
),
concat
=
require
(
'gulp-concat'
),
compass
=
require
(
'gulp-compass'
),
exec
=
require
(
'child_process'
).
exec
,
mkdirp
=
require
(
'mkdirp'
),
uglify
=
require
(
'gulp-uglify'
),
Package
=
require
(
'father'
).
SpmPackage
,
transport
=
require
(
'gulp-spm'
),
request
=
require
(
'request'
),
// md5 = require("gulp-md5"),
rmdir
=
require
(
'rmdir'
)
server
=
require
(
'gulp-develop-server'
);
gulp
.
task
(
'default'
,
[
'server'
,
'server:restart'
,
'compass-watch'
,
'compass'
]);
...
...
@@ -37,4 +49,142 @@ gulp.task('compass', function() {
sass
:
'public/sass'
})
)
});
\ No newline at end of file
});
//PRODUCTION
//cdn
var
config
=
JSON
.
parse
(
fs
.
readFileSync
(
'./package.json'
).
toString
()),
distRoot
=
'dist/yohobuy-mobile/'
,
distDir
=
{
js
:
distRoot
+
config
.
name
+
'/'
+
config
.
version
,
css
:
distRoot
+
config
.
name
+
'/'
+
config
.
version
,
image
:
distRoot
+
config
.
name
+
'/assets/images'
,
fonts
:
distRoot
+
config
.
name
+
'/assets/fonts'
},
cdnDomain
=
'http://cdn.yoho.cn/'
,
ftpConfig
=
{
host
:
'58.213.133.26'
,
user
:
'php'
,
pass
:
'yoho9646'
};
gulp
.
task
(
'dist'
,
function
()
{
var
ftpstream
=
ftp
(
ftpConfig
);
return
gulp
.
src
(
'dist/**/'
)
.
pipe
(
ftpstream
)
.
pipe
(
gutil
.
noop
());
});
//拷贝fonts+images到发布目录
gulp
.
task
(
'assets'
,
function
()
{
gulp
.
src
(
'public/img/**'
)
.
pipe
(
gulp
.
dest
(
distDir
.
image
));
gulp
.
src
(
'public/fonts/*'
)
.
pipe
(
gulp
.
dest
(
distDir
.
fonts
));
});
//compass整合所有css到index后发布到发布目录
gulp
.
task
(
'compass-production'
,
function
()
{
gulp
.
src
(
'public/sass/*.scss'
)
.
pipe
(
compass
({
css
:
distDir
.
css
,
sass
:
'public/sass'
,
image
:
distDir
.
image
,
font
:
distDir
.
fonts
,
http_path
:
'/'
,
style
:
'compressed'
})
)
.
on
(
'error'
,
function
(
error
)
{
console
.
log
(
error
);
this
.
emit
(
'end'
);
});
});
//JS build
gulp
.
task
(
'build'
,
[
'libs-build'
,
'index-build'
]);
gulp
.
task
(
'libs-build'
,
[
'pre-libs'
,
'concat-libs'
,
'min-libs'
,
'clear-libs'
]);
gulp
.
task
(
'index-build'
,
[
'libs-build'
],
function
()
{
var
pkg
=
new
Package
(
__dirname
);
return
gulp
.
src
(
pkg
.
main
)
.
pipe
(
transport
({
pkg
:
pkg
}))
.
pipe
(
concat
(
'index-debug.js'
))
.
pipe
(
gulp
.
dest
(
distDir
.
js
))
.
pipe
(
uglify
())
.
pipe
(
concat
(
'index.js'
))
.
pipe
(
gulp
.
dest
(
distDir
.
js
));
});
//SPM 打包库文件
gulp
.
task
(
'pre-libs'
,
function
()
{
libPkgPre
();
var
pkg
=
new
Package
(
__dirname
);
return
gulp
.
src
(
pkg
.
main
)
.
pipe
(
transport
({
pkg
:
pkg
}))
.
pipe
(
gulp
.
dest
(
distDir
.
js
));
});
//合并库文件
gulp
.
task
(
'concat-libs'
,
[
'pre-libs'
],
function
()
{
return
gulp
.
src
([
'public/sea.js'
,
distDir
.
js
+
'/libs.js'
])
.
pipe
(
concat
(
'libs-debug.js'
))
.
pipe
(
gulp
.
dest
(
distDir
.
js
));
});
//压缩库文件
gulp
.
task
(
'min-libs'
,
[
'pre-libs'
],
function
()
{
return
gulp
.
src
([
'public/sea.js'
,
distDir
.
js
+
'/libs.js'
])
.
pipe
(
concat
(
'libs.js'
))
.
pipe
(
uglify
())
// .pipe(md5())
.
pipe
(
gulp
.
dest
(
distDir
.
js
));
});
//清除过程文件
gulp
.
task
(
'clear-libs'
,
[
'concat-libs'
,
'min-libs'
],
function
()
{
fs
.
renameSync
(
'package_bak.json'
,
'package.json'
);
//恢复原包配置文件
fs
.
unlinkSync
(
'./libs.js'
);
//删除入口文件
// fs.unlinkSync(distDir.js + '/libs.js');
});
//库文件的入口文件和过程文件的生成
function
libPkgPre
()
{
var
obj
=
{
name
:
config
.
name
,
version
:
config
.
version
,
spm
:
config
.
spm
},
libCon
,
libsjs
=
''
,
key
,
libDir
=
distDir
.
js
+
''
;
obj
.
spm
.
main
=
'libs.js'
;
obj
.
spm
.
buildArgs
=
'--idleading {{}} --include all'
;
libCon
=
JSON
.
stringify
(
obj
);
fs
.
renameSync
(
'package.json'
,
'package_bak.json'
);
fs
.
writeFileSync
(
'package.json'
,
libCon
);
//生成库文件pkg配置
var
packages
=
[];
for
(
key
in
obj
.
spm
.
dependencies
)
{
if
(
obj
.
spm
.
inside
&&
obj
.
spm
.
inside
[
key
])
{
packages
.
push
(
obj
.
spm
.
inside
[
key
]);
}
else
{
packages
.
push
(
key
);
}
}
for
(
var
i
=
0
;
i
<
packages
.
length
;
i
++
)
{
libsjs
+=
"require('"
+
packages
[
i
]
+
"');"
;
}
fs
.
writeFileSync
(
'libs.js'
,
libsjs
);
//写入口文件
return
libDir
;
}
\ No newline at end of file
...
...
home-page/index.js
View file @
5b43c40
var
yohobuyMobile
;
require
(
'./public/js/public'
);
module
.
exports
=
yohobuyMobile
;
\ No newline at end of file
...
...
home-page/package.json
View file @
5b43c40
...
...
@@ -34,6 +34,12 @@
"gulp-develop-server"
:
"^0.4.2"
,
"gulp-ftp"
:
"^1.0.3"
,
"gulp-util"
:
"^3.0.4"
,
"hbs"
:
"^3.0.1"
"hbs"
:
"^3.0.1"
,
"father"
:
"^1.0.0"
,
"gulp-spm"
:
"^0.11.3"
,
"gulp-uglify"
:
"^1.2.0"
,
"mkdirp"
:
"^0.5.1"
,
"request"
:
"^2.58.0"
,
"rmdir"
:
"^1.1.0"
}
}
\ No newline at end of file
...
...
home-page/public/sea.js
0 → 100644
View file @
5b43c40
/*! Sea.js 2.3.0 | seajs.org/LICENSE.md */
!
function
(
a
,
b
){
function
c
(
a
){
return
function
(
b
){
return
{}.
toString
.
call
(
b
)
==
"[object "
+
a
+
"]"
}}
function
d
(){
return
z
++
}
function
e
(
a
){
return
a
.
match
(
C
)[
0
]}
function
f
(
a
){
for
(
a
=
a
.
replace
(
D
,
"/"
),
a
=
a
.
replace
(
F
,
"$1/"
);
a
.
match
(
E
);)
a
=
a
.
replace
(
E
,
"/"
);
return
a
}
function
g
(
a
){
var
b
=
a
.
length
-
1
,
c
=
a
.
charAt
(
b
);
return
"#"
===
c
?
a
.
substring
(
0
,
b
):
".js"
===
a
.
substring
(
b
-
2
)
||
a
.
indexOf
(
"?"
)
>
0
||
"/"
===
c
?
a
:
a
+
".js"
}
function
h
(
a
){
var
b
=
u
.
alias
;
return
b
&&
w
(
b
[
a
])?
b
[
a
]:
a
}
function
i
(
a
){
var
b
=
u
.
paths
,
c
;
return
b
&&
(
c
=
a
.
match
(
G
))
&&
w
(
b
[
c
[
1
]])
&&
(
a
=
b
[
c
[
1
]]
+
c
[
2
]),
a
}
function
j
(
a
){
var
b
=
u
.
vars
;
return
b
&&
a
.
indexOf
(
"{"
)
>-
1
&&
(
a
=
a
.
replace
(
H
,
function
(
a
,
c
){
return
w
(
b
[
c
])?
b
[
c
]:
a
})),
a
}
function
k
(
a
){
var
b
=
u
.
map
,
c
=
a
;
if
(
b
)
for
(
var
d
=
0
,
e
=
b
.
length
;
e
>
d
;
d
++
){
var
f
=
b
[
d
];
if
(
c
=
y
(
f
)?
f
(
a
)
||
a
:
a
.
replace
(
f
[
0
],
f
[
1
]),
c
!==
a
)
break
}
return
c
}
function
l
(
a
,
b
){
var
c
,
d
=
a
.
charAt
(
0
);
if
(
I
.
test
(
a
))
c
=
a
;
else
if
(
"."
===
d
)
c
=
f
((
b
?
e
(
b
):
u
.
cwd
)
+
a
);
else
if
(
"/"
===
d
){
var
g
=
u
.
cwd
.
match
(
J
);
c
=
g
?
g
[
0
]
+
a
.
substring
(
1
):
a
}
else
c
=
u
.
base
+
a
;
return
0
===
c
.
indexOf
(
"//"
)
&&
(
c
=
location
.
protocol
+
c
),
c
}
function
m
(
a
,
b
){
if
(
!
a
)
return
""
;
a
=
h
(
a
),
a
=
i
(
a
),
a
=
j
(
a
),
a
=
g
(
a
);
var
c
=
l
(
a
,
b
);
return
c
=
k
(
c
)}
function
n
(
a
){
return
a
.
hasAttribute
?
a
.
src
:
a
.
getAttribute
(
"src"
,
4
)}
function
o
(
a
,
b
,
c
){
var
d
=
K
.
createElement
(
"script"
);
if
(
c
){
var
e
=
y
(
c
)?
c
(
a
):
c
;
e
&&
(
d
.
charset
=
e
)}
p
(
d
,
b
,
a
),
d
.
async
=!
0
,
d
.
src
=
a
,
R
=
d
,
Q
?
P
.
insertBefore
(
d
,
Q
):
P
.
appendChild
(
d
),
R
=
null
}
function
p
(
a
,
b
,
c
){
function
d
(){
a
.
onload
=
a
.
onerror
=
a
.
onreadystatechange
=
null
,
u
.
debug
||
P
.
removeChild
(
a
),
a
=
null
,
b
()}
var
e
=
"onload"
in
a
;
e
?(
a
.
onload
=
d
,
a
.
onerror
=
function
(){
B
(
"error"
,{
uri
:
c
,
node
:
a
}),
d
()}):
a
.
onreadystatechange
=
function
(){
/loaded|complete/
.
test
(
a
.
readyState
)
&&
d
()}}
function
q
(){
if
(
R
)
return
R
;
if
(
S
&&
"interactive"
===
S
.
readyState
)
return
S
;
for
(
var
a
=
P
.
getElementsByTagName
(
"script"
),
b
=
a
.
length
-
1
;
b
>=
0
;
b
--
){
var
c
=
a
[
b
];
if
(
"interactive"
===
c
.
readyState
)
return
S
=
c
}}
function
r
(
a
){
var
b
=
[];
return
a
.
replace
(
U
,
""
).
replace
(
T
,
function
(
a
,
c
,
d
){
d
&&
b
.
push
(
d
)}),
b
}
function
s
(
a
,
b
){
this
.
uri
=
a
,
this
.
dependencies
=
b
||
[],
this
.
exports
=
null
,
this
.
status
=
0
,
this
.
_waitings
=
{},
this
.
_remain
=
0
}
if
(
!
a
.
seajs
){
var
t
=
a
.
seajs
=
{
version
:
"2.3.0"
},
u
=
t
.
data
=
{},
v
=
c
(
"Object"
),
w
=
c
(
"String"
),
x
=
Array
.
isArray
||
c
(
"Array"
),
y
=
c
(
"Function"
),
z
=
0
,
A
=
u
.
events
=
{};
t
.
on
=
function
(
a
,
b
){
var
c
=
A
[
a
]
||
(
A
[
a
]
=
[]);
return
c
.
push
(
b
),
t
},
t
.
off
=
function
(
a
,
b
){
if
(
!
a
&&!
b
)
return
A
=
u
.
events
=
{},
t
;
var
c
=
A
[
a
];
if
(
c
)
if
(
b
)
for
(
var
d
=
c
.
length
-
1
;
d
>=
0
;
d
--
)
c
[
d
]
===
b
&&
c
.
splice
(
d
,
1
);
else
delete
A
[
a
];
return
t
};
var
B
=
t
.
emit
=
function
(
a
,
b
){
var
c
=
A
[
a
],
d
;
if
(
c
){
c
=
c
.
slice
();
for
(
var
e
=
0
,
f
=
c
.
length
;
f
>
e
;
e
++
)
c
[
e
](
b
)}
return
t
},
C
=
/
[^
?#
]
*
\/
/
,
D
=
/
\/\.\/
/g
,
E
=
/
\/[^/]
+
\/\.\.\/
/
,
F
=
/
([^
:
/])\/
+
\/
/g
,
G
=
/^
([^/
:
]
+
)(\/
.+
)
$/
,
H
=
/{
([^
{
]
+
)
}/g
,
I
=
/^
\/\/
.|:
\/
/
,
J
=
/^.*
?\/\/
.*
?\/
/
,
K
=
document
,
L
=
location
.
href
&&
0
!==
location
.
href
.
indexOf
(
"about:"
)?
e
(
location
.
href
):
""
,
M
=
K
.
scripts
,
N
=
K
.
getElementById
(
"seajsnode"
)
||
M
[
M
.
length
-
1
],
O
=
e
(
n
(
N
)
||
L
);
t
.
resolve
=
m
;
var
P
=
K
.
head
||
K
.
getElementsByTagName
(
"head"
)[
0
]
||
K
.
documentElement
,
Q
=
P
.
getElementsByTagName
(
"base"
)[
0
],
R
,
S
;
t
.
request
=
o
;
var
T
=
/"
(?:\\
"|
[^
"
])
*"|'
(?:\\
'|
[^
'
])
*'|
\/\*[\S\s]
*
?\*\/
|
\/(?:\\\/
|
[^\/\r\n])
+
\/(?=[^\/])
|
\/\/
.*|
\.\s
*require|
(?:
^|
[^
$
])\b
require
\s
*
\(\s
*
([
"'
])(
.+
?)\1\s
*
\)
/g
,
U
=
/
\\\\
/g
,
V
=
t
.
cache
=
{},
W
,
X
=
{},
Y
=
{},
Z
=
{},
$
=
s
.
STATUS
=
{
FETCHING
:
1
,
SAVED
:
2
,
LOADING
:
3
,
LOADED
:
4
,
EXECUTING
:
5
,
EXECUTED
:
6
};
s
.
prototype
.
resolve
=
function
(){
for
(
var
a
=
this
,
b
=
a
.
dependencies
,
c
=
[],
d
=
0
,
e
=
b
.
length
;
e
>
d
;
d
++
)
c
[
d
]
=
s
.
resolve
(
b
[
d
],
a
.
uri
);
return
c
},
s
.
prototype
.
load
=
function
(){
var
a
=
this
;
if
(
!
(
a
.
status
>=
$
.
LOADING
)){
a
.
status
=
$
.
LOADING
;
var
c
=
a
.
resolve
();
B
(
"load"
,
c
);
for
(
var
d
=
a
.
_remain
=
c
.
length
,
e
,
f
=
0
;
d
>
f
;
f
++
)
e
=
s
.
get
(
c
[
f
]),
e
.
status
<
$
.
LOADED
?
e
.
_waitings
[
a
.
uri
]
=
(
e
.
_waitings
[
a
.
uri
]
||
0
)
+
1
:
a
.
_remain
--
;
if
(
0
===
a
.
_remain
)
return
a
.
onload
(),
b
;
var
g
=
{};
for
(
f
=
0
;
d
>
f
;
f
++
)
e
=
V
[
c
[
f
]],
e
.
status
<
$
.
FETCHING
?
e
.
fetch
(
g
):
e
.
status
===
$
.
SAVED
&&
e
.
load
();
for
(
var
h
in
g
)
g
.
hasOwnProperty
(
h
)
&&
g
[
h
]()}},
s
.
prototype
.
onload
=
function
(){
var
a
=
this
;
a
.
status
=
$
.
LOADED
,
a
.
callback
&&
a
.
callback
();
var
b
=
a
.
_waitings
,
c
,
d
;
for
(
c
in
b
)
b
.
hasOwnProperty
(
c
)
&&
(
d
=
V
[
c
],
d
.
_remain
-=
b
[
c
],
0
===
d
.
_remain
&&
d
.
onload
());
delete
a
.
_waitings
,
delete
a
.
_remain
},
s
.
prototype
.
fetch
=
function
(
a
){
function
c
(){
t
.
request
(
g
.
requestUri
,
g
.
onRequest
,
g
.
charset
)}
function
d
(){
delete
X
[
h
],
Y
[
h
]
=!
0
,
W
&&
(
s
.
save
(
f
,
W
),
W
=
null
);
var
a
,
b
=
Z
[
h
];
for
(
delete
Z
[
h
];
a
=
b
.
shift
();)
a
.
load
()}
var
e
=
this
,
f
=
e
.
uri
;
e
.
status
=
$
.
FETCHING
;
var
g
=
{
uri
:
f
};
B
(
"fetch"
,
g
);
var
h
=
g
.
requestUri
||
f
;
return
!
h
||
Y
[
h
]?(
e
.
load
(),
b
):
X
[
h
]?(
Z
[
h
].
push
(
e
),
b
):(
X
[
h
]
=!
0
,
Z
[
h
]
=
[
e
],
B
(
"request"
,
g
=
{
uri
:
f
,
requestUri
:
h
,
onRequest
:
d
,
charset
:
u
.
charset
}),
g
.
requested
||
(
a
?
a
[
g
.
requestUri
]
=
c
:
c
()),
b
)},
s
.
prototype
.
exec
=
function
(){
function
a
(
b
){
return
s
.
get
(
a
.
resolve
(
b
)).
exec
()}
var
c
=
this
;
if
(
c
.
status
>=
$
.
EXECUTING
)
return
c
.
exports
;
c
.
status
=
$
.
EXECUTING
;
var
e
=
c
.
uri
;
a
.
resolve
=
function
(
a
){
return
s
.
resolve
(
a
,
e
)},
a
.
async
=
function
(
b
,
c
){
return
s
.
use
(
b
,
c
,
e
+
"_async_"
+
d
()),
a
};
var
f
=
c
.
factory
,
g
=
y
(
f
)?
f
(
a
,
c
.
exports
=
{},
c
):
f
;
return
g
===
b
&&
(
g
=
c
.
exports
),
delete
c
.
factory
,
c
.
exports
=
g
,
c
.
status
=
$
.
EXECUTED
,
B
(
"exec"
,
c
),
g
},
s
.
resolve
=
function
(
a
,
b
){
var
c
=
{
id
:
a
,
refUri
:
b
};
return
B
(
"resolve"
,
c
),
c
.
uri
||
t
.
resolve
(
c
.
id
,
b
)},
s
.
define
=
function
(
a
,
c
,
d
){
var
e
=
arguments
.
length
;
1
===
e
?(
d
=
a
,
a
=
b
):
2
===
e
&&
(
d
=
c
,
x
(
a
)?(
c
=
a
,
a
=
b
):
c
=
b
),
!
x
(
c
)
&&
y
(
d
)
&&
(
c
=
r
(
""
+
d
));
var
f
=
{
id
:
a
,
uri
:
s
.
resolve
(
a
),
deps
:
c
,
factory
:
d
};
if
(
!
f
.
uri
&&
K
.
attachEvent
){
var
g
=
q
();
g
&&
(
f
.
uri
=
g
.
src
)}
B
(
"define"
,
f
),
f
.
uri
?
s
.
save
(
f
.
uri
,
f
):
W
=
f
},
s
.
save
=
function
(
a
,
b
){
var
c
=
s
.
get
(
a
);
c
.
status
<
$
.
SAVED
&&
(
c
.
id
=
b
.
id
||
a
,
c
.
dependencies
=
b
.
deps
||
[],
c
.
factory
=
b
.
factory
,
c
.
status
=
$
.
SAVED
,
B
(
"save"
,
c
))},
s
.
get
=
function
(
a
,
b
){
return
V
[
a
]
||
(
V
[
a
]
=
new
s
(
a
,
b
))},
s
.
use
=
function
(
b
,
c
,
d
){
var
e
=
s
.
get
(
d
,
x
(
b
)?
b
:[
b
]);
e
.
callback
=
function
(){
for
(
var
b
=
[],
d
=
e
.
resolve
(),
f
=
0
,
g
=
d
.
length
;
g
>
f
;
f
++
)
b
[
f
]
=
V
[
d
[
f
]].
exec
();
c
&&
c
.
apply
(
a
,
b
),
delete
e
.
callback
},
e
.
load
()},
t
.
use
=
function
(
a
,
b
){
return
s
.
use
(
a
,
b
,
u
.
cwd
+
"_use_"
+
d
()),
t
},
s
.
define
.
cmd
=
{},
a
.
define
=
s
.
define
,
t
.
Module
=
s
,
u
.
fetchedList
=
Y
,
u
.
cid
=
d
,
t
.
require
=
function
(
a
){
var
b
=
s
.
get
(
s
.
resolve
(
a
));
return
b
.
status
<
$
.
EXECUTING
&&
(
b
.
onload
(),
b
.
exec
()),
b
.
exports
},
u
.
base
=
O
,
u
.
dir
=
O
,
u
.
cwd
=
L
,
u
.
charset
=
"utf-8"
,
t
.
config
=
function
(
a
){
for
(
var
b
in
a
){
var
c
=
a
[
b
],
d
=
u
[
b
];
if
(
d
&&
v
(
d
))
for
(
var
e
in
c
)
d
[
e
]
=
c
[
e
];
else
x
(
d
)?
c
=
d
.
concat
(
c
):
"base"
===
b
&&
(
"/"
!==
c
.
slice
(
-
1
)
&&
(
c
+=
"/"
),
c
=
l
(
c
)),
u
[
b
]
=
c
}
return
B
(
"config"
,
a
),
t
}}}(
this
);
\ No newline at end of file
...
...
Please
register
or
login
to post a comment