This commit is contained in:
qiaojiale 2025-06-06 15:07:26 +08:00
parent c711239127
commit 2b53798b0d
891 changed files with 89818 additions and 81836 deletions

28
.gitignore vendored
View File

@ -1,14 +1,14 @@
# Windows # Windows
[Dd]esktop.ini [Dd]esktop.ini
Thumbs.db Thumbs.db
$RECYCLE.BIN/ $RECYCLE.BIN/
# macOS # macOS
.DS_Store .DS_Store
.fseventsd .fseventsd
.Spotlight-V100 .Spotlight-V100
.TemporaryItems .TemporaryItems
.Trashes .Trashes
# Node.js # Node.js
node_modules/ node_modules/

View File

@ -1,3 +1,3 @@
{ {
"git.ignoreLimitWarning": true "git.ignoreLimitWarning": true
} }

View File

@ -1,17 +1,17 @@
export const apiArr = { export const apiArr = {
getActiveList:'/wechat/community/activity/list', //获取活动列表 getActiveList:'/wechat/community/activity/list', //获取活动列表
getActiveInfoById:"/wechat/community/activity/detail", //获取活动详情 getActiveInfoById:"/wechat/community/activity/detail", //获取活动详情
eliminate:"/wechat/community/activity/eliminate", //核销 eliminate:"/wechat/community/activity/eliminate", //核销
eliminateList:"/wechat/community/activity/eliminate/list", //核销列表 eliminateList:"/wechat/community/activity/eliminate/list", //核销列表
eliminateInfo:"/wechat/community/activity/eliminate/detail", //核销详情 eliminateInfo:"/wechat/community/activity/eliminate/detail", //核销详情
ScanCodeInfo:"/wechat/community/activity/one",//商家扫码详情 ScanCodeInfo:"/wechat/community/activity/one",//商家扫码详情
getReserationList:"/wechat/community/activity/reservation/list", //获取预约列表 getReserationList:"/wechat/community/activity/reservation/list", //获取预约列表
Reservation:"/wechat/community/activity/reservation", //预约 Reservation:"/wechat/community/activity/reservation", //预约
modify: '/wechat/community/activity/order/modify', // 订单修改 modify: '/wechat/community/activity/order/modify', // 订单修改
getShopList:"/wechat/community/activity/shop/list" getShopList:"/wechat/community/activity/shop/list"
} }

View File

@ -1,14 +1,14 @@
const host = 'https://api.hshuishang.com/api/v1'; const host = 'https://api.hshuishang.com/api/v1';
// 水机 // 水机
const httpUserUrl = host + '/waters'; const httpUserUrl = host + '/waters';
const apiAddr = { const apiAddr = {
host:host, host:host,
// 处理主办激活请求 // 处理主办激活请求
board_activation: httpUserUrl + '/board-activation', board_activation: httpUserUrl + '/board-activation',
} }
module.exports = apiAddr; module.exports = apiAddr;

View File

@ -1,88 +1,88 @@
const host = 'https://zhsq.hshuishang.com'; const host = 'https://zhsq.hshuishang.com';
const centerHost = 'https://cloud.rongwu360.com'; const centerHost = 'https://cloud.rongwu360.com';
const httpUserUrl = host + '/Miniapi/User'; const httpUserUrl = host + '/Miniapi/User';
const httpIndexUrl = host + '/Miniapi/Index'; const httpIndexUrl = host + '/Miniapi/Index';
const httpShopUrl = host + '/Miniapi/Shop'; const httpShopUrl = host + '/Miniapi/Shop';
const httpSendUrl = host + '/Miniapi/Sendmsg'; const httpSendUrl = host + '/Miniapi/Sendmsg';
const httpHomeUrl = host + '/Miniapi/Home'; const httpHomeUrl = host + '/Miniapi/Home';
const httpMeituanUrl = host + '/Miniapi/Meituan'; const httpMeituanUrl = host + '/Miniapi/Meituan';
const httpHardwareUrl = host + '/Miniapi/Hardware'; const httpHardwareUrl = host + '/Miniapi/Hardware';
const httpDouyinUrl = host + '/Miniapi/Douyin'; const httpDouyinUrl = host + '/Miniapi/Douyin';
const httpStatisticsUrl = host + '/Miniapi/Statistics'; const httpStatisticsUrl = host + '/Miniapi/Statistics';
const httpCommunityUrl = host + '/Miniapi/Community'; const httpCommunityUrl = host + '/Miniapi/Community';
const httpMapsUrl = host + '/Miniapi/Maps'; const httpMapsUrl = host + '/Miniapi/Maps';
const apiAddr = { const apiAddr = {
host:host, host:host,
center_host:centerHost, center_host:centerHost,
// 获取会话密钥 // 获取会话密钥
get_session_key: httpUserUrl + '/get_session_key', get_session_key: httpUserUrl + '/get_session_key',
decrypt_mini_user: httpUserUrl + '/decrypt_mini_user', decrypt_mini_user: httpUserUrl + '/decrypt_mini_user',
decrypt_mini_phone: httpUserUrl + '/decrypt_mini_phone', decrypt_mini_phone: httpUserUrl + '/decrypt_mini_phone',
mini_user_bind: httpUserUrl + '/mini_user_bind', mini_user_bind: httpUserUrl + '/mini_user_bind',
add_create_mini_user: httpUserUrl + '/add_create_mini_user', add_create_mini_user: httpUserUrl + '/add_create_mini_user',
avatar_upload: httpUserUrl + '/avatar_upload', avatar_upload: httpUserUrl + '/avatar_upload',
get_user_info: httpUserUrl + '/get_user_info', get_user_info: httpUserUrl + '/get_user_info',
get_user_menu: httpUserUrl + '/get_user_menu', get_user_menu: httpUserUrl + '/get_user_menu',
order_list:httpUserUrl + '/get_order_list', order_list:httpUserUrl + '/get_order_list',
order_module:httpUserUrl + '/get_order_module_list', order_module:httpUserUrl + '/get_order_module_list',
poster_info:httpUserUrl + '/poster_info', poster_info:httpUserUrl + '/poster_info',
get_map_shop_list: httpShopUrl + '/get_map_shop_list', get_map_shop_list: httpShopUrl + '/get_map_shop_list',
get_booking_type: httpShopUrl + '/get_booking_type', get_booking_type: httpShopUrl + '/get_booking_type',
mini_shop_apply: httpShopUrl + '/mini_shop_apply', mini_shop_apply: httpShopUrl + '/mini_shop_apply',
get_shop_details: httpShopUrl + '/get_shop_details', get_shop_details: httpShopUrl + '/get_shop_details',
get_shop_area_list: httpShopUrl + '/get_shop_area_list', get_shop_area_list: httpShopUrl + '/get_shop_area_list',
get_access_history_shop_list: httpShopUrl + '/get_access_history_shop_list', get_access_history_shop_list: httpShopUrl + '/get_access_history_shop_list',
access_history_shop_del: httpShopUrl + '/access_history_shop_del', access_history_shop_del: httpShopUrl + '/access_history_shop_del',
get_shop_index_nav: httpShopUrl + '/get_index_nav', get_shop_index_nav: httpShopUrl + '/get_index_nav',
get_map_shop_goods_list:httpShopUrl + '/get_map_shop_goods_list', get_map_shop_goods_list:httpShopUrl + '/get_map_shop_goods_list',
get_map_community_list: httpCommunityUrl + '/get_map_community_list', get_map_community_list: httpCommunityUrl + '/get_map_community_list',
get_community_details: httpCommunityUrl + '/get_community_details', get_community_details: httpCommunityUrl + '/get_community_details',
get_community_area_list: httpCommunityUrl + '/get_community_area_list', get_community_area_list: httpCommunityUrl + '/get_community_area_list',
get_community_tools_nav: httpCommunityUrl + '/get_tools_nav', get_community_tools_nav: httpCommunityUrl + '/get_tools_nav',
get_community_index_nav:httpCommunityUrl + '/get_index_nav', get_community_index_nav:httpCommunityUrl + '/get_index_nav',
get_share_pic:httpIndexUrl + '/get_share_pic', get_share_pic:httpIndexUrl + '/get_share_pic',
get_site_color: httpIndexUrl + '/get_site_color', get_site_color: httpIndexUrl + '/get_site_color',
get_location: httpIndexUrl + '/get_location', get_location: httpIndexUrl + '/get_location',
get_host_info: httpIndexUrl + '/get_host_info', get_host_info: httpIndexUrl + '/get_host_info',
customer_page_info:httpIndexUrl + '/customer_page_info', customer_page_info:httpIndexUrl + '/customer_page_info',
footer_nav_list:httpIndexUrl + '/footer_nav_list', footer_nav_list:httpIndexUrl + '/footer_nav_list',
setcookie_location:httpIndexUrl + '/setcookie_location', setcookie_location:httpIndexUrl + '/setcookie_location',
get_site_config:httpIndexUrl + '/get_site_config', get_site_config:httpIndexUrl + '/get_site_config',
get_site_ad:httpIndexUrl + '/get_site_ad', // 获取图片广告 get_site_ad:httpIndexUrl + '/get_site_ad', // 获取图片广告
get_index_nav:httpIndexUrl + '/get_index_nav', // 获取图片广告 get_index_nav:httpIndexUrl + '/get_index_nav', // 获取图片广告
get_site_nav:httpIndexUrl + '/get_site_nav', // 获取菜单 get_site_nav:httpIndexUrl + '/get_site_nav', // 获取菜单
get_index_block: httpIndexUrl + '/get_index_block', // 组合模块 get_index_block: httpIndexUrl + '/get_index_block', // 组合模块
get_index_list_tab:httpIndexUrl + '/get_index_list_tab', // 组合模块 get_index_list_tab:httpIndexUrl + '/get_index_list_tab', // 组合模块
get_mini_tmpl: httpSendUrl + '/get_mini_tmpl', get_mini_tmpl: httpSendUrl + '/get_mini_tmpl',
user_send_apply: httpSendUrl + '/user_send_apply', user_send_apply: httpSendUrl + '/user_send_apply',
add_port_share:httpHomeUrl + '/add_port_share', add_port_share:httpHomeUrl + '/add_port_share',
meituan_shop: httpMeituanUrl + '/meituan_shop', meituan_shop: httpMeituanUrl + '/meituan_shop',
meituan_verify_code: httpMeituanUrl + '/verify_code', meituan_verify_code: httpMeituanUrl + '/verify_code',
hw_cp_operate: httpHardwareUrl+'/operate', hw_cp_operate: httpHardwareUrl+'/operate',
hw_cp_operate_common: httpHardwareUrl+'/operate_common', hw_cp_operate_common: httpHardwareUrl+'/operate_common',
hw_cp_change_port_state: httpHardwareUrl+'/change_port_mode_state', hw_cp_change_port_state: httpHardwareUrl+'/change_port_mode_state',
douyinver: httpDouyinUrl+'/getPreVerify', douyinver: httpDouyinUrl+'/getPreVerify',
douyin_shop: httpDouyinUrl + '/douyin_shop', douyin_shop: httpDouyinUrl + '/douyin_shop',
douyin_verify_code: httpDouyinUrl + '/verify_code', douyin_verify_code: httpDouyinUrl + '/verify_code',
statistics_api:httpStatisticsUrl, statistics_api:httpStatisticsUrl,
get_maps_geocoder: httpMapsUrl + '/geocoder', get_maps_geocoder: httpMapsUrl + '/geocoder',
third_recharge_order:httpUserUrl + '/get_third_recharge_logs', third_recharge_order:httpUserUrl + '/get_third_recharge_logs',
}; };
module.exports = apiAddr; module.exports = apiAddr;

View File

@ -1,4 +1,4 @@
export const city = { export const city = {
getCitys: '/citys/c/list', //获取城市 getCitys: '/citys/c/list', //获取城市
} }

View File

@ -1,14 +1,14 @@
export const apiArr = { export const apiArr = {
list: '/wechat/community/list', // 获取社区列表 list: '/wechat/community/list', // 获取社区列表
info: '/wechat/community/info', // 获取单个社区信息 info: '/wechat/community/info', // 获取单个社区信息
tipsList: '/wechat/community/tips/list', // 获取全部通知列表 tipsList: '/wechat/community/tips/list', // 获取全部通知列表
oneTips: '/wechat/community/tips/one', // 获取单个社区通知 oneTips: '/wechat/community/tips/one', // 获取单个社区通知
apply: '/wechat/community/apply', // 申请加入小区 apply: '/wechat/community/apply', // 申请加入小区
getFacilityList:'/wechat/community/facility/list', //获取楼号, getFacilityList:'/wechat/community/facility/list', //获取楼号,
getRoomList:'/wechat/community/room/list', //获取房间号 getRoomList:'/wechat/community/room/list', //获取房间号
ownerList: '/wechat/community/owner/list', // 获取社区业主列表 ownerList: '/wechat/community/owner/list', // 获取社区业主列表
submit:"/wechat/community/owner/feedback-create", //报修提交 submit:"/wechat/community/owner/feedback-create", //报修提交
getListByRepair:"/wechat/community/owner/feedback-list",//报事报修列表 getListByRepair:"/wechat/community/owner/feedback-list",//报事报修列表
getInfoById:"/wechat/community/owner/feedback-info", //报事报修根据id查询详情 getInfoById:"/wechat/community/owner/feedback-info", //报事报修根据id查询详情
}; };

View File

@ -1,6 +1,6 @@
export const apiArr = { export const apiArr = {
list: '/wechat/community/car/list', // 获取社区列表 list: '/wechat/community/car/list', // 获取社区列表
addCar: '/wechat/community/car/add', // 添加车辆 addCar: '/wechat/community/car/add', // 添加车辆
getCarList:'/wechat/community/car/list', //获取车辆列表 getCarList:'/wechat/community/car/list', //获取车辆列表
deleteItem:"/wechat/community/car/del"//删除车牌 deleteItem:"/wechat/community/car/del"//删除车牌
}; };

View File

@ -1,11 +1,11 @@
export const apiArr = { export const apiArr = {
AllDoorToDoor: '/wechat/appoints/get-cate-list', //获取服务列表 AllDoorToDoor: '/wechat/appoints/get-cate-list', //获取服务列表
ServerInfo: '/wechat/appoints/get-one', //获取服务列表 ServerInfo: '/wechat/appoints/get-one', //获取服务列表
getServerById: '/wechat/appoints/get-all-list', //跟据不同的id 查分类 getServerById: '/wechat/appoints/get-all-list', //跟据不同的id 查分类
submitServer: '/wechat/appoint-orders/now', //预约服务 submitServer: '/wechat/appoint-orders/now', //预约服务
createServerOrder: '/wechat/appoint-orders/create', //创建上门服务订单 createServerOrder: '/wechat/appoint-orders/create', //创建上门服务订单
getCurrentShopMsg: '/wechat/water/device/shop-info', //获取店铺支付信息 getCurrentShopMsg: '/wechat/water/device/shop-info', //获取店铺支付信息
getBanner: '/wechat/banner-list ', //banner图 getBanner: '/wechat/banner-list ', //banner图
getGoodsList: '/wechat/appoints/get-shop-list', //获取商家列表 getGoodsList: '/wechat/appoints/get-shop-list', //获取商家列表
getGoodsDesc:"/wechat/shop/shop_info", //商家详情 getGoodsDesc:"/wechat/shop/shop_info", //商家详情
} }

View File

@ -1,6 +1,6 @@
export const apiArr = { export const apiArr = {
createRecord:'/wechat/mpuser/health/create', //创建健康自测 createRecord:'/wechat/mpuser/health/create', //创建健康自测
getReportList:'/wechat/mpuser/health/list', //获取健康自测记录 getReportList:'/wechat/mpuser/health/list', //获取健康自测记录
getReportById:"/wechat/mpuser/health/one",//根据id查健康记录 getReportById:"/wechat/mpuser/health/one",//根据id查健康记录
} }

View File

@ -1,9 +1,9 @@
export const apiArr = { export const apiArr = {
settledShop: '/wechat/shop/settled-shop', // 商家入驻 settledShop: '/wechat/shop/settled-shop', // 商家入驻
settledDeal: '/wechat/water/dealer/settled-deal', // 经销商入驻 settledDeal: '/wechat/water/dealer/settled-deal', // 经销商入驻
settledComm: '/wechat/community/settled-comm', // 社区入驻 settledComm: '/wechat/community/settled-comm', // 社区入驻
city: '/citys/s/list', // 获取省份列表 city: '/citys/s/list', // 获取省份列表
area: '/citys/c/list', // 获取城市列表 area: '/citys/c/list', // 获取城市列表
business: '/citys/x/list', // 获取区县列表 business: '/citys/x/list', // 获取区县列表
getTree: '/wechat/shop/cates/get-tree', // 商家商户分类树信息 getTree: '/wechat/shop/cates/get-tree', // 商家商户分类树信息
} }

View File

@ -1,6 +1,6 @@
export const apiArr = { export const apiArr = {
shopList: '/wechat/shop/shop_list', // 获取商家列表 shopList: '/wechat/shop/shop_list', // 获取商家列表
balance: '/wechat/shop/user_balance', // 用户余额 balance: '/wechat/shop/user_balance', // 用户余额
pay: '/wechat/shop/shop_pay', // 支付 pay: '/wechat/shop/shop_pay', // 支付
recharge: '/wechat/shop/recharge', // 充值 recharge: '/wechat/shop/recharge', // 充值
} }

45
api/partner.js Normal file
View File

@ -0,0 +1,45 @@
const login = '/users/admin-login' //登录
const loginInfo = '/users/get-info' //登录信息
const getPartner = '/dealer/get-one' //经销商信息
const getPackageList = '/new-install/packages' //套餐购买列表
const getMasterList = '/master/list' //师傅列表
const createNewOrder = '/new-install/create' //创建新装工单
const phoneSearch = '/customer/phone-search' //搜索客户电话
const getproductList = '/water/dealer/deposit_pack_product'//新增工单产品
const deviceList = '/device/list' //设备列表
const createRepairOrder = '/order-repair/create'//创建维修订单
const getUninstallList = '/uninstall/list' //拆除工单
const getUninstallInfo = '/uninstall/one' //拆除工单详情
const getPartList = '/part_replace/list' //更换工单列表
const getPartInfo = '/part_replace/one' //更换工单详情
const masterSelect = '/master/select' //更换工单详情
const assignPartReplaceMaster = '/part_replace/assign' //指派
const apiArr = {
masterSelect,
getproductList,
assignPartReplaceMaster,
login,
getPartList,
getPartInfo,
getUninstallList,
getUninstallInfo,
createRepairOrder,
deviceList,
loginInfo,
getPartner,
getPackageList,
getMasterList,
createNewOrder,
phoneSearch
}
module.exports = apiArr;

View File

@ -1,9 +1,16 @@
const pay = '/lakala/preorder' //预下单 const pay = '/lakala/preorder' //预下单
const queryPay = '/lakala/trade-query' //查询交易结果 const queryPay = '/lakala/trade-query' //查询交易结果
const queryPayByWechat = '/wechat/water/query_pay' //查询交易结果
const PayJs = {
pay, const HsqueryPay = '/lakala/hs-preorder' //预下单
queryPay const HsqueryPayByWechat = '/lakala/hs-trade-query' //查询交易结果
}
const PayJs = {
pay,
queryPay,
HsqueryPay,
HsqueryPayByWechat,
queryPayByWechat
}
module.exports = PayJs; module.exports = PayJs;

View File

@ -1,26 +1,26 @@
export const apiArr = { export const apiArr = {
getAllList:' /wechat/appoints/get-all-list', // 上门服务商品列表 getAllList:' /wechat/appoints/get-all-list', // 上门服务商品列表
revoke: '/wechat/appoint-orders/revoke', // 取消订单 revoke: '/wechat/appoint-orders/revoke', // 取消订单
getOne: '/wechat/appoint-orders/get-one', // 订单详情 getOne: '/wechat/appoint-orders/get-one', // 订单详情
create: '/wechat/appoint-orders/create', // 订单提交 create: '/wechat/appoint-orders/create', // 订单提交
getOrdersAllList: '/wechat/appoint-orders/get-all-list', // 查询这个登录人的所有订单 getOrdersAllList: '/wechat/appoint-orders/get-all-list', // 查询这个登录人的所有订单
signCycle: '/wechat/sign/sign-cycle', // 签到周期详情 signCycle: '/wechat/sign/sign-cycle', // 签到周期详情
signList: '/wechat/sign/sign-list', // 获取签到记录列表 signList: '/wechat/sign/sign-list', // 获取签到记录列表
sign: '/wechat/sign/sign', // 积分签到 sign: '/wechat/sign/sign', // 积分签到
signIntegral: '/wechat/sign/integral', // 查询账户积分 signIntegral: '/wechat/sign/integral', // 查询账户积分
signInfo: '/wechat/sign/info', // 获取签到详情 signInfo: '/wechat/sign/info', // 获取签到详情
addr: '/wechat/mpusers/addr', // 获取地址信息 addr: '/wechat/mpusers/addr', // 获取地址信息
setAddr: '/wechat/mpusers/set-addr',// 修改地址接口 setAddr: '/wechat/mpusers/set-addr',// 修改地址接口
avatar: '/wechat/mpusers/avatar', // 上传头像 avatar: '/wechat/mpusers/avatar', // 上传头像
modifyPass: '/wechat/mpusers/modify-pass', // 修改登录密码 modifyPass: '/wechat/mpusers/modify-pass', // 修改登录密码
payPass: '/wechat/mpusers/pay-pass', // 设置支付密码 payPass: '/wechat/mpusers/pay-pass', // 设置支付密码
couponList: '/wechat/discuss/list', // 获取优惠券列表 couponList: '/wechat/discuss/list', // 获取优惠券列表
getUserCommunity:"/wechat/community/owner/mylist",//获取用户社区信息 getUserCommunity:"/wechat/community/owner/mylist",//获取用户社区信息
// TODO: 以下接口非小程序使用,临时调用添加数据 // TODO: 以下接口非小程序使用,临时调用添加数据
allCate: '/discuss-capon/all_cate', // 获取所有分类 allCate: '/discuss-capon/all_cate', // 获取所有分类
list: '/discuss-capon/list', // 获取优惠券商品列表 list: '/discuss-capon/list', // 获取优惠券商品列表
create: '/discuss-capon/create', // 添加优惠券 create: '/discuss-capon/create', // 添加优惠券
}; };

View File

@ -1,177 +1,234 @@
const repair = '/wechat/water/device/one-key-repair' //一键报修 const repair = '/wechat/water/device/one-key-repair' //一键报修
const getUserList = '/wechat/water/device/list' //获取用户设备列表 const getUserList = '/wechat/water/device/list' //获取用户设备列表
const changeDef = '/wechat/water/device/first' //切换默认设备 const changeDef = '/wechat/water/device/first' //切换默认设备
const getpackageList = '/wechat/water/device/package-list' //获取套餐列表 // const getpackageList = '/wechat/water/device/package-list' //获取套餐列表
const createPackageOrder = '/wechat/water/device/package-buy'//创建套餐订单 const getpackageList = '/wechat/water/device-package' //获取套餐列表
const getCurrentShopMsg = '/wechat/water/device/shop-info' //获取当前商户信息
const getdeviceListByid = '/wechat/water/device/parts-list' //根据id获取可购买设备 const createPackageOrder = '/wechat/water/device/package-buy'//创建套餐订单
const createDeviceOrder = '/wechat/water/device/parts-buy' //创建配件购买订单 const getCurrentShopMsg = '/wechat/water/device/shop-info' //获取当前商户信息
const getdeviceListByid = '/wechat/water/device/parts-list' //根据id获取可购买设备
const createDeviceOrder = '/wechat/water/device/parts-buy' //创建配件购买订单
const changeOrderState = '/wechat/water/device/pay-parts-buy' //变更滤芯订单状态
const getOrderPayList = '/wechat/water/device/parts-buy-list' //滤芯购买记录 const changeOrderState = '/wechat/water/device/pay-parts-buy' //变更滤芯订单状态
// const getUserBanlance = '/wechat/water/device/balance' //我的余额 const getOrderPayList = '/wechat/water/device/parts-buy-list' //滤芯购买记录
const getTotalBanlance = '/wechat/water/dealer/statistics-money' //我的收益
const getOrderBuyList = '/wechat/water/device/package-buy-list' //查询套餐订单列表 const getFilterChangeList = '/wechat/water/dealer/part-replace-list' //滤芯购买记录
const resetFilter = '/waters/reset-filter' //重置滤芯
const getFilterListByid = '/wechat/water/device/device-parts' //根据设备id获取滤芯列表
// const getUserBanlance = '/wechat/water/device/balance' //我的余额
const getTotalBanlance = '/wechat/water/dealer/statistics-money' //我的收益
const MasterList = '/wechat/water/dealer/master-list' //师傅列表 const getOrderBuyList = '/wechat/water/device/package-buy-list' //查询套餐订单列表
const masterDesc = '/wechat/water/dealer/one-master' //师傅详情
const createMaster = '/wechat/water/dealer/create-master' //创建傅信息
const editMaster = '/wechat/water/dealer/set-master' //创建傅信息 const getFilterListByid = '/wechat/water/device/device-parts' //根据设备id获取滤芯列表
const getPhoneByUser = '/wechat/water/dealer/phone-master' //创建师傅的时候 使用
const OrderList = '/wechat/water/dealer/repair-order-list' //维修工单列表 // const MasterList = '/wechat/water/dealer/master-list' //师傅列表
const addOrderItem = '/wechat/water/dealer/repair-order-create' //新增维修工单 const MasterList = '/master/list' //师傅列表
const repairOrderOne = '/wechat/water/dealer/repair-order-one' // 维修工单详情 const masterDesc = '/wechat/water/dealer/one-master' //师傅详情
const orderRepairAssign = '/wechat/water/dealer/order-repair-assign' // 维修工单分配师傅 const createMaster = '/wechat/water/dealer/create-master' //创建傅信息
const RecallRepair = '/wechat/water/dealer/complete-repair' // 撤回维修工单 const editMaster = '/wechat/water/dealer/set-master' //创建傅信息
const RecallNewRepair = '/wechat/water/dealer/complete-new-install' // 撤回新装工单 const getPhoneByUser = '/wechat/water/dealer/phone-master' //创建师傅的时候 使用
const deviceDesc = '/device/one' //设备详情 const OrderList = '/wechat/water/dealer/repair-order-list' //维修工单列表
const addOrderItem = '/wechat/water/dealer/repair-order-create' //新增维修工单
const newOrderList = '/wechat/water/dealer/get_list_new_install' //新装工单列表 const repairOrderOne = '/wechat/water/dealer/repair-order-one' // 维修工单详情
const userNewOrderList = '/wechat/water/get_list_new_install' //微信新装工单列表
const orderRepairAssign = '/wechat/water/dealer/order-repair-assign' // 维修工单分配师傅
const RecallRepair = '/wechat/water/dealer/complete-repair' // 撤回维修工单
const newOrderDesc = '/wechat/water/dealer/new-install-one' //新装工单详情 // const RecallNewRepair = '/wechat/water/dealer/complete-new-install' // 撤回新装工单
const creNewOrder = '/new-install/create' //创建新装工单 const RecallNewRepair = '/water/new-install-cancel' // 撤回新装工单
const newInstallAssign = '/wechat/water/dealer/new-install-assign' // 新装工单分配师傅
const packageList = '/package-buy/list' //套餐列表 const deviceDesc = '/device/one' //设备详情
const packageDesc = '/package-buy/list' //套餐详情
// const newOrderList = '/wechat/water/dealer/get_list_new_install' //新装工单列表
const BXList = '/wechat/water/device/repair-list' //报修列表 const newOrderList = '/new-install/list' //新装工单列表
const BXOneRepair = '/wechat/water/device/one-repair' // 获取维修工单详情
const BXDeviceList = '/wechat/water/device/list' // 获取用户设备列表 const userNewOrderList = '/wechat/water/new-install-list' //微信新装工单列表
const login = '/wechat/mpusers/login' // 小程序登录
const loginInfo = '/wechat/mpusers/login-info' const newOrderDesc = '/wechat/water/new-install-info' //新装工单详情
const loginGetPhone = '/wechat/mpusers/get-phone' const creNewOrder = '/new-install/create' //创建新装工单
// const newInstallAssign = '/wechat/water/dealer/new-install-assign' // 新装工单分配师傅
const newInstallAssign = '/new-install/assign' // 新装工单分配师傅
const rankingList = '/wechat/water/dealer/ranking-team' //销售排行
// const inviteList = '/wechat/water/dealer/statistics-group' //邀请排行 const packageList = '/package-buy/list' //套餐列表
const MyinviteList = '/wechat/water/dealer/statistics-group' //我的邀请统计 const packageDesc = '/package-buy/list' //套餐详情
const buyProductList = '/wechat/water/dealer/buy_product_list' //进货记录
const BXList = '/wechat/water/device/repair-list' //报修列表
const BXOneRepair = '/wechat/water/device/one-repair' // 获取维修工单详情
const getPartner = '/wechat/water/dealer/info' //合伙人详情
const getPartnerOrder = '/wechat/water/dealer/order-statistics' //合伙人订单 const BXDeviceList = '/wechat/water/device/list' // 获取用户设备列表
const getProduct = '/wechat/water/dealer/product-list' //合伙人所有的产品列表
const createPartnerOrder = '/wechat/water/dealer/buy_product_create' //创建合伙人订单 const login = '/wechat/mpusers/login' // 小程序登录
const deviceList = '/wechat/water/dealer/device-list' // 设备列表 const loginInfo = '/wechat/mpusers/login-info'
const deviceInfo = '/wechat/water/device/one-device' //设备详情 const loginGetPhone = '/wechat/mpusers/get-phone'
const createQrcode = '/wechat/water/device/qr-code' //获取小程序码
const rankingList = '/wechat/water/dealer/ranking-team' //销售排行
// const inviteList = '/wechat/water/dealer/statistics-group' //邀请排行
const getVersion = '/wechat/audit/app_versions' //获取版本信息 const MyinviteList = '/wechat/water/dealer/statistics-group' //我的邀请统计
const accountLogin = '/wechat/audit/app_login' //审核登录 const buyProductList = '/wechat/water/dealer/buy_product_list' //进货记录
const getPartner = '/wechat/water/dealer/info' //合伙人详情
//师傅端 const getPartnerOrder = '/wechat/water/dealer/order-statistics' //合伙人订单
const getNewOrder = '/wechat/water/master/get_list_new_install' //获取新装工单 const getProduct = '/wechat/water/dealer/product-list' //合伙人所有的产品列表
const gerRepairOrder = '/wechat/water/master/repair-order-list' //获取维修工单 const createPartnerOrder = '/wechat/water/dealer/buy_product_create' //创建合伙人订单
const getPartOrder = '/wechat/water/master/part-replace-list' //获取耗材工单 const deviceList = '/wechat/water/dealer/device-list' // 设备列表
const deviceInfo = '/wechat/water/device/one-device' //设备详情
const NewOrderDesc = '/wechat/water/master/new-install-one' //师傅新装工单详情
const RepairOrderDesc = '/wechat/water/master/repair-order-one' //师傅更换工单详情 const createQrcode = '/wechat/water/device/qr-code' //获取小程序码
const PartOrderDesc = '/wechat/water/master/part-replace-one' // 师傅耗材更换详情
const completeNewOrder = '/wechat/water/dealer/complete-new-install' //完成新装工单 const getVersion = '/wechat/audit/app_versions' //获取版本信息
const completeRepairOrder = '/wechat/water/master/complete-repair' //完成维修工单 const accountLogin = '/wechat/audit/app_login' //审核登录
const completePartOrder = '/wechat/water/master/complete-part-replace' //完成耗材更换工单 const updateVersion = '/api/v1/audit/config-update'
const getDeviceByCode = '/wechat/water/dealer/device-code' //根据编码获取设备信息
const masterInfo = '/wechat/water/master/master-info' //师傅信息 //师傅端
const editMasterInfo = '/wechat/water/master/set-master-info' //修改师傅信息 const getNewOrder = '/wechat/water/master/get_list_new_install' //获取新装工单
const gerRepairOrder = '/wechat/water/master/repair-order-list' //获取维修工单
const getDeposit = '/wechat/water/deposit_pay' //获取押金信息 const getPartOrder = '/wechat/water/master/part-replace-list' //获取耗材工单
const city = '/citys/s/list' // 获取省份列表'
const area = '/citys/c/list' // 获取市列表' const NewOrderDesc = '/wechat/water/master/new-install-one' //师傅新装工单详情
const business = '/citys/x/list' // 获取区列表' const RepairOrderDesc = '/wechat/water/master/repair-order-one' //师傅更换工单详情
const createPosit = '/wechat/water/create_posit_info' //创建押金缴纳 const PartOrderDesc = '/wechat/water/master/part-replace-one' // 师傅耗材更换详情
const apiArr = { const getUninstallOrder = '/wechat/water/master/uninstall/list' //拆卸工单
createPosit, const getUninstallDesc = '/wechat/water/master/uninstall/info' //拆除工单详情
city, const unintsall = '/wechat/water/master/uninstall/complete' //拆机
area, const operate = '/wechat/water/master/uninstall/operate' //入库 报废
business,
getDeposit,
MasterList, const completeNewOrder = '/wechat/water/dealer/complete-new-install' //完成新装工单
masterDesc, const cancelNewOrder = '/wechat/water/new-install-cancel' //取消新装工单
editMaster,
getPhoneByUser, const completeRepairOrder = '/wechat/water/master/complete-repair' //完成维修工单
OrderList, const completePartOrder = '/wechat/water/master/complete-part-replace' //完成耗材更换工单
addOrderItem,
repairOrderOne, const getDeviceByCode = '/wechat/water/dealer/device-code' //根据编码获取设备信息
getUserList,
deviceDesc, const masterInfo = '/wechat/water/master/master-info' //师傅信息
RecallRepair, const editMasterInfo = '/wechat/water/master/set-master-info' //修改师傅信息
RecallNewRepair,
newOrderList, const masterDeviceList = '/wechat/water/master/device/list' //师傅安装的设备列表
userNewOrderList, const masterDeviceInfo = '/wechat/water/master/device/info' //设备详情
newOrderDesc, const createUninstallOrder = '/wechat/water/master/uninstall/create' //创建拆除工单
packageList,
packageDesc,
login, const getDeposit = '/wechat/water/deposit_pay' //获取押金信息
loginInfo, const getDepositList = '/wechat/water/deposit_list' //获取押金信息
loginGetPhone, const city = '/citys/s/list' // 获取省份列表'
BXList, const area = '/citys/c/list' // 获取市列表'
BXOneRepair, const business = '/citys/x/list' // 获取区列表'
BXDeviceList, const createPosit = '/wechat/water/create_posit_info' //创建押金缴纳
creNewOrder,
createMaster, const openOff = '/waters/board-on-off' //开机关机
changeDef,
repair, const boardInfo = '/waters/board-info-query' //主板信息
getpackageList,
createPackageOrder, const cancelActivation = '/waters/cancel-activation' //主板取消
getCurrentShopMsg,
getFilterListByid, const scanOrder = '/wechat/trans-order/confirm' //查询是否有转账
getdeviceListByid, const queryOrder = '/wechat/trans-order/success' //确认是否转账
newInstallAssign,
orderRepairAssign, const BeActive = '/wechat/water/dealer/active-device' //激活设备
createDeviceOrder, const apiArr = {
changeOrderState, cancelActivation,
getOrderPayList, queryOrder,
// getUserBanlance, createUninstallOrder,
getTotalBanlance, scanOrder,
getOrderBuyList, BeActive,
rankingList, boardInfo,
// inviteList, createPosit,
MyinviteList, openOff,
buyProductList, getUninstallOrder,
getPartner, getUninstallDesc,
getPartnerOrder, unintsall,
getProduct, city,
deviceList, area,
createPartnerOrder, business,
deviceInfo, getDeposit,
createQrcode, getDepositList,
getVersion, MasterList,
accountLogin, masterDesc,
getNewOrder, editMaster,
gerRepairOrder, getPhoneByUser,
getPartOrder, OrderList,
NewOrderDesc, addOrderItem,
RepairOrderDesc, repairOrderOne,
PartOrderDesc, getUserList,
completeNewOrder, deviceDesc,
completeRepairOrder, RecallRepair,
completePartOrder, RecallNewRepair,
masterInfo, newOrderList,
editMasterInfo, userNewOrderList,
getDeviceByCode newOrderDesc,
} packageList,
packageDesc,
login,
loginInfo,
loginGetPhone,
BXList,
BXOneRepair,
BXDeviceList,
creNewOrder,
createMaster,
changeDef,
repair,
getpackageList,
createPackageOrder,
getCurrentShopMsg,
getFilterListByid,
getdeviceListByid,
newInstallAssign,
orderRepairAssign,
createDeviceOrder,
changeOrderState,
getOrderPayList,
getFilterChangeList,
resetFilter,
// getUserBanlance,
getTotalBanlance,
getOrderBuyList,
rankingList,
// inviteList,
MyinviteList,
buyProductList,
getPartner,
getPartnerOrder,
getProduct,
deviceList,
createPartnerOrder,
deviceInfo,
createQrcode,
getVersion,
accountLogin,
updateVersion,
getNewOrder,
gerRepairOrder,
getPartOrder,
NewOrderDesc,
RepairOrderDesc,
PartOrderDesc,
completeNewOrder,
cancelNewOrder,
completeRepairOrder,
completePartOrder,
operate,
masterInfo,
editMasterInfo,
masterDeviceList,
masterDeviceInfo,
getDeviceByCode
}
module.exports = apiArr; module.exports = apiArr;

636
app.js
View File

@ -1,319 +1,319 @@
import apiArr from './api/water_filter'; import apiArr from './api/water_filter';
import util from './utils/util'; import util from './utils/util';
import apiAddr from '/api/base'; import apiAddr from '/api/base';
App({ App({
globalData: { globalData: {
isIpx: false, isIpx: false,
userInfo: null, userInfo: null,
id: '', id: '',
navHeight: 0, navHeight: 0,
navTop: 0, navTop: 0,
windowHeight: 0, windowHeight: 0,
isShow: false, isShow: false,
isShare: false, // 用于判断是否来源于分享 isShare: false, // 用于判断是否来源于分享
nav_list:[], nav_list:[],
foot_width:'20%', foot_width:'20%',
}, },
getFootNav() { getFootNav() {
console.log(789789); console.log(789789);
let that = this; let that = this;
// util.postUrl(apiArr.footer,{},res=>{ // util.postUrl(apiArr.footer,{},res=>{
// that.globalData.nav_list = res; // that.globalData.nav_list = res;
// that.globalData.foot_width = (100 / res.length).toFixed(2) + '%'; // that.globalData.foot_width = (100 / res.length).toFixed(2) + '%';
// }) // })
wx.request({ wx.request({
url: apiArr.footer, url: apiArr.footer,
data: {}, data: {},
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
}, },
success: f => { success: f => {
console.log('successddd'); console.log('successddd');
if (f.data.code == "-101" || f.data.code == "-102") { if (f.data.code == "-101" || f.data.code == "-102") {
successfn(f.data); successfn(f.data);
} else if (f.data.code == "-103") { } else if (f.data.code == "-103") {
successfn(f.data); successfn(f.data);
} else { } else {
successfn(f.data); successfn(f.data);
} }
}, },
error: f => { error: f => {
console.log('error'); console.log('error');
wx.showToast({ wx.showToast({
title: '系统繁忙', title: '系统繁忙',
icon: 'none' icon: 'none'
}) })
} }
}) })
}, },
onLaunch(options) { onLaunch(options) {
let that = this; let that = this;
that.getFootNav() that.getFootNav()
if (options.scene) { if (options.scene) {
const scene = decodeURIComponent(options.scene); // 解码 scene const scene = decodeURIComponent(options.scene); // 解码 scene
console.log('scene:', scene); console.log('scene:', scene);
} }
if (options.query.scene) { if (options.query.scene) {
let scene = decodeURIComponent(options.query.scene); let scene = decodeURIComponent(options.query.scene);
that.d.scene = scene; that.d.scene = scene;
} }
this.globalData.sysinfo = wx.getSystemInfoSync() this.globalData.sysinfo = wx.getSystemInfoSync()
//获取系统信息 //获取系统信息
wx.getSystemInfo({ wx.getSystemInfo({
success: res => { success: res => {
that.system = res that.system = res
} }
}) })
//获取胶囊信息 //获取胶囊信息
that.menu = wx.getMenuButtonBoundingClientRect(); that.menu = wx.getMenuButtonBoundingClientRect();
// console.log(that.menu) // console.log(that.menu)
// 判断是否为 iPhone X // 判断是否为 iPhone X
wx.getSystemInfo({ wx.getSystemInfo({
success: function (res) { success: function (res) {
// X 及以上的异形屏top为44非异形屏为20 // X 及以上的异形屏top为44非异形屏为20
if (res.safeArea.top > 20) { if (res.safeArea.top > 20) {
that.globalData.isIpx = true that.globalData.isIpx = true
} }
} }
}) })
let menuButtonObject = wx.getMenuButtonBoundingClientRect(); let menuButtonObject = wx.getMenuButtonBoundingClientRect();
wx.getSystemInfo({ wx.getSystemInfo({
success: res => { success: res => {
let statusBarHeight = res.statusBarHeight, let statusBarHeight = res.statusBarHeight,
navTop = menuButtonObject.top, //胶囊按钮与顶部的距离 navTop = menuButtonObject.top, //胶囊按钮与顶部的距离
navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2; //导航高度 navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2; //导航高度
this.globalData.navHeight = navHeight; this.globalData.navHeight = navHeight;
this.globalData.navTop = navTop; this.globalData.navTop = navTop;
this.globalData.windowHeight = res.windowHeight; this.globalData.windowHeight = res.windowHeight;
}, },
fail(err) { fail(err) {
console.log(err); console.log(err);
} }
}) })
this.autoUpdate() this.autoUpdate()
}, },
onShow(options) { onShow(options) {
const updateManager = wx.getUpdateManager(); const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) { if (res.hasUpdate) {
// updateManager.onUpdateReady(function () { // updateManager.onUpdateReady(function () {
// wx.showModal({ // wx.showModal({
// title: '温馨提示', // title: '温馨提示',
// content: '系统检测到有新版本并已准备好更新,是否重启应用?', // content: '系统检测到有新版本并已准备好更新,是否重启应用?',
// success: () => { // success: () => {
// if (res.confirm) updateManager.applyUpdate(); // if (res.confirm) updateManager.applyUpdate();
// } // }
// }) // })
// }) // })
// updateManager.onUpdateFailed(function () { // updateManager.onUpdateFailed(function () {
// wx.showModal({ // wx.showModal({
// title: '温馨提示', // title: '温馨提示',
// content: '系统检测到有新版本,请删除当前小程序,重新搜索打开' // content: '系统检测到有新版本,请删除当前小程序,重新搜索打开'
// }) // })
// }) // })
} }
}); });
if (options.scene == 1007) { if (options.scene == 1007) {
// 通过单人聊天会话分享进入 // 通过单人聊天会话分享进入
this.globalData.isShare = true; this.globalData.isShare = true;
} }
if (options.scene == 1008) { if (options.scene == 1008) {
// 通过群聊会话分享进入 // 通过群聊会话分享进入
this.globalData.isShare = true; this.globalData.isShare = true;
} }
}, },
/** 5d444af49568c61c47aa7b84dfe7c575 /** 5d444af49568c61c47aa7b84dfe7c575
* @description 获取本地用户数据 * @description 获取本地用户数据
* @method getLocalUserInfo * @method getLocalUserInfo
* @returns {Object} // 返回用户数据 * @returns {Object} // 返回用户数据
*/ */
getLocalUserInfo(){ getLocalUserInfo(){
let userInfo = wx.getStorageSync('userInfo'); let userInfo = wx.getStorageSync('userInfo');
return !userInfo ? {} : JSON.parse(userInfo); return !userInfo ? {} : JSON.parse(userInfo);
}, },
getSessionKey() { getSessionKey() {
let userSessionKey = wx.getStorageSync('session_key'); let userSessionKey = wx.getStorageSync('session_key');
return userSessionKey || ''; return userSessionKey || '';
}, },
/** /**
* @description 验证用户是否点击授权 * @description 验证用户是否点击授权
* @method hasUserAuth * @method hasUserAuth
* @param {String} errMsg // 提示信息 * @param {String} errMsg // 提示信息
* @returns {Boolean} // 返回 Boolean * @returns {Boolean} // 返回 Boolean
*/ */
hasUserAuth(errMsg){ hasUserAuth(errMsg){
let [ msg_1, msg_2 ] = errMsg.split(':'); let [ msg_1, msg_2 ] = errMsg.split(':');
return msg_2 === 'ok'; return msg_2 === 'ok';
}, },
initCustomNavbar(){ initCustomNavbar(){
let { top, height, left } = wx.getMenuButtonBoundingClientRect(); let { top, height, left } = wx.getMenuButtonBoundingClientRect();
let { statusBarHeight, screenWidth } = wx.getSystemInfoSync(); let { statusBarHeight, screenWidth } = wx.getSystemInfoSync();
let navBarHeight = (top - statusBarHeight) * 2 + height + statusBarHeight; let navBarHeight = (top - statusBarHeight) * 2 + height + statusBarHeight;
let navBarDetail = { let navBarDetail = {
top: statusBarHeight, top: statusBarHeight,
right: screenWidth - left, right: screenWidth - left,
height: navBarHeight, height: navBarHeight,
}; };
return navBarDetail; return navBarDetail;
}, },
changeHeaderColor(){ changeHeaderColor(){
wx.request({ wx.request({
url: apiAddr.get_site_color, url: apiAddr.get_site_color,
method: 'post', method: 'post',
header: { header: {
'Content-type': 'application/x-www-form-urlencoded' 'Content-type': 'application/x-www-form-urlencoded'
}, },
dataType:'json', dataType:'json',
success: (result) => { success: (result) => {
var color = result.data.mobile_color ? result.data.mobile_color : '#ffffff'; var color = result.data.mobile_color ? result.data.mobile_color : '#ffffff';
var font_color = result.data.font_color ? result.data.font_color : '#000000'; var font_color = result.data.font_color ? result.data.font_color : '#000000';
wx.setStorageSync('mobile_color',color); wx.setStorageSync('mobile_color',color);
wx.setNavigationBarColor({ wx.setNavigationBarColor({
frontColor: font_color, frontColor: font_color,
backgroundColor: color, backgroundColor: color,
animation: { animation: {
duration: 0, duration: 0,
timingFunc: 'linear' timingFunc: 'linear'
} }
}) })
}, },
}) })
}, },
goH5Link(event){ goH5Link(event){
let url=event.currentTarget.dataset.url; let url=event.currentTarget.dataset.url;
console.log(url); console.log(url);
wx.navigateTo({ wx.navigateTo({
url: `/pages/index/index?q=${url}`, url: `/pages/index/index?q=${url}`,
}) })
}, },
goPagesLink(event){ goPagesLink(event){
let url= event.currentTarget.dataset.url; let url= event.currentTarget.dataset.url;
let tab1 = 'pages/index/community'; let tab1 = 'pages/index/community';
let tab2 = 'pages/booking/orderlist'; let tab2 = 'pages/booking/orderlist';
let tab3 = '/user/index'; let tab3 = '/user/index';
if(url.indexOf(tab1) !== -1 || url.indexOf(tab2) !== -1 || url.indexOf(tab3) !== -1){ if(url.indexOf(tab1) !== -1 || url.indexOf(tab2) !== -1 || url.indexOf(tab3) !== -1){
wx.redirectTo({ wx.redirectTo({
url: url, url: url,
}); });
}else{ }else{
wx.navigateTo({ wx.navigateTo({
url: url, url: url,
}) })
} }
}, },
goMiniprogram(event){ goMiniprogram(event){
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: event.currentTarget.dataset.appid appId: event.currentTarget.dataset.appid
}) })
}, },
makeCall(event){ makeCall(event){
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: event.currentTarget.dataset.tel phoneNumber: event.currentTarget.dataset.tel
}) })
}, },
return:function(){ return:function(){
//返回到上一个页面 //返回到上一个页面
console.log('返回'); console.log('返回');
wx.navigateBack() wx.navigateBack()
/* /*
var pages = getCurrentPages();//获取页面数据 var pages = getCurrentPages();//获取页面数据
var prevPage = pages[pages.length - 2]; //上一个页面 var prevPage = pages[pages.length - 2]; //上一个页面
prevPage.onLoad();//对上一个页面进行刷新执行上一个页面的onLoad方法 prevPage.onLoad();//对上一个页面进行刷新执行上一个页面的onLoad方法
prevPage.setData({ //调用上一个页面的setData方法 prevPage.setData({ //调用上一个页面的setData方法
iconStatu: false //给A页面设置一个变量iconStatu值为false iconStatu: false //给A页面设置一个变量iconStatu值为false
}); });
*/ */
}, },
globalData: { globalData: {
appid: 'wx1addb25675dd8e70' appid: 'wx1addb25675dd8e70'
}, },
pluginHxj(){ pluginHxj(){
// var createPlugin = requirePlugin("hxjlock"); // var createPlugin = requirePlugin("hxjlock");
// var Plugin = createPlugin() // var Plugin = createPlugin()
return null; return null;
}, },
pluginTts(){ pluginTts(){
return requirePlugin("ttslock"); return requirePlugin("ttslock");
}, },
initQQMapKey(){ initQQMapKey(){
return ''; return '';
}, },
autoUpdate:function(){ autoUpdate:function(){
var self=this var self=this
let startParamObj = wx.getLaunchOptionsSync(); let startParamObj = wx.getLaunchOptionsSync();
// 获取小程序更新机制兼容 // 获取小程序更新机制兼容
if (wx.canIUse('getUpdateManager')&& startParamObj.scene!=1154) { if (wx.canIUse('getUpdateManager')&& startParamObj.scene!=1154) {
const updateManager = wx.getUpdateManager() const updateManager = wx.getUpdateManager()
//1. 检查小程序是否有新版本发布 //1. 检查小程序是否有新版本发布
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调 // 请求完新版本信息的回调
if (res.hasUpdate) { if (res.hasUpdate) {
//2. 小程序有新版本,则静默下载新版本,做好更新准备 //2. 小程序有新版本,则静默下载新版本,做好更新准备
updateManager.onUpdateReady(function () { updateManager.onUpdateReady(function () {
console.log(new Date()) console.log(new Date())
wx.showModal({ wx.showModal({
title: '更新提示', title: '更新提示',
content: '新版本已经准备好,是否重启应用?', content: '新版本已经准备好,是否重启应用?',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
//3. 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 //3. 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate() updateManager.applyUpdate()
} else if (res.cancel) { } else if (res.cancel) {
//如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了 //如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了
wx.showModal({ wx.showModal({
title: '温馨提示~', title: '温馨提示~',
content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~', content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~',
success: function (res) { success: function (res) {
self.autoUpdate() self.autoUpdate()
return; return;
//第二次提示后,强制更新 //第二次提示后,强制更新
if (res.confirm) { if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate() updateManager.applyUpdate()
} else if (res.cancel) { } else if (res.cancel) {
//重新回到版本更新提示 //重新回到版本更新提示
self.autoUpdate() self.autoUpdate()
} }
} }
}) })
} }
} }
}) })
}) })
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
// 新的版本下载失败 // 新的版本下载失败
wx.showModal({ wx.showModal({
title: '已经有新版本了哟~', title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~', content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
}) })
}) })
} }
}) })
} else { } else {
if(startParamObj.scene==1154){ if(startParamObj.scene==1154){
}else{ }else{
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
}) })
} }
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
/* wx.showModal({ /* wx.showModal({
title: '提示', title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})*/ })*/
} }
} }
}) })

296
app.json
View File

@ -1,142 +1,156 @@
{ {
"pages": [ "pages": [
"pages/water_filter/water_filter", "pages/chooseEntrance/chooseEntrance",
"pages/index/newIndex/newIndex", "pages/water_filter/water_filter",
"pages/index/shopcity", "pages/info/info",
"pages/community/detail", "pages/Agreement/Agreement",
"pages/map/map", "pages/share/share",
"pages/login/login", "pages/community/detail",
"pages/phoneGo/phoneGo", "pages/map/map",
"pages/chooseCommunity/chooseCommunity", "pages/login/login",
"pages/device/device", "pages/MasterLogin/MasterLogin",
"pages/deposit/deposit", "pages/phoneGo/phoneGo",
"pages/newOrderList/newOrderList" "pages/chooseCommunity/chooseCommunity",
], "pages/device/device",
"subPackages": [ "pages/deposit/deposit",
{ "pages/newOrderList/newOrderList",
"root": "packages/WaterPurifier", "pages/newOrderListDesc/index",
"independent": false, "pages/RechargeRecord/RechargeRecord",
"pages": [ "pages/filterChange/filterChange",
"pages/water_filter/water_filter", "pages/SubscribeMessage/SubscribeMessage"
"pages/repair/repair", ],
"pages/RechargeRecord/RechargeRecord", "subPackages": [
"pages/Recharge/Recharge", {
"pages/payList/payList", "root": "packages/WaterPurifier",
"pages/orderDesc/orderDesc", "independent": false,
"pages/MaintenanceInfo/MaintenanceInfo", "pages": [
"pages/Maintenance/Maintenance", "pages/water_filter/water_filter",
"pages/filter/filter", "pages/repair/repair",
"pages/Buyfilter/Buyfilter", "pages/RechargeRecord/RechargeRecord",
"pages/device/deviceList/deviceList", "pages/Recharge/Recharge",
"pages/device/deviceDesc/deviceDesc", "pages/payList/payList",
"pages/device/myDevice/myDevice", "pages/orderDesc/orderDesc",
"pages/device/inventory/inventory", "pages/MaintenanceInfo/MaintenanceInfo",
"pages/upKeep/upKeep", "pages/Maintenance/Maintenance",
"pages/newUpKeep/newUpKeep", "pages/filter/filter",
"pages/shareDerive/shareDerive", "pages/Buyfilter/Buyfilter",
"pages/shareWaterFilter/shareWaterFilter", "pages/device/deviceList/deviceList",
"pages/test/test", "pages/device/deviceDesc/deviceDesc",
"pages/Addfriend/Addfriend", "pages/device/myDevice/myDevice",
"pages/water_change/water_change" "pages/device/inventory/inventory",
] "pages/upKeep/upKeep",
}, "pages/newUpKeep/newUpKeep",
{ "pages/shareDerive/shareDerive",
"root": "packages/user", "pages/shareWaterFilter/shareWaterFilter",
"pages": [ "pages/test/test",
"points/detail", "pages/Addfriend/Addfriend",
"share/index", "pages/water_change/water_change",
"marketing/index", "pages/filterChangeList/filterChangeList"
"userAvatars/index", ]
"resetPwd/index", },
"userInfo/index", {
"transactionRecord/index", "root": "packages/user",
"transactionDetail/index", "pages": [
"goPay/index", "points/detail",
"addressAdministration/index", "share/index",
"addAress/index", "marketing/index",
"uploadAvatar/index", "userAvatars/index",
"coupon/index", "resetPwd/index",
"points/desc", "userInfo/index",
"community/list", "transactionRecord/index",
"points/sign" "transactionDetail/index",
] "goPay/index",
}, "addressAdministration/index",
{ "addAress/index",
"root": "packages/master", "uploadAvatar/index",
"pages":[ "coupon/index",
"order/index", "points/desc",
"orderDesc/index", "community/list",
"PersonCen/index" "points/sign"
] ]
}, },
{ {
"root": "packages/partner", "root": "packages/master",
"pages": [ "pages":[
"pages/partner", "order/index",
"pages/purchaseGoods/purchaseGoods", "orderDesc/index",
"pages/WorkOrder/WorkOrder", "PersonCen/index",
"pages/newWorkOrder/newWorkOrder", "masterInfo/index",
"pages/orderDesc/orderDesc", "device/index",
"pages/team/team", "deviceInfo/index"
"pages/invite/invite", ]
"pages/ranking/ranking", },
"pages/master/master", {
"pages/masterDesc/masterDesc", "root": "packages/partner",
"pages/creatMaster/creatMaster", "pages": [
"pages/desk/desk", "pages/login/login",
"pages/income/income", "pages/partner",
"pages/incomeDesc/incomeDesc", "pages/purchaseGoods/purchaseGoods",
"pages/incomeDetail/incomeDetail" "pages/WorkOrder/WorkOrder",
] "pages/newWorkOrder/newWorkOrder",
} "pages/removeOrder/removeOrder",
], "pages/removeOrderInfo/removeOrderInfo",
"requiredPrivateInfos": [ "pages/partsOrder/partsOrder",
"getLocation", "pages/partsOrderInfo/partsOrderInfo",
"chooseAddress", "pages/orderDesc/orderDesc",
"chooseLocation" "pages/team/team",
], "pages/invite/invite",
"window": { "pages/ranking/ranking",
"backgroundTextStyle": "light", "pages/master/master",
"navigationBarBackgroundColor": "#ffffff", "pages/masterDesc/masterDesc",
"navigationBarTitleText": "衡水喜屏智慧社区", "pages/creatMaster/creatMaster",
"navigationBarTextStyle": "black" "pages/desk/desk",
}, "pages/income/income",
"lazyCodeLoading": "requiredComponents", "pages/incomeDesc/incomeDesc",
"permission": { "pages/incomeDetail/incomeDetail",
"scope.userLocation": { "pages/addNewOrder/addNewOrder"
"desc": "正在授权您获取当前位置信息" ]
} }
}, ],
"plugins": {}, "requiredPrivateInfos": [
"usingComponents": { ],
"van-grid": "/miniprogram_npm/vant-weapp/grid/index", "window": {
"van-grid-item": "/miniprogram_npm/vant-weapp/grid-item/index", "backgroundTextStyle": "light",
"van-divider": "/miniprogram_npm/vant-weapp/divider/index", "navigationBarBackgroundColor": "#ffffff",
"van-row": "/miniprogram_npm/vant-weapp/row/index", "navigationBarTitleText": "人人爱净水",
"van-col": "/miniprogram_npm/vant-weapp/col/index", "navigationBarTextStyle": "black"
"van-progress": "/miniprogram_npm/vant-weapp/progress/index", },
"van-icon": "/miniprogram_npm/vant-weapp/icon/index", "lazyCodeLoading": "requiredComponents",
"van-tab": "/miniprogram_npm/vant-weapp/tab/index", "permission": {
"van-tabs": "/miniprogram_npm/vant-weapp/tabs/index", "scope.userLocation": {
"van-field": "/miniprogram_npm/vant-weapp/field/index", "desc": "正在授权您获取当前位置信息"
"van-uploader": "/miniprogram_npm/vant-weapp/uploader/index", }
"van-datetime-picker": "/miniprogram_npm/vant-weapp/datetime-picker/index", },
"van-popup": "/miniprogram_npm/vant-weapp/popup/index", "plugins": {},
"van-circle": "/miniprogram_npm/vant-weapp/circle/index", "usingComponents": {
"van-checkbox": "/miniprogram_npm/vant-weapp/checkbox", "van-grid": "/miniprogram_npm/vant-weapp/grid/index",
"van-checkbox-group": "/miniprogram_npm/vant-weapp/checkbox-group", "van-grid-item": "/miniprogram_npm/vant-weapp/grid-item/index",
"van-area": "/miniprogram_npm/vant-weapp/area/index", "van-divider": "/miniprogram_npm/vant-weapp/divider/index",
"van-dropdown-menu": "/miniprogram_npm/vant-weapp/dropdown-menu", "van-row": "/miniprogram_npm/vant-weapp/row/index",
"van-dropdown-item": "/miniprogram_npm/vant-weapp/dropdown-item", "van-col": "/miniprogram_npm/vant-weapp/col/index",
"van-notice-bar": "/miniprogram_npm/vant-weapp/notice-bar", "van-progress": "/miniprogram_npm/vant-weapp/progress/index",
"van-empty": "/miniprogram_npm/vant-weapp/empty", "van-icon": "/miniprogram_npm/vant-weapp/icon/index",
"van-picker": "/miniprogram_npm/vant-weapp/picker", "van-tab": "/miniprogram_npm/vant-weapp/tab/index",
"van-radio": "/miniprogram_npm/vant-weapp/radio", "van-tabs": "/miniprogram_npm/vant-weapp/tabs/index",
"van-radio-group": "/miniprogram_npm/vant-weapp/radio-group", "van-field": "/miniprogram_npm/vant-weapp/field/index",
"van-stepper": "/miniprogram_npm/vant-weapp/stepper/index" "van-uploader": "/miniprogram_npm/vant-weapp/uploader/index",
}, "van-datetime-picker": "/miniprogram_npm/vant-weapp/datetime-picker/index",
"sitemapLocation": "sitemap.json", "van-popup": "/miniprogram_npm/vant-weapp/popup/index",
"resolveAlias": { "van-circle": "/miniprogram_npm/vant-weapp/circle/index",
"~/*": "/*" "van-checkbox": "/miniprogram_npm/vant-weapp/checkbox",
} "van-checkbox-group": "/miniprogram_npm/vant-weapp/checkbox-group",
"van-area": "/miniprogram_npm/vant-weapp/area/index",
"van-dropdown-menu": "/miniprogram_npm/vant-weapp/dropdown-menu",
"van-dropdown-item": "/miniprogram_npm/vant-weapp/dropdown-item",
"van-notice-bar": "/miniprogram_npm/vant-weapp/notice-bar",
"van-empty": "/miniprogram_npm/vant-weapp/empty",
"van-picker": "/miniprogram_npm/vant-weapp/picker",
"van-radio": "/miniprogram_npm/vant-weapp/radio",
"van-radio-group": "/miniprogram_npm/vant-weapp/radio-group",
"van-stepper": "/miniprogram_npm/vant-weapp/stepper/index"
},
"sitemapLocation": "sitemap.json",
"resolveAlias": {
"~/*": "/*"
}
} }

View File

@ -1,5 +1,5 @@
{ {
"adapteByMiniprogram": { "adapteByMiniprogram": {
"userName": "gh_f54e89bc7e54" "userName": "gh_f54e89bc7e54"
} }
} }

273
app.wxss
View File

@ -1,134 +1,139 @@
page,view,text,input,image{ page,view,text,input,image{
padding: 0; padding: 0;
margin: 0; margin: 0;
box-sizing: border-box; box-sizing: border-box;
} }
page{ page{
font-size: 28rpx; font-size: 28rpx;
padding-bottom: 120rpx; padding-bottom: 120rpx;
} }
.van-dropdown-menu__title--active {
image{ color: #2583ff !important;
display: block; }
} .van-dropdown-item__option--active .van-dropdown-item__icon, .van-dropdown-item__option--active .van-dropdown-item__title {
.container-show-footer{ color: #2583ff !important;
padding-bottom: 76px; }
} image{
.noDataImg{ display: block;
background:unset; }
margin: auto; .container-show-footer{
height: auto; padding-bottom: 76px;
display: block; }
overflow: hidden; .noDataImg{
} background:unset;
.noDataImg image{ margin: auto;
background: unset; height: auto;
width: 70%; display: block;
margin: 20px 15%; overflow: hidden;
position: relative; }
} .noDataImg image{
.noDataTips{ background: unset;
width: 100%; width: 70%;
text-align: center; margin: 20px 15%;
display: block; position: relative;
margin-bottom: 50px; }
} .noDataTips{
width: 100%;
.foot-fixed { text-align: center;
position: fixed; display: block;
bottom: -1px; margin-bottom: 50px;
left: 0; }
right: 0;
z-index: 999; .foot-fixed {
width: 100%; position: fixed;
background: #ffffff; bottom: -1px;
border-top: 1px solid #E8E8E8; left: 0;
box-shadow: 0 0 3px rgba(0,0,0,0.1); right: 0;
} z-index: 999;
.foot-fixed .foot-item { width: 100%;
padding: 0; background: #ffffff;
} border-top: 1px solid #E8E8E8;
.foot-fixed .foot-item { box-shadow: 0 0 3px rgba(0,0,0,0.1);
position: relative; }
} .foot-fixed .foot-item {
.foot-fixed .foot-item { padding: 0;
width: 20%; }
float: left; .foot-fixed .foot-item {
text-align: center; position: relative;
color: #777; }
padding: 5px 0 10px; .foot-fixed .foot-item {
} width: 20%;
a { float: left;
color: #666; text-align: center;
text-decoration: none; color: #777;
} padding: 5px 0 10px;
a { }
background: transparent; a {
} color: #666;
.foot-fixed .foot-item .foot-icon { text-decoration: none;
width: 24px; }
height: 26px; a {
margin: 0 auto; background: transparent;
} }
.foot-fixed .foot-item .foot-label { .foot-fixed .foot-item .foot-icon {
margin: 5px 0; width: 24px;
} height: 26px;
.foot-fixed .foot-item .foot-label { margin: 0 auto;
height: 15px; }
line-height: 15px; .foot-fixed .foot-item .foot-label {
font-size: 12px; margin: 5px 0;
} }
.foot-fixed .foot-item span { .foot-fixed .foot-item .foot-label {
display: block; height: 15px;
width: 100%; line-height: 15px;
text-align: center; font-size: 12px;
} }
.foot-fixed .foot-item span {
display: block;
width: 100%;
/* 自定义导航栏 */ text-align: center;
.nav-box { }
box-sizing: border-box;
width: 100%;
/* position: relative; */
/* position: fixed; */ /* 自定义导航栏 */
z-index: 2; .nav-box {
} box-sizing: border-box;
width: 100%;
.nav-box .nav-bar { /* position: relative; */
display: flex; /* position: fixed; */
align-items: center; z-index: 2;
} }
.nav-box .nav-bar .nav-bar-left, .nav-box .nav-bar {
.nav-box .nav-bar .nav-bar-right { display: flex;
padding: 0 20rpx; align-items: center;
min-width: 36rpx; }
}
.nav-box .nav-bar .nav-bar-left,
.nav-box .nav-bar .nav-bar-left van-icon { .nav-box .nav-bar .nav-bar-right {
vertical-align: sub; padding: 0 20rpx;
color: #333333; min-width: 36rpx;
} }
.nav-box .nav-bar .nav-bar-title { .nav-box .nav-bar .nav-bar-left van-icon {
flex: 1; vertical-align: sub;
text-align: center; color: #333333;
font-size: 32rpx; }
letter-spacing: 2rpx;
color: #333333; .nav-box .nav-bar .nav-bar-title {
} flex: 1;
text-align: center;
.nav-box .nav-bar-title { font-size: 32rpx;
color: red; letter-spacing: 2rpx;
} color: #333333;
}
.gray{
height: 20rpx; .nav-box .nav-bar-title {
background: #F9F9F9; color: red;
} }
image{ .gray{
width: 100%; height: 20rpx;
height: 100%; background: #F9F9F9;
} }
image{
width: 100%;
height: 100%;
}

View File

@ -1,84 +1,84 @@
const app = getApp() const app = getApp()
// component/Nav/index.js // component/Nav/index.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
Text:{ Text:{
type:String, type:String,
value:"衡水喜屏智慧社区" value:"衡水喜屏智慧社区"
}, },
NavPosition:{ NavPosition:{
type:String, type:String,
value:'fixed' value:'fixed'
}, },
backColor:{ backColor:{
type:String, type:String,
value:"#000" value:"#000"
}, },
backSize:{ backSize:{
type:String, type:String,
value:"36rpx" value:"36rpx"
}, },
backImg:{ backImg:{
type:String, type:String,
value:"arrow-left" value:"arrow-left"
}, },
pageUrl:{ pageUrl:{
type:String, type:String,
value:"" value:""
}, },
//返回上一页的类型 0返回上一页 1去底部导航 2不保留当前页面跳转 除了0其他必须有pageUrl //返回上一页的类型 0返回上一页 1去底部导航 2不保留当前页面跳转 除了0其他必须有pageUrl
backType:{ backType:{
type:String, type:String,
value:0 value:0
}, },
color:{ color:{
type:String, type:String,
value:'#000' value:'#000'
}, },
showBack:{ showBack:{
type:Boolean, type:Boolean,
value:true value:true
} }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
s: app.system.statusBarHeight, // 状态栏高度 s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度 n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离 t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度 h: app.menu.height, // 胶囊高度
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
handleNavigateBack(){ handleNavigateBack(){
let that = this let that = this
if(that.data.backType == 0){ if(that.data.backType == 0){
wx.navigateBack({ wx.navigateBack({
delta:1 delta:1
}) })
}else if(that.data.backType == 1 && that.data.pageUrl){ }else if(that.data.backType == 1 && that.data.pageUrl){
wx.switchTab({ wx.switchTab({
url: `/pages/${that.data.pageUrl}/${that.data.pageUrl}`, url: `/pages/${that.data.pageUrl}/${that.data.pageUrl}`,
}) })
}else if(that.data.backType == 2 && that.data.pageUrl){ }else if(that.data.backType == 2 && that.data.pageUrl){
wx.redirectTo({ wx.redirectTo({
url: `/pages/${that.data.pageUrl}/${that.data.pageUrl}`, url: `/pages/${that.data.pageUrl}/${that.data.pageUrl}`,
}) })
}else if(that.data.backType != 0){ }else if(that.data.backType != 0){
wx.showToast({ wx.showToast({
title: '请传pageUrl', title: '请传pageUrl',
icon:"none" icon:"none"
}) })
} }
}, },
} }
}) })

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,16 +1,16 @@
<view class="nav-box" style="padding-top: {{ t }}px;position: {{NavPosition}};"> <view class="nav-box" style="padding-top: {{ t }}px;position: {{NavPosition}};">
<view class="nav-bar" style="height: {{ h }}px;"> <view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack" > <view class="nav-bar-left" bindtap="handleNavigateBack" >
<van-icon name="{{backImg}}" color="{{backColor}}" size="{{backSize}}"></van-icon> <van-icon name="{{backImg}}" color="{{backColor}}" size="{{backSize}}"></van-icon>
</view> </view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};"> <view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};">
{{Text}} {{Text}}
</view> </view>
<view class="nav-bar-right"> <view class="nav-bar-right">
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,42 +1,42 @@
/* 自定义导航栏 */ /* 自定义导航栏 */
.nav-box { .nav-box {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
/* position: relative; */ /* position: relative; */
/* position: fixed; */ /* position: fixed; */
z-index: 2; z-index: 2;
} }
.nav-box .nav-bar { .nav-box .nav-bar {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.nav-box .nav-bar .nav-bar-left, .nav-box .nav-bar .nav-bar-left,
.nav-box .nav-bar .nav-bar-right { .nav-box .nav-bar .nav-bar-right {
padding: 0 20rpx; padding: 0 20rpx;
min-width: 36rpx; min-width: 36rpx;
} }
.nav-box .nav-bar .nav-bar-left van-icon { .nav-box .nav-bar .nav-bar-left van-icon {
vertical-align: sub; vertical-align: sub;
color: #333333; color: #333333;
} }
.nav-box .nav-bar .nav-bar-title { .nav-box .nav-bar .nav-bar-title {
flex: 1; flex: 1;
text-align: center; text-align: center;
font-size: 32rpx; font-size: 32rpx;
letter-spacing: 2rpx; letter-spacing: 2rpx;
color: #333333; color: #333333;
} }
.nav-box .nav-bar-title { .nav-box .nav-bar-title {
color: red; color: red;
margin-left: -40rpx; margin-left: -40rpx;
} }
/* .nav-bar-right{ /* .nav-bar-right{
display: none; display: none;
} */ } */

View File

@ -0,0 +1,93 @@
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[],
foot_width:'20%',
},
/**
* 组件的方法列表
*/
methods: {
getFootnav(){
let _that = this;
wx.request({
url: apiAddr.footer_nav_list,
method: 'post',
header: { 'Content-type': 'application/x-www-form-urlencoded' },
data: {},
dataType: 'json',
success: (result) => {
result.data[0].url = "/pages/index/newIndex/newIndex"
result.data[1].url = "/pages/device/device"
result.data[2].nav_name = "手机通行"
result.data[2].url = "/pages/phoneGo/phoneGo"
// result.data[3].url = `/packages/community/communityList/index?communityId=${communityIdArr}`
result.data[3].url = `/packages/community/communityList/index`
result.data[4].url = "/pages/index/index"
result.data.splice(1, 2);
setData(_that,'nav_list', result.data);
setData(_that,'foot_width', (100/result.data.length).toFixed(2)+'%');
},
});
},
//暂未开通
NotOpen(){
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel:false,
complete: (res) => {
if (res.cancel) {
}
}
})
},
jump(e){
const ctoken = wx.getStorageSync('ctoken');
const authen = ['/pages/index/newIndex/newIndex', '/pages/index/index'];
// 除首页及个人中心页不需要鉴定ctoken 其他tab页均需存在登录态才可访问
if (authen.includes(e.currentTarget.dataset.url)) {
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
return
}
if (!ctoken) {
wx.redirectTo({
url: '/pages/login/login',
})
return;
}
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
this.getFootnav();
},
},
})

View File

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

View File

@ -0,0 +1,9 @@
<view class="foot-fixed">
<block wx:for="{{nav_list}}" wx:key="unique">
<!-- <view>{{item.photo}}</view> -->
<view id="navIndex" bind:tap="jump" data-idx="{{index}}" data-url="{{item.url}}" style="width:{{foot_width}}" class="foot-item">
<view class="foot-icon" style="background: url({{item.photo}}) center center no-repeat; background-size: contain;"></view>
<text class="foot-label" id="navIndexLabel">{{item.nav_name}}</text>
</view>
</block>
</view>

View File

@ -0,0 +1,3 @@
/* pages/public/footer.wxss */
@import "../../app.wxss";

View File

@ -1,65 +1,65 @@
import { stateType } from '../../constants/index'; import { stateType } from '../../constants/index';
import { img_url } from '../../utils/util'; import { img_url } from '../../utils/util';
Component({ Component({
properties: { properties: {
isTopShow: { // 接口通过后根据传递订单编号判断是否展示头部区域 isTopShow: { // 接口通过后根据传递订单编号判断是否展示头部区域
type: String, type: String,
value: '', value: '',
}, },
isBottomShow: { // 是否显示底部按钮 isBottomShow: { // 是否显示底部按钮
type: Boolean, type: Boolean,
value: false, value: false,
}, },
shopInfoShow: { // 是否展示商铺信息 shopInfoShow: { // 是否展示商铺信息
type: Boolean, type: Boolean,
value: false, value: false,
}, },
state: { // 商品状态 默认不展示 state: { // 商品状态 默认不展示
type: Boolean, type: Boolean,
value: false value: false
}, },
headerText: { headerText: {
type: String, type: String,
value: '', value: '',
}, },
headerDesc: { headerDesc: {
type: String, type: String,
value: '' value: ''
}, },
item: { item: {
type: Object, type: Object,
value: null, value: null,
} }
}, },
data: { data: {
stateType, stateType,
picUrl: img_url, picUrl: img_url,
}, },
methods: { methods: {
handleLeftClick(e) { handleLeftClick(e) {
const { id } = e.currentTarget.dataset; const { id } = e.currentTarget.dataset;
this.triggerEvent('orde', id) this.triggerEvent('orde', id)
}, },
// 详情点击事件 // 详情点击事件
handleOptionClick(e) { handleOptionClick(e) {
const { id, ordersn } = e.currentTarget.dataset; const { id, ordersn } = e.currentTarget.dataset;
// 触发父组件方法 传递订单id 及订单编号 // 触发父组件方法 传递订单id 及订单编号
this.triggerEvent('details', {id, ordersn}); this.triggerEvent('details', {id, ordersn});
}, },
handleRigthClick(e) { handleRigthClick(e) {
const { item } = e.currentTarget.dataset; const { item } = e.currentTarget.dataset;
if (item.status !== 1) { if (item.status !== 1) {
wx.showToast({ wx.showToast({
title: '当前订单状态无法进行支付', title: '当前订单状态无法进行支付',
icon: 'none', icon: 'none',
}) })
return; return;
} }
// 触发父组件方法 // 触发父组件方法
this.triggerEvent('goPay', item); this.triggerEvent('goPay', item);
} }
} }
}) })

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,37 +1,37 @@
<view class="card"> <view class="card">
<view class="header" wx:if="{{isTopShow}}"> <view class="header" wx:if="{{isTopShow}}">
<view class="code">{{headerText}}{{headerDesc}}</view> <view class="code">{{headerText}}{{headerDesc}}</view>
<view class="state" wx:if="{{state}}">{{stateType[item.status]}}</view> <view class="state" wx:if="{{state}}">{{stateType[item.status]}}</view>
</view> </view>
<view class="main"> <view class="main">
<image class="left_icon" wx:if="{{shopInfoShow}}" src="{{picUrl}}{{item.photo}}" mode=""/> <image class="left_icon" wx:if="{{shopInfoShow}}" src="{{picUrl}}{{item.photo}}" mode=""/>
<image class="left_icon" wx:else="" src="{{picUrl}}{{item.appoint.photo}}" mode=""/> <image class="left_icon" wx:else="" src="{{picUrl}}{{item.appoint.photo}}" mode=""/>
<!-- 根据参数shopInfoShow来渲染3行 --> <!-- 根据参数shopInfoShow来渲染3行 -->
<view class="shop_detail" wx:if="{{shopInfoShow}}"> <view class="shop_detail" wx:if="{{shopInfoShow}}">
<view class="shop_detail_desc">{{item.shop_name}}</view> <view class="shop_detail_desc">{{item.shop_name}}</view>
<view class="shop_detail_desc">电话:{{item.tel}}</view> <view class="shop_detail_desc">电话:{{item.tel}}</view>
<view class="shop_detail_desc">地址:{{item.addr}}</view> <view class="shop_detail_desc">地址:{{item.addr}}</view>
</view> </view>
<view class="main_right" wx:else> <view class="main_right" wx:else>
<view class="article_title">{{item.appoint.title}}</view> <view class="article_title">{{item.appoint.title}}</view>
<view class="article_subTitle"> <view class="article_subTitle">
小计: 小计:
<text class="article_symbol">¥</text> <text class="article_symbol">¥</text>
<text class="article_desc">{{item.total_price}}</text> <text class="article_desc">{{item.total_price}}</text>
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{isBottomShow}}" class="bottom"> <view wx:if="{{isBottomShow}}" class="bottom">
<view class="price article_subTitle"> <view class="price article_subTitle">
总价 总价
<text class="price_symbol article_symbol">¥</text> <text class="price_symbol article_symbol">¥</text>
<text class="price_desc article_desc">{{item.total_price}}</text> <text class="price_desc article_desc">{{item.total_price}}</text>
</view> </view>
<view class="bottom_btn"> <view class="bottom_btn">
<view class="btn btn_left" data-id="{{item.order_id}}" bindtap="handleLeftClick">取消订单</view> <view class="btn btn_left" data-id="{{item.order_id}}" bindtap="handleLeftClick">取消订单</view>
<view class="btn btn_center" data-orderSn="{{item.order_sn}}" data-id="{{item.order_id}}" bindtap="handleOptionClick">详情</view> <view class="btn btn_center" data-orderSn="{{item.order_sn}}" data-id="{{item.order_id}}" bindtap="handleOptionClick">详情</view>
<view class="btn btn_right" data-item="{{item}}" bindtap="handleRigthClick">去付款</view> <view class="btn btn_right" data-item="{{item}}" bindtap="handleRigthClick">去付款</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,97 +1,97 @@
.card { .card {
margin: 0 18rpx 30rpx 20rpx; margin: 0 18rpx 30rpx 20rpx;
} }
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 32rpx; font-size: 32rpx;
} }
.code { .code {
flex: 1; flex: 1;
font-weight: bold; font-weight: bold;
color: #222222; color: #222222;
overflow: hidden; /* 隐藏溢出内容 */ overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 添加省略号 */ text-overflow: ellipsis; /* 添加省略号 */
white-space: nowrap; /* 防止文本换行 */ white-space: nowrap; /* 防止文本换行 */
} }
.state { .state {
width: 100rpx; width: 100rpx;
color: #FF512A; color: #2583FF;
font-weight: bold; font-weight: bold;
} }
.main { .main {
display: flex; display: flex;
margin-top: 30rpx; margin-top: 30rpx;
} }
.left_icon { .left_icon {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
border-radius: 30rpx 30rpx 30rpx 30rpx; border-radius: 30rpx 30rpx 30rpx 30rpx;
margin-right: 30rpx; margin-right: 30rpx;
} }
.main_right { .main_right {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.article_title { .article_title {
font-weight: 400; font-weight: 400;
font-size: 28rpx; font-size: 28rpx;
color: #000000; color: #000000;
margin-bottom: 18rpx; margin-bottom: 18rpx;
} }
.article_subTitle { .article_subTitle {
font-size: 26rpx; font-size: 26rpx;
font-weight: 400; font-weight: 400;
color: #222222; color: #222222;
} }
.article_symbol { .article_symbol {
font-size: 22rpx; font-size: 22rpx;
color: #FF512A; color: #2583FF;
font-weight: 400; font-weight: 400;
} }
.article_desc { .article_desc {
font-weight: 500; font-weight: 500;
font-size: 36rpx; font-size: 36rpx;
color: #FF512A; color: #2583FF;
} }
.bottom { .bottom {
margin-top: 12rpx; margin-top: 12rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.bottom_btn { .bottom_btn {
display: flex; display: flex;
} }
.btn { .btn {
display: flex; display: flex;
align-items: center; align-items: center;
background: #999999; background: #999999;
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
font-size: 26rpx; font-size: 26rpx;
color: #FFFFFF; color: #FFFFFF;
font-weight: 400; font-weight: 400;
margin-right: 10rpx; margin-right: 10rpx;
} }
.btn:last-child { .btn:last-child {
margin-right: 0; margin-right: 0;
} }
.btn_left { .btn_left {
padding: 10rpx 23rpx; padding: 10rpx 23rpx;
} }
.btn_center { .btn_center {
padding: 10rpx 24rpx; padding: 10rpx 24rpx;
background: #D5AC66; background: #D5AC66;
} }
.btn_right { .btn_right {
padding: 10rpx 11rpx; padding: 10rpx 11rpx;
background: #FF512A; background: #2583FF;
} }
.shop_detail { .shop_detail {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }

View File

@ -0,0 +1,50 @@
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/pages/water_filter/water_filter",
nav_name:"设备",
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/deviceIcon.png"
},
{
url:"/pages/info/info",
nav_name:"我的",
photo:"https://zhsq.hshuishang.com/attachs/navigation/2024/12/23/6768c0b16ce89.png"
},
],
foot_width:'50%',
},
/**
* 组件的方法列表
*/
methods: {
jump(e){
console.log(e);
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
},
},
})

View File

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

View File

@ -0,0 +1,9 @@
<view class="foot-fixed">
<block wx:for="{{nav_list}}" wx:key="unique">
<!-- <view>{{item.photo}}</view> -->
<view id="navIndex" bind:tap="jump" data-idx="{{index}}" data-url="{{item.url}}" style="width:{{foot_width}}" class="foot-item">
<view class="foot-icon" style="background: url({{item.photo}}) center center no-repeat; background-size: contain;"></view>
<text class="foot-label" id="navIndexLabel">{{item.nav_name}}</text>
</view>
</block>
</view>

View File

@ -0,0 +1,3 @@
/* pages/public/footer.wxss */
@import "../../app.wxss";

View File

@ -1,285 +1,285 @@
import WxCanvas from './wx-canvas'; import WxCanvas from './wx-canvas';
import * as echarts from './echarts'; import * as echarts from './echarts';
let ctx; let ctx;
function compareVersion(v1, v2) { function compareVersion(v1, v2) {
v1 = v1.split('.') v1 = v1.split('.')
v2 = v2.split('.') v2 = v2.split('.')
const len = Math.max(v1.length, v2.length) const len = Math.max(v1.length, v2.length)
while (v1.length < len) { while (v1.length < len) {
v1.push('0') v1.push('0')
} }
while (v2.length < len) { while (v2.length < len) {
v2.push('0') v2.push('0')
} }
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i]) const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i]) const num2 = parseInt(v2[i])
if (num1 > num2) { if (num1 > num2) {
return 1 return 1
} else if (num1 < num2) { } else if (num1 < num2) {
return -1 return -1
} }
} }
return 0 return 0
} }
Component({ Component({
properties: { properties: {
canvasId: { canvasId: {
type: String, type: String,
value: 'ec-canvas' value: 'ec-canvas'
}, },
ec: { ec: {
type: Object type: Object
}, },
forceUseOldCanvas: { forceUseOldCanvas: {
type: Boolean, type: Boolean,
value: false value: false
} }
}, },
data: { data: {
isUseNewCanvas: false isUseNewCanvas: false
}, },
ready: function () { ready: function () {
// Disable prograssive because drawImage doesn't support DOM as parameter // Disable prograssive because drawImage doesn't support DOM as parameter
// See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html // See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
echarts.registerPreprocessor(option => { echarts.registerPreprocessor(option => {
if (option && option.series) { if (option && option.series) {
if (option.series.length > 0) { if (option.series.length > 0) {
option.series.forEach(series => { option.series.forEach(series => {
series.progressive = 0; series.progressive = 0;
}); });
} }
else if (typeof option.series === 'object') { else if (typeof option.series === 'object') {
option.series.progressive = 0; option.series.progressive = 0;
} }
} }
}); });
if (!this.data.ec) { if (!this.data.ec) {
console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" ' console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
+ 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>'); + 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
return; return;
} }
if (!this.data.ec.lazyLoad) { if (!this.data.ec.lazyLoad) {
this.init(); this.init();
} }
}, },
methods: { methods: {
init: function (callback) { init: function (callback) {
const version = wx.getSystemInfoSync().SDKVersion const version = wx.getSystemInfoSync().SDKVersion
const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0; const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
const forceUseOldCanvas = this.data.forceUseOldCanvas; const forceUseOldCanvas = this.data.forceUseOldCanvas;
const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas; const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
this.setData({ isUseNewCanvas }); this.setData({ isUseNewCanvas });
if (forceUseOldCanvas && canUseNewCanvas) { if (forceUseOldCanvas && canUseNewCanvas) {
console.warn('开发者强制使用旧canvas,建议关闭'); console.warn('开发者强制使用旧canvas,建议关闭');
} }
if (isUseNewCanvas) { if (isUseNewCanvas) {
// console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>'); // console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
// 2.9.0 可以使用 <canvas type="2d"></canvas> // 2.9.0 可以使用 <canvas type="2d"></canvas>
this.initByNewWay(callback); this.initByNewWay(callback);
} else { } else {
const isValid = compareVersion(version, '1.9.91') >= 0 const isValid = compareVersion(version, '1.9.91') >= 0
if (!isValid) { if (!isValid) {
console.error('微信基础库版本过低,需大于等于 1.9.91。' console.error('微信基础库版本过低,需大于等于 1.9.91。'
+ '参见https://github.com/ecomfe/echarts-for-weixin' + '参见https://github.com/ecomfe/echarts-for-weixin'
+ '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82'); + '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
return; return;
} else { } else {
console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能'); console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
this.initByOldWay(callback); this.initByOldWay(callback);
} }
} }
}, },
initByOldWay(callback) { initByOldWay(callback) {
// 1.9.91 <= version < 2.9.0:原来的方式初始化 // 1.9.91 <= version < 2.9.0:原来的方式初始化
ctx = wx.createCanvasContext(this.data.canvasId, this); ctx = wx.createCanvasContext(this.data.canvasId, this);
const canvas = new WxCanvas(ctx, this.data.canvasId, false); const canvas = new WxCanvas(ctx, this.data.canvasId, false);
if (echarts.setPlatformAPI) { if (echarts.setPlatformAPI) {
echarts.setPlatformAPI({ echarts.setPlatformAPI({
createCanvas: () => canvas, createCanvas: () => canvas,
}); });
} else { } else {
echarts.setCanvasCreator(() => canvas); echarts.setCanvasCreator(() => canvas);
}; };
// const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr // const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
const canvasDpr = 1 const canvasDpr = 1
var query = wx.createSelectorQuery().in(this); var query = wx.createSelectorQuery().in(this);
query.select('.ec-canvas').boundingClientRect(res => { query.select('.ec-canvas').boundingClientRect(res => {
if (typeof callback === 'function') { if (typeof callback === 'function') {
this.chart = callback(canvas, res.width, res.height, canvasDpr); this.chart = callback(canvas, res.width, res.height, canvasDpr);
} }
else if (this.data.ec && typeof this.data.ec.onInit === 'function') { else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr); this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
} }
else { else {
this.triggerEvent('init', { this.triggerEvent('init', {
canvas: canvas, canvas: canvas,
width: res.width, width: res.width,
height: res.height, height: res.height,
canvasDpr: canvasDpr // 增加了dpr可方便外面echarts.init canvasDpr: canvasDpr // 增加了dpr可方便外面echarts.init
}); });
} }
}).exec(); }).exec();
}, },
initByNewWay(callback) { initByNewWay(callback) {
// version >= 2.9.0:使用新的方式初始化 // version >= 2.9.0:使用新的方式初始化
const query = wx.createSelectorQuery().in(this) const query = wx.createSelectorQuery().in(this)
query query
.select('.ec-canvas') .select('.ec-canvas')
.fields({ node: true, size: true }) .fields({ node: true, size: true })
.exec(res => { .exec(res => {
const canvasNode = res[0].node const canvasNode = res[0].node
this.canvasNode = canvasNode this.canvasNode = canvasNode
const canvasDpr = wx.getSystemInfoSync().pixelRatio const canvasDpr = wx.getSystemInfoSync().pixelRatio
const canvasWidth = res[0].width const canvasWidth = res[0].width
const canvasHeight = res[0].height const canvasHeight = res[0].height
const ctx = canvasNode.getContext('2d') const ctx = canvasNode.getContext('2d')
const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode) const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
if (echarts.setPlatformAPI) { if (echarts.setPlatformAPI) {
echarts.setPlatformAPI({ echarts.setPlatformAPI({
createCanvas: () => canvas, createCanvas: () => canvas,
loadImage: (src, onload, onerror) => { loadImage: (src, onload, onerror) => {
if (canvasNode.createImage) { if (canvasNode.createImage) {
const image = canvasNode.createImage(); const image = canvasNode.createImage();
image.onload = onload; image.onload = onload;
image.onerror = onerror; image.onerror = onerror;
image.src = src; image.src = src;
return image; return image;
} }
console.error('加载图片依赖 `Canvas.createImage()` API要求小程序基础库版本在 2.7.0 及以上。'); console.error('加载图片依赖 `Canvas.createImage()` API要求小程序基础库版本在 2.7.0 及以上。');
// PENDING fallback? // PENDING fallback?
} }
}) })
} else { } else {
echarts.setCanvasCreator(() => canvas) echarts.setCanvasCreator(() => canvas)
} }
if (typeof callback === 'function') { if (typeof callback === 'function') {
this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr) this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') { } else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr) this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
} else { } else {
this.triggerEvent('init', { this.triggerEvent('init', {
canvas: canvas, canvas: canvas,
width: canvasWidth, width: canvasWidth,
height: canvasHeight, height: canvasHeight,
dpr: canvasDpr dpr: canvasDpr
}) })
} }
}) })
}, },
canvasToTempFilePath(opt) { canvasToTempFilePath(opt) {
if (this.data.isUseNewCanvas) { if (this.data.isUseNewCanvas) {
// 新版 // 新版
const query = wx.createSelectorQuery().in(this) const query = wx.createSelectorQuery().in(this)
query query
.select('.ec-canvas') .select('.ec-canvas')
.fields({ node: true, size: true }) .fields({ node: true, size: true })
.exec(res => { .exec(res => {
const canvasNode = res[0].node const canvasNode = res[0].node
opt.canvas = canvasNode opt.canvas = canvasNode
wx.canvasToTempFilePath(opt) wx.canvasToTempFilePath(opt)
}) })
} else { } else {
// 旧的 // 旧的
if (!opt.canvasId) { if (!opt.canvasId) {
opt.canvasId = this.data.canvasId; opt.canvasId = this.data.canvasId;
} }
ctx.draw(true, () => { ctx.draw(true, () => {
wx.canvasToTempFilePath(opt, this); wx.canvasToTempFilePath(opt, this);
}); });
} }
}, },
touchStart(e) { touchStart(e) {
if (this.chart && e.touches.length > 0) { if (this.chart && e.touches.length > 0) {
var touch = e.touches[0]; var touch = e.touches[0];
var handler = this.chart.getZr().handler; var handler = this.chart.getZr().handler;
handler.dispatch('mousedown', { handler.dispatch('mousedown', {
zrX: touch.x, zrX: touch.x,
zrY: touch.y, zrY: touch.y,
preventDefault: () => {}, preventDefault: () => {},
stopImmediatePropagation: () => {}, stopImmediatePropagation: () => {},
stopPropagation: () => {} stopPropagation: () => {}
}); });
handler.dispatch('mousemove', { handler.dispatch('mousemove', {
zrX: touch.x, zrX: touch.x,
zrY: touch.y, zrY: touch.y,
preventDefault: () => {}, preventDefault: () => {},
stopImmediatePropagation: () => {}, stopImmediatePropagation: () => {},
stopPropagation: () => {} stopPropagation: () => {}
}); });
handler.processGesture(wrapTouch(e), 'start'); handler.processGesture(wrapTouch(e), 'start');
} }
}, },
touchMove(e) { touchMove(e) {
if (this.chart && e.touches.length > 0) { if (this.chart && e.touches.length > 0) {
var touch = e.touches[0]; var touch = e.touches[0];
var handler = this.chart.getZr().handler; var handler = this.chart.getZr().handler;
handler.dispatch('mousemove', { handler.dispatch('mousemove', {
zrX: touch.x, zrX: touch.x,
zrY: touch.y, zrY: touch.y,
preventDefault: () => {}, preventDefault: () => {},
stopImmediatePropagation: () => {}, stopImmediatePropagation: () => {},
stopPropagation: () => {} stopPropagation: () => {}
}); });
handler.processGesture(wrapTouch(e), 'change'); handler.processGesture(wrapTouch(e), 'change');
} }
}, },
touchEnd(e) { touchEnd(e) {
if (this.chart) { if (this.chart) {
const touch = e.changedTouches ? e.changedTouches[0] : {}; const touch = e.changedTouches ? e.changedTouches[0] : {};
var handler = this.chart.getZr().handler; var handler = this.chart.getZr().handler;
handler.dispatch('mouseup', { handler.dispatch('mouseup', {
zrX: touch.x, zrX: touch.x,
zrY: touch.y, zrY: touch.y,
preventDefault: () => {}, preventDefault: () => {},
stopImmediatePropagation: () => {}, stopImmediatePropagation: () => {},
stopPropagation: () => {} stopPropagation: () => {}
}); });
handler.dispatch('click', { handler.dispatch('click', {
zrX: touch.x, zrX: touch.x,
zrY: touch.y, zrY: touch.y,
preventDefault: () => {}, preventDefault: () => {},
stopImmediatePropagation: () => {}, stopImmediatePropagation: () => {},
stopPropagation: () => {} stopPropagation: () => {}
}); });
handler.processGesture(wrapTouch(e), 'end'); handler.processGesture(wrapTouch(e), 'end');
} }
} }
} }
}); });
function wrapTouch(event) { function wrapTouch(event) {
for (let i = 0; i < event.touches.length; ++i) { for (let i = 0; i < event.touches.length; ++i) {
const touch = event.touches[i]; const touch = event.touches[i];
touch.offsetX = touch.x; touch.offsetX = touch.x;
touch.offsetY = touch.y; touch.offsetY = touch.y;
} }
return event; return event;
} }

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,4 +1,4 @@
<!-- 新的接口对其了H5 --> <!-- 新的接口对其了H5 -->
<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> <canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
<!-- 旧的 --> <!-- 旧的 -->
<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> <canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>

View File

@ -1,4 +1,4 @@
.ec-canvas { .ec-canvas {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,111 +1,111 @@
export default class WxCanvas { export default class WxCanvas {
constructor(ctx, canvasId, isNew, canvasNode) { constructor(ctx, canvasId, isNew, canvasNode) {
this.ctx = ctx; this.ctx = ctx;
this.canvasId = canvasId; this.canvasId = canvasId;
this.chart = null; this.chart = null;
this.isNew = isNew this.isNew = isNew
if (isNew) { if (isNew) {
this.canvasNode = canvasNode; this.canvasNode = canvasNode;
} }
else { else {
this._initStyle(ctx); this._initStyle(ctx);
} }
// this._initCanvas(zrender, ctx); // this._initCanvas(zrender, ctx);
this._initEvent(); this._initEvent();
} }
getContext(contextType) { getContext(contextType) {
if (contextType === '2d') { if (contextType === '2d') {
return this.ctx; return this.ctx;
} }
} }
// canvasToTempFilePath(opt) { // canvasToTempFilePath(opt) {
// if (!opt.canvasId) { // if (!opt.canvasId) {
// opt.canvasId = this.canvasId; // opt.canvasId = this.canvasId;
// } // }
// return wx.canvasToTempFilePath(opt, this); // return wx.canvasToTempFilePath(opt, this);
// } // }
setChart(chart) { setChart(chart) {
this.chart = chart; this.chart = chart;
} }
addEventListener() { addEventListener() {
// noop // noop
} }
attachEvent() { attachEvent() {
// noop // noop
} }
detachEvent() { detachEvent() {
// noop // noop
} }
_initCanvas(zrender, ctx) { _initCanvas(zrender, ctx) {
zrender.util.getContext = function () { zrender.util.getContext = function () {
return ctx; return ctx;
}; };
zrender.util.$override('measureText', function (text, font) { zrender.util.$override('measureText', function (text, font) {
ctx.font = font || '12px sans-serif'; ctx.font = font || '12px sans-serif';
return ctx.measureText(text); return ctx.measureText(text);
}); });
} }
_initStyle(ctx) { _initStyle(ctx) {
ctx.createRadialGradient = () => { ctx.createRadialGradient = () => {
return ctx.createCircularGradient(arguments); return ctx.createCircularGradient(arguments);
}; };
} }
_initEvent() { _initEvent() {
this.event = {}; this.event = {};
const eventNames = [{ const eventNames = [{
wxName: 'touchStart', wxName: 'touchStart',
ecName: 'mousedown' ecName: 'mousedown'
}, { }, {
wxName: 'touchMove', wxName: 'touchMove',
ecName: 'mousemove' ecName: 'mousemove'
}, { }, {
wxName: 'touchEnd', wxName: 'touchEnd',
ecName: 'mouseup' ecName: 'mouseup'
}, { }, {
wxName: 'touchEnd', wxName: 'touchEnd',
ecName: 'click' ecName: 'click'
}]; }];
eventNames.forEach(name => { eventNames.forEach(name => {
this.event[name.wxName] = e => { this.event[name.wxName] = e => {
const touch = e.touches[0]; const touch = e.touches[0];
this.chart.getZr().handler.dispatch(name.ecName, { this.chart.getZr().handler.dispatch(name.ecName, {
zrX: name.wxName === 'tap' ? touch.clientX : touch.x, zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
zrY: name.wxName === 'tap' ? touch.clientY : touch.y, zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
preventDefault: () => {}, preventDefault: () => {},
stopImmediatePropagation: () => {}, stopImmediatePropagation: () => {},
stopPropagation: () => {} stopPropagation: () => {}
}); });
}; };
}); });
} }
set width(w) { set width(w) {
if (this.canvasNode) this.canvasNode.width = w if (this.canvasNode) this.canvasNode.width = w
} }
set height(h) { set height(h) {
if (this.canvasNode) this.canvasNode.height = h if (this.canvasNode) this.canvasNode.height = h
} }
get width() { get width() {
if (this.canvasNode) if (this.canvasNode)
return this.canvasNode.width return this.canvasNode.width
return 0 return 0
} }
get height() { get height() {
if (this.canvasNode) if (this.canvasNode)
return this.canvasNode.height return this.canvasNode.height
return 0 return 0
} }
} }

View File

@ -1,97 +1,93 @@
import apiAddr from '../../api/base'; import apiAddr from '../../api/base';
import { setData } from '../../utils/index'; import { setData } from '../../utils/index';
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
nav_list:[], nav_list:[],
foot_width:'20%', foot_width:'20%',
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
getFootnav(){ getFootnav(){
let _that = this; let _that = this;
wx.request({ wx.request({
url: apiAddr.footer_nav_list, url: apiAddr.footer_nav_list,
method: 'post', method: 'post',
header: { 'Content-type': 'application/x-www-form-urlencoded' }, header: { 'Content-type': 'application/x-www-form-urlencoded' },
data: {}, data: {},
dataType: 'json', dataType: 'json',
success: (result) => { success: (result) => {
// let communityId = wx.getStorageSync('communityId')
// let communityIdArr = '' result.data[0].url = "/pages/index/newIndex/newIndex"
// communityIdArr = communityId.join(',') result.data[1].url = "/pages/device/device"
// console.log(communityIdArr,'communityIdcommunityId'); result.data[2].nav_name = "手机通行"
result.data[2].url = "/pages/phoneGo/phoneGo"
result.data[0].url = "/pages/index/newIndex/newIndex" // result.data[3].url = `/packages/community/communityList/index?communityId=${communityIdArr}`
result.data[1].url = "/pages/device/device" result.data[3].url = `/packages/community/communityList/index`
result.data[2].nav_name = "手机通行" result.data[4].url = "/pages/index/index"
result.data[2].url = "/pages/phoneGo/phoneGo"
// result.data[3].url = `/packages/community/communityList/index?communityId=${communityIdArr}` result.data.splice(1, 2);
result.data[3].url = `/packages/community/communityList/index`
result.data[4].url = "/pages/index/index" setData(_that,'nav_list', result.data);
setData(_that,'foot_width', (100/result.data.length).toFixed(2)+'%');
result.data.splice(1, 2); },
});
setData(_that,'nav_list', result.data); },
setData(_that,'foot_width', (100/result.data.length).toFixed(2)+'%'); //暂未开通
}, NotOpen(){
}); wx.showModal({
}, title: '提示',
//暂未开通 content: '此功能暂未开通!',
NotOpen(){ showCancel:false,
wx.showModal({ complete: (res) => {
title: '提示', if (res.cancel) {
content: '此功能暂未开通!',
showCancel:false, }
complete: (res) => { }
if (res.cancel) { })
},
} jump(e){
} const ctoken = wx.getStorageSync('ctoken');
}) const authen = ['/pages/index/newIndex/newIndex', '/pages/index/index'];
}, // 除首页及个人中心页不需要鉴定ctoken 其他tab页均需存在登录态才可访问
jump(e){ if (authen.includes(e.currentTarget.dataset.url)) {
const ctoken = wx.getStorageSync('ctoken'); wx.redirectTo({
const authen = ['/pages/index/newIndex/newIndex', '/pages/index/index']; url: e.currentTarget.dataset.url,
// 除首页及个人中心页不需要鉴定ctoken 其他tab页均需存在登录态才可访问 })
if (authen.includes(e.currentTarget.dataset.url)) { return
wx.redirectTo({ }
url: e.currentTarget.dataset.url, if (!ctoken) {
}) wx.redirectTo({
return url: '/pages/login/login',
} })
if (!ctoken) { return;
wx.redirectTo({ }
url: '/pages/login/login', wx.redirectTo({
}) url: e.currentTarget.dataset.url,
return; })
} },
wx.redirectTo({
url: e.currentTarget.dataset.url, },
})
}, lifetimes: {
attached: function () {
}, // 组件被添加到页面节点树时执行
this.getFootnav();
lifetimes: { },
attached: function () { },
// 组件被添加到页面节点树时执行
this.getFootnav();
},
},
}) })

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,9 +1,9 @@
<view class="foot-fixed"> <view class="foot-fixed">
<block wx:for="{{nav_list}}" wx:key="unique"> <block wx:for="{{nav_list}}" wx:key="unique">
<!-- <view>{{item.photo}}</view> --> <!-- <view>{{item.photo}}</view> -->
<view id="navIndex" bind:tap="jump" data-idx="{{index}}" data-url="{{item.url}}" style="width:{{foot_width}}" class="foot-item"> <view id="navIndex" bind:tap="jump" data-idx="{{index}}" data-url="{{item.url}}" style="width:{{foot_width}}" class="foot-item">
<view class="foot-icon" style="background: url({{item.photo}}) center center no-repeat; background-size: contain;"></view> <view class="foot-icon" style="background: url({{item.photo}}) center center no-repeat; background-size: contain;"></view>
<text class="foot-label" id="navIndexLabel">{{item.nav_name}}</text> <text class="foot-label" id="navIndexLabel">{{item.nav_name}}</text>
</view> </view>
</block> </block>
</view> </view>

View File

@ -1,3 +1,3 @@
/* pages/public/footer.wxss */ /* pages/public/footer.wxss */
@import "../../app.wxss"; @import "../../app.wxss";

View File

@ -0,0 +1,50 @@
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/packages/master/order/index",
nav_name:"订单",
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1"
},
{
url:"/packages/master/PersonCen/index",
nav_name:"我的",
photo:"https://zhsq.hshuishang.com/attachs/navigation/2024/12/23/6768c0b16ce89.png"
},
],
foot_width:'50%',
},
/**
* 组件的方法列表
*/
methods: {
jump(e){
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
},
},
})

View File

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

View File

@ -0,0 +1,9 @@
<view class="foot-fixed">
<block wx:for="{{nav_list}}" wx:key="unique">
<!-- <view>{{item.photo}}</view> -->
<view id="navIndex" bind:tap="jump" data-idx="{{index}}" data-url="{{item.url}}" style="width:{{foot_width}}" class="foot-item">
<view class="foot-icon" style="background: url({{item.photo}}) center center no-repeat; background-size: contain;"></view>
<text class="foot-label" id="navIndexLabel">{{item.nav_name}}</text>
</view>
</block>
</view>

View File

@ -0,0 +1,3 @@
/* pages/public/footer.wxss */
@import "../../app.wxss";

View File

@ -1,125 +1,125 @@
let privacyHandler let privacyHandler
let privacyResolves = new Set() let privacyResolves = new Set()
let closeOtherPageshowDialogHooks = new Set() let closeOtherPageshowDialogHooks = new Set()
if (wx.onNeedPrivacyAuthorization) { if (wx.onNeedPrivacyAuthorization) {
wx.onNeedPrivacyAuthorization(resolve => { wx.onNeedPrivacyAuthorization(resolve => {
if (typeof privacyHandler === 'function') { if (typeof privacyHandler === 'function') {
privacyHandler(resolve) privacyHandler(resolve)
} }
}) })
} }
const closeOtherPageshowDialog = (closeDialog) => { const closeOtherPageshowDialog = (closeDialog) => {
closeOtherPageshowDialogHooks.forEach(hook => { closeOtherPageshowDialogHooks.forEach(hook => {
if (closeDialog !== hook) { if (closeDialog !== hook) {
hook() hook()
} }
}) })
} }
Component({ Component({
data: { data: {
visible: false, visible: false,
mini_logo: __wxConfig.accountInfo.icon, mini_logo: __wxConfig.accountInfo.icon,
mini_name: __wxConfig.accountInfo.nickname mini_name: __wxConfig.accountInfo.nickname
}, },
properties: { properties: {
useSafeArea: { // 是否在非tabBar页面引用 useSafeArea: { // 是否在非tabBar页面引用
type: Boolean, type: Boolean,
value: true value: true
} }
}, },
lifetimes: { lifetimes: {
attached() { attached() {
const closeDialog = () => { const closeDialog = () => {
this.hideDialog() this.hideDialog()
} }
privacyHandler = resolve => { privacyHandler = resolve => {
privacyResolves.add(resolve) privacyResolves.add(resolve)
this.showDialog() this.showDialog()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
closeOtherPageshowDialog(closeDialog) closeOtherPageshowDialog(closeDialog)
} }
closeOtherPageshowDialogHooks.add(closeDialog) closeOtherPageshowDialogHooks.add(closeDialog)
this.closeDialog = closeDialog this.closeDialog = closeDialog
}, },
detached() { detached() {
closeOtherPageshowDialogHooks.delete(this.closeDialog) closeOtherPageshowDialogHooks.delete(this.closeDialog)
this.handleDisagree() this.handleDisagree()
} }
}, },
methods: { methods: {
handleAgree() { handleAgree() {
this.hideDialog() this.hideDialog()
// 这里演示了同时调用多个wx隐私接口时要如何处理让隐私弹窗保持单例点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 // 这里演示了同时调用多个wx隐私接口时要如何处理让隐私弹窗保持单例点击一次同意按钮即可让所有pending中的wx隐私接口继续执行
privacyResolves.forEach(resolve => { privacyResolves.forEach(resolve => {
resolve({ resolve({
event: 'agree', event: 'agree',
buttonId: 'agree-btn' buttonId: 'agree-btn'
}) })
}) })
privacyResolves.clear() privacyResolves.clear()
}, },
handleDisagree(e) { handleDisagree(e) {
this.hideDialog() this.hideDialog()
privacyResolves.forEach(resolve => { privacyResolves.forEach(resolve => {
resolve({ resolve({
event: 'disagree' event: 'disagree'
}) })
}) })
privacyResolves.clear() privacyResolves.clear()
wx.exitMiniProgram(); wx.exitMiniProgram();
}, },
showDialog() { showDialog() {
if (!this.data.visible) { if (!this.data.visible) {
this.setData({ this.setData({
visible: true visible: true
}) })
wx.setPageStyle({ wx.setPageStyle({
style: { style: {
overflow: 'hidden' overflow: 'hidden'
} }
}) })
} }
}, },
hideDialog() { hideDialog() {
if (this.data.visible) { if (this.data.visible) {
this.setData({ this.setData({
visible: false visible: false
}) })
wx.setPageStyle({ wx.setPageStyle({
style: { style: {
overflow: 'auto' overflow: 'auto'
} }
}) })
} }
}, },
openPrivacyContract() { openPrivacyContract() {
wx.openPrivacyContract({ wx.openPrivacyContract({
success: res => { success: res => {
console.log('openPrivacyContract success', res) console.log('openPrivacyContract success', res)
}, },
fail: err => { fail: err => {
console.error('openPrivacyContract fail', err) console.error('openPrivacyContract fail', err)
} }
}) })
}, },
tabBarPageShow() { tabBarPageShow() {
this.handleDisagree() this.handleDisagree()
if (this.closeDialog) { if (this.closeDialog) {
privacyHandler = resolve => { privacyHandler = resolve => {
privacyResolves.add(resolve) privacyResolves.add(resolve)
this.showDialog() this.showDialog()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗 // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
closeOtherPageshowDialog(this.closeDialog) closeOtherPageshowDialog(this.closeDialog)
} }
} }
}, },
openUserAgreementConfig(){ openUserAgreementConfig(){
wx.navigateTo({ wx.navigateTo({
url: '/pages/index/illustrate?type=miniprogram_user_agreement', url: '/pages/index/illustrate?type=miniprogram_user_agreement',
}) })
} }
} }
}) })

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,16 +1,16 @@
<view class="privacy-dialog {{visible ? 'active' : ''}}"> <view class="privacy-dialog {{visible ? 'active' : ''}}">
<view class="privacy-back {{visible ? 'active' : ''}}"></view> <view class="privacy-back {{visible ? 'active' : ''}}"></view>
<view class="privacy-container {{visible ? 'active' : ''}} {{useSafeArea ? 'change' : ''}}"> <view class="privacy-container {{visible ? 'active' : ''}} {{useSafeArea ? 'change' : ''}}">
<view class="privacy-info"> <view class="privacy-info">
<image src="{{mini_logo}}" mode="widthFix" class="privacy-logo" /> <image src="{{mini_logo}}" mode="widthFix" class="privacy-logo" />
<text class="privacy-name">{{mini_name}}</text> <text class="privacy-name">{{mini_name}}</text>
</view> </view>
<!-- <view class="privacy-text">在您使用【{{mini_name}}】服务之前,请仔细阅读<text bindtap="openPrivacyContract">《{{mini_name}}隐私保护指引》</text>。如您同意,《{{mini_name}}隐私保护指引》,请点击“同意”开始使用【{{mini_name}}】</view> --> <!-- <view class="privacy-text">在您使用【{{mini_name}}】服务之前,请仔细阅读<text bindtap="openPrivacyContract">《{{mini_name}}隐私保护指引》</text>。如您同意,《{{mini_name}}隐私保护指引》,请点击“同意”开始使用【{{mini_name}}】</view> -->
<view class="privacy-text">尊敬的用户,欢迎使用“{{mini_name}}”,我们非常注重您的个人隐私,为了更好地保护您的个人信息,在您使用产品服务前,请仔细阅读<text bindtap="openPrivacyContract">《{{mini_name}}隐私保护政策》</text>和<text bindtap="openUserAgreementConfig">《用户协议》</text>,需要您同意我们收集、使用和保护您的个人信息,我们将严格遵守相关法律法规、监管政策,保护您的个人信息安全。如您同意此政策,请点击“同意”并开始使用我们的产品,如您不同意,我们将无法进一步为您提供服务。</view> <view class="privacy-text">尊敬的用户,欢迎使用“{{mini_name}}”,我们非常注重您的个人隐私,为了更好地保护您的个人信息,在您使用产品服务前,请仔细阅读<text bindtap="openPrivacyContract">《{{mini_name}}隐私保护政策》</text>和<text bindtap="openUserAgreementConfig">《用户协议》</text>,需要您同意我们收集、使用和保护您的个人信息,我们将严格遵守相关法律法规、监管政策,保护您的个人信息安全。如您同意此政策,请点击“同意”并开始使用我们的产品,如您不同意,我们将无法进一步为您提供服务。</view>
<!-- 尊敬的用户欢迎使用“xxx”我们非常注重您的个人隐私为了更好地保护您的个人信息在您使用产品服务前请仔细阅读《xxxx》和《服务使用协议》需要您同意我们收集、使用和保护您的个人信息我们将严格遵守相关法律法规、监管政策保护您的个人信息安全。如您同意此政策请点击“同意”并开始使用我们的产品和服务如您不同意我们将无法进一步为您提供服务。 --> <!-- 尊敬的用户欢迎使用“xxx”我们非常注重您的个人隐私为了更好地保护您的个人信息在您使用产品服务前请仔细阅读《xxxx》和《服务使用协议》需要您同意我们收集、使用和保护您的个人信息我们将严格遵守相关法律法规、监管政策保护您的个人信息安全。如您同意此政策请点击“同意”并开始使用我们的产品和服务如您不同意我们将无法进一步为您提供服务。 -->
<view class="privacy-btns"> <view class="privacy-btns">
<button id="disagree-btn" class="privacy-cancel-btn" bindtap="handleDisagree">不同意并退出</button> <button id="disagree-btn" class="privacy-cancel-btn" bindtap="handleDisagree">不同意并退出</button>
<button id="agree-btn" open-type="agreePrivacyAuthorization" class="privacy-confirm-btn" bindagreeprivacyauthorization="handleAgree">同意并继续</button> <button id="agree-btn" open-type="agreePrivacyAuthorization" class="privacy-confirm-btn" bindagreeprivacyauthorization="handleAgree">同意并继续</button>
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,123 +1,123 @@
@import "/app.wxss"; @import "/app.wxss";
.privacy-dialog { .privacy-dialog {
width: 100%; width: 100%;
visibility: hidden; visibility: hidden;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
z-index: 1000; z-index: 1000;
} }
.privacy-dialog.active { .privacy-dialog.active {
visibility: visible; visibility: visible;
} }
.privacy-back { .privacy-back {
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.6);
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: 8888; z-index: 8888;
opacity: 0; opacity: 0;
transition: all 0.3s; transition: all 0.3s;
} }
.privacy-back.active { .privacy-back.active {
opacity: 1; opacity: 1;
transition: all 0.3s; transition: all 0.3s;
} }
.privacy-container { .privacy-container {
width: 100%; width: 100%;
background: #fff; background: #fff;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
z-index: 9999; z-index: 9999;
border-radius: 32rpx 32rpx 0 0; border-radius: 32rpx 32rpx 0 0;
padding: 48rpx; padding: 48rpx;
transform: translateY(100%); transform: translateY(100%);
transition: all 0.3s; transition: all 0.3s;
overflow: hidden; overflow: hidden;
} }
.privacy-container.active { .privacy-container.active {
transform: translateY(0%); transform: translateY(0%);
transition: all 0.3s; transition: all 0.3s;
} }
.privacy-container.change { .privacy-container.change {
padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx); padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
} }
.privacy-info { .privacy-info {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.privacy-logo { .privacy-logo {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
border-radius: 50%; border-radius: 50%;
} }
.privacy-name { .privacy-name {
margin-left: 8rpx; margin-left: 8rpx;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.privacy-text { .privacy-text {
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
margin: 32rpx 0; margin: 32rpx 0;
letter-spacing: 2rpx; letter-spacing: 2rpx;
} }
.privacy-text text { .privacy-text text {
color: #1277FF; color: #1277FF;
} }
.privacy-btns { .privacy-btns {
width: auto; width: auto;
display: flex; display: flex;
margin: 0 auto; margin: 0 auto;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.privacy-cancel-btn { .privacy-cancel-btn {
width: 45%; width: 45%;
height: 90rpx; height: 90rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 14rpx; border-radius: 14rpx;
color: #07c160; color: #07c160;
background-color: #F2F2F2; background-color: #F2F2F2;
font-weight: 500; font-weight: 500;
margin: 10px !important; margin: 10px !important;
padding: 0; padding: 0;
font-size: 32rpx; font-size: 32rpx;
} }
.privacy-confirm-btn { .privacy-confirm-btn {
width: 45%; width: 45%;
height: 90rpx; height: 90rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 14rpx; border-radius: 14rpx;
color: #fff; color: #fff;
background: #07c160; background: #07c160;
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
margin: 10px !important; margin: 10px !important;
padding: 0; padding: 0;
} }

View File

@ -1,209 +1,209 @@
import { doNavigateWithUser } from '../../utils/helper'; import { doNavigateWithUser } from '../../utils/helper';
import apiAddr from '../../api/base'; import apiAddr from '../../api/base';
const app = getApp(); const app = getApp();
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
qqmap_key: app.initQQMapKey(), qqmap_key: app.initQQMapKey(),
address: '定位中', address: '定位中',
selectKeyWord: '', selectKeyWord: '',
shopArea: [], shopArea: [],
lat: '', lat: '',
lng: '', lng: '',
mapObj: {}, mapObj: {},
}, },
methods: { methods: {
goPagesLink() { goPagesLink() {
doNavigateWithUser({ doNavigateWithUser({
url: `/pages/index/shopcity` url: `/pages/index/shopcity`
}); });
}, },
// 获取地址 // 获取地址
getAddress() { getAddress() {
let that = this; let that = this;
let userlocat = wx.getStorageSync('userlocat'); let userlocat = wx.getStorageSync('userlocat');
let nowtime = Date.parse(new Date()) / 1000; let nowtime = Date.parse(new Date()) / 1000;
if (!userlocat || userlocat.overtime < nowtime || !userlocat.city) { if (!userlocat || userlocat.overtime < nowtime || !userlocat.city) {
wx.showLoading({ wx.showLoading({
title: '定位中...' title: '定位中...'
}); });
wx.getLocation({ wx.getLocation({
success: (res) => { success: (res) => {
console.log(res); console.log(res);
let overtime = Date.parse(new Date()) / 1000 + 7200; let overtime = Date.parse(new Date()) / 1000 + 7200;
this.setData({ this.setData({
lat: res.latitude, lat: res.latitude,
lng: res.longitude, lng: res.longitude,
}) })
if (this.data.qqmap_key) { if (this.data.qqmap_key) {
// 微信逆地址解析 // 微信逆地址解析
wx.request({ wx.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + ',' + res.longitude + '&key=' + this.data.qqmap_key + '&get_poi=0', url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + ',' + res.longitude + '&key=' + this.data.qqmap_key + '&get_poi=0',
success: function (res) { success: function (res) {
// console.log('cityres', res); // console.log('cityres', res);
var city = res.data.result.address_component.city; var city = res.data.result.address_component.city;
// console.log(city); // console.log(city);
if (city) { if (city) {
that.setData({ that.setData({
address: city address: city
}) })
let area = that.data.shopArea; let area = that.data.shopArea;
// console.log(area); // console.log(area);
if (typeof area[city] !== 'undefined') { if (typeof area[city] !== 'undefined') {
// setData(that,'area_id',area[city]['area_id']); // setData(that,'area_id',area[city]['area_id']);
} }
} }
userlocat = { userlocat = {
userlat: that.data.lat, userlat: that.data.lat,
userlng: that.data.lng, userlng: that.data.lng,
overtime: overtime, overtime: overtime,
city: city, city: city,
}; };
wx.setStorageSync('userlocat', userlocat); wx.setStorageSync('userlocat', userlocat);
wx.hideLoading(); wx.hideLoading();
// that.setData({ // that.setData({
// pageNo: 0, // 当前页数 // pageNo: 0, // 当前页数
// shopList: [], // shopList: [],
// }) // })
// that.getList(); // that.getList();
} }
}) })
} else { } else {
console.log('11111 走到这列了'); console.log('11111 走到这列了');
let sendData = { let sendData = {
lat: res.latitude, lat: res.latitude,
lng: res.longitude, lng: res.longitude,
}; };
// 后端地图接口 // 后端地图接口
wx.request({ wx.request({
url: apiAddr.get_maps_geocoder, url: apiAddr.get_maps_geocoder,
method: 'post', method: 'post',
header: { header: {
'Content-type': 'application/x-www-form-urlencoded' 'Content-type': 'application/x-www-form-urlencoded'
}, },
dataType: 'json', dataType: 'json',
data: sendData, data: sendData,
success: function (res) { success: function (res) {
// console.log('cityres2', res); // console.log('cityres2', res);
var city = res.data.city; var city = res.data.city;
// console.log(city); // console.log(city);
if (city) { if (city) {
that.setData({ that.setData({
address: city address: city
}) })
let area = that.data.shopArea; let area = that.data.shopArea;
if (typeof area[city] !== 'undefined') { if (typeof area[city] !== 'undefined') {
// setData(that,'area_id',area[city]['area_id']); // setData(that,'area_id',area[city]['area_id']);
} }
} }
userlocat = { userlocat = {
userlat: that.data.lat, userlat: that.data.lat,
userlng: that.data.lng, userlng: that.data.lng,
overtime: overtime, overtime: overtime,
city: city, city: city,
}; };
wx.setStorageSync('userlocat', userlocat); wx.setStorageSync('userlocat', userlocat);
wx.hideLoading(); wx.hideLoading();
} }
}) })
} }
// 缓存 // 缓存
wx.request({ wx.request({
url: apiAddr.setcookie_location, url: apiAddr.setcookie_location,
method: 'post', method: 'post',
header: { header: {
'Content-type': 'application/x-www-form-urlencoded' 'Content-type': 'application/x-www-form-urlencoded'
}, },
dataType: 'json', dataType: 'json',
data: userlocat, data: userlocat,
success: (result) => { success: (result) => {
// console.log(result); // console.log(result);
}, },
}) })
}, },
// fail: () => wx.showToast({ title: '请点击右上角三个点并开启位置权限', icon: 'none', mask: true }) // fail: () => wx.showToast({ title: '请点击右上角三个点并开启位置权限', icon: 'none', mask: true })
}) })
} else { } else {
// console.log('userlocat', userlocat); // console.log('userlocat', userlocat);
that.setData({ that.setData({
address: userlocat.city address: userlocat.city
}) })
} }
}, },
searchInput(e) { searchInput(e) {
console.log('e',e); console.log('e',e);
let _this = this; let _this = this;
_this.setData({ _this.setData({
selectKeyWord: e.detail.value selectKeyWord: e.detail.value
}) })
_this.triggerEvent('search', e.detail.value); _this.triggerEvent('search', e.detail.value);
}, },
// 获取店铺区域列表 // 获取店铺区域列表
getShopAreaList() { getShopAreaList() {
let shopArea = wx.getStorageSync('shopArea'); let shopArea = wx.getStorageSync('shopArea');
let nowtime = Date.parse(new Date()) / 1000; let nowtime = Date.parse(new Date()) / 1000;
if (!shopArea || shopArea.overtime < nowtime) { if (!shopArea || shopArea.overtime < nowtime) {
wx.request({ wx.request({
url: apiAddr.get_community_area_list, url: apiAddr.get_community_area_list,
method: 'get', method: 'get',
header: { header: {
'Content-type': 'application/x-www-form-urlencoded' 'Content-type': 'application/x-www-form-urlencoded'
}, },
dataType: 'json', dataType: 'json',
success: (result) => { success: (result) => {
let { let {
data: { data: {
list list
} }
} = result; } = result;
if (list) { if (list) {
this.setData({ this.setData({
shopArea: list shopArea: list
}) })
let overtime = Date.parse(new Date()) / 1000 + 7200; let overtime = Date.parse(new Date()) / 1000 + 7200;
shopArea = { shopArea = {
list: list, list: list,
overtime: overtime overtime: overtime
}; };
wx.setStorageSync('shopArea', shopArea); wx.setStorageSync('shopArea', shopArea);
} }
}, },
}) })
} else { } else {
this.setData({ this.setData({
shopArea: shopArea.list shopArea: shopArea.list
}) })
// setData(this, 'shopArea', shopArea.list); // setData(this, 'shopArea', shopArea.list);
} }
}, },
}, },
lifetimes: { lifetimes: {
attached: function () { attached: function () {
// 组件被添加到页面节点树时执行 // 组件被添加到页面节点树时执行
this.getAddress(); this.getAddress();
this.getShopAreaList(); this.getShopAreaList();
}, },
}, },
}) })

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,21 +1,21 @@
<view class="search"> <view class="search">
<view class="locat" catchtap="goPagesLink"> <view class="locat" catchtap="goPagesLink">
<image class="local_left_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/location.png" mode=""/> <image class="local_left_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/location.png" mode=""/>
<text class="local_city">{{address}}</text> <text class="local_city">{{address}}</text>
<van-icon name="arrow-down" color="#FF512A " /> <van-icon name="arrow-down" color="#2583FF " />
</view> </view>
<view class='search_bar'> <view class='search_bar'>
<image class="search_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_36.png" mode=""/> <image class="search_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_36.png" mode=""/>
<!-- bindinput="searchInput" --> <!-- bindinput="searchInput" -->
<!-- bindblur="searchInput" --> <!-- bindblur="searchInput" -->
<input <input
class="search_input" class="search_input"
placeholder='输入搜索的社区名称' placeholder='输入搜索的社区名称'
confirm-type='search' confirm-type='search'
bindinput="searchInput" bindinput="searchInput"
bindconfirm="searchInput" bindconfirm="searchInput"
value="{{ selectKeyWord }}" value="{{ selectKeyWord }}"
/> />
<!-- <image class="search_qrcode" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_49.png" mode=""/> --> <!-- <image class="search_qrcode" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_49.png" mode=""/> -->
</view> </view>
</view> </view>

View File

@ -1,52 +1,52 @@
.container { .container {
background: #F9F9F9; background: #F9F9F9;
} }
.search { .search {
width: 100%; width: 100%;
height: 120rpx; height: 120rpx;
display: flex; display: flex;
background: #F9F9F9; background: #F9F9F9;
padding-top: 30rpx; padding-top: 30rpx;
padding-bottom: 30rpx; padding-bottom: 30rpx;
padding-left: 21rpx; padding-left: 21rpx;
} }
.locat { .locat {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.local_left_icon { .local_left_icon {
width: 34rpx; width: 34rpx;
height: 34rpx; height: 34rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
.local_city { .local_city {
font-weight: 400; font-weight: 400;
font-size: 26rpx; font-size: 26rpx;
color: #000000; color: #000000;
margin-right: 13rpx; margin-right: 13rpx;
} }
.search_bar { .search_bar {
width: 536rpx; width: 536rpx;
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
margin-left: 24rpx; margin-left: 24rpx;
margin-right: 20rpx; margin-right: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
background: #FFFFFF; background: #FFFFFF;
flex: 1; flex: 1;
} }
.search_input { .search_input {
flex: 1; flex: 1;
} }
.search_icon { .search_icon {
margin-left: 30rpx; margin-left: 30rpx;
margin-right: 15rpx; margin-right: 15rpx;
width: 33rpx; width: 33rpx;
height: 33rpx; height: 33rpx;
} }
.search_qrcode { .search_qrcode {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
margin-right: 27rpx; margin-right: 27rpx;
} }

View File

@ -1,121 +1,121 @@
import { doNavigateWithUser } from '../../utils/helper'; import { doNavigateWithUser } from '../../utils/helper';
import { isObjEmpty } from '../../utils/index'; import { isObjEmpty } from '../../utils/index';
import { img_url } from '../../utils/util'; import { img_url } from '../../utils/util';
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
item: { // 循环项 item: { // 循环项
type: Object, type: Object,
value: null, value: null,
}, },
type: { type: {
type: String, type: String,
value: '' value: ''
}, },
isLast: { isLast: {
type: Boolean, type: Boolean,
value: false value: false
}, },
joinType:{ joinType:{
type:String, type:String,
value:"2" value:"2"
} }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
picUrl: img_url, picUrl: img_url,
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
// 导航触发父组件方法 // 导航触发父组件方法
handleOptionClick() { handleOptionClick() {
const { item } = this.data; const { item } = this.data;
let openParmas = { let openParmas = {
latitude: Number(item.lat), latitude: Number(item.lat),
longitude: Number(item.lng), longitude: Number(item.lng),
name: item.name, name: item.name,
address: item.addr, address: item.addr,
} }
if (!isObjEmpty(openParmas)) { if (!isObjEmpty(openParmas)) {
Object.assign(openParmas, this.bMapTransQQMap(openParmas.longitude, openParmas.latitude)); Object.assign(openParmas, this.bMapTransQQMap(openParmas.longitude, openParmas.latitude));
wx.openLocation(openParmas); wx.openLocation(openParmas);
} }
}, },
// 地图转腾讯地图 // 地图转腾讯地图
bMapTransQQMap: function (lng, lat) { bMapTransQQMap: function (lng, lat) {
return { return {
longitude: lng, longitude: lng,
latitude: lat latitude: lat
}; };
}, },
//拨打电话触发事件 //拨打电话触发事件
headlePhoneClick() { headlePhoneClick() {
const { const {
item item
} = this.data; } = this.data;
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: item.tel phoneNumber: item.tel
}) })
}, },
//进入小区 //进入小区
headerEnterClick() { headerEnterClick() {
const { const {
item, item,
type type
} = this.data; } = this.data;
if (type) { if (type) {
console.log('共享空间点击事件'); console.log('共享空间点击事件');
return; return;
} }
doNavigateWithUser({ doNavigateWithUser({
url: `/packages/community/dwelling/index?title=${item.name}&id=${item.community_id}` url: `/packages/community/dwelling/index?title=${item.name}&id=${item.community_id}`
}) })
}, },
headerEnterClick2(e){ headerEnterClick2(e){
let that = this let that = this
if(that.data.joinType == 3){ if(that.data.joinType == 3){
let community_id = e.currentTarget.dataset.id; let community_id = e.currentTarget.dataset.id;
let name = e.currentTarget.dataset.name; let name = e.currentTarget.dataset.name;
let that= this let that= this
that.triggerEvent('chooseCommunity',{ that.triggerEvent('chooseCommunity',{
name,community_id name,community_id
}) })
wx.navigateBack({ wx.navigateBack({
delta:1 delta:1
}) })
}else{ }else{
console.log(456); console.log(456);
that.headerEnterClick() that.headerEnterClick()
} }
}, },
//选择小区 //选择小区
chooseClick(e){ chooseClick(e){
let community_id = e.currentTarget.dataset.id; let community_id = e.currentTarget.dataset.id;
let name = e.currentTarget.dataset.name; let name = e.currentTarget.dataset.name;
let that= this let that= this
// that.triggerEvent('chooseCommunity',{ // that.triggerEvent('chooseCommunity',{
// name,community_id // name,community_id
// }) // })
wx.setStorageSync('currentCommunity', name) wx.setStorageSync('currentCommunity', name)
wx.setStorageSync('currentCommunityId', community_id) wx.setStorageSync('currentCommunityId', community_id)
wx.navigateBack({ wx.navigateBack({
delta:1 delta:1
}) })
}, },
} }
}) })

View File

@ -1,4 +1,4 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {}
} }

View File

@ -1,31 +1,31 @@
<view class="container" bind:tap="headerEnterClick2" data-id="{{item.community_id}}" data-name="{{item.name}}"> <view class="container" bind:tap="headerEnterClick2" data-id="{{item.community_id}}" data-name="{{item.name}}">
<image class="left_logo" src="{{picUrl}}{{item.pic}}" mode="aspectFill"/> <image class="left_logo" src="{{picUrl}}{{item.pic}}" mode="aspectFill"/>
<view class="right {{isLast && 'no_bottom'}}"> <view class="right {{isLast && 'no_bottom'}}">
<view class="header"> <view class="header">
<view class="title">{{item.name}}</view> <view class="title">{{item.name}}</view>
<view class="distance" wx:if="{{item.distance}}">{{item.distance}}</view> <view class="distance" wx:if="{{item.distance}}">{{item.distance}}</view>
</view> </view>
<view class="center">物业公司:{{item.shop.shop_name}}</view> <view class="center">物业公司:{{item.shop.shop_name}}</view>
<view class="address"> <view class="address">
<image class="address_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_50.png" mode=""/> <image class="address_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_50.png" mode=""/>
<view class="text-container"> <view class="text-container">
<text>{{item.addr}}</text> <text>{{item.addr}}</text>
</view> </view>
</view> </view>
<view class="bottom"> <view class="bottom">
<view class="bottom_left"> <view class="bottom_left">
<view class="btn" catch:tap="handleOptionClick"> <view class="btn" catch:tap="handleOptionClick">
<image class="btn_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Send.png" mode="aspectFill"/> <image class="btn_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Send.png" mode="aspectFill"/>
导航 导航
</view> </view>
<view class="btn mobile" catch:tap="headlePhoneClick"> <view class="btn mobile" catch:tap="headlePhoneClick">
<image class="btn_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Phone-telephone.png" mode=""/> <image class="btn_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Phone-telephone.png" mode=""/>
电话 电话
</view> </view>
</view> </view>
<view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 1}}">前往预定</view> <view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 1}}">前往预定</view>
<view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 2}}">进入小区</view> <view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 2}}">进入小区</view>
<view class="bottom_right" catch:tap="chooseClick" wx:if="{{joinType == 3}}" data-id="{{item.community_id}}" data-name="{{item.name}}">选择小区</view> <view class="bottom_right" catch:tap="chooseClick" wx:if="{{joinType == 3}}" data-id="{{item.community_id}}" data-name="{{item.name}}">选择小区</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,99 +1,99 @@
.container { .container {
display: flex; display: flex;
padding-top: 32rpx; padding-top: 32rpx;
} }
.left_logo { .left_logo {
width: 180rpx !important; width: 180rpx !important;
height: 180rpx !important; height: 180rpx !important;
margin-right: 30rpx; margin-right: 30rpx;
margin-left: 19rpx; margin-left: 19rpx;
} }
.right { .right {
flex: 1; flex: 1;
margin-right: 21rpx; margin-right: 21rpx;
border-bottom: 1rpx solid #E6E6E6; border-bottom: 1rpx solid #E6E6E6;
max-width: 460rpx; max-width: 460rpx;
} }
.no_bottom { .no_bottom {
border-bottom: none; border-bottom: none;
} }
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.title { .title {
font-weight: 400; font-weight: 400;
font-size: 32rpx; font-size: 32rpx;
color: #000000; color: #000000;
margin-bottom: 14rpx; margin-bottom: 14rpx;
} }
.distance { .distance {
font-weight: 400; font-weight: 400;
font-size: 22rpx; font-size: 22rpx;
color: rgba(168,104,43,0.8); color: rgba(168,104,43,0.8);
} }
.center { .center {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #555555; color: #555555;
margin-bottom: 18rpx; margin-bottom: 18rpx;
} }
.address { .address {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
margin-bottom: 25rpx; margin-bottom: 25rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.address_icon { .address_icon {
display: inline-block; display: inline-block;
width: 24rpx; width: 24rpx;
height: 26rpx; height: 26rpx;
margin-right: 12rpx; margin-right: 12rpx;
} }
.text-container { .text-container {
flex: 1; flex: 1;
white-space: nowrap; /* 强制文本在一行内显示 */ white-space: nowrap; /* 强制文本在一行内显示 */
overflow: hidden; /* 隐藏超出容器的文本 */ overflow: hidden; /* 隐藏超出容器的文本 */
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.bottom { .bottom {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 35rpx; margin-bottom: 35rpx;
} }
.bottom_left { .bottom_left {
} }
.btn { .btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
background: rgba(255,81,42,0.1); background: rgba(255,81,42,0.1);
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
padding: 7rpx 22rpx 7rpx 0; padding: 7rpx 22rpx 7rpx 0;
} }
.mobile { .mobile {
background: #FFF2DA; background: #FFF2DA;
margin-left: 20rpx; margin-left: 20rpx;
} }
.btn_icon { .btn_icon {
display: inline-block; display: inline-block;
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
margin-right: 9rpx; margin-right: 9rpx;
margin-left: 11rpx; margin-left: 11rpx;
} }
.bottom_right { .bottom_right {
display: inline-block; display: inline-block;
font-weight: 400; font-weight: 400;
font-size: 26rpx; font-size: 26rpx;
color: #FFFFFF; color: #FFFFFF;
padding: 10rpx 23rpx; padding: 10rpx 23rpx;
background: #D5AC66; background: #D5AC66;
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
} }

View File

@ -1,10 +1,10 @@
export const stateType = { export const stateType = {
1: '待付款', 1: '待付款',
2: '已付款', 2: '已付款',
3: '已接单', 3: '已接单',
4: '退款中', 4: '退款中',
5: '已退款', 5: '已退款',
6: '退单中', 6: '退单中',
7: '已退单', 7: '已退单',
8: '已完成' 8: '已完成'
} }

BIN
miniprogram_npm.zip Normal file

Binary file not shown.

View File

@ -1 +1 @@
export {}; export {};

View File

@ -1,78 +1,78 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var button_1 = require("../mixins/button"); var button_1 = require("../mixins/button");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
classes: ['list-class'], classes: ['list-class'],
mixins: [button_1.button], mixins: [button_1.button],
props: { props: {
show: Boolean, show: Boolean,
title: String, title: String,
cancelText: String, cancelText: String,
description: String, description: String,
round: { round: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
zIndex: { zIndex: {
type: Number, type: Number,
value: 100, value: 100,
}, },
actions: { actions: {
type: Array, type: Array,
value: [], value: [],
}, },
overlay: { overlay: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
closeOnClickOverlay: { closeOnClickOverlay: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
closeOnClickAction: { closeOnClickAction: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
safeAreaInsetBottom: { safeAreaInsetBottom: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
rootPortal: { rootPortal: {
type: Boolean, type: Boolean,
value: false, value: false,
}, },
}, },
methods: { methods: {
onSelect: function (event) { onSelect: function (event) {
var _this = this; var _this = this;
var index = event.currentTarget.dataset.index; var index = event.currentTarget.dataset.index;
var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile; var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile;
var item = actions[index]; var item = actions[index];
if (item) { if (item) {
this.$emit('select', item); this.$emit('select', item);
if (closeOnClickAction) { if (closeOnClickAction) {
this.onClose(); this.onClose();
} }
if (item.openType === 'getUserInfo' && canIUseGetUserProfile) { if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({ wx.getUserProfile({
desc: item.getUserProfileDesc || ' ', desc: item.getUserProfileDesc || ' ',
complete: function (userProfile) { complete: function (userProfile) {
_this.$emit('getuserinfo', userProfile); _this.$emit('getuserinfo', userProfile);
}, },
}); });
} }
} }
}, },
onCancel: function () { onCancel: function () {
this.$emit('cancel'); this.$emit('cancel');
}, },
onClose: function () { onClose: function () {
this.$emit('close'); this.$emit('close');
}, },
onClickOverlay: function () { onClickOverlay: function () {
this.$emit('click-overlay'); this.$emit('click-overlay');
this.onClose(); this.onClose();
}, },
}, },
}); });

View File

@ -1,8 +1,8 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-icon": "../icon/index", "van-icon": "../icon/index",
"van-popup": "../popup/index", "van-popup": "../popup/index",
"van-loading": "../loading/index" "van-loading": "../loading/index"
} }
} }

View File

@ -1,70 +1,70 @@
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<van-popup <van-popup
show="{{ show }}" show="{{ show }}"
position="bottom" position="bottom"
round="{{ round }}" round="{{ round }}"
z-index="{{ zIndex }}" z-index="{{ zIndex }}"
overlay="{{ overlay }}" overlay="{{ overlay }}"
custom-class="van-action-sheet custom-class" custom-class="van-action-sheet custom-class"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}" safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}" root-portal="{{ rootPortal }}"
bind:close="onClickOverlay" bind:close="onClickOverlay"
> >
<view wx:if="{{ title }}" class="van-action-sheet__header"> <view wx:if="{{ title }}" class="van-action-sheet__header">
{{ title }} {{ title }}
<van-icon <van-icon
name="cross" name="cross"
custom-class="van-action-sheet__close" custom-class="van-action-sheet__close"
bind:click="onClose" bind:click="onClose"
/> />
</view> </view>
<view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom"> <view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom">
{{ description }} {{ description }}
</view> </view>
<view wx:if="{{ actions && actions.length }}" class="list-class"> <view wx:if="{{ actions && actions.length }}" class="list-class">
<!-- button外包一层view防止actions动态变化导致渲染时button被打散 --> <!-- button外包一层view防止actions动态变化导致渲染时button被打散 -->
<button <button
wx:for="{{ actions }}" wx:for="{{ actions }}"
wx:key="index" wx:key="index"
open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}" open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}" style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}" class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover" hover-class="van-action-sheet__item--hover"
data-index="{{ index }}" data-index="{{ index }}"
bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}" bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
binderror="onError" binderror="onError"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"
lang="{{ lang }}" lang="{{ lang }}"
session-from="{{ sessionFrom }}" session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}" send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}" send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
> >
<block wx:if="{{ !item.loading }}"> <block wx:if="{{ !item.loading }}">
{{ item.name }} {{ item.name }}
<view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view> <view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view>
</block> </block>
<van-loading wx:else custom-class="van-action-sheet__loading" size="22px" /> <van-loading wx:else custom-class="van-action-sheet__loading" size="22px" />
</button> </button>
</view> </view>
<slot /> <slot />
<block wx:if="{{ cancelText }}"> <block wx:if="{{ cancelText }}">
<view class="van-action-sheet__gap" /> <view class="van-action-sheet__gap" />
<view <view
class="van-action-sheet__cancel" class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover" hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70" hover-stay-time="70"
bind:tap="onCancel" bind:tap="onCancel"
> >
{{ cancelText }} {{ cancelText }}
</view> </view>
</block> </block>
</van-popup> </van-popup>

View File

@ -1 +1 @@
export {}; export {};

View File

@ -1,235 +1,235 @@
"use strict"; "use strict";
var __assign = (this && this.__assign) || function () { var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) { __assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) { for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i]; s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p]; t[p] = s[p];
} }
return t; return t;
}; };
return __assign.apply(this, arguments); return __assign.apply(this, arguments);
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var shared_1 = require("../picker/shared"); var shared_1 = require("../picker/shared");
var utils_1 = require("../common/utils"); var utils_1 = require("../common/utils");
var EMPTY_CODE = '000000'; var EMPTY_CODE = '000000';
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
classes: ['active-class', 'toolbar-class', 'column-class'], classes: ['active-class', 'toolbar-class', 'column-class'],
props: __assign(__assign({}, shared_1.pickerProps), { showToolbar: { props: __assign(__assign({}, shared_1.pickerProps), { showToolbar: {
type: Boolean, type: Boolean,
value: true, value: true,
}, value: { }, value: {
type: String, type: String,
observer: function (value) { observer: function (value) {
this.code = value; this.code = value;
this.setValues(); this.setValues();
}, },
}, areaList: { }, areaList: {
type: Object, type: Object,
value: {}, value: {},
observer: 'setValues', observer: 'setValues',
}, columnsNum: { }, columnsNum: {
type: null, type: null,
value: 3, value: 3,
}, columnsPlaceholder: { }, columnsPlaceholder: {
type: Array, type: Array,
observer: function (val) { observer: function (val) {
this.setData({ this.setData({
typeToColumnsPlaceholder: { typeToColumnsPlaceholder: {
province: val[0] || '', province: val[0] || '',
city: val[1] || '', city: val[1] || '',
county: val[2] || '', county: val[2] || '',
}, },
}); });
}, },
} }), } }),
data: { data: {
columns: [{ values: [] }, { values: [] }, { values: [] }], columns: [{ values: [] }, { values: [] }, { values: [] }],
typeToColumnsPlaceholder: {}, typeToColumnsPlaceholder: {},
}, },
mounted: function () { mounted: function () {
var _this = this; var _this = this;
(0, utils_1.requestAnimationFrame)(function () { (0, utils_1.requestAnimationFrame)(function () {
_this.setValues(); _this.setValues();
}); });
}, },
methods: { methods: {
getPicker: function () { getPicker: function () {
if (this.picker == null) { if (this.picker == null) {
this.picker = this.selectComponent('.van-area__picker'); this.picker = this.selectComponent('.van-area__picker');
} }
return this.picker; return this.picker;
}, },
onCancel: function (event) { onCancel: function (event) {
this.emit('cancel', event.detail); this.emit('cancel', event.detail);
}, },
onConfirm: function (event) { onConfirm: function (event) {
var index = event.detail.index; var index = event.detail.index;
var value = event.detail.value; var value = event.detail.value;
value = this.parseValues(value); value = this.parseValues(value);
this.emit('confirm', { value: value, index: index }); this.emit('confirm', { value: value, index: index });
}, },
emit: function (type, detail) { emit: function (type, detail) {
detail.values = detail.value; detail.values = detail.value;
delete detail.value; delete detail.value;
this.$emit(type, detail); this.$emit(type, detail);
}, },
parseValues: function (values) { parseValues: function (values) {
var columnsPlaceholder = this.data.columnsPlaceholder; var columnsPlaceholder = this.data.columnsPlaceholder;
return values.map(function (value, index) { return values.map(function (value, index) {
if (value && if (value &&
(!value.code || value.name === columnsPlaceholder[index])) { (!value.code || value.name === columnsPlaceholder[index])) {
return __assign(__assign({}, value), { code: '', name: '' }); return __assign(__assign({}, value), { code: '', name: '' });
} }
return value; return value;
}); });
}, },
onChange: function (event) { onChange: function (event) {
var _this = this; var _this = this;
var _a; var _a;
var _b = event.detail, index = _b.index, picker = _b.picker, value = _b.value; var _b = event.detail, index = _b.index, picker = _b.picker, value = _b.value;
this.code = value[index].code; this.code = value[index].code;
(_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(function () { (_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(function () {
_this.$emit('change', { _this.$emit('change', {
picker: picker, picker: picker,
values: _this.parseValues(picker.getValues()), values: _this.parseValues(picker.getValues()),
index: index, index: index,
}); });
}); });
}, },
getConfig: function (type) { getConfig: function (type) {
var areaList = this.data.areaList; var areaList = this.data.areaList;
return (areaList && areaList["".concat(type, "_list")]) || {}; return (areaList && areaList["".concat(type, "_list")]) || {};
}, },
getList: function (type, code) { getList: function (type, code) {
if (type !== 'province' && !code) { if (type !== 'province' && !code) {
return []; return [];
} }
var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder; var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder;
var list = this.getConfig(type); var list = this.getConfig(type);
var result = Object.keys(list).map(function (code) { return ({ var result = Object.keys(list).map(function (code) { return ({
code: code, code: code,
name: list[code], name: list[code],
}); }); }); });
if (code != null) { if (code != null) {
// oversea code // oversea code
if (code[0] === '9' && type === 'city') { if (code[0] === '9' && type === 'city') {
code = '9'; code = '9';
} }
result = result.filter(function (item) { return item.code.indexOf(code) === 0; }); result = result.filter(function (item) { return item.code.indexOf(code) === 0; });
} }
if (typeToColumnsPlaceholder[type] && result.length) { if (typeToColumnsPlaceholder[type] && result.length) {
// set columns placeholder // set columns placeholder
var codeFill = type === 'province' var codeFill = type === 'province'
? '' ? ''
: type === 'city' : type === 'city'
? EMPTY_CODE.slice(2, 4) ? EMPTY_CODE.slice(2, 4)
: EMPTY_CODE.slice(4, 6); : EMPTY_CODE.slice(4, 6);
result.unshift({ result.unshift({
code: "".concat(code).concat(codeFill), code: "".concat(code).concat(codeFill),
name: typeToColumnsPlaceholder[type], name: typeToColumnsPlaceholder[type],
}); });
} }
return result; return result;
}, },
getIndex: function (type, code) { getIndex: function (type, code) {
var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
var list = this.getList(type, code.slice(0, compareNum - 2)); var list = this.getList(type, code.slice(0, compareNum - 2));
// oversea code // oversea code
if (code[0] === '9' && type === 'province') { if (code[0] === '9' && type === 'province') {
compareNum = 1; compareNum = 1;
} }
code = code.slice(0, compareNum); code = code.slice(0, compareNum);
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
if (list[i].code.slice(0, compareNum) === code) { if (list[i].code.slice(0, compareNum) === code) {
return i; return i;
} }
} }
return 0; return 0;
}, },
setValues: function () { setValues: function () {
var picker = this.getPicker(); var picker = this.getPicker();
if (!picker) { if (!picker) {
return; return;
} }
var code = this.code || this.getDefaultCode(); var code = this.code || this.getDefaultCode();
var provinceList = this.getList('province'); var provinceList = this.getList('province');
var cityList = this.getList('city', code.slice(0, 2)); var cityList = this.getList('city', code.slice(0, 2));
var stack = []; var stack = [];
var indexes = []; var indexes = [];
var columnsNum = this.data.columnsNum; var columnsNum = this.data.columnsNum;
if (columnsNum >= 1) { if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, provinceList, false)); stack.push(picker.setColumnValues(0, provinceList, false));
indexes.push(this.getIndex('province', code)); indexes.push(this.getIndex('province', code));
} }
if (columnsNum >= 2) { if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, cityList, false)); stack.push(picker.setColumnValues(1, cityList, false));
indexes.push(this.getIndex('city', code)); indexes.push(this.getIndex('city', code));
if (cityList.length && code.slice(2, 4) === '00') { if (cityList.length && code.slice(2, 4) === '00') {
code = cityList[0].code; code = cityList[0].code;
} }
} }
if (columnsNum === 3) { if (columnsNum === 3) {
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false)); stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
indexes.push(this.getIndex('county', code)); indexes.push(this.getIndex('county', code));
} }
return Promise.all(stack) return Promise.all(stack)
.catch(function () { }) .catch(function () { })
.then(function () { return picker.setIndexes(indexes); }) .then(function () { return picker.setIndexes(indexes); })
.catch(function () { }); .catch(function () { });
}, },
getDefaultCode: function () { getDefaultCode: function () {
var columnsPlaceholder = this.data.columnsPlaceholder; var columnsPlaceholder = this.data.columnsPlaceholder;
if (columnsPlaceholder.length) { if (columnsPlaceholder.length) {
return EMPTY_CODE; return EMPTY_CODE;
} }
var countyCodes = Object.keys(this.getConfig('county')); var countyCodes = Object.keys(this.getConfig('county'));
if (countyCodes[0]) { if (countyCodes[0]) {
return countyCodes[0]; return countyCodes[0];
} }
var cityCodes = Object.keys(this.getConfig('city')); var cityCodes = Object.keys(this.getConfig('city'));
if (cityCodes[0]) { if (cityCodes[0]) {
return cityCodes[0]; return cityCodes[0];
} }
return ''; return '';
}, },
getValues: function () { getValues: function () {
var picker = this.getPicker(); var picker = this.getPicker();
if (!picker) { if (!picker) {
return []; return [];
} }
return this.parseValues(picker.getValues().filter(function (value) { return !!value; })); return this.parseValues(picker.getValues().filter(function (value) { return !!value; }));
}, },
getDetail: function () { getDetail: function () {
var values = this.getValues(); var values = this.getValues();
var area = { var area = {
code: '', code: '',
country: '', country: '',
province: '', province: '',
city: '', city: '',
county: '', county: '',
}; };
if (!values.length) { if (!values.length) {
return area; return area;
} }
var names = values.map(function (item) { return item.name; }); var names = values.map(function (item) { return item.name; });
area.code = values[values.length - 1].code; area.code = values[values.length - 1].code;
if (area.code[0] === '9') { if (area.code[0] === '9') {
area.country = names[1] || ''; area.country = names[1] || '';
area.province = names[2] || ''; area.province = names[2] || '';
} }
else { else {
area.province = names[0] || ''; area.province = names[0] || '';
area.city = names[1] || ''; area.city = names[1] || '';
area.county = names[2] || ''; area.county = names[2] || '';
} }
return area; return area;
}, },
reset: function (code) { reset: function (code) {
this.code = code || ''; this.code = code || '';
return this.setValues(); return this.setValues();
}, },
}, },
}); });

View File

@ -1,6 +1,6 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-picker": "../picker/index" "van-picker": "../picker/index"
} }
} }

View File

@ -1,20 +1,20 @@
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<van-picker <van-picker
class="van-area__picker" class="van-area__picker"
active-class="active-class" active-class="active-class"
toolbar-class="toolbar-class" toolbar-class="toolbar-class"
column-class="column-class" column-class="column-class"
show-toolbar="{{ showToolbar }}" show-toolbar="{{ showToolbar }}"
value-key="name" value-key="name"
title="{{ title }}" title="{{ title }}"
loading="{{ loading }}" loading="{{ loading }}"
columns="{{ computed.displayColumns(columns, columnsNum) }}" columns="{{ computed.displayColumns(columns, columnsNum) }}"
item-height="{{ itemHeight }}" item-height="{{ itemHeight }}"
visible-item-count="{{ visibleItemCount }}" visible-item-count="{{ visibleItemCount }}"
cancel-button-text="{{ cancelButtonText }}" cancel-button-text="{{ cancelButtonText }}"
confirm-button-text="{{ confirmButtonText }}" confirm-button-text="{{ confirmButtonText }}"
bind:change="onChange" bind:change="onChange"
bind:confirm="onConfirm" bind:confirm="onConfirm"
bind:cancel="onCancel" bind:cancel="onCancel"
/> />

View File

@ -1,8 +1,8 @@
/* eslint-disable */ /* eslint-disable */
function displayColumns(columns, columnsNum) { function displayColumns(columns, columnsNum) {
return columns.slice(0, +columnsNum); return columns.slice(0, +columnsNum);
} }
module.exports = { module.exports = {
displayColumns: displayColumns, displayColumns: displayColumns,
}; };

View File

@ -1 +1 @@
export {}; export {};

View File

@ -1,67 +1,67 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var button_1 = require("../mixins/button"); var button_1 = require("../mixins/button");
var version_1 = require("../common/version"); var version_1 = require("../common/version");
var mixins = [button_1.button]; var mixins = [button_1.button];
if ((0, version_1.canIUseFormFieldButton)()) { if ((0, version_1.canIUseFormFieldButton)()) {
mixins.push('wx://form-field-button'); mixins.push('wx://form-field-button');
} }
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
mixins: mixins, mixins: mixins,
classes: ['hover-class', 'loading-class'], classes: ['hover-class', 'loading-class'],
data: { data: {
baseStyle: '', baseStyle: '',
}, },
props: { props: {
formType: String, formType: String,
icon: String, icon: String,
classPrefix: { classPrefix: {
type: String, type: String,
value: 'van-icon', value: 'van-icon',
}, },
plain: Boolean, plain: Boolean,
block: Boolean, block: Boolean,
round: Boolean, round: Boolean,
square: Boolean, square: Boolean,
loading: Boolean, loading: Boolean,
hairline: Boolean, hairline: Boolean,
disabled: Boolean, disabled: Boolean,
loadingText: String, loadingText: String,
customStyle: String, customStyle: String,
loadingType: { loadingType: {
type: String, type: String,
value: 'circular', value: 'circular',
}, },
type: { type: {
type: String, type: String,
value: 'default', value: 'default',
}, },
dataset: null, dataset: null,
size: { size: {
type: String, type: String,
value: 'normal', value: 'normal',
}, },
loadingSize: { loadingSize: {
type: String, type: String,
value: '20px', value: '20px',
}, },
color: String, color: String,
}, },
methods: { methods: {
onClick: function (event) { onClick: function (event) {
var _this = this; var _this = this;
this.$emit('click', event); this.$emit('click', event);
var _a = this.data, canIUseGetUserProfile = _a.canIUseGetUserProfile, openType = _a.openType, getUserProfileDesc = _a.getUserProfileDesc, lang = _a.lang; var _a = this.data, canIUseGetUserProfile = _a.canIUseGetUserProfile, openType = _a.openType, getUserProfileDesc = _a.getUserProfileDesc, lang = _a.lang;
if (openType === 'getUserInfo' && canIUseGetUserProfile) { if (openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({ wx.getUserProfile({
desc: getUserProfileDesc || ' ', desc: getUserProfileDesc || ' ',
lang: lang || 'en', lang: lang || 'en',
complete: function (userProfile) { complete: function (userProfile) {
_this.$emit('getuserinfo', userProfile); _this.$emit('getuserinfo', userProfile);
}, },
}); });
} }
}, },
}, },
}); });

View File

@ -1,7 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-icon": "../icon/index", "van-icon": "../icon/index",
"van-loading": "../loading/index" "van-loading": "../loading/index"
} }
} }

View File

@ -1,56 +1,56 @@
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<button <button
id="{{ id || buttonId }}" id="{{ id || buttonId }}"
data-detail="{{ dataset }}" data-detail="{{ dataset }}"
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}" hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
lang="{{ lang }}" lang="{{ lang }}"
form-type="{{ formType }}" form-type="{{ formType }}"
style="{{ computed.rootStyle({ plain, color, customStyle }) }}" style="{{ computed.rootStyle({ plain, color, customStyle }) }}"
open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}" open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
session-from="{{ sessionFrom }}" session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}" send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}" send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
aria-label="{{ ariaLabel }}" aria-label="{{ ariaLabel }}"
bindtap="{{ disabled || loading ? '' : 'onClick' }}" bindtap="{{ disabled || loading ? '' : 'onClick' }}"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
bindgetrealtimephonenumber="onGetRealTimePhoneNumber" bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization" bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
binderror="onError" binderror="onError"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"
bindchooseavatar="onChooseAvatar" bindchooseavatar="onChooseAvatar"
> >
<block wx:if="{{ loading }}"> <block wx:if="{{ loading }}">
<van-loading <van-loading
custom-class="loading-class" custom-class="loading-class"
size="{{ loadingSize }}" size="{{ loadingSize }}"
type="{{ loadingType }}" type="{{ loadingType }}"
color="{{ computed.loadingColor({ type, color, plain }) }}" color="{{ computed.loadingColor({ type, color, plain }) }}"
/> />
<view wx:if="{{ loadingText }}" class="van-button__loading-text"> <view wx:if="{{ loadingText }}" class="van-button__loading-text">
{{ loadingText }} {{ loadingText }}
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<van-icon <van-icon
wx:if="{{ icon }}" wx:if="{{ icon }}"
size="1.2em" size="1.2em"
name="{{ icon }}" name="{{ icon }}"
class-prefix="{{ classPrefix }}" class-prefix="{{ classPrefix }}"
class="van-button__icon" class="van-button__icon"
custom-style="line-height: inherit;" custom-style="line-height: inherit;"
/> />
<view class="van-button__text"> <view class="van-button__text">
<slot /> <slot />
</view> </view>
</block> </block>
</button> </button>

View File

@ -1,39 +1,39 @@
/* eslint-disable */ /* eslint-disable */
var style = require('../wxs/style.wxs'); var style = require('../wxs/style.wxs');
function rootStyle(data) { function rootStyle(data) {
if (!data.color) { if (!data.color) {
return data.customStyle; return data.customStyle;
} }
var properties = { var properties = {
color: data.plain ? data.color : '#fff', color: data.plain ? data.color : '#fff',
background: data.plain ? null : data.color, background: data.plain ? null : data.color,
}; };
// hide border when color is linear-gradient // hide border when color is linear-gradient
if (data.color.indexOf('gradient') !== -1) { if (data.color.indexOf('gradient') !== -1) {
properties.border = 0; properties.border = 0;
} else { } else {
properties['border-color'] = data.color; properties['border-color'] = data.color;
} }
return style([properties, data.customStyle]); return style([properties, data.customStyle]);
} }
function loadingColor(data) { function loadingColor(data) {
if (data.plain) { if (data.plain) {
return data.color ? data.color : '#c9c9c9'; return data.color ? data.color : '#c9c9c9';
} }
if (data.type === 'default') { if (data.type === 'default') {
return '#c9c9c9'; return '#c9c9c9';
} }
return '#fff'; return '#fff';
} }
module.exports = { module.exports = {
rootStyle: rootStyle, rootStyle: rootStyle,
loadingColor: loadingColor, loadingColor: loadingColor,
}; };

View File

@ -1,70 +1,70 @@
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-calendar"> <view class="van-calendar">
<header <header
title="{{ title }}" title="{{ title }}"
showTitle="{{ showTitle }}" showTitle="{{ showTitle }}"
subtitle="{{ subtitle }}" subtitle="{{ subtitle }}"
showSubtitle="{{ showSubtitle }}" showSubtitle="{{ showSubtitle }}"
firstDayOfWeek="{{ firstDayOfWeek }}" firstDayOfWeek="{{ firstDayOfWeek }}"
bind:click-subtitle="onClickSubtitle" bind:click-subtitle="onClickSubtitle"
> >
<slot name="title" slot="title"></slot> <slot name="title" slot="title"></slot>
</header> </header>
<scroll-view <scroll-view
class="van-calendar__body" class="van-calendar__body"
scroll-y scroll-y
scroll-into-view="{{ scrollIntoView }}" scroll-into-view="{{ scrollIntoView }}"
> >
<month <month
wx:for="{{ computed.getMonths(minDate, maxDate) }}" wx:for="{{ computed.getMonths(minDate, maxDate) }}"
wx:key="index" wx:key="index"
id="month{{ index }}" id="month{{ index }}"
class="month" class="month"
data-date="{{ item }}" data-date="{{ item }}"
date="{{ item }}" date="{{ item }}"
type="{{ type }}" type="{{ type }}"
color="{{ color }}" color="{{ color }}"
minDate="{{ minDate }}" minDate="{{ minDate }}"
maxDate="{{ maxDate }}" maxDate="{{ maxDate }}"
showMark="{{ showMark }}" showMark="{{ showMark }}"
formatter="{{ formatter }}" formatter="{{ formatter }}"
rowHeight="{{ rowHeight }}" rowHeight="{{ rowHeight }}"
currentDate="{{ currentDate }}" currentDate="{{ currentDate }}"
showSubtitle="{{ showSubtitle }}" showSubtitle="{{ showSubtitle }}"
allowSameDay="{{ allowSameDay }}" allowSameDay="{{ allowSameDay }}"
showMonthTitle="{{ index !== 0 || !showSubtitle }}" showMonthTitle="{{ index !== 0 || !showSubtitle }}"
firstDayOfWeek="{{ firstDayOfWeek }}" firstDayOfWeek="{{ firstDayOfWeek }}"
bind:click="onClickDay" bind:click="onClickDay"
/> />
</scroll-view> </scroll-view>
<view <view
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}" class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
> >
<slot name="footer"></slot> <slot name="footer"></slot>
</view> </view>
<view <view
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}" class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
> >
<van-button <van-button
wx:if="{{ showConfirm }}" wx:if="{{ showConfirm }}"
round round
block block
type="danger" type="danger"
color="{{ color }}" color="{{ color }}"
custom-class="van-calendar__confirm" custom-class="van-calendar__confirm"
disabled="{{ computed.getButtonDisabled(type, currentDate, minRange) }}" disabled="{{ computed.getButtonDisabled(type, currentDate, minRange) }}"
nativeType="text" nativeType="text"
bind:click="onConfirm" bind:click="onConfirm"
> >
{{ {{
computed.getButtonDisabled(type, currentDate, minRange) computed.getButtonDisabled(type, currentDate, minRange)
? confirmDisabledText ? confirmDisabledText
: confirmText : confirmText
}} }}
</van-button> </van-button>
</view> </view>
</view> </view>

View File

@ -1 +1 @@
export {}; export {};

View File

@ -1,45 +1,45 @@
"use strict"; "use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) { if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i); if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i]; ar[i] = from[i];
} }
} }
return to.concat(ar || Array.prototype.slice.call(from)); return to.concat(ar || Array.prototype.slice.call(from));
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../../../common/component"); var component_1 = require("../../../common/component");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
props: { props: {
title: { title: {
type: String, type: String,
value: '日期选择', value: '日期选择',
}, },
subtitle: String, subtitle: String,
showTitle: Boolean, showTitle: Boolean,
showSubtitle: Boolean, showSubtitle: Boolean,
firstDayOfWeek: { firstDayOfWeek: {
type: Number, type: Number,
observer: 'initWeekDay', observer: 'initWeekDay',
}, },
}, },
data: { data: {
weekdays: [], weekdays: [],
}, },
created: function () { created: function () {
this.initWeekDay(); this.initWeekDay();
}, },
methods: { methods: {
initWeekDay: function () { initWeekDay: function () {
var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六']; var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六'];
var firstDayOfWeek = this.data.firstDayOfWeek || 0; var firstDayOfWeek = this.data.firstDayOfWeek || 0;
this.setData({ this.setData({
weekdays: __spreadArray(__spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7), true), defaultWeeks.slice(0, firstDayOfWeek), true), weekdays: __spreadArray(__spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7), true), defaultWeeks.slice(0, firstDayOfWeek), true),
}); });
}, },
onClickSubtitle: function (event) { onClickSubtitle: function (event) {
this.$emit('click-subtitle', event); this.$emit('click-subtitle', event);
}, },
}, },
}); });

View File

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

View File

@ -1,16 +1,16 @@
<view class="van-calendar__header"> <view class="van-calendar__header">
<block wx:if="{{ showTitle }}"> <block wx:if="{{ showTitle }}">
<view class="van-calendar__header-title"><slot name="title"></slot></view> <view class="van-calendar__header-title"><slot name="title"></slot></view>
<view class="van-calendar__header-title">{{ title }}</view> <view class="van-calendar__header-title">{{ title }}</view>
</block> </block>
<view wx:if="{{ showSubtitle }}" class="van-calendar__header-subtitle" bind:tap="onClickSubtitle"> <view wx:if="{{ showSubtitle }}" class="van-calendar__header-subtitle" bind:tap="onClickSubtitle">
{{ subtitle }} {{ subtitle }}
</view> </view>
<view class="van-calendar__weekdays"> <view class="van-calendar__weekdays">
<view wx:for="{{ weekdays }}" wx:key="index" class="van-calendar__weekday"> <view wx:for="{{ weekdays }}" wx:key="index" class="van-calendar__weekday">
{{ item }} {{ item }}
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,6 +1,6 @@
export interface Day { export interface Day {
date: Date; date: Date;
type: string; type: string;
text: number; text: number;
bottomInfo?: string; bottomInfo?: string;
} }

View File

@ -1,158 +1,158 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../../../common/component"); var component_1 = require("../../../common/component");
var utils_1 = require("../../utils"); var utils_1 = require("../../utils");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
props: { props: {
date: { date: {
type: null, type: null,
observer: 'setDays', observer: 'setDays',
}, },
type: { type: {
type: String, type: String,
observer: 'setDays', observer: 'setDays',
}, },
color: String, color: String,
minDate: { minDate: {
type: null, type: null,
observer: 'setDays', observer: 'setDays',
}, },
maxDate: { maxDate: {
type: null, type: null,
observer: 'setDays', observer: 'setDays',
}, },
showMark: Boolean, showMark: Boolean,
rowHeight: null, rowHeight: null,
formatter: { formatter: {
type: null, type: null,
observer: 'setDays', observer: 'setDays',
}, },
currentDate: { currentDate: {
type: null, type: null,
observer: 'setDays', observer: 'setDays',
}, },
firstDayOfWeek: { firstDayOfWeek: {
type: Number, type: Number,
observer: 'setDays', observer: 'setDays',
}, },
allowSameDay: Boolean, allowSameDay: Boolean,
showSubtitle: Boolean, showSubtitle: Boolean,
showMonthTitle: Boolean, showMonthTitle: Boolean,
}, },
data: { data: {
visible: true, visible: true,
days: [], days: [],
}, },
methods: { methods: {
onClick: function (event) { onClick: function (event) {
var index = event.currentTarget.dataset.index; var index = event.currentTarget.dataset.index;
var item = this.data.days[index]; var item = this.data.days[index];
if (item.type !== 'disabled') { if (item.type !== 'disabled') {
this.$emit('click', item); this.$emit('click', item);
} }
}, },
setDays: function () { setDays: function () {
var days = []; var days = [];
var startDate = new Date(this.data.date); var startDate = new Date(this.data.date);
var year = startDate.getFullYear(); var year = startDate.getFullYear();
var month = startDate.getMonth(); var month = startDate.getMonth();
var totalDay = (0, utils_1.getMonthEndDay)(startDate.getFullYear(), startDate.getMonth() + 1); var totalDay = (0, utils_1.getMonthEndDay)(startDate.getFullYear(), startDate.getMonth() + 1);
for (var day = 1; day <= totalDay; day++) { for (var day = 1; day <= totalDay; day++) {
var date = new Date(year, month, day); var date = new Date(year, month, day);
var type = this.getDayType(date); var type = this.getDayType(date);
var config = { var config = {
date: date, date: date,
type: type, type: type,
text: day, text: day,
bottomInfo: this.getBottomInfo(type), bottomInfo: this.getBottomInfo(type),
}; };
if (this.data.formatter) { if (this.data.formatter) {
config = this.data.formatter(config); config = this.data.formatter(config);
} }
days.push(config); days.push(config);
} }
this.setData({ days: days }); this.setData({ days: days });
}, },
getMultipleDayType: function (day) { getMultipleDayType: function (day) {
var currentDate = this.data.currentDate; var currentDate = this.data.currentDate;
if (!Array.isArray(currentDate)) { if (!Array.isArray(currentDate)) {
return ''; return '';
} }
var isSelected = function (date) { var isSelected = function (date) {
return currentDate.some(function (item) { return (0, utils_1.compareDay)(item, date) === 0; }); return currentDate.some(function (item) { return (0, utils_1.compareDay)(item, date) === 0; });
}; };
if (isSelected(day)) { if (isSelected(day)) {
var prevDay = (0, utils_1.getPrevDay)(day); var prevDay = (0, utils_1.getPrevDay)(day);
var nextDay = (0, utils_1.getNextDay)(day); var nextDay = (0, utils_1.getNextDay)(day);
var prevSelected = isSelected(prevDay); var prevSelected = isSelected(prevDay);
var nextSelected = isSelected(nextDay); var nextSelected = isSelected(nextDay);
if (prevSelected && nextSelected) { if (prevSelected && nextSelected) {
return 'multiple-middle'; return 'multiple-middle';
} }
if (prevSelected) { if (prevSelected) {
return 'end'; return 'end';
} }
return nextSelected ? 'start' : 'multiple-selected'; return nextSelected ? 'start' : 'multiple-selected';
} }
return ''; return '';
}, },
getRangeDayType: function (day) { getRangeDayType: function (day) {
var _a = this.data, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay; var _a = this.data, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay;
if (!Array.isArray(currentDate)) { if (!Array.isArray(currentDate)) {
return ''; return '';
} }
var startDay = currentDate[0], endDay = currentDate[1]; var startDay = currentDate[0], endDay = currentDate[1];
if (!startDay) { if (!startDay) {
return ''; return '';
} }
var compareToStart = (0, utils_1.compareDay)(day, startDay); var compareToStart = (0, utils_1.compareDay)(day, startDay);
if (!endDay) { if (!endDay) {
return compareToStart === 0 ? 'start' : ''; return compareToStart === 0 ? 'start' : '';
} }
var compareToEnd = (0, utils_1.compareDay)(day, endDay); var compareToEnd = (0, utils_1.compareDay)(day, endDay);
if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) { if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) {
return 'start-end'; return 'start-end';
} }
if (compareToStart === 0) { if (compareToStart === 0) {
return 'start'; return 'start';
} }
if (compareToEnd === 0) { if (compareToEnd === 0) {
return 'end'; return 'end';
} }
if (compareToStart > 0 && compareToEnd < 0) { if (compareToStart > 0 && compareToEnd < 0) {
return 'middle'; return 'middle';
} }
return ''; return '';
}, },
getDayType: function (day) { getDayType: function (day) {
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, currentDate = _a.currentDate; var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, currentDate = _a.currentDate;
if ((0, utils_1.compareDay)(day, minDate) < 0 || (0, utils_1.compareDay)(day, maxDate) > 0) { if ((0, utils_1.compareDay)(day, minDate) < 0 || (0, utils_1.compareDay)(day, maxDate) > 0) {
return 'disabled'; return 'disabled';
} }
if (type === 'single') { if (type === 'single') {
return (0, utils_1.compareDay)(day, currentDate) === 0 ? 'selected' : ''; return (0, utils_1.compareDay)(day, currentDate) === 0 ? 'selected' : '';
} }
if (type === 'multiple') { if (type === 'multiple') {
return this.getMultipleDayType(day); return this.getMultipleDayType(day);
} }
/* istanbul ignore else */ /* istanbul ignore else */
if (type === 'range') { if (type === 'range') {
return this.getRangeDayType(day); return this.getRangeDayType(day);
} }
return ''; return '';
}, },
getBottomInfo: function (type) { getBottomInfo: function (type) {
if (this.data.type === 'range') { if (this.data.type === 'range') {
if (type === 'start') { if (type === 'start') {
return '开始'; return '开始';
} }
if (type === 'end') { if (type === 'end') {
return '结束'; return '结束';
} }
if (type === 'start-end') { if (type === 'start-end') {
return '开始/结束'; return '开始/结束';
} }
} }
}, },
}, },
}); });

View File

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

View File

@ -1,39 +1,39 @@
<wxs src="./index.wxs" module="computed"></wxs> <wxs src="./index.wxs" module="computed"></wxs>
<wxs src="../../../wxs/utils.wxs" module="utils" /> <wxs src="../../../wxs/utils.wxs" module="utils" />
<view class="van-calendar__month" style="{{ computed.getMonthStyle(visible, date, rowHeight) }}"> <view class="van-calendar__month" style="{{ computed.getMonthStyle(visible, date, rowHeight) }}">
<view wx:if="{{ showMonthTitle }}" class="van-calendar__month-title"> <view wx:if="{{ showMonthTitle }}" class="van-calendar__month-title">
{{ computed.formatMonthTitle(date) }} {{ computed.formatMonthTitle(date) }}
</view> </view>
<view wx:if="{{ visible }}" class="van-calendar__days"> <view wx:if="{{ visible }}" class="van-calendar__days">
<view wx:if="{{ showMark }}" class="van-calendar__month-mark"> <view wx:if="{{ showMark }}" class="van-calendar__month-mark">
{{ computed.getMark(date) }} {{ computed.getMark(date) }}
</view> </view>
<view <view
wx:for="{{ days }}" wx:for="{{ days }}"
wx:key="index" wx:key="index"
style="{{ computed.getDayStyle(item.type, index, date, rowHeight, color, firstDayOfWeek) }}" style="{{ computed.getDayStyle(item.type, index, date, rowHeight, color, firstDayOfWeek) }}"
class="{{ utils.bem('calendar__day', [item.type]) }} {{ item.className }}" class="{{ utils.bem('calendar__day', [item.type]) }} {{ item.className }}"
data-index="{{ index }}" data-index="{{ index }}"
bindtap="onClick" bindtap="onClick"
> >
<view wx:if="{{ item.type === 'selected' }}" class="van-calendar__selected-day" style="width: {{ rowHeight }}px; height: {{ rowHeight }}px; background: {{ color }}"> <view wx:if="{{ item.type === 'selected' }}" class="van-calendar__selected-day" style="width: {{ rowHeight }}px; height: {{ rowHeight }}px; background: {{ color }}">
<view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view> <view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view>
{{ item.text }} {{ item.text }}
<view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info"> <view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info">
{{ item.bottomInfo }} {{ item.bottomInfo }}
</view> </view>
</view> </view>
<view wx:else> <view wx:else>
<view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view> <view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view>
{{ item.text }} {{ item.text }}
<view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info"> <view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info">
{{ item.bottomInfo }} {{ item.bottomInfo }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,71 +1,71 @@
/* eslint-disable */ /* eslint-disable */
var utils = require('../../utils.wxs'); var utils = require('../../utils.wxs');
function getMark(date) { function getMark(date) {
return getDate(date).getMonth() + 1; return getDate(date).getMonth() + 1;
} }
var ROW_HEIGHT = 64; var ROW_HEIGHT = 64;
function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) { function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
var style = []; var style = [];
var current = getDate(date).getDay() || 7; var current = getDate(date).getDay() || 7;
var offset = current < firstDayOfWeek ? (7 - firstDayOfWeek + current) : var offset = current < firstDayOfWeek ? (7 - firstDayOfWeek + current) :
current === 7 && firstDayOfWeek === 0 ? 0 : current === 7 && firstDayOfWeek === 0 ? 0 :
(current - firstDayOfWeek); (current - firstDayOfWeek);
if (index === 0) { if (index === 0) {
style.push(['margin-left', (100 * offset) / 7 + '%']); style.push(['margin-left', (100 * offset) / 7 + '%']);
} }
if (rowHeight !== ROW_HEIGHT) { if (rowHeight !== ROW_HEIGHT) {
style.push(['height', rowHeight + 'px']); style.push(['height', rowHeight + 'px']);
} }
if (color) { if (color) {
if ( if (
type === 'start' || type === 'start' ||
type === 'end' || type === 'end' ||
type === 'start-end' || type === 'start-end' ||
type === 'multiple-selected' || type === 'multiple-selected' ||
type === 'multiple-middle' type === 'multiple-middle'
) { ) {
style.push(['background', color]); style.push(['background', color]);
} else if (type === 'middle') { } else if (type === 'middle') {
style.push(['color', color]); style.push(['color', color]);
} }
} }
return style return style
.map(function(item) { .map(function(item) {
return item.join(':'); return item.join(':');
}) })
.join(';'); .join(';');
} }
function formatMonthTitle(date) { function formatMonthTitle(date) {
date = getDate(date); date = getDate(date);
return date.getFullYear() + '年' + (date.getMonth() + 1) + '月'; return date.getFullYear() + '年' + (date.getMonth() + 1) + '月';
} }
function getMonthStyle(visible, date, rowHeight) { function getMonthStyle(visible, date, rowHeight) {
if (!visible) { if (!visible) {
date = getDate(date); date = getDate(date);
var totalDay = utils.getMonthEndDay( var totalDay = utils.getMonthEndDay(
date.getFullYear(), date.getFullYear(),
date.getMonth() + 1 date.getMonth() + 1
); );
var offset = getDate(date).getDay(); var offset = getDate(date).getDay();
var padding = Math.ceil((totalDay + offset) / 7) * rowHeight; var padding = Math.ceil((totalDay + offset) / 7) * rowHeight;
return 'padding-bottom:' + padding + 'px'; return 'padding-bottom:' + padding + 'px';
} }
} }
module.exports = { module.exports = {
getMark: getMark, getMark: getMark,
getDayStyle: getDayStyle, getDayStyle: getDayStyle,
formatMonthTitle: formatMonthTitle, formatMonthTitle: formatMonthTitle,
getMonthStyle: getMonthStyle getMonthStyle: getMonthStyle
}; };

View File

@ -1 +1 @@
export {}; export {};

View File

@ -1,383 +1,383 @@
"use strict"; "use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) { if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i); if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i]; ar[i] = from[i];
} }
} }
return to.concat(ar || Array.prototype.slice.call(from)); return to.concat(ar || Array.prototype.slice.call(from));
}; };
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("./utils"); var utils_1 = require("./utils");
var toast_1 = __importDefault(require("../toast/toast")); var toast_1 = __importDefault(require("../toast/toast"));
var utils_2 = require("../common/utils"); var utils_2 = require("../common/utils");
var initialMinDate = (0, utils_1.getToday)().getTime(); var initialMinDate = (0, utils_1.getToday)().getTime();
var initialMaxDate = (function () { var initialMaxDate = (function () {
var now = (0, utils_1.getToday)(); var now = (0, utils_1.getToday)();
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime(); return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate()).getTime();
})(); })();
var getTime = function (date) { var getTime = function (date) {
return date instanceof Date ? date.getTime() : date; return date instanceof Date ? date.getTime() : date;
}; };
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
props: { props: {
title: { title: {
type: String, type: String,
value: '日期选择', value: '日期选择',
}, },
color: String, color: String,
show: { show: {
type: Boolean, type: Boolean,
observer: function (val) { observer: function (val) {
if (val) { if (val) {
this.initRect(); this.initRect();
this.scrollIntoView(); this.scrollIntoView();
} }
}, },
}, },
formatter: null, formatter: null,
confirmText: { confirmText: {
type: String, type: String,
value: '确定', value: '确定',
}, },
confirmDisabledText: { confirmDisabledText: {
type: String, type: String,
value: '确定', value: '确定',
}, },
rangePrompt: String, rangePrompt: String,
showRangePrompt: { showRangePrompt: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
defaultDate: { defaultDate: {
type: null, type: null,
value: (0, utils_1.getToday)().getTime(), value: (0, utils_1.getToday)().getTime(),
observer: function (val) { observer: function (val) {
this.setData({ currentDate: val }); this.setData({ currentDate: val });
this.scrollIntoView(); this.scrollIntoView();
}, },
}, },
allowSameDay: Boolean, allowSameDay: Boolean,
type: { type: {
type: String, type: String,
value: 'single', value: 'single',
observer: 'reset', observer: 'reset',
}, },
minDate: { minDate: {
type: Number, type: Number,
value: initialMinDate, value: initialMinDate,
}, },
maxDate: { maxDate: {
type: Number, type: Number,
value: initialMaxDate, value: initialMaxDate,
}, },
position: { position: {
type: String, type: String,
value: 'bottom', value: 'bottom',
}, },
rowHeight: { rowHeight: {
type: null, type: null,
value: utils_1.ROW_HEIGHT, value: utils_1.ROW_HEIGHT,
}, },
round: { round: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
poppable: { poppable: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
showMark: { showMark: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
showTitle: { showTitle: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
showConfirm: { showConfirm: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
showSubtitle: { showSubtitle: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
safeAreaInsetBottom: { safeAreaInsetBottom: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
closeOnClickOverlay: { closeOnClickOverlay: {
type: Boolean, type: Boolean,
value: true, value: true,
}, },
maxRange: { maxRange: {
type: null, type: null,
value: null, value: null,
}, },
minRange: { minRange: {
type: Number, type: Number,
value: 1, value: 1,
}, },
firstDayOfWeek: { firstDayOfWeek: {
type: Number, type: Number,
value: 0, value: 0,
}, },
readonly: Boolean, readonly: Boolean,
rootPortal: { rootPortal: {
type: Boolean, type: Boolean,
value: false, value: false,
}, },
}, },
data: { data: {
subtitle: '', subtitle: '',
currentDate: null, currentDate: null,
scrollIntoView: '', scrollIntoView: '',
}, },
watch: { watch: {
minDate: function () { minDate: function () {
this.initRect(); this.initRect();
}, },
maxDate: function () { maxDate: function () {
this.initRect(); this.initRect();
}, },
}, },
created: function () { created: function () {
this.setData({ this.setData({
currentDate: this.getInitialDate(this.data.defaultDate), currentDate: this.getInitialDate(this.data.defaultDate),
}); });
}, },
mounted: function () { mounted: function () {
if (this.data.show || !this.data.poppable) { if (this.data.show || !this.data.poppable) {
this.initRect(); this.initRect();
this.scrollIntoView(); this.scrollIntoView();
} }
}, },
methods: { methods: {
reset: function () { reset: function () {
this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) }); this.setData({ currentDate: this.getInitialDate(this.data.defaultDate) });
this.scrollIntoView(); this.scrollIntoView();
}, },
initRect: function () { initRect: function () {
var _this = this; var _this = this;
if (this.contentObserver != null) { if (this.contentObserver != null) {
this.contentObserver.disconnect(); this.contentObserver.disconnect();
} }
var contentObserver = this.createIntersectionObserver({ var contentObserver = this.createIntersectionObserver({
thresholds: [0, 0.1, 0.9, 1], thresholds: [0, 0.1, 0.9, 1],
observeAll: true, observeAll: true,
}); });
this.contentObserver = contentObserver; this.contentObserver = contentObserver;
contentObserver.relativeTo('.van-calendar__body'); contentObserver.relativeTo('.van-calendar__body');
contentObserver.observe('.month', function (res) { contentObserver.observe('.month', function (res) {
if (res.boundingClientRect.top <= res.relativeRect.top) { if (res.boundingClientRect.top <= res.relativeRect.top) {
// @ts-ignore // @ts-ignore
_this.setData({ subtitle: (0, utils_1.formatMonthTitle)(res.dataset.date) }); _this.setData({ subtitle: (0, utils_1.formatMonthTitle)(res.dataset.date) });
} }
}); });
}, },
limitDateRange: function (date, minDate, maxDate) { limitDateRange: function (date, minDate, maxDate) {
if (minDate === void 0) { minDate = null; } if (minDate === void 0) { minDate = null; }
if (maxDate === void 0) { maxDate = null; } if (maxDate === void 0) { maxDate = null; }
minDate = minDate || this.data.minDate; minDate = minDate || this.data.minDate;
maxDate = maxDate || this.data.maxDate; maxDate = maxDate || this.data.maxDate;
if ((0, utils_1.compareDay)(date, minDate) === -1) { if ((0, utils_1.compareDay)(date, minDate) === -1) {
return minDate; return minDate;
} }
if ((0, utils_1.compareDay)(date, maxDate) === 1) { if ((0, utils_1.compareDay)(date, maxDate) === 1) {
return maxDate; return maxDate;
} }
return date; return date;
}, },
getInitialDate: function (defaultDate) { getInitialDate: function (defaultDate) {
var _this = this; var _this = this;
if (defaultDate === void 0) { defaultDate = null; } if (defaultDate === void 0) { defaultDate = null; }
var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay; var _a = this.data, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate, allowSameDay = _a.allowSameDay;
if (!defaultDate) if (!defaultDate)
return []; return [];
var now = (0, utils_1.getToday)().getTime(); var now = (0, utils_1.getToday)().getTime();
if (type === 'range') { if (type === 'range') {
if (!Array.isArray(defaultDate)) { if (!Array.isArray(defaultDate)) {
defaultDate = []; defaultDate = [];
} }
var _b = defaultDate || [], startDay = _b[0], endDay = _b[1]; var _b = defaultDate || [], startDay = _b[0], endDay = _b[1];
var startDate = getTime(startDay || now); var startDate = getTime(startDay || now);
var start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : (0, utils_1.getPrevDay)(new Date(maxDate)).getTime()); var start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
var date = getTime(endDay || now); var date = getTime(endDay || now);
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime()); var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
return [start, end]; return [start, end];
} }
if (type === 'multiple') { if (type === 'multiple') {
if (Array.isArray(defaultDate)) { if (Array.isArray(defaultDate)) {
return defaultDate.map(function (date) { return _this.limitDateRange(date); }); return defaultDate.map(function (date) { return _this.limitDateRange(date); });
} }
return [this.limitDateRange(now)]; return [this.limitDateRange(now)];
} }
if (!defaultDate || Array.isArray(defaultDate)) { if (!defaultDate || Array.isArray(defaultDate)) {
defaultDate = now; defaultDate = now;
} }
return this.limitDateRange(defaultDate); return this.limitDateRange(defaultDate);
}, },
scrollIntoView: function () { scrollIntoView: function () {
var _this = this; var _this = this;
(0, utils_2.requestAnimationFrame)(function () { (0, utils_2.requestAnimationFrame)(function () {
var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate; var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate;
if (!currentDate) if (!currentDate)
return; return;
// @ts-ignore // @ts-ignore
var targetDate = type === 'single' ? currentDate : currentDate[0]; var targetDate = type === 'single' ? currentDate : currentDate[0];
var displayed = show || !poppable; var displayed = show || !poppable;
if (!targetDate || !displayed) { if (!targetDate || !displayed) {
return; return;
} }
var months = (0, utils_1.getMonths)(minDate, maxDate); var months = (0, utils_1.getMonths)(minDate, maxDate);
months.some(function (month, index) { months.some(function (month, index) {
if ((0, utils_1.compareMonth)(month, targetDate) === 0) { if ((0, utils_1.compareMonth)(month, targetDate) === 0) {
_this.setData({ scrollIntoView: "month".concat(index) }); _this.setData({ scrollIntoView: "month".concat(index) });
return true; return true;
} }
return false; return false;
}); });
}); });
}, },
onOpen: function () { onOpen: function () {
this.$emit('open'); this.$emit('open');
}, },
onOpened: function () { onOpened: function () {
this.$emit('opened'); this.$emit('opened');
}, },
onClose: function () { onClose: function () {
this.$emit('close'); this.$emit('close');
}, },
onClosed: function () { onClosed: function () {
this.$emit('closed'); this.$emit('closed');
}, },
onClickDay: function (event) { onClickDay: function (event) {
if (this.data.readonly) { if (this.data.readonly) {
return; return;
} }
var date = event.detail.date; var date = event.detail.date;
var _a = this.data, type = _a.type, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay; var _a = this.data, type = _a.type, currentDate = _a.currentDate, allowSameDay = _a.allowSameDay;
if (type === 'range') { if (type === 'range') {
// @ts-ignore // @ts-ignore
var startDay_1 = currentDate[0], endDay = currentDate[1]; var startDay_1 = currentDate[0], endDay = currentDate[1];
if (startDay_1 && !endDay) { if (startDay_1 && !endDay) {
var compareToStart = (0, utils_1.compareDay)(date, startDay_1); var compareToStart = (0, utils_1.compareDay)(date, startDay_1);
if (compareToStart === 1) { if (compareToStart === 1) {
var days_1 = this.selectComponent('.month').data.days; var days_1 = this.selectComponent('.month').data.days;
days_1.some(function (day, index) { days_1.some(function (day, index) {
var isDisabled = day.type === 'disabled' && var isDisabled = day.type === 'disabled' &&
getTime(startDay_1) < getTime(day.date) && getTime(startDay_1) < getTime(day.date) &&
getTime(day.date) < getTime(date); getTime(day.date) < getTime(date);
if (isDisabled) { if (isDisabled) {
(date = days_1[index - 1].date); (date = days_1[index - 1].date);
} }
return isDisabled; return isDisabled;
}); });
this.select([startDay_1, date], true); this.select([startDay_1, date], true);
} }
else if (compareToStart === -1) { else if (compareToStart === -1) {
this.select([date, null]); this.select([date, null]);
} }
else if (allowSameDay) { else if (allowSameDay) {
this.select([date, date], true); this.select([date, date], true);
} }
} }
else { else {
this.select([date, null]); this.select([date, null]);
} }
} }
else if (type === 'multiple') { else if (type === 'multiple') {
var selectedIndex_1; var selectedIndex_1;
// @ts-ignore // @ts-ignore
var selected = currentDate.some(function (dateItem, index) { var selected = currentDate.some(function (dateItem, index) {
var equal = (0, utils_1.compareDay)(dateItem, date) === 0; var equal = (0, utils_1.compareDay)(dateItem, date) === 0;
if (equal) { if (equal) {
selectedIndex_1 = index; selectedIndex_1 = index;
} }
return equal; return equal;
}); });
if (selected) { if (selected) {
// @ts-ignore // @ts-ignore
var cancelDate = currentDate.splice(selectedIndex_1, 1); var cancelDate = currentDate.splice(selectedIndex_1, 1);
this.setData({ currentDate: currentDate }); this.setData({ currentDate: currentDate });
this.unselect(cancelDate); this.unselect(cancelDate);
} }
else { else {
// @ts-ignore // @ts-ignore
this.select(__spreadArray(__spreadArray([], currentDate, true), [date], false)); this.select(__spreadArray(__spreadArray([], currentDate, true), [date], false));
} }
} }
else { else {
this.select(date, true); this.select(date, true);
} }
}, },
unselect: function (dateArray) { unselect: function (dateArray) {
var date = dateArray[0]; var date = dateArray[0];
if (date) { if (date) {
this.$emit('unselect', (0, utils_1.copyDates)(date)); this.$emit('unselect', (0, utils_1.copyDates)(date));
} }
}, },
select: function (date, complete) { select: function (date, complete) {
if (complete && this.data.type === 'range') { if (complete && this.data.type === 'range') {
var valid = this.checkRange(date); var valid = this.checkRange(date);
if (!valid) { if (!valid) {
// auto selected to max range if showConfirm // auto selected to max range if showConfirm
if (this.data.showConfirm) { if (this.data.showConfirm) {
this.emit([ this.emit([
date[0], date[0],
(0, utils_1.getDayByOffset)(date[0], this.data.maxRange - 1), (0, utils_1.getDayByOffset)(date[0], this.data.maxRange - 1),
]); ]);
} }
else { else {
this.emit(date); this.emit(date);
} }
return; return;
} }
} }
this.emit(date); this.emit(date);
if (complete && !this.data.showConfirm) { if (complete && !this.data.showConfirm) {
this.onConfirm(); this.onConfirm();
} }
}, },
emit: function (date) { emit: function (date) {
this.setData({ this.setData({
currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date),
}); });
this.$emit('select', (0, utils_1.copyDates)(date)); this.$emit('select', (0, utils_1.copyDates)(date));
}, },
checkRange: function (date) { checkRange: function (date) {
var _a = this.data, maxRange = _a.maxRange, rangePrompt = _a.rangePrompt, showRangePrompt = _a.showRangePrompt; var _a = this.data, maxRange = _a.maxRange, rangePrompt = _a.rangePrompt, showRangePrompt = _a.showRangePrompt;
if (maxRange && (0, utils_1.calcDateNum)(date) > maxRange) { if (maxRange && (0, utils_1.calcDateNum)(date) > maxRange) {
if (showRangePrompt) { if (showRangePrompt) {
(0, toast_1.default)({ (0, toast_1.default)({
context: this, context: this,
message: rangePrompt || "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ".concat(maxRange, " \u5929"), message: rangePrompt || "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ".concat(maxRange, " \u5929"),
}); });
} }
this.$emit('over-range'); this.$emit('over-range');
return false; return false;
} }
return true; return true;
}, },
onConfirm: function () { onConfirm: function () {
var _this = this; var _this = this;
if (this.data.type === 'range' && if (this.data.type === 'range' &&
!this.checkRange(this.data.currentDate)) { !this.checkRange(this.data.currentDate)) {
return; return;
} }
wx.nextTick(function () { wx.nextTick(function () {
// @ts-ignore // @ts-ignore
_this.$emit('confirm', (0, utils_1.copyDates)(_this.data.currentDate)); _this.$emit('confirm', (0, utils_1.copyDates)(_this.data.currentDate));
}); });
}, },
onClickSubtitle: function (event) { onClickSubtitle: function (event) {
this.$emit('click-subtitle', event); this.$emit('click-subtitle', event);
}, },
}, },
}); });

View File

@ -1,10 +1,10 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"header": "./components/header/index", "header": "./components/header/index",
"month": "./components/month/index", "month": "./components/month/index",
"van-button": "../button/index", "van-button": "../button/index",
"van-popup": "../popup/index", "van-popup": "../popup/index",
"van-toast": "../toast/index" "van-toast": "../toast/index"
} }
} }

View File

@ -1,27 +1,27 @@
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<import src="./calendar.wxml" /> <import src="./calendar.wxml" />
<van-popup <van-popup
wx:if="{{ poppable }}" wx:if="{{ poppable }}"
custom-class="van-calendar__popup--{{ position }}" custom-class="van-calendar__popup--{{ position }}"
close-icon-class="van-calendar__close-icon" close-icon-class="van-calendar__close-icon"
show="{{ show }}" show="{{ show }}"
round="{{ round }}" round="{{ round }}"
position="{{ position }}" position="{{ position }}"
closeable="{{ showTitle || showSubtitle }}" closeable="{{ showTitle || showSubtitle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}" safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}" root-portal="{{ rootPortal }}"
bind:enter="onOpen" bind:enter="onOpen"
bind:close="onClose" bind:close="onClose"
bind:after-enter="onOpened" bind:after-enter="onOpened"
bind:after-leave="onClosed" bind:after-leave="onClosed"
> >
<include src="./calendar.wxml" /> <include src="./calendar.wxml" />
</van-popup> </van-popup>
<include wx:else src="./calendar.wxml" /> <include wx:else src="./calendar.wxml" />
<van-toast id="van-toast" /> <van-toast id="van-toast" />

View File

@ -1,37 +1,37 @@
/* eslint-disable */ /* eslint-disable */
var utils = require('./utils.wxs'); var utils = require('./utils.wxs');
function getMonths(minDate, maxDate) { function getMonths(minDate, maxDate) {
var months = []; var months = [];
var cursor = getDate(minDate); var cursor = getDate(minDate);
cursor.setDate(1); cursor.setDate(1);
do { do {
months.push(cursor.getTime()); months.push(cursor.getTime());
cursor.setMonth(cursor.getMonth() + 1); cursor.setMonth(cursor.getMonth() + 1);
} while (utils.compareMonth(cursor, getDate(maxDate)) !== 1); } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);
return months; return months;
} }
function getButtonDisabled(type, currentDate, minRange) { function getButtonDisabled(type, currentDate, minRange) {
if (currentDate == null) { if (currentDate == null) {
return true; return true;
} }
if (type === 'range') { if (type === 'range') {
return !currentDate[0] || !currentDate[1]; return !currentDate[0] || !currentDate[1];
} }
if (type === 'multiple') { if (type === 'multiple') {
return currentDate.length < minRange; return currentDate.length < minRange;
} }
return !currentDate; return !currentDate;
} }
module.exports = { module.exports = {
getMonths: getMonths, getMonths: getMonths,
getButtonDisabled: getButtonDisabled getButtonDisabled: getButtonDisabled
}; };

View File

@ -1,12 +1,12 @@
export declare const ROW_HEIGHT = 64; export declare const ROW_HEIGHT = 64;
export declare function formatMonthTitle(date: Date): string; export declare function formatMonthTitle(date: Date): string;
export declare function compareMonth(date1: Date | number, date2: Date | number): 0 | 1 | -1; export declare function compareMonth(date1: Date | number, date2: Date | number): 0 | 1 | -1;
export declare function compareDay(day1: Date | number, day2: Date | number): 0 | 1 | -1; export declare function compareDay(day1: Date | number, day2: Date | number): 0 | 1 | -1;
export declare function getDayByOffset(date: Date, offset: number): Date; export declare function getDayByOffset(date: Date, offset: number): Date;
export declare function getPrevDay(date: Date): Date; export declare function getPrevDay(date: Date): Date;
export declare function getNextDay(date: Date): Date; export declare function getNextDay(date: Date): Date;
export declare function getToday(): Date; export declare function getToday(): Date;
export declare function calcDateNum(date: [Date, Date]): number; export declare function calcDateNum(date: [Date, Date]): number;
export declare function copyDates(dates: Date | Date[]): Date | Date[]; export declare function copyDates(dates: Date | Date[]): Date | Date[];
export declare function getMonthEndDay(year: number, month: number): number; export declare function getMonthEndDay(year: number, month: number): number;
export declare function getMonths(minDate: number, maxDate: number): number[]; export declare function getMonths(minDate: number, maxDate: number): number[];

View File

@ -1,97 +1,97 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0; exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
exports.ROW_HEIGHT = 64; exports.ROW_HEIGHT = 64;
function formatMonthTitle(date) { function formatMonthTitle(date) {
if (!(date instanceof Date)) { if (!(date instanceof Date)) {
date = new Date(date); date = new Date(date);
} }
return "".concat(date.getFullYear(), "\u5E74").concat(date.getMonth() + 1, "\u6708"); return "".concat(date.getFullYear(), "\u5E74").concat(date.getMonth() + 1, "\u6708");
} }
exports.formatMonthTitle = formatMonthTitle; exports.formatMonthTitle = formatMonthTitle;
function compareMonth(date1, date2) { function compareMonth(date1, date2) {
if (!(date1 instanceof Date)) { if (!(date1 instanceof Date)) {
date1 = new Date(date1); date1 = new Date(date1);
} }
if (!(date2 instanceof Date)) { if (!(date2 instanceof Date)) {
date2 = new Date(date2); date2 = new Date(date2);
} }
var year1 = date1.getFullYear(); var year1 = date1.getFullYear();
var year2 = date2.getFullYear(); var year2 = date2.getFullYear();
var month1 = date1.getMonth(); var month1 = date1.getMonth();
var month2 = date2.getMonth(); var month2 = date2.getMonth();
if (year1 === year2) { if (year1 === year2) {
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
} }
return year1 > year2 ? 1 : -1; return year1 > year2 ? 1 : -1;
} }
exports.compareMonth = compareMonth; exports.compareMonth = compareMonth;
function compareDay(day1, day2) { function compareDay(day1, day2) {
if (!(day1 instanceof Date)) { if (!(day1 instanceof Date)) {
day1 = new Date(day1); day1 = new Date(day1);
} }
if (!(day2 instanceof Date)) { if (!(day2 instanceof Date)) {
day2 = new Date(day2); day2 = new Date(day2);
} }
var compareMonthResult = compareMonth(day1, day2); var compareMonthResult = compareMonth(day1, day2);
if (compareMonthResult === 0) { if (compareMonthResult === 0) {
var date1 = day1.getDate(); var date1 = day1.getDate();
var date2 = day2.getDate(); var date2 = day2.getDate();
return date1 === date2 ? 0 : date1 > date2 ? 1 : -1; return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
} }
return compareMonthResult; return compareMonthResult;
} }
exports.compareDay = compareDay; exports.compareDay = compareDay;
function getDayByOffset(date, offset) { function getDayByOffset(date, offset) {
date = new Date(date); date = new Date(date);
date.setDate(date.getDate() + offset); date.setDate(date.getDate() + offset);
return date; return date;
} }
exports.getDayByOffset = getDayByOffset; exports.getDayByOffset = getDayByOffset;
function getPrevDay(date) { function getPrevDay(date) {
return getDayByOffset(date, -1); return getDayByOffset(date, -1);
} }
exports.getPrevDay = getPrevDay; exports.getPrevDay = getPrevDay;
function getNextDay(date) { function getNextDay(date) {
return getDayByOffset(date, 1); return getDayByOffset(date, 1);
} }
exports.getNextDay = getNextDay; exports.getNextDay = getNextDay;
function getToday() { function getToday() {
var today = new Date(); var today = new Date();
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
return today; return today;
} }
exports.getToday = getToday; exports.getToday = getToday;
function calcDateNum(date) { function calcDateNum(date) {
var day1 = new Date(date[0]).getTime(); var day1 = new Date(date[0]).getTime();
var day2 = new Date(date[1]).getTime(); var day2 = new Date(date[1]).getTime();
return (day2 - day1) / (1000 * 60 * 60 * 24) + 1; return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
} }
exports.calcDateNum = calcDateNum; exports.calcDateNum = calcDateNum;
function copyDates(dates) { function copyDates(dates) {
if (Array.isArray(dates)) { if (Array.isArray(dates)) {
return dates.map(function (date) { return dates.map(function (date) {
if (date === null) { if (date === null) {
return date; return date;
} }
return new Date(date); return new Date(date);
}); });
} }
return new Date(dates); return new Date(dates);
} }
exports.copyDates = copyDates; exports.copyDates = copyDates;
function getMonthEndDay(year, month) { function getMonthEndDay(year, month) {
return 32 - new Date(year, month - 1, 32).getDate(); return 32 - new Date(year, month - 1, 32).getDate();
} }
exports.getMonthEndDay = getMonthEndDay; exports.getMonthEndDay = getMonthEndDay;
function getMonths(minDate, maxDate) { function getMonths(minDate, maxDate) {
var months = []; var months = [];
var cursor = new Date(minDate); var cursor = new Date(minDate);
cursor.setDate(1); cursor.setDate(1);
do { do {
months.push(cursor.getTime()); months.push(cursor.getTime());
cursor.setMonth(cursor.getMonth() + 1); cursor.setMonth(cursor.getMonth() + 1);
} while (compareMonth(cursor, maxDate) !== 1); } while (compareMonth(cursor, maxDate) !== 1);
return months; return months;
} }
exports.getMonths = getMonths; exports.getMonths = getMonths;

View File

@ -1,25 +1,25 @@
/* eslint-disable */ /* eslint-disable */
function getMonthEndDay(year, month) { function getMonthEndDay(year, month) {
return 32 - getDate(year, month - 1, 32).getDate(); return 32 - getDate(year, month - 1, 32).getDate();
} }
function compareMonth(date1, date2) { function compareMonth(date1, date2) {
date1 = getDate(date1); date1 = getDate(date1);
date2 = getDate(date2); date2 = getDate(date2);
var year1 = date1.getFullYear(); var year1 = date1.getFullYear();
var year2 = date2.getFullYear(); var year2 = date2.getFullYear();
var month1 = date1.getMonth(); var month1 = date1.getMonth();
var month2 = date2.getMonth(); var month2 = date2.getMonth();
if (year1 === year2) { if (year1 === year2) {
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
} }
return year1 > year2 ? 1 : -1; return year1 > year2 ? 1 : -1;
} }
module.exports = { module.exports = {
getMonthEndDay: getMonthEndDay, getMonthEndDay: getMonthEndDay,
compareMonth: compareMonth compareMonth: compareMonth
}; };

View File

@ -1 +1 @@
export {}; export {};

View File

@ -1,51 +1,51 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var link_1 = require("../mixins/link"); var link_1 = require("../mixins/link");
var component_1 = require("../common/component"); var component_1 = require("../common/component");
(0, component_1.VantComponent)({ (0, component_1.VantComponent)({
classes: [ classes: [
'num-class', 'num-class',
'desc-class', 'desc-class',
'thumb-class', 'thumb-class',
'title-class', 'title-class',
'price-class', 'price-class',
'origin-price-class', 'origin-price-class',
], ],
mixins: [link_1.link], mixins: [link_1.link],
props: { props: {
tag: String, tag: String,
num: String, num: String,
desc: String, desc: String,
thumb: String, thumb: String,
title: String, title: String,
price: { price: {
type: String, type: String,
observer: 'updatePrice', observer: 'updatePrice',
}, },
centered: Boolean, centered: Boolean,
lazyLoad: Boolean, lazyLoad: Boolean,
thumbLink: String, thumbLink: String,
originPrice: String, originPrice: String,
thumbMode: { thumbMode: {
type: String, type: String,
value: 'aspectFit', value: 'aspectFit',
}, },
currency: { currency: {
type: String, type: String,
value: '¥', value: '¥',
}, },
}, },
methods: { methods: {
updatePrice: function () { updatePrice: function () {
var price = this.data.price; var price = this.data.price;
var priceArr = price.toString().split('.'); var priceArr = price.toString().split('.');
this.setData({ this.setData({
integerStr: priceArr[0], integerStr: priceArr[0],
decimalStr: priceArr[1] ? ".".concat(priceArr[1]) : '', decimalStr: priceArr[1] ? ".".concat(priceArr[1]) : '',
}); });
}, },
onClickThumb: function () { onClickThumb: function () {
this.jumpLink('thumbLink'); this.jumpLink('thumbLink');
}, },
}, },
}); });

View File

@ -1,6 +1,6 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-tag": "../tag/index" "van-tag": "../tag/index"
} }
} }

View File

@ -1,56 +1,56 @@
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class van-card"> <view class="custom-class van-card">
<view class="{{ utils.bem('card__header', { center: centered }) }}"> <view class="{{ utils.bem('card__header', { center: centered }) }}">
<view class="van-card__thumb" bind:tap="onClickThumb"> <view class="van-card__thumb" bind:tap="onClickThumb">
<image <image
wx:if="{{ thumb }}" wx:if="{{ thumb }}"
src="{{ thumb }}" src="{{ thumb }}"
mode="{{ thumbMode }}" mode="{{ thumbMode }}"
lazy-load="{{ lazyLoad }}" lazy-load="{{ lazyLoad }}"
class="van-card__img thumb-class" class="van-card__img thumb-class"
/> />
<slot wx:else name="thumb" /> <slot wx:else name="thumb" />
<van-tag <van-tag
wx:if="{{ tag }}" wx:if="{{ tag }}"
mark mark
type="danger" type="danger"
custom-class="van-card__tag" custom-class="van-card__tag"
> >
{{ tag }} {{ tag }}
</van-tag> </van-tag>
<slot wx:else name="tag" /> <slot wx:else name="tag" />
</view> </view>
<view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}"> <view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}">
<view> <view>
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view> <view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" /> <slot wx:else name="title" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view> <view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" /> <slot wx:else name="desc" />
<slot name="tags" /> <slot name="tags" />
</view> </view>
<view class="van-card__bottom"> <view class="van-card__bottom">
<slot name="price-top" /> <slot name="price-top" />
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class"> <view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">
<text>{{ currency }}</text> <text>{{ currency }}</text>
<text class="van-card__price-integer">{{ integerStr }}</text> <text class="van-card__price-integer">{{ integerStr }}</text>
<text class="van-card__price-decimal">{{ decimalStr }}</text> <text class="van-card__price-decimal">{{ decimalStr }}</text>
</view> </view>
<slot wx:else name="price" /> <slot wx:else name="price" />
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view> <view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
<slot wx:else name="origin-price" /> <slot wx:else name="origin-price" />
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view> <view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
<slot wx:else name="num" /> <slot wx:else name="num" />
<slot name="bottom" /> <slot name="bottom" />
</view> </view>
</view> </view>
</view> </view>
<view class="van-card__footer"> <view class="van-card__footer">
<slot name="footer" /> <slot name="footer" />
</view> </view>
</view> </view>

Some files were not shown because too many files have changed in this diff Show More