| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- exports.ids = [3];
- exports.modules = {
- /***/ 161:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__);
- const instance = axios__WEBPACK_IMPORTED_MODULE_0___default.a.create({
- timeout: 15000,
- withCredentials: true
- }); // Add a request interceptor
- instance.interceptors.request.use(function (config) {
- // Do something before request is sent
- return config;
- }, function (error = {}) {
- console.log('request Error', error);
- return Promise.reject(error);
- }); // Add a response interceptor
- instance.interceptors.response.use(function (response) {
- // Do something with response data
- return response;
- }, function (error = {}) {
- console.log('response Error', error);
- return Promise.reject(error);
- });
- /* harmony default export */ __webpack_exports__["a"] = (instance);
- /***/ }),
- /***/ 207:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _plugins_axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(161);
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * author 赵越
- * 2018-11-04
- */
- /**
- *
- * @param {string} path 请求地址的 path
- * @param {string} data 请求实体
- * @param {object} payload 其他选项
- * @param {object} promise 返回一个 promise
- */
- const get = async (path, data, payload = {}) => {
- console.log('ajax get req:' + path);
- return await request('get', path, data, payload);
- };
- /**
- *
- * @param {string} path 请求地址的 path
- * @param {string} data 请求实体
- * @param {object} payload 其他选项
- * @param {object} promise 返回一个 promise
- */
- const post = async (path, data = {}, payload = {}) => {
- console.log('ajax req:' + path);
- let urlParams = [];
- console.log(data);
- for (const key in data) {
- if (data.hasOwnProperty(key)) {
- const element = encodeURIComponent(data[key]);
- urlParams.push(`${key}=${element}`);
- }
- }
- let formData = urlParams.join('&');
- let config = {
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
- }
- };
- if (payload.config && payload.config.headers) config.headers = { ...config.headers,
- ...payload.config.headers
- };
- return await request('post', path, formData, {
- config
- });
- };
- /**
- *
- * @param {method} method 请求方法
- * @param {string} path 请求地址的 path
- * @param {string} data 请求实体
- * @param {object} payload 其他选项
- * @param {object} promise 返回一个 promise
- */
- const request = async (method, path, data, payload = {}) => {
- let host = '';
- let url = host + path;
- let body = {
- url,
- data,
- method,
- params: data
- };
- if (payload.config) body = { ...body,
- ...payload.config,
- params: ''
- }; // Object.assign(body, payload.config, { params: '' })
- consoleFormat({
- body
- });
- const res = await _plugins_axios__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].request(body);
- let rData = res.data;
- if (typeof rData !== 'object') rData = JSON.parse(rData);
- consoleFormat({
- rData
- });
- if (rData.status === 1) return rData;else if ((rData.status === -99 || rData.status === '-99') && !payload.neverLogout) {
- // alert('not login ..');
- // const deviceType = getDeviceType();
- // alert('deviceType ..' + deviceType);
- // if (deviceType === 'ios' || deviceType === 'android') {
- // alert('redirect to login:' + 'proginn://login')
- // location.href = 'proginn://login'
- // } else {
- // location.href = 'https://www.proginn.com/?loginbox=show'
- // }
- return;
- } else {
- if (!payload.neverLogout) vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$message.error(rData.info || rData.error);
- return;
- }
- };
- const consoleFormat = obj => {
- const key = Object.keys(obj)[0];
- };
- vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$get = get;
- vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$post = post;
- vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$request = request; // let host = `https://dev.test.proginn.com`
- let host = `https://www.proginn.com`;
- /* unused harmony default export */ var _unused_webpack_default_export = ({
- get,
- post,
- request,
- host
- });
- /***/ }),
- /***/ 434:
- /***/ (function(module, exports) {
- // Exports
- module.exports = {};
- /***/ }),
- /***/ 490:
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__.p + "img/bg.83752a0.png";
- /***/ }),
- /***/ 738:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* 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);
- /* 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__);
- /* 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__));
- /* 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);
- /***/ }),
- /***/ 874:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // 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&
- 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>开发者个人主页 ></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)])}
- var staticRenderFns = []
- // CONCATENATED MODULE: ./pages/cert/no/_no.vue?vue&type=template&id=380c366c&scoped=true&
- // EXTERNAL MODULE: ./plugins/http.js
- var http = __webpack_require__(207);
- // EXTERNAL MODULE: ./assets/img/cert/bg.png
- var bg = __webpack_require__(490);
- // EXTERNAL MODULE: external "vuex"
- var external_vuex_ = __webpack_require__(2);
- // EXTERNAL MODULE: ./mixins/wx.js
- var wx = __webpack_require__(95);
- // 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&
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- let canvas = null;
- let ctx = null;
- let img = null;
- let interval = null;
- let qrLoaded = false;
- let imgLoaded = false;
- let detailLoaded = false;
- /* harmony default export */ var _novue_type_script_lang_js_ = ({
- async asyncData({
- $axios,
- params,
- req
- }) {
- let id = params.id;
- let headers = req && req.headers;
- let res = await $axios.$post(`/api/cert/getCertDetail`, {
- cert_no: params.no
- }, {
- headers
- });
- let detail = {};
- if (res) {
- detail = res.data;
- }
- return {
- detail
- };
- },
- head() {
- return {
- title: `${this.detail.name}证书-程序员客栈`
- };
- },
- mixins: [wx["a" /* default */]],
- data() {
- return {};
- },
- computed: {},
- mounted() {
- if (!this.detail.name) return;
- this.initCanvas();
- this.checkInfoFull();
- interval = setInterval(this.checkInfoFull, 500);
- },
- methods: {
- checkInfoFull() {
- this.$refs.qrImg.onload = () => qrLoaded = true;
- this.$refs.img.onload = () => imgLoaded = true;
- if (this.detail.uid) detailLoaded = true;
- if (qrLoaded && imgLoaded && detailLoaded) {
- this.fillingCanvas();
- clearInterval(interval);
- }
- },
- initCanvas() {
- canvas = this.$refs.canvas;
- ctx = canvas.getContext('2d');
- img = this.$refs.img;
- },
- fillingCanvas() {
- let detail = this.detail,
- canvasWidth = 850,
- textWidth = 0,
- text = ''; // 背景
- ctx.drawImage(img, 0, 0, 850, 520); // 证书英文名
- let englishName = detail.english_name.toUpperCase();
- ctx.font = '43px 微软雅黑';
- textWidth = ctx.measureText(englishName).width;
- ctx.save();
- ctx.fillStyle = 'rgb(44, 108, 195)';
- ctx.fillText(englishName, canvasWidth / 2 - textWidth / 2, 160); // 两条线
- let lineStartLeft = canvasWidth / 2 - textWidth / 2;
- ctx.beginPath();
- ctx.moveTo(lineStartLeft, 170);
- ctx.lineTo(textWidth + lineStartLeft, 170);
- ctx.moveTo(lineStartLeft, 174);
- ctx.lineTo(textWidth + lineStartLeft, 174);
- ctx.lineWidth = 1;
- ctx.strokeStyle = 'rgb(44, 108, 195)';
- ctx.stroke(); // 证书名
- let name = detail.name.toUpperCase();
- ctx.beginPath();
- ctx.font = '32px 微软雅黑';
- textWidth = ctx.measureText(name).width;
- ctx.fillText(name, canvasWidth / 2 - textWidth / 2, 220); // 真实姓名
- let realname = detail.realname || '测试';
- ctx.font = '43px 微软雅黑';
- textWidth = ctx.measureText(realname).width;
- ctx.restore();
- ctx.fillText(realname, canvasWidth / 2 - textWidth / 2, 290); // 用户信息
- let id = detail.uid,
- nickname = detail.nickname;
- ctx.font = '14px 微软雅黑';
- ctx.fillStyle = '#666';
- text = `ID ${id} | 昵称 ${nickname}`;
- textWidth = ctx.measureText(text).width;
- ctx.fillText(text, canvasWidth / 2 - textWidth / 2, 320); // 内容
- let content = detail.content;
- ctx.font = '16px 微软雅黑';
- ctx.fillStyle = '#000';
- textWidth = 660;
- let lineWidth = 0,
- fullWidth = 0;
- for (let i = 0; i < content.length; i++) {
- lineWidth += ctx.measureText(content[i]).width;
- if (lineWidth < textWidth) {
- ctx.fillText(content[i], canvasWidth / 2 - textWidth / 2 + lineWidth, 350);
- fullWidth = lineWidth;
- } else {
- ctx.fillText(content[i], canvasWidth / 2 + lineWidth - fullWidth - 76, 370);
- }
- } // 二维码
- let qr = detail.qr;
- ctx.drawImage(this.$refs.qrImg, 70, 380, 76, 76); // 证书编号
- let certNO = detail.cert_no;
- ctx.font = '12px 微软雅黑';
- ctx.fillStyle = '#666';
- ctx.fillText(`证书编号 ${certNO}`, 160, 410); // 起始时间
- let startDate = detail.start_date,
- endDate = detail.end_date,
- statusName = detail.cert_status_name;
- text = `有效时间 ${startDate} - ${endDate} ${statusName}`;
- ctx.font = '12px 微软雅黑';
- ctx.fillText(text, 160, 430); // 状态框
- let boxWidth = ctx.measureText(statusName).width + 10;
- ctx.rect(ctx.measureText(text).width - boxWidth + 165, 414, boxWidth, 22);
- ctx.stroke();
- }
- }
- });
- // CONCATENATED MODULE: ./pages/cert/no/_no.vue?vue&type=script&lang=js&
- /* harmony default export */ var no_novue_type_script_lang_js_ = (_novue_type_script_lang_js_);
- // EXTERNAL MODULE: ./node_modules/@nuxt/webpack/node_modules/vue-loader/lib/runtime/componentNormalizer.js
- var componentNormalizer = __webpack_require__(1);
- // CONCATENATED MODULE: ./pages/cert/no/_no.vue
- function injectStyles (context) {
-
- var style0 = __webpack_require__(738)
- if (style0.__inject__) style0.__inject__(context)
- }
- /* normalize component */
- var component = Object(componentNormalizer["a" /* default */])(
- no_novue_type_script_lang_js_,
- render,
- staticRenderFns,
- false,
- injectStyles,
- "380c366c",
- "5631b341"
-
- )
- /* harmony default export */ var _no = __webpack_exports__["default"] = (component.exports);
- /***/ }),
- /***/ 95:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony default export */ __webpack_exports__["a"] = ({
- mounted() {
- this.getWxConfig();
- },
- data() {
- return {
- // 详情id
- detailID: this.$route.params.detail
- };
- },
- methods: {
- /**
- * 获取微信配置
- */
- async getWxConfig() {
- let res = await this.$axios.$post(`/api/auth/get_wechat_js_api_conf`);
- this.$store.commit('updateWxConfig', {
- wxConfig: res.data || {}
- });
- if (this.configWx) this.configWx();
- }
- }
- });
- /***/ })
- };;
- //# sourceMappingURL=_no.js.map
|