Forráskód Böngészése

Merge branch 'master' of http://git.hghweb.ir/ali.s/palizvani-front-vite

hgh 2 éve
szülő
commit
d0f4f4e3ca

+ 17 - 6
src/components/Widgets/Content/AdminContentList/AdminContentList.vue

@@ -1,6 +1,8 @@
 <template>
   <div class="AdminContentList"
        :style="localOptions.style">
+    <q-linear-progress v-if="loading"
+                       indeterminate />
     <div class="more-action">
       <q-btn label="محتوای جدید"
              color="primary"
@@ -58,8 +60,9 @@ export default {
   name: 'AdminContentList',
   components: { DeleteBtn, EntityIndex },
   mixins: [mixinWidget],
-  data: () => {
+  data () {
     return {
+      loading: false,
       api: APIGateway.content.APIAdresses.base,
       tableKeys: {
         data: 'results',
@@ -69,8 +72,9 @@ export default {
         pageKey: 'page'
       },
       inputs: [
+        { type: 'select', name: 'category', label: 'دسته بندی', placeholder: ' ', optionLabel: 'title', optionValue: 'id', col: 'col-md-3 col-12' },
         { type: 'input', name: 'search', value: null, col: 'col-md-3 col-12', label: 'جست و جو', placeholder: ' ' },
-        { type: BtnControlComp, name: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
+        { type: BtnControlComp, name: 'btn', label: 'جستجو', placeholder: ' ', atClick: this.search, col: 'col-md-2 col-12' }
       ],
       table: {
         columns: [
@@ -116,12 +120,19 @@ export default {
     }
   },
   mounted() {
-    this.setActionBtn()
-    this.mounted = true
+    this.getCategories()
   },
   methods: {
-    setActionBtn () {
-      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
+    getCategories () {
+      this.loading = true
+      APIGateway.contentCategory.index({ per_page: 9999 })
+        .then((contentCategories) => {
+          FormBuilderAssist.setAttributeByName(this.inputs, 'category', 'options', contentCategories.list.list)
+        })
+        .finally(() => {
+          this.loading = false
+          this.mounted = true
+        })
     },
     search () {
       this.$refs.entityIndex.search()

+ 22 - 34
src/components/Widgets/ContentCategory/ContentCategoryShow/ContentItem.vue

@@ -1,24 +1,16 @@
 <template>
   <div class="col-md-4 col-sm-6 col-12">
     <q-card flat
-            class="ContentItem">
+            class="ContentItem"
+            @click="goToContentPage">
       <div class="thumbnail">
-        <router-link :to="{name: 'Public.Content.Show', params: {id: content.id}}">
-          <q-img :src="content.thumbnail" />
-        </router-link>
+        <q-img :src="content.thumbnail" />
       </div>
       <div class="title ellipsis-2-lines">
         <router-link :to="{name: 'Public.Content.Show', params: {id: content.id}}">
           {{content.title}}
         </router-link>
       </div>
-      <div class="child-category ellipsis-2-lines">
-        <router-link :to="{name: 'Public.ContentCategory.Show', params: {category_id: content.category }}">
-          <q-icon name="account_tree" />
-          دسته:
-          {{content.category_info?.title}}
-        </router-link>
-      </div>
       <q-card-actions class="action-section">
         <q-btn color="primary"
                class="btn-show-content"
@@ -41,48 +33,44 @@ export default defineComponent({
       type: Content,
       default: new Content()
     }
+  },
+  methods: {
+    goToContentPage () {
+      this.$router.push({ name: 'Public.Content.Show', params: { id: this.content.id } })
+    }
   }
 })
 </script>
 
 <style lang="scss" scoped>
 .ContentItem {
-  background-color: #f6f6f6;
-  border-radius: 54px 0 54px 54px;
-  padding: 20px 20px 30px;
+  background: #F6F6F6;
+  border-radius: 8px;
+  border: 1px solid #DFE1EC;
+  padding: 11px 24px 24px 24px;
   margin: 8px;
+  position: relative;
   .thumbnail {
-    margin-bottom: 43px;
+    padding: 0 34px;
+    margin-bottom: 8px;
     .q-img {
-      border-radius: 54px 0 54px 54px;
     }
   }
   .title {
-    font-size: 17px;
-    letter-spacing: 0;
-    padding-right: 26px;
-    padding-left: 26px;
-    margin-bottom: 16px;
-    a {
-      color: #475F4A;
-    }
-  }
-  .child-category {
-    font-size: 17px;
-    letter-spacing: 0;
-    padding-right: 26px;
-    padding-left: 26px;
-    margin-bottom: 31px;
+    font-size: 18px;
+    color: #212121;
+    text-align: center;
+    margin-bottom: 8px;
+    max-height: 48px;
+    min-height: 48px;
     a {
-      color: #475F4A;
+      color: #212121;
     }
   }
   .action-section {
     .btn-show-content {
       width: 100%;
       height: 48px;
-      max-width: 252px;
-      margin: auto;
     }
   }
 }

+ 18 - 7
src/components/Widgets/Post/AdminPostList/AdminPostList.vue

@@ -1,6 +1,8 @@
 <template>
   <div class="AdminPostList"
        :style="localOptions.style">
+    <q-linear-progress v-if="loading"
+                       indeterminate />
     <div class="more-action">
       <q-btn label="پست جدید"
              color="primary"
@@ -48,9 +50,9 @@ import { shallowRef } from 'vue'
 import { EntityIndex } from 'quasar-crud'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
-import DeleteBtn from 'src/components/Control/DeleteBtn.vue'
 import BtnControl from 'src/components/Control/btn.vue'
 import { FormBuilderAssist } from 'quasar-form-builder'
+import DeleteBtn from 'src/components/Control/DeleteBtn.vue'
 
 const BtnControlComp = shallowRef(BtnControl)
 
@@ -58,8 +60,9 @@ export default {
   name: 'AdminPostList',
   components: { DeleteBtn, EntityIndex },
   mixins: [mixinWidget],
-  data: () => {
+  data () {
     return {
+      loading: false,
       api: APIGateway.post.APIAdresses.base,
       tableKeys: {
         data: 'results',
@@ -69,8 +72,9 @@ export default {
         pageKey: 'page'
       },
       inputs: [
+        { type: 'select', name: 'category', label: 'دسته بندی', placeholder: ' ', optionLabel: 'title', optionValue: 'id', col: 'col-md-3 col-12' },
         { type: 'input', name: 'search', value: null, col: 'col-md-3 col-12', label: 'جست و جو', placeholder: ' ' },
-        { type: BtnControlComp, name: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
+        { type: BtnControlComp, name: 'btn', label: 'جستجو', placeholder: ' ', atClick: this.search, col: 'col-md-2 col-12' }
       ],
       table: {
         columns: [
@@ -116,12 +120,19 @@ export default {
     }
   },
   mounted() {
-    this.setActionBtn()
-    this.mounted = true
+    this.getCategories()
   },
   methods: {
-    setActionBtn () {
-      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
+    getCategories () {
+      this.loading = true
+      APIGateway.postCategory.index({ per_page: 9999 })
+        .then((postCategories) => {
+          FormBuilderAssist.setAttributeByName(this.inputs, 'category', 'options', postCategories.list.list)
+        })
+        .finally(() => {
+          this.loading = false
+          this.mounted = true
+        })
     },
     search () {
       this.$refs.entityIndex.search()