lrf 2 년 전
부모
커밋
a535776fea
48개의 변경된 파일865개의 추가작업 그리고 38개의 파일을 삭제
  1. 110 0
      commpents/drawer/index.js
  2. 4 0
      commpents/drawer/index.json
  3. 18 0
      commpents/drawer/index.wxml
  4. 39 0
      commpents/drawer/index.wxss
  5. 150 0
      commpents/f6darge/index.js
  6. 6 0
      commpents/f6darge/index.json
  7. 1 0
      commpents/f6darge/index.wxml
  8. 1 0
      commpents/f6darge/index.wxss
  9. 98 0
      miniprogram_npm/@antv/f6-wx/canvas/canvas.js
  10. 4 0
      miniprogram_npm/@antv/f6-wx/canvas/canvas.json
  11. 13 0
      miniprogram_npm/@antv/f6-wx/canvas/canvas.wxml
  12. 87 0
      miniprogram_npm/@antv/f6-wx/container/container.js
  13. 4 0
      miniprogram_npm/@antv/f6-wx/container/container.json
  14. 13 0
      miniprogram_npm/@antv/f6-wx/container/container.wxml
  15. 17 0
      miniprogram_npm/@antv/f6-wx/extends/graph/treeGraph.js
  16. 1 0
      miniprogram_npm/@antv/f6-wx/extends/graph/treeGraph.js.map
  17. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/circularLayout.js
  18. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/circularLayout.js.map
  19. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/comboForceLayout.js
  20. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/comboForceLayout.js.map
  21. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/concentricLayout.js
  22. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/concentricLayout.js.map
  23. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/dagreLayout.js
  24. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/dagreLayout.js.map
  25. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/forceAtlas2Layout.js
  26. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/forceAtlas2Layout.js.map
  27. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/forceLayout.js
  28. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/forceLayout.js.map
  29. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/fruchtermanLayout.js
  30. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/fruchtermanLayout.js.map
  31. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/gForceLayout.js
  32. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/gForceLayout.js.map
  33. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/gridLayout.js
  34. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/gridLayout.js.map
  35. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/mdsLayout.js
  36. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/mdsLayout.js.map
  37. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/radialLayout.js
  38. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/radialLayout.js.map
  39. 2 0
      miniprogram_npm/@antv/f6-wx/extends/layout/randomLayout.js
  40. 1 0
      miniprogram_npm/@antv/f6-wx/extends/layout/randomLayout.js.map
  41. 47 0
      miniprogram_npm/@antv/f6-wx/index.js
  42. 1 0
      miniprogram_npm/@antv/f6-wx/index.js.map
  43. 11 0
      package-lock.json
  44. 1 0
      package.json
  45. 177 33
      pagesMatch/matchAdmin/elimmatch/add.js
  46. 5 2
      pagesMatch/matchAdmin/elimmatch/add.json
  47. 20 2
      pagesMatch/matchAdmin/elimmatch/add.wxml
  48. 1 1
      project.config.json

+ 110 - 0
commpents/drawer/index.js

@@ -0,0 +1,110 @@
+// commpents/drawer/index.js
+/**
+ * show:控制显示的变量
+ * list:数据列表
+ * label:显示选项的内容,默认 label 属性
+ * key:选择后获取的值. 为空的话,返回当前选中的选项
+ * bind:select:选中后的参数
+ */
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        // 是否显示
+        show: {
+            type: Boolean,
+            observer: function (val) {
+                this.setData({ showModalStatus: val })
+            }
+        },
+        // 选项列表
+        list: { type: Array },
+        // 显示的属性
+        label: { type: String, value: 'label' },
+        // 获取的键名,不写就全返回
+        key: { type: String }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        showModalStatus: false
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        selectValue(e) {
+            const data = e?.target?.dataset?.value
+            const key = this.properties.key;
+            if (key) {
+                const value = data[key];
+                if (value) {
+                    this.triggerEvent('select', value)
+                    this.setData({ show: false, showModalStatus: false })
+                    return;
+                } else {
+                    console.log('对象中没有指定的属性')
+                }
+            }
+            this.triggerEvent('select', data)
+            this.setData({ show: false, showModalStatus: false })
+        },
+
+        powerDrawer: function (e) {
+            var currentStatu = e.currentTarget.dataset.statu;
+            this.util(currentStatu)
+        },
+        util: function (currentStatu) {
+            /* 动画部分 */
+            // 第1步:创建动画实例 
+            var animation = wx.createAnimation({
+                duration: 200,  //动画时长
+                timingFunction: "linear", //线性
+                delay: 0  //0则不延迟
+            });
+
+            // 第2步:这个动画实例赋给当前的动画实例
+            this.animation = animation;
+
+            // 第3步:执行第一组动画:Y轴偏移240px后(盒子高度是240px),停
+            animation.translateY(240).step();
+
+            // 第4步:导出动画对象赋给数据对象储存
+            this.setData({
+                animationData: animation.export()
+            })
+
+            // 第5步:设置定时器到指定时候后,执行第二组动画
+            setTimeout(function () {
+                // 执行第二组动画:Y轴不偏移,停
+                animation.translateY(0).step()
+                // 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
+                this.setData({
+                    animationData: animation
+                })
+
+                //关闭抽屉
+                if (currentStatu == "close") {
+                    this.setData(
+                        {
+                            showModalStatus: false,
+                            show: false
+                        }
+                    );
+                }
+            }.bind(this), 200)
+            // 显示抽屉
+            if (currentStatu == "open") {
+                this.setData(
+                    {
+                        showModalStatus: true
+                    }
+                );
+            }
+        }
+    }
+})

+ 4 - 0
commpents/drawer/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 18 - 0
commpents/drawer/index.wxml

@@ -0,0 +1,18 @@
+<!--commpents/drawer/index.wxml-->
+
+<view class="drawer_screen" bindtap="powerDrawer" data-statu="close" wx:if="{{showModalStatus}}"></view>
+<!--content-->
+<!--使用animation属性指定需要执行的动画-->
+<view animation="{{animationData}}" class="drawer_attr_box" wx:if="{{showModalStatus}}">
+    <!--drawer content-->
+    <view class="drawer_content">
+        <view class="drawer_title line">请选择</view>
+        <!--<view class="drawer_title line">菜单2</view>
+        <view class="drawer_title line">菜单3</view>
+        <view class="drawer_title line">菜单4</view>
+        <view class="drawer_title">菜单5</view> -->
+        <view class="drawer_title line" wx:for="{{list}}" wx:for-item="i" wx:key="id" bind:tap="selectValue" data-value="{{i}}">
+            {{i[label]}}
+        </view>
+    </view>
+</view>

+ 39 - 0
commpents/drawer/index.wxss

@@ -0,0 +1,39 @@
+/* commpents/drawer/index.wxss */
+
+/*mask*/
+.drawer_screen {
+  width: 100%;
+  height: 100%;
+  position: fixed;
+  top: 0;
+  left: 0;
+  z-index: 1000;
+  background: #000;
+  opacity: 0.2;
+  overflow: hidden;
+}
+/*content*/
+.drawer_attr_box {
+  width: 100%;
+  overflow: hidden;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  z-index: 1001;
+  background: #fff;
+  border-radius: 20px 20px 0 0;
+}
+.drawer_content {
+  text-align: center;
+  padding: 20rpx 40rpx;
+  height: 470rpx;
+  overflow-y: scroll;
+}
+.drawer_title {
+  padding: 20rpx;
+  font: 42rpx "microsoft yahei";
+  text-align: center;
+}
+.line {
+  border-bottom: 1px solid #f8f8f8;
+}

+ 150 - 0
commpents/f6darge/index.js

@@ -0,0 +1,150 @@
+// commpents/f6darge/index.js
+import F6 from '@antv/f6-wx';
+import dagre from '@antv/f6-wx/extends/layout/dagreLayout';
+F6.registerLayout('dagre', dagre);
+Component({
+    canvas: null,
+    ctx: null,
+    renderer: '', // mini、mini-native等,F6需要,标记环境
+    graph: null,
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        width: { type: Number },
+        height: { type: Number },
+        data: {
+            type: Object, observer: function (val) {
+                this.changeData()
+            }
+        },
+        nodeSetting: { type: Function }, // 节点设置函数
+        edgeSetting: { type: Function } // 节点边设置
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        canvasWidth: 375,
+        canvasHeight: 600,
+        pixelRatio: 1,
+    },
+
+    onLoad() {
+        const obj = {};
+        // if (this.properties.width) obj.canvasWidth = this.properties.width
+        // if (this.properties.height) obj.canvasHeight = this.properties.height;
+        // const { pixelRatio } = wx.getSystemInfoSync();
+        // if (pixelRatio) obj.pixelRatio = pixelRatio
+        // this.setData(obj)
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /**
+     * 初始化cnavas回调,缓存获得的context
+     * @param {*} ctx 绘图context
+     * @param {*} rect 宽高信息
+     * @param {*} canvas canvas对象,在render为mini时为null
+     * @param {*} renderer 使用canvas 1.0还是canvas 2.0,mini | mini-native
+     */
+        init(event) {
+            const { ctx, canvas, renderer } = event.detail;
+            this.isCanvasInit = true;
+            this.ctx = ctx;
+            this.renderer = renderer;
+            this.canvas = canvas;
+            this.updateChart();
+        },
+
+        /**
+         * canvas派发的事件,转派给graph实例
+         */
+        handleTouch(e) {
+            this.graph && this.graph.emitEvent(e.detail);
+        },
+
+        updateChart() {
+            let width, height;
+            const { canvasWidth, canvasHeight, pixelRatio } = this.data;
+            if (this.properties.width) width = this.properties.width
+            else width = canvasWidth;
+            if (this.properties.height) height = this.properties.height
+            else height = canvasHeight;
+            const chartData = this.properties.data;
+            // 创建F6实例
+            this.graph = new F6.Graph({
+                container: this.canvas,
+                context: this.ctx,
+                renderer: this.renderer,
+                width: width,
+                height: height,
+                pixelRatio,
+                fitView: true,
+                modes: {
+                    default: ['drag-canvas', 'zoom-canvas'],
+                },
+                layout: {
+                    type: 'dagre',
+                    rankdir: 'LR', // 可选,默认为图的中心
+                    nodesep: 10, // 可选
+                    // ranksepFunc: (node) => {
+                    //     console.log(node.mark);
+                    //     const mark = node.mark;
+                    //     if (mark !== 'l') return 40
+                    //     return 80
+                    // },
+                    ranksep: 40, // 可选
+                    controlPoints: true, // 可选
+                },
+                defaultNode: {
+                    anchorPoints: [
+                        [0.5, 1],
+                        [0.5, 0]
+                    ],
+                    type: "rect",
+                    labelCfg: {
+                        position: 'center',
+                        offset: 10,
+                        style: {
+                            fill: '#666',
+                        },
+                    },
+                },
+                defaultEdge: {
+                    type: "quadratic",
+                    endArrow: true,
+                    color: '#722ed1',
+                    size: 2,
+                },
+            });
+            // 节点选择事件
+            this.graph.on('node:tap', e => {
+                const node = e?.item?._cfg?.model;
+                this.triggerEvent('tapNode', node)
+            });
+            // 节点设置事件
+            this.graph.node(this.properties.nodeSetting)
+            // 边设置事件
+            this.graph.edge(this.properties.edgeSetting)
+            // 注册数据
+            this.graph.data(chartData);
+            this.graph.render();
+            this.graph.fitView();
+        },
+
+        changeData() {
+            if (!this.graph) return;
+            const data = this.properties?.data;
+            this.graph.data(data)
+            this.graph.render();
+            this.graph.fitView();
+        },
+    },
+    onUnload() {
+        this.graph && this.graph.destroy();
+    },
+})

+ 6 - 0
commpents/f6darge/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "f6-canvas": "@antv/f6-wx/canvas/canvas"
+    }
+}

+ 1 - 0
commpents/f6darge/index.wxml

@@ -0,0 +1 @@
+<f6-canvas width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" bind:onInit="init" bind:onTouchEvent="handleTouch" />

+ 1 - 0
commpents/f6darge/index.wxss

@@ -0,0 +1 @@
+/* commpents/f6darge/index.wxss */

+ 98 - 0
miniprogram_npm/@antv/f6-wx/canvas/canvas.js

@@ -0,0 +1,98 @@
+Component({
+  data: {
+    finalPixelRatio: 1,
+  },
+  properties: {
+    style: {
+      type: String,
+      value: '',
+    },
+    width: {
+      type: Number,
+      value: 100,
+    },
+    height: {
+      type: Number,
+      value: 100,
+    },
+    onInit: {
+      type: Function,
+      value: function value() {},
+    },
+    onTouchEvent: {
+      type: Function,
+      value: function value() {},
+    },
+    onError: {
+      type: Function,
+      value: function value() {},
+    },
+    pixelRatio: {
+      type: Number,
+      value: 1,
+    },
+  },
+  observers: {
+    pixelRatio: function (pixelRatio) {
+      this.setData({
+        finalPixelRatio: pixelRatio >= 1 ? Math.ceil(pixelRatio) : 1,
+      });
+    },
+  },
+  ready: function ready() {
+    const query = wx.createSelectorQuery().in(this);
+    query
+      .select('#f6-canvas')
+      .fields({
+        node: true,
+        size: true,
+      })
+      .exec((ret) => {
+        console.log('ret', ret);
+        var canvas = ret[0].node;
+        const finalPixelRatio = this.data.finalPixelRatio;
+        canvas.width = this.data.width * finalPixelRatio;
+        canvas.height = this.data.height * finalPixelRatio;
+        this.rect = {
+          width: this.data.width * finalPixelRatio,
+          height: this.data.height * finalPixelRatio,
+          left: canvas._left,
+          top: canvas._top,
+        };
+        console.log('rect', this.rect);
+        this.ctx = canvas.getContext('2d');
+
+        this.triggerEvent('onInit', {
+          ctx: this.ctx,
+          rect: this.rect,
+          canvas: canvas,
+          renderer: 'mini-native',
+        });
+      });
+  },
+  methods: {
+    error: function error(e) {
+      this.data.onError(e);
+    },
+    ontouch: function ontouch(e) {
+      var i = 0;
+
+      for (i = 0; i < e.touches.length; i++) {
+        modifyEvent(e.touches[i]);
+      }
+
+      for (i = 0; i < e.changedTouches.length; i++) {
+        modifyEvent(e.changedTouches[i]);
+      }
+
+      this.triggerEvent('onTouchEvent', e);
+    },
+  },
+});
+
+function modifyEvent(touchEvent) {
+  touchEvent.clientX = touchEvent.x;
+  touchEvent.clientY = touchEvent.y;
+  touchEvent.pageX = touchEvent.x;
+  touchEvent.pageY = touchEvent.y;
+}

+ 4 - 0
miniprogram_npm/@antv/f6-wx/canvas/canvas.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 13 - 0
miniprogram_npm/@antv/f6-wx/canvas/canvas.wxml

@@ -0,0 +1,13 @@
+<canvas
+  id="f6-canvas"
+  type="2d"
+  width="{{width * finalPixelRatio}}"
+  height="{{(height) * finalPixelRatio}}"
+  style="width: {{width}}px; height: {{height}}px; {{style}}"
+  disable-scroll="{{true}}"
+  bindtouchstart="ontouch"
+  bindtouchcancel="ontouch"
+  bindtouchmove="ontouch"
+  bindtouchend="ontouch"
+  binderror="error"
+></canvas>

+ 87 - 0
miniprogram_npm/@antv/f6-wx/container/container.js

@@ -0,0 +1,87 @@
+Component({
+  data: {},
+  properties: {
+    style: {
+      type: String,
+      value: '',
+    },
+    width: {
+      type: Number,
+      value: 100,
+    },
+    height: {
+      type: Number,
+      value: 100,
+    },
+    onInit: {
+      type: Function,
+      value: () => {},
+    },
+    onTouchEvent: {
+      type: Function,
+      value: () => {},
+    },
+    onError: {
+      type: Function,
+      value: () => {},
+    },
+    pixelRatio: {
+      type: Number,
+      value: 1,
+    },
+  },
+  observers: {
+    pixelRatio: function (pixelRatio) {
+      this.setData({
+        finalPixelRatio: pixelRatio >= 1 ? Math.ceil(pixelRatio) : 1,
+      });
+    },
+  },
+  ready() {
+    const query = wx.createSelectorQuery().in(this);
+    query
+      .select('#g6-canvas')
+      .fields({
+        node: true,
+        size: true,
+      })
+      .exec((ret) => {
+        console.log('ret', ret);
+        const { node: canvas } = ret[0];
+        const finalPixelRatio = this.data.finalPixelRatio;
+        canvas.width = this.data.width * finalPixelRatio;
+        canvas.height = this.data.height * finalPixelRatio;
+        this.rect = {
+          width: this.data.width * finalPixelRatio,
+          height: this.data.height * finalPixelRatio,
+          left: canvas._left,
+          top: canvas._top,
+        };
+        console.log('rect', this.rect);
+        this.ctx = canvas.getContext('2d');
+        this.data.onInit(this.ctx, this.rect, canvas, 'mini-native');
+      });
+  },
+  methods: {
+    error(e) {
+      this.data.onError(e);
+    },
+    ontouch(e) {
+      let i = 0;
+      for (i = 0; i < e.touches.length; i++) {
+        modifyEvent(e.touches[i]);
+      }
+      for (i = 0; i < e.changedTouches.length; i++) {
+        modifyEvent(e.changedTouches[i]);
+      }
+      this.data.onTouchEvent(e);
+    },
+  },
+});
+
+function modifyEvent(touchEvent) {
+  touchEvent.clientX = touchEvent.x;
+  touchEvent.clientY = touchEvent.y;
+  touchEvent.pageX = touchEvent.x;
+  touchEvent.pageY = touchEvent.y;
+}

+ 4 - 0
miniprogram_npm/@antv/f6-wx/container/container.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 13 - 0
miniprogram_npm/@antv/f6-wx/container/container.wxml

@@ -0,0 +1,13 @@
+<canvas
+  id="g6-canvas"
+  type="2d"
+  width="{{width * finalPixelRatio}}"
+  height="{{(height) * finalPixelRatio}}"
+  style="width: {{width}}px; height: {{height}}px; {{style}}"
+  disable-scroll="{{true}}"
+  bindtouchstart="ontouch"
+  bindtouchcancel="ontouch"
+  bindtouchmove="ontouch"
+  bindtouchend="ontouch"
+  binderror="error"
+></canvas>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 17 - 0
miniprogram_npm/@antv/f6-wx/extends/graph/treeGraph.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/graph/treeGraph.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/circularLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/circularLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/comboForceLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/comboForceLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/concentricLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/concentricLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/dagreLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/dagreLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/forceAtlas2Layout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/forceAtlas2Layout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/forceLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/forceLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/fruchtermanLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/fruchtermanLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/gForceLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/gForceLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/gridLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/gridLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/mdsLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/mdsLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/radialLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/radialLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/randomLayout.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/extends/layout/randomLayout.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 47 - 0
miniprogram_npm/@antv/f6-wx/index.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
miniprogram_npm/@antv/f6-wx/index.js.map


+ 11 - 0
package-lock.json

@@ -9,10 +9,16 @@
       "version": "1.0.0",
       "version": "1.0.0",
       "license": "ISC",
       "license": "ISC",
       "dependencies": {
       "dependencies": {
+        "@antv/f6-wx": "^0.0.6",
         "@vant/weapp": "^1.10.3",
         "@vant/weapp": "^1.10.3",
         "echarts": "^5.3.3"
         "echarts": "^5.3.3"
       }
       }
     },
     },
+    "node_modules/@antv/f6-wx": {
+      "version": "0.0.6",
+      "resolved": "https://registry.npmjs.org/@antv/f6-wx/-/f6-wx-0.0.6.tgz",
+      "integrity": "sha512-Hgcj41EeHxuc3iJPvwsLoc2+mcjwdUVCOs4XjvaP9BerspWKAuPeOjNLrHhYKtP8jNzo4RuT7Ng2YCGXVlTlyw=="
+    },
     "node_modules/@vant/weapp": {
     "node_modules/@vant/weapp": {
       "version": "1.10.3",
       "version": "1.10.3",
       "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.3.tgz",
       "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.3.tgz",
@@ -42,6 +48,11 @@
     }
     }
   },
   },
   "dependencies": {
   "dependencies": {
+    "@antv/f6-wx": {
+      "version": "0.0.6",
+      "resolved": "https://registry.npmjs.org/@antv/f6-wx/-/f6-wx-0.0.6.tgz",
+      "integrity": "sha512-Hgcj41EeHxuc3iJPvwsLoc2+mcjwdUVCOs4XjvaP9BerspWKAuPeOjNLrHhYKtP8jNzo4RuT7Ng2YCGXVlTlyw=="
+    },
     "@vant/weapp": {
     "@vant/weapp": {
       "version": "1.10.3",
       "version": "1.10.3",
       "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.3.tgz",
       "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.3.tgz",

+ 1 - 0
package.json

@@ -9,6 +9,7 @@
   "author": "",
   "author": "",
   "license": "ISC",
   "license": "ISC",
   "dependencies": {
   "dependencies": {
+    "@antv/f6-wx": "^0.0.6",
     "@vant/weapp": "^1.10.3",
     "@vant/weapp": "^1.10.3",
     "echarts": "^5.3.3"
     "echarts": "^5.3.3"
   }
   }

+ 177 - 33
pagesMatch/matchAdmin/elimmatch/add.js

@@ -1,7 +1,34 @@
 const app = getApp();
 const app = getApp();
+const nodeSetting = function (node) {
+    node.label = node.name
+    return node;
+};
+const edgeSetting = function (edge) {
+    return edge;
+}
 Page({
 Page({
     data: {
     data: {
         frameStyle: { useTop: true, name: '添加赛程', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '添加赛程', leftArrow: true, useBar: false },
+        loadChart: false,
+        winData: {},
+        loseData: {},
+        schList: [],
+        playerList: [],
+        canvasWidth: 375,
+        canvasHeight: 300,
+        pixelRatio: 2,
+        edgeSetting,
+        nodeSetting,
+        tabs: {
+            active: 'a',
+            menu: [
+                { title: '比赛流程', active: 'a' },
+                { title: '败者组流程', active: 'b' },
+                { title: '赛事赛程', active: 'c' },
+            ],
+        },
+        show: false,
+        selectNode: {}
     },
     },
     // 返回
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
     back: function () { wx.navigateBack({ delta: 1 }) },
@@ -9,58 +36,175 @@ Page({
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
-    onLoad: function (options) { },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () { },
+    onLoad: function (options) {
+        this.search();
+    },
     /**
     /**
-     * 生命周期函数--监听页面显示
+     * 查询函数
      */
      */
-    onShow: function () {
-        const that = this;
-        // 监听用户是否登录
-        that.watchLogin();
-    },
-    // 监听用户是否登录
-    watchLogin: async function () {
-        const that = this;
-        wx.getStorage({
-            key: 'raceuser',
-            success: async res => { },
-            fail: async res => {
-                wx.redirectTo({ url: '/pages/index/index' })
+    async search() {
+        const match_id = '630ec4700a92b0a015ccfd14';
+        const group_id = "6318277947be96470e849b6a";
+        const project_id = '631827f047be96470e849bc1'
+        wx.request({
+            url: `http://192.168.1.197:15001/newCourt/race/v2/api/eliminate/graphData?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}`,
+            success: (res) => {
+                let data = res?.data?.data
+                const { winData, loseData } = this.groupData(data);
+                const schList = this.schData(data)
+                this.setData({ winData, loseData, schList })
+            }
+        })
+        wx.request({
+            url: `http://192.168.1.197:15001/newCourt/race/v2/api/eliminate/playerList?match_id=${match_id}&group_id=${group_id}&project_id=${project_id}`,
+            success: (res) => {
+                const playerList = res?.data?.data
+                this.setData({ playerList })
             }
             }
         })
         })
     },
     },
     /**
     /**
-     * 页面上拉触底事件的处理函数
+     * 选中选手的处理
+     * @param {Object} selected 选中的选手数据
      */
      */
+    selectPlayer({ detail: selected }) {
+        let node = this.data.selectNode;
+        const { _id: player_id, name } = selected
+        node = { ...node, player_id, name }
+        let targetData;
+        let type;
+        if (node.mark && !node.mark.includes('w')) {
+            // 需要进入胜者节点中进行查找
+            targetData = this.data.loseData.nodes
+            type = 'lose'
+        } else {
+            targetData = this.data.winData.nodes
+            type = 'win'
+        }
+        const i = targetData.findIndex(f => f.id === node.id)
+        if (i < 0) {
+            console.warn('未在合理的范围内找到更改的节点')
+            return false
+        }
+        targetData[i] = node;
+        this.setData({ [`${type}Data.nodes`]: targetData })
+        // 修改赛程部分
+        // 找到该节点的数据
+        const schList = this.data.schList;
+        const sch = schList.find(f => f.player_one_node === node.id || f.player_two_node === node.id)
+        if (!sch) {
+            console.warn('没找到该节点所在的赛程')
+            return
+        }
+        if (sch.player_one_node === node.id) {
+            sch.player_one = node.player_id;
+            sch.player_one_name = node.name;
+        } else {
+            sch.player_two = node.player_id;
+            sch.player_two_name = node.name;
+        }
+        const schIndex = schList.findIndex(f => f.player_one_node === node.id || f.player_two_node === node.id)
+        schList.splice(schIndex, 1, sch)
+        this.setData({ schList })
+    },
+
     /**
     /**
-     * 生命周期函数--监听页面隐藏
+     * 选择节点并存储在selectNode变量中
+     * @param {Object} node 节点数据
      */
      */
-    onHide: function () {
-
+    nodeSelect({ detail: node }) {
+        this.setData({ show: true, selectNode: node })
     },
     },
 
 
     /**
     /**
-     * 生命周期函数--监听页面卸载
+     * 给流程图数据分组
+     * @param {Array} data 流程图数据
      */
      */
-    onUnload: function () {
-
+    groupData(data) {
+        const { nodes, edges } = data;
+        // 按胜/败进行分组,显示在2个选项卡中
+        const winNodes = nodes.filter(f => !f.mark || f.mark.includes('w'))
+        const winEdges = this.getNodesEdges(winNodes, edges);
+        const loseNodes = nodes.filter(f => f.mark && !f.mark.includes('w'))
+        const loseEdges = this.getNodesEdges(loseNodes, edges);
+        return { winData: { nodes: winNodes, edges: winEdges }, loseData: { nodes: loseNodes, edges: loseEdges } }
     },
     },
-
     /**
     /**
-     * 页面相关事件处理函数--监听用户下拉动作
+     * 获取该图中的赛程列表
+     * @param {Object} data 流程图数据
      */
      */
-    onPullDownRefresh: function () {
-
+    schData(data) {
+        const { edges } = data;
+        let stop = false;
+        const schList = [];
+        let dupAll = JSON.parse(JSON.stringify(edges))
+        while (!stop) {
+            const dup = JSON.parse(JSON.stringify(dupAll))
+            // 取出第一个关系
+            const head = dup[0]
+            // 删除第一个关系
+            dup.shift();
+            // 查看是否有与第一个关系指向一个目标的地方
+            const r = dup.find(f => f.target === head.target)
+            if (r) {
+                // 有,则将这俩关系组为一个比赛,然后在dup中删除
+                const sch = { player_one_node: head.source, player_two_node: r.source }
+                schList.push(sch)
+                const ri = dup.find(f => f.target === head.target)
+                dup.splice(ri, 1)
+            }
+            dupAll = dup;
+            if (dupAll.length <= 0) stop = true
+        }
+        return schList;
     },
     },
 
 
     /**
     /**
-     * 用户点击右上角分享
+     * 找到这些节点的边关系
+     * @param {Array} list 节点数据
+     * @param {Array} edges 所有的辺数据
      */
      */
-    onShareAppMessage: function () {
+    getNodesEdges(list, edges) {
+        const fedges = [];
+        for (let i = 0; i < list.length; i += 2) {
+            const n1 = list[i];
+            const n2 = list[i + 1]
+            const n1id = n1.id;
+            const n2id = n2.id
+            if (!n1id || !n2id) continue;
+            const n1e = edges.find(f => f.source === n1id)
+            const n2e = edges.find(f => f.source === n2id)
+            if (!n1e || !n2e) continue;
+            const n1et = n1e.target;
+            const n2et = n2e.target;
+            if (n1et === n2et) fedges.push(n1e, n2e)
+        }
+        return fedges;
+    },
 
 
-    }
+    tabsChange: function (e) {
+        const that = this;
+        let { active } = e.detail;
+        that.setData({ 'tabs.active': active });
+    },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        this.setData({ loadChart: true })
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'raceuser',
+            success: async res => { },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
 })
 })

+ 5 - 2
pagesMatch/matchAdmin/elimmatch/add.json

@@ -1,6 +1,9 @@
 {
 {
     "component": true,
     "component": true,
     "usingComponents": {
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+        "mobile-main": "/commpents/mobile-frame/index",
+        "f6-darge": "/commpents/f6darge/index",
+        "s-tab": "/commpents/tabs/index",
+        "drawer": "/commpents/drawer/index"
     }
     }
-  }
+}

+ 20 - 2
pagesMatch/matchAdmin/elimmatch/add.wxml

@@ -1,7 +1,25 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
     <view slot="info" class="container main">
         <view class="one">
         <view class="one">
-            淘汰赛添加赛程页面
+            <view>
+                <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
+            </view>
+            <view>
+                <view wx:if="{{tabs.active=='a'}}">
+                    <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{winData}}" nodeSetting="{{nodeSetting}}" bind:tapNode="nodeSelect" edgeSetting="{{edgeSetting}}" />
+                </view>
+                <view wx:elif="{{tabs.active=='b'}}">
+                    <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{loseData}}" nodeSetting="{{nodeSetting}}" bind:tapNode="nodeSelect" edgeSetting="{{edgeSetting}}" />
+                </view>
+                <view wx:elif="{{tabs.active=='c'}}">
+                    <view wx:for="{{schList}}" wx:for-item="s">
+                        {{s.player_one_name || s.player_one_node}} - {{s.player_two_name || s.player_two_node}}
+                    </view>
+                </view>
+            </view>
         </view>
         </view>
     </view>
     </view>
-</mobile-main>
+</mobile-main>
+<view>
+    <drawer show="{{show}}" list="{{playerList}}" label="name" bind:select="selectPlayer"></drawer>
+</view>

+ 1 - 1
project.config.json

@@ -47,7 +47,7 @@
         "showES6CompileOption": false,
         "showES6CompileOption": false,
         "useCompilerPlugins": false,
         "useCompilerPlugins": false,
         "useStaticServer": true,
         "useStaticServer": true,
-        "ignoreUploadUnusedFiles": true
+        "ignoreUploadUnusedFiles": false
     },
     },
     "compileType": "miniprogram",
     "compileType": "miniprogram",
     "libVersion": "2.19.4",
     "libVersion": "2.19.4",