Commit 610399e6 by zhangxw

区域运营助手小程序

1 parent bf1ba91f
Showing 585 changed files with 3420 additions and 0 deletions
.DS_Store
node_modules
miniprogram_npm
project.config.json
project.private.config.json
/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*
This diff is collapsed. Click to expand it.
//app.js
// 初始化sentry
import sentryInit from "~/utils/sentryConfig/sentryInit";
const sentry = sentryInit();
wx.$sendSentry = function (e) {
sentry.captureException(e);
};
// 解决showLoading 和 showToast显示异常的问题
import fixWxShowToast from "./utils/lib/fixWxShowToast";
fixWxShowToast();
import router from "./router/index.js";
// 判断小程序是否需要更新
import getUpdateManager from "./utils/lib/wxUpdateManager";
import util from "./utils/util.js";
import wxApi from "./utils/utils_wx";
// 实例化对象存储
import { Storage } from "~/utils/cache/storage";
const $Storage = new Storage();
import {
setSystem_info,
getNoSignInUuid,
removeSystemStorage,
rmNoSignInUuid
} from "~/utils/cache/storageApi";
setSystem_info(); // 存储设备信息
import { checkYqdSuper, checkScene } from "~/store/index";
import eventbus from "./utils/eventbus";
import api from "./api/api";
import { Version } from "glsx-common-sdk";
import { areaList } from "@vant/area-data"; //预加载省市区
import globalDataFunction from './mixins/globalDataFunction'
/**全埋点 */
import Track from '~/utils/track'
const $Track = new Track()
// 将 api.reNoSignIn() 函数包装为防抖函数
const debouncedReNoSignIn = debounce(function (noSignInUuid, that) {
console.log("debouncedReNoSignIn2222");
api
.reNoSignIn({
noSignInUuid: noSignInUuid,
})
.then((res) => {
let { code, data } = res;
if (code == "0" && data) {
util.setSessionId(data?.sessionId);
// debugger
// 还要判断一下他是不是全部登录完,不是直接打到账号选择页面
if (!data.needSelectAccount) {
wx.reLaunch({ url: "/pages/loading/loading" });
} else {
// debugger
wx.reLaunch({ url: "/pages/accountItems/accountItems" });
}
} else {
util.removeStorage();
removeSystemStorage();
that.login(false);
}
});
}, 0); // 设置防抖时间为 0 秒
// }, 0); // 设置防抖时间为 5 秒
// 定义一个防抖函数
function debounce(func, timeout) {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => {
func.apply(this, args);
}, timeout);
};
}
App({
onLaunch() {
/**挂载到wx对象 */
wx.$storage = $Storage; /** 挂载全局缓存方法 */
wx.$router = router;
wx.$modal = this.showModal;
wx.$util = util;
wx.$api = wxApi;
wx.$eventbus = eventbus;
wx.$areaList = areaList;
wx.$track = $Track
let userInfo = util.getStorageSync("dj_boutique_user_info");
// ,this.globalData, userInfo
userInfo && this.gobalCheckYqdSuper(userInfo);
wx.$versionConfig = new Version({
request: {
baseUrl: "https://config-center-backend.glsx.com.cn/glsxAdmin/config",
isSign: false,
},
});
wx.$globalDataFunction = globalDataFunction
},
async getVersionInfo(request) {
if (request) this.globalData.versionData = null;
const { versionData } = this.globalData;
if (versionData) return versionData;
else {
const res = await wx.$versionConfig.get({
moduleUrl: "dj-car-boutique-work-wechat",
// moduleUrl: 'business-assistant',
env: "update",
});
this.globalData.versionData = res;
return res;
}
},
showModal(that, options, id = "#modal") {
// id = id || "#modal";
that.selectComponent(id).showModal(options);
},
gobalCheckYqdSuper(userInfo) {
checkYqdSuper(userInfo, this.globalData);
},
onShow(options) {
wx.onMemoryWarning(function () {
console.log("onMemoryWarningReceive");
});
// console.log('lifeshow')
getUpdateManager();
// options = {
// query: {
// page: 'playVideo',
// type: 1,
// title: '内容通知-培训资料-视频',
// id: 30,
// merchantId: 44211025
// }
// }
if (options) {
console.log('options', options)
let res = checkScene(options);
// console.log(res, 'res')
// 如果需要重新登录 去掉30天免登录逻辑避免自动登录直接跳回到首页去
if (res) {
rmNoSignInUuid()
this.login(true, res);
}
// res &&
}
},
login(relogin, context, RequestMethods) {
let that = this;
// 清空多账号信息
if (relogin) {
// 判断有没有 30 天免登陆 有直接跳选园区
let noSignInUuid = getNoSignInUuid();
console.log("noSignInUuid", noSignInUuid);
if (noSignInUuid) {
// 调用防抖函数
debouncedReNoSignIn(noSignInUuid, that);
// util.debounce(() => {
// console.log(1112);
// api
// .reNoSignIn({
// noSignInUuid: noSignInUuid
// })
// .then(res => {
// let { code, data } = res
// if (code == '0' && data) {
// // util.setUserinfo( console.log('noSignInUuid_sessionId',data?.sessionId);
// // wx.reLaunch({url: '/pages/accountItems/accountItems'})
// util.setSessionId(data?.sessionId)
// wx.reLaunch({ url: '/pages/loading/loading' })
// } else {
// util.removeStorage()
// removeSystemStorage()
// that.login(false)
// }
// })
// }, 500, true)
} else {
let thisPage = wx.$router.getPageInstance()
// 启动页loading中的埋点接口 在触发登录超时后 ios端wx.showModal会被页面跳转截断,导致无弹窗,将loading页面这个埋点接口的登录超时不做弹窗处理
if (thisPage?.route == 'pages/loading/loading' && RequestMethods.includes('dj.api.smartcarlife.staff.login.record.save')) return
// 标志位 解决安卓查复弹框问题
if (wx.__HAS_NOTLOGIN_MODAL) return false;
wx.__HAS_NOTLOGIN_MODAL = true;
wx.showModal({
title: "温馨提示",
content: context || "登录过期,请重新登录。",
showCancel: false,
confirmText: "去登录",
confirmColor: "#2C66F7",
success(res) {
if (res.confirm) {
that.globalData.yqdInfo = {};
that.globalData.YQorderSetting = "";
that.globalData.YQList = "";
that.globalData.businessSchoolScene = "";
util.removeStorage();
wx.$relogin = relogin;
router.reLaunch("pages.wxLogin");
}
},
complete: () => {
// 这个延迟的目的是为了避免短时间内重复弹出
// 你要是没有这个需要也可以去掉,直接把标志位改成 false 就行
setTimeout(() => {
wx.__HAS_NOTLOGIN_MODAL = false;
}, 2000);
},
});
}
} else {
this.globalData.yqdInfo = {};
this.globalData.YQorderSetting = "";
this.globalData.YQList = "";
this.globalData.businessSchoolScene = "";
util.removeStorage();
removeSystemStorage();
wx.$relogin = relogin;
router.reLaunch("pages.wxLogin");
}
},
globalData: {
statusBarHeight: wx.getSystemInfoSync()["statusBarHeight"], // 头部导航栏的高度
yqdInfo: {},
isYqdSuper: true,
isStaff: false,
YQorderSetting: "",
count: "",
versionData: null,
businessSchoolScene: "",
ROUTE_QUERY: {},//路由携带的参数
},
});
{
"pages": [
"pages/loading/loading",
"pages/sceneIndex/sceneIndex",
"pages/wxLogin/wxLogin",
"pages/accountItems/accountItems",
"pages/merchantList/merchantList",
"pages/nothing/nothing",
"pages/webView/webView",
"pages/tab/index/index",
"pages/tab/workspace/workspace",
"pages/tab/study/study",
"pages/tab/mine/mine",
"pages/log/log",
"pages/changeScene/changeScene",
"pages/h5AuthPhone/h5AuthPhone"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "区域运营助手",
"navigationBarTextStyle": "black",
"pageOrientation": "auto"
},
"tabBar": {
"color": "#757980",
"selectedColor": "#2C66F7",
"backgroundColor": "#FFFFFF",
"position": "bottom",
"list": [
{
"pagePath": "pages/tab/index/index",
"text": "首页",
"iconPath": "images/tab-home.png",
"selectedIconPath": "images/tab-home-active.png"
},
{
"pagePath": "pages/tab/workspace/workspace",
"text": "工作台",
"iconPath": "images/tab-workspace.png",
"selectedIconPath": "images/tab-workspace-active.png"
},
{
"pagePath": "pages/tab/study/study",
"text": "学习",
"iconPath": "images/tab-study.png",
"selectedIconPath": "images/tab-study-active.png"
},
{
"pagePath": "pages/tab/mine/mine",
"text": "我的",
"iconPath": "images/tab-mine.png",
"selectedIconPath": "images/tab-mine-active.png"
}
]
},
"subpackages": [
{
"root": "packageIndex",
"name": "packageIndex",
"pages": []
},
{
"root": "packageWorkspace",
"name": "packageWorkspace",
"pages": [
"pages/refundOperationList/refundOperationList",
"pages/refundDetailList/refundDetailList",
"pages/refundApply/refundApply",
"pages/receptionRecords/receptionRecords",
"pages/receptionDetail/receptionDetail",
"pages/newReceptionRecords/newReceptionRecords",
"pages/residentManage/residentManage",
"pages/recruitManage/recruitDetail/recruitDetail",
"pages/recruitManage/recruitInsert/recruitInsert",
"pages/recruitManage/recruitResult/recruitResult",
"pages/recruitManage/recruitManage/recruitManage",
"pages/supervisorDaily/supervisorDaily",
"pages/talentAnalysis/talentAnalysis"
]
},
{
"root": "packageStudy",
"name": "packageStudy",
"pages": [
"pages/sceneMarket/index/index",
"pages/sceneMarket/clue/clue",
"pages/sceneMarket/clueForm/clueForm",
"pages/sceneMarket/materialPage/materialPage",
"pages/sceneMarket/carBrands/carBrands",
"pages/sceneMarket/carSeries/carSeries",
"pages/aiCheck/chat/chat",
"pages/aiCheck/result/result",
"pages/aiCheck/scene/scene",
"pages/aiCheck/start/start",
"pages/aiCheck/redundance/redundance",
"pages/aiCheck/detail/detail",
"pages/aiCheck/defense/defense"
]
},
{
"root": "packageMine",
"name": "packageMine",
"pages": []
}
],
"usingComponents": {
"gl-textarea": "/components/GlTextarea/GlTextarea",
"gl-cell": "/components/GlCell/GlCell",
"gl-cust-form": "/components/GLCustForm/GLCustForm",
"calendar": "/components/Calendar/Calendar",
"navigation-bar": "/components/navigationBar/navigationBar",
"popup": "/components/Popup/Popup",
"search-input": "/components/SearchInput/SearchInput",
"tab-bar": "/components/TabBar/TabBar",
"modal": "components/modal/modal",
"gl-image": "components/GlImage/index",
"van-field": "@vant/weapp/field/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-radio": "@vant/weapp/radio/index",
"van-popup": "@vant/weapp/popup/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-uploader": "@vant/weapp/uploader/index",
"glsx-privacy": "glsk-applet-component/GlsxPrivacy/index",
"empty-data": "/components/EmptyData/EmptyData",
"van-switch": "@vant/weapp/switch/index"
},
"resolveAlias": {
"~/*": "/*"
},
"sitemapLocation": "sitemap.json",
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"lazyCodeLoading": "requiredComponents",
"resizable": true
}
\ No newline at end of file \ No newline at end of file
@font-face {
font-family: "numberNor";
src: url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-500-Medium.ttf");
}
@font-face {
font-family: "numberBold";
src: url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.ttf");
}
page {
/* 兼容 IOS<11.2 先constant再env */
--constantSafeAreaInsetBottom: constant(safe-area-inset-bottom);
/* 兼容 IOS>11.2 */
--envSafeAreaInsetBottom: env(safe-area-inset-bottom);
@for $i from 1 through 1300 {
--fontSize#{$i}: calc(#{$i}vmin / 7.5);
--fontSizeContent#{$i}: calc(#{$i}vmin / 7.176);
}
@media screen and (min-device-width: 768px) and (-webkit-min-device-pixel-ratio: 1) {
@for $i from 1 through 1300 {
--fontSize#{$i}: calc(#{$i}vmin / 8.5);
--fontSizeContent#{$i}: calc(#{$i}vmin / 6.719);
}
}
image {
width: 100%;
height: 100%;
vertical-align: top;
}
.y-center {
top: 50%;
transform: translateY(-50%);
}
.x-center {
left: 50%;
transform: translateX(-50%);
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.two-text {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.isFullSucreen {
box-sizing: border-box;
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
// padding-bottom: 34px !important;
}
.isFullSucreen-bottom {
bottom: 34px !important;
}
.list-nothing {
padding: var(--fontSize30) 0;
text-align: center;
font-size: var(--fontSize28);
color: #666666;
}
.list-not {
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: var(--fontSize24);
height: 100%;
}
.bgcw {
background-color: #fff;
}
}
\ No newline at end of file \ No newline at end of file
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
Component({
/**
* 组件的属性列表
*/
properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data,
/**
* 组件的方法列表
*/
methods: {
noScroll() { },
/** 日期手动改 */
resetData(date) {
// let _this = this[_CalendarObject_]
let { monthList, current } = this.data
console.log(monthList)
console.log(date)
// return
monthList.map(x => {
x.data.map(i => (i.active = false))
})
monthList.map((item, index) => {
item.data.map(ele => {
if (ele.data == date) {
console.log(ele.data)
console.log(current)
ele.active = true
current = index
}
})
})
this.setData({
monthList,
current
})
},
// resetData(date) {
// // console.log(this.resetData)
// // this.getUserDayReport(n)[CalendarFunction]
// // this[CalendarFunction].resetData(date)
// // console.log(date)
// // console.log(this[CalendarFunction].setCalenderBodyHeight)
// },
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
console.log(e)
let { disabled } = this.data
if (disabled) return false;
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, source } = e.detail
/**
* 根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。
* touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制
* 只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
*/
source == 'touch' &&
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
})
},
chooseAll() {
this[CalendarFunction].chooseAll()
}
},
ready() {
this[CalendarFunction] = new Calendar(this)
}
})
{
"component": true,
"usingComponents": {}
}
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot/>
</view>
<!-- 弹框模式 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar" />
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{(isFullSucreen&&!showConfirm)? "isFullSucreen":""}} ' style="height:{{height}};">
<view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'>
<block wx:if="{{rangeAll && dateType == 'range'}}">
<view class="calender-all" style="color:{{calenderColor}};" bindtap="chooseAll">累计</view>
</block>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="../images/close.png" class='calender-close-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>
</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 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?true:""}} ' 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>
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
width: 100%;
height: 100%;
}
.calender-bg {
position: absolute;
background: rgba(0, 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 0.5s forwards;
color: #333;
}
.calender-view.true {
border-radius: var(--fontSize40) var(--fontSize40) 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 0.5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 var(--fontSize4) var(--fontSize20) rgba(0, 0, 0, 0.1);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: var(--fontSize88);
text-align: center;
position: relative;
font-size: var(--fontSize32);
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: var(--fontSize40);
transform: translateY(-50%);
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: var(--fontSize28);
}
.calender-subtitle .arrow {
width: var(--fontSize14);
height: var(--fontSize14);
border-top: var(--fontSize2) solid transparent;
border-right: var(--fontSize2) solid #ccc;
border-bottom: var(--fontSize2) solid #ccc;
border-left: var(--fontSize2) solid transparent;
transform: rotate(45deg) translateY(calc(-1 * var(--fontSize4)));
margin-left: var(--fontSize16);
transition: all 0.3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(calc(-1 * var(--fontSize4)));
}
.calender-close {
position: absolute;
width: var(--fontSize40);
height: var(--fontSize40);
top: 50%;
right: var(--fontSize24);
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: var(--fontSize24);
height: var(--fontSize24);
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: var(--fontSize24);
line-height: var(--fontSize60);
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: var(--fontSize20) 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: #f2f3f5;
text-shadow: 0 var(--fontSize4) var(--fontSize20) #f2f3f5;
font-size: var(--fontSize320);
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: var(--fontSize32);
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: var(--fontSize8);
}
.calender-day.disable {
opacity: 0.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: var(--fontSize14);
}
@media screen and (min-width: 1000px) {
.calender-day .text {
display: flex;
justify-content: center;
align-items: center;
}
.calender-tips {
margin-left: var(--fontSize5);
}
}
.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: var(--fontSize14) var(--fontSize32);
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: var(--fontSize72);
font-size: var(--fontSize28);
color: #fff;
border-radius: var(--fontSize999);
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: 0.3;
}
\ No newline at end of file \ No newline at end of file
export default {
properties: {
calenderHeight: {
// 兼容新版本不能使用type 改用optionalTypes 属性避免提示错误
type: String,
optionalTypes: [Number]
// optionalTypes: [String]
},
title: String, // 标题名称
disabled: {
type: Boolean,
value: false
}, //是否能选中
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, //是否纵向滑动
/** 选择类型默认单选,single单选, multiple多个日期,range日期范围 */
dateType: {
type: String,
value: 'single'
},
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/**是否显示日期范围 全选 */
rangeAll: Boolean,
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay: Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
// 新版本不能使用type 改用optionalTypes 属性避免提示错误
type: Number,
optionalTypes: [Number],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean,
isComponents: Boolean,
maxDayRange: Number, // 最大可选范围长度
maxDayRangeType: String // 最大可选范围类型
// dataDateStr: {
// type: String,
// observer: function (n) {
// // console.log(n)
// this.resetData(n)
// }
// } //日期变化
// forceFullSucreen: {
// // 兼容isFullSucreen 属性不准确的情况
// type: Boolean,
// value: false
// }
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
}
}
// components/emptyData/emptyData.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
Component({
/**
* 组件的属性列表
*/
properties: {
emptyImageStyle: {
type: String,
value: 'width: var(--fontSize208);height: var(--fontSize208);'
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ 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
<!--components/emptyData/emptyData.wxml-->
<view class="empty-box">
<image class="no-data-img" style="{{emptyImageStyle}}" src="{{IMG_URL}}empty-data.png" />
<view class="list-not-text">暂无数据</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/emptyData/emptyData.wxss */
.empty-box{
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.empty-box .no-data-img{
width: var(--fontSize160);
height: var(--fontSize160);
}
.empty-box .list-not-text{
margin-top: var(--fontSize10);
font-size: var(--fontSize28);
font-size: var(--fontSize24);
color: #999999;
}
// components/GLCustForm/GLCustForm.js
Component({
externalClasses: ['custom-class'],
options: {
multipleSlots: true, // 在组件定义时的选项中启用多 slot 支持
styleIsolation: 'shared', // 自定义覆盖vant样式
},
/**
* 组件的属性列表
*/
properties: {
formData: {
type: Object,
value: () => { },
observer: function (n) {
this.setData({
formData: n
})
}
},
formDataList: {
type: Array,
observer: function(n) {
if(n) {
this.changeStyle()
}
}
},
labelWidth: {
type: String,
value: 'var(--fontSize140)'
},
// 页面存放表单对象的对象名,用于直接变更page的值
dataAttrName: {
type: String,
value: null
},
disable: {
type: Boolean,
value: false
},
glCellClass: {
type: String,
value: false
},
// 背景色
background: {
type: String,
value: 'transparent'
}
},
/**
* 组件的初始数据
*/
data: {
targetIdx: -1,
areaList: []
},
lifetimes: {
attached() {
let thisPage = wx.$router.getPageInstance()
console.log(this.data.formDataList, 'formDataList---')
this.changeStyle()
wx.$eventbus.on('set_car_info', n => {
let {
targetIdx,
dataAttrName
} = this.data
let formData = thisPage?.data[dataAttrName] || null
if (formData) {
if (targetIdx != -1) {
let targetItem = this.data.formDataList[targetIdx] || {}
if (targetItem.handleChange) {
targetItem.handleChange(thisPage, dataAttrName, n)
}
if (!targetItem.noDefault) {
thisPage.setData({
[dataAttrName + '.' + targetItem.labelName]: n.vehicleBrandName + '/' + n.vehicleSeriesName + '/' + n.vehicleShapeName + '/' + n.vehicleSubBrandName
})
}
}
formData = Object.assign(formData, n)
thisPage.setData({
[dataAttrName]: formData
// carInfo: n,
})
}
})
}
},
/**
* 组件的方法列表
*/
methods: {
/**
* 默认样式为label和value在同一行
* 改为label和value为两行
*/
changeStyle() {
let { formDataList } = this.data
formDataList.forEach((item, idx) => {
if(item.isLabelNoLine) {
formDataList[idx].noBorder = true
formDataList[idx].noPadding = true
formDataList[idx].cellStyle = 'display: block !important; height: auto !important; padding: 0 40rpx !important;'
formDataList[idx].labelStyle = 'width: 100% !important; padding: 24rpx 0 16rpx 0;'
formDataList[idx].cellValueStyle = `box-sizing: border-box; width: 100% !important; border: ${item.type == 'input' ? '2rpx': '0'} solid #ececec; padding: ${item.type == 'input' ? '0 24rpx 0 0 !important': '0'}; border-radius: ${item.type == 'input' ? '8rpx': '0'} ;`
formDataList[idx].customStyle = `padding: 0 0; display: flex; align-items: center; justify-content: space-between;`
formDataList[idx].inputCustomStyle = `width: ${item.suffix ? 'calc(100% - 4rpx)' : '100%'} !important; flex-shrink: 0; padding: 0 0;`
}
})
this.setData({
formDataList
})
},
getHeight(selector) {
return new Promise(resolve => {
wx.$util.getViewInfo(selector, res => {
return resolve(res)
}, this)
})
},
parentSetData(attr, value) {
let {
dataAttrName
} = this.data
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[dataAttrName + '.' + attr]: value
})
},
handleRadio(e) {
let value = e.detail
let {
attr
} = e.target.dataset
let {
dataAttrName
} = this.data
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[dataAttrName + '.' + attr]: value
})
this.triggerEvent('radioEvent', {
attr
})
},
handleInput(e) {
let value = e.detail
let {
attr,
item
} = e.target.dataset
let {
dataAttrName
} = this.data
// if (attr == 'price') {
// value = value >= 2000000 ? '2000000' : value
// // wx.$eventbus.emit('delete_goodsSelect')
// }
// console.log(item,'handleInput');
let thisPage = wx.$router.getPageInstance()
if (item.inputLimit && item.inputLimit.maxVal) {
value = value >= item.inputLimit.maxVal ? item.inputLimit.maxVal : value
}
if (item.inputLimit && item.inputLimit.minVal) {
value = value <= item.inputLimit.minVal ? item.inputLimit.minVal : value
}
if (item.inputLimit && item.inputLimit.type == 'digit') {
let [number, decimal] = value.toString().split('.')
if (decimal != undefined) {
decimal = decimal.substring(0, item.inputLimit.decimalDigit || 2)
number += `.${decimal}`
value = number
}
}
const diffValue = value.toString()
const trimValue = value.toString().trim()
if (diffValue != trimValue) {
value = trimValue
}
thisPage.setData({
[dataAttrName + '.' + attr]: value + ''
})
this.triggerEvent('inputEvent', {
attr
})
},
handlePickerChange(e) {
let idx = e.detail.value || 0
let {
target
} = e.currentTarget.dataset
let {
dataAttrName
} = this.data
let thisPage = wx.$router.getPageInstance()
console.log(target, 'target---')
thisPage.setData({
[dataAttrName + '.' + target.name]: target.optionList[idx][target.optionId],
[dataAttrName + '.' + target.labelName]: target.optionList[idx][target.optionLabel]
})
this.triggerEvent('pickerChange', {
obj: target.optionList[idx]
})
},
handleTimeChange(e) {
let {
value
} = e.detail
let {
target
} = e.currentTarget.dataset
let {
dataAttrName
} = this.data
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
[dataAttrName + '.' + target.name]: value
})
// console.log(this.data.formData)
},
// 品牌车型
handleJumpBrand(e) {
wx.$router.go('packageEquity.carBrands')
},
handleCellClick(e) {
let {
target,
idx
} = e.currentTarget.dataset
switch (target.type) {
case 'brand':
this.setData({
targetIdx: idx
})
this.handleJumpBrand()
break
default:
break
}
},
showAreaFun() {
let {
showArea,
areaList
} = this.data
if (!areaList.length) areaList = wx.$areaList // 省市区数据
this.setData({
showArea: !showArea,
areaList
})
},
bindRegionChange(e) {
this.triggerEvent('RegionChange', e)
this.showAreaFun()
}
}
})
\ No newline at end of file \ No newline at end of file
{
"component": true,
"usingComponents": {
"van-area": "@vant/weapp/area/index",
"van-popup": "@vant/weapp/popup/index"
}
}
\ No newline at end of file \ No newline at end of file
/* components/GLCustForm/GLCustForm.wxss */
.gl-cust-form {
.input-box {
display: flex;
align-items: center;
justify-content: space-between;
align-items: center;
--cell-line-height: 40rpx !important;
}
.radio-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.radio-item {
display: inline-block;
width: 270rpx;
}
.textarea {
text-align: right;
font-size: var(--fontSize28) !important;
flex-grow: 1;
}
.meeting-box {
.van-cell {
line-height: auto !important;
border: 2rpx solid #ececec;
border-radius: 16rpx;
margin-top: 16rpx;
padding: 16rpx 24rpx !important;
}
.van-field__control--textarea {
min-height: var(--field-text-area-min-height,144rpx) !important;
}
}
.input-suffix {
/* height: var(--fontSize88);
line-height: var(--fontSize88); */
/* height: var(--fontSize132);
line-height: var(--fontSize132); */
margin-left: var(--fontSize4);
}
.placeholder-class {
color: #C3C3C3;
}
.picker {
display: flex;
flex-direction: row-reverse;
height: var(--fontSize40) !important;
line-height: var(--fontSize40) !important;
text-align: right;
}
.arrow {
// width: var(--fontSize28);
// height: var(--fontSize26);
// margin-top: var(--fontSize26);
// flex-shrink: 0;
width: var(--fontSize28);
height: var(--fontSize26);
margin-top: var(--fontSize6);
transform: 0;
flex-shrink: 0;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.brand {
text-align: right;
padding: var(--fontSize40) 0;
}
.textarea .van-field__control {
//padding: 16rpx 24rpx !important;
height: 38px;
line-height: 38px;
padding-left: 24rpx;
}
.placeholder {
font-weight: 400;
font-size: var(--fontSize28);
color: #B6B6B8;
}
}
// .input-box .textarea input {
// height: var(--fontSize40);
// }
// .gl-cust-form .van-cell--borderless {
// padding: var(--fontSize10) 0 !important;
// }
// .between .van-cell--borderless {
// padding: var(--fontSize30) 0 !important;
// }
/* @media screen and (min-device-width: 600px) and (-webkit-min-device-pixel-ratio: 1) {
} */
\ No newline at end of file \ No newline at end of file
<!--components/GLCustForm/GLCustForm.wxml-->
<wxs src="./GLForm.wxs" module="filterUtils" />
<glsx-privacy appletName="嘀加区域助手" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view wx:for="{{formDataList}}" wx:key="index" class="custom-class gl-cust-form">
<gl-cell
wx:if="{{filterUtils.isShowFn(formData, item) && item.type != 'otherSlot' && !item.isHide}}"
border="{{!item.noBorder}}"
class="{{item.name}}"
haveArrow="{{item.haveArrow || false}}"
valueAlign="right"
label="{{item.label}}"
labelWidth="{{item.labelWidth || labelWidth}}"
placeholder="{{item.placeholder || ''}}"
bindclick="handleCellClick"
data-target="{{item}}"
data-idx="{{index}}"
background="{{background}}"
required="{{item.required}}"
requiredBefore="false"
requiredAfter="true"
cellHeight="{{!item.noCellHeight}}"
cellStyle="{{item.cellStyle||''}}"
labelStyle="{{item.labelStyle}}"
cellValueStyle="{{item.cellValueStyle}}"
cellBoxStyle="{{item.cellBoxStyle||''}}"
show-word-limit
noPadding="{{item.noPadding}}">
<!-- slot -->
<slot wx:if="{{item.type == 'slot'}}" name="{{item.slotName || item.name}}" />
<!-- radio -->
<view wx:if="{{item.type == 'radio'}}">
<van-radio-group value="{{formData[item.name]}}" disabled="{{item.disabled||disable}}" class="radio-box" data-attr="{{item.name}}" bindchange="handleRadio">
<van-radio wx:for="{{item.optionList}}" class="radio-item" wx:for-item="k"
wx:for-index="kIdx" wx:key="kIdx" name="{{k[item.optionLabel]}}">{{k[item.optionLabel]}}</van-radio>
</van-radio-group>
</view>
<!-- input -->
<view wx:if="{{item.type == 'input'}}" class="input-box" style="{{item.customStyle}}">
<!-- rows="1" -->
<van-field
class="textarea"
custom-style="padding: var(--fontSize30) 0; font-size: var(--fontSize28); background: {{background}}{{item.inputCustomStyle}};"
border="{{false}}"
value="{{formData[item.name]}}"
input-align="{{item.inputAlign || 'right'}}"
autosize
hold-keyboard
type="{{item.fieldType || 'text'}}"
rows="{{item.rows || '1'}}"
placeholder="{{item.placeholder || '请输入'}}"
maxlength="{{item.maxlength || 140}}"
disabled="{{item.disabled||disable}}"
readonly="{{item.readonly}}"
data-attr="{{item.name}}"
data-item="{{item}}"
bindinput="handleInput" />
<text wx:if="{{item.suffix}}" class="input-suffix">{{item.suffix}}</text>
</view>
<!-- textarea -->
<view wx:if="{{item.type == 'textarea'}}" class="meeting-box">
<view class="meeting-textarea">
<van-field value="{{formData[item.name]}}" hold-keyboard type="textarea" rows="{{item.rows || '4'}}" autosize="{ minHeight: 50 }" show-word-limit placeholder="{{item.placeholder || '请输入'}}" maxlength="{{item.maxlength || 140}}" disabled="{{item.disabled||disable}}" data-attr="{{item.name}}" data-item="{{item}}" bindinput="handleInput" />
</view>
</view>
<!-- picker -->
<picker
wx:if="{{item.type == 'select'}}"
bindchange="handlePickerChange"
data-target="{{item}}"
disabled="{{item.disabled||disable}}"
range="{{item.optionList}}"
range-key="{{item.optionLabel}}">
<view class="picker">
<image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}">
{{formData[item.labelName]}}
</view>
<text class="placeholder" wx:else>点击选择</text>
</view>
</picker>
<!-- 省市区 -->
<block wx:if="{{item.type == 'region'}}">
<view class="picker" bindtap="showAreaFun">
<image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}">
{{formData[item.labelName]}}
</view>
<text class="placeholder" wx:else>点击选择</text>
</view>
<van-popup
show="{{ showArea }}"
position="bottom"
bind:close="showAreaFun"
>
<van-area area-list="{{ areaList }}" columns-num="{{ item.columnsNum }}" title="{{item.label}}" bind:confirm="bindRegionChange" bind:cancel="showAreaFun" />
</van-popup>
</block>
<!-- 时间选择器 -->
<picker
wx:if="{{item.type == 'pickerTime'}}"
mode="date"
value="{{formData[name] || formData[item.name]}}"
start="{{item.start || ''}}"
end="{{item.end || ''}}"
bindchange="handleTimeChange"
data-target="{{item}}">
<view class="picker">
<view class="text-hide" wx:if="{{formData[item.name]}}">{{formData[item.name]}}</view>
<text class="placeholder" wx:else>点击选择</text>
</view>
</picker>
<!-- 品牌车型 -->
<view wx:if="{{item.type == 'brand'}}" class="brand">
<view wx:if="{{formData.vehicleBrandId}}">
{{formData.vehicleBrandName || ''}}/{{formData.vehicleSubBrandName || ''}}/{{formData.vehicleSeriesName || ''}}/{{formData.vehicleShapeName || ''}}
</view>
<view wx:else class="placeholder-class">{{item.placeholder || '点击选择'}}</view>
</view>
</gl-cell>
<slot wx:if="{{item.type == 'otherSlot'}}" name="{{item.name}}" />
</view>
var isShowFn = function (formData, targetItem) {
var flag = false
if (targetItem.isShowObj && formData) {
for (var i = 0; i <= targetItem.isShowObj.list.length; i++) {
var item = targetItem.isShowObj.list[i]
if (item == formData[targetItem.isShowObj.attr]) {
flag = true
break
}
}
} else {
flag = true
}
return flag
}
module.exports = {
isShowFn: isShowFn
}
\ No newline at end of file \ No newline at end of file
/**
* 动态校验字段
* @param {*} obj 需校验的对象
* @param {*} formRule 校验规则
* formRule = {
* id: [
* { required: true, message: 'xx不能为空' },
* {
* validator: (rule, value) => {
* return value != 'cwq' ? { message: '错误信息' } : null
* }
* }
* ],
* }
*/
const checkRequired = function (obj, formRule) {
let target = Object.keys(formRule)
for (let i = 0; i < target.length; i++) {
let attr = target[i]
let item = formRule[attr]
let requirObj = item.find(k => k.required == true)
let validFn = item.find(k => k.validator)
if (requirObj && !obj[attr]) {
return {
...requirObj,
attr
}
}
if (validFn) {
let validObj = validFn.validator({}, obj[attr], obj)
if (validObj) {
return {
...validObj,
attr
}
}
}
}
return false
}
export default {
checkRequired
}
\ No newline at end of file \ No newline at end of file
// components/GlCell/GlCell.js
Component({
options: {
styleIsolation: 'apply-shared'
// styleIsolation: 'shared'
},
/**
* 组件的属性列表
*/
properties: {
label: String,
labelWidth: String,
border: Boolean,
haveArrow: Boolean,
value: String,
valueAlign: String,
required: Boolean,
placeholder: String,
iconSrc: String,
logoSrc:String,
labelStyle: String,
cellStyle: String,
cellBoxStyle: String,
cellValueStyle: String,
noPadding: Boolean,
background: {
type: String,
value: '#FFFFFF',
},
cellHeight: {
type: Boolean,
value: true
},
requiredBefore: {
type: Boolean,
value: true
},
requiredAfter: {
type: Boolean,
value: false,
observer: function (n, o) {
if (n) {
this.setData({
requiredBefore: false
})
}
}
},
disabled: Boolean,
titleBtn: String
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
click(e) {
if (this.data.disabled) return
this.triggerEvent('click')
},
titleClick() {
this.triggerEvent('titleClick')
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/GlCell/GlCell.wxss */
.cell-box {
background: #fff;
font-size: var(--fontSize28);
color: #222222;
box-sizing: border-box;
}
.cell {
width: 100%;
min-height: var(--fontSize120);
box-sizing: border-box;
display: flex;
padding-left: var(--fontSize40);
align-items: center;
}
.cellHeight {
height: var(--fontSize120);
}
.cell.border {
border-bottom: var(--fontSize1) solid #EFF0F2;
}
.cell-label {
width: 25%;
display: flex;
align-items: center;
}
.titleIcon {
width: var(--fontSize32);
height: var(--fontSize32);
margin-left: var(--fontSize8);
}
.logoIcon{
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: var(--fontSize8);
}
.titleBtn {
display: inline-block;
background: #FFFFFF;
border-radius: 26px;
color: #2C66F7;
height: var(--fontSize48);
line-height: var(--fontSize48);
padding: 0 var(--fontSize8);
font-size: var(--fontSize24);
white-space:nowrap;
}
.cell-value {
width: 75%;
position: relative;
height: 100%;
}
.cell-value .false {
padding-right: var(--fontSize40) !important;
}
.cell-value .noPadding {
padding: 0 !important;
}
.value {
width: 100%;
height: 100%;
display: flex;
align-items: center;
padding-right: var(--fontSize70);
box-sizing: border-box;
}
.required {
color: #f00;
margin-left: var(--fontSize8);
}
.details,
.placeholder {
display: none;
}
.slot:empty+.details,
.slot:empty+.placeholder {
display: block;
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.placeholder {
color: #C3C3C3;
}
.cell-value .right {
justify-content: flex-end;
height: 100%;
box-sizing: border-box;
}
.cell-value .right .details,
.cell-value .right .placeholder {
text-align: right;
}
.slot {
width: 100%;
}
.slot:empty {
display: none;
}
.arrow {
position: absolute;
right: var(--fontSize40);
top: 50%;
transform: translateY(-50%);
width: var(--fontSize28);
height: var(--fontSize26);
margin: 0 !important;
}
\ No newline at end of file \ No newline at end of file
<view class='cell-box' style="background:{{background}};{{cellBoxStyle}}">
<view class="cell {{cellHeight?'cellHeight': ''}} {{border?'border':''}}" style="{{cellStyle}}" bindtap="click">
<view class='cell-label title-style' style="width:{{labelWidth}};{{labelStyle}}" bindtap="titleClick">
<text wx:if='{{required&&requiredBefore}}' class='required'>*</text>
<image
webp
class="logoIcon"
wx:if="{{logoSrc}}"
src="{{logoSrc}}" />
{{label||'标题'}}
<text wx:if='{{required&&requiredAfter}}' class='required'>*</text>
<image
webp
class="titleIcon"
wx:if="{{iconSrc}}"
src="{{iconSrc}}" />
<text class="titleBtn" wx:if="{{titleBtn}}">{{titleBtn}}</text>
</view>
<view class='cell-value ' style="width:calc(100% - {{labelWidth}});{{cellValueStyle}}">
<view class='value {{valueAlign}} {{haveArrow}} {{noPadding ? "noPadding" : ""}}'>
<view class='slot'>
<slot/>
</view>
<block wx:if="{{value}}">
<view class='details'>{{value}}</view>
</block>
<block wx:if="{{placeholder}}">
<view class='placeholder'>{{placeholder}}</view>
</block>
</view>
<image wx:if='{{haveArrow}}' class='arrow' src="../images/arrow-x.png" />
</view>
</view>
</view>
// components/image/index.js
// import { IMG_URL, IMG_VERSION } from '~/utils/constantData'
import { ImgUrl } from '~/config'
Component({
externalClasses: ['custom-class', 'class'],
/**
* 组件的属性列表
*/
properties: {
src: {
type: String,
value: '',
observer: function (url, o) {
if (url) {
let isWebp = url.includes('webp')
this.setData({
isWebp,
// imagePath: `${ImgUrl}${url}?v=` + IMG_VERSION()
imagePath: `${ImgUrl}${url}`
})
}
}
},
mode: {
type: String,
value: 'scaleToFill'
},
webp: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
imagePath: '',
isWebp: false
},
// 组件生命周期
lifetimes: {
// 在组件实例进入页面节点树时执行
// attached: function () {
// let src = this.data.src
// let prefix = IMG_URL
// this.setData({
// imagePath: `${prefix}${src}?v=` + IMG_VERSION()
// })
// },
// 在组件实例被从页面节点树移除时执行
detached: function () {}
},
/**
* 组件的方法列表
*/
methods: {}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* components/image/index.wxss */
\ No newline at end of file \ No newline at end of file
<!-- components/image/index.wxml -->
<image
src="{{imagePath}}"
mode="{{mode}}"
webp="{{webp||isWebp}}"
lazy-load
class="custom-class class" />
// components/glTextarea/glTextarea.js
Component({
/**
* 组件的属性列表
*/
properties: {
maxlength: {
type: Number,
value: -1
},
show: {
type: String
// observer: function (boolean) {
// // console.log(n)
// // this.resetData(n)
// if (boolean) {
// // this.data.value = this.
// console.log(this.data.value)
// this.data.inputValue = this.data.value ? this.data.value : ''
// }
// }
},
customMaxLength: Boolean,
placeholder: String,
showWordLimit: Boolean,
disabled: Boolean,
value: String,
filterEmoji: {
type: Boolean,
value: true
},
isLimitNum: {
type: Boolean,
value: false
},
isInt: {
type: Boolean,
value: false
},
color: {
type: String,
value: '#282829'
},
placeholderColor: {
type: String,
value: '#B1B1B3'
},
textStyle: String
},
/**
* 组件的初始数据
*/
data: {
edit: true,
// inputValue: null
value: null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 打开文本编辑器
*/
openTextarea() {
if (this.data.disabled) return
this.setData({
edit: false,
textareaFocus: true
})
},
setValue(value) {
let {
customMaxLength,
maxlength,
isLimitNum,
isInt
} = this.data
if (this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
}
// console.log(isInt)
if (isInt) {
value = value.replace(/[^\d]/g, '') //清除“数字”和“.”以外的字符
if (value != '') {
value = parseFloat(value).toString()
}
}
// debugger
// console.log(value)
if (customMaxLength && maxlength != -1) value = value.substring(0, maxlength)
if (isLimitNum) {
value = value.replace(/[^\d.]/g, '') //清除“数字”和“.”以外的字符
value = value.replace(/\.{2,}/g, '.') //只保留第一个. 清除多余的
value = value.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') //只能输入两个小数
if (value.indexOf('.') < 0 && value != '') {
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value = parseFloat(value)
}
}
console.log(value)
this.setData({
value
})
return value
},
textareaInput(e) {
let {
value
} = e.detail
value = this.setValue(value)
this.triggerEvent('input', {
value
})
},
textareaBlur(e) {
let {
value
} = e.detail
this.setData({
edit: true
})
value = this.setValue(value)
this.triggerEvent('blur', {
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='textarea-box {{maxlength>0&&showWordLimit?"showWordLimit":""}}'>
<block wx:if='{{edit}}'>
<text class='textarea' bindtap="openTextarea"
style="color:{{value?color:placeholderColor}}; {{textStyle}}">{{value||placeholder||'请输入'}}</text>
</block>
<block wx:else>
<textarea class='_textarea_' maxlength="{{customMaxLength?-1:maxlength}}" value='{{value}}'
bindinput='textareaInput' focus='{{textareaFocus}}' bindblur='textareaBlur' bindconfirm='textareaBlur' style="{{textStyle}}"></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%;
min-height: var(--fontSize120);
position: relative;
height: 100%;
}
.textarea-box .textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
line-height: var(--fontSize38);
font-size: var(--fontSize32);
word-break: break-all;
}
._textarea_ {
width: 100%;
font-size: var(--fontSize32);
color: #333333;
height: calc(100% - var(--fontSize40));
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - var(--fontSize40));
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
Component({
externalClasses: ['popup-slot-class'],
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false,
observer: function (n, o) {
n && wx.hideKeyboard()
this.setData({
showPopup: n
})
}
},
title: String,
height: {
type: String,
value: '85%'
},
slotStyle: String
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
noScroll() { },
hidePopup() {
this.setData({
show: false
})
this.triggerEvent('cancel')
},
confirm() {
this.triggerEvent('confirm')
}
},
attached() {
// console.log(wx.$util.isFullSucreen(), 'wx.$util.isFullSucreen()')
this.setData({
isFullSucreen: wx.$util.isFullSucreen(true)
})
}
})
\ 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="popup" hidden="{{ !showPopup }}" catchtouchmove="noScroll">
<view class="popup-bg" bindtap="hidePopup"></view>
<view class="popup-content" style="height:{{ height }}">
<block wx:if="{{ title }}">
<view class="popup-title text-center">{{title}}</view>
</block>
<view class="popup-slot popup-slot-class {{ isFullSucreen?title?'isFullSucreen':'isFullSucreen-notitle':'' }}" style="{{slotStyle}}">
<slot></slot>
</view>
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}">
<view class="cancel btn text-center" bind:tap="hidePopup">取消</view>
<view class="confirm btn text-center" bind:tap="confirm">确认</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.wxss */
.popup {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 998;
transform: translateZ(2px);
}
.popup-bg {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .6);
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.popup-content {
position: absolute;
left: 0;
width: 100%;
background: #FFFFFF;
border-radius: var(--fontSize20) var(--fontSize20) 0 0;
animation: show-popup .5s forwards;
box-sizing: border-box;
padding: 0 var(--fontSize32);
}
.popup-title {
height: var(--fontSize98);
font-size: var(--fontSize32);
color: #333333;
border-bottom: var(--fontSize2) solid #EBEDF0;
}
.popup-slot {
height: calc(100% - var(--fontSize214));
}
.popup-slot.isFullSucreen {
height: calc(100% - var(--fontSize282));
}
.popup-slot.isFullSucreen-notitle {
height: calc(100% - var(--fontSize184));
}
.popup-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--fontSize20) 0;
}
.popup-footer.isFullSucreen {
padding-bottom: var(--fontSize68) !important;
}
.popup-footer .btn {
width: var(--fontSize330);
height: var(--fontSize80);
box-sizing: border-box;
border-radius: var(--fontSize20);
font-size: var(--fontSize32);
}
.popup-footer .cancel {
/* color: #323233;
border: var(--fontSize2) solid #DCDEE0; */
color: #292D33;
background: #F7F8FA;
}
.popup-footer .confirm {
background: #2C66F7;
color: #fff;
}
@keyframes show-popup {
0% {
bottom: -100%;
}
100% {
bottom: 0;
}
}
\ No newline at end of file \ No newline at end of file
// components/SearchInput/SearchInput.js
Component({
// options: {
// styleIsolation: 'shared'
// },
/**
* 组件的属性列表
*/
properties: {
maxlength: {
type: Number,
value: -1
},
placeholder: String,
disabled: Boolean,
value: String,
filterEmoji: {
type: Boolean,
value: true
},
styleValue: {
type: String,
value: ''
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
open() {
if (this.data.disabled) return
this.setData({
edit: true,
inputFocus: true
})
},
setValue(value) {
if (this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
}
this.setData({
value
})
},
input(e) {
let {
value
} = e.detail
this.setValue(value)
this.triggerEvent('input', {
value
})
},
inputBlur(e) {
this.emit(e)
},
inputConfifm(e) {
this.emit(e)
},
emit(e) {
let {
detail: {
value
},
type
} = e
this.setData({
edit: false
})
this.setValue(value)
this.triggerEvent(type == 'confirm' ? 'search' : 'blur', {
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="search-box" style="{{styleValue}}">
<view class="search-input">
<block wx:if="{{!edit}}">
<view class="input {{value?'':'placeholder'}}" bindtap="open">
<block wx:if="{{value}}">
{{value}}
</block>
<block wx:else>
<image src="../../images/search.png" class="icon"></image>
{{placeholder||'查找'}}
</block>
</view>
</block>
<block wx:else>
<input type="text" maxlength="{{maxlength}}" class="input" value='{{value}}' focus='{{inputFocus}}' confirm-type="search" bindinput='input' bindblur="inputBlur" bindconfirm="inputConfifm" />
</block>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/SearchInput/SearchInput.wxss */
.search-box {
height: var(--fontSize104);
display: flex;
align-items: center;
justify-content: center;
/* border-bottom: var(--fontSize2) solid #EBEDF0; */
margin: 0 var(--fontSize32);
font-size: var(--fontSize28);
}
.search-box .search-input {
/* width: var(--fontSize686); */
width: 100%;
height: var(--fontSize72);
background: #F7F8FA;
border-radius: var(--fontSize38);
color: #333;
}
.search-input .input{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
text-align: center;
}
.search-input .icon{
width: var(--fontSize28);
height: var(--fontSize28);
margin-right: var(--fontSize10);
}
.search-input .placeholder{
color: #C8C9CC;
}
\ No newline at end of file \ No newline at end of file
// components/TabBar/TabBar.js
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: Array,
activeIndex: {
type: Number,
observer: function (n) {
console.log(this.data.tabIndex, 'activeIndex', n);
console.log(this.data.tabIndex != n);
if (this.data.tabIndex != n) {
this.setData({
tabIndex: this.data.activeIndex
})
this.setTab(this.data.tabIndex)
}
}
},
scroll: Boolean
},
/**
* 组件的初始数据
*/
data: {
tabIndex: 0
},
lifetimes: {
ready() {
// console.log('lifetimes',this.data.tabIndex);
// console.log('lifetimes',this.data.activeIndex);
this.setTab(this.data.tabIndex)
let that = this
wx.$eventbus.on('page_show', n => {
!that.data.width && that.setTab(that.data.tabIndex)
})
}
},
/**
* 组件的方法列表
*/
methods: {
change(e) {
let {
index
} = e.currentTarget.dataset
this.setTab(index)
},
setTab(index = 0) {
let {
tabIndex,
} = this.data
wx.$util.getViewInfo(`#tab-${tabIndex}`, old => {
let oldLeft = old.left
let oldWidth = old.width
wx.$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: var(--fontSize64);background-color:#2C66F7;border-radius:3rpx;left:${readyLeft + readyWidth / 2}px;transition: all .1s;`
})
}
setTimeout(() => {
this.setData({
activeStyle: `width: var(--fontSize64);left:${left + (width - 32) / 2}px;background-color:#2C66F7;`,
tabIndex: index,
to: `to-${index}`,
width
})
this.triggerEvent('click', index)
}, 100)
}, this)
}, 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
<block wx:if="{{scroll}}">
<scroll-view class=" scroll" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}" id="to-{{index}}">
<text id="tab-{{index}}">
<text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text>
</text>
</view>
</block>
<!-- <view class="active-doc" style="{{activeStyle}}" /> -->
</scroll-view>
</block>
<block wx:else>
<view class="tab" style="grid-template-columns: repeat({{tabList.length}}, 1fr);font-size:{{tabList.length>5?'var(--fontSize24)':''}} ;">
<block wx:for="{{tabList}}" wx:key="index">
<!-- style="color:{{tabIndex==index?'#2C66F7':''}};" -->
<view class="tab-item {{tabIndex==index?'active':''}}" bindtap="change" data-index="{{index}}">
<text id="tab-{{index}}"><text class="tab-item-text">{{item.text || item }}</text><text wx:if="{{item.count >= 0}}" style="font-size: var(--fontSize20);">({{item.count}})</text></text>
</view>
</block>
<view class="active-doc" style="{{activeStyle}}" />
</view>
</block>
\ No newline at end of file \ No newline at end of file
/* components/TabBar/TabBar.wxss */
.tab {
background-color: #fff;
height: var(--fontSize72);
box-sizing: border-box;
display: grid;
align-items: center;
font-size: var(--fontSize28);
color: #999999;
border-bottom: var(--fontSize1) solid #F2F3F5;
}
.scroll {
background-color: #fff;
height: var(--fontSize72);
box-sizing: border-box;
color: #999999;
border-bottom: var(--fontSize1) solid #F2F3F5;
width: 100%;
display: flex;
line-height: var(--fontSize72);
font-size: 0;
}
.active {
/* font-size: var(--fontSize32); */
font-weight: 600;
color: #2C66F7;
}
.active-doc {
position: absolute;
bottom: var(--fontSize1);
height: var(--fontSize4);
border-radius: var(--fontSize2) var(--fontSize2) 0 0;
transition: all .25s;
}
.tab .tab-item {
text-align: center;
}
.scroll .tab-item {
width: fit-content;
min-width: var(--fontSize144);
height: 100%;
flex-shrink: 0;
font-size: var(--fontSize28);
text-align: center;
position: relative;
padding: 0 var(--fontSize10);
}
.scroll .active::after {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 64rpx;
height: var(--fontSize4);
background-color: #2C66F7;
content: '';
}
\ No newline at end of file \ No newline at end of file
// components/show-modal/index.js
let app = getApp()
/****
* 功能名称:自定义弹框 (支持三个按钮)
* show:false @description 默认false,true弹框展示
* custom:false @description 默认false,true弹框内容自定义
* title:'' @description 弹框内容文案
* btns:[] @description 弹框按钮文案,最多支持三个
* cntMarginTop:550 @description 弹框距离顶部的距离rpx
* btnBorder:true
* btnTextColor:[] @description 弹框按钮字体颜色,最多支持三个
* tapTitle:"" 顶部标题
* tabTitleShow:false 顶部标题是否展示
* binddidClickBtn="onClickModalBtn" 外面通过e.detail获取,值为按钮所在位置的索引 0/1/2
* onClickModalBtn(e) {
console.log(e.detail)
}
*
*
* 案例
* <show-modal show="{{canShow}}" title="这是一个弹框" btns="{{['取消','确定']}}" binddidClickBtn="onClickModalBtn"></show-modal>
*
* 案例 custom:true
<show-modal show="{{canShow}}" custom="{{true}}" btns="{{['取消','确定']}}" binddidClickBtn="onClickModalBtn">
<view>这是一个弹框</view>
</show-modal>
*/
Component({
// 属性
properties: {
// 弹层开关
show: {
type: Boolean, //目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: false, // 默认值
observer(newVal, oldVal) {
if (newVal) {
this.createMaskAnimate(true)
} else {
this.createMaskAnimate(false)
}
}
},
// 是否内容自定义
custom: {
type: Boolean,
value: false
},
// 弹框内容
title: {
type: String,
value: '这是一个弹框'
},
// 按钮文字内容
btns: {
type: Array,
value: ['取消', '确定'] // 默认值
},
// 弹框距离顶部距离
cntMarginTop: {
type: Number,
value: 550 // 默认值
},
// 按钮文字颜色
btnTextColor: {
type: Array,
value: ['#A2A2A8', '#333333', '#303030'], // 默认值
observer(newVal, oldVal) {
if (!newVal && !newVal.length && newVal.length != 3) {
this._btnTextColor = ['#A2A2A8', '#333333', '#303030']
} else {
this._btnTextColor = newVal
}
}
},
// 按钮边框线
btnBorder: {
type: Boolean,
value: true
},
//标题是否显示
tabTitleShow: {
type: Boolean,
value: true
},
maskEnable: {
type: Boolean,
value: true
},
// 标题
tapTitle: {
type: String,
value: '提示信息'
}
},
// 初始化数据
data: {
_show: false,
_btnTextColor: ['#A2A2A8', '#333333', '#303030'],
maskAnimate: [],
frameAnimate: [],
title: '', // 提示弹框
success: () => {}, // 成功
error: () => {} // 失败
},
lifetimes: {
attached: function () {
function success() {} // 成功
function error() {}
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
}
},
methods: {
selectMask: function (e) {
this.data.maskEnable &&
this.setData({
show: !this.data.show
})
},
// 选中底部的按钮
selectBtn: function (e) {
let index = e.currentTarget.dataset.index
const that = this
this.triggerEvent('didClickBtn', index) // 外面通过e.detail获取index的值
if (index == 0) {
this.setData(
{
show: false
},
() => {
that.data.error()
}
)
} else {
this.setData(
{
show: false
},
() => {
that.data.success()
}
)
}
},
move: function () {
return
},
showModal: function (params) {
let { success, error } = this
this.setData({
show: !this.data.show,
title: params.title,
tabTitleShow: params.tabTitleShow,
success: params.success || function () {},
error: params.error || function () {}
})
},
//动画-遮罩层淡入淡出
createMaskAnimate(currentStatu) {
if (currentStatu) {
this.setData({
_show: currentStatu
})
this.createframeAnimate(true)
} else {
setTimeout(() => {
this.setData({
_show: false
})
}, 300)
this.createframeAnimate(false)
}
let maskAnimate = wx.createAnimation({
duration: 300,
timingFunction: 'ease-in-out',
delay: 0
})
this.maskAnimate = maskAnimate
maskAnimate.opacity(currentStatu ? 0.7 : 0).step()
setTimeout(() => {
this.setData({
maskAnimate: maskAnimate.export()
})
}, 50)
},
//动画-弹层内容Q弹
createframeAnimate(currentStatu) {
// return
let frameAnimate = wx.createAnimation({
duration: 300,
timingFunction: 'ease',
delay: 0
})
this.frameAnimate = frameAnimate
frameAnimate
.translate('-50%', '-50%')
.opacity(currentStatu ? 0.5 : 1)
.step()
// .scale(currentStatu ? 1.05 : 1)
this.setData({
frameAnimate: frameAnimate.export()
})
setTimeout(() => {
// 执行第二组动画
frameAnimate
.opacity(currentStatu ? 1 : 0)
.scale(currentStatu ? 1 : 0.9)
.step()
// 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
this.setData({
frameAnimate: frameAnimate.export()
})
}, 150)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!-- components/show-modal/index.wxml -->
<view wx:if="{{ _show }}" class="popV" catchtouchmove="move">
<view class="popV-mask" bindtap="selectMask" animation="{{ maskAnimate }}" />
<!-- 动态修改top -->
<view class="popV-content" animation="{{ frameAnimate }}">
<view class="tap_title" wx:if="{{ tabTitleShow }}">{{tapTitle}}</view>
<view class="popV-title" wx:if="{{ title }}">{{title}}</view>
<slot wx:if="{{ custom }}" />
<view wx:if="{{ btns&&btns.length }}" class="popV-content-btm {{ btnBorder?'border':'' }}">
<!-- style="color:{{btnTextColor[index]?btnTextColor[index]:''}};" -->
<!-- <block > -->
<view
wx:for="{{ btns }}"
wx:key="index"
data-index="{{ index }}"
class="popV-item"
hover-class="popV-hover"
bindtap="selectBtn"
>{{item}}</view>
<!-- </block> -->
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/show-modal/index.wxss */
.popV {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
width: 100vw;
height: 100vh;
}
.popV-mask {
position: absolute;
width: 100%;
height: 100%;
background: rgba(0, 0, 0);
opacity: 0;
display: block;
}
.popV-content {
position: absolute;
top: 50%;
left: 50%;
transform: translateY(-50%);
transform: translate(-50%);
width: var(--fontSize640);
background: white;
border-radius: var(--fontSize24);
z-index: 1000;
display: flex;
flex-direction: column;
overflow: hidden;
opacity: 1;
}
.popV-title {
box-sizing: border-box;
height: var(--fontSize100);
/* height: var(--fontSize205); */
/* line-height: var(--fontSize48); */
border-bottom: var(--fontSize2) solid #EBEDF0;
display: flex;
justify-content: center;
align-items: center;
font-family: PingFangSC-Regular;
font-size: var(--fontSize32);
color: #333333;
letter-spacing: -0;
padding: 0 var(--fontSize48);
text-align: center;
}
/* 底部 */
.popV-content-btm {
height: var(--fontSize97);
width: 100%;
left: 0;
bottom: 0;
display: flex;
flex-direction: row;
align-items: center;
padding: var(--fontSize48);
box-sizing: border-box;
/* margin-bottom: var(--fontSize48); */
}
.popV-content-btm.border {
border-top: 1px solid #EBEDF0;
}
.popV-item {
flex: 1;
font-size: var(--fontSize32);
color: #333333;
opacity: 1;
height: var(--fontSize97);
line-height: var(--fontSize97);
font-family: PingFangSC-Medium;
text-align: center;
/* border: var(--fontSize2) solid #A2A2A8; */
/* border-radius: var(--fontSize44); */
/* height: var(--fontSize88);
line-height: var(--fontSize88); */
letter-spacing: 0;
box-sizing: border-box;
overflow: hidden;
align-items: center;
}
.border .popV-item:nth-last-child(1) {
border-left: 1px solid #EBEDF0;
}
.popV-item:nth-last-child(1) {
color: #2C66F7;
}
/* .popV-item~.popV-item {
margin-left: var(--fontSize48);
} */
/* .popV-hover {
background: #DDD;
} */
.tap_title {
text-align: center;
font-family: PingFangSC-Medium;
font-size: var(--fontSize36);
color: #303030;
letter-spacing: 0;
margin-top: var(--fontSize64);
font-weight: 700;
}
\ No newline at end of file \ No newline at end of file
// components/navigationBar/navigationBar.js
import util from '../../utils/util'
const app = getApp()
Component({
options: {
styleIsolation: 'shared'
},
/**
* 组件的属性列表
*/
properties: {
navStyle: String,
showBack: Boolean,
showMenu: Boolean,
showWhiteMenu: Boolean
},
/**
* 组件的初始数据
*/
data: {
// navigationBarHeight: 70
// // 状态栏高度
// statusBarHeight: app.globalData.statusBarHeight,
// // 导航栏高度
// navigationBarHeight: app.globalData.navigationBarHeight,
// navigationBarStyle: 'font-size: var(--fontSize34)',
// // navigationBarTextWidth: `width:${app.globalData.navigationBarWidth / 2}rpx;padding:0 ${app.globalData.navigationBarPadding / 2}rpx; 0 ${app.globalData.navigationBarPadding / 2}rpx;`
// navigationBarTextWidth: `width:${app.globalData.navigationBarWidth / 2}rpx;padding:${app.globalData.navigationBarPadding / 2}rpx;`
},
/**
* 组件的方法列表
*/
methods: {
back() {
this.triggerEvent('back')
},
showMenuPopup() {
this.triggerEvent('showMenuPopup')
},
init() {
/**
* 获取自定义导航栏信息
*/
let _this = this
// 获取屏幕宽度和高度
const { windowWidth, windowHeight } = wx.getSystemInfoSync()
// 判断屏幕方向
const isLandscape = windowWidth > windowHeight // '横屏' : '竖屏'
wx.getSystemInfo({
success(res) {
let {
fontSizeSetting,
statusBarHeight,
screenWidth,
pixelRatio,
safeArea,
platform
} = res
console.log(safeArea, 'safeArea')
const { height, right, width, top } =
wx.getMenuButtonBoundingClientRect()
// 判断是否是华为平板设备
// && pixelRatio >= 2
let isPad = screenWidth >= 600
statusBarHeight = platform == 'ios' ? safeArea.top : statusBarHeight
if (isLandscape) statusBarHeight = 0
// console.log(isPad, screenWidth, 'screenWidth');
// let navigationBarHeight = height + (top - statusBarHeight) * 2 + 5
let navigationBarHeight = `var(--fontSize${
(height + (top - statusBarHeight) * 2) * (isPad ? 1 : 2)
})`
let navigationBarPadding = screenWidth - right
let navigationBarWidth =
screenWidth - (navigationBarPadding * 2 + width) - width
// if(deviceOrientation == 'landscape') statusBarHeight = 0
_this.setData({
statusBarHeight: `var(--fontSize${
statusBarHeight * (isPad ? 1 : 2)
})`,
navigationBarHeight,
// navigationBarStyle: `font-size:${fontSizeSetting}px;`,
navigationBarStyle: 'font-size: var(--fontSize34)',
navigationBarTextWidth: `width:${navigationBarWidth}px;padding:0 ${navigationBarPadding}px; 0 ${navigationBarPadding}px;`
})
},
complete() {
// console.log('#navigation-bar');
// setTimeout(() => {
util.getViewInfo(
'#navigation-bar',
res => {
// console.log(res, '#navigation-bar');
_this.triggerEvent('navbarReady', res)
_this.setData({
showNavBar: true
})
},
_this
)
// }, 0)
}
})
}
},
pageLifetimes: {
resize(res) {
// console.log(res, 'res');
// this.setData({
// statusBarHeight: 0
// })
// else
this.init()
}
},
ready() {
this.init()
}
})
{
"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}};height:{{navigationBarHeight}};{{navStyle }}"
>
<!-- hidden="{{!showNavBar}}" wx:if="{{showNavBar}}" -->
<!-- <view class="navigation-bar-box" style="{{navigationBarStyle}}"> -->
<view class="navigation-bar-box">
<view class="navigation-bar-titleText" style="{{ navigationBarTextWidth }}">
<slot />
</view>
<block wx:if="{{ showBack }}">
<view class="back-box" bindtap="back">
<view class="back">
<image src="../../images/back.png" />
</view>
</view>
</block>
<block wx:if="{{ showMenu }}">
<view class="menu-box" bindtap="showMenuPopup">
<view class="menu-class">
<image wx:if="{{ showWhiteMenu }}" src="https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/nav-bar-menu.png" />
<image wx:else src="https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/navgation-bar-menu.png" />
</view>
</view>
</block>
</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: 99;
box-shadow: 0 var(--fontSize1) 0 0 #E9E9E9;
background-color: #fff;
/* padding-top: constant(safe-area-inset-top); */
/* padding-top: env(safe-area-inset-top); */
/* padding-top: 40px; */
}
.navigation-bar-box {
position: relative;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
font-size: var(--fontSize34);
}
.navigation-bar-titleText {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: var(--fontSize34);
color: #2D2D2E;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
box-sizing: border-box;
text-align: center;
}
.back-box {
width: var(--fontSize160);
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.back {
position: absolute;
left: var(--fontSize20);
top: 50%;
transform: translateY(-50%);
width: var(--fontSize36);
height: var(--fontSize36);
}
.menu-box {
width: var(--fontSize160);
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.menu-box .menu-class {
position: absolute;
left: var(--fontSize20);
top: 50%;
transform: translateY(-50%);
width: var(--fontSize40);
height: var(--fontSize40);
}
@media screen and (min-device-width: 600px) and (-webkit-min-device-pixel-ratio: 1) {
.navigation-bar-box {
font-size: var(--fontSize23);
}
.navigation-bar-titleText {
font-size: var(--fontSize23);
}
.back {
width: var(--fontSize18);
height: var(--fontSize18);
}
.menu-box .menu-class {
width: var(--fontSize40);
height: var(--fontSize40);
}
}
\ No newline at end of file \ No newline at end of file
/**
* 用来配置小程序项目的变量
* 统一管理
*/
// 配置预发布的小程序aapId
export const preReleaseAppId = 'wx96c8f2a3e76907cb'
// 小程序id
export const appId = 'wx570d9331f9ace0bd'
/**
* 环境指定
* 0本地
* 1开发
* 2测试
* 3生产环境
* 4预发布
* 5cdptest
*/
let index = 1
const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync()
const envName = accountInfo.miniProgram.envVersion
//手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = false
const release = false
// 判断小程序环境
// develop:开发版 trial:体验版 release:正式版
if (systemInfo.platform != 'devtools') {
if (accountInfo.miniProgram.appId == preReleaseAppId) {
index = 4
} else {
switch (envName) {
case 'develop':
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3
break
}
}
}
export const env = envName
export const envIndex = index
const createQuotedUrl = {
develop: `http://192.168.1.178:9528/dj-scrm-wx-work-main-zhangls/#/equityPoster?id=`,
trial: `http://frontend.test.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=`,
release: `https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=`,
preRelease: `https://dj.beta.glsx.com.cn/dj-car-boutique-work-wechat/#/equityPoster?id=`
}
const scoketURL = {
develop: `ws://192.168.3.191:7865`,
trial: `ws://salesgpt.test.glsx.com.cn`,
release: `wss://salesgpt.glsx.com.cn`,
preRelease: `ws://salesgpt.test.glsx.com.cn`
}
const target = ['ip', 'develop', 'trial', 'release', 'preRelease']
const ALIYUN_LIST = [
{
AKID: 'LTAI5tJday6R4sng1jgrgH3N', //个人
AKKEY: 'TWvwaQqwjxw7Tj7RlnTxyEXjOjQgFh',
APPKEY: 'a1HmjrmQNv6yT8zb',
URL: 'wss://nls-gateway-cn-shanghai.aliyuncs.com/ws/v1'
},
{
AKID: 'LTAI5tCSaRbXmWhF7cR6k626', //公司
AKKEY: 'jYHkk6rR6UoaZWikxDTuAUNwJycJwb',
APPKEY: 'Pm7teJgylXGPnPvO',
URL: 'wss://nls-gateway-cn-shanghai.aliyuncs.com/ws/v1'
},
{
AKID: 'LTAI5tCv6tv55tZVyV4uQKd6', //个人
AKKEY: 'K3eko04dQ88KWltUEbY3A7h5twdjJk',
APPKEY: 'xKQ7JCyBsyNFjUdL',
URL: 'wss://nls-gateway-cn-shanghai.aliyuncs.com/ws/v1'
}
]
export const ALIYUN = ALIYUN_LIST[1]
// 报价单图片地址
export const quotedImgUrl = createQuotedUrl[target[envIndex]]
export const scoket_url = scoketURL[target[envIndex]]
// sentry Dsn 地址
export const dsnUrl =
'https://ddaadc52bf8d4ecc92eca632683d456a@sentry.glsx.com.cn/23'
// 图片基地址
export const ImgUrl =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat'
export const ossConfig = {
// 请求域名 格式:https://xxx.xxx.com
HTTP_REQUEST_URL: 'http://127.0.0.1:8000/api',
// 阿里云oss域名 格式:https://xxx.oss-cn-xxx.aliyuncs.com
OSS_DOMAIN: 'https://glsk-oss.oss-cn-shenzhen.aliyuncs.com',
// 文件直传到阿里云oss时需用到
ACCESSKEYID: 'LTAI5tCRcCUgd7bt1J7JY596',
ACCESSKEYSECRET: 'kJos9mgylkR5ztosnDt8Asrc3ulgqy',
BUKET_NAME: 'glsk-oss',
FOLDER: 'quality/',
// 与后端约定的token字段名
TOKEN_NAME: 'glsk-oss'
}
export const bytedanceConfig = {
url: 'https://openspeech.bytedance.com/api/v1/tts'
}
images/back.png

474 Bytes

images/dian.png

929 Bytes

images/plus.png

333 Bytes

This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
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!