Commit 6d71c9a8 by wangzhihui

Merge branch 'SAAS+V5.7.0' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into SAAS+V5.7.0
2 parents 1a95b257 6c5b4d9f
// pages/webView/webView.js // pages/webView/webView.js
import commonApi from '~/api/api' import commonApi from '~/api/api'
const WEBVIEW_H5_TOKENS_KEY = 'dj_boutique_webview_h5_tokens'
let time let time
Page({ Page({
/** /**
...@@ -9,6 +12,26 @@ Page({ ...@@ -9,6 +12,26 @@ Page({
flag: true, flag: true,
isH5Bind: false isH5Bind: false
}, },
/** 从完整 URL 提取 base(协议+域名+路径,不含查询串) */
getBaseUrl(url) {
if (!url || typeof url !== 'string') return ''
const idx = url.indexOf('?')
return idx >= 0 ? url.slice(0, idx) : url
},
/** 将对象转为 query 并追加到 URL */
appendParamsToUrl(url, params) {
if (!params || typeof params !== 'object' || Object.keys(params).length === 0) return url
const searchParams = Object.entries(params)
.filter(([, v]) => v != null && v !== '')
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`)
.join('&')
if (!searchParams) return url
const separator = url.includes('?') ? '&' : '?'
return `${url}${separator}${searchParams}`
},
getParams(str) { getParams(str) {
let params = str.split('?') let params = str.split('?')
if (params.length < 2) return {} if (params.length < 2) return {}
...@@ -29,6 +52,18 @@ Page({ ...@@ -29,6 +52,18 @@ Page({
onLoad: function (options) { onLoad: function (options) {
wx.$util.showLoading('加载中...') wx.$util.showLoading('加载中...')
let decodeUrl = decodeURIComponent(options.url) let decodeUrl = decodeURIComponent(options.url)
// 检查是否有该 URL 对应的 H5 token 缓存,有则追加到链接
const baseUrl = this.getBaseUrl(decodeUrl)
try {
const stored = wx.getStorageSync(WEBVIEW_H5_TOKENS_KEY)
if (stored) {
const tokens = JSON.parse(stored)
const storedData = tokens[baseUrl]
if (storedData && typeof storedData === 'object') {
decodeUrl = this.appendParamsToUrl(decodeUrl, storedData)
}
}
} catch (e) {}
let param = this.getParams(decodeUrl) let param = this.getParams(decodeUrl)
if (param.urlParam) { if (param.urlParam) {
let query = JSON.parse(param.urlParam) let query = JSON.parse(param.urlParam)
...@@ -115,6 +150,19 @@ Page({ ...@@ -115,6 +150,19 @@ Page({
this.setData({ this.setData({
isH5Bind: true isH5Bind: true
}) })
// 保存 H5 传入的 token 等数据,按 baseUrl 维度存储
const msgData = data[0]
if (msgData && typeof msgData === 'object' && msgData !== null) {
const baseUrl = this.getBaseUrl(this.data.url)
if (baseUrl) {
try {
const stored = wx.getStorageSync(WEBVIEW_H5_TOKENS_KEY)
const tokens = stored ? JSON.parse(stored) : {}
tokens[baseUrl] = msgData
wx.setStorageSync(WEBVIEW_H5_TOKENS_KEY, JSON.stringify(tokens))
} catch (err) {}
}
}
} }
}, },
......
...@@ -46,6 +46,6 @@ ...@@ -46,6 +46,6 @@
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",
"tabSize": 2 "tabSize": 2
}, },
"appid": "wx067bf6e1dd394e4d", "appid": "wx570d9331f9ace0bd",
"simulatorPluginLibVersion": {} "simulatorPluginLibVersion": {}
} }
\ No newline at end of file \ No newline at end of file
...@@ -46,6 +46,34 @@ export const reportFirstAutoObj = { ...@@ -46,6 +46,34 @@ export const reportFirstAutoObj = {
ortherValueObj: 'merchantMonthTotal', ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.1运营主管日报模版 */
'uuid-temp-024': {
list: [{
attrName: 'todayTransactionOutput024',
// 今日产值
valueObj: 'staffTodayTotal',
ortherValueObj: 'merchantTodayTotal',
}, {
attrName: 'monthTransactionOutput024',
// 本月产值
valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}]
},
/** 2.3运营主管日报模版 */
'uuid-temp-025': {
list: [{
attrName: 'todayTransactionOutput025',
// 今日产值
valueObj: 'staffTodayTotal',
ortherValueObj: 'merchantTodayTotal',
}, {
attrName: 'monthTransactionOutput025',
// 本月产值
valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}]
},
/** 2.1区域经理周报模版 */ /** 2.1区域经理周报模版 */
'uuid-temp-012': { 'uuid-temp-012': {
list: [{ list: [{
......
...@@ -1245,6 +1245,172 @@ export const tempRuleFnObj = { ...@@ -1245,6 +1245,172 @@ export const tempRuleFnObj = {
} }
} }
}, },
/** 2.1运营主管日报模版 - 业绩报告 */
performanceReport024: {
/** 今日谈客 */
todayGuestReception024: {
ruleFn: (rule, value) => {
const maxValue = 1000
if (value < 0 || value > maxValue) {
return { message: `今日谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,3}$/.test(value) ? null : { message: '今日谈客请输入四位数字' }
}
},
/** 今日成交 */
todayTransactions024: {
ruleFn: (rule, value) => {
const maxValue = 1000
if (value < 0 || value > maxValue) {
return { message: `今日成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,3}$/.test(value) ? null : { message: '今日成交请输入四位数字' }
}
},
/** 今日成交产值 */
todayTransactionOutput024: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `今日成交产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '今日成交产值请输入仅有两位小数的数字' }
}
},
/** 今日成交率 */
todayTransactionRate024: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `今日成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '今日成交率请输入仅有两位小数的数字' }
}
},
/** 本月谈客 */
monthGuestReception024: {
ruleFn: (rule, value) => {
const maxValue = 100000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,5}$/.test(value) ? null : { message: '本月谈客请输入六位数字' }
}
},
/** 本月成交 */
monthTransactions024: {
ruleFn: (rule, value) => {
const maxValue = 100000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,5}$/.test(value) ? null : { message: '本月成交请输入六位数字' }
}
},
/** 本月成交产值 */
monthTransactionOutput024: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月成交产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交产值请输入仅有两位小数的数字' }
}
},
/** 本月成交率 */
monthTransactionRate024: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交率请输入仅有两位小数的数字' }
}
},
},
/** 2.3运营主管日报模版 - 业绩报告 */
performanceReport025: {
/** 今日谈客 */
todayGuestReception025: {
ruleFn: (rule, value) => {
const maxValue = 1000
if (value < 0 || value > maxValue) {
return { message: `今日谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,3}$/.test(value) ? null : { message: '今日谈客请输入四位数字' }
}
},
/** 今日成交 */
todayTransactions025: {
ruleFn: (rule, value) => {
const maxValue = 1000
if (value < 0 || value > maxValue) {
return { message: `今日成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,3}$/.test(value) ? null : { message: '今日成交请输入四位数字' }
}
},
/** 今日成交产值 */
todayTransactionOutput025: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `今日成交产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '今日成交产值请输入仅有两位小数的数字' }
}
},
/** 今日成交率 */
todayTransactionRate025: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `今日成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '今日成交率请输入仅有两位小数的数字' }
}
},
/** 本月谈客 */
monthGuestReception025: {
ruleFn: (rule, value) => {
const maxValue = 100000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,5}$/.test(value) ? null : { message: '本月谈客请输入六位数字' }
}
},
/** 本月成交 */
monthTransactions025: {
ruleFn: (rule, value) => {
const maxValue = 100000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,5}$/.test(value) ? null : { message: '本月成交请输入六位数字' }
}
},
/** 本月成交产值 */
monthTransactionOutput025: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月成交产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交产值请输入仅有两位小数的数字' }
}
},
/** 本月成交率 */
monthTransactionRate025: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交率请输入仅有两位小数的数字' }
}
},
},
/** 工作总结 */ /** 工作总结 */
workReport: {} workReport: {}
/** 工作总结 */ /** 工作总结 */
......
...@@ -40,7 +40,7 @@ Page({ ...@@ -40,7 +40,7 @@ Page({
tabActive: "", tabActive: "",
tabList: [], tabList: [],
dataAttrName: "tmlpFormData", dataAttrName: "tmlpFormData",
dailyReportTempList: ["qinggai-temp-001", "uuid-temp-001", "uuid-temp-011"], dailyReportTempList: ["qinggai-temp-001", "uuid-temp-001", "uuid-temp-011", "uuid-temp-024", "uuid-temp-025"],
/** 模版表单数据对象 /** 模版表单数据对象
* { 模版key: [ 模版下面的表单项数据对象 ] } * { 模版key: [ 模版下面的表单项数据对象 ] }
*/ */
......
...@@ -136,6 +136,7 @@ const removeStorage = () => { ...@@ -136,6 +136,7 @@ const removeStorage = () => {
wx.removeStorageSync('dj_boutique_sessionId') wx.removeStorageSync('dj_boutique_sessionId')
wx.removeStorageSync('dateStaffPop') wx.removeStorageSync('dateStaffPop')
wx.removeStorageSync('abnormalOrderPop') wx.removeStorageSync('abnormalOrderPop')
wx.removeStorageSync('dj_boutique_webview_h5_tokens')
} }
const showNoAccess = () => { const showNoAccess = () => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!