Pārlūkot izejas kodu

轮播图从接口获取

Xiao_123 5 mēneši atpakaļ
vecāks
revīzija
b1492c9b00

+ 12 - 0
api/common.js

@@ -307,4 +307,16 @@ export const getInterviewInviteListByInviteUserId = async (inviteUserId) => {
       auth: true
     }
   })
+}
+
+// 内容管理-广告
+export const getWebContent = async () => {
+  return request({
+    url: `/app-api/menduner/system/web-content/get?id=1`,
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
 }

+ 17 - 9
components/Advertisement/index.vue

@@ -4,7 +4,7 @@
 			<view class="popup-content" >
 					<swiper class="swiper-box" @change="swiperChange">
 						<swiper-item v-for="(item ,index) in swiperList" :key="index" class="f-straight">
-							<image class="img-item" :src="item.url" @click="skipLink(item)" mode="widthFix"></image>
+							<image class="img-item" :src="item.img" @click="skipLink(item)" mode="widthFix"></image>
 							<view @click="closeAdd" class="f-horizon-center">
 								<uni-icons style="display: flex;justify-content: flex-end;" type="closeempty"	size="40"	color="#fff"/>
 							</view>
@@ -17,20 +17,28 @@
 
 <script setup>
 import { ref, onMounted } from 'vue'
+import { getWebContent } from '@/api/common'
 
 const current = ref(0)
 const inputDialog = ref()
-const swiperList = [
+const swiperList = ref([
 	// {
 	// 	url: 'https://minio.menduner.com/dev/260c94447f93c5258e6b5c0db453f9da92ce59bebd1eef6bff3a8063d91d07f1.jpg',
 	// 	path: 'https://mp.weixin.qq.com/s/lI7_iHY1yaEqrb_kG1MusA'
 	// }
-	{
-		url: 'https://minio.menduner.com/dev/menduner/advertisement.jpg' // 注册广告
-	}
-]
+	// {
+	// 	url: 'https://minio.menduner.com/dev/menduner/advertisement.jpg' // 注册广告
+	// }
+])
 const currentPage = getCurrentPages()[0].route
 
+// 获取广告图
+const getSystemWebContent = async () => {
+  const { data } = await getWebContent()
+  swiperList.value = data.appAdvertisement || []
+}
+getSystemWebContent()
+
 const closeAdd = () => {
   inputDialog.value.close()
 	uni.removeStorageSync('firstOpen')
@@ -40,15 +48,15 @@ const openDialog = () => {
   inputDialog.value.open()
 }
 
-const skipLink = ({path}) => {
+const skipLink = ({ link, title }) => {
 	closeAdd()
 	// if (!uni.getStorageSync('token') && currentPage !== 'pages/login/index') {
 	// 	uni.switchTab({
   //     url: '/pages/index/my'
   //   })
 	// }
-	if (path) {
-		uni.navigateTo({ url: `/pages/addWebView/index?url=${path}` })
+	if (link) {
+		uni.navigateTo({ url: `/pages/addWebView/index?url=${link}&title=${title}` })
 	}
 }
 

+ 17 - 18
pages/index/crowdsourcing.vue

@@ -13,7 +13,7 @@
 				<view class="content-top">
 					<view class="content-top-carousel">
 						<view class="content-top-carousel-box">
-							<SwiperAd :list="swiperAdList" :strType="false" @click="handleToDetails"></SwiperAd>
+							<SwiperAd :list="swiperAdList" imgUrlKey="img" :strType="false" @click="handleToDetails"></SwiperAd>
 						</view>
 					</view>
 					<view class="content-top-recommend">
@@ -47,6 +47,7 @@ import ResumeStatus from '@/components/ResumeStatus'
 import { getJobAdvertisedHire } from '@/api/position.js'
 import { dealDictArrayData } from '@/utils/position.js'
 import PositionList from '@/components/PositionList'
+import { getWebContent } from '@/api/common'
 import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
 // 设置自定义tabbar选中值
 onShow(() => {
@@ -56,17 +57,15 @@ onShow(() => {
     // 设置当前tab页的下标index
     currentTabBar?.setData({ selected: 3 });
 })
-const swiperAdList = [
-  { src: 'https://minio.menduner.com/dev/menduner/banner/IHG.gif', id: '577540545828753408' },
-  { src: 'https://minio.citupro.com/dev/menduner/preferredGroup/SWISS-HOTEL-MANAGEMENT-SCHOOL-MBA.jpg' },
-  { src: 'https://minio.menduner.com/dev/menduner/banner/Marriott.jpg', id: '734173233779183616' },
-  { src: 'https://minio.menduner.com/dev/menduner/banner/UrCove.jpg', id: '277182701256183808' },
-  { src: 'https://minio.menduner.com/dev/menduner/miniProgram/Grand-Mercure.jpg', id: '120281807903133696' },
-  // { src: 'https://minio.menduner.com/dev/5eb89c28816dbc7613986ac994d2d760cc9fada84e17a78970c424904c26667c.jpg', id: '735167920258289664' },
-  { src: 'https://minio.menduner.com/dev/c2fc649b5aec3811c7a171b199bc2e67bb1649e63b471e48a59c8a6ead6aa047.jpg', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/lI7_iHY1yaEqrb_kG1MusA' },
-  { src: 'https://minio.menduner.com/dev/fbff08c5608d746380f859a97241109fe4726f776a25301d7d0fb43d9ba7df67.png', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/NrxuXTi7kB9AngNBYJ3v4A' },
-	{ src: 'https://minio.menduner.com/dev/4aeb9acb92512d899596d692db935429b339fca189129c0d78ce966f81ba2d38.jpg' }
-]
+
+// 获取轮播图
+const swiperAdList = ref([])
+const getSystemWebContent = async () => {
+  const { data } = await getWebContent()
+  swiperAdList.value = data.appHomeCarousel || []
+}
+getSystemWebContent()
+
 const items = reactive([])
 const pageInfo = ref({
 	pageNo: 1,
@@ -79,12 +78,12 @@ const total = ref(0)
 const more = ref('more')
 
 // 跳转企业详情
-const handleToDetails = ({ id, weiXinPublicUrl }) => {
-	if (id) {
-		uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
-	}
-	if (weiXinPublicUrl) {
-		uni.navigateTo({ url: `/pages/addWebView/index?url=${weiXinPublicUrl}&title=风尚榜奖投票` })
+const handleToDetails = ({ link, title }) => {
+	// if (id) {
+	// 	uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
+	// }
+	if (link) {
+		uni.navigateTo({ url: `/pages/addWebView/index?url=${link}&title=${title || '风尚榜奖投票'}` })
 	}
 }
 

+ 18 - 18
pages/index/position.vue

@@ -4,7 +4,7 @@
     <view class="box defaultBgc">
       <scroll-view class="scrollBox" :scroll-y="true" :scroll-top="scrollTop" @scrolltolower="loadingMore" @scroll="onScroll" style="position:relative;">
         <view>
-          <SwiperAd :list="swiperAdList" :strType="false" @click="handleToDetails"></SwiperAd>
+          <SwiperAd :list="swiperAdList" imgUrlKey="img" :strType="false" @click="handleToDetails"></SwiperAd>
           <!-- 五宫格菜单 -->
           <view class="white-bgc ss-p-t-10">
             <uni-grid :column="5" @change="handleGrid" :showBorder="false">
@@ -62,6 +62,7 @@ import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/un
 import Navbar from '@/components/Navbar'
 import { getRewardEventList } from '@/utils/eventList'
 import { getMorningNewsArticle } from '@/api/content'
+import { getWebContent } from '@/api/common'
 
 // 设置自定义tabbar选中值
 onShow(() => {
@@ -94,17 +95,16 @@ onLoad(() => {
 
 const inputDialog = ref()
 const more = ref('more')
-const swiperAdList = [
-  { src: 'https://minio.menduner.com/dev/menduner/banner/IHG.gif', id: '577540545828753408' },
-  { src: 'https://minio.citupro.com/dev/menduner/preferredGroup/SWISS-HOTEL-MANAGEMENT-SCHOOL-MBA.jpg' },
-  { src: 'https://minio.menduner.com/dev/menduner/banner/Marriott.jpg', id: '734173233779183616' },
-  { src: 'https://minio.menduner.com/dev/menduner/banner/UrCove.jpg', id: '277182701256183808' },
-  { src: 'https://minio.menduner.com/dev/menduner/miniProgram/Grand-Mercure.jpg', id: '120281807903133696' },
-  // { src: 'https://minio.menduner.com/dev/5eb89c28816dbc7613986ac994d2d760cc9fada84e17a78970c424904c26667c.jpg', id: '735167920258289664' },
-  { src: 'https://minio.menduner.com/dev/c2fc649b5aec3811c7a171b199bc2e67bb1649e63b471e48a59c8a6ead6aa047.jpg', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/lI7_iHY1yaEqrb_kG1MusA' },
-  { src: 'https://minio.menduner.com/dev/fbff08c5608d746380f859a97241109fe4726f776a25301d7d0fb43d9ba7df67.png', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/NrxuXTi7kB9AngNBYJ3v4A' },
-  { src: 'https://minio.menduner.com/dev/4aeb9acb92512d899596d692db935429b339fca189129c0d78ce966f81ba2d38.jpg' }
-]
+
+// 获取轮播图
+const swiperAdList = ref([])
+const getSystemWebContent = async () => {
+  const { data } = await getWebContent()
+  swiperAdList.value = data.appHomeCarousel || []
+}
+getSystemWebContent()
+
+
 const filterList = ref([
   { label: '城市', dictType: 'areaTreeDataExtend', key: 'areaIds', map: { text: 'name', value: 'id' } },
   // { label: '行业', dictType: 'industryTreeData',key: 'industryIds', map: { text: 'nameCn', value: 'id' } },
@@ -123,12 +123,12 @@ const gridList = [
 ]
 
 // 跳转企业详情
-const handleToDetails = ({ id, weiXinPublicUrl, title }) => {
-	if (id) {
-		uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
-	}
-	if (weiXinPublicUrl) {
-		uni.navigateTo({ url: `/pages/addWebView/index?url=${weiXinPublicUrl}&title=${title || '风尚榜奖投票'}` })
+const handleToDetails = ({ link, title }) => {
+	// if (id) {
+	// 	uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
+	// }
+	if (link) {
+		uni.navigateTo({ url: `/pages/addWebView/index?url=${link}&title=${title || '风尚榜奖投票'}` })
 	}
 }