lilei 2 年 前
コミット
81c85407ce
8 ファイル変更215 行追加17 行削除
  1. 2 2
      App.vue
  2. 19 0
      api/video.js
  3. 22 6
      pages.json
  4. 45 8
      pages/index/index.vue
  5. 0 0
      pages/videos/detail.vue
  6. 69 0
      pages/videos/index.vue
  7. 57 0
      pagesA/activeDetail/index.vue
  8. 1 1
      store/index.js

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.103:7002/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.2.113:7002/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 19 - 0
api/video.js

@@ -0,0 +1,19 @@
+import request from './request';
+
+// 首页轮播图
+export const promoTerminalList = params => {
+  return request({
+    url: `promoTerminal/queryByDealerSn/${params.sn}`,
+    method: 'get',
+    data: ''
+  })
+}
+
+// 活动详情
+export const promoTerminalDetail = params => {
+  return request({
+    url: `promoTerminal/findBySn/${params.sn}`,
+    method: 'get',
+    data: ''
+  })
+}

+ 22 - 6
pages.json

@@ -37,9 +37,24 @@
 		{
 			"path": "pages/h5Page/index",
 			"style": {
-				"navigationBarTitleText": "车领主"
+				"navigationBarTitleText": "页面"
 			}
 		},
+		{
+		    "path" : "pages/videos/index",
+		    "style" :                                                                                    
+		{
+		    "navigationBarTitleText": "视频内容",
+		    "enablePullDownRefresh": false
+		}
+		},{
+		    "path" : "pages/videos/detail",
+		    "style" :                                                                                    
+		{
+		    "navigationBarTitleText": "视频内容",
+		    "enablePullDownRefresh": false
+		}
+		},
 		{
 			"path": "pages/personData/personData",
 			"style": {
@@ -174,7 +189,6 @@
                 "navigationBarTitleText": "设置岗位",
                 "enablePullDownRefresh": false
             }
-            
         }
     ],
 	"subPackages":[{
@@ -334,14 +348,13 @@
 			    }
 			    
 			}
-		    ,{
-                    "path" : "videos/index",
+            ,{
+                    "path" : "activeDetail/index",
                     "style" :                                                                                    
                 {
-                    "navigationBarTitleText": "视频",
+                    "navigationBarTitleText": "活动内容",
                     "enablePullDownRefresh": false
                 }
-                
                 }
             ]
 	}],
@@ -365,6 +378,9 @@
 		"list": [{
 				"pagePath": "pages/index/index"
 			},
+			{
+				"pagePath": "pages/videos/index"
+			},
 			{
 				"pagePath": "pages/morePage/morePage"
 			}

+ 45 - 8
pages/index/index.vue

@@ -122,6 +122,7 @@
 	import { findCurrentRewardRule } from '@/api/rewardRule.js'
 	import { listLookUp, getLookUpDatas, getCurrUserInfo } from '@/api/data.js';
 	import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
+	import { promoTerminalList } from '@/api/video.js'
 	import { getRewardRollList } from '@/api/rewardRule.js'
 	export default {
 		components: {
@@ -151,6 +152,7 @@
 						fontSize: 32
 					}
 				],
+				carouselList: []
 			}
 		},
 		computed: {
@@ -169,15 +171,20 @@
 				return rule&&rule.ruleStatus == 'release'
 			},
 			imgList(){
+				let list = [
+					{
+						image: '/static/banner1.png',
+						activeType: ''
+					}
+				]
 				if(this.hasRedPacket&&this.hasShelf){
-					return [{
-						image: '/static/banner2.png'
-					}]
-				}else{
-					return [{
-						image: '/static/banner1.png'
-					}]
+					list.push(
+					{
+						image: '/static/banner2.png',
+						activeType: 'redPacket'
+					})
 				}
+				return list.concat(this.carouselList) 
 			}
 		},
 		onReady() {
@@ -252,6 +259,25 @@
 					return true
 				}
 			},
+			// 轮播图片
+			getCarousel(){
+				this.carouselList = []
+				const storeShelf = this.$store.state.vuex_storeShelf
+				promoTerminalList({sn:storeShelf.dealerSn}).then(res => {
+					if(res.status == 200){
+						res.data&&res.data.map(item => {
+							this.carouselList.push({
+								image: item.images,
+								title: item.title,
+								contentType: item.contentType,
+								id: item.id,
+								name: item.name,
+								promoActiveSn: item.promoActiveSn
+							})
+						})
+					}
+				})
+			},
 			pageInit(){
 				if(this.hasLogin){
 					// 获取扫描记录
@@ -378,6 +404,8 @@
 							this.getShelfBWPayRecord()
 							// 获取订单信息
 							this.shelfGetTotalWaitQty()
+							// 获取轮播数据
+							this.getCarousel()
 						}
 				})
 			},
@@ -420,9 +448,18 @@
 			},
 			// 单击banner
 			clickBanner(index){
-				if(index == 0 && this.hasRedPacket){
+				const row = this.imgList[index]
+				if(row.activeType == 'redPacket'){
 					uni.navigateTo({url:"/pages/morePage/redPacket"})
 				}
+				// 图文
+				if(row.contentType == 'IMAGE_CONTENT'){
+					uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
+				}
+				// 视频
+				if(row.activeType == 'VIDEO_CONTENT'){
+					uni.navigateTo({url:"/pagesA/videos/detail?sn="+row.promoActiveSn})
+				}
 			},
 			// 选择取货方式
 			clickAction(index){

+ 0 - 0
pagesA/videos/index.vue → pages/videos/detail.vue


+ 69 - 0
pages/videos/index.vue

@@ -0,0 +1,69 @@
+<template>
+	<view>
+		<view>asdfasdf asdf</view>
+		<u-tabbar :list="vuex_tabBarList" :before-switch="beforeSwitch" :mid-button="false"></u-tabbar>
+	</view>
+</template>
+
+<script>
+	import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		computed: {
+			...mapState(['hasLogin','vuex_vinScanNums','vuex_scanMaxNums','vuex_tabBarList']),
+			userInfo(){
+				return this.$store.state.vuex_userInfo
+			},
+		},
+		methods: {
+			// 扫描vin
+			beforeSwitch(index){
+				console.log(index)
+				if(index==1){
+					this.openCamera()
+				}else{
+					return true
+				}
+			},
+			// 去扫描
+			openCamera(){
+				if(this.hasLogin){
+					if(this.userInfo.sysUserFlag == '0'){
+						if(this.vuex_vinScanNums < this.vuex_scanMaxNums){
+							uni.navigateTo({
+								url: "/pages/scan-frame/scan-frame"
+							})
+						}else{
+							uni.showModal({
+								title: '提示',
+								content: '个人用户扫描VIN仅限10次,您的次数已用完!',
+								confirmText: '好的',
+								showCancel: false,
+								success(res) {}
+							})
+						}
+					}else{
+						uni.navigateTo({
+							url: "/pages/scan-frame/scan-frame"
+						})
+					}
+				}else{
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}
+			},
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 57 - 0
pagesA/activeDetail/index.vue

@@ -0,0 +1,57 @@
+<template>
+	<view class="content" v-if="detail">
+		<view class="titles">{{detail.title}}</view>
+		<view class="acitve-content">
+			<u-parse :html="content" :tag-style="style"></u-parse>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { promoTerminalDetail } from '@/api/video.js'
+	export default {
+		data() {
+			return {
+				detail: null,
+				style: {
+					p: ''
+				},
+				promoActiveSn: null
+			}
+		},
+		computed: {
+			content() {
+				return this.detail && this.detail.content 
+			}
+		},
+		onLoad(opts) {
+			this.promoActiveSn = opts.sn
+			this.getDetail()
+		},
+		methods: {
+			getDetail(){
+				promoTerminalDetail({sn:this.promoActiveSn}).then(res => {
+					this.detail = res.data
+					uni.setNavigationBarTitle({
+						title: res.data.name || '活动内容'
+					})
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.content{
+		padding: 30rpx;
+		.titles{
+			text-align: center;
+			padding: 20rpx 0;
+			border-bottom: 1px solid #eee;
+			font-weight: bold;
+		}
+		.acitve-content{
+			padding: 20rpx 0;
+		}
+	}
+</style>

+ 1 - 1
store/index.js

@@ -78,7 +78,7 @@ const store = new Vuex.Store({
 				'customIcon': false,
 			},
 			{
-				"pagePath": "/pagesA/videos/index",
+				"pagePath": "/pages/videos/index",
 				"iconPath": "/static/tab/tab_video_normal.png",
 				"selectedIconPath": "/static/tab/tab_video_pressed.png",
 				"text": "视频",