Commit 3f9a99e0 authored by 张锡奇's avatar 张锡奇

upload

parent 4e105c52
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"copy-webpack-plugin": "^4.0.1", "copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1", "cross-spawn": "^5.0.1",
"crypto-js": "^3.3.0",
"css-loader": "^0.28.0", "css-loader": "^0.28.0",
"echarts": "^4.2.1", "echarts": "^4.2.1",
"extract-text-webpack-plugin": "^3.0.0", "extract-text-webpack-plugin": "^3.0.0",
......
...@@ -84,5 +84,8 @@ const methodMap = { ...@@ -84,5 +84,8 @@ const methodMap = {
//tiip 收发存 //tiip 收发存
getTiipReceiveStorage:{url:"/boss/stock/",method:"post",host:"default"}, getTiipReceiveStorage:{url:"/boss/stock/",method:"post",host:"default"},
get_ticket:{url:"/weixin/get_ticket/",method:"post",host:"app"},
}; };
export default Object.assign(methodMap,healthApi); export default Object.assign(methodMap,healthApi);
...@@ -21,6 +21,8 @@ const signatureUtil={ ...@@ -21,6 +21,8 @@ const signatureUtil={
if (body) { if (body) {
signPlain += JSON.stringify(body) signPlain += JSON.stringify(body)
} }
console.log(signPlain)
signPlain += timestamp.toString() + nonce.toString() signPlain += timestamp.toString() + nonce.toString()
// console.log('签名结果:', signPlain) // console.log('签名结果:', signPlain)
// signPlain = sha256.hmac('018f162e804f945ee6b23aebfa863639', signPlain); // signPlain = sha256.hmac('018f162e804f945ee6b23aebfa863639', signPlain);
......
...@@ -32,7 +32,7 @@ Http.install = function (Vue) { ...@@ -32,7 +32,7 @@ Http.install = function (Vue) {
loading(toast); loading(toast);
} }
let _params = opts.hasOwnProperty('params') ? opts.params : {}; let _params = opts.hasOwnProperty('params') ? opts.params : {};
let url = new HSHttpClient(apiURL(m.host) + m.url,{},_params).newUrl; let url = new HSHttpClient(apiURL(m.host) + m.url,{},_params,opts.data).newUrl;
if (m.method === 'get') { if (m.method === 'get') {
return Vue.prototype.apiGet(url,opts.data,toast,header); return Vue.prototype.apiGet(url,opts.data,toast,header);
......
import Axios from 'axios'; import Axios from 'axios';
import CryptoJS from 'crypto-js'
var now = new Date(); //当前日期 var now = new Date(); //当前日期
var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDayOfWeek = now.getDay(); //今天本周的第几天
var nowDay = now.getDate(); //当前日 var nowDay = now.getDate(); //当前日
...@@ -9,6 +9,16 @@ nowYear += (nowYear < 2000) ? 1900 : 0; // ...@@ -9,6 +9,16 @@ nowYear += (nowYear < 2000) ? 1900 : 0; //
var y = 0; var y = 0;
const fillKey = (key) => {
const filledKey = Buffer.alloc(128 / 8);
const keys = Buffer.from(key);
if (keys.length <= filledKey.length) {
filledKey.map((b, i) => filledKey[i] = keys[i]);
}
return filledKey;
}
let util = { let util = {
}; };
...@@ -527,4 +537,32 @@ util.scrollToBottom = function(scrollDom){ ...@@ -527,4 +537,32 @@ util.scrollToBottom = function(scrollDom){
// } // }
// } // }
/**
* 定义加密函数
* @param {string} data - 需要加密的数据, 传过来前先进行 JSON.stringify(data);
* @param {string} key - 加密使用的 key
*/
util.aesEncrypt = (data, key) => {
key = CryptoJS.enc.Utf8.parse(fillKey(key));
/**
* CipherOption, 加密的一些选项:
* mode: 加密模式, 可取值(CBC, CFB, CTR, CTRGladman, OFB, ECB), 都在 CryptoJS.mode 对象下
* padding: 填充方式, 可取值(Pkcs7, AnsiX923, Iso10126, Iso97971, ZeroPadding, NoPadding), 都在 CryptoJS.pad 对象下
* iv: 偏移量, mode === ECB 时, 不需要 iv
* 返回的是一个加密对象
*/
const cipher = CryptoJS.AES.encrypt(data, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
iv: "",
});
// 将加密后的数据转换成 Base64
const base64Cipher = cipher.ciphertext.toString(CryptoJS.enc.Base64);
// 处理 Android 某些低版的BUG
const resultCipher = base64Cipher.replace(/\+/g,"-").replace(/\//g,"_");
// 返回加密后的经过处理的 Base64
return cipher.toString();
}
export default util; export default util;
\ No newline at end of file
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
<div class="header"> <div class="header">
<searchComponent placeholder="请输入订单号/合同号/供应商/客户..." :search="search" :typeList="typeList" :status="status"/> <searchComponent placeholder="请输入订单号/合同号/供应商/客户..." :search="search" :typeList="typeList" :status="status"/>
</div> </div>
<button id="scanQRCode" >ddddddd</button>
<div class="Table"> <div class="Table">
<customerTable :columns="columns" :list="list" :tableStyle="tableStyle"></customerTable> <customerTable :columns="columns" :list="list" :tableStyle="tableStyle"></customerTable>
</div> </div>
...@@ -34,6 +37,7 @@ ...@@ -34,6 +37,7 @@
import Util from '@/libs/util.js' import Util from '@/libs/util.js'
import searchComponent from '@/components/search' import searchComponent from '@/components/search'
import customerTable from '@/components/Table' import customerTable from '@/components/Table'
var CryptoJS = require("crypto-js");
export default { export default {
name: 'tipProcessProgress', name: 'tipProcessProgress',
...@@ -170,6 +174,50 @@ export default { ...@@ -170,6 +174,50 @@ export default {
this.row = this.list[res.trIndex]; this.row = this.list[res.trIndex];
this.routerToDetail(); this.routerToDetail();
}) })
console.log(Util.aesEncrypt('1234567890123456', '1234567890123456'));
// let result = await this.request('get_ticket',{
// data:{
// url:window.location.href
// }
// })
// wx.config({
// // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
// debug: false,
// // 必填,公众号的唯一标识
// appId: result.appId,
// // 必填,生成签名的时间戳
// timestamp:result.timestamp,
// // 必填,生成签名的随机串
// nonceStr:result.nonceStr,
// // 必填,签名,见附录1
// signature:result.signature,
// // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
// jsApiList : [ 'checkJsApi', 'scanQRCode' ]
// });
// wx.error(function(res) {
// alert("出错了:" + res.errMsg);//这个地方的好处就是wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。
// });
// console.log(wx)
// wx.ready(function() {
// //点击按钮扫描二维码
// document.querySelector('#scanQRCode').onclick = function() {
// console.log(wx)
// wx.scanQRCode({
// needResult : 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
// scanType : [ "qrCode"], // 可以指定扫二维码还是一维码,默认二者都有
// success : function(res) {
// var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
// window.location.href = result;//因为我这边是扫描后有个链接,然后跳转到该页面
// }
// });
// };
// });
}, },
methods:{ methods:{
async getStatus(){ async getStatus(){
......
...@@ -134,6 +134,9 @@ ...@@ -134,6 +134,9 @@
mode="during" mode="during"
:defaultDate="calendarValue" :defaultDate="calendarValue"
@change="Change"/> @change="Change"/>
<button @click="scan">ddddddd</button>
</div> </div>
</template> </template>
<script> <script>
...@@ -228,6 +231,11 @@ export default { ...@@ -228,6 +231,11 @@ export default {
} }
return new Date(date.getTime()); return new Date(date.getTime());
}, },
scan(){
wx.miniProgram.scanQRCode(function(res) {
console.log(111,res.miniprogram) // true
})
}
}, },
computed:{ computed:{
startDate(val){ startDate(val){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment