Parcourir la source

优化代码

ms
zhoujie il y a 1 an
Parent
révision
26975005ea
3 fichiers modifiés avec 17 ajouts et 6 suppressions
  1. 2
    2
      .env.production
  2. 1
    1
      pages/payment/payment.vue
  3. 14
    3
      utils/network/encryption.js

+ 2
- 2
.env.production Voir le fichier

@@ -13,5 +13,5 @@ ENV = 'production'
# VITE_APP_BASE_URL ='https://qtzl.etcjz.cn/' # 试运行地址
# VITE_APP_UPLOAD_URL = "https://qtzl.etcjz.cn" #试运行地址
# VITE_APP_BASE_URL ='https://testmedusa.etcjz.cn/ifzt/api/interfaceMidGroundIn'
VITE_APP_TYPE = 'dev' #打测试环境的包
# VITE_APP_TYPE = 'production' #打生产环境的包
# VITE_APP_TYPE = 'dev' #打测试环境的包
VITE_APP_TYPE = 'production' #打生产环境的包

+ 1
- 1
pages/payment/payment.vue Voir le fichier

@@ -31,7 +31,7 @@
<text class="amount">¥{{handleAmount(amountData.actualPayment)}}</text>
</view>

<Hetong v-model="checked" :link='link'/>
<Hetong v-model="checked" :link='link' v-if='link'/>
<button type="success" class="btn-txt btn" @click="submit">确认办理</button>
</view>
<u-toast ref="uToastRef" />

+ 14
- 3
utils/network/encryption.js Voir le fichier

@@ -24,8 +24,18 @@ const s4 = new SM4Util()

const _signCode = "etc123456"; //签名码

function pad2(n) {
return n < 10 ? "0" + n : n;
function pad2(n, isMill = false) {
if (isMill) {
if (n < 10) {
return "00" + n
} else if (n < 100 && n >= 10) {
return "0" + n
} else {
return n
}
} else {
return n < 10 ? "0" + n : n;
}
}

//获取时间ymdHis
@@ -38,7 +48,7 @@ function getDate() {
pad2(date.getHours()) +
pad2(date.getMinutes()) +
pad2(date.getSeconds()) +
pad2(date.getMilliseconds())
pad2(date.getMilliseconds(),true)
);
}

@@ -178,6 +188,7 @@ export function encryption(ifCode, subdata, type) {
}
// requestData["signType"] = "MD5"; // || "NONE"
requestData["reqId"] = requestData["appId"] + "_" + getDate() + "_" + generateMixed(5);
console.log(requestData["appId"] + "_" + getDate() + "_" + generateMixed(5));
requestData["timestamp"] = formatTime(new Date());

// if (import.meta.env.MODE === 'production') {

Chargement…
Annuler
Enregistrer