File tree Expand file tree Collapse file tree 12 files changed +327
-13
lines changed
Expand file tree Collapse file tree 12 files changed +327
-13
lines changed Original file line number Diff line number Diff line change 1111 </div >
1212 </li >
1313 <li >
14- <a href >
14+ <a href = " #/ " >
1515 <i class =" material-icons" >home</i >
1616 </a >
1717 </li >
1818 <li >
19- <a href >
19+ <a href = " #/email " >
2020 <i class =" material-icons" >email</i >
2121 </a >
2222 </li >
2323 <li >
24- <a href >
24+ <a href = " /list " >
2525 <i class =" material-icons" >supervisor_account</i >
2626 </a >
2727 </li >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" row" >
3+ <div class =" col s12" >
4+ <h5 >Editando campanha</h5 >
5+ </div >
6+ <div class =" col s12" >
7+ <a href =" '#/emails/view/' + email._id" class =" btn" >ver</a >
8+ </div >
9+ <div class =" col s12" >
10+ <div class =" card grey lighten-4" >
11+ <div class =" card-content" >
12+ <form action =" " @submit.prevent =" save()" >
13+ <div class =" input-field" >
14+ <input type =" text" id =" campanhaTitle" v-model =" email.title" />
15+ <label for =" campanhaTitle" >Título</label >
16+ </div >
17+ <div class =" input-field" >
18+ <textarea
19+ class =" materialize-textarea"
20+ rows =" 30"
21+ id =" campanhaBody"
22+ v-model =" email.body"
23+ />
24+ <label for =" campanhaBody" >Conteúdo</label >
25+ </div >
26+ <div class =" input-field" >
27+ <input type =" text" id =" campanhaStart" v-model =" email.start" />
28+ <label for =" campanhaStart" >Data de inicio</label >
29+ </div >
30+ <input type =" submit" value =" Salvar" class =" btn" />
31+ </form >
32+ </div >
33+ </div >
34+ </div >
35+ </div >
36+ </template >
37+ <script >
38+ export default {
39+ computed: {
40+ email : function () {
41+ return this .$store .state .email .email
42+ }
43+ },
44+ methods: {
45+ save : function () {
46+ this .$store .dispatch (' update' , this .email ).then (() => {
47+ this .$router .push (' /emails/view/' + this .email ._id )
48+ })
49+ }
50+ },
51+ mounted () {
52+ this .$store .dispatch (' getOne' , this .$route .params .id )
53+ }
54+ }
55+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" row" >
3+ <div class =" col s12" >
4+ <h5 >Gerenciamento de campanha</h5 >
5+ </div >
6+ <div class =" col s9" >
7+ <div class =" card grey lighten-4" >
8+ <div class =" card-content" >
9+ <table >
10+ <thead >
11+ <tr >
12+ <th >#</th >
13+ <th >Titulo</th >
14+ <th >Status</th >
15+ <th >Inicio</th >
16+ <th >Lista</th >
17+ <th ></th >
18+ </tr >
19+ </thead >
20+ <tbody >
21+ <tr v-for =" (email, index) in emails" >
22+ <td >{{ index+1 }}</td >
23+ <td >{{ email.title }}</td >
24+ <td >{{ email.status }}</td >
25+ <td >{{ email.start }}</td >
26+ <td >{{ email.list }}</td >
27+ <td >
28+ <a :href =" '#/emails/view/' + email._id " class =" btn" >ver</a >
29+ <a :href =" '#/emails/edit/' + email._id " class =" btn blue" >editar</a >
30+ <a :href =" '#/emails/remove/' + email._id " class =" btn red" >remover</a >
31+ </td >
32+ </tr >
33+ </tbody >
34+ </table >
35+ </div >
36+ </div >
37+ </div >
38+ <div class =" col s3" >
39+ <div class =" card lime" >
40+ <div class =" card-content" >
41+ <span class =" card-title" >
42+ Deseja iniciar uma nova campanha?
43+ </span >
44+ <p >
45+ <a href =" #/email/new" class =" btn bue" >começar</a >
46+ </p >
47+ </div >
48+ </div >
49+ </div >
50+ </div >
51+ </template >
52+
53+ <script >
54+ export default {
55+ computed: {
56+ emails : function () {
57+ return this .$store .state .email .emails
58+ }
59+ },
60+ mounted () {
61+ this .$store .dispatch (' getAll' )
62+ }
63+ }
64+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" row" >
3+ <div class =" col s12" >
4+ <h5 >Nova Campanha</h5 >
5+ </div >
6+ <div class =" col s12" >
7+ <div class =" card grey lighten-4" >
8+ <div class =" card-content" >
9+ <form action =" " @submit.prevent =" save()" >
10+ <div class =" input-field" >
11+ <input type =" text" id =" campanhaTitle" v-model =" data.title" />
12+ <label for =" campanhaTitle" >Título</label >
13+ </div >
14+ <div class =" input-field" >
15+ <textarea
16+ class =" materialize-textarea"
17+ rows =" 30"
18+ id =" campanhaBody"
19+ v-model =" data.body"
20+ />
21+ <label for =" campanhaBody" >Conteúdo</label >
22+ </div >
23+ <div class =" input-field" >
24+ <input type =" text" id =" campanhaStart" v-model =" data.start" />
25+ <label for =" campanhaStart" >Data de inicio</label >
26+ </div >
27+ <input type =" submit" value =" Salvar" class =" btn" />
28+ </form >
29+ </div >
30+ </div >
31+ </div >
32+ </div >
33+ </template >
34+ <script >
35+ export default {
36+ data : function () {
37+ return {
38+ data: {}
39+ }
40+ },
41+ methods: {
42+ save : function () {
43+ this .$store .dispatch (' insert' , this .data ).then (() => {
44+ this .$router .push (' /email' )
45+ })
46+ }
47+ }
48+ }
49+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" row" >
3+ <div class =" col s12" >
4+ <h5 >{{ email.title }} - campanha</h5 >
5+ </div >
6+ <div class =" col s12" >
7+ <a :href =" '#/emails/edit/' + email._id" class =" btn blue" >editar</a >
8+ <a :href =" '#/emails/remove/' + email._id" class =" btn red" >remover</a >
9+ </div >
10+ <div class =" col s6" >
11+ <div class =" card grey lighten-4" >
12+ <div class =" card-content" >
13+ <span class =" card-title" >Detalhes</span >
14+ <table >
15+ <tr >
16+ <th >Titulo</th >
17+ <td >{{ email.title }}</td >
18+ </tr >
19+ <tr >
20+ <th >Data de disparo</th >
21+ <td >{{ email.start }}</td >
22+ </tr >
23+ <tr >
24+ <th >Aberturas</th >
25+ <td >{{ email.opens }}</td >
26+ </tr >
27+ <tr >
28+ <th >Cliques</th >
29+ <td >{{ email.click }}</td >
30+ </tr >
31+ <tr >
32+ <th >Descadastros</th >
33+ <td >{{ email.unsubscribe }}</td >
34+ </tr >
35+ <tr >
36+ <th >Bounces</th >
37+ <td >{{ email.bounce }}</td >
38+ </tr >
39+ </table >
40+ </div >
41+ </div >
42+ </div >
43+ </div >
44+ </template >
45+
46+ <script >
47+ export default {
48+ computed: {
49+ email : function () {
50+ return this .$store .state .email .email
51+ }
52+ },
53+ mounted () {
54+ this .$store .dispatch (' getOne' , this .$route .params .id )
55+ }
56+ }
57+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ <h1 >Listas de disparo</h1 >
4+ </div >
5+ </template >
6+ <script >
7+ export default {
8+
9+ }
10+ </script >
Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ import Hello from '@/components/Hello'
44import Login from '@/components/auth/Login'
55import store from '@/states'
66
7+ import EmailList from '@/components/email/email-list'
8+ import EmailNew from '@/components/email/email-new'
9+ import EmailView from '@/components/email/email-view'
10+ import EmailEdit from '@/components/email/email-edit'
11+ import ListsList from '@/components/lists/lists-list'
12+
713Vue . use ( Router )
814
915let router = new Router ( {
@@ -14,6 +20,36 @@ let router = new Router({
1420 component : Hello ,
1521 meta : { requiresAuth : true }
1622 } ,
23+ {
24+ path : '/email' ,
25+ name : 'EmailList' ,
26+ component : EmailList ,
27+ meta : { requiresAuth : true }
28+ } ,
29+ {
30+ path : '/email/new' ,
31+ name : 'EmailNew' ,
32+ component : EmailNew ,
33+ meta : { requiresAuth : true }
34+ } ,
35+ {
36+ path : '/emails/view/:id' ,
37+ name : 'EmailView' ,
38+ component : EmailView ,
39+ meta : { requiresAuth : true }
40+ } ,
41+ {
42+ path : '/emails/edit/:id' ,
43+ name : 'EmailEdit' ,
44+ component : EmailEdit ,
45+ meta : { requiresAuth : true }
46+ } ,
47+ {
48+ path : '/lists' ,
49+ name : 'ListsList' ,
50+ component : ListsList ,
51+ meta : { requiresAuth : true }
52+ } ,
1753 {
1854 path : '/login' ,
1955 name : 'Login' ,
Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ import Vue from 'vue'
22import Vuex from 'vuex'
33
44import user from './modules/user'
5+ import email from './modules/email'
56
67window . axios = require ( 'axios' )
78window . axios . defaults . baseURL = process . env . SERVER
89window . axios . defaults . headers . post [ 'Content-Type' ] = 'application/x-www-form-urlencoded'
910
1011let config = {
1112 modules : {
12- user : user
13+ user : user ,
14+ email : email
1315 }
1416}
1517
Original file line number Diff line number Diff line change 1+ let qs = require ( 'qs' )
2+
3+ export default {
4+ state : {
5+ emails : [ ] ,
6+ email : { }
7+ } ,
8+ mutations : {
9+ updateEmails ( state , data ) {
10+ state . emails = data
11+ } ,
12+ updateEmail ( state , data ) {
13+ state . email = data
14+ }
15+ } ,
16+ actions : {
17+ getAll ( context ) {
18+ return window . axios . get ( '/api/campaigns' ) . then ( ( response ) => {
19+ context . commit ( 'updateEmails' , response . data . data )
20+ return response
21+ } )
22+ } ,
23+ getOne ( context , id ) {
24+ return window . axios . get ( '/api/campaigns/' + id ) . then ( ( response ) => {
25+ context . commit ( 'updateEmail' , response . data . data )
26+ return response
27+ } )
28+ } ,
29+ insert ( context , data ) {
30+ return window . axios . post ( '/api/campaigns' , qs . stringify ( data ) ) . then ( ( response ) => {
31+ return response
32+ } )
33+ } ,
34+ update ( context , data ) {
35+ console . log ( 'data' , data )
36+ return window . axios . put ( '/api/campaigns/' + data . _id , qs . stringify ( data ) ) . then ( ( response ) => {
37+ return response
38+ } )
39+ }
40+ }
41+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module.exports = function (app) {
33
44 app . get ( '/api/campaigns' , controller . index ) ;
55 app . post ( '/api/campaigns' , controller . add ) ;
6- app . get ( '/api/campaigns:id' , controller . view ) ;
7- app . put ( '/api/campaigns:id' , controller . edit ) ;
8- app . delete ( '/api/campaigns:id' , controller . delete ) ;
6+ app . get ( '/api/campaigns/ :id' , controller . view ) ;
7+ app . put ( '/api/campaigns/ :id' , controller . edit ) ;
8+ app . delete ( '/api/campaigns/ :id' , controller . delete ) ;
99}
You can’t perform that action at this time.
0 commit comments