Commit bb63d0b3 authored by techird's avatar techird

修复没登陆失败的 BUG

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