Commit 7e1ca638 by 张立顺

分包处理

1 parent dc9a3811
{
"pages": [
"pages/accountItems/accountItems",
"pages/nothing/nothing",
"pages/wxLogin/wxLogin",
"pages/webView/webView",
"tabIndex/pages/index/index",
"tabWorkOrder/pages/index/index",
"tabWorkOrder/pages/createOrder/createOrder",
......@@ -8,18 +12,12 @@
"tabWorkOrder/pages/constructionOrderDetail/constructionOrderDetail",
"tabWorkOrder/pages/confirmOrder/confirmOrder",
"tabWorkOrder/pages/updateOrderInfo/updateOrderInfo",
"tabWorkOrder/pages/createArchives/createArchives",
"tabWorkOrder/pages/ocr/ocr",
"tabDate/pages/index/index",
"tabDate/pages/detail/detail",
"tabMine/pages/index/index",
"pages/accountItems/accountItems",
"pages/nothing/nothing",
"pages/wxLogin/wxLogin",
"tabOperating/pages/index/index",
"tabOperating/pages/operatingShow/operatingShow",
"tabWorkOrder/pages/ocr/ocr",
"test/pages/test",
"tabWorkOrder/pages/createArchives/createArchives",
"tabOperating/pages/4sOverview/4sOverview"
"test/pages/test"
],
"window": {
"backgroundTextStyle": "light",
......@@ -54,6 +52,13 @@
}
]
},
"subpackages": [
{
"root": "tabOperating",
"name": "tabOperating",
"pages": ["pages/4sOverview/4sOverview", "pages/index/index", "pages/operatingShow/operatingShow"]
}
],
"usingComponents": {
"gl-textarea": "/components/GlTextarea/GlTextarea",
"gl-cell": "/components/GlCell/GlCell",
......
// components/image/index.js
import { IMG_URL, IMG_VERSION } from '~/utils/constantData'
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: `${IMG_URL}${url}?v=` + IMG_VERSION()
})
}
}
},
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" />
// pages/webView/webView.js
Page({
/**
* 页面的初始数据
*/
data: {
flag: true
},
getParams(str) {
let params = str.split('?')
if (params.length < 2) return {}
let param = params[1].split('&')
let obj = {}
for (let i = 0; i < param.length; i++) {
let paramsA = param[i].split('=')
let key = paramsA[0]
let value = paramsA[1]
obj[key] = value
}
return obj
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.$api.showLoading('加载中...')
let decodeUrl = decodeURIComponent(options.url)
let param = this.getParams(decodeUrl)
if (param.urlParam) {
let query = JSON.parse(param.urlParam)
this.refresh = query.refresh
}
console.log(decodeUrl)
this.setData({
url: decodeUrl
})
wx.hideLoading()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.refresh) {
this.setData(
{
flag: true
},
() => {
this.setData({
url: this.data.url
})
}
)
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
if (this.refresh) {
this.setData({
flag: false
})
}
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
if (this.refresh) {
this.setData({
flag: false
})
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
{
"usingComponents": {}
}
\ No newline at end of file
/* packagesList/webView/pages/webView.wxss */
\ No newline at end of file
<!-- <web-view src="{{url}}"></web-view> -->
<block wx:if="{{flag}}">
<web-view src="{{url}}"></web-view>
</block>
\ No newline at end of file
/* pages/webView/webView.wxss */
\ No newline at end of file
......@@ -42,7 +42,7 @@
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
......
......@@ -130,5 +130,5 @@
]
}
},
"libVersion": "2.15.0"
"libVersion": "2.28.1"
}
\ No newline at end of file
......@@ -13,7 +13,6 @@ export const checkYqdSuper = (globalData, userInfo) => {
// app.globalData.isYqdSuper = userInfo.userType == 2 && !userInfo.isSuper && merchantAccountType
globalData.isYqdSuper = userInfo.userType != 2 && !userInfo.isSuper && merchantAccountType
globalData.isStaff = userInfo.userType == 2 && !userInfo.isSuper && merchantAccountType
globalData.isStaff = 'test'
}
// 获取园区店信息
export const getYQInfo = userInfo => {
......
......@@ -10,13 +10,11 @@ Page({
*/
data: {
...mixins.data,
navBarHeight: 0,
totalTableSum: [
{
name: 'filmTimesTotalSum'
},
// {
// name: 'getTotalSum' //发券总数
// },
{
name: 'usedTotalSum'
},
......@@ -53,7 +51,6 @@ Page({
type: 2,
typeText: '补录订单'
}
// tableWidth: 606 + 28
},
tipsEvent() {
this.setData({
......@@ -81,7 +78,7 @@ Page({
api
.updateCouponDayReport(methodUpdateInfo)
.then(result => {
console.log(result)
// console.log(result)
if (result.code == 0) {
methodUpdateInfo.value = ''
this.setData({
......@@ -102,13 +99,8 @@ Page({
changeTableData(e) {
let { startDate, maxDate, isYqdSuper } = this.data
let { merchantId, filmTimes, merchantName } = e.currentTarget.dataset.item
// UpdateInfo
// console.log(e.currentTarget.dataset)
// console.log(item)
// 不是管理员不开启这个权限
if (!isYqdSuper) return
if (startDate != maxDate) {
return wx.showToast({
title: '只能修改当天数据',
......@@ -119,21 +111,20 @@ Page({
let methodUpdateInfo = {
merchantId,
merchantName,
// filmTimes == 0 ? '' :
filmTimes: filmTimes,
startDate: maxDate,
endDate: maxDate
}
// return
this.setData({
showRemark: true,
methodUpdateInfo
})
// console.log('changeTableData')
},
navbarReady(e) {
// console.log(e, 'e')
let navBarHeight = e.detail.height
// console.log(e.detail.height)
this.setData({
navBarHeight
})
......@@ -169,40 +160,6 @@ Page({
// 判断是不是门店员工
if (userInfo.merchantType && !userInfo.isSuper && type == 2) {
wx.$router.go(item.url)
// if () {
// // if (item.url) {
// // if (type == 2) {
// // wx.$router.go(item.url)
// // } else {
// // wx.$util.showNoAccess()
// // }
// // }
// // if (item.wxCallBack) {
// // wx[item.wxCallBack]({
// // success(res) {
// // let { result } = res
// // wx.$router.go('tabWorkOrder.createOrder', {
// // scene: result
// // })
// // },
// // fail(err) {
// // this.showToast(err)
// // }
// // })
// // }
// } else {
// console.log('item.url', item.url)
// // if (item.url) {
// // if (item.url != 'tabWorkOrder.createOrder') {
// if (!['tabWorkOrder.createOrder', 'tabWorkOrder.createArchives'].includes(item.url)) {
// return wx.$router.go(item.url)
// } else {
// wx.$util.showNoAccess()
// }
// // } else {
// // wx.$util.showNoAccess()
// // }
// }
} else {
// item.url != 'tabWorkOrder.createOrder'
if (!['tabWorkOrder.createOrder', 'tabWorkOrder.createArchives'].includes(item.url)) {
......@@ -282,30 +239,7 @@ Page({
table
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(app.globalData.isStaff )
if (options.supplement) {
this.setData({
showOrderpop: true
})
}
let today = new Date()
let startDate = today.format('yyyy-MM-dd')
let endDate = today.format('yyyy-MM-dd')
this.setData({
maxDate: new Date().format('yyyy-MM-dd'),
startDate,
endDate
})
// console.log(app.globalData.isYqdSuper)
this.setData({
isStaff: app.globalData.isStaff
})
// this.getWaitOrder()
},
setTime() {
let _this = this
time = setTimeout(() => {
......@@ -315,17 +249,13 @@ Page({
},
// 10s轮询一次待补录
getWaitOrder() {
// console.log('waitorder')
let { isStaff } = this.data
// console.log('isStaff', isStaff)
isStaff &&
api
.waitinputorder()
.then(result => {
// console.log(result)
let { code, data } = result
// console.log(this.setTime)
// console.log(result.data.waitInputCount)
this.setTime()
if (code == 0) {
this.setData({
......@@ -335,19 +265,7 @@ Page({
})
.catch(err => {})
},
init(userInfo) {
// app.
getYQInfo(userInfo)
.then(result => {
console.log(result)
// console.log(app.globalData.isYqdSuper)
this.setData({
...result
})
})
.catch(err => {})
this.getPageData()
},
getPageData() {
api.getHomeReport().then(res => {
wx.$util.hideLoading()
......@@ -369,9 +287,6 @@ Page({
getMerchantCouponList() {
let { orderByTypeEnum, tableSort, tableObj, startDate, endDate, totalTableSum, tableWidth } = this.data
let target = tableObj[tableSort].sort
// console.log(target)
// console.log(orderByTypeEnum[target])
// console.log(orderByTypeEnum[target][tableSort])
let orderByType = orderByTypeEnum[target][tableSort]
api
.getMerchantCouponList({
......@@ -388,12 +303,8 @@ Page({
let sumWidth = 0
totalTableSum.forEach((element, index) => {
element.total = data[element.name] || 0
// customerUnitMoneySum
let sumList = ['orderMoneyTotalSum', 'customerUnitMoneySum']
if (sumList.includes(element.name)) {
// debugger
// element.total = 12344566778
// console.log(element.total)
let length = element.total.toString().length
// console.log(length)
let labelWidth = length > 5 ? length * 20 : 118
......@@ -403,10 +314,8 @@ Page({
sumWidth = sumWidth + labelWidth
}
})
// console.log(sumWidth)
tableWidth = 118 * 5 + 232 + 30 + sumWidth
// 处理列表宽度问题
tableWidth = 118 * 5 + 232 + 30 + sumWidth
this.setData({
tableFlag: true,
......@@ -414,7 +323,6 @@ Page({
totalTableSum,
tableWidth,
tableObj
// totalTableAverage
})
} else {
this.showToast(message)
......@@ -428,18 +336,50 @@ Page({
})
}
},
init(userInfo) {
getYQInfo(userInfo)
.then(result => {
// console.log(result)
// console.log(app.globalData.isYqdSuper)
this.setData({
...result
})
})
.catch(err => {})
this.getPageData()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(app.globalData.isStaff)
if (options.supplement) {
this.setData({
showOrderpop: true
})
}
let today = new Date()
let startDate = today.format('yyyy-MM-dd')
let endDate = today.format('yyyy-MM-dd')
this.setData({
maxDate: new Date().format('yyyy-MM-dd'),
startDate,
endDate
})
// console.log(app.globalData.isYqdSuper)
this.setData({
isStaff: app.globalData.isStaff
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// debugger
const accountInfo = wx.getAccountInfoSync()
let checklist = []
switch (accountInfo.miniProgram.envVersion) {
case 'develop':
// checklist = ['15816539334']
checklist = []
// this.globalData.url = 'http://192.168.0.252:3000/api'; //
break
case 'trial':
// index = manual ? index : 2
......
{
"navigationStyle":"custom"
}
\ No newline at end of file
// tabWorkOrder/pages/createOrder/createOrder.js
import deepClone from '~/utils/deepClone'
// import deepClone from '~/utils/deepClone'
import api from '../../api'
import { getYQorderInfo } from '~/store/index'
const app = getApp()
......@@ -711,7 +711,7 @@ Page({
this.setData({
// requiredList: [...new Set(requiredList)],
// phoneShow: merchantSettingInfo.yqPhoneConfig
phoneShow: deepClone(merchantSettingInfo.yqPhoneConfig)
phoneShow: wx.$util.deepClone(merchantSettingInfo.yqPhoneConfig)
})
// this.setData({ merchantSettingInfo })
})
......
// tabWorkOrder/pages/createArchives/createArchives.js
// tabWorkOrder/pages/createOrder/createOrder.js
import deepClone from '~/utils/deepClone'
// import deepClone from '~/utils/deepClone'
import api from '../../api'
import { getYQorderInfo } from '~/store/index'
const app = getApp()
......@@ -416,7 +416,7 @@ Page({
this.setData({
isStandNo,
// phoneShow: merchantSettingInfo.yqPhoneConfig
phoneShow: deepClone(merchantSettingInfo.yqPhoneConfig)
phoneShow: wx.$util.deepClone(merchantSettingInfo.yqPhoneConfig)
})
// this.setData({ merchantSettingInfo })
})
......
// tabWorkOrder/pages/createOrder/createOrder.js
import deepClone from '~/utils/deepClone'
// import deepClone from '~/utils/deepClone'
import api from '../../api'
import { getYQorderInfo } from '~/store/index'
const app = getApp()
......@@ -611,7 +611,7 @@ Page({
// console.log(deepClone(merchantSettingInfo.yqPhoneConfig), 'deepClone(merchantSettingInfo.yqPhoneConfig)')
this.setData({
requiredList: [...new Set(requiredList)],
phoneShow: deepClone(merchantSettingInfo.yqPhoneConfig)
phoneShow: wx.$util.deepClone(merchantSettingInfo.yqPhoneConfig)
})
// this.setData({ merchantSettingInfo })
})
......
// tabWorkOrder/pages/createOrder/createOrder.js
import deepClone from '~/utils/deepClone'
// import deepClone from '~/utils/deepClone'
import api from '../../api'
import { getYQorderInfo } from '~/store/index'
let toastList = {
......@@ -242,7 +242,7 @@ Page({
getYQorderInfo()
.then(merchantSettingInfo => {
this.setData({
phoneShow: deepClone(merchantSettingInfo.yqPhoneConfig)
phoneShow: wx.$util.deepClone(merchantSettingInfo.yqPhoneConfig)
})
// this.setData({ merchantSettingInfo })
})
......
......@@ -13,18 +13,13 @@ export function getUserInfo() {
return $Storage.get('userInfo')
}
export function setUserInfo(data) {
console.log(data)
// console.log(data)
$Storage.set('userInfo', data)
}
export function removeSystemStorage() {
// $Storage.rm('srcm_shopmall_user_info')
// $Storage.rm('scrm_shopmall_sessionId')
// $Storage.rm('guest_no')
// $Storage.rm('equity_info')
// $Storage.rm('packageList')
// $Storage.rm('isVIP')
// $Storage.rm('bizjiaUrl')
// $Storage.rm('vip_card_info')
}
export function setStorageSync(key, data) {
$Storage.set(key, JSON.stringify(data))
......
/**
* 深克隆 所有原型链上的对象和属性
* 例: const bar=deepClone(foo)
* console.log(bar===foo) false
* @param {*} obj
*/
const deepClone = obj => {
const clone = require('rfdc')({ proto: false, circles: false })
return clone(obj)
}
// const deepClone = obj => {
// if (typeof obj !== 'object') {
// return obj
// }
// if (Array.isArray(obj)) {
// return deepCloneArray(obj)
// } else {
// return deepCloneObj(obj)
// }
// }
// const deepCloneArray = arr => {
// // function deepCloneArray(arr) {
// const target = []
// arr.forEach(it => {
// if (typeof it === 'object') {
// target.push(deepClone(it))
// } else {
// target.push(it)
// }
// })
// return target
// }
// const deepCloneObj = target => {
// const map = new WeakMap()
// function isObject(target) {
// return (typeof target === 'object' && target) || typeof target === 'function'
// }
// function clone(data) {
// if (!isObject(data)) {
// return data
// }
// if ([Date, RegExp].includes(data.constructor)) {
// return new data.constructor(data)
// }
// // 会在生产环境的clone props对象报错 导致报错 弃用
// if (typeof data === 'function') {
// return new Function('return ' + data.toString())()
// }
// const exist = map.get(data)
// if (exist) {
// return exist
// }
// const keys = Reflect.ownKeys(data)
// const allDesc = Object.getOwnPropertyDescriptors(data)
// const result = Object.create(Object.getPrototypeOf(data), allDesc)
// map.set(data, result)
// keys.forEach(key => {
// const val = data[key]
// if (isObject(val)) {
// result[key] = clone(val)
// } else {
// result[key] = val
// }
// })
// return result
// }
// return clone(target)
// }
export default deepClone
......@@ -14,7 +14,7 @@ const systemInfo = wx.getSystemInfoSync()
const manual = false
const release = false
let index = 3
let index = 2
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
......
......@@ -88,16 +88,6 @@ const getUserInfo = () => {
let user = wx.getStorageSync('dj_boutique_user_info') || null
return JSON.parse(user)
}
const setSellerInfo = sellerInfo => {
wx.setStorageSync('dj_boutique_seller_info', JSON.stringify(sellerInfo))
}
const getSellerInfo = () => {
let sellerInfo = wx.getStorageSync('dj_boutique_seller_info') || null
return JSON.parse(sellerInfo)
}
const removeSellerInfo = () => {
wx.removeStorageSync('dj_boutique_seller_info')
}
const setUserInfo = userInfo => {
wx.setStorageSync('dj_boutique_user_info', JSON.stringify(userInfo))
}
......@@ -111,8 +101,8 @@ const setSessionId = sessionId => {
const removeStorage = () => {
wx.removeStorageSync('dj_boutique_user_info')
wx.removeStorageSync('dj_boutique_sessionId')
// wx.removeStorageSync('dj_boutique_seller_info')
}
const showNoAccess = () => {
showToast('您的账号无法完成此操作')
}
......@@ -153,7 +143,16 @@ var type = function (data) {
.toLowerCase()
return dataType
}
/**
* 深克隆 所有原型链上的对象和属性
* 例: const bar=deepClone(foo)
* console.log(bar===foo) false
* @param {*} obj
*/
const deepClone = obj => {
const clone = require('rfdc')({ proto: false, circles: false })
return clone(obj)
}
const util = {
onReachBottom,
haveEmoji,
......@@ -164,15 +163,13 @@ const util = {
setUserInfo,
getSessionId,
setSessionId,
setSellerInfo,
getSellerInfo,
removeSellerInfo,
removeStorage,
showNoAccess,
setStorageSync,
getStorageSync,
getSceneId,
type
type,
deepClone
}
const Util = Object.assign(util, wxApi, format)
// console.log('Util', Util)
......
......@@ -160,9 +160,9 @@ export function handleCopy(url) {
const getViewInfo = (name, callBack, isComponents) => {
const query = !isComponents ? wx.createSelectorQuery() : wx.createSelectorQuery().in(isComponents)
query
.selectAll(name)
.select(name)
.boundingClientRect(res => {
console.log('res: ', res)
// console.log('res: ', res)
callBack(res)
})
.exec()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!