Commit a908d46d by zhangxw

督导小程序需求开发

1 parent 47c73f6f
Showing 332 changed files with 4719 additions and 1 deletions
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
tab_width = 4
[*.{json,jsonc}]
indent_style = tab
indent_size = 4
tab_width = 4
[*.{js,ts,jsx,tsx,wxml,wxss,wxs,scss,sass}]
indent_style = tab
indent_size = 4
tab_width = 4
.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
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
export default {
printWidth: 200,
tabWidth: 4,
useTabs: true,
semi: true,
singleQuote: false,
htmlWhitespaceSensitivity: "ignore",
bracketSameLine: true,
plugins: ["./prettier-plugin-wxml.mjs"],
overrides: [
{
files: "*.wxml",
options: {
parser: "wxml",
},
},
],
};
{
"小程序页面模板": {
"prefix": "page",
"scope": "javascript",
"body": [
"Page({",
"\tdata: {",
"\t\tnavBarHeight: 0,",
"\t},",
"",
"\tnavbarReady(e) {",
"\t\tlet navBarHeight = e?.detail?.height;",
"\t\tthis.setData({",
"\t\t\tnavBarHeight,",
"\t\t});",
"\t},",
"",
"\tback() {",
"\t\twx.\\$router.back();",
"\t},",
"",
"\tonLoad(options) {",
"\t\t$1",
"\t},",
"",
"\tonRoute(options) {",
"\t\tconsole.log(options);",
"\t},",
"",
"\t/**",
"\t * 生命周期函数--监听页面隐藏",
"\t */",
"\tonHide() {},",
"",
"\t/**",
"\t * 生命周期函数--监听页面卸载",
"\t */",
"\tonUnload() {},",
"",
"\t/**",
"\t * 页面相关事件处理函数--监听用户下拉动作",
"\t */",
"\tonPullDownRefresh() {},",
"",
"\t/**",
"\t * 页面上拉触底事件的处理函数",
"\t */",
"\tonReachBottom() {}",
"});",
],
"description": "微信小程序 Page 页面模板(含 navbarReady / back)",
},
"小程序组件模板": {
"prefix": "component",
"scope": "javascript",
"body": [
"Component({",
" /**",
" * 组件的属性列表",
" */",
" properties: {",
" ${1:exampleProp}: {",
" type: ${2:String},",
" value: ${3:''},",
" observer: function(newVal, oldVal) {",
" $4",
" }",
" }",
" },",
"",
" /**",
" * 组件的初始数据",
" */",
" data: {",
" ${5:exampleData}: ${6:null}",
" },",
"",
" /**",
" * 组件的方法列表",
" */",
" methods: {",
" ${7:exampleMethod}() {",
" $0",
" }",
" },",
"",
" /**",
" * 组件生命周期函数",
" */",
" lifetimes: {",
" created() {",
" ",
" },",
" attached() {",
" ",
" },",
" ready() {",
" ",
" },",
" moved() {",
" ",
" },",
" detached() {",
" ",
" }",
" },",
"",
" /**",
" * 组件数据监听器",
" */",
" observers: {",
" }",
"})",
],
"description": "微信小程序 Component 完整模板(含 properties, data, methods, lifetimes, observers)",
},
}
{
// 使用 Prettier 作为默认格式化器
"editor.defaultFormatter": "esbenp.prettier-vscode",
// 保存时自动格式化
"editor.formatOnSave": false,
// 缩进设置:使用 tab,大小为 4
"editor.tabSize": 2,
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"explorer.compactFolders": false,
"scm.compactFolders": false,
"problems.decorations.enabled": false,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[wxml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[wxss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[sass]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[wxs]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.associations": {
"*.wxss": "css",
"*.sass": "scss"
},
"cSpell.words": [
// 微信小程序相关
"scrolltolower",
"wxml",
"wxss",
"wxs",
"elif",
"miniprogram",
"usingComponents",
"behaviours",
"onLaunch",
"onShow",
"onHide",
"onLoad",
"onUnload",
"onReady",
"onPullDownRefresh",
"onReachBottom",
"onShareAppMessage",
"setData",
"globalData",
// 项目相关
"glsk",
"glsx",
"dayjs",
"rfdc",
"ucharts",
"vant",
"vanui",
// 业务相关
"artificer",
"boutique",
"crowdfunding",
"technician",
"subvehicle",
"tabbar",
"tabDate",
"tabIndex",
"tabMine",
"tabOperating",
"tabRepairOrder",
"tabWorkOrder",
// 常用英文词汇
"mixins",
"utils",
"jsconfig",
"sitemap",
"unpkg",
"qrcode",
"qrbox",
"popup",
"popups",
"navbar",
"readonly",
"textarea",
// API/接口相关
"errId",
"sessionId",
"moduleType",
"moduleTypes",
"businessType",
"unread",
"pageNum",
"pageSize",
// 中文拼音
"yanbao",
"jingpin",
"quanyi"
],
// GitLens Blame 配置
"gitlens.codeLens.enabled": true,
"gitlens.codeLens.recentChange.enabled": true,
"gitlens.currentLineBlame": true,
"gitlens.currentLineBlame.format": "${author}, ${date} - ${message}",
"gitlens.blame.visibility": "on",
// 待团队讨论后再开启
"prettier.enable": false
}
\ No newline at end of file
// import api from './request.js'
import api from '~/utils/request/request.js'
module.exports = {
/**微信登录 */
wxLogin(data) {
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.jscode.login', data)
},
/**微信登录 */
ssoLogin(data) {
return api.post(
'scrm.api.sso.weapp.jscode.getOpenId',
data,
[],
'/rop-scrm-sso/router',
'scrm',
false
)
},
/**微信手机号登录 */
authPhone(data) {
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.auth.phone', data)
},
/**账号登录 */
accountAndPwd(data) {
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.login.accountAndPwd', data)
},
/**验证码 */
getSMS(data) {
return api.post('dj.api.smartcarlife.sms.get.code', data)
},
/** 免登录 */
noLogin(data) {
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.sms.not.code.login', data)
},
/** 免登录 */
loginLogAdd(data) {
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.login.log.add', data)
},
/** 记录登录设置类型 */
reNoSignIn(data) {
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.sms.noSignIn.login', data)
},
/**手机验证码登录 /1.0.0 */
smsLogin(data = {}) {
data.source = 'MINIAPP'
data.productCode = 'PC00c2'
return api.post('dj.api.smartcarlife.sms.login', data)
},
/**上传图片 /1.0.0*/
uploadImg(data) {
return api.post('dj.api.smartcarlife.common.uploadImg', data, ['file'])
},
/**退出*/
logout() {
return api.post('dj.api.smartcarlife.logout')
},
/**
* 员工登录日志记录保存
*/
loginRecordSave(data, name) {
// console.log(name, 'loginRecordSave');
// debugger
return api.post('dj.api.smartcarlife.staff.login.record.save', data)
//selectMerchantScene
},
// 上传pdf
uploadPdfAPI(data) {
return api.post('dj.api.smartcarlife.common.uploadPdf', data, ['file'])
},
}
import api from '~/utils/request/request.js'
module.exports = {
// 查询团队统计数据
getCrewStaticsData(data) {
return api.post('', data)
},
// 获取AI分析内容
getAIAnslyseData(data) {
return api,post('', data)
},
// 获取员工排行数据
getStaffRankList(data) {
return api.post('', data)
},
// 查询门店日期范围内接待记录统计数据
getReceptionRecordList(data) {
return api.post("dj.api.smartcarlife.recepiton.receptionStaticList", data)
},
// 分页查询接待列表
getRecordDetailList(data) {
return api.post("dj.api.smartcarlife.reception.findReceptionByConditionPage", data)
},
// 获取短链地址
getShortUrl(data) {
return api.post("dj.api.car.boutique.inspection.batch.file.short.url", data)
},
findCheckResultByBatchId(data) {
return api.post('dj.api.car.boutique.inspection.findCheckResultByBatchId', data)
},
// 人员带教
submitMentorData(datd) {
return api.post('', data)
}
}
import api from '~/utils/request/request.js'
module.exports = {
// 获取任务列表数据
getMissionList(data) {
return api.post('dj.pad.api.recommended.course.page', data)
},
// 提交督导日报
submitSupervisorReport(data) {
return api.post('dj.api.supervisor.mini.submitDayTask', data, [], 'rop-dj-supervisor-mini')
},
// 提交本周复盘
submitWeeklyReview(data) {
return api.post('dj.api.supervisor.mini.submitWeekTask', data, [], 'rop-dj-supervisor-mini')
},
// 提交督导月度计划
submitMonthPlan(data) {
return api.post('dj.api.supervisor.mini.submitMonthTask', data, [], 'rop-dj-supervisor-mini')
},
// 获取督导任务详情
getSpecialTaskDetail(data) {
return api.post('dj.api.supervisor.mini.getTaskDetailById', data, [], 'rop-dj-supervisor-mini')
}
}
import api from '~/utils/request/request.js'
module.exports = {
// 获取全部课程列表数据
getRecommendedCourseList(data) {
return api.post('dj.pad.api.recommended.course.page', data, [], '/rop-dj-pad/router')
},
// 查询课程分类
getCourseCategoryData(data) {
return api.post('dj.pad.api.course.category.list.tree', data, [], '/rop-dj-pad/router')
},
// 获取北森token
findBeiSenSSOToken(data) {
return api.post(
"dj.pad.api.beisen.findBeiSenSSOToken",
data,
[],
"/rop-dj-pad/router"
);
},
// 提交课程推送
submitCoursePush(data) {
return api.post('', data)
}
}
//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: {}, //路由携带的参数
isChoosingMedia: false
}
})
{
"pages": [
"pages/loading/loading",
"pages/wxLogin/wxLogin",
"pages/nothing/nothing",
"pages/webView/webView",
"pages/tab/index/index",
"pages/tab/crew/crew",
"pages/tab/learningCenter/learningCenter",
"pages/tab/mine/mine"
],
"requiredPrivateInfos": [
"getLocation",
"chooseLocation"
],
"lazyCodeLoading": "requiredComponents",
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#2C66F7",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [
{
"pagePath": "pages/tab/index/index",
"text": "工作台",
"iconPath": "images/tab-home.png",
"selectedIconPath": "images/tab-home-active.png"
},
{
"pagePath": "pages/tab/crew/crew",
"text": "团队",
"iconPath": "images/tab-crew.png",
"selectedIconPath": "images/tab-crew-active.png"
},
{
"pagePath": "pages/tab/learningCenter/learningCenter",
"text": "学习中心",
"iconPath": "images/tab-learning.png",
"selectedIconPath": "images/tab-learning-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": [
"pages/dailySupervisionReport/dailySupervisionReport",
"pages/recordingReview/recordingReview",
"pages/recordingReviewDetail/recordingReviewDetail",
"pages/submitRecordingReview/submitRecordingReview",
"pages/weeklyReview/weeklyReview",
"pages/monthlyPlan/monthlyPlan",
"pages/specialTask/specialTask"
]
},
{
"root": "packageCrew",
"name": "packageCrew",
"pages": [
"pages/peopleOverview/peopleOverview",
"pages/storeTransfer/storeTransfer",
"pages/receptionRecording/receptionRecording",
"pages/recordingDetail/recordingDetail",
"pages/mentoring/mentoring"
]
},
{
"root": "packageLearningCenter",
"name": "packageLearningCenter",
"pages": [
"pages/coursePush/coursePush"
]
}
],
"preloadRule": {},
"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",
"__usePrivacyCheck__": true,
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
}
}
\ 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
// components/AIAnalyse/AIAnalyse.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram/'
Component({
/**
* 组件的属性列表
*/
properties: {
AIContent: String
},
/**
* 组件的初始数据
*/
data: {
IMG_URL
},
/**
* 组件的方法列表
*/
methods: {
// 展开收起
changeUnfold(e) {
this.setData({
unfoldFlag: !this.data.unfoldFlag
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* components/AIAnalyse/AIAnalyse.wxss */
.AI-analyse {
margin: 0 24rpx;
border-radius: 24rpx;
background: linear-gradient(227.8deg, #e8f2fe 0%, #f2edff 100%);
box-shadow: inset 4rpx 4rpx 16rpx 0 #7948ea40, inset -4rpx -4rpx 16rpx 0 #6390ff33;
min-height: 200rpx;
padding: 24rpx;
box-sizing: border-box;
.title {
display: flex;
align-items: center;
justify-content: space-between;
.left {
display: flex;
align-items: center;
font-size: 30rpx;
font-weight: 500;
color: #222222;
image {
width: 48rpx;
height: 48rpx;
flex-shrink: 0;
}
}
.right {
width: 120rpx;
height: 48rpx;
border-radius: 48rpx;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #999999;
.icon {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
&.up {
transform: rotate(180deg);
}
}
}
}
.content {
margin-top: 24rpx;
color: #222222;
font-size: 26rpx;
line-height: 40rpx;
&.unfold {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.empty-data {
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #999999;
image {
width: 104rpx;
height: 104rpx;
flex-shrink: 0;
margin-right: 13rpx;
}
}
}
\ No newline at end of file
<!--components/AIAnalyse/AIAnalyse.wxml-->
<view class="AI-analyse">
<view class="title">
<view class="left">
<image src="{{IMG_URL}}ai-icon.png" mode=""/>
<view>AI分析</view>
</view>
<view class="right" wx:if="{{AIContent}}" bindtap="changeUnfold">{{unfoldFlag ? '收起' : '展开'}}<image class="icon {{unfoldFlag ? 'up' : ''}}" src="{{IMG_URL}}gray-arrow-down.png" mode=""/></view>
</view>
<block wx:if="{{AIContent}}">
<view class="content {{!unfoldFlag ? 'unfold' : ''}}">{{AIContent}}</view>
</block>
<block wx:else>
<view class="empty-data">
<image src="{{IMG_URL}}empty-data.png" mode=""/>
暂无数据
</view>
</block>
</view>
\ 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
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/supervisor-miniprogram/'
Component({
/**
* 组件的属性列表
*/
properties: {
emptyImageStyle: {
type: String,
value: 'width: var(--fontSize208);height: var(--fontSize208);'
},
emptyText: {
type: String,
value: '暂无数据'
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ 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">{{emptyText || '暂无数据'}}</view>
</view>
\ 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;
}
{
"component": true,
"usingComponents": {
"TopToolbarPopup": "../TopToolbarPopup/TopToolbarPopup",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-picker": "@vant/weapp/picker/index",
"calendar": "../Calendar/Calendar"
}
}
<view class="filter-bar">
<!-- Search Area -->
<view class="search-box">
<view class="search-input">
<image src="/images/search.png" class="search-icon" />
<input type="text" placeholder="{{searchPlaceholder}}" class="input" value="{{ searchValue }}" placeholder-class="input-placeholder" bindinput="onSearchInput" bindconfirm="onSearch" />
<block wx:if="{{ searchValue }}">
<image src="/images/clear.png" class="search-clear" catchtap="clearSearch" />
</block>
</view>
</view>
<!-- Filter Area -->
<view class="filter-box" wx:if="{{filters.length > 0}}">
<view class="filter-list">
<block wx:for="{{filters}}" wx:key="key">
<!-- Date Range Filter -->
<block wx:if="{{item.type === 'date-range'}}">
<calendar
class="calendar-wrapper"
allowSameDay
shortcut
bindselect="onDateRangeSelect"
calenderColor="#2C66F7"
vertical
dateType='range'
minDate="2025-01-01"
maxDate="{{ maxDateForCalendar }}"
isComponents
data-index="{{index}}"
>
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
</calendar>
</block>
<!-- Other Filters (Month, Select) -->
<block wx:else>
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}" bindtap="onFilterTagTap" data-index="{{index}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
</block>
</block>
</view>
<!-- Reset Button -->
<view class="reset-btn" bindtap="resetFilters">
重置
</view>
</view>
</view>
<!-- Dynamic Popup -->
<TopToolbarPopup show="{{showPopup}}" title="" bind:cancel="closePopup" bind:confirm="confirmPopup" height="{{height}}">
<!-- Content depends on active filter type -->
<block wx:if="{{activeFilterIndex > -1}}">
<!-- Type: Month -->
<block wx:if="{{filters[activeFilterIndex].type === 'month'}}">
<van-datetime-picker
type="{{filters[activeFilterIndex].pickerType || 'year-month'}}"
value="{{pickerViewValue}}"
bind:input="onDatePickChange"
show-toolbar="{{false}}"
min-date="{{minDate}}"
max-date="{{maxDate}}"
/>
</block>
<!-- Type: Select -->
<block wx:elif="{{filters[activeFilterIndex].type === 'select'}}">
<van-picker
columns="{{ currentSelectOptions }}"
value-key="confLabel"
default-index="{{ tempSelectIndex }}"
bind:change="onSelectPickerChange"
show-toolbar="{{false}}"
/>
</block>
</block>
</TopToolbarPopup>
/* components/FilterBar/FilterBar.wxss */
.filter-bar {
background: #FFFFFF;
padding: 16rpx 24rpx;
}
/* Search Box */
.search-box {
margin-bottom: 16rpx;
}
.search-input {
background: #F7F8FA;
border-radius: 72rpx;
width: 100%;
height: 72rpx;
display: flex;
align-items: center;
}
.search-icon {
width: 28rpx;
height: 28rpx;
margin: 0 10rpx 0 26rpx;
flex-shrink: 0;
}
.search-clear {
width: 36rpx;
height: 36rpx;
margin: 0 26rpx 0 10rpx;
flex-shrink: 0;
z-index: 10;
}
.input {
font-size: 28rpx;
height: 38rpx;
line-height: 38rpx;
flex: 1;
color: #333;
}
.input-placeholder {
color: #BBBBBB;
}
/* Filter Box */
.filter-box {
display: flex;
justify-content: space-between;
align-items: center;
}
.filter-list {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.filter-item {
height: 56rpx;
border-radius: 56rpx;
background: #F7F8FA;
padding: 0 16rpx 0 24rpx;
font-size: 26rpx;
color: #666666;
margin-right: 16rpx;
display: flex;
align-items: center;
/* Handle wrap if many filters */
}
.filter-item.active {
color: #2C66F7;
/* background: #F7F8FA; */
/* Background stays same in reference */
}
.filter-text {
line-height: 40rpx;
max-width: 170rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.filter-icon {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
margin-left: 4rpx;
}
.reset-btn {
color: #222222;
font-size: 26rpx;
padding: 10rpx;
flex-shrink: 0;
}
\ No newline at end of file
// 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' ? '16rpx': '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
}
}
if(!item.isAgreeTrim) {
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
{
"component": true,
"usingComponents": {
"van-area": "@vant/weapp/area/index",
"van-popup": "@vant/weapp/popup/index"
}
}
\ 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
<!--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
/**
* 动态校验字段
* @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 && obj[attr] != null) {
let validObj = validFn.validator({}, obj[attr], obj)
if (validObj) {
return {
...validObj,
attr
}
}
}
}
return false
}
export default {
checkRequired
}
\ 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
/* 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
<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
/* components/image/index.wxss */
\ 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
{
"component": true,
"usingComponents": {}
}
\ 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
/* 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
{
"component": true,
"usingComponents": {}
}
\ 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
/* 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
// 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
{
"component": true,
"usingComponents": {}
}
\ 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
/* components/SearchInput/SearchInput.wxss */
.search-box {
height: var(--fontSize104);
display: flex;
align-items: center;
font-size: var(--fontSize28);
}
.search-box .search-input {
width: 100%;
height: var(--fontSize72);
background: #F7F8FA;
border-radius: var(--fontSize38);
color: #333;
}
.search-input .input{
display: flex;
align-items: center;
height: 100%;
width: 100%;
padding: 0 24rpx;
}
.search-input .icon{
width: var(--fontSize28);
height: var(--fontSize28);
margin-right: var(--fontSize10);
}
.search-input .placeholder{
color: #C8C9CC;
}
\ 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(--fontSize36);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
{
"component": true,
"usingComponents": {}
}
\ 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 class="tab-item-count" wx:if="{{item.count}}"><text style="margin: 0 6rpx;">·</text>{{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">
<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}}"><text style="margin: 0 6rpx;">·</text>{{item.count}}</text></text>
</view>
</block>
<view class="active-doc" style="{{activeStyle}}" />
</view>
</block>
\ No newline at end of file
/* components/TabBar/TabBar.wxss */
.tab {
position: relative;
height: var(--fontSize88);
box-sizing: border-box;
display: grid;
align-items: center;
font-size: var(--fontSize28);
color: #222222;
padding: 0 24rpx;
font-weight: 500;
}
.scroll {
height: var(--fontSize88);
box-sizing: border-box;
color: #222222;
width: 100%;
display: flex;
line-height: var(--fontSize88);
font-size: 0;
padding: 0 24rpx;
}
.active {
font-size: var(--fontSize34) !important;
color: #2C66F7;
}
.active-doc {
position: absolute;
bottom: var(--fontSize1);
height: var(--fontSize6);
border-radius: var(--fontSize6);
transition: all .25s;
}
.tab .tab-item {
text-align: center;
margin-right: 32rpx;
}
.scroll .tab-item {
width: fit-content;
min-width: var(--fontSize144);
height: 100%;
flex-shrink: 0;
font-size: var(--fontSize28);
text-align: center;
position: relative;
margin-right: 32rpx;
}
.scroll .active::after {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 36rpx;
height: var(--fontSize6);
border-radius: var(--fontSize6);
background-color: #2C66F7;
content: '';
}
\ No newline at end of file
// components/TopToolbarPopup/TopToolbarPopup.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: {
isFullSucreen: false
},
methods: {
noScroll() { },
hidePopup() {
this.setData({
show: false
})
this.triggerEvent('cancel')
},
confirm() {
this.triggerEvent('confirm')
}
},
attached() {
this.setData({
isFullSucreen: wx.$util && wx.$util.isFullSucreen ? wx.$util.isFullSucreen(true) : false
})
}
})
{
"component": true,
"usingComponents": {}
}
<view class="popup" hidden="{{ !showPopup }}" catchtouchmove="noScroll">
<view class="popup-bg" bindtap="hidePopup"></view>
<view class="popup-content" style="height:{{ height }}">
<view class="popup-header">
<view class="action-btn cancel" bind:tap="hidePopup">取消</view>
<view class="title" wx:if="{{ title }}">{{title}}</view>
<view class="action-btn confirm" bind:tap="confirm">确定</view>
</view>
<view class="popup-slot popup-slot-class {{ isFullSucreen?'isFullSucreen':'' }}" style="{{slotStyle}}">
<slot></slot>
</view>
</view>
</view>
/* components/TopToolbarPopup/TopToolbarPopup.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);
}
.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(--fontSize40);
display: flex;
flex-direction: column;
}
.popup-header {
height: var(--fontSize112);
display: flex;
align-items: center;
justify-content: space-between;
/* border-bottom: var(--fontSize2) solid #EBEDF0; */
flex-shrink: 0;
}
.popup-header .title {
font-size: var(--fontSize34);
color: #333333;
font-weight: bold;
}
.popup-header .action-btn {
font-size: var(--fontSize32);
padding: 0 var(--fontSize10);
}
.popup-header .cancel {
color: #666666;
}
.popup-header .confirm {
color: #2C66F7;
}
.popup-slot {
flex: 1;
overflow-y: auto;
/* height: calc(100% - var(--fontSize98)); */
}
.popup-slot.isFullSucreen {
padding-bottom: var(--fontSize68);
}
@keyframes show-popup {
0% {
bottom: -100%;
}
100% {
bottom: 0;
}
}
{
"component": true,
"usingComponents": {
"van-icon": "@vant/weapp/icon/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-calendar": "@vant/weapp/calendar/index",
"van-picker": "@vant/weapp/picker/index"
}
}
\ No newline at end of file
/* components/dateScreen/dateScreen.wxss */
.date-screen {
display: flex;
align-items: center;
.tab-section {
box-sizing: border-box;
width: 278rpx;
height: 56rpx;
display: flex;
align-items: center;
background: #FFFFFF;
border-radius: 56rpx;
font-size: 26rpx;
color: #999999;
padding: 4rpx;
&.isSticky {
background: #F7F8FA;
}
.tab {
flex: 1;
text-align: center;
height: 48rpx;
line-height: 48rpx;
border-radius: 48rpx;
&.active{
color: #2C66F7;
font-weight: 500;
background: #2c66f71a;
}
}
}
.date-section {
box-sizing: border-box;
height: 56rpx;
flex: 1;
display: flex;
align-items: center;
justify-content: space-around;
.date-text {
text-align: center;
width: 320rpx;
flex-shrink: 0;
}
.arrow {
width: 32rpx;
}
}
}
\ No newline at end of file
<!--components/dateScreen/dateScreen.wxml-->
<view class="date-screen">
<view class="tab-section {{isSticky ? 'isSticky' : ''}}" style="background: {{customBackground}};" wx:if="{{!tabSelected || tabSelected == 3}}">
<block wx:for="{{dateList}}" wx:key="index">
<view class="tab {{item.index==dateCurrent?'active':''}}" data-index="{{item.index}}" bind:tap="selectDate">{{item.title}}</view>
</block>
</view>
<view class="date-section">
<view class="arrow left">
<van-icon wx:if="{{!leftCurrent}}" class="arrow-left" name="arrow-left" bind:tap="last" />
</view>
<view class="date-text" bind:tap="onDisplayDate">{{date}}</view>
<view class="arrow right">
<van-icon wx:if="{{!rightCurrent}}" class="arrow-right" name="arrow" bind:tap="next" />
</view>
</view>
</view>
<!-- 年月日 -->
<popup bind:hidePopup="cancel" bind:confirm="confirm" show="{{dateShow}}" title="{{titleEnum[timeType]}}" height="60vh">
<block wx:if="{{timeType == 'date' || timeType == 'year-month'}}">
<van-datetime-picker id="datePicker" show-toolbar="{{false}}" min-date="{{ minDate }}" max-date="{{ maxDate }}" model:value="{{ currentDate }}" type="{{timeType=='date'?'date':'year-month'}}" bind:change="onChange" bind:input="onInput" />
</block>
<!-- 周 -->
<block wx:if="{{timeType == 'week'}}">
<van-picker id="weekPicker" show-toolbar="{{false}}" model:value="{{ currentDate }}" default-index="{{defaultIndex}}" value-key="label" columns="{{ weekColumns }}" bind:change="onWeekChange" />
</block>
</popup>
<van-calendar
id="calendar"
max-range="{{ 31 }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
show="{{ show }}"
type="range"
color="#2C66F7"
bind:confirm="onConfirm"
bind:close="onClose"
/>
\ 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
<!-- 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
/* 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
// 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
<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
/* 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
// packageWorkspace/pages/performanceRating/components/selectPopup/selectPopup.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram/'
Component({
options: {
addGlobalClass: true
},
properties: {
show: {
type: Boolean,
value: false
},
title: {
type: String,
value: ''
},
// 原始选项列表,支持任意字段名,通过 labelKey/valueKey 映射
options: {
type: Array,
value: []
},
// 是否多选
multiple: {
type: Boolean,
value: false
},
// 单选初始值
value: {
type: null,
value: null
},
// 多选初始值
values: {
type: Array,
value: []
},
// 字段映射
labelKey: {
type: String,
value: 'name'
},
valueKey: {
type: String,
value: 'value'
},
// 多选最大数量(不限制则设为 0 或不传)
max: {
type: Number,
value: 0
},
// 单选时点击即确认
confirmOnSelect: {
type: Boolean,
value: false
},
height: {
type: String
},
allowSearch: {
type: Boolean
}
},
data: {
IMG_URL,
displayOptions: [], // 带 checked 的渲染选项
selectedValues: [] // 选中的值列表(单选也统一用数组)
},
observers: {
'options, multiple, value, values': function(options, multiple, value, values) {
this.initDisplay(options || [], multiple, value, values)
},
show(n) {
// 进出场时保持数据一致
if (n) {
this.setData({
searchValue: ''
})
this.initDisplay(this.properties.options || [], this.properties.multiple, this.properties.value, this.properties.values)
}
}
},
methods: {
initDisplay(options = [], multiple = false, value = null, values = []) {
const vKey = this.properties.valueKey
// 初始选中值统一转为数组
const initSelected = multiple ? (Array.isArray(values) ? values.slice() : []) : (value !== null && value !== undefined ? value : [])
const display = (options || []).map(item => {
const val = item[vKey]
const checked = initSelected?.some(v => v === val)
return { ...item, checked }
})
this.setData({
displayOptions: display,
copyDisplayOptions: wx.$util.deepClone(display),
selectedValues: initSelected
})
},
toggle(e) {
const { index, item } = e.currentTarget.dataset
const { multiple, max, valueKey } = this.properties
let { displayOptions, copyDisplayOptions } = this.data
if (!item || item.disabled) return
if (multiple) {
let nextChecked = !item.checked
// 限制最大数量
if (nextChecked && max > 0) {
const selectedCount = this.data.selectedValues.length
if (selectedCount >= max) {
// 可根据项目规范提示用户,这里不做 UI 弹窗,保持组件纯净
this.triggerEvent('maxtips')
return
}
}
const selectIndex = displayOptions?.findIndex(v => v[valueKey] == item[valueKey])
this.setData({ [`displayOptions[${selectIndex}].checked`]: nextChecked })
const copySelectIndex = copyDisplayOptions?.findIndex(v => v[valueKey] == item[valueKey])
this.setData({ [`copyDisplayOptions[${copySelectIndex}].checked`]: nextChecked })
const val = item[valueKey]
let selected = this.data.selectedValues.slice()
const pos = selected.findIndex(v => v === val)
if (nextChecked && pos === -1) selected.push(val)
if (!nextChecked && pos > -1) selected.splice(pos, 1)
this.setData({ selectedValues: selected })
this.triggerEvent('change', { values: selected, items: this.getSelectedItems() })
} else {
// 单选:取消其他,选中当前
const currentVal = item[valueKey]
const display = this.data.displayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false }))
const selected = display[index].checked ? [currentVal] : []
this.setData({ displayOptions: display, selectedValues: selected })
const copyDisplay = this.data.copyDisplayOptions.map((it, idx) => ({ ...it, checked: idx === index ? !it.checked : false }))
this.setData({ copyDisplayOptions: copyDisplay })
this.triggerEvent('change', { values: selected, items: this.getSelectedItems() })
if (this.properties.confirmOnSelect) {
this.onConfirm()
}
}
},
search(e) {
let { labelKey, copyDisplayOptions, displayOptions, selectedValues, valueKey } = this.data
let { value } = e.detail
if (!value) {
copyDisplayOptions.map(i => {
i.checked = false
if (selectedValues.includes(i[valueKey])) i.checked = true
return i
})
this.setData({
displayOptions: copyDisplayOptions
})
} else {
let arr = []
copyDisplayOptions.map(i => {
i.checked = false
if (selectedValues.includes(i[valueKey])) i.checked = true
if (i[labelKey].indexOf(value) != -1) {
arr.push(i)
}
})
this.setData({
displayOptions: arr
})
}
},
onCancel() {
this.triggerEvent('cancel')
},
onConfirm() {
const values = this.data.selectedValues
const items = this.getSelectedItems()
this.triggerEvent('confirm', { values, items })
},
getSelectedItems() {
return (this.data.copyDisplayOptions || []).filter(it => it.checked)
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* packageWorkspace/pages/performanceRating/components/selectPopup/selectPopup.wxss */
.sp-list {
box-sizing: border-box;
height: 100%;
&.hassearch {
height: calc(100% - 104rpx);
}
.sp-item {
display: flex;
align-items: center;
justify-content: space-between;
height: 96rpx;
border-bottom: 2rpx solid #F0F2F5;
color: #333;
font-size: 28rpx;
&:last-child {
border-bottom: none;
}
.label {
max-width: 580rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.check {
width: 36rpx;
height: 36rpx;
}
}
.active {
.label {
color: #3D74FF;
}
}
}
\ No newline at end of file
<!--packageWorkspace/pages/performanceRating/components/selectPopup/selectPopup.wxml-->
<popup show="{{show}}" title="{{title}}" height="{{height || '50%'}}" bind:confirm="onConfirm" bind:cancel="onCancel" customPopupSlotStyle="overflow:auto;">
<view wx:if="{{allowSearch}}">
<search-input bindsearch="search" placeholder="搜索" value="{{ searchValue }}" />
</view>
<scroll-view scroll-y show-scrollbar="{{false}}" enhanced class="sp-list {{allowSearch ? 'hassearch' : ''}}">
<block wx:if="{{displayOptions.length}}">
<block wx:for="{{displayOptions}}" wx:key="index">
<view class="sp-item {{item.checked ? 'active' : ''}} {{item.disabled ? 'disabled' : ''}}" catchtap="toggle" data-index="{{index}}" data-item="{{item}}">
<text class="label">{{item[labelKey] || item.label || item.text}}</text>
<image class="check" src="{{IMG_URL}}checked.png" wx:if="{{item.checked}}" />
</view>
</block>
</block>
<block wx:else>
<empty-data />
</block>
</scroll-view>
</popup>
\ No newline at end of file
/**
* 用来配置小程序项目的变量
* 统一管理
*/
// 配置预发布的小程序aapId
export const preReleaseAppId = "wx96c8f2a3e76907cb";
// 小程序id
export const appId = "wx570d9331f9ace0bd";
/**
* 环境指定
* 0本地
* 1开发
* 2测试
* 3生产环境
* 4预发布
* 5cdptest
*/
let index = 2;
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://6b10bd312d154ff3a4664772bb4e50f5@sentry.glsx.com.cn/49";
// 图片基地址
export const ImgUrl = "https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram";
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

{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"baseUrl": ".",
"allowJs": true,
"checkJs": false,
"moduleResolution": "Node",
"lib": ["es2020"],
"paths": {
"~/*": ["./*"]
}
},
"include": ["**/*"],
"exclude": ["node_modules", "miniprogram_npm"]
}
import api from '~/utils/request/request.js'
export default {
/**
* 查询当前员工处罚情况
*/
async inspectionOfProhibitionBill() {
const {
data
} = await api.post('dj.api.carboutique.staff.study.punish')
if (data) wx.showModal({
title: '温馨提示',
content: '未完成学习任务,禁止提单!\n请在平板电脑上展业助手-学习中心完成学习。',
showCancel: false,
cancelColor: "#292D33",
confirmText: '确定',
confirmColor: "#2C66F7",
})
return Promise.resolve(data)
}
}
\ No newline at end of file
module.exports = Behavior({
data: {
track_timerFlag: false,
track_batchId: null,
track_page_view_flag: false
},
methods: {
onHide() {
this.setData({
track_timerFlag: false,
track_batchId: null,
track_page_view_flag: false,
})
},
onPageShow() {
// debugger
if (this.data.track_page_view_flag) return
if (!this.data.track_batchId) this.setData({
track_batchId: wx.$track.setRandomId('batch')
})
this.setData({
track_page_view_flag: true,
track_timerFlag: true
})
this.setBrowseTrackData()
},
onPageHide() {
wx.$track.setTrackData(2, this.data.track_event_code, this.track_businessParam, this.data.track_batchId, this.data.scene)
if (this.timer) clearTimeout(this.timer)
this.setData({
track_timerFlag: false,
track_batchId: null,
track_page_view_flag: false
})
this.timer = null
},
setBrowseTrackData() {
try {
if (!this.data.track_timerFlag) return this.onPageHide()
else this.timer = setTimeout(() => {
this.setBrowseTrackData()
}, 10e3)
wx.$track.setTrackData(2, this.data.track_event_code, this.track_businessParam, this.data.track_batchId, this.data.scene)
} catch (error) {
console.log(error, 'error')
}
},
}
})
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
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!