Bläddra i källkod

新增的动态发布时间,展示浏览量,新增产品浏览统计

gcz 2 år sedan
förälder
incheckning
cd5bbd23a8
7 ändrade filer med 32 tillägg och 7 borttagningar
  1. 5 0
      common/apiurl.js
  2. 1 1
      manifest.json
  3. 8 0
      shopping/productdetails.vue
  4. 7 2
      uni.scss
  5. 4 1
      xushuo/dynamic.vue
  6. 2 2
      xushuo/dynamicdetails.vue
  7. 5 1
      xushuo/xushuo.vue

+ 5 - 0
common/apiurl.js

@@ -173,6 +173,11 @@ const apiurl = {
 		url: '/order/selectById',
 		type: 'get'
 	},
+	// 添加商品浏览量
+	goodsAddView: {
+		url: '/goods/addViewCount',
+		type: 'put'
+	},
 	// 订单
 	// 订单提交
 	submitOrder: {

+ 1 - 1
manifest.json

@@ -63,7 +63,7 @@
             }
         },
         "requiredPrivateInfos" : [ "getLocation", "chooseLocation" ],
-		"lazyCodeLoading": "requiredComponents"
+        "lazyCodeLoading" : "requiredComponents"
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 8 - 0
shopping/productdetails.vue

@@ -137,6 +137,7 @@
 		onShow(){
 			this.getCartList();
 			this.getAddrList();
+			this.goodsAddView(this.id)
 		},
 		methods: {
 			leftClick(e){
@@ -175,6 +176,13 @@
 					console.log('getDetails',err.data);
 				})
 			},
+			goodsAddView(id){
+				this.$u.api.goodsAddView({id:id}).then(res=>{
+					// console.log('res',res.data);
+				}).catch(err=>{
+					console.log('goodsAddView',err.data);
+				})
+			},
 			addCart(id,buyNow){
 				this.$u.api.addCart({goodsId:id}).then(res=>{
 					this.$refs.uToast.show({

+ 7 - 2
uni.scss

@@ -276,6 +276,7 @@ page{
 		padding-bottom: 30rpx;
 		margin-bottom: 30rpx;
 		.text{
+			flex: 1;
 			margin-left: 20rpx;
 			.til{
 				font-size: 30rpx;
@@ -284,8 +285,12 @@ page{
 				font-weight: 600;
 				margin-bottom: 17rpx;
 			}
-			.time{
-				text-align: left;
+			// .time{
+			// 	text-align: left;
+			// 	color: #999;
+			// 	font-size: 24rpx;
+			// }
+			.info{
 				color: #999;
 				font-size: 24rpx;
 			}

+ 4 - 1
xushuo/dynamic.vue

@@ -26,7 +26,10 @@
 							<view class="til ellipsis-2">
 								{{item.title}}
 							</view>
-							<view class="time">2023-08-24</view>
+							<view class="info u-flex u-row-between">
+								<view class="view-count">浏览量:{{item.viewCount}}</view>
+								<view class="time">{{item.publicTime}}</view>
+							</view>
 						</view>
 					</view>
 				</view>

+ 2 - 2
xushuo/dynamicdetails.vue

@@ -11,14 +11,14 @@
 			<view class="base-info" v-if="type=='swiperDetail'">
 				<view class="title">{{swiperDetails.name}}</view>
 				<view class="info u-flex u-row-between">
-					<view class="time">{{swiperDetails.createTime}}</view>
+					<view class="time">{{swiperDetails.publicTime}}</view>
 					<!-- <view class="view-count">{{swiperDetails.viewCount}}</view> -->
 				</view>
 			</view>
 			<view v-else class="base-info">
 				<view class="title">{{pageData.title}}</view>
 				<view class="info u-flex u-row-between">
-					<view class="time">{{pageData.createTime}}</view>
+					<view class="time">{{pageData.publicTime}}</view>
 					<view class="view-count">浏览量:{{pageData.viewCount}}</view>
 				</view>
 			</view>

+ 5 - 1
xushuo/xushuo.vue

@@ -72,7 +72,11 @@
 						<view class="til ellipsis-2">
 							{{item.title}}
 						</view>
-						<view class="time">{{item.createTime}}</view>
+						<view class="info u-flex u-row-between">
+							<view class="view-count">浏览量:{{item.viewCount}}</view>
+							<view class="time">{{item.publicTime}}</view>
+						</view>
+						<!-- <view class="time">{{item.createTime}}</view> -->
 					</view>
 				</view>
 			</view>