Initial commit

This commit is contained in:
admin
2025-12-08 14:39:07 +08:00
commit 9d4f78656b
782 changed files with 66418 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
# card
功能:商品(联络人)信息卡
大小:*≈7KB*
支持平台:
| 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
|:---:|:---:|:---:|:---:|:---:|:---:|
| √ | √ | √ | √ | √ | √(nvue 不支持) |
### 效果图
![效果图](../../docs/assets/plugin/card.png)
### 参数列表
|参数名|是否必须|类型|说明|
|:---- |:---|:----- |----- |
|src|是|String|图片Url|
|title|是|String|标题|
|desc|是|String|描述|
|url|是|String|跳转url|
|color|是|String|文字颜色|
|bgcolor|是|String|卡片背景颜色|
|border|是|String|卡片边框颜色|
### 说明:
1. 可以显示商品信息卡片/联络人信息卡片
### 基础库要求:
满足最低要求即可
?> 如果希望页面上使用本组件,组件的路径为 *path/to/mp-html/card/card*

View File

@@ -0,0 +1,14 @@
module.exports = {
usingComponents: {
'my-card': '../card/card'
},
handler (file) {
if (file.isBuffer()) {
let content = file.contents.toString()
if (file.path.includes('parser.js')) {
content = content.replace(/trustTags\s*:\s*makeMap\('/, "trustTags: makeMap('card,").replace(/voidTags\s*:\s*makeMap\('/, "voidTags: makeMap('card,")
}
file.contents = Buffer.from(content)
}
}
}

View File

@@ -0,0 +1,7 @@
/**
* @fileoverview Card 插件
*/
function Card (vm) {
}
module.exports = Card

View File

@@ -0,0 +1,3 @@
module.exports = {
template: '<my-card wx:if="{{n.name==\'card\'}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" mode="{{opts[5]}}" src="{{n.attrs.src}}" title="{{n.attrs.title}}" desc="{{n.attrs.desc}}" url="{{n.attrs.url}}" color="{{n.attrs.color}}" bgcolor="{{n.attrs.bgcolor}}" border="{{n.attrs.border}}" name="{{n.attrs.name}}" data-i="{{i}}" data-source="card" />'
}

View File

@@ -0,0 +1,26 @@
/**
* @fileoverview card 组件
*/
Component({
properties: {
mode: {
type: Boolean,
default: false
},
src: String,
title: String,
desc: String,
url: String,
color: String,
bgcolor: String,
border: String
},
data: {},
methods: {
onClick (e) {
if (this.properties.url && this.properties.url.trim().length > 6 && !this.properties.mode) {
wx.navigateTo({ url: this.properties.url })
}
}
}
})

View File

@@ -0,0 +1,3 @@
{
"component": true
}

View File

@@ -0,0 +1,9 @@
<view class="card" bindtap="onClick" style="background-color:{{bgcolor||'#a4d0ff'}};border:{{border||'1px solid #FFF'}};color:{{color||'#000'}}">
<image class="card-img" mode="aspectFill" src="{{src}}" />
<view class="text-wrap text-wrap-width" wx:if="{{!!desc}}">
<view class="title one-t">{{title}}</view>
<view class="desc one-t">{{desc}}</view>
</view>
<view wx:else class="text-wrap-width title more-t">{{title}}</view>
<image class="card-icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABCFBMVEUAAAC/v7+qqqqZmZmLi6KJnZ2ImZmHlpaGlKGMjJmSkp6Li5eQkJuKlZ+Pj5mOjpeJkpuNjZ6IkJmHj5eLi5uKkpmGjZqJj5uLi5eIjpmIjZiKj5qKj5mJjpiHjJqJjZaGj5iKj5eIjJmKjpqHi5eGjZeIi5eHjZiIi5eHjJiIjpaHjJeIjZiGjJeIjZiGjJaGjJeIi5aGjJeHi5eHi5aHjJeHjJaHjJeGi5eHjJaHjJeGi5aGi5aHjJeHjJaGjJeGjJeHjJaHi5eGi5eHjJaHjJeGjJaGjJeHi5aHjJeHjJeHi5aGjJeHi5aGjJaHi5eGjJaHi5eHjJaGi5eGi5aHjJeGi5aGi5apAvjmAAAAV3RSTlMABAYKCw0PERMUFRYXGBkbHB0eICEjJiksLS8wMjQ1ODk7PD9ATFZXWFlaW1xdXl+Hi6msu7/Dx8vMzs/R0tTV19na3N3f4uTn6evs7e7v8PHy9PX7/P18cCTXAAABEklEQVRo3u2YWU5CQRQFn4qCM4LzhIoDAorzrIgCigiCimf/O/Gj3UIlmJxaQFXSea/T90aRMcYYY4zpG0ZPu9cZMnAi6SsLBjqS9LnJBcqSpC53Sjs/kqSPNaxwGAqtFbrQXKILjQW68DpPF17m6EI9TRdqM3TheZouVCbpQnkcK5RC4T5BF27jdOFqhC5cDtOFixhdOB+iC2cDdOEoggttLrDbk6QW5/+WJB1T/r1e+FAHWT/2q/35scsiF/w3cdZ/R13Y+8H/MMb6Hycgfz74n6ZYfzXJ+mspyF8I/vos68cep0X4eV2EB4SD4H9bZP3vy+yTtL3KjrGddXgQ34BXCVvwMmT7P69zjDHGGGP6gF83lHISOctsKQAAAABJRU5ErkJggg=="></image>
</view>

View File

@@ -0,0 +1,55 @@
.one-t {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
transition: all linear 0.2s;
}
.more-t {
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
transition: all linear 0.2s;
}
.card {
width: 80%;
margin: 10rpx auto;
max-width: 700rpx;
max-height: 140rpx;
box-sizing: border-box;
overflow: hidden;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0 20rpx 10rpx;
border-radius: 12rpx;
}
.card-img {
width: 96rpx;
height: 96rpx;
border-radius: 12rpx;
flex: 0 0 96rpx;
}
.card-icon {
width: 30rpx;
height: 96rpx;
}
.card .text-wrap {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.card .text-wrap-width {
width: 72%;
}
.card .title {
font-weight: bold;
font-size: 34rpx;
line-height: 48rpx;
}
.card .desc {
font-size: 27rpx;
line-height: 37rpx;
}

View File

@@ -0,0 +1,3 @@
module.exports = {
template: '<my-card v-if="n.name==\'card\'" :class="n.attrs.class" :style="n.attrs.style" :mode="opts[5]" :src="n.attrs.src" :title="n.attrs.title" :desc="n.attrs.desc" :url="n.attrs.url" :color="n.attrs.color" :bgcolor="n.attrs.bgcolor" :border="n.attrs.border" :name="n.attrs.name" :data-i="i" data-source="card" />'
}

View File

@@ -0,0 +1,122 @@
<template>
<view class="card" @click="onClick" :style="[customStyle]" :data-i="$attrs['data-i']">
<image class="card-img" mode="aspectFill" :src="src" />
<view class="text-wrap text-wrap-width" v-if="!!desc">
<view class="title one-t">{{title}}</view>
<view class="desc one-t">{{desc}}</view>
</view>
<view v-else class="text-wrap-width title more-t">{{title}}</view>
<image class="card-icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABCFBMVEUAAAC/v7+qqqqZmZmLi6KJnZ2ImZmHlpaGlKGMjJmSkp6Li5eQkJuKlZ+Pj5mOjpeJkpuNjZ6IkJmHj5eLi5uKkpmGjZqJj5uLi5eIjpmIjZiKj5qKj5mJjpiHjJqJjZaGj5iKj5eIjJmKjpqHi5eGjZeIi5eHjZiIi5eHjJiIjpaHjJeIjZiGjJeIjZiGjJaGjJeIi5aGjJeHi5eHi5aHjJeHjJaHjJeGi5eHjJaHjJeGi5aGi5aHjJeHjJaGjJeGjJeHjJaHi5eGi5eHjJaHjJeGjJaGjJeHi5aHjJeHjJeHi5aGjJeHi5aGjJaHi5eGjJaHi5eHjJaGi5eGi5aHjJeGi5aGi5apAvjmAAAAV3RSTlMABAYKCw0PERMUFRYXGBkbHB0eICEjJiksLS8wMjQ1ODk7PD9ATFZXWFlaW1xdXl+Hi6msu7/Dx8vMzs/R0tTV19na3N3f4uTn6evs7e7v8PHy9PX7/P18cCTXAAABEklEQVRo3u2YWU5CQRQFn4qCM4LzhIoDAorzrIgCigiCimf/O/Gj3UIlmJxaQFXSea/T90aRMcYYY4zpG0ZPu9cZMnAi6SsLBjqS9LnJBcqSpC53Sjs/kqSPNaxwGAqtFbrQXKILjQW68DpPF17m6EI9TRdqM3TheZouVCbpQnkcK5RC4T5BF27jdOFqhC5cDtOFixhdOB+iC2cDdOEoggttLrDbk6QW5/+WJB1T/r1e+FAHWT/2q/35scsiF/w3cdZ/R13Y+8H/MMb6Hycgfz74n6ZYfzXJ+mspyF8I/vos68cep0X4eV2EB4SD4H9bZP3vy+yTtL3KjrGddXgQ34BXCVvwMmT7P69zjDHGGGP6gF83lHISOctsKQAAAABJRU5ErkJggg=="></image>
</view>
</template>
<script>
export default {
props: {
mode: {
type: Boolean,
default: false
},
src: String,
title: String,
desc: String,
url: String,
color: String,
bgcolor: String,
border: String
},
data () {
return {
}
},
computed: {
customStyle () {
return {
'background-color': this.bgColor || '#a4d0ff',
border: this.border || '1px solid #FFF',
color: this.color || '#000'
}
}
},
methods: {
onClick (e) {
if (this.url && this.url.trim().length > 6 && !this.mode) {
uni.navigateTo({ url: this.url })
}
this.$emit('click', e)
}
}
}
</script>
<style lang="scss">
.one-t {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
transition: all linear 0.2s;
}
.more-t {
overflow: hidden;
text-overflow: ellipsis;
word-break:break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
transition: all linear 0.2s;
}
.card {
width: 80%;
margin: 10rpx auto;
max-width: 700rpx;
max-height: 140rpx;
box-sizing: border-box;
overflow: hidden;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0 20rpx 10rpx;
border-radius: 12rpx;
&-img {
width: 96rpx;
height: 96rpx;
border-radius: 12rpx;
flex: 0 0 96rpx;
}
&-icon {
width: 30rpx;
height: 96rpx;
}
.text-wrap {
display: flex;
flex-direction: column;
justify-content: space-between;
&-width {
width: 72%;
}
}
.title {
font-weight: bold;
font-size: 34rpx;
line-height: 48rpx;
}
.desc {
font-size: 27rpx;
line-height: 37rpx;
}
}
</style>