Bläddra i källkod

消息请求处理

yangc 7 år sedan
förälder
incheckning
21bc4cee42

+ 10 - 6
pages/mobile/center/user/collect/message.vue

@@ -6,12 +6,16 @@
   export default {
     middleware: 'authenticated',
     layout: 'mobileNoHeader',
-    fetch ({ store }) {
-      let user = store.state.option.user.data
-      return Promise.all([
-        // 获取消息列表
-        store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
-      ])
+//    fetch ({ store }) {
+//      let user = store.state.option.user.data
+//      return Promise.all([
+//        // 获取消息列表
+//        store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
+//      ])
+//    },
+    created () {
+      let user = this.user.data
+      this.$store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
     },
     components: {
       Message

+ 10 - 6
pages/mobile/center/vendor/message.vue

@@ -6,12 +6,16 @@
   export default {
     middleware: 'authenticated',
     layout: 'mobileNoHeader',
-    fetch ({ store }) {
-      let user = store.state.option.user.data
-      return Promise.all([
-        // 获取消息列表
-        store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
-      ])
+//    fetch ({ store }) {
+//      let user = store.state.option.user.data
+//      return Promise.all([
+//        // 获取消息列表
+//        store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
+//      ])
+//    },
+    created () {
+      let user = this.user.data
+      this.$store.dispatch('messageShow/getAllMessage', { receiverUu: user.userUU, receiverEnuu: user.enterprise.uu, consumerApp: 'MALL', count: 10, page: 1, sorting: {'createTime': 'DESC'} })
     },
     components: {
       Message

+ 1 - 1
store/messageShow.js

@@ -14,7 +14,7 @@ export const actions = {
   // 获取全部消息
   getAllMessage({ commit }, params = {}) {
     commit('messageList/REQUEST_MESSAGE_LIST')
-    return axios.get('/messages', {params})
+    return axios.get(`${process.env.MESSAGE_URL}/messages`, {params})
       .then(response => {
         commit('messageList/GET_MESSAGE_LIST_SUCCESS', response.data)
       }, err => {