1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view>
- <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left"
- ref="inputForm">
- <u-form-item label="旧签名" borderBottom prop="signPic">
- <u--image :showLoading="true" :src="BASE_URL + inputForm.signPic " width="100px" height="40px"></u--image>
- </u-form-item>
- <u-form-item label="签字" borderBottom prop="signPic">
- <signInput ref="sign" canvasId="twoDrowCanvas" canvasIds="twoRotateCanvas" :header="header"
- :action="action" @signToUrl="signToUrl">
- </signInput>
- </u-form-item>
- <view class="padding-xl">
- <u-button type="primary" @click="formSubmit" text="提交"></u-button>
- </view>
- </u--form>
- </view>
- </template>
- <script>
- import userService from "@/api/sys/userService"
- import * as $auth from "@/common/auth.js"
- import BASE_URL from '@/config.js'
- import signInput from "@/components/am-sign-input/am-sign-input.vue"
- export default {
- components:{
- signInput
- },
- data() {
- return {
- action: this.BASE_URL + '/gwfile/upload?uploadPath=sign', //上传服务器的地址
- header: {"token": $auth.getUserToken()}, //图片上传携带头部信息
- loading: false,
- inputForm: this.$auth.getUserInfo()
- }
- },
- methods: {
- /**
- * @param {Object} e
- * 签名完成回调
- */
- signToUrl(e) {
- console.log("签字=====", e);
- this.inputForm.signPic = e.data
- if (e.error_code && e.error_code === '201') {
- uni.showToast({
- title: e.msg,
- icon: 'none'
- })
- return
- }
- },
- formSubmit: function(e) {
- //定义表单规则
- // this.$refs.inputForm.validate().then(res => {
- uni.showLoading()
- userService.saveInfo(this.inputForm).then((data) => {
- uni.showToast({
- title: data,
- icon: "success"
- });
- uni.clearStorage();
- uni.reLaunch({
- url: '/pages/login/login'
- })
- // }).catch((e) => {
- // console.log(e)
- // })
- })
- }
- }
- }
- </script>
- <style>
- .btn-logout {
- margin-top: 100upx;
- width: 80%;
- border-radius: 50upx;
- font-size: 16px;
- color: #fff;
- background: linear-gradient(to right, #365fff, #36bbff);
- }
- .btn-logout-hover {
- background: linear-gradient(to right, #365fdd, #36bbfa);
- }
- .cu-form-group .title {
- min-width: calc(4em + 40px);
- }
- </style>
|