signCommit.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="sign_commit">
  3. <nav-bar title="签署承诺书"></nav-bar>
  4. <!-- 考试疫情承诺书 -->
  5. <view v-if="reportStatus == 0" class="appointmentItem">
  6. <view class="title"><text class="star_red">*</text> 考试疫情承诺书</view>
  7. <view class="commitment">
  8. 本人参加“住房和城乡建设领域施工现场专业人员岗位”考试,愿意遵守疫情防控各项管理的相关要求,秉承对自己、对他人负责的原则,承担疫情防控社会责任,郑重作出以下承诺:<br/>
  9. 一、充分理解并遵守考试期间考点各项防疫安全的要求。<br/>
  10. 二、在考试前14天内,没有到过国内疫情中风险、高风险地区,未出境,不存在自境外回国情形。<br/>
  11. 三、在考试前14天内,每日自觉监测体温,体温均未出现高于37.3度的情形,无发热和呼吸道门诊就诊史。<br/>
  12. 四、在考试前14天内,未和新冠肺炎病例或疑似病例密切接触或间接接触,没有发烧、干咳、乏力、咳痰、气短、肌肉痛或关节痛、咽喉痛、头痛、寒颤、恶心或呕吐、鼻塞、腹泻、咳血、结膜充血等疑似新冠肺炎症状。<br/>
  13. 五、如出现与前述第二、三、四项任何一项不符的情形之一的,本人将及时在考前向相关管理机构报告,自觉配合采取隔离或其他防疫措施,并根据情况,自愿放弃参加考试。<br/>
  14. 六、考试当日自行做好防护工作,佩戴防护口罩。提前抵达考点,配合查验健康码、测量体温等。<br/>
  15. 七、考试期间,将严格遵守应考人员考场守则及疫情防控相关管理要求,完成考试后立即离场,不扎堆,不聚集。<br/>
  16. 八、本人承诺遵守《应考人员安全承诺书》中所有承诺内容,若因有瞒报、谎报造成新冠肺炎疫情传播的,一经查实,由本人承担相应的法律和经济责任。
  17. </view>
  18. </view>
  19. <view v-if="reportStatus == 0" class="appointmentItem">
  20. <view class="title"><text class="star_red">*</text>签名板</view>
  21. <view class="dis_stys">
  22. <text style="color: #999999">请在下方签名区进行签名</text>
  23. <text @click="retDraw()" mode="">清空</text>
  24. </view>
  25. <view class="handCenter">
  26. <canvas
  27. class="handWriting"
  28. disable-scroll="true"
  29. :catchtouchmove="true"
  30. @touchstart="uploadScaleStart"
  31. @touchmove="uploadScaleMove"
  32. @touchend="uploadScaleEnd"
  33. canvas-id="handWriting"
  34. ></canvas>
  35. </view>
  36. </view>
  37. <view v-if="reportStatus == 0" class="finish_btn" @click="submits()">
  38. 完成签署
  39. </view>
  40. <view
  41. v-if="reportStatus == 1"
  42. style="width: 100%; height: 100vh;"
  43. >
  44. <image
  45. style="width: 100%; height: 100%; display: block;"
  46. :src="$method.splitImgHost(reportFile)"
  47. mode=""
  48. ></image>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import Handwriting from "@/common/signature.js";
  54. export default {
  55. name: 'sign_commit',
  56. data() {
  57. return {
  58. handwriting: '',
  59. lineColor: "black",
  60. slideValue: 30,
  61. commitment_electr_signature: '',
  62. isUploading: false,
  63. reportStatus: 0, // 是否线上签署疫情防控承诺书, 1是,0否
  64. baseAddress: '', // 签名转成base64
  65. reportFile: '', // 文件路径
  66. subscribeId: '',
  67. phone: '',
  68. }
  69. },
  70. onLoad(option) {
  71. console.log('option', option)
  72. const { reportStatus, reportFile, subscribeId, phone } = option
  73. this.reportStatus = reportStatus
  74. this.reportFile = reportFile
  75. this.subscribeId = subscribeId
  76. this.phone = phone
  77. },
  78. onReady(res) {
  79. this.handwriting = new Handwriting({
  80. lineColor: this.lineColor,
  81. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  82. canvasName: "handWriting",
  83. });
  84. },
  85. methods: {
  86. retDraw() {
  87. this.handwriting.retDraw()
  88. this.commitment_electr_signature = ''
  89. },
  90. uploadScaleStart(event) {
  91. this.handwriting.uploadScaleStart(event);
  92. },
  93. uploadScaleMove(event) {
  94. this.handwriting.uploadScaleMove(event);
  95. },
  96. uploadScaleEnd(event) {
  97. this.handwriting.uploadScaleEnd(event);
  98. },
  99. subCanvas() {
  100. return new Promise((resolve, reject) => {
  101. if (this.commitment_electr_signature) {
  102. resolve();
  103. return;
  104. }
  105. this.handwriting.saveCanvas().then((res) => {
  106. if (this.handwriting.linePrack.length) {
  107. console.log('签名-----res', res)
  108. this.commitment_electr_signature = res
  109. }
  110. resolve(res)
  111. })
  112. .catch((err) => {
  113. uni.showToast({
  114. title: "签名上传失败",
  115. icon: "error",
  116. });
  117. this.isUploading = false
  118. });
  119. });
  120. },
  121. async submits() {
  122. if (this.isUploading) {
  123. return;
  124. }
  125. this.isUploading = true
  126. await this.subCanvas()
  127. if (!this.commitment_electr_signature) {
  128. uni.showToast({
  129. title: "请签名",
  130. icon: "none",
  131. })
  132. this.isUploading = false
  133. return
  134. } else {
  135. uni.getFileSystemManager().readFile({
  136. filePath: this.commitment_electr_signature, //临时路径
  137. encoding: 'base64', //编码格式
  138. success: res => {
  139. console.log('返回结果', res)
  140. const base64 = "data:image/png;base64," + res.data
  141. console.log('sfs签名转成base64', base64)
  142. this.baseAddress = base64
  143. // return
  144. this.$http({
  145. url: '/apply/signReport',
  146. method: 'post',
  147. data: {
  148. signImageStr: this.baseAddress,
  149. subscribeId: this.subscribeId,
  150. }
  151. }).then((res) => {
  152. console.log('res', res)
  153. if (res.data.code == 200) {
  154. this.$u.toast('签署成功')
  155. uni.navigateBack()
  156. } else {
  157. this.$u.toast(res.data.msg)
  158. }
  159. this.isUploading = false
  160. }).catch((err) => {
  161. this.$u.toast('签署失败,请重新签署')
  162. this.isUploading = false
  163. })
  164. },
  165. fail: err => {
  166. console.log('转base64错误', err)
  167. this.isUploading = false
  168. }
  169. })
  170. }
  171. },
  172. },
  173. }
  174. </script>
  175. <style>
  176. page {
  177. background-color: #eaeef1;
  178. }
  179. </style>
  180. <style lang="scss" scoped>
  181. .sign_commit {
  182. padding-bottom: 50rpx;
  183. .appointmentItem {
  184. margin: 24rpx 0 40rpx;
  185. .title {
  186. font-size: 30rpx;
  187. font-family: PingFang SC;
  188. font-weight: 500;
  189. color: #333333;
  190. line-height: 1;
  191. margin-bottom: 16rpx;
  192. padding-left: 24rpx;
  193. .star_red {
  194. color: red;
  195. }
  196. }
  197. .place {
  198. height: 80rpx;
  199. background: #ffffff;
  200. border-radius: 16rpx;
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. padding: 0 24rpx;
  205. }
  206. .commitment {
  207. padding: 12rpx;
  208. height: 900rpx;
  209. background: #ffffff;
  210. overflow-y: auto;
  211. }
  212. .handCenter, .dis_stys, .commitment {
  213. margin: 0rpx 24rpx;
  214. }
  215. .dis_stys {
  216. display: flex;
  217. justify-content: space-between;
  218. align-items: center;
  219. margin-bottom: 16rpx;
  220. }
  221. .handCenter {
  222. // width: 100%;
  223. height: 400rpx;
  224. .handWriting {
  225. width: 100%;
  226. height: 100%;
  227. background: #fff;
  228. }
  229. }
  230. }
  231. .finish_btn {
  232. // width: 100%;
  233. height: 90rpx;
  234. line-height: 90rpx;
  235. text-align: center;
  236. background-color:#1890ff;
  237. font-size: 32rpx;
  238. color: #fff;
  239. border-radius: 10rpx;
  240. margin: 20rpx 24rpx;
  241. }
  242. }
  243. </style>