signCommit.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="sign_commit">
  3. <nav-bar title="签署承诺书"></nav-bar>
  4. <!-- 考试疫情承诺书 -->
  5. <view 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 class="appointmentItem">
  20. <view class="title"><text class="star_red">*</text>签名板</view>
  21. <view class="dis_stys">
  22. <text v-if="reportStatus != 1" style="color: #999999">请在下方签名区进行签名</text>
  23. <text v-if="reportStatus != 1" @click="retDraw()" mode="">清空</text>
  24. </view>
  25. <view class="handCenter">
  26. <canvas
  27. v-if="reportStatus != 1"
  28. class="handWriting"
  29. disable-scroll="true"
  30. :catchtouchmove="true"
  31. @touchstart="uploadScaleStart"
  32. @touchmove="uploadScaleMove"
  33. @touchend="uploadScaleEnd"
  34. canvas-id="handWriting"
  35. ></canvas>
  36. <view
  37. v-else
  38. style="width: 100%; height: 100%; position: relative"
  39. >
  40. <image
  41. style="width: 100%; height: 100%"
  42. :src="$method.splitImgHost(reportFile)"
  43. mode=""
  44. ></image>
  45. </view>
  46. </view>
  47. </view>
  48. <view v-if="reportStatus != 1" class="finish_btn" @click="submits()">
  49. 完成签署
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import Handwriting from "@/common/signature.js";
  55. export default {
  56. name: 'sign_commit',
  57. data() {
  58. return {
  59. handwriting: '',
  60. lineColor: "black",
  61. slideValue: 30,
  62. commitment_electr_signature: '',
  63. isUploading: false,
  64. reportStatus: 0, // 是否线上签署疫情防控承诺书, 1是,0否
  65. baseAddress: '', // 签名转成base64
  66. reportFile: '', // 文件路径
  67. subscribeId: '',
  68. phone: '',
  69. }
  70. },
  71. onLoad(option) {
  72. console.log('option', option)
  73. const { reportStatus, reportFile, subscribeId, phone } = option
  74. this.reportStatus = reportStatus
  75. this.reportFile = reportFile
  76. this.subscribeId = subscribeId
  77. this.phone = phone
  78. },
  79. onReady(res) {
  80. this.handwriting = new Handwriting({
  81. lineColor: this.lineColor,
  82. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  83. canvasName: "handWriting",
  84. });
  85. },
  86. methods: {
  87. retDraw() {
  88. this.handwriting.retDraw()
  89. this.commitment_electr_signature = ''
  90. },
  91. uploadScaleStart(event) {
  92. this.handwriting.uploadScaleStart(event);
  93. },
  94. uploadScaleMove(event) {
  95. this.handwriting.uploadScaleMove(event);
  96. },
  97. uploadScaleEnd(event) {
  98. this.handwriting.uploadScaleEnd(event);
  99. },
  100. subCanvas() {
  101. return new Promise((resolve, reject) => {
  102. if (this.commitment_electr_signature) {
  103. resolve();
  104. return;
  105. }
  106. this.handwriting.saveCanvas().then((res) => {
  107. if (this.handwriting.linePrack.length) {
  108. console.log('签名-----res', res)
  109. this.commitment_electr_signature = res
  110. }
  111. resolve(res)
  112. })
  113. .catch((err) => {
  114. uni.showToast({
  115. title: "签名上传失败",
  116. icon: "error",
  117. });
  118. this.isUploading = false
  119. });
  120. });
  121. },
  122. async submits() {
  123. if (this.isUploading) {
  124. return;
  125. }
  126. this.isUploading = true
  127. await this.subCanvas()
  128. if (!this.commitment_electr_signature) {
  129. uni.showToast({
  130. title: "请签名",
  131. icon: "none",
  132. })
  133. this.isUploading = false
  134. return
  135. } else {
  136. if (this.commitment_electr_signature) {
  137. uni.request({
  138. url: this.commitment_electr_signature, //临时路径
  139. responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
  140. success: res => {
  141. const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
  142. console.log('sfs签名转成base64', base64)
  143. this.baseAddress = base64
  144. // return
  145. this.$http({
  146. url: '/apply/signReport',
  147. method: 'post',
  148. data: {
  149. signImageStr: this.baseAddress,
  150. subscribeId: this.subscribeId,
  151. }
  152. }).then((res) => {
  153. console.log('res', res)
  154. if (res.data.data == 200) {
  155. }
  156. })
  157. },
  158. fail: err => {
  159. console.log(err)
  160. }
  161. })
  162. this.isUploading = false
  163. }
  164. }
  165. },
  166. },
  167. }
  168. </script>
  169. <style>
  170. page {
  171. background-color: #eaeef1;
  172. }
  173. </style>
  174. <style lang="scss" scoped>
  175. .sign_commit {
  176. padding-bottom: 50rpx;
  177. .appointmentItem {
  178. margin: 24rpx 0 40rpx;
  179. .title {
  180. font-size: 30rpx;
  181. font-family: PingFang SC;
  182. font-weight: 500;
  183. color: #333333;
  184. line-height: 1;
  185. margin-bottom: 16rpx;
  186. padding-left: 24rpx;
  187. .star_red {
  188. color: red;
  189. }
  190. }
  191. .place {
  192. height: 80rpx;
  193. background: #ffffff;
  194. border-radius: 16rpx;
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: center;
  198. padding: 0 24rpx;
  199. }
  200. .commitment {
  201. padding: 12rpx;
  202. height: 900rpx;
  203. background: #ffffff;
  204. overflow-y: auto;
  205. }
  206. .handCenter, .dis_stys, .commitment {
  207. margin: 0rpx 24rpx;
  208. }
  209. .dis_stys {
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. margin-bottom: 16rpx;
  214. }
  215. .handCenter {
  216. width: 100%;
  217. height: 400rpx;
  218. .handWriting {
  219. width: 100%;
  220. height: 100%;
  221. background: #fff;
  222. }
  223. }
  224. }
  225. .finish_btn {
  226. // width: 100%;
  227. height: 90rpx;
  228. line-height: 90rpx;
  229. text-align: center;
  230. background-color:#1890ff;
  231. font-size: 32rpx;
  232. color: #fff;
  233. border-radius: 10rpx;
  234. margin: 20rpx 24rpx;
  235. }
  236. }
  237. </style>