Selaa lähdekoodia

拉取拦截诺德

master
yangteng 8 kuukautta sitten
vanhempi
commit
861b91a614

+ 10
- 3
datas/9901Jump.js Näytä tiedosto

@@ -7,12 +7,14 @@ export function jump(type,item){
// 7申请换货 8申请退货 9申请补货 没激活之前
// 10 上传身份信息 11待支付 12待签约 13异地-邮寄地址填写 18去下单
// 16签约 17卡签信息读取(没登录去异地登录)
// 19 恢复签约
// plateNum 车牌号码和颜色编号 例:浙A0P73H_0
// orderNo 订单编号
// afterType 售后办理类型 1.挂失/解挂 3.更换 4.续期 5.补办 6.注销 7.换货 8.退货 9.补货
// afterType 售后办理类型 1.挂失/解挂 3.更换 4.续期 5.补办(增补设备) 6.注销 7.换货 8.退货 9.补货(申请补货)
// orderType 订单类型 1.新办 2.售后

// 需要小程序跳转的:
// 1.新办理的订单在设备在已发货未二发前可进行退货、换货、补货的业务。
// 2. 已激活设备可发起挂失、解挂、更换、补办、注销、续期售后业务。针对更换、补办产生的订单在已发货未二发前可以进行退货、换货、补货业务。
@@ -60,7 +62,7 @@ export function jump(type,item){
// 补卡 补签(没有补卡签)
redirectUrl="/pages/order/order"
handleType="aftersale"
afterType=9
afterType=5
}else{
// 正常支付
redirectUrl="/pages/order/order"
@@ -76,7 +78,7 @@ export function jump(type,item){
redirectUrl="/pages/order/order"
}else if(data['orderType']=='FILL_OBU'|| data['orderType']=='FILL_CARD'){
// 补卡 补签(没有补卡签)
afterType=9
afterType=5
orderType=2
handleType="aftersale"
redirectUrl="/pages/order/order"
@@ -134,9 +136,14 @@ export function jump(type,item){
handleType="reactivate"
redirectUrl="/pages/index/index"
}
if(type=="19"){
handleType="resumeSigning"
redirectUrl="/pages/order/order"
}
console.log("data.promoteId",data.promoteId,handleType)
uni.navigateTo({
url:`plugin://issuer-plugin/login?redirectUrl=${redirectUrl}&plateNum=${data.vehicleId?data.vehicleId:""}&handleType=${handleType}&orderNo=${(handleType!='continuation' && data.orderId)?data.orderId:""}&orderType=${orderType}&afterType=${afterType}&accountType=${accountType}&carType=${carType}&etcProductId=${data.promoteId?data.promoteId:data.productId}&mobile=${getItem("mobile")}`
})
}
}

+ 6
- 0
pages.json Näytä tiedosto

@@ -965,6 +965,12 @@
"navigationBarTitleText": "支付宝代扣"
}
},
{
"path": "sign-up-ali-yd",
"style": {
"navigationBarTitleText": "支付宝代扣"
}
},
{
"path": "deductionAccountAssociation",
"style": {

+ 8
- 2
pages/index/index.vue Näytä tiedosto

@@ -279,6 +279,12 @@
console.log("wechatSignNo",options)
getInfo();
})
// 页面初次渲染完成时触发
onReady(()=>{
setTimeout(()=>{
quanKeyAction()
},5000)
})
// 页面初次渲染完成时触发
onReady(()=>{
setTimeout(()=>{
@@ -334,7 +340,7 @@
commonQuestion();
}
};
//全量枚举值查询
// //全量枚举值查询
const quanKeyAction = () => {
var data = {};
const options = {
@@ -343,7 +349,7 @@
method: "POST",
showLoading: true,
};
request(queryKey, options).then((res) => {
request(queryKey, options).then((res) => {
console.log(stringToJson(res.bizContent));
const data = stringToJson(res.bizContent)
console.log("轮播图", data)

+ 5
- 5
pages/order/components/order-list-item-new.vue Näytä tiedosto

@@ -84,10 +84,10 @@

<!-- 待收货 -->
<view class="btns" v-else-if="item.orderStep == OrderStatus.待收货">
<view class="btn btn-normal" @click.stop="gotoCheckLogistics(item)">查看物流
</view>
<view class="btn btn-normal" @click.stop="gotoReturnOrder(item)">申请退货
</view>
<view class="btn btn-normal" @click.stop="gotoCheckLogistics(item)">查看物流</view>
<!-- 待收货异地 发货之后确认收货之前可以补货 -->
<view class="btn btn-normal" @click.stop="gotoReplenishmentOrder(item)" v-if="item.deviceType == deviceType">申请补货</view>
<view class="btn btn-normal" @click.stop="gotoReturnOrder(item)" v-else>申请退货</view>
<view class="btn btn-primary" @click.stop="gotoConfirmReceipt(item)">确认收货</view>
<view class="btn btn-primary" @click.stop="closeOrder(item)" v-if="item.finishOrder">结束订单</view>
</view>
@@ -95,7 +95,7 @@
<!-- 待激活 -->
<view class="btns" v-else-if="item.orderStep == OrderStatus.待激活">
<view class="btn btn-normal" @click.stop="gotoReturnOrder(item)" v-if="item.applyReturn">申请退货</view>
<view class="btn btn-normal" @click.stop="gotoReturnOrder(item)" v-if="item.applyReturn || item.deviceType == deviceType">申请退货</view>
<view class="btn btn-normal" @click.stop="gotoExchangeOrder(item)">申请换货</view>
<view class="btn btn-normal" @click.stop="gotoReplenishmentOrder(item)" v-if="item.deviceType == deviceType">申请补货</view>
<view class="btn btn-primary" @click.stop="gotoActiveOrder(item)">去激活</view>

+ 1
- 0
subpackage/after-sale/deviceInfo/deviceInfo.vue Näytä tiedosto

@@ -226,6 +226,7 @@
console.log(cmdArr);
console.log(bluetoothUtil);
bluetoothUtil.transCmd(cmdArr, '10', function(res) { //10:写卡 20:写OBU
console.log("5201",res)
let str = res[2].substring(res[2].length - 4, res[2].length); //判断是否为9000
let str3 = res[3].substring(res[3].length - 4, res[3].length); //判断是否为9000
if (str == "9000" || str3 == "9000") {

+ 18
- 10
subpackage/carPark/channelSing/select-car.vue Näytä tiedosto

@@ -36,6 +36,8 @@
import {
getVehiclePlateColor
} from "@/datas/vehiclePlateColor";
import { deviceType } from "@/utils/network/difference";
import { jump } from "@/datas/9901Jump.js";
const state = reactive({
list: [],
starts: false,
@@ -73,22 +75,28 @@
request(orderList, options).then((res) => {
let dataAll = [...state.list, ...stringToJson(res.bizContent).data]
state.list =dataAll;
console.log("state.list",state.list)
})
};

const flag = ref("0");
const choose = (i,item) => {
console.log("item", item);
// #ifdef MP-ALIPAY
uni.navigateTo({
url: `/subpackage/orders/sign-up-ali?orderId=${item.orderId}&&channelSing=1&&vehiclePlate=${item.vehiclePlate}`,
});
// #endif
// #ifdef MP-WEIXIN
uni.navigateTo({
url: `/subpackage/orders/sign-up?orderId=${item.orderId}&&channelSing=1&&vehiclePlate=${item.vehiclePlate}`,
});
// #endif
if (item.deviceType == deviceType) {
const params = encodeURIComponent(JSON.stringify(item))
jump('19', params)
}else{
// #ifdef MP-ALIPAY
uni.navigateTo({
url: `/subpackage/orders/sign-up-ali?orderId=${item.orderId}&&channelSing=1&&vehiclePlate=${item.vehiclePlate}`,
});
// #endif
// #ifdef MP-WEIXIN
uni.navigateTo({
url: `/subpackage/orders/sign-up?orderId=${item.orderId}&&channelSing=1&&vehiclePlate=${item.vehiclePlate}`,
});
// #endif
}
};
onReachBottom(() => {
if (state.list.length < state.pageNo * 10) return state.flags = true

+ 4
- 2
subpackage/orders/order-details-new.vue Näytä tiedosto

@@ -434,15 +434,17 @@
<!-- 待收货 -->
<view v-if="state.orderInfo.orderStep == OrderStatus.待收货" class="btn-status">
<view class="btn space" @click="gotoCheckLogistics(state.orderInfo)">查看物流</view>
<view class="btn space" @click="gotoReturnOrder(state.orderInfo)">申请退货</view>
<view class="btn space" @click.stop="gotoReplenishmentOrder(state.orderInfo)" v-if="state.orderInfo.deviceType == deviceType">申请补货</view>
<view class="btn space" @click="gotoReturnOrder(state.orderInfo)" v-else>申请退货</view>
<view class="btn-green space" @click="gotoConfirmReceipt(state.orderInfo)">确认收货</view>
<view class="btn-green" @click.stop="closeOrder(state.orderInfo)"
v-if="state.orderInfo.finishOrder">结束订单</view>
</view>
<!-- 待激活 -->
<!-- 确认收货之后可以退换补 异地 -->
<view v-if="state.orderInfo.orderStep == OrderStatus.待激活" class="btn-status">
<view class="btn space" @click="gotoReturnOrder(state.orderInfo)"
v-if="state.orderInfo.applyReturn">申请退货</view>
v-if="state.orderInfo.applyReturn || state.orderInfo.deviceType == deviceType">申请退货</view>
<view class="btn space" @click="gotoExchangeOrder(state.orderInfo)">申请换货</view>
<view class="btn space" @click.stop="gotoReplenishmentOrder(state.orderInfo)" v-if="state.orderInfo.deviceType == deviceType">申请补货</view>
<view class="btn-green space" @click="gotoActiveOrder(state.orderInfo)">去激活</view>

+ 1
- 1
subpackage/orders/order_payment.vue Näytä tiedosto

@@ -92,7 +92,7 @@
type: 2,
data: {
orderId: state.orderId,
wxOpenid: data.openId,
wxOpenid: data.openId?data.openId:data.alipayUserId,
payType: val.payType
},
method: "POST",

+ 275
- 0
subpackage/orders/sign-up-ali-yd.vue Näytä tiedosto

@@ -0,0 +1,275 @@
<template>
<image style="
margin-top: 20rpx;
width: 100%;
height: 240rpx;
background-color: #eeeeee;
" :src="`${$imgUrl}applyCard/car-service.png`"></image>
<view class="title"> 支付宝签约代扣 </view>
<view class="value">
<view class="content_1">
支付宝签约代扣是支付宝支付为车主用户提供的安全便捷的智慧服务
</view>
<view class="content_2">
本次将为贵州黔通智联科技股份有限公司开启免密支付服务,后续相关的费用将通过支付宝签约代扣从你的支付宝账户扣除
</view>
<view class="content_3">
注:签约成功后请返回本页面,再次点击开通服务
</view>
</view>
<view class="as-layout-horizontal agreement">
<checkbox-group @change="checkboxChange">
<checkbox :checked="state.checked" style="transform: scale(0.8)" />我已阅读并同意
</checkbox-group>
<text style="color:#007AFF;text-decoration: underline;" @click="downAuthD()">《代扣协议》</text>
</view>
<view class="action">
<button type="default" class="button" @click="savaHandle()">
开通服务
</button>
</view>
</template>

<script setup lang="ts">
import { onLoad, onShow } from "@dcloudio/uni-app";
import { reactive } from "vue";
import { request } from "@/utils/network/request.js";

import { stringToJson } from "@/utils/network/encryption";
import { fileURL } from "@/datas/fileURL.js";
import { msg, confirm } from "@/utils/utils";
import {
aliPayConfigIdTwo,
obtainUserId,
infoQuery,
envs, signTest
} from "@/utils/network/api";
const imgURL = `${fileURL}image/`;
import { getItem } from "@/utils/storage";
const state = reactive({
openid: "",
orderId: "",
id: "",
clientFee: "",
code: "",
checked: false,
agreeURL: "",
});
onLoad((option : any) => {
state.orderId = option.orderId;
getInfo();
});
const checkboxChange = (e) => {
state.checked = !state.checked;
console.log(state.checked);
};
const downAuthD = () => {
uni.downloadFile({
url: state.agreeURL,
filePath: uni.env.USER_DATA_PATH + '/' + '代扣协议.docx',
success(res) {
const filePath = res.filePath
uni.openDocument({
filePath: filePath,
fileType: 'docx',
showMenu: true, //关键点
success: function (res) {
},
fail: function (err) {
msg("打开文档失败");
}
});
},
fail: function (err) {
msg("下载文档失败");
console.log("err", err)
},
complete(res) {

}
})
}
const getInfo = () => {
//参数说明
let options = {
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
data: {
businessType: 'WITHHOLD_AGREEMENT' //代扣协议
}, //请求参数
method: "POST", //提交方式(默认POST)
showLoading: true, //是否显示加载中(默认显示)
};

//调用方式
request(infoQuery, options)
.then((res) => {
let data = stringToJson(res.bizContent)
if (data.textType = "URL") {
state.agreeURL = envs[process.env.NODE_ENV].baseUrl + data.text
}
console.log("代扣协议", state.agreeURL);
})
.catch((err) => {
console.log(err);
});
}
const savaHandle = () => {
if (!state.checked) {
msg("请勾选协议!")
return;
}
my.getAuthCode({
scopes: 'auth_user',
success: res => {
// 获取需要的用户信息
state.code = res.authCode
//如果获取openId成功
if (state.code) {
console.log("code*******", state.code);
const optionsUser = {
type: 2,
data: {
payConfigId: aliPayConfigIdTwo,
code: res.authCode,
mobile:getItem('mobile')
},
method: "POST",
showLoading: true,
};
console.log('支付宝用户编号请求:', optionsUser)

request(obtainUserId, optionsUser).then((res) => {
console.log('支付宝用户编号返回:', res,res.bizContent)
// const bizContent = stringToJson(res.bizContent);
var data = {
outOrderId: state.orderId,
// subOpenId: bizContent.openId,
};
const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
request(signTest, options).then((res) => {
console.log("res*******", res);
const data = stringToJson(res.bizContent);
console.log("data*******", data);
if (data.signStatusCode === "WAIT_SIGN") {
//待签约
my.ap.navigateToAlipayPage({
path: "https://render.alipay.com/p/yuyan/180020010001250649/sign.html?orderId=" + data.alipayOrderId
});
} else if (data.signStatusCode === "SIGNED" || data.signStatusCode === "ACTIVED") {
//已签约
// msg("已签约");
confirm("您已完成签约,等待业务员审核发货", () => {
uni.switchTab({
url: "/pages/order/order"
})
}, "已完成签约", false);
} else if (data.signStatusCode === "UNSIGN") {
//已解约
// msg("已解约");
confirm(
"您已解约!",
() => {
uni.switchTab({
url: "/pages/order/order"
})
},
"您已解约",
false
);
}
});

})


} else {
//如果获取openId失败
uni.showToast({
title: "网络异常,请重试!",
icon: "none",
duration: 1000,
});
return;
}
},
fail: err => {
console.log('my.getAuthCode 调用失败', err)
}
});

}
</script>

<style lang="scss" scoped>
.action {
margin-top: 40rpx;
padding-left: 20rpx;
padding-right: 20rpx;
padding-bottom: 30rpx;

.button {
height: 80rpx;
background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
border-radius: 40rpx;
font-size: 32rpx;
font-weight: 400;
color: #ffffff;
line-height: 80rpx;
}
}

.title {
text-align: center;
margin-top: 15rpx;
font-size: 36rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #333333;
line-height: 36rpx;
}

.value {
padding: 0rpx 60rpx;
}

.content_1 {
margin-top: 60rpx;
font-size: 30rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #666666;
line-height: 58rpx;
}

.content_2 {
margin-top: 50rpx;
font-size: 30rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #666666;
line-height: 58rpx;
}

.content_3 {
margin-top: 50rpx;
font-size: 30rpx;
font-family: Microsoft YaHei;
font-weight: 400;
color: #ff0000;
line-height: 58rpx;
}

.agreement {
font-size: 30rpx;
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
align-items: center;
justify-content: center;
}
</style>

+ 3
- 1
utils/network/api.js Näytä tiedosto

@@ -308,4 +308,6 @@ export const oneOreTwo = "3e09b1199e854a91a4d3a9329e734b8d" //判断诺德订
export const ndActivateVerification = "6aeefd1ec9c1469fae240b9dca3733a4" //诺德激活验证接口
export const versionVerificationApi = "d4f9dd3758ca41a1baa4f191df728f8b" //卡签版本校验接口
export const interceptNDApi = "d8445c8b368d4b57bb6774aa51b91bb0" //拦截诺德
export const getOnLineUrlApi = "4b173ee5f550478ca22d4681fa9d8b42" //在线客服
export const getOnLineUrlApi = "4b173ee5f550478ca22d4681fa9d8b42" //在线客服

export const signTest = "880ae48d40704572bac521b2fa11e93e" //异地支付宝签约检测

+ 1
- 1
utils/network/request.js Näytä tiedosto

@@ -265,7 +265,7 @@ export function request(code, options = {}, start = false) {
reject(res.data.errorMsg)
return
} else {
console.log("res===",res)
let content = s4.decryptData_CBC(res, sm4Key)
console.log('请求成功返回参数:', code, content.data)
resolve(content.data)

+ 240
- 0
utils/util/encoder.js Näytä tiedosto

@@ -0,0 +1,240 @@
'use strict';

// #ifdef MP-WEIXIN
(function(r) {
function x() {}

function y() {}
var z = String.fromCharCode,
v = {}.toString,
A = v.call(r.SharedArrayBuffer),
B = v(),
q = r.Uint8Array,
t = q || Array,
w = q ? ArrayBuffer : t,
C = w.isView || function(g) {
return g && "length" in g
},
D = v.call(w.prototype);
w = y.prototype;
var E = r.TextEncoder,
a = new(q ? Uint16Array : t)(32);
x.prototype.decode = function(g) {
if (!C(g)) {
var l = v.call(g);
if (l !== D && l !== A && l !== B) throw TypeError(
"Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"
);
g = q ? new t(g) : g || []
}
for (var f = l = "", b = 0, c = g.length | 0, u = c - 32 | 0, e, d, h = 0, p = 0, m, k = 0, n = -1; b <
c;) {
for (e = b <= u ? 32 : c - b | 0; k < e; b = b + 1 | 0, k = k + 1 | 0) {
d = g[b] & 255;
switch (d >> 4) {
case 15:
m = g[b = b + 1 | 0] & 255;
if (2 !== m >> 6 || 247 < d) {
b = b - 1 | 0;
break
}
h = (d & 7) << 6 | m & 63;
p = 5;
d = 256;
case 14:
m = g[b = b + 1 | 0] & 255, h <<= 6, h |= (d & 15) << 6 | m & 63, p = 2 === m >> 6 ? p +
4 | 0 : 24, d = d + 256 & 768;
case 13:
case 12:
m = g[b = b + 1 | 0] & 255, h <<= 6, h |= (d & 31) << 6 | m & 63, p = p + 7 | 0, b <
c && 2 === m >> 6 && h >> p && 1114112 > h ? (d = h, h = h - 65536 | 0, 0 <= h && (
n = (h >> 10) + 55296 | 0, d = (h & 1023) + 56320 | 0, 31 > k ? (a[k] = n,
k = k + 1 | 0, n = -1) :
(m = n, n = d, d = m))) : (d >>= 8, b = b - d - 1 | 0, d = 65533), h = p = 0,
e = b <= u ? 32 : c - b | 0;
default:
a[k] = d;
continue;
case 11:
case 10:
case 9:
case 8:
}
a[k] = 65533
}
f += z(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[
14], a[15], a[16], a[17], a[18], a[19], a[20], a[21], a[22], a[23], a[24], a[25], a[26], a[
27], a[28], a[29], a[30], a[31]);
32 > k && (f = f.slice(0, k - 32 | 0));
if (b < c) {
if (a[0] = n, k = ~n >>> 31, n = -1, f.length < l.length) continue
} else - 1 !== n && (f += z(n));
l += f;
f = ""
}
return l
};
w.encode = function(g) {
g = void 0 === g ? "" : "" + g;
var l = g.length |
0,
f = new t((l << 1) + 8 | 0),
b, c = 0,
u = !q;
for (b = 0; b < l; b = b + 1 | 0, c = c + 1 | 0) {
var e = g.charCodeAt(b) | 0;
if (127 >= e) f[c] = e;
else {
if (2047 >= e) f[c] = 192 | e >> 6;
else {
a: {
if (55296 <= e)
if (56319 >= e) {
var d = g.charCodeAt(b = b + 1 | 0) | 0;
if (56320 <= d && 57343 >= d) {
e = (e << 10) + d - 56613888 | 0;
if (65535 < e) {
f[c] = 240 | e >> 18;
f[c = c + 1 | 0] = 128 | e >> 12 & 63;
f[c = c + 1 | 0] = 128 | e >> 6 & 63;
f[c = c + 1 | 0] = 128 | e & 63;
continue
}
break a
}
e = 65533
} else 57343 >= e && (e = 65533);!u && b << 1 < c && b << 1 < (c - 7 | 0) && (u = !
0, d = new t(3 * l), d.set(f), f = d)
}
f[c] = 224 | e >> 12;f[c = c + 1 | 0] = 128 | e >> 6 & 63
}
f[c = c + 1 | 0] = 128 | e & 63
}
}
return q ?
f.subarray(0, c) : f.slice(0, c)
};
E || (r.TextDecoder = x, r.TextEncoder = y)
})("" + void 0 == typeof global ? "" + void 0 == typeof self ? this : self : global); //AnonyCo
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/EncoderDecoderTogether.min.js.map
// #endif


// #ifdef MP-ALIPAY
(function(r) {
function x() {}

function y() {}
var z = String.fromCharCode,
v = {}.toString,
A = v.call(r.SharedArrayBuffer),
B = v(),
q = r.Uint8Array,
t = q || Array,
w = q ? ArrayBuffer : t,
C = w.isView || function(g) {
return g && "length" in g
},
D = v.call(w.prototype);
w = y.prototype;
var E = r.TextEncoder,
a = new(q ? Uint16Array : t)(32);
x.prototype.decode = function(g) {
if (!C(g)) {
var l = v.call(g);
if (l !== D && l !== A && l !== B) throw TypeError(
"Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"
);
g = q ? new t(g) : g || []
}
for (var f = l = "", b = 0, c = g.length | 0, u = c - 32 | 0, e, d, h = 0, p = 0, m, k = 0, n = -1; b <
c;) {
for (e = b <= u ? 32 : c - b | 0; k < e; b = b + 1 | 0, k = k + 1 | 0) {
d = g[b] & 255;
switch (d >> 4) {
case 15:
m = g[b = b + 1 | 0] & 255;
if (2 !== m >> 6 || 247 < d) {
b = b - 1 | 0;
break
}
h = (d & 7) << 6 | m & 63;
p = 5;
d = 256;
case 14:
m = g[b = b + 1 | 0] & 255, h <<= 6, h |= (d & 15) << 6 | m & 63, p = 2 === m >> 6 ? p +
4 | 0 : 24, d = d + 256 & 768;
case 13:
case 12:
m = g[b = b + 1 | 0] & 255, h <<= 6, h |= (d & 31) << 6 | m & 63, p = p + 7 | 0, b <
c && 2 === m >> 6 && h >> p && 1114112 > h ? (d = h, h = h - 65536 | 0, 0 <= h && (
n = (h >> 10) + 55296 | 0, d = (h & 1023) + 56320 | 0, 31 > k ? (a[k] = n,
k = k + 1 | 0, n = -1) :
(m = n, n = d, d = m))) : (d >>= 8, b = b - d - 1 | 0, d = 65533), h = p = 0,
e = b <= u ? 32 : c - b | 0;
default:
a[k] = d;
continue;
case 11:
case 10:
case 9:
case 8:
}
a[k] = 65533
}
f += z(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[
14], a[15], a[16], a[17], a[18], a[19], a[20], a[21], a[22], a[23], a[24], a[25], a[26], a[
27], a[28], a[29], a[30], a[31]);
32 > k && (f = f.slice(0, k - 32 | 0));
if (b < c) {
if (a[0] = n, k = ~n >>> 31, n = -1, f.length < l.length) continue
} else - 1 !== n && (f += z(n));
l += f;
f = ""
}
return l
};
w.encode = function(g) {
g = void 0 === g ? "" : "" + g;
var l = g.length |
0,
f = new t((l << 1) + 8 | 0),
b, c = 0,
u = !q;
for (b = 0; b < l; b = b + 1 | 0, c = c + 1 | 0) {
var e = g.charCodeAt(b) | 0;
if (127 >= e) f[c] = e;
else {
if (2047 >= e) f[c] = 192 | e >> 6;
else {
a: {
if (55296 <= e)
if (56319 >= e) {
var d = g.charCodeAt(b = b + 1 | 0) | 0;
if (56320 <= d && 57343 >= d) {
e = (e << 10) + d - 56613888 | 0;
if (65535 < e) {
f[c] = 240 | e >> 18;
f[c = c + 1 | 0] = 128 | e >> 12 & 63;
f[c = c + 1 | 0] = 128 | e >> 6 & 63;
f[c = c + 1 | 0] = 128 | e & 63;
continue
}
break a
}
e = 65533
} else 57343 >= e && (e = 65533);!u && b << 1 < c && b << 1 < (c - 7 | 0) && (u = !
0, d = new t(3 * l), d.set(f), f = d)
}
f[c] = 224 | e >> 12;f[c = c + 1 | 0] = 128 | e >> 6 & 63
}
f[c = c + 1 | 0] = 128 | e & 63
}
}
return q ?
f.subarray(0, c) : f.slice(0, c)
};
E || (r.TextDecoder = x, r.TextEncoder = y)
})("" + void 0 == typeof $global ? "" + void 0 == typeof self ? this : self : $global); //AnonyCo
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/EncoderDecoderTogether.min.js.map
// #endif

+ 30
- 6
utils/util/fileData.js Näytä tiedosto

@@ -1,7 +1,16 @@
import {
TextEncoder,
TextDecoder
} from "../node-model/text-decoding";
// import {
// TextEncoder,
// TextDecoder
// } from "../node-model/text-decoding";
import "./encoder.js"

// #ifdef MP-WEIXIN
console.log("global", global)
// #endif

// #ifdef MP-ALIPAY
console.log("global", $global)
// #endif

export function IntegerToHexString(num, nLen) {
if (num == null) {
@@ -27,7 +36,15 @@ export function HighAddZero(str, nLen) {
}
export function AsciToHexString(strAsci, nLen) {
let s = String(strAsci);
let encoder = new TextEncoder("UTF-8");

// #ifdef MP-WEIXIN
let encoder = new global.TextEncoder("UTF-8");
// #endif

// #ifdef MP-ALIPAY
let encoder = new $global.TextEncoder("UTF-8");
// #endif
// let encoder = new TextEncoder("UTF-8");
// let encoder = new TextEncoder("gbk");
// let bytes = encode(str, 'gbk');
let bytes = encoder.encode(s);
@@ -75,7 +92,14 @@ export function HexToStrig(data, charType = 1) {
}
const asd = hexStringToByteArray(data);
try {
str = new TextDecoder("GBK").decode(asd);
// #ifdef MP-WEIXIN
let str = new global.TextDecoder("GBK").decode(asd)
// #endif

// #ifdef MP-ALIPAY
let str = new $global.TextDecoder("GBK").decode(asd)
// #endif
// str = new TextDecoder("GBK").decode(asd);

} catch (e) {
console.error(e);

Loading…
Peruuta
Tallenna