Compare commits
3 Commits
afc29b1153
...
d41e9875fe
Author | SHA1 | Date |
---|---|---|
|
d41e9875fe | |
|
0402da40ac | |
|
4f59ca0038 |
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "jhprjv2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# jhwxapp
|
||||
|
||||
jhwxapp
|
|
@ -0,0 +1,44 @@
|
|||
import {request} from '../utils/request'
|
||||
|
||||
// 查询劳资投诉列表
|
||||
export function list(data) {
|
||||
return request({
|
||||
url: '/wechat/flow/flowLabour/list',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 统计劳资投诉信息
|
||||
export function findGroupCountByApprove(data) {
|
||||
return request({
|
||||
url: '/wechat/flow/flowLabour/findGroupCountByApprove',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询劳资投诉进度
|
||||
export function findMyFlowLabourNodes(flowId) {
|
||||
return request({
|
||||
url: '/wechat/flow/flowLabour/findMyFlowLabourNodes/'+flowId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
//劳资投诉审批
|
||||
export function submitFlowLabour(data) {
|
||||
return request({
|
||||
url: '/wechat/flow/flowLabour/submitFlowLabour',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取劳资投诉详细信息
|
||||
export function getInfo(flowId) {
|
||||
return request({
|
||||
url: '/wechat/flow/flowLabour/info/'+flowId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
import {request} from '../utils/request'
|
||||
|
||||
// 获取流程申请类型
|
||||
export function myDefinitionList(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/myDefinitionList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 启动流程实例
|
||||
export function startProcessInstance(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/startProcessInstance',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询流程节点
|
||||
export function readDeployNotes(deployId) {
|
||||
return request({
|
||||
url: '/wechat/flowTask/readDeployNotes/'+deployId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 取消流程申请
|
||||
export function stopProcess(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/stopProcess',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 撤回流程办理
|
||||
export function revokeProcess(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/revokeProcess',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 审批任务流程
|
||||
export function complete(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/complete',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 驳回任务流程
|
||||
export function reject(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/reject',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 退回任务流程
|
||||
export function returnTask(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/return',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 委派任务流程
|
||||
export function delegateTask(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/delegateTask',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 转办任务流程
|
||||
export function assignTask(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/assignTask',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除流程实例
|
||||
export function deleteInstance(instanceId) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/delete/'+instanceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取所有可回退的节点
|
||||
export function returnList(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/returnList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据流程Id查询操作日志
|
||||
export function findCommentByProcInsId(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/findCommentByProcInsId',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据条件查询我的代办任务
|
||||
export function myAwaitFlowTaskList(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/myAwaitFlowTaskList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据条件查询我的已办任务
|
||||
export function myFinishedFlowTaskList(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/myFinishedFlowTaskList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据条件查询所有流申请
|
||||
export function allInstanceList(data) {
|
||||
return request({
|
||||
url: '/wechat/flowTask/allList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据条件统计所有流程任务
|
||||
export function queryTaskCount(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/queryCount',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据条件统计分类流程任务
|
||||
export function queryTaskCountByCategory(data){
|
||||
return request({
|
||||
url: '/wechat/flowTask/findAwaitCountGroupByCategory',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
import {
|
||||
request
|
||||
} from '../utils/request'
|
||||
|
||||
// 获取验证码
|
||||
export function getCodeImg() {
|
||||
return request({
|
||||
url: '/wechat/captchaImage',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 用户登录
|
||||
export function login(data) {
|
||||
return request({
|
||||
url: '/wechat/login',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改密码
|
||||
export function updatePwd(data) {
|
||||
return request({
|
||||
url: '/wechat/v1/updatePassword',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改密码
|
||||
export function codeUpdatePwd(data) {
|
||||
return request({
|
||||
url: '/wechat/v1/codeUpdatePwd',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 用户退出方法
|
||||
export function loginOut() {
|
||||
return request({
|
||||
'url': '/wechat/loginOut',
|
||||
'method': 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 发送短信验证码
|
||||
export function sendPhoneMessage(phoneNumber) {
|
||||
return request({
|
||||
url: '/wechat/v1/sendPhoneMessage',
|
||||
method: 'post',
|
||||
data: {
|
||||
'phoneNumber': phoneNumber
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 查询公众号消息授权
|
||||
export function findOpenUserMsgId(openId) {
|
||||
return request({
|
||||
'url': '/wechat/findOpenUserMsgId/' + openId,
|
||||
'method': 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 删除公众号消息授权
|
||||
export function delOpenUserMsgId(openId) {
|
||||
return request({
|
||||
'url': '/wechat/delOpenUserMsgId/' + openId,
|
||||
'method': 'get'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
import {request} from '../utils/request'
|
||||
|
||||
// 统计劳务人员信息
|
||||
export function groupAllByParams(data){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/groupAllByParams',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 统计最近出勤信息
|
||||
export function findGroupAllByDays(data){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/findGroupAllByDays',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 统计劳务人员信息
|
||||
export function groupUserByParams(data){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/groupUserByParams',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 劳务人员详情
|
||||
export function attendanceUser(id){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/attendanceUser/'+id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 劳务人员列表
|
||||
export function attendanceUserList(data){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/attendanceUserList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 统计人员出勤信息
|
||||
export function groupDataByParams(data){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/groupDataByParams',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 出勤数据列表
|
||||
export function attendanceDataList(data){
|
||||
return request({
|
||||
url: '/wechat/attendance/v1/attendanceDataList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import {request} from '../utils/request'
|
||||
|
||||
// 项目文件传达列表
|
||||
export function fileList(data){
|
||||
return request({
|
||||
url: '/wechat/projectFiles/list',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据条件统计项目文件传达
|
||||
export function findCountByType(data){
|
||||
return request({
|
||||
url: '/wechat/projectFiles/findCountByType',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 文件阅读
|
||||
export function readFile(id){
|
||||
return request({
|
||||
url: '/wechat/projectFiles/readFile/'+id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
import {
|
||||
request
|
||||
} from '../utils/request'
|
||||
|
||||
// 查询工程功能检验列表
|
||||
export function listProjectFunVerify(data,pageNum,pageSize) {
|
||||
return request({
|
||||
url: '/wechat/projectFunVerify/list?pageNum='+pageNum+'pageSize'+pageSize,
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 统计工程功能检验
|
||||
export function findGroupCountByApprove(data) {
|
||||
return request({
|
||||
url: '/wechat/projectFunVerify/findGroupCountByApprove',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工程功能检验详细
|
||||
export function getProjectFunVerify(id) {
|
||||
return request({
|
||||
url: '/wechat/projectFunVerify/info/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工程功能检验
|
||||
export function addProjectFunVerify(data) {
|
||||
return request({
|
||||
url: '/wechat/projectFunVerify/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工程功能检验
|
||||
export function updateProjectFunVerify(data) {
|
||||
return request({
|
||||
url: '/wechat/projectFunVerify/edit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工程功能检验
|
||||
export function delProjectFunVerify(id) {
|
||||
return request({
|
||||
url: '/wechat/projectFunVerify/remove/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import {request} from '../utils/request'
|
||||
|
||||
// 根据条件统计项目标准化类型
|
||||
export function queryCountByType(data){
|
||||
return request({
|
||||
url: '/wechat/projectStandard/findCountByType',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
import {request} from '../utils/request'
|
||||
|
||||
// 获取用户详细信息
|
||||
export function getUserInfo() {
|
||||
return request({
|
||||
url: '/wxApi/publics/user/info',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户菜单信息
|
||||
export function selectRoleMenuList(data) {
|
||||
return request({
|
||||
url: '/wxApi/publics/v1/selectRoleMenuList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户待办信息
|
||||
export function findMyTask(data) {
|
||||
return request({
|
||||
url: '/wxApi/flowTask/myAwaitFlowTaskListCount',
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户部门信息
|
||||
export function findMyDeptList(){
|
||||
return request({
|
||||
url: '/wxApi/publics/v1/findMyDeptList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户项目信息
|
||||
export function findMyProjectList(){
|
||||
return request({
|
||||
url: '/wxApi/publics/v1/findMyProjectList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询部门资产列表信息
|
||||
export function findAllByCategory(category){
|
||||
return request({
|
||||
url: '/wxApi/publics/v1/findAllByCategory/'+category,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取项目申请详细信息
|
||||
export function findProjectApplyData(id){
|
||||
return request({
|
||||
url: '/wxApi/publics/projectApply/'+id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取系统字典信息
|
||||
export function getDictCache(type){
|
||||
return request({
|
||||
url: '/wechat/publics/v1/getDictCache/'+type,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取审批流程信息
|
||||
export function selectProjectAuditinfoList(data){
|
||||
return request({
|
||||
url: '/wechat/projectAuditinfo/selectProjectAuditinfo',
|
||||
method: 'get',
|
||||
data:data
|
||||
})
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
import {
|
||||
getToken
|
||||
} from '/utils/auth'
|
||||
|
||||
//全局分享
|
||||
!function(){
|
||||
var PageTmp = Page;
|
||||
Page =function (pageConfig) {
|
||||
// 设置全局默认分享
|
||||
pageConfig = Object.assign({
|
||||
//右上角分享功能
|
||||
onShareAppMessage () {
|
||||
return {
|
||||
title: '智慧工地优管',//分享标题
|
||||
path: '/pages/login/index',//分享用户点开后页面
|
||||
success (res) {
|
||||
console.log('分享成功!')
|
||||
}
|
||||
}
|
||||
}
|
||||
},pageConfig);
|
||||
PageTmp(pageConfig);
|
||||
};
|
||||
}();
|
||||
|
||||
App({
|
||||
globalData: {
|
||||
category:'',
|
||||
standard:'',
|
||||
paramDeptId:'',
|
||||
userProjectId:'',
|
||||
appId: "wx9997d071b4996f23",
|
||||
// 智慧工地后台接口访问域名
|
||||
reqUrl:'https://szgcwx.jhncidg.com',
|
||||
//reqUrl:'http://127.0.0.1:8091',
|
||||
uploadUrl:"https://szgcwx.jhncidg.com/wechat",
|
||||
//uploadUrl:'http://127.0.0.1:8091/wechat',
|
||||
|
||||
//御景路数字化集成管控平台接口访问域名
|
||||
szhUrl:'https://szh.makalu.cc',
|
||||
// szhUrl:'http://127.0.0.1:9004',
|
||||
// szhUrl:'http://192.168.31.49:9004',
|
||||
|
||||
//劳务实名制平台接口访问域名
|
||||
smzUrl:'https://smz.makalu.cc',
|
||||
|
||||
//安全智管平台接口访问域名
|
||||
aqzgUrl:'https://aqzg.makalu.cc',
|
||||
|
||||
//地图相关参数
|
||||
|
||||
|
||||
scale:'',
|
||||
initialLon:'',
|
||||
initialLat:'',
|
||||
markers:[],
|
||||
//页面跳转参数
|
||||
type:'',
|
||||
value1:'省',
|
||||
value2:'市/区',
|
||||
value3:'公司',
|
||||
projectInfoList:[],
|
||||
projectId:'',
|
||||
projectName:'',
|
||||
companyName:'',
|
||||
deptId:'',
|
||||
},
|
||||
|
||||
onLaunch: function () {
|
||||
if (!wx.cloud) {
|
||||
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
|
||||
} else {
|
||||
wx.cloud.init({
|
||||
// env 参数说明:
|
||||
// env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
|
||||
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
|
||||
// 如不填则使用默认环境(第一个创建的环境)
|
||||
// env: 'my-env-id',
|
||||
traceUser: true,
|
||||
})
|
||||
}
|
||||
this.autoUpdate();
|
||||
if(!getToken()){
|
||||
setTimeout(() => {
|
||||
this.toast("请使用手机号码登录",1500);
|
||||
}, 1000);
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(){},
|
||||
|
||||
//页面弹窗
|
||||
toast: function (msg) {
|
||||
wx.showToast({
|
||||
title: msg,
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
mask: true
|
||||
});
|
||||
},
|
||||
|
||||
initWxAuth:function(){
|
||||
wx.redirectTo({
|
||||
url: '../wx-auth/index',
|
||||
})
|
||||
},
|
||||
|
||||
//版本自动更新
|
||||
autoUpdate:function(){
|
||||
var self = this
|
||||
// 获取小程序更新机制兼容
|
||||
if (wx.canIUse('getUpdateManager')) {
|
||||
const updateManager = wx.getUpdateManager()
|
||||
//1. 检查小程序是否有新版本发布
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
// 请求完新版本信息的回调
|
||||
if (res.hasUpdate) {
|
||||
//2. 小程序有新版本,则静默下载新版本,做好更新准备
|
||||
updateManager.onUpdateReady(function () {
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已经准备好,是否重启应用?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
//3. 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate()
|
||||
} else if (res.cancel) {
|
||||
//如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了
|
||||
wx.showModal({
|
||||
title: '温馨提示~',
|
||||
content: '本次更新可能会导致旧版本无法正常访问,请使用新版本',
|
||||
success: function (res) {
|
||||
self.autoUpdate()
|
||||
//第二次提示后,强制更新
|
||||
// if (res.confirm) {
|
||||
// // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
// updateManager.applyUpdate()
|
||||
// } else if (res.cancel) {
|
||||
// //重新回到版本更新提示
|
||||
// self.autoUpdate()
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
updateManager.onUpdateFailed(function () {
|
||||
// 新的版本下载失败
|
||||
wx.showModal({
|
||||
title: '已经有新版本了哟~',
|
||||
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,188 @@
|
|||
{
|
||||
"pages": [
|
||||
"pages/login/index",
|
||||
"pages/alter-ps/index",
|
||||
"pages/wx-auth/index",
|
||||
"pages/gongchengliebiao/index",
|
||||
"pages/gengduogongneng/index",
|
||||
"pages/xiangmugaikuang/index",
|
||||
"pages/renyuanguanli/renyuanguanli",
|
||||
"pages/map/map",
|
||||
"pages/winter-training/index",
|
||||
"pages/Highlight-photos/index",
|
||||
"pages/construction/index",
|
||||
"pages/Construction-Log/index",
|
||||
"pages/safety_manage/index",
|
||||
"pages/quality_manage/index",
|
||||
"pages/progress_manage/index",
|
||||
"pages/project_flowable/initTask/index",
|
||||
"pages/project_flowable/myFlowDefinition/index",
|
||||
"pages/project_flowable/await/index",
|
||||
"pages/project_flowable/approveTask/index",
|
||||
"pages/project_flowable/approveLeaveTask/index",
|
||||
"pages/project_flowable/finished/index",
|
||||
"pages/project_flowable/initLeaveTask/index",
|
||||
"pages/project_flowable/detailTask/index",
|
||||
"pages/project_flowable/detailLeaveTask/index",
|
||||
"pages/project_flowable/editTask/index",
|
||||
"pages/project_flowable/editLeaveTask/index",
|
||||
"pages/project_flowable/myProcessIns/index",
|
||||
"pages/project_approve/index",
|
||||
"pages/project_approve/approveCheckDetection/index",
|
||||
"pages/project_approve/approveChecking/index",
|
||||
"pages/project_approve/approveMaterialSeal/index",
|
||||
"pages/project_approve/approveMeasure/index",
|
||||
"pages/project_approve/approveFunVerify/index"
|
||||
],
|
||||
"subpackages": [
|
||||
{
|
||||
"root": "pageage",
|
||||
"name": "pageage",
|
||||
"pages": [
|
||||
"educations-add/index",
|
||||
"educations-details/index",
|
||||
"educations-list/index",
|
||||
"xiangmuhuanjing/xiangmuhuanjing",
|
||||
"xiangmuyujing/xiangmuyujing",
|
||||
"yujingxinxi/yujingxinxi",
|
||||
"xiangmushipin/xiangmushipin",
|
||||
"AIvideoAnalysis/index",
|
||||
"AIWarningList/index",
|
||||
"vehicleManage/index",
|
||||
"shipinquanping/shipingquanping",
|
||||
"biangeng/index",
|
||||
"safetyManagement/securityCheckGR/index",
|
||||
"safetyManagement/securityCheck/index",
|
||||
"safetyManagement/problemRectificationGR/index",
|
||||
"safetyManagement/problemRectification/index",
|
||||
"safetyManagement/securityCheckRectified/index",
|
||||
"safetyManagement/addSafetyInspect/index",
|
||||
"samplingRetesting/index",
|
||||
"samplingRetestingDeliver/index",
|
||||
"samplingRetestingUpload/index",
|
||||
"samplingAddRetestingDeliver/index",
|
||||
"samplingRetestingDetail/index",
|
||||
"Progress-management/index",
|
||||
"Material-Management/index",
|
||||
"technical-management/index",
|
||||
"project_checking/add/index",
|
||||
"project_checking/list/index",
|
||||
"project_checking/edit/index",
|
||||
"project_checking/info/index",
|
||||
"project_funVerify/add/index",
|
||||
"project_funVerify/list/index",
|
||||
"project_funVerify/edit/index",
|
||||
"project_funVerify/info/index",
|
||||
"project_problemmodify/security/list/index",
|
||||
"project_problemmodify/security/info/index",
|
||||
"project_problemmodify/security/modify/index",
|
||||
"project_problemmodify/security/check/index",
|
||||
"project_problemmodify/security/add/index",
|
||||
"project_problemmodify/security/draft/index",
|
||||
"project_problemmodify/quality/list/index",
|
||||
"project_problemmodify/quality/info/index",
|
||||
"project_problemmodify/quality/modify/index",
|
||||
"project_problemmodify/quality/check/index",
|
||||
"project_problemmodify/quality/add/index",
|
||||
"project_problemmodify/quality/draft/index",
|
||||
"project_schedule/list/index",
|
||||
"project_schedule/add/index",
|
||||
"project_schedule/info/index",
|
||||
"project_train/list/index",
|
||||
"project_train/add/index",
|
||||
"project_train/info/index",
|
||||
"project_special/list/index",
|
||||
"project_special/add/index",
|
||||
"project_special/info/index",
|
||||
"project_measure/list/index",
|
||||
"project_measure/add/index",
|
||||
"project_measure/edit/index",
|
||||
"project_measure/info/index",
|
||||
"project_materialSeal/list/index",
|
||||
"project_materialSeal/add/index",
|
||||
"project_materialSeal/edit/index",
|
||||
"project_materialSeal/info/index",
|
||||
"project_checkDetection/list/index",
|
||||
"project_checkDetection/add/index",
|
||||
"project_checkDetection/info/index",
|
||||
"project_checkDetection/check/index",
|
||||
"project_checkDetection/edit/index",
|
||||
"project_insurance/add/index",
|
||||
"project_insurance/info/index",
|
||||
"project_insurance/list/index",
|
||||
"project_attendance/project_attendanceUser/list/index",
|
||||
"project_attendance/project_attendanceUser/info/index",
|
||||
"project_attendance/project_attendanceData/list/index",
|
||||
"project_standard/list/index",
|
||||
"project_standard/add/index",
|
||||
"project_standard/info/index",
|
||||
"project_files/index",
|
||||
"flow_labour/list/index",
|
||||
"flow_labour/check/index",
|
||||
"flow_labour/info/index"
|
||||
],
|
||||
"independent": false
|
||||
}
|
||||
],
|
||||
"usingComponents": {
|
||||
"van-row": "@vant/weapp/row",
|
||||
"van-col": "@vant/weapp/col",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
|
||||
"van-radio": "@vant/weapp/radio/index",
|
||||
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||
"van-toast": "@vant/weapp/toast/index",
|
||||
"ec-canvas": "ec-canvas/ec-canvas",
|
||||
"van-sticky": "@vant/weapp/sticky",
|
||||
"van-calendar": "@vant/weapp/calendar/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"pie-chart": "pages/components/pie-chart/index",
|
||||
"deep-select": "pages/components/deep-select/index",
|
||||
"select-btn": "pages/components/select-btn/index",
|
||||
"bar-chart": "pages/components/bar-chart/index",
|
||||
"bar-chart-warning": "pages/components/bar-chart-warning/index",
|
||||
"pz-screen": "pages/components/pz-screen/index",
|
||||
"pz-screen-training": "pages/components/pz-screen-training/index",
|
||||
"pz-screen-training-index": "pages/components/pz-screen-training-index/index",
|
||||
"select-date": "pages/components/select-date/index",
|
||||
"voucher-select": "pages/components/voucher-select/index",
|
||||
"voucher-selects": "pages/components/voucher-selects/index",
|
||||
"voucher-selected": "pages/components/voucher-selected/index",
|
||||
"voucher-date": "pages/components/voucher-date/index",
|
||||
"voucher-datetime": "pages/components/voucher-datetime/index",
|
||||
"file-uploader": "pages/components/file-uploader/index",
|
||||
"file-uploader-all": "pages/components/file-uploader-all/index",
|
||||
"project-select": "pages/components/project-select/index",
|
||||
"safety-pie-chart": "./newComponents/safety-pie-chart/index",
|
||||
"safety-pie-charts": "./newComponents/safety-pie-charts/index",
|
||||
"safety-bar-chart": "./newComponents/safety-bar-chart/index",
|
||||
"safety-bar-charts": "./newComponents/safety-bar-charts/index",
|
||||
"safety-bar-chartss": "./newComponents/safety-bar-chartss/index",
|
||||
"voucher-many-select": "pages/components/voucher-many-select/index",
|
||||
"sign": "pages/components/sign/sign",
|
||||
"safety-number": "./newComponents/number/index",
|
||||
"select-person": "./newComponents/select-person/index",
|
||||
"select-group-person": "./newComponents/select-group-person/index",
|
||||
"van-dropdown-menu": "@vant/weapp/dropdown-menu/index",
|
||||
"van-dropdown-item": "@vant/weapp/dropdown-item/index",
|
||||
"curve-echarts": "pages/components/curve-echarts/index",
|
||||
"user-infos": "pages/components/user-infos/index"
|
||||
},
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#191d28",
|
||||
"navigationBarTextStyle": "white"
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos": [
|
||||
"getLocation"
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,37 @@
|
|||
import { link } from '../mixins/link';
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: [
|
||||
'title-class',
|
||||
'label-class',
|
||||
'value-class',
|
||||
'right-icon-class',
|
||||
'hover-class',
|
||||
],
|
||||
mixins: [link],
|
||||
props: {
|
||||
title: null,
|
||||
value: null,
|
||||
icon: String,
|
||||
size: String,
|
||||
label: String,
|
||||
center: Boolean,
|
||||
isLink: Boolean,
|
||||
required: Boolean,
|
||||
clickable: Boolean,
|
||||
titleWidth: String,
|
||||
customStyle: String,
|
||||
arrowDirection: String,
|
||||
useLabelSlot: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event.detail);
|
||||
this.jumpLink();
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
|
||||
hover-class="van-cell--hover hover-class"
|
||||
hover-stay-time="70"
|
||||
style="{{ customStyle }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
name="{{ icon }}"
|
||||
class="van-cell__left-icon-wrap"
|
||||
custom-class="van-cell__left-icon"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
|
||||
<view
|
||||
style="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
|
||||
class="van-cell__title title-class"
|
||||
>
|
||||
<block wx:if="{{ title }}">{{ title }}</block>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
|
||||
<slot wx:if="{{ useLabelSlot }}" name="label" />
|
||||
<block wx:elif="{{ label }}">{{ label }}</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-cell__value value-class">
|
||||
<block wx:if="{{ value || value === 0 }}">{{ value }}</block>
|
||||
<slot wx:else />
|
||||
</view>
|
||||
|
||||
<van-icon
|
||||
wx:if="{{ isLink }}"
|
||||
name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}"
|
||||
class="van-cell__right-icon-wrap right-icon-class"
|
||||
custom-class="van-cell__right-icon"
|
||||
/>
|
||||
<slot wx:else name="right-icon" />
|
||||
|
||||
<slot name="extra" />
|
||||
</view>
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:auto;right:0;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,92 @@
|
|||
import { VantComponent } from "../common/component";
|
||||
const nextTick = () => new Promise((resolve) => setTimeout(resolve, 20));
|
||||
VantComponent({
|
||||
classes: ["title-class", "content-class"],
|
||||
relation: {
|
||||
name: "collapse",
|
||||
type: "ancestor",
|
||||
current: "collapse-item",
|
||||
},
|
||||
props: {
|
||||
name: null,
|
||||
title: null,
|
||||
value: null,
|
||||
icon: String,
|
||||
label: String,
|
||||
disabled: Boolean,
|
||||
clickable: Boolean,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
isLink: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
contentHeight: 0,
|
||||
expanded: false,
|
||||
transition: false,
|
||||
},
|
||||
mounted() {
|
||||
this.updateExpanded()
|
||||
.then(nextTick)
|
||||
.then(() => {
|
||||
const data = { transition: true };
|
||||
if (this.data.expanded) {
|
||||
data.contentHeight = "auto";
|
||||
}
|
||||
this.setData(data);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
updateExpanded() {
|
||||
if (!this.parent) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const { value, accordion } = this.parent.data;
|
||||
const { children = [] } = this.parent;
|
||||
const { name } = this.data;
|
||||
const index = children.indexOf(this);
|
||||
const currentName = name == null ? index : name;
|
||||
const expanded = accordion ? value === currentName : (value || []).some((name) => name === currentName);
|
||||
const stack = [];
|
||||
if (expanded !== this.data.expanded) {
|
||||
stack.push(this.updateStyle(expanded));
|
||||
}
|
||||
stack.push(this.set({ index, expanded }));
|
||||
return Promise.all(stack);
|
||||
},
|
||||
updateStyle(expanded) {
|
||||
return this.getRect(".van-collapse-item__content")
|
||||
.then((rect) => rect.height)
|
||||
.then((height) => {
|
||||
if (expanded) {
|
||||
return this.set({
|
||||
contentHeight: height ? `${height}px` : "auto",
|
||||
});
|
||||
}
|
||||
return this.set({ contentHeight: `${height}px` })
|
||||
.then(nextTick)
|
||||
.then(() => this.set({ contentHeight: 0 }));
|
||||
});
|
||||
},
|
||||
onClick() {
|
||||
if (this.data.disabled) {
|
||||
return;
|
||||
}
|
||||
const { name, expanded } = this.data;
|
||||
const index = this.parent.children.indexOf(this);
|
||||
const currentName = name == null ? index : name;
|
||||
this.parent.switch(currentName, !expanded);
|
||||
},
|
||||
onTransitionEnd() {
|
||||
if (this.data.expanded) {
|
||||
this.setData({
|
||||
contentHeight: "auto",
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-cell": "../cell/index"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<view class="van-collapse-item custom-class mkl-collapse {{ index !== 0 ? 'van-hairline--top' : '' }}">
|
||||
<van-cell custom-class="van-cell mkl-cell {{expanded?'mkl-cell__expanded':''}}" title="{{ title }}" title-class="title-class" icon="{{ icon }}" value="{{ value }}" label="{{ label }}" is-link="{{ isLink }}" clickable="{{ clickable }}" border="{{ border && expanded }}" class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}" right-icon-class="van-cell__right-icon" hover-class="van-cell--hover" bind:click="onClick">
|
||||
<slot name="title" slot="title" />
|
||||
<slot name="icon" slot="icon" />
|
||||
<slot name="value" />
|
||||
<slot name="right-icon" slot="right-icon" />
|
||||
</van-cell>
|
||||
<view class="mkl-collapse-container {{ utils.bem('collapse-item__wrapper', { transition }) }}" style="height: {{ contentHeight }};" bind:transitionend="onTransitionEnd">
|
||||
<!-- <view class="mkl-cell__bottom"></view> -->
|
||||
<view class="van-collapse-item__content content-class">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
|
@ -0,0 +1,60 @@
|
|||
@import "../common/index.wxss";
|
||||
.van-collapse-item__title .van-cell__right-icon {
|
||||
-webkit-transform: rotate(90deg);
|
||||
transform: rotate(90deg);
|
||||
transition: -webkit-transform 0.3s;
|
||||
transition: transform 0.3s;
|
||||
transition: transform 0.3s, -webkit-transform 0.3s;
|
||||
}
|
||||
.van-collapse-item__title--expanded .van-cell__right-icon {
|
||||
-webkit-transform: rotate(-90deg);
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.van-collapse-item__title--disabled .van-cell,
|
||||
.van-collapse-item__title--disabled .van-cell__right-icon {
|
||||
color: #c8c9cc !important;
|
||||
}
|
||||
.van-collapse-item__title--disabled .van-cell--hover {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
.van-collapse-item__wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
.van-collapse-item__wrapper--transition {
|
||||
transition: height 0.3s ease-in-out;
|
||||
}
|
||||
.van-collapse-item__content {
|
||||
padding: 0 25rpx;
|
||||
color: #969799;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.mkl-collapse {
|
||||
padding: 0 25rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.mkl-cell {
|
||||
background: #fff;
|
||||
padding: 25rpx;
|
||||
border-radius: 20rpx;
|
||||
/* border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx; */
|
||||
box-shadow: 0px 0px 10px #ddd;
|
||||
/* margin-bottom: 40rpx; */
|
||||
}
|
||||
|
||||
.mkl-cell__expanded {
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
.mkl-cell__bottom {
|
||||
height: 40rpx;
|
||||
}
|
||||
.mkl-collapse-container {
|
||||
box-shadow: 0px 0px 10px #ddd;
|
||||
transition: height 0.2s;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
background: #f5f5f5;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,47 @@
|
|||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
relation: {
|
||||
name: 'collapse-item',
|
||||
type: 'descendant',
|
||||
current: 'collapse',
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: null,
|
||||
observer: 'updateExpanded',
|
||||
},
|
||||
accordion: {
|
||||
type: Boolean,
|
||||
observer: 'updateExpanded',
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateExpanded() {
|
||||
this.children.forEach((child) => {
|
||||
child.updateExpanded();
|
||||
});
|
||||
},
|
||||
switch(name, expanded) {
|
||||
const { accordion, value } = this.data;
|
||||
const changeItem = name;
|
||||
if (!accordion) {
|
||||
name = expanded
|
||||
? (value || []).concat(name)
|
||||
: (value || []).filter((activeName) => activeName !== name);
|
||||
} else {
|
||||
name = expanded ? name : '';
|
||||
}
|
||||
if (expanded) {
|
||||
this.$emit('open', changeItem);
|
||||
} else {
|
||||
this.$emit('close', changeItem);
|
||||
}
|
||||
this.$emit('change', name);
|
||||
this.$emit('input', name);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"component": true
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
<view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }} ">
|
||||
<slot />
|
||||
</view>
|
|
@ -0,0 +1 @@
|
|||
@import "../common/index.wxss";
|
|
@ -0,0 +1,7 @@
|
|||
export declare const RED = "#ee0a24";
|
||||
export declare const BLUE = "#1989fa";
|
||||
export declare const WHITE = "#fff";
|
||||
export declare const GREEN = "#07c160";
|
||||
export declare const ORANGE = "#ff976a";
|
||||
export declare const GRAY = "#323233";
|
||||
export declare const GRAY_DARK = "#969799";
|
|
@ -0,0 +1,7 @@
|
|||
export const RED = '#ee0a24';
|
||||
export const BLUE = '#1989fa';
|
||||
export const WHITE = '#fff';
|
||||
export const GREEN = '#07c160';
|
||||
export const ORANGE = '#ff976a';
|
||||
export const GRAY = '#323233';
|
||||
export const GRAY_DARK = '#969799';
|
|
@ -0,0 +1,3 @@
|
|||
import { VantComponentOptions, CombinedComponentInstance } from '../definitions/index';
|
||||
declare function VantComponent<Data, Props, Methods>(vantOptions?: VantComponentOptions<Data, Props, Methods, CombinedComponentInstance<Data, Props, Methods>>): void;
|
||||
export { VantComponent };
|
|
@ -0,0 +1,101 @@
|
|||
import { basic } from '../mixins/basic';
|
||||
const relationFunctions = {
|
||||
ancestor: {
|
||||
linked(parent) {
|
||||
this.parent = parent;
|
||||
},
|
||||
unlinked() {
|
||||
this.parent = null;
|
||||
},
|
||||
},
|
||||
descendant: {
|
||||
linked(child) {
|
||||
this.children = this.children || [];
|
||||
this.children.push(child);
|
||||
},
|
||||
unlinked(child) {
|
||||
this.children = (this.children || []).filter((it) => it !== child);
|
||||
},
|
||||
},
|
||||
};
|
||||
function mapKeys(source, target, map) {
|
||||
Object.keys(map).forEach((key) => {
|
||||
if (source[key]) {
|
||||
target[map[key]] = source[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
function makeRelation(options, vantOptions, relation) {
|
||||
const { type, name, linked, unlinked, linkChanged } = relation;
|
||||
const { beforeCreate, destroyed } = vantOptions;
|
||||
if (type === 'descendant') {
|
||||
options.created = function () {
|
||||
beforeCreate && beforeCreate.bind(this)();
|
||||
this.children = this.children || [];
|
||||
};
|
||||
options.detached = function () {
|
||||
this.children = [];
|
||||
destroyed && destroyed.bind(this)();
|
||||
};
|
||||
}
|
||||
options.relations = Object.assign(options.relations || {}, {
|
||||
[`../${name}/index`]: {
|
||||
type,
|
||||
linked(node) {
|
||||
relationFunctions[type].linked.bind(this)(node);
|
||||
linked && linked.bind(this)(node);
|
||||
},
|
||||
linkChanged(node) {
|
||||
linkChanged && linkChanged.bind(this)(node);
|
||||
},
|
||||
unlinked(node) {
|
||||
relationFunctions[type].unlinked.bind(this)(node);
|
||||
unlinked && unlinked.bind(this)(node);
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
function VantComponent(vantOptions = {}) {
|
||||
const options = {};
|
||||
mapKeys(vantOptions, options, {
|
||||
data: 'data',
|
||||
props: 'properties',
|
||||
mixins: 'behaviors',
|
||||
methods: 'methods',
|
||||
beforeCreate: 'created',
|
||||
created: 'attached',
|
||||
mounted: 'ready',
|
||||
relations: 'relations',
|
||||
destroyed: 'detached',
|
||||
classes: 'externalClasses',
|
||||
});
|
||||
const { relation } = vantOptions;
|
||||
if (relation) {
|
||||
makeRelation(options, vantOptions, relation);
|
||||
}
|
||||
// add default externalClasses
|
||||
options.externalClasses = options.externalClasses || [];
|
||||
options.externalClasses.push('custom-class');
|
||||
// add default behaviors
|
||||
options.behaviors = options.behaviors || [];
|
||||
options.behaviors.push(basic);
|
||||
// map field to form-field behavior
|
||||
if (vantOptions.field) {
|
||||
options.behaviors.push('wx://form-field');
|
||||
}
|
||||
if (options.properties) {
|
||||
Object.keys(options.properties).forEach((name) => {
|
||||
if (Array.isArray(options.properties[name])) {
|
||||
// miniprogram do not allow multi type
|
||||
options.properties[name] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
// add default options
|
||||
options.options = {
|
||||
multipleSlots: true,
|
||||
addGlobalClass: true,
|
||||
};
|
||||
Component(options);
|
||||
}
|
||||
export { VantComponent };
|
|
@ -0,0 +1 @@
|
|||
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #eee;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
|
@ -0,0 +1 @@
|
|||
.van-clearfix:after{display:table;clear:both;content:""}
|
|
@ -0,0 +1 @@
|
|||
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}
|
|
@ -0,0 +1 @@
|
|||
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #eee;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
|
@ -0,0 +1,8 @@
|
|||
/// <reference types="miniprogram-api-typings" />
|
||||
export declare function isDef(value: any): boolean;
|
||||
export declare function isObj(x: any): boolean;
|
||||
export declare function isNumber(value: any): boolean;
|
||||
export declare function range(num: number, min: number, max: number): number;
|
||||
export declare function nextTick(fn: Function): void;
|
||||
export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSyncResult;
|
||||
export declare function addUnit(value?: string | number): string | undefined;
|
|
@ -0,0 +1,32 @@
|
|||
export function isDef(value) {
|
||||
return value !== undefined && value !== null;
|
||||
}
|
||||
export function isObj(x) {
|
||||
const type = typeof x;
|
||||
return x !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
export function isNumber(value) {
|
||||
return /^\d+(\.\d+)?$/.test(value);
|
||||
}
|
||||
export function range(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
}
|
||||
export function nextTick(fn) {
|
||||
setTimeout(() => {
|
||||
fn();
|
||||
}, 1000 / 30);
|
||||
}
|
||||
let systemInfo = null;
|
||||
export function getSystemInfoSync() {
|
||||
if (systemInfo == null) {
|
||||
systemInfo = wx.getSystemInfoSync();
|
||||
}
|
||||
return systemInfo;
|
||||
}
|
||||
export function addUnit(value) {
|
||||
if (!isDef(value)) {
|
||||
return undefined;
|
||||
}
|
||||
value = String(value);
|
||||
return isNumber(value) ? `${value}px` : value;
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
export declare function canIUseModel(): boolean;
|
||||
export declare function canIUseFormFieldButton(): boolean;
|
|
@ -0,0 +1,31 @@
|
|||
import { getSystemInfoSync } from './utils';
|
||||
function compareVersion(v1, v2) {
|
||||
v1 = v1.split('.');
|
||||
v2 = v2.split('.');
|
||||
const len = Math.max(v1.length, v2.length);
|
||||
while (v1.length < len) {
|
||||
v1.push('0');
|
||||
}
|
||||
while (v2.length < len) {
|
||||
v2.push('0');
|
||||
}
|
||||
for (let i = 0; i < len; i++) {
|
||||
const num1 = parseInt(v1[i], 10);
|
||||
const num2 = parseInt(v2[i], 10);
|
||||
if (num1 > num2) {
|
||||
return 1;
|
||||
}
|
||||
if (num1 < num2) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
export function canIUseModel() {
|
||||
const system = getSystemInfoSync();
|
||||
return compareVersion(system.SDKVersion, '2.9.3') >= 0;
|
||||
}
|
||||
export function canIUseFormFieldButton() {
|
||||
const system = getSystemInfoSync();
|
||||
return compareVersion(system.SDKVersion, '2.10.3') >= 0;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,27 @@
|
|||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
size: null,
|
||||
color: String,
|
||||
customStyle: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon',
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
isImageName: val.indexOf('/') !== -1,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit('click');
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-info": "../info/index"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}"
|
||||
style="color: {{ color }};font-size: {{ utils.addUnit(size) }};{{ customStyle }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
wx:if="{{ info !== null || dot }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
custom-class="van-icon__info"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ isImageName }}"
|
||||
src="{{ name }}"
|
||||
mode="aspectFit"
|
||||
class="van-icon__image"
|
||||
/>
|
||||
</view>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,8 @@
|
|||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
customStyle: String,
|
||||
},
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"component": true
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
wx:if="{{ info !== null && info !== '' || dot }}"
|
||||
class="custom-class van-info {{ utils.bem('info', { dot }) }}"
|
||||
style="{{ customStyle }}"
|
||||
>{{ dot ? '' : info }}</view>
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';.van-info{position:absolute;top:0;right:0;box-sizing:border-box;white-space:nowrap;text-align:center;-webkit-transform:translate(50%,-50%);transform:translate(50%,-50%);-webkit-transform-origin:100%;transform-origin:100%;min-width:16px;min-width:var(--info-size,16px);padding:0 3px;padding:var(--info-padding,0 3px);color:#fff;color:var(--info-color,#fff);font-weight:500;font-weight:var(--info-font-weight,500);font-size:12px;font-size:var(--info-font-size,12px);font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--info-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif);line-height:14px;line-height:calc(var(--info-size, 16px) - var(--info-border-width, 1px)*2);background-color:#ee0a24;background-color:var(--info-background-color,#ee0a24);border:1px solid #fff;border:var(--info-border-width,1px) solid var(--white,#fff);border-radius:16px;border-radius:var(--info-size,16px)}.van-info--dot{min-width:0;border-radius:100%;width:8px;width:var(--info-dot-size,8px);height:8px;height:var(--info-dot-size,8px);background-color:#ee0a24;background-color:var(--info-dot-color,#ee0a24)}
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,16 @@
|
|||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
color: String,
|
||||
vertical: Boolean,
|
||||
type: {
|
||||
type: String,
|
||||
value: 'circular',
|
||||
},
|
||||
size: String,
|
||||
textSize: String,
|
||||
},
|
||||
data: {
|
||||
array12: Array.from({ length: 12 }),
|
||||
},
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"component": true
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}">
|
||||
<view
|
||||
class="van-loading__spinner van-loading__spinner--{{ type }}"
|
||||
style="color: {{ color }}; width: {{ utils.addUnit(size) }}; height: {{ utils.addUnit(size) }}"
|
||||
>
|
||||
<view
|
||||
wx:if="{{ type === 'spinner' }}"
|
||||
wx:for="{{ array12 }}"
|
||||
wx:key="index"
|
||||
class="van-loading__dot"
|
||||
/>
|
||||
</view>
|
||||
<view class="van-loading__text" style="font-size: {{ utils.addUnit(textSize) }};">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#c8c9cc;color:var(--loading-spinner-color,#c8c9cc)}.van-loading__spinner{position:relative;box-sizing:border-box;width:30px;width:var(--loading-spinner-size,30px);max-width:100%;max-height:100%;height:30px;height:var(--loading-spinner-size,30px);-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite;-webkit-animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__text{margin-left:8px;margin-left:var(--padding-xs,8px);color:#969799;color:var(--loading-text-color,#969799);font-size:14px;font-size:var(--loading-text-font-size,14px);line-height:20px;line-height:var(--loading-text-line-height,20px)}.van-loading__text:empty{display:none}.van-loading--vertical{-webkit-flex-direction:column;flex-direction:column}.van-loading--vertical .van-loading__text{margin:8px 0 0;margin:var(--padding-xs,8px) 0 0}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
|
|
@ -0,0 +1 @@
|
|||
export declare const basic: string;
|
|
@ -0,0 +1,27 @@
|
|||
export const basic = Behavior({
|
||||
methods: {
|
||||
$emit(...args) {
|
||||
this.triggerEvent(...args);
|
||||
},
|
||||
set(data, callback) {
|
||||
this.setData(data, callback);
|
||||
return new Promise((resolve) => wx.nextTick(resolve));
|
||||
},
|
||||
getRect(selector, all) {
|
||||
return new Promise((resolve) => {
|
||||
wx.createSelectorQuery()
|
||||
.in(this)
|
||||
[all ? 'selectAll' : 'select'](selector)
|
||||
.boundingClientRect((rect) => {
|
||||
if (all && Array.isArray(rect) && rect.length) {
|
||||
resolve(rect);
|
||||
}
|
||||
if (!all && rect) {
|
||||
resolve(rect);
|
||||
}
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export declare const button: string;
|
|
@ -0,0 +1,15 @@
|
|||
export const button = Behavior({
|
||||
externalClasses: ['hover-class'],
|
||||
properties: {
|
||||
id: String,
|
||||
lang: String,
|
||||
businessId: Number,
|
||||
sessionFrom: String,
|
||||
sendMessageTitle: String,
|
||||
sendMessagePath: String,
|
||||
sendMessageImg: String,
|
||||
showMessageCard: Boolean,
|
||||
appParameter: String,
|
||||
ariaLabel: String,
|
||||
},
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export declare const link: string;
|
|
@ -0,0 +1,17 @@
|
|||
export const link = Behavior({
|
||||
properties: {
|
||||
url: String,
|
||||
linkType: {
|
||||
type: String,
|
||||
value: 'navigateTo',
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
jumpLink(urlKey = 'url') {
|
||||
const url = this.data[urlKey];
|
||||
if (url) {
|
||||
wx[this.data.linkType]({ url });
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export declare const openType: string;
|
|
@ -0,0 +1,25 @@
|
|||
export const openType = Behavior({
|
||||
properties: {
|
||||
openType: String,
|
||||
},
|
||||
methods: {
|
||||
bindGetUserInfo(event) {
|
||||
this.$emit('getuserinfo', event.detail);
|
||||
},
|
||||
bindContact(event) {
|
||||
this.$emit('contact', event.detail);
|
||||
},
|
||||
bindGetPhoneNumber(event) {
|
||||
this.$emit('getphonenumber', event.detail);
|
||||
},
|
||||
bindError(event) {
|
||||
this.$emit('error', event.detail);
|
||||
},
|
||||
bindLaunchApp(event) {
|
||||
this.$emit('launchapp', event.detail);
|
||||
},
|
||||
bindOpenSetting(event) {
|
||||
this.$emit('opensetting', event.detail);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
/// <reference types="miniprogram-api-typings" />
|
||||
declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
|
||||
declare type Scroller = (event: IPageScrollOption) => void;
|
||||
export declare const pageScrollMixin: (scroller: Scroller) => string;
|
||||
export {};
|
|
@ -0,0 +1,33 @@
|
|||
function getCurrentPage() {
|
||||
const pages = getCurrentPages();
|
||||
return pages[pages.length - 1] || {};
|
||||
}
|
||||
function onPageScroll(event) {
|
||||
const { vanPageScroller = [] } = getCurrentPage();
|
||||
vanPageScroller.forEach((scroller) => {
|
||||
if (typeof scroller === 'function') {
|
||||
scroller(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
export const pageScrollMixin = (scroller) =>
|
||||
Behavior({
|
||||
attached() {
|
||||
const page = getCurrentPage();
|
||||
if (Array.isArray(page.vanPageScroller)) {
|
||||
page.vanPageScroller.push(scroller.bind(this));
|
||||
} else {
|
||||
page.vanPageScroller =
|
||||
typeof page.onPageScroll === 'function'
|
||||
? [page.onPageScroll.bind(page), scroller.bind(this)]
|
||||
: [scroller.bind(this)];
|
||||
}
|
||||
page.onPageScroll = onPageScroll;
|
||||
},
|
||||
detached() {
|
||||
const page = getCurrentPage();
|
||||
page.vanPageScroller = (page.vanPageScroller || []).filter(
|
||||
(item) => item !== scroller
|
||||
);
|
||||
},
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export declare const touch: string;
|
|
@ -0,0 +1,36 @@
|
|||
const MIN_DISTANCE = 10;
|
||||
function getDirection(x, y) {
|
||||
if (x > y && x > MIN_DISTANCE) {
|
||||
return 'horizontal';
|
||||
}
|
||||
if (y > x && y > MIN_DISTANCE) {
|
||||
return 'vertical';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
export const touch = Behavior({
|
||||
methods: {
|
||||
resetTouchStatus() {
|
||||
this.direction = '';
|
||||
this.deltaX = 0;
|
||||
this.deltaY = 0;
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
},
|
||||
touchStart(event) {
|
||||
this.resetTouchStatus();
|
||||
const touch = event.touches[0];
|
||||
this.startX = touch.clientX;
|
||||
this.startY = touch.clientY;
|
||||
},
|
||||
touchMove(event) {
|
||||
const touch = event.touches[0];
|
||||
this.deltaX = touch.clientX - this.startX;
|
||||
this.deltaY = touch.clientY - this.startY;
|
||||
this.offsetX = Math.abs(this.deltaX);
|
||||
this.offsetY = Math.abs(this.deltaY);
|
||||
this.direction =
|
||||
this.direction || getDirection(this.offsetX, this.offsetY);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export declare const transition: (showDefaultValue: boolean) => string;
|
|
@ -0,0 +1,118 @@
|
|||
import { isObj } from '../common/utils';
|
||||
const getClassNames = (name) => ({
|
||||
enter: `van-${name}-enter van-${name}-enter-active enter-class enter-active-class`,
|
||||
'enter-to': `van-${name}-enter-to van-${name}-enter-active enter-to-class enter-active-class`,
|
||||
leave: `van-${name}-leave van-${name}-leave-active leave-class leave-active-class`,
|
||||
'leave-to': `van-${name}-leave-to van-${name}-leave-active leave-to-class leave-active-class`,
|
||||
});
|
||||
const nextTick = () => new Promise((resolve) => setTimeout(resolve, 1000 / 30));
|
||||
export const transition = function (showDefaultValue) {
|
||||
return Behavior({
|
||||
properties: {
|
||||
customStyle: String,
|
||||
// @ts-ignore
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: showDefaultValue,
|
||||
observer: 'observeShow',
|
||||
},
|
||||
// @ts-ignore
|
||||
duration: {
|
||||
type: null,
|
||||
value: 300,
|
||||
observer: 'observeDuration',
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
value: 'fade',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
type: '',
|
||||
inited: false,
|
||||
display: false,
|
||||
},
|
||||
methods: {
|
||||
observeShow(value, old) {
|
||||
if (value === old) {
|
||||
return;
|
||||
}
|
||||
value ? this.enter() : this.leave();
|
||||
},
|
||||
enter() {
|
||||
const { duration, name } = this.data;
|
||||
const classNames = getClassNames(name);
|
||||
const currentDuration = isObj(duration) ? duration.enter : duration;
|
||||
this.status = 'enter';
|
||||
this.$emit('before-enter');
|
||||
Promise.resolve()
|
||||
.then(nextTick)
|
||||
.then(() => {
|
||||
this.checkStatus('enter');
|
||||
this.$emit('enter');
|
||||
this.setData({
|
||||
inited: true,
|
||||
display: true,
|
||||
classes: classNames.enter,
|
||||
currentDuration,
|
||||
});
|
||||
})
|
||||
.then(nextTick)
|
||||
.then(() => {
|
||||
this.checkStatus('enter');
|
||||
this.transitionEnded = false;
|
||||
this.setData({
|
||||
classes: classNames['enter-to'],
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
leave() {
|
||||
if (!this.data.display) {
|
||||
return;
|
||||
}
|
||||
const { duration, name } = this.data;
|
||||
const classNames = getClassNames(name);
|
||||
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||
this.status = 'leave';
|
||||
this.$emit('before-leave');
|
||||
Promise.resolve()
|
||||
.then(nextTick)
|
||||
.then(() => {
|
||||
this.checkStatus('leave');
|
||||
this.$emit('leave');
|
||||
this.setData({
|
||||
classes: classNames.leave,
|
||||
currentDuration,
|
||||
});
|
||||
})
|
||||
.then(nextTick)
|
||||
.then(() => {
|
||||
this.checkStatus('leave');
|
||||
this.transitionEnded = false;
|
||||
setTimeout(() => this.onTransitionEnd(), currentDuration);
|
||||
this.setData({
|
||||
classes: classNames['leave-to'],
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
checkStatus(status) {
|
||||
if (status !== this.status) {
|
||||
throw new Error(`incongruent status: ${status}`);
|
||||
}
|
||||
},
|
||||
onTransitionEnd() {
|
||||
if (this.transitionEnded) {
|
||||
return;
|
||||
}
|
||||
this.transitionEnded = true;
|
||||
this.$emit(`after-${this.status}`);
|
||||
const { show, display } = this.data;
|
||||
if (!show && display) {
|
||||
this.setData({ display: false });
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,145 @@
|
|||
import { VantComponent } from "../common/component";
|
||||
import { pickerProps } from "../picker/shared";
|
||||
const COLUMNSPLACEHOLDERCODE = "000000";
|
||||
VantComponent({
|
||||
classes: ["active-class", "toolbar-class", "column-class"],
|
||||
props: Object.assign(Object.assign({}, pickerProps), {
|
||||
value: {
|
||||
type: Array,
|
||||
observer(value) {
|
||||
this.value = value;
|
||||
this.getSelect();
|
||||
this.setValues();
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer(value) {
|
||||
this.getSelect();
|
||||
this.setValues();
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
data: {
|
||||
displayColumns: [],
|
||||
typeToColumnsPlaceholder: {},
|
||||
},
|
||||
mounted() {
|
||||
// setTimeout(() => {
|
||||
// this.setValues();
|
||||
// }, 0);
|
||||
},
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
this.picker = this.selectComponent(".van-multi-select__picker");
|
||||
}
|
||||
return this.picker;
|
||||
},
|
||||
onCancel(event) {
|
||||
this.emit("cancel", event.detail);
|
||||
},
|
||||
onConfirm(event) {
|
||||
const detail = event.detail;
|
||||
const values = this.parseOutputValues(detail.value);
|
||||
this.emit("confirm", {text:values.map((x) => x.text),value: values.map((x) => x.key), index:detail.index });
|
||||
},
|
||||
emit(type, detail) {
|
||||
detail.values = detail.value;
|
||||
delete detail.value;
|
||||
this.$emit(type, detail);
|
||||
},
|
||||
// parse output columns data
|
||||
parseOutputValues(values) {
|
||||
return values.map((value, index) => {
|
||||
return {
|
||||
key: value.key,
|
||||
text: value.text,
|
||||
};
|
||||
});
|
||||
},
|
||||
onChange(event) {
|
||||
const { index, picker, value } = event.detail;
|
||||
this.select = { value, index };
|
||||
this.setValues();
|
||||
const values = this.parseOutputValues(value);
|
||||
this.$emit("change", {
|
||||
picker,
|
||||
values: values,
|
||||
value: values.map((x) => x.key),
|
||||
text: values.map((x) => x.text),
|
||||
index,
|
||||
});
|
||||
},
|
||||
//初始化赋值核心方法
|
||||
getSelect(columns = this.data.columns, index = 0, displayColumns = []) {
|
||||
if (this.value && this.value.length > 0) {
|
||||
const key = this.value[index];
|
||||
|
||||
if (columns && columns.length > 0) {
|
||||
let selectColumn = columns.find((x) => key == x.key);
|
||||
if (selectColumn) {
|
||||
displayColumns.push(selectColumn);
|
||||
if (selectColumn.childs && selectColumn.childs.length > 0) {
|
||||
this.getSelect(selectColumn.childs, index + 1, displayColumns);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.select = {
|
||||
index: this.value.length - 1,
|
||||
value: displayColumns,
|
||||
};
|
||||
|
||||
}
|
||||
},
|
||||
getColumns(columns = this.data.columns, index = 0, displayColumns = [], select) {
|
||||
if (columns && columns.length > 0) {
|
||||
let defaultIndex = 0;
|
||||
if (select) {
|
||||
if (index <= select.index) {
|
||||
const val = select.value[index];
|
||||
if(val&&val.key){
|
||||
columns.forEach((x, i) => {
|
||||
if (x.key == val.key) {
|
||||
defaultIndex = i;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
displayColumns.push({
|
||||
values: columns,
|
||||
defaultIndex: defaultIndex,
|
||||
});
|
||||
let firstColumn = columns[defaultIndex];
|
||||
if (firstColumn.childs && firstColumn.childs.length > 0) {
|
||||
index++;
|
||||
this.getColumns(firstColumn.childs, index, displayColumns, select);
|
||||
}
|
||||
}
|
||||
return displayColumns;
|
||||
},
|
||||
setValues() {
|
||||
// const picker = this.getPicker();
|
||||
// if (!picker) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
let { select } = this;
|
||||
const stack = this.getColumns(undefined, undefined, undefined, select);
|
||||
this.setData({
|
||||
displayColumns: stack,
|
||||
});
|
||||
},
|
||||
getValues() {
|
||||
const picker = this.getPicker();
|
||||
return picker ? picker.getValues().filter((value) => !!value) : [];
|
||||
},
|
||||
reset(value) {
|
||||
this.value = value || [];
|
||||
return this.setValues();
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-picker": "../picker/index"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<van-picker class="van-multi-select__picker" active-class="active-class" toolbar-class="toolbar-class" column-class="column-class" show-toolbar value-key="text" title="{{ title }}" loading="{{ loading }}" columns="{{ displayColumns }}" item-height="{{ itemHeight }}" visible-item-count="{{ visibleItemCount }}" cancel-button-text="{{ cancelButtonText }}" confirm-button-text="{{ confirmButtonText }}" bind:change="onChange" bind:confirm="onConfirm" bind:cancel="onCancel" />
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,123 @@
|
|||
import { VantComponent } from '../common/component';
|
||||
import { isObj, range } from '../common/utils';
|
||||
const DEFAULT_DURATION = 200;
|
||||
VantComponent({
|
||||
classes: ['active-class'],
|
||||
props: {
|
||||
valueKey: String,
|
||||
className: String,
|
||||
itemHeight: Number,
|
||||
visibleItemCount: Number,
|
||||
initialOptions: {
|
||||
type: Array,
|
||||
value: [],
|
||||
},
|
||||
defaultIndex: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer(value) {
|
||||
this.setIndex(value);
|
||||
},
|
||||
},
|
||||
},
|
||||
data: {
|
||||
startY: 0,
|
||||
offset: 0,
|
||||
duration: 0,
|
||||
startOffset: 0,
|
||||
options: [],
|
||||
currentIndex: 0,
|
||||
},
|
||||
created() {
|
||||
const { defaultIndex, initialOptions } = this.data;
|
||||
this.set({
|
||||
currentIndex: defaultIndex,
|
||||
options: initialOptions,
|
||||
}).then(() => {
|
||||
this.setIndex(defaultIndex);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getCount() {
|
||||
return this.data.options.length;
|
||||
},
|
||||
onTouchStart(event) {
|
||||
this.setData({
|
||||
startY: event.touches[0].clientY,
|
||||
startOffset: this.data.offset,
|
||||
duration: 0,
|
||||
});
|
||||
},
|
||||
onTouchMove(event) {
|
||||
const { data } = this;
|
||||
const deltaY = event.touches[0].clientY - data.startY;
|
||||
this.setData({
|
||||
offset: range(
|
||||
data.startOffset + deltaY,
|
||||
-(this.getCount() * data.itemHeight),
|
||||
data.itemHeight
|
||||
),
|
||||
});
|
||||
},
|
||||
onTouchEnd() {
|
||||
const { data } = this;
|
||||
if (data.offset !== data.startOffset) {
|
||||
this.setData({ duration: DEFAULT_DURATION });
|
||||
const index = range(
|
||||
Math.round(-data.offset / data.itemHeight),
|
||||
0,
|
||||
this.getCount() - 1
|
||||
);
|
||||
this.setIndex(index, true);
|
||||
}
|
||||
},
|
||||
onClickItem(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
this.setIndex(index, true);
|
||||
},
|
||||
adjustIndex(index) {
|
||||
const { data } = this;
|
||||
const count = this.getCount();
|
||||
index = range(index, 0, count);
|
||||
for (let i = index; i < count; i++) {
|
||||
if (!this.isDisabled(data.options[i])) return i;
|
||||
}
|
||||
for (let i = index - 1; i >= 0; i--) {
|
||||
if (!this.isDisabled(data.options[i])) return i;
|
||||
}
|
||||
},
|
||||
isDisabled(option) {
|
||||
return isObj(option) && option.disabled;
|
||||
},
|
||||
getOptionText(option) {
|
||||
const { data } = this;
|
||||
return isObj(option) && data.valueKey in option
|
||||
? option[data.valueKey]
|
||||
: option;
|
||||
},
|
||||
setIndex(index, userAction) {
|
||||
const { data } = this;
|
||||
index = this.adjustIndex(index) || 0;
|
||||
const offset = -index * data.itemHeight;
|
||||
if (index !== data.currentIndex) {
|
||||
return this.set({ offset, currentIndex: index }).then(() => {
|
||||
userAction && this.$emit('change', index);
|
||||
});
|
||||
}
|
||||
return this.set({ offset });
|
||||
},
|
||||
setValue(value) {
|
||||
const { options } = this.data;
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
if (this.getOptionText(options[i]) === value) {
|
||||
return this.setIndex(i);
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
getValue() {
|
||||
const { data } = this;
|
||||
return data.options[data.currentIndex];
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"component": true
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<wxs src="./index.wxs" module="getOptionText" />
|
||||
|
||||
<view
|
||||
class="van-picker-column custom-class"
|
||||
style="height: {{ itemHeight * visibleItemCount }}px"
|
||||
bind:touchstart="onTouchStart"
|
||||
catch:touchmove="onTouchMove"
|
||||
bind:touchend="onTouchEnd"
|
||||
bind:touchcancel="onTouchEnd"
|
||||
>
|
||||
<view style="transition: transform {{ duration }}ms; line-height: {{ itemHeight }}px; transform: translate3d(0, {{ offset + (itemHeight * (visibleItemCount - 1)) / 2 }}px, 0)">
|
||||
<view
|
||||
wx:for="{{ options }}"
|
||||
wx:for-item="option"
|
||||
wx:key="index"
|
||||
data-index="{{ index }}"
|
||||
style="height: {{ itemHeight }}px"
|
||||
class="van-ellipsis van-picker-column__item {{ option && option.disabled ? 'van-picker-column__item--disabled' : '' }} {{ index === currentIndex ? 'van-picker-column__item--selected active-class' : '' }}"
|
||||
bindtap="onClickItem"
|
||||
>{{ getOptionText(option, valueKey) }}</view>
|
||||
</view>
|
||||
</view>
|
|
@ -0,0 +1,8 @@
|
|||
function isObj(x) {
|
||||
var type = typeof x;
|
||||
return x !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
module.exports = function (option, valueKey) {
|
||||
return isObj(option) && option[valueKey] != null ? option[valueKey] : option;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';.van-picker-column{overflow:hidden;text-align:center;color:#000;color:var(--picker-option-text-color,#000);font-size:16px;font-size:var(--picker-option-font-size,16px)}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--picker-option-selected-text-color,#323233)}.van-picker-column__item--disabled{opacity:.3;opacity:var(--picker-option-disabled-opacity,.3)}
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,145 @@
|
|||
import { VantComponent } from '../common/component';
|
||||
import { pickerProps } from './shared';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: Object.assign(Object.assign({}, pickerProps), {
|
||||
valueKey: {
|
||||
type: String,
|
||||
value: 'text',
|
||||
},
|
||||
toolbarPosition: {
|
||||
type: String,
|
||||
value: 'top',
|
||||
},
|
||||
defaultIndex: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
columns: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer(columns = []) {
|
||||
this.simple = columns.length && !columns[0].values;
|
||||
this.children = this.selectAllComponents('.van-picker__column');
|
||||
if (Array.isArray(this.children) && this.children.length) {
|
||||
this.setColumns().catch(() => {});
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
beforeCreate() {
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
noop() {},
|
||||
setColumns() {
|
||||
const { data } = this;
|
||||
const columns = this.simple ? [{ values: data.columns }] : data.columns;
|
||||
const stack = columns.map((column, index) =>
|
||||
this.setColumnValues(index, column.values)
|
||||
);
|
||||
return Promise.all(stack);
|
||||
},
|
||||
emit(event) {
|
||||
const { type } = event.currentTarget.dataset;
|
||||
if (this.simple) {
|
||||
this.$emit(type, {
|
||||
value: this.getColumnValue(0),
|
||||
index: this.getColumnIndex(0),
|
||||
});
|
||||
} else {
|
||||
this.$emit(type, {
|
||||
value: this.getValues(),
|
||||
index: this.getIndexes(),
|
||||
});
|
||||
}
|
||||
},
|
||||
onChange(event) {
|
||||
if (this.simple) {
|
||||
this.$emit('change', {
|
||||
picker: this,
|
||||
value: this.getColumnValue(0),
|
||||
index: this.getColumnIndex(0),
|
||||
});
|
||||
} else {
|
||||
this.$emit('change', {
|
||||
picker: this,
|
||||
value: this.getValues(),
|
||||
index: event.currentTarget.dataset.index,
|
||||
});
|
||||
}
|
||||
},
|
||||
// get column instance by index
|
||||
getColumn(index) {
|
||||
return this.children[index];
|
||||
},
|
||||
// get column value by index
|
||||
getColumnValue(index) {
|
||||
const column = this.getColumn(index);
|
||||
return column && column.getValue();
|
||||
},
|
||||
// set column value by index
|
||||
setColumnValue(index, value) {
|
||||
const column = this.getColumn(index);
|
||||
if (column == null) {
|
||||
return Promise.reject(new Error('setColumnValue: 对应列不存在'));
|
||||
}
|
||||
return column.setValue(value);
|
||||
},
|
||||
// get column option index by column index
|
||||
getColumnIndex(columnIndex) {
|
||||
return (this.getColumn(columnIndex) || {}).data.currentIndex;
|
||||
},
|
||||
// set column option index by column index
|
||||
setColumnIndex(columnIndex, optionIndex) {
|
||||
const column = this.getColumn(columnIndex);
|
||||
if (column == null) {
|
||||
return Promise.reject(new Error('setColumnIndex: 对应列不存在'));
|
||||
}
|
||||
return column.setIndex(optionIndex);
|
||||
},
|
||||
// get options of column by index
|
||||
getColumnValues(index) {
|
||||
return (this.children[index] || {}).data.options;
|
||||
},
|
||||
// set options of column by index
|
||||
setColumnValues(index, options, needReset = true) {
|
||||
const column = this.children[index];
|
||||
if (column == null) {
|
||||
return Promise.reject(new Error('setColumnValues: 对应列不存在'));
|
||||
}
|
||||
const isSame =
|
||||
JSON.stringify(column.data.options) === JSON.stringify(options);
|
||||
if (isSame) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return column.set({ options }).then(() => {
|
||||
if (needReset) {
|
||||
column.setIndex(0);
|
||||
}
|
||||
});
|
||||
},
|
||||
// get values of all columns
|
||||
getValues() {
|
||||
return this.children.map((child) => child.getValue());
|
||||
},
|
||||
// set values of all columns
|
||||
setValues(values) {
|
||||
const stack = values.map((value, index) =>
|
||||
this.setColumnValue(index, value)
|
||||
);
|
||||
return Promise.all(stack);
|
||||
},
|
||||
// get indexes of all columns
|
||||
getIndexes() {
|
||||
return this.children.map((child) => child.data.currentIndex);
|
||||
},
|
||||
// set indexes of all columns
|
||||
setIndexes(indexes) {
|
||||
const stack = indexes.map((optionIndex, columnIndex) =>
|
||||
this.setColumnIndex(columnIndex, optionIndex)
|
||||
);
|
||||
return Promise.all(stack);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"picker-column": "../picker-column/index",
|
||||
"loading": "../loading/index"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<import src="./toolbar.wxml" />
|
||||
<view class="van-picker custom-class">
|
||||
<template is="toolbar" wx:if="{{ toolbarPosition === 'top' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template>
|
||||
<view wx:if="{{ loading }}" class="van-picker__loading">
|
||||
<loading color="#1989fa" />
|
||||
</view>
|
||||
<view class="van-picker__columns" style="height: {{ itemHeight * visibleItemCount }}px" catch:touchmove="noop">
|
||||
<picker-column class="van-picker__column" wx:for="{{ isSimple(columns) ? [columns] : columns }}" wx:key="index" data-index="{{ index }}" custom-class="column-class" value-key="{{ valueKey }}" initial-options="{{ isSimple(columns) ? item : item.values }}" default-index="{{ item.defaultIndex || defaultIndex }}" item-height="{{ itemHeight }}" visible-item-count="{{ visibleItemCount }}" active-class="active-class" bind:change="onChange" />
|
||||
<view class="van-picker__mask" style="background-size: 100% {{ (itemHeight * visibleItemCount - itemHeight) / 2 }}px" />
|
||||
<view class="van-picker__frame van-hairline--top-bottom" style="height: {{ itemHeight }}px" />
|
||||
</view>
|
||||
<template is="toolbar" wx:if="{{ toolbarPosition === 'bottom' }}" data="{{ showToolbar, cancelButtonText, title, confirmButtonText }}"></template>
|
||||
</view>
|
||||
<wxs module="isSimple">
|
||||
function isSimple(columns) {
|
||||
return columns.length && !columns[0].values;
|
||||
}
|
||||
module.exports = isSimple;
|
||||
</wxs>
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;-webkit-user-select:none;user-select:none;background-color:#fff;background-color:var(--picker-background-color,#fff)}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;height:var(--picker-toolbar-height,44px);line-height:44px;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{padding:0 16px;padding:var(--picker-action-padding,0 16px);font-size:14px;font-size:var(--picker-action-font-size,14px);color:#1989fa;color:var(--picker-action-text-color,#1989fa)}.van-picker__cancel--hover,.van-picker__confirm--hover{background-color:#f2f3f5;background-color:var(--picker-action-active-color,#f2f3f5)}.van-picker__title{max-width:50%;text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--picker-option-font-size,16px)}.van-picker__columns{position:relative;display:-webkit-flex;display:flex}.van-picker__column{-webkit-flex:1 1;flex:1 1;width:0}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:hsla(0,0%,100%,.9);background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9))}.van-picker__mask{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-repeat:no-repeat;background-position:top,bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:none}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);pointer-events:none}
|
|
@ -0,0 +1,21 @@
|
|||
export declare const pickerProps: {
|
||||
title: StringConstructor;
|
||||
loading: BooleanConstructor;
|
||||
showToolbar: BooleanConstructor;
|
||||
cancelButtonText: {
|
||||
type: StringConstructor;
|
||||
value: string;
|
||||
};
|
||||
confirmButtonText: {
|
||||
type: StringConstructor;
|
||||
value: string;
|
||||
};
|
||||
visibleItemCount: {
|
||||
type: NumberConstructor;
|
||||
value: number;
|
||||
};
|
||||
itemHeight: {
|
||||
type: NumberConstructor;
|
||||
value: number;
|
||||
};
|
||||
};
|
|
@ -0,0 +1,21 @@
|
|||
export const pickerProps = {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
showToolbar: Boolean,
|
||||
cancelButtonText: {
|
||||
type: String,
|
||||
value: '取消',
|
||||
},
|
||||
confirmButtonText: {
|
||||
type: String,
|
||||
value: '确认',
|
||||
},
|
||||
visibleItemCount: {
|
||||
type: Number,
|
||||
value: 5,
|
||||
},
|
||||
itemHeight: {
|
||||
type: Number,
|
||||
value: 44,
|
||||
},
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
<template name="toolbar">
|
||||
<view
|
||||
wx:if="{{ showToolbar }}"
|
||||
class="van-picker__toolbar van-hairline--top-bottom toolbar-class"
|
||||
>
|
||||
<view
|
||||
class="van-picker__cancel"
|
||||
hover-class="van-picker__cancel--hover"
|
||||
hover-stay-time="70"
|
||||
data-type="cancel"
|
||||
bindtap="emit"
|
||||
>
|
||||
{{ cancelButtonText }}
|
||||
</view>
|
||||
<view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{
|
||||
title
|
||||
}}</view>
|
||||
<view
|
||||
class="van-picker__confirm"
|
||||
hover-class="van-picker__confirm--hover"
|
||||
hover-stay-time="70"
|
||||
data-type="confirm"
|
||||
bindtap="emit"
|
||||
>
|
||||
{{ confirmButtonText }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
|
@ -0,0 +1 @@
|
|||
export {};
|
|
@ -0,0 +1,105 @@
|
|||
import { VantComponent } from "../common/component";
|
||||
import { pageScrollMixin } from "../mixins/page-scroll";
|
||||
const ROOT_ELEMENT = ".van-sticky";
|
||||
VantComponent({
|
||||
props: {
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 99,
|
||||
},
|
||||
offsetTop: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer: "onScroll",
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer: "onScroll",
|
||||
},
|
||||
container: {
|
||||
type: null,
|
||||
observer: "onScroll",
|
||||
},
|
||||
scrollTop: {
|
||||
type: null,
|
||||
observer(val) {
|
||||
this.onScroll({ scrollTop: val });
|
||||
},
|
||||
},
|
||||
},
|
||||
mixins: [
|
||||
pageScrollMixin(function (event) {
|
||||
if (this.data.scrollTop != null) {
|
||||
return;
|
||||
}
|
||||
this.onScroll(event);
|
||||
}),
|
||||
],
|
||||
data: {
|
||||
height: 0,
|
||||
fixed: false,
|
||||
transform: 0,
|
||||
},
|
||||
mounted() {
|
||||
this.onScroll();
|
||||
},
|
||||
methods: {
|
||||
onScroll({ scrollTop } = {}) {
|
||||
const { container, offsetTop, disabled } = this.data;
|
||||
if (disabled) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: false,
|
||||
transform: 0,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.scrollTop = scrollTop || this.scrollTop;
|
||||
if (typeof container === "function") {
|
||||
Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(([root, container]) => {
|
||||
if (offsetTop + root.height > container.height + container.top) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: false,
|
||||
transform: container.height - root.height,
|
||||
});
|
||||
} else if (offsetTop >= root.top) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: true,
|
||||
height: root.height,
|
||||
transform: 0,
|
||||
});
|
||||
} else {
|
||||
this.setDataAfterDiff({ fixed: false, transform: 0 });
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.getRect(ROOT_ELEMENT).then((root) => {
|
||||
if (offsetTop >= root.top) {
|
||||
this.setDataAfterDiff({ fixed: true, height: root.height });
|
||||
this.transform = 0;
|
||||
} else {
|
||||
this.setDataAfterDiff({ fixed: false });
|
||||
}
|
||||
});
|
||||
},
|
||||
setDataAfterDiff(data) {
|
||||
wx.nextTick(() => {
|
||||
const diff = Object.keys(data).reduce((prev, key) => {
|
||||
if (data[key] !== this.data[key]) {
|
||||
prev[key] = data[key];
|
||||
}
|
||||
return prev;
|
||||
}, {});
|
||||
this.setData(diff);
|
||||
this.$emit("scroll", {
|
||||
scrollTop: this.scrollTop,
|
||||
isFixed: data.fixed || this.data.fixed,
|
||||
});
|
||||
});
|
||||
},
|
||||
getContainerRect() {
|
||||
const nodesRef = this.data.container();
|
||||
return new Promise((resolve) => nodesRef.boundingClientRect(resolve).exec());
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"component": true
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
<view class="custom-class van-sticky" style="{{ computed.containerStyle({ fixed, height, zIndex }) }}">
|
||||
<view class="{{ utils.bem('sticky-wrap', { fixed }) }}" style="{{ computed.wrapStyle({ fixed, offsetTop, transform, zIndex }) }}">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
|
@ -0,0 +1,37 @@
|
|||
/* eslint-disable */
|
||||
function wrapStyle(data) {
|
||||
var style = '';
|
||||
|
||||
if (data.transform) {
|
||||
style += 'transform: translate3d(0, ' + data.transform + 'px, 0);';
|
||||
}
|
||||
|
||||
if (data.fixed) {
|
||||
style += 'top: ' + data.offsetTop + 'px;';
|
||||
}
|
||||
|
||||
if (data.zIndex) {
|
||||
style += 'z-index: ' + data.zIndex + ';';
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
function containerStyle(data) {
|
||||
var style = '';
|
||||
|
||||
if (data.fixed) {
|
||||
style += 'height: ' + data.height + 'px;';
|
||||
}
|
||||
|
||||
if (data.zIndex) {
|
||||
style += 'z-index: ' + data.zIndex + ';';
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
wrapStyle: wrapStyle,
|
||||
containerStyle: containerStyle
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
@import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{position:fixed;right:0;left:0}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue