diff --git a/common/js/apix.js b/common/js/apix.js index 1c933a7..4f34bfb 100644 --- a/common/js/apix.js +++ b/common/js/apix.js @@ -14,4 +14,7 @@ export default { home(data) { //首页上半部分 return uni.api.post("/home", data); }, + locationdistrict(data) { //获取行政区域(区,街道) + return uni.api.get("/location/district", data); + }, } \ No newline at end of file diff --git a/framework/0-conf.js b/framework/0-conf.js index 2625f09..9de837b 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -3,7 +3,9 @@ const debug = process.env.NODE_ENV == 'development' ? true : false; const proxyApi = "/api" // #endif // #ifdef MP-WEIXIN || APP -const proxyApi = 'http://101.37.12.135:9889/cashierService' // 线上 +// const proxyApi = 'http://192.168.2.133:9889/cashierService' // 王伟 +// const proxyApi = 'http://101.37.12.135:9889/cashierService' // 帆哥 +const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // #endif // #ifdef H5 diff --git a/pages/index/components/todaylist.vue b/pages/index/components/todaylist.vue index a323551..9203532 100644 --- a/pages/index/components/todaylist.vue +++ b/pages/index/components/todaylist.vue @@ -15,7 +15,7 @@ - + {{item.productName}} @@ -50,7 +50,7 @@ - + diff --git a/pages/index/index.vue b/pages/index/index.vue index f56dace..0607f9c 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -49,10 +49,12 @@ - - + + {{item.name}} - + @@ -172,10 +174,35 @@ + :key="index" @click="viewHistory(item)"> {{item.name}} - + + + + + + + + {{item.label}} + + + + + + + + + {{item.name}} + + + @@ -205,12 +232,14 @@ keyword: '', current: 0, opacity: false, - showproductlist: false, //弹成 + showproductlist: true, //弹成 + clickdetailindex: 0, //默认下拉选项第一个 hometoplist: { //上面数据 carousel: [], district: [] }, homelist: [], //下面数据 + clickhometoplistmenulist: {}, //下拉点击的数据 form: { address: '', //地址 type: '', //品类 @@ -219,7 +248,6 @@ page: 1, //页数 size: 10, //页容量 status: 'loadmore' - } }; }, @@ -242,10 +270,14 @@ return this.$store.getters.is_BarHeight }, }, - onLoad() { + async onLoad() { setTimeout(() => { this.GetTop() }, 1000) + let res = await this.apix.locationdistrict({ + keywords: '西安市' + }) + this.clickhometoplistmenulist = res.data[0].districts }, onReachBottom() { this.onLoadhome() @@ -315,12 +347,30 @@ //TODO handle the exception } }, - async viewHistory() { - this.showproductlist = true + // 点击元素到指定位置 + async viewHistory(item) { + if (item.dictName == 'allCity') { + let res = await this.apix.locationdistrict({ + keywords: '西安市' + }) + this.clickhometoplistmenulist = res.data[0] + } else { + this.clickhometoplistmenulist = item + } uni.pageScrollTo({ scrollTop: this.Topdistance + 1, duration: 300 }); + if (item.isChild) { + this.showproductlist = true + } else { + + } + }, + // 选择元素的指定选项 + clickdetail(item, index) { + this.clickdetailindex = index + this.showproductlist = false }, } @@ -466,6 +516,48 @@ } } + .sixcontent { + .sixcontentitemP { + padding: 0 32rpx 28rpx 32rpx; + max-height: 600rpx; + overflow: auto; + + .sixcontentitemP_itembox { + .sixcontentitemP_itemone { + flex: 1; + margin-top: 16rpx; + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: 400; + font-size: 24rpx; + color: #666666; + } + + .sixcontentitemP_itemone:nth-child(1) { + margin-top: 0rpx; + } + } + + .sixcontentitemP_item:nth-child(1) { + margin-top: 0rpx; + } + + .sixcontentitemP_item { + margin-top: 16rpx; + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: 400; + font-size: 24rpx; + color: #666666; + } + + .sixcontentitemP_itemactive { + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: bold; + font-size: 24rpx; + color: #666666; + } + } + } + .fivecontent { padding: 0 28rpx; diff --git a/uni_modules/le-dropdown/changelog.md b/uni_modules/le-dropdown/changelog.md new file mode 100644 index 0000000..59d70a8 --- /dev/null +++ b/uni_modules/le-dropdown/changelog.md @@ -0,0 +1,13 @@ +## 1.0.4(2023-06-04) +1.更新层级点击不了问题; +2.增加吸顶属性配置; +3.cell类型选中建议增加对号图标; +4.完善文档; +## 1.0.3(2023-04-15) +更新选项增加箭头交互 +## 1.0.2(2023-04-14) +更新示例 +## 1.0.1(2023-04-09) +更新版本标签 +## 1.0.0(2023-04-09) +第一个版本 diff --git a/uni_modules/le-dropdown/components/le-dropdown/components/le-picker.vue b/uni_modules/le-dropdown/components/le-dropdown/components/le-picker.vue new file mode 100644 index 0000000..2c5105f --- /dev/null +++ b/uni_modules/le-dropdown/components/le-dropdown/components/le-picker.vue @@ -0,0 +1,112 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/le-dropdown/components/le-dropdown/le-dropdown.vue b/uni_modules/le-dropdown/components/le-dropdown/le-dropdown.vue new file mode 100644 index 0000000..42a24b0 --- /dev/null +++ b/uni_modules/le-dropdown/components/le-dropdown/le-dropdown.vue @@ -0,0 +1,603 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/le-dropdown/components/le-dropdown/utils/cloneDeep.js b/uni_modules/le-dropdown/components/le-dropdown/utils/cloneDeep.js new file mode 100644 index 0000000..215fc46 --- /dev/null +++ b/uni_modules/le-dropdown/components/le-dropdown/utils/cloneDeep.js @@ -0,0 +1,17 @@ +function deepClone(obj) { + let result = typeof obj.splice === "function" ? [] : {}; + if (obj && typeof obj === 'object') { + for (let key in obj) { + if (obj[key] && typeof obj[key] === 'object') { + result[key] = deepClone(obj[key]);//如果对象的属性值为object的时候,递归调用deepClone,即在吧某个值对象复制一份到新的对象的对应值中。 + } else { + result[key] = obj[key];//如果对象的属性值不为object的时候,直接复制参数对象的每一个键值到新的对象对应的键值对中。 + } + + } + return result; + } + return obj; +} + +export default deepClone \ No newline at end of file diff --git a/uni_modules/le-dropdown/components/le-dropdown/utils/hexToRgb.js b/uni_modules/le-dropdown/components/le-dropdown/utils/hexToRgb.js new file mode 100644 index 0000000..ff3be76 --- /dev/null +++ b/uni_modules/le-dropdown/components/le-dropdown/utils/hexToRgb.js @@ -0,0 +1,23 @@ +export default function(hexStr){ + //十六进制颜色值的正则表达式 + let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; + let sColor = hexStr.toLowerCase(); + if (sColor && reg.test(sColor)) { + if (sColor.length === 4) { + let sColorNew = "#"; + for (let i = 1; i < 4; i += 1) { + sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1)); + } + sColor = sColorNew; + } + //处理六位的颜色值f + let sColorChange = []; + for (let i = 1; i < 7; i += 2) { + sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`)); + } + let rgbText = sColorChange.join(",") + return rgbText; + } else { + return sColor; + } +} diff --git a/uni_modules/le-dropdown/package.json b/uni_modules/le-dropdown/package.json new file mode 100644 index 0000000..0d5f863 --- /dev/null +++ b/uni_modules/le-dropdown/package.json @@ -0,0 +1,81 @@ +{ + "id": "le-dropdown", + "displayName": "le-dropdown(多功能下拉筛选菜单+主题色)", + "version": "1.0.4", + "description": "下拉筛选、多级级联、排序、点击菜单组件;兼容小程序、H5、app;可以更换主题色。", + "keywords": [ + "le-dropdown", + "dropdown", + "筛选", + "菜单", + "下拉" +], + "repository": "https://gitee.com/le-ui/le-dropdown", + "engines": { + "HBuilderX": "^3.6.18" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "插件不采集任何数据", + "permissions": "无" + }, + "npmurl": "", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "n", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "n", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "u", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/le-dropdown/readme.md b/uni_modules/le-dropdown/readme.md new file mode 100644 index 0000000..c0e13a3 --- /dev/null +++ b/uni_modules/le-dropdown/readme.md @@ -0,0 +1,72 @@ +# le-dropdown + +### 使用方式 + +```javascript + +``` +### 组件的属性说明如下: + +| 属性 | 类型 | 默认值 | 必填 | 说明 | +| ---------------- | ------- | ------- | ---- | ------------------------------ | +| v-model:menuList | Array | [] | 是 | 设置整个菜单筛选的配置数居 | +| themeColor | String | #3185FF | 否 | 整个组件的主题颜色 | +| duration | Number | 300 | 否 | 动画的执行时间 | +| isCeiling | Boolean | false | 否 | 是否自动吸顶(采用sticky规则) | + +#### menuList参数说明: + +| 属性 | 类型 | 必填 | 说明 | +| -------------- | --------------------- | ---- | ---------------------------------------------------------- | +| title | String | 是 | 菜单名称 | +| type | String | 是 | 菜单筛选展示的类型:cell\|picker\|sort\|click\|filter | +| value | Number\|String\|Array | 是 | 菜单对应的值 | +| options | Array | 否 | 菜单配置的组件参数数据,**见下**: | +| children | Array | 否 | 菜单配置的组件参数数据(当前只用在filter类型),**见下**: | +| componentProps | Object | 否 | 菜单对应type的组件参数(当前只用在picker类型),**见下**: | + +##### options参数说明: + +| 属性 | 类型 | 必填 | 说明 | +| -------- | -------------- | ---- | ------------------------------- | +| label | String | 是 | 属性名,显示在页面上 | +| value | Number\|String | 是 | 属性值,保存在父级的value属性上 | +| children | options[] | 否 | 子层级(当前只在picker上使用) | + +##### **children参数(filter)说明:** + +| 属性 | 类型 | 必填 | 说明 | +| ------- | -------------- | ---- | ------------------------------------------- | +| title | String | 是 | 菜单名称 | +| type | String | 是 | 菜单筛选展示的类型:radio\|slider\|checkbox | +| value | Number\|String | 是 | 菜单对应的值 | +| options | Array | 是 | 菜单配置的组件参数数据,**见上**: | + +###### children下type参数说明: + +- radio:单选 +- checkbox:多选 +- slider:进度(存在componentProps与type同级参数,对象里的值为uniapp原生的slider里的参数) + +##### componentProps参数(picker)说明: + +| 属性 | 类型 | 默认值 | 必填 | 说明 | +| ---------- | ------ | ------------------------------------------------------ | ---- | --------------------------------------- | +| colNum | Number | 1 | 否 | 级联的列数 | +| options | Array | - | 是 | 菜单配置的组件参数数据,**见上**: | +| fieldNames | Object | { label: `label`, value: `value`, options: `options` } | 否 | 自定义节点 label、value、options 的字段 | + +### 事件 + +| 事件名称 | 回调参数 | 说明 | +| --------- | -------------------- | ------------------------------------------------------------ | +| onConfirm | (data) => void | 确定事件回调,data为当前确认选中的菜单数据 | +| onChange | (data,index) => void | 改变事件,data为当前操作菜单数据,index为当前操作菜单第index个索引发生变化 | +