index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. <el-dialog
  42. title="证书预览和下载"
  43. :visible.sync="dialogVisible"
  44. width="fit-content"
  45. :before-close="handleClose"
  46. >
  47. <!-- :before-close="handleClose" -->
  48. <div id="pdfDom" ref="posterWrap">
  49. <div class="proBox" >
  50. <!-- :style="{backgroundImage:'url('+data.imgurl+')'}" -->
  51. <img class="proBox-img" :src="data.url" >
  52. <!-- < <p class="tit">{{data.title}}</p>
  53. <p class="proid"><span>编号:</span> <span>xxjj2021412</span></p> -->
  54. <div class="con" >
  55. <span class="con-name">{{data.name}}</span>
  56. <span>{{data.certContent}}</span>
  57. </div>
  58. <span class="foot-term" :style="{bottom:'+data.top+'+'px'}">{{data.validTerm}}</span>
  59. <span class="foot-cert">{{data.certId}}</span>
  60. <span class="foot-date">{{data.issueDate}}</span>
  61. <!-- <p class="con">特发此证。</p>
  62. <div class="con-unit">
  63. <p>广东省教师继续教育学会</p>
  64. </div> -->
  65. <!-- <div class="con-footer">
  66. <p>广东省教师继续教育学会证书查询:</p>
  67. <p>请关注学会微信公众号“粤师继教”(gqisjxjyxh)查询</p>
  68. </div> -->
  69. <!-- <div class="cert-msg">
  70. <p>证书编号:{{data.d_code}}</p>
  71. <p>发证时间:{{data.issue_date}}</p>
  72. </div> -->
  73. </div>
  74. <!-- <img :src="imgUrl" > -->
  75. </div>
  76. <span slot="footer" class="dialog-footer">
  77. <!-- <el-checkbox v-model="isShow" style="margin-right: 20px;">添加盖章</el-checkbox> -->
  78. <el-button @click="handleClose">取 消</el-button>
  79. <!-- <el-button type="primary" @click="makePoster">下载</el-button> bnm,.//.,mnbvcx
  80. -->
  81. <el-button type="primary" @click="getPdf('#pdfDom')">下载</el-button>
  82. </span>
  83. </el-dialog>
  84. </div>
  85. </template>
  86. <script>
  87. import { getCodeImg,checkCode} from "@/api/login";
  88. import { getCert } from "@/api/system/contract";
  89. export default {
  90. data() {
  91. return {
  92. pic:require('@/assets/certback/appiontment_page-0001.jpg'),
  93. userName: "",
  94. certNumber: "",
  95. code: "",
  96. codeUrl:"",
  97. captchaEnabled:true,
  98. uuid:"",
  99. dialogVisible: false,
  100. iconShow:false,
  101. dist:"cert_b_type",
  102. pageData: null, //接收html格式代码
  103. htmlTitle: "结业证书",
  104. isShow: true,
  105. isCanvas: false,
  106. downType: false, // false为 pdf , true为图片
  107. data:{
  108. certContent: null,
  109. certId: "221231hhh13",
  110. certMajor: 1,
  111. certType: 1,
  112. code: "666666666666666",
  113. createBy: null,
  114. createTime: null,
  115. email: "littlegreen55@163.com",
  116. id: 4,
  117. issueDate: "2022-11-28",
  118. name: "张晓翠",
  119. phone: "16329009990",
  120. remark: null,
  121. updateBy: null,
  122. updateDate: null,
  123. updateTime: null,
  124. validTerm: "22222222"
  125. },
  126. majorData:[],
  127. };
  128. },
  129. methods:{
  130. getCode() {
  131. getCodeImg().then(res => {
  132. // console.log(res)
  133. this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
  134. if (this.captchaEnabled) {
  135. this.codeUrl = "data:image/gif;base64," + res.img;
  136. this.uuid = res.uuid;
  137. }
  138. this.iconShow = false
  139. });
  140. },
  141. async handleSearch(){
  142. this.iconShow = true
  143. if( this.isBlock(this.userName)){
  144. this.iconShow = false
  145. this.$message.error("请输入持证人姓名或单位名称!")
  146. return;
  147. }
  148. if( this.isBlock(this.certNumber)){
  149. this.iconShow = false
  150. this.$message.error("请输入证书编码!")
  151. return;
  152. }
  153. if( this.isBlock(this.code)){
  154. this.iconShow = false
  155. this.$message.error("请输入验证码!")
  156. return;
  157. }
  158. const form = {
  159. userName: this.userName,
  160. certNumber: this.certNumber,
  161. }
  162. const codeForm = {
  163. code: this.code,
  164. uuid: this.uuid
  165. }
  166. try{
  167. let codeRes = await checkCode(codeForm)
  168. if(codeRes.code===200){
  169. try{
  170. getCert(form).then(res=>{
  171. this.iconShow = false
  172. this.data = res.data
  173. let img = this.realUrl(this.data.url)
  174. this.htmlTitle = this.data.name
  175. this.data.url = img
  176. this.dialogVisible = true
  177. // console.log(host)
  178. })
  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>