Commit bb63d0b3 authored by techird's avatar techird

修复没登陆失败的 BUG

parent 69bdc4e6
...@@ -172,9 +172,10 @@ ...@@ -172,9 +172,10 @@
{ path: 'ui/menu/help/feedback.js', pack: 'edit|share'}, { path: 'ui/menu/help/feedback.js', pack: 'edit|share'},
/* UI Top Bar */ /* UI Top Bar */
{ path: 'ui/topbar/quickvisit.js', pack: 'edit' }, { path: 'ui/topbar/quickvisit.js', pack: 'edit|share' },
{ path: 'ui/topbar/history.js', pack: 'edit' }, { path: 'ui/topbar/history.js', pack: 'edit' },
{ path: 'ui/topbar/user.js', pack: 'edit' }, { path: 'ui/topbar/user.js', pack: 'edit' },
{ path: 'ui/topbar/feedback.js', pack: 'edit|share' },
{ path: 'ui/topbar/search.js', pack: 'edit|share' }, { path: 'ui/topbar/search.js', pack: 'edit|share' },
{ path: 'ui/topbar/switch-view.js', pack: 'm-share' }, { path: 'ui/topbar/switch-view.js', pack: 'm-share' },
{ path: 'ui/topbar/m-logo.js', pack: 'm-share' }, { path: 'ui/topbar/m-logo.js', pack: 'm-share' },
......
...@@ -10,10 +10,25 @@ KityMinder.registerUI('menu/share/view', function (minder) { ...@@ -10,10 +10,25 @@ KityMinder.registerUI('menu/share/view', function (minder) {
var $menu = minder.getUI('menu/menu'); var $menu = minder.getUI('menu/menu');
var $save = minder.getUI('menu/save/save'); var $save = minder.getUI('menu/save/save');
var $doc = minder.getUI('doc'); var $doc = minder.getUI('doc');
var notice = minder.getUI('widget/notice');
var shareId;
$menu.$tabs.select(0); $menu.$tabs.select(0);
$save.$tabs.select(0); $save.$tabs.select(0);
minder.on('uiready', function() {
var $quickvisit = minder.getUI('topbar/quickvisit');
var $edit = $quickvisit.add('editshare', 'right');
$edit.on('click', function() {
if (shareId) window.open('edit.html?shareId=' + shareId);
});
$quickvisit.$new.remove();
$quickvisit.$save.remove();
$quickvisit.$share.remove();
});
function loadShareDoc() { function loadShareDoc() {
var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/; var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/;
...@@ -21,14 +36,12 @@ KityMinder.registerUI('menu/share/view', function (minder) { ...@@ -21,14 +36,12 @@ KityMinder.registerUI('menu/share/view', function (minder) {
if (!match) return Promise.resolve(null); if (!match) return Promise.resolve(null);
var shareId = match[1]; shareId = match[1];
function renderShareData(data) { function renderShareData(data) {
if (data.error) { if (data.error) {
window.alert(data.error); return notice.error('err_share_data', data.error);
window.location.href = 'index.html';
return;
} }
var content = data.shareMinder.data; var content = data.shareMinder.data;
...@@ -44,7 +57,7 @@ KityMinder.registerUI('menu/share/view', function (minder) { ...@@ -44,7 +57,7 @@ KityMinder.registerUI('menu/share/view', function (minder) {
}).then(function(doc) { }).then(function(doc) {
var $title = minder.getUI('topbar/title'); var $title = minder.getUI('topbar/title');
$title.setTitle('[分享的] ' + $title.getTitle()); $title.setTitle('[分享的] ' + $title.getTitle() + ' (只读)');
}); });
} }
...@@ -52,7 +65,7 @@ KityMinder.registerUI('menu/share/view', function (minder) { ...@@ -52,7 +65,7 @@ KityMinder.registerUI('menu/share/view', function (minder) {
return $.pajax({ return $.pajax({
url: 'http://naotu.baidu.com/share.php', //'http://naotu.baidu.com/mongo.php', url: 'http://naotu.baidu.com/share.php',
data: { data: {
action: 'find', action: 'find',
...@@ -63,14 +76,14 @@ KityMinder.registerUI('menu/share/view', function (minder) { ...@@ -63,14 +76,14 @@ KityMinder.registerUI('menu/share/view', function (minder) {
}).then(renderShareData)['catch'](function(e) { }).then(renderShareData)['catch'](function(e) {
window.alert('请求分享文件失败,请重试!'); notice.error('err_share_data', e);
}).then(function() { }).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
minder.disable(); minder.disable();
minder.execCommand('hand', true); minder.execCommand('hand', true);
$container.removeClass('loading'); $container.removeClass('loading');
}); });
} }
......
...@@ -55,12 +55,18 @@ ...@@ -55,12 +55,18 @@
height: 30px; height: 30px;
} }
} }
&.login-button .fui-icon { &.login-button {
width: 25px; .fui-icon {
height: 25px; border-radius: 100%;
margin-right: 3px; width: 25px;
vertical-align: baseline; height: 25px;
background: url(../images/icons.png) 0 -320px; margin-right: 3px;
vertical-align: baseline;
background: url(../images/icons.png) 0 -320px;
}
.fui-label {
display: none;
}
} }
} }
} }
......
...@@ -2249,12 +2249,16 @@ body { ...@@ -2249,12 +2249,16 @@ body {
height: 30px; height: 30px;
} }
#panel div.user-panel .fui-button.login-button .fui-icon { #panel div.user-panel .fui-button.login-button .fui-icon {
border-radius: 100%;
width: 25px; width: 25px;
height: 25px; height: 25px;
margin-right: 3px; margin-right: 3px;
vertical-align: baseline; vertical-align: baseline;
background: url(../images/icons.png) 0 -320px; background: url(../images/icons.png) 0 -320px;
} }
#panel div.user-panel .fui-button.login-button .fui-label {
display: none;
}
.login-tip { .login-tip {
display: none; display: none;
} }
......
This diff is collapsed.
/**
* @fileOverview
*
* 快速反馈按钮
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('topbar/feedback', function(minder) {
var $quickvisit = minder.getUI('topbar/quickvisit');
var $feedback = $quickvisit.add('feedback', 'right');
function quickFeedback() {
var $menu = minder.getUI('menu/menu');
$menu.$tabs.select(5);
$menu.show();
}
$feedback.click(quickFeedback);
minder.addShortcut('f1', quickFeedback);
return $feedback;
});
\ No newline at end of file
...@@ -8,24 +8,33 @@ ...@@ -8,24 +8,33 @@
*/ */
KityMinder.registerUI('topbar/quickvisit', function (minder) { KityMinder.registerUI('topbar/quickvisit', function (minder) {
function btn(name) { var rightDocks = [];
return $('<a class="quick-visit-button"></a>')
function btn(name, dockRight) {
var $btn = $('<a class="quick-visit-button"></a>')
.text(minder.getLang('ui.quickvisit.' + name)) .text(minder.getLang('ui.quickvisit.' + name))
.attr('title', minder.getLang('ui.quickvisit.' + name)) .attr('title', minder.getLang('ui.quickvisit.' + name))
.addClass(name) .addClass(name);
.appendTo('#panel');
if (dockRight) rightDocks.push($btn);
else $btn.appendTo('#panel');
return $btn;
} }
var $new = btn('new'), var $new = btn('new'),
$save = btn('save'), $save = btn('save'),
$share = btn('share'), $share = btn('share');
$feedback = btn('feedback');
var ret = {}; var ret = {
$new: $new,
$save: $save,
$share: $share
};
minder.on('uiready', function quickVisit() { minder.on('uiready', function quickVisit() {
$('#panel #search').after($feedback); while (rightDocks.length) $('#panel #search').after(rightDocks.shift());
function quickNew() { function quickNew() {
var $doc = minder.getUI('doc'); var $doc = minder.getUI('doc');
...@@ -52,16 +61,10 @@ KityMinder.registerUI('topbar/quickvisit', function (minder) { ...@@ -52,16 +61,10 @@ KityMinder.registerUI('topbar/quickvisit', function (minder) {
$menu.show(); $menu.show();
} }
function quickFeedback() {
var $menu = minder.getUI('menu/menu');
$menu.$tabs.select(5);
$menu.show();
}
$new.click(quickNew); $new.click(quickNew);
$save.click(quickSave); $save.click(quickSave);
$share.click(quickShare); $share.click(quickShare);
$feedback.click(quickFeedback);
minder.addShortcut('ctrl+alt+n', quickNew); minder.addShortcut('ctrl+alt+n', quickNew);
minder.addShortcut('ctrl+s', quickSave); minder.addShortcut('ctrl+s', quickSave);
...@@ -71,15 +74,15 @@ KityMinder.registerUI('topbar/quickvisit', function (minder) { ...@@ -71,15 +74,15 @@ KityMinder.registerUI('topbar/quickvisit', function (minder) {
$menu.$tabs.select(2); $menu.$tabs.select(2);
$menu.show(); $menu.show();
}); });
minder.addShortcut('f1', quickFeedback);
ret.ready = true; ret.ready = true;
ret.quickNew = quickNew; ret.quickNew = quickNew;
ret.quickSave = quickSave; ret.quickSave = quickSave;
ret.quickShare = quickShare; ret.quickShare = quickShare;
ret.quickFeedback = quickFeedback;
}); });
ret.add = btn;
return ret; return ret;
}); });
\ No newline at end of file
...@@ -101,7 +101,7 @@ KityMinder.registerUI('topbar/user', function(minder) { ...@@ -101,7 +101,7 @@ KityMinder.registerUI('topbar/user', function(minder) {
fio.user.fire('login', user); fio.user.fire('login', user);
} else { } else {
if (window.location.href.indexOf('nocheck') == -1) { if (window.location.href.indexOf('nocheck') == -1) {
logout(); return login();
} else { } else {
$loginButton.show(); $loginButton.show();
} }
...@@ -122,7 +122,7 @@ KityMinder.registerUI('topbar/user', function(minder) { ...@@ -122,7 +122,7 @@ KityMinder.registerUI('topbar/user', function(minder) {
$loginButton.setLabel(minder.getLang('ui.loggingin')); $loginButton.setLabel(minder.getLang('ui.loggingin'));
fio.user.login({ fio.user.login({
remember: 7 * 24 * 60 * 60 // remember 7 days remember: 7 * 24 * 60 * 60 // remember 7 days
}).then(check); });
} }
function switchUser() { function switchUser() {
......
...@@ -140,7 +140,7 @@ KityMinder.registerUI('widget/notice', function (minder) { ...@@ -140,7 +140,7 @@ KityMinder.registerUI('widget/notice', function (minder) {
if (e.getDetail) return e; if (e.getDetail) return e;
// 文件访问错误 // 文件访问错误
if (e instanceof fio.FileRequestError) { if (typeof(fio) != 'undefined' && (e instanceof fio.FileRequestError)) {
if (!e.status) { if (!e.status) {
e.description = errorMessage.err_network; e.description = errorMessage.err_network;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment