[baozhangchao] 3 år sedan
förälder
incheckning
33dfd1b526
7 ändrade filer med 14778 tillägg och 406 borttagningar
  1. 8
    3
      package-lock.json
  2. 3
    1
      package.json
  3. 10
    0
      src/router/index.js
  4. 1
    13
      src/views/Course.vue
  5. 7
    5
      src/views/UserCenter.vue
  6. 101
    0
      src/views/WriteText.vue
  7. 14648
    384
      yarn.lock

+ 8
- 3
package-lock.json Visa fil

9734
       "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
9734
       "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
9735
       "dev": true
9735
       "dev": true
9736
     },
9736
     },
9737
+    "signature_pad": {
9738
+      "version": "4.0.2",
9739
+      "resolved": "https://registry.npmmirror.com/signature_pad/-/signature_pad-4.0.2.tgz",
9740
+      "integrity": "sha512-4jHtgCVvihLLPr0H4F0hB4eE9YOMcr/V9rFWwhPqzJ5qsBYhj7sg/B0yvcyM4HB+eWTKVoIep8Xh7gM/gKq+sA=="
9741
+    },
9737
     "simple-swizzle": {
9742
     "simple-swizzle": {
9738
       "version": "0.2.2",
9743
       "version": "0.2.2",
9739
       "resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
9744
       "resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
11077
     },
11082
     },
11078
     "vue-loader-v16": {
11083
     "vue-loader-v16": {
11079
       "version": "npm:vue-loader@16.8.3",
11084
       "version": "npm:vue-loader@16.8.3",
11080
-      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
11085
+      "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz",
11081
       "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
11086
       "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
11082
       "dev": true,
11087
       "dev": true,
11083
       "optional": true,
11088
       "optional": true,
11089
       "dependencies": {
11094
       "dependencies": {
11090
         "chalk": {
11095
         "chalk": {
11091
           "version": "4.1.2",
11096
           "version": "4.1.2",
11092
-          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
11097
+          "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
11093
           "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
11098
           "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
11094
           "dev": true,
11099
           "dev": true,
11095
           "optional": true,
11100
           "optional": true,
11100
         },
11105
         },
11101
         "loader-utils": {
11106
         "loader-utils": {
11102
           "version": "2.0.2",
11107
           "version": "2.0.2",
11103
-          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
11108
+          "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-2.0.2.tgz",
11104
           "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
11109
           "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
11105
           "dev": true,
11110
           "dev": true,
11106
           "optional": true,
11111
           "optional": true,

+ 3
- 1
package.json Visa fil

11
     "animate.css": "^4.1.1",
11
     "animate.css": "^4.1.1",
12
     "axios": "^0.26.0",
12
     "axios": "^0.26.0",
13
     "core-js": "^3.6.5",
13
     "core-js": "^3.6.5",
14
+    "signature_pad": "^4.0.2",
15
+    "smooth-signature": "^1.0.11",
14
     "vant": "^2.12.44",
16
     "vant": "^2.12.44",
15
     "vue": "^2.6.11",
17
     "vue": "^2.6.11",
16
     "vue-router": "^3.5.3",
18
     "vue-router": "^3.5.3",
41
       "parser": "babel-eslint"
43
       "parser": "babel-eslint"
42
     },
44
     },
43
     "rules": {
45
     "rules": {
44
-        "no-unused-vars":"off"
46
+      "no-unused-vars": "off"
45
     }
47
     }
46
   },
48
   },
47
   "browserslist": [
49
   "browserslist": [

+ 10
- 0
src/router/index.js Visa fil

7
 import MyCollection from '@/views/MyCollection.vue'//收藏
7
 import MyCollection from '@/views/MyCollection.vue'//收藏
8
 import SignIn from '@/views/SignIn.vue'//打卡
8
 import SignIn from '@/views/SignIn.vue'//打卡
9
 import ClassInfo from '@/views/ClassInfo.vue'//课堂详情
9
 import ClassInfo from '@/views/ClassInfo.vue'//课堂详情
10
+import WriteText from '@/views/WriteText.vue'//手写签名
11
+
10
 import StrongPhoto from '@/views/StrongPhoto.vue'//精彩集锦
12
 import StrongPhoto from '@/views/StrongPhoto.vue'//精彩集锦
11
 import UserCenter from '@/views/UserCenter.vue'//我的页面
13
 import UserCenter from '@/views/UserCenter.vue'//我的页面
12
 import Questionnaire from '@/views/Questionnaire.vue'
14
 import Questionnaire from '@/views/Questionnaire.vue'
13
 import SetUser from '@/views/userPages/SetUser.vue'//修改个人信息
15
 import SetUser from '@/views/userPages/SetUser.vue'//修改个人信息
16
+
14
 import { share } from '../util/initial'
17
 import { share } from '../util/initial'
15
 
18
 
16
 
19
 
76
       name: 'MyCollection',
79
       name: 'MyCollection',
77
       component: MyCollection,
80
       component: MyCollection,
78
     },
81
     },
82
+    //手写签名
83
+    {
84
+      path: '/WriteText',
85
+      name: 'WriteText',
86
+      component: WriteText,
87
+    },
88
+
79
   ]
89
   ]
80
 
90
 
81
 })
91
 })

+ 1
- 13
src/views/Course.vue Visa fil

52
   },
52
   },
53
 
53
 
54
   methods: {
54
   methods: {
55
-    // wen() {
56
-    //   this.$router.push({
57
-    //     name: 'Questionnaire',
58
-    //     params: { id: 'f5a47d178019bda33a370d7a6ed1e4c3' }
59
-    //   })
60
-    // },
61
-    // qian() {
62
-    //   this.$router.push({
63
-    //     name: 'SignIn',
64
-    //     params: { signId: '4ed7a69dc0df0e9132679d58a58fbf5a' }
65
-    //   })
66
-    // },
67
     goQuestion(courseId) {
55
     goQuestion(courseId) {
68
       this.$router.push({ name: 'ClassInfo', params: { courseId: courseId } })
56
       this.$router.push({ name: 'ClassInfo', params: { courseId: courseId } })
69
-      // this.$router.push('/Questionnaire')
57
+      // this.$router.push('/WriteText')
70
     },
58
     },
71
     parseTime, //时间格式化
59
     parseTime, //时间格式化
72
 
60
 

+ 7
- 5
src/views/UserCenter.vue Visa fil

54
           icon: require('@/assets/userImag/wenjuan.png'),
54
           icon: require('@/assets/userImag/wenjuan.png'),
55
           title: '我的收藏',
55
           title: '我的收藏',
56
           path: '/MyCollection'
56
           path: '/MyCollection'
57
+        },
58
+        // this.$router.push('/WriteText')
59
+
60
+        {
61
+          icon: require('@/assets/userImag/shoucang.png'),
62
+          title: '我的问卷',
63
+          path: '/WriteText'
57
         }
64
         }
58
-        // {
59
-        //   icon: require('@/assets/userImag/shoucang.png'),
60
-        //   title: '我的问卷',
61
-        //   path: '',
62
-        // }
63
       ]
65
       ]
64
     }
66
     }
65
   },
67
   },

+ 101
- 0
src/views/WriteText.vue Visa fil

1
+<template>
2
+  <div class="pcDemo">
3
+    <div class="actions">
4
+      <button class="clear" @click="handleClear">清空</button>
5
+      <!-- <button @click="handleUndo">撤销</button> -->
6
+      <button class="preview clear" @click="handlePreview">确定</button>
7
+      <!-- <button @click="handleColor">颜色</button> -->
8
+    </div>
9
+    <div class="tip">签名</div>
10
+    <canvas />
11
+  </div>
12
+</template>
13
+
14
+<script>
15
+import SmoothSignature from 'smooth-signature'
16
+export default {
17
+  name: 'pcDemo',
18
+  data() {
19
+    return {
20
+      openSmooth: true
21
+    }
22
+  },
23
+  mounted() {
24
+    this.init()
25
+  },
26
+  methods: {
27
+    init() {
28
+      const canvas = document.querySelector('canvas')
29
+      const options = {
30
+        width: Math.min(window.innerWidth, 1000) * 0.98,
31
+        height: 600,
32
+        minWidth: 4,
33
+        maxWidth: 12,
34
+        color: '#000',
35
+        bgColor: '#f6f6f6'
36
+      }
37
+      this.signature = new SmoothSignature(canvas, options)
38
+    },
39
+    handleClear() {
40
+      this.signature.clear()
41
+    },
42
+    handleUndo() {
43
+      this.signature.undo()
44
+    },
45
+    handleColor() {
46
+      this.signature.color = '#' + Math.random().toString(16).slice(-6)
47
+    },
48
+    // 验证canvas画布是否为空函数
49
+    isCanvasBlank(canvas) {
50
+      let isEmpty = this.signature.isEmpty()
51
+      return isEmpty
52
+    },
53
+
54
+    handlePreview() {
55
+      // var c = document.querySelector('canvas') // 获取html的canvas对象,我这个id="myCanvas"
56
+      if (this.isCanvasBlank()) {
57
+        // console.log('🚀 ~ file: WriteText.vue ~ line 66 ~ handlePreview ~ c', c)
58
+        alert('请在签名区域签名后再次确认')
59
+        return
60
+      } else {
61
+        var image = this.signature.toDataURL('image/jpeg') // 得到生成后的签名base64位  url 地址
62
+        console.log(image) // 打印图片base64 url
63
+      }
64
+    }
65
+  }
66
+}
67
+</script>
68
+
69
+<style lang="less" scoped >
70
+.pcDemo {
71
+  button {
72
+    width: 98%;
73
+    margin-right: 10px;
74
+    font-size: 18px;
75
+  }
76
+  canvas {
77
+    border: 2px dashed #ccc;
78
+    cursor: crosshair;
79
+  }
80
+  .actions {
81
+    width: 100vw;
82
+    text-align: center;
83
+    margin: 30px auto;
84
+    .clear {
85
+      width: 40vw;
86
+      height: 5vh;
87
+    }
88
+    // .preview {
89
+    //   width: 40vw;
90
+    //   height: 5vh;
91
+    // }
92
+  }
93
+  .tip {
94
+    color: #108eff;
95
+    margin: 0 auto;
96
+    width: 100vw;
97
+    text-align: center;
98
+    font-size: 20px;
99
+  }
100
+}
101
+</style>

+ 14648
- 384
yarn.lock
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil