Skip to content

Commit 324dd70

Browse files
committed
save
1 parent 6b13a99 commit 324dd70

File tree

11 files changed

+35
-70
lines changed

11 files changed

+35
-70
lines changed

src/common/dev.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,4 @@ export default {
4040
}
4141
return load();
4242
},
43-
getUrl: function(url) {
44-
if(/^\/works\/v\d+\/\d+$/.test(url)) {
45-
let id = /^\/works\/v\d+\/(\d+)$/.exec(url)[1];
46-
url = 'works.html?' + id;
47-
}
48-
else if(/^\/author\/v\d+\/\d+$/.test(url)) {
49-
let id = /^\/author\/v\d+\/(\d+)$/.exec(url)[1];
50-
url = 'author.html?' + id;
51-
}
52-
else if(/^\/(?:follow)|(?:zhuanquan)|(?:find)|(?:my)$/.test(url)) {
53-
let name = /^\/(?:follow)|(?:zhuanquan)|(?:find)|(?:my)$/.exec(url)[0];
54-
url = name + '.html';
55-
}
56-
else if(/^\/search(\/.*)?/.test(url)) {
57-
let kw = /^\/search(\/.*)?/.exec(url)[1] || '';
58-
url = 'search.html?' + kw.slice(1);
59-
}
60-
return url;
61-
}
6243
};
63-
64-
let url = location.href;
65-
if(/\/works\.html\?\d+$/.test(url)) {
66-
let id = /\/works\.html\?(\d+)$/.exec(url)[1];
67-
window.workID = id;
68-
}
69-
else if(/\/author\.html\?\d+$/.test(url)) {
70-
let id = /\/author\.html\?(\d+)$/.exec(url)[1];
71-
window.authorID = id;
72-
}
73-
else if(/\/search\.html\?(.*)$/.test(url)) {
74-
let kw = /\/search\.html\?(.*)$/.exec(url)[1];
75-
window.kw = decodeURIComponent(kw);
76-
}

src/common/mock.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,4 @@ export default {
1010
success(res.default || res);
1111
}, 20);
1212
},
13-
getUrl: function(url) {
14-
if(/^\/works\/v\d+\/\d+$/.test(url)) {
15-
let id = /^\/works\/v\d+\/(\d+)$/.exec(url)[1];
16-
url = 'works.html?' + id;
17-
}
18-
else if(/^\/author\/v\d+\/\d+$/.test(url)) {
19-
let id = /^\/author\/v\d+\/(\d+)$/.exec(url)[1];
20-
url = 'author.html?' + id;
21-
}
22-
else if(/^\/(?:follow)|(?:zhuanquan)|(?:find)|(?:my)$/.test(url)) {
23-
let name = /^\/(?:follow)|(?:zhuanquan)|(?:find)|(?:my)$/.exec(url)[0];
24-
url = name.slice(1) + '.html'
25-
}
26-
location.href = url;
27-
}
2813
};

src/common/production.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export default {
2727
},
2828
success: function (data, state, xhr) {
2929
// console.log('ajax success: ' + url + ', ' + JSON.stringify(data));
30-
if(!data.success && data.code === 1000) {
31-
location.href = window.LOGIN_URL;
32-
return;
33-
}
30+
// if(!data.success && data.code === 1000) {
31+
// location.href = window.LOGIN_URL;
32+
// return;
33+
// }
3434
success(data, state, xhr);
3535
},
3636
error: function (data) {
@@ -44,7 +44,4 @@ export default {
4444
}
4545
return load();
4646
},
47-
getUrl: function(url) {
48-
location.href = url;
49-
}
5047
};

src/common/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ let util = {
2828
return env.ajax(url, data, success, error, 'post');
2929
},
3030
goto: function(url) {
31-
location.href = this.getUrl(url);
31+
if(url.charAt(0) === '/') {
32+
url = url.slice(1);
33+
}
34+
location.href = '/pc/' + url;
3235
},
33-
getUrl: env.getUrl,
3436
sort,
3537
ERROR_MESSAGE: '人气大爆发,请稍后再试。'
3638
};

src/component/mlogin/MLogin.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class NeedLogin extends migi.Component {
2222
<div class="c">
2323
<h3>您尚未登录...</h3>
2424
<p>{ this.message || '登录后即可进行相关操作~' }</p>
25-
<a href={ window.LOGIN_URL } class="weibo">微博登录</a>
25+
<a href={ window.$CONFIG.LOGIN_URL } class="weibo">微博登录</a>
2626
<a href="#" class="close" onClick={ this.clickClose }/>
2727
</div>
2828
</div>;

src/home/home.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616
<link rel="stylesheet" href="/home.css"/>
1717
</head>
1818
<body>
19+
<script>
20+
var $CONFIG = {
21+
kw: 'kw',
22+
worksID: '2757',
23+
authorID: '1',
24+
isLogin: 'True',
25+
userID: '123456',
26+
userName: 'mingzi',
27+
userPic: '',
28+
loginUrl: 'http://circling.cc/oauth/weibo'
29+
};
30+
</script>
1931
<script src="/common.js"></script>
2032
<script src="/home.js"></script>
2133
</body>

src/index/index.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ let topNav = migi.render(
1313
document.body
1414
);
1515

16-
let pathname = location.path;
17-
if(pathname === '/' || !pathname) {
18-
pathname = '/home';
19-
}
20-
2116
let hash = location.hash;
2217
if(hash.length) {
2318
hash = hash.slice(1);

src/works/Audio.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class Audio extends migi.Component {
174174
}
175175
}
176176
clickDownload(e) {
177-
if(window.isLogin !== 'True') {
177+
if(window.$CONFIG.isLogin !== 'True') {
178178
e.preventDefault();
179179
migi.eventBus.emit('NEED_LOGIN');
180180
}

src/works/Video.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class Video extends migi.Component {
138138
}
139139
}
140140
clickDownload(e) {
141-
if(window.isLogin !== 'True') {
141+
if(window.$CONFIG.isLogin !== 'True') {
142142
e.preventDefault();
143143
migi.eventBus.emit('NEED_LOGIN');
144144
}

src/works/WorkComment.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class WorkComment extends migi.Component {
164164
this.rootId = null;
165165
}
166166
input(e, vd) {
167-
if(window.isLogin !== 'True') {
167+
if(window.$CONFIG.isLogin !== 'True') {
168168
migi.eventBus.emit('NEED_LOGIN');
169169
}
170170
else {
@@ -173,7 +173,7 @@ class WorkComment extends migi.Component {
173173
}
174174
}
175175
focus(e, vd) {
176-
if(window.isLogin !== 'True') {
176+
if(window.$CONFIG.isLogin !== 'True') {
177177
migi.eventBus.emit('NEED_LOGIN');
178178
}
179179
}

0 commit comments

Comments
 (0)