Commit 1a86080f authored by 肖健's avatar 肖健

小程序首页悬浮更改为动态、首页商品更改为动态、首页增加视频播放、新增小程序广告

parent 5c3d38ea
// const baseUrl = 'https://r.ucaret.cn/test-api'; // 开发地/址
// const baseUrl = 'http://5thcg5.natappfree.cc'; // 开发地址
const baseUrl = 'https://movecar.jd.com'; // 线上地址
// const baseUrl = 'http://192.168.0.107:8080'; // 线上地址
const httpRequest = (opts, data) => {
let httpDefaultOpts = {
url: baseUrl + opts.url,
......
......@@ -3,8 +3,9 @@ import request from "./request";
// let baseUrl = 'https://jdorder.uzosp.com/'; // 正式服务域名接口
// let baseUrl = 'https://r.ucaret.cn/test-api'; // 开发地/址
let baseUrl = 'https://movecar.jd.com'; // 测试服务域名接口
// let baseUrl = 'http://192.168.0.107:8080'; // 测试服务域名接口
//可以new多个request来支持多个域名请求
......
......@@ -6,6 +6,7 @@ Vue.prototype.$store = store;
import http from "./common/api/api.js"
import $http from '@/common/request/requestConfig';
import {goToLocation} from '@/utils/utils.js'
Vue.config.productionTip = false
import ActiveForm from "@/common/active-form/active-form";
......@@ -13,6 +14,7 @@ import scrollList from "@/common/scroll-list/scroll-list";
Vue.use(uView);
Vue.prototype.http = http
Vue.prototype.$http = $http
Vue.prototype.$goToLocation = goToLocation
// 订阅消息模板id
Vue.prototype.nc_templateid = '59-hfHg3CnDvgVEnjqxiHRFwpABehc5lZxHQeUctlrg'
......
......@@ -18,38 +18,60 @@
</view>
<view class="banner">
<view class="banner-img">
<image src="http://jdnc-oss.uzosp.com/2022/06/23/d868a11f485448efb960d436a2159d78.png"></image>
<view class="left" @click="goJdShop(1)">
<view :class="indexCommodityList.length == 2 ? 'banner-bg' : 'banner-bg banner-bg-1'" v-if="indexCommodityList && indexCommodityList.length <= 2">
<image src="http://jdnc-oss.uzosp.com/2022/12/28/b1679b5da1b84fa1827039fe4fadd91c.png"></image>
<view class="item" @click="goJdShop(item)" v-for="(item, i) in indexCommodityList" :key="i">
<image :src="item.mainImgUrl"></image>
<view class="banner-btn-bg">
<view class="banner-btn">
<image src="../static/index/ban-btn.png"></image>
<text>立即购买</text>
</view>
</view>
<view class="right" @click="goJdShop(2)">
</view>
</view>
<view v-else>
<view scroll-x="true" class="banner-bg">
<image src="http://jdnc-oss.uzosp.com/2022/12/28/b1679b5da1b84fa1827039fe4fadd91c.png"></image>
<scroll-view :scroll-x="true" :enable-flex="true" :show-scrollbar="false" :scroll-with-animation="true" style="width:100%;white-space: nowrap;">
<view class="item" style="display: inline-flex;margin-right: 15rpx;" @click="goJdShop(item)" v-for="(item, i) in indexCommodityList" :key="i">
<image :src="item.mainImgUrl"></image>
<view class="banner-btn-bg">
<view class="banner-btn">
<image src="../static/index/ban-btn.png"></image>
<text>立即购买</text>
</view>
</view>
</view>
<view class="banner-other">
<view @click="goShopH5(2)">
<image src="https://nuoche.s3.cn-north-1.jdcloud-oss.com/2022/10/14/eb67b0d88bd24f71a04b6a939ef3bf74.png"></image>
</scroll-view>
</view>
<view @click="goShopH5(1)">
<image src="https://nuoche.s3.cn-north-1.jdcloud-oss.com/2022/10/14/672f38dadb0f4eacb486af28fe4fe762.png"></image>
</view>
<view class="banner-other" v-if="levitationList && levitationList.length > 0">
<view v-for="(item, i) in levitationList" :key="i" @click="$goToLocation(item)">
<view v-if="i !== 0" style="margin-top: 50rpx;">
<u--image :src="item.imageUrl" width="160rpx" height="120rpx"></u--image>
</view>
<u-gap bgColor="transparent" height="20"></u-gap>
<view v-else>
<u--image :src="item.imageUrl" width="160rpx" height="120rpx"></u--image>
</view>
</view>
</view>
<u-gap bgColor="transparent" height="20"></u-gap>
</view>
</view>
<view class="bg-img">
<!-- bg-img2为视频播放 -->
<view class="bg-img2" v-if="videoObj">
<image src="http://jdnc-oss.uzosp.com/2022/12/27/6a1ef562576f4e86a98118c9e343b9da.png"></image>
<video id="myvideo" @fullscreenchange="screenChange" :src="videoObj.videoLink" :poster="videoObj.thumbnail" controls>
</video>
</view>
<!-- bg-img没有视频播放,纯图片 -->
<view class="bg-img" v-else>
<image src="http://jdnc-oss.uzosp.com/2022/06/15/079440f5eea541bba67ea3d5f8097162.png"></image>
</view>
......@@ -95,39 +117,23 @@
timerNum:3,
timer:null,
clickState:false, // 立即领取 防抖
videoObj: null, //视频对象
videoContext: null,
levitationList: [],//悬浮数组对象
indexCommodityList: [],
};
},
methods: {
goShopH5(index){
let token = uni.getStorageSync('userToken');
if (!token) {
uni.setStorageSync('jdNavto',index)
uni.navigateTo({
url: '/pages/login/index/index'
})
return;
}
let url;
if(index == 1){
url = 'https://pro.m.jd.com/mall/active/3L2hs3R3aibYmosCRzA2Rp5z8pTR/index.html?babelChannel=ttt1'
}else{
url = 'https://jarvis.m.jd.com/start?source=2'
screenChange(e) {
if (!e.detail.fullScreen) {
this.videoContext.stop()
}
// uni.setStorageSync('h5url',url)
util.navigateToH5({page:url})
},
// 跳转 其他小程序页面
goJdShop(index){
let sku;
if(index == 1){
sku = 100025676633
}else{
sku = 100025676611
}
console.log(sku,777777777)
goJdShop(d){
uni.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74', // 跳转目标小程序的id
path: 'pages/item/detail/detail?sku='+sku, // 目标小程序的页面路径
path: d.link, // 目标小程序的页面路径
extraData: { // 需要携带的参数
},
......@@ -288,31 +294,55 @@
}
})
},
// 轮播跳转其他页面
goOtherLink(index) {
let item = this.list5[index]
let link = item.link;
if(link) {
if (item.remark == 'jdh5') {
// uni.navigateTo({
// url: '/pages/webview/webview?url=' + link
// })
let url;
let token = uni.getStorageSync('userToken');
if (!token) {
uni.setStorageSync('jdNavto',1)
uni.navigateTo({
url: '/pages/login/index/index'
})
return;
async getVideoList() {
await this.$http.request({
url:'/app/index/video/1',
method:'get',
data:{
},
}).then(res => {
if(res && res.length > 0) {
this.videoObj = res[0]
}
util.navigateToH5({page:link})
return
})
},
getVideoList() {
this.$http.request({
url:'/app/index/levitation/1',
method:'get',
data:{
},
}).then(res => {
if(res && res.length > 0) {
this.levitationList = res
} else {
this.levitationList = []
}
uni.navigateTo({
url: link
})
},
//获取首页商品
getIndexCommodityList() {
this.$http.request({
url:'/app/index/mall/index',
method:'get',
data:{
},
}).then(res => {
if(res && res.length > 0) {
this.indexCommodityList = res
} else {
this.indexCommodityList = []
}
})
},
// 轮播跳转其他页面
goOtherLink(index) {
let item = this.list5[index]
this.$goToLocation(item)
},
// 获取爱车列表
getCarList(){
......@@ -351,6 +381,8 @@
created() {
this.getMoveCode()
this.getRotationList()
this.getVideoList()
this.getIndexCommodityList()
},
mounted() {
setTimeout(() => {
......@@ -361,6 +393,11 @@
uni.setNavigationBarTitle({
title: '京东汽车挪车牌'
});
// 获取 video 上下文 videoContext 对象
this.videoContext = uni.createVideoContext('myvideo')
// 进入全屏状态
this.videoContext.requestFullScreen()
}
};
</script>
......@@ -435,10 +472,8 @@
width:100%;
margin-top:70rpx;
position: relative;
.banner-img,
.banner-bg,
.banner-btn{
margin: 0 auto;
position: relative;
image{
position: absolute;
top:0;left:0;
......@@ -448,19 +483,21 @@
position: relative;
}
}
.banner-img{
.banner-btn-bg {
display: flex;
justify-content: center;
width: 100%;
}
.banner-bg{
width: 710rpx ;height:542rpx;
box-sizing: border-box;
padding:100rpx 80rpx 0;
display:flex;
justify-content: space-between;
.left{
width: 260rpx;height:360rpx;
.item {
width:268rpx;
height:366rpx;
}
.right{
width: 260rpx;height:360rpx;
}
>view{
.banner-btn{
width:200rpx;height:66rpx;
font-weight: bold;
......@@ -471,33 +508,39 @@
line-height:66rpx;
}
}
.banner-bg-1 {
justify-content: center;
}
.banner-other{
position: absolute;
right:-22rpx;top:-80rpx;
z-index:100;
>view{
&:first-child{
margin-left:34rpx;
width: 120rpx;height:112rpx;
}
&:last-child{
margin-top:100rpx;
width: 172rpx;height:140rpx;
}
.bg-img{
width:750rpx;
image{
width:100%;height:100%;
}
width:750rpx;height:4420rpx;
}
}
}
.bg-img{
width:100%;
.bg-img2{
width:750rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
image{
width:100%;height:4420rpx;
width:750rpx;height:4959rpx;
}
video {
position: absolute;
top: 660rpx;
width: 620rpx;
height: 310rpx;
}
}
......
......@@ -364,19 +364,11 @@
})
}
// 判断是否有京东跳转
let jdNavto = uni.getStorageSync('jdNavto')
let jdNavToObj = uni.getStorageSync('jdNavToObj')
if(jdNavto){
let url;
if(jdNavto == 1){
url = 'https://pro.m.jd.com/mall/active/3L2hs3R3aibYmosCRzA2Rp5z8pTR/index.html?babelChannel=ttt1'
}else{
url = 'https://jarvis.m.jd.com/start?source=2'
}
// uni.setStorageSync('h5url',url)
util.navigateToH5({page:url})
uni.removeStorageSync('jdNavto')
if(jdNavToObj){
uni.removeStorageSync('jdNavToObj')
this.$goToLocation(item)
}
}
......
......@@ -73,11 +73,11 @@
},
getRotationList() {
let opts = {
url: '/app/index/carouse/3',
url: '/app/index/adv/1',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
if (res.data.code == 200 && res.data.data && res.data.data.length > 0) {
let data = []
data = res.data.data
let imgList = []
......@@ -92,28 +92,7 @@
// 轮播跳转其他页面
goOtherLink(index) {
let item = this.list5[index]
let link = item.link;
if(link) {
if (item.remark == 'jdh5') {
// uni.navigateTo({
// url: '/pages/webview/webview?url=' + link
// })
let url;
let token = uni.getStorageSync('userToken');
if (!token) {
uni.setStorageSync('jdNavto',1)
uni.navigateTo({
url: '/pages/login/index/index'
})
return;
}
util.navigateToH5({page:link})
return
}
uni.navigateTo({
url: link
})
}
this.$goToLocation(item)
},
goUrl(vo) {
uni.removeStorageSync('routerLogin')
......
......@@ -146,11 +146,11 @@
},
getRotationList() {
let opts = {
url: '/app/index/carouse/4',
url: '/app/index/adv/2',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
if (res.data.code == 200 && res.data.data && res.data.data.length > 0) {
let data = []
data = res.data.data
let imgList = []
......@@ -165,28 +165,7 @@
// 轮播跳转其他页面
goOtherLink(index) {
let item = this.list5[index]
let link = item.link;
if(link) {
if (item.remark == 'jdh5') {
// uni.navigateTo({
// url: '/pages/webview/webview?url=' + link
// })
let url;
let token = uni.getStorageSync('userToken');
if (!token) {
uni.setStorageSync('jdNavto',1)
uni.navigateTo({
url: '/pages/login/index/index'
})
return;
}
util.navigateToH5({page:link})
return
}
uni.navigateTo({
url: link
})
}
this.$goToLocation(item)
},
loginOut() {
this.$http.request({
......
......@@ -19,7 +19,7 @@
<image :src="getImage(vo.mainImgUrl)" />
</view>
<view class="item2__title">{{vo.title}}</view>
<view class="item2__price">{{vo.currentPrice/100}}<text style="font-size: 22rpx;"></text></view>
<view class="item2__price">{{vo.currentPrice/100}}<text v-if="vo.priceSuffixFlag" style="font-size: 22rpx;"></text></view>
</view>
</view>
</view>
......@@ -34,8 +34,8 @@
{{vo.title}}
</view>
<view class="one_item_price">
{{vo.currentPrice/100}}<text style="font-size: 22rpx;margin-right:4rpx;"></text>
<span class="num__two">{{vo.originalPrice/100}}</span>
{{vo.currentPrice/100}}<text v-if="vo.priceSuffixFlag" style="font-size: 22rpx;margin-right:4rpx;"></text>
<span class="num__two" v-if="vo.originalPrice && vo.originalPrice > 0">{{vo.originalPrice/100}}</span>
</view>
</view>
</view>
......@@ -191,27 +191,7 @@ export default {
// 轮播跳转其他页面
goOtherLink(index){
let item = this.list3[index]
let link = item.link;
if(link) {
if (item.remark == 'jdh5') {
// uni.navigateTo({
// url: '/pages/webview/webview?url=' + link
// })
let token = uni.getStorageSync('userToken');
if (!token) {
uni.setStorageSync('jdNavto',1)
uni.navigateTo({
url: '/pages/login/index/index'
})
return;
}
util.navigateToH5({page:link})
return
}
uni.navigateTo({
url: link
})
}
this.$goToLocation(item)
}
},
onReady: function () {
......@@ -281,7 +261,7 @@ export default {
}
.one_item_price {
font-size: 24rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: #E1251B;
......@@ -374,7 +354,7 @@ export default {
}
.item2__price {
font-size: 24rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: #E1251B;
......
......@@ -66,6 +66,17 @@
<u-action-sheet :actions="list" @close='close' @select="selectClick" closeOnClickOverlay round='6'
:show="show"></u-action-sheet>
</div>
<u-gap bgColor="transparent" v-if="carouselFlag" height="20"></u-gap>
<view v-if="carouselFlag" style="width: 700rpx;margin: 0 auto;position: relative;">
<u-swiper radius="12rpx" :height="120" :list="list5" circular @change="e => current = e.current"
:autoplay="true" keyName="imageUrl" @click="goOtherLink">
</u-swiper>
<view style="position: absolute;right: 10rpx; top:10rpx;z-index: 99999;">
<u--image src="/static/my/close.png" width="12px" height="12px" @click="closeCarouselFlag"></u--image>
</view>
</view>
</view>
</template>
......@@ -120,10 +131,39 @@
notAllowPhoneReason: '',
notAllowWechatReason: '',
},
wxMaxNum:""
wxMaxNum:"",
list5: [],
current: 0,
carouselFlag:false,
}
},
methods: {
closeCarouselFlag() {
this.carouselFlag = false
},
// 轮播跳转其他页面
goOtherLink(index) {
let item = this.list5[index]
this.$goToLocation(item)
},
getRotationList() {
let opts = {
url: '/app/index/adv/4',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200 && res.data.data && res.data.data.length > 0) {
let data = []
data = res.data.data
let imgList = []
data.forEach(e => {
imgList.push(e)
})
this.list5 = imgList
this.carouselFlag = true
}
})
},
goToIndex() {
uni.navigateTo({
url: '/pages/main'
......@@ -399,6 +439,7 @@
this.moveCode = e.scene
//console.log('scene: ' + scene);
}
this.getRotationList()
},
onShow() {
this.getCarNumber()
......
......@@ -96,6 +96,17 @@
<!-- <view class="use__text" @click="gotoExplanation">使用说明</view> -->
<view class="use__text" @click="goArticle(2)">挪车牌使用安全说明</view>
<u-gap bgColor="transparent" v-if="carouselFlag" height="20"></u-gap>
<view v-if="carouselFlag" style="width: 700rpx;margin: 0 auto;position: relative;">
<u-swiper radius="12rpx" :height="120" :list="list5" circular @change="e => current = e.current"
:autoplay="true" keyName="imageUrl" @click="goOtherLink">
</u-swiper>
<view style="position: absolute;right: 10rpx; top:10rpx;z-index: 99999;">
<u--image src="/static/my/close.png" width="12px" height="12px" @click="closeCarouselFlag"></u--image>
</view>
</view>
<!-- 爱车选择弹框 -->
<u-popup :show="selectCar" mode="bottom" round="10" @close="selectCar = false">
<view class="love_car_list">
......@@ -171,10 +182,39 @@ export default {
}, // 验证码
clickStatus:false, // 节流
key:null, // 加密key
iv:null // 加密iv
iv:null, // 加密iv
list5: [],
current: 0,
carouselFlag:false,
}
},
methods: {
closeCarouselFlag() {
this.carouselFlag = false
},
// 轮播跳转其他页面
goOtherLink(index) {
let item = this.list5[index]
this.$goToLocation(item)
},
getRotationList() {
let opts = {
url: '/app/index/adv/3',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200 && res.data.data && res.data.data.length > 0) {
let data = []
data = res.data.data
let imgList = []
data.forEach(e => {
imgList.push(e)
})
this.list5 = imgList
this.carouselFlag = true
}
})
},
changeBtn() {
this.checked = !this.checked;
},
......@@ -424,6 +464,7 @@ export default {
onLoad(option) {
this.moveCode = option.moveCode
this.getKey()
this.getRotationList()
}
}
</script>
......
......@@ -24,7 +24,7 @@
</div>
<div class="money__num">
<text class="num__one">¥{{vo.currentPrice/100}}</text>
<text class="num__two">¥{{vo.originalPrice/100}}</text>
<text class="num__two" v-if="vo.originalPrice && vo.originalPrice > 0">¥{{vo.originalPrice/100}}</text>
</div>
</div>
</div>
......
import util from '@/pages/login/util.js'
export function goToLocation(item) {
let token = uni.getStorageSync('userToken')
if (!token) {
uni.setStorageSync('jdNavToObj', item)
uni.navigateTo({
url: '/pages/login/index/index'
})
return
}
let url
//H5链接,判断链接是否设置
if(item.busType == 1 && item.link){
util.navigateToH5({page:url})
}
//小程序链接,需要判断链接和appId是否都设置
if(item.busType == 2 && item.appId != null && item.link){
uni.navigateToMiniProgram({
appId: item.appId, // 跳转目标小程序的id
path: item.link, // 目标小程序的页面路径
extraData: { // 需要携带的参数
},
success:(res)=> {
// 打开成功
},
fail:()=>{
}
})
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment