优化代码

This commit is contained in:
wuxw 2022-10-28 03:35:14 +08:00
parent 90a681ae09
commit 3cdff83c6f
7 changed files with 398 additions and 5 deletions

View File

@ -196,3 +196,54 @@ export function loadAdverts(dataObj) {
});
})
}
/**
* 查询小区广告
*/
export function listMarketPicByCommunity(dataObj) {
return new Promise(
(resolve, reject) => {
requestNoAuth({
url: url.listMarketPicByCommunity,
method: "GET",
data: dataObj,
//动态数据
success: function(res) {
if (res.statusCode == 200) {
resolve(res.data);
return;
}
reject();
},
fail: function(e) {
reject();
}
});
})
}
/**
* 查询小区广告
*/
export function listCommunityMarketGoods(dataObj) {
return new Promise(
(resolve, reject) => {
requestNoAuth({
url: url.listCommunityMarketGoods,
method: "GET",
data: dataObj,
//动态数据
success: function(res) {
if (res.statusCode == 200) {
resolve(res.data);
return;
}
reject();
},
fail: function(e) {
reject();
}
});
})
}

View File

@ -0,0 +1,66 @@
<template>
<view>
<view class="home_swiper" v-if="ad && ad.length>0">
<text class="text-gray padding-xs">更多精彩</text>
<swiper class="ad-swiper margin-top-xs bg-white" indicator-dots="true" indicator-color="rgba(228,228,228,1)"
indicator-active-color="#FECA49" autoplay="true" interval="5000" duration="1000" circular="true">
<block v-for="(item, index) in ad" :key="index" @click="_advertJump(item)">
<swiper-item>
<image style="height:100%;width: 100%" :src="item.picUrl"></image>
</swiper-item>
</block>
</swiper>
</view>
</view>
</template>
<script>
import {
listMarketPicByCommunity
} from '../../api/index/indexApi.js';
import {getCommunityId} from '@/api/community/communityApi.js'
export default {
name: "successAds",
data() {
return {
ad: [],
};
},
props:{
objType: {
type: String,
default: '3003',
},
},
created() {
this._loadAdvertPhoto();
},
methods: {
_loadAdvertPhoto: function() {
let _that = this;
let _objData = {
objType: this.objType,
communityId: getCommunityId(),
};
// 广
listMarketPicByCommunity(_objData)
.then(function(_aPhotos) {
_that.ad = _aPhotos.data;
});
},
_advertJump: function(ad) {
//
let url = encodeURIComponent(ad.picLink)
uni.navigateTo({
url: '/pages/hcWebView/hcWebView?url=' + url
})
},
}
}
</script>
<style>
.home_swiper {
margin-bottom: 20upx;
}
</style>

View File

@ -0,0 +1,187 @@
<template>
<view>
<view class="home_swiper" v-if="goodsList && goodsList.length>0">
<text class="text-gray padding-xs">为您推荐</text>
<view class="goods-list">
<view class="list" v-for="(item,index) in goodsList" @click="_advertJump(item)" :key="index">
<view class="pictrue">
<image :src="item.picUrl" mode="heightFix"></image>
</view>
<view class="title-tag">
<view class="tag">
{{item.prodName}}
</view>
</view>
<view class="price-info">
<view class="user-price">
<text class="min"></text>
<text class="max">{{item.price}}</text>
</view>
<!-- <view class="vip-price">
<image src="/static/vip_ico.png"></image>
<text>{{item.defaultSpecValue.vipPrice}}</text>
</view> -->
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
listCommunityMarketGoods
} from '../../api/index/indexApi.js';
import {getCommunityId} from '@/api/community/communityApi.js'
export default {
name: "successGoods",
data() {
return {
goodsList: [],
};
},
props:{
objType: {
type: String,
default: '3003',
},
},
created() {
this._loadAdvertGoods();
},
methods: {
_loadAdvertGoods: function() {
let _that = this;
let _objData = {
objType: this.objType,
communityId: getCommunityId(),
};
// 广
listCommunityMarketGoods(_objData)
.then(function(_aPhotos) {
_that.goodsList = _aPhotos.data;
});
},
_advertJump: function(ad) {
//
let url = encodeURIComponent(ad.picLink)
uni.navigateTo({
url: '/pages/hcWebView/hcWebView?url=' + url
})
},
}
}
</script>
<style lang="scss">
.home_swiper {
margin-bottom: 20upx;
}
.goods-list{
display: flex;
width: 100%;
height: 220rpx;
.list{
width: 50%;
height: 100%;
.pictrue{
width: 100%;
height: 70%;
image{
width: 150rpx;
height: 150rpx;
}
}
.price{
display: flex;
align-items: center;
width: 100%;
height: 30%;
.selling-price{
font-size: 28rpx;
font-weight: bold;
color: red;
}
.original-price{
font-size: 24rpx;
text-decoration: line-through;
color: #bbbaba;
margin-left: 10rpx;
}
}
}
}
.good-choice{
width: 50%;
height: 100%;
.goods-title{
display: flex;
align-items: center;
padding: 0 20rpx;
height: 80rpx;
.title{
display: flex;
align-items: center;
text{
font-size: 28rpx;
color: #4c4b4b;
}
}
.describe{
display: flex;
align-items: center;
margin-left: 10rpx;
text{
font-size: 24rpx;
color: #979696;
}
.num{
display: flex;
align-items: center;
justify-content: center;
margin: 0 6rpx;
width: 30rpx;
height: 30rpx;
background-color: red;
color: #FFFFFF;
border-radius: 6rpx;
}
}
}
.goods-list{
display: flex;
width: 100%;
height: 220rpx;
.list{
width: 50%;
height: 100%;
.pictrue{
width: 100%;
height: 70%;
image{
width: 150rpx;
height: 150rpx;
}
}
.price{
display: flex;
align-items: center;
width: 100%;
height: 30%;
.selling-price{
font-size: 28rpx;
font-weight: bold;
color: red;
}
.original-price{
font-size: 24rpx;
text-decoration: line-through;
color: #bbbaba;
margin-left: 10rpx;
}
}
}
}
}
</style>

View File

@ -154,9 +154,11 @@ export default {
uploadImage: baseUrl + "callComponent/uploadFile/uploadPhotoImage",
saveParkingCouponCar:baseUrl+"app/parkingCoupon.saveParkingCouponCar",
listParkingCouponCar:baseUrl+"app/parkingCoupon.listParkingCouponCar",
listMarketPicByCommunity:baseUrl+"app/marketPic.listCommunityMarketPic",
listCommunityMarketGoods:baseUrl+"app/marketGoods.listCommunityMarketGoods",
NEED_NOT_LOGIN_PAGE: [

View File

@ -76,12 +76,12 @@
"disableHostCheck" : true,
"proxy" : {
"/app" : {
"target" : "http://demo.homecommunity.cn/", //
"target" : "http://192.168.100.108:8088/", //
"changeOrigin" : true, //
"secure" : true // https
},
"/callComponent" : {
"target" : "http://demo.homecommunity.cn/", //
"target" : "http://192.168.100.108:8088/", //
"changeOrigin" : true, //
"secure" : true // https
}

View File

@ -3,8 +3,7 @@
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "业主版",
"backgroundColor": "#ffffff"
"backgroundColor": "#ffffff"
}
},
{
@ -580,6 +579,14 @@
"navigationBarTitleText": "领取优惠券",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/successPage/successPage",
"style" :
{
"navigationBarTitleText": "处理成功",
"enablePullDownRefresh": false
}
}
],

View File

@ -0,0 +1,80 @@
<template>
<view>
<view class="bg-white success-msg">
<view class=" ">
<view class=" padding flex align-center">
<view class="flex-sub text-center">
<view class="text-xsl">
<text class="cuIcon-roundcheckfill text-green"></text>
</view>
<view class=" text-msg">{{msg}}</view>
</view>
</view>
</view>
<view class="padding flex flex-direction margin-top">
<button class="cu-btn bg-green lg" @click="_indexPage()">返回首页</button>
</view>
</view>
<view class="home_wrap">
<success-ads :objType="objType"></success-ads>
</view>
<view class="home_wrap">
<success-goods :objType="objType"></success-goods>
</view>
</view>
</template>
<script>
import successAds from '@/components/success/success-ads.vue';
import successGoods from '@/components/success/success-goods.vue';
export default {
data() {
return {
msg: '处理成功',
objType:'3003',
imgs: [],
goods: []
}
},
onLoad(options) {
this.msg = options.msg;
this.objType = options.objType;
},
components: {
successAds,
successGoods
},
methods: {
_indexPage:function(){
uni.switchTab({
url: "/pages/index/index?wAppId=" + this.vc.getWAppId()
});
}
}
}
</script>
<style>
.success-msg {
padding-top: 100upx;
padding-bottom: 50upx;
}
.text-xsl {
font-size: 180upx;
line-height: 1.2;
}
.text-msg {
font-size: 40upx;
}
.home_wrap {
padding: 20upx 20upx 0;
}
</style>