index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div >
  3. <div class="main-content">
  4. <div class="img-box">
  5. <img src="../../../assets/logo/logo2.png" alt="广东省教师继续教育学会">
  6. </div>
  7. <div style="text-align: center;line-height: 50px;">
  8. <span class="main-title" style="margin: 0 10px;font-weight: bold;" >会员、理事证书、聘书查询</span>
  9. </div>
  10. <div>
  11. <div class="label-box">
  12. <div class="label-title">
  13. <p>持证人姓名</p>
  14. <p>(或持证单位全称)</p>
  15. </div>
  16. <input type="text" v-model="userName" class="label-input" />
  17. </div>
  18. <div class="label-box">
  19. <div class="label-title">
  20. <p>证书编码</p>
  21. </div>
  22. <input type="text" v-model="certNumber" class="label-input" />
  23. </div>
  24. <div class="label-box">
  25. <div class="label-title">
  26. <p>验证码<span class="label-must">*</span></p>
  27. </div>
  28. <input type="text" v-model="code" class="label-input" style="border-color:#acb1b5"/>
  29. <div class="captcha-img">
  30. <img :src="codeUrl" @click="getCode" class="login-code-img"/>
  31. </div>
  32. </div>
  33. <div class="btn-box">
  34. <button class="btn-reset">重置</button>
  35. <button class="btn-search" @click="handleSearch" v-bind:disabled="iconShow">
  36. 查询<i class="el-icon-loading" v-show="iconShow"></i>
  37. </button>
  38. </div>
  39. </div>
  40. </div>
  41. <!-- <div style="position:fixed;top:-900px;left:-500px">
  42. <div id="pdfDomm" ref="posterWrap" >
  43. <div class="proBox" >
  44. <img class="proBox-img" :src="data.url" >
  45. <div class="con" >
  46. <span class="con-name heiti">{{data.name}}</span>
  47. <span>{{data.certContent}}</span>
  48. </div>
  49. <span class="foot-term" :style="{bottom:'+data.top+'+'px'}">{{data.validTerm}}</span>
  50. <span class="foot-cert">{{data.certId}}</span>
  51. <span class="foot-date">{{data.issueDate}}</span>
  52. </div>
  53. </div>
  54. <el-button type="primary" @click="getPdf('#pdfDomm')" ref="download">下载</el-button>
  55. </div> -->
  56. <el-dialog
  57. title="证书预览和下载"
  58. :visible.sync="dialogVisible"
  59. width="fit-content"
  60. :before-close="handleClose"
  61. >
  62. <!-- :before-close="handleClose" -->
  63. <div id="pdfDom" ref="posterWrap">
  64. <div class="proBox" >
  65. <!-- :style="{backgroundImage:'url('+data.imgurl+')'}" -->
  66. <img class="proBox-img" :src="data.url" >
  67. <div class="con" >
  68. <span class="con-name heiti">{{data.name}}</span>
  69. <span>{{data.certContent}}</span>
  70. </div>
  71. <span class="foot-term">{{data.validTerm}}</span>
  72. <span class="foot-cert">{{data.certId}}</span>
  73. <span class="foot-date">{{data.issueDate}}</span>
  74. </div>
  75. </div>
  76. <span slot="footer" class="dialog-footer">
  77. <el-button @click="handleClose">取 消</el-button>
  78. <el-button type="primary" @click="getPdf('#pdfDom')">下载</el-button>
  79. </span>
  80. </el-dialog>
  81. </div>
  82. </template>
  83. <script>
  84. import { getCodeImg,checkCode} from "@/api/login";
  85. import { getCert } from "@/api/system/contract";
  86. export default {
  87. data() {
  88. return {
  89. pic:require('@/assets/certback/appiontment_page-0001.jpg'),
  90. userName: "",
  91. certNumber: "",
  92. code: "",
  93. codeUrl:"",
  94. captchaEnabled:true,
  95. uuid:"",
  96. dialogVisible: false,
  97. iconShow:false,
  98. dist:"cert_b_type",
  99. pageData: null, //接收html格式代码
  100. htmlTitle: "结业证书",
  101. isShow: true,
  102. isCanvas: false,
  103. downType: false, // false为 pdf , true为图片
  104. data:{
  105. certContent: null,
  106. certId: "221231hhh13",
  107. certMajor: 1,
  108. certType: 1,
  109. code: "666666666666666",
  110. createBy: null,
  111. createTime: null,
  112. email: "littlegreen55@163.com",
  113. id: 4,
  114. issueDate: "2022-11-28",
  115. name: "张晓翠",
  116. phone: "16329009990",
  117. remark: null,
  118. updateBy: null,
  119. updateDate: null,
  120. updateTime: null,
  121. validTerm: "22222222"
  122. }
  123. };
  124. },
  125. methods:{
  126. getCode() {
  127. getCodeImg().then(res => {
  128. // console.log(res)
  129. this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
  130. if (this.captchaEnabled) {
  131. this.codeUrl = "data:image/gif;base64," + res.img;
  132. this.uuid = res.uuid;
  133. }
  134. this.iconShow = false
  135. });
  136. },
  137. async handleSearch(){
  138. this.iconShow = true
  139. if( this.isBlock(this.userName)){
  140. this.iconShow = false
  141. this.$message.error("请输入持证人姓名或单位名称!")
  142. return;
  143. }
  144. if( this.isBlock(this.certNumber)){
  145. this.iconShow = false
  146. this.$message.error("请输入证书编码!")
  147. return;
  148. }
  149. if( this.isBlock(this.code)){
  150. this.iconShow = false
  151. this.$message.error("请输入验证码!")
  152. return;
  153. }
  154. const form = {
  155. userName: this.userName,
  156. certNumber: this.certNumber,
  157. }
  158. const codeForm = {
  159. code: this.code,
  160. uuid: this.uuid
  161. }
  162. try{
  163. let codeRes = await checkCode(codeForm)
  164. if(codeRes.code===200){
  165. try{
  166. getCert(form).then(res=>{
  167. this.iconShow = false
  168. this.data = res.data
  169. let img = this.realUrl(this.data.url)
  170. this.htmlTitle = this.data.name
  171. this.data.url = img
  172. this.dialogVisible = true
  173. })
  174. setTimeout(()=>{
  175. if(this.iconShow){
  176. this.iconShow = false
  177. }
  178. },10000)
  179. }catch(error){
  180. this.iconShow = false
  181. this.getCode()
  182. }
  183. }
  184. }catch(err){
  185. this.iconShow = false
  186. this.getCode()
  187. }
  188. },
  189. isBlock(str){
  190. if(str===""){
  191. return true
  192. }else {
  193. return false
  194. }
  195. },
  196. handleClose(){
  197. // console.log("beforeClose")
  198. this.getCode()
  199. this.dialogVisible = false
  200. },
  201. realUrl(val){
  202. return process.env.VUE_APP_BASE_API + val
  203. }
  204. },
  205. mounted(){
  206. this.getCode()
  207. },
  208. destroyed(){
  209. // removeToken()
  210. }
  211. };
  212. </script>
  213. <style lang="scss" scoped>
  214. </style>