This commit is contained in:
ghusermoon 2020-07-15 16:21:43 +08:00
parent 1854ffff03
commit cc9fb2b48b
11 changed files with 190 additions and 31 deletions

View File

@ -1,6 +1,14 @@
export default {
init(vm){
return {
// 获取首页轮播
getIndexSwiper() {
return vm.$u.post('adv/indexadv');
},
// 获取首页轮播
getZhiBoSwiper() {
return vm.$u.post('adv/divebroadcastxadv');
},
// 发现列表
getArticlelist({ page, value, store_id, member_id, is_video_img }){
return vm.$u.post('article/articlelist', {
@ -29,6 +37,12 @@ export default {
article_id: article_id,
});
},
// 直播列表
// getZhiboList() {
// return vm.$u.post('article/articleCollect', {
// article_id: article_id,
// });
// },
// 屏蔽用户
articleAddShield({ article_id, member_id }) {
return vm.$u.post('article/articleAddShield', {
@ -129,8 +143,14 @@ export default {
});
},
// 商品详情
// getGoodsDetails({ id }) {
// return vm.$u.post('Goods/goodDetails', {
// goods_id: id
// });
// },
// 商品详情
getGoodsDetails({ id }) {
return vm.$u.post('Goods/goodDetails', {
return vm.$u.post('goods/goodsInfo', {
goods_id: id
});
},
@ -149,7 +169,23 @@ export default {
return vm.$u.post('goods/goodsInfo', {
goods_id: id
});
}
},
// 秒杀推荐
recommendedSpike() {
return vm.$u.post('Spike/recommendedSpike');
},
// 秒杀详情
getSpikeInfo({ id }) {
return vm.$u.post('Spike/spikeInfo', {
groupbuy_id: id
});
},
// 秒杀列表
getSpikeList({ page }) {
return vm.$u.post('spike/spikeList', {
page: page
});
},
}
}

View File

@ -302,6 +302,14 @@ export default {
delMessage({ type }) {
return vm.$u.post('/message/readMessage', { type });
},
// 屏蔽列表
articlShieldList() {
return vm.$u.post('/Article/articlShieldList');
},
// 取消屏蔽
articleDelShield({ id }) {
return vm.$u.post('article/articleDelShield', { member_id: id });
},
}
}
}

41
common/store/index.js Normal file
View File

@ -0,0 +1,41 @@
// 商品相关
const moduleA = {
state: () => ({
count: 0
}),
mutations: {
increment (state) {
// 这里的 `state` 对象是模块的局部状态
state.count++
}
},
getters: {
doubleCount (state) {
return state.count * 2
}
}
}
// 用户相关
const moduleB = {
state: () => ({
count: 0
}),
mutations: {
increment (state) {
// 这里的 `state` 对象是模块的局部状态
state.count++
}
},
getters: {
doubleCount (state) {
return state.count * 2
}
}
}
const store = new Vuex.Store({
modules: {
shop: moduleA,
user: moduleB
}
})

View File

@ -5,25 +5,35 @@
<text>点击查看更多></text>
</view>
<view class="connect">
<view class="time">
<image></image>
<text>12:00</text>
<view class="time" v-if="type=='spike'">
<image src="/static/image/common/15.png"></image>
<text>{{ info.groupbuy_starttime_histime }}</text>
</view>
<view class="info">
<text>修身套头上衣</text>
<text class="u-line-2">珂莱蒂尔雪纺衫2020春装新简约百搭V领蕾丝九分... </text>
<text class="u-line-1">{{ info.groupbuy_name }}</text>
<text class="u-line-2">{{ info.goods_name }}</text>
<view>
<text>99</text>
<text>299</text>
<text>{{ info.groupbuy_price }}</text>
<text>{{ info.goods_price }}</text>
</view>
</view>
<image class="img"></image>
<image class="img" :src="info.groupbuy_image1"></image>
</view>
</view>
</template>
<script>
export default {
name:"recommend"
name:"recommend",
data() {
return {
info: {}
}
},
props: ['recommendData', 'type'],
created() {
this.info = this.recommendData;
console.log(this.recommendData);
}
}
</script>
<style lang="scss" scoped>
@ -48,7 +58,7 @@ export default {
display: flex;
flex-direction: column;
align-items: center;
margin-right: 18rpx;
margin-right: 28rpx;
justify-content: center;
>image{
width: 90rpx;
@ -62,6 +72,7 @@ export default {
flex-shrink: 0;
}
.info{
width: 340rpx;
display: flex;
flex-direction: column;
>text:nth-child(1){
@ -87,6 +98,7 @@ export default {
font-size: 24rpx;
color: #999;
margin-left: 33rpx;
text-decoration: line-through;
}
}
}

View File

@ -1,12 +1,17 @@
import Vue from 'vue'
import App from './App'
import uView from "uview-ui";
// import Vuex from 'vuex'
Vue.config.productionTip = false
Vue.use(uView);
// Vue.use(Vuex);
App.mpType = 'app'
// import store from '@/common/store/index.js'
const app = new Vue({
...App
...App,
// store
})
// http拦截器将此部分放在new Vue()和app.$mount()之间才能App.vue中正常使用
import httpInterceptor from '@/common/http.interceptor.js'

View File

@ -13,6 +13,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"uview-ui": "^1.5.0"
"uview-ui": "^1.5.0"
}
}

View File

@ -67,15 +67,16 @@ export default {
this.id = id;
this.$u.api.getGoodsDetails({ id: id }).then((res)=>{
if (res.errCode == 0) {
this.goodsInfo = res.data;
this.goodsInfo.goods_image_mobile.forEach(item => {
this.goodsInfo = res.data.goods;
let list = [];
res.data.goods_image[0].forEach(item => {
let temp = {
image: item
}
this.list.push(temp);
list.push(temp);
})
this.list = list;
// console.log(this.goodsInfo.mobile_body);
}
})
this.$u.api.goodsInfo({id}).then((res)=>{

View File

@ -1,19 +1,37 @@
<template>
<view class="shield">
<view class="shield-list" v-for="(item, index) in 5" :key="index">
<view class="shield-list" v-for="(item, index) in userList" :key="index">
<view class="infomation">
<u-avatar :src="src" size="80"></u-avatar>
<view class="nickname u-line-1">神的温柔</view>
<u-avatar :src="item.member_avatar" size="80"></u-avatar>
<view class="nickname u-line-1">{{ item.member_nickname }}</view>
</view>
<view class="btn">取消屏蔽</view>
<view class="btn" @click="cancelArticleShield(item.member_id)">取消屏蔽</view>
</view>
<u-empty text="暂无屏蔽用户" mode="list" v-if="!userList.length" margin-top="280" color="#333"></u-empty>
</view>
</template>
<script>
export default {
data() {
return {
src: 'https://dmmall.sdbairui.com/uploads/home/avatar/avatar_19.jpg'
src: 'https://dmmall.sdbairui.com/uploads/home/avatar/avatar_19.jpg',
userList: [],
}
},
onShow() {
this.articlShieldList();
},
methods: {
articlShieldList() {
this.$u.api.articlShieldList().then(res => {
this.userList = res.data;
})
},
//
cancelArticleShield(id) {
this.$u.api.articleDelShield({ id: id }).then(res => {
this.articlShieldList();
})
}
}
};

View File

@ -20,7 +20,8 @@
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
<view class="box">
<indexad style="width:690rpx"></indexad>
<!-- <indexad style="width:690rpx"></indexad> -->
<u-swiper mode="dot" :list="indexImageSwiper" name="adv_code"></u-swiper>
<view class="list">
<view >
<videoItem v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id" :item="item" @getArticlelist="getArticlelist"></videoItem>
@ -35,7 +36,7 @@
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
<view class="box">
<indexad style="width:690rpx"></indexad>
<u-swiper mode="dot" :list="zhiboImageSwiper" name="adv_code"></u-swiper>
<view class="list">
<view >
<zhiboItem v-for="item in 10"></zhiboItem>
@ -185,6 +186,8 @@ export default {
page: 0, // 0
articleList: [],
recommendList: [], //
indexImageSwiper: [],
zhiboImageSwiper: [],
}
},
components:{
@ -196,8 +199,24 @@ export default {
onShow(){
this.getArticlelist();
this.getRecommendList();
this.getSwiper();
this.getZhiBoSwiper();
},
methods:{
getSwiper() {
this.$u.api.getIndexSwiper().then(res => {
if(res.errCode == 0) {
this.indexImageSwiper = res.data;
}
})
},
getZhiBoSwiper() {
this.$u.api.getZhiBoSwiper().then(res => {
if(res.errCode == 0) {
this.zhiboImageSwiper = res.data;
}
})
},
dianji(a){
// console.log(a)
if(typeof a == "object"){

View File

@ -37,12 +37,12 @@
<shopitem v-for="item in goodsClassify" :key="item.gc_id" :info="item" class="item"></shopitem>
</view>
<view class="hr" style="margin-top:80rpx"></view>
<recommend></recommend>
<view class="hr" style="margin-top:40rpx"></view>
<seckill></seckill>
<view class="hr" style="margin-top:40rpx"></view>
<recommend></recommend>
<recommend v-if="JSON.stringify(recommendedSpike) != '{}'" :recommendData="recommendedSpike" type="spike"></recommend>
<view class="hr" style="margin-top:40rpx"></view>
<seckill v-if="spikeList.length"></seckill>
<view v-if="spikeList.length" class="hr" style="margin-top:40rpx"></view>
<!-- <recommend></recommend> -->
<!-- <view class="hr" style="margin-top:40rpx"></view> -->
<group></group>
<image class="lingquan"></image>
<youhq></youhq>
@ -85,13 +85,20 @@ export default {
list:[],
goodsClassify: [], //
classifyList: [],
goodsList: []
goodsList: [],
recommendedSpike: {}, //
spikeList: [], //
}
},
onLoad() {
this.getShopTopList();
this.getGoodsRecommend();
},
onShow() {
// console.log(this.$store.shop.state.count);
this.getRecommendedSpike();
this.getSpikeList();
},
methods: {
sousuo(){
// console.log(123)
@ -115,6 +122,18 @@ export default {
}
})
},
getRecommendedSpike() {
this.$u.api.recommendedSpike().then(res => {
if(res.errCode == 0) this.recommendedSpike = res.data;
console.log(this.recommendedSpike);
})
},
//
getSpikeList() {
this.$u.api.getSpikeList({ page: 0 }).then(res => {
if(res.errCode == 0) this.spikeList = res.data;
})
},
getGoodsRecommend() {
this.$u.api.getGoodsRecommend({
page: 1,

BIN
static/image/common/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB