add moment

This commit is contained in:
Anton Romanov 2019-05-27 18:02:05 +04:00
parent 4fefa39f7b
commit 10d560623d
3 changed files with 67 additions and 10 deletions

View File

@ -122,6 +122,7 @@ dependencies {
compile group: 'org.webjars.npm', name: 'vuex', version: '3.1.0'
compile group: 'org.webjars.npm', name: 'vue-router', version: '3.0.2'
compile group: 'org.webjars.npm', name: 'vue-multiselect', version: '2.0.2'
compile group: 'org.webjars.npm', name: 'vue-moment', version: '4.0.0'
compile group: 'org.webjars.npm', name: 'http-vue-loader', version: '1.3.5'
compile group: 'org.webjars.npm', name: 'axios', version: '0.18.0'

View File

@ -24,6 +24,7 @@
<script type="application/javascript" src="/webjars/vuex/3.1.0/dist/vuex.min.js"></script>
<script type="application/javascript" src="/webjars/vue-router/3.0.2/dist/vue-router.min.js"></script>
<script type="application/javascript" src="/webjars/vue-multiselect/2.0.2/dist/vue-multiselect.min.js"></script>
<script type="application/javascript" src="/webjars/moment/2.24.0/moment.js"></script>
<script type="application/javascript" src="/webjars/http-vue-loader/1.3.5/src/httpVueLoader.js"></script>
<script type="application/javascript" src="/webjars/axios/0.18.0/dist/axios.min.js"></script>
<script type="application/javascript" src="/js/app-config.js?v=@@timestamp"></script>

View File

@ -28,38 +28,37 @@
aria-labelledby="nav-main-tab">
<div class="form-group">
<label for="title">Название:</label>
<input class="form-control" id="title" type="text"
<input class="form-control" id="title" type="text" :value="paper.title"
placeholder="Название статьи"/>
</div>
<div class="form-group">
<label for="type">Тип статьи:</label>
<select class="form-control" id="type">
<option v-for="type in allTypes" value="type.id">{{ type.name }}</option>
<select class="form-control" id="type" :value="paper.type">
<option v-for="type in allTypes" :value="type.id">{{ type.name }}</option>
</select>
</div>
<div class="form-group">
<label for="status">Статус:</label>
<select class="form-control" id="status">
<option v-for="status in allStatuses" value="status.id">{{status.name}}</option>
<select class="form-control" id="status" :value="paper.status">
<option v-for="status in allStatuses" :value="status.id">{{status.name}}</option>
</select>
</div>
<div class="form-group">
<label for="comment">Комментарий:</label>
<textarea class="form-control" rows="5" id="comment"></textarea>
<textarea class="form-control" rows="5" id="comment" :value="paper.comment"></textarea>
</div>
<div class="form-group">
<label for="title">Ссылка на сайт конференции:</label>
<input class="form-control" id="url" type="text"
placeholder="Url"/>
<input class="form-control" id="url" type="text" placeholder="Url" :value="paper.url"/>
</div>
<div class="form-group">
<label>Авторы:</label>
<multiselect v-model="paperAuthors"
<multiselect v-model="paper.authors"
label="lastName"
:multiple="true"
:options="allAuthors"
@ -72,6 +71,55 @@
</div>
</div>
</div>
<div class="col-md-4 offset-md-1 col-sm-12 offset-sm-0">
<div class="form-group">
<div class="row">
<div class="col">
<h6 class="my-0">Дата создания:</h6>
</div>
<div class="col">
<small class="text-muted" >
{{ formatDate(paper.createDate) }}
</small>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col">
<h6 class="my-0">Дата изменения:</h6>
</div>
<div class="col">
<small class="text-muted">
{{ formatDate(paper.updateDate) }}
</small>
</div>
</div>
</div>
<div class="form-group">
<button id="pingButton" class="btn btn-primary text-uppercase"
type="button">
Ping авторам
</button>
</div>
</div>
<div class="clearfix"></div>
<div class="col-lg-12">
<div class="form-group">
<button id="sendMessageButton" name="save"
class="btn btn-success text-uppercase"
type="submit">
Сохранить
</button>
<a id="cancelButton" class="btn btn-default text-uppercase"
href="/papers/papers">
Отмена
</a>
</div>
</div>
</div>
</form>
</div>
@ -87,12 +135,19 @@
},
data: function () {
return {
paperAuthors:[],
paper:'',
allAuthors: [],
allTypes: [],
allStatuses: []
};
},
methods: {
formatDate: function (date) {
if (date) {
return moment(String(new Date(date))).format('DD.MM.YYYY hh:mm')
}
}
},
mounted: function () {
var self = this;
axiosEx.get(