Procházet zdrojové kódy

接口数据解密

jwyu před 3 roky
rodič
revize
91a2912862

binární
components/.DS_Store


+ 364 - 0
components/chartList/chartList.vue

@@ -0,0 +1,364 @@
+<template>
+  <view class="chart-list-wrap">
+    <scroll-view 
+      id="scrollView" 
+      :scroll-y="true" 
+      :style="{'height': ListHeight+'px'}" 
+      :scroll-top="scrollViewTop"
+      @scrolltolower="scrolltolower"
+		  @scroll="drag.scroll" 
+      :scroll-with-animation="false"
+    >
+      <!-- 两个list列表 拖拽完直接切换list 避免闪烁 -->
+      <block v-for="(tmplist,listType) in dragList" :key="listType">
+        <view 
+          class="chart-list" 
+          :class="[listType=='A'?(listSwitch?'show':'hide'):(listSwitch?'hide':'show')]"
+        >
+          <block v-for="(item,index) in tmplist" :key="index">
+            <view class="rowBox chart-item" :id="'rowBox'+listType+index">
+            <view class="row" :id="'row'+listType+index">
+              <!-- 拖动按钮 -->
+              <image 
+                class="drag-icon" 
+                src="../../static/chart/drag-icon.png" 
+                mode="aspectFill"
+                :style="{'height': rowHeight+'px'}" 
+                :data-index="index" 
+                :data-type="listType" 
+								@touchstart="drag.touchstart" 
+                @touchmove="drag.touchmove" 
+                @touchend="drag.touchend"
+								<!-- #ifdef MP-WEIXIN -->
+								@longpress="drag.longpress"
+								<!-- #endif -->
+              />
+
+              <!-- 内容区域 -->
+              <view>标题{{item.title}}</view>
+              <image lazy-load class="img" src="" mode="aspectFill"/>
+            </view>
+            </view>
+          </block>
+        </view>
+      </block>
+    </scroll-view>
+
+    <!-- 拖动的盒子 -->
+    <view id="shadowRowBox" class="shadowRowBox">
+      <view id="shadowRow">
+        <image class="drag-icon" src="../../static/chart/drag-icon.png" mode="aspectFill"/>
+        <!-- 内容区域 -->
+        <view>标题{{shadowRow.title}}</view>
+        <image lazy-load class="img" src="" mode="aspectFill"/>
+      </view>
+    </view>
+
+
+    <view :data-isapph5="isAppH5" :data-islongtouch="isLongTouch" :data-longtouchtime="longTouchTime" :data-listheight="ListHeight"
+		 :data-rownum="list.length" id="dataView" style="display: none !important;">存放数据给wxs读取</view>
+  </view>
+</template>
+
+<script src="./drag.wxs" module="drag" lang="wxs"></script>
+<script>
+	/**  
+	 * 拖拽排序组件 HM-dragSort
+	 * @description 拖拽排序组件 HM-dragSort
+	 * @property {ObjectArray} list = [] 列表数据,自定义数据,会传递到name="rowContent"插槽  
+	 * @property {Boolean} isLongTouch = [true|false] 是否开启长按拖动  
+	 * @property {Number} longTouchTime = [] 选填,触发长按时长,单位:ms,默认350ms,不支持微信小程序 
+	 * @property {Number} listHeight = [] 选填,可拖动列表整体的高度,单位:px,默认等于窗口高度 
+	 * @property {Number} rowHeight = [] 必填,行高,单位:px,默认44px
+	 * @event {Function} change 行位置发生改变时触发事件 返回值:{index:'原始下标',moveTo:'被拖动到的下标',moveRow:'拖动行数据'}   
+	 * @event {Function} confirm 拖拽结束且行位置发生了改变触发事件 返回值:{index:'原始下标',moveTo:'被拖动到的下标',moveRow:'拖动行数据',list:'整个列表拖动后的数据'}  
+	 * @event {Function} onclick 点击行触发事件 返回值:{index:'被点击行下标',value:'被点击行数据'} 
+	 */
+	export default {
+		name: 'chart-list',
+		data() {
+			return {
+				// #ifdef APP-PLUS || H5
+				isAppH5: true,
+				// #endif
+				// #ifdef MP-WEIXIN
+				isAppH5: false,
+				// #endif
+
+				shadowRow: {}, // 存放被拖拽行数据
+				// 列表数据 分A和B两个列表 互相切换 避免闪烁
+				dragList: {
+					"A": [],
+					"B": []
+				},
+				ListHeight: this.listHeight,
+				listSwitch: true, // 控制切换列表
+
+				// 控制滑动
+				scrollViewTop: 0, // 滚动条位置
+				scrollCommand: 1, //传递renderjs数据
+				isHoldTouch: false, //是否正在拖拽
+				isScrolling: false, //是否正在滚动视图
+				scrollTimer: null, //定时器-控制滚动 微信小程序端使用 实现类似requestAnimationFrame效果
+			}
+		},
+		props: {
+			// 是否开启长按拖动
+			isLongTouch: {
+				value: Boolean,
+				default: true
+			},
+			longTouchTime: {
+				value: Number,
+				default: 300
+			},
+			// 列表数据
+			list: {
+				value: Array,
+				default: []
+			},
+			// 行高度 默认44行高
+			rowHeight: {
+				value: Number,
+				default: 44
+			},
+			// 组件高度 默认windowHeight满屏
+			listHeight: {
+				value: Number,
+				default: 0
+			}
+		},
+		watch: {
+			list: {
+				handler(val) {
+					this.initList(); //数据变化重新初始化list
+				},
+				immediate: true
+			}
+
+		},
+		mounted() {
+			if (this.listHeight == 0) {
+				this.ListHeight = uni.getSystemInfoSync().windowHeight;
+			}
+
+		},
+		methods: {
+      // 触底
+      scrolltolower(){
+        this.$emit('scrolltolower')
+      },
+
+			loadShadowRow(e) {
+				this.shadowRow = JSON.parse(JSON.stringify(this.dragList[this.listSwitch ? "A" : "B"][e.rowIndex]));
+			},
+			initList() {
+				if (this.dragList.A.length > 0) {
+					setTimeout(() => {
+						this.dragList.A = JSON.parse(JSON.stringify(this.list));
+						this.dragList.B = JSON.parse(JSON.stringify(this.list));
+					}, 50)
+				} else {
+					this.dragList.A = JSON.parse(JSON.stringify(this.list));
+					this.dragList.B = JSON.parse(JSON.stringify(this.list));
+				}
+
+			},
+			triggerClick(index, row) {
+				this.$emit('onclick', {
+					index: index,
+					value: JSON.parse(JSON.stringify(row))
+				});
+			},
+			//兼容微信小程序震动
+			vibrate() {
+				uni.vibrateShort()
+			},
+			// 控制自动滚动视图
+			pageScroll(e) {
+				// 滚动
+				if (e.command == "up" || e.command == "down") {
+					if (!this.isHoldTouch) {
+						this.isHoldTouch = true;
+						this.scrollViewTop = e.scrollTop;
+					}
+					if (this.isScrolling) {
+						return;
+					};
+					this.isScrolling = true;
+
+					// APP端和H5端 执行renderjs的滚动
+					// #ifdef APP-PLUS || H5
+					e.ListHeight = this.ListHeight;
+					e.rowHeight = this.rowHeight;
+					e.rowLength = this.list.length;
+					this.scrollCommand = e;
+					return;
+					// #endif
+
+					// 微信小程序执行以下逻辑
+					this.scrollTimer != null && clearInterval(this.scrollTimer);
+					let maxheight = this.rowHeight * this.list.length + 1 - this.ListHeight;
+					// 16.6ms毫秒执行一次,接近60HZ
+					this.scrollTimer = setInterval(() => {
+						if (e.command == "up") {
+							this.scrollViewTop -= 3
+						}
+						if (e.command == "down") {
+							this.scrollViewTop += 3;
+						}
+						if (this.scrollViewTop < 0) {
+							this.scrollViewTop = 0;
+							clearInterval(this.scrollTimer);
+						}
+						if (this.scrollViewTop > maxheight) {
+							this.scrollViewTop = maxheight;
+							clearInterval(this.scrollTimer);
+						}
+					}, 16.6)
+				}
+				// 停止滚动
+				if (e.command == "stop") {
+					// #ifdef APP-PLUS || H5
+					this.scrollCommand = e;
+					// #endif
+					this.isScrolling && this.stopScroll();
+				}
+			},
+			stopScroll() {
+				this.scrollTimer != null && clearInterval(this.scrollTimer);
+				this.isScrolling = false;
+				this.scrollingtop = 0;
+			},
+			change(e) {
+				e.moveRow = JSON.parse(JSON.stringify(this.dragList.A[e.index]))
+				this.$emit('change', e);
+			},
+			sort(e) {
+				this.stopScroll();
+				this.isHoldTouch = false;
+				let tmpList = JSON.parse(JSON.stringify(this.dragList.A));
+				tmpList.splice(e.offset, 0, tmpList.splice(e.index, 1)[0]);
+				let listType = "A"
+				if (this.listSwitch) {
+					this.dragList.B = [];
+					this.dragList.B = tmpList;
+
+				} else {
+					this.dragList.A = [];
+					this.dragList.A = tmpList;
+					listType = "B";
+				}
+				setTimeout(() => {
+					this.resetList(listType, tmpList)
+				}, 50)
+				this.$emit('confirm', {
+					list: tmpList,
+					index: e.index,
+					moveTo: e.offset,
+					moveRow: JSON.parse(JSON.stringify(this.dragList.A[e.index]))
+				});
+			},
+			resetList(listType, tmpList) {
+				this.listSwitch = !this.listSwitch;
+				this.$nextTick(() => {
+					this.dragList[listType] = [];
+					this.dragList[listType] = tmpList;
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.chart-list-wrap{
+  .hide{
+    display: none;
+  }
+  .show{
+    
+  }
+}
+.chart-list{
+  padding: 24rpx 25rpx;
+  width: 100%;
+  box-sizing: border-box;
+  display: flex;
+  justify-content: space-between;
+  flex-wrap: wrap;
+  .chart-item{
+    width: 48.5%;
+    &.show{
+      display: block;
+    }
+    &.hide{
+      display: none;
+    }
+    .row{
+      background: #FFFFFF;
+      box-shadow: 0px 0px 12rpx rgba(154, 141, 123, 0.16);
+      border-radius: 8rpx;
+      margin-bottom: 20rpx;
+      padding: 20rpx 20rpx 33rpx 20rpx;
+      position: relative;
+    }
+    .title{
+      font-size: 26rpx;
+    }
+    .img{
+      margin-top: 10rpx;
+      width: 100%;
+      height: 261rpx;
+      display: block;
+      margin-left: auto;
+      margin-right: auto;
+      background-color: #f6f6f6;
+    }
+
+    .drag-icon{
+      position: absolute;
+      top: 0;
+      right: 0;
+      width: 40rpx !important;
+      height: 40rpx !important;
+    }
+  }
+
+}
+
+.shadowRowBox{
+    &.show{
+      display: block;
+      opacity: 0.7;
+    }
+    width: 48vw;
+    background: #FFFFFF;
+    box-shadow: 0px 0px 12rpx rgba(154, 141, 123, 0.16);
+    border-radius: 8rpx;
+    margin-bottom: 20rpx;
+    padding: 20rpx 20rpx 33rpx 20rpx;
+    position: absolute;
+		z-index: 100;
+		display: none;
+    .title{
+      font-size: 26rpx;
+    }
+    .img{
+      margin-top: 10rpx;
+      width: 100%;
+      height: 261rpx;
+      display: block;
+      margin-left: auto;
+      margin-right: auto;
+      background-color: #f6f6f6;
+    }
+
+    .drag-icon{
+      position: absolute;
+      top: 0;
+      right: 0;
+      width: 40rpx;
+      height: 40rpx;
+    }
+}
+</style>

+ 273 - 0
components/chartList/drag.wxs

@@ -0,0 +1,273 @@
+var row_Height = 0;			//行高
+var scrollOffsetTop = 0;	//滚动条位置
+var isAppH5 = false;		//是否APPH5端
+var isLongTouch = false;	//是否开启长按
+var longTouchTime = 350;	//触发长安事件事件
+var isMove = false;			//是否可拖动
+var touchTimer=false;		//长按事件定时器
+function scroll(event,instance){
+	scrollOffsetTop = event.detail.scrollTop;
+}
+function touchstart(event, instance) {
+	isMove = false;
+	if(row_Height==0){
+		var rowStyle = event.instance.getComputedStyle(['height']);
+		row_Height = parseInt(rowStyle.height);//获取行高
+		console.log(rowStyle.height)
+	}
+	var rowData = event.instance.getDataset();
+	var rowtype = rowData.type == "A" ? "B" : "A";
+	//重置样式
+	resetRowStyle(state, instance, rowtype);
+	var state = instance.getState();
+	if (event.touches.length == 1) {
+		state.point = event.touches[0];
+		state.initscrollOffsetTop = scrollOffsetTop;
+		state.islongTap = true;
+		state.rowData = rowData;
+		//读取数据
+		var dataViewDOM = instance.selectComponent('#dataView');
+		var viewData = dataViewDOM.getDataset();
+		isAppH5 = viewData.isapph5&&JSON.parse(viewData.isapph5);
+		isLongTouch = viewData.islongtouch&&JSON.parse(viewData.islongtouch);
+		longTouchTime = parseInt(viewData.longtouchtime);
+		state.rowData.rownum = viewData.rownum;
+		state.rowData.listheight = viewData.listheight;
+	}
+	
+	// 计算shadowRow.style.top
+	var rowIndex = parseInt(rowData.index);
+	var shadowRowTop = rowIndex*row_Height;
+	shadowRowTop = shadowRowTop - scrollOffsetTop;
+	// 加载shadowRow数据
+	instance.callMethod("loadShadowRow", {rowIndex : rowIndex,shadowRowTop:shadowRowTop});
+	state.shadowRowTop = shadowRowTop;
+	var shadowBoxComponent = instance.selectComponent('#shadowRowBox');
+	shadowBoxComponent.setStyle({'top': shadowRowTop + 'px'})
+	//长按事件
+	if(isLongTouch){
+		if(typeof setTimeout !== "undefined"){
+			touchTimer && clearTimeout(touchTimer);
+			touchTimer = setTimeout(function(){
+				longpress(event,instance);
+			},longTouchTime)
+		}
+	}
+}
+function longpress(event,instance){
+	if(isLongTouch){
+		isMove = true;
+		moveRow(instance, 0)
+	}
+}
+function touchmove(event, instance) {
+	
+	var state = instance.getState();
+	var rowData = event.instance.getDataset(); 
+	var movePoint = event.touches[0];
+	var initPoint = state.point;
+	var moveY = movePoint.pageY - initPoint.pageY;	
+	//xy
+	var moveX=movePoint.pageX-initPoint.pageX
+
+
+
+	if(isLongTouch){
+		if(typeof setTimeout !== "undefined" && Math.abs(moveY)>10){
+			clearTimeout(touchTimer);
+		}
+		if (!isMove) {
+			return ;
+		}
+	}
+	moveRow(instance, moveY,moveX);
+	//阻止滚动页面
+	if(event.preventDefault){
+		event.preventDefault();
+	}
+	return false;
+}
+
+function touchend(event, instance) {
+	if(isLongTouch && typeof setTimeout !== "undefined"){
+		clearTimeout(touchTimer);
+	}
+	
+	if(lastCommand!="stop"){
+		lastCommand = "stop";
+		instance.callMethod("pageScroll", {'command':"stop"});
+	}
+	var state = instance.getState();
+	var rowtype = state.rowData.type;
+	
+	if (typeof state.offset !== "undefined" && state.rowData.index != state.offset && state.offset != null) {
+		instance.callMethod("sort", {
+			index: state.rowData.index,
+			offset: state.offset
+		});
+	} else {
+		resetRowStyle(state, instance, rowtype);
+		resetShadowRowStyle(instance)
+		feedbackGenerator(instance); //震动反馈
+		return false;
+	}
+	resetShadowRowStyle(instance)
+	typeof setTimeout !== "undefined" && setTimeout(function() {
+		resetRowStyle(state, instance, rowtype);
+	}, 500);
+	state.offset = null;
+	oldOffset = null;
+	feedbackGenerator(instance); //震动反馈
+	return false;
+}
+
+function resetRowStyle(state, instance, rowtype) {
+	var blockList = instance.selectAllComponents('.row'+rowtype);
+	for (var i = 0; i < blockList.length; i++) {
+		blockList[i].setStyle({
+			'height': row_Height+'px',
+			'transform': 'none',
+			'-webkit-transform': 'none'
+			});
+		blockList[i].removeClass('ani');
+		blockList[i].removeClass('hide');
+	}
+}
+function resetShadowRowStyle(instance) {
+	var shadowBoxComponent = instance.selectComponent('#shadowRowBox');
+	shadowBoxComponent.removeClass('show');
+	shadowBoxComponent.setStyle({});
+	shadowBoxComponent.removeClass('move');
+}
+var lastCommand = '';
+// move Row 
+function moveRow(instance, moveY,moveX) {
+	var state = instance.getState();
+	var initIndex = parseInt(state.rowData.index);
+	var rowtype = state.rowData.type;
+	//显示拖拽行Box
+	var shadowBoxComponent = instance.selectComponent('#shadowRowBox');
+	shadowBoxComponent.hasClass('show') || shadowBoxComponent.addClass('show');
+	//隐藏列表对应行
+	var rowDom = instance.selectComponent('#row' + rowtype + state.rowData.index);
+	rowDom.hasClass('hide') || rowDom.addClass('hide');
+	//拖动shadowRow
+	var shadowRowDom = instance.selectComponent('#shadowRow');
+	shadowRowDom.hasClass('move') || shadowRowDom.addClass('move');
+	shadowRowDom.removeClass('ani');
+	var style = {
+		'transform': 'translateY(' + moveY + 'px) translateX('+ moveX +'px) translateZ(10px)',
+		'-webkit-transform': 'translateY(' + moveY + 'px) translateX('+ moveX +'px) translateZ(10px)'
+	}
+	shadowRowDom.setStyle(style); 
+	
+	var listheight = state.rowData.listheight
+	var listClientY = state.shadowRowTop + moveY;
+	var tmpscrollListTop = scrollOffsetTop;
+	// 拖拽至边缘滚动视图 距离顶部距离1.5行高触发上滚动 下滚动同理
+	var callMethodData = {
+		command:listClientY<row_Height*1.5?"up":listClientY>listheight-(row_Height*1.5)?"down":"stop",
+		scrollTop:tmpscrollListTop,
+	}
+	//把滚动指令发给逻辑层
+	if(lastCommand!=callMethodData.command){
+		lastCommand = callMethodData.command;
+		instance.callMethod("pageScroll", callMethodData);
+	}
+	
+	var moveOffset = moveY + scrollOffsetTop - state.initscrollOffsetTop;
+	var offset = calcOffset(initIndex, moveOffset);
+	if(offset<=2 || offset>=state.rowData.rownum-2){
+		callMethodData.command = 'stop';
+	}
+	//为保证体验,非APP和H5端,在滚动视图期间不进行位置交换
+	if((!isAppH5) && callMethodData.command!='stop'){
+		return;
+	}
+	oldOffset = oldOffset == null ? initIndex : oldOffset;
+	if (offset < 0 || offset >= state.rowData.rownum) {
+		return;
+	}
+	if (offset == oldOffset) {
+		return;
+	}
+	
+	oldOffset = offset;
+	state.offset = offset;
+	//触发change事件
+	instance.callMethod("change", {
+		index: state.rowData.index,
+		moveTo: state.offset
+	});
+	feedbackGenerator(instance); //震动反馈
+	//根据offset对行进行位置交换
+	var blockList = instance.selectAllComponents('.row' + rowtype);
+	for (var i = 0; i < blockList.length; i++) {
+		if (i == initIndex) {
+			continue;
+		}
+		var translateY = 0;
+		if ((i >= offset && i < initIndex) || (i <= offset && i > initIndex)) {
+			translateY = i < initIndex ? row_Height : -row_Height;
+		}
+		var style = {
+			'height': row_Height+'px',
+			'transform': 'translateY(' + translateY + 'px) translateZ(5px)',
+			'-webkit-transform': 'translateY(' + translateY + 'px) translateZ(5px)'
+		}
+		blockList[i].hasClass('ani') || blockList[i].addClass('ani');
+		blockList[i].setStyle(style);
+	}
+	
+}
+//计算偏移index
+var oldOffset = null;
+function calcOffset(initIndex, moveY) {
+	var offset = initIndex + parseInt(moveY / row_Height); //偏移 行高的倍数
+	var rest = moveY % row_Height;
+	if (rest > 0) {
+		offset = offset + (rest / row_Height >= 0.6 ? 1 : 0);
+		if (offset < oldOffset) {
+			offset = rest / row_Height <= 0.4 ? offset : oldOffset;
+		}
+	} else {
+		offset = offset + (rest / row_Height <= -0.6 ? -1 : 0);
+		if (offset > oldOffset) {
+			offset = rest / row_Height >= -0.4 ? offset : oldOffset;
+		}
+	}
+	return offset;
+}
+
+//触感反馈
+//wxs 不支持条件编译,所以用此方法判断
+var isiOSAPP = typeof plus != "undefined" && plus.os.name == 'iOS';
+var UISelectionFeedbackGenerator;
+var UIImpactFeedbackGenerator;
+var impact
+
+if (isiOSAPP) {
+	UISelectionFeedbackGenerator = plus.ios.importClass("UISelectionFeedbackGenerator");
+	impact = new UISelectionFeedbackGenerator();
+	impact.init();
+}
+
+function feedbackGenerator(instance) {
+	if (isiOSAPP) {
+		impact.selectionChanged();
+	} else {
+		if (typeof plus != "undefined") {
+			plus.device.vibrate(12)
+		} else {
+			instance.callMethod("vibrate");
+		}
+	}
+}
+
+module.exports = {
+	scroll:scroll,
+	longpress:longpress,
+	touchstart: touchstart,
+	touchmove: touchmove,
+	touchend: touchend
+}

+ 13 - 0
package.json

@@ -0,0 +1,13 @@
+{
+    "id": "evils-drag-sorts",
+    "name": "drag-sorts 拖动排序组件",
+    "version": "1.0.2",
+    "description": " 拖动排序组件,",
+    "keywords": [
+        "拖动排序",
+        "拖动",
+        "drag",
+        "sorts",
+        "movable"
+    ]
+}

+ 2 - 1
pages.json

@@ -158,7 +158,8 @@
   		"van-tabs": "/wxcomponents/vant/tabs/index",
 			"van-count-down": "/wxcomponents/vant/count-down/index",
 			"van-empty": "/wxcomponents/vant/empty/index",
-			"van-checkbox": "/wxcomponents/vant/checkbox/index"
+			"van-checkbox": "/wxcomponents/vant/checkbox/index",
+			"van-transition": "/wxcomponents/vant/transition/index"
 		}
 	}
 }

+ 201 - 38
pages/chart/chart.vue

@@ -1,8 +1,8 @@
 <template>
     <page-meta :page-style="showFilter? 'overflow: hidden;' : ''" />
-    <view class="chart-page">
+    <view class="chart-page" @click="popData.show=false">
       <van-sticky style="background: #fff">
-        <view class="flex search-wrap">
+        <view class="flex search-wrap" id="search-wrap">
             <van-search
                 shape="round"
                 :value="searchVal"
@@ -20,17 +20,65 @@
             />
         </view>
       </van-sticky>
-      <view class="chart-list">
-        <view class="chart-item" v-for="item in 20" :key="item">
+      <!-- <view class="flex chart-list">
+        <view 
+          class="chart-item" 
+          v-for="(item,index) in list" 
+          :key="item"
+          @longpress="longtap(item)"
+          @touchstart="touchstart"
+          @touchmove.stop.prevent="touchmove"
+          @touchend="touchend(item)"
+        >
           <rich-text 
             class="van-multi-ellipsis--l2 title" 
-            :nodes="getTitle('标题'+item)" 
-            @longpress="chariItemLongPress(item,$event)"
+            :nodes="getTitle('标题'+item.title+index)" 
+            @longpress="chartItemLongPress(item,$event)"
           ></rich-text>
           <image lazy-load class="img" src="" mode="aspectFill"/>
         </view>
-      </view>
+
+        <view v-show="popData.show" class="pop-box" :style="{top:popData.y+'px',left:popData.x+'px'}">{{popData.title}}</view>
+
+        <view class="move-active-chart" v-show="moveData.show" :style="{top:moveData.y+'px',left:moveData.x+'px'}">
+          <rich-text 
+            class="van-multi-ellipsis--l2 title" 
+            :nodes="getTitle('标题'+moveData.chart.title)" 
+          ></rich-text>
+          <image lazy-load class="img" src="" mode="aspectFill"/>
+        </view>
+      </view> -->
+
+
+      <chartList
+        v-if="chartH"
+        :list="list" 
+        :isLongTouch="false" 
+        :isAutoScroll="true" 
+        :feedbackGeneratorState="true"  
+        :rowHeight="200" 
+        :listHeight="chartH"
+        @change="change" 
+        @confirm="confirm" 
+        @onclick="onclick"
+        @scrolltolower="scrolltolower"
+      >
+      </chartList>
+    
+      <!-- <DragSorts
+        @change="sortChange"
+        @click="click"
+        @del="moduleDel"
+        :viewWidth="375"
+        :height="200"
+        :row="2"
+        :disabled="false"
+        :list="list"
+      >
+      </DragSorts> -->
+    
     </view>
+    
     <!-- 筛选弹窗 -->
       <van-popup 
         :show="showFilter" 
@@ -57,22 +105,99 @@
 </template>
 
 <script>
+import chartList from '../../components/chartList/chartList.vue'
+// import DragSorts from "../../components/evils-drag-sorts/index.vue";
 export default {
+    components: {
+      chartList
+      // DragSorts
+    },
     data() {
         return {
-          showFilter:false,
+          showFilter:false,//显示筛选弹窗
+          popData:{
+            show:false,
+            x:0,
+            y:0,
+            title:''
+          },//长按标题弹窗
 
+          list:[],
+          page:1,
+          finished:false,
+          chartH:0,
         }
     },
-    onLoad() {},
+    onLoad() {
+      this.initListHeight()
+      this.getList()
+    },
+    
+    onReachBottom() {
+        // if (this.finished) return
+        // this.page++
+        // this.getList()
+    },
     methods: {
-      getTitle(e){
-        return e
+      // 计算出图列表高度
+      initListHeight(){
+        let searchH=0
+        const query = uni.createSelectorQuery().in(this);
+        query.select('#search-wrap').boundingClientRect(data => {
+          searchH=data.height
+        }).exec();
+
+        query.select('.chart-page').boundingClientRect(data => {
+          this.chartH=data.height-searchH
+        }).exec();
+
+      },
+
+      scrolltolower(){
+        if (this.finished) return
+        this.page++
+        this.getList()
       },
 
-      chariItemLongPress(item,e){
-        console.log(item);
+      change(e){
         console.log(e);
+      },
+
+      confirm(e){},
+      onclick(e){},
+
+      // 获取列表
+      getList(){
+        if(this.page<5){
+          let arr=[]
+          for (let index = (this.page-1)*20; index < this.page*20; index++) {
+            arr.push({title:'标题'+index,src:''})
+          }
+          this.list=[...this.list,...arr]
+        }else{
+          this.finished=true
+        }
+        
+      },
+
+      chartItemLongPress(item,e){
+        console.log(e);
+        this.popData.show=true
+        this.popData.title=item
+        this.popData.x=e.detail.x 
+        this.popData.y=e.detail.y
+        uni.setClipboardData({
+            data: item,
+            success: function () {
+                uni.showToast({
+                  title: '复制成功',
+                  icon: 'none',
+                })
+            },
+            fail:function(e){
+              console.log(e);
+            }
+        });
       }
     }
 }
@@ -83,6 +208,7 @@ export default {
     min-height: calc(100vh - calc(50px + constant(safe-area-inset-bottom)));
     min-height: calc(100vh - calc(50px + env(safe-area-inset-bottom)));
     background-color: #f9f9f9;
+    position: relative;
 }
 .search-wrap {
     background-color: #fff;
@@ -99,31 +225,68 @@ export default {
       padding: 0;
     }
 }
-.chart-list{
-  padding: 24rpx 25rpx;
-  column-count: 2;
-  width: 100%;
-  column-gap: 20rpx;
-  .chart-item{
-    background: #FFFFFF;
-    box-shadow: 0px 0px 12rpx rgba(154, 141, 123, 0.16);
-    border-radius: 8rpx;
-    margin-bottom: 20rpx;
-    padding: 20rpx 20rpx 33rpx 20rpx;
-    .title{
-      font-size: 26rpx;
-    }
-    .img{
-      margin-top: 10rpx;
-      width: 100%;
-      height: 261rpx;
-      display: block;
-      margin-left: auto;
-      margin-right: auto;
-      background-color: #f6f6f6;
-    }
-  }
-}
+
+// .chart-list{
+//   padding: 24rpx 25rpx;
+//   width: 100%;
+//   height: 67vh;
+//   box-sizing: border-box;
+//   justify-content: space-between;
+//   flex-wrap: wrap;
+//   .chart-item{
+//     width: 48.5%;
+//     background: #FFFFFF;
+//     box-shadow: 0px 0px 12rpx rgba(154, 141, 123, 0.16);
+//     border-radius: 8rpx;
+//     margin-bottom: 20rpx;
+//     padding: 20rpx 20rpx 33rpx 20rpx;
+//     .title{
+//       font-size: 26rpx;
+//     }
+//     .img{
+//       margin-top: 10rpx;
+//       width: 100%;
+//       height: 261rpx;
+//       display: block;
+//       margin-left: auto;
+//       margin-right: auto;
+//       background-color: #f6f6f6;
+//     }
+//   }
+
+//   .pop-box{
+//     background-color: #fff;
+//     width: 100rpx;
+//     font-size: 14px;
+//     padding: 10rpx;
+//     border-radius: 4rpx;
+//     position: absolute;
+//     box-shadow: 0px 0px 12rpx rgba(154, 141, 123, 0.16);
+//   }
+
+//   .move-active-chart{
+//     position: absolute;
+//     opacity: 0.5;
+//     width: 48.5%;
+//     background: #FFFFFF;
+//     box-shadow: 0px 0px 12rpx rgba(154, 141, 123, 0.16);
+//     border-radius: 8rpx;
+//     padding: 20rpx 20rpx 33rpx 20rpx;
+//     .title{
+//       font-size: 26rpx;
+//     }
+//     .img{
+//       margin-top: 10rpx;
+//       width: 100%;
+//       height: 261rpx;
+//       display: block;
+//       margin-left: auto;
+//       margin-right: auto;
+//       background-color: #f6f6f6;
+//     }
+//   }
+
+// }
 
 .filter-wrap{
   .top{

binární
static/chart/drag-icon.png


+ 1 - 1
utils/crypto.js

@@ -1,4 +1,4 @@
-const key = 'KHcV1Kgvrf2Nf55SA4SfE1tm';
+const key = 'zDeESsxsXuionhqSLZYHWcDJ';
 
 class CryptoJS {
 	// 3DES加密,CBC/PKCS5Padding

+ 1 - 2
utils/request.js

@@ -91,8 +91,7 @@ const http=(url,params,method)=>{
 				Authorization:store.state.user.token,
 			},
 			success(e) {
-				// let res=JSON.parse(CryptoJS.Des3Decrypt(e.data));//解密
-				let res=e.data
+				let res=JSON.parse(CryptoJS.Des3Decrypt(e.data));//解密
 				if(res.code!==200&&res.code!==403&&res.code!==4001&&res.code!==401){
 					showError(res)
 				}