微信小程序代码记录

css命名

https://github.com/Tencent/tdesign-common/blob/main/css-naming.md

界面设置

页面标题

json

{"usingComponents": {},"navigationBarTitleText": "库存搜索","navigationBarBackgroundColor": "#9D1117","navigationBarTextStyle":"white"
}

页面标题镂空

json

{"usingComponents": {},"navigationBarTitleText": "库存搜索","navigationStyle": "custom"
}

循环判断

循环

wx:for="{{firstRow}}" wx:key="id" wx:for-item="item" 

是否显示

wx:if="{{false}}"
wx:if="{{true}}"

三种状态判断显示

<block wx:if="{{true}}"> </block>
<block wx:elif="{{true}}"> </block>
<block wx:else> </block>

样式三元判断

<view class="start-btn {{isRunning?'start-on':'start-off'}}" bindtap="startGame">START</view>

跳转页面

导航栏页面的跳转

<navigator url="../kehulist/kehulist" open-type="switchTab" class="xidi-buts-item"><text>取消</text></navigator>

普通跳转

<navigator url="../kehulist/kehulist" open-type="navigate" hover-class="none" class="xidi-buts-item"><text>取消</text></navigator>

筛选页面跳转 wx.navigateTo

toFilter: function () {wx.navigateTo({url: '../genjinfilter/genjinfilter?key=1',})},

返回上一页面

wx.navigateBack({delta: 2
})

常用CSS

选择最后一个之外的

css


.radio-item:not(:last-child) {margin-right: 20rpx;
}

一行文字超出打点

css

.dizhi-info .shiqu_txt {max-width: 300rpx;display: -webkit-box;-webkit-line-clamp: 1;text-overflow: ellipsis;-webkit-box-orient: vertical;overflow: hidden;word-wrap: break-word;
}

投影样式

效果
在这里插入图片描述
css

.form-wrap {background-color: #ffffff;padding: 10rpx;margin: 20rpx;border-radius: 20rpx;box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.10);
}

渐变色背景

渐进效果
在这里插入图片描述
css

background-image: linear-gradient(90deg, #FFEBDE 30%, #ffffff);

断崖效果
在这里插入图片描述
css

background: linear-gradient(180deg, #F8C859 150px, #FAFAFA 150px);

字体图标

css引用
base64引用法

/* 字体图标 */
@font-face {font-family: "iconfont";src: url('这里贴上base64代码') format('woff2')
}.iconfont {font-family: "iconfont" !important;font-size: 16px;font-style: normal;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;
}.icon-trust:before {content: "\e76b";
}

用法


<text class="iconfont icon-training"></text></view>

base64代码获取
1,访问图标项目的 css
在这里插入图片描述

2,复制base64代码(更新图标项目之后,需要重新获取)
在这里插入图片描述

资源


图标项目首页:https://www.iconfont.cn/home/index?spm=a313x.7781069.1998910419.3

效果
在这里插入图片描述

图片image

icon图标

效果
在这里插入图片描述
用法

<view class="icon-img"><image src="../../images/chang-city.png" mode="aspectFit"/></view>

aspectFit 说明

缩放模式,保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来。

头像、标题图

效果
在这里插入图片描述
用法

<image mode="aspectFill" src="../../images/mendian001@2x.png"></image>

aspectFill 说明

保持纵横比缩放图片,只保证图片的短边能完全显示出来`

内容图

效果
在这里插入图片描述

用法

<image mode="aspectFill" src="../../images/mendian001@2x.png"></image>

aspectFill 说明

保持纵横比缩放图片,只保证图片的短边能完全显示出来`

背景图

效果
在这里插入图片描述
用法

<!-- 背景图片 -->
<view class="dati-plane"><image class="dati-bg-img dati-bg-1" src="https://dati-1251106769.cos.ap-nanjing.myqcloud.com/dati001.png"mode="aspectFill"></image>
</view>
<!-- 背景图片 -->

aspectFill 说明

保持纵横比缩放图片,只保证图片的短边能完全显示出来。

css

.dati-plane {position: fixed;width: 100%;height: 100%;
}.dati-bg-img {display: block;width: 750rpx;height: 100%;
}

图片预览

效果
在这里插入图片描述

wxml

<view class="imglist-choose-box"><!-- 图片预览 --><block wx:if="{{imageList.length != 0}}"><view class="imglist-item" wx:for="{{imageList}}" wx:key="*this" wx:for-item="image"><image mode="aspectFill" src="{{image}}" data-src="{{image}}" bindtap="previewImage"></image><view class="delete-tag" catchtap="deleteImage" data-index="{{index}}"><text></text></view></view></block><!-- 图片预览 --></view>

css

保持纵横比缩放图片,只保证图片的短边能完全显示出来。

data

// 图片预览imageList: ['http://www.mylhh.com/mylhh/user/skin/scroller/20220101001.png', 'http://www.mylhh.com/mylhh/user/skin/scroller/20221012001.png'],

js

 // 预览图片previewImage: function (e) {const current = e.target.dataset.srcwx.previewImage({current,urls: this.data.imageList})},// 预览图片

视频

video

效果
在这里插入图片描述

用法


<video class="video-bg-img"poster="https://1251106769.vod2.myqcloud.com/8ccb2785vodgzp1251106769/9df193aa5285890816016256328/5285890816016550025.png"src="https://1251106769.vod2.myqcloud.com/40f2ca2dvodtransgzp1251106769/9df193aa5285890816016256328/adp.10.m3u8"id="myVideo" loop="{{true}}" show-mute-btn="{{true}}" controls="{{false}}" autoplay="{{true}}"enable-auto-rotation="{{true}}"></video>

说明


show-mute-btn 是否显示静音按钮
loop 是否循环播放
enable-auto-rotation 开启手机横屏时自动全屏
autoplay 是否自动播放
controls 是否显示默认播放控件

按钮

按钮套件


/* ui-button */
.ui-button {width: 100%;display: flex;justify-content: center;align-items: center;background-color: #9D1117;border: #9D1117 solid 1px;color: #fff;border-radius: 10rpx;line-height: 90rpx;box-sizing: border-box;
}/* .ui-button  */
.ui-button .iconfont {font-size: 45rpx;margin-right: 10rpx;
}/* .ui-button-info */
.ui-button-info {color: #909399;background: #f4f4f5;border-color: #d3d4d6;
}/* ui-button-delete */
.ui-button-delete {background-color: #ffffff;color: #333333;border: #DEDEDE solid 1px;
}/* ui-button-primary */
.ui-button-primary {background-color: #9D1117;color: #ffffff;
}/* ui-button-line */
.ui-button-line {background-color: transparent;border: #9D1117 solid 1px;color: #9D1117;
}/* ui-button-copy */
.ui-button-copy {background-color: #EDF4FF;border: #74A9FF solid 1px;color: #2E7CFF;line-height: 50rpx;width: 100rpx;font-size: 24rpx;
}

按钮组


/* 按钮组 */
.ui-button-group {padding: 20rpx;display: flex;align-items: center;
}.ui-button-group .ui-button:nth-child(2) {flex: 2;margin-left: 20rpx;
}.ui-button-group .ui-button:nth-child(1) {flex: 1;
}

悬浮操作按钮

效果
在这里插入图片描述

用法


<!-- 悬浮按钮2 -->
<view class="ui-float-box"><view class="ui-float-but" bindtap="toFilter" data-url="../sjadd/sjadd"><text class="iconfont icon-add-select"></text></view>
</view>
<!-- 2悬浮按钮2 -->

css


/* 悬浮按钮2 */
.ui-float-box {position: fixed;right: 40rpx;bottom: 60rpx;
}.ui-float-but {background-color: #9D1117;border-radius: 100%;width: 90rpx;height: 90rpx;display: flex;align-items: center;justify-content: center;
}.ui-float-but .iconfont {color: #ffffff;font-size: 65rpx;
}
/* 悬浮按钮2 */

按钮组件

重置效果
在这里插入图片描述

用法


<view class="share-item share-wx"><button open-type="share"><text class="iconfont icon-iconfont16x16moban"></text><view>微信好友</view></button></view>

重置css


.share-group button:not([size='mini']) {width: 100%;padding: 0;line-height: initial;font-size: initial;font-weight: normal;background-color: transparent;color: #9D9D9D;
}

基本按钮

效果
在这里插入图片描述

用法


<view class="ui-button-group"><view class="ui-button">确认到访</view>
</view>

css


/* ui-button */
.ui-button {width: 100%;display: flex;justify-content: center;align-items: center;background-color: #2E7CFF;border: #2E7CFF solid 1px;color: #fff;border-radius: 10rpx;line-height: 90rpx;box-sizing: border-box;
}

轻按钮

效果
在这里插入图片描述
用法

<view class="ui-button-group"><view class="ui-button ui-button-delete">确认到访</view>
</view>

css


.ui-button-line {background-color: #ffffff;border: #2E7CFF solid 1px;color: #2E7CFF;
}

弱按钮

效果
在这里插入图片描述

css


/* ui-button-delete */
.ui-button-delete {background-color: #ffffff;color: #333333;border: #DEDEDE solid 1px;
}

复制按钮

效果
在这里插入图片描述

css


.ui-button-copy {background-color: #EDF4FF;border: #74A9FF solid 1px;color: #2E7CFF;line-height: 50rpx;width: 100rpx;font-size: 24rpx;
}

成功按钮

效果
在这里插入图片描述
用法

<view class="ui-button-group"><view class="ui-button ui-button-info">拒绝</view><view class="ui-button ui-button-primary">同意到访</view></view>

css

/* .ui-button-info */
.ui-button-info {color: #909399;background: #f4f4f5;border-color: #d3d4d6;
}
/* ui-button-primary */
.ui-button-primary {background-color: #EDF4FF;color: #2E7CFF;
}

吸底按钮

效果
在这里插入图片描述
用法

<!-- ui-affix -->
<view class="ui-affix-block"></view>
<view class="ui-affix"><view class="ui-button-group"><view bindtap="testModal" data-key="拒绝" data-tip="访客将会收系统发送的申请失败通知。" class="ui-button ui-button-delete">拒绝</view><view bindtap="testModal" data-key="同意到访" data-tip="访客将会收系统发送的预约成功通知。" class="ui-button ui-button-primary">同意到访</view></view>
</view>

css

/* 吸底 */
.ui-affix-block {height: 150rpx;
}
.ui-affix {background-color: #fff;position: fixed;width: 100%;bottom: 0rpx;border-top: #EAEAEA solid 1px;z-index: 3;
}

不吸底

用法

<!-- ui-affix-no -->
<view class="ui-affix-no"><view class="ui-button-group"><view class="ui-button ui-button-delete">删除</view><view class="ui-button ui-button-primary" bindtap="toFilter" data-url="../sjprofile/sjprofile">保存</view></view>
</view>

css

/* 不吸底 */
.ui-affix-no .ui-button-group {display: block;border-top: #F5F5F5 solid 1px;
}.ui-affix-no .ui-button-group .ui-button:nth-child(2) {margin-left: 0;
}.ui-affix-no .ui-button-group .ui-button:not(:first-child) {margin-top: 20rpx;
}

按钮动效

用法

/* 按钮动画 */
.start-on {animation: animat 1.1s infinite;
}
@keyframes animat {0% {transform: scale(.9);}50% {transform: scale(1);}100% {transform: scale(.9);}
}

页面提示

暂无数据

效果
在这里插入图片描述

用法


<!-- 暂无数据 -->
<block wx:if="{{true}}"><view class="ui-msg"><view class="ui-msg-icon"><text class="iconfont icon-icon_nomemo"></text><view class="ui-msg-tit">暂无记录</view></view></view>
</block>
<!-- 暂无数据 -->

css


/* 暂无数据 ui-msg */
.ui-msg {padding-top: 50rpx;padding-bottom: 50rpx;text-align: center;
}
.ui-msg-icon {font-size: 28rpx;color: #9D9D9D;
}
.ui-msg-icon .iconfont {font-size: 80rpx;color: #B2B2B2;margin-bottom: 40rpx;
}
/* 暂无数据 ui-msg */

Tab切换

一行tab

效果
在这里插入图片描述

用法

<view class="ui-tab"><view class="ui-tab-item {{1==TabCur?'cur':''}}" bindtap="tabSelect" data-id="1">全部</view><view class="ui-tab-item {{2==TabCur?'cur':''}}" bindtap="tabSelect" data-id="2">审核中</view><view class="ui-tab-item {{3==TabCur?'cur':''}}" bindtap="tabSelect" data-id="3">预约成功</view><view class="ui-tab-item {{4==TabCur?'cur':''}}" bindtap="tabSelect" data-id="4">已完成</view>
</view>

css

/* ui-tab */
.ui-tab {padding: 20rpx;font-size: 28rpx;display: flex;align-items: center;justify-content: space-around;background-color: #ffffff;
}.ui-tab .ui-tab-item {position: relative;padding: 10rpx;
}.ui-tab .cur {color: #2E7CFC;font-weight: bold;
}.ui-tab .cur::before {content: " ";display: inline-block;height: 4rpx;width: 40rpx;background-color: #2E7CFC;position: absolute;left: 50%;margin-left: -20rpx;bottom: 0;
}
/* ui-tab */

data

// tab选项卡默认值TabCur: 1,

js

  //tab切换tabSelect(e) {this.setData({TabCur: e.currentTarget.dataset.id})},//tab切换

列表

历史记录

效果
在这里插入图片描述

用法


<view class="ui-list-item"><view class="ui-list-info" bindtap="historyTyping" data-key="张无忌">张无忌</view><view class="iconfont icon-icon_roundclose" data-test="删除此条搜索记录" bindtap="test"></view></view>

css


/* .ui-list */
.ui-list .ui-list-item {font-size: 28rpx;display: flex;align-items: center;justify-content: space-between;padding-right: 20rpx;padding-bottom: 20rpx;margin-bottom: 20rpx;border-bottom: #F0F0F0 solid 1px;
}.ui-list .ui-list-item:last-child {padding-bottom: 0rpx;margin-bottom: 0rpx;border-bottom: none;
}.ui-list .ui-list-item .ui-list-info {flex: 1;
}.ui-list .ui-list-info .txt-h {font-size: 28rpx;
}.ui-list .ui-list-info .txt-p {font-size: 24rpx;color: #9D9D9D;
}.ui-list .ui-list-item .iconfont {color: #B2B2B2;
}

通讯录列表

效果
在这里插入图片描述

用法


<!-- 通讯录列表 -->
<view class="ui-list"><view class="ui-list-item" bindtap="testDialog" data-key="张无忌4"><view class="ui-list-avatar"><image mode="aspectFill" src="../../images/xt001.png"></image></view><view class="ui-list-info"><view class="txt-h">张无忌</view><view class="txt-p">营销代表</view></view></view>
</view>
<!-- 通讯录列表 -->

css


.ui-list .ui-list-avatar {width: 80rpx;height: 80rpx;border-radius: 10rpx;box-sizing: border-box;margin-right: 20rpx;
}.ui-list .ui-list-avatar image {display: block;width: 100%;height: 100%;border-radius: 10rpx;
}

描述列表

效果
在这里插入图片描述

用法


<view class="ui-descr"><view class="ui-descr-item"><view class="ui-descr-label">访客姓名</view><view class="ui-descr-content">林煜 <text>150****8247</text></view></view><view class="ui-descr-item"><view class="ui-descr-label">访客单位</view><view class="ui-descr-content">武汉藏龙岛星巴克</view></view><view class="ui-descr-item"><view class="ui-descr-label">到访日期</view><view class="ui-descr-content">2021-05-12(周四)14:30</view></view><view class="ui-descr-item"><view class="ui-descr-label">拜访员工</view><view class="ui-descr-content">张三丰 <text>销售代表</text></view></view><view class="ui-descr-item"><view class="ui-descr-label">备注</view><view class="ui-descr-content">来送咖啡豆的</view></view></view>

css


/* 描述列表 .ui-descr */
.ui-descr .ui-descr-item {font-size: 28rpx;display: flex;align-items: center;padding-bottom: 6rpx;margin-bottom: 6rpx;
}.ui-descr .ui-descr-item:last-child {padding-bottom: 0rpx;margin-bottom: 0rpx;
}.ui-descr .ui-descr-label {color: #9D9D9D;width: 130rpx;
}.ui-descr-content text {color: #9D9D9D;
}/* 描述列表 .ui-descr */

箭头

效果
在这里插入图片描述

用法

css


/* ui-arrow-flex */
.ui-arrow {display: flex;align-items: center;justify-content: flex-end;
}/* ui-arrow */
.ui-arrow:after {content: " ";display: inline-block;height: 15rpx;width: 15rpx;border-width: 4rpx 4rpx 0 0;border-color: #b2b2b2;border-style: solid;-webkit-transform: matrix(.71, .71, -.71, .71, 0, 0);transform: matrix(.71, .71, -.71, .71, 0, 0);margin-left: 10rpx;
}

卡片

简单卡片

效果
在这里插入图片描述
用法

<view class="ui-card"><view class="ui-card-header"><view class="ui-card-user"><image class="card-user-image" mode="aspectFill" src="/images/070602.png"></image><view class="card-user-text"><view>小林</view><text>2020-04-18 22:06:16</text></view></view><view class="ui-card-status"><view>面试</view></view></view><view class="ui-card-body ui-arrow"><view class="ui-descr"><view class="ui-descr-item"><view class="ui-descr-label">访客姓名</view><view class="ui-descr-content">林煜 <text>150****8247</text></view></view><view class="ui-descr-item"><view class="ui-descr-label">到访日期</view><view class="ui-descr-content">2021-05-12(周四)14:30</view></view><view class="ui-descr-item"><view class="ui-descr-label">拜访员工</view><view class="ui-descr-content">张三丰 <text>销售代表</text></view></view><view class="ui-descr-item"><view class="ui-descr-label">备注</view><view class="ui-descr-content">来送咖啡豆的</view></view></view></view><view class="ui-card-footer"><view class="ui-button-group"><view class="ui-button ui-button-info">拒绝</view><view class="ui-button ui-button-primary">同意到访</view></view></view></view>

css

/* 基础卡片 */
/* ui-card */
.ui-card {background-color: #fff;border-radius: 20rpx;box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.10);margin-bottom: 20rpx;
}/* ui-card-header */
.ui-card-header {display: flex;justify-content: space-between;align-items: center;font-size: 28rpx;line-height: 1;padding: 30rpx 30rpx;border-bottom: #F0F0F0 solid 1px;
}.ui-card-header .ui-card-user {display: flex;flex: 1;align-items: center;
}.ui-card-header .card-user-text {margin-left: 0rpx;
}.ui-card-header .card-user-text view {margin-bottom: 6rpx;
}.ui-card-header .card-user-text text {color: #999999;font-size: 24rpx;
}.ui-card-footer {padding: 20rpx 30rpx;border-radius: 0rpx 0rpx 20rpx 20rpx;background-color: #F7F7F7;font-size: 28rpx;color: #999999;
}/* item-status-con */
.ui-card-status {text-align: right;color: #2E7CFC;
}
/* ui-card-body */
.ui-card-body {padding: 30rpx;
}
/* 基础卡片 */

自定义弹窗

底部弹出窗口

效果
在这里插入图片描述

用法

<view class="shop-fot" bindtap="showModal" data-target="bottom"><text class="iconfont icon-share"></text><view>分享</view></view>

wxml

<!-- 自定义弹出窗口-底部弹出 -->
<view class="basic-modal bottom {{basicModal=='bottom'?'show':''}}" catchtouchmove="true"><view class="basic-dialog"><view class="basic-dialog-head"><view class="basic-tit">分享到</view><view class="basic-tit-hide" bindtap="hideModal"></view></view><view class="basic-dialog-con"><view class="share-group"><view class="share-item share-wx"><button open-type="share"><text class="iconfont icon-iconfont16x16moban"></text><view>微信好友</view></button></view><view class="share-item  share-img" bindtap="renderToCanvas" data-target="haibao"><text class="iconfont icon-pic-fill"></text><view>生成海报</view></view></view></view><view class="basic-dialog-fot"><view class="basic-fot-hide" bindtap="hideModal">取消</view></view></view>
</view>
<!-- 自定义弹出窗口-底部弹出 -->

css


/* 自定义弹窗 */
/* bg */
.basic-modal {position: fixed;top: 0;right: 0;bottom: 0;left: 0;z-index: 1110;opacity: 0;background: rgba(0, 0, 0, 0.75);outline: 0;backface-visibility: hidden;perspective: 2000rpx;transition: all 0.3s ease-in-out 0s;pointer-events: none;
}/* 显示bg */
.basic-modal.show {opacity: 1;overflow-x: hidden;overflow-y: auto;pointer-events: auto;
}/* 显示body */
.basic-modal .basic-dialog {position: relative;display: inline-block;vertical-align: middle;margin-left: auto;margin-right: auto;background-color: #ffffff;
}/* pro-dialog-head */
.basic-dialog-head {position: relative;display: flex;align-items: center;justify-content: space-between;padding: 40rpx 25rpx 40rpx 40rpx;
}.basic-dialog-head .basic-tit {font-size: 40rpx;font-weight: 700;
}/* 取消按钮 */
.basic-dialog-head .basic-tit-hide {width: 36rpx;height: 36rpx;background-color: #ffffff;padding: 15rpx;
}.basic-dialog-head .basic-tit-hide:after,
.basic-dialog-head .basic-tit-hide:before {background-color: #404041;content: '';display: block;height: 4rpx;
}.basic-dialog-head .basic-tit-hide:after {transform: translateY(10rpx) rotate(135deg);
}.basic-dialog-head .basic-tit-hide:before {transform: translateY(14rpx) rotate(-135deg);
}/* sku-dialog-fot */
.basic-dialog-fot {border-top: #F5F5F5 solid 1px;padding: 20rpx;text-align: center;
}/* 居中-外布局 */
.basic-modal.center {transform: scale(1.185);display: flex;align-items: center;justify-content: center;
}/* 居中-显示 */
.basic-modal.center.show {transition-duration: 0.3s;-ms-transform: scale(1);transform: scale(1);
}/* 居中-内布局 */
.basic-modal.center .basic-dialog {width: 680rpx;max-width: 100%;border-radius: 10rpx;overflow: hidden;
}
/* 顶部 */
/* 顶部-外布局 */
.basic-modal.top {margin-top: -1000rpx;
}.basic-modal.top.show {margin-top: 0;
}
/* 顶部-内布局 */
.basic-modal.top .basic-dialog {border-radius: 0rpx 0rpx 20rpx 20rpx;position: absolute;width: 100%;top: 0rpx;z-index: 1111;
}/* 底部 */
/* 底部-外布局 */
.basic-modal.bottom {margin-bottom: -1000rpx;
}.basic-modal.bottom.show {margin-bottom: 0;
}/* 底部-内布局 */
.basic-modal.bottom .basic-dialog {border-radius: 20rpx 20rpx 0rpx 0rpx;position: absolute;width: 100%;bottom: 0rpx;z-index: 1111;
}/* 居中海报-外布局 */
.basic-modal.haibao {display: flex;align-items: center;justify-content: center;
}/* 居中海报-显示 */
.basic-modal.haibao.show {transition-duration: 0.3s;
}/* 居中海报-内布局 */
.basic-modal.haibao .basic-dialog {max-width: 100%;border-radius: 10rpx;background-color: transparent;
}.basic-modal.haibao .basic-dialog .basic-dialog-head {padding: 0rpx;position: relative;display: block;
}.basic-modal.haibao .basic-dialog-head .basic-tit-hide {background-color: transparent;position: absolute;right: -50rpx;top: -50rpx;border: #ffffff solid 1px;border-radius: 50rpx;padding: 8rpx;
}.basic-modal.haibao .basic-dialog-head .basic-tit-hide:after,
.basic-modal.haibao .basic-dialog-head .basic-tit-hide:before {background-color: #ffffff;
}.basic-modal.haibao .basic-dialog-fot {border-top: none;
}.basic-modal.haibao .basic-fot-hide {background-color: #FF6200;color: #ffffff;display: block;padding: 20rpx;margin: 0rpx 40rpx;border-radius: 80rpx;
}

js


//自定义弹窗 显示proshowModal: function (e) {const target = e.currentTarget.dataset.target;console.log(target);this.setData({target,basicModal: target});},// 自定义弹窗 隐藏prohideModal: function (e) {var that = this;let target = that.data.target;this.setData({basicModal: false,})},

顶部弹出窗口

效果
在这里插入图片描述

用法


<view bindtap="showModal" data-target="top" class="todo-search"><text class="iconfont icon-icon_search"></text>筛选</view>

wxml


<!-- 自定义弹出窗口-顶部弹出 -->
<view class="basic-modal top {{basicModal=='top'?'show':''}}" catchtouchmove="true"><view class="basic-dialog"><view class="basic-dialog-head"><view class="basic-tit">请选择筛选条件</view><view class="basic-tit-hide" bindtap="hideModal"></view></view><view class="basic-dialog-con"><view class="filter-plane"><view class="filter-row"><view class="filter-title">日期</view><view class="filter-body"><!--  --><view class="filter-data-con"><view class="filter-date"><picker mode="date" value="{{date_star}}" start="2015-09-01" end="2040-08-01"bindchange="bindDateChange_star"><view class="filter-date-input">{{date_star}}</view></picker></view><view class="filter-date">到</view><view class="filter-date"><picker mode="date" value="{{date_end}}" start="2015-09-01" end="2040-08-01"bindchange="bindDateChange_end"><view class=".filter-date-input">{{date_end}}</view></picker></view></view><!--  --><view class="filter-key-list"><text class="filter-key" data-test="直接改变上面日期起始" bindtap="test">今日</text><textclass="filter-key filter-key-cur" data-test="直接改变上面日期起始" bindtap="test">昨日</text><textclass="filter-key" data-test="直接改变上面日期起始e" bindtap="test">本周</text><text class="filter-key"data-test="点击条件" bindtap="test">上周</text><text class="filter-key" data-test="点击条件"bindtap="test">本月</text><text class="filter-key" data-test="点击条件" bindtap="test">上月</text><textclass="filter-key" data-test="点击条件" bindtap="test">本年</text></view></view></view><view class="filter-row"><view class="filter-title">状态</view><view class="filter-body"><view class="filter-key-list"><text class="filter-key" data-test="点击条件" bindtap="test">待处理</text><text class="filter-key"data-test="点击条件" bindtap="test">已同意</text><text class="filter-key filter-key-cur" data-test="点击条件"bindtap="test">已到访</text><text class="filter-key" data-test="点击条件" bindtap="test">已过期</text><textclass="filter-key" data-test="点击条件" bindtap="test">已拒绝</text></view></view></view></view><!--  --></view><view class="basic-dialog-fot"><view class="ui-button-group"><view bindtap="exit" class="ui-button ui-button-delete">取消</view><view class="ui-button">确认</view></view></view></view>
</view>
<!-- 自定义弹出窗口-顶部弹出 -->

居中弹出窗口

效果
在这里插入图片描述

用法


<view class="shop-fot" bindtap="showModal" data-target="center"><text class="iconfont icon-share"></text><view>分享</view></view>

wxml


<!-- 自定义弹出窗口-居中弹出 -->
<view class="basic-modal center {{basicModal=='center'?'show':''}}" catchtouchmove="true"><view class="basic-dialog"><view class="basic-dialog-head"><view class="basic-tit">分享到</view><view class="basic-tit-hide" bindtap="hideModal"></view></view><view class="basic-dialog-con"><view class="share-group"><view class="share-item share-wx"><button open-type="share"><text class="iconfont icon-iconfont16x16moban"></text><view>微信好友</view></button></view><view class="share-item  share-img"><text class="iconfont icon-pic-fill"></text><view>生成海报</view></view></view></view><view class="basic-dialog-fot"><view class="basic-fot-hide" bindtap="hideModal">取消</view></view></view>
</view>
<!-- 自定义弹出窗口-居中弹出 -->

海报居中弹出窗口

效果
在这里插入图片描述

用法


<view class="share-item  share-img" bindtap="renderToCanvas" data-target="haibao"><text class="iconfont icon-pic-fill"></text><view>生成海报</view></view>

wxml


<!-- 自定义弹出窗口-海报-弹出 -->
<view class="basic-modal haibao {{basicModal=='haibao'?'show':''}}" catchtouchmove="true"><view class="basic-dialog"><view class="basic-dialog-head"><view class="basic-tit-hide" bindtap="hideModal"></view></view><view class="basic-dialog-con"><view class="wxml-canvas"><wxml-to-canvas width="300" height="433" class="widget"></wxml-to-canvas></view></view><view class="basic-dialog-fot"><view class="basic-fot-hide" bindtap="extraImage">保存图片</view></view></view>
</view>
<!-- 自定义弹出窗口-海报-弹出 -->

交互动效

更多操作菜单

效果
用法
js


// 更多操作菜单 showActionSheetcaoZuo: function (e) {wx.showActionSheet({itemList: ['查看客户资料', '编辑', '删除'],success(res) {console.log(res.tapIndex)},fail(res) {console.log(res.errMsg)}})},

手风琴

效果
用户


<view class=" ui-card"><view bind:tap="kindToggle" id="{{0}}"  class="ui-card-header {{openlist[0] ? 'card-show' : 'card-hide'}} ui-arrow"><view class="ui-card-title"><view class="hrda-card-tit">基础信息</view><view class="hrda-card-action">编辑</view></view></view><view wx:if="{{openlist[0]}}" class="ui-card-body">1</view></view>

js

data: {openlist: [true, true, true, true, true, true, true, true, true, true, true, true],},kindToggle(e) {const id = e.currentTarget.idconst openlist = this.data.openlistthis.setData({[`openlist[${id}]`]: !this.data.openlist[`${id}`],})},

拨打电话

效果

用法

<view bindtap="daDianhua" data-haoma="15010828247" class="ui-button  ui-button-copy">拨打</view> 

js

  // 拨打电话 dataset 传值daDianhua: function (e) {const haoma = e.currentTarget.dataset.haoma;console.log(haoma);wx.makePhoneCall({phoneNumber: haoma, //dataset 传值success: function () {console.log('确定')},fail: function () {console.log('取消')}})},// 拨打电话 dataset 传值

微信弹出组件

效果
在这里插入图片描述

用法


<view bindtap="popup" data-position="bottom" class="tongyi-tip f-c-s"><view class="link-success f-c-c"><text class="iconfont icon-seleted"></text></view> 确认已阅读并同意 <text class="link-txt">《参展须知》</text>
</view><!-- 弹出微信组件 page-container --><page-container show="{{show}}" round="{{true}}" overlay="{{true}}" duration="300" position="{{position}}"bindenter="onEnter" bindafterenter="afterEnter" custom-style="{{customStyle}}"><view class="ui-page"><view class="ui-page-body"><view class="ui-page-head"><view class="pop-tit">请填写拜访员工手机号</view><view class="pop-exit" bindtap="exit"></view></view><view class="pop-body"><view class="fangke-usre-form"><view class="form-item"><view class="input-cell"><input focus="{{focus}}" class="form-input" type="number" value="{{inputVal}}" cursor-spacing="100"placeholder="请输入拜访员工手机号码" /></view><view class="button-cell"><button bindtap="test" data-test="先判断为空,再提示加载,有的话提示成功" class="ui-button">确定</button></view></view></view><!-- 历史记录 --><view class="search-history" wx:if="{{true}}"><view class="search-history-title">历史拜访员工</view><view class="search-history-con"><!--  --><view class="search-key"><text bindtap="historyTyping" data-key="15010828247">15010828247(林*)</text><textclass="iconfont icon-icon_roundclose" data-test="删除此条记录" bindtap="test"></text></view><!--  --></view></view><!-- 历史记录 --></view></view></view>
</page-container>

css


/* ui-page */
.ui-page {width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;
}.ui-page-body {flex: 1;padding-bottom: 20rpx;
}.ui-page-head {position: relative;display: flex;align-items: center;justify-content: space-between;padding: 40rpx 25rpx 40rpx 40rpx;
}.ui-page-head .pop-tit {font-size: 40rpx;font-weight: 700;
}/* 取消 */
.ui-page-head .pop-exit {width: 36rpx;height: 36rpx;background-color: #ffffff;padding: 15rpx;
}.ui-page-head .pop-exit:after,
.ui-page-head .pop-exit:before {background-color: #404041;content: '';display: block;height: 4rpx;
}.ui-page-head .pop-exit:after {transform: translateY(10rpx) rotate(135deg);
}.ui-page-head .pop-exit:before {transform: translateY(14rpx) rotate(-135deg);
}

data


// 弹出微信组件show: false,

js

// 弹出微信组件 page-containerpopup: function (e) {const position = e.currentTarget.dataset.positionlet duration = this.data.durationthis.setData({position,show: true,customStyle: 'z-index:10'})},// 隐藏微信组件 page-containerexit() {this.setData({show: false})// wx.navigateBack()},

询问弹出框

效果
在这里插入图片描述

用法


<view class="ui-list-item" bindtap="testModal" data-key="张无忌3">

js

// 选择用户testModal: function (e) {const username = e.currentTarget.dataset.key;wx.showModal({title: '拜访员工',content: '确认选择【' + username + '】',success(res) {if (res.confirm) {console.log('用户点击确定')} else if (res.cancel) {console.log('用户点击取消')}}})},

轻提示

效果
在这里插入图片描述

用法


<view class="iconfont icon-icon_roundclose" data-test="删除此条搜索记录" bindtap="test"></view>

js

// test-showToasttest: function (e) {// democonst test = e.currentTarget.dataset.test;wx.showToast({title: test,icon: 'none',duration: 2000})// demo},// test-showToast

普通页面跳转

用法

<view bindtap="toFilter" data-url="../fangkeuser/fangkeuser" class="ui-button ui-button-line"><textclass="iconfont icon-icon_addresslist"></text>添加访客信息</view></view>

js

  // 页面演示跳转 wx.navigateTo toFilter: function (e) {const toUrl = e.currentTarget.dataset.url;wx.navigateTo({url: toUrl,})},// 页面演示跳转 wx.navigateTo 

tabBar页面跳转

用法

<view class="sub-nav-item" bindtap="toNavigator" data-url="../fenlei/fenlei"><view class="sub-nav-img"><image src="../../images/nav-icon-001.png" mode="aspectFit" /></view><view class="sub-nav-text">注射指导</view></view>

js

// 导航栏页面跳转 wx.switchTabtoNavigator: function (e) {const toUrl = e.currentTarget.dataset.url;wx.switchTab({url: toUrl,})},

返回上一页

用法

<view class="ui-search-clear" bindtap="fanHui"><view>取消</view></view>

js

  // 返回上一页fanHui:function(e){wx.navigateBack({delta: 1})},

其他

绑定并阻止事件冒泡

用法

<view id="outer" bindtap="handleTap1">outer view<view id="middle" catchtap="handleTap2">middle view<view id="inner" bindtap="handleTap3">inner view</view></view>
</view>

说明

catchtap="handleTap2"

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/71888.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

微信小程序系列(3)如何用微信小程序写一个论坛?贴心代码详解(一)发帖

源代码已开源&#xff0c;如果对你有帮助可以点个星&#xff1a;https://github.com/linkaimin/xdzs 写论坛不难&#xff0c;重点是各页面之间的信息传递&#xff01; 先放成品图&#xff0c;虽然有点单调。。。。但是麻雀虽小五脏俱全&#xff01; 论坛功能&#xff1a; 1…

手把手教你写一个微信小程序(附源码)

以下内容来自公众号逆锋起笔&#xff0c;关注每日干货及时送达 来源&#xff1a;blog.csdn.net/zwb19940216/ article/details/81023191 前言 现在微信小程序越来越火了&#xff0c;相信不少人都通过各种途径学习过微信小程序或者尝试开发&#xff0c;作者就是曾经由于兴趣了解…

为什么复制粘贴时html,为什么我粘贴文本的时候发现和复制时的不一样

2008-05-12 在新浪博客里&#xff0c;看到好多人博客里的每篇文章后面都有一些很个性的链接或者图片&#xff0c;就像QQ空间里的签名一样&#xff0c;应该怎样做 一、我的个性名片的代码如下&#xff1a;CRL南宁市欢迎你的光临说明&#xff1a;其余的蓝色部分你可以更换为自己的…

最新HTML微信聊天对话生成器网页源码+实测可用

正文: 用来装X_OR制作抖音幽默段子还是不错的&#xff08;如果需要的人多&#xff0c;有时间的话后面可能会考虑出一个高级点的&#xff09;。 下载源码后双击 index.html 运行即可&#xff0c;不需要服务器。 程序: wwgrlu.lanzouy.com/iMwK00grrvhe 图片:

会员信息管理系统

欢迎大佬指点&#xff01;&#xff01; 亲测可用&#xff01; 改了 几个bug 更新 之后的代码 会员信息管理系统文本说明 功能&#xff1a; 消费 ①从vipinf.txt的文本文件中LOAD()建立一个链表&#xff0c;之后的操作全部在链表中进行。在链表中修改消费信息&#xff0c;并将…

积分运营系列—一款优秀积分商城产品需具备的准则与功能梳理

我们常说的商业积分的应用&#xff0c;往往有两个核心目的&#xff1a; 给予商业预期的用户行为予回报&#xff0c;导向更深入、更频繁的核心业务。维护用户&#xff08;客户&#xff09;&#xff0c;绑定客户&#xff0c;引导低价值用户转化为高价值用户。 积分体系是否能够…

分享小程序会员积分管理系统的优势_会员积分管理系统的作用

商场、超市对用户进行管理&#xff0c;基本上都是采用积分管理&#xff0c;通过用户注册&#xff0c;施行积分积累制度&#xff0c;不仅能够有效吸引消费者消费更多商品或者服务&#xff0c;商家还能采用会员营销的方式&#xff0c;开展会员日活动&#xff0c;通过积分管理模式…

第三方支付-手续费系统设计与实现

1、手续费中的概念 1.1 手续费的定义 根据百度百科的定义&#xff0c;“手续费&#xff1a;办事过程中所产生的费用”&#xff0c;“手续费”可以这样解释&#xff1a;为代理他人办理有关事项所收取的一种劳务补偿&#xff1b;或对委托人来讲&#xff0c;是属于因他人代为办理…

盛世昊通董车长APP新功能上线,看视频获收益

近日,盛世昊通董车长APP新功能上线,新版本中首次加入视频广告“任务中心”,看视频广告就能获取收益,通过该功能,用户只要在董车长APP中邀请好友一起看视频做任务即可获取高额视频豆。积累的视频豆可以在董车长APP兑换分红收益,这个既能开开心心看广告又能获取丰厚收益的功…

CRM原型、协同办公APP高保真原型/审批管理、办公申请、工单管理、任务管理、日程管理、工作报告、签到考勤、客户管理、销售线索、商机管理、订单管理、账务管理、统计报表、回款管理、发票管理、报销管理

CRM及协同办公APP高保真原型/审批管理、办公申请、工单管理、任务管理、日程管理、工作报告、签到考勤、客户管理、销售线索、商机管理、订单管理、账务管理、统计报表、回款管理、发票管理、报销管理 Axure原型演示及下载地址&#xff1a;Axure Cloud - Generating Project A…

电子不停车收费系统(ETC)专题(1)——系统概述

我国道路交通普遍较为拥堵已经在国人的脑海中留下了深刻的印象&#xff0c;每当车辆通过收费站时都要停下来缴费&#xff0c;既耽误了司机和乘客的时间&#xff0c;又消耗了交通管理部门的人力、物力和财力&#xff0c;更重要的时候&#xff0c;加剧了交通拥挤。因此&#xff0…

互融云汽车融资租赁系统-汽车金融软件开发

汽车融资租赁作为汽车金融中典型的业务模式&#xff0c;是一种依托现金分期付款的方式&#xff0c;在此基础之上引入出租服务中所有权和使用权分离的特性&#xff0c;租赁结束后将所有权转移给承租人的现代营销方式。即在租赁期内&#xff0c;用户以分期支付租金的方式获得车辆…

酷信即时通讯开放平台和支付系统简述

一、通过网页申请成为开发者&#xff0c;审核通过后集成开放平台SDK到自己的APP或游戏中&#xff0c;运行时如果未安装酷信IM则提示安装&#xff0c;否则提示是否授权使用酷信IM帐号登录。 二、登录后&#xff0c;可分享给酷信即时通讯的好友、群组、生活圈&#xff0c;比如分享…

免费会员管理管理系统

csdn下载链接&#xff1a; https://download.csdn.net/download/zhupengfei/11422345 本软件可免费使用&#xff0c;无限制。需要的可以直接下载安装。本软件win10可直接使用&#xff0c;其他版本的可能需要安装.net4.0组件。安装时有提示。 最近比较忙&#xff0c;软件已免…

开发CRM客户关系管理系统需要多少钱

现阶段各个领域都少不了和客户相处&#xff0c;所以也必须对住户关联进行监管&#xff0c;跟踪业务流程进度情况&#xff0c;促使协作。伴随着现代科技的高速发展&#xff0c;及其管理模式的兴起&#xff0c;CRM客户关系管理系统开发逐步完善&#xff0c;而且在销售工作普及化。…

恒溢会员管理系统使用说明

恒溢会员管理系统是这样一款专业的会员管理软件&#xff0c;可针对不同行业&#xff08;理发店、美容院、美甲店、休闲、娱乐、汽车服务、洗衣店等&#xff09;&#xff0c;可实现对会员基本信息、充值、套餐、消费、优惠、提成、统计、报表等综合性的管理&#xff0c;可选配短…

免费的图书管图书借阅管理系统

百宝云图书借阅系统 基于百宝云在线表单设计的图书借阅系统&#xff0c;实现了三个基本功能。主要运用到了百宝云表单系统的数据联动和计算公式。这样借书还书只要扫一个条形码&#xff0c;图书资料会自动显示。本套系统免费使用&#xff0c;适合中小型图书借阅机构和简单图书…

CRM系统多少钱一套?盘点主流各大CRM系统价格

阅读本文你将了解&#xff1a;1.CRM定价规则&#xff1b;2.各大CRM系统报价&#xff08;CRM系统多少钱一套&#xff09;;3.CRM系统费用构成。 一、CRM定价规则 很多企业都寻求使用CRM系统来管理客户关系&#xff0c;从而优化管理流程&#xff0c;提升业绩。 对于企业而言&…

开发一套CRM系统要花多少钱?收费标准又是怎么样?

如今&#xff0c;越来越多的企业开始选择定制开发CRM客户管理系统。那么开发一套CRM系统要花多少钱&#xff1f;收费标准又是怎么样的呢&#xff1f; CRM企业管理软件&#xff0c;在90年代末美国落地初期&#xff0c;通用型CRM软件因更易学习、费用较便宜等原因曾风靡一时。 …

快鲸写字楼物业管理软件收费标准如何?

快鲸写字楼物业管理软件介绍 快鲸写字楼物业管理软件是快鲸科技有限公司旗下产品&#xff0c;有着强大的系统功能优势&#xff0c;能助力商住不动产快速招商&#xff0c;智能租赁管理和高效的资产管理。适用于写字楼、商场、公寓、办公园区、创客空间、商业楼宇等业态。 软件自…