Browse Source

feat(首页): 添加轮播图点击跳转功能并更新接口

- 修改环境变量为develop
- 新增webview页面用于处理外部链接跳转
- 实现轮播图点击跳转功能,支持内部路由和外部链接
- 替换旧版轮播图接口为新的AppletOrderBanner接口
- 更新pages.json添加webview页面配置
master
前端-胡立永 16 hours ago
parent
commit
3162ec4e67
5 changed files with 81 additions and 10 deletions
  1. +10
    -0
      api/order/AppletOrderBanner.js
  2. +9
    -0
      pages.json
  3. +35
    -9
      pages/index.vue
  4. +26
    -0
      pages_order/webview/webview.vue
  5. +1
    -1
      utils/getUrl.js

+ 10
- 0
api/order/AppletOrderBanner.js View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询轮播图列表
export function listAppletBanner(query) {
return request({
url: '/applet/order/banner/list',
method: 'get',
params: query
})
}

+ 9
- 0
pages.json View File

@ -463,6 +463,15 @@
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
},
{
"path": "webview/webview",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFBF60",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
}
]
}


+ 35
- 9
pages/index.vue View File

@ -7,8 +7,9 @@
<uni-swiper-dot class="uni-swiper-dot-box" field="content">
<swiper class="swiper" indicator-dots indicator-color="rgba(255, 255, 255, 0.50)"
indicator-active-color="#ffffff" autoplay interval="5000">
<swiper-item v-for="(item,i) in bannerList" :key="i">
<image :src="item&&item.dictValue" style="width: 100%;" mode="widthFix" />
<swiper-item v-for="(item,i) in bannerList" :key="i" @click="towebview(item)">
<image :src="item&&item.image" style="width: 100%;" mode="widthFix" />
<!-- <image :src="item&&item.dictValue" style="width: 100%;" mode="widthFix" /> -->
</swiper-item>
</swiper>
</uni-swiper-dot>
@ -312,6 +313,7 @@
<script>
import { bindCode } from '@/api/order/order.js'
import { listAppletBanner } from '@/api/order/AppletOrderBanner.js'
import {
getStaffList,
getProductList,
@ -414,6 +416,20 @@ import { bindCode } from '@/api/order/order.js'
// },
methods: {
towebview(item){
if(!item.url){
return
}
if(item.url.indexOf('https://') === 0 || item.url.indexOf('http://') === 0){
uni.navigateTo({
url: '/pages_order/webview/webview?url=' + encodeURIComponent(item.url)
})
return
}
uni.navigateTo({
url: item.url
})
},
closeNewUserPopup() {
this.isNewUser = false;
},
@ -755,13 +771,23 @@ import { bindCode } from '@/api/order/order.js'
},
redirectuser() {},
getBanner() {
getBannerList().then(res => {
if (res.code == 200) {
this.bannerList = res.data
} else {
this.$modal.showToast('获取Banner失败')
}
})
// getBannerList().then(res => {
// if (res.code == 200) {
// this.bannerList = res.data
// } else {
// this.$modal.showToast('Banner')
// }
// })
listAppletBanner({
pageNum: 1,
pageSize: 9999999,
}).then(res => {
if (res.code == 200) {
this.bannerList = res.data.records
} else {
this.$modal.showToast('获取Banner失败')
}
})
},
changeSwiper(e) {
this.current = e.detail.current


+ 26
- 0
pages_order/webview/webview.vue View File

@ -0,0 +1,26 @@
<template>
<view>
<!-- <web-view src="https://mp.weixin.qq.com/s/E3P7LocvLcklX2HIxblnsg"></web-view> -->
<web-view :src="url"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
onLoad(options) {
this.url = decodeURIComponent(options.url)
},
methods: {
}
}
</script>
<style>
</style>

+ 1
- 1
utils/getUrl.js View File

@ -1,4 +1,4 @@
let current ="release";
let current ="trial";
const accountInfo = wx.getAccountInfoSync();
// current = accountInfo.miniProgram.envVersion;


Loading…
Cancel
Save