更新搜索页面
This commit is contained in:
parent
94be84c33d
commit
e9a3252443
|
|
@ -177,3 +177,7 @@ img.operator {
|
|||
.fontred {
|
||||
color: #F00;
|
||||
}
|
||||
|
||||
.js-history-word:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
<div class="ui container">
|
||||
<!-- directive:菜单 -->
|
||||
<menus></menus>
|
||||
<div class="ui container" style="width:100%;height:10px"></div>
|
||||
<div class="ui container" style="width:100%;height:2px"></div>
|
||||
<div class="ui container">
|
||||
<div ui-view></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
$scope.quickUrl = {};
|
||||
$scope.longPress = false;
|
||||
$scope.user = {};
|
||||
$scope.searching = true;
|
||||
|
||||
// 防止在登陆的情况下,在浏览器里面直接输入url,这时候要更新菜单选项
|
||||
pubSubService.subscribe('Common.menuActive', $scope, function (event, params) {
|
||||
|
|
@ -32,19 +31,38 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
$scope.user = data;
|
||||
if(data.username === 'lcq') {
|
||||
$scope.loginMenus[dataService.LoginIndexHot].show = false;
|
||||
console.info($scope.loginMenus)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
});
|
||||
|
||||
$scope.searchIcon = function(item) {
|
||||
if(item.t === 0) {
|
||||
item.icon = "book link icon";
|
||||
} else if(item.t === 1) {
|
||||
item.icon = "google link icon";
|
||||
} else if(item.t === 2) {
|
||||
item.icon = "github link icon";
|
||||
} else if(item.t === 3) {
|
||||
item.icon = "stack overflow link icon";
|
||||
} else if(item.t === 4) {
|
||||
item.icon = "bimobject link icon";
|
||||
} else if(item.t === 5) {
|
||||
item.icon = "file alternate link icon";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @func
|
||||
* @desc 点击搜索按钮搜索书签
|
||||
*/
|
||||
$scope.search = function (searchWord, searchOption) {
|
||||
console.log('search......', searchWord);
|
||||
if (!searchWord) {
|
||||
toastr.error('请输入搜索关键字', "错误");
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.login = true;
|
||||
// var searchOption = $('.js-search-option').dropdown('get value') || 0;
|
||||
|
|
@ -81,6 +99,7 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
t: searchOption,
|
||||
d: searchWord,
|
||||
}
|
||||
$scope.searchIcon(newItem)
|
||||
var delIndex = -1;
|
||||
$scope.searchHistory.unshift(newItem);
|
||||
$scope.searchHistory.forEach((item, index) => {
|
||||
|
|
@ -98,17 +117,9 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
}
|
||||
}
|
||||
|
||||
$scope.readySearch = function () {
|
||||
$scope.searching = true;
|
||||
}
|
||||
|
||||
$scope.exitSearch = function () {
|
||||
$scope.searching = false;
|
||||
$scope.searchWord = "";
|
||||
$(".search-item").val("");
|
||||
}
|
||||
|
||||
$scope.searchByHistory = function (type, data) {
|
||||
$scope.searchByHistory = function (type, data, $event) {
|
||||
console.log("searchByHistory", type, data);
|
||||
$event && $event.stopPropagation();
|
||||
$scope.searchWord = data;
|
||||
$('.search-item').val($scope.searchWord);
|
||||
|
||||
|
|
@ -119,10 +130,12 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
$('.js-search-option .menu .item').removeClass('active');
|
||||
$('.js-search-option .menu .item:eq(' + type + ')').addClass('active');
|
||||
$('.js-history-popup').removeClass('visible').addClass('hidden');
|
||||
$scope.search(data);
|
||||
$scope.search(data, type);
|
||||
}
|
||||
|
||||
$scope.delHistory = function (type, data) {
|
||||
$scope.delHistory = function (type, data, $event) {
|
||||
console.log("delHistory", type, data);
|
||||
$event && $event.stopPropagation();
|
||||
var delIndex = -1;
|
||||
$scope.searchHistory.forEach((item, index) => {
|
||||
if (index >= 1 && item.t == type && item.d == data) {
|
||||
|
|
@ -132,9 +145,13 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
if (delIndex >= 0) {
|
||||
$scope.searchHistory.splice(delIndex, 1);
|
||||
}
|
||||
if(!type && !data) {
|
||||
$scope.searchHistory = [];
|
||||
}
|
||||
saveHistory();
|
||||
toastr.info("历史搜索已全部清空", "提示");
|
||||
$timeout(function () {
|
||||
$('.js-history-popup').removeClass('hidden').addClass('visible');
|
||||
type && data && $('.js-history-popup').removeClass('hidden').addClass('visible');
|
||||
}, 500)
|
||||
}
|
||||
|
||||
|
|
@ -221,11 +238,15 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
bookmarkService.userInfo({})
|
||||
.then((user) => {
|
||||
$scope.searchHistory = JSON.parse(user.search_history || '[]');
|
||||
$scope.quickUrl = JSON.parse(user.quick_url || '{}');
|
||||
|
||||
$scope.searchHistory.forEach((item, index) => {
|
||||
$scope.searchIcon(item)
|
||||
})
|
||||
$timeout(function () {
|
||||
var showStyle = (user && user.show_style) || 'navigate';
|
||||
if (showStyle) {
|
||||
|
|
@ -275,7 +296,6 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
|||
}
|
||||
|
||||
if (key == 'S') {
|
||||
$scope.searching = true;
|
||||
$(".search-item").focus();
|
||||
var count = 1;
|
||||
var sId = setInterval(function() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<div class="js-menu" ng-controller="menuCtr">
|
||||
<div class="ui huge menu js-login-in" ng-if="login">
|
||||
<a class="item js-single-menu" ng-class="{selected:$index===selectLoginIndex}" style="cursor:default;" ui-sref-opts="{reload: true}" ng-repeat="menu in loginMenus" ui-sref="{{ menu.uiSref }}({searchWord:null})" ng-show="menu.show !== false" js-menu-init>
|
||||
<a class="item js-single-menu" ng-class="{selected:$index===selectLoginIndex}" style="cursor:default;" ui-sref-opts="{reload: true}" ng-repeat="menu in loginMenus"
|
||||
ui-sref="{{ menu.uiSref }}({searchWord:null})" ng-show="menu.show !== false" js-menu-init>
|
||||
<div>{{ menu.title }}</div>
|
||||
<div class="ui floating simple dropdown icon js-bookmark-dropdown" ng-if="$index==0" ng-click="$event.stopPropagation();">
|
||||
<i class="dropdown icon"></i>
|
||||
|
|
@ -19,81 +20,61 @@
|
|||
<label>表格</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 卡片这个傻逼模式就没用过,干掉 -->
|
||||
<!-- <div class="field item js-field-card" ng-click="updateShowStyle('card')">
|
||||
<div class="ui radio checkbox js-radio-card">
|
||||
<input type="radio" name="show-style">
|
||||
<label>卡片</label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<div id="js-search" style="width: 1500px;">
|
||||
<div class="ui transparent fluid icon input" style="height: 100%;margin-left: 10px;">
|
||||
<label for="lcq">
|
||||
<div class="ui inline dropdown js-search-option" style="margin-top:3px;height: 100%;" js-search-option-init>
|
||||
<!-- <div class="text " style="color:#C9C9C9;font-weight:normal;">书签</div> -->
|
||||
<!-- <i class="angle down icon"></i> -->
|
||||
<div class="menu">
|
||||
<div class="item" data-value="{{$index}}" ng-class="{active:$index==0}" ng-repeat="historyType in historyTypes">{{historyType}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
<input style="padding-left: 0px;" class="prompt search-item js-search-input" type="text" ng-focus="readySearch()" ng-model="searchWord" placeholder="search..." ng-keypress="($event.which === 13)?search(searchWord, 0):0" data-position="bottom left" data-variation="large" id="lcq">
|
||||
<div class="ui fluid popup top left transition hidden" style="padding-left: 0px; padding-right: -10px;">
|
||||
<div class="ui selection list">
|
||||
<div class="item" ng-repeat="item in searchHistory" ng-click="searchByHistory(item.t, item.d)" style="height:30px;">
|
||||
<div class="right floated content">
|
||||
<span style="margin-right:10px;">{{ historyTypes[item.t] }}</span>
|
||||
<input style="padding-left: 0px;" class="prompt search-item js-search-input" type="text" ng-model="searchWord" placeholder="search..."
|
||||
ng-keypress="($event.which === 13)?search(searchWord, 1):0" data-position="bottom left" data-variation="large">
|
||||
<div class="ui fluid popup top left transition hidden js-popup-search js-history-popup" ng-if="searchHistory.length > 0" style="margin-left: 2px; margin-top: -1px;">
|
||||
<div class="ui internally grid">
|
||||
<div class="row js-history-word" style="height: 20px;" ng-repeat="item in searchHistory">
|
||||
<div class="sixteen wide column js-search-again" style="margin: -10px 0px 0px -8px;cursor:default;"
|
||||
ng-click="searchByHistory(item.t, item.d)">
|
||||
<i class="{{ item.icon }}" style="cursor:default;"></i>
|
||||
<span style="color: #7B77C5">{{ item.d}}</span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span style="margin-left:10px;">{{ item.d}}</span>
|
||||
<!-- <div class="center aligned two wide column" style="margin: -10px 0px 0px 0px;padding:0px;">
|
||||
<div style="cursor:default;float: right;" ng-click="delHistory(item.t, item.d)">删除</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="row" style="height: 20px;background: #f2f2f2" ng-click="delHistory()">
|
||||
<div class="center aligned sixteen wide column" style="margin: -10px 0px 0px 0px;padding:0px;">
|
||||
<div style="cursor:pointer;float: right;">清空全部</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="searching">
|
||||
<span style="margin-left: -25px;"><i class="bookmark outline link icon" title="书签搜索" ng-click="search(searchWord, 0)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||
<span><i class="google link icon" title="谷歌搜索" ng-click="search(searchWord, 1)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||
<span><i class="bimobject link icon" title="百度搜索" ng-click="search(searchWord, 4)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||
<span><i class="github link icon" title="Github 搜索" ng-click="search(searchWord, 2)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||
<span><i class="stack overflow link icon" title="栈溢出搜索" ng-click="search(searchWord, 3)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||
<span>|</span>
|
||||
<span><i class="add square link icon" title="添加书签" ng-click="showAddBookmarkMoadl()" style="cursor:default;margin-top:16px;margin-right: 8px;margin-left: 8px;"></i></span>
|
||||
<span><i class="arrow right link icon" title="退出搜索" ng-click="exitSearch()" style="cursor:default;margin-top:16px;"></i></span>
|
||||
<div style="margin-top: 13px;">
|
||||
<span style="margin-left: -25px;"><i class="google link icon" title="谷歌搜索(输入关键字按回车键默认搜索引擎)" ng-click="search(searchWord, 1)" style="cursor:default;margin-right: 8px;"></i></span>
|
||||
<span><i class="bimobject link icon" title="百度搜索" ng-click="search(searchWord, 4)" style="cursor:default;margin-right: 8px;"></i></span>
|
||||
<span><i class="book link icon" title="书签搜索" ng-click="search(searchWord, 0)" style="cursor:default;margin-right: 8px;"></i></span>
|
||||
<span><i class="file alternate link icon" title="备忘录搜索" ng-click="search(searchWord, 5)" style="cursor:default;margin-right: 8px;"></i></span>
|
||||
<span><i class="github link icon" title="Github 搜索" ng-click="search(searchWord, 2)" style="cursor:default;margin-right: 8px;"></i></span>
|
||||
<span><i class="stack overflow link icon" title="栈溢出搜索" ng-click="search(searchWord, 3)" style="cursor:default;margin-right: 8px;"></i></span>
|
||||
<span style="margin: 0px 5px">▏</span>
|
||||
<span data-tooltip="添加书签,可按Insert快速打开添加页面" ng-click="showAddBookmarkMoadl()">
|
||||
<i class="add square link icon" style="cursor:default;margin-right: 8px;margin-left: 1px;"></i>
|
||||
</span>
|
||||
<span data-tooltip="如果你觉得我的系统对你有帮助,请点击跳转到 Github 为我 Star" ng-click="star()" ng-show="user.username !== 'lcq'">
|
||||
<i class="star link icon" style="cursor:default;margin-right: 8px;"></i>
|
||||
</span>
|
||||
<span class="suggest" ng-click="showUpdate()" ng-show="user.username !== 'lcq'">
|
||||
<i class="info circle link icon" style="cursor:default;margin-right: 8px;"></i>
|
||||
</span>
|
||||
<span data-tooltip="请我喝杯咖啡" ng-click="coffee()" ng-show="user.username !== 'lcq'">
|
||||
<i class="coffee link icon" style="cursor:default;margin-right: 8px;"></i>
|
||||
</span>
|
||||
<span data-tooltip="退出登陆" ng-click="logout()">
|
||||
<i class="sign out link icon" style="cursor:default;margin-right: 8px;"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right menu" ng-if="!searching">
|
||||
<div class="item" style="padding:0 8px 0 13px;" title="添加书签" ng-click="showAddBookmarkMoadl()">
|
||||
<span data-tooltip="添加书签,可按Insert快速打开添加页面">
|
||||
<i class="add square icon"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item" style="padding:0 8px 0 13px;" ng-click="star()" ng-show="user.username !== 'lcq'">
|
||||
<span data-tooltip="如果你觉得我的系统对你有帮助,请点击跳转到 Github 为我 Star">
|
||||
<i class="star icon"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item" style="padding:0 8px 0 13px;" ng-click="showUpdate()" ng-show="user.username !== 'lcq'">
|
||||
<span class="suggest">
|
||||
<i class="info circle icon"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item" style="padding:0 8px 0 13px;" ng-click="coffee()" ng-show="user.username !== 'lcq'">
|
||||
<span data-tooltip="请我喝杯咖啡">
|
||||
<i class="coffee icon"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item" style="padding:0 8px 0 13px;">
|
||||
<span data-tooltip="退出登陆">
|
||||
<i class="sign out icon" title="退出登陆" ng-click="logout()"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui huge menu js-not-login-in" ng-if="!login">
|
||||
<a class="item" ng-class="{selected:$index==selectNotLoginIndex}" ui-sref="{{ menu.uiSref}}" ui-sref-opts="{reload: true}" ng-repeat="menu in notLoginMenus">{{ menu.title}}</a>
|
||||
<a class="item" ng-class="{selected:$index==selectNotLoginIndex}" ui-sref="{{ menu.uiSref}}" ui-sref-opts="{reload: true}"
|
||||
ng-repeat="menu in notLoginMenus">{{ menu.title}}</a>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue