diff --git a/components/layouts/mobile/header.vue b/components/layouts/mobile/header.vue
index 9be06fc..ae7ddd3 100644
--- a/components/layouts/mobile/header.vue
+++ b/components/layouts/mobile/header.vue
@@ -6,19 +6,18 @@
+
+
+
+
+ 首页
+ 专题
+
+
+
+
-
-
-
-
-
发帖
@@ -127,27 +126,6 @@
}
},
methods: {
- loadAll() {
- return [
- {"value": "三全鲜食(北新泾店)", "address": "长宁区新渔路144号"},
- {"value": "Hot honey 首尔炸鸡(仙霞路)", "address": "上海市长宁区淞虹路661号"},
- {"value": "新旺角茶餐厅", "address": "上海市普陀区真北路988号创邑金沙谷6号楼113"}
- ]
- },
- querySearchAsync(queryString, cb) {
- let restaurants = this.restaurants;
- let results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
-
- clearTimeout(this.timeout);
- this.timeout = setTimeout(() => {
- cb(results);
- }, 3000 * Math.random());
- },
- createStateFilter(queryString) {
- return (state) => {
- return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
- };
- },
handleSelectMenu(item) {
let _ts = this;
let activeMenu = _ts.$store.state.activeMenu;
@@ -171,9 +149,6 @@
}
}
},
- handleSelect(item) {
- console.log(item)
- },
handleCommand(item) {
let _ts = this;
switch (item) {
@@ -211,7 +186,6 @@
}
},
mounted() {
- // this.restaurants = this.loadAll();
let user = this.user;
if (user) {
this.getUnreadNotifications();
diff --git a/components/layouts/pc/header.vue b/components/layouts/pc/header.vue
index 594e6d4..88dc9c2 100644
--- a/components/layouts/pc/header.vue
+++ b/components/layouts/pc/header.vue
@@ -6,37 +6,50 @@
-
+
-
首页
专题
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
- 创建作品集
+ 创建作品集
- 发帖
+ 发帖
@@ -61,7 +74,9 @@
:src="avatarURL">
- {{ nickname }}
+
+ {{ nickname }}
+
系统管理
个人中心
@@ -88,172 +103,196 @@
diff --git a/pages/article/_article_id.vue b/pages/article/_article_id.vue
index a87dca5..1bbc732 100644
--- a/pages/article/_article_id.vue
+++ b/pages/article/_article_id.vue
@@ -81,7 +81,7 @@
diff --git a/plugins/element-ui.js b/plugins/element-ui.js
index ff3dbc9..88021ce 100644
--- a/plugins/element-ui.js
+++ b/plugins/element-ui.js
@@ -1,5 +1,5 @@
import Vue from 'vue'
import Element from 'element-ui'
-import locale from 'element-ui/lib/locale/lang/zh-CN'
+import language from 'element-ui/lib/locale/lang/zh-CN'
-Vue.use(Element, { locale })
+Vue.use(Element, { language })
diff --git a/store/global.js b/store/global.js
index 177c836..5c45dca 100644
--- a/store/global.js
+++ b/store/global.js
@@ -4,7 +4,7 @@ export const state = () => ({
// ua
userAgent: '',
// 默认语言
- language: '',
+ language: 'zh-CN',
})
diff --git a/store/index.js b/store/index.js
index c5ba7bc..4b47087 100644
--- a/store/index.js
+++ b/store/index.js
@@ -1,6 +1,6 @@
import { isServer } from '~/environment'
-const cookieparser = process.server ? require('cookieparser') : undefined
+const cookieParser = isServer ? require('cookieparser') : undefined
export const state = () => {
return {
@@ -52,7 +52,7 @@ export const actions = {
android: userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1, //android终端或uc浏览器
iPhone: userAgent.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
iPad: userAgent.indexOf('iPad') > -1, //是否iPad
- webApp: userAgent.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部
+ webApp: userAgent.indexOf('Safari') == -1 //是否web应用程序,没有头部与底部
};
} ()
}
@@ -62,7 +62,7 @@ export const actions = {
}
let auth = null
if (req.headers.cookie) {
- const parsed = cookieparser.parse(req.headers.cookie)
+ const parsed = cookieParser.parse(req.headers.cookie)
try {
auth = JSON.parse(parsed.auth)
} catch (err) {
@@ -75,7 +75,8 @@ export const actions = {
const initFetchAppData = [
// 内容数据
store.dispatch('topic/fetchNavList'),
- store.dispatch('article/fetchList')
+ store.dispatch('article/fetchList'),
+ store.dispatch('search/fetchList'),
]
return Promise.all(initFetchAppData)
diff --git a/store/search.js b/store/search.js
new file mode 100644
index 0000000..96caed8
--- /dev/null
+++ b/store/search.js
@@ -0,0 +1,38 @@
+export const BASE_API_PATH = '/api/console';
+
+export const state = () => {
+ return {
+ fetching: false,
+ list: []
+ }
+}
+
+export const mutations = {
+ // 数据列表
+ updateListFetching(state, action) {
+ state.fetching = action
+ },
+ updateListData(state, action) {
+ state.list = action
+ }
+}
+
+export const actions = {
+ // 获取文章列表
+ fetchList({commit}, params = {}) {
+ // 清空已有数据
+ commit('updateListData', []);
+ commit('updateListFetching', true);
+
+ return this.$axios
+ .$get(`${BASE_API_PATH}/initial-search`)
+ .then(response => {
+ commit('updateListFetching', false);
+ commit('updateListData', response);
+ })
+ .catch(error => {
+ console.log(error);
+ commit('updateListFetching', false);
+ });
+ }
+}