liangan 1 долоо хоног өмнө
parent
commit
64bf0bc0f5

+ 6 - 2
src/api/common.ts

@@ -1,4 +1,3 @@
-import { qs } from '@/utils'
 import { http } from '@/utils/http'
 
 const pre = import.meta.env.VITE_SERVER_BASEURL_PREFIX
@@ -16,7 +15,7 @@ export function getEnum(data: any) {
  * @returns
  */
 export function divisionsTreeList(data: any) {
-  return http.post<any>(`${pre2}/divisions/treeList?${qs(data)}`)
+  return http.get<any>(`${pre2}/divisions/treeList`, data)
 }
 /**
  * 获取banner
@@ -92,3 +91,8 @@ export function noticeDel(id: number) {
 export function bindUser(data: any) {
   return http.post<any>(`${pre}/app/jpush/bindUser`, data)
 }
+
+// 广告
+export function advList(data: any) {
+  return http.get<any>(`${pre}/app/adv/advList`, data)
+}

+ 34 - 1
src/pages/index/index.vue

@@ -14,7 +14,7 @@
 // eslint-disable-next-line unused-imports/no-unused-imports
 import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
-import { bannerList, noticeUnread } from '@/api/common'
+import { advList, bannerList, noticeUnread } from '@/api/common'
 import { getList } from '@/api/product'
 import { toPage } from '@/utils/page'
 
@@ -182,7 +182,39 @@ async function getUnread() {
   catch {}
 }
 
+const curtain = reactive({
+  show: false,
+  img: '',
+  link: '',
+  linkType: '', // IN OUT
+  title: '',
+})
+
+async function getCurtain() {
+  try {
+    const res = await advList({ advType: 'INDEX' })
+    if (res.code === '200' && res.data.length) {
+      curtain.show = true
+      curtain.img = res.data[0].advImage
+      curtain.link = res.data[0].link
+      curtain.linkType = res.data[0].linkType
+      curtain.title = res.data[0].title
+    }
+  }
+  catch {}
+}
+
+function curtainClick() {
+  if (curtain.linkType === 'IN') {
+    toPage({ url: curtain.link })
+  }
+  else {
+    toPage({ url: '/pages/webLink/webLink', params: { title: curtain.title, link: curtain.link } })
+  }
+}
+
 onLoad(async () => {
+  getCurtain()
   await loadData()
 })
 
@@ -377,6 +409,7 @@ onShow(() => {
         </view>
       </view>
     </template>
+    <wd-curtain v-model="curtain.show" :src="curtain.img" :to="curtain.link" close-position="bottom" :width="280" @click="curtainClick" />
   </z-paging>
 </template>
 

+ 3 - 3
src/pages/mine/addressBookOperate.vue

@@ -57,9 +57,9 @@ watch(() => model.value.areaCodes, (newVal) => {
 async function columnChange({ selectedItem, resolve, finish }: any) {
   // 模拟异步请求
   console.log(selectedItem)
-  const res = await divisionsTreeList({ pid: selectedItem.pid, name: selectedItem.name })
-  if (res.data[0].child && res.data[0].child.length) {
-    resolve(res.data[0].child)
+  const res = await divisionsTreeList({ pid: selectedItem.id })
+  if (res.data && res.data.length) {
+    resolve(res.data)
   }
   else {
     finish()