_no.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. exports.ids = [3];
  2. exports.modules = {
  3. /***/ 161:
  4. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5. "use strict";
  6. /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
  7. /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__);
  8. const instance = axios__WEBPACK_IMPORTED_MODULE_0___default.a.create({
  9. timeout: 15000,
  10. withCredentials: true
  11. }); // Add a request interceptor
  12. instance.interceptors.request.use(function (config) {
  13. // Do something before request is sent
  14. return config;
  15. }, function (error = {}) {
  16. console.log('request Error', error);
  17. return Promise.reject(error);
  18. }); // Add a response interceptor
  19. instance.interceptors.response.use(function (response) {
  20. // Do something with response data
  21. return response;
  22. }, function (error = {}) {
  23. console.log('response Error', error);
  24. return Promise.reject(error);
  25. });
  26. /* harmony default export */ __webpack_exports__["a"] = (instance);
  27. /***/ }),
  28. /***/ 207:
  29. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  30. "use strict";
  31. /* harmony import */ var _plugins_axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(161);
  32. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
  33. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__);
  34. /**
  35. * author 赵越
  36. * 2018-11-04
  37. */
  38. /**
  39. *
  40. * @param {string} path 请求地址的 path
  41. * @param {string} data 请求实体
  42. * @param {object} payload 其他选项
  43. * @param {object} promise 返回一个 promise
  44. */
  45. const get = async (path, data, payload = {}) => {
  46. console.log('ajax get req:' + path);
  47. return await request('get', path, data, payload);
  48. };
  49. /**
  50. *
  51. * @param {string} path 请求地址的 path
  52. * @param {string} data 请求实体
  53. * @param {object} payload 其他选项
  54. * @param {object} promise 返回一个 promise
  55. */
  56. const post = async (path, data = {}, payload = {}) => {
  57. console.log('ajax req:' + path);
  58. let urlParams = [];
  59. console.log(data);
  60. for (const key in data) {
  61. if (data.hasOwnProperty(key)) {
  62. const element = encodeURIComponent(data[key]);
  63. urlParams.push(`${key}=${element}`);
  64. }
  65. }
  66. let formData = urlParams.join('&');
  67. let config = {
  68. headers: {
  69. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  70. }
  71. };
  72. if (payload.config && payload.config.headers) config.headers = { ...config.headers,
  73. ...payload.config.headers
  74. };
  75. return await request('post', path, formData, {
  76. config
  77. });
  78. };
  79. /**
  80. *
  81. * @param {method} method 请求方法
  82. * @param {string} path 请求地址的 path
  83. * @param {string} data 请求实体
  84. * @param {object} payload 其他选项
  85. * @param {object} promise 返回一个 promise
  86. */
  87. const request = async (method, path, data, payload = {}) => {
  88. let host = '';
  89. let url = host + path;
  90. let body = {
  91. url,
  92. data,
  93. method,
  94. params: data
  95. };
  96. if (payload.config) body = { ...body,
  97. ...payload.config,
  98. params: ''
  99. }; // Object.assign(body, payload.config, { params: '' })
  100. consoleFormat({
  101. body
  102. });
  103. const res = await _plugins_axios__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].request(body);
  104. let rData = res.data;
  105. if (typeof rData !== 'object') rData = JSON.parse(rData);
  106. consoleFormat({
  107. rData
  108. });
  109. if (rData.status === 1) return rData;else if ((rData.status === -99 || rData.status === '-99') && !payload.neverLogout) {
  110. // alert('not login ..');
  111. // const deviceType = getDeviceType();
  112. // alert('deviceType ..' + deviceType);
  113. // if (deviceType === 'ios' || deviceType === 'android') {
  114. // alert('redirect to login:' + 'proginn://login')
  115. // location.href = 'proginn://login'
  116. // } else {
  117. // location.href = 'https://www.proginn.com/?loginbox=show'
  118. // }
  119. return;
  120. } else {
  121. if (!payload.neverLogout) vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$message.error(rData.info || rData.error);
  122. return;
  123. }
  124. };
  125. const consoleFormat = obj => {
  126. const key = Object.keys(obj)[0];
  127. };
  128. vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$get = get;
  129. vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$post = post;
  130. vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$request = request; // let host = `https://dev.test.proginn.com`
  131. let host = `https://www.proginn.com`;
  132. /* unused harmony default export */ var _unused_webpack_default_export = ({
  133. get,
  134. post,
  135. request,
  136. host
  137. });
  138. /***/ }),
  139. /***/ 434:
  140. /***/ (function(module, exports) {
  141. // Exports
  142. module.exports = {};
  143. /***/ }),
  144. /***/ 490:
  145. /***/ (function(module, exports, __webpack_require__) {
  146. module.exports = __webpack_require__.p + "img/bg.83752a0.png";
  147. /***/ }),
  148. /***/ 738:
  149. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  150. "use strict";
  151. __webpack_require__.r(__webpack_exports__);
  152. /* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_nuxt_webpack_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_1_node_modules_nuxt_webpack_node_modules_vue_loader_lib_index_js_vue_loader_options_no_vue_vue_type_style_index_0_id_380c366c_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(434);
  153. /* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_nuxt_webpack_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_1_node_modules_nuxt_webpack_node_modules_vue_loader_lib_index_js_vue_loader_options_no_vue_vue_type_style_index_0_id_380c366c_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_nuxt_webpack_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_1_node_modules_nuxt_webpack_node_modules_vue_loader_lib_index_js_vue_loader_options_no_vue_vue_type_style_index_0_id_380c366c_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  154. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_nuxt_webpack_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_1_node_modules_nuxt_webpack_node_modules_vue_loader_lib_index_js_vue_loader_options_no_vue_vue_type_style_index_0_id_380c366c_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_nuxt_webpack_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_1_node_modules_nuxt_webpack_node_modules_vue_loader_lib_index_js_vue_loader_options_no_vue_vue_type_style_index_0_id_380c366c_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  155. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_nuxt_webpack_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_3_oneOf_1_1_node_modules_nuxt_webpack_node_modules_vue_loader_lib_index_js_vue_loader_options_no_vue_vue_type_style_index_0_id_380c366c_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  156. /***/ }),
  157. /***/ 874:
  158. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  159. "use strict";
  160. // ESM COMPAT FLAG
  161. __webpack_require__.r(__webpack_exports__);
  162. // CONCATENATED MODULE: ./node_modules/@nuxt/webpack/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@nuxt/webpack/node_modules/vue-loader/lib??vue-loader-options!./pages/cert/no/_no.vue?vue&type=template&id=380c366c&scoped=true&
  163. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"cert-id"},[_vm._ssrNode("<section class=\"cert-id-box\" data-v-380c366c>","</section>",[(_vm.detail.name)?[_vm._ssrNode("<h1 data-v-380c366c>"+_vm._ssrEscape(_vm._s(_vm.detail.name)+"证书")+"</h1> <div class=\"hr\" data-v-380c366c></div> <canvas width=\"850\" height=\"520\" class=\"canvas\" data-v-380c366c>对不起, 您的浏览器不支持绘图功能, 请更新浏览器.</canvas> <img"+(_vm._ssrAttr("src",__webpack_require__(490)))+" alt=\"img\" class=\"img\" data-v-380c366c> <img"+(_vm._ssrAttr("src",("/api/cert/certQrCode?uid=" + (_vm.detail.uid))))+" alt=\"qrImg\" class=\"img\" data-v-380c366c> "),_vm._ssrNode("<section class=\"links\" data-v-380c366c>","</section>",[_vm._ssrNode("<a"+(_vm._ssrAttr("href",_vm.detail.seo_uri))+" class=\"link\" data-v-380c366c>开发者个人主页 &gt;</a> <br data-v-380c366c> "),_c('nuxt-link',{staticClass:"link",attrs:{"to":("/cert/type/" + (_vm.detail.cert_id))}},[_vm._v(_vm._s(_vm.detail.name)+"认证标准 >")])],2)]:_vm._ssrNode(("<h1 data-v-380c366c>未查询到证书</h1>"))],2)])}
  164. var staticRenderFns = []
  165. // CONCATENATED MODULE: ./pages/cert/no/_no.vue?vue&type=template&id=380c366c&scoped=true&
  166. // EXTERNAL MODULE: ./plugins/http.js
  167. var http = __webpack_require__(207);
  168. // EXTERNAL MODULE: ./assets/img/cert/bg.png
  169. var bg = __webpack_require__(490);
  170. // EXTERNAL MODULE: external "vuex"
  171. var external_vuex_ = __webpack_require__(2);
  172. // EXTERNAL MODULE: ./mixins/wx.js
  173. var wx = __webpack_require__(95);
  174. // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/webpack/node_modules/vue-loader/lib??vue-loader-options!./pages/cert/no/_no.vue?vue&type=script&lang=js&
  175. //
  176. //
  177. //
  178. //
  179. //
  180. //
  181. //
  182. //
  183. //
  184. //
  185. //
  186. //
  187. //
  188. //
  189. //
  190. //
  191. //
  192. //
  193. //
  194. //
  195. let canvas = null;
  196. let ctx = null;
  197. let img = null;
  198. let interval = null;
  199. let qrLoaded = false;
  200. let imgLoaded = false;
  201. let detailLoaded = false;
  202. /* harmony default export */ var _novue_type_script_lang_js_ = ({
  203. async asyncData({
  204. $axios,
  205. params,
  206. req
  207. }) {
  208. let id = params.id;
  209. let headers = req && req.headers;
  210. let res = await $axios.$post(`/api/cert/getCertDetail`, {
  211. cert_no: params.no
  212. }, {
  213. headers
  214. });
  215. let detail = {};
  216. if (res) {
  217. detail = res.data;
  218. }
  219. return {
  220. detail
  221. };
  222. },
  223. head() {
  224. return {
  225. title: `${this.detail.name}证书-程序员客栈`
  226. };
  227. },
  228. mixins: [wx["a" /* default */]],
  229. data() {
  230. return {};
  231. },
  232. computed: {},
  233. mounted() {
  234. if (!this.detail.name) return;
  235. this.initCanvas();
  236. this.checkInfoFull();
  237. interval = setInterval(this.checkInfoFull, 500);
  238. },
  239. methods: {
  240. checkInfoFull() {
  241. this.$refs.qrImg.onload = () => qrLoaded = true;
  242. this.$refs.img.onload = () => imgLoaded = true;
  243. if (this.detail.uid) detailLoaded = true;
  244. if (qrLoaded && imgLoaded && detailLoaded) {
  245. this.fillingCanvas();
  246. clearInterval(interval);
  247. }
  248. },
  249. initCanvas() {
  250. canvas = this.$refs.canvas;
  251. ctx = canvas.getContext('2d');
  252. img = this.$refs.img;
  253. },
  254. fillingCanvas() {
  255. let detail = this.detail,
  256. canvasWidth = 850,
  257. textWidth = 0,
  258. text = ''; // 背景
  259. ctx.drawImage(img, 0, 0, 850, 520); // 证书英文名
  260. let englishName = detail.english_name.toUpperCase();
  261. ctx.font = '43px 微软雅黑';
  262. textWidth = ctx.measureText(englishName).width;
  263. ctx.save();
  264. ctx.fillStyle = 'rgb(44, 108, 195)';
  265. ctx.fillText(englishName, canvasWidth / 2 - textWidth / 2, 160); // 两条线
  266. let lineStartLeft = canvasWidth / 2 - textWidth / 2;
  267. ctx.beginPath();
  268. ctx.moveTo(lineStartLeft, 170);
  269. ctx.lineTo(textWidth + lineStartLeft, 170);
  270. ctx.moveTo(lineStartLeft, 174);
  271. ctx.lineTo(textWidth + lineStartLeft, 174);
  272. ctx.lineWidth = 1;
  273. ctx.strokeStyle = 'rgb(44, 108, 195)';
  274. ctx.stroke(); // 证书名
  275. let name = detail.name.toUpperCase();
  276. ctx.beginPath();
  277. ctx.font = '32px 微软雅黑';
  278. textWidth = ctx.measureText(name).width;
  279. ctx.fillText(name, canvasWidth / 2 - textWidth / 2, 220); // 真实姓名
  280. let realname = detail.realname || '测试';
  281. ctx.font = '43px 微软雅黑';
  282. textWidth = ctx.measureText(realname).width;
  283. ctx.restore();
  284. ctx.fillText(realname, canvasWidth / 2 - textWidth / 2, 290); // 用户信息
  285. let id = detail.uid,
  286. nickname = detail.nickname;
  287. ctx.font = '14px 微软雅黑';
  288. ctx.fillStyle = '#666';
  289. text = `ID ${id} | 昵称 ${nickname}`;
  290. textWidth = ctx.measureText(text).width;
  291. ctx.fillText(text, canvasWidth / 2 - textWidth / 2, 320); // 内容
  292. let content = detail.content;
  293. ctx.font = '16px 微软雅黑';
  294. ctx.fillStyle = '#000';
  295. textWidth = 660;
  296. let lineWidth = 0,
  297. fullWidth = 0;
  298. for (let i = 0; i < content.length; i++) {
  299. lineWidth += ctx.measureText(content[i]).width;
  300. if (lineWidth < textWidth) {
  301. ctx.fillText(content[i], canvasWidth / 2 - textWidth / 2 + lineWidth, 350);
  302. fullWidth = lineWidth;
  303. } else {
  304. ctx.fillText(content[i], canvasWidth / 2 + lineWidth - fullWidth - 76, 370);
  305. }
  306. } // 二维码
  307. let qr = detail.qr;
  308. ctx.drawImage(this.$refs.qrImg, 70, 380, 76, 76); // 证书编号
  309. let certNO = detail.cert_no;
  310. ctx.font = '12px 微软雅黑';
  311. ctx.fillStyle = '#666';
  312. ctx.fillText(`证书编号 ${certNO}`, 160, 410); // 起始时间
  313. let startDate = detail.start_date,
  314. endDate = detail.end_date,
  315. statusName = detail.cert_status_name;
  316. text = `有效时间 ${startDate} - ${endDate} ${statusName}`;
  317. ctx.font = '12px 微软雅黑';
  318. ctx.fillText(text, 160, 430); // 状态框
  319. let boxWidth = ctx.measureText(statusName).width + 10;
  320. ctx.rect(ctx.measureText(text).width - boxWidth + 165, 414, boxWidth, 22);
  321. ctx.stroke();
  322. }
  323. }
  324. });
  325. // CONCATENATED MODULE: ./pages/cert/no/_no.vue?vue&type=script&lang=js&
  326. /* harmony default export */ var no_novue_type_script_lang_js_ = (_novue_type_script_lang_js_);
  327. // EXTERNAL MODULE: ./node_modules/@nuxt/webpack/node_modules/vue-loader/lib/runtime/componentNormalizer.js
  328. var componentNormalizer = __webpack_require__(1);
  329. // CONCATENATED MODULE: ./pages/cert/no/_no.vue
  330. function injectStyles (context) {
  331. var style0 = __webpack_require__(738)
  332. if (style0.__inject__) style0.__inject__(context)
  333. }
  334. /* normalize component */
  335. var component = Object(componentNormalizer["a" /* default */])(
  336. no_novue_type_script_lang_js_,
  337. render,
  338. staticRenderFns,
  339. false,
  340. injectStyles,
  341. "380c366c",
  342. "5631b341"
  343. )
  344. /* harmony default export */ var _no = __webpack_exports__["default"] = (component.exports);
  345. /***/ }),
  346. /***/ 95:
  347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  348. "use strict";
  349. /* harmony default export */ __webpack_exports__["a"] = ({
  350. mounted() {
  351. this.getWxConfig();
  352. },
  353. data() {
  354. return {
  355. // 详情id
  356. detailID: this.$route.params.detail
  357. };
  358. },
  359. methods: {
  360. /**
  361. * 获取微信配置
  362. */
  363. async getWxConfig() {
  364. let res = await this.$axios.$post(`/api/auth/get_wechat_js_api_conf`);
  365. this.$store.commit('updateWxConfig', {
  366. wxConfig: res.data || {}
  367. });
  368. if (this.configWx) this.configWx();
  369. }
  370. }
  371. });
  372. /***/ })
  373. };;
  374. //# sourceMappingURL=_no.js.map