Browse Source

Merge branch 'master' of https://git.dayouqiantu.cn/develop/yshop-uniapp into master

master
朱耘稷 4 years ago
parent
commit
ae094ad6ff
  1. 8
      api/public.js
  2. 46
      components/Adv.vue
  3. 10
      components/CouponPop.vue
  4. 3
      config/index.js
  5. 19
      package-lock.json
  6. 2
      package.json
  7. 859
      pages/home/index.vue

8
api/public.js

@ -8,6 +8,14 @@ export function getHomeData() {
return request.get("index", {}, { login: false }); return request.get("index", {}, { login: false });
} }
/**
* 首页
* @returns {*}
*/
export function getCanvas() {
return request.get("/getCanvas?terminal=3", {}, { login: false });
}
/** /**
* 文章 轮播列表 * 文章 轮播列表
* @returns {*} * @returns {*}

46
components/Adv.vue

@ -2,55 +2,55 @@
<view class="adv-box mx20 mb10"> <view class="adv-box mx20 mb10">
<!-- 模板1--> <!-- 模板1-->
<view class="x-f" v-if="detail.style == 1"> <view class="x-f" v-if="detail.style == 1">
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
</view> </view>
<!-- 模板2--> <!-- 模板2-->
<view class="type1 x-f" v-if="detail.style == 2"> <view class="type1 x-f" v-if="detail.style == 2">
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image class="type1-img" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> <image class="type1-img" @tap="jump(detail.list[1].uniapp_url)" :src="detail.list[1].image" mode="aspectFill"></image>
</view> </view>
<!-- 模板3--> <!-- 模板3-->
<view class="type2 x-bc" v-if="detail.style == 3"> <view class="type2 x-bc" v-if="detail.style == 3">
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image class="type2-img1" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
<view class="y-f type2-box"> <view class="y-f type2-box">
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image> <image class="type2-img2" @tap="jump(detail.list[1].uniapp_url)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image>
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> <image class="type2-img2" @tap="jump(detail.list[2].uniapp_url)" :src="detail.list[2].image" mode="aspectFill"></image>
</view> </view>
</view> </view>
<!-- 模板4--> <!-- 模板4-->
<view class="type3 x-bc" v-if="detail.style == 4"> <view class="type3 x-bc" v-if="detail.style == 4">
<view class="type3-box y-f"> <view class="type3-box y-f">
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image class="type3-img1" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> <image class="type3-img1" @tap="jump(detail.list[1].uniapp_url)" :src="detail.list[1].image" mode="aspectFill"></image>
</view> </view>
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> <image class="type3-img2" @tap="jump(detail.list[2].uniapp_url)" :src="detail.list[2].image" mode="aspectFill"></image>
</view> </view>
<!-- 模板5--> <!-- 模板5-->
<view class="type4 y-f" v-if="detail.style == 5"> <view class="type4 y-f" v-if="detail.style == 5">
<view class="type4-box x-f"> <view class="type4-box x-f">
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image class="type4-img1" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> <image class="type4-img1" @tap="jump(detail.list[1].uniapp_url)" :src="detail.list[1].image" mode="aspectFill"></image>
</view> </view>
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> <image class="type4-img2" @tap="jump(detail.list[2].uniapp_url)" :src="detail.list[2].image" mode="aspectFill"></image>
</view> </view>
<!-- 模板6--> <!-- 模板6-->
<view class="type5 y-f" v-if="detail.style == 6"> <view class="type5 y-f" v-if="detail.style == 6">
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image class="type5-img1" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
<view class="type5-box x-bc"> <view class="type5-box x-bc">
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image> <image class="type5-img2" @tap="jump(detail.list[1].uniapp_url)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image>
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> <image class="type5-img2" @tap="jump(detail.list[2].uniapp_url)" :src="detail.list[2].image" mode="aspectFill"></image>
</view> </view>
</view> </view>
<!-- 模板7--> <!-- 模板7-->
<view class="type6 y-f" v-if="detail.style == 7"> <view class="type6 y-f" v-if="detail.style == 7">
<view class="x-f type6-box1"> <view class="x-f type6-box1">
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> <image class="type6-img1" @tap="jump(detail.list[0].uniapp_url)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> <image class="type6-img1" @tap="jump(detail.list[1].uniapp_url)" :src="detail.list[1].image" mode="aspectFill"></image>
</view> </view>
<view class="x-f type6-box2"> <view class="x-f type6-box2">
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> <image class="type6-img2" @tap="jump(detail.list[2].uniapp_url)" :src="detail.list[2].image" mode="aspectFill"></image>
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image" mode="aspectFill"></image> <image class="type6-img2" @tap="jump(detail.list[3].uniapp_url)" :src="detail.list[3].image" mode="aspectFill"></image>
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image" mode="aspectFill"></image> <image class="type6-img2" @tap="jump(detail.list[4].uniapp_url)" :src="detail.list[4].image" mode="aspectFill"></image>
</view> </view>
</view> </view>
</view> </view>
@ -63,14 +63,16 @@ export default {
return {}; return {};
}, },
props: { props: {
detail: {} detail: Object
}, },
computed: {}, computed: {},
created() {}, created() {},
methods: { methods: {
// //
jump(path) { jump(path) {
this.$tools.routerTo(path); if (item.uniapp_url) {
this.$yrouter.push(path)
}
} }
} }
}; };

10
components/CouponPop.vue

@ -14,17 +14,17 @@
> >
<view class="money"> <view class="money">
<text class="num">{{ item.coupon_price }}</text> <text class="num">{{ item.couponPrice }}</text>
</view> </view>
<view class="text"> <view class="text">
<view class="condition line1">购物满{{ item.use_min_price }}元可用</view> <view class="condition line1">购物满{{ item.useMinPrice }}元可用</view>
<view class="data acea-row row-between-wrapper"> <view class="data acea-row row-between-wrapper">
<view v-if="item.end_time === 0">不限时</view> <view v-if="item.end_time === 0">不限时</view>
<view v-else>{{ item.start_time }}-{{ item.end_time }}</view> <view v-else>{{ item.startTime }}-{{ item.endTime }}</view>
<view <view
class="bnt acea-row row-center-wrapper" class="bnt acea-row row-center-wrapper"
:class="!item.is_use ? 'bg-color-red' : 'gray'" :class="!item.isUse ? 'bg-color-red' : 'gray'"
>{{ !item.is_use ? "立即领取" : "已领取" }}</view> >{{ !item.isUse ? "立即领取" : "已领取" }}</view>
</view> </view>
</view> </view>
</view> </view>

3
config/index.js

@ -2,7 +2,8 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'; // export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api';
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'; // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api';
export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api'; export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';

19
package-lock.json generated

@ -287,6 +287,11 @@
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz", "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz",
"integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=" "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk="
}, },
"mutation-observer": {
"version": "1.0.3",
"resolved": "http://192.168.1.56:8081/repository/npm-public/mutation-observer/-/mutation-observer-1.0.3.tgz",
"integrity": "sha1-QukiKxAbyoLlup1aes9KFMDyY9A="
},
"normalize-url": { "normalize-url": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npm.taobao.org/normalize-url/download/normalize-url-4.5.0.tgz?cache=0&sync_timestamp=1596373090568&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-url%2Fdownload%2Fnormalize-url-4.5.0.tgz", "resolved": "https://registry.npm.taobao.org/normalize-url/download/normalize-url-4.5.0.tgz?cache=0&sync_timestamp=1596373090568&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-url%2Fdownload%2Fnormalize-url-4.5.0.tgz",
@ -399,6 +404,11 @@
"resolved": "https://registry.npm.taobao.org/to-readable-stream/download/to-readable-stream-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/to-readable-stream/download/to-readable-stream-1.0.0.tgz",
"integrity": "sha1-zgqgwvPfat+FLvtASng+d8BHV3E=" "integrity": "sha1-zgqgwvPfat+FLvtASng+d8BHV3E="
}, },
"transitionEnd": {
"version": "1.0.2",
"resolved": "http://192.168.1.56:8081/repository/npm-public/transitionEnd/-/transitionEnd-1.0.2.tgz",
"integrity": "sha1-GRTbW0Wn79w0oBr2koWjppOHFjM="
},
"url-parse-lax": { "url-parse-lax": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/url-parse-lax/download/url-parse-lax-3.0.0.tgz", "resolved": "https://registry.npm.taobao.org/url-parse-lax/download/url-parse-lax-3.0.0.tgz",
@ -407,6 +417,15 @@
"prepend-http": "^2.0.0" "prepend-http": "^2.0.0"
} }
}, },
"vconsole": {
"version": "3.4.0",
"resolved": "http://192.168.1.56:8081/repository/npm-public/vconsole/-/vconsole-3.4.0.tgz",
"integrity": "sha1-LPL/qobNerc2mXoitj0FYnxqtWc=",
"requires": {
"mutation-observer": "^1.0.3",
"transitionEnd": "^1.0.2"
}
},
"vue": { "vue": {
"version": "2.6.12", "version": "2.6.12",
"resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.12.tgz", "resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.12.tgz",

2
package.json

@ -16,7 +16,7 @@
"jweixin-module": "^1.6.0", "jweixin-module": "^1.6.0",
"miniapp-color-thief": "^1.0.5", "miniapp-color-thief": "^1.0.5",
"vue-ydui": "^1.2.6", "vue-ydui": "^1.2.6",
"vconsole": "^3.3.4", "vconsole": "^3.3.4",
"wechat-jssdk": "^5.0.4" "wechat-jssdk": "^5.0.4"
}, },
"devDependencies": { "devDependencies": {

859
pages/home/index.vue

@ -1,470 +1,447 @@
<template> <template>
<view class="index"> <view class="index">
<!-- 导航栏 --> <view v-for="(item,index) in homeData" :key="index">
<!-- <view class="head_box " :style="{ background: bgcolor }" :class="{ active: bgcolor }">--> <view class="head_box" v-if="item.type=='header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }">
<!-- <view class="cu-custom" :style="[{height:CustomBar+ 'px',}]">--> <cu-custom :isBack="true" :bgColor="bgcolor">
<!-- <view class="cu-bar fixed" :style="customStyle" :class="[bgcolor]">--> <block slot="backText">
<!-- <view class="action">--> <text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text>
<!-- <text class="nav-title Shop-selector-rect">{{ 'yshop商城' }}</text>--> </block>
<!-- </view>--> </cu-custom>
<!-- <view class="content" :style="[{top:StatusBar + 'px'}]">--> </view>
<view class="header header-search acea-row row-center-wrapper" v-if="item.type=='search'" :style="{ background: bgcolor }">
<!-- </view>--> <view @click="goGoodSearch()" class="search acea-row row-middle">
<!-- </view>--> <text class="iconfont icon-xiazai5"></text>
<!-- </view>--> 搜索商品
<!-- </view>--> </view>
<view class="qr" @click="startQr()">
<view <image src="@/static/images/qr.png" />
class="head_box" </view>
:style="{ background: bgcolor }" </view>
:class="{ active: bgcolor }" <Banner v-if="item.type=='banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner>
> <uni-notice-bar v-if="item.type=='noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10"
<cu-custom :isBack="true" :bgColor="bgcolor"> showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar>
<block slot="backText"> <view class="content_box home_content_box">
<text class="nav-title shopro-selector-rect">{{ "YSHOP商城" }}</text> <!-- 菜单 -->
</block> <Menu :list="item.componentContent.menus" v-if="item.type=='menu'"></Menu>
</cu-custom> <!-- 滚动新闻 -->
</view> <!-- 广告 -->
<view <Adv v-if="item.type=='adv'" :detail="item.componentContent.detail" />
class="header header-search acea-row row-center-wrapper" <!-- 热门榜单 -->
:style="{ background: bgcolor }" <HotCommodity v-if="item.type=='hotCommodity'" :detail="likeInfo"></HotCommodity>
> <!-- 超值拼团 -->
<view @click="goGoodSearch()" class="search acea-row row-middle"> <Groupon v-if="item.type=='groupon'" :detail="combinationList" />
<text class="iconfont icon-xiazai5"></text> <!-- 首发新品->秒杀 -->
搜索商品 <FirstNewProduct v-if="item.type=='firstNewProduct'" :detail="firstList"></FirstNewProduct>
</view> <!-- 精品推荐 -->
<view class="qr" @click="startQr()"> <ProductsRecommended v-if="item.type=='productsRecommended'" :detail="bastList"></ProductsRecommended>
<image src="@/static/images/qr.png" /> <!-- 促销单品 -->
</view> <PromoteProduct v-if="item.type=='promoteProduct'" :detail="benefit"></PromoteProduct>
</view> <!-- 直播 -->
<Banner <!-- #ifdef MP-WEIXIN -->
:detail="banner" <Live v-if="item.type=='live'" :detail="live"></Live>
v-if="banner.length > 0" <!-- #endif -->
@getbgcolor="getbgcolor" <!-- 为您推荐 -->
></Banner> <PromotionGood v-if="item.type=='promotionGood'" :benefit="benefit"></PromotionGood>
<uni-notice-bar </view>
scrollable="true" <Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose">
@click="goRoll(singNew)" </Coupon-window>
single="true" </view>
:speed="10" </view>
showIcon="true"
:text="singNew.info"
></uni-notice-bar>
<view class="content_box home_content_box">
<!-- 菜单 -->
<Menu :list="menus"></Menu>
<!-- 滚动新闻 -->
<!-- 广告 -->
<Adv />
<!-- 热门榜单 -->
<HotCommodity :detail="likeInfo"></HotCommodity>
<!-- 超值拼团 -->
<Groupon :detail="combinationList" />
<!-- 首发新品->秒杀 -->
<!-- <FirstNewProduct :detail="firstList"></FirstNewProduct> -->
<!-- 精品推荐 -->
<!-- <ProductsRecommended :detail="bastList"></ProductsRecommended> -->
<!-- 促销单品
<PromoteProduct :detail="benefit"></PromoteProduct> -->
<!-- 直播 -->
<!-- #ifdef MP-WEIXIN -->
<Live :detail="live"></Live>
<!-- #endif -->
<!-- 为您推荐 -->
<PromotionGood :benefit="benefit"></PromotionGood>
</view>
<Coupon-window
:coupon-list="couponList"
v-if="showCoupon"
@checked="couponClose"
@close="couponClose"
>
</Coupon-window>
</view>
</template> </template>
<script> <script>
import { mapState, mapMutations, mapActions } from "vuex"; import {
import GoodList from "@/components/GoodList"; mapState,
import PromotionGood from "@/components/PromotionGood"; mapMutations,
import CouponWindow from "@/components/CouponWindow"; mapActions
import Menu from "@/components/Menu"; } from "vuex";
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar"; import GoodList from "@/components/GoodList";
import Adv from "@/components/sh-adv"; import PromotionGood from "@/components/PromotionGood";
import Groupon from "@/components/sh-groupon.vue"; import CouponWindow from "@/components/CouponWindow";
import Menu from "@/components/Menu";
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar";
import Adv from "@/components/sh-adv";
import Groupon from "@/components/sh-groupon.vue";
import Banner from "./components/Banner"; import Banner from "./components/Banner";
import HotCommodity from "./components/HotCommodity"; import HotCommodity from "./components/HotCommodity";
import FirstNewProduct from "./components/FirstNewProduct"; import FirstNewProduct from "./components/FirstNewProduct";
import ProductsRecommended from "./components/ProductsRecommended"; import ProductsRecommended from "./components/ProductsRecommended";
import Live from "./components/Live"; import Live from "./components/Live";
import { getHomeData, getShare } from "@/api/public"; import {
import cookie from "@/utils/store/cookie"; getHomeData,
import { isWeixin, handleUrlParam } from "@/utils/index"; getShare,
getCanvas
} from "@/api/public";
import cookie from "@/utils/store/cookie";
import {
isWeixin,
handleUrlParam
} from "@/utils/index";
import { import {
openShareAll, openShareAll,
} from '@/libs/wechat' } from '@/libs/wechat'
const HAS_COUPON_WINDOW = "has_coupon_window"; const HAS_COUPON_WINDOW = "has_coupon_window";
export default { export default {
name: "Index", name: "Index",
components: { components: {
// swiper, // swiper,
// swiperSlide, // swiperSlide,
UniNoticeBar, UniNoticeBar,
GoodList, GoodList,
PromotionGood, PromotionGood,
CouponWindow, CouponWindow,
Menu, Menu,
Adv, Adv,
Groupon, Groupon,
Banner, Banner,
HotCommodity, HotCommodity,
FirstNewProduct, FirstNewProduct,
ProductsRecommended, ProductsRecommended,
Live, Live,
}, },
props: {}, props: {},
data: function () { data: function() {
return { return {
CustomBar: this.CustomBar, homeData: [],
StatusBar: this.StatusBar, CustomBar: this.CustomBar,
formatMenus: [], StatusBar: this.StatusBar,
categoryCurrent: 0, formatMenus: [],
menuNum: 4, categoryCurrent: 0,
bgcolor: "", menuNum: 4,
bgColor: "", bgcolor: "",
swiperCurrent: 0, // bgColor: "",
webviewId: 0, swiperCurrent: 0, //
showCoupon: false, webviewId: 0,
logoUrl: "", showCoupon: false,
banner: [], logoUrl: "",
menus: [], banner: [],
combinationList: [], menus: [],
roll: [], combinationList: [],
activity: [], roll: [],
activityOne: {}, activity: [],
bastList: [], activityOne: {},
firstList: [], bastList: [],
info: { firstList: [],
fastList: [], info: {
bastBanner: [], fastList: [],
bastBanner: [],
bastList: [], bastList: [],
}, },
likeInfo: [], likeInfo: [],
live: [], live: [],
lovely: [], lovely: [],
benefit: [], benefit: [],
couponList: [], couponList: [],
swiperOption: { swiperOption: {
pagination: { pagination: {
el: ".swiper-pagination", el: ".swiper-pagination",
clickable: true, clickable: true,
}, },
autoplay: { autoplay: {
disableOnInteraction: false, disableOnInteraction: false,
delay: 2000, delay: 2000,
}, },
loop: true, loop: true,
speed: 1000, speed: 1000,
observer: true, observer: true,
observeParents: true, observeParents: true,
}, },
swiperRoll: { swiperRoll: {
direction: "vertical", direction: "vertical",
autoplay: { autoplay: {
disableOnInteraction: false, disableOnInteraction: false,
delay: 2000, delay: 2000,
}, },
loop: true, loop: true,
speed: 1000, speed: 1000,
observer: true, observer: true,
observeParents: true, observeParents: true,
}, },
swiperScroll: { swiperScroll: {
freeMode: true, freeMode: true,
freeModeMomentum: false, freeModeMomentum: false,
slidesPerView: "auto", slidesPerView: "auto",
observer: true, observer: true,
observeParents: true, observeParents: true,
}, },
swiperBoutique: { swiperBoutique: {
pagination: { pagination: {
el: ".swiper-pagination", el: ".swiper-pagination",
clickable: true, clickable: true,
}, },
autoplay: { autoplay: {
disableOnInteraction: false, disableOnInteraction: false,
delay: 2000, delay: 2000,
}, },
loop: true, loop: true,
speed: 1000, speed: 1000,
observer: true, observer: true,
observeParents: true, observeParents: true,
}, },
swiperProducts: { swiperProducts: {
freeMode: true, freeMode: true,
freeModeMomentum: false, freeModeMomentum: false,
slidesPerView: "auto", slidesPerView: "auto",
observer: true, observer: true,
observeParents: true, observeParents: true,
}, },
bgImage: "", bgImage: "",
}; };
}, },
computed: { computed: {
singNew() { singNew() {
return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!"; return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!";
}, },
customStyle() { customStyle() {
var bgImage = this.bgImage; var bgImage = this.bgImage;
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`; // var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`;
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`; var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`;
if (this.bgImage) { if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`; style = `${style}background-image:url(${bgImage});`;
} }
return style; return style;
}, },
}, },
onLoad: function () { onLoad: function() {
this.getLocation(); this.getLocation();
let that = this; let that = this;
uni.showLoading({ // uni.showLoading({
title: "加载中", // title: "",
}); // });
getHomeData().then((res) => { getCanvas().then(res => {
that.logoUrl = res.data.logoUrl; }).catch(error => {
res.data.banner.map((item) => (item.bgcolor = item.color || "")); this.homeData = JSON.parse(error.data.json)
that.$set(that, "banner", res.data.banner); })
that.$set(that, "menus", res.data.menus); getHomeData().then((res) => {
that.$set(that, "roll", res.data.roll); that.logoUrl = res.data.logoUrl;
that.$set(that, "info", res.data.info); res.data.banner.map((item) => (item.bgcolor = item.color || ""));
that.$set(that, "firstList", res.data.firstList); that.$set(that, "info", res.data.info);
that.$set(that, "bastList", res.data.bastList); that.$set(that, "firstList", res.data.firstList);
that.$set(that, "likeInfo", res.data.likeInfo); that.$set(that, "bastList", res.data.bastList);
that.$set(that, "live", res.data.liveList); that.$set(that, "likeInfo", res.data.likeInfo);
that.$set(that, "lovely", res.data.lovely); that.$set(that, "live", res.data.liveList);
that.$set(that, "benefit", res.data.benefit); that.$set(that, "lovely", res.data.lovely);
that.$set(that, "couponList", res.data.couponList); that.$set(that, "benefit", res.data.benefit);
that.$set(that, "combinationList", res.data.combinationList); that.$set(that, "couponList", res.data.couponList);
uni.hideLoading(); that.$set(that, "combinationList", res.data.combinationList);
that.setOpenShare(); uni.hideLoading();
// that.doColorThief() that.setOpenShare();
}); // that.doColorThief()
}, });
methods: { },
...mapActions(["getLocation"]), methods: {
onShareTimeline: function () { ...mapActions(["getLocation"]),
return { onShareTimeline: function() {
title: this.miniHomeRemark, return {
imageUrl: this.miniHomeImg, title: this.miniHomeRemark,
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), imageUrl: this.miniHomeImg,
}; path: "pages/home/index?spread=" + uni.getStorageSync("uid"),
}, };
onShareAppMessage: function () { },
return { onShareAppMessage: function() {
title: this.miniHomeRemark, return {
imageUrl: this.miniHomeImg, title: this.miniHomeRemark,
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), imageUrl: this.miniHomeImg,
}; path: "pages/home/index?spread=" + uni.getStorageSync("uid"),
}, };
goRoll(item) { },
if (item.uniapp_url) { goRoll(item) {
this.$yrouter.push(item.uniapp_url); if (item.uniapp_url) {
} this.$yrouter.push(item.uniapp_url);
}, }
goGoodSearch() { },
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index'); goGoodSearch() {
this.$yrouter.push("/pages/shop/GoodSearch/index"); // this.$yrouter.push('/pages/shop/GoodsEvaluate/index');
}, this.$yrouter.push("/pages/shop/GoodSearch/index");
goWxappUrl(item) { },
this.$yrouter.push(item.uniapp_url); goWxappUrl(item) {
}, this.$yrouter.push(item.uniapp_url);
goHotNewGoods(type) { },
this.$yrouter.push({ goHotNewGoods(type) {
path: "/pages/shop/HotNewGoods/index", this.$yrouter.push({
query: { path: "/pages/shop/HotNewGoods/index",
type, query: {
}, type,
}); },
}, });
goGoodsCon(item) { },
this.$yrouter.push({ goGoodsCon(item) {
path: "/pages/shop/GoodsCon/index", this.$yrouter.push({
query: { path: "/pages/shop/GoodsCon/index",
id: item.id, query: {
}, id: item.id,
}); },
}, });
goGoodsPromotion() { },
this.$yrouter.push("/pages/shop/GoodsPromotion/index"); goGoodsPromotion() {
}, this.$yrouter.push("/pages/shop/GoodsPromotion/index");
setOpenShare: function () { },
if (this.$deviceType == "weixin") { setOpenShare: function() {
getShare().then((res) => { if (this.$deviceType == "weixin") {
var data = res.data.data; getShare().then((res) => {
var configAppMessage = { var data = res.data.data;
desc: data.synopsis, var configAppMessage = {
title: data.title, desc: data.synopsis,
link: location.href, title: data.title,
imgUrl: data.img, link: location.href,
}; imgUrl: data.img,
openShareAll(configAppMessage); };
}); openShareAll(configAppMessage);
} });
}, }
startQr: function () { },
uni.scanCode({ startQr: function() {
success: (res) => { uni.scanCode({
let option = handleUrlParam(res.result); success: (res) => {
switch (option.pageType) { let option = handleUrlParam(res.result);
case "good": switch (option.pageType) {
// case "good":
this.$yrouter.push({ //
path: "/pages/shop/GoodsCon/index", this.$yrouter.push({
query: { path: "/pages/shop/GoodsCon/index",
q: res.result, query: {
}, q: res.result,
}); },
break; });
case "group": break;
// case "group":
this.$yrouter.push({ //
path: "/pages/activity/GroupRule/index", this.$yrouter.push({
query: { path: "/pages/activity/GroupRule/index",
q: res.result, query: {
}, q: res.result,
}); },
break; });
case "dargain": break;
// case "dargain":
this.$yrouter.push({ //
path: "/pages/activity/DargainDetails/index", this.$yrouter.push({
query: { path: "/pages/activity/DargainDetails/index",
q: res.result, query: {
}, q: res.result,
}); },
break; });
default: break;
// default:
this.$yrouter.push({ //
path: "/pages/Loading/index", this.$yrouter.push({
query: {}, path: "/pages/Loading/index",
}); query: {},
break; });
} break;
}, }
}); },
}, });
getbgcolor(e) { },
this.bgcolor = e; getbgcolor(e) {
}, this.bgcolor = e;
}, },
created: async function () { },
// await this.doColorThief(); created: async function() {
}, // await this.doColorThief();
}; },
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.content_box { .content_box {
background: #f6f6f6; background: #f6f6f6;
} }
.index { .index {
background-color: #fff; background-color: #fff;
} }
.swiper-item { .swiper-item {
height: 100%; height: 100%;
} }
.fixed-header { .fixed-header {
position: fixed; position: fixed;
z-index: 99; z-index: 99;
// #ifdef H5 // #ifdef H5
top: 88rpx; top: 88rpx;
// #endif // #endif
// #ifndef H5 // #ifndef H5
top: 0; top: 0;
// #endif // #endif
left: 0; left: 0;
right: 0; right: 0;
background: #fff; background: #fff;
box-shadow: 0 0 20rpx -10rpx #aaa; box-shadow: 0 0 20rpx -10rpx #aaa;
& + .fixed-header-box { &+.fixed-header-box {
height: 98rpx; height: 98rpx;
} }
} }
.head_box { .head_box {
width: 750rpx; width: 750rpx;
// background: #fff; // background: #fff;
transition: all linear 0.3s; transition: all linear 0.3s;
/deep/.cuIcon-back { /deep/.cuIcon-back {
display: none; display: none;
} }
.nav-title { .nav-title {
font-size: 38rpx; font-size: 38rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #fff; color: #fff;
} }
} }
.cu-bar.fixed { .cu-bar.fixed {
position: fixed; position: fixed;
width: 100%; width: 100%;
top: 0; top: 0;
z-index: 1024; z-index: 1024;
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); // box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1);
} }
.cu-bar { .cu-bar {
box-sizing: border-box; box-sizing: border-box;
.index .header { .index .header {
height: 64rpx; height: 64rpx;
// width: 100%; // width: 100%;
// padding: 0 30rpx; // padding: 0 30rpx;
// box-sizing: border-box; // box-sizing: border-box;
} }
} }
.header-search { .header-search {
transition: all linear 0.3s; transition: all linear 0.3s;
} }
.cu-bar .action { .cu-bar .action {
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
max-height: 100%; max-height: 100%;
&:first-child { &:first-child {
margin-left: 15px; margin-left: 15px;
font-size: 15px; font-size: 15px;
} }
} }
.home_content_box { .home_content_box {
margin-top: -10rpx; margin-top: -10rpx;
} }
.head_box { .head_box {}
}
.nav-title { .nav-title {
margin-left: 20rpx; margin-left: 20rpx;
line-height: 40px; line-height: 40px;
} }
</style> </style>

Loading…
Cancel
Save