diff --git a/App.vue b/App.vue index 8f20c16..9a66f58 100644 --- a/App.vue +++ b/App.vue @@ -43,23 +43,21 @@ onHide(() => { function getUserInfo() { lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({ - appId: 'qdsrgznrgpp', // 接入方在成功创建应用后自动生成 + appId: config.appInfo.loveShandong, // 接入方在成功创建应用后自动生成 success: function (data) { if (data == '未登录') onLoginApp(); else { if (typeof data == 'string') data = JSON.parse(data); - - const sm2_privateKey = '7e14966df4ecd4241ed082ef716d82b52113cb5899ebdc704a98844d0a32b0dc'; + const sm2_privateKey = config.appInfo.sm2PrivateKey; let sm2_encrypt_result = data.data; let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, sm2_privateKey); - + console.log(sm2_decrypt_result); if (typeof sm2_decrypt_result == 'string') sm2_decrypt_result = JSON.parse(sm2_decrypt_result); // 其次,对sm2解密后的结果进行 aes解密 // aes解密需要用到 appword , 为固定值,使用示例代码中的即可 let aes_encrypt_result = sm2_decrypt_result.data; let aes_decrypt_result = aes_Decrypt(aes_encrypt_result, appword); - // 加密 loginCallback(aes_decrypt_result); } diff --git a/common/globalFunction.js b/common/globalFunction.js index e67a461..a4bf4bd 100644 --- a/common/globalFunction.js +++ b/common/globalFunction.js @@ -1,3 +1,4 @@ +import '@/lib/encryption/sm4.min.js' import useUserStore from "../stores/useUserStore"; import { createRequest, @@ -7,9 +8,6 @@ import streamRequest, { chatRequest } from "../utils/streamRequest.js"; -const sm4 = typeof window.sm4 !== 'undefined' ? window.sm4 : - (typeof window.smCrypto !== 'undefined' ? window.smCrypto.sm4 : null); - export const CloneDeep = (props) => { if (typeof props !== 'object' || props === null) { return props @@ -564,7 +562,6 @@ function aes_Decrypt(word, key) { }) return decrypt.toString(CryptoJS.enc.Utf8) } - export function sm2_Decrypt(word, key) { return SM.decrypt(word, key); } @@ -588,7 +585,7 @@ export function sm4Decrypt(key, value, mode = "hex") { return decrypted } catch (e) { - console.log('解密失败') + console.log('解密失败', e) } } diff --git a/components/renderCompanyCollectionRecord/renderCompanyCollectionRecord.vue b/components/renderCompanyCollectionRecord/renderCompanyCollectionRecord.vue new file mode 100644 index 0000000..e07ec8c --- /dev/null +++ b/components/renderCompanyCollectionRecord/renderCompanyCollectionRecord.vue @@ -0,0 +1,157 @@ + + + + + \ No newline at end of file diff --git a/components/renderCompanys/renderCompanys.vue b/components/renderCompanys/renderCompanys.vue index 5a1456d..1234a2d 100644 --- a/components/renderCompanys/renderCompanys.vue +++ b/components/renderCompanys/renderCompanys.vue @@ -130,4 +130,4 @@ function nextDetail(company) { .ris{ font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif; } - + \ No newline at end of file diff --git a/components/renderCompanysOutData/renderCompanysOutData.vue b/components/renderCompanysOutData/renderCompanysOutData.vue new file mode 100644 index 0000000..87f22fa --- /dev/null +++ b/components/renderCompanysOutData/renderCompanysOutData.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/components/renderDeliveryRecord/renderDeliveryRecord.vue b/components/renderDeliveryRecord/renderDeliveryRecord.vue new file mode 100644 index 0000000..07967ef --- /dev/null +++ b/components/renderDeliveryRecord/renderDeliveryRecord.vue @@ -0,0 +1,201 @@ + + + + + \ No newline at end of file diff --git a/components/renderJobCollectionRecord/renderJobCollectionRecord.vue b/components/renderJobCollectionRecord/renderJobCollectionRecord.vue new file mode 100644 index 0000000..c1f6888 --- /dev/null +++ b/components/renderJobCollectionRecord/renderJobCollectionRecord.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/components/renderJobViewRecord/renderJobViewRecord.vue b/components/renderJobViewRecord/renderJobViewRecord.vue new file mode 100644 index 0000000..111a610 --- /dev/null +++ b/components/renderJobViewRecord/renderJobViewRecord.vue @@ -0,0 +1,201 @@ + + + + + \ No newline at end of file diff --git a/components/renderJobs/renderJobs.vue b/components/renderJobs/renderJobs.vue index 08372b6..c2d0623 100644 --- a/components/renderJobs/renderJobs.vue +++ b/components/renderJobs/renderJobs.vue @@ -7,7 +7,7 @@ - {{ job.companyName }} + {{ job.gwmc }} @@ -77,7 +77,7 @@ function nextDetail(job) { const recordData = recommedIndexDb.JobParameter(job); recommedIndexDb.addRecord(recordData); } - navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`); + navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}&dataType=1`); } diff --git a/components/renderJobsOutData/renderJobsOutData.vue b/components/renderJobsOutData/renderJobsOutData.vue new file mode 100644 index 0000000..ba50080 --- /dev/null +++ b/components/renderJobsOutData/renderJobsOutData.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/config.js b/config.js index 9d75c81..6b16e54 100644 --- a/config.js +++ b/config.js @@ -1,8 +1,7 @@ export default { // baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网 baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试 - // baseUrl: "http://192.168.98.110:18181", - // baseUrl: "http://192.168.3.19:8080", + // baseUrl: 'http://192.168.3.29:8081', // sseAI+ // StreamBaseURl: 'http://39.98.44.136:8000', StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai', @@ -22,6 +21,10 @@ export default { appInfo: { // 应用名称 name: "青岛市就业服务", + // 爱山东应用标识 + loveShandong: 'szjxrgznqzzp', + // 爱山东应用Key + sm2PrivateKey: '0d152c849f10e4469f2af8cedea62004e4f1db7be23c2f7270c1441d8050799d', // 地区名 areaName: '青岛市', // AI名称 diff --git a/index.html b/index.html index a8102dd..0a4ef1f 100644 --- a/index.html +++ b/index.html @@ -24,19 +24,13 @@ - - - + - - - - - + - -
- + +
+ \ No newline at end of file diff --git a/lib/encryption/sm2.min.js b/lib/encryption/sm2.min.js new file mode 100644 index 0000000..51e2e8e --- /dev/null +++ b/lib/encryption/sm2.min.js @@ -0,0 +1,7 @@ +/** + * Skipped minification because the original files appears to be already minified. + * Original file: /npm/sm-crypto@0.3.13/dist/sm2.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.sm2=r():t.sm2=r()}("undefined"!=typeof self?self:this,function(){return function(t){function r(e){if(i[e])return i[e].exports;var n=i[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var i={};return r.m=t,r.c=i,r.d=function(t,i,e){r.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:e})},r.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(i,"a",i),i},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=2)}([function(t,r,i){(function(){function i(t,r,i){null!=t&&("number"==typeof t?this.fromNumber(t,r,i):null==r&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,r))}function e(){return new i(null)}function n(t,r,i,e,n,o){for(;--o>=0;){var s=r*this[t++]+i[e]+n;n=Math.floor(s/67108864),i[e++]=67108863&s}return n}function o(t,r,i,e,n,o){for(var s=32767&r,u=r>>15;--o>=0;){var h=32767&this[t],a=this[t++]>>15,f=u*h+a*s;h=s*h+((32767&f)<<15)+i[e]+(1073741823&n),n=(h>>>30)+(f>>>15)+u*a+(n>>>30),i[e++]=1073741823&h}return n}function s(t,r,i,e,n,o){for(var s=16383&r,u=r>>14;--o>=0;){var h=16383&this[t],a=this[t++]>>14,f=u*h+a*s;h=s*h+((16383&f)<<14)+i[e]+n,n=(h>>28)+(f>>14)+u*a,i[e++]=268435455&h}return n}function u(t){return pr.charAt(t)}function h(t,r){var i=vr[t.charCodeAt(r)];return null==i?-1:i}function a(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s}function f(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function l(t){var r=e();return r.fromInt(t),r}function c(t,r){var e;if(16==r)e=4;else if(8==r)e=3;else if(256==r)e=8;else if(2==r)e=1;else if(32==r)e=5;else{if(4!=r)return void this.fromRadix(t,r);e=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var u=8==e?255&t[n]:h(t,n);u<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=u:s+e>this.DB?(this[this.t-1]|=(u&(1<>this.DB-s):this[this.t-1]|=u<=this.DB&&(s-=this.DB))}8==e&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function v(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(16==t)r=4;else if(8==t)r=3;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return this.toRadix(t);r=2}var i,e=(1<0)for(h>h)>0&&(n=!0,o=u(i));s>=0;)h>(h+=this.DB-r)):(i=this[s]>>(h-=r)&e,h<=0&&(h+=this.DB,--s)),i>0&&(n=!0),n&&(o+=u(i));return n?o:"0"}function y(){var t=e();return i.ZERO.subTo(this,t),t}function m(){return this.s<0?this.negate():this}function d(t){var r=this.s-t.s;if(0!=r)return r;var i=this.t;if(0!=(r=i-t.t))return this.s<0?-r:r;for(;--i>=0;)if(0!=(r=this[i]-t[i]))return r;return 0}function g(t){var r,i=1;return 0!=(r=t>>>16)&&(t=r,i+=16),0!=(r=t>>8)&&(t=r,i+=8),0!=(r=t>>4)&&(t=r,i+=4),0!=(r=t>>2)&&(t=r,i+=2),0!=(r=t>>1)&&(t=r,i+=1),i}function T(){return this.t<=0?0:this.DB*(this.t-1)+g(this[this.t-1]^this.s&this.DM)}function F(t,r){var i;for(i=this.t-1;i>=0;--i)r[i+t]=this[i];for(i=t-1;i>=0;--i)r[i]=0;r.t=this.t+t,r.s=this.s}function b(t,r){for(var i=t;i=0;--i)r[i+s+1]=this[i]>>n|u,u=(this[i]&o)<=0;--i)r[i]=0;r[s]=u,r.t=this.t+s+1,r.s=this.s,r.clamp()}function B(t,r){r.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)return void(r.t=0);var e=t%this.DB,n=this.DB-e,o=(1<>e;for(var s=i+1;s>e;e>0&&(r[this.t-i-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;e+=this.s}else{for(e+=this.s;i>=this.DB;e-=t.s}r.s=e<0?-1:0,e<-1?r[i++]=this.DV+e:e>0&&(r[i++]=e),r.t=i,r.clamp()}function D(t,r){var e=this.abs(),n=t.abs(),o=e.t;for(r.t=o+n.t;--o>=0;)r[o]=0;for(o=0;o=0;)t[i]=0;for(i=0;i=r.DV&&(t[i+r.t]-=r.DV,t[i+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(i,r[i],t,2*i,0,1)),t.s=0,t.clamp()}function q(t,r,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(f,u),s.lShiftTo(f,n)):(o.copyTo(u),s.copyTo(n));var l=u.t,c=u[l-1];if(0!=c){var p=c*(1<1?u[l-2]>>this.F2:0),v=this.FV/p,y=(1<=0&&(n[n.t++]=1,n.subTo(F,n)),i.ONE.dlShiftTo(l,F),F.subTo(u,u);u.t=0;){var b=n[--d]==c?this.DM:Math.floor(n[d]*v+(n[d-1]+m)*y);if((n[d]+=u.am(0,b,n,T,0,l))0&&n.rShiftTo(f,n),h<0&&i.ZERO.subTo(n,n)}}}function S(t){var r=e();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(i.ZERO)>0&&t.subTo(r,r),r}function E(t){this.m=t}function A(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function P(t){return t}function O(t){t.divRemTo(this.m,null,t)}function R(t,r,i){t.multiplyTo(r,i),this.reduce(i)}function M(t,r){t.squareTo(r),this.reduce(r)}function C(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var r=3&t;return r=r*(2-(15&t)*r)&15,r=r*(2-(255&t)*r)&255,r=r*(2-((65535&t)*r&65535))&65535,r=r*(2-t*r%this.DV)%this.DV,r>0?this.DV-r:-r}function H(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(r,r),r}function V(t){var r=e();return t.copyTo(r),this.reduce(r),r}function N(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r>15)*this.mpl&this.um)<<15)&t.DM;for(i=r+this.m.t,t[i]+=this.m.am(0,e,t,r,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function j(t,r){t.squareTo(r),this.reduce(r)}function L(t,r,i){t.multiplyTo(r,i),this.reduce(i)}function z(){return 0==(this.t>0?1&this[0]:this.s)}function K(t,r){if(t>4294967295||t<1)return i.ONE;var n=e(),o=e(),s=r.convert(this),u=g(t)-1;for(s.copyTo(n);--u>=0;)if(r.sqrTo(n,o),(t&1<0)r.mulTo(o,s,n);else{var h=n;n=o,o=h}return r.revert(n)}function Z(t,r){var i;return i=t<256||r.isEven()?new E(r):new H(r),this.exp(t,i)}function U(){var t=e();return this.copyTo(t),t}function _(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function Y(){return 0==this.t?this.s:this[0]<<16>>16}function G(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function J(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function Q(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var r=this.chunkSize(t),i=Math.pow(t,r),n=l(i),o=e(),s=e(),u="";for(this.divRemTo(n,o,s);o.signum()>0;)u=(i+s.intValue()).toString(t).substr(1)+u,o.divRemTo(n,o,s);return s.intValue().toString(t)+u}function W(t,r){this.fromInt(0),null==r&&(r=10);for(var e=this.chunkSize(r),n=Math.pow(r,e),o=!1,s=0,u=0,a=0;a=e&&(this.dMultiply(n),this.dAddOffset(u,0),s=0,u=0))}s>0&&(this.dMultiply(Math.pow(r,s)),this.dAddOffset(u,0)),o&&i.ZERO.subTo(this,this)}function $(t,r,e){if("number"==typeof r)if(t<2)this.fromInt(1);else for(this.fromNumber(t,e),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),ut,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),r.nextBytes(n),o>0?n[0]&=(1<0)for(e>e)!=(this.s&this.DM)>>e&&(r[n++]=i|this.s<=0;)e<8?(i=(this[t]&(1<>(e+=this.DB-8)):(i=this[t]>>(e-=8)&255,e<=0&&(e+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(r[n++]=i);return r}function rt(t){return 0==this.compareTo(t)}function it(t){return this.compareTo(t)<0?this:t}function et(t){return this.compareTo(t)>0?this:t}function nt(t,r,i){var e,n,o=Math.min(t.t,this.t);for(e=0;e>=16,r+=16),0==(255&t)&&(t>>=8,r+=8),0==(15&t)&&(t>>=4,r+=4),0==(3&t)&&(t>>=2,r+=2),0==(1&t)&&++r,r}function dt(){for(var t=0;t=this.t?0!=this.s:0!=(this[r]&1<>=this.DB;if(t.t>=this.DB;e+=this.s}else{for(e+=this.s;i>=this.DB;e+=t.s}r.s=e<0?-1:0,e>0?r[i++]=e:e<-1&&(r[i++]=this.DV+e),r.t=i,r.clamp()}function It(t){var r=e();return this.addTo(t,r),r}function qt(t){var r=e();return this.subTo(t,r),r}function St(t){var r=e();return this.multiplyTo(t,r),r}function Et(){var t=e();return this.squareTo(t),t}function At(t){var r=e();return this.divRemTo(t,r,null),r}function Pt(t){var r=e();return this.divRemTo(t,null,r),r}function Ot(t){var r=e(),i=e();return this.divRemTo(t,r,i),new Array(r,i)}function Rt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Mt(t,r){if(0!=t){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}}function Ct(){}function Ht(t){return t}function kt(t,r,i){t.multiplyTo(r,i)}function Vt(t,r){t.squareTo(r)}function Nt(t){return this.exp(t,new Ct)}function jt(t,r,i){var e=Math.min(this.t+t.t,r);for(i.s=0,i.t=e;e>0;)i[--e]=0;var n;for(n=i.t-this.t;e=0;)i[e]=0;for(e=Math.max(r-this.t,0);e2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var r=e();return t.copyTo(r),this.reduce(r),r}function Zt(t){return t}function Ut(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function _t(t,r){t.squareTo(r),this.reduce(r)}function Xt(t,r,i){t.multiplyTo(r,i),this.reduce(i)}function Yt(t,r){var i,n,o=t.bitLength(),s=l(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new E(r):r.isEven()?new zt(r):new H(r);var u=new Array,h=3,a=i-1,f=(1<1){var c=e();for(n.sqrTo(u[1],c);h<=f;)u[h]=e(),n.mulTo(c,u[h-2],u[h]),h+=2}var p,v,y=t.t-1,m=!0,d=e();for(o=g(t[y])-1;y>=0;){for(o>=a?p=t[y]>>o-a&f:(p=(t[y]&(1<0&&(p|=t[y-1]>>this.DB+o-a)),h=i;0==(1&p);)p>>=1,--h;if((o-=h)<0&&(o+=this.DB,--y),m)u[p].copyTo(s),m=!1;else{for(;h>1;)n.sqrTo(s,d),n.sqrTo(d,s),h-=2;h>0?n.sqrTo(s,d):(v=s,s=d,d=v),n.mulTo(d,u[p],s)}for(;y>=0&&0==(t[y]&1<0&&(r.rShiftTo(o,r),i.rShiftTo(o,i));r.signum()>0;)(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),r.compareTo(i)>=0?(r.subTo(i,r),r.rShiftTo(1,r)):(i.subTo(r,i),i.rShiftTo(1,i));return o>0&&i.lShiftTo(o,i),i}function Jt(t){if(t<=0)return 0;var r=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==r)i=this[0]%t;else for(var e=this.t-1;e>=0;--e)i=(r*i+this[e])%t;return i}function Qt(t){var r=t.isEven();if(this.isEven()&&r||0==t.signum())return i.ZERO;for(var e=t.clone(),n=this.clone(),o=l(1),s=l(0),u=l(0),h=l(1);0!=e.signum();){for(;e.isEven();)e.rShiftTo(1,e),r?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),r?(u.isEven()&&h.isEven()||(u.addTo(this,u),h.subTo(t,h)),u.rShiftTo(1,u)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);e.compareTo(n)>=0?(e.subTo(n,e),r&&o.subTo(u,o),s.subTo(h,s)):(n.subTo(e,n),r&&u.subTo(o,u),h.subTo(s,h))}return 0!=n.compareTo(i.ONE)?i.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h}function Wt(t){var r,i=this.abs();if(1==i.t&&i[0]<=yr[yr.length-1]){for(r=0;r>1)>yr.length&&(t=yr.length);for(var s=e(),u=0;u>8&255,gr[Tr++]^=t>>16&255,gr[Tr++]^=t>>24&255,Tr>=Br&&(Tr-=Br)}function rr(){tr((new Date).getTime())}function ir(){if(null==dr){for(rr(),dr=hr(),dr.init(gr),Tr=0;Tr>>8,gr[Tr++]=255&Fr;Tr=0,rr()}nr.prototype.nextBytes=er,or.prototype.init=sr,or.prototype.next=ur;var Br=256;r=t.exports={default:i,BigInteger:i,SecureRandom:nr}}).call(this)},function(t,r,i){"use strict";function e(t){if(Array.isArray(t)){for(var r=0,i=Array(t.length);r>>32-i}function o(t,r){for(var i=[],e=t.length-1;e>=0;e--)i[e]=255&(t[e]^r[e]);return i}function s(t){return t^n(t,9)^n(t,17)}function u(t){return t^n(t,15)^n(t,23)}function h(t){var r=8*t.length,i=r%512;i=i>=448?512-i%448-1:448-i-1;for(var o=new Array((i-7)/8),h=new Array(8),a=0,c=o.length;a=0;y--)if(r.length>8){var m=r.length-8;h[y]=parseInt(r.substr(m),2),r=r.substr(0,m)}else r.length>0&&(h[y]=parseInt(r,2),r="");for(var d=new Uint8Array([].concat(e(t),[128],o,h)),g=new DataView(d.buffer,0),T=d.length/64,F=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),b=0;b=0&&N<=15?2043430169:2055708042,M=n(n(I,12)+A+n(V,N),7),C=M^n(I,12),H=(N>=0&&N<=15?I^q^S:I&q|I&S|q&S)+E+C+l[N],k=(N>=0&&N<=15?A^P^O:A&P|~A&O)+R+M+f[N],E=S,S=n(q,9),q=I,I=H,R=O,O=n(P,19),P=A,A=s(k);F[0]^=I,F[1]^=q,F[2]^=S,F[3]^=E,F[4]^=A,F[5]^=P,F[6]^=O,F[7]^=R}for(var j=[],L=0,z=F.length;L>>24,(16711680&K)>>>16,(65280&K)>>>8,255&K)}return j}function a(t,r){for(r.length>c&&(r=h(r));r.length2&&void 0!==arguments[2]?arguments[2]:1;t="string"==typeof t?m.hexToArray(m.utf8ToHex(t)):Array.prototype.slice.call(t),r=m.getGlobalCurve().decodePointHex(r);var n=m.generateKeyPairHex(),o=new c(n.privateKey,16),s=n.publicKey;s.length>128&&(s=s.substr(s.length-128));var u=r.multiply(o),h=m.hexToArray(m.leftPad(u.getX().toBigInteger().toRadix(16),64)),a=m.hexToArray(m.leftPad(u.getY().toBigInteger().toRadix(16),64)),f=m.arrayToHex(d([].concat(h,t,a))),l=1,p=0,v=[],y=[].concat(h,a),g=function(){v=d([].concat(e(y),[l>>24&255,l>>16&255,l>>8&255,255&l])),l++,p=0};g();for(var T=0,F=t.length;T2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.output,s=void 0===o?"string":o;r=new c(r,16);var u=t.substr(128,64),h=t.substr(192);i===w&&(u=t.substr(t.length-64),h=t.substr(128,t.length-128-64));var a=m.hexToArray(h),f=m.getGlobalCurve().decodePointHex("04"+t.substr(0,128)),l=f.multiply(r),p=m.hexToArray(m.leftPad(l.getX().toBigInteger().toRadix(16),64)),v=m.hexToArray(m.leftPad(l.getY().toBigInteger().toRadix(16),64)),y=1,g=0,T=[],F=[].concat(p,v),b=function(){T=d([].concat(e(F),[y>>24&255,y>>16&255,y>>8&255,255&y])),y++,g=0};b();for(var B=0,x=a.length;B2&&void 0!==arguments[2]?arguments[2]:{},e=i.pointPool,n=i.der,o=i.hash,s=i.publicKey,u=i.userId,l="string"==typeof t?m.utf8ToHex(t):m.arrayToHex(t);o&&(s=s||a(r),l=h(l,s,u));var p=new c(r,16),y=new c(l,16),d=null,g=null,T=null;do{do{var F=void 0;F=e&&e.length?e.pop():f(),d=F.k,g=y.add(F.x1).mod(b)}while(g.equals(c.ZERO)||g.add(d).equals(b));T=p.add(c.ONE).modInverse(b).multiply(d.subtract(g.multiply(p))).mod(b)}while(T.equals(c.ZERO));return n?v(g,T):m.leftPad(g.toString(16),64)+m.leftPad(T.toString(16),64)}function u(t,r,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=e.der,o=e.hash,s=e.userId,u="string"==typeof t?m.utf8ToHex(t):m.arrayToHex(t);o&&(u=h(u,i,s));var a=void 0,f=void 0;if(n){var l=y(r);a=l.r,f=l.s}else a=new c(r.substring(0,64),16),f=new c(r.substring(64),16);var p=F.decodePointHex(i),v=new c(u,16),d=a.add(f).mod(b);if(d.equals(c.ZERO))return!1;var g=T.multiply(f).add(p.multiply(d)),w=v.add(g.getX().toBigInteger()).mod(b);return a.equals(w)}function h(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1234567812345678";i=m.utf8ToHex(i);var e=m.leftPad(T.curve.a.toBigInteger().toRadix(16),64),n=m.leftPad(T.curve.b.toBigInteger().toRadix(16),64),o=m.leftPad(T.getX().toBigInteger().toRadix(16),64),s=m.leftPad(T.getY().toBigInteger().toRadix(16),64),u=void 0,h=void 0;if(128===r.length)u=r.substr(0,64),h=r.substr(64,64);else{var a=T.curve.decodePointHex(r);u=m.leftPad(a.getX().toBigInteger().toRadix(16),64),h=m.leftPad(a.getY().toBigInteger().toRadix(16),64)}var f=m.hexToArray(i+e+n+o+s+u+h),l=4*i.length;f.unshift(255&l),f.unshift(l>>8&255);var c=d(f);return m.arrayToHex(d(c.concat(m.hexToArray(t))))}function a(t){var r=T.multiply(new c(t,16));return"04"+m.leftPad(r.getX().toBigInteger().toString(16),64)+m.leftPad(r.getY().toBigInteger().toString(16),64)}function f(){var t=m.generateKeyPairHex(),r=F.decodePointHex(t.publicKey);return t.k=new c(t.privateKey,16),t.x1=r.getX().toBigInteger(),t}var l=i(0),c=l.BigInteger,p=i(3),v=p.encodeDer,y=p.decodeDer,m=i(4),d=i(1).sm3,g=m.generateEcparam(),T=g.G,F=g.curve,b=g.n,w=0;t.exports={generateKeyPairHex:m.generateKeyPairHex,compressPublicKeyHex:m.compressPublicKeyHex,comparePublicKeyHex:m.comparePublicKeyHex,doEncrypt:n,doDecrypt:o,doSignature:s,doVerifySignature:u,getPublicKeyFromPrivateKey:a,getPoint:f,verifyPublicKey:m.verifyPublicKey}},function(t,r,i){"use strict";function e(t,r){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?t:r}function n(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(t,r):t.__proto__=r)}function o(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function s(t){var r=t.toString(16);if("-"!==r[0])r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{r=r.substr(1);var i=r.length;i%2==1?i+=1:r.match(/^[0-7]/)||(i+=2);for(var e="",n=0;n>>2]|=(255&t.charCodeAt(e))<<24-e%4*8;for(var n=[],o=0;o>>2]>>>24-o%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")}function h(t,r){return t.length>=r?t:new Array(r-t.length+1).join("0")+t}function a(t){return t.map(function(t){return t=t.toString(16),1===t.length?"0"+t:t}).join("")}function f(t){for(var r=[],i=0,e=0;e<2*t.length;e+=2)r[e>>>3]|=parseInt(t[i],10)<<24-e%8*4,i++;try{for(var n=[],o=0;o>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(s))}return decodeURIComponent(escape(n.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}}function l(t){var r=[],i=t.length;i%2!=0&&(t=h(t,i+1)),i=t.length;for(var e=0;e0;n--){e=e.twice();var o=r.testBit(n);o!==t.testBit(n)&&(e=e.add(o?this:i))}return e}}]),t}(),l=function(){function t(r,i,n){e(this,t),this.q=r,this.a=this.fromBigInteger(i),this.b=this.fromBigInteger(n),this.infinity=new f(this,null,null)}return n(t,[{key:"equals",value:function(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}},{key:"fromBigInteger",value:function(t){return new a(this.q,t)}},{key:"decodePointHex",value:function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var r=this.fromBigInteger(new s(t.substr(2),16)),i=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new s("4")).add(s.ONE),this.q));return i.toBigInteger().mod(u).equals(new s(t.substr(0,2),16).subtract(u))||(i=i.negate()),new f(this,r,i);case 4:case 6:case 7:var e=(t.length-2)/2,n=t.substr(2,e),o=t.substr(e+2,e);return new f(this,this.fromBigInteger(new s(n,16)),this.fromBigInteger(new s(o,16)));default:return null}}}]),t}();t.exports={ECPointFp:f,ECCurveFp:l}}])}); \ No newline at end of file diff --git a/static/js/sm4.min.js b/lib/encryption/sm4.min.js similarity index 100% rename from static/js/sm4.min.js rename to lib/encryption/sm4.min.js diff --git a/main.js b/main.js index 8ae9e2a..5255af7 100644 --- a/main.js +++ b/main.js @@ -12,6 +12,12 @@ import SelectPopup from '@/components/selectPopup/selectPopup.vue' import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin'; import RenderJobs from '@/components/renderJobs/renderJobs.vue'; import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue'; +import RenderJobsOutData from '@/components/renderJobsOutData/renderJobsOutData.vue'; +import RenderCompanysOutData from '@/components/renderCompanysOutData/renderCompanysOutData.vue'; +import renderDeliveryRecord from '@/components/renderDeliveryRecord/renderDeliveryRecord.vue'; +import renderJobCollectionRecord from '@/components/renderJobCollectionRecord/renderJobCollectionRecord.vue'; +import renderCompanyCollectionRecord from '@/components/renderCompanyCollectionRecord/renderCompanyCollectionRecord.vue'; +import renderJobViewRecord from '@/components/renderJobViewRecord/renderJobViewRecord.vue'; // import Tabbar from '@/components/tabbar/midell-box.vue' // 自动导入 directives 目录下所有指令 const directives = import.meta.glob('./directives/*.js', { @@ -36,6 +42,12 @@ export function createApp() { app.component('SelectPopup', SelectPopup) app.component('RenderJobs', RenderJobs) app.component('RenderCompanys', RenderCompanys) + app.component('RenderJobsOutData', RenderJobsOutData) //渲染外部岗位数据列表 + app.component('RenderCompanysOutData', RenderCompanysOutData) //渲染外部公司数据列表 + app.component('renderDeliveryRecord', renderDeliveryRecord) //渲染岗位投递记录 + app.component('renderJobCollectionRecord', renderJobCollectionRecord) //渲染岗位收藏记录 + app.component('renderCompanyCollectionRecord', renderCompanyCollectionRecord) //渲染公司收藏记录 + app.component('renderJobViewRecord', renderJobViewRecord) //渲染岗位浏览记录 // app.component('tabbar-custom', Tabbar) for (const path in directives) { diff --git a/packageA/pages/Intendedposition/Intendedposition.vue b/packageA/pages/Intendedposition/Intendedposition.vue index 1ed76e9..edc81c5 100644 --- a/packageA/pages/Intendedposition/Intendedposition.vue +++ b/packageA/pages/Intendedposition/Intendedposition.vue @@ -1,12 +1,12 @@ @@ -41,9 +41,7 @@ onReachBottom(() => { getJobList(); }); -function navToPost(jobId) { - navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`); -} + function getJobList(type = 'add') { if (type === 'refresh') { diff --git a/packageA/pages/UnitDetails/UnitDetails.vue b/packageA/pages/UnitDetails/UnitDetails.vue index 633857a..af8d916 100644 --- a/packageA/pages/UnitDetails/UnitDetails.vue +++ b/packageA/pages/UnitDetails/UnitDetails.vue @@ -21,7 +21,7 @@
- {{ companyInfo?.name }} + {{ dataType === 2 ? companyInfo?.gsmc : companyInfo?.name }}   + {{ companyInfo.gsxy }}
公司介绍 - {{ companyInfo.description }} - + {{ dataType === 2 ? companyInfo.qyxz : companyInfo.description }} {{ isExpanded ? '收起' : '展开' }} @@ -50,8 +49,15 @@ 在招职位 + + { console.log(options); - getCompanyInfo(options.companyId || options.bussinessId); + dataType.value = options.dataType ? parseInt(options.dataType) : 1; + pageOptions.value = options; + + if (dataType.value === 2) { + // 第三方数据 + getCompanyInfo(options.companyId, options.zphId); + getJobsList('refresh'); + } else { + // 原数据 + getCompanyInfo(options.companyId || options.bussinessId); + } }); function companyCollection() { - const companyId = companyInfo.value.companyId; - if (companyInfo.value.isCollection) { - $api.createRequest(`/app/company/collection/${companyId}`, {}, 'DELETE').then((resData) => { - getCompanyInfo(companyId); - $api.msg('取消收藏成功'); + if (dataType.value === 2) { + // 第三方数据收藏逻辑 + const id = companyInfo.value.id; + const companyId = companyInfo.value.gsID; + const zphId = companyInfo.value.zphID; + if (companyInfo.value.isCollection) { + $api.createRequest(`/app/company/collection/${id}/2`, {}, 'DELETE').then((resData) => { + getCompanyInfo(companyId, zphId); + $api.msg('取消收藏成功'); + }); + } else { + $api.createRequest(`/app/company/collection/${id}/2`, {}, 'POST').then((resData) => { + getCompanyInfo(companyId, zphId); + $api.msg('收藏成功'); + }); + } + } else { + // 原数据收藏逻辑 + const companyId = companyInfo.value.companyId; + if (companyInfo.value.isCollection) { + $api.createRequest(`/app/company/collection/${companyId}/1`, {}, 'DELETE').then((resData) => { + getCompanyInfo(companyId); + $api.msg('取消收藏成功'); + }); + } else { + $api.createRequest(`/app/company/collection/${companyId}/1`, {}, 'POST').then((resData) => { + getCompanyInfo(companyId); + $api.msg('收藏成功'); + }); + } + } +} + +function getCompanyInfo(...args) { + if (dataType.value === 2) { + // 第三方数据接口 + const [companyId, zphId] = args; + $api.createRequest(`/app/internal/companyThirdPart/${companyId}/${zphId}`).then((resData) => { + companyInfo.value = resData.data; }); } else { - $api.createRequest(`/app/company/collection/${companyId}`, {}, 'POST').then((resData) => { - getCompanyInfo(companyId); - $api.msg('收藏成功'); + // 原数据接口 + const [companyId] = args; + $api.createRequest(`/app/company/${companyId}`).then((resData) => { + companyInfo.value = resData.data; + getJobsList(); }); } } -function getCompanyInfo(id) { - $api.createRequest(`/app/company/${id}`).then((resData) => { - companyInfo.value = resData.data; - getJobsList(); +function getJobsList(type = 'add') { + if (dataType.value === 2) { + // 第三方数据职位列表 + getThirdPartyJobsList(type); + } else { + // 原数据职位列表 + getOriginalJobsList(type); + } +} + +function getThirdPartyJobsList(type = 'add') { + const { companyId, companyName, zphId } = pageOptions.value; + + if (type === 'refresh') { + pageState.current = 1; + pageState.maxPage = 1; + } + if (type === 'add' && pageState.current < pageState.maxPage) { + pageState.current += 1; + } + + let params = { + current: pageState.current, + pageSize: pageState.pageSize, + }; + + $api.createRequest(`/app/internal/jobThirdPart?gsID=${companyId}&gsmc=${companyName}&zphID=${zphId}`, params).then((resData) => { + const { rows, total } = resData; + handleJobsListResponse(type, rows, total, 'current'); }); } -function getJobsList(type = 'add') { +function getOriginalJobsList(type = 'add') { if (type === 'refresh') { pageState.page = 1; pageState.maxPage = 1; @@ -118,25 +198,31 @@ function getJobsList(type = 'add') { if (type === 'add' && pageState.page < pageState.maxPage) { pageState.page += 1; } + let params = { current: pageState.page, pageSize: pageState.pageSize, }; + $api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params).then((resData) => { const { rows, total } = resData; - if (type === 'add') { - const str = pageState.pageSize * (pageState.page - 1); - const end = pageState.list.length; - const reslist = rows; - pageState.list.splice(str, end, ...reslist); - } else { - pageState.list = rows; - } - pageState.total = resData.total; - pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); + handleJobsListResponse(type, rows, total, 'page'); }); } +function handleJobsListResponse(type, rows, total, pageKey) { + if (type === 'add') { + const str = pageState.pageSize * (pageState[pageKey] - 1); + const end = pageState.list.length; + const reslist = rows; + pageState.list.splice(str, end, ...reslist); + } else { + pageState.list = rows; + } + pageState.total = total; + pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); +} + function expand() { isExpanded.value = !isExpanded.value; } @@ -174,7 +260,6 @@ image { margin-right: 24rpx } .companyinfo-right{ - .row1{ font-weight: 500; font-size: 32rpx; @@ -210,7 +295,7 @@ image { } } .expanded { - max-height: 1000rpx; // 足够显示完整内容 + max-height: 1000rpx; } .expand{ display: flex @@ -285,7 +370,7 @@ image { } .card-companyName{ font-weight: 400; - font-size: 28rpx; + font-size: 28rpx; color: #6C7282; } .card-tags{ @@ -317,4 +402,4 @@ image { } } } - + \ No newline at end of file diff --git a/packageA/pages/browseJob/browseJob.vue b/packageA/pages/browseJob/browseJob.vue index 3b2f8f0..0f9aa20 100644 --- a/packageA/pages/browseJob/browseJob.vue +++ b/packageA/pages/browseJob/browseJob.vue @@ -25,12 +25,12 @@ - + > @@ -88,9 +88,7 @@ function toSelectDate() { }); } -function navToPost(jobId) { - navTo(`/packageA/pages/post/post?jobId=${btoa(jobId)}`); -} + function searchCollection(e) { const value = e.detail.value; diff --git a/packageA/pages/collection/collection.vue b/packageA/pages/collection/collection.vue index 928dd70..d1204c9 100644 --- a/packageA/pages/collection/collection.vue +++ b/packageA/pages/collection/collection.vue @@ -15,12 +15,12 @@ - + :latitude="latitudeVal"> + @@ -28,12 +28,12 @@ - + > diff --git a/packageA/pages/exhibitors/exhibitors.vue b/packageA/pages/exhibitors/exhibitors.vue index e6872cb..171d0eb 100644 --- a/packageA/pages/exhibitors/exhibitors.vue +++ b/packageA/pages/exhibitors/exhibitors.vue @@ -11,15 +11,15 @@ - {{ fairInfo?.name }} + {{ fairInfo?.zphmc }} - {{ fairInfo.location }} - {{ fairInfo.jbf }} + @@ -27,36 +27,36 @@ - {{ fairInfo.address }} - 位置 + {{ fairInfo.zphdz }} + 内容描述 - {{ fairInfo.description }} + {{ fairInfo.zphjj }} 内容描述 - {{ parseDateTime(fairInfo.startTime).time }} - {{ parseDateTime(fairInfo.startTime).date }} + {{ parseDateTime(fairInfo.zphjbsj).time }} + {{ parseDateTime(fairInfo.zphjbsj).date }} - {{ getTimeStatus(fairInfo.startTime, fairInfo.endTime).statusText }} + {{ getTimeStatus(fairInfo.zphjbsj, fairInfo.zphjzsj).statusText }} - {{ getHoursBetween(fairInfo.startTime, fairInfo.endTime) }}小时 + {{ getHoursBetween(fairInfo.zphjbsj, fairInfo.zphjzsj) }}小时 - {{ parseDateTime(fairInfo.endTime).time }} - {{ parseDateTime(fairInfo.endTime).date }} + {{ parseDateTime(fairInfo.zphjzsj).time }} + {{ parseDateTime(fairInfo.zphjzsj).date }} @@ -69,17 +69,18 @@ src="@/static/icon/downs.png" > - + - 参会单位({{ companyList.length }}) + 参会单位({{ pageState.total }}) - + > @@ -110,28 +111,69 @@ const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore()); const isExpanded = ref(false); const fairInfo = ref({}); -const companyList = ref([]); + +const pageState = reactive({ + current: 0, + list: [], + total: 0, + maxPage: 1, + pageSize: 10, +}); const hasnext = ref(true); + +const zphId = ref(''); +const pageOptions = ref({}) + onLoad((options) => { - getCompanyInfo(options.jobFairId); + zphId.value = options.jobFairId + pageOptions.value = options + getJobFairInfo(options.jobFairId, options.jobFairName); + getCompanyList('refresh'); }); -function getCompanyInfo(id) { - $api.createRequest(`/app/fair/${id}`).then((resData) => { +function getJobFairInfo(id,name) { + $api.createRequest(`/app/internal/jobFairThirdPart/${id}`).then((resData) => { fairInfo.value = resData.data; - companyList.value = resData.data.companyList; hasAppointment(); }); } +function getCompanyList(type='add') { + const { jobFairId,jobFairName} = pageOptions.value + if (type === 'refresh') { + pageState.current = 1; + pageState.maxPage = 1; + } + if (type === 'add' && pageState.current < pageState.maxPage) { + pageState.current += 1; + } + let params = { + current: pageState.current, + pageSize: pageState.pageSize, + }; + $api.createRequest(`/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`,params ).then((resData) => { + const { rows, total } = resData; + if (type === 'add') { + const str = pageState.pageSize * (pageState.current - 1); + const end = pageState.list.length; + const reslist = rows; + pageState.list.splice(str, end, ...reslist); + } else { + pageState.list = rows; + } + pageState.total = resData.total; + pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); + }); +} const hasAppointment = () => { const isTimePassed = (timeStr) => { + if(!timeStr) return false const targetTime = new Date(timeStr.replace(/-/g, '/')).getTime(); // 兼容格式 const now = Date.now(); return now < targetTime; }; - hasnext.value = isTimePassed(fairInfo.value.startTime); + hasnext.value = isTimePassed(fairInfo.value.zphjbsj); }; function openMap(lat, lng, name = '位置') { @@ -149,16 +191,16 @@ function expand() { // 取消/收藏岗位 function applyExhibitors() { - const fairId = fairInfo.value.jobFairId; + const fairId = fairInfo.value.zphID; if (fairInfo.value.isCollection) { - // $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => { - // getCompanyInfo(fairId); - // $api.msg('取消预约成功'); - // }); + $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => { + getJobFairInfo(fairId); + $api.msg('取消预约成功'); + }); $api.msg('已预约成功'); } else { $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'POST').then((resData) => { - getCompanyInfo(fairId); + getJobFairInfo(fairId); $api.msg('预约成功'); }); } diff --git a/packageA/pages/myResume/myResume.vue b/packageA/pages/myResume/myResume.vue index 2123cf4..78e47e4 100644 --- a/packageA/pages/myResume/myResume.vue +++ b/packageA/pages/myResume/myResume.vue @@ -5,6 +5,13 @@ + + + + {{userInfo.resumeOcrStatus}} + + + { getUserResume(); }); +function closeNotice() { + showNotice.value=false +} + function chooseResume() { uni.chooseImage({ sizeType: ["original", "compressed"], @@ -254,6 +266,36 @@ function uploadResume(tempFilePath, loading) { text-align: center; } } + +.notice-line + width 100%; + height:60rpx; + display: flex; + align-items: center; + justify-content: space-between; + box-sizing: border-box; + padding:0 30rpx + margin-bottom: 20rpx + .icon + width:35rpx; + height:35rpx; + .text + flex: 1; + overflow hidden + padding:0 25rpx + .close + width:25rpx; + height:25rpx; + +.notice-line.blue{ + background: #E8F1FF + color: #1677ff +} +.notice-line.green{ + background: #D4FFF1 + color: #38bb8f +} + image{ width: 100%; height: 100% diff --git a/packageA/pages/post/component/radarMap.vue b/packageA/pages/post/component/radarMap.vue index 0d7084e..2d0a98e 100644 --- a/packageA/pages/post/component/radarMap.vue +++ b/packageA/pages/post/component/radarMap.vue @@ -28,9 +28,12 @@ watch( () => props.value, (newVal) => { if (newVal && Object.keys(newVal).length > 0) { - const { skill, experience, education, salary, age, location } = newVal.radarChart; - const labels = ['学历', '年龄', '工作地', '技能', '工作经验', '期望薪资']; - const data = [education, age, location, skill, experience, salary].map((item) => item * 0.05); + // const { skill, experience, education, salary, age, location } = newVal.radarChart; + const { experience, education, salary, age, location } = newVal.radarChart; + // const labels = ['学历', '年龄', '工作地', '技能', '工作经验', '期望薪资']; + const labels = ['学历', '年龄', '工作地', '工作经验', '期望薪资']; + // const data = [education, age, location, skill, experience, salary].map((item) => item * 0.05); + const data = [education, age, location, experience, salary].map((item) => item * 0.05); rawRadarChart(labels, data); } }, @@ -43,10 +46,8 @@ function rawRadarChart(labels, data) { const height = 80; const centerX = 150; const centerY = 125; - // const data = [2, 3.5, 5, 3.5, 5, 3.5]; // 示例数据 - // const labels = ['火烧', '泡水', '事故', '外观', '部件', '火烧']; const colors = ['#F5F5F5', '#F5F5F5', '#F5F5F5', '#F5F5F5', '#F5F5F5']; - const maxScore = 5; // 数据最大值 + const maxScore = 5; const angleStep = (2 * Math.PI) / labels.length; @@ -62,9 +63,8 @@ function rawRadarChart(labels, data) { ctx.fill(); //多边形圈 - // 多边形圈 for (let i = 5; i > 0; i--) { - ctx.setStrokeStyle(colors[i - 1]); // 设置边框颜色 + ctx.setStrokeStyle(colors[i - 1]); ctx.beginPath(); labels.forEach((label, index) => { const x = centerX + (width / 5) * i * Math.cos(angleStep * index - Math.PI / 2); @@ -76,19 +76,20 @@ function rawRadarChart(labels, data) { } }); ctx.closePath(); - ctx.stroke(); // 只描边,不填充 + ctx.stroke(); } - // //竖线 + //竖线 labels.forEach((label, index) => { ctx.setStrokeStyle('#F5F5F5'); ctx.setFillStyle('#F5F5F5'); ctx.beginPath(); - const x1 = centerX + width * 0.6 * Math.sin(angleStep * index); - const y1 = centerY + height * 0.6 * Math.cos(angleStep * index); - const x = centerX + width * Math.sin(angleStep * index); - const y = centerY + height * Math.cos(angleStep * index); + // 修改坐标计算,使用与多边形圈相同的角度计算方式 + const x1 = centerX + width * 0.6 * Math.cos(angleStep * index - Math.PI / 2); + const y1 = centerY + height * 0.6 * Math.sin(angleStep * index - Math.PI / 2); + const x = centerX + width * Math.cos(angleStep * index - Math.PI / 2); + const y = centerY + height * Math.sin(angleStep * index - Math.PI / 2); ctx.moveTo(x1, y1); ctx.lineTo(x, y); @@ -102,11 +103,11 @@ function rawRadarChart(labels, data) { ctx.setFillStyle('rgba(37,107,250, 0.24)'); ctx.setLineWidth(2); ctx.beginPath(); - const pointList = []; // 记录每个点的位置,等会画小圆点 + const pointList = []; data.forEach((score, index) => { const x = centerX + width * (score / maxScore) * Math.cos(angleStep * index - Math.PI / 2); const y = centerY + height * (score / maxScore) * Math.sin(angleStep * index - Math.PI / 2); - pointList.push({ x, y }); // 保存位置 + pointList.push({ x, y }); if (index === 0) { ctx.moveTo(x, y); } else { @@ -118,15 +119,16 @@ function rawRadarChart(labels, data) { ctx.stroke(); // 绘制每个小圆点 - ctx.setFillStyle('#256BFA'); // 小圆点颜色(你可以改) + ctx.setFillStyle('#256BFA'); pointList.forEach((point) => { ctx.beginPath(); - ctx.arc(point.x, point.y, 4, 0, 2 * Math.PI); // 半径 4,可以自己调大小 + ctx.arc(point.x, point.y, 4, 0, 2 * Math.PI); ctx.fill(); }); - // 绘制标签 + // 绘制标签 ctx.setTextAlign('center'); + ctx.setTextBaseline('middle'); labels.forEach((label, index) => { const x = centerX + (width + 30) * Math.cos(angleStep * index - Math.PI / 2); @@ -137,30 +139,9 @@ function rawRadarChart(labels, data) { ctx.setFontSize(12); ctx.font = 'bold 12px sans-serif'; ctx.fillText(label, x, y); - - // ctx.setFillStyle('#A2A4A2'); - // ctx.font = '12px sans-serif'; - // ctx.setFontSize(12); - // ctx.fillText(data[index], x, y + 16); }); ctx.draw(); - - //转图片 - - // uni.canvasToTempFilePath({ - // x: 0, - // y: 0, - // width: 320, - // height: 320, - // destWidth: 840, - // destHeight: 840, - // canvasId: 'radarCanvas', - // success: (res) => { - // // 在H5平台下,tempFilePath 为 base64 - // src = res.tempFilePath; - // }, - // }); } diff --git a/packageA/pages/post/post.vue b/packageA/pages/post/post.vue index 5551afb..d3932aa 100644 --- a/packageA/pages/post/post.vue +++ b/packageA/pages/post/post.vue @@ -6,39 +6,59 @@ + + + - + - {{ jobInfo.jobTitle }} + + + + {{ dataType === 2 ? jobInfo.gwmc : jobInfo.jobTitle }} - + + + {{jobInfo.xlyq == '不限' ? '学历不限' : jobInfo.xlyq}} + + + + - + + + {{jobInfo.gwgzjy == '不限' ? '经验不限' : jobInfo.gwgzjy}} + + + 来源  - {{ jobInfo.dataSource }} + {{ dataType === 2 ? '青岛人才网' : jobInfo.dataSource }} + + @@ -48,20 +68,24 @@ 点击查看 + + 职位描述 - {{ jobInfo.description }} + {{ dataType === 2 ? jobInfo.gwms : jobInfo.description }} + + 公司信息 单位详情 @@ -71,15 +95,20 @@ - {{ jobInfo.company?.name }} + {{ dataType === 2 ? jobInfo.gsmc : jobInfo.company?.name }} -   - +   + + {{jobInfo.qyxz}} 在招 @@ -97,7 +126,9 @@ > - + + + 竞争力分析 @@ -125,11 +156,15 @@ + + @@ -143,8 +178,10 @@ import { reactive, inject, watch, ref, onMounted, computed } from 'vue'; import { onLoad, onShow, onHide } from '@dcloudio/uni-app'; import dictLabel from '@/components/dict-Label/dict-Label.vue'; import RadarMap from './component/radarMap.vue'; + const { $api, navTo, getLenPx, parseQueryParams, navBack, isEmptyObject } = inject('globalFunction'); import config from '@/config.js'; + const matchingDegree = ref(['一般', '良好', '优秀', '极好']); const currentStep = ref(1); const companyCount = ref(0); @@ -155,9 +192,11 @@ const jobIdRef = ref(); const raderData = ref({}); const videoPalyerRef = ref(null); const explainUrlRef = ref(''); +const dataType = ref(1); // 1: 原数据, 2: 第三方数据 onLoad((option) => { if (option.jobId) { + dataType.value = option.dataType ? parseInt(option.dataType) : 1; initLoad(option); } }); @@ -165,6 +204,7 @@ onLoad((option) => { onShow(() => { const option = parseQueryParams(); // 兼容微信内置浏览器 if (option.jobId) { + dataType.value = option.dataType ? parseInt(option.dataType) : 1; initLoad(option); } }); @@ -180,91 +220,165 @@ function initLoad(option) { function seeExplain() { if (jobInfo.value.explainUrl) { videoPalyerRef.value?.open(jobInfo.value.explainUrl); - // console.log(jobInfo.value.explainUrl); - // explainUrlRef.value = jobInfo.value.explainUrl; } } function getDetail(jobId) { - return new Promise((reslove, reject) => { + if (dataType.value === 2) { + // 第三方数据接口 + return new Promise((reslove, reject) => { + $api.createRequest(`/app/internal/jobThirdPart/${jobId}`).then((resData) => { + const { gsID, gsmc, zphID } = resData.data; + jobInfo.value = resData.data; + reslove(resData.data); + getCompanyIsAJobs(gsID, gsmc, zphID); + + if (resData.data.latitude && resData.data.longitude) { + initMapCovers(resData.data.latitude, resData.data.longitude, resData.data.gsmc); + } + }); + }); + } else { + // 原数据接口 $api.createRequest(`/app/job/${jobId}`).then((resData) => { const { latitude, longitude, companyName, companyId } = resData.data; jobInfo.value = resData.data; - reslove(resData.data); getCompanyIsAJobs(companyId); getCompetivetuveness(jobId); + if (latitude && longitude) { - mapCovers.value = [ - { - latitude: latitude, - longitude: longitude, - iconPath: point, - label: { - content: companyName, - textAlign: 'center', - padding: 3, - fontSize: 12, - bgColor: '#FFFFFF', - anchorX: getTextWidth(companyName), // X 轴调整,负数向左 - borderRadius: 5, - }, - width: 34, - }, - ]; + initMapCovers(latitude, longitude, companyName); } }); - }); + } } -function getCompanyIsAJobs(companyId) { - $api.createRequest(`/app/company/count/${companyId}`).then((resData) => { - companyCount.value = resData.data; - }); +function initMapCovers(latitude, longitude, companyName) { + mapCovers.value = [ + { + latitude: latitude, + longitude: longitude, + iconPath: point, + label: { + content: companyName, + textAlign: 'center', + padding: 3, + fontSize: 12, + bgColor: '#FFFFFF', + anchorX: getTextWidth(companyName), + borderRadius: 5, + }, + width: 34, + }, + ]; +} + +function getCompanyIsAJobs(...args) { + if (dataType.value === 2) { + // 第三方数据获取公司职位数量 + const [gsID, gsmc, zphID] = args; + $api.createRequest(`/app/internal/jobThirdPart?gsID=${gsID}&gsmc=${gsmc}&zphID=${zphID}`).then((resData) => { + companyCount.value = resData.total; + }); + } else { + // 原数据获取公司职位数量 + const [companyId] = args; + $api.createRequest(`/app/company/count/${companyId}`).then((resData) => { + companyCount.value = resData.data; + }); + } } function getTextWidth(text, size = 12) { const canvas = document.createElement('canvas'); const context = canvas.getContext('2d'); context.font = `${12}px Arial`; - return -(context.measureText(text).width / 2) - 20; // 计算文字中心点 + return -(context.measureText(text).width / 2) - 20; } function getCompetivetuveness(jobId) { - $api.createRequest(`/app/job/competitiveness/${jobId}`, {}, 'GET').then((resData) => { - raderData.value = resData.data; - currentStep.value = resData.data.matchScore * 0.04; - }); + if (dataType.value !== 2) { + $api.createRequest(`/app/job/competitiveness/${jobId}`, {}, 'GET').then((resData) => { + raderData.value = resData.data; + currentStep.value = resData.data.matchScore * 0.04; + }); + } } // 申请岗位 function jobApply() { - const jobId = jobInfo.value.jobId; - if (jobInfo.value.isApply) { - const jobUrl = jobInfo.value.jobUrl; - return window.open(jobUrl); - } else { - $api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => { - getDetail(jobId); - $api.msg('申请成功'); + if (dataType.value === 2) { + $api.msg('敬请期待'); + return + // 第三方数据申请逻辑 + const jobId = jobInfo.value.id; + if (jobInfo.value.isApply) { const jobUrl = jobInfo.value.jobUrl; return window.open(jobUrl); - }); + } else { + $api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => { + getDetail(jobIdRef.value); + $api.msg('投递成功'); + const jobUrl = jobInfo.value.jobUrl; + return window.open(jobUrl); + }); + } + } else { + // 原数据申请逻辑 + const jobId = jobInfo.value.jobId; + if (jobInfo.value.isApply) { + const jobUrl = jobInfo.value.jobUrl; + return window.open(jobUrl); + } else { + $api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => { + getDetail(jobId); + $api.msg('申请成功'); + const jobUrl = jobInfo.value.jobUrl; + return window.open(jobUrl); + }); + } } } // 取消/收藏岗位 function jobCollection() { - const jobId = jobInfo.value.jobId; - if (jobInfo.value.isCollection) { - $api.createRequest(`/app/job/collection/${jobId}`, {}, 'DELETE').then((resData) => { - getDetail(jobId); - $api.msg('取消收藏成功'); - }); + if (dataType.value === 2) { + // 第三方数据收藏逻辑 + const id = jobInfo.value.id; + if (jobInfo.value.isCollection) { + $api.createRequest(`/app/job/collection/${id}/2`, {}, 'DELETE').then((resData) => { + getDetail(jobIdRef.value); + $api.msg('取消收藏成功'); + }); + } else { + $api.createRequest(`/app/job/collection/${id}/2`, {}, 'POST').then((resData) => { + getDetail(jobIdRef.value); + $api.msg('收藏成功'); + }); + } } else { - $api.createRequest(`/app/job/collection/${jobId}`, {}, 'POST').then((resData) => { - getDetail(jobId); - $api.msg('收藏成功'); - }); + // 原数据收藏逻辑 + const jobId = jobInfo.value.jobId; + if (jobInfo.value.isCollection) { + $api.createRequest(`/app/job/collection/${jobId}/1`, {}, 'DELETE').then((resData) => { + getDetail(jobId); + $api.msg('取消收藏成功'); + }); + } else { + $api.createRequest(`/app/job/collection/${jobId}/1`, {}, 'POST').then((resData) => { + getDetail(jobId); + $api.msg('收藏成功'); + }); + } + } +} + +// 处理公司详情跳转 +function handleCompanyDetail() { + if (dataType.value === 2) { + navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.gsID}&companyName=${jobInfo.value.gsmc}&zphId=${jobInfo.value.zphID}&dataType=2`); + } else { + navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.company.companyId}`); } } @@ -285,6 +399,7 @@ function getClass(index) { + \ No newline at end of file diff --git a/packageA/pages/reservation/reservation.vue b/packageA/pages/reservation/reservation.vue index 313a73d..89bf7c7 100644 --- a/packageA/pages/reservation/reservation.vue +++ b/packageA/pages/reservation/reservation.vue @@ -15,24 +15,24 @@ - + - + - {{ item.name }} + {{ item.zphmc }} - {{ item.location }} - - {{ item.zphdz }} + + - + 取消预约 @@ -72,6 +72,7 @@ const ranOptions = ref([ ]); function isTimePassed(timeStr) { + if(!timeStr) return false const targetTime = new Date(timeStr.replace(/-/g, '/')).getTime(); // 兼容格式 const now = Date.now(); return now < targetTime; @@ -88,11 +89,22 @@ function chnageRanOption(item) { } function updateCancel(item) { - const fairId = item.jobFairId; - $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => { - getList('refresh'); - $api.msg('取消预约成功'); - }); + const fairId = item.zphID; + uni.showModal({ + title: '提示', + content: '确定要取消预约吗?', + showCancel: true, + success: ({ confirm, cancel }) => { + if(confirm){ + $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => { + getList('refresh'); + $api.msg('取消预约成功'); + }); + } + } + }) + + } function getList(type = 'add', loading = true) { @@ -166,6 +178,7 @@ function getList(type = 'add', loading = true) { display: flex align-items: center } + } .card-Title{ font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif; diff --git a/packageA/pages/vCard/vCard.vue b/packageA/pages/vCard/vCard.vue index 4571dcf..5edd52a 100644 --- a/packageA/pages/vCard/vCard.vue +++ b/packageA/pages/vCard/vCard.vue @@ -32,7 +32,8 @@ - 到岗:2025-11-02 + + 地点:青岛市- @@ -44,10 +45,10 @@ 毕业学校 {{ userInfo.graduationSchool || "-" }} - + diff --git a/pages/careerfair/careerfair copy.vue b/pages/careerfair/careerfair copy.vue new file mode 100644 index 0000000..0abc265 --- /dev/null +++ b/pages/careerfair/careerfair copy.vue @@ -0,0 +1,545 @@ + + + + + diff --git a/pages/careerfair/careerfair.vue b/pages/careerfair/careerfair.vue index a6754a7..4fe0789 100644 --- a/pages/careerfair/careerfair.vue +++ b/pages/careerfair/careerfair.vue @@ -13,7 +13,7 @@ - + @@ -42,42 +42,42 @@ class="card press-button" v-for="(item, index) in fairList" :key="index" - @click="navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + item.jobFairId)" + @click="navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + item.zphID + '&jobFairName=' + item.zphmc)" > - {{ item.name }} + {{ item.zphmc }} - {{ item.location }} + {{ item.jbf }} - + > --> - {{ parseDateTime(item.startTime).time }} - {{ parseDateTime(item.startTime).date }} + {{ parseDateTime(item.zphjbsj).time }} + {{ parseDateTime(item.zphjbsj).date }} - {{ getTimeStatus(item.startTime, item.endTime).statusText }} + {{ getTimeStatus(item.zphjbsj, item.zphjzsj).statusText }} - {{ getHoursBetween(item.startTime, item.endTime) }}小时 + {{ getHoursBetween(item.zphjbsj, item.zphjzsj) }}小时 - {{ parseDateTime(item.endTime).time }} - {{ parseDateTime(item.endTime).date }} + {{ parseDateTime(item.zphjzsj).time }} + {{ parseDateTime(item.zphjzsj).date }} - 内容简介:{{ item.description }} + 内容简介:{{ item.zphjj }} @@ -95,7 +95,7 @@ import Tabbar from '@/components/tabbar/midell-box.vue'; import useLocationStore from '@/stores/useLocationStore'; import { storeToRefs } from 'pinia'; const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore()); -const { $api, navTo, cloneDeep } = inject('globalFunction'); +const { $api, navTo, cloneDeep,debounce } = inject('globalFunction'); const weekList = ref([]); const fairList = ref([]); const currentDay = ref({}); @@ -108,7 +108,7 @@ const pageState = reactive({ total: 0, maxPage: 2, pageSize: 10, - search: {}, + zphmc:'' }); onLoad(() => { @@ -122,6 +122,7 @@ onLoad(() => { startDate: currentDate, }); weekList.value = result; + currentDay.value.fullDate = result[0].fullDate getFair('refresh'); }); @@ -161,10 +162,12 @@ function seemsg(index) { } const handleScrollToLower = () => { + return getFair(); console.log('触底'); }; + function getFair(type = 'add') { if (type === 'refresh') { pageState.page = 1; @@ -174,21 +177,24 @@ function getFair(type = 'add') { pageState.page += 1; } let params = { - ...pageState.search, - current: pageState.page, - pageSize: pageState.pageSize, + zphmc:pageState.zphmc, + // current: pageState.page, + // pageSize: pageState.pageSize, }; + // if (currentDay.value?.fullDate) { + // params.queryDate = currentDay.value.fullDate; + // } if (currentDay.value?.fullDate) { - params.queryDate = currentDay.value.fullDate; + params.zphjbsj = currentDay.value.fullDate.replace(/-/g, ''); } - $api.createRequest('/app/fair', params).then((resData) => { + $api.createRequest('/app/internal/jobFairThirdPart', params).then((resData) => { const { rows, total } = resData; - console.log(rows); if (type === 'add') { - const str = pageState.pageSize * (pageState.page - 1); - const end = fairList.value.length; - const reslist = rows; - fairList.value.splice(str, end, ...reslist); + // const str = pageState.pageSize * (pageState.page - 1); + // const end = fairList.value.length; + // const reslist = rows; + // fairList.value.splice(str, end, ...reslist); + fairList.value = rows } else { fairList.value = rows; } diff --git a/static/icon/close-blue.png b/static/icon/close-blue.png new file mode 100644 index 0000000..024fd7b Binary files /dev/null and b/static/icon/close-blue.png differ diff --git a/static/icon/close-green.png b/static/icon/close-green.png new file mode 100644 index 0000000..39ddb3c Binary files /dev/null and b/static/icon/close-green.png differ diff --git a/static/icon/notice-blue.png b/static/icon/notice-blue.png new file mode 100644 index 0000000..373531a Binary files /dev/null and b/static/icon/notice-blue.png differ diff --git a/static/icon/notice-green.png b/static/icon/notice-green.png new file mode 100644 index 0000000..d335ce5 Binary files /dev/null and b/static/icon/notice-green.png differ diff --git a/static/js/aes.js b/static/js/aes.js deleted file mode 100644 index 166e3ea..0000000 --- a/static/js/aes.js +++ /dev/null @@ -1,234 +0,0 @@ -;(function (root, factory, undef) { - if (typeof exports === "object") { - // CommonJS - module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); - } - else if (typeof define === "function" && define.amd) { - // AMD - define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); - } - else { - // Global (browser) - factory(root.CryptoJS); - } -}(this, function (CryptoJS) { - - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var BlockCipher = C_lib.BlockCipher; - var C_algo = C.algo; - - // Lookup tables - var SBOX = []; - var INV_SBOX = []; - var SUB_MIX_0 = []; - var SUB_MIX_1 = []; - var SUB_MIX_2 = []; - var SUB_MIX_3 = []; - var INV_SUB_MIX_0 = []; - var INV_SUB_MIX_1 = []; - var INV_SUB_MIX_2 = []; - var INV_SUB_MIX_3 = []; - - // Compute lookup tables - (function () { - // Compute double table - var d = []; - for (var i = 0; i < 256; i++) { - if (i < 128) { - d[i] = i << 1; - } else { - d[i] = (i << 1) ^ 0x11b; - } - } - - // Walk GF(2^8) - var x = 0; - var xi = 0; - for (var i = 0; i < 256; i++) { - // Compute sbox - var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); - sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; - SBOX[x] = sx; - INV_SBOX[sx] = x; - - // Compute multiplication - var x2 = d[x]; - var x4 = d[x2]; - var x8 = d[x4]; - - // Compute sub bytes, mix columns tables - var t = (d[sx] * 0x101) ^ (sx * 0x1010100); - SUB_MIX_0[x] = (t << 24) | (t >>> 8); - SUB_MIX_1[x] = (t << 16) | (t >>> 16); - SUB_MIX_2[x] = (t << 8) | (t >>> 24); - SUB_MIX_3[x] = t; - - // Compute inv sub bytes, inv mix columns tables - var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); - INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); - INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); - INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); - INV_SUB_MIX_3[sx] = t; - - // Compute next counter - if (!x) { - x = xi = 1; - } else { - x = x2 ^ d[d[d[x8 ^ x2]]]; - xi ^= d[d[xi]]; - } - } - }()); - - // Precomputed Rcon lookup - var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; - - /** - * AES block cipher algorithm. - */ - var AES = C_algo.AES = BlockCipher.extend({ - _doReset: function () { - var t; - - // Skip reset of nRounds has been set before and key did not change - if (this._nRounds && this._keyPriorReset === this._key) { - return; - } - - // Shortcuts - var key = this._keyPriorReset = this._key; - var keyWords = key.words; - var keySize = key.sigBytes / 4; - - // Compute number of rounds - var nRounds = this._nRounds = keySize + 6; - - // Compute number of key schedule rows - var ksRows = (nRounds + 1) * 4; - - // Compute key schedule - var keySchedule = this._keySchedule = []; - for (var ksRow = 0; ksRow < ksRows; ksRow++) { - if (ksRow < keySize) { - keySchedule[ksRow] = keyWords[ksRow]; - } else { - t = keySchedule[ksRow - 1]; - - if (!(ksRow % keySize)) { - // Rot word - t = (t << 8) | (t >>> 24); - - // Sub word - t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; - - // Mix Rcon - t ^= RCON[(ksRow / keySize) | 0] << 24; - } else if (keySize > 6 && ksRow % keySize == 4) { - // Sub word - t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; - } - - keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; - } - } - - // Compute inv key schedule - var invKeySchedule = this._invKeySchedule = []; - for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { - var ksRow = ksRows - invKsRow; - - if (invKsRow % 4) { - var t = keySchedule[ksRow]; - } else { - var t = keySchedule[ksRow - 4]; - } - - if (invKsRow < 4 || ksRow <= 4) { - invKeySchedule[invKsRow] = t; - } else { - invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ - INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; - } - } - }, - - encryptBlock: function (M, offset) { - this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); - }, - - decryptBlock: function (M, offset) { - // Swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - - this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); - - // Inv swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - }, - - _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { - // Shortcut - var nRounds = this._nRounds; - - // Get input, add round key - var s0 = M[offset] ^ keySchedule[0]; - var s1 = M[offset + 1] ^ keySchedule[1]; - var s2 = M[offset + 2] ^ keySchedule[2]; - var s3 = M[offset + 3] ^ keySchedule[3]; - - // Key schedule row counter - var ksRow = 4; - - // Rounds - for (var round = 1; round < nRounds; round++) { - // Shift rows, sub bytes, mix columns, add round key - var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; - var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; - var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; - var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; - - // Update state - s0 = t0; - s1 = t1; - s2 = t2; - s3 = t3; - } - - // Shift rows, sub bytes, add round key - var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; - var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; - var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; - var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; - - // Set output - M[offset] = t0; - M[offset + 1] = t1; - M[offset + 2] = t2; - M[offset + 3] = t3; - }, - - keySize: 256/32 - }); - - /** - * Shortcut functions to the cipher's object interface. - * - * @example - * - * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); - * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); - */ - C.AES = BlockCipher._createHelper(AES); - }()); - - - return CryptoJS.AES; - -})); \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index 6746c7f..9ee9c0d 100644 --- a/utils/request.js +++ b/utils/request.js @@ -76,8 +76,8 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h // 响应拦截 if (resData.statusCode === 200) { if (resData.data.encrypted) { - const decryptedData = sm4Decrypt(config - .sm4Config.key, resData.data.encryptedData) + const decryptedData = sm4Decrypt(config.sm4Config.key, resData.data + .encryptedData) resData.data = JSON.parse(decryptedData) } const {