From 7ab0424d94b67bb99681f67354fafea1c7c73fbe Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Fri, 18 Nov 2022 16:26:04 +0800 Subject: [PATCH 1/5] cxw-010203 --- app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app.js b/app.js index 8aee4d5..02a63f0 100644 --- a/app.js +++ b/app.js @@ -54,7 +54,6 @@ function splitQueryParams(params, key) { }(); App({ onLaunch: function () { - this.autoUpdate(); // 展示本地存储能力 var logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) From 7dbf1c748ff30ffe5fd58abb7c370d7361e79a93 Mon Sep 17 00:00:00 2001 From: liuyongli <1598631486@qq.com> Date: Fri, 18 Nov 2022 17:49:13 +0800 Subject: [PATCH 2/5] lyl --- components/option/percentRankOption.js | 115 ++++++++------- components/option/pictographicOption.js | 6 +- components/option/pictographicOption2.js | 4 +- components/timeCustom/index.js | 15 +- contrastPackages/brandRatio/BBS/index.wxml | 6 +- contrastPackages/brandRatio/BBS/index.wxss | 2 +- contrastPackages/eventRatio/weibo/index.js | 5 +- contrastPackages/eventRatio/weibo/index.wxml | 11 +- contrastPackages/eventRatio/weibo/index.wxss | 6 +- contrastPackages/themeRatio/BBS/index.wxml | 7 +- contrastPackages/themeRatio/weibo/index.wxml | 8 +- contrastPackages/themeRatio/weibo/index.wxss | 7 + .../@vant/weapp/tree-select/index.wxss | 48 ++++++- pages/index/Salesranking/Salesranking.js | 135 +++++++++--------- pages/index/Salesranking/Salesranking.wxml | 10 +- pages/index/Salesranking/Salesranking.wxss | 36 +++-- .../pages/brandInsight/brandDataList/index.js | 3 +- .../pages/eventInsight/evDatalist/index.js | 2 +- .../pages/modalInsight/modalDataList/index.js | 2 +- pages/insight/pages/themeList/index.js | 2 +- 20 files changed, 257 insertions(+), 173 deletions(-) diff --git a/components/option/percentRankOption.js b/components/option/percentRankOption.js index dae570f..9f0b6ce 100644 --- a/components/option/percentRankOption.js +++ b/components/option/percentRankOption.js @@ -1,5 +1,11 @@ // 地区分布 -export default function pictographicOption(dRegion=[],dValue=[]){ +export default function pictographicOption(dRegion = [], dValue = []) { + if(dRegion.length < 5) { + let n = 5 - dRegion.length; + for(let i = 0; i < n; i++) { + dRegion.push('') + } + } return { tooltip: { trigger: "item", @@ -13,60 +19,61 @@ export default function pictographicOption(dRegion=[],dValue=[]){ extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;", confine: true }, - xAxis: { - show:false, - type:'value' - }, - yAxis: - { - data: dRegion, - inverse: true, - axisTick: { show: false }, - axisLine: { show: false }, - axisLabel: { - margin: 10, - color: '#333333', - fontSize: 12 - } - }, - grid: { - // top: 'center', - bottom:20, - height:186, - width:48, - left: 60, - }, - series: [ - { - itemStyle:{ - normal:{ - color:'#0084FF', - barBorderRadius:12 - }, - }, - // current data - type: 'bar', - barWidth:10, - data:dValue, - label: { - show: true, - formatter: function (params) { - return (params.value).toFixed(1) + ' %'; - }, - // position: 'right', - // offset: [20, 0], + xAxis: { + show: false, + type: 'value' + }, + yAxis: + { + data: dRegion, + axisTick: { show: false }, + axisLine: { show: false }, + inverse: true, + axisLabel: { + margin: 10, color: '#333333', - fontSize: 12, - position:[60,-1] - }, + fontSize: 12 + } + }, + grid: { + // top: 'center', + top: 'top', + bottom: 20, + height: 186, + width: 48, + left: 60, + }, + series: [ + { + itemStyle: { + normal: { + color: '#0084FF', + barBorderRadius: 12 + }, + }, + // current data + type: 'bar', + barWidth: 10, + data: dValue, + label: { + show: true, + formatter: function (params) { + return (params.value).toFixed(1) + ' %'; + }, + // position: 'right', + // offset: [20, 0], + color: '#333333', + fontSize: 12, + position: [60, -1] + }, showBackground: true, backgroundStyle: { - color: 'rgba(180, 180, 180, 0.2)' - }, - markLine: { - symbol: 'none', - }, - }, - ] -} + color: 'rgba(180, 180, 180, 0.2)' + }, + markLine: { + symbol: 'none', + }, + }, + ] + } } \ No newline at end of file diff --git a/components/option/pictographicOption.js b/components/option/pictographicOption.js index be09dfd..23cc9f2 100644 --- a/components/option/pictographicOption.js +++ b/components/option/pictographicOption.js @@ -33,11 +33,11 @@ export default function pictographicOption(dRegion = [], dValue = [], dSum = 0) } }, grid: { - top: '10%', - bottom: 20, + top: '10%', + bottom: 5, height: 186, width: 48, - left: 60, + left: 55, }, series: [{ itemStyle: { diff --git a/components/option/pictographicOption2.js b/components/option/pictographicOption2.js index 7fb8cb4..c3d14c6 100644 --- a/components/option/pictographicOption2.js +++ b/components/option/pictographicOption2.js @@ -36,9 +36,9 @@ export default function pictographicOption(dRegion = [], dValue = [], dSum = 0) } }, grid: { - height: 186, width: '50%', - left: 'center', + height: 186, + left:'23%', }, series: [{ itemStyle: { diff --git a/components/timeCustom/index.js b/components/timeCustom/index.js index 9c11ee2..3abcff5 100644 --- a/components/timeCustom/index.js +++ b/components/timeCustom/index.js @@ -20,9 +20,18 @@ Component({ }, lifetimes: { attached() { - wx.setStorageSync('sTimeType', '34'); - wx.setStorageSync('sStartTime', ''); - wx.setStorageSync('sEndTime', ''); + let st = wx.getStorageSync('sTimeType') + if (st) { + let n = this.data.valList.findIndex(ele => ele == st); + this.setData({ + intervalSel: n + }) + } else { + wx.setStorageSync('sTimeType', 34); + wx.setStorageSync('sStartTime', ''); + wx.setStorageSync('sEndTime', ''); + } + } }, methods: { diff --git a/contrastPackages/brandRatio/BBS/index.wxml b/contrastPackages/brandRatio/BBS/index.wxml index 2395038..2097452 100644 --- a/contrastPackages/brandRatio/BBS/index.wxml +++ b/contrastPackages/brandRatio/BBS/index.wxml @@ -52,7 +52,7 @@ 论坛正面话题对比 - + @@ -61,7 +61,7 @@ - {{item.name}} + {{item.name}} @@ -80,7 +80,7 @@ - {{item.name}} + {{item.name}} diff --git a/contrastPackages/brandRatio/BBS/index.wxss b/contrastPackages/brandRatio/BBS/index.wxss index a1cfc1f..9e1f3cc 100644 --- a/contrastPackages/brandRatio/BBS/index.wxss +++ b/contrastPackages/brandRatio/BBS/index.wxss @@ -94,5 +94,5 @@ height: 970rpx; background:#ffffff; border-radius: 8rpx; - padding-top:32rpx; + padding:32rpx 0; } diff --git a/contrastPackages/eventRatio/weibo/index.js b/contrastPackages/eventRatio/weibo/index.js index 273fd43..f501d98 100644 --- a/contrastPackages/eventRatio/weibo/index.js +++ b/contrastPackages/eventRatio/weibo/index.js @@ -152,7 +152,6 @@ Component({ obj.func = pieOption(['#FF4852', '#FF6E25', '#FFBF00', '#20CC62', '#00D6D6', '#00AAFF', '#7257FF'], i) newData.push(obj) } - console.log(newData); this.setData({ weiboDist: newData }) @@ -193,11 +192,13 @@ Component({ newRes.push(obj) } newRes = newRes.map(ele => { - ele.func = [pictographicOption(ele.region.slice(0, 5), ele.value.slice(0, 5), ele.sum), + ele.func = [pictographicOption(ele.region.slice(0, 5), ele.value.slice(0, 5), ele.sum,), pictographicOption(ele.region.slice(5, 10), ele.value.slice(5, 10), ele.sum) ] return ele }) + + console.log('ser',newRes) this.setData({ area: newRes }) diff --git a/contrastPackages/eventRatio/weibo/index.wxml b/contrastPackages/eventRatio/weibo/index.wxml index bf99ccb..4f7790b 100644 --- a/contrastPackages/eventRatio/weibo/index.wxml +++ b/contrastPackages/eventRatio/weibo/index.wxml @@ -71,16 +71,15 @@ 活跃用户信息 - - 事件一 - - + + {{indedx==0?"事件一":"事件二"}} + + - + - diff --git a/contrastPackages/eventRatio/weibo/index.wxss b/contrastPackages/eventRatio/weibo/index.wxss index 6c8ed1c..eef986a 100644 --- a/contrastPackages/eventRatio/weibo/index.wxss +++ b/contrastPackages/eventRatio/weibo/index.wxss @@ -1,7 +1,7 @@ .chart_box{ margin-top: 24rpx; width: 686rpx; - height: 486rpx; + height: 400rpx; padding-top:32rpx ; background: white; } @@ -70,10 +70,10 @@ .area_box{ margin-top: 24rpx; width: 686rpx; - height: 970rpx; + height: 880rpx; background:#ffffff; border-radius: 8rpx; - padding-top:32rpx; + padding:32rpx 0; } .event_distribution{ height: 894rpx; diff --git a/contrastPackages/themeRatio/BBS/index.wxml b/contrastPackages/themeRatio/BBS/index.wxml index 60e0dab..1187c22 100644 --- a/contrastPackages/themeRatio/BBS/index.wxml +++ b/contrastPackages/themeRatio/BBS/index.wxml @@ -61,9 +61,8 @@ - {{item.name}} - - + {{item.name}} + @@ -82,7 +81,7 @@ {{item.name}} - + diff --git a/contrastPackages/themeRatio/weibo/index.wxml b/contrastPackages/themeRatio/weibo/index.wxml index 9a4f36d..f1042f8 100644 --- a/contrastPackages/themeRatio/weibo/index.wxml +++ b/contrastPackages/themeRatio/weibo/index.wxml @@ -95,12 +95,12 @@ - {{item.name}} - - + {{item.name}} + + - + diff --git a/contrastPackages/themeRatio/weibo/index.wxss b/contrastPackages/themeRatio/weibo/index.wxss index 02d24d0..1e8bbde 100644 --- a/contrastPackages/themeRatio/weibo/index.wxss +++ b/contrastPackages/themeRatio/weibo/index.wxss @@ -5,6 +5,13 @@ padding:32rpx 0; background: white; } +.chart_box1{ + margin-top: 24rpx; + width: 686rpx; + height: 400rpx; + padding:32rpx 0; + background: white; +} .chart_box1{ margin-top: 24rpx; diff --git a/miniprogram_npm/@vant/weapp/tree-select/index.wxss b/miniprogram_npm/@vant/weapp/tree-select/index.wxss index 5bef0ac..f03e2da 100644 --- a/miniprogram_npm/@vant/weapp/tree-select/index.wxss +++ b/miniprogram_npm/@vant/weapp/tree-select/index.wxss @@ -1 +1,47 @@ -@import '../common/index.wxss';.van-tree-select{display:flex;font-size:var(--tree-select-font-size,14px);position:relative;-webkit-user-select:none;user-select:none}.van-tree-select__nav{--sidebar-padding:12px 8px 12px 12px;background-color:var(--tree-select-nav-background-color,#f7f8fa);flex:1}.van-tree-select__nav__inner{height:100%;width:100%!important}.van-tree-select__content{background-color:var(--tree-select-content-background-color,#fff);flex:2}.van-tree-select__item{font-weight:700;line-height:var(--tree-select-item-height,44px);padding:0 32px 0 var(--padding-md,16px);position:relative}.van-tree-select__item--active{color:var(--tree-select-item-active-color,#ee0a24)}.van-tree-select__item--disabled{color:var(--tree-select-item-disabled-color,#c8c9cc)}.van-tree-select__selected{position:absolute;right:var(--padding-md,16px);top:50%;transform:translateY(-50%)} \ No newline at end of file +@import '../common/index.wxss'; + +.van-tree-select { + display: flex; + font-size: var(--tree-select-font-size, 14px); + position: relative; + -webkit-user-select: none; + user-select: none +} + +.van-tree-select__nav { + --sidebar-padding: 12px 8px 12px 12px; + background-color: var(--tree-select-nav-background-color, #f7f8fa); + flex: 1 +} + +.van-tree-select__nav__inner { + height: 100%; + width: 100% !important +} + +.van-tree-select__content { + background-color: var(--tree-select-content-background-color, #fff); + flex: 2 +} + +.van-tree-select__item { + font-weight: 700; + line-height: var(--tree-select-item-height, 44px); + padding: 0 32px 0 var(--padding-md, 16px); + position: relative +} + +.van-tree-select__item--active { + color: var(--tree-select-item-active-color, #ee0a24) +} + +.van-tree-select__item--disabled { + color: var(--tree-select-item-disabled-color, #c8c9cc) +} + +.van-tree-select__selected { + position: absolute; + right: var(--padding-md, 16px); + top: 50%; + transform: translateY(-50%) +} \ No newline at end of file diff --git a/pages/index/Salesranking/Salesranking.js b/pages/index/Salesranking/Salesranking.js index 14b64a5..b8b9341 100644 --- a/pages/index/Salesranking/Salesranking.js +++ b/pages/index/Salesranking/Salesranking.js @@ -10,13 +10,14 @@ let iPageIndex = 1 // 当前第几页,0代表第一页 let iPageSize = 20 //每页显示多少数据 Page({ data: { + nengtitle1: '全部级别', + nengtitle2: '全部价格', + nengtitle3: '全部能源', active: 0, end: moment().format("YYYY-MM"), showChart: true, // select: false, - grade_value1: "", grade_value2: "", - grade_value3: "", grade_value4: 0, grades4: [{ text: '列表展示', @@ -48,15 +49,14 @@ Page({ sEnergyType: '', imageUrl: getApp().globalData.imageUrl, mockData: [], - show1: false, mainActiveIndex: 0, - mainActiveIndex2:0, + mainActiveIndex2: 0, activeId: '', + activeId2: '', // ec: { lazyLoad: true // 设置图表懒加载 }, - showvalue:false, }, // 标签切换点击事件 onChange(val) { @@ -173,8 +173,6 @@ Page({ }, //页面上拉触底事件的处理函数 onReachBottom: function () { - // console.log("上拉触底事件") - // console.log(iPageIndex) let that = this if (!that.data.loadMore) { that.setData({ @@ -207,7 +205,7 @@ Page({ } obj.children.push(ol) }) - } + } arr.push(obj) }) this.setData({ @@ -250,7 +248,7 @@ Page({ } obj.children.push(ol) }) - } + } arr.push(obj) }) this.setData({ @@ -266,33 +264,14 @@ Page({ this.data.builds = e.detail.val } }, - // 按级别 - mySelect1(e) { - iPageIndex = 1 - iPageSize = 20 - this.setData({ - ranking: [], - sSpec: e.detail, - }) - this.getTrend() - }, // 按价格 - mySelect2(e) { - iPageIndex = 1 - iPageSize = 20 - this.setData({ - ranking: [], - sPriceType: e.detail, - }) - this.getTrend() - }, - // 按能源 - mySelect3(e) { + mySelect2({ detail }) { iPageIndex = 1 iPageSize = 20 this.setData({ ranking: [], - sEnergyType: e.detail, + sPriceType: this.data.grades2[detail].value, + nengtitle2:this.data.grades2[detail].text, }) this.getTrend() }, @@ -303,7 +282,7 @@ Page({ this.setData({ ranking: [], a: e.detail != 0, - showvalue:false + showvalue: false }) this.getTrend() }, @@ -315,9 +294,9 @@ Page({ let dj = this.data.num % 2 == 0 this.setData({ ranking: [], - grade_value1: "", - grade_value2: "", - grade_value3: "", + nengtitle1: '全部级别', + nengtitle2: '全部价格', + nengtitle3: '全部能源', sSpec: '', sPriceType: '', sEnergyType: '', @@ -404,52 +383,76 @@ Page({ }) }, // 树形结构父级点击 - onClickNav({ detail = {} }) { + // 按能源 + onClickNav({ + detail = {} + }) { this.setData({ - mainActiveIndex: detail.index || 0, + mainActiveIndex: detail.index || 0, }); - let {grades3} = this.data; - if(!grades3[detail.index].children) { + let { + grades3 + } = this.data; + if (!grades3[detail.index].children) { this.setData({ ranking: [], - sEnergyType:grades3[detail.index].id || "", + sEnergyType: grades3[detail.index].id || "", + nengtitle3: grades3[detail.index].text, }) this.getTrend() - - } + } }, - onClickNav2({ detail = {} }) { + // 按级别 + onClickNav2({ + detail = {} + }) { this.setData({ - mainActiveIndex2: detail.index || 0, + mainActiveIndex2: detail.index || 0, }); - let {grades1} = this.data; - console.log('xds',grades1[detail.index]) - if(!grades1[detail.index].children) { + let { + grades1 + } = this.data; + if (!grades1[detail.index].children) { this.setData({ ranking: [], sSpec: grades1[detail.index].id || "", + nengtitle1: grades1[detail.index].text, }) this.getTrend() } }, + // 树形结构子级点击 + // 按能源 + onClickItem({ + detail = {} + }) { + const activeId = this.data.activeId === detail.id ? null : detail.id; + let { + mainActiveIndex + } = this.data; + this.setData({ + ranking: [], + activeId, + nengtitle3: detail.text, + sEnergyType: mainActiveIndex + "," + activeId, - // 树形结构子级点击 - onClickItem({ detail = {} }) { - const activeId = this.data.activeId === detail.id ? null : detail.id; - let {mainActiveIndex} = this.data; - this.setData({ - ranking: [], - sEnergyType: mainActiveIndex+","+activeId, - }); - this.getTrend() - }, - onClickItem2({ detail = {} }) { - const activeId = this.data.activeId === detail.id ? null : detail.id; - let {mainActiveIndex2} = this.data; - this.setData({ - ranking: [], - sSpec: mainActiveIndex2+","+activeId, - }); - this.getTrend() - }, + }); + this.getTrend() + }, + // 按级别 + onClickItem2({ + detail = {} + }) { + const activeId2 = this.data.activeId2 === detail.id ? null : detail.id; + let { + mainActiveIndex2 + } = this.data; + this.setData({ + ranking: [], + activeId2, + nengtitle1: detail.text, + sSpec: mainActiveIndex2 + "," + activeId2, + }); + this.getTrend() + }, }) \ No newline at end of file diff --git a/pages/index/Salesranking/Salesranking.wxml b/pages/index/Salesranking/Salesranking.wxml index b06803c..6e23b14 100644 --- a/pages/index/Salesranking/Salesranking.wxml +++ b/pages/index/Salesranking/Salesranking.wxml @@ -24,12 +24,12 @@ - - + + - - - + + + diff --git a/pages/index/Salesranking/Salesranking.wxss b/pages/index/Salesranking/Salesranking.wxss index e8ed6e9..596b4c2 100644 --- a/pages/index/Salesranking/Salesranking.wxss +++ b/pages/index/Salesranking/Salesranking.wxss @@ -2,13 +2,15 @@ .dropdown-menu { box-shadow: 0 0 0 !important; } + .detail-page { - position: relative; + position: relative; } -.van-dropdown-menu__item{ - border: 1px solid #F9F9F9; - position: relative; - margin:10rpx; + +.van-dropdown-menu__item { + border: 1px solid #F9F9F9; + position: relative; + margin: 10rpx; } .menu-tabs .van-tabs__nav { @@ -283,13 +285,14 @@ } /* 下拉内容 */ -van-dropdown-item van-dropdown-item--down{ - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; +van-dropdown-item van-dropdown-item--down { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; } + .select_box { background-color: #fff; /* padding: 0 20rpx; */ @@ -341,8 +344,17 @@ van-dropdown-item van-dropdown-item--down{ text-align: center; border-radius: 50rpx; } -.jb-item{ + +.jb-item { font-size: 20rpx; height: 30px; line-height: 30px; +} + +.show { + display: none; +} + +.is_show { + display: block; } \ No newline at end of file diff --git a/pages/insight/pages/brandInsight/brandDataList/index.js b/pages/insight/pages/brandInsight/brandDataList/index.js index a6bce78..1ee8936 100644 --- a/pages/insight/pages/brandInsight/brandDataList/index.js +++ b/pages/insight/pages/brandInsight/brandDataList/index.js @@ -228,6 +228,7 @@ Page({ sStartTime: result.detail.sStartTime, sEndTime: result.detail.sEndTime, }); + console.log('xs', result.detail.sTimeType) this.getData(); }, toEventDetail(e) { @@ -333,7 +334,7 @@ Page({ sCrisis: wjList.join(',') || '', sType: 'BrandData', sField: JSON.stringify(sField), //导出字段 - sFileName: "事件数据" + date, //文件名称 + sFileName: this.data.fileName, //文件名称 sCheckedIds: this.data.result.join(',') || '', //数据id iNum: this.data.result.length == 0 ? this.data.total : this.data.result.length, //导出条数 iTimeType: this.data.iTimeType, //0发布时间 1入库时间 diff --git a/pages/insight/pages/eventInsight/evDatalist/index.js b/pages/insight/pages/eventInsight/evDatalist/index.js index d04274e..b8a392c 100644 --- a/pages/insight/pages/eventInsight/evDatalist/index.js +++ b/pages/insight/pages/eventInsight/evDatalist/index.js @@ -332,7 +332,7 @@ Component({ sCrisis: wjList.join(',') || '', sType: 'BrandDataHot', sField: JSON.stringify(sField), //导出字段 - sFileName: "事件数据" + date, //文件名称 + sFileName: this.data.fileName, //文件名称 sCheckedIds: this.data.result.join(',') || '', //数据id iNum: this.data.result.length == 0 ? this.data.total : this.data.result.length, //导出条数 iTimeType: this.data.iTimeType, //0发布时间 1入库时间 diff --git a/pages/insight/pages/modalInsight/modalDataList/index.js b/pages/insight/pages/modalInsight/modalDataList/index.js index 33dda96..e57bd85 100644 --- a/pages/insight/pages/modalInsight/modalDataList/index.js +++ b/pages/insight/pages/modalInsight/modalDataList/index.js @@ -333,7 +333,7 @@ Page({ sCrisis: wjList.join(',') || '', sType: 'BrandData', sField: JSON.stringify(sField), //导出字段 - sFileName: "事件数据" + date, //文件名称 + sFileName: this.data.fileName, //文件名称 sCheckedIds: this.data.result.join(',') || '', //数据id iNum: this.data.result.length == 0 ? this.data.total : this.data.result.length, //导出条数 iTimeType: this.data.iTimeType, //0发布时间 1入库时间 diff --git a/pages/insight/pages/themeList/index.js b/pages/insight/pages/themeList/index.js index 511723e..399975c 100644 --- a/pages/insight/pages/themeList/index.js +++ b/pages/insight/pages/themeList/index.js @@ -427,7 +427,7 @@ Page({ sType: 'ZhuTiFenXiBl', sGuid: this.data.Guid, sField: JSON.stringify(sField), //导出字段 - sFileName: "事件数据" + date, //文件名称 + sFileName:this.data.fileName, //文件名称 sCheckedIds: this.data.result.join(',') || '', //数据id iNum: this.data.result.length == 0 ? this.data.total : this.data.result.length, //导出条数 iTimeType: this.data.iTimeType, //0发布时间 1入库时间 From 156484e129322de7a2db0e2b4dafa53f858f1fba Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Mon, 21 Nov 2022 12:02:20 +0800 Subject: [PATCH 3/5] cxw-010203 --- pages/mine/index.js | 42 ++++++++++++++++++++++++++--- pages/mine/index.wxml | 10 ++++--- pages/mine/index.wxss | 4 +-- pages/mine/pages/bindUser/index.js | 43 +++++++++++++++++++----------- 4 files changed, 75 insertions(+), 24 deletions(-) diff --git a/pages/mine/index.js b/pages/mine/index.js index b1b7b8e..0b6508a 100644 --- a/pages/mine/index.js +++ b/pages/mine/index.js @@ -1,5 +1,5 @@ // index.js - +const app = getApp() Page({ data: { imageUrl: getApp().globalData.imageUrl, @@ -7,7 +7,10 @@ Page({ statusBarHeight: 0, nickName: "未登录", avatarUrl: "", - btnShow: false + btnShow: false, + userName: '', + headImg: '', + fileList: [] }, onLoad: function () { wx.getSystemInfo({ @@ -23,19 +26,52 @@ Page({ this.getTabBar().init(); this.getUser(); }, + // 上传头像的验证 + beforeRead(event) { + const { file, callback } = event.detail; + callback(file.type === 'image'); + }, + // 上传图片 + afterRead(event) { + const { file } = event.detail; + let url = file.url; + let base64 = wx.getFileSystemManager().readFileSync(url, "base64"); + let unionID = wx.getStorageSync('unionID'); + if(!unionID) { + return false; + } + let obj = { + action: 'updImg', + unionID: unionID, + base64: base64, + token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' + } + app.globalData.request(obj).then(res => { + let userInfo = wx.getStorageSync("userInfo"); + userInfo.headImg = res; + wx.setStorageSync('userInfo', userInfo); + this.setData({ + headImg: res + }) + }) + }, getUser() { if(wx.getStorageSync("userInfo")) { let userInfo = wx.getStorageSync("userInfo"); this.setData({ nickName: userInfo.nickName, avatarUrl: userInfo.avatarUrl, + userName: userInfo.UserName, + headImg: userInfo.headImg, btnShow: true }) } else { this.setData({ nickName: '', avatarUrl: '', - btnShow: false + btnShow: false, + headImg: '', + userName: '' }) } }, diff --git a/pages/mine/index.wxml b/pages/mine/index.wxml index 52aece3..ae0cd7e 100644 --- a/pages/mine/index.wxml +++ b/pages/mine/index.wxml @@ -1,12 +1,14 @@ - - {{nickName}} + + {{userName}} 欢迎您使⽤硕为思平台 - - + + + + diff --git a/pages/mine/index.wxss b/pages/mine/index.wxss index e4972f5..13ef8fd 100644 --- a/pages/mine/index.wxss +++ b/pages/mine/index.wxss @@ -7,9 +7,9 @@ height: 330px; } .mine_title{ - width: 100%; + width: calc(100% -64rpx); display: flex; - padding-top: 208rpx; + padding: 208rpx 32rpx 0rpx 32rpx; justify-content: space-between; } diff --git a/pages/mine/pages/bindUser/index.js b/pages/mine/pages/bindUser/index.js index 6e83dc8..dc7e6c7 100644 --- a/pages/mine/pages/bindUser/index.js +++ b/pages/mine/pages/bindUser/index.js @@ -41,7 +41,7 @@ Page({ }, onShow() { let userInfo = wx.getStorageSync('userInfo'); - if(userInfo) { + if (userInfo) { this.setData({ userName: userInfo.UserName || userInfo.userName }) @@ -49,13 +49,22 @@ Page({ }, // 微信用户初始化 initData() { + let that = this; return new Promise((resolve, reject) => { - this.getUserCode().then(() => { - this.getOpenidByCode().then(() => { - resolve(true) - }).catch(err => { - console.log(err) - }) + wx.login({ + success(res) { + that.setData({ + code: res.code + }) + that.getOpenidByCode().then(() => { + resolve(true) + }).catch(err => { + console.log(err) + }) + }, + fail() { + reject(false) + } }) }) }, @@ -145,11 +154,13 @@ Page({ const userInfo = Object.assign({}, res, { nickName: this.data.nickName, avatarUrl: this.data.avatarUrl, - userName: this.data.userName + userName: this.data.userName, + headImg: res.headImg }) wx.setStorageSync('token', res.toKen); wx.setStorageSync('userInfo', userInfo); wx.setStorageSync('openid', this.data.openid); + wx.setStorageSync('unionID', this.data.unionID); wx.navigateBack({ delta: 1 }); @@ -158,11 +169,13 @@ Page({ let data = err.Data; const userInfo = Object.assign({}, data, { nickName: this.data.nickName, - avatarUrl: this.data.avatarUrl + avatarUrl: this.data.avatarUrl, + userName: this.data.userName, }) wx.setStorageSync('token', data.toKen); wx.setStorageSync('userInfo', userInfo); wx.setStorageSync('openid', this.data.openid); + wx.setStorageSync('unionID', this.data.unionID); wx.showModal({ title: '提示', content: '登录成功,但未关注公众号。', @@ -186,20 +199,20 @@ Page({ }) }, //注册 - register(){ + register() { wx.navigateTo({ - url: '/pages/mine/pages/register/register', + url: '/pages/mine/pages/register/register', }) }, handlerBack() { - if(this.data.isHome == 1) { + if (this.data.isHome == 1) { wx.switchTab({ - url: '/pages/index/index' + url: '/pages/index/index' }) - } else if(this.data.isHome == 3) { + } else if (this.data.isHome == 3) { wx.switchTab({ url: '/pages/mine/index' - }) + }) } else { wx.navigateBack({ delta: 1 From 2234cce02f8c50a7b181ce57329260ff15d47311 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Mon, 21 Nov 2022 16:05:39 +0800 Subject: [PATCH 4/5] cxw-010203 --- components/indexCom/rankingChild/index.js | 18 +++++++++++------- pages/index/Salesranking/Salesranking.js | 13 ++++++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/components/indexCom/rankingChild/index.js b/components/indexCom/rankingChild/index.js index b76f208..83bdd13 100644 --- a/components/indexCom/rankingChild/index.js +++ b/components/indexCom/rankingChild/index.js @@ -31,9 +31,6 @@ Component({ sType: 'Marketing' }).then(res => { wx.setStorageSync('newTime', res) - this.setData({ - newTime: wx.getStorageSync('newTime') - }) resolve(true) }).catch(() => { reject(false) @@ -95,9 +92,11 @@ Component({ }) }, Rankdetail() { + this.getTimeData().then(() => { wx.navigateTo({ url: "/pages/index/Salesranking/Salesranking" }) + }) }, //品牌排行 ranking() { @@ -106,8 +105,10 @@ Component({ // url: '/pages/mine/pages/bindUser/index' // }) // } else { - wx.navigateTo({ - url: "/pages/index/Salesranking/Brandranking/Brandranking" + this.getTimeData().then(() => { + wx.navigateTo({ + url: "/pages/index/Salesranking/Brandranking/Brandranking" + }) }) // } }, @@ -118,9 +119,12 @@ Component({ // url: '/pages/mine/pages/bindUser/index' // }) // } else { - wx.navigateTo({ - url: "/pages/index/Salesranking/Salesranking" + this.getTimeData().then(() => { + wx.navigateTo({ + url: "/pages/index/Salesranking/Salesranking" + }) }) + // } } diff --git a/pages/index/Salesranking/Salesranking.js b/pages/index/Salesranking/Salesranking.js index b8b9341..be20d12 100644 --- a/pages/index/Salesranking/Salesranking.js +++ b/pages/index/Salesranking/Salesranking.js @@ -40,7 +40,7 @@ Page({ //图表 // positiveOption:brokenLine(dName,dValue,dColor,data), imageUrl: getApp().globalData.imageUrl, - date: wx.getStorageSync('newTime'), + date: '', accountIndex: 0, ranking: [], accountIndex: 0, @@ -268,10 +268,14 @@ Page({ mySelect2({ detail }) { iPageIndex = 1 iPageSize = 20 + let n = 0; + if(detail) { + n = detail * 1; + } this.setData({ ranking: [], - sPriceType: this.data.grades2[detail].value, - nengtitle2:this.data.grades2[detail].text, + sPriceType: this.data.grades2[n].value, + nengtitle2:this.data.grades2[n].text, }) this.getTrend() }, @@ -372,6 +376,9 @@ Page({ */ onShow() { iPageIndex = 1; + this.setData({ + date: wx.getStorageSync('newTime') + }) // this.getTabBar().init(); this.getData() }, From f762891a07698faed958a339d321ceb4c6326b9b Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Mon, 21 Nov 2022 16:15:51 +0800 Subject: [PATCH 5/5] cxw-010203 --- pages/index/Salesranking/Salesranking.js | 4 ++++ pages/index/Salesranking/Salesranking.wxml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/index/Salesranking/Salesranking.js b/pages/index/Salesranking/Salesranking.js index be20d12..d1267e5 100644 --- a/pages/index/Salesranking/Salesranking.js +++ b/pages/index/Salesranking/Salesranking.js @@ -406,6 +406,7 @@ Page({ sEnergyType: grades3[detail.index].id || "", nengtitle3: grades3[detail.index].text, }) + this.selectComponent('#menuitem2').toggle(false); this.getTrend() } }, @@ -425,6 +426,7 @@ Page({ sSpec: grades1[detail.index].id || "", nengtitle1: grades1[detail.index].text, }) + this.selectComponent('#menuitem1').toggle(false); this.getTrend() } }, @@ -444,6 +446,7 @@ Page({ sEnergyType: mainActiveIndex + "," + activeId, }); + this.selectComponent('#menuitem2').toggle(false); this.getTrend() }, // 按级别 @@ -460,6 +463,7 @@ Page({ nengtitle1: detail.text, sSpec: mainActiveIndex2 + "," + activeId2, }); + this.selectComponent('#menuitem1').toggle(false); this.getTrend() }, }) \ No newline at end of file diff --git a/pages/index/Salesranking/Salesranking.wxml b/pages/index/Salesranking/Salesranking.wxml index 6e23b14..bc56079 100644 --- a/pages/index/Salesranking/Salesranking.wxml +++ b/pages/index/Salesranking/Salesranking.wxml @@ -24,11 +24,11 @@ - + - +