提交 9b9dcb4f authored 作者: 黎九's avatar 黎九

bug修复

上级 a8bfe986
{
"name" : "荣县随手拍",
"appid" : "__UNI__BD3107B",
"appid" : "__UNI__7F4BF0D",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
......
......@@ -68,6 +68,7 @@ export default {
onLoad(query) {
this.query = query;
console.log(query);
this.fetchPhotoTaskTypeData();
this.fetchPhotoTaskTypeDetail();
......@@ -80,7 +81,7 @@ export default {
async fetchPhotoTaskTypeData() {
const { list } = await uni.$u.http.get('/api/app/phototasktype/list', { params: { parent_id: this.query.id } });
this.list = list;
console.log(list);
// 可分类
if (list.some(v => v.category > 0)) {
this.totalList = Object.keys(categoryMap).map((c, index) => {
......@@ -124,11 +125,14 @@ export default {
},
onListClick(item, index) {
if (!this.isFirstRecordType) {
console.log(123,'Tt');
this.isFirstRecordTypeId = item.id;
this.showReport = true;
return;
}
console.log('ccc');
uni.$u.route({
url: 'pages/record-content/index',
params: {
......@@ -139,8 +143,11 @@ export default {
},
getIsFirstRecordType() {
const isFirstRecordType = uni.getStorageSync('isFirstRecordType');
if (!isFirstRecordType) uni.setStorageSync('isFirstRecordType', 1);
let isFirstRecordType = uni.getStorageSync('isFirstRecordType');
if (!isFirstRecordType){
uni.setStorageSync('isFirstRecordType', 1);
isFirstRecordType = uni.getStorageSync('isFirstRecordType');
}
return isFirstRecordType;
},
},
......
......@@ -84,6 +84,7 @@ export default {
// this.fetchPhotoTaskTypeDetail();
this.isFirstRecord = this.getIsFirstRecord();
// console.log(this.isFirstRecord);
},
onShow(options) {},
......@@ -99,7 +100,7 @@ export default {
async fetchPhotoTaskTypeDetail() {
const { detail } = await uni.$u.http.get('/api/app/phototasktype/detail', { params: { id: 0 } });
console.log(detail);
// console.log(detail);
},
async fetchFalutTask(id) {
......@@ -140,17 +141,28 @@ export default {
},
onListClick(item, index) {
// console.log(this.isFirstRecord);
if (!this.isFirstRecord) {
// console.log(123);
this.isFirstRecordId = item.id;
this.showReport = true;
return;
}
uni.$u.route({ url: 'pages/record-type/index', params: { id: item.id } });
// console.log(123,'ttc');
uni.$u.route({ url: 'pages/record-type/index',
params: {
id: item.id,
} ,
});
},
getIsFirstRecord() {
const isFirstRecord = uni.getStorageSync('isFirstRecord');
if (!isFirstRecord) uni.setStorageSync('isFirstRecord', 1);
let isFirstRecord = uni.getStorageSync('isFirstRecord');
if (!isFirstRecord){
uni.setStorageSync('isFirstRecord', 1)
isFirstRecord = uni.getStorageSync('isFirstRecord');
} ;
return isFirstRecord;
},
......
MIT License
Copyright (c) 2020 www.uviewui.com
Copyright (c) 2023 www.uviewui.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
## 2.0.34(2022-09-25)
## 2.0.36(2023-03-27)
# uView2.0重磅发布,利剑出鞘,一统江湖
1. 重构`deepClone` & `deepMerge`方法
2. 其他优化
## 2.0.34(2022-09-24)
# uView2.0重磅发布,利剑出鞘,一统江湖
1. `u-input``u-textarea`增加`ignoreCompositionEvent`属性
......
......@@ -114,7 +114,7 @@
* @event {Function} confirm 点击确认按钮时触发
* @event {Function} cancel 点击取消按钮时触发
* @event {Function} close 点击遮罩关闭出发,closeOnClickOverlay为true有效
* @example <u-loadmore :status="status" icon-type="iconType" load-text="loadText" />
* @example <u-modal :show="true" title="title" content="content"></u-modal>
*/
export default {
name: 'u-modal',
......@@ -146,7 +146,7 @@
},
// 点击遮罩
// 从原理上来说,modal的遮罩点击,并不是真的点击到了遮罩
// 因为modal依赖于popup的中部弹窗类型,中部弹窗比较特殊,虽有然遮罩,但是为了让弹窗内容能flex居中
// 因为modal依赖于popup的中部弹窗类型,中部弹窗比较特殊,虽然有遮罩,但是为了让弹窗内容能flex居中
// 多了一个透明的遮罩,此透明的遮罩会覆盖在灰色的遮罩上,所以实际上是点击不到灰色遮罩的,popup内部在
// 透明遮罩的子元素做了.stop处理,所以点击内容区,也不会导致误触发
clickHandler() {
......
......@@ -83,7 +83,7 @@ export default {
},
// 文字装饰,下划线,中划线等,可选值 none|underline|line-through
decoration: {
tepe: String,
type: String,
default: uni.$u.props.text.decoration
},
// 外边距,对象、字符串,数值形式均可
......
// 此版本发布于2022-00-24
const version = '2.0.34'
// 此版本发布于2023-03-27
const version = '2.0.36'
// 开发环境才提示,生产环境不会提示
if (process.env.NODE_ENV === 'development') {
......
......@@ -179,22 +179,34 @@ function addUnit(value = 'auto', unit = uni?.$u?.config?.unit ?? 'px') {
/**
* @description 深度克隆
* @param {object} obj 需要深度克隆的对象
* @param cache 缓存
* @returns {*} 克隆后的对象或者原值(不是对象)
*/
function deepClone(obj) {
// 对常见的“非”值,直接返回原来值
if ([null, undefined, NaN, false].includes(obj)) return obj
if (typeof obj !== 'object' && typeof obj !== 'function') {
// 原始类型直接返回
return obj
}
const o = test.array(obj) ? [] : {}
for (const i in obj) {
if (obj.hasOwnProperty(i)) {
o[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i]
function deepClone(obj, cache = new WeakMap()) {
if (obj === null || typeof obj !== 'object') return obj;
if (cache.has(obj)) return cache.get(obj);
let clone;
if (obj instanceof Date) {
clone = new Date(obj.getTime());
} else if (obj instanceof RegExp) {
clone = new RegExp(obj);
} else if (obj instanceof Map) {
clone = new Map(Array.from(obj, ([key, value]) => [key, deepClone(value, cache)]));
} else if (obj instanceof Set) {
clone = new Set(Array.from(obj, value => deepClone(value, cache)));
} else if (Array.isArray(obj)) {
clone = obj.map(value => deepClone(value, cache));
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
clone = Object.create(Object.getPrototypeOf(obj));
cache.set(obj, clone);
for (const [key, value] of Object.entries(obj)) {
clone[key] = deepClone(value, cache);
}
} else {
clone = Object.assign({}, obj);
}
return o
cache.set(obj, clone);
return clone;
}
/**
......@@ -205,24 +217,27 @@ function deepClone(obj) {
*/
function deepMerge(target = {}, source = {}) {
target = deepClone(target)
if (typeof target !== 'object' || typeof source !== 'object') return false
if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target;
const merged = Array.isArray(target) ? target.slice() : Object.assign({}, target);
for (const prop in source) {
if (!source.hasOwnProperty(prop)) continue
if (prop in target) {
if (typeof target[prop] !== 'object') {
target[prop] = source[prop]
} else if (typeof source[prop] !== 'object') {
target[prop] = source[prop]
} else if (target[prop].concat && source[prop].concat) {
target[prop] = target[prop].concat(source[prop])
if (!source.hasOwnProperty(prop)) continue;
const sourceValue = source[prop];
const targetValue = merged[prop];
if (sourceValue instanceof Date) {
merged[prop] = new Date(sourceValue);
} else if (sourceValue instanceof RegExp) {
merged[prop] = new RegExp(sourceValue);
} else if (sourceValue instanceof Map) {
merged[prop] = new Map(sourceValue);
} else if (sourceValue instanceof Set) {
merged[prop] = new Set(sourceValue);
} else if (typeof sourceValue === 'object' && sourceValue !== null) {
merged[prop] = deepMerge(targetValue, sourceValue);
} else {
target[prop] = deepMerge(target[prop], source[prop])
merged[prop] = sourceValue;
}
} else {
target[prop] = source[prop]
}
}
return target
return merged;
}
/**
......@@ -650,6 +665,16 @@ function pages() {
return pages
}
/**
* 获取页面历史栈指定层实例
* @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。
*/
function getHistoryPage(back = 0) {
const pages = getCurrentPages()
const len = pages.length
return pages[len - 1 + back]
}
/**
* @description 修改uView内置属性值
* @param {object} props 修改内置props属性
......@@ -701,5 +726,6 @@ export default {
setProperty,
page,
pages,
getHistoryPage,
setConfig
}
......@@ -53,7 +53,7 @@ class Router {
mergeConfig.url = this.mixinParam(options, params)
mergeConfig.type = 'navigateTo'
} else {
mergeConfig = uni.$u.deepMerge(options, this.config)
mergeConfig = uni.$u.deepMerge(this.config, options)
// 否则正常使用mergeConfig中的url和params进行拼接
mergeConfig.url = this.mixinParam(options.url, options.params)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论