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 { export default {
init(vm){ init(vm){
return { 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 }){ getArticlelist({ page, value, store_id, member_id, is_video_img }){
return vm.$u.post('article/articlelist', { return vm.$u.post('article/articlelist', {
@ -29,6 +37,12 @@ export default {
article_id: article_id, article_id: article_id,
}); });
}, },
// 直播列表
// getZhiboList() {
// return vm.$u.post('article/articleCollect', {
// article_id: article_id,
// });
// },
// 屏蔽用户 // 屏蔽用户
articleAddShield({ article_id, member_id }) { articleAddShield({ article_id, member_id }) {
return vm.$u.post('article/articleAddShield', { 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 }) { getGoodsDetails({ id }) {
return vm.$u.post('Goods/goodDetails', { return vm.$u.post('goods/goodsInfo', {
goods_id: id goods_id: id
}); });
}, },
@ -149,7 +169,23 @@ export default {
return vm.$u.post('goods/goodsInfo', { return vm.$u.post('goods/goodsInfo', {
goods_id: id 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 }) { delMessage({ type }) {
return vm.$u.post('/message/readMessage', { 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> <text>点击查看更多></text>
</view> </view>
<view class="connect"> <view class="connect">
<view class="time"> <view class="time" v-if="type=='spike'">
<image></image> <image src="/static/image/common/15.png"></image>
<text>12:00</text> <text>{{ info.groupbuy_starttime_histime }}</text>
</view> </view>
<view class="info"> <view class="info">
<text>修身套头上衣</text> <text class="u-line-1">{{ info.groupbuy_name }}</text>
<text class="u-line-2">珂莱蒂尔雪纺衫2020春装新简约百搭V领蕾丝九分... </text> <text class="u-line-2">{{ info.goods_name }}</text>
<view> <view>
<text>99</text> <text>{{ info.groupbuy_price }}</text>
<text>299</text> <text>{{ info.goods_price }}</text>
</view> </view>
</view> </view>
<image class="img"></image> <image class="img" :src="info.groupbuy_image1"></image>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name:"recommend" name:"recommend",
data() {
return {
info: {}
}
},
props: ['recommendData', 'type'],
created() {
this.info = this.recommendData;
console.log(this.recommendData);
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -48,7 +58,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-right: 18rpx; margin-right: 28rpx;
justify-content: center; justify-content: center;
>image{ >image{
width: 90rpx; width: 90rpx;
@ -62,6 +72,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
} }
.info{ .info{
width: 340rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
>text:nth-child(1){ >text:nth-child(1){
@ -87,6 +98,7 @@ export default {
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
margin-left: 33rpx; margin-left: 33rpx;
text-decoration: line-through;
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -1,19 +1,37 @@
<template> <template>
<view class="shield"> <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"> <view class="infomation">
<u-avatar :src="src" size="80"></u-avatar> <u-avatar :src="item.member_avatar" size="80"></u-avatar>
<view class="nickname u-line-1">神的温柔</view> <view class="nickname u-line-1">{{ item.member_nickname }}</view>
</view> </view>
<view class="btn">取消屏蔽</view> <view class="btn" @click="cancelArticleShield(item.member_id)">取消屏蔽</view>
</view> </view>
<u-empty text="暂无屏蔽用户" mode="list" v-if="!userList.length" margin-top="280" color="#333"></u-empty>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { 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> <swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true"> <scroll-view style="width:100%;height:100%" scroll-y="true">
<view class="box"> <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 class="list">
<view > <view >
<videoItem v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id" :item="item" @getArticlelist="getArticlelist"></videoItem> <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> <swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true"> <scroll-view style="width:100%;height:100%" scroll-y="true">
<view class="box"> <view class="box">
<indexad style="width:690rpx"></indexad> <u-swiper mode="dot" :list="zhiboImageSwiper" name="adv_code"></u-swiper>
<view class="list"> <view class="list">
<view > <view >
<zhiboItem v-for="item in 10"></zhiboItem> <zhiboItem v-for="item in 10"></zhiboItem>
@ -185,6 +186,8 @@ export default {
page: 0, // 0 page: 0, // 0
articleList: [], articleList: [],
recommendList: [], // recommendList: [], //
indexImageSwiper: [],
zhiboImageSwiper: [],
} }
}, },
components:{ components:{
@ -196,8 +199,24 @@ export default {
onShow(){ onShow(){
this.getArticlelist(); this.getArticlelist();
this.getRecommendList(); this.getRecommendList();
this.getSwiper();
this.getZhiBoSwiper();
}, },
methods:{ 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){ dianji(a){
// console.log(a) // console.log(a)
if(typeof a == "object"){ 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> <shopitem v-for="item in goodsClassify" :key="item.gc_id" :info="item" class="item"></shopitem>
</view> </view>
<view class="hr" style="margin-top:80rpx"></view> <view class="hr" style="margin-top:80rpx"></view>
<recommend></recommend> <recommend v-if="JSON.stringify(recommendedSpike) != '{}'" :recommendData="recommendedSpike" type="spike"></recommend>
<view class="hr" style="margin-top:40rpx"></view>
<seckill></seckill>
<view class="hr" style="margin-top:40rpx"></view>
<recommend></recommend>
<view class="hr" style="margin-top:40rpx"></view> <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> <group></group>
<image class="lingquan"></image> <image class="lingquan"></image>
<youhq></youhq> <youhq></youhq>
@ -85,13 +85,20 @@ export default {
list:[], list:[],
goodsClassify: [], // goodsClassify: [], //
classifyList: [], classifyList: [],
goodsList: [] goodsList: [],
recommendedSpike: {}, //
spikeList: [], //
} }
}, },
onLoad() { onLoad() {
this.getShopTopList(); this.getShopTopList();
this.getGoodsRecommend(); this.getGoodsRecommend();
}, },
onShow() {
// console.log(this.$store.shop.state.count);
this.getRecommendedSpike();
this.getSpikeList();
},
methods: { methods: {
sousuo(){ sousuo(){
// console.log(123) // 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() { getGoodsRecommend() {
this.$u.api.getGoodsRecommend({ this.$u.api.getGoodsRecommend({
page: 1, page: 1,

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB