Commit 8dcb503d by 前端

Merge branch 'dev_v4.27.1' into 'master'

Dev v4.27.1

See merge request !1
2 parents 9482233c 91dbad11
Showing 284 changed files with 3926 additions and 0 deletions
.DS_Store
node_modules
miniprogram_npm
/dist
/.history
/.svn
.svn
miniprogram_npm
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
# sass+ 精品升级嘀加智慧门店
\ No newline at end of file \ No newline at end of file
const restapi = require('/utils/restapi.js')
//app.js
import util from './utils/util.js'
App({
// 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
onLaunch: function(option) {
/**挂载到wx对象 */
wx.$util = util
var self = this;
// 获取用户登录场景值
console.log("onLaunch.option", option)
self.globalData.app = this;
self.globalData.scene = option.scene;
self.globalData.appId = wx.getAccountInfoSync().miniProgram.appId;
/**
* 获取自定义导航栏信息
*/
let padding = 6
let ios = true
wx.getSystemInfo({
success(res) {
console.log(res)
if (res.platform == "android") {
padding = 8
ios = false
}
/**兼容全屏手机 */
if (res.screenHeight - res.windowHeight > 72) {
self.globalData.isFullSucreen = true
}
self.globalData.systemInfo = {
statusBarPadding: padding,
ios: ios,
statusBarHeight: res.statusBarHeight,
phoneHeight: res.screenHeight - res.statusBarHeight
}
}
})
// 打开调试
// wx.setEnableDebug({
// enableDebug: true
// })
},
// 当小程序启动,或从后台进入前台显示,会触发
onShow: function(option) {
let self = this;
self.globalData.sceneData = option;
self.globalData.scene = option.scene;
},
onHide: function() {
let that = this
that.globalData.clearMarqueeTime = true
},
login: function() {
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
var self = this;
self.globalData.code = res.code;
restapi.jscodeLogin(res.code, self.globalData.appId, function(response) {
console.log(response)
switch (response.returnCode) {
case '0': // 获取微信用户信息成功
self.globalData.userInfo = response.data;
if (response.data.uuid) { // 已获取手机号
// 登录成功回调
self.loginSuccessCallback(response.data);
} else { // 未获取手机号,授权获取
wx.navigateTo({
url: '/pages/login/index/index'
});
}
break;
case '-1':
// 获取微信用户信息为空,授权获取
if (response.errId == '200205') {
self.getUserInfo();
}
break;
default:
wx.showToast({
title: response.message
})
}
});
}
})
},
getUserInfo: function() {
var self = this;
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
self.userAuth();
} else {
wx.navigateTo({
url: '/pages/index/index'
});
}
},
fail: res => {
console.log(res);
}
});
},
userAuth: function() {
var self = this;
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
withCredentials: true,
lang: 'zh_CN',
success: res => {
wx.checkSession({
success() {
//session_key 未过期,并且在本生命周期一直有效
self.authUserInfo(res);
},
fail() {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: response => {
appInstance.globalData.code = response['code'];
self.authUserInfo(res);
}
})
}
})
},
fail: res => {
console.log(res);
}
});
},
authUserInfo: function(wechatAuthSetting) {
var self = this;
wechatAuthSetting['code'] = self.globalData.code;
wechatAuthSetting['appId'] = self.globalData.appId;
console.log("wechatAuthSetting", wechatAuthSetting)
restapi.authUserInfo(wechatAuthSetting, function(response) {
console.log("authUserInfo", response)
switch (response.returnCode) {
case '0':
self.globalData.userInfo = response.data;
if (response.data.uuid) { // 已获取手机号
// 登录成功回调
self.loginSuccessCallback(response.data);
} else { // 未获取手机号,授权获取
wx.navigateTo({
url: '/pages/login/index/index'
});
}
break;
default:
wx.showToast({
title: response.message
})
}
}, function() {
console.log("authUserInfo request fail!")
});
},
/**
* 提示框
*/
showMessage: function(title) {
wx.showToast({
title: title,
icon: 'none',
duration: 2000
})
},
/**
* 登录成功回调
*/
loginSuccessCallback: function(userInfo) {
console.log(userInfo);
this.globalData.userInfo = userInfo;
this.globalData.uuid = userInfo.uuid;
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(userInfo)
}
},
globalData: {
clearMarqueeTime:false,
scene: null,
app: null,
userInfo: null,
code: null,
uuid: null,
unionId: '',
authUserInfo: false,
authPhone: false,
curUserId:'',
loginSuccessCallback: function(userInfo) {
this.app.loginSuccessCallback(userInfo);
},
login: function() {
this.app.login();
},
systemInfo: null,
mapKey: '',// 先去除掉腾讯的,后续需要再改造成高德
sceneData: null,
appId: null,
isFullSucreen:false
}
})
\ No newline at end of file \ No newline at end of file
{
"pages": [
"packageIndex/pages/index/index",
"packagePersonal/pages/index/index",
"packagePersonal/pages/edit/edit",
"packagePersonal/pages/address/address",
"packagePersonal/pages/carBrandList/carBrandList",
"packageConversionPlus/pages/index/index",
"packageConversionPlus/pages/orderList/orderList",
"packageConversionPlus/pages/orderDetails/orderDetails",
"packageConversionPlus/pages/search/search",
"packageConversionPlus/pages/searchList/searchList",
"packageConversionPlus/pages/searchSuccess/searchSuccess",
"packageConversionPlus/pages/createCoupon/createCoupon",
"packageConversionPlus/pages/couponList/couponList",
"pages/route/to",
"pages/index/index",
"pages/webpage/webpage",
"pages/upgrade/upgrade",
"pages/auth/login/login",
"pages/employee/index/index",
"pages/employee/success/success",
"pages/login/index/index",
"pages/login/accountItems/accountItems",
"pages/login/signIn/signIn",
"pages/login/success/success",
"pages/login/fail/fail",
"packageConversionPlus/pages/couponDetail/couponDetail"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "嘀加智慧门店",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#05BAA0",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [{
"pagePath": "packageIndex/pages/index/index",
"text": "工作台",
"iconPath": "images/home.png",
"selectedIconPath": "images/home_active.png"
},
{
"pagePath": "packageConversionPlus/pages/index/index",
"text": "转化+",
"iconPath": "images/conversion.png",
"selectedIconPath": "images/conversion_active.png"
},
{
"pagePath": "packagePersonal/pages/index/index",
"text": "我的",
"iconPath": "images/mine.png",
"selectedIconPath": "images/mine_active.png"
}
]
},
"requiredPrivateInfos": [
"getLocation"
],
"usingComponents": {
"navigation-bar": "components/navigationBar/navigationBar",
"list": "components/list/list",
"mp-icon": "components/icon/icon",
"edit-box": "components/editBox/editBox",
"edit-tags": "components/editTags/editTags",
"search-input": "components/searchInput/searchInput",
"time-picker": "components/timePicker/timePicker",
"share": "components/share/share",
"tabbar": "components/tabbar/tabbar",
"tab-view": "components/tabView/tabView",
"cell": "components/cell/cell",
"gl-textarea": "components/glTextarea/glTextarea",
"marquee": "/components/marquee/marquee",
"f2": "@antv/wx-f2",
"calendar": "/components/Calendar/Calendar",
"gl-tab": "/components/glTab/glTab",
"glsx-privacy": "glsx-applet-component/GlsxPrivacy/index"
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {
"authorization-plugin": {
"version": "1.0.2",
"provider": "wxe10067a63c1856ac"
}
},
"__usePrivacyCheck__": true
}
\ No newline at end of file \ No newline at end of file
@import 'style/common.wxss';
\ No newline at end of file \ No newline at end of file
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import Static_Properties from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
Component({
/**
* 组件的属性列表
*/
properties: Static_Properties.properties,
/**
* 组件的初始数据
*/
data: Static_Properties.data,
/**
* 组件的方法列表
*/
methods: {
noScroll(){},
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || ''
let result = type === 'show'
if (!result) {
this.setData({
hideCalendar: true
})
setTimeout(() => {
this.setData({
show: result,
hideCalendar: false
})
}, 300)
} else {
this.setData({
show: result
})
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight()
}
},
dateChange(e) {
let {
current
} = e.detail
this.setData({
current
})
},
choose(e) {
let {
dateType,
minDate,
maxDate
} = this.data
let {
data
} = e.currentTarget.dataset
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e)
},
done() {
let {
dateType
} = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e){
let {value} = e.detail
this.setData({
current:value
})
},
showShortcutPicker(){
this.setData({
showShortcut:!this.data.showShortcut
})
},
},
ready() {
this[CalendarFunction] = new Calendar(this)
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot></slot>
</view>
<!-- 弹框模式 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar"></view>
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{isFullSucreen&&!showConfirm?"isFullSucreen":""}}' style="height:{{height}}">
<view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="../../images/close.png" class='calender-close-image' > </image>
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}'></view>
</view>
</picker>
<view class='calender-subtitle' wx:else>{{dateList[current]}}</view>
</block>
<view class='calendar-weekdays'>
<block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view>
</block>
</view>
</view>
<view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})">
<swiper class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'>
<block wx:for='{{monthList}}' wx:key='index'>
<swiper-item>
<view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}月</view>
<view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'>
<view class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}}' style="background:{{i.active?calenderColor:''}};color:{{i.middle?calenderColor:''}}" bindtap="choose" data-index='{{index}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<view class='calender-middle' style="background:{{calenderColor}};" wx:if='{{i.middle}}'></view>
<view class='box-center text'>
{{i.day}}
<view wx:if='{{dateType==="range"}}' class='calender-tips'>
<view wx:if='{{i.start}}'>{{rangeText.start}}</view>
<view wx:if='{{i.end}}'>{{rangeText.end}}</view>
</view>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class='calender-footer {{isFullSucreen}}' wx:if='{{showConfirm}}'>
<view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done">{{confirmText||'确定'}}</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 99;
}
.calender-bg {
position: absolute;
background: rgba(0, 0, 0, .5);
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.calender-view {
position: absolute;
left: 0;
width: 100%;
background: #fff;
animation: show-calender .5s forwards;
color: #333;
}
.calender-view.true {
border-radius: 40rpx 40rpx 0 0;
}
.calender-view.isFullSucreen {
box-sizing: border-box;
padding-bottom: 34px !important;
}
@keyframes show-calender {
from {
bottom: -100%;
}
to {
bottom: 0;
}
}
.calender-view.hideCalendar {
animation: hide-calender .5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: 88rpx;
text-align: center;
position: relative;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: 28rpx;
}
.calender-subtitle .arrow {
width: 14rpx;
height: 14rpx;
border-top: 2rpx solid transparent;
border-right: 2rpx solid #ccc;
border-bottom: 2rpx solid #ccc;
border-left: 2rpx solid transparent;
transform: rotate(45deg) translateY(-4rpx);
margin-left: 16rpx;
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(-4rpx);
}
.calender-close {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: 24rpx;
height: 24rpx;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: 24rpx;
line-height: 60rpx;
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: 20rpx 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: rgba(0, 0, 0, .1);
text-shadow: 0 4rpx 20rpx rgba(0, 0, 0, .1);
font-size: 320rpx;
width: 100%;
text-align: center;
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.calender-month {
height: 100%;
position: relative;
z-index: 1;
display: grid;
grid-template-rows: repeat(minmax(5, 6), 1fr);
grid-template-columns: repeat(7, 1fr);
}
.calender-day {
position: relative;
font-size: 32rpx;
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: 8rpx;
}
.calender-day.disable {
opacity: .25;
}
.calender-day .calender-middle {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.1;
}
.calender-day .text {
text-align: center;
width: 100%;
}
.calender-tips {
font-size: 14rpx;
}
.week-1 {
grid-column-start: 2;
}
.week-2 {
grid-column-start: 3;
}
.week-3 {
grid-column-start: 4;
}
.week-4 {
grid-column-start: 5;
}
.week-5 {
grid-column-start: 6;
}
.week-6 {
grid-column-start: 7;
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: 72rpx;
font-size: 28rpx;
color: #fff;
border-radius: 999rpx;
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file \ No newline at end of file
const _CalendarObject_ = Symbol('_CalendarObject_')
const _nowDate_ = Symbol('_nowDate_')
const _separator_ = Symbol('_separator_')
class Calendar {
[_CalendarObject_] = {};
[_nowDate_] = new Date();
[_separator_] = '-';
constructor(calendarObject) {
this[_CalendarObject_] = calendarObject
this[_separator_] = calendarObject.data.separator
this.setCalenderHeight()
this.setMonthList()
let {
weekdays,
firstDayOfWeek
} = calendarObject.data
let firstDay = weekdays[firstDayOfWeek - 1]
let [last, first] = weekdays.join('').split(firstDay)
calendarObject.setData({
weekdays: [firstDay, ...first, ...last]
})
}
/**设置日历高度 */
setCalenderHeight() {
let _this = this[_CalendarObject_]
let {
data: calenderHeight
} = _this
let height = '80%'
if (typeof calenderHeight === 'number') {
wx.$util.getPhoneInfo(res => {
let {
windowHeight
} = res
if (calenderHeight > windowHeight) calenderHeight = windowHeight
if (calenderHeight < windowHeight * 0.5) calenderHeight = windowHeight * 0.5
height = `${calenderHeight}px`
})
}
if (typeof calenderHeight === 'string') {
if (calenderHeight.includes('%')) {
height = calenderHeight
let [num] = calenderHeight.split('%')
if (num < 50) height = '50%'
if (num > 100) height = '80%'
} else {
if (calenderHeight < 50) calenderHeight = '50'
if (calenderHeight > 100) calenderHeight = '80'
height = `${calenderHeight}%`
}
}
_this.setData({
isFullSucreen: wx.$util.isFullSucreen(),
height
})
}
/**设置日期高度 */
setCalenderBodyHeight() {
let _this = this[_CalendarObject_]
wx.$util.getViewInfo('.calender-header', header => {
wx.$util.getViewInfo('.calender-footer', footer => {
let headerHeight = header.height
let footerHeight = footer && footer.height || 0
_this.setData({
calenderBodyHeight: `${headerHeight + footerHeight}px`
})
}, _this)
}, _this)
}
/**设置日期列表 */
setMonthList() {
let {
previous,
minDate,
maxDate,
next
} = this[_CalendarObject_].data
if(maxDate || minDate){
previous = this.getMonthDifference(minDate,maxDate)
next = this.getMonthDifference(maxDate,this[_nowDate_].format('yyyy-MM-dd'))
}else{
previous = previous < 0 ? 0 : previous
next = next < 0 ? 0 : next
}
let nowMonth = this[_nowDate_].getMonth()
for (let i = nowMonth - previous; i <= nowMonth + next; i++) {
this.init(new Date().setMonth(i))
}
}
/**初始化日期 */
init(date) {
let _this = this[_CalendarObject_]
let {
firstDayOfWeek,
allowSameDay,
multipleDate,
monthList,
rangeDate,
dateList,
dateType,
current,
minDate,
maxDate,
value,
} = _this.data
let separator = this[_separator_]
let [year, month] = new Date(date).format(`yyyy${separator}MM`).split(separator)
let days = getDayNumber(year, Number(month))
let week = new Date(year, Number(month) - 1, 1).getDay()
let dateFormat = `yyyy${separator}MM${separator}dd`
let today = value || this[_nowDate_].format(dateFormat)
let nextDay = ''
let arr = []
dateList.push(`${year}${separator}${month}`)
if (dateType === 'range') {
nextDay = new Date(new Date().setDate(new Date(new Date(today)).getDate() + 1)).format(dateFormat)
}
let [t_year, t_month, t_day] = today.split(separator)
let [n_year, n_month, n_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${t_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}`:i}`
let obj = {
day: i,
data: dayStr,
active: t_year == year && t_month == month && i == Number(t_day)
}
if ((minDate && Date.parse(minDate) > Date.parse(dayStr)) || (maxDate && Date.parse(maxDate) < Date.parse(dayStr))) obj.disable = true
if (dateType === 'multiple') multipleDate.push(todayStr)
if (nextDay) {
if (t_year == year && t_month == month && i == Number(t_day)) {
obj.start = true
rangeDate.start = todayStr
}
if (n_year == year && n_month == month && i == Number(n_day)) {
obj.active = true
obj.end = true
rangeDate.end = `${year}${separator}${n_month}${separator}${n_day}`
}
}
firstDayOfWeek = firstDayOfWeek == 7 ? 0 : firstDayOfWeek
if (i === 1) obj.week = `week-${week - firstDayOfWeek}`
arr.push(obj)
}
monthList.push({
data: arr,
mark: Number(month)
})
if (current <= 1) {
let [nowYear, nowMonth] = today.split(separator)
current = dateList.findIndex(e => e === `${nowYear}${separator}${nowMonth}`)
}
_this.setData({
multipleDate,
date: today,
rangeDate,
monthList,
dateList,
current
})
}
/**当设置最小日期或者最大日期时 自动设置前后月份 */
getMonthDifference(date1, date2) {
let _this = this[_CalendarObject_]
let separator = this[_separator_]
//获取年,月数
let [year1,month1] = date1.split(separator)
let [year2,month2] = date2.split(separator)
let months = (parseInt(year2) - parseInt(year1)) * 12 + (parseInt(month2) - parseInt(month1))
return months
}
/**单选 */
single(e) {
let _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
showConfirm,
monthList
} = _this.data
monthList.map(x => {
x.data.map(i => i.active = false)
})
monthList[index].data[ind].active = true
_this.setData({
monthList,
date: data
})
if (!showConfirm) this.done()
}
/**多选 */
multiple(e) {
let _this = this[_CalendarObject_]
let {
index,
ind,
} = e.currentTarget.dataset
let {
monthList
} = _this.data
let arr = []
monthList[index].data[ind].active = !monthList[index].data[ind].active
monthList.map(x => x.data.map(i => {
if (i.active) arr.push(i.data)
}))
_this.setData({
[`monthList[${index}].data`]: monthList[index].data,
multipleDate: arr
})
}
/**范围选择 */
range(e) {
const _this = this[_CalendarObject_]
let {
index,
data,
ind
} = e.currentTarget.dataset
let {
allowSameDay,
showConfirm,
monthList,
rangeDate
} = _this.data
const start = Date.parse(rangeDate.start)
if (rangeDate.end || start > Date.parse(data)) {
monthList = clearStatus({
monthList,
index,
ind
})
rangeDate.start = data
rangeDate.end = ''
} else {
if (!allowSameDay && Date.parse(data) == Date.parse(rangeDate.start)) return
monthList[index].data[ind].active = true
monthList[index].data[ind].end = true
rangeDate.end = data
monthList.map(x => {
x.data.map(i => {
let day = Date.parse(i.data)
i.middle = day > start && day < Date.parse(data)
})
})
}
_this.setData({
monthList,
rangeDate
})
if (!showConfirm && rangeDate.end) this.done()
}
/**点击完成 */
done() {
let _this = this[_CalendarObject_]
let {
multipleDate,
rangeDate,
dateType,
date
} = _this.data
let targer = {
'single': date,
'multiple': multipleDate,
'range': rangeDate
}
if ((dateType === 'multiple' && multipleDate.length < 1) || (dateType === 'range' && !rangeDate.end)) return
_this.triggerEvent('select', {
date: targer[dateType]
})
_this.showCalendar()
}
}
/**
* 获取月份天数
*/
function getDayNumber(year, month) {
let days = 31
switch (month) {
case 2:
days = (year % 4 == 0 && year % 100 !== 0) || year % 400 == 0 ? 29 : 28
break;
case 4:
case 6:
case 9:
case 11:
days = 30
break;
}
return days
}
/**清空范围选择状态 */
function clearStatus(params) {
let {
monthList,
index,
ind
} = params
monthList.map(x => x.data.map(i => {
i.active = false
i.start = false
i.end = false
i.middle = false
}))
monthList[index].data[ind].active = true
monthList[index].data[ind].start = true
return monthList
}
export default Calendar
\ No newline at end of file \ No newline at end of file
export default {
properties: {
calenderHeight: {
type: [String, Number]
},
title: String, // 标题名称
hasRadius: {
type: Boolean,
value: true
}, // 是否圆角
showTitle: {
type: Boolean,
value: true
}, // 是否显示标题
showSubTitle: {
type: Boolean,
value: true
}, // 是否显示副标题
confirmText: String, // 确定按钮文本
showConfirm: {
type: Boolean,
value: true
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#00A479'
}, // 日历主题色
previous: {
type: Number,
value: 3
}, // 当前月的前几个月 ,默认3个月
next: {
type: Number,
value: 3
}, // 当前月的后几个月 , 默认3个月
vertical: Boolean, //是否纵向滑动
dateType: {
type: String,
value: 'single'
},
/** 选择类型默认单选,single单选, multiple多个日期,range日期范围 */
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay:Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
type: [Number, String],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark:Boolean
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
// show:true,
}
}
\ No newline at end of file \ No newline at end of file
// components/cell/cell.js
import {
haveEmoji,
replaceEmoji
} from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
label: String,
required: Boolean,
type: null,
maxlength: Number,
pickerData: Array,
placeholder: String,
value: {
type: String,
value: '',
observer: function(n, o) {
this.setData({
value: n
})
}
},
hideArrow: Boolean,
inputAlign: {
type: String,
value: 'left'
},
disabled: Boolean,
pickerFlag: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
typeIndex: 0,
subTypeIndex: 0,
pickerValue: [0, 0],
},
/**
* 组件的方法列表
*/
methods: {
change(e) {
let index = e.detail.value
this.setData({
pickerValue: index
})
this.triggerEvent('click', {
type: this.data.type,
value: index
})
},
click(e) {
this.triggerEvent('click')
},
input(e) {
let value = e.detail.value
if (haveEmoji(value)) value = replaceEmoji(value)
this.triggerEvent('input', {
type: this.data.type,
value: value
})
},
bindcolumnchange(e) {
console.log(e)
if (e.detail.column == 0) {
wx.showLoading({
title: '',
})
}
this.triggerEvent('pickerchange', e.detail)
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='cell-box'>
<block wx:if='{{type=="picker"}}'>
<picker range='{{pickerData}}' disabled="{{disabled}}" value='{{pickerValue}}' bindchange='change' range-key='name' mode='multiSelector' bindcolumnchange='bindcolumnchange'>
<view class='cell {{inputAlign=="right"?"inputRight":"inputLeft"}}'>
<view class='label {{required?"required":""}}' wx:if='{{label}}'>{{label}}</view>
<view class='value {{value?"":"no-value"}}'>
{{value ||'请选择'}}
<image wx:if='{{!hideArrow}}' class='arrow' src="./images/arrow.png"></image>
</view>
</view>
</picker>
</block>
<block wx:else>
<view class='cell {{inputAlign=="right"?"inputRight":"inputLeft"}} {{!label?"left":""}}' bindtap="click">
<view class='label {{required?"required":""}}' wx:if='{{label}}'>{{label}}</view>
<block wx:if='{{type=="input"}}'>
<input class='input' placeholder="{{placeholder}}" disabled="{{disabled}}" bindinput="input" placeholder-class="no-value" maxlength="{{maxlength}}" value='{{value}}'></input>
</block>
<block wx:elif='{{type=="slot"}}'>
<slot></slot>
</block>
<block wx:else>
<view class='value {{value?"":"no-value"}}'>
<text class='text'>{{value||'请选择'}}</text>
<image wx:if='{{!hideArrow}}' class='arrow' src="./images/arrow.png"></image>
</view>
</block>
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
/* components/cell/cell.wxss */
.cell-box {
padding-left: 40rpx;
background: #fff;
}
.cell {
height: 100rpx;
position: relative;
border-bottom: 2rpx solid #eee;
font-size: 28rpx;
color: #151515;
display: flex;
align-items: center;
box-sizing: border-box;
padding-right: 40rpx;
}
.cell.inputRight{
justify-content:space-between;
}
.cell.inputRight .input {
text-align: right;
}
.required::before{
content: '*';
color: red;
display: inline-block;
}
.value{
max-width: 75%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.value .text{
display: inline-block;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
max-width: 90%;
}
.no-value{
color: #999;
}
.cell.cellInput .input {
text-align: right;
width: 70%;
}
.cell.left .input{
width: 100%;
text-align: left;
}
.cell.inputLeft .label{
width: 25%;
}
.arrow{
width: 28rpx;
height: 28rpx;
vertical-align: middle;
transform: translateY(2rpx);
margin-left:20rpx;
}
// components/editBox/editBox.js
import {
haveEmoji,
replaceEmoji
} from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function(newVal, oldVal) {
this.setData({
value: ''
})
}
},
title: String,
maxlength: {
type: Number,
value: 4
},
placeholder: String
},
/**
* 组件的初始数据
*/
data: {
value: ''
},
/**
* 组件的方法列表
*/
methods: {
input(e) {
let value = e.detail.value
if (haveEmoji(value)) value = replaceEmoji(value)
this.setData({
value: value
})
},
click(e) {
let value = this.data.value
let type = e.currentTarget.dataset.type == 'ok'
if (type && !value) {
wx.showToast({
title: '请填写内容',
icon: 'none'
})
return
}
this.triggerEvent('click', {
type: type,
value: value
})
},
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='fixed' hidden="{{!show}}">
<view class='box'>
<view class='title'>{{title}}</view>
<input class='input' maxlength='{{maxlength}}' placeholder="{{placeholder}}" value='{{value}}' placeholder-style="color:#999;" bindinput="input"></input>
<view class='btn'>
<view bindtap="click" class="view">取消</view>
<view bindtap="click" data-type='ok' class="view">确定</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/editBox/editBox.wxss */
.fixed {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.65);
z-index: 9;
}
.box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 520rpx;
height: 320rpx;
border-radius: 8rpx;
background: #fff;
}
.title {
padding: 36rpx 0 44rpx;
font-size: 32rpx;
color: #333;
text-align: center;
}
.box .input {
margin: 0 50rpx;
font-size: 24rpx;
text-align: center;
padding-bottom: 16rpx;
border-bottom: 2rpx solid #e3e3e3;
}
.btn {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 84rpx;
line-height: 84rpx;
border-top: 1rpx solid #e3e3e3;
font-size: 24rpx;
color: #666;
}
.btn::after {
content: '';
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
border-right: 2rpx solid #e3e3e3;
height: 100%;
color: rgb(20, 104, 183)
}
.btn .view {
float: left;
width: 50%;
text-align: center;
}
// components/editTags/editTags.js
import util from '../../utils/util.js'
let employee = [{
tag: '贴心服务'
},
{
tag: '专业娴熟'
},
{
tag: '热情靠谱'
},
{
tag: '仪表整洁'
}
]
let store = [{
tag: '保养'
},
{
tag: '维修'
},
{
tag: '清洗'
},
{
tag: '钣喷'
}
]
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
tags: {
type: Array,
observer: function(n, o) {
this.setList(n)
}
},
type: {
type: String,
observer: function(n, o) {
this.setData({
labelType: n
})
}
},
isCheckbox: {
type: Boolean,
value: true
},
customSize:{
type:Number,
value: -1
},
tagSize:{
type:Number,
value:4
}
},
/**
* 组件的初始数据
*/
data: {
showEdit: false,
list: [],
labelType: 'employee'
},
/**
* 组件的方法列表
*/
methods: {
setList(arr) {
let labelType = this.data.labelType
let list = {
employee: employee,
store: store,
diy: arr
}
if (labelType != 'diy') {
list[labelType].forEach(i => {
arr.forEach((e, ind) => {
if (i.tag == e.tag) {
if (e.active) {
i.active = true
}
arr.splice(ind, 1)
}
e.custom = true
})
})
}
this.setData({
list: labelType != 'diy' ? [...list[labelType], ...arr]: arr
})
},
noScroll() {},
/**完成 */
click(e) {
let type = e.currentTarget.dataset.type
let list = this.data.list
let activeList = []
list.forEach(i => {
if (i.active) activeList.push({
tag: i.tag
})
})
if (type && activeList.length < 1) {
wx.showToast({
title: '至少选择一项',
icon: 'none'
})
return
}
this.triggerEvent('click', {
type: type,
tags: activeList,
list
})
},
addTags() {
let customSize = this.properties.customSize
let list = this.data.list
let customList = []
list.map(e =>{
if (e.custom) customList.push(e)
})
if (customList.length == customSize) {
util.showToast(`最多${customSize}个标签`)
return
}
this.setData({
showEdit: true
})
},
/**新增标签 */
tagsCallBack(e) {
console.log(e)
let type = e.detail.type
let value = e.detail.value
let list = this.data.list
let labelType = this.data.labelType
if (type) {
for (let i = 0; i < list.length; i++) {
if (value == list[i].tag) {
wx.showToast({
title: '标签不能重复',
icon: 'none'
})
return
}
}
if (list.length > 0 && labelType == 'diy') {
list.map(i => {
i.active = false
})
}
list.push({
tag: value,
custom: true,
active: true
})
this.setData({
list: list
})
}
this.setData({
showEdit: false
})
},
/**选标签 */
choose(e) {
let list = this.data.list
let index = e.currentTarget.dataset.index
let isCheckbox = this.data.isCheckbox
if (isCheckbox) {
list[index].active = !list[index].active
} else {
list.map(i => {
i.active = false
})
list[index].active = true
}
this.setData({
list: list
})
},
/**删除标签 */
del(e) {
let index = e.currentTarget.dataset.index
let list = this.data.list
list.splice(index, 1)
this.setData({
list: list
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='fixed' hidden="{{!show}}" catchtouchmove="noScroll">
<view class='box'>
<view class='control'>
<view class="cancel" bindtap="click">取消</view>
<view class='done' bindtap="click" data-type='ok'>完成</view>
</view>
<scroll-view class='content' scroll-y>
<block wx:for='{{list}}' wx:key='index'>
<view class='tags {{item.active?"active":""}}' >
<view class='text ' data-index='{{index}}' bindtap="choose">{{item.tag}}</view>
<view class='del' wx:if='{{item.custom}}' bindtap="del" data-index='{{index}}'>
<mp-icon icon="close" color="#999" size="12" class='icon'></mp-icon>
</view>
</view>
</block>
</scroll-view>
<view class='addTags' bindtap="addTags">添加自定义标签</view>
</view>
</view>
<edit-box show='{{showEdit}}' maxlength='{{tagSize}}' title='自定义标签' bindclick='tagsCallBack' placeholder='请输入标签名,不得超过{{tagSize}}个字'></edit-box>
\ No newline at end of file \ No newline at end of file
/* components/editTags/editTags.wxss */
.fixed {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.65);
z-index: 9;
}
.box {
position: absolute;
width: 100%;
height: 600rpx;
left: 0;
animation: show 0.5s forwards;
background: #fff;
border-radius: 8rpx 8rpx 0 0;
}
@keyframes show {
0% {
bottom: -600rpx;
}
100% {
bottom: 0;
}
}
.control {
height: 89rpx;
line-height: 89rpx;
padding: 0 40rpx;
border-bottom: 1rpx solid #e9e9e9;
font-size: 28rpx;
color: #333;
}
.cancel {
float: left;
}
.done {
float: right;
}
.content {
height: 390rpx;
width: 100%;
padding: 56rpx 20rpx 0 40rpx;
box-sizing: border-box;
}
.tags {
float: left;
text-align: center;
min-width: 210rpx;
height: 60rpx;
box-sizing: border-box;
font-size: 24rpx;
color: #999;
margin: 0 20rpx 20rpx 0;
position: relative;
display: flex;
align-items: center;
border-radius: 47rpx;
background: rgba(153, 153, 153,.1);
}
.text{
padding: 0 20rpx;
width: calc(100% - 40rpx);
height: 60rpx;
line-height: 60rpx;
box-sizing: border-box;
}
.del{
color: #000;
height: 100%;
width: 40rpx;
z-index: 99;
}
.icon{
position: absolute;
top:50%;
right: 16rpx;
transform: translateY(-55%);
}
.active {
background: rgba(5, 186, 160,.1);
color: #05BAA0;
}
.addTags {
width: 100%;
text-align: center;
height: 120rpx;
line-height: 120rpx;
font-size: 28rpx;
color: #05BAA0;
}
// components/glTab/glTab.js
import util from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
activeColor:{
type:String,
value:'#05BAA0'
},
activeDotColor:{
type:String,
value:'#05BAA0'
}
},
/**
* 组件的初始数据
*/
data: {
tabIndex:0
},
/**
* 组件的方法列表
*/
methods: {
change(e) {
let {
index
} = e.currentTarget.dataset
this.setTab(index)
this.triggerEvent('change',index)
},
setTab(index = 0) {
let {
tabIndex,
activeDotColor
} = this.data
util.getViewInfo(`#tab-${tabIndex}`, old => {
let oldLeft = old.left
let oldWidth = old.width
util.getViewInfo(`#tab-${index}`, res => {
let {
left,
width
} = res
if (tabIndex != index) {
let readyLeft = oldLeft > left ? left : oldLeft
let readyWidth = oldLeft > left ? oldLeft - left : left - oldLeft
this.setData({
activeStyle: `width:${readyWidth - oldWidth / 2 + width / 2}px;background-color:${activeDotColor};border-radius:100%;left:${readyLeft + oldWidth / 2}px;transition: all .1s;`
})
}
setTimeout(() => {
this.setData({
activeStyle: `width:${width}px;left:${left}px;background-color:${activeDotColor};`,
tabIndex: index
})
}, 100)
},this)
},this)
},
},
ready(){
this.setTab()
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="tab" style="grid-template-columns:repeat({{tabList.length}},1fr)">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item" style="color:{{tabIndex==index?activeColor:''}};" bindtap="change"
data-index="{{index}}">
<text class="tab-item-text" id="tab-{{index}}">{{item}}</text>
</view>
</block>
<view class="active-doc" style="{{activeStyle}}"></view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/glTab/glTab.wxss */
.tab {
position: sticky;
top: 0;
left: 0;
z-index: 2;
background-color: #fff;
height: 88rpx;
box-shadow: 0 2rpx 4rpx 2rpx #E9E9E9;
box-sizing: border-box;
display: grid;
align-items: center;
font-size: 28rpx;
color: #A9A9A9;
}
.active-doc{
position: absolute;
bottom: 5rpx;
height: 4rpx;
transition: all .25s;
}
.tab .tab-item{
text-align: center;
}
// components/glTextarea/glTextarea.js
import { haveEmoji, replaceEmoji } from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
maxlength:{
type:Number,
value:-1
},
placeholder:String,
showWordLimit: Boolean,
disabled:Boolean,
value:String
},
/**
* 组件的初始数据
*/
data: {
edit:true,
value:null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 打开文本编辑器
*/
openTextarea() {
if (this.data.disabled) return
this.setData({
edit: false,
textareaFocus: true
})
},
textareaBlur(e) {
let value = e.detail.value
if (haveEmoji(value)) value = replaceEmoji(value)
this.setData({
value: value,
edit: true
})
this.triggerEvent('input', {
value: value
})
},
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='textarea-box {{maxlength>0&&showWordLimit?"showWordLimit":""}}'>
<block wx:if='{{edit}}'>
<view class='textarea' bindtap="openTextarea" style="color:{{value?'#333':'#999'}}">{{value||placeholder||'请输入'}}</view>
</block>
<block wx:else>
<textarea maxlength="{{maxlength}}" value='{{value}}' focus='{{textareaFocus}}' bindblur='textareaBlur' bindconfirm='textareaBlur' ></textarea>
</block>
<block wx:if='{{maxlength>0&&showWordLimit}}'>
<view class='wordLimit'>
{{value.length||0}} / {{maxlength}}
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
/* components/glTextarea/glTextarea.wxss */
.textarea-box {
width: 100%;
height: 100%;
position: relative;
}
.textarea-box .textarea {
height: 100%;
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - 40rpx);
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
This diff could not be displayed because it is too large.
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<wxs module="utils">
var double = function(a) {
return 2*a
};
var ifSpecialIcon = function(v) {
return v === 'arrow' || v === 'back'
}
module.exports = {
double: double,
ifSpecialIcon: ifSpecialIcon
}
</wxs>
<view class="{{extClass}} weui-icon" style="background:{{color}};width:{{size}}px;height:{{ utils.ifSpecialIcon(icon) ? utils.double(size) : size}}px;mask-image:url({{src}});-webkit-mask-image:url({{src}});-moz-mask-image:url({{src}})"></view>
.weui-icon{vertical-align:middle;display:inline-block;background:black;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;-moz-mask-repeat:no-repeat;mask-size:cover;-webkit-mask-size:cover;-moz-mask-size:cover}
\ No newline at end of file \ No newline at end of file
// components/list/list.js
const util = require('../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array,
value:[],
observer:function(n,o){
if(n){
this.setData({
list:n
})
}
}
},
margin:{
type: Number,
value: 0
},
haveArrow:{
type: Boolean,
value:true
},
inputPlaceholder: {
type:String,
value:'请输入'
},
showPlaceholder:Boolean
},
/**
* 组件的初始数据
*/
data: {
list:[]
},
/**
* 组件的方法列表
*/
methods: {
input(e){
let index = e.target.dataset.index
let value = e.detail.value
this.triggerEvent('input', {index,value})
},
jump(e) {
let obj = e.currentTarget.dataset.item
obj.index = e.currentTarget.dataset.index
if (!obj.hideArrow){
if (obj.url) {
let type = obj.type
let url = type == 'h5' ? `/pages/webpage/webpage?path=${encodeURIComponent(obj.url)}` : obj.url
wx.navigateTo({
url: url
})
} else {
this.triggerEvent('click', obj)
}
}
},
chooseTime(e){
let value = e.detail
this.triggerEvent('chooseTime', value)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='group' style='margin-top:{{margin}}rpx'>
<block wx:for='{{list}}' wx:key='index'>
<view class='view {{item.hideArrow?"":"arrow"}}' bindtap='jump' data-index='{{index}}' data-item='{{item}}'>
<image class='image' src='{{item.icon}}' wx:if='{{item.icon}}'></image>
<view class='label'>{{item.name}}</view>
<block wx:if='{{item.type == "time"}}'>
<!-- 时间控件 -->
<time-picker bindchoose='chooseTime' timeValue='{{item.value}}'></time-picker>
</block>
<block wx:elif='{{item.type=="input"}}'>
<input type='{{item.inputType||"text"}}' disabled="{{item.disabled}}" value='{{item.value}}' bindinput='input' class='input' maxlength="{{item.maxlength||-1}}" data-index='{{index}}' placeholder="{{inputPlaceholder}}"></input>
</block>
<block wx:else>
<text wx:if='{{item.value}}' class='text'>{{item.value}}</text>
<text wx:if='{{!item.value&&showPlaceholder}}' class='noValue'>请选择</text>
</block>
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
/* components/list/list.wxss */
.group {
background: #fff;
padding-left: 40rpx;
}
.group .view {
height: 103rpx;
line-height: 103rpx;
font-size: 28rpx;
color: #333;
border-bottom: 1rpx solid #eee;
position: relative;
display: flex;
align-items: center;
}
.group .image {
width: 28rpx;
height: 28rpx;
margin-right: 20rpx;
vertical-align: baseline;
}
.group .text {
display: inline-block;
max-width: 65%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.group .label {
width: 25%;
}
.group .input {
width: 75%;
}
.arrow::after {
content: '';
width: 14rpx;
height: 14rpx;
position: absolute;
top: 50%;
right: 40rpx;
border-right: 2rpx solid #999;
border-bottom: 2rpx solid #999;
transform: translateY(-50%) rotate(-45deg);
}
.tips {
font-size: 20rpx;
color: #999;
position: absolute;
top: 50%;
right: 80rpx;
transform: translateY(-50%);
}
.noValue {
display: block;
width: 75%;
color: #999;
}
// components/marquee/marquee.js
let timer = null
import util from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
data: {
type: String,
value: '测试公告'
},
delay: {
type: Number,
value: 1000
},
fontSize: {
type: Number,
value: 12
},
speed: {
type: Number,
value: 5000
}
},
/**
* 组件的初始数据
*/
data: {
flag: true,
},
/**
* 组件的方法列表
*/
methods: {
/**
* 获取宽度
*/
getWidth() {
let boxWidth = 0
let valueWidth = 0
util.getViewInfo('#marquee', res => {
boxWidth = res.width
this.setData({
boxWidth
})
util.getViewInfo('#content', contentInfo => {
valueWidth = contentInfo.width
if (boxWidth - 20 <= valueWidth) {
this.setData({
valueWidth
})
this.run()
}
}, this)
}, this)
},
run() {
clearTimeout(timer)
util.promise(resolve => {
let {
speed,
delay,
valueWidth
} = this.data
let animation = wx.createAnimation({
duration: speed,
timingFunction: 'linear',
delay
})
animation.left(`-${valueWidth}px`).step()
this.setData({
animation: animation.export()
})
let time = Number(delay) + Number(speed) + 1000
timer = setTimeout(() => {
resolve()
}, time)
}).then(() => {
this.setData({
flag: false
})
this.again()
})
},
again() {
clearTimeout(timer)
util.promise(resolve => {
let {
boxWidth
} = this.data
let animation = wx.createAnimation({
duration: 1,
timingFunction: 'linear'
})
animation.left(`${boxWidth}px`).step()
this.setData({
animation: animation.export()
})
timer = setTimeout(() => {
resolve()
}, 500)
}).then(() => {
this.setData({
flag: true
})
this.goZero()
})
},
goZero() {
clearTimeout(timer)
util.promise(resolve => {
let {speed} = this.data
let animation = wx.createAnimation({
duration: speed,
timingFunction: 'linear',
})
animation.left('0%').step()
this.setData({
animation: animation.export()
})
timer = setTimeout(() => {
resolve()
}, Number(speed) + 5000)
}).then(() => {
this.run()
})
}
},
ready(){
this.getWidth()
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='marquee-box' style="font-size:{{fontSize * 2}}rpx">
<image src="./images/notice.png" class="img"></image>
<view class='box' id='marquee' style="height:{{fontSize / 0.75 * 2}}rpx">
<view class='content' id='content' style="opacity:{{flag?1:0}}; color:{{color}}" animation='{{animation}}'>{{data}}</view>
</view>
</view>
/* components/marquee/marquee.wxss */
.marquee-box {
padding: 14rpx;
position: relative;
box-sizing: border-box;
background: rgba(239, 168, 118,.3);
}
.marquee-box .img {
position: absolute;
width: 26rpx;
height: 24rpx;
top: 50%;
left: 20rpx;
transform: translateY(-50%);
}
.marquee-box .box {
width: calc(100% - 46rpx);
margin-left: 46rpx;
position: relative;
overflow: hidden;
}
.marquee-box .box .content{
width: auto;
height:100%;
position: absolute;
top: 0;
left: 0;
white-space: nowrap;
}
// components/navigationBar/navigationBar.js
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
titleText: {
type: String,
value: '嘀加智慧门店'
},
showBtn:{
type: Boolean,
value:true
},
showBack:{
type: Boolean,
value: false
},
showHome: {
type: Boolean,
value: false
},
intercept:{
type: Boolean,
value: true
},
bgColor:null,
textColor:{
type:String,
value: '#333'
}
},
/**
* 组件的初始数据
*/
data: {
statusBarHeight: 0,
statusBarPadding: 0,
btn: [
{
url: 'images/back.png'
},
{
url: 'images/home.png'
}
],
ios: false
},
/**
* 组件的方法列表
*/
methods: {
navigation(e) {
let index = e.currentTarget.dataset.index
if(index == 0) {
this.triggerEvent('navigateBack')
if (this.properties.intercept) {
console.log(getCurrentPages())
if (getCurrentPages().length > 1){
wx.navigateBack({
delta: 1,
fail(e) {
wx.switchTab({
url: '/packageIndex/pages/index/index'
})
}
})
}else{
wx.switchTab({
url: '/packageIndex/pages/index/index'
})
}
}
} else {
wx.switchTab({
url: '/packageIndex/pages/index/index'
})
}
},
goHome() {
wx.switchTab({
url: '/packageIndex/pages/index/index'
})
}
},
ready() {
let systemInfo = app.globalData.systemInfo
let height = systemInfo.statusBarPadding * 2 + systemInfo.statusBarHeight + 32
this.setData({
ios: systemInfo.ios,
statusBarPadding: systemInfo.statusBarPadding,
statusBarHeight: systemInfo.statusBarHeight
})
this.triggerEvent('getNavHeight', height)
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='navigation-bar' id='navigation-bar' style='padding-top:{{statusBarHeight}}px;background-color:{{bgColor}};'>
<view class='navigation-bar-box' style='padding:{{statusBarPadding}}px'>
<view class='navigation-bar-btn' wx:if='{{!showBack && showBtn && !showHome}}'>
<view class='navigation-bar-img' wx:for='{{btn}}' wx:key='*this' data-index='{{index}}' bindtap='navigation'>
<image class='image' src='{{item.url}}'></image>
</view>
</view>
<view class='navigation-bar-back' wx:if='{{showBack}}' bindtap='navigation' data-index='0'>
<image class='image' src='{{bgColor?"images/back-w.png":"images/back.png"}}' ></image>
</view>
<view class="navigation-bar-home" wx:if='{{showHome}}' bindtap="goHome">
<image class='image' src='images/share_home.png'></image>
</view>
<view wx:if='{{ios?true:statusBarPadding!=0?true:false}}' class='navigation-bar-titleText {{ios?"ios":""}} {{showHome?ios?"":"android":""}}' style='margin-left:{{ios?"0":showBack?"0":"10"}}px;top:{{ios?statusBarHeight + statusBarPadding + 1:"0"}}px;color:{{textColor}}'>{{titleText}}</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/navigationBar/navigationBar.wxss */
.navigation-bar{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9;
height: 44px;
padding-top: 20px;
}
.navigation-bar-box{
position: relative;
width: 70%;
height: 32px;
display: flex;
align-items: center;
padding-top: 6px;
}
.navigation-bar-titleText{
display: inline-block;
font-size: 18px;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 10px;
max-width: calc(100% - 76.5px);
}
.navigation-bar-btn{
position: relative;
width: 86.5px;
height: 32px;
border: 1px solid #CECECE;
border-radius: 100px;
box-sizing: border-box;
}
.navigation-bar-back{
position: relative;
width: 32px;
height: 32px;
transform: translateX(-6px);
}
.navigation-bar-back .image{
width: 18px;
height: 18px;
position: absolute;
top: 50%;
left: 6px;
transform: translateY(-50%);
}
.navigation-bar-img{
float: left;
width: 50%;
height: 100%;
position: relative;
}
.navigation-bar-img .image{
width: 18px;
height: 18px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.navigation-bar-btn::after{
content: '';
width: 1px;
height: 18.5px;
position: absolute;
top: 50%;
left: 50%;
background: #CECECE;
transform: translate(-50%,-50%);
}
.navigation-bar-home{
position: absolute;
top: 50%;
left: 5px;
width: 42px;
height: 32px;
border: 1px solid #cecece;
border-radius: 100px;
transform: translateY(-50%);
}
.navigation-bar-home .image{
width: 16px;
height: 16px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.ios{
position: fixed;
max-width: 40%;
top: 0;
left:50%;
transform: translateX(-50%);
margin-left: 0;
font-weight: bold;
}
.android{
margin-left: 60px !important;
}
\ No newline at end of file \ No newline at end of file
let privacyHandler
let privacyResolves = new Set()
let closeOtherPagePopUpHooks = new Set()
wx.onNeedPrivacyAuthorization(resolve => {
if (typeof privacyHandler === 'function') {
privacyHandler(resolve)
}
})
const closeOtherPagePopUp = (closePopUp) => {
closeOtherPagePopUpHooks.forEach(hook => {
if (closePopUp !== hook) {
hook()
}
})
}
Component({
data: {
title: "用户隐私保护提示",
desc1: "感谢您使用本游戏,您使用本游戏前应当阅井同意",
urlTitle: "《用户隐私保护指引》",
desc2: "当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。",
innerShow: false,
height: 0,
},
lifetimes: {
attached: function() {
const closePopUp = () => {
this.disPopUp()
}
privacyHandler = resolve => {
privacyResolves.add(resolve)
this.popUp()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
closeOtherPagePopUp(closePopUp)
}
closeOtherPagePopUpHooks.add(closePopUp)
this.closePopUp = closePopUp
},
detached: function() {
closeOtherPagePopUpHooks.delete(this.closePopUp)
}
},
methods: {
handleAgree(e) {
this.disPopUp()
// 这里演示了同时调用多个wx隐私接口时要如何处理:让隐私弹窗保持单例,点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 (看page/index/index中的 wx.getClipboardData 和 wx.startCompass)
privacyResolves.forEach(resolve => {
resolve({
event: 'agree',
buttonId: 'agree-btn'
})
})
privacyResolves.clear()
},
handleDisagree(e) {
this.disPopUp()
privacyResolves.forEach(resolve => {
resolve({
event: 'disagree',
})
})
privacyResolves.clear()
},
popUp() {
if (this.data.innerShow === false) {
this.setData({
innerShow: true
})
}
},
disPopUp() {
if (this.data.innerShow === true) {
this.setData({
innerShow: false
})
}
},
openPrivacyContract() {
wx.openPrivacyContract({
success: res => {
console.log('openPrivacyContract success')
},
fail: res => {
console.error('openPrivacyContract fail', res)
}
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view wx:if="{{innerShow}}" class="weui-half-screen-dialog" style="border-color:rgb(64, 247, 94); border-style:solid; border-width:3px; position: fixed; bottom:{{height}}px" >
<view class="weui-half-screen-dialog__hd">
<text class="weui-half-screen-dialog__title">{{title}}</text>
</view>
<view class="weui-half-screen-dialog__bd">
<view class="weui-half-screen-dialog__tips">{{desc1}}</view>
<view class="weui-half-screen-dialog__tips" style="color:blue" bindtap="openPrivacyContract">{{urlTitle}}</view>
<view class="weui-half-screen-dialog__tips">{{desc2}}</view>
</view>
<view class="weui-half-screen-dialog__ft">
<view class="weui-half-screen-dialog__btn-area">
<button id="disagree-btn"
type="default"
class="weui-btn"
bindtap="handleDisagree"
>不同意</button>
<button id="agree-btn"
type="default"
open-type="agreePrivacyAuthorization"
class="weui-btn"
bindagreeprivacyauthorization="handleAgree"
>同意并继续</button>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
// components/searchInput/searchInput.js
import {
haveEmoji,
replaceEmoji
} from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
searchValue: {
type: String,
value: '',
observer: function (n, o) {
if (n) {
this.setData({
searchValue: n
})
}
}
},
isFocus: null,
placeholder: null,
closeBlurSearch: null,
closeVerify: null
},
/**
* 组件的初始数据
*/
data: {
searchValue: '',
hideSearch: false
},
/**
* 组件的方法列表
*/
methods: {
focus() {
this.setData({
hideSearch: true
})
},
click() {
this.setData({
isFocus: true
})
},
blur() {
console.log(1)
let {
searchValue,
closeBlurSearch
} = this.data
this.setData({
hideSearch: false
})
if (!searchValue || closeBlurSearch) return
this.triggerEvent('search', searchValue)
},
input(e) {
let {
value
} = e.detail
if (haveEmoji(value)) searchValue = replaceEmoji(value)
this.setData({
searchValue: value
})
},
confirm(e) {
let {
searchValue,
closeVerify,
} = this.data
let {
type
} = e.currentTarget.dataset
if (type) {
this.setData({
searchValue: '',
hideSearch: false
})
return
}
if (!searchValue && !closeVerify) return
let {
value
} = e.detail
this.setData({
searchValue: value
})
this.triggerEvent('search', searchValue)
},
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="box">
<view class="search-input {{hideSearch?'w90':''}}" >
<input class='input' bindfocus='focus' bindblur='blur' focus='{{isFocus}}' bindinput='input' value='{{searchValue}}' bindconfirm='confirm' confirm-type='search'></input>
<view class="search" wx:if='{{!searchValue}}' bindtap="click">
<image class='image' src="./images/search.png"></image>
<text class='text'>{{placeholder||'搜索'}}</text>
</view>
<view class="clear" bindtap="confirm" data-type='clear'>
<image class='image' src="./images/clear.png" hidden="{{!searchValue}}"></image>
</view>
</view>
<!-- <view class='search-cancel' bindtap="confirm" data-type='clear'>取消</view> -->
</view>
\ No newline at end of file \ No newline at end of file
/* components/searchInput/searchInput.wxss */
.search-input {
position: relative;
float: left;
width: 100%;
height: 40rpx;
box-sizing: border-box;
}
.w90 {
width: 100%;
}
.search-input .search {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
height: 100%;
font-size: 24rpx;
color: #999;
line-height: 40rpx;
display: flex;
align-items: center;
}
.search-input .search .image {
width: 32rpx;
height: 32rpx;
margin-right: 7rpx;
}
.search-input .input {
height: 100%;
width: 100%;
box-sizing: border-box;
font-size: 28rpx;
}
.w90 .search {
display: none;
}
.w90 .input {
width: calc(100% - 57rpx);
color: #333;
}
.w90 .clear {
position: absolute;
width: 57rpx;
height: 40rpx;
top: 0;
right: 0;
}
.w90 .clear .image {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 28rpx;
height: 28rpx;
}
.w90~.search-cancel{
display: block;
}
.search-cancel {
display: none;
float: left;
width: 10%;
height: 40rpx;
line-height: 40rpx;
font-size: 24rpx;
color: #666;
text-align: right;
}
\ No newline at end of file \ No newline at end of file
// components/share/share.js
import util from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (newVal, oldVal) {
this.check(newVal)
}
},
data: {
type: Object,
value: {},
observer: function (newVal, oldVal) {
}
},
hideWx: Boolean,
hideCancel: Boolean,
goods: Boolean
},
ready() {
},
/**
* 组件的初始数据
*/
data: {
imgWidth: 250,
imgHeight: 420,
tempFilePath: '',
bgImg: './images/bg.png'
},
/**
* 组件的方法列表
*/
methods: {
/**
* 检查
*/
check(bool) {
let data = this.properties.data
if (bool) {
this.getImgData(res => {
if (res.qr) this.draw(res)
})
}
},
/**
* 禁止滑动
*/
noScroll() {},
/**
* 取消
*/
cancel() {
this.triggerEvent('hide', false)
},
saveImg() {
wx.saveImageToPhotosAlbum({
filePath: this.data.tempFilePath,
success(e) {
console.log(e)
wx.showToast({
title: '保存成功'
})
},
fail(err) {
console.log(err)
wx.showToast({
title: err
})
}
})
},
/**
* 保存
*/
save() {
let that = this
wx.getSetting({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
that.saveImg()
},
fail(err) {
console.log(err)
wx.showToast({
title: '请在小程序设置允许保存图片',
icon: 'none',
mask: true,
success() {}
})
}
})
} else {
that.saveImg()
}
}
})
wx.nextTick(() => this.cancel())
},
/**
* 画!
*/
draw(images) {
const data = this.properties.data
const ctx = wx.createCanvasContext(`img`, this)
let isGoods = this.properties.goods
const imgWidth = isGoods ? this.data.imgWidth : 315
const imgHeight = isGoods ? this.data.imgHeight : 456
util.getViewInfo('.choose-list', res => {
util.getViewInfo('.bg', phoneInfo => {
util.getViewInfo('.info', info => {
let viewTop = (phoneInfo.height - res.height - info.height) / 2
this.setData({
viewTop: viewTop,
})
},this)
}, this)
}, this)
let target = !isGoods ? 'draw_store_card' : 'draw_goods'
ctx.clearRect(0, 0, imgWidth, imgHeight)
this[target](images, data, ctx, imgWidth, imgHeight, res => {
ctx.draw(true, setTimeout(() => this.getCanvasImg(), 500))
})
},
/**
* 生成门店
*/
draw_store_card(images, data, ctx, imgWidth, imgHeight, callBack) {
console.log(images)
// 背景
ctx.setTextAlign('left')
ctx.setTextBaseline('top')
ctx.setFillStyle('#fff')
ctx.drawImage(this.data.bgImg, 0, 0, imgWidth, imgHeight)
ctx.save()
//头像
ctx.beginPath()
ctx.arc(69, 71, 35, 0, 2 * Math.PI)
ctx.clip()
ctx.drawImage(images.photo || '/images/default.png', 34, 36, 70, 70)
ctx.restore()
ctx.save()
//名称
ctx.setFillStyle('#333')
let haveName = data.name
if (haveName) {
ctx.setFontSize(20)
ctx.setStrokeStyle('#333')
ctx.strokeText(haveName, 120, 37)
}
ctx.setFontSize(14)
if (data.phone) ctx.fillText(`联系电话:${data.phone}`, 120, haveName ? 65 : 46)
ctx.fillText(data.merchantName, 120, haveName ? 85 : 66, 161)
//提示
ctx.setTextAlign('center')
ctx.fillText(data.tips || '我已上传好产品和视频,期待您的关注~', imgWidth / 2, 142, 245)
//二维码
ctx.drawImage(images.qr, imgWidth / 2 - 90, 205, 180, 180)
return callBack()
},
/**生成商品 */
draw_goods(images, data, ctx, imgWidth, imgHeight, callBack) {
// 背景
ctx.setTextAlign('left')
ctx.setTextBaseline('top')
ctx.setFillStyle('#fff')
ctx.fillRect(0, 0, imgWidth, imgHeight)
ctx.save()
//商品图
ctx.drawImage(images.photo, 0, 0, imgWidth, 311)
ctx.setFontSize(14)
ctx.setStrokeStyle('#333')
ctx.strokeText(data.name, 14, 321, 222)
ctx.setFontSize(12)
ctx.setFillStyle('#666')
ctx.fillText(`商户名称:${data.user.merchantName}`, 14, 353, 157)
if (data.user.name || data.user.contactName) ctx.fillText(`联系人:${data.user.name || data.user.contactName}`, 14, 369, 157)
if (data.user.phone) ctx.fillText(`联系电话:${data.user.phone}`, 14, 385, 157)
//二维码
ctx.drawImage(images.qr, 171, 347, 63, 62)
return callBack()
},
/**
* 画布生成图片
*/
getCanvasImg() {
let that = this
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: that.data.imgWidth * 2,
height: that.data.imgHeight * 2,
canvasId: 'img',
fileType: 'jpg',
quality: 1,
success(res) {
wx.hideLoading()
that.triggerEvent('init', res.tempFilePath)
wx.nextTick(() => {
that.setData({
tempFilePath: res.tempFilePath,
flag: true
})
})
},
}, this)
},
/**
* 图片转成本地
*/
getImgData(callBack) {
let images = {}
let goods = this.properties.goods
let data = this.properties.data
let photo = !goods ? data.photo || data.shopPhoto : data.productCoverUrl
console.log(goods, data, photo)
let that = this
wx.showLoading({
title: '加载中',
mask: true,
success(res) {
// 获取二维码
wx.getImageInfo({
src: data.qr,
success(res) {
images.qr = res.path
if (photo) {
// 背景图
wx.getImageInfo({
src: photo,
success(res) {
images.photo = res.path
return callBack(images)
},
fail(err) {
console.log('photo', err)
wx.hideLoading()
wx.showToast({
icon: 'none',
title: '图片生成失败,请稍后再试'
})
}
})
} else {
return callBack(images)
}
},
fail(err) {
console.log('qr', err)
wx.hideLoading()
wx.showToast({
icon: 'none',
title: '图片生成失败,请稍后再试'
})
}
})
}
})
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<glsx-privacy appletName="嘀加智慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view class='share-box' catchtouchmove='noScroll' wx:if='{{show}}'>
<view class='bg' bindtap='cancel'></view>
<view class='info {{!goods?"isStoreInfo":"goods"}} {{flag?"flag":""}}' style="top:{{viewTop}}px;">
<block wx:if='{{goods}}'>
<image src="{{data.productCoverUrl}}" class='goods-photo'></image>
<view class='goods-name text-hide'>{{data.name}}</view>
<view class='goods-info'>
<view class='text-hide'>商户名称:{{data.user.merchantName}}</view>
<view class='text-hide' wx:if='{{data.user.name || data.user.contactName}}'>联系人:{{data.user.name || data.user.contactName}}</view>
<view class='text-hide' wx:if='{{data.user.phone}}'>联系电话:{{data.user.phone}}</view>
</view>
<view class='qr'>
<image src="{{data.qr}}"></image>
</view>
</block>
<block wx:else>
<view class='share-bg'>
<image src="{{bgImg}}"></image>
</view>
<view class='info-data zIndex-1'>
<image src="{{data.photo||data.shopPhoto|| '/images/default.png'}}" class='image'></image>
<view class='info-text'>
<view wx:if='{{data.name}}' class='name'>{{data.name}}</view>
<view wx:if='{{data.phone}}'>联系电话:{{data.phone}}</view>
<view wx:if='{{data.merchantName}}' class='text-hide'>{{data.merchantName}}</view>
</view>
</view>
<view class='tips zIndex-1'>{{data.tips}}</view>
<view class='qr zIndex-1'>
<image src="{{data.qr}}"></image>
</view>
</block>
</view>
<view class='choose-list' style="height:{{hideCancel?'auto':'298rpx'}}">
<view class='list'>
<view class='list-btn' wx:if='{{!hideWx}}'>
<image src='images/wx.png' class='image'></image>
<view>微信好友</view>
<button open-type='share' bindtap='cancel' class='button'></button>
</view>
<view class='list-btn' bindtap='save'>
<image src='images/share.png' class='image'></image>
<view>保存分享</view>
</view>
</view>
<view wx:if='{{!hideCancel}}' class='cancel' bindtap='cancel'>取消</view>
</view>
</view>
<view class='canvas {{!goods?"isStore":""}}'>
<canvas canvas-id='img' style='width:100%;height:100%;'></canvas>
</view>
\ No newline at end of file \ No newline at end of file
/* components/share/share.wxss */
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.share-box {
position: fixed;
z-index: 999999;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
.share-box .bg {
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
}
.share-box .info {
position: absolute;
left: 10000%;
transform: translateX(-50%);
width: 500rpx;
height: 840rpx;
background: #fff;
border-radius: 8rpx;
overflow: hidden;
box-sizing: border-box;
}
.share-box .info.flag{
left: 50%;
}
.share-box .isStoreInfo {
width: 630rpx;
height: 912rpx;
padding: 72rpx 68rpx 0;
font-size: 28rpx;
color: #333;
}
.info-text {
max-width: 322rpx;
}
.zIndex-1 {
position: relative;
z-index: 1;
}
.info-data {
height: 140rpx;
display: flex;
align-items: center;
}
.info-data .image {
width: 140rpx;
height: 140rpx;
border-radius: 100%;
margin-right: 32rpx;
}
.info-data .name {
font-size: 40rpx;
font-weight: 700;
}
.isStoreInfo .tips {
margin: 54rpx auto 86rpx;
}
.isStoreInfo .qr {
display: block;
margin: 0 auto;
width: 360rpx;
height: 360rpx;
}
.choose-list {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
background: #f6f6f6;
}
.choose-list .cancel {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
font-size: 28rpx;
color: #333;
background: #fff;
}
.list {
width: 100%;
height: 182rpx;
background: #fff;
display: flex;
}
.list-btn {
flex: 1;
text-align: center;
font-size: 24rpx;
color: #333;
padding-top: 40rpx;
position: relative;
}
.list-btn .image {
width: 60rpx;
height: 60rpx;
margin-bottom: 10rpx;
}
.list-btn .button {
width: 100%;
height: 100%;
position: absolute;
opacity: 0;
top: 0;
left: 0;
}
.goods .goods-photo {
width: 100%;
height: 622rpx;
}
.goods .goods-name {
padding: 20rpx 28rpx 24rpx 28rpx;
font-size: 28rpx;
color: #333;
width: 100%;
box-sizing: border-box;
font-weight: 700;
}
.goods .goods-info {
padding-left: 28rpx;
box-sizing: border-box;
width: 342rpx;
color: #666;
font-size: 24rpx;
}
.goods .qr {
position: absolute;
bottom: 22rpx;
right: 32rpx;
width: 126rpx;
height: 124rpx;
}
.canvas {
width: 250px;
height: 420px;
position: fixed;
top: -1000%;
left: -1000%;
/* top: 12rpx;
left: 50%;
transform: translateX(-50%);
z-index: 99999999999; */
}
.isStore {
width: 315px;
height: 456px;
top: 40rpx;
}
.share-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
// components/tabView/tabView.js
import { getViewInfo,throttle,showLoading,hideLoading} from '../../utils/util.js'
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
height:null,
hasTags:{
type:Array,
value:[],
observer:function(n,o){
this.setData({
sticky: n.length > 0
})
}
},
tagIndex:{
type:Number,
value:0,
observer: function (n, o) {
this.setData({
count: n
})
}
},
refresherEnabled:Boolean,
triggered:Boolean
},
/**
* 组件的初始数据
*/
data: {
count: 0,
scrollTop:0,
sticky:false
},
/**
* 组件的方法列表
*/
methods: {
click(e) {
showLoading('')
let index = e.currentTarget.dataset.index
let item = e.currentTarget.dataset.item
item.index = index
this.setData({
count: index,
scrollTop: 0
})
this.triggerEvent('click', item)
},
tabScrollTolower(e){
this.triggerEvent('tabScrollTolower')
},
viewScrollTolower(e){
this.triggerEvent('viewScrollTolower')
},
bindrefresherrefresh(e){
this.triggerEvent('refresherrefresh')
}
},
ready() {
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='tab-box' id='tabView' style="height:calc(100vh - {{height}}px)">
<scroll-view style="height:100%;" scroll-y class='tab' bindscrolltolower='tabScrollTolower'>
<view>
<block wx:for='{{tabList}}' wx:key='index'>
<view class='tab-item {{count==index?"active":""}}' bindtap="click" data-item='{{item}}' data-index='{{index}}'>{{item.name}}</view>
</block>
</view>
</scroll-view>
<view class='view'>
<slot name='sticky'></slot>
<view style="height:calc(100% - {{sticky?'48px':'0px'}});margin-top:{{sticky?'48px':'0'}};">
<scroll-view style="height:100%" scroll-y scroll-top='{{scrollTop}}' bindscrolltolower='viewScrollTolower' refresher-enabled='{{refresherEnabled}}' refresher-triggered='{{triggered}}' bindrefresherrefresh='bindrefresherrefresh'>
<view class='refresherEnabled' wx:if='{{refresherEnabled}}'>
<block wx:for='{{20}}' wx:key='index'>
<view>{{item}}</view>
</block>
</view>
<view class='content'>
<slot name='content'></slot>
</view>
</scroll-view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/tabView/tabView.wxss */
.tab {
float: left;
width: 26.7%;
box-sizing: border-box;
text-align: center;
background: #f4f4f4;
}
.view {
float: left;
width: 73.3%;
height: 100%;
position: relative;
background: #fff;
}
.tab-item {
width: 100%;
height: 96rpx;
line-height: 96rpx;
font-size: 24rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #333;
box-sizing: border-box;
padding: 0 10rpx;
}
.active {
font-weight: 700;
background: #fff;
position: sticky;
top: 0;
}
.refresherEnabled {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
opacity: 0;
}
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
\ No newline at end of file \ No newline at end of file
// components/tabbar.js
Component({
/**
* 组件的属性列表
*/
properties: {
list: Array,
flex: null,
defaultIndex: {
type: Number,
observer: function (n, o) {
this.setData({
count: n
})
}
},
},
/**
* 组件的初始数据
*/
data: {
count: 0,
},
/**
* 组件的方法列表
*/
methods: {
click(e){
let index = e.currentTarget.dataset.index
this.setData({
count: index
})
this.triggerEvent('tabclick', index)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='tabbar {{flex?"flex":""}}'>
<block wx:for='{{list}}' wx:key='index'>
<view class="tabbar-item {{count == index ? 'active': ''}}" bindtap="click" data-index="{{index}}">
{{item}}
</view>
</block>
</view>
\ No newline at end of file \ No newline at end of file
/* components/tabbar.wxss */
.tabbar {
height: 102rpx;
line-height: 102rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #EEEEEE;
}
.flex{
display: flex;
}
.tabbar-item {
float: left;
margin-right: 80rpx;
font-size: 28rpx;
color: #333;
}
.flex .tabbar-item{
flex: 1;
text-align: center;
margin-right: 0;
}
.tabbar-item:last-of-type{
margin-right: 0;
}
.tabbar-item.active {
color: #05BAA0;
position: relative;
font-weight: bold;
}
.tabbar-item.active::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 80rpx;
height: 4rpx;
background-color: #05BAA0;
}
// components/timePicker/timePicker.js
let startTime = setTime()
let endTime = setTime()
let second = setSecond()
let endSecond = setSecond(1)
function setTime(limit = 0, arr = []) {
for (let i = limit; i < 24; i++) {
arr.push(i < 10 ? `0${i}` : i)
}
return arr
}
function setSecond(limit = 0, end = 60, arr = []) {
for (let i = limit; i < end; i++) {
arr.push(i < 10 ? `0${i}` : i)
}
return arr
}
Component({
/**
* 组件的属性列表
*/
properties: {
timeValue: {
type: String,
value: '',
observer: function (n, o) {
if (n) {
this.setData({
timeValue: n
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
time: [startTime, second, endTime, endSecond],
timeValue: '',
values: [0, 0, 0, 0]
},
/**
* 组件的方法列表
*/
methods: {
columnChange(e) {
let column = e.detail.column
let value = e.detail.value
let time = this.data.time
let values = this.data.values
values[column] = value
let st_value = time[0][values[0]]
let ss_value = time[1][values[1]]
let et_value = time[2][values[2]] ? time[2][values[2]] : 23
let es_value = time[3][values[3]]
console.log(st_value, ss_value, et_value, es_value)
console.log(values[0], values[1], values[2], values[3])
if (column == 0) {
values[2] = value
if (st_value > 22) {
second = setSecond(0, 59)
if (st_value == et_value) {
endSecond = setSecond(1)
time[3] = endSecond
}
} else {
second = setSecond(0, 60)
if (values[1] > values[3]) {
endSecond = setSecond(values[1] + 1)
if (values[1] == 59) {
values[2] = values[2] + 1
endSecond = setSecond(0)
}
time[3] = endSecond
}
}
time[1] = second
time[2] = endTime
} else if (column == 1) {
if (st_value == et_value) {
endSecond = setSecond(value + 1)
if (ss_value == 59) {
values[2] = values[2] + 1
endSecond = setSecond(0)
}
} else {
endSecond = setSecond(0)
}
time[3] = endSecond
} else if (column == 2) {
if (et_value > st_value) {
endSecond = setSecond(0)
} else if (et_value == st_value) {
endSecond = setSecond(values[1] + 1)
if (ss_value == 59) {
values[2] = values[2] + 1
endSecond = setSecond(0)
}
}
time[3] = endSecond
}
this.setData({
time: time,
values: values
})
},
change(e) {
let values = e.detail.value
let time = this.data.time
let value = ''
values.forEach((i, index) => {
if (i == null) i = 0
value += index == 2 ? `-${time[index][i]}` : index == 0 ? time[index][i] : `:${time[index][i]}`
})
console.log(value)
this.setData({
timeValue: value,
values: values
})
this.triggerEvent('choose', value)
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<picker mode='multiSelector' range='{{time}}' value='{{values}}' class='picker' bindcolumnchange='columnChange' bindchange='change'>
<view style='color:{{timeValue?"":"#999"}}'>{{timeValue||'请选择'}}</view>
</picker>
\ No newline at end of file \ No newline at end of file
/* components/timePicker/timePicker.wxss */
.picker{
width: 530rpx;
}
\ No newline at end of file \ No newline at end of file
images/close.png

505 Bytes

images/more.png

500 Bytes

{
"name": "d_plus",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@antv/adjust": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@antv/adjust/-/adjust-0.1.1.tgz",
"integrity": "sha512-9FaMOyBlM4AgoRL0b5o0VhEKAYkexBNUrxV8XmpHU/9NBPJONBOB/NZUlQDqxtLItrt91tCfbAuMQmF529UX2Q==",
"requires": {
"@antv/util": "~1.3.1"
},
"dependencies": {
"@antv/util": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@antv/util/-/util-1.3.1.tgz",
"integrity": "sha512-cbUta0hIJrKEaW3eKoGarz3Ita+9qUPF2YzTj8A6wds/nNiy20G26ztIWHU+5ThLc13B1n5Ik52LbaCaeg9enA==",
"requires": {
"@antv/gl-matrix": "^2.7.1"
}
}
}
},
"@antv/f2": {
"version": "3.7.7",
"resolved": "https://registry.npmjs.org/@antv/f2/-/f2-3.7.7.tgz",
"integrity": "sha512-xv1K9BAN5t+PPu8RcpF36mLO/D19PIboddgMgR6Pdmp1PMVyyrT9uuV3SD+sxbn9iVDk2w6HtML30yGkmfkwnw==",
"requires": {
"@antv/adjust": "~0.1.1",
"@antv/scale": "~0.3.3",
"@antv/util": "~2.0.6",
"@babel/runtime": "^7.7.7",
"@types/hammerjs": "^2.0.36",
"hammerjs": "^2.0.8",
"type-fest": "^0.15.1"
}
},
"@antv/gl-matrix": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/@antv/gl-matrix/-/gl-matrix-2.7.1.tgz",
"integrity": "sha512-oOWcVNlpELIKi9x+Mm1Vwbz8pXfkbJKykoCIOJ/dNK79hSIANbpXJ5d3Rra9/wZqK6MC961B7sybFhPlLraT3Q=="
},
"@antv/scale": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/@antv/scale/-/scale-0.3.4.tgz",
"integrity": "sha512-mZaf3MtMoQJtd+KAgTANVbvKpaXVpzLAFbKO/wSKaLFpnWO0bwMVDYzrs+5DZhfEfMbZpP/A7qUZ2/DLh0T3Tg==",
"requires": {
"@antv/util": "~2.0.3",
"fecha": "~4.2.0",
"tslib": "^2.0.0"
}
},
"@antv/util": {
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/@antv/util/-/util-2.0.9.tgz",
"integrity": "sha512-JblWzne7msAPDdxkUhEk8zAz0Wd6igKwqymGbvIeyOydGrhBhGjA3nEayFj4IlG+XixCvGFKsCB4yuFS4glRIA==",
"requires": {
"tslib": "^1.10.0"
},
"dependencies": {
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}
}
},
"@antv/wx-f2": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@antv/wx-f2/-/wx-f2-2.1.1.tgz",
"integrity": "sha512-15S+Fz9NYFpZvXHaOM65lcNWEpsx7SmIyDDGMDZ0/beNW2T4DkxBdJwVLjE/SBIZc7kbQKJsC8n2p4HLbHcJYg==",
"requires": {
"@antv/f2": "~3.7.0"
}
},
"@babel/runtime": {
"version": "7.12.1",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
"integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
"requires": {
"regenerator-runtime": "^0.13.4"
}
},
"@types/hammerjs": {
"version": "2.0.36",
"resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.36.tgz",
"integrity": "sha512-7TUK/k2/QGpEAv/BCwSHlYu3NXZhQ9ZwBYpzr9tjlPIL2C5BeGhH3DmVavRx3ZNyELX5TLC91JTz/cen6AAtIQ=="
},
"fecha": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.0.tgz",
"integrity": "sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg=="
},
"glsx-applet-component": {
"version": "1.1.24",
"resolved": "https://registry.npmmirror.com/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz",
"integrity": "sha512-3XTG9J99rgKVJpcC7aKS/+N7CaS+MNYdy5qmWH8siFaRFiSo1PeBRDaprfjCazaud/c31RvpoDFUof/fxNkxjw=="
},
"hammerjs": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz",
"integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE="
},
"regenerator-runtime": {
"version": "0.13.7",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
"integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew=="
},
"tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"type-fest": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.15.1.tgz",
"integrity": "sha512-n+UXrN8i5ioo7kqT/nF8xsEzLaqFra7k32SEsSPwvXVGyAcRgV/FUQN/sgfptJTR1oRmmq7z4IXMFSM7im7C9A=="
}
}
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!