Skip to content

Commit 2c8b51f

Browse files
committed
Merge branch 'host'
2 parents 7d6957c + d2f6a06 commit 2c8b51f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

_tasks/plugins/TmTIndex.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*/
44
var fs = require('fs'),
55
path = require('path'),
6-
format = function () {
7-
};
6+
localIp = require('quick-local-ip');
87

98
module.exports = function (config) {
109
var html = [
@@ -30,7 +29,8 @@ module.exports = function (config) {
3029
].join(''),
3130
tmpHtml = '',
3231
length = '/dev/html/'.length,
33-
collector = listdir('./dev/html');
32+
collector = listdir('./dev/html'),
33+
ip = localIp.getLocalIP4();
3434

3535

3636
showdir(collector, 0);
@@ -99,7 +99,7 @@ module.exports = function (config) {
9999

100100
html = html + tmpHtml;
101101

102-
html += '</tbody></table><div id="qrcode"></div><script src="http://wximg.gtimg.com/tmt/tools/file-list/js/jquery-2.1.3.min.js"></script><script src="http://wximg.gtimg.com/tmt/tools/file-list/js/qrcode.min.js"></script><script type="text/javascript">$(document).ready(function(){document.title= "' + config.projectName + ' 资源列表"; $(".level1").prependTo(".table-body"); $(".td-qrcode i").bind("mouseenter ",function(){$("#qrcode").show().empty();new QRCode(document.getElementById("qrcode"), encodeURI(window.location.href.split("TmTIndex.html")[0]+$(this).parent().parent().find("a").attr("href")));});$("body").bind("click",function(){$("#qrcode").hide();});});</script></body></html>';
102+
html += '</tbody></table><div id="qrcode"></div><script src="http://wximg.gtimg.com/tmt/tools/file-list/js/jquery-2.1.3.min.js"></script><script src="http://wximg.gtimg.com/tmt/tools/file-list/js/qrcode.min.js"></script><script type="text/javascript">$(document).ready(function(){ var url = location.href.replace("localhost", "' + ip + '");document.title= "' + config.projectName + ' 资源列表"; $(".level1").prependTo(".table-body"); $(".td-qrcode i").bind("mouseenter ",function(){$("#qrcode").show().empty();new QRCode(document.getElementById("qrcode"), encodeURI(url.split("TmTIndex.html")[0]+$(this).parent().parent().find("a").attr("href")));});$("body").bind("click",function(){$("#qrcode").hide();});});</script></body></html>';
103103

104104
var out = fs.createWriteStream('./dev/html/TmTIndex.html', {encoding: "utf8"});
105105
out.write(html, function (err) {

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"dependencies": {
55
"autoprefixer": "^6.3.3",
66
"browser-sync": "^2.11.1",
7+
"crypto-md5": "^1.0.0",
78
"del": "^2.2.0",
89
"gulp": "git://github.com/gulpjs/gulp#4.0",
910
"gulp-cssnano": "^2.1.1",
@@ -29,10 +30,10 @@
2930
"lodash": "^4.5.1",
3031
"postcss-pxtorem": "^3.3.1",
3132
"posthtml-px2rem": "^0.0.3",
33+
"quick-local-ip": "^1.0.7",
3234
"rc": "^1.1.6",
3335
"rd": "^0.0.2",
34-
"tmt-ejs-helper": "^0.0.1",
35-
"crypto-md5": "^1.0.0"
36+
"tmt-ejs-helper": "^0.0.1"
3637
},
3738
"description": "A f2e project workflow based on Gulp",
3839
"repository": {
@@ -57,4 +58,4 @@
5758
},
5859
"homepage": "https://github.com/weixin/tmt-workflow",
5960
"readmeFilename": "README.md"
60-
}
61+
}

0 commit comments

Comments
 (0)