Merge branch 'razrab' into feature/create_app
This commit is contained in:
commit
4f2e6aa2a9
9 files changed
+164
-67
No files matched your search
@@ -5,7 +5,7 @@
|
||||
/>
|
||||
<v-card
|
||||
class="mx-auto mb-0 "
|
||||
v-for="(x, i) in newss.newsqueryset" :key= i
|
||||
v-for="(x, i) in newss" :key= i
|
||||
>
|
||||
<v-img
|
||||
:src="`${burl}${x.link}`"
|
||||
@@ -50,22 +50,24 @@
|
||||
<v-row >
|
||||
<v-col>
|
||||
<v-btn
|
||||
variant="text"
|
||||
icon="mdi-thumb-up-outline"
|
||||
color="blue-darken-3"
|
||||
@click="toggleIncrementLike"
|
||||
/>
|
||||
{{ incrementLikes }}
|
||||
variant="text"
|
||||
:icon="x.scores.filter(e=> e.user==accountStore.user.id && e.score ==true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'"
|
||||
color="blue-darken-3"
|
||||
@click="toggleIncrementLike(x.id, true)"
|
||||
/>
|
||||
{{x.scores.filter(e=> e.score==true).length}}
|
||||
<!-- {{ x.likes }} -->
|
||||
</v-col>
|
||||
<v-col class=" ml-8">
|
||||
<v-btn
|
||||
variant="text"
|
||||
icon="mdi-message-text-outline"
|
||||
color="teal"
|
||||
@click="commentShow=!commentShow"
|
||||
@click="x.showComment=!x.showComment"
|
||||
/>
|
||||
{{ x.comment.length }}
|
||||
<!-- @click="commentadd" -->
|
||||
{{ message }}
|
||||
|
||||
<!-- <v-btn
|
||||
:icon="x.show ? 'mdi-chevron-up' : 'mdi-chevron-down'"
|
||||
@click="x.show = !x.show"
|
||||
@@ -74,11 +76,13 @@
|
||||
<v-col class="text-center pr-0">
|
||||
<v-btn
|
||||
variant="text"
|
||||
icon="mdi-thumb-down-outline"
|
||||
:icon="x.scores.filter(e=> e.user==accountStore.user.id && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'"
|
||||
color="red-lighten-2"
|
||||
@click="toggleDecrementLike"
|
||||
@click="toggleIncrementLike(x.id, false)"
|
||||
/>
|
||||
{{ derementLikes }}
|
||||
{{x.scores.filter(e=> e.score==false).length}}
|
||||
<!-- {{ x.dislikes }} -->
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
@@ -91,8 +95,24 @@
|
||||
|
||||
</v-expand-transition>
|
||||
<v-expand-transition>
|
||||
<div v-show="commentShow">
|
||||
<!-- {{ x.commnet.text }} -->
|
||||
<div v-show="x.showComment" v-if="x.comment.length>0">
|
||||
<div
|
||||
v-for = "(y, key) in x.comment"
|
||||
:key="key"
|
||||
|
||||
|
||||
class="d-flex align-center flex-column py-3"
|
||||
>
|
||||
<div class="text-subtitle-2">{{dateformat(y.cdate)}}</div>
|
||||
|
||||
<v-card
|
||||
width="400"
|
||||
:subtitle=y.author
|
||||
:text=y.text
|
||||
elevation="1"
|
||||
></v-card>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</v-expand-transition>
|
||||
</v-card>
|
||||
@@ -145,6 +165,8 @@ import {useAccountStore} from '@/store/AccountStore'
|
||||
import {getfromserver} from '@/utils/universal_functions'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import myHelper from './UI/my-helper.vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { format } from 'date-fns'
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
@@ -157,38 +179,61 @@ export default {
|
||||
const show=ref(false)
|
||||
const incrementLikes = ref(0)
|
||||
const derementLikes = ref(0)
|
||||
const likes = ref(0)
|
||||
const likedI = ref(false)
|
||||
const likedD = ref(false)
|
||||
const message = ref(0)
|
||||
const commentShow = ref(false)
|
||||
const dialogCommentShow = ref(false)
|
||||
|
||||
const toggleIncrementLike = () => {
|
||||
if (likedI.value) {
|
||||
incrementLikes.value--
|
||||
}
|
||||
else {
|
||||
incrementLikes.value++
|
||||
if(likedD.value){
|
||||
derementLikes.value--
|
||||
likedD.value = false
|
||||
}
|
||||
}
|
||||
likedI.value=!likedI.value
|
||||
const toggleIncrementLike = (news, scores) => {
|
||||
console.log(news, scores);
|
||||
|
||||
// let k = scores.find(e=>e.user==accountStore.user.id)
|
||||
// // if (!k.score){
|
||||
// console.log(k,'=============');
|
||||
// // }
|
||||
|
||||
// if (likedI.value) {
|
||||
// incrementLikes.value--
|
||||
// }
|
||||
// else {
|
||||
// incrementLikes.value++
|
||||
// if(likedD.value){
|
||||
// derementLikes.value--
|
||||
// likedD.value = false
|
||||
// }
|
||||
// }
|
||||
// likedI.value=!likedI.value
|
||||
// likes.value = incrementLikes.value
|
||||
// console.log(incrementLikes.value, 'incrementLikes.value');
|
||||
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
|
||||
|
||||
newss.value[newss.value.findIndex(e=> e.id==news)].scores= result.data
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
const toggleDecrementLike = () => {
|
||||
if (likedD.value) {
|
||||
derementLikes.value--
|
||||
}
|
||||
else {
|
||||
derementLikes.value++
|
||||
if(likedI.value){
|
||||
incrementLikes.value--
|
||||
likedI.value = false
|
||||
}
|
||||
}
|
||||
likedD.value=!likedD.value
|
||||
const dateformat = (datas) => {
|
||||
|
||||
return format(new Date(datas), 'dd.MM.yyyy')
|
||||
}
|
||||
|
||||
const toggleDecrementLike = (idnews) => {
|
||||
// if (likedD.value) {
|
||||
// derementLikes.value--
|
||||
// }
|
||||
// else {
|
||||
// derementLikes.value++
|
||||
// if(likedI.value){
|
||||
// incrementLikes.value--
|
||||
// likedI.value = false
|
||||
// }
|
||||
// }
|
||||
// likedD.value=!likedD.value
|
||||
// likes.value = derementLikes.value
|
||||
// console.log(derementLikes.value, 'derementLikes.value');
|
||||
// axiosApiInstance.post(`api/navigation/news/`, {like: likes.value, idnews: idnews})
|
||||
}
|
||||
|
||||
const burl = baseURL.slice(0,-1)
|
||||
@@ -207,6 +252,14 @@ export default {
|
||||
}
|
||||
}, {deep:true})
|
||||
|
||||
|
||||
// watch(()=>likes,(newValue,oldValue)=>{
|
||||
// if(newValue){
|
||||
// getfromserver("api/navigation/news/",newss)
|
||||
// }
|
||||
// }, {deep:true})
|
||||
|
||||
|
||||
const commentadd = () => {
|
||||
dialogCommentShow.value=!dialogCommentShow.value
|
||||
// commentShow.value =!commentShow.value
|
||||
@@ -225,7 +278,9 @@ export default {
|
||||
toggleIncrementLike,
|
||||
toggleDecrementLike,
|
||||
dialogCommentShow,
|
||||
commentadd
|
||||
commentadd,
|
||||
accountStore,
|
||||
dateformat
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- {{appStore.countvisitor}} -->
|
||||
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
Reference in new issue
Block a user