新增的手写模块
This commit is contained in:
parent
535081b7d2
commit
091594bec7
|
|
@ -1,76 +1,66 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view style="width: 750rpx; height: 750rpx">
|
||||||
<button @tap="authVerification">请选择位置</button>
|
<l-signature
|
||||||
<template v-if="currentLocation.address">
|
ref="signatureRef"
|
||||||
<div>name:{{ currentLocation.name }}</div>
|
:openSmooth="openSmooth"
|
||||||
<div>address:{{ currentLocation.address }}</div>
|
:penColor="penColor"
|
||||||
<div>latitude:{{ currentLocation.latitude }}</div>
|
:penSize="penSize"
|
||||||
<div>longitude:{{ currentLocation.longitude }}</div>
|
disableScroll
|
||||||
</template>
|
></l-signature>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<button @click="onClick('clear')">清空</button>
|
||||||
|
<button @click="onClick('undo')">撤消</button>
|
||||||
|
<button @click="onClick('save')">保存</button>
|
||||||
|
<button @click="onClick('openSmooth')">压感{{ openSmooth ? '开' : '关' }}</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getCurrentInstance, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mounted() {
|
|
||||||
console.log('uvUI 可用性:', !!this.$uv)
|
|
||||||
console.log('debounce 方法:', !!this.$uv?.debounce)
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentLocation: {},
|
title: 'Hello',
|
||||||
|
penColor: 'red',
|
||||||
|
penSize: 5,
|
||||||
|
url: '',
|
||||||
|
openSmooth: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
|
||||||
uni.getStorage({
|
|
||||||
key: 'currentLocation',
|
|
||||||
success: res => {
|
|
||||||
this.currentLocation = res.data
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
authVerification() {
|
onClick(type) {
|
||||||
uni.getSetting({
|
if (type == 'openSmooth') {
|
||||||
success: res => {
|
this.openSmooth = !this.openSmooth
|
||||||
if (res.authSetting['scope.userLocation']) {
|
return
|
||||||
/* 用户授权成功时走这里 */
|
}
|
||||||
this.handerChooseLocation()
|
if (type == 'save') {
|
||||||
} else if (res.authSetting['scope.userLocation'] === undefined) {
|
this.$refs.signatureRef.canvasToTempFilePath({
|
||||||
/* 用户未授权时走这里 */
|
success: res => {
|
||||||
console.log('没有授权')
|
// 是否为空画板 无签名
|
||||||
this.handleOpenSetting()
|
console.log(res.isEmpty)
|
||||||
} else {
|
// 生成图片的临时路径
|
||||||
/* 用户拒绝了授权后走这里 */
|
// H5 生成的是base64
|
||||||
console.log('拒绝了授权 false')
|
this.url = res.tempFilePath
|
||||||
this.handleOpenSetting()
|
console.log(res.tempFilePath)
|
||||||
}
|
// uni.saveImageToPhotosAlbum({
|
||||||
},
|
// filePath: res.tempFilePath,
|
||||||
})
|
// success: () => {
|
||||||
},
|
// uni.showToast({ title: '已保存到相册' })
|
||||||
handerChooseLocation(latitude, longitude) {
|
// },
|
||||||
uni.chooseLocation({
|
// })
|
||||||
latitude: latitude || '',
|
uni.previewImage({
|
||||||
longitude: longitude || '',
|
urls: [res.tempFilePath],
|
||||||
success: res => {
|
current: 0,
|
||||||
console.log('wx.chooseLocation res=', res)
|
})
|
||||||
uni.setStorageSync('currentLocation', res)
|
},
|
||||||
},
|
})
|
||||||
fail: function (err) {
|
return
|
||||||
console.log('取消按钮', err)
|
}
|
||||||
},
|
if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
|
||||||
})
|
|
||||||
},
|
|
||||||
handleOpenSetting() {
|
|
||||||
wx.openSetting({
|
|
||||||
success: res => {
|
|
||||||
console.log('定位 openSetting', res)
|
|
||||||
if (res.authSetting['scope.userLocation']) {
|
|
||||||
this.handerChooseLocation()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss"></style>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const ENV_CONFIG = {
|
||||||
// 正式版
|
// 正式版
|
||||||
// baseUrl: 'https://chu.chuangtewl.com/prod-api',
|
// baseUrl: 'https://chu.chuangtewl.com/prod-api',
|
||||||
// baseUrl: 'http://192.168.2.88:4601',
|
// baseUrl: 'http://192.168.2.88:4601',
|
||||||
baseUrl: 'http://192.168.2.88:4601',
|
baseUrl: 'http://192.168.2.21:4601',
|
||||||
appId: 1,
|
appId: 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user