chore(components): 所有diy组件,添加data-component-name属性

This commit is contained in:
2025-10-30 17:17:15 +08:00
parent 0fabacd71c
commit fc232ad938
49 changed files with 16780 additions and 16770 deletions

View File

@@ -1,211 +1,211 @@
<template> <template>
<x-skeleton type="list" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-article" type="list" :loading="loading" :configs="skeletonConfig">
<view class="article-wrap" :style="warpCss"> <view class="article-wrap" :style="warpCss">
<view :class="['list-wrap', value.style]" :style="warpCss"> <view :class="['list-wrap', value.style]" :style="warpCss">
<view :class="['item', value.ornament.type]" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :style="itemCss"> <view :class="['item', value.ornament.type]" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :style="itemCss">
<view class="article-img"> <view class="article-img">
<image class="cover-img" :src="$util.img(item.cover_img)" mode="widthFix" @error="imgError(index)" /> <image class="cover-img" :src="$util.img(item.cover_img)" mode="widthFix" @error="imgError(index)" />
</view> </view>
<view class="info-wrap"> <view class="info-wrap">
<text class="title">{{ item.article_title }}</text> <text class="title">{{ item.article_title }}</text>
<text class="desc" style="color:#888;font-size: 24rpx; display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;">{{ item.article_abstract }}</text> <text class="desc" style="color:#888;font-size: 24rpx; display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;">{{ item.article_abstract }}</text>
<view class="read-wrap"> <view class="read-wrap">
<block v-if="item.category_name"> <block v-if="item.category_name">
<text class="category-icon"></text> <text class="category-icon"></text>
<text>{{ item.category_name }}</text> <text>{{ item.category_name }}</text>
</block> </block>
<text class="date">{{ $util.timeStampTurnTime(item.create_time, 'date') }}</text> <text class="date">{{ $util.timeStampTurnTime(item.create_time, 'date') }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
// 文章 // 文章
export default { export default {
name: 'diy-article', name: 'diy-article',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
list: [], list: [],
loading: true, loading: true,
skeletonConfig: { skeletonConfig: {
gridRows: 1, gridRows: 1,
gridRowsGap: '40rpx', gridRowsGap: '40rpx',
headWidth: '160rpx', headWidth: '160rpx',
headHeight: '160rpx', headHeight: '160rpx',
textRows: 2 textRows: 2
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function (nval) { componentRefresh: function (nval) {
this.getList(); this.getList();
} }
}, },
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
}, },
// 子项样式 // 子项样式
itemCss() { itemCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.elementBgColor + ';'; obj += 'background-color:' + this.value.elementBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
if (this.value.ornament.type == 'shadow') { if (this.value.ornament.type == 'shadow') {
obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color; obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color;
} }
if (this.value.ornament.type == 'stroke') { if (this.value.ornament.type == 'stroke') {
obj += 'border:' + '2rpx solid ' + this.value.ornament.color; obj += 'border:' + '2rpx solid ' + this.value.ornament.color;
} }
return obj; return obj;
} }
}, },
methods: { methods: {
getList() { getList() {
var data = { var data = {
num: this.value.count num: this.value.count
}; };
if (this.value.sources == 'diy') { if (this.value.sources == 'diy') {
data.num = 0; data.num = 0;
data.article_id_arr = this.value.articleIds.toString(); data.article_id_arr = this.value.articleIds.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/article/lists', url: '/api/article/lists',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
let data = res.data; let data = res.data;
this.list = data; this.list = data;
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
toDetail(item) { toDetail(item) {
this.$util.redirectTo('/pages_tool/article/detail', { this.$util.redirectTo('/pages_tool/article/detail', {
article_id: item.article_id article_id: item.article_id
}); });
}, },
imgError(index) { imgError(index) {
if (this.list[index]) this.list[index].cover_img = this.$util.getDefaultImage().article; if (this.list[index]) this.list[index].cover_img = this.$util.getDefaultImage().article;
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.article-wrap { .article-wrap {
.list-wrap { .list-wrap {
&.style-1 { &.style-1 {
.item { .item {
display: flex; display: flex;
padding: 20rpx; padding: 20rpx;
margin-top: 24rpx; margin-top: 24rpx;
&:first-of-type { &:first-of-type {
margin-top: 0; margin-top: 0;
} }
.article-img { .article-img {
margin-right: 20rpx; margin-right: 20rpx;
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
image { image {
width: 100%; width: 100%;
} }
} }
.info-wrap { .info-wrap {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
.title { .title {
font-weight: bold; font-weight: bold;
margin-bottom: 10rpx; margin-bottom: 10rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
font-size: 30rpx; font-size: 30rpx;
line-height: 1.5; line-height: 1.5;
} }
.abstract { .abstract {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
font-size: $font-size-tag; font-size: $font-size-tag;
} }
.read-wrap { .read-wrap {
display: flex; display: flex;
color: #999ca7; color: #999ca7;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
margin-top: 10rpx; margin-top: 10rpx;
line-height: 1; line-height: 1;
text { text {
font-size: $font-size-tag; font-size: $font-size-tag;
} }
.iconfont { .iconfont {
font-size: 36rpx; font-size: 36rpx;
vertical-align: bottom; vertical-align: bottom;
margin-right: 10rpx; margin-right: 10rpx;
} }
.category-icon { .category-icon {
width: 8rpx; width: 8rpx;
height: 8rpx; height: 8rpx;
border-radius: 50%; border-radius: 50%;
background: $base-color; background: $base-color;
margin-right: 10rpx; margin-right: 10rpx;
} }
.date { .date {
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
} }
} }
} }
} }
} }
</style> </style>

View File

@@ -1,444 +1,444 @@
<template> <template>
<view> <view data-component-name="diy-audio">
<view class="fui-audio style1" :style="{background:value.background}" v-if="value.type == 'style-2'"> <view class="fui-audio style1" :style="{background:value.background}" v-if="value.type == 'style-2'">
<view class="content" style="padding-top: 20rpx;"> <view class="content" style="padding-top: 20rpx;">
<view class="name" :style="{color:value.textcolor}">{{value.text}}</view> <view class="name" :style="{color:value.textcolor}">{{value.text}}</view>
<view class="author" :style="{color:value.subtitlecolor}">{{value.desc}}----{{value.id}}</view> <view class="author" :style="{color:value.subtitlecolor}">{{value.desc}}----{{value.id}}</view>
</view> </view>
<view class="progress"> <view class="progress">
<view class="progressBar" :style="{width:audiowidth}"></view> <view class="progressBar" :style="{width:audiowidth}"></view>
</view> </view>
<view class="time" :style="{color:value.timecolor}"> <view class="time" :style="{color:value.timecolor}">
{{audiotime}} {{audiotime}}
</view> </view>
<view @click="play()" class="start" :class="status?'iconj icon-07zanting':'iconj icon-bofang'" style="padding-top: 18rpx"></view> <view @click="play()" class="start" :class="status?'iconj icon-07zanting':'iconj icon-bofang'" style="padding-top: 18rpx"></view>
</view> </view>
<view class="fui-audio style3" :style="{background:value.background}" v-else> <view class="fui-audio style3" :style="{background:value.background}" v-else>
<!-- <audio src="/static/audio/bgm.mp3" controls loop></audio> --> <!-- <audio src="/static/audio/bgm.mp3" controls loop></audio> -->
<view class="img"> <view class="img">
<image :src="$util.img(value.imageUrl)"></image> <image :src="$util.img(value.imageUrl)"></image>
</view> </view>
<view class="content"> <view class="content">
<view class="name" :style="{color:value.textcolor}">{{value.text}}</view> <view class="name" :style="{color:value.textcolor}">{{value.text}}</view>
<view class="author" :style="{color:value.subtitlecolor}">{{value.desc}}</view> <view class="author" :style="{color:value.subtitlecolor}">{{value.desc}}</view>
</view> </view>
<view class="progress"> <view class="progress">
<view class="progressBar" :style="{width:audiowidth}"></view> <view class="progressBar" :style="{width:audiowidth}"></view>
</view> </view>
<view class="time" :style="{color:value.timecolor}"> <view class="time" :style="{color:value.timecolor}">
<!-- {{audios[value.id].audiotime}} --> <!-- {{audios[value.id].audiotime}} -->
{{audiotime}} {{audiotime}}
</view> </view>
<view @click="play()" class="start" :class="status?'iconj icon-07zanting':'iconj icon-bofang'"></view> <view @click="play()" class="start" :class="status?'iconj icon-07zanting':'iconj icon-bofang'"></view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// 视频 // 视频
export default { export default {
name: 'diy-audio', name: 'diy-audio',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
audiosObj:[], audiosObj:[],
audios: {}, audios: {},
audioContext:null, audioContext:null,
audiotime:'00:01', audiotime:'00:01',
audiowidth:0, audiowidth:0,
status:0,//1播放0停止 status:0,//1播放0停止
}; };
}, },
created() { created() {
// console.log(this.value) // console.log(this.value)
this.audios[this.value.id] = { this.audios[this.value.id] = {
audiotime:'00:01', audiotime:'00:01',
audiowidth:0 audiowidth:0
} }
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
videoWarpCss: function() { videoWarpCss: function() {
var obj = ''; var obj = '';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: { methods: {
play(){ play(){
var t = this.value.id, a = this.audiosObj[t] || !1; var t = this.value.id, a = this.audiosObj[t] || !1;
var e = { var e = {
audio:this.$util.img(this.value.audioUrl), audio:this.$util.img(this.value.audioUrl),
} }
if (!a) { if (!a) {
a = uni.createInnerAudioContext("audio_" + t); a = uni.createInnerAudioContext("audio_" + t);
var i = this.audiosObj; var i = this.audiosObj;
i[t] = a, this.audiosObj = i i[t] = a, this.audiosObj = i
// uni.setStorageSync('audio_list',audio_list) // uni.setStorageSync('audio_list',audio_list)
var audio_list = uni.getStorageSync('audio_list')?uni.getStorageSync('audio_list'):[] var audio_list = uni.getStorageSync('audio_list')?uni.getStorageSync('audio_list'):[]
if(audio_list.includes(t) == false){ if(audio_list.includes(t) == false){
audio_list.push(t) audio_list.push(t)
uni.setStorageSync('audio_list',audio_list) uni.setStorageSync('audio_list',audio_list)
} }
} }
console.log(uni.getStorageSync('audio_list')) console.log(uni.getStorageSync('audio_list'))
var n = this; var n = this;
// console.log(a) // console.log(a)
a.onPlay(function() { a.onPlay(function() {
var e = setInterval(function() { var e = setInterval(function() {
var i = a.currentTime / a.duration * 100 + "%", s = Math.floor(Math.ceil(a.currentTime) / 60), o = (Math.ceil(a.currentTime) % 60 / 100).toFixed(2).slice(-2), r = Math.ceil(a.currentTime); var i = a.currentTime / a.duration * 100 + "%", s = Math.floor(Math.ceil(a.currentTime) / 60), o = (Math.ceil(a.currentTime) % 60 / 100).toFixed(2).slice(-2), r = Math.ceil(a.currentTime);
s < 10 && (s = "0" + s); s < 10 && (s = "0" + s);
var u = s + ":" + o, c = n.audios; var u = s + ":" + o, c = n.audios;
// console.log(i) // console.log(i)
c[t].audiowidth = i, c[t].Time = e, c[t].audiotime = u, c[t].seconds = r, n.audios = c; c[t].audiowidth = i, c[t].Time = e, c[t].audiotime = u, c[t].seconds = r, n.audios = c;
}, 1e3); }, 1e3);
}); });
var s = n.$util.img(n.value.audioUrl), o = n.audios[n.value.id].seconds || 0, r = 0, u = 1; var s = n.$util.img(n.value.audioUrl), o = n.audios[n.value.id].seconds || 0, r = 0, u = 1;
0 == u && a.onEnded(function(e) { 0 == u && a.onEnded(function(e) {
c[t].status = !1,n.status=!1,c[t].seconds = 0,console.log(c),n.audios = c; c[t].status = !1,n.status=!1,c[t].seconds = 0,console.log(c),n.audios = c;
}); });
var c = n.audios; var c = n.audios;
c[t] || (c[t] = {}), a.paused && 0 == o ? (a.src = s, a.play(), 1 == u && (a.loop = !0), c[t] || (c[t] = {}), a.paused && 0 == o ? (a.src = s, a.play(), 1 == u && (a.loop = !0),
c[t].status = !0,n.status=!0, n.pauseOther(t)) : a.paused && o > 0 ? (a.play(), 0 == r ? a.seek(o) : a.seek(0), c[t].status = !0,n.status=!0, n.pauseOther(t)) : a.paused && o > 0 ? (a.play(), 0 == r ? a.seek(o) : a.seek(0),
c[t].status = !0,n.status=!0, n.pauseOther(t)) : (a.pause(), c[t].status = !1,n.status=!1),n.audios = c; c[t].status = !0,n.status=!0, n.pauseOther(t)) : (a.pause(), c[t].status = !1,n.status=!1),n.audios = c;
console.log(n.audios) console.log(n.audios)
}, },
pauseOther: function(e) { pauseOther: function(e) {
var t = this; var t = this;
// console.log(this.audiosObj[this.value.id]); // console.log(this.audiosObj[this.value.id]);
var i = this.audiosObj[this.value.id],a = this.value.id var i = this.audiosObj[this.value.id],a = this.value.id
// console.log(i) // console.log(i)
// console.log(a) // console.log(a)
// if (a != e) { // if (a != e) {
// i.pause(); // i.pause();
// var n = t.audios; // var n = t.audios;
// n[a] && (n[a].status = !1, this.audios=n); // n[a] && (n[a].status = !1, this.audios=n);
// } // }
var audios = document.getElementsByTagName("audio"); var audios = document.getElementsByTagName("audio");
// 暂停函数 // 暂停函数
function pauseAll() { function pauseAll() {
var self = this; var self = this;
[].forEach.call(audios, function (i) { [].forEach.call(audios, function (i) {
// 将audios中其他的audio全部暂停 // 将audios中其他的audio全部暂停
i !== self && i.pause(); i !== self && i.pause();
}) })
} }
// 给play事件绑定暂停函数 // 给play事件绑定暂停函数
[].forEach.call(audios, function (i) { [].forEach.call(audios, function (i) {
i.addEventListener("play", pauseAll.bind(i)); i.addEventListener("play", pauseAll.bind(i));
}) })
// var audio_list = uni.getStorageSync('audio_list') // var audio_list = uni.getStorageSync('audio_list')
// audio_list.forEach(function(value, index) { // audio_list.forEach(function(value, index) {
// if (value != e) { // if (value != e) {
// console.log(e) // console.log(e)
// uni.createInnerAudioContext("audio_" + value).pause(); // uni.createInnerAudioContext("audio_" + value).pause();
// } // }
// }); // });
// this.audiosObj.forEach(function(value, index) { // this.audiosObj.forEach(function(value, index) {
// console.log(value); // console.log(value);
// }); // });
// this.each(this.audiosObj, function(a, i) { // this.each(this.audiosObj, function(a, i) {
// if (a != e) { // if (a != e) {
// i.pause(); // i.pause();
// var n = t.data.audios; // var n = t.data.audios;
// n[a] && (n[a].status = !1, t.setData({ // n[a] && (n[a].status = !1, t.setData({
// audios: n // audios: n
// })); // }));
// } // }
// }); // });
}, },
play_bak(){ play_bak(){
var t = this.value.id var t = this.value.id
this.audioContext = uni.createInnerAudioContext("audio_" + this.value.id); this.audioContext = uni.createInnerAudioContext("audio_" + this.value.id);
this.audioContext.src = this.$util.img(this.value.audioUrl); this.audioContext.src = this.$util.img(this.value.audioUrl);
var that = this var that = this
if(this.status == 1){ if(this.status == 1){
this.audioContext.pause(); this.audioContext.pause();
this.status = 0 this.status = 0
return false return false
} }
this.audioContext.play(); this.audioContext.play();
this.status = 1 this.status = 1
this.audioContext.onCanplay(function(s){ this.audioContext.onCanplay(function(s){
var e = setInterval(function() { var e = setInterval(function() {
var i = parseFloat(that.audioContext.currentTime) / parseFloat(that.audioContext.duration) * 100 + "%", s = Math.floor(Math.ceil(that.audioContext.currentTime) / 60), o = (Math.ceil(that.audioContext.currentTime) % 60 / 100).toFixed(2).slice(-2), r = Math.ceil(that.audioContext.currentTime); var i = parseFloat(that.audioContext.currentTime) / parseFloat(that.audioContext.duration) * 100 + "%", s = Math.floor(Math.ceil(that.audioContext.currentTime) / 60), o = (Math.ceil(that.audioContext.currentTime) % 60 / 100).toFixed(2).slice(-2), r = Math.ceil(that.audioContext.currentTime);
s < 10 && (s = "0" + s); s < 10 && (s = "0" + s);
var u = s + ":" + o, c = that.audios; var u = s + ":" + o, c = that.audios;
c[t].audiowidth = i, c[t].Time = e, c[t].audiotime = u, c[t].seconds = r c[t].audiowidth = i, c[t].Time = e, c[t].audiotime = u, c[t].seconds = r
that.audios = c that.audios = c
// console.log(c) // console.log(c)
console.log(that.audios[that.value.id].audiotime) console.log(that.audios[that.value.id].audiotime)
that.audiotime = that.audios[that.value.id].audiotime that.audiotime = that.audios[that.value.id].audiotime
that.audiowidth = that.audios[that.value.id].audiowidth that.audiowidth = that.audios[that.value.id].audiowidth
console.log(i) console.log(i)
that.lyg = i that.lyg = i
}, 1e3); }, 1e3);
}); });
this.audioContext.onEnded(() => { this.audioContext.onEnded(() => {
console.log('播放结束'); console.log('播放结束');
this.status = 0 this.status = 0
}); });
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>
.fui-audio { .fui-audio {
width: 100%; width: 100%;
border: 1rpx solid #eeeeee; border: 1rpx solid #eeeeee;
padding: 0 30rpx 0 20rpx; padding: 0 30rpx 0 20rpx;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
} }
.fui-audio .img { .fui-audio .img {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
background: #000; background: #000;
} }
.fui-audio .img image { .fui-audio .img image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.fui-audio .name { .fui-audio .name {
font-size: 26rpx; font-size: 26rpx;
color: #333; color: #333;
} }
.fui-audio .author { .fui-audio .author {
font-size: 26rpx; font-size: 26rpx;
color: #666; color: #666;
} }
.fui-audio .time { .fui-audio .time {
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.fui-audio .start { .fui-audio .start {
border: 0; border: 0;
padding: 0; padding: 0;
margin: 0; margin: 0;
font-size: 28rpx; font-size: 28rpx;
} }
.progressBar { .progressBar {
height: 2rpx; height: 2rpx;
width: 0; width: 0;
background: #333; background: #333;
} }
.fui-audio.style1 { .fui-audio.style1 {
height: 86rpx; height: 86rpx;
line-height: 82rpx; line-height: 82rpx;
} }
.fui-audio.style1 .img,.fui-audio.style2 .img { .fui-audio.style1 .img,.fui-audio.style2 .img {
display: none; display: none;
} }
.fui-audio.style1 .name,.fui-audio.style2 .name { .fui-audio.style1 .name,.fui-audio.style2 .name {
float: left; float: left;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-width: 300rpx; max-width: 300rpx;
} }
.fui-audio.style1 .author,.fui-audio.style2 .author { .fui-audio.style1 .author,.fui-audio.style2 .author {
float: left; float: left;
margin-left: 12rpx; margin-left: 12rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-width: 200rpx; max-width: 200rpx;
} }
.fui-audio.style1 .time,.fui-audio.style4 .time { .fui-audio.style1 .time,.fui-audio.style4 .time {
display: none; display: none;
} }
.fui-audio.style1 .start { .fui-audio.style1 .start {
position: absolute; position: absolute;
top: 0rpx; top: 0rpx;
right: 40rpx; right: 40rpx;
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
color: #000; color: #000;
} }
.fui-audio.style1 .progress { .fui-audio.style1 .progress {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
} }
.fui-audio.style2 { .fui-audio.style2 {
height: 86rpx; height: 86rpx;
line-height: 82rpx; line-height: 82rpx;
} }
.fui-audio.style2 .img { .fui-audio.style2 .img {
display: none; display: none;
} }
.fui-audio.style2 .time { .fui-audio.style2 .time {
position: absolute; position: absolute;
top: 0; top: 0;
right: 30rpx; right: 30rpx;
} }
.fui-audio.style2 .name { .fui-audio.style2 .name {
margin-left: 70rpx; margin-left: 70rpx;
} }
.fui-audio.style2 .start { .fui-audio.style2 .start {
position: absolute; position: absolute;
top: 0rpx; top: 0rpx;
left: 30rpx; left: 30rpx;
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
color: #000; color: #000;
} }
.fui-audio.style2 .progress,.fui-audio.style3 .progress { .fui-audio.style2 .progress,.fui-audio.style3 .progress {
display: none; display: none;
} }
.fui-audio.style3 { .fui-audio.style3 {
padding: 8rpx; padding: 8rpx;
} }
.fui-audio.style3 .start { .fui-audio.style3 .start {
position: absolute; position: absolute;
top: 30rpx; top: 30rpx;
left: 28rpx; left: 28rpx;
width: 56rpx; width: 56rpx;
height: 56rpx; height: 56rpx;
color: #fff; color: #fff;
/* border: 2rpx solid #fff; */ /* border: 2rpx solid #fff; */
border-radius: 50%; border-radius: 50%;
text-indent: 18rpx; text-indent: 18rpx;
line-height: 56rpx; line-height: 56rpx;
} }
.fui-audio.style3 .img,.fui-audio.style4 .img { .fui-audio.style3 .img,.fui-audio.style4 .img {
float: left; float: left;
margin-right: 20rpx; margin-right: 20rpx;
} }
.fui-audio.style3 .content { .fui-audio.style3 .content {
width: 468rpx; width: 468rpx;
} }
.fui-audio.style3 .content,.fui-audio.style4 .content { .fui-audio.style3 .content,.fui-audio.style4 .content {
float: left; float: left;
height: 100rpx; height: 100rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.fui-audio.style3 .content .name { .fui-audio.style3 .content .name {
height: 40rpx; height: 40rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.fui-audio.style3 .content .author { .fui-audio.style3 .content .author {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.fui-audio.style3 .time { .fui-audio.style3 .time {
position: absolute; position: absolute;
top: 40rpx; top: 40rpx;
right: 30rpx; right: 30rpx;
} }
.fui-audio.style4 { .fui-audio.style4 {
padding: 10rpx; padding: 10rpx;
} }
.fui-audio.style4 .content { .fui-audio.style4 .content {
padding-bottom: 18rpx; padding-bottom: 18rpx;
height: 82rpx; height: 82rpx;
width: 500rpx; width: 500rpx;
} }
.fui-audio.style4 .start { .fui-audio.style4 .start {
position: absolute; position: absolute;
top: 32rpx; top: 32rpx;
right: 30rpx; right: 30rpx;
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
color: #000; color: #000;
} }
.fui-audio.style4 .name { .fui-audio.style4 .name {
line-height: 1.2; line-height: 1.2;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.fui-audio.style4 .author { .fui-audio.style4 .author {
line-height: 1.2; line-height: 1.2;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.fui-audio.style4 .progress { .fui-audio.style4 .progress {
background: #f5f5f5; background: #f5f5f5;
height: 4rpx; height: 4rpx;
position: absolute; position: absolute;
bottom: 24rpx; bottom: 24rpx;
left: 130rpx; left: 130rpx;
right: 30rpx; right: 30rpx;
border-radius: 2rpx; border-radius: 2rpx;
overflow: hidden; overflow: hidden;
} }
.fui-audio.style4 .progressBar { .fui-audio.style4 .progressBar {
height: 4rpx; height: 4rpx;
} }
.diy-audio>>>.uni-video-container { .diy-audio>>>.uni-video-container {
background-color: transparent; background-color: transparent;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,293 +1,293 @@
<template> <template>
<view v-if="tabBarList && tabBarList.list"> <view data-component-name="diy-bottom-nav" v-if="tabBarList && tabBarList.list">
<view class="tab-bar" :style="{ backgroundColor: tabBarList.backgroundColor }"> <view class="tab-bar" :style="{ backgroundColor: tabBarList.backgroundColor }">
<view class="tabbar-border"></view> <view class="tabbar-border"></view>
<view class="item" v-for="(item, index) in tabBarList.list" :key="item.id" @click="redirectTo(item.link)"> <view class="item" v-for="(item, index) in tabBarList.list" :key="item.id" @click="redirectTo(item.link)">
<view class="bd"> <view class="bd">
<block v-if="item.link.wap_url == '/pages/goods/cart'"> <block v-if="item.link.wap_url == '/pages/goods/cart'">
<view class="icon" v-if="tabBarList.type == 1 || tabBarList.type == 2" :animation="cartAnimation" id="tabbarCart"> <view class="icon" v-if="tabBarList.type == 1 || tabBarList.type == 2" :animation="cartAnimation" id="tabbarCart">
<block v-if="verify(item.link)"> <block v-if="verify(item.link)">
<image v-if="item.selected_icon_type == 'img'" :src="$util.img(item.selectedIconPath)" /> <image v-if="item.selected_icon_type == 'img'" :src="$util.img(item.selectedIconPath)" />
<diy-icon v-if="item.selected_icon_type == 'icon'" :icon="item.selectedIconPath" :value="item.selected_style ? item.selected_style : null"></diy-icon> <diy-icon v-if="item.selected_icon_type == 'icon'" :icon="item.selectedIconPath" :value="item.selected_style ? item.selected_style : null"></diy-icon>
</block> </block>
<block v-else> <block v-else>
<image v-if="item.icon_type == 'img'" :src="$util.img(item.iconPath)" /> <image v-if="item.icon_type == 'img'" :src="$util.img(item.iconPath)" />
<diy-icon v-if="item.icon_type == 'icon'" :icon="item.iconPath" :value="item.style ? item.style : null"></diy-icon> <diy-icon v-if="item.icon_type == 'icon'" :icon="item.iconPath" :value="item.style ? item.style : null"></diy-icon>
</block> </block>
<view class="cart-count-mark font-size-activity-tag" <view class="cart-count-mark font-size-activity-tag"
:class="{ max: item.link.wap_url == '/pages/goods/cart' && cartNumber > 99 }" :class="{ max: item.link.wap_url == '/pages/goods/cart' && cartNumber > 99 }"
:style="{ background: 'var(--price-color)' }" v-if="cartNumber > 0"> :style="{ background: 'var(--price-color)' }" v-if="cartNumber > 0">
{{ cartNumber > 99 ? '99+' : cartNumber }} {{ cartNumber > 99 ? '99+' : cartNumber }}
</view> </view>
</view> </view>
</block> </block>
<block v-else> <block v-else>
<view class="icon" v-if="tabBarList.type == 1 || tabBarList.type == 2"> <view class="icon" v-if="tabBarList.type == 1 || tabBarList.type == 2">
<block v-if="verify(item.link)"> <block v-if="verify(item.link)">
<image v-if="item.selected_icon_type == 'img'" :src="$util.img(item.selectedIconPath)" /> <image v-if="item.selected_icon_type == 'img'" :src="$util.img(item.selectedIconPath)" />
<diy-icon v-if="item.selected_icon_type == 'icon'" :icon="item.selectedIconPath" <diy-icon v-if="item.selected_icon_type == 'icon'" :icon="item.selectedIconPath"
:value="item.selected_style ? item.selected_style : null"></diy-icon> :value="item.selected_style ? item.selected_style : null"></diy-icon>
</block> </block>
<block v-else> <block v-else>
<image v-if="item.icon_type == 'img'" :src="$util.img(item.iconPath)" /> <image v-if="item.icon_type == 'img'" :src="$util.img(item.iconPath)" />
<diy-icon v-if="item.icon_type == 'icon'" :icon="item.iconPath" :value="item.style ? item.style : null"></diy-icon> <diy-icon v-if="item.icon_type == 'icon'" :icon="item.iconPath" :value="item.style ? item.style : null"></diy-icon>
</block> </block>
</view> </view>
</block> </block>
<view class="label" v-if="(tabBarList.type == 1 || tabBarList.type == 3) && tabBarList.theme == 'diy'" :style="{ color: verify(item.link) ? tabBarList.textHoverColor : tabBarList.textColor }"> <view class="label" v-if="(tabBarList.type == 1 || tabBarList.type == 3) && tabBarList.theme == 'diy'" :style="{ color: verify(item.link) ? tabBarList.textHoverColor : tabBarList.textColor }">
{{ lang =='en-us'?item.en_text:item.text }} {{ lang =='en-us'?item.en_text:item.text }}
</view> </view>
<view class="label" v-if="(tabBarList.type == 1 || tabBarList.type == 3) && tabBarList.theme == 'default'" :style="{ color: verify(item.link) ? 'var(--base-color)' : '#333333' }"> <view class="label" v-if="(tabBarList.type == 1 || tabBarList.type == 3) && tabBarList.theme == 'default'" :style="{ color: verify(item.link) ? 'var(--base-color)' : '#333333' }">
{{ lang =='en-us'?item.en_text:item.text }} {{ lang =='en-us'?item.en_text:item.text }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 解决fixed定位后底部导航栏塌陷问题 --> <!-- 解决fixed定位后底部导航栏塌陷问题 -->
<view class="tab-bar-placeholder"></view> <view class="tab-bar-placeholder"></view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-bottom-nav', name: 'diy-bottom-nav',
props: { props: {
value: { value: {
type: Object type: Object
}, },
name: { name: {
type: String, type: String,
default: '' default: ''
} }
}, },
data() { data() {
return { return {
lang:uni.getStorageSync("lang"), lang:uni.getStorageSync("lang"),
currentRoute: '', //当前页面路径 currentRoute: '', //当前页面路径
jumpFlag: true, //是否可以跳转,防止重复点击 jumpFlag: true, //是否可以跳转,防止重复点击
cartAnimation: {} cartAnimation: {}
}; };
}, },
mounted() { mounted() {
let currentPage = getCurrentPages()[getCurrentPages().length - 1]; let currentPage = getCurrentPages()[getCurrentPages().length - 1];
if (currentPage && currentPage.route) { if (currentPage && currentPage.route) {
this.currentRoute = currentPage.route; this.currentRoute = currentPage.route;
} }
this.$nextTick(() => { this.$nextTick(() => {
if (!this.$store.state.cartPosition) { if (!this.$store.state.cartPosition) {
let query = uni.createSelectorQuery().in(this); let query = uni.createSelectorQuery().in(this);
query.select('#tabbarCart') query.select('#tabbarCart')
.boundingClientRect(data => { .boundingClientRect(data => {
if (data) this.$store.commit('setCartPosition', data); if (data) this.$store.commit('setCartPosition', data);
}).exec(); }).exec();
query.select('.tab-bar') query.select('.tab-bar')
.boundingClientRect(data => { .boundingClientRect(data => {
if (data) this.$store.commit('setTabBarHeight', data.height + if (data) this.$store.commit('setTabBarHeight', data.height +
'px'); 'px');
}).exec(); }).exec();
} }
}); });
}, },
computed: { computed: {
cartChange() { cartChange() {
return this.$store.state.cartChange; return this.$store.state.cartChange;
} }
}, },
watch: { watch: {
cartChange: function (nval, oval) { cartChange: function (nval, oval) {
if (nval > oval) { if (nval > oval) {
let animation = uni.createAnimation({ let animation = uni.createAnimation({
duration: 200, duration: 200,
timingFunction: 'ease' timingFunction: 'ease'
}); });
animation.scale(1.2).step(); animation.scale(1.2).step();
this.cartAnimation = animation.export(); this.cartAnimation = animation.export();
setTimeout(() => { setTimeout(() => {
animation.scale(1).step(); animation.scale(1).step();
this.cartAnimation = animation.export(); this.cartAnimation = animation.export();
}, 300); }, 300);
} }
} }
}, },
methods: { methods: {
redirectTo(link) { redirectTo(link) {
this.$emit('callback'); this.$emit('callback');
this.$util.diyRedirectTo(link); this.$util.diyRedirectTo(link);
}, },
verify(link) { verify(link) {
if (link == null || link == '' || !link.wap_url) return false; if (link == null || link == '' || !link.wap_url) return false;
if (this.name) { if (this.name) {
var url = this.currentRoute + '?name=' + this.name; var url = this.currentRoute + '?name=' + this.name;
} else { } else {
var url = this.currentRoute; var url = this.currentRoute;
} }
// 首页特殊处理 // 首页特殊处理
if (link.wap_url == '/pages/index/index' && this.name == 'DIY_VIEW_INDEX') { if (link.wap_url == '/pages/index/index' && this.name == 'DIY_VIEW_INDEX') {
return true; return true;
} else if (url && link.wap_url.indexOf(url) != -1) { } else if (url && link.wap_url.indexOf(url) != -1) {
return true; return true;
} }
return false; return false;
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.placeholder { .placeholder {
height: 112rpx; height: 112rpx;
&.bluge { &.bluge {
height: 180rpx; height: 180rpx;
} }
} }
.safe-area { .safe-area {
padding-bottom: 0; padding-bottom: 0;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
} }
.tab-bar { .tab-bar {
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
z-index: 998; z-index: 998;
display: flex; display: flex;
border-top: 2rpx solid #f5f5f5; border-top: 2rpx solid #f5f5f5;
padding-bottom: 0; padding-bottom: 0;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
.tabbar-border { .tabbar-border {
background-color: rgba(255, 255, 255, 0.329412); background-color: rgba(255, 255, 255, 0.329412);
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 2rpx; height: 2rpx;
-webkit-transform: scaleY(0.5); -webkit-transform: scaleY(0.5);
transform: scaleY(0.5); transform: scaleY(0.5);
} }
.item { .item {
display: flex; display: flex;
align-items: center; align-items: center;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-box-direction: normal; -webkit-box-direction: normal;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
padding-bottom: 10rpx; padding-bottom: 10rpx;
box-sizing: border-box; box-sizing: border-box;
.bd { .bd {
position: relative; position: relative;
height: 100rpx; height: 100rpx;
flex-direction: column; flex-direction: column;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.icon { .icon {
position: relative; position: relative;
display: inline-block; display: inline-block;
margin-top: 10rpx; margin-top: 10rpx;
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
font-size: 40rpx; font-size: 40rpx;
line-height: 40rpx; line-height: 40rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
>view { >view {
height: inherit; height: inherit;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.bar-icon { .bar-icon {
font-size: 42rpx; font-size: 42rpx;
} }
} }
.label { .label {
position: relative; position: relative;
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
line-height: 1; line-height: 1;
margin-top: 12rpx; margin-top: 12rpx;
} }
} }
&.bulge { &.bulge {
.bd { .bd {
position: relative; position: relative;
height: 100rpx; height: 100rpx;
flex-direction: column; flex-direction: column;
text-align: center; text-align: center;
.icon { .icon {
margin-top: -60rpx; margin-top: -60rpx;
margin-bottom: 4rpx; margin-bottom: 4rpx;
border-radius: 50%; border-radius: 50%;
width: 100rpx; width: 100rpx;
height: 102rpx; height: 102rpx;
padding: 10rpx; padding: 10rpx;
border-top: 2rpx solid #f5f5f5; border-top: 2rpx solid #f5f5f5;
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
} }
} }
.label { .label {
position: relative; position: relative;
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
} }
} }
} }
.cart-count-mark { .cart-count-mark {
position: absolute; position: absolute;
top: -8rpx; top: -8rpx;
right: -18rpx; right: -18rpx;
width: 24rpx; width: 24rpx;
height: 24rpx !important; height: 24rpx !important;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: #fff; color: #fff;
padding: 6rpx; padding: 6rpx;
border-radius: 50%; border-radius: 50%;
z-index: 99; z-index: 99;
&.max { &.max {
width: 40rpx; width: 40rpx;
border-radius: 24rpx; border-radius: 24rpx;
right: -28rpx; right: -28rpx;
} }
} }
} }
} }
.tab-bar-placeholder { .tab-bar-placeholder {
padding-bottom: calc(constant(safe-area-inset-bottom) + 112rpx); padding-bottom: calc(constant(safe-area-inset-bottom) + 112rpx);
padding-bottom: calc(env(safe-area-inset-bottom) + 112rpx); padding-bottom: calc(env(safe-area-inset-bottom) + 112rpx);
} }
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,23 @@
<template> <template>
<view></view> <view data-component-name="diy-comp-extend"></view>
</template> </template>
<script> <script>
// 自定义扩展组件 // 自定义扩展组件
export default { export default {
name: 'diy-comp-extend', name: 'diy-comp-extend',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
computed: {}, computed: {},
created() {}, created() {},
methods: {} methods: {}
}; };
</script> </script>
<style></style> <style></style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,419 +1,419 @@
<template> <template>
<view class="diy-fenxiao" v-if="list.length" :class="['goods-list', value.template, value.style]" :style="goodsListWarpCss"> <view data-component-name="diy-fenxiao-goods-list" class="diy-fenxiao" v-if="list.length" :class="['goods-list', value.template, value.style]" :style="goodsListWarpCss">
<view class="goods-item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="goods-item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="goods-img" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="goods-img" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imgError(index)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imgError(index)"/>
</view> </view>
<view class="info-wrap" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl || value.btnStyle.control"> <view class="info-wrap" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl || value.btnStyle.control">
<view class="name-wrap"> <view class="name-wrap">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]" :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"
> >
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
</view> </view>
<view class="pro-info"> <view class="pro-info">
<view class="discount-price"> <view class="discount-price">
<view class="price-wrap" v-if="value.priceStyle.mainControl"> <view class="price-wrap" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor : '' }"> </text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor : '' }"> </text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor : '' }">{{ item.commission_money.split('.')[0] }}</text> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor : '' }">{{ item.commission_money.split('.')[0] }}</text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor : '' }">{{ '.' + item.commission_money.split('.')[1] }}</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor : '' }">{{ '.' + item.commission_money.split('.')[1] }}</text>
</view> </view>
<view class="sale-btn" v-if="value.btnStyle.control && item.is_collect == 0" <view class="sale-btn" v-if="value.btnStyle.control && item.is_collect == 0"
:style="{ :style="{
background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '', background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '',
color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '', color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '',
borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx' borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx'
}" }"
@click.stop="followGoods(item, index)" @click.stop="followGoods(item, index)"
> >
关注 关注
</view> </view>
<view class="sale-btn" v-if="value.btnStyle.control && item.is_collect == 1" <view class="sale-btn" v-if="value.btnStyle.control && item.is_collect == 1"
:style="{ :style="{
background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '', background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '',
color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '', color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '',
borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx' borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx'
}" }"
@click.stop="delFollowTip(item, index)" @click.stop="delFollowTip(item, index)"
> >
取消关注 取消关注
</view> </view>
</view> </view>
<view class="delete-price" v-if="value.priceStyle.lineControl" :style="{ color: value.theme == 'diy' ? value.priceStyle.lineColor : '' }"> <view class="delete-price" v-if="value.priceStyle.lineControl" :style="{ color: value.theme == 'diy' ? value.priceStyle.lineColor : '' }">
{{ item.discount_price }} {{ item.discount_price }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-fenxiao-goods-list', name: 'diy-fenxiao-goods-list',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
list: [], list: [],
currentRoute: '' currentRoute: ''
}; };
}, },
created() { created() {
let currentPage = getCurrentPages()[getCurrentPages().length - 1]; let currentPage = getCurrentPages()[getCurrentPages().length - 1];
this.currentRoute = '/' + currentPage.route; this.currentRoute = '/' + currentPage.route;
if (!this.storeToken) { if (!this.storeToken) {
this.$util.redirectTo( this.$util.redirectTo(
'/pages_tool/login/login', '/pages_tool/login/login',
{ {
back: this.currentRoute back: this.currentRoute
}, },
'redirectTo' 'redirectTo'
); );
} }
this.getData(); this.getData();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getData(); this.getData();
} }
}, },
computed: { computed: {
goodsListWarpCss() { goodsListWarpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
}, },
// 商品项样式 // 商品项样式
goodsItemCss() { goodsItemCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.elementBgColor + ';'; obj += 'background-color:' + this.value.elementBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
if (this.value.ornament.type == 'shadow') { if (this.value.ornament.type == 'shadow') {
obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color; obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color;
} }
if (this.value.ornament.type == 'stroke') { if (this.value.ornament.type == 'stroke') {
obj += 'border:' + '2rpx solid ' + this.value.ornament.color; obj += 'border:' + '2rpx solid ' + this.value.ornament.color;
} }
return obj; return obj;
} }
}, },
methods: { methods: {
//页面跳转 //页面跳转
toDetail(e) { toDetail(e) {
this.$util.redirectTo('/pages/goods/detail', { goods_id: e.goods_id }); this.$util.redirectTo('/pages/goods/detail', { goods_id: e.goods_id });
}, },
//关注 //关注
followGoods(e, index) { followGoods(e, index) {
let goods_id = e.goods_id; let goods_id = e.goods_id;
let sku_id = e.sku_id; let sku_id = e.sku_id;
this.$api.sendRequest({ this.$api.sendRequest({
url: '/fenxiao/api/goodscollect/add', url: '/fenxiao/api/goodscollect/add',
data: { data: {
goods_id: goods_id, goods_id: goods_id,
sku_id: sku_id sku_id: sku_id
}, },
success: res => { success: res => {
if (res.code >= 0) { if (res.code >= 0) {
this.$util.showToast({ title: '关注成功' }); this.$util.showToast({ title: '关注成功' });
this.list[index].is_collect = 1; this.list[index].is_collect = 1;
this.list[index].collect_id = res.data; this.list[index].collect_id = res.data;
} }
this.$forceUpdate(); this.$forceUpdate();
} }
}); });
}, },
//取消关注 //取消关注
delFollowTip(e, index) { delFollowTip(e, index) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认取消关注该商品吗', content: '确认取消关注该商品吗',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
this.delFollow(e.collect_id, index); this.delFollow(e.collect_id, index);
} }
} }
}); });
}, },
delFollow(e, f) { delFollow(e, f) {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/fenxiao/api/goodscollect/delete', url: '/fenxiao/api/goodscollect/delete',
data: { data: {
collect_id: e collect_id: e
}, },
success: res => { success: res => {
let msg = ''; let msg = '';
if (res.code == 0) { if (res.code == 0) {
msg = '取消成功'; msg = '取消成功';
} else { } else {
msg = res.message; msg = res.message;
} }
this.$util.showToast({ this.$util.showToast({
title: msg title: msg
}); });
let arr = this.list; let arr = this.list;
arr[f].is_collect = 0; arr[f].is_collect = 0;
this.list = arr; this.list = arr;
this.$forceUpdate(); this.$forceUpdate();
} }
}); });
}, },
toMore() { toMore() {
this.$util.redirectTo('/pages_promotion/fenxiao/goods_list'); this.$util.redirectTo('/pages_promotion/fenxiao/goods_list');
}, },
getData() { getData() {
var data = { var data = {
page: 1, page: 1,
page_size: this.value.count page_size: this.value.count
}; };
if (this.value.sources == 'category') { if (this.value.sources == 'category') {
data.category_id = this.value.categoryId; data.category_id = this.value.categoryId;
data.category_level = 1; data.category_level = 1;
} else if (this.value.sources == 'diy') { } else if (this.value.sources == 'diy') {
data.page_size = 0; data.page_size = 0;
data.goods_id_arr = this.value.goodsId.toString(); data.goods_id_arr = this.value.goodsId.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/fenxiao/api/goods/page', url: '/fenxiao/api/goods/page',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0) { if (res.code == 0) {
this.list = res.data.list; this.list = res.data.list;
} }
} }
}); });
}, },
imgError(index) { imgError(index) {
if (this.list[index]) this.list[index].goods_image = this.$util.getDefaultImage().goods; if (this.list[index]) this.list[index].goods_image = this.$util.getDefaultImage().goods;
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.diy-fenxiao { .diy-fenxiao {
} }
// 商品列表单列样式 // 商品列表单列样式
.goods-list.row1-of1 { .goods-list.row1-of1 {
.goods-item { .goods-item {
background-color: #fff; background-color: #fff;
display: flex; display: flex;
margin-bottom: 20rpx; margin-bottom: 20rpx;
&:last-of-type { &:last-of-type {
margin-bottom: 0; margin-bottom: 0;
} }
&.shadow { &.shadow {
margin: 8rpx 8rpx 20rpx 8rpx; margin: 8rpx 8rpx 20rpx 8rpx;
} }
.goods-img { .goods-img {
width: 180rpx; width: 180rpx;
overflow: hidden; overflow: hidden;
margin-right: 20rpx; margin-right: 20rpx;
image { image {
width: 100%; width: 100%;
} }
} }
.info-wrap { .info-wrap {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
position: relative; position: relative;
.name-wrap { .name-wrap {
flex: 1; flex: 1;
margin-bottom: 10rpx; margin-bottom: 10rpx;
.goods-name { .goods-name {
font-size: $font-size-base; font-size: $font-size-base;
line-height: 1.3; line-height: 1.3;
&.multi-hidden { &.multi-hidden {
height: 72rpx; height: 72rpx;
} }
} }
} }
.pro-info { .pro-info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
.sale { .sale {
font-size: 20rpx; font-size: 20rpx;
line-height: 1; line-height: 1;
color: #999; color: #999;
} }
.discount-price { .discount-price {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 10rpx; margin-bottom: 10rpx;
.price-wrap { .price-wrap {
white-space: nowrap; white-space: nowrap;
.unit { .unit {
font-size: $font-size-tag; font-size: $font-size-tag;
color: $base-color; color: $base-color;
} }
.price { .price {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
} }
text { text {
font-weight: bold; font-weight: bold;
color: $base-color; color: $base-color;
} }
} }
} }
.delete-price { .delete-price {
text-decoration: line-through; text-decoration: line-through;
flex: 1; flex: 1;
line-height: 28rpx; line-height: 28rpx;
color: $color-tip; color: $color-tip;
font-size: $font-size-activity-tag; font-size: $font-size-activity-tag;
} }
} }
.sale-btn { .sale-btn {
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
bottom: 26rpx; bottom: 26rpx;
height: 50rpx; height: 50rpx;
line-height: 52rpx; line-height: 52rpx;
color: #fff; color: #fff;
width: 120rpx; width: 120rpx;
text-align: center; text-align: center;
background-color: $base-color; background-color: $base-color;
} }
} }
} }
} }
// 商品列表两列样式 // 商品列表两列样式
.goods-list.row1-of2 { .goods-list.row1-of2 {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.goods-item { .goods-item {
position: relative; position: relative;
background: #fff; background: #fff;
overflow: hidden; overflow: hidden;
margin-right: 20rpx; margin-right: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
width: calc(50% - 10rpx); width: calc(50% - 10rpx);
&:nth-child(2n + 2) { &:nth-child(2n + 2) {
width: calc(50% - 11rpx); width: calc(50% - 11rpx);
margin-right: 0; margin-right: 0;
} }
&:nth-of-type(1), &:nth-of-type(1),
&:nth-of-type(2) { &:nth-of-type(2) {
margin-top: 0; margin-top: 0;
} }
&.shadow { &.shadow {
width: calc(50% - 18rpx); width: calc(50% - 18rpx);
&:nth-child(2n-1) { &:nth-child(2n-1) {
margin-left: 8rpx; margin-left: 8rpx;
} }
&:nth-of-type(1), &:nth-of-type(1),
&:nth-of-type(2) { &:nth-of-type(2) {
margin-top: 8rpx; margin-top: 8rpx;
} }
} }
.goods-img { .goods-img {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
height: 350rpx; height: 350rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
top: 49%; top: 49%;
left: 0; left: 0;
transform: translateY(-50%); transform: translateY(-50%);
} }
} }
.info-wrap { .info-wrap {
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
.name-wrap { .name-wrap {
margin-bottom: 10rpx; margin-bottom: 10rpx;
.goods-name { .goods-name {
font-size: $font-size-base; font-size: $font-size-base;
line-height: 1.3; line-height: 1.3;
&.multi-hidden { &.multi-hidden {
height: 72rpx; height: 72rpx;
} }
} }
} }
.pro-info { .pro-info {
margin-top: 10rpx; margin-top: 10rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
.sale { .sale {
font-size: 20rpx; font-size: 20rpx;
line-height: 1; line-height: 1;
color: #999; color: #999;
} }
.discount-price { .discount-price {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.price-wrap { .price-wrap {
white-space: nowrap; white-space: nowrap;
.unit { .unit {
font-size: $font-size-tag; font-size: $font-size-tag;
color: $base-color; color: $base-color;
} }
.price { .price {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
} }
text { text {
font-weight: bold; font-weight: bold;
color: $base-color; color: $base-color;
} }
} }
} }
.delete-price { .delete-price {
text-decoration: line-through; text-decoration: line-through;
flex: 1; flex: 1;
line-height: 28rpx; line-height: 28rpx;
color: $color-tip; color: $color-tip;
font-size: $font-size-activity-tag; font-size: $font-size-activity-tag;
} }
} }
.sale-btn { .sale-btn {
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
bottom: 26rpx; bottom: 26rpx;
height: 50rpx; height: 50rpx;
line-height: 52rpx; line-height: 52rpx;
color: #fff; color: #fff;
width: 120rpx; width: 120rpx;
text-align: center; text-align: center;
background-color: $base-color; background-color: $base-color;
} }
} }
} }
} }
</style> </style>

View File

@@ -1,114 +1,114 @@
<template> <template>
<view class="float-btn" :class="{ left_top: value.bottomPosition == 1, right_top: value.bottomPosition == 2, left_bottom: value.bottomPosition == 3, right_bottom: value.bottomPosition == 4 }" :style="style"> <view data-component-name="diy-float-btn" class="float-btn" :class="{ left_top: value.bottomPosition == 1, right_top: value.bottomPosition == 2, left_bottom: value.bottomPosition == 3, right_bottom: value.bottomPosition == 4 }" :style="style">
<block v-for="(item, index) in value.list" :key="index"> <block v-for="(item, index) in value.list" :key="index">
<view class="button-box" @click="$util.diyRedirectTo(item.link)" :style="{ width: value.imageSize + 'px', height: value.imageSize + 'px', fontSize: value.imageSize + 'px' }"> <view class="button-box" @click="$util.diyRedirectTo(item.link)" :style="{ width: value.imageSize + 'px', height: value.imageSize + 'px', fontSize: value.imageSize + 'px' }">
<image v-if="!item.iconType || item.iconType == 'img'" :src="$util.img(item.imageUrl)" mode="aspectFit" :show-menu-by-longpress="true"/> <image v-if="!item.iconType || item.iconType == 'img'" :src="$util.img(item.imageUrl)" mode="aspectFit" :show-menu-by-longpress="true"/>
<diy-icon v-else-if="item.iconType && item.iconType == 'icon'" :icon="item.icon" <diy-icon v-else-if="item.iconType && item.iconType == 'icon'" :icon="item.icon"
:value="item.style ? item.style : null"></diy-icon> :value="item.style ? item.style : null"></diy-icon>
</view> </view>
</block> </block>
</view> </view>
</template> </template>
<script> <script>
// 获取系统状态栏的高度 // 获取系统状态栏的高度
let systemInfo = uni.getSystemInfoSync(); let systemInfo = uni.getSystemInfoSync();
export default { export default {
name: 'diy-float-btn', name: 'diy-float-btn',
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
} }
}, },
data() { data() {
return { return {
navHeight: 0, navHeight: 0,
statusBarHeight: systemInfo.statusBarHeight statusBarHeight: systemInfo.statusBarHeight
}; };
}, },
created() {}, created() {},
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
components: {}, components: {},
methods: {}, methods: {},
computed: { computed: {
style() { style() {
let style = {}, let style = {},
height = 54; height = 54;
// #ifdef MP // #ifdef MP
height = systemInfo.platform == 'ios' ? 54 : 58; height = systemInfo.platform == 'ios' ? 54 : 58;
// #endif // #endif
switch (parseInt(this.value.bottomPosition)) { switch (parseInt(this.value.bottomPosition)) {
case 1: case 1:
style.top = (this.navHeight + this.statusBarHeight + parseInt(this.value.btnBottom)) * 2 + 'rpx'; style.top = (this.navHeight + this.statusBarHeight + parseInt(this.value.btnBottom)) * 2 + 'rpx';
break; break;
case 2: case 2:
style.top = (this.navHeight + this.statusBarHeight + parseInt(this.value.btnBottom)) * 2 + 'rpx'; style.top = (this.navHeight + this.statusBarHeight + parseInt(this.value.btnBottom)) * 2 + 'rpx';
break; break;
case 3: case 3:
style.bottom = (100 + parseInt(this.value.btnBottom)) * 2 + 'rpx'; style.bottom = (100 + parseInt(this.value.btnBottom)) * 2 + 'rpx';
break; break;
case 4: case 4:
style.bottom = (100 + parseInt(this.value.btnBottom)) * 2 + 'rpx'; style.bottom = (100 + parseInt(this.value.btnBottom)) * 2 + 'rpx';
break; break;
} }
return this.$util.objToStyle(style); return this.$util.objToStyle(style);
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.float-btn { .float-btn {
position: fixed; position: fixed;
bottom: 20%; bottom: 20%;
right: 40rpx; right: 40rpx;
z-index: 990; z-index: 990;
&.left_top { &.left_top {
top: 100rpx; top: 100rpx;
left: 30rpx; left: 30rpx;
} }
&.right_top { &.right_top {
top: 100rpx; top: 100rpx;
right: 30rpx; right: 30rpx;
} }
&.left_bottom { &.left_bottom {
bottom: 160rpx; bottom: 160rpx;
left: 30rpx; left: 30rpx;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
/*兼容 IOS<11.2*/ /*兼容 IOS<11.2*/
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
/*兼容 IOS>11.2*/ /*兼容 IOS>11.2*/
} }
&.right_bottom { &.right_bottom {
bottom: 160rpx; bottom: 160rpx;
right: 30rpx; right: 30rpx;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
/*兼容 IOS<11.2*/ /*兼容 IOS<11.2*/
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
/*兼容 IOS>11.2*/ /*兼容 IOS>11.2*/
} }
.button-box { .button-box {
margin-bottom: 20rpx; margin-bottom: 20rpx;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
} }
</style> </style>

View File

@@ -1,29 +1,29 @@
<template> <template>
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view v-if="value.isShow"> <view data-component-name="diy-follow-official-account" v-if="value.isShow">
<official-account></official-account> <official-account></official-account>
</view> </view>
<!--#endif --> <!--#endif -->
</template> </template>
<script> <script>
// 关注公众号 // 关注公众号
export default { export default {
name: 'diy-follow-official-account', name: 'diy-follow-official-account',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
methods: {} methods: {}
}; };
</script> </script>
<style></style> <style></style>

View File

@@ -1,110 +1,110 @@
<template> <template>
<view class="diy-from" :style="style"> <view data-component-name="diy-form" class="diy-from" :style="style">
<view class="fui-cell-group"> <view class="fui-cell-group">
<view class="fui-cell "> <view class="fui-cell ">
<view class="fui-cell-label ">您的姓名</view> <view class="fui-cell-label ">您的姓名</view>
<view class="fui-cell-info"> <view class="fui-cell-info">
<input v-model="Form.realname" class="fui-input" placeholder="请输入您的姓名" value=""></input> <input v-model="Form.realname" class="fui-input" placeholder="请输入您的姓名" value=""></input>
</view> </view>
</view> </view>
<view class="fui-cell "> <view class="fui-cell ">
<view class="fui-cell-label">手机号码</view> <view class="fui-cell-label">手机号码</view>
<view class="fui-cell-info"> <view class="fui-cell-info">
<input v-model="Form.mobile" class="fui-input" maxlength="11" placeholder="请输入您的手机号" type="number" ></input> <input v-model="Form.mobile" class="fui-input" maxlength="11" placeholder="请输入您的手机号" type="number" ></input>
</view> </view>
</view> </view>
<view class="fui-cell "> <view class="fui-cell ">
<view class="fui-cell-label">您的邮箱</view> <view class="fui-cell-label">您的邮箱</view>
<view class="fui-cell-info"> <view class="fui-cell-info">
<input v-model="Form.mailbox" class="fui-input" placeholder="请输入您的邮箱" type="text" ></input> <input v-model="Form.mailbox" class="fui-input" placeholder="请输入您的邮箱" type="text" ></input>
</view> </view>
</view> </view>
<view class="fui-cell"> <view class="fui-cell">
<view class="fui-cell-label">所在城市</view> <view class="fui-cell-label">所在城市</view>
<view class="fui-cell-info"> <view class="fui-cell-info">
<input v-model="Form.citys" class="fui-input" placeholder="请输入您的所在地" value=""></input> <input v-model="Form.citys" class="fui-input" placeholder="请输入您的所在地" value=""></input>
</view> </view>
</view> </view>
<view class="fui-cell"> <view class="fui-cell">
<view class="fui-cell-label">备注</view> <view class="fui-cell-label">备注</view>
<view class="fui-cell-info"> <view class="fui-cell-info">
<input v-model="Form.remark" class="fui-input" placeholder="请输入备注" value=""></input> <input v-model="Form.remark" class="fui-input" placeholder="请输入备注" value=""></input>
</view> </view>
</view> </view>
</view> </view>
<view @click="submitform" class="fui-btn btn-danger block mtop">提交信息</view> <view @click="submitform" class="fui-btn btn-danger block mtop">提交信息</view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-from', name: 'diy-from',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
markers:[], markers:[],
Form:{ Form:{
realname:'', realname:'',
mobile:'', mobile:'',
mailbox:'', mailbox:'',
citys:'', citys:'',
remark:'', remark:'',
} }
}; };
}, },
created() { created() {
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
// this.getDataList(); // this.getDataList();
} }
}, },
computed: { computed: {
markerst(){ markerst(){
return [{ return [{
id:1, id:1,
latitude:this.value.list[0].lat, latitude:this.value.list[0].lat,
longitude:this.value.list[0].lng longitude:this.value.list[0].lng
}] }]
}, },
style() { style() {
var css = ''; var css = '';
css += 'background-color:' + this.value.contentBgColor + ';'; css += 'background-color:' + this.value.contentBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
return css; return css;
} }
}, },
methods: { methods: {
submitform(){ submitform(){
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/member/information', url: '/api/member/information',
data: this.Form, data: this.Form,
success: res => { success: res => {
this.$util.showToast({ this.$util.showToast({
title: res.message title: res.message
}); });
} }
}); });
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.diy-from{ .diy-from{
background: #fff; background: #fff;
padding-bottom: 20rpx; padding-bottom: 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
</style> </style>

View File

@@ -1,158 +1,158 @@
<template> <template>
<x-skeleton type="waterfall" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-goods-brand" type="waterfall" :loading="loading" :configs="skeletonConfig">
<view :class="['brand-wrap', value.ornament.type]" :style="warpCss"> <view :class="['brand-wrap', value.ornament.type]" :style="warpCss">
<view :class="[value.style]"> <view :class="[value.style]">
<view class="title-wrap" v-show="value.title" :style="{ color: value.textColor, fontWeight: value.fontWeight ? 'bold' : '' }">{{ value.title }} <view class="title-wrap" v-show="value.title" :style="{ color: value.textColor, fontWeight: value.fontWeight ? 'bold' : '' }">{{ value.title }}
</view> </view>
<view class="ul-wrap"> <view class="ul-wrap">
<view class="li-item" v-for="(item, index) in list" :key="index"> <view class="li-item" v-for="(item, index) in list" :key="index">
<image class="brand-pic" :src="$util.img(item.image_url)" mode="aspectFit" @click="toDetail(item)" @error="imgError(index)" :style="itemCss"/> <image class="brand-pic" :src="$util.img(item.image_url)" mode="aspectFit" @click="toDetail(item)" @error="imgError(index)" :style="itemCss"/>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
// 商品品牌 // 商品品牌
import uniGrid from '@/components/uni-grid/uni-grid.vue'; import uniGrid from '@/components/uni-grid/uni-grid.vue';
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue'; import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
export default { export default {
name: 'diy-goods-brand', name: 'diy-goods-brand',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
components: { components: {
uniGrid, uniGrid,
uniGridItem uniGridItem
}, },
data() { data() {
return { return {
list: [], list: [],
loading: true, loading: true,
skeletonConfig: { skeletonConfig: {
gridRows: 2, gridRows: 2,
gridColumns: 4, gridColumns: 4,
gridRowsGap: '20rpx', gridRowsGap: '20rpx',
headWidth: '120rpx', headWidth: '120rpx',
headHeight: '120rpx', headHeight: '120rpx',
textShow: false textShow: false
} }
}; };
}, },
created() { created() {
this.getBrandList(); this.getBrandList();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getBrandList(); this.getBrandList();
} }
}, },
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
if (this.value.ornament.type == 'shadow') { if (this.value.ornament.type == 'shadow') {
obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color; obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color;
} }
if (this.value.ornament.type == 'stroke') { if (this.value.ornament.type == 'stroke') {
obj += 'border:' + '2rpx solid ' + this.value.ornament.color; obj += 'border:' + '2rpx solid ' + this.value.ornament.color;
} }
return obj; return obj;
}, },
// 子项样式 // 子项样式
itemCss() { itemCss() {
var obj = ''; var obj = '';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: { methods: {
getBrandList() { getBrandList() {
var data = { var data = {
page: 1, page: 1,
page_size: this.value.count page_size: this.value.count
}; };
if (this.value.sources == 'diy') { if (this.value.sources == 'diy') {
data.page_size = 0; data.page_size = 0;
data.brand_id_arr = this.value.brandIds.toString(); data.brand_id_arr = this.value.brandIds.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/goodsbrand/page', url: '/api/goodsbrand/page',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
let data = res.data; let data = res.data;
this.list = data.list; this.list = data.list;
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
toDetail(item) { toDetail(item) {
this.$util.redirectTo('/pages/goods/list', { this.$util.redirectTo('/pages/goods/list', {
brand_id: item.brand_id brand_id: item.brand_id
}); });
}, },
imgError(index) { imgError(index) {
if (this.list[index]) this.list[index].image_url = this.$util.getDefaultImage().goods; if (this.list[index]) this.list[index].image_url = this.$util.getDefaultImage().goods;
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.brand-wrap { .brand-wrap {
&.shadow { &.shadow {
margin-left: 8rpx; margin-left: 8rpx;
margin-right: 8rpx; margin-right: 8rpx;
margin-top: 8rpx; margin-top: 8rpx;
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
.style-1 { .style-1 {
.title-wrap { .title-wrap {
text-align: center; text-align: center;
padding: 20rpx 0 10rpx; padding: 20rpx 0 10rpx;
} }
.ul-wrap { .ul-wrap {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 20rpx; padding: 20rpx;
.li-item { .li-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: calc(100% / 4 - 20rpx) !important; width: calc(100% / 4 - 20rpx) !important;
height: 124rpx; height: 124rpx;
margin: 10rpx; margin: 10rpx;
background-color: #fff; background-color: #fff;
.brand-pic { .brand-pic {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
} }
} }
} }
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,304 +1,304 @@
<template> <template>
<view :style="componentStyle"> <view data-component-name="diy-graphic-nav" :style="componentStyle">
<block v-if="value.showStyle == 'pageSlide'"> <block v-if="value.showStyle == 'pageSlide'">
<swiper :class="['graphic-nav', 'pageSlide', value.carousel.type]" circular :indicator-dots="false" :style="swiperHeight" @change="swiperChange"> <swiper :class="['graphic-nav', 'pageSlide', value.carousel.type]" circular :indicator-dots="false" :style="swiperHeight" @change="swiperChange">
<swiper-item class="graphic-nav-wrap" <swiper-item class="graphic-nav-wrap"
v-for="(numItem, numIndex) in Math.ceil(value.list.length / (value.pageCount * value.rowCount))"> v-for="(numItem, numIndex) in Math.ceil(value.list.length / (value.pageCount * value.rowCount))">
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view class="graphic-nav-item" :class="[value.mode]" v-for="(item, index) in value.list" <view class="graphic-nav-item" :class="[value.mode]" v-for="(item, index) in value.list"
:key="index" :key="index"
v-if="index >= [(numItem) * (value.pageCount * value.rowCount)] && index < [(numItem+1) * (value.pageCount * value.rowCount)]" v-if="index >= [(numItem) * (value.pageCount * value.rowCount)] && index < [(numItem+1) * (value.pageCount * value.rowCount)]"
:style="{ width: 100 / value.rowCount + '%' }" @click="redirectTo(item.link)"> :style="{ width: 100 / value.rowCount + '%' }" @click="redirectTo(item.link)">
<!-- #endif --> <!-- #endif -->
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<view class="graphic-nav-item" :class="[value.mode]" v-for="(item, index) in value.list" <view class="graphic-nav-item" :class="[value.mode]" v-for="(item, index) in value.list"
:key="index" :key="index"
v-if="index >= [(numItem - 1) * (value.pageCount * value.rowCount)] && index < [numItem * (value.pageCount * value.rowCount)]" v-if="index >= [(numItem - 1) * (value.pageCount * value.rowCount)] && index < [numItem * (value.pageCount * value.rowCount)]"
:style="{ width: 100 / value.rowCount + '%' }" @click="redirectTo(item.link)"> :style="{ width: 100 / value.rowCount + '%' }" @click="redirectTo(item.link)">
<!-- #endif --> <!-- #endif -->
<view class="graphic-img" v-if="value.mode != 'text'" <view class="graphic-img" v-if="value.mode != 'text'"
:style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }"> :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }">
<image v-if="item.iconType == 'img'" <image v-if="item.iconType == 'img'"
:src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')" :src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')"
mode="aspectFill" mode="aspectFill"
:style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', borderRadius: value.aroundRadius * 2 + 'rpx' }" :style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', borderRadius: value.aroundRadius * 2 + 'rpx' }"
:show-menu-by-longpress="true"/> :show-menu-by-longpress="true"/>
<diy-icon v-if="item.iconType == 'icon'" :icon="item.icon" <diy-icon v-if="item.iconType == 'icon'" :icon="item.icon"
:value="item.style ? item.style : null" :value="item.style ? item.style : null"
:style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon> :style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon>
<text class="tag" v-if="item.label.control" <text class="tag" v-if="item.label.control"
:style="{ color: item.label.textColor, backgroundImage: 'linear-gradient(' + item.label.bgColorStart + ',' + item.label.bgColorEnd + ')' }"> :style="{ color: item.label.textColor, backgroundImage: 'linear-gradient(' + item.label.bgColorStart + ',' + item.label.bgColorEnd + ')' }">
{{ item.label.text }} {{ item.label.text }}
</text> </text>
</view> </view>
<text v-if="value.mode != 'img'" class="graphic-text" <text v-if="value.mode != 'img'" class="graphic-text"
:style="{ fontSize: value.font.size * 2 + 'rpx', fontWeight: value.font.weight, color: value.font.color }"> :style="{ fontSize: value.font.size * 2 + 'rpx', fontWeight: value.font.weight, color: value.font.color }">
{{ item.title }} {{ item.title }}
</text> </text>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="swiper-dot-box" v-if="isIndicatorDots" :class="value.carousel.type"> <view class="swiper-dot-box" v-if="isIndicatorDots" :class="value.carousel.type">
<view v-for="(numItem, numIndex) in Math.ceil(value.list.length / (value.pageCount * value.rowCount))" :key="numIndex"> <view v-for="(numItem, numIndex) in Math.ceil(value.list.length / (value.pageCount * value.rowCount))" :key="numIndex">
<view class="swiper-dot" :class="{'active':numIndex==swiperCurrent}"></view> <view class="swiper-dot" :class="{'active':numIndex==swiperCurrent}"></view>
</view> </view>
</view> </view>
</block> </block>
<scroll-view v-else :scroll-x="value.showStyle == 'singleSlide'" :class="['graphic-nav', value.showStyle == 'fixed' ? 'fixed-layout' : value.showStyle ]"> <scroll-view v-else :scroll-x="value.showStyle == 'singleSlide'" :class="['graphic-nav', value.showStyle == 'fixed' ? 'fixed-layout' : value.showStyle ]">
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view class="uni-scroll-view-content"> <view class="uni-scroll-view-content">
<!-- #endif --> <!-- #endif -->
<view class="graphic-nav-item" :class="[value.mode]" v-for="(item, index) in value.list" :key="index" :style="{ width: 100 / value.rowCount + '%' }" @click="redirectTo(item.link)"> <view class="graphic-nav-item" :class="[value.mode]" v-for="(item, index) in value.list" :key="index" :style="{ width: 100 / value.rowCount + '%' }" @click="redirectTo(item.link)">
<view class="graphic-img" v-if="value.mode != 'text'" :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }"> <view class="graphic-img" v-if="value.mode != 'text'" :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }">
<image v-if="item.iconType == 'img'" <image v-if="item.iconType == 'img'"
:src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')" :src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')"
mode="aspectFill" mode="aspectFill"
:style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', borderRadius: value.aroundRadius * 2 + 'rpx' }" :style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', borderRadius: value.aroundRadius * 2 + 'rpx' }"
:show-menu-by-longpress="true"/> :show-menu-by-longpress="true"/>
<diy-icon v-if="item.iconType == 'icon'" :icon="item.icon" <diy-icon v-if="item.iconType == 'icon'" :icon="item.icon"
:value="item.style ? item.style : null" :value="item.style ? item.style : null"
:style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon> :style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon>
<text :class="['tag', { alone: value.mode == 'text' }]" v-if="item.label.control" <text :class="['tag', { alone: value.mode == 'text' }]" v-if="item.label.control"
:style="{ color: item.label.textColor, backgroundImage: 'linear-gradient(' + item.label.bgColorStart + ',' + item.label.bgColorEnd + ')' }"> :style="{ color: item.label.textColor, backgroundImage: 'linear-gradient(' + item.label.bgColorStart + ',' + item.label.bgColorEnd + ')' }">
{{ item.label.text }} {{ item.label.text }}
</text> </text>
</view> </view>
<text v-if="value.mode != 'img'" class="graphic-text" :style="{ fontSize: value.font.size * 2 + 'rpx', fontWeight: value.font.weight, color: value.font.color }"> <text v-if="value.mode != 'img'" class="graphic-text" :style="{ fontSize: value.font.size * 2 + 'rpx', fontWeight: value.font.weight, color: value.font.color }">
{{ item.title }} {{ item.title }}
</text> </text>
</view> </view>
<!-- #ifdef MP --> <!-- #ifdef MP -->
</view> </view>
<!-- #endif --> <!-- #endif -->
</scroll-view> </scroll-view>
<ns-login ref="login"></ns-login> <ns-login ref="login"></ns-login>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-graphic-nav', name: 'diy-graphic-nav',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
pageWidth: '', pageWidth: '',
indicatorDots: false, indicatorDots: false,
swiperCurrent: 0 swiperCurrent: 0
}; };
}, },
created() {}, created() {},
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
componentStyle() { componentStyle() {
var css = ''; var css = '';
css += 'background-color:' + this.value.componentBgColor + ';'; css += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
css += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament css += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament
.color : .color :
'') + ';'; '') + ';';
css += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : css += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color :
'') + ';'; '') + ';';
return css; return css;
}, },
// 滑块容器的高度 // 滑块容器的高度
swiperHeight() { swiperHeight() {
var css = ''; var css = '';
var height = 0; var height = 0;
if (this.value.mode == 'graphic') { if (this.value.mode == 'graphic') {
height = (21 + 6 + 14 + 8 + this.value.imageSize) * this.value height = (21 + 6 + 14 + 8 + this.value.imageSize) * this.value
.pageCount; // 21 = 文字高度8 = 文字上边距14 = 上下内边距8 = 外边距 .pageCount; // 21 = 文字高度8 = 文字上边距14 = 上下内边距8 = 外边距
} else if (this.value.mode == 'img') { } else if (this.value.mode == 'img') {
height = (14 + 8 + this.value.imageSize) * this.value.pageCount; // 14 = 上下内边距8 = 外边距 height = (14 + 8 + this.value.imageSize) * this.value.pageCount; // 14 = 上下内边距8 = 外边距
} else if (this.value.mode == 'text') { } else if (this.value.mode == 'text') {
height = (21 + 14 + 8) * this.value.pageCount; // 21 = 文字高度14 = 上下内边距8 = 外边距 height = (21 + 14 + 8) * this.value.pageCount; // 21 = 文字高度14 = 上下内边距8 = 外边距
} }
css += 'height:' + height * 2 + 'rpx'; css += 'height:' + height * 2 + 'rpx';
return css; return css;
}, },
// 是否显示轮播点 // 是否显示轮播点
isIndicatorDots() { isIndicatorDots() {
var bool = true; var bool = true;
bool = this.value.carousel.type == 'hide' || Math.ceil(this.value.list.length / (this.value.pageCount * this.value.rowCount)) == 1 ? false : true; bool = this.value.carousel.type == 'hide' || Math.ceil(this.value.list.length / (this.value.pageCount * this.value.rowCount)) == 1 ? false : true;
return bool; return bool;
} }
}, },
methods: { methods: {
redirectTo(link) { redirectTo(link) {
if (link.wap_url) { if (link.wap_url) {
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) { if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
this.$refs.login.open(link.wap_url); this.$refs.login.open(link.wap_url);
return; return;
} }
} }
console.log(link) console.log(link)
this.$util.diyRedirectTo(link); this.$util.diyRedirectTo(link);
}, },
swiperChange(e) { swiperChange(e) {
this.swiperCurrent = e.detail.current this.swiperCurrent = e.detail.current
} }
} }
}; };
</script> </script>
<style> <style>
/* 固定显示 */ /* 固定显示 */
.graphic-nav.fixed-layout>>>.uni-scroll-view-content { .graphic-nav.fixed-layout>>>.uni-scroll-view-content {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
/* 单行滑动 */ /* 单行滑动 */
.graphic-nav.singleSlide>>>.uni-scroll-view-content { .graphic-nav.singleSlide>>>.uni-scroll-view-content {
display: flex; display: flex;
} }
.graphic-nav.pageSlide>>>.uni-swiper-dots-horizontal { .graphic-nav.pageSlide>>>.uni-swiper-dots-horizontal {
bottom: 0rpx; bottom: 0rpx;
} }
.graphic-nav.pageSlide.straightLine>>>.uni-swiper-dot { .graphic-nav.pageSlide.straightLine>>>.uni-swiper-dot {
width: 30rpx; width: 30rpx;
border-radius: 0; border-radius: 0;
height: 8rpx; height: 8rpx;
} }
.graphic-nav.pageSlide.circle>>>.uni-swiper-dot { .graphic-nav.pageSlide.circle>>>.uni-swiper-dot {
width: 14rpx; width: 14rpx;
height: 14rpx; height: 14rpx;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.graphic-nav { .graphic-nav {
padding: 16rpx; padding: 16rpx;
box-sizing: border-box; box-sizing: border-box;
&.singleSlide { &.singleSlide {
.graphic-nav-item { .graphic-nav-item {
flex-shrink: 0; flex-shrink: 0;
} }
} }
&.pageSlide { &.pageSlide {
position: relative; position: relative;
.graphic-nav-wrap { .graphic-nav-wrap {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.graphic-nav-item { .graphic-nav-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 14rpx 0; padding: 14rpx 0;
box-sizing: border-box; box-sizing: border-box;
.graphic-text { .graphic-text {
padding-top: 12rpx; padding-top: 12rpx;
line-height: 1.5; line-height: 1.5;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
text-align: center; text-align: center;
&.alone { &.alone {
padding-top: 0; padding-top: 0;
} }
} }
&.text { &.text {
.graphic-text { .graphic-text {
padding-top: 0; padding-top: 0;
} }
} }
.graphic-img { .graphic-img {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
font-size: 90rpx; font-size: 90rpx;
.tag { .tag {
position: absolute; position: absolute;
top: -10rpx; top: -10rpx;
right: -24rpx; right: -24rpx;
color: #fff; color: #fff;
border-radius: 24rpx; border-radius: 24rpx;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
transform: scale(0.8); transform: scale(0.8);
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
line-height: 1; line-height: 1;
font-size: 24rpx; font-size: 24rpx;
} }
.icon { .icon {
font-size: 50rpx; font-size: 50rpx;
color: $color-sub; color: $color-sub;
} }
} }
} }
} }
.swiper-dot-box { .swiper-dot-box {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: -20rpx; margin-top: -20rpx;
padding-bottom: 8rpx; padding-bottom: 8rpx;
.swiper-dot { .swiper-dot {
background-color: rgba(0, 0, 0, .3); background-color: rgba(0, 0, 0, .3);
margin: 8rpx; margin: 8rpx;
&.active { &.active {
background-color: rgba(0, 0, 0, 1); background-color: rgba(0, 0, 0, 1);
} }
} }
&.straightLine { &.straightLine {
.swiper-dot { .swiper-dot {
width: 30rpx; width: 30rpx;
border-radius: 0; border-radius: 0;
height: 8rpx; height: 8rpx;
} }
} }
&.circle { &.circle {
.swiper-dot { .swiper-dot {
width: 15rpx; width: 15rpx;
border-radius: 50%; border-radius: 50%;
height: 15rpx; height: 15rpx;
} }
} }
} }
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="diy-group"> <view data-component-name="diy-group" class="diy-group">
<view v-for="(item, index) in diyDataArray" :key="index" :style="item.pageStyle"> <view v-for="(item, index) in diyDataArray" :key="index" :style="item.pageStyle">
<view v-if="addonIsExist.store && item.componentName == 'StoreShow'"> <view v-if="addonIsExist.store && item.componentName == 'StoreShow'">
<!-- 门店展示 --> <!-- 门店展示 -->

View File

@@ -1,462 +1,462 @@
<template> <template>
<x-skeleton :type="skeletonType" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-groupbuy" :type="skeletonType" :loading="loading" :configs="skeletonConfig">
<view class="diy-groupbuy" :class="[value.template, value.style]" :style="warpCss"> <view class="diy-groupbuy" :class="[value.template, value.style]" :style="warpCss">
<template v-if="value.template == 'row1-of1'"> <template v-if="value.template == 'row1-of1'">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" <view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)"
:class="[value.ornament.type]" :style="goodsItemCss"> :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)">
</image> </image>
</view> </view>
<view class="content" <view class="content"
v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl || value.btnStyle.control"> v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl || value.btnStyle.control">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"> :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]">
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
<view class="discount-price" v-if="value.priceStyle.mainControl"> <view class="discount-price" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ item.groupbuy_price.split('.')[0] }}</text> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ item.groupbuy_price.split('.')[0] }}</text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ '.' + item.groupbuy_price.split('.')[1] }}</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ '.' + item.groupbuy_price.split('.')[1] }}</text>
</view> </view>
<button v-if="value.btnStyle.control" :style="{ <button v-if="value.btnStyle.control" :style="{
background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '', background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '',
color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '', color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '',
borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx' borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx'
}"> }">
{{ value.btnStyle.text }} {{ value.btnStyle.text }}
</button> </button>
</view> </view>
</view> </view>
</template> </template>
<template v-if="value.template == 'horizontal-slide'"> <template v-if="value.template == 'horizontal-slide'">
<scroll-view v-if="value.slideMode == 'scroll'" class="scroll" :scroll-x="true" :show-scrollbar="false"> <scroll-view v-if="value.slideMode == 'scroll'" class="scroll" :scroll-x="true" :show-scrollbar="false">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/>
<image class="bg" v-if="value.saleStyle.control" :src="$util.img('public/uniapp/groupbuy/bg.png')" mode="widthFix"/> <image class="bg" v-if="value.saleStyle.control" :src="$util.img('public/uniapp/groupbuy/bg.png')" mode="widthFix"/>
<view class="num" v-if="value.saleStyle.control" :style="{ color: value.theme == 'diy' ? value.saleStyle.color : '' }"> <view class="num" v-if="value.saleStyle.control" :style="{ color: value.theme == 'diy' ? value.saleStyle.color : '' }">
已团{{ item.sell_num }} 已团{{ item.sell_num }}
</view> </view>
</view> </view>
<view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl"> <view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"> :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]">
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
<view class="discount-price" v-if="value.priceStyle.mainControl"> <view class="discount-price" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ item.groupbuy_price.split('.')[0] }}</text> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ item.groupbuy_price.split('.')[0] }}</text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ '.' + item.groupbuy_price.split('.')[1] }}</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ '.' + item.groupbuy_price.split('.')[1] }}</text>
</view> </view>
<view class="original-price price-font" v-if="value.priceStyle.lineControl" :style="{ color: value.theme == 'diy' ? value.priceStyle.lineColor : '' }">¥{{ item.price }}</view> <view class="original-price price-font" v-if="value.priceStyle.lineControl" :style="{ color: value.theme == 'diy' ? value.priceStyle.lineColor : '' }">¥{{ item.price }}</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<swiper v-if="value.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }"> <swiper v-if="value.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }">
<swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']"> <swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']">
<view class="item" v-for="(item, dataIndex) in list[pageIndex]" :key="dataIndex" <view class="item" v-for="(item, dataIndex) in list[pageIndex]" :key="dataIndex"
@click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(dataIndex)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(dataIndex)"/>
<image class="bg" v-if="value.saleStyle.control" :src="$util.img('public/uniapp/groupbuy/bg.png')" mode="widthFix"/> <image class="bg" v-if="value.saleStyle.control" :src="$util.img('public/uniapp/groupbuy/bg.png')" mode="widthFix"/>
<view class="num" v-if="value.saleStyle.control" :style="{ color: value.theme == 'diy' ? value.saleStyle.color : '' }">已团{{ item.sell_num }}</view> <view class="num" v-if="value.saleStyle.control" :style="{ color: value.theme == 'diy' ? value.saleStyle.color : '' }">已团{{ item.sell_num }}</view>
</view> </view>
<view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl"> <view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.priceStyle.lineControl">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"> :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]">
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
<view class="discount-price" v-if="value.priceStyle.mainControl"> <view class="discount-price" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ item.groupbuy_price.split('.')[0] }}</text> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ item.groupbuy_price.split('.')[0] }}</text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ '.' + item.groupbuy_price.split('.')[1] }}</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">{{ '.' + item.groupbuy_price.split('.')[1] }}</text>
</view> </view>
<view class="original-price price-font" v-if="value.priceStyle.lineControl" :style="{ color: value.theme == 'diy' ? value.priceStyle.lineColor : '' }">¥{{ item.price }}</view> <view class="original-price price-font" v-if="value.priceStyle.lineControl" :style="{ color: value.theme == 'diy' ? value.priceStyle.lineColor : '' }">¥{{ item.price }}</view>
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</template> </template>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-groupbuy', name: 'diy-groupbuy',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
skeletonType: '', skeletonType: '',
skeletonConfig: {}, skeletonConfig: {},
list: [], list: [],
page: 1 page: 1
}; };
}, },
created() { created() {
this.initSkeleton(); this.initSkeleton();
this.getData(); this.getData();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getData(); this.getData();
} }
}, },
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
}, },
// 商品项样式 // 商品项样式
goodsItemCss() { goodsItemCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.elementBgColor + ';'; obj += 'background-color:' + this.value.elementBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
if (this.value.ornament.type == 'shadow') { if (this.value.ornament.type == 'shadow') {
obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color + ';'; obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color + ';';
} }
if (this.value.ornament.type == 'stroke') { if (this.value.ornament.type == 'stroke') {
obj += 'border:' + '2rpx solid ' + this.value.ornament.color + ';'; obj += 'border:' + '2rpx solid ' + this.value.ornament.color + ';';
} }
const screenWidth = uni.getSystemInfoSync().windowWidth; const screenWidth = uni.getSystemInfoSync().windowWidth;
if (this.value.template == 'horizontal-slide') { if (this.value.template == 'horizontal-slide') {
var width = ''; var width = '';
if (this.value.slideMode == 'scroll' && this.value.goodsMarginType == 'diy') width = this.rpxUpPx(this if (this.value.slideMode == 'scroll' && this.value.goodsMarginType == 'diy') width = this.rpxUpPx(this
.value.goodsMarginNum * 2); .value.goodsMarginNum * 2);
else width = [screenWidth - this.rpxUpPx(20) * 2 - this.rpxUpPx(200) * 3 - this.rpxUpPx(this.value else width = [screenWidth - this.rpxUpPx(20) * 2 - this.rpxUpPx(200) * 3 - this.rpxUpPx(this.value
.margin.both * 2) * 2] / 6; .margin.both * 2) * 2] / 6;
obj += 'margin-left:' + width + 'px;'; obj += 'margin-left:' + width + 'px;';
obj += 'margin-right:' + width + 'px;'; obj += 'margin-right:' + width + 'px;';
} }
return obj; return obj;
}, },
swiperHeight() { swiperHeight() {
if (this.value.nameLineMode == 'multiple') return this.value.ornament.type == 'shadow' ? '404rpx' : if (this.value.nameLineMode == 'multiple') return this.value.ornament.type == 'shadow' ? '404rpx' :
'392rpx'; '392rpx';
return this.value.ornament.type == 'shadow' ? '376rpx' : '368rpx'; return this.value.ornament.type == 'shadow' ? '376rpx' : '368rpx';
} }
}, },
methods: { methods: {
initSkeleton() { initSkeleton() {
if (this.value.template == 'row1-of1') { if (this.value.template == 'row1-of1') {
// 单列 风格 // 单列 风格
this.skeletonType = 'list'; this.skeletonType = 'list';
this.skeletonConfig = { this.skeletonConfig = {
textRows: 2 textRows: 2
}; };
} else if (this.value.template == 'horizontal-slide') { } else if (this.value.template == 'horizontal-slide') {
// 横向滑动 风格 // 横向滑动 风格
this.skeletonType = 'waterfall'; this.skeletonType = 'waterfall';
this.skeletonConfig = { this.skeletonConfig = {
gridRows: 1, gridRows: 1,
gridColumns: 3, gridColumns: 3,
headHeight: '200rpx', headHeight: '200rpx',
textRows: 2, textRows: 2,
textWidth: ['100%', '80%'] textWidth: ['100%', '80%']
}; };
} }
}, },
rpxUpPx(res) { rpxUpPx(res) {
const screenWidth = uni.getSystemInfoSync().windowWidth; const screenWidth = uni.getSystemInfoSync().windowWidth;
var data = (screenWidth * parseInt(res)) / 750; var data = (screenWidth * parseInt(res)) / 750;
return Math.floor(data); return Math.floor(data);
}, },
getData() { getData() {
var data = { var data = {
num: this.value.count num: this.value.count
}; };
if (this.value.sources == 'diy') { if (this.value.sources == 'diy') {
data.num = 0; data.num = 0;
data.goods_id_arr = this.value.goodsId.toString(); data.goods_id_arr = this.value.goodsId.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/groupbuy/api/goods/lists', url: '/groupbuy/api/goods/lists',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
// 切屏滚动,每页显示固定数量 // 切屏滚动,每页显示固定数量
if (this.value.template == 'horizontal-slide' && this.value.slideMode == 'slide') { if (this.value.template == 'horizontal-slide' && this.value.slideMode == 'slide') {
let size = 3; let size = 3;
let temp = []; let temp = [];
this.page = Math.ceil(this.list.length / size); this.page = Math.ceil(this.list.length / size);
for (var i = 0; i < this.page; i++) { for (var i = 0; i < this.page; i++) {
temp[i] = []; temp[i] = [];
for (var j = i * size; j < this.list.length; j++) { for (var j = i * size; j < this.list.length; j++) {
if (temp[i].length == size) break; if (temp[i].length == size) break;
temp[i].push(this.list[j]); temp[i].push(this.list[j]);
} }
} }
this.list = temp; this.list = temp;
} }
this.loading = false; this.loading = false;
} }
} }
}); });
}, },
toDetail(e) { toDetail(e) {
this.$util.redirectTo('/pages_promotion/groupbuy/detail', { this.$util.redirectTo('/pages_promotion/groupbuy/detail', {
groupbuy_id: e.groupbuy_id groupbuy_id: e.groupbuy_id
}); });
}, },
imageError(index) { imageError(index) {
this.list[index].goods_image = this.$util.getDefaultImage().goods; this.list[index].goods_image = this.$util.getDefaultImage().goods;
this.$forceUpdate(); this.$forceUpdate();
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
/deep/.uni-scroll-view ::-webkit-scrollbar { /deep/.uni-scroll-view ::-webkit-scrollbar {
/* 隐藏滚动条,但依旧具备可以滚动的功能 */ /* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none; display: none;
width: 0; width: 0;
height: 0; height: 0;
color: transparent; color: transparent;
background: transparent; background: transparent;
} }
/deep/::-webkit-scrollbar { /deep/::-webkit-scrollbar {
display: none; display: none;
width: 0; width: 0;
height: 0; height: 0;
color: transparent; color: transparent;
background: transparent; background: transparent;
} }
scroll-view ::-webkit-scrollbar { scroll-view ::-webkit-scrollbar {
width: 0; width: 0;
height: 0; height: 0;
background-color: transparent; background-color: transparent;
touch-action: none; touch-action: none;
} }
.diy-groupbuy { .diy-groupbuy {
&.row1-of1 { &.row1-of1 {
.item { .item {
display: flex; display: flex;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 16rpx; padding: 16rpx;
&.shadow { &.shadow {
margin: 8rpx 8rpx 20rpx 8rpx; margin: 8rpx 8rpx 20rpx 8rpx;
} }
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.img-wrap { .img-wrap {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
>image { >image {
width: 200rpx; width: 200rpx;
} }
} }
.goods-name { .goods-name {
margin-top: 6rpx; margin-top: 6rpx;
line-height: 1.5; line-height: 1.5;
} }
.content { .content {
flex: 1; flex: 1;
margin-left: 20rpx; margin-left: 20rpx;
position: relative; position: relative;
.discount-price { .discount-price {
white-space: nowrap; white-space: nowrap;
font-weight: bold; font-weight: bold;
position: absolute; position: absolute;
bottom: 20rpx; bottom: 20rpx;
left: 0; left: 0;
display: flex; display: flex;
align-items: baseline; align-items: baseline;
line-height: 1; line-height: 1;
.unit { .unit {
font-size: $font-size-tag; font-size: $font-size-tag;
margin-right: 4rpx; margin-right: 4rpx;
color: $base-color; color: $base-color;
} }
.price { .price {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
color: $base-color; color: $base-color;
} }
} }
button { button {
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
right: 20rpx; right: 20rpx;
margin: 0; margin: 0;
padding: 0 20rpx; padding: 0 20rpx;
background-color: $base-color; background-color: $base-color;
color: #fff; color: #fff;
min-width: 112rpx; min-width: 112rpx;
height: 52rpx; height: 52rpx;
line-height: 52rpx; line-height: 52rpx;
font-size: $font-size-tag; font-size: $font-size-tag;
} }
} }
} }
} }
&.horizontal-slide { &.horizontal-slide {
.scroll { .scroll {
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
padding: 20rpx; padding: 20rpx;
line-height: 1; line-height: 1;
white-space: nowrap; white-space: nowrap;
.item.shadow { .item.shadow {
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
} }
.flex-between { .flex-between {
justify-content: space-between; justify-content: space-between;
} }
.item { .item {
display: inline-block; display: inline-block;
width: 200rpx; width: 200rpx;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
&:nth-child(3n + 3) { &:nth-child(3n + 3) {
width: 198rpx; width: 198rpx;
} }
&.shadow { &.shadow {
margin-top: 8rpx; margin-top: 8rpx;
} }
.img-wrap { .img-wrap {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
margin: 0 auto; margin: 0 auto;
>image { >image {
width: 200rpx; width: 200rpx;
} }
.bg { .bg {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 60rpx; height: 60rpx;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 2; z-index: 2;
} }
.num { .num {
width: 180rpx; width: 180rpx;
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
padding-left: 20rpx; padding-left: 20rpx;
font-size: 20rpx; font-size: 20rpx;
line-height: 1; line-height: 1;
color: #ffffff; color: #ffffff;
z-index: 3; z-index: 3;
} }
} }
.content { .content {
padding: 10rpx; padding: 10rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
&.multi-content { &.multi-content {
height: 158rpx; height: 158rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.goods-name { .goods-name {
line-height: 1.3; line-height: 1.3;
&.multi-hidden { &.multi-hidden {
white-space: break-spaces; white-space: break-spaces;
} }
} }
.discount-price { .discount-price {
white-space: nowrap; white-space: nowrap;
margin-top: auto; margin-top: auto;
font-weight: bold; font-weight: bold;
line-height: 1; line-height: 1;
.unit { .unit {
font-size: $font-size-tag; font-size: $font-size-tag;
margin-right: 4rpx; margin-right: 4rpx;
color: $base-color; color: $base-color;
} }
.price { .price {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
color: $base-color; color: $base-color;
} }
} }
.original-price { .original-price {
font-size: $font-size-tag; font-size: $font-size-tag;
color: $color-tip; color: $color-tip;
line-height: 1; line-height: 1;
text-decoration: line-through; text-decoration: line-through;
} }
} }
} }
.swiper { .swiper {
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
padding: 20rpx; padding: 20rpx;
box-sizing: border-box; box-sizing: border-box;
.swiper-item { .swiper-item {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.item { .item {
width: 200rpx; width: 200rpx;
} }
} }
} }
} }
</style> </style>

View File

@@ -1,40 +1,40 @@
<template> <template>
<view :style="horzBlankGaugeWrap"></view> <view data-component-name="diy-horz-blank" :style="horzBlankGaugeWrap"></view>
</template> </template>
<script> <script>
// 辅助空白 // 辅助空白
export default { export default {
name: 'diy-horz-blank', name: 'diy-horz-blank',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
horzBlankGaugeWrap: function() { horzBlankGaugeWrap: function() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
obj += 'height:' + this.value.height * 2 + 'rpx'; obj += 'height:' + this.value.height * 2 + 'rpx';
return obj; return obj;
} }
}, },
created() {}, created() {},
methods: {} methods: {}
}; };
</script> </script>
<style></style> <style></style>

View File

@@ -1,25 +1,25 @@
<template> <template>
<view :style="{ borderTop: '2rpx ' + value.borderStyle + ' ' + value.color }"></view> <view data-component-name="diy-horz-line" :style="{ borderTop: '2rpx ' + value.borderStyle + ' ' + value.color }"></view>
</template> </template>
<script> <script>
// 辅助线 // 辅助线
export default { export default {
name: 'diy-horz-line', name: 'diy-horz-line',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
methods: {} methods: {}
}; };
</script> </script>
<style></style> <style></style>

View File

@@ -1,73 +1,73 @@
<template> <template>
<view :style="hotAreaWarp" class="hot-area-box"> <view data-component-name="diy-hot-area" :style="hotAreaWarp" class="hot-area-box">
<view class="simple-graph-wrap"> <view class="simple-graph-wrap">
<image :style="{ height: value.imgHeight }" :src="$util.img(value.imageUrl)" mode="widthFix" :show-menu-by-longpress="true"/> <image :style="{ height: value.imgHeight }" :src="$util.img(value.imageUrl)" mode="widthFix" :show-menu-by-longpress="true"/>
<!-- 热区功能 --> <!-- 热区功能 -->
<view class="heat-map" v-for="(mapItem, mapIndex) in value.heatMapData" :key="mapIndex" :style="{ <view class="heat-map" v-for="(mapItem, mapIndex) in value.heatMapData" :key="mapIndex" :style="{
width: mapItem.width + '%', width: mapItem.width + '%',
height: mapItem.height + '%', height: mapItem.height + '%',
left: mapItem.left + '%', left: mapItem.left + '%',
top: mapItem.top + '%' top: mapItem.top + '%'
}" @click.stop="$util.diyRedirectTo(mapItem.link)"></view> }" @click.stop="$util.diyRedirectTo(mapItem.link)"></view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-hot-area', name: 'diy-hot-area',
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
} }
}, },
data() { data() {
return {}; return {};
}, },
created() {}, created() {},
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
hotAreaWarp: function() { hotAreaWarp: function() {
var obj = ''; var obj = '';
obj = 'background-color:' + this.value.componentBgColor + ';'; obj = 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: {} methods: {}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.hot-area-box { .hot-area-box {
position: relative; position: relative;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
} }
.simple-graph-wrap { .simple-graph-wrap {
line-height: 0; line-height: 0;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
image { image {
width: 100%; width: 100%;
} }
.heat-map { .heat-map {
position: absolute; position: absolute;
} }
} }
</style> </style>

View File

@@ -1,84 +1,84 @@
<template> <template>
<view class="diy-icon" :style="iconBgStyle"> <view data-component-name="diy-icon" class="diy-icon" :style="iconBgStyle">
<text class="js-icon" :class="iconClass" :style="iconStyle"></text> <text class="js-icon" :class="iconClass" :style="iconStyle"></text>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-icon', name: 'diy-icon',
props: { props: {
icon: { icon: {
type: String, type: String,
default: '' default: ''
}, },
value: { value: {
type: Object, type: Object,
default: function () { default: function () {
return null; return null;
} }
} }
}, },
computed: { computed: {
iconClass(){ iconClass(){
var _class = ' ' + this.icon; var _class = ' ' + this.icon;
if (this.value && this.value.iconColor.length > 1) _class += ' gradient'; if (this.value && this.value.iconColor.length > 1) _class += ' gradient';
return _class; return _class;
}, },
iconBgStyle(){ iconBgStyle(){
if (!this.value) return {}; if (!this.value) return {};
var style = { var style = {
'border-radius': this.value.bgRadius + '%', 'border-radius': this.value.bgRadius + '%',
'background': '' 'background': ''
}; };
if (this.value.iconBgImg) style['background'] += 'url('+ this.$util.img(this.value.iconBgImg) +') no-repeat bottom / contain' if (this.value.iconBgImg) style['background'] += 'url('+ this.$util.img(this.value.iconBgImg) +') no-repeat bottom / contain'
if (this.value.iconBgColor.length) { if (this.value.iconBgColor.length) {
if (style.background) style.background += ','; if (style.background) style.background += ',';
if (this.value.iconBgColor.length == 1) { if (this.value.iconBgColor.length == 1) {
style.background += this.value.iconBgColor[0]; style.background += this.value.iconBgColor[0];
} else { } else {
style['background'] += 'linear-gradient('+ this.value.iconBgColorDeg +'deg, '+ this.value.iconBgColor.join(',') +')'; style['background'] += 'linear-gradient('+ this.value.iconBgColorDeg +'deg, '+ this.value.iconBgColor.join(',') +')';
} }
} }
return this.$util.objToStyle(style); return this.$util.objToStyle(style);
}, },
iconStyle(){ iconStyle(){
if (!this.value) return {}; if (!this.value) return {};
var style = { var style = {
'font-size': this.value.fontSize + '%' 'font-size': this.value.fontSize + '%'
} }
if (this.value.iconColor.length == 1) { if (this.value.iconColor.length == 1) {
style.color = this.value.iconColor[0]; style.color = this.value.iconColor[0];
} else { } else {
style['background'] = 'linear-gradient('+ this.value.iconColorDeg +'deg, '+ this.value.iconColor.join(',') +')'; style['background'] = 'linear-gradient('+ this.value.iconColorDeg +'deg, '+ this.value.iconColor.join(',') +')';
} }
return this.$util.objToStyle(style); return this.$util.objToStyle(style);
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.diy-icon { .diy-icon {
width: 100%; width: 100%;
height: 100%; height: 100%;
font-size: 100%; font-size: 100%;
color: #000; color: #000;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.js-icon { .js-icon {
font-size: 50%; font-size: 50%;
line-height:1; line-height:1;
padding: 1rpx; padding: 1rpx;
&.gradient { &.gradient {
-webkit-background-clip:text!important; -webkit-background-clip:text!important;
-webkit-text-fill-color:transparent; -webkit-text-fill-color:transparent;
} }
} }
} }
</style> </style>

View File

@@ -1,301 +1,301 @@
<template> <template>
<view class="single-graph"> <view data-component-name="diy-img-ads" class="single-graph">
<view :style="imgAdsMarginWarp" class="swiper-box"> <view :style="imgAdsMarginWarp" class="swiper-box">
<block v-if="imgAdsValue.list.length == 1"> <block v-if="imgAdsValue.list.length == 1">
<view class="simple-graph-wrap" :style="imgAdsSwiper" @click="$util.diyRedirectTo(imgAdsValue.list[0].link)"> <view class="simple-graph-wrap" :style="imgAdsSwiper" @click="$util.diyRedirectTo(imgAdsValue.list[0].link)">
<image :style="{ height: imgAdsValue.list[0].imgHeight }" :src="$util.img(imgAdsValue.list[0].imageUrl)" mode="widthFix" :show-menu-by-longpress="true"/> <image :style="{ height: imgAdsValue.list[0].imgHeight }" :src="$util.img(imgAdsValue.list[0].imageUrl)" mode="widthFix" :show-menu-by-longpress="true"/>
</view> </view>
</block> </block>
<swiper v-else class="swiper" :style="{ height: swiperHeight }" :class="{ <swiper v-else class="swiper" :style="{ height: swiperHeight }" :class="{
'swiper-left': imgAdsValue.indicatorLocation == 'left', 'swiper-left': imgAdsValue.indicatorLocation == 'left',
'swiper-right': imgAdsValue.indicatorLocation == 'right', 'swiper-right': imgAdsValue.indicatorLocation == 'right',
'ns-indicator-dots': imgAdsValue.carouselStyle == 'line' 'ns-indicator-dots': imgAdsValue.carouselStyle == 'line'
}" :autoplay="true" :interval="imgAdsValue.interval" circular="true" :indicator-dots="isDots" }" :autoplay="true" :interval="imgAdsValue.interval" circular="true" :indicator-dots="isDots"
indicator-color="rgba(130, 130, 130, .5)" :indicator-active-color="imgAdsValue.indicatorColor" indicator-color="rgba(130, 130, 130, .5)" :indicator-active-color="imgAdsValue.indicatorColor"
@change="swiperChange"> @change="swiperChange">
<swiper-item class="swiper-item" :style="imgAdsSwiper" v-for="(item, index) in imgAdsValue.list" :key="index" v-if="item.imageUrl" @click="$util.diyRedirectTo(item.link)"> <swiper-item class="swiper-item" :style="imgAdsSwiper" v-for="(item, index) in imgAdsValue.list" :key="index" v-if="item.imageUrl" @click="$util.diyRedirectTo(item.link)">
<view class="item" :style="imgAdsSwiper + 'height: ' + item.imgHeight"> <view class="item" :style="imgAdsSwiper + 'height: ' + item.imgHeight">
<image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :show-menu-by-longpress="true"/> <image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :show-menu-by-longpress="true"/>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<view v-if="imgAdsValue.list.length > 1 && value.indicatorIsShow" :class="[ <view v-if="imgAdsValue.list.length > 1 && value.indicatorIsShow" :class="[
'swiper-dot-box', 'swiper-dot-box',
{ straightLine: imgAdsValue.carouselStyle == 'line' }, { straightLine: imgAdsValue.carouselStyle == 'line' },
{ 'swiper-left': imgAdsValue.indicatorLocation == 'left' }, { 'swiper-left': imgAdsValue.indicatorLocation == 'left' },
{ 'swiper-right': imgAdsValue.indicatorLocation == 'right' } { 'swiper-right': imgAdsValue.indicatorLocation == 'right' }
]"> ]">
<view v-for="(numItem, numIndex) in imgAdsValue.list.length" :key="numIndex" :class="['swiper-dot', { active: numIndex == swiperIndex }]" :style="[numIndex == swiperIndex && { backgroundColor: imgAdsValue.indicatorColor }]"></view> <view v-for="(numItem, numIndex) in imgAdsValue.list.length" :key="numIndex" :class="['swiper-dot', { active: numIndex == swiperIndex }]" :style="[numIndex == swiperIndex && { backgroundColor: imgAdsValue.indicatorColor }]"></view>
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-img-ads', name: 'diy-img-ads',
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
} }
}, },
data() { data() {
return { return {
isDots: true, isDots: true,
swiperHeight: 0, swiperHeight: 0,
imgAdsValue: null, // 深拷贝一遍数据,防止动态计算图片展示尺寸的时候,影响到父级的数据,导致二次渲染的时候,数据错误 imgAdsValue: null, // 深拷贝一遍数据,防止动态计算图片展示尺寸的时候,影响到父级的数据,导致二次渲染的时候,数据错误
swiperIndex: 0 swiperIndex: 0
}; };
}, },
created() { created() {
this.calcSingleRow(); this.calcSingleRow();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
imgAdsMarginWarp: function() { imgAdsMarginWarp: function() {
var obj = ''; var obj = '';
obj = 'background-color:' + this.value.componentBgColor + ';'; obj = 'background-color:' + this.value.componentBgColor + ';';
return obj; return obj;
}, },
imgAdsSwiper: function() { imgAdsSwiper: function() {
var obj = ''; var obj = '';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
}, },
singleGraphBg: function() { singleGraphBg: function() {
var imgArr = []; var imgArr = [];
for (let i = 0; i < this.imgAdsValue.list.length; i++) { for (let i = 0; i < this.imgAdsValue.list.length; i++) {
let item = this.imgAdsValue.list[i]; let item = this.imgAdsValue.list[i];
imgArr[i] = parseFloat(item.imgHeight); imgArr[i] = parseFloat(item.imgHeight);
} }
imgArr.sort(function(a, b) { imgArr.sort(function(a, b) {
return b - a; return b - a;
}); });
var obj = ''; var obj = '';
obj += 'background-color:' + this.imgAdsValue.backgroundColor + ';'; obj += 'background-color:' + this.imgAdsValue.backgroundColor + ';';
obj += 'height:' + imgArr[0] * (this.imgAdsValue.backgroundHeight / 100) * 2 + 'rpx;'; obj += 'height:' + imgArr[0] * (this.imgAdsValue.backgroundHeight / 100) * 2 + 'rpx;';
return obj; return obj;
} }
}, },
methods: { methods: {
swiperChange(e) { swiperChange(e) {
this.swiperIndex = e.detail.current; this.swiperIndex = e.detail.current;
}, },
calcSingleRow() { calcSingleRow() {
let minHeight = 0; let minHeight = 0;
let systemInfo = uni.getSystemInfoSync() let systemInfo = uni.getSystemInfoSync()
// 深拷贝一层数据,防止数据更改越权 // 深拷贝一层数据,防止数据更改越权
this.imgAdsValue = JSON.parse(JSON.stringify(this.value)); this.imgAdsValue = JSON.parse(JSON.stringify(this.value));
this.imgAdsValue.list.forEach((item, index) => { this.imgAdsValue.list.forEach((item, index) => {
var ratio = item.imgHeight / item.imgWidth; var ratio = item.imgHeight / item.imgWidth;
item.imgWidth = systemInfo.windowWidth; item.imgWidth = systemInfo.windowWidth;
item.imgWidth -= this.value.margin.both * 2; item.imgWidth -= this.value.margin.both * 2;
item.imgHeight = item.imgWidth * ratio; item.imgHeight = item.imgWidth * ratio;
// 获取最大高度 if (maxHeight == 0 || maxHeight < item.imgHeight) maxHeight = item.imgHeight; // 获取最大高度 if (maxHeight == 0 || maxHeight < item.imgHeight) maxHeight = item.imgHeight;
if (minHeight == 0 || minHeight > item.imgHeight) minHeight = item.imgHeight; if (minHeight == 0 || minHeight > item.imgHeight) minHeight = item.imgHeight;
}); });
this.imgAdsValue.list.forEach((item, index) => { this.imgAdsValue.list.forEach((item, index) => {
item.imgHeight = minHeight + 'px'; item.imgHeight = minHeight + 'px';
this.swiperHeight = minHeight + 'px'; this.swiperHeight = minHeight + 'px';
}); });
this.imgAdsValue.indicatorColor = this.imgAdsValue.indicatorColor || '#fff'; this.imgAdsValue.indicatorColor = this.imgAdsValue.indicatorColor || '#fff';
if (this.value.indicatorIsShow === undefined) { if (this.value.indicatorIsShow === undefined) {
this.value.indicatorIsShow = true; // 控制指示点是否展示 this.value.indicatorIsShow = true; // 控制指示点是否展示
} }
// 是否显示指示器 // 是否显示指示器
if (this.imgAdsValue.list.length <= 1) { if (this.imgAdsValue.list.length <= 1) {
this.isDots = false; this.isDots = false;
} }
// #ifdef H5 // #ifdef H5
this.isDots = this.value.indicatorIsShow; this.isDots = this.value.indicatorIsShow;
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
this.isDots = false; this.isDots = false;
// #endif // #endif
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.single-graph { .single-graph {
width: 100%; width: 100%;
line-height: 0; line-height: 0;
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
} }
.simple-graph-wrap { .simple-graph-wrap {
line-height: 0; line-height: 0;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
image { image {
width: 100%; width: 100%;
} }
.heat-map { .heat-map {
position: absolute; position: absolute;
} }
} }
.item.active text { .item.active text {
background: rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.3);
position: absolute; position: absolute;
bottom: 0; bottom: 0;
color: #ffffff; color: #ffffff;
font-size: $font-size-tag; font-size: $font-size-tag;
width: 100%; width: 100%;
left: 0; left: 0;
line-height: 40rpx; line-height: 40rpx;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
padding: 0 10rpx; padding: 0 10rpx;
text-align: center; text-align: center;
} }
.swiper-box { .swiper-box {
position: relative; position: relative;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
} }
.swiper { .swiper {
margin: 0 auto; margin: 0 auto;
overflow: hidden; overflow: hidden;
} }
.swiper-item { .swiper-item {
width: 100%; width: 100%;
height: auto !important; height: auto !important;
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
// position: relative; // position: relative;
overflow: hidden; overflow: hidden;
.item { .item {
width: 100%; width: 100%;
height: auto; height: auto;
text-align: center; text-align: center;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
image { image {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
height: 100%; height: 100%;
will-change: transform; will-change: transform;
} }
.heat-map { .heat-map {
position: absolute; position: absolute;
} }
} }
} }
.swiper-dot-box { .swiper-dot-box {
position: absolute; position: absolute;
bottom: 20rpx; bottom: 20rpx;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 40rpx 8rpx; padding: 0 40rpx 8rpx;
box-sizing: border-box; box-sizing: border-box;
&.swiper-left { &.swiper-left {
justify-content: flex-start; justify-content: flex-start;
} }
&.swiper-right { &.swiper-right {
justify-content: flex-end; justify-content: flex-end;
} }
.swiper-dot { .swiper-dot {
background-color: #b2b2b2; background-color: #b2b2b2;
width: 15rpx; width: 15rpx;
border-radius: 50%; border-radius: 50%;
height: 15rpx; height: 15rpx;
margin: 8rpx; margin: 8rpx;
&.active { &.active {
background-color: rgba(0, 0, 0, 1); background-color: rgba(0, 0, 0, 1);
} }
} }
&.straightLine { &.straightLine {
.swiper-dot { .swiper-dot {
width: 18rpx; width: 18rpx;
height: 6rpx; height: 6rpx;
border-radius: 4rpx; border-radius: 4rpx;
&.active { &.active {
width: 36rpx; width: 36rpx;
background-color: rgba(0, 0, 0, 1); background-color: rgba(0, 0, 0, 1);
} }
} }
} }
} }
/* 隐藏滚动条,但依旧具备可以滚动的功能 */ /* 隐藏滚动条,但依旧具备可以滚动的功能 */
/deep/.uni-scroll-view::-webkit-scrollbar { /deep/.uni-scroll-view::-webkit-scrollbar {
display: none; display: none;
} }
.swiper /deep/ .uni-swiper-dots-horizontal { .swiper /deep/ .uni-swiper-dots-horizontal {
bottom: 25rpx; bottom: 25rpx;
} }
.swiper-left /deep/ .uni-swiper-dots-horizontal { .swiper-left /deep/ .uni-swiper-dots-horizontal {
left: 40rpx; left: 40rpx;
transform: translate(0); transform: translate(0);
} }
.swiper-right /deep/ .uni-swiper-dots-horizontal { .swiper-right /deep/ .uni-swiper-dots-horizontal {
right: 40rpx; right: 40rpx;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
transform: translate(0); transform: translate(0);
} }
.carousel-angle /deep/ .uni-swiper-dots-horizontal .uni-swiper-dot { .carousel-angle /deep/ .uni-swiper-dots-horizontal .uni-swiper-dot {
width: 24rpx; width: 24rpx;
border-radius: 0; border-radius: 0;
height: 8rpx; height: 8rpx;
} }
.swiper.ns-indicator-dots /deep/ .uni-swiper-dot { .swiper.ns-indicator-dots /deep/ .uni-swiper-dot {
width: 18rpx; width: 18rpx;
height: 6rpx; height: 6rpx;
border-radius: 4rpx; border-radius: 4rpx;
} }
.swiper.ns-indicator-dots /deep/ .uni-swiper-dot-active { .swiper.ns-indicator-dots /deep/ .uni-swiper-dot-active {
width: 36rpx; width: 36rpx;
} }
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<view> <view data-component-name="diy-index-page">
<view class="bg" :style="warpCss"> <view class="bg" :style="warpCss">
<view class="index-page-content"> <view class="index-page-content">
<view class="nav-top-category" :style="categoryCss"> <view class="nav-top-category" :style="categoryCss">

View File

@@ -1,71 +1,71 @@
<template> <template>
<view class="diy-kefu" :style="style"> <view data-component-name="diy-kefu" class="diy-kefu" :style="style">
<view class="fui-list-group merchgroup" v-for="(item,index) in value.list"> <view class="fui-list-group merchgroup" v-for="(item,index) in value.list">
<view class="fui-list jump" v-if="index == 0"> <view class="fui-list jump" v-if="index == 0">
<view class="fui-list-media"> <view class="fui-list-media">
<image class="round" :src="$util.img(item.imageUrl)" style="border-radius:6rpx"></image> <image class="round" :src="$util.img(item.imageUrl)" style="border-radius:6rpx"></image>
</view> </view>
<view class="fui-list-inner" > <view class="fui-list-inner" >
<view class="title" style="color: ;height: 75rpx;"> <view class="title" style="color: ;height: 75rpx;">
<text style="font-weight:600" :style="{color:item.textColor}">{{item.title}}</text> <text style="font-weight:600" :style="{color:item.textColor}">{{item.title}}</text>
<view class="subtitle" style="font-size:24rpx" :style="{color:item.textColor}">{{item.desc}}</view> <view class="subtitle" style="font-size:24rpx" :style="{color:item.textColor}">{{item.desc}}</view>
</view> </view>
</view> </view>
<view class="fui-remark jump" style="padding-right: 20rpx; text-align: center; line-height: 140rpx;"> <view class="fui-remark jump" style="padding-right: 20rpx; text-align: center; line-height: 140rpx;">
<span style="font-size:24rpx;padding: 14rpx 18rpx;border-radius:8rpx" :style="{background:item.BtBgColor,color:item.BtColor}" @click="previewSqs()">立即添加</span> <span style="font-size:24rpx;padding: 14rpx 18rpx;border-radius:8rpx" :style="{background:item.BtBgColor,color:item.BtColor}" @click="previewSqs()">立即添加</span>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-picture', name: 'diy-picture',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
}; };
}, },
created() { created() {
// this.getDataList(); // this.getDataList();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
// this.getDataList(); // this.getDataList();
} }
}, },
computed: { computed: {
style() { style() {
var css = ''; var css = '';
css += 'background-color:' + this.value.contentBgColor + ';'; css += 'background-color:' + this.value.contentBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
return css; return css;
} }
}, },
methods: { methods: {
previewSqs(){ previewSqs(){
var img = this.$util.img(this.value.list[1].imageUrl) var img = this.$util.img(this.value.list[1].imageUrl)
uni.previewImage({ uni.previewImage({
current: img, current: img,
urls: [img] urls: [img]
}) })
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
</style> </style>

View File

@@ -1,77 +1,77 @@
<template> <template>
<view class="diy-picture" :style="style"> <view data-component-name="diy-picture" class="diy-picture" :style="style">
<view class="fui-cell-group"> <view class="fui-cell-group">
<!-- <image mode="widthFix" style="width: 100%;" :src="$util.img(item.imageUrl)"></image> --> <!-- <image mode="widthFix" style="width: 100%;" :src="$util.img(item.imageUrl)"></image> -->
<view v-for="(item,index) in value.list" @click="redirectTo(item.link)" class="fui-cell" :class="item.iconType == 'img'?'img-cell':''"> <view v-for="(item,index) in value.list" @click="redirectTo(item.link)" class="fui-cell" :class="item.iconType == 'img'?'img-cell':''">
<view class="fui-cell-icon" style="color:diyitem.style.iconcolo"> <view class="fui-cell-icon" style="color:diyitem.style.iconcolo">
<diy-icon v-if="item.iconType == 'icon'" :icon="item.icon" <diy-icon v-if="item.iconType == 'icon'" :icon="item.icon"
:value="item.style ? item.style : null" :value="item.style ? item.style : null"
:style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon> :style="{ maxWidth: value.imageSize * 2 + 'rpx', maxHeight: value.imageSize * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon>
<image v-if="item.iconType == 'img'" mode="widthFix" :src="$util.img(item.imageUrl)" style="border-radius:6rpx;width: 60rpx;"></image> <image v-if="item.iconType == 'img'" mode="widthFix" :src="$util.img(item.imageUrl)" style="border-radius:6rpx;width: 60rpx;"></image>
</view> </view>
<view class="fui-cell-text" style="color:#333;">{{item.title}}</view> <view class="fui-cell-text" style="color:#333;">{{item.title}}</view>
<view class="fui-cell-remark" style="font-size: 24rpx;">{{lang=='en-us'?'view':'查看'}}</view> <view class="fui-cell-remark" style="font-size: 24rpx;">{{lang=='en-us'?'view':'查看'}}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-listmenu', name: 'diy-listmenu',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
lang:uni.getStorageSync("lang")//en-us 英文 lang:uni.getStorageSync("lang")//en-us 英文
}; };
}, },
created() { created() {
// this.getDataList(); // this.getDataList();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
// this.getDataList(); // this.getDataList();
} }
}, },
computed: { computed: {
style() { style() {
var css = ''; var css = '';
css += 'background-color:' + this.value.contentBgColor + ';'; css += 'background-color:' + this.value.contentBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
if(this.value.margin.top > 0)css += 'margin-top:' + this.value.margin.top * 2 + 'rpx;'; if(this.value.margin.top > 0)css += 'margin-top:' + this.value.margin.top * 2 + 'rpx;';
return css; return css;
} }
}, },
methods: { methods: {
redirectTo(link) { redirectTo(link) {
if (link.wap_url) { if (link.wap_url) {
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) { if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
this.$refs.login.open(link.wap_url); this.$refs.login.open(link.wap_url);
return; return;
} }
} }
this.$util.diyRedirectTo(link); this.$util.diyRedirectTo(link);
}, },
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.img-cell{ .img-cell{
padding:0 16rpx !important; padding:0 16rpx !important;
} }
</style> </style>

View File

@@ -1,241 +1,241 @@
<template> <template>
<x-skeleton type="banner" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-live" type="banner" :loading="loading" :configs="skeletonConfig">
<view class="live-wrap" @click="entryRoom(liveInfo.roomid)" v-if="liveInfo"> <view class="live-wrap" @click="entryRoom(liveInfo.roomid)" v-if="liveInfo">
<view class="banner-wrap"> <view class="banner-wrap">
<image :src="liveInfo.banner != '' ? $util.img(liveInfo.banner) : $util.img('public/uniapp/live/live_default_banner.png')" <image :src="liveInfo.banner != '' ? $util.img(liveInfo.banner) : $util.img('public/uniapp/live/live_default_banner.png')"
mode="widthFix" @error="liveInfo.banner = $util.img('public/uniapp/live/live_default_banner.png')"/> mode="widthFix" @error="liveInfo.banner = $util.img('public/uniapp/live/live_default_banner.png')"/>
<view class="shade"></view> <view class="shade"></view>
<view class="wrap"> <view class="wrap">
<view class="room-name"> <view class="room-name">
<text class="status-name font-size-base" :class="{ 'color-base-bg': liveInfo.live_status == '101' }"> <text class="status-name font-size-base" :class="{ 'color-base-bg': liveInfo.live_status == '101' }">
<text class="iconfont icon-zhibozhong font-size-sub" v-if="liveInfo.live_status == '101'"></text> <text class="iconfont icon-zhibozhong font-size-sub" v-if="liveInfo.live_status == '101'"></text>
<text class="iconfont icon-zhibojieshu font-size-sub" v-else></text> <text class="iconfont icon-zhibojieshu font-size-sub" v-else></text>
{{ liveInfo.status_name }} {{ liveInfo.status_name }}
</text> </text>
{{ liveInfo.name }} {{ liveInfo.name }}
</view> </view>
</view> </view>
</view> </view>
<view class="room-info" v-if="value.isShowAnchorInfo || value.isShowLiveGood"> <view class="room-info" v-if="value.isShowAnchorInfo || value.isShowLiveGood">
<block v-if="value.isShowAnchorInfo"> <block v-if="value.isShowAnchorInfo">
<image :src="liveInfo.anchor_img != '' ? $util.img(liveInfo.anchor_img) : $util.getDefaultImage().head" class="anchor-img" @error="liveInfo.anchor_img = $util.getDefaultImage().head"/> <image :src="liveInfo.anchor_img != '' ? $util.img(liveInfo.anchor_img) : $util.getDefaultImage().head" class="anchor-img" @error="liveInfo.anchor_img = $util.getDefaultImage().head"/>
<text class="anchor-name">主播{{ liveInfo.anchor_name }}</text> <text class="anchor-name">主播{{ liveInfo.anchor_name }}</text>
</block> </block>
<text class="separate" v-if="value.isShowAnchorInfo && value.isShowLiveGood">|</text> <text class="separate" v-if="value.isShowAnchorInfo && value.isShowLiveGood">|</text>
<block v-if="value.isShowLiveGood"> <block v-if="value.isShowLiveGood">
<text class="goods-text">直播商品{{ liveInfo.goods.length }}</text> <text class="goods-text">直播商品{{ liveInfo.goods.length }}</text>
</block> </block>
</view> </view>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
// 直播 // 直播
export default { export default {
components: {}, components: {},
name: 'diy-live', name: 'diy-live',
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
skeletonConfig: { skeletonConfig: {
headHeight: '200rpx' headHeight: '200rpx'
}, },
liveInfo: { liveInfo: {
banner: '', banner: '',
anchor_img: '' anchor_img: ''
} }
}; };
}, },
created() { created() {
this.getLiveInfo(); this.getLiveInfo();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getLiveInfo(); this.getLiveInfo();
} }
}, },
methods: { methods: {
getLiveInfo() { getLiveInfo() {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/live/api/live/info', url: '/live/api/live/info',
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
this.liveInfo = res.data; this.liveInfo = res.data;
this.getLiveStatus(); this.getLiveStatus();
} else { } else {
this.liveInfo = null; this.liveInfo = null;
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
entryRoom(roomId) { entryRoom(roomId) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
wx.navigateTo({ wx.navigateTo({
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}` url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}`
}); });
// #endif // #endif
}, },
getLiveStatus() { getLiveStatus() {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
let livePlayer = requirePlugin('live-player-plugin'); let livePlayer = requirePlugin('live-player-plugin');
livePlayer.getLiveStatus({ livePlayer.getLiveStatus({
room_id: this.liveInfo.roomid room_id: this.liveInfo.roomid
}).then(res => { }).then(res => {
const liveStatus = res.liveStatus; const liveStatus = res.liveStatus;
if (liveStatus && liveStatus != this.liveInfo.live_status) { if (liveStatus && liveStatus != this.liveInfo.live_status) {
this.changeLiveStatus(liveStatus); this.changeLiveStatus(liveStatus);
} }
}) })
.catch(err => {console.log('get live status', err); .catch(err => {console.log('get live status', err);
}); });
// 往后间隔1分钟或更慢的频率去轮询获取直播状态 // 往后间隔1分钟或更慢的频率去轮询获取直播状态
var timer = setInterval(() => { var timer = setInterval(() => {
livePlayer livePlayer
.getLiveStatus({ .getLiveStatus({
room_id: this.liveInfo.roomid room_id: this.liveInfo.roomid
}) })
.then(res => { .then(res => {
const liveStatus = res.liveStatus; const liveStatus = res.liveStatus;
if (liveStatus && liveStatus != this.liveInfo.live_status) { if (liveStatus && liveStatus != this.liveInfo.live_status) {
this.changeLiveStatus(liveStatus); this.changeLiveStatus(liveStatus);
} }
if (this.$util.inArray(liveStatus, [103, 104, 106, 107])) { if (this.$util.inArray(liveStatus, [103, 104, 106, 107])) {
clearInterval(timer); clearInterval(timer);
} }
}) })
.catch(err => { .catch(err => {
console.log('get live status', err); console.log('get live status', err);
}); });
}, 60000); }, 60000);
// #endif // #endif
}, },
changeLiveStatus(status) { changeLiveStatus(status) {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/live/api/live/modifyLiveStatus', url: '/live/api/live/modifyLiveStatus',
data: { data: {
room_id: this.liveInfo.roomid, room_id: this.liveInfo.roomid,
status: status status: status
}, },
success: res => { success: res => {
if (res.code == 0) { if (res.code == 0) {
this.getLiveInfo(); this.getLiveInfo();
} }
} }
}); });
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.live-wrap { .live-wrap {
background: #fff; background: #fff;
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
} }
.banner-wrap { .banner-wrap {
width: 100%; width: 100%;
position: relative; position: relative;
line-height: 1; line-height: 1;
display: flex; display: flex;
image { image {
width: 100%; width: 100%;
} }
.shade { .shade {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
background: rgba($color: #888, $alpha: 0.3); background: rgba($color: #888, $alpha: 0.3);
left: 0; left: 0;
top: 0; top: 0;
z-index: 5; z-index: 5;
} }
.wrap { .wrap {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
z-index: 10; z-index: 10;
padding: 26rpx 20rpx; padding: 26rpx 20rpx;
box-sizing: border-box; box-sizing: border-box;
.room-name { .room-name {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
color: #fff; color: #fff;
line-height: 1; line-height: 1;
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: flex; display: flex;
align-items: center; align-items: center;
.status-name { .status-name {
display: inline-block; display: inline-block;
font-size: $font-size-activity-tag; font-size: $font-size-activity-tag;
color: #fff; color: #fff;
padding: 8rpx 12rpx; padding: 8rpx 12rpx;
background-color: rgba(0, 0, 0, 0.6); background-color: rgba(0, 0, 0, 0.6);
border-radius: 36rpx; border-radius: 36rpx;
margin-right: 20rpx; margin-right: 20rpx;
.icon-zhibozhong { .icon-zhibozhong {
font-size: $font-size-activity-tag; font-size: $font-size-activity-tag;
color: #fff; color: #fff;
margin-right: 9rpx; margin-right: 9rpx;
} }
} }
} }
} }
} }
.room-info { .room-info {
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
background: #fff; background: #fff;
display: flex; display: flex;
.anchor-img { .anchor-img {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
margin-right: 20rpx; margin-right: 20rpx;
} }
.anchor-name, .anchor-name,
.goods-text { .goods-text {
font-size: $font-size-base; font-size: $font-size-base;
line-height: 60rpx; line-height: 60rpx;
} }
.separate { .separate {
color: #808080; color: #808080;
margin: 0 10rpx; margin: 0 10rpx;
line-height: 56rpx; line-height: 56rpx;
} }
} }
</style> </style>
<style scoped> <style scoped>
.coupon-all>>>.uni-scroll-view::-webkit-scrollbar { .coupon-all>>>.uni-scroll-view::-webkit-scrollbar {
display: none; display: none;
} }
</style> </style>

View File

@@ -1,247 +1,247 @@
<template> <template>
<view class="many-goods-list"> <view data-component-name="diy-many-goods-list" class="many-goods-list">
<scroll-view scroll-x="true" class="many-goods-list-head" :scroll-into-view="'a' + cateIndex" :style="manyWrapCss"> <scroll-view scroll-x="true" class="many-goods-list-head" :scroll-into-view="'a' + cateIndex" :style="manyWrapCss">
<view v-for="(item, index) in value.list" class="scroll-item" :class="{ active: index == cateIndex }" :id="'a' + index" :key="index" @click="changeCateIndex(item, index)"> <view v-for="(item, index) in value.list" class="scroll-item" :class="{ active: index == cateIndex }" :id="'a' + index" :key="index" @click="changeCateIndex(item, index)">
<view class="split-line" v-if="index > 0"></view> <view class="split-line" v-if="index > 0"></view>
<view class="cate"> <view class="cate">
<view class="name" :style="{ color : value.headStyle.titleColor }">{{ item.title }}</view> <view class="name" :style="{ color : value.headStyle.titleColor }">{{ item.title }}</view>
<view class="desc" :class="{ 'color-base-bg': index == cateIndex && item.desc }">{{ item.desc }} <view class="desc" :class="{ 'color-base-bg': index == cateIndex && item.desc }">{{ item.desc }}
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="many-goods-list-fill" :style="{'height': manyInfo.height}" v-if="fixedTop"></view> <view class="many-goods-list-fill" :style="{'height': manyInfo.height}" v-if="fixedTop"></view>
<diy-goods-list class="many-goods-list-body" v-if="goodsValue" :value="goodsValue" ref="diyGoodsList"></diy-goods-list> <diy-goods-list class="many-goods-list-body" v-if="goodsValue" :value="goodsValue" ref="diyGoodsList"></diy-goods-list>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-many-goods-list', name: 'diy-many-goods-list',
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
}, },
scrollTop: { scrollTop: {
type: [Number, String] type: [Number, String]
}, },
global: { global: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
} }
}, },
data() { data() {
return { return {
cateIndex: 0, // 当前选中的分类id cateIndex: 0, // 当前选中的分类id
goodsValue: null, // 商品列表数据 goodsValue: null, // 商品列表数据
manyInfo: { manyInfo: {
bodyHeight: 0, bodyHeight: 0,
bodyTop: 0, bodyTop: 0,
height: 0, height: 0,
top: 0 top: 0
} }
}; };
}, },
created() { created() {
this.changeCateIndex(this.value.list[0], 0, true); this.changeCateIndex(this.value.list[0], 0, true);
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.changeCateIndex(this.value.list[0], 0, true); this.changeCateIndex(this.value.list[0], 0, true);
}, },
scrollTop: function(nval) { scrollTop: function(nval) {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query query
.select('.many-goods-list') .select('.many-goods-list')
.boundingClientRect(data => { .boundingClientRect(data => {
if (data) { if (data) {
this.manyInfo.top = data.top; this.manyInfo.top = data.top;
} }
}) })
.exec(); .exec();
query query
.select('.many-goods-list .many-goods-list-body') .select('.many-goods-list .many-goods-list-body')
.boundingClientRect(data => { .boundingClientRect(data => {
if (data) { if (data) {
this.manyInfo.bodyHeight = (data.height || 0); this.manyInfo.bodyHeight = (data.height || 0);
this.manyInfo.bodyTop = (data.top || 0); this.manyInfo.bodyTop = (data.top || 0);
} }
}) })
.exec(); .exec();
} }
}, },
computed: { computed: {
fixedTop() { fixedTop() {
let diyPositionObj = JSON.parse(JSON.stringify(this.$store.state.diyGroupPositionObj)); let diyPositionObj = JSON.parse(JSON.stringify(this.$store.state.diyGroupPositionObj));
let positionHeight = 0; let positionHeight = 0;
let height = 0; let height = 0;
delete diyPositionObj.diyManyGoodsList; delete diyPositionObj.diyManyGoodsList;
if (diyPositionObj) { if (diyPositionObj) {
let arr = Object.values(diyPositionObj); let arr = Object.values(diyPositionObj);
arr.forEach((item, index) => { arr.forEach((item, index) => {
positionHeight += item.originalVal; //定位的高度【搜索框+导航分类+自定义头部】 positionHeight += item.originalVal; //定位的高度【搜索框+导航分类+自定义头部】
}); });
} }
if (this.manyInfo.top < positionHeight && (this.manyInfo.bodyTop + this.manyInfo.bodyHeight > if (this.manyInfo.top < positionHeight && (this.manyInfo.bodyTop + this.manyInfo.bodyHeight >
positionHeight + Number.parseFloat(this.manyInfo.height))) { positionHeight + Number.parseFloat(this.manyInfo.height))) {
height = positionHeight; height = positionHeight;
} }
return height; return height;
}, },
manyWrapCss() { manyWrapCss() {
let html = ''; let html = '';
html += `position: ${this.fixedTop ? 'fixed' : 'initial'};` html += `position: ${this.fixedTop ? 'fixed' : 'initial'};`
html += `top: ${this.fixedTop}px;` html += `top: ${this.fixedTop}px;`
if (!this.global.topNavBg) if (!this.global.topNavBg)
html += `background-color: #fff;` html += `background-color: #fff;`
else else
html += `background-color: ${this.fixedTop ? this.global.topNavColor : 'transparent'};` html += `background-color: ${this.fixedTop ? this.global.topNavColor : 'transparent'};`
return html; return html;
} }
}, },
mounted() { mounted() {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query query
.select('.many-goods-list .many-goods-list-head') .select('.many-goods-list .many-goods-list-head')
.boundingClientRect(data => { .boundingClientRect(data => {
if (data) { if (data) {
this.manyInfo.height = (data.height || 0) + 'px'; this.manyInfo.height = (data.height || 0) + 'px';
// 向vuex中的diyIndexPositionObj增加多商品组件定位位置 // 向vuex中的diyIndexPositionObj增加多商品组件定位位置
let diyManyGoodsList = { let diyManyGoodsList = {
originalVal: data.height || 0 //自身高度 px originalVal: data.height || 0 //自身高度 px
} }
this.$store.commit('setDiyGroupPositionObj', { this.$store.commit('setDiyGroupPositionObj', {
diyManyGoodsList: diyManyGoodsList diyManyGoodsList: diyManyGoodsList
}); });
} }
}) })
.exec(); .exec();
}, },
methods: { methods: {
changeCateIndex(item, index, isFirst) { changeCateIndex(item, index, isFirst) {
this.cateIndex = index; this.cateIndex = index;
this.goodsValue = { this.goodsValue = {
sources: item.sources, sources: item.sources,
categoryId: item.categoryId, categoryId: item.categoryId,
categoryName: item.categoryName, categoryName: item.categoryName,
goodsId: item.goodsId, goodsId: item.goodsId,
componentBgColor: this.value.componentBgColor, componentBgColor: this.value.componentBgColor,
componentAngle: this.value.componentAngle, componentAngle: this.value.componentAngle,
topAroundRadius: this.value.topAroundRadius, topAroundRadius: this.value.topAroundRadius,
bottomAroundRadius: this.value.bottomAroundRadius, bottomAroundRadius: this.value.bottomAroundRadius,
elementBgColor: this.value.elementBgColor, elementBgColor: this.value.elementBgColor,
elementAngle: this.value.elementAngle, elementAngle: this.value.elementAngle,
topElementAroundRadius: this.value.topElementAroundRadius, topElementAroundRadius: this.value.topElementAroundRadius,
bottomElementAroundRadius: this.value.bottomElementAroundRadius, bottomElementAroundRadius: this.value.bottomElementAroundRadius,
count: this.value.count, count: this.value.count,
nameLineMode: this.value.nameLineMode, nameLineMode: this.value.nameLineMode,
template: this.value.template, template: this.value.template,
style: this.value.style, style: this.value.style,
ornament: this.value.ornament, ornament: this.value.ornament,
sortWay: this.value.sortWay, sortWay: this.value.sortWay,
saleStyle: this.value.saleStyle, saleStyle: this.value.saleStyle,
tag: this.value.tag, tag: this.value.tag,
btnStyle: this.value.btnStyle, btnStyle: this.value.btnStyle,
goodsNameStyle: this.value.goodsNameStyle, goodsNameStyle: this.value.goodsNameStyle,
theme: this.value.theme, theme: this.value.theme,
priceStyle: this.value.priceStyle, priceStyle: this.value.priceStyle,
slideMode: this.value.slideMode, slideMode: this.value.slideMode,
imgAroundRadius: this.value.imgAroundRadius, imgAroundRadius: this.value.imgAroundRadius,
margin: this.value.margin, margin: this.value.margin,
goodsMarginType: this.value.goodsMarginType, goodsMarginType: this.value.goodsMarginType,
goodsMarginNum: this.value.goodsMarginNum goodsMarginNum: this.value.goodsMarginNum
}; };
// 如果是第一次加载,不需要执行下面代码 // 如果是第一次加载,不需要执行下面代码
if (isFirst) return; if (isFirst) return;
this.$refs.diyGoodsList.goodsValue = this.goodsValue; this.$refs.diyGoodsList.goodsValue = this.goodsValue;
this.$refs.diyGoodsList.getGoodsList(); this.$refs.diyGoodsList.getGoodsList();
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.many-goods-list-head { .many-goods-list-head {
left: 0; left: 0;
right: 0; right: 0;
z-index: 5; z-index: 5;
background-color: #fff; background-color: #fff;
} }
scroll-view { scroll-view {
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx 0; padding: 20rpx 0;
.scroll-item { .scroll-item {
display: inline-block; display: inline-block;
text-align: center; text-align: center;
vertical-align: top; vertical-align: top;
width: calc(25% - 40rpx); width: calc(25% - 40rpx);
position: relative; position: relative;
padding: 0 20rpx; padding: 0 20rpx;
&:first-child { &:first-child {
width: calc(25% - 20rpx); width: calc(25% - 20rpx);
padding-left: 0; padding-left: 0;
} }
.split-line { .split-line {
display: inline-block; display: inline-block;
width: 1rpx; width: 1rpx;
height: 30rpx; height: 30rpx;
background-color: #e5e5e5; background-color: #e5e5e5;
position: absolute; position: absolute;
left: 0; left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
&.active { &.active {
.name { .name {
font-weight: bold; font-weight: bold;
} }
.desc { .desc {
color: #ffffff; color: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;
} }
} }
.name { .name {
font-size: 32rpx; font-size: 32rpx;
color: $color-title; color: $color-title;
line-height: 1; line-height: 1;
} }
.cate { .cate {
display: inline-block; display: inline-block;
} }
.desc { .desc {
font-size: $font-size-tag; font-size: $font-size-tag;
color: $color-tip; color: $color-tip;
height: 36rpx; height: 36rpx;
line-height: 36rpx; line-height: 36rpx;
margin-top: 10rpx; margin-top: 10rpx;
min-width: 120rpx; min-width: 120rpx;
max-width: 220rpx; max-width: 220rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 0 10rpx; padding: 0 10rpx;
} }
} }
} }
</style> </style>

View File

@@ -1,78 +1,78 @@
<template> <template>
<view class="diy-map" :style="style"> <view data-component-name="diy-map" class="diy-map" :style="style">
<view class="fui-list-group merchgroup" style="margin-top:0" v-for="(item,index) in value.list"> <view class="fui-list-group merchgroup" style="margin-top:0" v-for="(item,index) in value.list">
<map <map
id="map" id="map"
style="width: 100%; height:600rpx" style="width: 100%; height:600rpx"
scale="12" scale="12"
:markers="markerst" :markers="markerst"
bindupdated="bindupdated" bindupdated="bindupdated"
:longitude="item.lng" :longitude="item.lng"
:latitude="item.lat" :latitude="item.lat"
show-location> show-location>
<cover-view style="position:absolute;right:10px;bottom:30rpx;z-index:99999;background:#4390FF;padding:5px 10px;wxcs_style_padding:10rpx 20rpx;border-radius:8rpx;color: #fff;" @click="tomap(item)"> <cover-view style="position:absolute;right:10px;bottom:30rpx;z-index:99999;background:#4390FF;padding:5px 10px;wxcs_style_padding:10rpx 20rpx;border-radius:8rpx;color: #fff;" @click="tomap(item)">
<cover-view style="font-size:24rpx">一键导航</cover-view> <cover-view style="font-size:24rpx">一键导航</cover-view>
</cover-view> </cover-view>
</map> </map>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-map', name: 'diy-map',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
markers:[] markers:[]
}; };
}, },
created() { created() {
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
// this.getDataList(); // this.getDataList();
} }
}, },
computed: { computed: {
markerst(){ markerst(){
return [{ return [{
id:1, id:1,
latitude:this.value.list[0].lat, latitude:this.value.list[0].lat,
longitude:this.value.list[0].lng longitude:this.value.list[0].lng
}] }]
}, },
style() { style() {
var css = ''; var css = '';
css += 'background-color:' + this.value.contentBgColor + ';'; css += 'background-color:' + this.value.contentBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
return css; return css;
} }
}, },
methods: { methods: {
tomap(item){ tomap(item){
uni.openLocation({ uni.openLocation({
latitude: parseFloat(item.lat), latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng), longitude: parseFloat(item.lng),
name:"一键导航", name:"一键导航",
}) })
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="container" :style="warpCss"> <view data-component-name="diy-member-info" class="container" :style="warpCss">
<!-- 会员信息 --> <!-- 会员信息 -->
<view class="common-wrap info-wrap" :class="[`data-style-${value.style}`]"> <view class="common-wrap info-wrap" :class="[`data-style-${value.style}`]">
<view class="member-info" :style="memberInfoStyle"> <view class="member-info" :style="memberInfoStyle">

View File

@@ -1,249 +1,249 @@
<template> <template>
<view class="common-wrap" :style="warpCss"> <view data-component-name="diy-member-my-order" class="common-wrap" :style="warpCss">
<view class="order-wrap"> <view class="order-wrap">
<view class="status-wrap"> <view class="status-wrap">
<view class="item-wrap" @click="redirect('/pages/order/list?status=waitpay')" style="margin-right: 10rpx;"> <view class="item-wrap" @click="redirect('/pages/order/list?status=waitpay')" style="margin-right: 10rpx;">
<view class="icon-block"> <view class="icon-block">
<template v-if="value.style == 3"> <template v-if="value.style == 3">
<image :src="$util.img('public/uniapp/member/order/wait_pay.png')" mode="widthFix"/> <image :src="$util.img('public/uniapp/member/order/wait_pay.png')" mode="widthFix"/>
<view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_pay_shade.png') + ')'"></view> <view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_pay_shade.png') + ')'"></view>
</template> </template>
<template v-else> <template v-else>
<diy-icon :icon="value.icon.waitPay.icon" v-if="value.icon.waitPay" :value="value.icon.waitPay.style ? value.icon.waitPay.style : null"></diy-icon> <diy-icon :icon="value.icon.waitPay.icon" v-if="value.icon.waitPay" :value="value.icon.waitPay.style ? value.icon.waitPay.style : null"></diy-icon>
</template> </template>
<text v-if="orderNum.waitpay > 0" class="order-num color-base-bg price-font">{{ orderNum.waitpay > 99 ? '99+' : orderNum.waitpay }}</text> <text v-if="orderNum.waitpay > 0" class="order-num color-base-bg price-font">{{ orderNum.waitpay > 99 ? '99+' : orderNum.waitpay }}</text>
</view> </view>
<view class="title">{{ $lang('waitpay') }}</view> <view class="title">{{ $lang('waitpay') }}</view>
</view> </view>
<view class="item-wrap" @click="redirect('/pages/order/list?status=waitsend')" style="margin-right: 10rpx;"> <view class="item-wrap" @click="redirect('/pages/order/list?status=waitsend')" style="margin-right: 10rpx;">
<view class="icon-block"> <view class="icon-block">
<template v-if="value.style == 3"> <template v-if="value.style == 3">
<image :src="$util.img('public/uniapp/member/order/wait_send.png')" mode="widthFix"></image> <image :src="$util.img('public/uniapp/member/order/wait_send.png')" mode="widthFix"></image>
<view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_send_shade.png') + ')'"></view> <view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_send_shade.png') + ')'"></view>
</template> </template>
<template v-else> <template v-else>
<diy-icon :icon="value.icon.waitSend.icon" v-if="value.icon.waitSend" :value="value.icon.waitSend.style ? value.icon.waitSend.style : null"></diy-icon> <diy-icon :icon="value.icon.waitSend.icon" v-if="value.icon.waitSend" :value="value.icon.waitSend.style ? value.icon.waitSend.style : null"></diy-icon>
</template> </template>
<text v-if="orderNum.waitsend > 0" class="order-num color-base-bg price-font">{{ orderNum.waitsend > 99 ? '99+' : orderNum.waitsend }}</text> <text v-if="orderNum.waitsend > 0" class="order-num color-base-bg price-font">{{ orderNum.waitsend > 99 ? '99+' : orderNum.waitsend }}</text>
</view> </view>
<view class="title">{{ $lang('waitsend') }}</view> <view class="title">{{ $lang('waitsend') }}</view>
</view> </view>
<view class="item-wrap" @click="redirect('/pages/order/list?status=waitconfirm')" style="margin-right: 10rpx;"> <view class="item-wrap" @click="redirect('/pages/order/list?status=waitconfirm')" style="margin-right: 10rpx;">
<view class="icon-block"> <view class="icon-block">
<template v-if="value.style == 3"> <template v-if="value.style == 3">
<image :src="$util.img('public/uniapp/member/order/wait_confirm.png')" mode="widthFix"/> <image :src="$util.img('public/uniapp/member/order/wait_confirm.png')" mode="widthFix"/>
<view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_confirm_shade.png') + ')'"></view> <view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_confirm_shade.png') + ')'"></view>
</template> </template>
<template v-else> <template v-else>
<diy-icon :icon="value.icon.waitConfirm.icon" v-if="value.icon.waitConfirm" :value="value.icon.waitConfirm.style ? value.icon.waitConfirm.style : null"></diy-icon> <diy-icon :icon="value.icon.waitConfirm.icon" v-if="value.icon.waitConfirm" :value="value.icon.waitConfirm.style ? value.icon.waitConfirm.style : null"></diy-icon>
</template> </template>
<text v-if="orderNum.waitconfirm > 0" class="order-num color-base-bg price-font">{{ orderNum.waitconfirm > 99 ? '99+' : orderNum.waitconfirm }}</text> <text v-if="orderNum.waitconfirm > 0" class="order-num color-base-bg price-font">{{ orderNum.waitconfirm > 99 ? '99+' : orderNum.waitconfirm }}</text>
</view> </view>
<view class="title">{{ $lang('waitconfirm') }}</view> <view class="title">{{ $lang('waitconfirm') }}</view>
</view> </view>
<view class="item-wrap" @click="redirect('/pages/order/list?status=waitrate')" style="margin-right: 10rpx;"> <view class="item-wrap" @click="redirect('/pages/order/list?status=waitrate')" style="margin-right: 10rpx;">
<view class="icon-block"> <view class="icon-block">
<template v-if="value.style == 3"> <template v-if="value.style == 3">
<image :src="$util.img('public/uniapp/member/order/wait_use.png')" mode="widthFix"/> <image :src="$util.img('public/uniapp/member/order/wait_use.png')" mode="widthFix"/>
<view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_rate_shade.png') + ')'"></view> <view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/wait_rate_shade.png') + ')'"></view>
</template> </template>
<template v-else> <template v-else>
<diy-icon :icon="value.icon.waitUse.icon" v-if="value.icon.waitUse" :value="value.icon.waitUse.style ? value.icon.waitUse.style : null"></diy-icon> <diy-icon :icon="value.icon.waitUse.icon" v-if="value.icon.waitUse" :value="value.icon.waitUse.style ? value.icon.waitUse.style : null"></diy-icon>
</template> </template>
<!-- <text v-if="orderNum.wait_use > 0" class="order-num color-base-bg price-font">{{ orderNum.wait_use > 99 ? '99+' : orderNum.wait_use }}</text> --> <!-- <text v-if="orderNum.wait_use > 0" class="order-num color-base-bg price-font">{{ orderNum.wait_use > 99 ? '99+' : orderNum.wait_use }}</text> -->
</view> </view>
<view class="title">{{ $lang('completed') }}</view> <view class="title">{{ $lang('completed') }}</view>
</view> </view>
<view class="item-wrap" @click="redirect('/pages_tool/order/activist')"> <view class="item-wrap" @click="redirect('/pages_tool/order/activist')">
<view class="icon-block"> <view class="icon-block">
<template v-if="value.style == 3"> <template v-if="value.style == 3">
<image :src="$util.img('public/uniapp/member/order/refunding.png')" mode="widthFix"/> <image :src="$util.img('public/uniapp/member/order/refunding.png')" mode="widthFix"/>
<view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/refunding_shade.png') + ')'"></view> <view class="icon-shade" :style="'-webkit-mask-image: url(' + $util.img('public/uniapp/member/order/refunding_shade.png') + ')'"></view>
</template> </template>
<template v-else> <template v-else>
<diy-icon :icon="value.icon.refunding.icon" v-if="value.icon.refunding" :value="value.icon.refunding.style ? value.icon.refunding.style : null"></diy-icon> <diy-icon :icon="value.icon.refunding.icon" v-if="value.icon.refunding" :value="value.icon.refunding.style ? value.icon.refunding.style : null"></diy-icon>
</template> </template>
<text v-if="orderNum.refunding > 0" class="order-num color-base-bg price-font">{{ orderNum.refunding > 99 ? '99+' : orderNum.refunding }}</text> <text v-if="orderNum.refunding > 0" class="order-num color-base-bg price-font">{{ orderNum.refunding > 99 ? '99+' : orderNum.refunding }}</text>
</view> </view>
<view class="title">{{ $lang('activist') }}</view> <view class="title">{{ $lang('activist') }}</view>
</view> </view>
</view> </view>
</view> </view>
<ns-login ref="login"></ns-login> <ns-login ref="login"></ns-login>
</view> </view>
</template> </template>
<script> <script>
// 自定义会员中心——我的订单 // 自定义会员中心——我的订单
export default { export default {
name: 'diy-member-my-order', name: 'diy-member-my-order',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
orderNum: { orderNum: {
waitpay: 0, waitpay: 0,
waitsend: 0, waitsend: 0,
waitconfirm: 0, waitconfirm: 0,
refunding: 0, refunding: 0,
wait_use: 0, wait_use: 0,
waitrate: 0 waitrate: 0
} }
}; };
}, },
created() { created() {
this.init(); this.init();
}, },
watch: { watch: {
storeToken(nVal, oVal) { storeToken(nVal, oVal) {
this.init(); this.init();
}, },
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.init(); this.init();
} }
}, },
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: { methods: {
init() { init() {
if (this.storeToken) { if (this.storeToken) {
this.getOrderNum(); this.getOrderNum();
} else { } else {
this.orderNum = { this.orderNum = {
waitpay: 0, waitpay: 0,
waitsend: 0, waitsend: 0,
waitconfirm: 0, waitconfirm: 0,
refunding: 0, refunding: 0,
wait_use: 0, wait_use: 0,
waitrate: 0 waitrate: 0
}; };
} }
}, },
/** /**
* 获取订单数量 * 获取订单数量
*/ */
getOrderNum() { getOrderNum() {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/order/num', url: '/api/order/num',
data: { data: {
order_status: 'waitpay,waitsend,waitconfirm,refunding,wait_use,waitrate' order_status: 'waitpay,waitsend,waitconfirm,refunding,wait_use,waitrate'
}, },
success: res => { success: res => {
if (res.code == 0) { if (res.code == 0) {
this.orderNum = res.data; this.orderNum = res.data;
} else { } else {
this.orderNum = { this.orderNum = {
waitpay: 0, waitpay: 0,
waitsend: 0, waitsend: 0,
waitconfirm: 0, waitconfirm: 0,
refunding: 0, refunding: 0,
wait_use: 0, wait_use: 0,
waitrate: 0 waitrate: 0
}; };
} }
} }
}); });
}, },
/** /**
* 跳转 * 跳转
* @param {Object} url * @param {Object} url
*/ */
redirect(url) { redirect(url) {
if (this.storeToken) { if (this.storeToken) {
this.$util.redirectTo(url); this.$util.redirectTo(url);
} else { } else {
this.$refs.login.open(url); this.$refs.login.open(url);
} }
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.common-wrap { .common-wrap {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
.order-wrap { .order-wrap {
.status-wrap { .status-wrap {
display: flex; display: flex;
padding: 30rpx 0; padding: 30rpx 0;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #333; color: #333;
} }
.item-wrap { .item-wrap {
flex: 1; flex: 1;
text-align: center; text-align: center;
background: #f6f7f9; background: #f6f7f9;
padding: 20rpx 0; padding: 20rpx 0;
.icon-block { .icon-block {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
font-size: 60rpx; font-size: 60rpx;
margin: 4rpx auto; margin: 4rpx auto;
position: relative; position: relative;
&>image { &>image {
position: absolute; position: absolute;
top: 5%; top: 5%;
right: 5%; right: 5%;
width: 90%; width: 90%;
height: 90%; height: 90%;
z-index: 5; z-index: 5;
} }
.icon-shade { .icon-shade {
width: 90%; width: 90%;
height: 90%; height: 90%;
position: absolute; position: absolute;
z-index: 4; z-index: 4;
top: 5%; top: 5%;
right: 5%; right: 5%;
background: $base-color; background: $base-color;
-webkit-mask: no-repeat center / contain; -webkit-mask: no-repeat center / contain;
} }
} }
.order-num { .order-num {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
transform: translate(50%, -50%); transform: translate(50%, -50%);
box-sizing: border-box; box-sizing: border-box;
color: #ffffff; color: #ffffff;
line-height: 1.2; line-height: 1.2;
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
padding: 0 6rpx; padding: 0 6rpx;
min-width: 30rpx; min-width: 30rpx;
border-radius: 16rpx; border-radius: 16rpx;
height: 30rpx; height: 30rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.title { .title {
font-size: 26rpx; font-size: 26rpx;
} }
} }
} }
</style> </style>

View File

@@ -1,350 +1,350 @@
<template> <template>
<view> <view class="diy-merch-list">
<x-skeleton type="list" :loading="loading" :configs="skeletonConfig" v-if="value.ornament.type == 'default'"> <x-skeleton type="list" :loading="loading" :configs="skeletonConfig" v-if="value.ornament.type == 'default'">
<view class="merch-wrap" :style="warpCss"> <view class="merch-wrap" :style="warpCss">
<view :class="['list-wrap', value.style]" :style="warpCss"> <view :class="['list-wrap', value.style]" :style="warpCss">
<view :class="['item', value.ornament.type]" v-for="(item, index) in list" :key="index" :style="itemCss" @click="toDetail(item)"> <view :class="['item', value.ornament.type]" v-for="(item, index) in list" :key="index" :style="itemCss" @click="toDetail(item)">
<view class="merch-img"> <view class="merch-img">
<image class="cover-img" :src="$util.img(item.merch_image)" mode="widthFix" @error="imgError(index)" /> <image class="cover-img" :src="$util.img(item.merch_image)" mode="widthFix" @error="imgError(index)" />
</view> </view>
<view class="info-wrap"> <view class="info-wrap">
<text class="title">{{ item.merch_name }}</text> <text class="title">{{ item.merch_name }}</text>
<text class="desc">{{ item.desc }}</text> <text class="desc">{{ item.desc }}</text>
<view class="read-wrap"></view> <view class="read-wrap"></view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</x-skeleton> </x-skeleton>
<view v-else :style="warpCss"> <view v-else :style="warpCss">
<scroll-view :scroll-x="true" :class="['merch-nav', 'singleSlide' ]"> <scroll-view :scroll-x="true" :class="['merch-nav', 'singleSlide' ]">
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view class="uni-scroll-view-content"> <view class="uni-scroll-view-content">
<!-- #endif --> <!-- #endif -->
<view class="merch-nav-item graphic" v-for="(item, index) in list" :key="index" :style="{ width: 100 / 4 + '%' }" @click="toDetail(item)"> <view class="merch-nav-item graphic" v-for="(item, index) in list" :key="index" :style="{ width: 100 / 4 + '%' }" @click="toDetail(item)">
<view class="graphic-img" v-if="value.mode != 'text'" :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }"> <view class="graphic-img" v-if="value.mode != 'text'" :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }">
<image <image
:src="$util.img(item.merch_image) || $util.img('public/uniapp/default_img/goods.png')" :src="$util.img(item.merch_image) || $util.img('public/uniapp/default_img/goods.png')"
mode="aspectFill" mode="aspectFill"
:show-menu-by-longpress="true" :show-menu-by-longpress="true"
style="max-width: 80rpx; max-height: 80rpx; border-radius: 50rpx;" style="max-width: 80rpx; max-height: 80rpx; border-radius: 50rpx;"
/> />
</view> </view>
<text class="graphic-text" style="font-size: 28rpx; font-weight: normal; color: rgb(48, 49, 51);"> <text class="graphic-text" style="font-size: 28rpx; font-weight: normal; color: rgb(48, 49, 51);">
{{ item.merch_name }} {{ item.merch_name }}
</text> </text>
</view> </view>
<!-- #ifdef MP --> <!-- #ifdef MP -->
</view> </view>
<!-- #endif --> <!-- #endif -->
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// 文章 // 文章
export default { export default {
name: 'diy-article', name: 'diy-article',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
list: [ list: [
/*{ /*{
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}, },
{ {
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}, },
{ {
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}, },
{ {
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}, },
{ {
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}, },
{ {
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}, },
{ {
merch_name:'品牌', merch_name:'品牌',
merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg' merch_image:'http://saas.cn//upload/4/common/images/20240824/20240824040223172448654356147.jpg'
}*/ }*/
], ],
loading: true, loading: true,
skeletonConfig: { skeletonConfig: {
gridRows: 1, gridRows: 1,
gridRowsGap: '40rpx', gridRowsGap: '40rpx',
headWidth: '160rpx', headWidth: '160rpx',
headHeight: '160rpx', headHeight: '160rpx',
textRows: 2 textRows: 2
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function (nval) { componentRefresh: function (nval) {
this.getList(); this.getList();
} }
}, },
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
console.log(obj) console.log(obj)
return obj; return obj;
}, },
// 子项样式 // 子项样式
itemCss() { itemCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.elementBgColor + ';'; obj += 'background-color:' + this.value.elementBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
if (this.value.ornament.type == 'shadow') { if (this.value.ornament.type == 'shadow') {
obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color; obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color;
} }
if (this.value.ornament.type == 'stroke') { if (this.value.ornament.type == 'stroke') {
obj += 'border:' + '2rpx solid ' + this.value.ornament.color; obj += 'border:' + '2rpx solid ' + this.value.ornament.color;
} }
return obj; return obj;
} }
}, },
methods: { methods: {
getList() { getList() {
console.log(121) console.log(121)
var data = { var data = {
num: this.value.count num: this.value.count
}; };
console.log(this.value) console.log(this.value)
if (this.value.sources == 'diy') { if (this.value.sources == 'diy') {
data.num = 0; data.num = 0;
data.merch_id_arr = this.value.merchIds.toString(); data.merch_id_arr = this.value.merchIds.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/merch/api/merch/lists', url: '/merch/api/merch/lists',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
let data = res.data; let data = res.data;
this.list = data; this.list = data;
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
toDetail(item) { toDetail(item) {
this.$util.redirectTo('/pages_promotion/merch/detail', { this.$util.redirectTo('/pages_promotion/merch/detail', {
merch_id: item.merch_id merch_id: item.merch_id
}); });
}, },
imgError(index) { imgError(index) {
if (this.list[index]) this.list[index].merch_image = this.$util.getDefaultImage().article; if (this.list[index]) this.list[index].merch_image = this.$util.getDefaultImage().article;
} }
} }
}; };
</script> </script>
<style> <style>
/* 单行滑动 */ /* 单行滑动 */
.merch-nav.singleSlide>>>.uni-scroll-view-content { .merch-nav.singleSlide>>>.uni-scroll-view-content {
display: flex; display: flex;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.merch-nav { .merch-nav {
padding: 16rpx; padding: 16rpx;
box-sizing: border-box; box-sizing: border-box;
&.singleSlide { &.singleSlide {
.merch-nav-item { .merch-nav-item {
flex-shrink: 0; flex-shrink: 0;
} }
} }
&.pageSlide { &.pageSlide {
position: relative; position: relative;
.merch-nav-wrap { .merch-nav-wrap {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.merch-nav-item { .merch-nav-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 14rpx 0; padding: 14rpx 0;
box-sizing: border-box; box-sizing: border-box;
.graphic-text { .graphic-text {
padding-top: 12rpx; padding-top: 12rpx;
line-height: 1.5; line-height: 1.5;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
text-align: center; text-align: center;
&.alone { &.alone {
padding-top: 0; padding-top: 0;
} }
} }
&.text { &.text {
.graphic-text { .graphic-text {
padding-top: 0; padding-top: 0;
} }
} }
.graphic-img { .graphic-img {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
font-size: 24rpx; font-size: 24rpx;
.tag { .tag {
position: absolute; position: absolute;
top: -10rpx; top: -10rpx;
right: -24rpx; right: -24rpx;
color: #fff; color: #fff;
border-radius: 24rpx; border-radius: 24rpx;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
transform: scale(0.8); transform: scale(0.8);
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
line-height: 1; line-height: 1;
font-size: 24rpx; font-size: 24rpx;
} }
.icon { .icon {
font-size: 50rpx; font-size: 50rpx;
color: $color-sub; color: $color-sub;
} }
} }
} }
} }
.merch-wrap { .merch-wrap {
.list-wrap { .list-wrap {
&.style-1 { &.style-1 {
.item { .item {
display: flex; display: flex;
padding: 20rpx; padding: 20rpx;
margin-top: 24rpx; margin-top: 24rpx;
&:first-of-type { &:first-of-type {
margin-top: 0; margin-top: 0;
} }
.merch-img { .merch-img {
margin-right: 20rpx; margin-right: 20rpx;
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
image { image {
width: 100%; width: 100%;
} }
} }
.info-wrap { .info-wrap {
// flex: 1; // flex: 1;
// display: flex; // display: flex;
// flex-direction: column; // flex-direction: column;
// justify-content: space-between; // justify-content: space-between;
.desc{ .desc{
color:#888 color:#888
} }
.title { .title {
font-weight: bold; font-weight: bold;
// margin-bottom: 10rpx; // margin-bottom: 10rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
font-size: 30rpx; font-size: 30rpx;
line-height: 1.5; line-height: 1.5;
} }
.abstract { .abstract {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
font-size: $font-size-tag; font-size: $font-size-tag;
} }
.read-wrap { .read-wrap {
display: flex; display: flex;
color: #999ca7; color: #999ca7;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
margin-top: 10rpx; margin-top: 10rpx;
line-height: 1; line-height: 1;
text { text {
font-size: $font-size-tag; font-size: $font-size-tag;
} }
.iconfont { .iconfont {
font-size: 36rpx; font-size: 36rpx;
vertical-align: bottom; vertical-align: bottom;
margin-right: 10rpx; margin-right: 10rpx;
} }
.category-icon { .category-icon {
width: 8rpx; width: 8rpx;
height: 8rpx; height: 8rpx;
border-radius: 50%; border-radius: 50%;
background: $base-color; background: $base-color;
margin-right: 10rpx; margin-right: 10rpx;
} }
.date { .date {
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
} }
} }
} }
} }
} }
</style> </style>

View File

@@ -1,351 +1,351 @@
<template> <template>
<x-skeleton type="list" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-notes" type="list" :loading="loading" :configs="skeletonConfig">
<view class="diy-notes" :style="{ backgroundColor: value.componentBgColor }"> <view class="diy-notes" :style="{ backgroundColor: value.componentBgColor }">
<view class="diy-notes-top"> <view class="diy-notes-top">
<view class="notes-title" :style="{ color: value.titleTextColor }">{{ value.title }}</view> <view class="notes-title" :style="{ color: value.titleTextColor }">{{ value.title }}</view>
<view class="notes-more" @click="toMore()" :style="{ color: value.moreTextColor }">{{ value.more }}</view> <view class="notes-more" @click="toMore()" :style="{ color: value.moreTextColor }">{{ value.more }}</view>
</view> </view>
<scroll-view class="diy-notes-box" scroll-x="true" show-scrollbar="true"> <scroll-view class="diy-notes-box" scroll-x="true" show-scrollbar="true">
<view class="notes-box-item" v-for="(item, i) in dataList" :key="i" @click="toDetail(item.note_id)" <view class="notes-box-item" v-for="(item, i) in dataList" :key="i" @click="toDetail(item.note_id)"
:style="notesItemStyle"> :style="notesItemStyle">
<view class="notes-item" v-if="item.status == 1"> <view class="notes-item" v-if="item.status == 1">
<view class="notes-item-con"> <view class="notes-item-con">
<view class="notes-title">{{ item.note_title }}</view> <view class="notes-title">{{ item.note_title }}</view>
<view class="notes-highlights-list" v-if="value.notesLabel == 1 && item.goods_highlights"> <view class="notes-highlights-list" v-if="value.notesLabel == 1 && item.goods_highlights">
<text class="color-base-bg" v-for="(labelItem, labelIndex) in item.label" :key="labelIndex">{{ labelItem }}</text> <text class="color-base-bg" v-for="(labelItem, labelIndex) in item.label" :key="labelIndex">{{ labelItem }}</text>
</view> </view>
<view class="notes-intro"> <view class="notes-intro">
<text class="notes-label color-base-text">#{{ item.note_type == 'goods_item' ? '单品介绍' : '掌柜说' }}#</text> <text class="notes-label color-base-text">#{{ item.note_type == 'goods_item' ? '单品介绍' : '掌柜说' }}#</text>
{{ item.note_abstract }} {{ item.note_abstract }}
</view> </view>
</view> </view>
<view class="notes-img-wrap" :class="{ 'notes-img-wrap-list': item.cover_type == 1 }"> <view class="notes-img-wrap" :class="{ 'notes-img-wrap-list': item.cover_type == 1 }">
<image v-if="item.cover_type == 0" :src="$util.img(item.img)" @error="imageError(i)" mode="aspectFill" class="notes-item-image"/> <image v-if="item.cover_type == 0" :src="$util.img(item.img)" @error="imageError(i)" mode="aspectFill" class="notes-item-image"/>
<image v-else v-for="(imgItem, imgIndex) in item.img" :key="imgIndex" :src="$util.img(imgItem)" @error="imageError(i)" mode="aspectFit" class="notes-item-image-li"/> <image v-else v-for="(imgItem, imgIndex) in item.img" :key="imgIndex" :src="$util.img(imgItem)" @error="imageError(i)" mode="aspectFit" class="notes-item-image-li"/>
</view> </view>
<view class="notes-item-con"> <view class="notes-item-con">
<view class="notes-info" v-if="(value.readNum == 1 && item.is_show_read_num == 1) || (value.uploadTime == 1 && item.is_show_release_time == 1)"> <view class="notes-info" v-if="(value.readNum == 1 && item.is_show_read_num == 1) || (value.uploadTime == 1 && item.is_show_release_time == 1)">
<view class="notes-num"> <view class="notes-num">
<text v-show="value.uploadTime == 1 && item.is_show_release_time == 1">{{ item.update_time_day }}</text> <text v-show="value.uploadTime == 1 && item.is_show_release_time == 1">{{ item.update_time_day }}</text>
</view> </view>
<view class="notes-num"> <view class="notes-num">
<text v-show="value.readNum == 1 && item.is_show_read_num == 1">阅读 {{ item.initial_read_num + item.read_num }}</text> <text v-show="value.readNum == 1 && item.is_show_read_num == 1">阅读 {{ item.initial_read_num + item.read_num }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<ns-login ref="login"></ns-login> <ns-login ref="login"></ns-login>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-notes', name: 'diy-notes',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
skeletonConfig: { skeletonConfig: {
itemDirection: 'column', itemDirection: 'column',
headWidth: '100%', headWidth: '100%',
headHeight: '320rpx', headHeight: '320rpx',
textRows: 2, textRows: 2,
textWidth: ['100%', '80%'] textWidth: ['100%', '80%']
}, },
dataList: [], dataList: [],
giveLikeFlag: false giveLikeFlag: false
}; };
}, },
created() { created() {
this.getDataList(); this.getDataList();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getDataList(); this.getDataList();
} }
}, },
computed: { computed: {
notesItemStyle() { notesItemStyle() {
var css = ''; var css = '';
css += 'background-color:' + this.value.contentBgColor + ';'; css += 'background-color:' + this.value.contentBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
return css; return css;
} }
}, },
methods: { methods: {
refresh() { refresh() {
this.getDataList(); this.getDataList();
}, },
getDataList() { getDataList() {
var data = { var data = {
num: this.value.count num: this.value.count
}; };
if (this.value.sources == 'diy') { if (this.value.sources == 'diy') {
data.num = 0; data.num = 0;
data.note_id_arr = this.value.noteId.toString(); data.note_id_arr = this.value.noteId.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/notes/api/notes/lists', url: '/notes/api/notes/lists',
data: data, data: data,
success: res => { success: res => {
var data = res.data; var data = res.data;
this.dataList = []; this.dataList = [];
if (data) { if (data) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var item = {}; var item = {};
item = data[i]; item = data[i];
if (data[i].cover_type == 1) { if (data[i].cover_type == 1) {
item.img = data[i].cover_img.split(','); item.img = data[i].cover_img.split(',');
} else { } else {
item.img = data[i].cover_img; item.img = data[i].cover_img;
} }
if (data[i].upload_time) { if (data[i].upload_time) {
item.update_time_day = this.$util.timeStampTurnTime(data[i].upload_time) item.update_time_day = this.$util.timeStampTurnTime(data[i].upload_time)
.split(' ')[0]; .split(' ')[0];
} else { } else {
item.update_time_day = this.$util.timeStampTurnTime(data[i].create_time) item.update_time_day = this.$util.timeStampTurnTime(data[i].create_time)
.split(' ')[0]; .split(' ')[0];
} }
item.label = data[i].goods_highlights.split(','); item.label = data[i].goods_highlights.split(',');
this.dataList.push(item); this.dataList.push(item);
} }
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
toMore() { toMore() {
this.$util.redirectTo('/pages_tool/store_notes/note_list'); this.$util.redirectTo('/pages_tool/store_notes/note_list');
}, },
toDetail(id) { toDetail(id) {
this.$util.redirectTo('/pages_tool/store_notes/note_detail', { this.$util.redirectTo('/pages_tool/store_notes/note_detail', {
note_id: id note_id: id
}); });
}, },
/* 点赞 */ /* 点赞 */
giveLike(noteId, index) { giveLike(noteId, index) {
if (!this.storeToken) { if (!this.storeToken) {
this.$refs.login.open('/pages/index/index'); this.$refs.login.open('/pages/index/index');
return; return;
} }
if (this.giveLikeFlag) return false; if (this.giveLikeFlag) return false;
this.giveLikeFlag = true; this.giveLikeFlag = true;
var url = this.dataList[index].is_dianzan == 1 ? '/notes/api/record/delete' : '/notes/api/record/add'; var url = this.dataList[index].is_dianzan == 1 ? '/notes/api/record/delete' : '/notes/api/record/add';
this.$api.sendRequest({ this.$api.sendRequest({
url: url, url: url,
data: { data: {
note_id: noteId note_id: noteId
}, },
success: res => { success: res => {
this.giveLikeFlag = false; this.giveLikeFlag = false;
if (res.code == 0 && res.data > 0) { if (res.code == 0 && res.data > 0) {
if (this.noteType != 'goods_item') if (this.noteType != 'goods_item')
this.dataList[index].dianzan_num = this.dataList[index].is_dianzan == 1 ? this.dataList[index].dianzan_num - 1 : this.dataList[index].dianzan_num + 1; this.dataList[index].dianzan_num = this.dataList[index].is_dianzan == 1 ? this.dataList[index].dianzan_num - 1 : this.dataList[index].dianzan_num + 1;
else { else {
this.dataList[index].dianzan_num = this.dataList[index].is_dianzan == 1 ? this.dataList[index].dianzan_num - 1 : this.dataList[index].dianzan_num + 1; this.dataList[index].dianzan_num = this.dataList[index].is_dianzan == 1 ? this.dataList[index].dianzan_num - 1 : this.dataList[index].dianzan_num + 1;
} }
this.dataList[index].is_dianzan = this.dataList[index].is_dianzan == 1 ? 0 : 1; this.dataList[index].is_dianzan = this.dataList[index].is_dianzan == 1 ? 0 : 1;
} else { } else {
this.$util.showToast({ this.$util.showToast({
title: res.message title: res.message
}); });
} }
} }
}); });
}, },
imageError(index) { imageError(index) {
this.dataList[index].img = this.$util.getDefaultImage().goods; this.dataList[index].img = this.$util.getDefaultImage().goods;
this.$forceUpdate(); this.$forceUpdate();
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
scroll-view ::-webkit-scrollbar { scroll-view ::-webkit-scrollbar {
width: 0; width: 0;
height: 0; height: 0;
background-color: transparent; background-color: transparent;
touch-action: none; touch-action: none;
} }
.diy-notes { .diy-notes {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
.diy-notes-top { .diy-notes-top {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
.notes-title { .notes-title {
width: 70%; width: 70%;
font-size: 28rpx; font-size: 28rpx;
font-weight: 600; font-weight: 600;
} }
.notes-more { .notes-more {
font-size: $font-size-tag; font-size: $font-size-tag;
color: #858585; color: #858585;
} }
.notes-more::after { .notes-more::after {
font-family: 'iconfont'; font-family: 'iconfont';
content: '\e6a3'; content: '\e6a3';
font-size: $font-size-tag; font-size: $font-size-tag;
line-height: 1; line-height: 1;
position: relative; position: relative;
margin-left: 4rpx; margin-left: 4rpx;
} }
} }
.diy-notes-box { .diy-notes-box {
width: 100%; width: 100%;
padding: 30rpx 0 20rpx; padding: 30rpx 0 20rpx;
} }
.notes-box-item { .notes-box-item {
width: calc(100% - 8rpx); width: calc(100% - 8rpx);
margin: 0 auto; margin: 0 auto;
height: 100%; height: 100%;
margin-bottom: 30rpx; margin-bottom: 30rpx;
border-radius: 10rpx; border-radius: 10rpx;
overflow: hidden; overflow: hidden;
-moz-box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02); -moz-box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02);
-webkit-box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02); -webkit-box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02);
box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02); box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02);
.notes-item { .notes-item {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 20rpx; padding: 20rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.notes-img-wrap { .notes-img-wrap {
position: relative; position: relative;
height: 300rpx; height: 300rpx;
.notes-item-image { .notes-item-image {
width: 100%; width: 100%;
height: 300rpx; height: 300rpx;
object-fit: cover; object-fit: cover;
} }
.notes-label { .notes-label {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
left: 20rpx; left: 20rpx;
bottom: 20rpx; bottom: 20rpx;
max-width: calc(100vh - 40rpx); max-width: calc(100vh - 40rpx);
background-color: #ffffff; background-color: #ffffff;
line-height: 36rpx; line-height: 36rpx;
padding: 0 10rpx 0 4rpx; padding: 0 10rpx 0 4rpx;
} }
} }
.notes-img-wrap-list { .notes-img-wrap-list {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
height: auto; height: auto;
image { image {
width: calc((100% - 40rpx) / 3); width: calc((100% - 40rpx) / 3);
height: 210rpx; height: 210rpx;
margin-top: 20rpx; margin-top: 20rpx;
&:nth-child(-n + 3) { &:nth-child(-n + 3) {
margin-top: 0; margin-top: 0;
} }
} }
&:after { &:after {
content: ''; content: '';
width: calc((100% - 40rpx) / 3); width: calc((100% - 40rpx) / 3);
} }
} }
.notes-item-con { .notes-item-con {
.notes-title { .notes-title {
font-size: 30rpx; font-size: 30rpx;
font-weight: 600; font-weight: 600;
line-height: 44rpx; line-height: 44rpx;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; overflow: hidden;
} }
.notes-highlights-list { .notes-highlights-list {
text { text {
display: inline-block; display: inline-block;
color: #ffffff; color: #ffffff;
font-size: 24rpx; font-size: 24rpx;
line-height: 36rpx; line-height: 36rpx;
padding: 0 10rpx; padding: 0 10rpx;
border-radius: 4rpx; border-radius: 4rpx;
margin: 0 5rpx; margin: 0 5rpx;
} }
} }
.notes-intro { .notes-intro {
margin: 4rpx 0 8rpx; margin: 4rpx 0 8rpx;
line-height: 40rpx; line-height: 40rpx;
overflow: hidden; overflow: hidden;
text { text {
float: left; float: left;
margin-right: 16rpx; margin-right: 16rpx;
} }
} }
.notes-info { .notes-info {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-top: 20rpx; margin-top: 20rpx;
.notes-num { .notes-num {
>text { >text {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: $font-size-tag; font-size: $font-size-tag;
color: #969799; color: #969799;
text.iconfont { text.iconfont {
font-size: 26rpx; font-size: 26rpx;
margin-right: 6rpx; margin-right: 6rpx;
} }
} }
} }
} }
} }
} }
</style> </style>

View File

@@ -1,300 +1,300 @@
<template> <template>
<view class="diy-notice"> <view data-component-name="diy-notice" class="diy-notice">
<view :class="['notice', value.contentStyle]" :style="noticeWrapCss"> <view :class="['notice', value.contentStyle]" :style="noticeWrapCss">
<image v-if="value.iconType == 'img'" class="notice-img" :src="$util.img(value.imageUrl)" mode="heightFix"/> <image v-if="value.iconType == 'img'" class="notice-img" :src="$util.img(value.imageUrl)" mode="heightFix"/>
<diy-icon v-if="value.iconType == 'icon'" :icon="value.icon" :value="value.style ? value.style : 'null'" :style="{ maxWidth: 30 * 2 + 'rpx', maxHeight: 30 * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon> <diy-icon v-if="value.iconType == 'icon'" :icon="value.icon" :value="value.style ? value.style : 'null'" :style="{ maxWidth: 30 * 2 + 'rpx', maxHeight: 30 * 2 + 'rpx', width: '100%', height: '100%' }"></diy-icon>
<view class="notice-xian"></view> <view class="notice-xian"></view>
<view class="main-wrap"> <view class="main-wrap">
<!-- 横向滚动 --> <!-- 横向滚动 -->
<view class="horizontal-wrap" v-if="value.scrollWay == 'horizontal'"> <view class="horizontal-wrap" v-if="value.scrollWay == 'horizontal'">
<view class="marquee-wrap"> <view class="marquee-wrap">
<view class="marquee" :style="marqueeStyle"> <view class="marquee" :style="marqueeStyle">
<text v-for="(item, index) in list" :key="index" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item.title }}</text> <text v-for="(item, index) in list" :key="index" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item.title }}</text>
</view> </view>
<view class="marquee" :style="marqueeAgainStyle"> <view class="marquee" :style="marqueeAgainStyle">
<text v-for="(item, index) in list" :key="index" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item.title }}</text> <text v-for="(item, index) in list" :key="index" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item.title }}</text>
</view> </view>
</view> </view>
</view> </view>
<!-- 上下滚动 --> <!-- 上下滚动 -->
<template v-if="value.scrollWay == 'upDown'"> <template v-if="value.scrollWay == 'upDown'">
<swiper :vertical="true" :duration="500" autoplay="true" circular="true"> <swiper :vertical="true" :duration="500" autoplay="true" circular="true">
<swiper-item v-for="(item, index) in list" :key="index" @touchmove.prevent.stop> <swiper-item v-for="(item, index) in list" :key="index" @touchmove.prevent.stop>
<text class="beyond-hiding using-hidden" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }"> <text class="beyond-hiding using-hidden" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">
{{ item.title }} {{ item.title }}
</text> </text>
</swiper-item> </swiper-item>
</swiper> </swiper>
</template> </template>
</view> </view>
</view> </view>
<view @touchmove.prevent.stop> <view @touchmove.prevent.stop>
<uni-popup ref="noticePopup" type="center"> <uni-popup ref="noticePopup" type="center">
<view class="notice-popup"> <view class="notice-popup">
<view class="head-wrap" @click="closeNoticePopup"> <view class="head-wrap" @click="closeNoticePopup">
<text>公告</text> <text>公告</text>
<text class="iconfont icon-close"></text> <text class="iconfont icon-close"></text>
</view> </view>
<view class="content-wrap">{{ notice }}</view> <view class="content-wrap">{{ notice }}</view>
<button type="primary" @click="closeNoticePopup">我知道了</button> <button type="primary" @click="closeNoticePopup">我知道了</button>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// 公告 // 公告
export default { export default {
name: 'diy-notice', name: 'diy-notice',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
list: [], list: [],
notice: '', // 当前点击的弹框内容 notice: '', // 当前点击的弹框内容
marqueeWrapWidth: 0, // 容器宽度 marqueeWrapWidth: 0, // 容器宽度
marqueeWidth: 0, // 公告内容累加宽度 marqueeWidth: 0, // 公告内容累加宽度
marqueeStyle: '', // 横向滚动样式 marqueeStyle: '', // 横向滚动样式
marqueeAgainStyle: '', // 横向滚动复制样式 marqueeAgainStyle: '', // 横向滚动复制样式
time: 0, // 滚动完成时间 time: 0, // 滚动完成时间
delayTime: 1000 // 动画延迟时间 delayTime: 1000 // 动画延迟时间
}; };
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
if (this.value.sources == 'initial') this.getData(); if (this.value.sources == 'initial') this.getData();
} }
}, },
created() {}, created() {},
mounted() { mounted() {
// 数据源:公告系统 // 数据源:公告系统
if (this.value.sources == 'initial') { if (this.value.sources == 'initial') {
this.getData(); this.getData();
} else { } else {
this.list = this.value.list; this.list = this.value.list;
this.bindCrossSlipEvent(); this.bindCrossSlipEvent();
} }
}, },
computed: { computed: {
noticeWrapCss: function() { noticeWrapCss: function() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: { methods: {
getData() { getData() {
var data = { var data = {
page_size: 0 page_size: 0
}; };
if (this.value.sources == 'initial') { if (this.value.sources == 'initial') {
data.page_size = this.value.count; data.page_size = this.value.count;
} }
if (this.value.noticeIds.length) { if (this.value.noticeIds.length) {
data.id_arr = this.value.noticeIds.toString(); data.id_arr = this.value.noticeIds.toString();
data.page_size = 0; data.page_size = 0;
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/notice/page', url: '/api/notice/page',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
this.list = res.data.list; this.list = res.data.list;
this.bindCrossSlipEvent(); this.bindCrossSlipEvent();
} }
} }
}); });
}, },
toLink(item) { toLink(item) {
if (this.value.sources == 'initial') { if (this.value.sources == 'initial') {
this.$util.redirectTo('/pages_tool/notice/detail', { this.$util.redirectTo('/pages_tool/notice/detail', {
notice_id: item.id notice_id: item.id
}); });
} else if (!item) { } else if (!item) {
this.$util.redirectTo('/pages_tool/notice/list'); this.$util.redirectTo('/pages_tool/notice/list');
} else if (Object.keys(item.link).length > 1) { } else if (Object.keys(item.link).length > 1) {
this.$util.diyRedirectTo(item.link); this.$util.diyRedirectTo(item.link);
} else { } else {
// 如果不设置跳转链接,则点击弹框展示 // 如果不设置跳转链接,则点击弹框展示
this.notice = item.title; this.notice = item.title;
this.$refs.noticePopup.open(); this.$refs.noticePopup.open();
} }
}, },
closeNoticePopup() { closeNoticePopup() {
this.$refs.noticePopup.close(); this.$refs.noticePopup.close();
}, },
// 绑定横向滚动事件 // 绑定横向滚动事件
bindCrossSlipEvent() { bindCrossSlipEvent() {
if (this.value.scrollWay == 'horizontal') { if (this.value.scrollWay == 'horizontal') {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
uni.createSelectorQuery() uni.createSelectorQuery()
.in(this) .in(this)
.select('.marquee-wrap') .select('.marquee-wrap')
.boundingClientRect(res => { .boundingClientRect(res => {
this.marqueeWrapWidth = res.width; this.marqueeWrapWidth = res.width;
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query query
.select('.marquee') .select('.marquee')
.boundingClientRect(data => { .boundingClientRect(data => {
this.marqueeWidth = data.width + 30; // 30px是间距 this.marqueeWidth = data.width + 30; // 30px是间距
this.time = Math.ceil(this.marqueeWidth * 10); this.time = Math.ceil(this.marqueeWidth * 10);
if (this.marqueeWrapWidth > this.marqueeWidth) { if (this.marqueeWrapWidth > this.marqueeWidth) {
this.marqueeStyle = `animation: none;`; this.marqueeStyle = `animation: none;`;
this.marqueeAgainStyle = 'display:none;'; this.marqueeAgainStyle = 'display:none;';
} else { } else {
this.marqueeStyle = ` this.marqueeStyle = `
width: ${this.marqueeWidth}px; width: ${this.marqueeWidth}px;
animation-duration: ${this.time}ms; animation-duration: ${this.time}ms;
animation-delay: ${this.delayTime}ms; animation-delay: ${this.delayTime}ms;
`; `;
this.marqueeAgainStyle = ` this.marqueeAgainStyle = `
width: ${this.marqueeWidth}px; width: ${this.marqueeWidth}px;
left: ${this.marqueeWidth}px; left: ${this.marqueeWidth}px;
animation-duration: ${this.time}ms; animation-duration: ${this.time}ms;
animation-delay: ${this.delayTime}ms; animation-delay: ${this.delayTime}ms;
`; `;
} }
}) })
.exec(); .exec();
}) })
.exec(); .exec();
}); });
}); });
} }
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.notice { .notice {
height: 80rpx; height: 80rpx;
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
padding: 20rpx 0 20rpx 20rpx; padding: 20rpx 0 20rpx 20rpx;
font-size: 70rpx; font-size: 70rpx;
box-sizing: border-box; box-sizing: border-box;
.notice-img { .notice-img {
width: 44rpx; width: 44rpx;
height: 80rpx; height: 80rpx;
} }
.notice-xian { .notice-xian {
width: 1rpx; width: 1rpx;
height: 26rpx; height: 26rpx;
background-color: #e4e4e4; background-color: #e4e4e4;
margin: 0 22rpx; margin: 0 22rpx;
} }
} }
.main-wrap { .main-wrap {
display: inline-block; display: inline-block;
width: calc(100% - 115rpx); width: calc(100% - 115rpx);
position: relative; position: relative;
} }
swiper { swiper {
height: 50rpx; height: 50rpx;
} }
.beyond-hiding { .beyond-hiding {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
} }
.notice-popup { .notice-popup {
padding: 0 30rpx 40rpx; padding: 0 30rpx 40rpx;
background-color: #fff; background-color: #fff;
.head-wrap { .head-wrap {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
line-height: 100rpx; line-height: 100rpx;
height: 100rpx; height: 100rpx;
display: block; display: block;
text-align: center; text-align: center;
position: relative; position: relative;
border-bottom: 2rpx solid $color-line; border-bottom: 2rpx solid $color-line;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.iconfont { .iconfont {
position: absolute; position: absolute;
float: right; float: right;
right: 0; right: 0;
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
} }
} }
.content-wrap { .content-wrap {
max-height: 600rpx; max-height: 600rpx;
overflow-y: auto; overflow-y: auto;
} }
button { button {
margin-top: 40rpx; margin-top: 40rpx;
} }
} }
.horizontal-wrap { .horizontal-wrap {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
} }
.marquee-wrap { .marquee-wrap {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
height: 100%; height: 100%;
vertical-align: middle; vertical-align: middle;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
} }
.marquee { .marquee {
display: flex; display: flex;
position: absolute; position: absolute;
white-space: nowrap; white-space: nowrap;
animation: marquee 0s 0s linear infinite; animation: marquee 0s 0s linear infinite;
text { text {
margin-left: 40rpx; margin-left: 40rpx;
&:first-child { &:first-child {
margin-left: 0; margin-left: 0;
} }
} }
} }
@keyframes marquee { @keyframes marquee {
0% { 0% {
transform: translateX(0); transform: translateX(0);
} }
100% { 100% {
transform: translateX(-100%); transform: translateX(-100%);
} }
} }
</style> </style>

View File

@@ -1,203 +1,203 @@
<template> <template>
<view class="payment-qrocde-wrap" :style="warpCss"> <view data-component-name="diy-payment-qrcode" class="payment-qrocde-wrap" :style="warpCss">
<view class="payment-qrocde-box"> <view class="payment-qrocde-box">
<view class="qrocde-left"> <view class="qrocde-left">
<view class="qrocde-desc"> <view class="qrocde-desc">
<text>门店消费时使用支付时点击下方展示付款码</text> <text>门店消费时使用支付时点击下方展示付款码</text>
<!-- <text class="iconfont icon-shuaxin"></text> --> <!-- <text class="iconfont icon-shuaxin"></text> -->
</view> </view>
<view class="qrocde-action"> <view class="qrocde-action">
<button type="primary" @click="toLink"> <button type="primary" @click="toLink">
<text class="iconfont icon-fukuanma"></text> <text class="iconfont icon-fukuanma"></text>
<text class="action-name">付款码</text> <text class="action-name">付款码</text>
</button> </button>
<button type="primary" @click="openPaymentPopup"> <button type="primary" @click="openPaymentPopup">
<text class="iconfont icon-saomafu"></text> <text class="iconfont icon-saomafu"></text>
<text class="action-name">扫码付</text> <text class="action-name">扫码付</text>
</button> </button>
</view> </view>
</view> </view>
<view class="qrocde-right"> <view class="qrocde-right">
<text class="iconfont icon-zhifu"></text> <text class="iconfont icon-zhifu"></text>
<text class="name">门店支付</text> <text class="name">门店支付</text>
</view> </view>
</view> </view>
<view @touchmove.prevent.stop> <view @touchmove.prevent.stop>
<uni-popup ref="paymentPopup" type="center"> <uni-popup ref="paymentPopup" type="center">
<view class="payment-popup"> <view class="payment-popup">
<view class="head-wrap" @click="closePaymentPopup"> <view class="head-wrap" @click="closePaymentPopup">
<text>提示</text> <text>提示</text>
<text class="iconfont icon-close"></text> <text class="iconfont icon-close"></text>
</view> </view>
<view class="content-wrap">扫码付请退出程序后直接使用微信扫一扫或返回上一页使用付款码进行支付</view> <view class="content-wrap">扫码付请退出程序后直接使用微信扫一扫或返回上一页使用付款码进行支付</view>
<button type="primary" @click="closePaymentPopup">我知道了</button> <button type="primary" @click="closePaymentPopup">我知道了</button>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// 付款码 // 付款码
export default { export default {
name: 'diy-payment-qrcode', name: 'diy-payment-qrcode',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
created() {}, created() {},
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
return obj; return obj;
} }
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
methods: { methods: {
toLink() { toLink() {
this.$util.redirectTo('/pages_tool/store/payment_qrcode'); this.$util.redirectTo('/pages_tool/store/payment_qrcode');
}, },
scanCodeFn() { scanCodeFn() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.toLink(); this.toLink();
// #endif // #endif
// #ifndef H5 // #ifndef H5
// 允许从相机和相册扫码,h5端不起作用 // 允许从相机和相册扫码,h5端不起作用
uni.scanCode({ uni.scanCode({
success: function(res) { success: function(res) {
console.log('条码类型:' + res.scanType); console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result); console.log('条码内容:' + res.result);
} }
}); });
// #endif // #endif
}, },
openPaymentPopup() { openPaymentPopup() {
this.$refs.paymentPopup.open(); this.$refs.paymentPopup.open();
}, },
closePaymentPopup() { closePaymentPopup() {
this.$refs.paymentPopup.close(); this.$refs.paymentPopup.close();
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.payment-qrocde-box { .payment-qrocde-box {
overflow: hidden; overflow: hidden;
display: flex; display: flex;
background-color: #fff; background-color: #fff;
border-radius: 16rpx; border-radius: 16rpx;
.qrocde-left { .qrocde-left {
flex: 1; flex: 1;
.qrocde-desc { .qrocde-desc {
margin-top: 20rpx; margin-top: 20rpx;
margin-bottom: 26rpx; margin-bottom: 26rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: $color-tip; color: $color-tip;
font-size: $font-size-tag; font-size: $font-size-tag;
.iconfont { .iconfont {
margin-left: 10rpx; margin-left: 10rpx;
font-size: $font-size-tag; font-size: $font-size-tag;
font-weight: bold; font-weight: bold;
} }
} }
.qrocde-action { .qrocde-action {
padding-bottom: 36rpx; padding-bottom: 36rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
button { button {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin: 0; margin: 0;
width: 230rpx; width: 230rpx;
height: 86rpx; height: 86rpx;
border-radius: 50rpx; border-radius: 50rpx;
&:first-of-type { &:first-of-type {
margin-right: 46rpx; margin-right: 46rpx;
background-color: $base-color; background-color: $base-color;
} }
&:last-of-type { &:last-of-type {
background-color: #999; background-color: #999;
} }
.iconfont { .iconfont {
margin-right: 10rpx; margin-right: 10rpx;
} }
.action-name { .action-name {
font-size: 30rpx; font-size: 30rpx;
} }
} }
} }
} }
.qrocde-right { .qrocde-right {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding-left: 16rpx; padding-left: 16rpx;
width: 90rpx; width: 90rpx;
z-index: 2; z-index: 2;
box-sizing: border-box; box-sizing: border-box;
.name { .name {
font-size: $font-size-sub; font-size: $font-size-sub;
writing-mode: tb-rl; writing-mode: tb-rl;
color: #fff; color: #fff;
letter-spacing: 6rpx; letter-spacing: 6rpx;
} }
.iconfont { .iconfont {
color: #fff; color: #fff;
} }
&::after { &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 0; left: 0;
width: 500rpx; width: 500rpx;
height: 500rpx; height: 500rpx;
border-radius: 50%; border-radius: 50%;
background-color: $base-color; background-color: $base-color;
transform: translateY(-50%); transform: translateY(-50%);
z-index: -1; z-index: -1;
} }
} }
} }
.payment-popup { .payment-popup {
padding: 0 30rpx 40rpx; padding: 0 30rpx 40rpx;
background-color: #fff; background-color: #fff;
.head-wrap { .head-wrap {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
line-height: 100rpx; line-height: 100rpx;
height: 100rpx; height: 100rpx;
display: block; display: block;
text-align: center; text-align: center;
position: relative; position: relative;
border-bottom: 2rpx solid $color-line; border-bottom: 2rpx solid $color-line;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.iconfont { .iconfont {
position: absolute; position: absolute;
float: right; float: right;
right: 0; right: 0;
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
} }
} }
.content-wrap { .content-wrap {
max-height: 600rpx; max-height: 600rpx;
overflow-y: auto; overflow-y: auto;
} }
button { button {
margin-top: 40rpx; margin-top: 40rpx;
} }
} }
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="diy-picture" :style="style"> <view data-component-name="diy-picture" class="diy-picture" :style="style">
<view class="fui-picture"> <view class="fui-picture">
<view v-for="(item,index) in value.list" style="line-height: 0;"> <view v-for="(item,index) in value.list" style="line-height: 0;">
<image mode="widthFix" style="width: 100%;height:auto" :src="$util.img(item.imageUrl)" v-if="item.link.wap_url" @click="handlerClick(item)" @tap="handlerClick(item)"></image> <image mode="widthFix" style="width: 100%;height:auto" :src="$util.img(item.imageUrl)" v-if="item.link.wap_url" @click="handlerClick(item)" @tap="handlerClick(item)"></image>
@@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import minx from './minx.js' import DiyMinx from './minx.js'
export default { export default {
name: 'diy-picture', name: 'diy-picture',
props: { props: {
@@ -35,7 +35,7 @@
// this.getDataList(); // this.getDataList();
} }
}, },
mixins: [minx], mixins: [DiyMinx],
computed: { computed: {
style() { style() {
var css = ''; var css = '';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,435 +1,435 @@
<template> <template>
<x-skeleton :type="skeletonType" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-presale" :type="skeletonType" :loading="loading" :configs="skeletonConfig">
<view class="diy-presale" v-if="list.length" :class="[value.template, value.style]" :style="warpCss"> <view class="diy-presale" v-if="list.length" :class="[value.template, value.style]" :style="warpCss">
<template v-if="value.template == 'row1-of1'"> <template v-if="value.template == 'row1-of1'">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/>
</view> </view>
<view class="content" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.btnStyle.control"> <view class="content" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl || value.btnStyle.control">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"> :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]">
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
<view class="discount-price" v-if="value.priceStyle.mainControl"> <view class="discount-price" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }"> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">
{{ showPrice(item).split('.')[0] }} {{ showPrice(item).split('.')[0] }}
</text> </text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }"> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">
{{ '.' + showPrice(item).split('.')[1] }} {{ '.' + showPrice(item).split('.')[1] }}
</text> </text>
</view> </view>
<button v-if="value.btnStyle.control" :style="{ <button v-if="value.btnStyle.control" :style="{
background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '', background: value.btnStyle.theme == 'diy' ? 'linear-gradient(to right,' + value.btnStyle.bgColorStart + ',' + value.btnStyle.bgColorEnd + ')' : '',
color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '', color: value.btnStyle.theme == 'diy' ? value.btnStyle.textColor : '',
borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx' borderRadius: value.btnStyle.aroundRadius * 2 + 'rpx'
}"> }">
{{ value.btnStyle.text }} {{ value.btnStyle.text }}
</button> </button>
</view> </view>
</view> </view>
</template> </template>
<template v-if="value.template == 'horizontal-slide'"> <template v-if="value.template == 'horizontal-slide'">
<scroll-view v-if="value.slideMode == 'scroll'" class="scroll" :scroll-x="true" :show-scrollbar="false"> <scroll-view v-if="value.slideMode == 'scroll'" class="scroll" :scroll-x="true" :show-scrollbar="false">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/>
</view> </view>
<view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl"> <view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"> :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]">
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
<view class="discount-price" v-if="value.priceStyle.mainControl"> <view class="discount-price" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }"> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">
{{ showPrice(item).split('.')[0] }} {{ showPrice(item).split('.')[0] }}
</text> </text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }"> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">
{{ '.' + showPrice(item).split('.')[1] }} {{ '.' + showPrice(item).split('.')[1] }}
</text> </text>
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<swiper v-if="value.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }"> <swiper v-if="value.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }">
<swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']"> <swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']">
<view class="item" v-for="(item, dataIndex) in list[pageIndex]" :key="dataIndex" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, dataIndex) in list[pageIndex]" :key="dataIndex" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(dataIndex)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(dataIndex)"/>
</view> </view>
<view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl"> <view :class="['content', { 'multi-content': value.nameLineMode == 'multiple' }]" v-if="value.goodsNameStyle.control || value.priceStyle.mainControl">
<view v-if="value.goodsNameStyle.control" class="goods-name" <view v-if="value.goodsNameStyle.control" class="goods-name"
:style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }" :style="{ color: value.theme == 'diy' ? value.goodsNameStyle.color : '', fontWeight: value.goodsNameStyle.fontWeight ? 'bold' : '' }"
:class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]"> :class="[{ 'using-hidden': value.nameLineMode == 'single' }, { 'multi-hidden': value.nameLineMode == 'multiple' }]">
{{ item.goods_name }} {{ item.goods_name }}
</view> </view>
<view class="discount-price" v-if="value.priceStyle.mainControl"> <view class="discount-price" v-if="value.priceStyle.mainControl">
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">¥</text>
<text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }"> <text class="price price-style large" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">
{{ showPrice(item).split('.')[0] }} {{ showPrice(item).split('.')[0] }}
</text> </text>
<text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }"> <text class="unit price-style small" :style="{ color: value.theme == 'diy' ? value.priceStyle.mainColor + '!important' : '' }">
{{ '.' + showPrice(item).split('.')[1] }} {{ '.' + showPrice(item).split('.')[1] }}
</text> </text>
</view> </view>
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</template> </template>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-presale', name: 'diy-presale',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
skeletonType:'', skeletonType:'',
skeletonConfig: {}, skeletonConfig: {},
list: [], list: [],
page: 1 page: 1
}; };
}, },
created() { created() {
this.initSkeleton(); this.initSkeleton();
this.getData(); this.getData();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getData(); this.getData();
} }
}, },
computed: { computed: {
warpCss() { warpCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
}, },
// 商品项样式 // 商品项样式
goodsItemCss() { goodsItemCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.elementBgColor + ';'; obj += 'background-color:' + this.value.elementBgColor + ';';
if (this.value.elementAngle == 'round') { if (this.value.elementAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
} }
if (this.value.ornament.type == 'shadow') { if (this.value.ornament.type == 'shadow') {
obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color + ';'; obj += 'box-shadow:' + '0 0 10rpx ' + this.value.ornament.color + ';';
} }
if (this.value.ornament.type == 'stroke') { if (this.value.ornament.type == 'stroke') {
obj += 'border:' + '2rpx solid ' + this.value.ornament.color + ';'; obj += 'border:' + '2rpx solid ' + this.value.ornament.color + ';';
} }
const screenWidth = uni.getSystemInfoSync().windowWidth; const screenWidth = uni.getSystemInfoSync().windowWidth;
if (this.value.template == 'horizontal-slide') { if (this.value.template == 'horizontal-slide') {
var width = ''; var width = '';
if (this.value.slideMode == 'scroll' && this.value.goodsMarginType == 'diy') width = this.rpxUpPx(this if (this.value.slideMode == 'scroll' && this.value.goodsMarginType == 'diy') width = this.rpxUpPx(this
.value.goodsMarginNum * 2); .value.goodsMarginNum * 2);
else width = [screenWidth - this.rpxUpPx(20) * 2 - this.rpxUpPx(200) * 3 - this.rpxUpPx(this.value else width = [screenWidth - this.rpxUpPx(20) * 2 - this.rpxUpPx(200) * 3 - this.rpxUpPx(this.value
.margin.both * 2) * 2] / 6; .margin.both * 2) * 2] / 6;
obj += 'margin-right:' + width + 'px;'; obj += 'margin-right:' + width + 'px;';
obj += 'margin-left:' + width + 'px;'; obj += 'margin-left:' + width + 'px;';
} }
return obj; return obj;
}, },
swiperHeight() { swiperHeight() {
if (this.value.nameLineMode == 'multiple') { if (this.value.nameLineMode == 'multiple') {
return this.value.ornament.type == 'shadow' ? '390rpx' : '382rpx'; return this.value.ornament.type == 'shadow' ? '390rpx' : '382rpx';
} }
return this.value.ornament.type == 'shadow' ? '364rpx' : '348rpx'; return this.value.ornament.type == 'shadow' ? '364rpx' : '348rpx';
} }
}, },
methods: { methods: {
initSkeleton() { initSkeleton() {
if (this.value.template == 'row1-of1') { if (this.value.template == 'row1-of1') {
// 单列 风格 // 单列 风格
this.skeletonType = 'list'; this.skeletonType = 'list';
this.skeletonConfig = { this.skeletonConfig = {
textRows: 2 textRows: 2
}; };
} else if (this.value.template == 'horizontal-slide') { } else if (this.value.template == 'horizontal-slide') {
// 横向滑动 风格 // 横向滑动 风格
this.skeletonType = 'waterfall'; this.skeletonType = 'waterfall';
this.skeletonConfig = { this.skeletonConfig = {
gridRows: 1, gridRows: 1,
gridColumns: 3, gridColumns: 3,
headHeight: '200rpx', headHeight: '200rpx',
textRows: 2, textRows: 2,
textWidth: ['100%', '80%'] textWidth: ['100%', '80%']
}; };
} }
}, },
rpxUpPx(res) { rpxUpPx(res) {
const screenWidth = uni.getSystemInfoSync().windowWidth; const screenWidth = uni.getSystemInfoSync().windowWidth;
var data = (screenWidth * parseInt(res)) / 750; var data = (screenWidth * parseInt(res)) / 750;
return Math.floor(data); return Math.floor(data);
}, },
getData() { getData() {
var data = { var data = {
num: this.value.count num: this.value.count
}; };
if (this.value.sources == 'diy') { if (this.value.sources == 'diy') {
data.num = 0; data.num = 0;
data.goods_id_arr = this.value.goodsId.toString(); data.goods_id_arr = this.value.goodsId.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/presale/api/goods/lists', url: '/presale/api/goods/lists',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
this.list = res.data; this.list = res.data;
// 切屏滚动,每页显示固定数量 // 切屏滚动,每页显示固定数量
if (this.value.template == 'horizontal-slide' && this.value.slideMode == 'slide') { if (this.value.template == 'horizontal-slide' && this.value.slideMode == 'slide') {
let size = 3; let size = 3;
let temp = []; let temp = [];
this.page = Math.ceil(this.list.length / size); this.page = Math.ceil(this.list.length / size);
for (var i = 0; i < this.page; i++) { for (var i = 0; i < this.page; i++) {
temp[i] = []; temp[i] = [];
for (var j = i * size; j < this.list.length; j++) { for (var j = i * size; j < this.list.length; j++) {
if (temp[i].length == size) break; if (temp[i].length == size) break;
temp[i].push(this.list[j]); temp[i].push(this.list[j]);
} }
} }
this.list = temp; this.list = temp;
} }
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
toDetail(e) { toDetail(e) {
this.$util.redirectTo('/pages_promotion/presale/detail', { this.$util.redirectTo('/pages_promotion/presale/detail', {
id: e.presale_id id: e.presale_id
}); });
}, },
imageError(index) { imageError(index) {
this.list[index].goods_image = this.$util.getDefaultImage().goods; this.list[index].goods_image = this.$util.getDefaultImage().goods;
this.$forceUpdate(); this.$forceUpdate();
}, },
showPrice(data) { showPrice(data) {
let price = data.price; let price = data.price;
if (data.member_price && parseFloat(data.member_price) < parseFloat(price)) price = data.member_price; if (data.member_price && parseFloat(data.member_price) < parseFloat(price)) price = data.member_price;
return price; return price;
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
/deep/.uni-scroll-view ::-webkit-scrollbar { /deep/.uni-scroll-view ::-webkit-scrollbar {
/* 隐藏滚动条,但依旧具备可以滚动的功能 */ /* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none; display: none;
width: 0; width: 0;
height: 0; height: 0;
color: transparent; color: transparent;
background: transparent; background: transparent;
} }
/deep/::-webkit-scrollbar { /deep/::-webkit-scrollbar {
display: none; display: none;
width: 0; width: 0;
height: 0; height: 0;
color: transparent; color: transparent;
background: transparent; background: transparent;
} }
scroll-view ::-webkit-scrollbar { scroll-view ::-webkit-scrollbar {
width: 0; width: 0;
height: 0; height: 0;
background-color: transparent; background-color: transparent;
touch-action: none; touch-action: none;
} }
.diy-presale { .diy-presale {
&.row1-of1 { &.row1-of1 {
.item { .item {
display: flex; display: flex;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 16rpx; padding: 16rpx;
&.shadow { &.shadow {
margin: 8rpx 8rpx 20rpx 8rpx; margin: 8rpx 8rpx 20rpx 8rpx;
} }
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.img-wrap { .img-wrap {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
>image { >image {
width: 200rpx; width: 200rpx;
} }
} }
.content { .content {
flex: 1; flex: 1;
margin-left: 20rpx; margin-left: 20rpx;
position: relative; position: relative;
padding: 6rpx 0; padding: 6rpx 0;
.goods-name { .goods-name {
line-height: 1.5; line-height: 1.5;
} }
.discount-price { .discount-price {
white-space: nowrap; white-space: nowrap;
font-weight: bold; font-weight: bold;
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
left: 0; left: 0;
.unit { .unit {
font-size: $font-size-tag; font-size: $font-size-tag;
margin-right: 4rpx; margin-right: 4rpx;
color: $base-color; color: $base-color;
} }
.price { .price {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
color: $base-color; color: $base-color;
} }
} }
button { button {
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
right: 20rpx; right: 20rpx;
margin: 0; margin: 0;
padding: 0 20rpx; padding: 0 20rpx;
background-color: $base-color; background-color: $base-color;
color: #fff; color: #fff;
min-width: 112rpx; min-width: 112rpx;
height: 52rpx; height: 52rpx;
line-height: 52rpx; line-height: 52rpx;
font-size: $font-size-tag; font-size: $font-size-tag;
} }
} }
} }
} }
&.horizontal-slide { &.horizontal-slide {
.scroll { .scroll {
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
padding: 20rpx; padding: 20rpx;
line-height: 1; line-height: 1;
white-space: nowrap; white-space: nowrap;
.item.shadow { .item.shadow {
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
} }
.flex-between { .flex-between {
justify-content: space-between; justify-content: space-between;
} }
.item { .item {
display: inline-block; display: inline-block;
width: 200rpx; width: 200rpx;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
&:nth-child(3n + 3) { &:nth-child(3n + 3) {
width: 198rpx; width: 198rpx;
} }
&.shadow { &.shadow {
margin-top: 8rpx; margin-top: 8rpx;
} }
.img-wrap { .img-wrap {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
margin: 0 auto; margin: 0 auto;
>image { >image {
width: 200rpx; width: 200rpx;
} }
} }
.content { .content {
padding: 10rpx; padding: 10rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
&.multi-content { &.multi-content {
height: 134rpx; height: 134rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.goods-name { .goods-name {
line-height: 1.3; line-height: 1.3;
&.multi-hidden { &.multi-hidden {
white-space: break-spaces; white-space: break-spaces;
} }
} }
.discount-price { .discount-price {
white-space: nowrap; white-space: nowrap;
margin-top: auto; margin-top: auto;
font-weight: bold; font-weight: bold;
line-height: 1; line-height: 1;
.unit { .unit {
font-size: $font-size-tag; font-size: $font-size-tag;
margin-right: 4rpx; margin-right: 4rpx;
color: $base-color; color: $base-color;
} }
.price { .price {
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
color: $base-color; color: $base-color;
} }
} }
} }
} }
.swiper { .swiper {
padding: 20rpx; padding: 20rpx;
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
box-sizing: border-box; box-sizing: border-box;
.swiper-item { .swiper-item {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.item { .item {
width: 200rpx; width: 200rpx;
} }
} }
} }
} }
</style> </style>

View File

@@ -1,116 +1,116 @@
<template> <template>
<view :style="componentStyle"> <view data-component-name="diy-quick-nav" :style="componentStyle">
<scroll-view class="quick-nav" scroll-x="true"> <scroll-view class="quick-nav" scroll-x="true">
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view class="uni-scroll-view-content"> <view class="uni-scroll-view-content">
<!-- #endif --> <!-- #endif -->
<view <view
class="quick-nav-item" class="quick-nav-item"
v-for="(item, index) in value.list" v-for="(item, index) in value.list"
:key="index" :key="index"
@click="redirectTo(item.link)" @click="redirectTo(item.link)"
:style="{ background: 'linear-gradient(to right,' + item.bgColorStart ? item.bgColorStart : '' + ',' + item.bgColorEnd ? item.bgColorEnd : '' + ')' }" :style="{ background: 'linear-gradient(to right,' + item.bgColorStart ? item.bgColorStart : '' + ',' + item.bgColorEnd ? item.bgColorEnd : '' + ')' }"
> >
<view class="quick-img" v-if="item.imageUrl || item.icon"> <view class="quick-img" v-if="item.imageUrl || item.icon">
<image v-if="item.iconType == 'img'" :src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')" mode="heightFix" :show-menu-by-longpress="true"></image> <image v-if="item.iconType == 'img'" :src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')" mode="heightFix" :show-menu-by-longpress="true"></image>
<diy-icon v-if="item.iconType == 'icon'" :icon="item.icon" :value="item.style ? item.style : null" :style="{ fontSize: '60rpx' }"></diy-icon> <diy-icon v-if="item.iconType == 'icon'" :icon="item.icon" :value="item.style ? item.style : null" :style="{ fontSize: '60rpx' }"></diy-icon>
</view> </view>
<text class="quick-text" :style="{ color: item.textColor }">{{ item.title }}</text> <text class="quick-text" :style="{ color: item.textColor }">{{ item.title }}</text>
</view> </view>
<!-- #ifdef MP --> <!-- #ifdef MP -->
</view> </view>
<!-- #endif --> <!-- #endif -->
</scroll-view> </scroll-view>
<ns-login ref="login"></ns-login> <ns-login ref="login"></ns-login>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'diy-quick-nav', name: 'diy-quick-nav',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
created() {}, created() {},
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
componentStyle() { componentStyle() {
var css = ''; var css = '';
css += 'background-color:' + this.value.componentBgColor + ';'; css += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; css += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; css += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; css += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; css += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
css += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament.color : '') + ';'; css += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament.color : '') + ';';
css += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : '') + ';'; css += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : '') + ';';
return css; return css;
} }
}, },
methods: { methods: {
redirectTo(link) { redirectTo(link) {
if (link.wap_url) { if (link.wap_url) {
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) { if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
this.$refs.login.open(link.wap_url); this.$refs.login.open(link.wap_url);
return; return;
} }
} }
this.$util.diyRedirectTo(link); this.$util.diyRedirectTo(link);
} }
} }
}; };
</script> </script>
<style> <style>
.quick-nav >>> .uni-scroll-view-content { .quick-nav >>> .uni-scroll-view-content {
display: flex; display: flex;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.quick-nav { .quick-nav {
.quick-nav-item { .quick-nav-item {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 18rpx; padding: 0 18rpx;
box-sizing: border-box; box-sizing: border-box;
flex-shrink: 0; flex-shrink: 0;
border-radius: 40rpx; border-radius: 40rpx;
margin-right: 20rpx; margin-right: 20rpx;
height: 48rpx; height: 48rpx;
&:first-of-type{ &:first-of-type{
padding-left: 12rpx; padding-left: 12rpx;
} }
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
} }
.quick-img { .quick-img {
margin-right: 6rpx; margin-right: 6rpx;
height: 30rpx; height: 30rpx;
line-height: 1; line-height: 1;
image { image {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
} }
} }
.quick-text { .quick-text {
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
font-size: 24rpx; font-size: 24rpx;
line-height: 1; line-height: 1;
} }
} }
} }
</style> </style>

View File

@@ -1,56 +1,56 @@
<template> <template>
<view class="rich-text-box" :style="richTextWarpCss"> <view data-component-name="diy-rich-text" class="rich-text-box" :style="richTextWarpCss">
<rich-text :nodes="html"></rich-text> <rich-text :nodes="html"></rich-text>
</view> </view>
</template> </template>
<script> <script>
// 富文本 // 富文本
import htmlParser from '@/common/js/html-parser'; import htmlParser from '@/common/js/html-parser';
export default { export default {
name: 'diy-rich-text', name: 'diy-rich-text',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
html: '' html: ''
}; };
}, },
created() { created() {
this.html = htmlParser(this.value.html); this.html = htmlParser(this.value.html);
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
richTextWarpCss: function() { richTextWarpCss: function() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
mounted() {}, mounted() {},
methods: {} methods: {}
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.rich-text-box { .rich-text-box {
padding: $padding; padding: $padding;
box-sizing: border-box; box-sizing: border-box;
height: auto; height: auto;
line-height: 1.5; line-height: 1.5;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-all; word-break: break-all;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,336 +1,336 @@
<template> <template>
<view class="diy-search"> <view data-component-name="diy-search" class="diy-search">
<view class="diy-search-wrap" :class="value.positionWay" :style="fixedCss"> <view class="diy-search-wrap" :class="value.positionWay" :style="fixedCss">
<view :class="['search-box','search-box-'+value.searchStyle]" :style="searchWrapCss" @click="search()"> <view :class="['search-box','search-box-'+value.searchStyle]" :style="searchWrapCss" @click="search()">
<block v-if="[1,2].includes(value.searchStyle)"> <block v-if="[1,2].includes(value.searchStyle)">
<view class="img" v-if="value.searchStyle == 2 && value.iconType == 'img'"> <view class="img" v-if="value.searchStyle == 2 && value.iconType == 'img'">
<image :src="$util.img(value.imageUrl)" mode="heightFix"/> <image :src="$util.img(value.imageUrl)" mode="heightFix"/>
</view> </view>
<diy-icon class="icon" v-if="value.searchStyle == 2 && value.iconType == 'icon'" :icon="value.icon" <diy-icon class="icon" v-if="value.searchStyle == 2 && value.iconType == 'icon'" :icon="value.icon"
:value="value.style ? value.style : 'null'" :value="value.style ? value.style : 'null'"
:style="{ maxWidth: 30 * 2 + 'rpx', maxHeight: 30 * 2 + 'rpx' }"></diy-icon> :style="{ maxWidth: 30 * 2 + 'rpx', maxHeight: 30 * 2 + 'rpx' }"></diy-icon>
<view class="search-content" :style="inputStyle"> <view class="search-content" :style="inputStyle">
<input type="text" class="uni-input ns-font-size-base" maxlength="50" :placeholder="value.title" v-model="searchText" @confirm="search()" disabled="true" :placeholderStyle="placeholderStyle" /> <input type="text" class="uni-input ns-font-size-base" maxlength="50" :placeholder="value.title" v-model="searchText" @confirm="search()" disabled="true" :placeholderStyle="placeholderStyle" />
<text class="iconfont icon-sousuo3" @click.stop="search()" :style="{ color: value.textColor ? value.textColor : 'rgba(0,0,0,0)' }"></text> <text class="iconfont icon-sousuo3" @click.stop="search()" :style="{ color: value.textColor ? value.textColor : 'rgba(0,0,0,0)' }"></text>
</view> </view>
</block> </block>
<block v-if="value.searchStyle == 3"> <block v-if="value.searchStyle == 3">
<view class="search-content" :style="inputStyle" @click.stop="search()"> <view class="search-content" :style="inputStyle" @click.stop="search()">
<text class="iconfont icon-sousuo3" :style="{ color: value.textColor ? value.textColor : 'rgba(0,0,0,0)' }"></text> <text class="iconfont icon-sousuo3" :style="{ color: value.textColor ? value.textColor : 'rgba(0,0,0,0)' }"></text>
<input type="text" class="uni-input ns-font-size-base" maxlength="50" :placeholder="value.title" v-model="searchText" @confirm="search()" disabled="true" @click.stop="search()" :placeholderStyle="placeholderStyle" /> <input type="text" class="uni-input ns-font-size-base" maxlength="50" :placeholder="value.title" v-model="searchText" @confirm="search()" disabled="true" @click.stop="search()" :placeholderStyle="placeholderStyle" />
<text class="search-content-btn" @click.stop="search()" :style="{ 'backgroundColor': value.pageBgColor ? value.pageBgColor : 'rgba(0,0,0,0)' }">搜索</text> <text class="search-content-btn" @click.stop="search()" :style="{ 'backgroundColor': value.pageBgColor ? value.pageBgColor : 'rgba(0,0,0,0)' }">搜索</text>
</view> </view>
<view class="img" v-if="value.iconType == 'img'" @click.stop="redirectTo(value.searchLink)"><image :src="$util.img(value.imageUrl)" mode="heightFix"/> <view class="img" v-if="value.iconType == 'img'" @click.stop="redirectTo(value.searchLink)"><image :src="$util.img(value.imageUrl)" mode="heightFix"/>
</view> </view>
<diy-icon class="icon" v-if="value.iconType == 'icon'" :icon="value.icon" <diy-icon class="icon" v-if="value.iconType == 'icon'" :icon="value.icon"
:value="value.style ? value.style : 'null'" :value="value.style ? value.style : 'null'"
:style="{ maxWidth: 30 * 2 + 'rpx', maxHeight: 30 * 2 + 'rpx' }" :style="{ maxWidth: 30 * 2 + 'rpx', maxHeight: 30 * 2 + 'rpx' }"
@click.stop="redirectTo(value.searchLink)"></diy-icon> @click.stop="redirectTo(value.searchLink)"></diy-icon>
</block> </block>
</view> </view>
</view> </view>
<!-- 解决fixed定位后导航栏塌陷的问题 --> <!-- 解决fixed定位后导航栏塌陷的问题 -->
<view v-if="value.positionWay == 'fixed'" class="u-navbar-placeholder" :style="{ width: '100%', paddingTop: moduleHeight }"></view> <view v-if="value.positionWay == 'fixed'" class="u-navbar-placeholder" :style="{ width: '100%', paddingTop: moduleHeight }"></view>
<ns-login ref="login"></ns-login> <ns-login ref="login"></ns-login>
</view> </view>
</template> </template>
<script> <script>
// 获取系统状态栏的高度 // 获取系统状态栏的高度
let systemInfo = uni.getSystemInfoSync(); let systemInfo = uni.getSystemInfoSync();
let menuButtonInfo = {}; let menuButtonInfo = {};
// 如果是小程序,获取右上角胶囊的尺寸信息,避免导航栏右侧内容与胶囊重叠(支付宝小程序非本API尚未兼容) // 如果是小程序,获取右上角胶囊的尺寸信息,避免导航栏右侧内容与胶囊重叠(支付宝小程序非本API尚未兼容)
// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
menuButtonInfo = uni.getMenuButtonBoundingClientRect(); menuButtonInfo = uni.getMenuButtonBoundingClientRect();
// #endif // #endif
// 搜索 // 搜索
export default { export default {
name: 'diy-search', name: 'diy-search',
props: { props: {
value: { value: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
}, },
topNavColor: String, topNavColor: String,
global: { global: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {};
} }
}, },
haveTopCategory: { haveTopCategory: {
type: Boolean type: Boolean
}, },
followOfficialAccount: { followOfficialAccount: {
type: Object type: Object
}, },
}, },
data() { data() {
return { return {
searchText: '', searchText: '',
menuButtonInfo: menuButtonInfo, menuButtonInfo: menuButtonInfo,
height: 0, height: 0,
placeholderHeight: 0, placeholderHeight: 0,
moduleHeight: 0 moduleHeight: 0
}; };
}, },
computed: { computed: {
fixedCss() { fixedCss() {
var obj = ''; var obj = '';
if (this.value.positionWay == 'fixed') { if (this.value.positionWay == 'fixed') {
let top = this.fixedTop; let top = this.fixedTop;
// 固定定位 // 固定定位
if (this.global.topNavBg) if (this.global.topNavBg)
obj += 'background-color:' + (this.topNavColor == 'transparent' ? this.value.pageBgColor : this obj += 'background-color:' + (this.topNavColor == 'transparent' ? this.value.pageBgColor : this
.topNavColor) + ';'; .topNavColor) + ';';
else else
obj += 'background-color:' + this.value.pageBgColor + ';'; obj += 'background-color:' + this.value.pageBgColor + ';';
obj += 'top:' + top + ';'; obj += 'top:' + top + ';';
obj += 'padding-top:' + this.value.margin.top * 2 + 'rpx;'; obj += 'padding-top:' + this.value.margin.top * 2 + 'rpx;';
obj += 'padding-left:' + this.value.margin.both * 2 + 'rpx;'; obj += 'padding-left:' + this.value.margin.both * 2 + 'rpx;';
obj += 'padding-right:' + this.value.margin.both * 2 + 'rpx;'; obj += 'padding-right:' + this.value.margin.both * 2 + 'rpx;';
obj += 'padding-bottom:' + this.value.margin.bottom * 2 + 'rpx;'; obj += 'padding-bottom:' + this.value.margin.bottom * 2 + 'rpx;';
} }
return obj; return obj;
}, },
searchWrapCss() { searchWrapCss() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
obj += 'text-align:' + this.value.textAlign + ';'; obj += 'text-align:' + this.value.textAlign + ';';
return obj; return obj;
}, },
inputStyle() { inputStyle() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.elementBgColor + ';'; obj += 'background-color:' + this.value.elementBgColor + ';';
if (this.value.borderType == 2) { if (this.value.borderType == 2) {
obj += 'border-radius:' + '40rpx;'; obj += 'border-radius:' + '40rpx;';
} }
return obj; return obj;
}, },
placeholderStyle() { placeholderStyle() {
var obj = ''; var obj = '';
if (this.value.textColor) { if (this.value.textColor) {
obj += 'color:' + this.value.textColor; obj += 'color:' + this.value.textColor;
} else { } else {
obj += 'color: rgba(0,0,0,0)'; obj += 'color: rgba(0,0,0,0)';
} }
return obj; return obj;
}, },
fixedTop() { fixedTop() {
let diyPositionObj = this.$store.state.diyGroupPositionObj; let diyPositionObj = this.$store.state.diyGroupPositionObj;
let data = 0 let data = 0
if (diyPositionObj.diySearch && diyPositionObj.diyIndexPage && diyPositionObj.nsNavbar) { if (diyPositionObj.diySearch && diyPositionObj.diyIndexPage && diyPositionObj.nsNavbar) {
if (diyPositionObj.diySearch.moduleIndex > diyPositionObj.diyIndexPage.moduleIndex) { if (diyPositionObj.diySearch.moduleIndex > diyPositionObj.diyIndexPage.moduleIndex) {
data = diyPositionObj.nsNavbar.originalVal + diyPositionObj.diyIndexPage.originalVal; data = diyPositionObj.nsNavbar.originalVal + diyPositionObj.diyIndexPage.originalVal;
} else { } else {
data = diyPositionObj.nsNavbar.originalVal; data = diyPositionObj.nsNavbar.originalVal;
} }
} else if (diyPositionObj.diySearch && diyPositionObj.nsNavbar) { } else if (diyPositionObj.diySearch && diyPositionObj.nsNavbar) {
data = diyPositionObj.nsNavbar.originalVal; data = diyPositionObj.nsNavbar.originalVal;
} }
data += 'px'; data += 'px';
return data; return data;
} }
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function (nval) { componentRefresh: function (nval) {
} }
}, },
created() { created() {
setTimeout(() => { setTimeout(() => {
// 获取组件的高度默认高度为4545是在375屏幕上的高度 // 获取组件的高度默认高度为4545是在375屏幕上的高度
const query = uni.createSelectorQuery(); const query = uni.createSelectorQuery();
// #ifdef H5 // #ifdef H5
let cssSelect = '.page-header .u-navbar'; let cssSelect = '.page-header .u-navbar';
// #endif // #endif
// #ifdef MP // #ifdef MP
let cssSelect = '.page-header >>> .u-navbar'; let cssSelect = '.page-header >>> .u-navbar';
// #endif // #endif
query query
.select(cssSelect) .select(cssSelect)
.boundingClientRect(data => { .boundingClientRect(data => {
if (this.global.navBarSwitch) { if (this.global.navBarSwitch) {
this.height = data ? data.height : 45; this.height = data ? data.height : 45;
} else { } else {
this.height = data ? data.height : 0; this.height = data ? data.height : 0;
} }
// 如果存在分类导航组件,则追加该组件的高度 // 如果存在分类导航组件,则追加该组件的高度
if (this.haveTopCategory) { if (this.haveTopCategory) {
this.height += 49; this.height += 49;
} }
}) })
.exec(); .exec();
}); });
if (this.value.positionWay == 'fixed') this.navbarPlaceholderHeight(); if (this.value.positionWay == 'fixed') this.navbarPlaceholderHeight();
}, },
mounted() { mounted() {
if (this.value.positionWay == 'fixed') if (this.value.positionWay == 'fixed')
this.setModuleLocatinoFn(); this.setModuleLocatinoFn();
}, },
methods: { methods: {
search() { search() {
this.$util.redirectTo('/pages_tool/goods/search'); this.$util.redirectTo('/pages_tool/goods/search');
}, },
redirectTo(link) { redirectTo(link) {
if (link.wap_url) { if (link.wap_url) {
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) { if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
this.$refs.login.open(link.wap_url); this.$refs.login.open(link.wap_url);
return; return;
} }
} }
this.$util.diyRedirectTo(link); this.$util.diyRedirectTo(link);
}, },
navbarPlaceholderHeight() { navbarPlaceholderHeight() {
let height = 0; let height = 0;
setTimeout(() => { setTimeout(() => {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select('.diy-search-wrap') query.select('.diy-search-wrap')
.boundingClientRect(data => { .boundingClientRect(data => {
// 获取搜索框自身高度 // 获取搜索框自身高度
this.placeholderHeight = data.height; this.placeholderHeight = data.height;
// 通过搜索框自身高度 - 定位模式下的多出的padding-bottom高度 // 通过搜索框自身高度 - 定位模式下的多出的padding-bottom高度
if (this.placeholderHeight) this.placeholderHeight -= this.value.margin.bottom; if (this.placeholderHeight) this.placeholderHeight -= this.value.margin.bottom;
}).exec(); }).exec();
}); });
}, },
// 向vuex中的diyIndexPositionObj增加搜索组件定位位置 // 向vuex中的diyIndexPositionObj增加搜索组件定位位置
setModuleLocatinoFn() { setModuleLocatinoFn() {
this.$nextTick(() => { this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select('.diy-search-wrap') query.select('.diy-search-wrap')
.boundingClientRect(data => { .boundingClientRect(data => {
let diySearch = { let diySearch = {
originalVal: data.height || 0, //自身高度 px originalVal: data.height || 0, //自身高度 px
currVal: 0, //定位高度 currVal: 0, //定位高度
moduleIndex: this.value.moduleIndex //组件在diy-group的位置 moduleIndex: this.value.moduleIndex //组件在diy-group的位置
}; };
this.moduleHeight = (data.height || 0) + 'px'; this.moduleHeight = (data.height || 0) + 'px';
this.$store.commit('setDiyGroupPositionObj', { this.$store.commit('setDiyGroupPositionObj', {
'diySearch': diySearch 'diySearch': diySearch
}); });
}).exec(); }).exec();
}) })
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
/deep/ .uni-input-placeholder { /deep/ .uni-input-placeholder {
overflow: initial; overflow: initial;
} }
.diy-search-wrap { .diy-search-wrap {
overflow: hidden; overflow: hidden;
} }
.fixed { .fixed {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
top: 0; top: 0;
z-index: 991; z-index: 991;
transition: background 0.3s; transition: background 0.3s;
} }
.search-box { .search-box {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
.img { .img {
height: 60rpx; height: 60rpx;
margin-right: 20rpx; margin-right: 20rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.icon { .icon {
width: 170rpx; width: 170rpx;
height: 60rpx; height: 60rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
} }
.search-box-3 { .search-box-3 {
.search-content { .search-content {
display: flex; display: flex;
align-items: center; align-items: center;
height: 68rpx; height: 68rpx;
.iconfont { .iconfont {
position: initial; position: initial;
transform: translateY(0); transform: translateY(0);
width: auto; width: auto;
margin-left: 26rpx; margin-left: 26rpx;
margin-right: 12rpx; margin-right: 12rpx;
font-size: $font-size-base; font-size: $font-size-base;
line-height: 1; line-height: 1;
} }
.uni-input { .uni-input {
flex: 1; flex: 1;
padding-left: 0; padding-left: 0;
height: 68rpx; height: 68rpx;
} }
.search-content-btn { .search-content-btn {
margin-right: 8rpx; margin-right: 8rpx;
width: 116rpx; width: 116rpx;
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
color: #fff; color: #fff;
border-radius: 30rpx; border-radius: 30rpx;
} }
} }
.diy-icon { .diy-icon {
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 0; margin-right: 0;
width: auto; width: auto;
font-size: 74rpx; font-size: 74rpx;
} }
.img { .img {
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 0; margin-right: 0;
} }
} }
.search-content { .search-content {
flex: 1; flex: 1;
} }
.search-content input { .search-content input {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
height: 64rpx; height: 64rpx;
width: 100%; width: 100%;
padding: 0 20rpx 0 40rpx; padding: 0 20rpx 0 40rpx;
color: #333333; color: #333333;
background: none; background: none;
} }
.search-content .iconfont { .search-content .iconfont {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 4rpx; right: 4rpx;
transform: translateY(-50%); transform: translateY(-50%);
font-size: 30rpx; font-size: 30rpx;
z-index: 10; z-index: 10;
width: 80rpx; width: 80rpx;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,170 +1,170 @@
<template> <template>
<x-skeleton type="banner" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-store-label" type="banner" :loading="loading" :configs="skeletonConfig">
<view class="diy-store-label"> <view class="diy-store-label">
<block v-if="businessConfig.store_business == 'store'"> <block v-if="businessConfig.store_business == 'store'">
<scroll-view scroll-x="true" :class="[value.contentStyle, { between: list.length == 3 }]" :style="storeLabelWrapCss" :enable-flex="true"> <scroll-view scroll-x="true" :class="[value.contentStyle, { between: list.length == 3 }]" :style="storeLabelWrapCss" :enable-flex="true">
<view v-for="(item, index) in storeLabel" :class="['item']"> <view v-for="(item, index) in storeLabel" :class="['item']">
<diy-icon v-if="value.icon" class="icon-box" :icon="value.icon" :value="value.style ? value.style : 'null'"></diy-icon> <diy-icon v-if="value.icon" class="icon-box" :icon="value.icon" :value="value.style ? value.style : 'null'"></diy-icon>
<text class="label-name" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item }}</text> <text class="label-name" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item }}</text>
</view> </view>
</scroll-view> </scroll-view>
</block> </block>
<block v-else> <block v-else>
<scroll-view scroll-x="true" :class="[value.contentStyle, { between: list.length == 3 }]" :style="storeLabelWrapCss" :enable-flex="true"> <scroll-view scroll-x="true" :class="[value.contentStyle, { between: list.length == 3 }]" :style="storeLabelWrapCss" :enable-flex="true">
<view v-for="(item, index) in list" :class="['item']"> <view v-for="(item, index) in list" :class="['item']">
<diy-icon v-if="value.icon" class="icon-box" :icon="value.icon" :value="value.style ? value.style : 'null'"></diy-icon> <diy-icon v-if="value.icon" class="icon-box" :icon="value.icon" :value="value.style ? value.style : 'null'"></diy-icon>
<text class="label-name" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item.label_name }}</text> <text class="label-name" :style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">{{ item.label_name }}</text>
</view> </view>
</scroll-view> </scroll-view>
</block> </block>
</view> </view>
</x-skeleton> </x-skeleton>
</template> </template>
<script> <script>
// 门店标签 // 门店标签
export default { export default {
name: 'diy-store-label', name: 'diy-store-label',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
skeletonConfig: { skeletonConfig: {
gridRows: 1, gridRows: 1,
gridRowsGap: '20rpx', gridRowsGap: '20rpx',
headHeight: '40rpx', headHeight: '40rpx',
headBorderRadius: '0' headBorderRadius: '0'
}, },
list: [], list: [],
notice: '', notice: '',
storeLabel: [], storeLabel: [],
businessConfig: "" businessConfig: ""
}; };
}, },
created() { created() {
this.getData(); this.getData();
this.getStoreConfig(); this.getStoreConfig();
}, },
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
this.getData(); this.getData();
} }
}, },
computed: { computed: {
storeLabelWrapCss: function() { storeLabelWrapCss: function() {
var obj = ''; var obj = '';
obj += 'background-color:' + this.value.componentBgColor + ';'; obj += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: { methods: {
getData() { getData() {
var data = { var data = {
page: 1, page: 1,
page_size: 0 page_size: 0
}; };
if (this.value.sources == 'initial') { if (this.value.sources == 'initial') {
data.page_size = this.value.count; data.page_size = this.value.count;
} else if (this.value.sources == 'diy') { } else if (this.value.sources == 'diy') {
data.label_id_arr = this.value.labelIds.toString(); data.label_id_arr = this.value.labelIds.toString();
} }
this.$api.sendRequest({ this.$api.sendRequest({
url: '/store/api/store/labelPage', url: '/store/api/store/labelPage',
data: data, data: data,
success: res => { success: res => {
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
this.list = res.data.list; this.list = res.data.list;
} }
this.loading = false; this.loading = false;
} }
}); });
}, },
getStoreConfig() { getStoreConfig() {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/store/api/config/config', url: '/store/api/config/config',
success: res => { success: res => {
if (res.code >= 0) { if (res.code >= 0) {
this.businessConfig = res.data.business_config; this.businessConfig = res.data.business_config;
if (res.data.business_config.store_business == "store") { if (res.data.business_config.store_business == "store") {
this.getStoreInfo(); this.getStoreInfo();
} }
} }
} }
}); });
}, },
getStoreInfo() { getStoreInfo() {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/api/store/info', url: '/api/store/info',
success: res => { success: res => {
if (res.data) { if (res.data) {
let label_arr = res.data.label_name.split(","); let label_arr = res.data.label_name.split(",");
let label_count = 3; let label_count = 3;
if (this.value.sources == 'initial') label_count = this.value.count; if (this.value.sources == 'initial') label_count = this.value.count;
for (let i = 0; i < label_arr.length; i++) { for (let i = 0; i < label_arr.length; i++) {
if (this.storeLabel.length < label_count && label_arr[i] != '') { if (this.storeLabel.length < label_count && label_arr[i] != '') {
this.storeLabel.push(label_arr[i]) this.storeLabel.push(label_arr[i])
} }
} }
} }
} }
}); });
}, },
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.diy-store-label { .diy-store-label {
.style-1 { .style-1 {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
/deep/ .uni-scroll-view-content { /deep/ .uni-scroll-view-content {
display: flex; display: flex;
align-items: center; align-items: center;
} }
&.between { &.between {
justify-content: space-between; justify-content: space-between;
/deep/.uni-scroll-view-content { /deep/.uni-scroll-view-content {
justify-content: space-between; justify-content: space-between;
} }
} }
.item { .item {
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
align-items: center; align-items: center;
padding-right: 20rpx; padding-right: 20rpx;
.icon-box { .icon-box {
font-size: 50rpx; font-size: 50rpx;
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
margin-right: 10rpx; margin-right: 10rpx;
margin-top: 2rpx; margin-top: 2rpx;
} }
.label-name { .label-name {
line-height: 40rpx; line-height: 40rpx;
} }
&:last-of-type { &:last-of-type {
padding-right: 0; padding-right: 0;
} }
} }
} }
} }
</style> </style>

View File

@@ -1,273 +1,273 @@
<template> <template>
<view class="store-wrap"> <view data-component-name="diy-store" class="store-wrap">
<block v-if="value.style == 1"> <block v-if="value.style == 1">
<view class="store-box store-one"> <view class="store-box store-one">
<view class="store-info"> <view class="store-info">
<view class="info-box" :style="{ color: value.textColor }" @click="toStoreList()"> <view class="info-box" :style="{ color: value.textColor }" @click="toStoreList()">
<block v-if="globalStoreInfo && globalStoreInfo.store_id"> <block v-if="globalStoreInfo && globalStoreInfo.store_id">
<text class="title">{{ globalStoreInfo.store_name }}</text> <text class="title">{{ globalStoreInfo.store_name }}</text>
<text> <text>
<text class="change margin-left">切换</text> <text class="change margin-left">切换</text>
<text class="iconfont icon-right"></text> <text class="iconfont icon-right"></text>
</text> </text>
</block> </block>
<text class="title" v-else>定位中...</text> <text class="title" v-else>定位中...</text>
</view> </view>
<view class="address-wrap" :style="{ color: value.textColor }"> <view class="address-wrap" :style="{ color: value.textColor }">
<text class="iconfont icon-dizhi"></text> <text class="iconfont icon-dizhi"></text>
<text v-if="globalStoreInfo && globalStoreInfo.store_id" @click="mapRoute" class="address">{{ globalStoreInfo.show_address }}</text> <text v-if="globalStoreInfo && globalStoreInfo.store_id" @click="mapRoute" class="address">{{ globalStoreInfo.show_address }}</text>
<text v-else>获取当前位置...</text> <text v-else>获取当前位置...</text>
</view> </view>
</view> </view>
<view class="store-image" @click="selectStore()"> <view class="store-image" @click="selectStore()">
<image :src="$util.img(globalStoreInfo.store_image)" v-if="globalStoreInfo && globalStoreInfo.store_image" mode="aspectFill"></image> <image :src="$util.img(globalStoreInfo.store_image)" v-if="globalStoreInfo && globalStoreInfo.store_image" mode="aspectFill"></image>
<image :src="$util.getDefaultImage().store" v-else mode="aspectFill"></image> <image :src="$util.getDefaultImage().store" v-else mode="aspectFill"></image>
</view> </view>
</view> </view>
</block> </block>
<block v-if="value.style == 2"> <block v-if="value.style == 2">
<view class="store-box store-three" @click="toStoreList()"> <view class="store-box store-three" @click="toStoreList()">
<view class="store-info"> <view class="store-info">
<view class="store-image" @click="selectStore()"> <view class="store-image" @click="selectStore()">
<image :src="$util.img(globalStoreInfo.store_image)" v-if="globalStoreInfo && globalStoreInfo.store_image" mode="aspectFill"></image> <image :src="$util.img(globalStoreInfo.store_image)" v-if="globalStoreInfo && globalStoreInfo.store_image" mode="aspectFill"></image>
<image :src="$util.getDefaultImage().store" v-else mode="aspectFill"></image> <image :src="$util.getDefaultImage().store" v-else mode="aspectFill"></image>
</view> </view>
<view class="info-box" :style="{ color: value.textColor }"> <view class="info-box" :style="{ color: value.textColor }">
<block v-if="globalStoreInfo && globalStoreInfo.store_id"> <block v-if="globalStoreInfo && globalStoreInfo.store_id">
<text class="title">{{ globalStoreInfo.store_name }}</text> <text class="title">{{ globalStoreInfo.store_name }}</text>
<text> <text>
<text class="change margin-left">切换</text> <text class="change margin-left">切换</text>
<text class="iconfont icon-right"></text> <text class="iconfont icon-right"></text>
</text> </text>
</block> </block>
<text class="title" v-else>定位中...</text> <text class="title" v-else>定位中...</text>
</view> </view>
</view> </view>
<view class="store-icon" @click.stop="search()"><text class="iconfont icon-sousuo3" :style="{ color: value.textColor }"></text></view> <view class="store-icon" @click.stop="search()"><text class="iconfont icon-sousuo3" :style="{ color: value.textColor }"></text></view>
</view> </view>
</block> </block>
<block v-if="value.style == 3"> <block v-if="value.style == 3">
<view class="store-box store-four" @click="toStoreList()"> <view class="store-box store-four" @click="toStoreList()">
<view class="store-left-wrap"> <view class="store-left-wrap">
<block v-if="globalStoreInfo && globalStoreInfo.store_id"> <block v-if="globalStoreInfo && globalStoreInfo.store_id">
<text class="iconfont icon-weizhi" :style="{ color: value.textColor }"></text> <text class="iconfont icon-weizhi" :style="{ color: value.textColor }"></text>
<text class="title" :style="{ color: value.textColor }">{{ globalStoreInfo.store_name }}</text> <text class="title" :style="{ color: value.textColor }">{{ globalStoreInfo.store_name }}</text>
<text class="iconfont icon-unfold" :style="{ color: value.textColor }"></text> <text class="iconfont icon-unfold" :style="{ color: value.textColor }"></text>
</block> </block>
<text class="title" v-else>定位中...</text> <text class="title" v-else>定位中...</text>
</view> </view>
<view class="store-right-search"> <view class="store-right-search">
<input type="text" class="uni-input font-size-tag" disabled placeholder="商品搜索" @click.stop="search()" /> <input type="text" class="uni-input font-size-tag" disabled placeholder="商品搜索" @click.stop="search()" />
<text class="iconfont icon-sousuo3" @click.stop="search()"></text> <text class="iconfont icon-sousuo3" @click.stop="search()"></text>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
</template> </template>
<script> <script>
// 门店展示 // 门店展示
import Map from '@/common/js/map/openMap.js'; import Map from '@/common/js/map/openMap.js';
export default { export default {
name: 'diy-store', name: 'diy-store',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
computed: {}, computed: {},
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
created() {}, created() {},
methods: { methods: {
//跳转至门店列表 //跳转至门店列表
toStoreList() { toStoreList() {
this.$util.redirectTo('/pages_tool/store/list'); this.$util.redirectTo('/pages_tool/store/list');
}, },
selectStore() { selectStore() {
if (this.globalStoreInfo) { if (this.globalStoreInfo) {
this.$util.redirectTo('/pages_tool/store/detail', { store_id: this.globalStoreInfo.store_id }); this.$util.redirectTo('/pages_tool/store/detail', { store_id: this.globalStoreInfo.store_id });
} }
}, },
search() { search() {
this.$util.redirectTo('/pages_tool/goods/search'); this.$util.redirectTo('/pages_tool/goods/search');
}, },
mapRoute() { mapRoute() {
if (!isNaN(Number(this.globalStoreInfo.latitude)) && !isNaN(Number(this.globalStoreInfo.longitude))) { if (!isNaN(Number(this.globalStoreInfo.latitude)) && !isNaN(Number(this.globalStoreInfo.longitude))) {
Map.openMap(Number(this.globalStoreInfo.latitude), Number(this.globalStoreInfo.longitude), this.globalStoreInfo.store_name, 'gcj02'); Map.openMap(Number(this.globalStoreInfo.latitude), Number(this.globalStoreInfo.longitude), this.globalStoreInfo.store_name, 'gcj02');
} }
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.store-wrap { .store-wrap {
.store-box { .store-box {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.store-info { .store-info {
height: 100rpx; height: 100rpx;
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
margin-right: 20rpx; margin-right: 20rpx;
.info-box { .info-box {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
margin-bottom: 6rpx; margin-bottom: 6rpx;
text { text {
line-height: 1.2; line-height: 1.2;
} }
.title { .title {
max-width: 480rpx; max-width: 480rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
font-size: $font-size-toolbar; font-size: $font-size-toolbar;
flex: 1; flex: 1;
} }
.change { .change {
font-size: $font-size-goods-tag; font-size: $font-size-goods-tag;
} }
.iconfont { .iconfont {
font-size: $font-size-goods-tag; font-size: $font-size-goods-tag;
} }
} }
.address-wrap { .address-wrap {
line-height: 1.2; line-height: 1.2;
font-size: $font-size-goods-tag; font-size: $font-size-goods-tag;
display: flex; display: flex;
align-items: center; align-items: center;
.iconfont { .iconfont {
font-size: $font-size-goods-tag; font-size: $font-size-goods-tag;
margin-right: 6rpx; margin-right: 6rpx;
} }
.address { .address {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
} }
} }
.store-image { .store-image {
width: 72rpx; width: 72rpx;
height: 72rpx; height: 72rpx;
border-radius: 50%; border-radius: 50%;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
} }
} }
} }
.store-one, .store-one,
.store-three { .store-three {
// padding: 0 20rpx; // padding: 0 20rpx;
} }
.store-two { .store-two {
.store-image { .store-image {
align-self: flex-start; align-self: flex-start;
margin-right: 14rpx; margin-right: 14rpx;
} }
.info-box { .info-box {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
.store-info { .store-info {
height: 106rpx; height: 106rpx;
} }
.switchover { .switchover {
display: flex; display: flex;
width: 120rpx; width: 120rpx;
} }
} }
.store-three { .store-three {
.store-info { .store-info {
height: auto; height: auto;
justify-content: flex-start; justify-content: flex-start;
flex-direction: inherit; flex-direction: inherit;
align-items: center; align-items: center;
} }
.info-box { .info-box {
margin-left: 18rpx; margin-left: 18rpx;
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
.store-icon text { .store-icon text {
font-size: 36rpx; font-size: 36rpx;
color: #fff; color: #fff;
} }
} }
.store-four { .store-four {
padding: 0 !important; padding: 0 !important;
.store-left-wrap { .store-left-wrap {
display: flex; display: flex;
align-items: center; align-items: center;
line-height: 1; line-height: 1;
.icon-weizhi { .icon-weizhi {
margin-right: 6rpx; margin-right: 6rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.icon-unfold { .icon-unfold {
margin-left: 6rpx; margin-left: 6rpx;
} }
.title { .title {
display: inline-block; display: inline-block;
max-width: 160rpx; max-width: 160rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
} }
.store-right-search { .store-right-search {
width: calc(100% - 260rpx); width: calc(100% - 260rpx);
position: relative; position: relative;
input { input {
width: 100%; width: 100%;
height: 72rpx; height: 72rpx;
line-height: 72rpx; line-height: 72rpx;
background-color: #ffffff; background-color: #ffffff;
border: none; border: none;
border-radius: 72rpx; border-radius: 72rpx;
padding-left: 30rpx; padding-left: 30rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.icon-sousuo3 { .icon-sousuo3 {
position: absolute; position: absolute;
right: 30rpx; right: 30rpx;
top: 10rpx; top: 10rpx;
font-size: 28rpx; font-size: 28rpx;
color: #909399; color: #909399;
} }
} }
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +1,46 @@
<template> <template>
<video class="diy-video" :src="$util.img(value.videoUrl)" :poster="$util.img(value.imageUrl)" :style="videoWarpCss" objectFit="cover"></video> <video data-component-name="diy-video" class="diy-video" :src="$util.img(value.videoUrl)" :poster="$util.img(value.imageUrl)" :style="videoWarpCss" objectFit="cover"></video>
</template> </template>
<script> <script>
// 视频 // 视频
export default { export default {
name: 'diy-video', name: 'diy-video',
props: { props: {
value: { value: {
type: Object type: Object
} }
}, },
data() { data() {
return {}; return {};
}, },
created() {}, created() {},
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
}, },
computed: { computed: {
videoWarpCss: function() { videoWarpCss: function() {
var obj = ''; var obj = '';
if (this.value.componentAngle == 'round') { if (this.value.componentAngle == 'round') {
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;'; obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
return obj; return obj;
} }
}, },
methods: {} methods: {}
}; };
</script> </script>
<style scoped> <style scoped>
video { video {
width: 100%; width: 100%;
} }
.diy-video>>>.uni-video-container { .diy-video>>>.uni-video-container {
background-color: transparent; background-color: transparent;
} }
</style> </style>

View File

@@ -2,6 +2,7 @@ export default {
methods: { methods: {
// 异步触发事件 // 异步触发事件
async __$emitEvent(payload = {eventName: '__unnamedEvent', data: {}, promiseCallback: null}) { async __$emitEvent(payload = {eventName: '__unnamedEvent', data: {}, promiseCallback: null}) {
// console.log('__$emitEvent', payload)
await this.$eventBus?.emit(payload.eventName, payload.data, payload.promiseCallback) await this.$eventBus?.emit(payload.eventName, payload.data, payload.promiseCallback)
}, },
} }