Browse Source

feat:寄售 分享

DaMowang 3 years ago
parent
commit
c7763d4e69

+ 5 - 0
package-lock.json

@@ -5992,6 +5992,11 @@
         "whatwg-url": "^7.0.0"
       }
     },
+    "dayjs": {
+      "version": "1.11.6",
+      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.6.tgz",
+      "integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ=="
+    },
     "de-indent": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",

+ 1 - 0
package.json

@@ -63,6 +63,7 @@
     "@dcloudio/uni-ui": "^1.4.23",
     "@vue/shared": "^3.0.0",
     "core-js": "^3.6.5",
+    "dayjs": "^1.11.6",
     "flyio": "^0.6.2",
     "js-md5": "^0.7.3",
     "regenerator-runtime": "^0.12.1",

+ 558 - 0
src/components/cmd-progress/cmd-progress.vue

@@ -0,0 +1,558 @@
+<template>
+  <view class="cmd-progress cmd-progress-default" :class="setStatusClass">
+    <block v-if="type == 'circle' || type == 'dashboard'">
+      <view class="cmd-progress cmd-progress-default" :class="setStatusClass">
+        <view class="cmd-progress-inner" :style="setCircleStyle">
+          <!-- 绘制圈 start -->
+          <!-- #ifdef H5 -->
+          <svg viewBox="0 0 100 100" class="cmd-progress-circle">
+            <path :d="setCirclePath" stroke="#f3f3f3" :stroke-linecap="strokeShape" :stroke-width="strokeWidth"
+              fill-opacity="0" class="cmd-progress-circle-trail" :style="setCircleTrailStyle"></path>
+            <path :d="setCirclePath" :stroke-linecap="strokeShape" :stroke-width="strokeWidth" fill-opacity="0" class="cmd-progress-circle-path"
+              :style="setCirclePathStyle"></path>
+          </svg>
+          <!-- #endif -->
+          <!-- #ifndef H5 -->
+          <text :style="setCircle"></text>
+          <!-- #endif -->
+          <!-- 绘制圈 end -->
+          <!-- 状态文本 start -->
+          <block v-if="showInfo">
+            <text class="cmd-progress-text" :title="setFormat">
+              <block v-if="status != 'success' && status != 'exception' && setProgress < 100">{{setFormat}}</block>
+              <!-- #ifdef H5 -->
+              <svg v-if="status == 'exception'" viewBox="64 64 896 896" data-icon="close" width="1em" height="1em" fill="currentColor"
+                aria-hidden="true">
+                <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path>
+              </svg>
+              <svg v-if="status == 'success' || setProgress == 100" viewBox="64 64 896 896" data-icon="check" width="1em"
+                height="1em" fill="currentColor" aria-hidden="true" :style="{'color': strokeColor ? strokeColor : ''}">
+                <path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path>
+              </svg>
+              <!-- #endif -->
+              <!-- #ifndef H5 -->
+              <text v-if="status == 'exception' || status == 'success' || setProgress == 100" :style="setCircleIcon"></text>
+              <!-- #endif -->
+            </text>
+          </block>
+          <!-- 状态文本 end -->
+        </view>
+      </view>
+    </block>
+
+    <block v-if="type == 'line'">
+      <!-- 进度条 start -->
+      <view class="cmd-progress-outer">
+        <view class="cmd-progress-inner" :style="{'border-radius': strokeShape == 'square' ? 0 : '100px'}">
+          <view class="cmd-progress-bg" :style="setLineStyle"></view>
+          <view v-if="successPercent" class="cmd-progress-success-bg" :style="setLineSuccessStyle"></view>
+        </view>
+      </view>
+      <!-- 进度条 end -->
+      <!-- 进度条是否显示信息 start -->
+      <block v-if="showInfo">
+        <text class="cmd-progress-text" :title="setFormat">
+          <block v-if="status != 'success' && status != 'exception' && setProgress < 100">{{setFormat}}</block>
+          <!-- #ifdef H5 -->
+          <svg v-if="status == 'exception'" viewBox="64 64 896 896" data-icon="close-circle" width="1em" height="1em"
+            fill="currentColor" aria-hidden="true">
+            <path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path>
+          </svg>
+          <svg v-if="status == 'success' || setProgress == 100" viewBox="64 64 896 896" data-icon="check-circle" width="1em"
+            height="1em" fill="currentColor" aria-hidden="true" :style="{'color': strokeColor ? strokeColor : ''}">
+            <path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"></path>
+          </svg>
+          <!-- #endif -->
+          <!-- #ifndef H5 -->
+          <text v-if="status == 'exception' || status == 'success' || setProgress == 100" :style="setLineStatusIcon"></text>
+          <!-- #endif -->
+        </text>
+      </block>
+      <!-- 进度条是否显示信息 end -->
+    </block>
+  </view>
+</template>
+
+<script>
+  /**  
+   * 进度条组件  
+   * @description 显示一个操作完成的百分比时,为用户显示该操作的当前进度和状态。  
+   * @tutorial https://ext.dcloud.net.cn/plugin?id=259  
+   * @property {String} type 进度类型 - 线型:line、圆圈形:circle、仪表盘:dashboard,默认线型:line  
+   * @property {Number} percent 进度百分比值 - 显示范围0-100 ,可能数比较大就需要自己转成百分比的值  
+   * @property {Number} success-percent 进度已完成的百分几 - 仅支持进度线型:line  
+   * @property {String} status 进度状态 - 涌动:active(仅支持线型:line)、正常:normal、完成:success、失败:exception,默认正常:normal  
+   * @property {Boolean} show-info 进度状态信息 - 是否显示进度数值或状态图标,默认true  
+   * @property {Number} stroke-width 进度线条的宽度 - 建议在条线的宽度范围:1-50,与进度条显示宽度有关,默认8  
+   * @property {String} stroke-color 进度线条的颜色 - 渐变色仅支持线型:line  
+   * @property {String} stroke-shape 进度线条两端的形状 - 圆:round、方块直角:square,默认圆:round  
+   * @property {Number} width 进度画布宽度 - 仅支持圆圈形:circle、仪表盘:dashboard,默认80  
+   * @property {String} gap-degree 进度圆形缺口角度 - 可取值 0 ~ 360,仅支持圆圈形:circle、仪表盘:dashboard  
+   * @property {String} gap-position 进度圆形缺口位置 - 可取值'top', 'bottom', 'left', 'right',仅支持圆圈形:circle、仪表盘:dashboard  
+   * @example <cmd-progress :percent="30"></cmd-progress>  
+   */
+  export default {
+    name: 'cmd-progress',
+
+    props: {
+      /**
+       * 类型默认:line,可选 line circle dashboard
+       */
+      type: {
+        validator: val => {
+          return ['line', 'circle', 'dashboard'].includes(val);
+        },
+        default: 'line'
+      },
+      /**
+       * 百分比
+       */
+      percent: {
+        type: Number,
+        default: 0
+      },
+      /**
+       * 已完成的分段百分,仅支持类型line
+       */
+      successPercent: {
+        type: Number,
+        default: 0
+      },
+      /**
+       * 是否显示进度数值或状态图标
+       */
+      showInfo: {
+        type: Boolean,
+        default: true
+      },
+      /**
+       * 进度状态,可选:normal success exception (active仅支持类型line
+       */
+      status: {
+        validator: val => {
+          return ['normal', 'success', 'exception', 'active'].includes(val);
+        },
+        default: 'normal'
+      },
+      /**
+       * 条线的宽度1-50,与width有关
+       */
+      strokeWidth: {
+        type: Number,
+        default: 6
+      },
+      /**
+       * 条线的颜色,渐变色仅支持类型line
+       */
+      strokeColor: {
+        type: String,
+        default: ''
+      },
+      /**
+       * 条线两端的形状 可选:'round', 'square'
+       */
+      strokeShape: {
+        validator: val => {
+          return ['round', 'square'].includes(val);
+        },
+        default: 'round'
+      },
+      /**
+       * 圆形进度条画布宽度,支持类型circle dashboard
+       */
+      width: {
+        type: Number,
+        default: 80
+      },
+      /**
+       * 圆形进度条缺口角度,可取值 0 ~ 360,支持类型circle dashboard
+       */
+      gapDegree: {
+        type: Number,
+        default: 0
+      },
+      /**
+       * 圆形进度条缺口位置,可取值'top', 'bottom', 'left', 'right' ,支持类型circle dashboard
+       */
+      gapPosition: {
+        validator: val => {
+          return ['top', 'bottom', 'left', 'right'].includes(val);
+        },
+        default: 'top'
+      }
+    },
+
+    computed: {
+      /**
+       * 如果需要自定义格式就在这改
+       */
+      setFormat() {
+        return `${this.setProgress}%`;
+      },
+      /**
+       * 设置显示进度值,禁止小于0和超过100
+       */
+      setProgress() {
+        let percent = this.percent;
+        if (!this.percent || this.percent < 0) {
+          percent = 0;
+        } else if (this.percent >= 100) {
+          percent = 100;
+        }
+        return percent;
+      },
+      /**
+       * 进度圈svg大小
+       */
+      setCircleStyle() {
+        return `width: ${this.width}rpx;
+				height: ${this.width}rpx;
+				fontSize:22.63rpx`
+      },
+      /**
+       * 圈底色
+       */
+      setCircleTrailStyle() {
+        const radius = 50 - this.strokeWidth / 2;
+        const len = Math.PI * 2 * radius;
+        const gapDeg = this.gapDegree || (this.type === 'dashboard' && 75);
+        return `stroke-dasharray: ${len - (gapDeg||0)}px, ${len}px;
+				stroke-dashoffset: -${(gapDeg||0) / 2}px;
+				transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s;`
+      },
+      /**
+       * 圈进度
+       */
+      setCirclePathStyle() {
+        const radius = 50 - this.strokeWidth / 2;
+        const len = Math.PI * 2 * radius;
+        const gapDeg = this.gapDegree || (this.type === 'dashboard' && 75);
+        return `stroke: ${this.strokeColor};
+				stroke-dasharray: ${(this.setProgress / 100) * (len - (gapDeg||0))}px, ${len}px;
+				stroke-dashoffset: -${(gapDeg||0) / 2}px;
+				transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s, stroke-width 0.06s ease 0.3s;`
+      },
+      /**
+       * 绘制圈
+       */
+      setCirclePath() {
+        const radius = 50 - this.strokeWidth / 2;
+        let beginPositionX = 0;
+        let beginPositionY = -radius;
+        let endPositionX = 0;
+        let endPositionY = -2 * radius;
+        const gapPos = (this.type === 'dashboard' && 'bottom') || this.gapPosition || 'top';
+        switch (gapPos) {
+          case 'left':
+            beginPositionX = -radius;
+            beginPositionY = 0;
+            endPositionX = 2 * radius;
+            endPositionY = 0;
+            break;
+          case 'right':
+            beginPositionX = radius;
+            beginPositionY = 0;
+            endPositionX = -2 * radius;
+            endPositionY = 0;
+            break;
+          case 'bottom':
+            beginPositionY = radius;
+            endPositionY = 2 * radius;
+            break;
+          default:
+            break;
+        }
+        return `M 50,50 m ${beginPositionX},${beginPositionY} a ${radius},${radius} 0 1 1 ${endPositionX},${-endPositionY} a ${radius},${radius} 0 1 1 ${-endPositionX},${endPositionY}`;
+      },
+      // #ifndef H5
+      /**
+       * 非H5端,绘制进度圈svg转base URL
+       */
+      setCircle() {
+        const radius = 50 - this.strokeWidth / 2;
+        const len = Math.PI * 2 * radius;
+        const gapDeg = this.gapDegree || (this.type === 'dashboard' && 75);
+        let currentColor = '#108ee9'
+        // 异常进度
+        if (this.status == 'exception') {
+          currentColor = '#f5222d'
+        }
+        // 完成进度
+        if (this.status == 'success' || this.setProgress >= 100 || this.strokeColor) {
+          currentColor = this.strokeColor || '#52c41a'
+        }
+        let svgToBase =
+          `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' class='cmd-progress-circle'%3E%3Cpath d='${this.setCirclePath}' stroke='%23f3f3f3' stroke-linecap='${this.strokeShape}' stroke-width='${this.strokeWidth}' fill-opacity='0' class='cmd-progress-circle-trail' style='stroke-dasharray: ${len - (gapDeg||0)}px, ${len}px;stroke-dashoffset: -${(gapDeg||0) / 2}px;transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s;'%3E%3C/path%3E%3Cpath  d='${this.setCirclePath}' stroke-linecap='${this.strokeShape}' stroke-width='${this.strokeWidth}' fill-opacity='0' class='cmd-progress-circle-path' style='stroke: ${escape(currentColor)};stroke-dasharray: ${(this.setProgress / 100) * (len - (gapDeg||0))}px, ${len}px;stroke-dashoffset: -${(gapDeg||0) / 2}px;transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s, stroke-width 0.06s ease 0.3s;'%3E%3C/path%3E%3C/svg%3E`
+        return `background-image: url("${svgToBase}");
+				background-size: cover;
+				display: inline-block;
+				${this.setCircleStyle}`;
+      },
+      /**
+       * 设置进度圈状态图标
+       */
+      setCircleIcon() {
+        let currentColor = '#108ee9'
+        let svgToBase = ''
+        // 异常进度
+        if (this.status == 'exception') {
+          currentColor = '#f5222d'
+          svgToBase =
+            `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='close' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z'%3E%3C/path%3E %3C/svg%3E`;
+        }
+        // 完成进度
+        if (this.status == 'success' || this.setProgress >= 100) {
+          currentColor = this.strokeColor || '#52c41a'
+          svgToBase =
+            `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='check' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z'%3E%3C/path%3E %3C/svg%3E`;
+        }
+        return `background-image: url("${svgToBase}");
+				background-size: cover;
+				display: inline-block;
+				width: 1em;
+				height: 1em;`;
+      },
+      // #endif
+      /**
+       * 设置进度条样式
+       */
+      setLineStyle() {
+        return `width: ${this.setProgress}%;
+				height: ${this.strokeWidth}px;
+				background: ${this.strokeColor};
+				border-radius: ${this.strokeShape === 'square' ? 0 : '100px'};`;
+      },
+      /**
+       * 设置已完成分段进度
+       */
+      setLineSuccessStyle() {
+        let successPercent = this.successPercent;
+        if (!this.successPercent || this.successPercent < 0 || this.setProgress < this.successPercent) {
+          successPercent = 0;
+        } else if (this.successPercent >= 100) {
+          successPercent = 100;
+        }
+        return `width: ${successPercent}%;
+				height: ${this.strokeWidth}px;
+				border-radius: ${this.strokeShape === 'square' ? 0 : '100px'};`;
+      },
+      // #ifndef H5
+      /**
+       * 设置进度条状态图标
+       */
+      setLineStatusIcon() {
+        let currentColor = '#108ee9'
+        let svgToBase = ''
+        // 异常进度
+        if (this.status == 'exception') {
+          currentColor = '#f5222d'
+          svgToBase =
+            `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='close-circle' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z'%3E%3C/path%3E %3C/svg%3E`;
+        }
+        // 完成进度
+        if (this.status == 'success' || this.setProgress >= 100) {
+          currentColor = this.strokeColor || '#52c41a'
+          svgToBase =
+            `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='check-circle' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z'%3E%3C/path%3E %3C/svg%3E`;
+        }
+        return `background-image: url("${svgToBase}");
+				background-size: cover;
+				display: inline-block;
+				width: 1em;
+				height: 1em;`;
+      },
+      // #endif
+      /**
+       * 状态样式
+       */
+      setStatusClass() {
+        let statusClass = [];
+        // 异常进度
+        if (this.status == 'exception') {
+          statusClass.push('cmd-progress-status-exception')
+        }
+        // 完成进度
+        if (this.status == 'success' || this.setProgress >= 100) {
+          statusClass.push('cmd-progress-status-success')
+        }
+        // 活动进度条
+        if (this.status == 'active') {
+          statusClass.push('cmd-progress-status-active')
+        }
+        // 是否显示信息
+        if (this.showInfo) {
+          statusClass.push('cmd-progress-show-info')
+        }
+        // 进度条类型
+        if (this.type === 'line') {
+          statusClass.push('cmd-progress-line')
+        }
+        // 进度圈、仪表盘类型
+        if (this.type === 'circle' || this.type === 'dashboard') {
+          statusClass.push('cmd-progress-circle')
+        }
+        statusClass.push('cmd-progress-status-normal')
+        return statusClass;
+      }
+    }
+  }
+</script>
+
+<style>
+  .cmd-progress { 
+    box-sizing: border-box;
+    margin: 0;
+    padding: 0;
+    list-style: none;
+    display: inline-block;
+  }
+
+  .cmd-progress-line {
+    width: 100%;
+    font-size: 28upx;
+    position: relative;
+    display: flex;
+    flex-direction: row;
+    justify-content: center;
+    align-items: center;
+  }
+
+  .cmd-progress-outer {
+    display: inline-block;
+    width: 100%;
+    margin-right: 0;
+    padding-right: 0;
+  }
+
+  .cmd-progress-show-info .cmd-progress-outer {
+    flex: 1;
+  }
+
+  .cmd-progress-inner {
+    display: inline-block;
+    width: 100%;
+    background-color: #f5f5f5;
+    border-radius: 200upx;
+    vertical-align: middle;
+    position: relative;
+  }
+
+  .cmd-progress-circle-trail {
+    stroke: #f5f5f5;
+  }
+
+  .cmd-progress-circle-path {
+    stroke: #1890ff;
+    animation: appear 0.3s;
+  }
+
+  .cmd-progress-success-bg,
+  .cmd-progress-bg {
+    background-color: #1890ff;
+    transition: all 0.4s cubic-bezier(0.08, 0.82, 0.17, 1) 0s;
+    position: relative;
+  }
+
+  .cmd-progress-success-bg {
+    background-color: #52c41a;
+    position: absolute;
+    top: 0;
+    left: 0;
+  }
+
+  .cmd-progress-text {
+    word-break: normal;
+    width: 60upx;
+    text-align: left;
+    margin-left: 16upx;
+    vertical-align: middle;
+    display: inline-block;
+    white-space: nowrap;
+    color: rgba(0, 0, 0, 0.45);
+    line-height: 1;
+  }
+
+  .cmd-progress-status-active .cmd-progress-bg:before {
+    content: "";
+    opacity: 0;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background: #fff;
+    border-radius: 20upx;
+    -webkit-animation: cmd-progress-active 2.4s cubic-bezier(0.23, 1, 0.32, 1) infinite;
+    animation: cmd-progress-active 2.4s cubic-bezier(0.23, 1, 0.32, 1) infinite;
+  }
+
+  .cmd-progress-status-exception .cmd-progress-bg {
+    background-color: #f5222d;
+  }
+
+  .cmd-progress-status-exception .cmd-progress-text {
+    color: #f5222d;
+  }
+
+  .cmd-progress-status-exception .cmd-progress-circle-path {
+    stroke: #f5222d;
+  }
+
+  .cmd-progress-status-success .cmd-progress-bg {
+    background-color: #52c41a;
+  }
+
+  .cmd-progress-status-success .cmd-progress-text {
+    color: #52c41a;
+  }
+
+  .cmd-progress-status-success .cmd-progress-circle-path {
+    stroke: #52c41a;
+  }
+
+  .cmd-progress-circle .cmd-progress-inner {
+    position: relative;
+    line-height: 1;
+    background-color: transparent;
+  }
+
+  .cmd-progress-circle .cmd-progress-text {
+    display: block;
+    position: absolute;
+    width: 100%;
+    text-align: center;
+    line-height: 1;
+    top: 50%;
+    -webkit-transform: translateY(-50%);
+    transform: translateY(-50%);
+    left: 0;
+    margin: 0;
+    color: rgba(0, 0, 0, 0.65);
+    white-space: normal;
+  }
+
+  .cmd-progress-circle .cmd-progress-status-exception .cmd-progress-text {
+    color: #f5222d;
+  }
+
+  .cmd-progress-circle .cmd-progress-status-success .cmd-progress-text {
+    color: #52c41a;
+  }
+
+  @keyframes cmd-progress-active {
+    0% {
+      opacity: 0.1;
+      width: 0;
+    }
+
+    20% {
+      opacity: 0.5;
+      width: 0;
+    }
+
+    100% {
+      opacity: 0;
+      width: 100%;
+    }
+  }
+</style>

+ 6 - 6
src/components/swiperBanner.vue

@@ -93,7 +93,7 @@
     border-radius: 16rpx;
 }
 
-swiper-item .imgsBar {
+.imgsBar {
     width: 100%;
     height: 330rpx;
 }
@@ -129,30 +129,30 @@ swiper-item .imgsBar {
     border-radius: 0;
 }
 .ad_swiper-container1 .swiper_box,
-.ad_swiper-container1 .swiper_box swiper-item .imgsBar{
+.ad_swiper-container1 .swiper_box .imgsBar{
     height: 750rpx;
 }
 
 /* 广告图3:1 */
 .ad_swiper-container .swiper_box,
-.ad_swiper-container .swiper_box swiper-item .imgsBar{
+.ad_swiper-container .swiper_box .imgsBar{
     height: 234rpx;
 }
 /* 广告图5:2 */
 .ad_swiper-container52 .swiper_box,
-.ad_swiper-container52 .swiper_box swiper-item .imgsBar{
+.ad_swiper-container52 .swiper_box .imgsBar{
     height: 272rpx;
 }
 
 // 广告图 25 : 17
 .ad_swiper-container25 .swiper_box,
-.ad_swiper-container25 .swiper_box swiper-item .imgsBar{
+.ad_swiper-container25 .swiper_box .imgsBar{
     height: 520rpx;
 }
 
 // 广告图 23 : 7
 .ad_swiper-container37 .swiper_box,
-.ad_swiper-container37 .swiper_box swiper-item .imgsBar{
+.ad_swiper-container37 .swiper_box .imgsBar{
     height: 210rpx;
 }
 

+ 4 - 0
src/main.js

@@ -9,6 +9,10 @@ Vue.config.productionTip = false
 import md5 from 'js-md5';
 Vue.prototype.$md5 = md5;
 
+import dayjs from 'dayjs';
+Vue.prototype.$day = dayjs;
+
+
 import cof from '@/static/config/in';
 Vue.prototype.$cof = cof;
 

+ 97 - 94
src/pages.json

@@ -2,180 +2,185 @@
 	"pages": [
 		{
 			"path": "pages/index/index",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "一茶酒社"
 			}
 		},
 		{
 			"path": "pages/my/login",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "登录"
 			}
 		},
 		{
 			"path": "pages/sign/index",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "任务"
 			}
 		},
 		{
 			"path": "pages/partner/index",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "联盟店"
 			}
 		},
 		{
 			"path": "pages/my/index",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "我的"
 			}
 		},
 		{
 			"path": "pages/product/productRetail",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "零售专区"
 			}
 		},
 		{
 			"path": "pages/product/productWholesale",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "批发专区"
 			}
 		},
 		{
 			"path": "pages/product/p_details",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "商品详情"
 			}
 		},
 		{
-			"path" : "pages/to-pay-list/index",
-			"style" : {
+			"path": "pages/to-pay-list/index",
+			"style": {
 				"navigationBarTitleText": "订单购买"
 			}
 		},
 		{
 			"path": "pages/protocol/index",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "购买协议"
 			}
 		},
-
+		{
+			"path": "pages/invi-img/index",
+			"style": {
+				"navigationBarTitleText": "邀请好友"
+			}
+		},
 		{
 			"path": "pages/account/wealth",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "财富"
 			}
 		},
 		{
 			"path": "pages/account/consignment",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "寄售"
 			}
 		},
 		{
 			"path": "pages/account/giveAsPresent",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "赠送"
 			}
 		},
-
+		{
+			"path": "pages/speed-up/index",
+			"style": {
+				"navigationBarTitleText": "加速"
+			}
+		},
 		{
 			"path": "pages/accountDetails/running",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "流水明细"
 			}
 		},
 		{
 			"path": "pages/accountDetails/withdraw",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "提现明细"
 			}
 		},
 		{
 			"path": "pages/accountDetails/topup",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "充值明细"
 			}
 		},
 		{
 			"path": "pages/accountDetails/integral",
-			"style":{
+			"style": {
 				"navigationBarTitleText": "积分明细"
 			}
 		},
 		{
-            "path" : "pages/notice/index",
-            "style":{
-            	"navigationBarTitleText": "用户须知"
-            }
-            
-        },
-		{
-		    "path" : "pages/about/index",
-		    "style":{
-		    	"navigationBarTitleText": "关于我们"
-		    }
-		    
-		},
-		{
-		    "path" : "pages/course/index",
-		    "style":{
-		    	"navigationBarTitleText": "新手教程"
-		    }
-		    
-		},
-		{
-		    "path" : "pages/szw-order-list/index",
-		    "style":{
-		    	"navigationBarTitleText": "订单列表"
-		    }
-		    
-		},
-		{
-            "path" : "pages/szw-order-details/index",
-            "style":{
-            	"navigationBarTitleText": "订单详情"
-            }
-            
-        }
-        ,{
-            "path" : "pages/top-up/index",
-            "style":{
-            	"navigationBarTitleText": "充值"
-            }
-            
-        }
-    ],
-	"tabBar": {
-	    "color": "#505050",
-	    "selectedColor": "#12B280",
-	    "borderStyle": "black",
-	    "backgroundColor": "#ffffff",
-	    "list": [{
-	        "pagePath": "pages/index/index",
-	        "iconPath": "static/nav/shouye.png",
-	        "selectedIconPath": "static/nav/shouye_select.png",
-	        "text": "首页"
-	    }, 
-		{
-			"pagePath":"pages/sign/index",
-			"iconPath":"static/nav/qiandao.png",
-			"selectedIconPath":"static/nav/qiandao_select.png",
-			"text":"任务"
-		},
-		{
-	        "pagePath": "pages/partner/index",
-	        "iconPath": "static/nav/hehuoren.png",
-	        "selectedIconPath": "static/nav/hehuoren_select.png",
-	        "text": "联盟店"
-	    },
-		{
-			"pagePath":"pages/my/index",
-			"iconPath":"static/nav/wode.png",
-			"selectedIconPath":"static/nav/wode_select.png",
-			"text":"我的"
+			"path": "pages/notice/index",
+			"style": {
+				"navigationBarTitleText": "用户须知"
+			}
+		},
+		{
+			"path": "pages/about/index",
+			"style": {
+				"navigationBarTitleText": "关于我们"
+			}
+		},
+		{
+			"path": "pages/course/index",
+			"style": {
+				"navigationBarTitleText": "新手教程"
+			}
+		},
+		{
+			"path": "pages/szw-order-list/index",
+			"style": {
+				"navigationBarTitleText": "订单列表"
+			}
+		},
+		{
+			"path": "pages/szw-order-details/index",
+			"style": {
+				"navigationBarTitleText": "订单详情"
+			}
+		},
+		{
+			"path": "pages/top-up/index",
+			"style": {
+				"navigationBarTitleText": "充值"
+			}
 		}
+	],
+	"tabBar": {
+		"color": "#505050",
+		"selectedColor": "#12B280",
+		"borderStyle": "black",
+		"backgroundColor": "#ffffff",
+		"list": [
+			{
+				"pagePath": "pages/index/index",
+				"iconPath": "static/nav/shouye.png",
+				"selectedIconPath": "static/nav/shouye_select.png",
+				"text": "首页"
+			},
+			{
+				"pagePath": "pages/sign/index",
+				"iconPath": "static/nav/qiandao.png",
+				"selectedIconPath": "static/nav/qiandao_select.png",
+				"text": "任务"
+			},
+			{
+				"pagePath": "pages/partner/index",
+				"iconPath": "static/nav/hehuoren.png",
+				"selectedIconPath": "static/nav/hehuoren_select.png",
+				"text": "联盟店"
+			},
+			{
+				"pagePath": "pages/my/index",
+				"iconPath": "static/nav/wode.png",
+				"selectedIconPath": "static/nav/wode_select.png",
+				"text": "我的"
+			}
 		]
 	},
 	"easycom": {
@@ -186,14 +191,12 @@
 		}
 		// "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 	},
-	"globalStyle":
-	{
+	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "uniapp",
 		"navigationBarBackgroundColor": "#fff",
 		"backgroundColor": "#fff",
-		"app-plus":
-		{
+		"app-plus": {
 			"titleNView": false
 		}
 	},

+ 2 - 1
src/pages/index/index.vue

@@ -80,7 +80,8 @@ export default {
         this.getImage(); //获取活动列表
     },
     onLaunch() {},
-    onShow() {},
+    onShow() {
+    },
     onHide() {},
     methods: {
         // 获取轮播图

+ 431 - 0
src/pages/invi-img/index.vue

@@ -0,0 +1,431 @@
+<template>
+    <!--pages/invi-img/index.wxml-->
+    <view class='container'>
+        <view class='invi_img'>
+            <swiper class="swiper_box" circular="true" duration="1000" indicator-dots="true" indicator-color="rgba(255, 255, 255, .3)" indicator-active-color="#d7a54c" @change="swiperchange">
+                <block>
+                    <swiper-item v-for="(item,index) in bgImgList" :key="index">
+                        <image :src="item" v-if="item && item != ''" class="slide-image" mode='widthFix' lazy-load />
+                    </swiper-item>
+                </block>
+            </swiper>
+        </view>
+        <view class='invi_tops'><text space="nbsp">新用户扫二维码识别小程序 / 授权登录即可成功绑定关系</text></view>
+        <view class='btn_group disFlex_goodsBox flex_hor_between' v-if="bgImgList && bgImgList.length > 0">
+            <view class='btn_tab' @tap='getImg' v-if="flag">生成专属海报</view>
+            <view class='btn_tab' v-else>
+                <button open-type="openSetting" class='button' plain @getuserinfo="onGotUserInfo">生成专属海报</button>
+            </view>
+            <!-- <view class='btn_tab' bindtap='getImg' data-type='sy' wx:if="{{flag}}">生成收益海报</view>
+	        <view class='btn_tab' wx:else>
+	            <button open-type="openSetting" class='button' plain bindgetuserinfo="onGotUserInfo">生成收益海报</button>
+	        </view> -->
+        </view>
+        <canvas class="myCanvas" canvas-id="myCanvas" :style="'width:' + WIDTH + 'px;height:' + HEIGHT + 'px;'"></canvas>
+    </view>
+</template>
+<script>
+let app = getApp()
+var appEv = app.$vm.$options;
+var util = require('@/utils/utils.js');
+import { get, post, u_post } from "@/request/api.js";
+// import { ReqApi } from "../../utils/reqTools.js";
+// var reqApi = new ReqApi();
+// import { base64ToPath } from "@/js_sdk/image-tools.js";
+export default {
+    data() {
+        return {
+            WIDTH: 1080,
+            HEIGHT: 1848,
+            E_WIDTH: 290,
+            flag: true,
+            imgUrl: "",
+            bgImgList: [],
+            bgSrc: "",
+            sybgSrc: "",
+            type: '',
+            userInfo: {},
+            Url: '',
+        };
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function(options) {
+        var userId = app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId ? app.globalData.systemUserInfo.userId : '';
+        var that = this;
+        if (!userId || userId == '') {
+            appEv.authorizeUserInfo(res => {
+                if (res) {
+                    that.loadData();
+                } else {
+                    appEv.errTips("请先登录");
+                    setTimeout(function() {
+                        uni.switchTab({
+                            url: '/pages/my/index'
+                        })
+                    }, 1200);
+                }
+            }, true);
+        } else {
+            that.loadData();
+        }
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function() {},
+    methods: {
+        loadData() {
+            uni.showLoading({ mask: true })
+            u_post("ShuZiTeaYW/poster/getPoster").then(res => {
+                uni.hideLoading();
+                if (res.status == 200) {
+                    var list = res.list || this.bgImgList;
+                    this.bgImgList = list
+                    this.bgSrc = list[0]
+                    this.sybgSrc = res.profit
+                } else {
+                    appEv.errTips(res.msg || '');
+                }
+            })
+        },
+        swiperchange: function(e) {
+            var current = e.detail.current || 0;
+            this.bgSrc = this.bgImgList[current]
+        },
+        onGotUserInfo(e) {
+            console.log(e);
+        },
+        getImg(e) {
+            uni.showLoading({
+                title: '图片保存中...',
+            })
+            // 判断是否为生成收益海报
+            if (e.currentTarget.dataset.type && e.currentTarget.dataset.type == 'sy') {
+                this.type = e.currentTarget.dataset.type
+                this.HEIGHT = 1920
+                this.getSyImg();
+            } else {
+                this.type = ''
+                this.HEIGHT = 1848
+                this.getZsImg();
+            }
+
+        },
+        // 专属海报接口
+        getZsImg() {
+            var that = this;
+            u_post("ShuZiTeaYW/twoCode/get").then(res => {
+                if (res.status == 200) {
+                    if (res.url) {
+                        that.imgUrl = res.url
+                        that.save();
+                    } else {
+                        appEv.errTips("保存失败");
+                        uni.hideLoading();
+                    }
+                } else {
+                    appEv.errTips(res.msg || '');
+                }
+            })
+        },
+        // 收益海报接口
+        getSyImg() {
+            var that = this;
+            var imgs = reqApi.getSyInviImg();
+            if (imgs) {
+                imgs.then(res => {
+                    if (res.data.status == 200) {
+                        if (res.data.twoCode) {
+                            that.imgUrl = res.data.twoCode,
+                                that.userInfo = res.data
+                            that.save();
+                        } else {
+                            appEv.errTips("保存失败");
+                            uni.hideLoading();
+                        }
+                    } else {
+                        appEv.errTips(res.data.msg || '');
+                    }
+                })
+            }
+        },
+
+        save: function() {
+            var bgSrc = this.type == 'sy' ? this.sybgSrc : this.bgSrc,
+                userInfo = this.userInfo,
+                that = this;
+            uni.getImageInfo({
+                src: bgSrc,
+                success: function(ret) {
+                    var path = ret.path;
+                    if (that.type == 'sy') {
+                        uni.downloadFile({
+                            url: userInfo.img,
+                            success(res) {
+                                if (res.tempFilePath) {
+                                    that.createImg(path, res.tempFilePath);
+                                } else {
+                                    appEv.errTips("头像下载失败");
+                                }
+                            },
+                            fail() {
+                                appEv.errTips("头像下载失败");
+                            }
+                        })
+                    } else {
+                        that.createImg(path);
+                    }
+                },
+                fail: (err) => {
+                    console.log(err);
+                },
+            })
+        },
+
+        createImg(bgSrc, avatar) {
+            var imgUrl = this.imgUrl,
+                WIDTH = this.WIDTH,
+                HEIGHT = this.HEIGHT,
+                E_WIDTH = this.E_WIDTH,
+                that = this;
+            var path;
+            uni.getImageInfo({
+                src: imgUrl,
+                success: function(ret) {
+                    path = ret.path;
+
+                    // let aBuffer = await base64ToPath(imgUrl);
+                    // path = aBuffer;
+
+                    const ctx = uni.createCanvasContext('myCanvas');
+                    let EWM_Y = that.type == 'sy' ? (HEIGHT - E_WIDTH - 15 - 90) : (HEIGHT - E_WIDTH - 15 - 128);
+
+                    ctx.save();
+                    ctx.drawImage(bgSrc, 0, 0, WIDTH, HEIGHT);
+                    ctx.drawImage(path, (WIDTH - E_WIDTH) / 2, EWM_Y, E_WIDTH, E_WIDTH);
+                    ctx.restore();
+
+                    if (that.type == 'sy') {
+                        var userInfo = that.userInfo;
+
+                        // 昵称
+                        ctx.save();
+                        ctx.setTextBaseline('top')
+                        ctx.setTextAlign('left')
+                        ctx.setFillStyle('#1b2028');
+                        ctx.setFontSize(44);
+                        ctx.fillText(util.transformContentToMultiLineText(ctx, util.emoji_uncodeUtf16(userInfo.name), 190, 1), 520, 284, 230);
+
+                        // id
+                        ctx.setFontSize(28);
+                        ctx.fillText(userInfo.id, 632, 365, 230);
+
+                        // 总佣金
+                        ctx.setTextAlign('center')
+                        ctx.setFillStyle('#f8233b');
+                        ctx.setFontSize(84);
+                        ctx.fillText(userInfo.money + '元', WIDTH / 2, 520);
+
+                        // 时间
+                        ctx.setFillStyle('#f5e3cd');
+                        ctx.setFontSize(28);
+                        ctx.fillText(util.formatDateTime(new Date(), 'hzhm') + '数据', WIDTH / 2, 868);
+
+                        // 阶段佣金
+                        ctx.setTextAlign('center')
+                        ctx.setFillStyle('#fd513b');
+                        ctx.setFontSize(38);
+                        ctx.fillText(userInfo.todayMoney, WIDTH / 2 - 204, 1028);
+
+                        ctx.fillText(userInfo.todayCount, WIDTH / 2 + 206, 1028);
+
+                        ctx.fillText(userInfo.yesterDayMoney, WIDTH / 2 - 204, 1150);
+
+                        ctx.fillText(userInfo.yesterDayCount, WIDTH / 2 + 206, 1150);
+
+                        ctx.fillText(userInfo.monthMoney, WIDTH / 2 - 204, 1272);
+
+                        ctx.fillText(userInfo.monthCount, WIDTH / 2 + 206, 1272);
+
+                        ctx.fillText(userInfo.lastMonthMoney, WIDTH / 2 - 204, 1394);
+
+                        ctx.fillText(userInfo.lastMonthCount, WIDTH / 2 + 206, 1394);
+                        ctx.restore();
+
+                        // 头像
+                        ctx.save()
+                        ctx.beginPath()
+                        ctx.arc(426, 340, 66, 0, 2 * Math.PI)
+                        ctx.clip()
+                        ctx.drawImage(avatar, 360, 274, 132, 132)
+                        ctx.restore()
+                    }
+
+                    ctx.draw(false, function(e) {
+                        // 保存到本地
+                        uni.canvasToTempFilePath({
+                            canvasId: 'myCanvas',
+                            quality: 1,
+                            fileType: 'jpg',
+                            success: function(res) {
+                                let pic = res.tempFilePath;
+                                that.saveImage(pic);
+                            }
+                        });
+                    });
+                },
+                fail: (err) => {
+                    console.log(err)
+                }
+            })
+        },
+
+        saveImage(path = appEv.parameter('path')) {
+            var that = this;
+            uni.getSetting({
+                success: (res) => {
+                    //如果没有相册权限
+                    console.log(res.authSetting); //授权信息
+                    if (!res.authSetting["scope.writePhotosAlbum"]) {
+                        console.log('没有授权,调用授权!');
+                        //向用户发起授权请求
+                        uni.authorize({
+                            scope: "scope.writePhotosAlbum",
+                            success: () => {
+                                console.log('授权成功!');
+                                that.savefun(path)
+                            },
+                            fail: (res) => {},
+                        })
+                    } else {
+                        console.log('已授权。直接保存');
+                        that.savefun(path)
+                    }
+                },
+                fail: (res) => {},
+            })
+        },
+
+        savefun(path) {
+            uni.saveImageToPhotosAlbum({
+                filePath: path,
+                success(result) {
+                    uni.showToast({
+                        title: '保存成功',
+                        icon: 'success',
+                        duration: 1200
+                    })
+                    // 预览图片
+                    uni.previewImage({
+                        current: path, // 当前显示图片的http链接
+                        urls: [path], // 需要预览的图片http链接列表
+                    })
+                },
+                fail(result) {
+                    this.flag = false;
+                    appEv.errTips("保存失败");
+                }
+            })
+        },
+    }
+}
+</script>
+<style lang="scss">
+/* pages/invi-img/index.wxss */
+page {
+    background-color: #2F323B;
+    color: #fff;
+}
+
+.container {
+    width: 600rpx;
+    margin: 0 auto;
+    overflow: hidden;
+    position: relative;
+}
+
+.myCanvas {
+    position: absolute;
+    top: 150%;
+    left: 50%;
+    right: 0;
+    bottom: 0;
+    opacity: 0;
+    transform: translate(-50%, 50%);
+}
+
+.invi_img {
+    margin: 5% 0 24rpx;
+    overflow: hidden;
+    border: 16rpx solid #fff;
+}
+
+.invi_img .image {
+    width: 100%;
+    display: block;
+}
+
+.invi_img .swiper_box,
+.invi_img .slide-image {
+    width: 100%;
+    height: 970rpx !important;
+    overflow: hidden;
+}
+
+.invi_tops {
+    list-style: 1.2;
+    font-size: 24rpx;
+    opacity: 0.8;
+    text-align: center;
+    width: 640rpx;
+    margin-left: -20rpx;
+    transform: scale(0.9);
+    -webkit-transform: scale(0.9);
+    -moz-transform: scale(0.9);
+    -o-transform: scale(0.9);
+    -ms-transform: scale(0.9);
+    transform-origin: top center;
+    -webkit-transform-origin: top center;
+    -moz-transform-origin: top center;
+    -o-transform-origin: top center;
+    -ms-transform-origin: top center;
+}
+
+.btn_group {
+    padding-top: 6rpx;
+    padding-bottom: 42rpx;
+}
+
+.btn_group .btn_tab {
+    /* min-width: calc((100% - 32rpx) / 2); */
+    min-width: 100%;
+    border-radius: 8rpx;
+    box-sizing: border-box;
+    padding: 20rpx;
+    text-align: center;
+    color: #fff;
+    background-color: #c9ab79;
+    margin-top: 32rpx;
+    /* width: 100%; */
+}
+
+.btn_group .btn_tab .button {
+    border: 0;
+    padding: 0;
+    margin: 0;
+}
+
+.btn_group .btn_tab,
+.btn_group .btn_tab .button {
+    color: #fff;
+    line-height: 1.4;
+    font-size: 28rpx;
+}
+
+.codeimg {
+    // display: none;
+}
+</style>

+ 8 - 15
src/pages/my/index.vue

@@ -58,13 +58,13 @@
           <view class="user_option flex_r flex_ac">
             <image
               class="code_img"
-              src="/static/f_img_code.png"
+              src="/static/my/f_img_code.png"
               @tap="getImgPage"
               mode=""
             ></image>
             <image
               class="code_img"
-              src="/static/setting.png"
+              src="/static/my/setting.png"
               @tap="getToSetting"
               mode=""
             ></image>
@@ -506,15 +506,15 @@ export default {
     SetHint: function () {
       appEv.errTips("此功能暂未开放");
     },
+    async isrealName(){
+      let n = await u_post("ShuZiTeaYW/userInfo/realName");
+      return n.status == 200
+    },
     // 跳转到分享页面
     getImgPage: function () {
       let that = this;
-      const info = reqApi.realName();
-      if (info) {
-        info.then((res) => {
-          if (res.data.status == 200) {
+      if(this.isrealName()){
             uni.navigateTo({
-              // url:'/pages/mytest/poster'
               url: "/pages/invi-img/index",
             });
           } else {
@@ -536,16 +536,11 @@ export default {
               });
             }
           }
-        });
-      }
     },
     // 跳转到提现页面
     getToCash: function () {
       let that = this;
-      const info = reqApi.realName();
-      if (info) {
-        info.then((res) => {
-          if (res.data.status == 200) {
+      if(this.isrealName()){
             uni.navigateTo({
               url: "/pages/cash/index",
             });
@@ -568,8 +563,6 @@ export default {
               });
             }
           }
-        });
-      }
     },
     // 复制账号
     copyText(e) {

+ 1 - 1
src/pages/sign/index.vue

@@ -250,7 +250,7 @@ export default {
                 page: page,
                 limit: 10
             }
-            post("/ShuZiTeaIntegral/integral/goodsDay", data).then(res => {
+            post("ShuZiTeaIntegral/integral/goodsDay", data).then(res => {
                 if (res.status == 200) {
                     let obj = res.goods
                     that.goods = []

+ 248 - 0
src/pages/speed-up/index.vue

@@ -0,0 +1,248 @@
+<template>
+	<view class="container">
+		<!-- 匹配周期 -->
+		<view class="matching mar_t20 flex_r flex_ac flex_jb">
+			<view class="match_name">{{detail.type == 1 ? '匹配中' : '匹配成功'}}</view>
+			<view class="match_day flex_r flex_ae">
+				<block v-if="detail.type == 1">
+					<text>{{dayNum}}</text>天 <view style="margin-left: 20rpx;">{{timeNum}}</view>
+				</block>
+				<block v-else>
+					{{detail.typeTime}}
+				</block>
+			</view>
+		</view>
+		<!-- 匹配周期-end -->
+		
+		<!-- 加速 -->
+		<view class="up flex_r flex_ac flex_jb mar_t20">
+			<view class="up_con flex_c">
+				<view class="up_name">已加速</view>
+			</view>
+			<view class="match_day flex_r flex_ae"><text>{{speedUpDayNum}}</text>天</view>
+		</view>
+		<!-- 加速-end -->
+		
+		<!-- 签到加速 -->
+		<view class="sign mar_t20">
+			<view class="sign_con flex_r flex_ac flex_jb">
+				<view class="sign_insfo flex_c flex_jc">
+					<view class="sign_name">签到加速</view>
+					<view class="sign_msg">每签到{{detail.qsCount}}次可加速1天,最多加速{{detail.oCountqd1}}天</view>
+				</view>
+				<view class="sign_up_con">
+					<view style="display: flex;justify-content: center;position: relative;">
+					  <cmd-progress type="circle" :percent="(detail.oCountqd2/detail.oCountqd1) * 100" stroke-color="#009688" :stroke-width="12" :width="168" :showInfo="false"></cmd-progress>
+					  <view class="status flex_r flex_ac flex_jc">加速中</view>
+					</view>
+				</view>
+			</view>
+			<view class="sign_option flex_r flex_ac flex_jb">
+				<view class="flex_r flex_ac">
+					<image class="hint_img" src="/static/notice.png" mode=""></image>
+					<view class="hint_msg">已达到最大签到次数或签到次数不足</view>
+				</view>
+				<view class="btn" @tap="gotoSign">立即加速</view>
+			</view>
+		</view>
+		<!-- 签到加速-end -->
+		
+		<!-- 推广 -->
+		<view class="promotion mar_t20">
+			<view class="sign_con flex_r flex_ac flex_jb">
+				<view class="sign_insfo flex_c flex_jc">
+					<view class="sign_name">分享加速</view>
+					<view class="sign_msg" style="max-width: 80%;">分享新用户在零售专区消费可获得加速,直至最快寄售匹配周期。</view>
+				</view>
+				<view class="pro_con">
+					<image src="/static/promotion.png" mode=""></image>
+				</view>
+			</view>
+			<view class="sign_option flex_r flex_ac flex_je">
+				<view class="btn" @tap="gotoImgTwo">立即分享</view>
+			</view>
+		</view>
+		<!-- 推广-end -->
+	</view>
+</template>
+
+<script>
+let tim
+let page = 1;
+let app=getApp();
+var appEv = app.$vm.$options;
+import { get, post, u_post } from "@/request/api.js";
+// let reqApi = new ReqApi();
+// import { ReqApi } from "@/utils/reqTools.js";
+import cmdProgress from "@/components/cmd-progress/cmd-progress.vue"
+	export default {
+		components: {cmdProgress},
+		data() {
+			return {
+				pro_num:0,
+				detail:'',
+				ojsId:'',
+				time:'',
+
+				dayNum: '', //剩余天数
+				timeNum: '', //剩余时间(减去整天数过后的)
+				speedUpDayNum: "",//加速天数
+			};
+		},
+		onLoad:function(e){
+			// let timer = setInterval(()=>{
+			// 	if(this.pro_num<50){
+			// 		this.pro_num = this.pro_num + 10
+			// 	}else{
+			// 		clearInterval(timer)
+			// 	}
+			// },100)
+			this.ojsId = e.id;
+			this.loadData()
+		},
+		onUnload:function(){
+			clearInterval(tim)
+		},
+		methods:{
+			loadData:function(){
+				let that = this;
+				let data = {
+					orderId:this.ojsId
+				}
+				u_post("ShuZiTeaYW/ojs/ojsDay",data).then(res => {
+					if(res.status == 200){
+						let da = res.ojsDetail;
+						let num1 = da.oCountqd2 > da.oCountqd1 ? da.oCountqd1 : da.oCountqd2; //签到加速天数
+						let num2 = da.oCounttg2 > da.oCounttg1 ? da.oCounttg1 : da.oCounttg2; //推广签到天数
+						that.speedUpDayNum =  (num1 + num2) > da.oCountSX ? da.oCountSX : num1 + num2;
+
+						that.detail = da;
+						if(da.type == 1) that.timeCalculate(da);
+					}
+				})
+			},
+			timeCalculate(data){
+				// console.log(this.$day(data.createTime).add(data.ojsDay - this.speedUpDayNum, 'day').format("YYYY-MM-DD HH:mm:ss"));
+				// console.log(this.$day().subtract(data.ojsDay - this.speedUpDayNum, 'day').format("YYYY-MM-DD HH:mm:ss"));
+
+				let endTime = this.$day(data.createTime).add(19 - this.speedUpDayNum, 'day').unix();
+				let dayNum = parseInt((endTime - this.$day().unix()) / 86400); //剩余整天数
+				let timeNum = (endTime - this.$day().unix()) % 86400; //剩余时间(减去整天数过后的)
+				timeNum  = timeNum > 0 ? timeNum : 0;
+				this.dayNum = dayNum;
+				let that = this;
+				let time = setInterval(()=>{
+					if(timeNum > 1){
+						timeNum --
+					}else{
+						if(dayNum >= 1){
+							that.dayNum = dayNum - 1
+							timeNum = 86399
+						}else{
+							clearInterval(time)
+							uni.showModal({
+							    title: '提示',
+							    content: '寄售完成,请返回列表查看结果',
+							    success: function (res) {
+							        if (res) {
+							            uni.navigateBack({
+							            	delta:1
+							            })
+									}
+							    }
+							});
+						}
+					}
+					let hour = parseInt(timeNum/3600) > 9 ? parseInt(timeNum/3600) : '0' + parseInt(timeNum/3600)
+					let min = parseInt(timeNum / 60 % 60) > 9 ? parseInt(timeNum / 60 % 60) : '0' + parseInt(timeNum / 60 % 60)
+					let sec = parseInt(timeNum % 60) > 9 ? parseInt(timeNum % 60) : '0' + parseInt(timeNum % 60)
+					that.timeNum = hour + ':' + min + ':' + sec;
+				},1000)
+
+			},
+			getTimer:function(timer){
+				var date;
+				let that = this;
+				tim = setInterval(()=>{
+					if(timer>1){
+						timer --
+					}else{
+						if(that.detail.ojsDaySurplus >= 1){
+							that.detail.ojsDaySurplus = that.detail.ojsDaySurplus - 1
+							timer = 86399
+						}else{
+							clearInterval(tim)
+							uni.showModal({
+							    title: '提示',
+							    content: '寄售完成,请返回列表查看结果',
+							    success: function (res) {
+							        if (res) {
+							            uni.navigateBack({
+							            	delta:1
+							            })
+									}
+							    }
+							});
+						}
+					}
+					let hour = parseInt(timer/3600) > 9 ? parseInt(timer/3600) : '0' + parseInt(timer/3600)
+					let min = parseInt(timer / 60 % 60) > 9 ? parseInt(timer / 60 % 60) : '0' + parseInt(timer / 60 % 60)
+					let sec = parseInt(timer % 60) > 9 ? parseInt(timer % 60) : '0' + parseInt(timer % 60)
+					date = hour + ':' + min + ':' + sec
+					this.time = date
+				},1000)
+			},
+			gotoSign:function(){
+				uni.switchTab({
+					url:'/pages/sign/index'
+				})
+			},
+			gotoImgTwo:function(){
+				uni.navigateTo({
+					url:'/pages/invi-img/index'
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+// 页面配置
+page{background: #F4F4F4;}
+// 页面配置-end
+
+// 匹配周期
+.match_day{font-size: 24rpx;color:#2A2A2A;line-height: 1;}
+.match_day text{font-size: 36rpx;color:#2A2A2A; line-height: 1;}
+.match_name{font-size: 32rpx;color:#313131;font-family: "SourceHanSansCN-Medium";}
+.matching{width: 100%;height: 88rpx;background: #fff;padding:0 30rpx;box-sizing: border-box;}
+// 匹配周期-end
+
+// 加速
+.up_max{font-size: 22rpx;color: #686868;}
+.up_name{font-size: 32rpx;color:#313131;font-family: "SourceHanSansCN-Medium";}
+.up{width: 100%;height: 100rpx;background: #fff;padding:0 30rpx;box-sizing: border-box;}
+// 加速-end
+
+// 签到加速
+.sign_msg{font-size: 24rpx;color: #3B3A3A;}
+.sign_up_con{width: 168rpx;height: 168rpx;}
+.hint_msg{font-size: 20rpx;color: #5D5C5C;}
+.hint_img{width: 30rpx;height: 30rpx;margin-right: 20rpx;}
+.sign_option{width: 100%;overflow: hidden;margin-top: 38rpx;}
+.sign_con{width: 100%;overflow: hidden;align-items: initial;}
+.sign{width: 100%;overflow: hidden;background: #fff;padding:30rpx;box-sizing: border-box;}
+.status{font-size:22.63rpx;color:#5D5C5C;width: 100%;height: 100%;position: absolute;top: 0;left: 0;}
+.sign_name{font-size: 32rpx;color:#313131;font-family: "SourceHanSansCN-Medium";margin-bottom: 30rpx;}
+.btn{padding:10rpx 31rpx 8rpx 40rpx;background: #E35535;color:#fff;font-size: 26rpx;font-family: "SourceHanSansCN-Medium";border-radius: 12rpx;}
+// 签到加速-end
+
+// 推广
+.pro_con{width: 84rpx;height: 78rpx;}
+.pro_con image{width: 100%;height: 100%;}
+.promotion .sign_con{align-items: center;}
+.promotion{width: 100%;overflow: hidden;background: #fff;padding:30rpx;box-sizing: border-box;}
+
+.y_color{color:#E56213;font-size: 24rpx;}
+// 推广-end
+</style>

+ 3 - 1
src/request/request.js

@@ -27,7 +27,9 @@ export default ({ url, method, params, header, baseURL }) => {
 
 uni.addInterceptor('request', {
 	invoke(args) {
-		// console.log('interceptor-invoke', args)		请求前
+		console.log('interceptor-invoke', args)		//请求前
+		let token = uni.getStorageSync('token');
+		if(token) args.header.token = token;
 	},
 	success(args) { //请求成功
 		if (args.data.resultCode && args.data.resultCode != 1) {

BIN
src/static/my/f_img_code.png


BIN
src/static/my/setting.png