<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      小程序wepy--手寫板

      跟上一篇一樣,因為客戶端用的是wepy,所以單獨寫的一套手寫板

      參考:https://blog.csdn.net/weixin_33912246/article/details/89621331

       

       直接代碼:

      <template>
        <view class="wrapper_handwriting">
          <view class="handBtn">
            <button catchtap="clearNow" class="delBtn">重寫</button>
            <button catchtap="exportImage" class="subBtn">完成</button>
          </view>
          <view class="handCenter">
            <canvas class="sign" canvas-id="sign" disable-scroll=true bindtouchstart="start" bindtouchmove="move" bindtouchend="end" />
          </view>
          <view class="handRight">
            <view class="handTitle">手寫簽名</view>
          </view>
          <!-- <block>
            <image src="{{filePathList}}" />
          </block> -->
      
        </view>
      
      </template>
      
      <script>
        import wepy from 'wepy'
        import qiniuUploader from '../../utils/qiniuUploader'
        var ctx = wx.createCanvasContext('sign')
        ctx.setStrokeStyle("#000");
        //設置線的寬度
        ctx.setLineWidth(3);
        //設置線兩端端點樣式更加圓潤
        ctx.setLineCap('round');
        //設置兩條線連接處更加圓潤
        ctx.setLineJoin('round');
        export default class Fyxz extends wepy.page {
          data = {
            x: 0,
            y: 0,
            ctx: ctx,
            filePath: '',
            filePathList: '',
            qiniuUrl: '22',
            qiniuToken: '',
          }
          onLoad() {
            this.qiniuUrl = this.$parent.globalData.qiniuUrl
            this.getQiniuToken();
          }
          getQiniuToken() {
            const _this = this
            const param = {
              url: '/common/getQiniuToken',
              data: {
                path: '/wxclient'
              }
            };
      
            this.$parent.showLoading();
      
            this.$parent.request(param).then(res => {
              wx.hideLoading();
              _this.qiniuToken = res.ResultData.data;
              this.$apply();
            }).catch(err => {
              wx.hideLoading();
              this.$parent.log(err);
            })
          }
          methods = {
            start: (e) => {
              this.x = e.touches[0].x
              this.y = e.touches[0].y
            },
            move: (e) => {
              this.ctx.moveTo(this.x, this.y)
              this.x = e.touches[0].x
              this.y = e.touches[0].y
              this.ctx.lineTo(this.x, this.y)
              this.ctx.stroke()
              this.ctx.draw(true)
            },
            end: (e) => {
      
            },
      
            exportImage: () => {
              wx.canvasToTempFilePath({
                x: 0,
                y: 0,
                width: 300,
                height: 200,
                destWidth: 300,
                destHeight: 200,
                canvasId: 'sign',
                success: (res) => {
                  let p = new Promise((resolve, reject) => {
                    let fp = res.tempFilePath
                    resolve(fp)
                  })
                  p.then((fp) => {
                    this.filePath = fp
                    // 將緩存路徑保存到列表
                    // this.filePathList = fp
                    this.methods.uploadImg(fp)
                    // 手動更新數據
                    this.$apply()
                  }).then(() => {
                    // this.methods.clearNow();
                    console.log('提交成功!')
                  })
                }
              })
            },
            // 清屏
            clearNow: () => {
              this.ctx.clearRect(0, 0, 100, 200)
              this.ctx.draw()
              this.filePathList = ''
            },
            /**
             * 圖片上傳
             */
            uploadImg: (url) => {
              const _this = this;
              console.log(_this)
              const param = {
                region: 'NCN',
                domain: _this.qiniuUrl,
                shouldUseQiniuFileName: false,
                uploadURL: _this.qiniuUrl,
                uptoken: _this.qiniuToken
              };
              console.log(param)
              qiniuUploader.upload(url, function (info) {
                wx.hideLoading();
                _this.filePathList = info.imageURL
                _this.$apply();
              }, function (error) {
                _this.$parent.log(error);
              }, param);
            },
          }
        }
      </script>
      <style lang="less">
      
        .wrapper_handwriting{
          width: 100%;
          height: 100%;
          margin: 30rpx 0;
          overflow: hidden;
          display: flex;
          align-content: center;
          flex-direction: row;
          justify-content: center;
          font-size: 28rpx;
        }
        .info {
          text-align: center;
        }
        .handRight {
          display: inline-flex;
          align-items: center;
        }
      
        .handCenter {
          border: 4rpx dashed #e9e9e9;
          flex: 5;
          overflow: hidden;
          box-sizing: border-box;
        }
      
        .handTitle {
          transform: rotate(90deg);
          flex: 1;
            margin-bottom: 10px;
          color: #666;
        }
      
        .handBtn button {
          font-size: 28rpx;
        }
      
        .handBtn {
          height: 95vh;
          display: inline-flex;
          flex-direction: column;
          justify-content: space-between;
          align-content: space-between;
          flex: 1;
        }
      
        .delBtn,.subBtn {
          position: absolute;
          bottom: 300rpx;
          left: 0rpx;
          transform: rotate(90deg);
          color: #666;
        }
        .subBtn{
            bottom: 100rpx;
        }
      
        .delBtn image {
          position: absolute;
          top: 13rpx;
          left: 25rpx;
        }
        .sign {
            display: block;
          background: #fff;
          width: 100%;
          height: 100%;
        }
      </style>
      View Code

      一樣的,寫完點擊確定時,將簽名傳至七牛

      posted @ 2019-12-30 16:48  一只臥沙的雕  閱讀(333)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 亚洲欧美高清在线精品一区二区| 少妇办公室好紧好爽再浪一点| 国产又黄又爽又不遮挡视频| 美女午夜福利视频一区二区| 日韩av一区二区三区在线| 熟女一区二区中文字幕| 狠狠色狠狠综合久久| 成人午夜在线观看日韩| 国产欧美另类精品久久久| 中文字幕亚洲无线码A| 大乳丰满人妻中文字幕日本| 韩国av无码| 日日碰狠狠添天天爽超碰97| 亚洲AⅤ天堂AV天堂无码| 亚洲午夜伦费影视在线观看| 国产午夜精品久久精品电影 | 精品久久久久久无码不卡| 人妻系列无码专区无码中出| 美女内射毛片在线看3d| 日韩无专区精品中文字幕| 日韩人妻无码一区二区三区99| 亚洲欧洲精品一区二区| 思思热在线视频精品| 久久天天躁狠狠躁夜夜av | 亚洲中文字幕无码av永久| 爆乳日韩尤物无码一区| 日本公妇乱偷中文字幕| 日本黄韩国色三级三级三| 日本亲近相奷中文字幕| 国产中文三级全黄| 尤物国产精品福利在线网| 亚洲欧美中文字幕日韩一区二区 | 国产精品自拍视频免费看| 集安市| 精品国偷自产在线视频99| 亚洲一区二区中文av| 国产精品麻豆成人AV电影艾秋| 欧美亚洲日本国产其他| 久久综合色之久久综合| 精品天堂色吊丝一区二区| 中文 在线 日韩 亚洲 欧美|