Parcourir la source

修改合作伙伴

zs il y a 8 mois
Parent
commit
b59f78d1ca
2 fichiers modifiés avec 55 ajouts et 2 suppressions
  1. 49 0
      src/store/api/platform/friend.js
  2. 6 2
      src/views/one/index.vue

+ 49 - 0
src/store/api/platform/friend.js

@@ -0,0 +1,49 @@
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/utils/axios-wrapper'
+import { get } from 'lodash-es'
+const url = '/friend'
+const axios = new AxiosWrapper()
+
+export const FriendStore = defineStore('friend', () => {
+  const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}`, cond)
+    return res
+  }
+  const list = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}/list`, cond)
+    return res
+  }
+  const fetch = async (payload) => {
+    const res = await axios.$get(`${url}/${payload}`)
+    return res
+  }
+  const create = async (payload) => {
+    const res = await axios.$post(`${url}`, payload)
+    return res
+  }
+  const update = async (payload) => {
+    const id = get(payload, 'id', get(payload, 'id'))
+    const res = await axios.$post(`${url}/${id}`, payload)
+    return res
+  }
+  const del = async (payload) => {
+    const res = await axios.$delete(`${url}/${payload}`)
+    return res
+  }
+  return {
+    query,
+    list,
+    fetch,
+    create,
+    update,
+    del
+  }
+})

+ 6 - 2
src/views/one/index.vue

@@ -113,7 +113,7 @@
       </div>
       <div class="four_2">
         <div class="list" v-for="(item, index) in friendList" :key="index">
-          <el-image class="image" :src="getUrl(item.url, 'array')" fit="fill"></el-image>
+          <el-image class="image" :src="getUrl(item.file, 'array')" fit="fill"></el-image>
         </div>
       </div>
     </el-col>
@@ -153,9 +153,11 @@ const user = computed(() => userStore.user)
 import { NewsStore } from '@/store/api/platform/news'
 import { MatchStore } from '@/store/api/platform/match'
 import { DesignStore } from '@/store/api/platform/design'
+import { FriendStore } from '@/store/api/platform/friend'
 const newsStore = NewsStore()
 const matchStore = MatchStore()
 const designStore = DesignStore()
+const friendStore = FriendStore()
 // 加载中
 const loading = ref(false)
 // 路由
@@ -186,11 +188,13 @@ const searchOther = async () => {
   // 政策新闻
   res = await newsStore.query({ ...info })
   if (res.errcode == '0') newsList.value = res.data
+  // 合作伙伴
+  res = await friendStore.list({ is_use: '0' })
+  if (res.errcode == '0') friendList.value = res.data
   // 基础设置
   res = await designStore.query({})
   if ($checkRes(res)) {
     carouselList.value = res.data[0].carouselUrl || []
-    friendList.value = res.data[0].friend || []
     const friendship = res.data[0].friendship || []
     for (const val of friendship) {
       for (const tag of typeList.value) {