Commit 55374e15 by 宋冰琦

修改toast文案 修改头像昵称获取方式

parent 546e7ac8
import App from './App';
import App from "./App";
//引入vuex
import store from './store';
import utils from './utils/utils';
import store from "./store";
import utils from "./utils/utils";
// console.log(Vue.$u,22)
// 需要在Vue.use(uView)之后执行
// #ifndef VUE3
import Vue from 'vue';
import Vuex from 'vuex'
import uView from 'uview-ui';
import User from '@/request/user';
import Vue from "vue";
import Vuex from "vuex";
import uView from "uview-ui";
import User from "@/request/user";
// main.js
import initToast from "@/components/bocft-toast/initToast.js"
import showToast from "@/components/bocft-toast/bocft-toast.vue"
import taBar from "@/components/tabBar/tabBar.vue"
import initToast from "@/components/bocft-toast/initToast.js";
import showToast from "@/components/bocft-toast/bocft-toast.vue";
import taBar from "@/components/tabBar/tabBar.vue";
initToast(Vue);
Vue.component('show-toast',showToast);
Vue.component('taBar',taBar);
Vue.component("show-toast", showToast);
Vue.component("taBar", taBar);
Vue.use(uView);
Vue.prototype.$utils = utils;
Vue.prototype.setPrice = (price) => price && Number(price).toFixed(2);
Vue.prototype.loginByPhoneNumber = (e) => {
if (e.detail.errMsg == 'getPhoneNumber:ok') {
if (e.detail.errMsg == "getPhoneNumber:ok") {
User.getPhoneNumber(e);
} else if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
uni.showToast({ title: '已拒绝手机号授权', icon: 'error' });
} else if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
uni.showToast({
title: "已拒绝手机号授权,请同意授权",
icon: "error",
});
}
};
Vue.config.productionTip = false;
App.mpType = 'app';
App.mpType = "app";
const app = new Vue({
...App,
store,
});
export default app
export default app;
app.$mount();
require('./request/index')(app);
require("./request/index")(app);
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue';
import { createSSRApp } from "vue";
export function createApp() {
const app = createSSRApp(App);
return {
......
import { $EventBus } from '@/utils/EventBus';
import context from '../../main.js'
import Order from '@/request/order/index.js'
import { $EventBus } from "@/utils/EventBus";
import context from "../../main.js";
import Order from "@/request/order/index.js";
export default {
// 获取菜单列表
getMenuList(id) {
return uni.$u.http
.get('/weixin/infoByShop', {
.get("/weixin/infoByShop", {
params: {
shopId: id,
},
......@@ -14,24 +14,27 @@ export default {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
// 获取点单屏幕的订单信息
getScreenShopCar(key, location, sendData) {
return uni.$u.http
.post('/application/getData', {
.post("/application/getData", {
key,
location,
...sendData
...sendData,
})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: '服务器错误',
icon: 'none',
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
return err;
});
......@@ -39,108 +42,108 @@ export default {
// 下单获取预支付订单
saveReserve(data) {
return uni.$u.http
.post('/order', data)
.post("/order", data)
.then((res) => {
return res;
})
.catch((err) => { });
.catch((err) => {});
},
// saveReserve 为业务接口
requestPayment(data, oldData, buyType, agreeTerms) {
// res为调起微信支付所需参数
// 调起微信支付
if(data.appId) {
const { switchTab = true, callBack } = data
if (data.appId) {
const { switchTab = true, callBack } = data;
uni.requestPayment({
provider: 'wxpay', // 服务提提供商微信支付
provider: "wxpay", // 服务提提供商微信支付
timeStamp: data.timeStamp, // 时间戳
nonceStr: data.nonceStr, // 随机字符串
package: data.package,
signType: data.signType || 'MD5', // 签名算法
signType: data.signType || "MD5", // 签名算法
paySign: data.paySign, // 签名
success: async function (res) {
if (res.errMsg == 'requestPayment:ok') {
if (res.errMsg == "requestPayment:ok") {
// 删除购物车数据后重新放回购物车
uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId);
if(agreeTerms)uni.setStorageSync('TermsStatus',true)
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index?from=settlement'
uni.navigateTo({ url })
}else{
callBack()
uni.setStorageSync("shopCarInfo", []);
$EventBus.$emit("updateCar");
uni.setStorageSync("orderId", data.orderId);
if (agreeTerms) uni.setStorageSync("TermsStatus", true);
if (switchTab) {
let url =
"/orderSubPackage/pages/orderInfo/index?from=settlement";
uni.navigateTo({ url });
} else {
callBack();
}
}
// 业务逻辑。。。
},
fail: async function (err) {
context.showToast({
title: '支付失败',
icon: 'error',
title: "支付失败,再试一试!",
icon: "error",
});
uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId);
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index?from=settlement'
uni.navigateTo({ url })
}else{
callBack()
uni.setStorageSync("shopCarInfo", []);
$EventBus.$emit("updateCar");
uni.setStorageSync("orderId", data.orderId);
if (switchTab) {
let url = "/orderSubPackage/pages/orderInfo/index?from=settlement";
uni.navigateTo({ url });
} else {
callBack();
}
},
});
}else{
uni.setStorageSync('orderId', data);
let url = '/orderSubPackage/pages/orderInfo/index?from=settlement'
uni.navigateTo({ url })
} else {
uni.setStorageSync("orderId", data);
let url = "/orderSubPackage/pages/orderInfo/index?from=settlement";
uni.navigateTo({ url });
}
},
// 优惠卷信息接口
requestTicketList(data){
// 优惠卷信息接口
requestTicketList(data) {
return uni.$u.http
.post('/app/order/coupon/info', data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: '服务器错误',
icon: 'none',
.post("/app/order/coupon/info", data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
return err;
});
return err;
});
},
// 下单页面优惠卷可用数量
requestTicketNum(data){
requestTicketNum(data) {
return uni.$u.http
.post('/app/order/coupon/fitable-count', data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: '服务器错误',
icon: 'none',
.post("/app/order/coupon/fitable-count", data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
return err;
});
return err;
});
},
// 首页调用发送优惠券接口
sendUserCoupon(data) {
return uni.$u.http
.post('/v1/issue/user/coupon', data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: '服务器错误',
icon: 'none',
.post("/v1/issue/user/coupon", data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
return err;
});
return err;
});
}
},
};
import context from '../../main.js'
import context from "../../main.js";
export default {
getList(id) {},
getMsg() {
return uni.$u.http
.get('/system/message/list', {})
.get("/system/message/list", {})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
read(data) {
return uni.$u.http
.put('/system/message', data)
.put("/system/message", data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
getMessageCount() {
return uni.$u.http
.get('/app/getMessageCount', {})
.get("/app/getMessageCount", {})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
// 获取用户优惠卷列表
getUserList(data) {
return uni.$u.http
.get(`/app/coupon/list/${data}`, {})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
});
.get(`/app/coupon/list/${data}`, {})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
// 获取用户信息
getUserInfo() {
return uni.$u.http
.get(`/system/customer/detail`, {})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
});
.get(`/system/customer/detail`, {})
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
// 更改用户生日
editBirthdat(data) {
return uni.$u.http
.post(`/system/customer/update/birth`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: err.data.msg, icon: 'none' });
return err
});
.post(`/system/customer/update/birth`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: err.data.msg, icon: "none" });
return err;
});
},
// 更改用户昵称、性别
editUserInfo(data) {
return uni.$u.http
.post(`/system/customer/update/base`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
});
.post(`/system/customer/update/base`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
// 更改用户头像
editUserAvatar(data) {
return uni.$u.http
.post(`/system/customer/update/avatar-url`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
});
.post(`/system/customer/update/avatar-url`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({
title: "哎哟!刚刚走神了,请退出后重进",
icon: "none",
});
});
},
};
export default {
getMyOrder() {
return uni.$u.http
.get('/app/getMyOrder', {
.get("/app/getMyOrder", {
params: {},
custom: {noLoading: true},
custom: { noLoading: true },
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
orderRefund(data) {
return uni.$u.http
.post('/system/refund', data)
.post("/system/refund", data)
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
getShop(params) {
return uni.$u.http
.get('/weixin/getArea', {
.get("/weixin/getArea", {
params,
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
// 校验sku是否可用
chekSku(params) {
return uni.$u.http
.get('/application/checkSku', {
.get("/application/checkSku", {
params,
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
cancelOrder(params) {
return uni.$u.http
.get('order/cancel', {
.get("order/cancel", {
params,
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
// 立即支付
payOrder(params) {
console.log(params,'params')
console.log(params, "params");
return uni.$u.http
.get('order/payOrder', {
.get("order/payOrder", {
params,
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
getHomeOrder(params) {
return uni.$u.http
.get(`/app/getHomeOrder?shopId=${params.shopId}`, {
params: {},
custom: {noLoading: true},
custom: { noLoading: true },
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
getWaitTine(data) {
return uni.$u.http
.post('app/getWaitTine', data)
.post("app/getWaitTine", data)
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
moreOrder(params) {
return uni.$u.http
.get('/app/getNextOrder', {
.get("/app/getNextOrder", {
params,
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
checkSku(params) {
const shopInfo = JSON.parse(uni.getStorageSync('shopInfo'))
const shopInfo = JSON.parse(uni.getStorageSync("shopInfo"));
return uni.$u.http
.get(`/application/checkSku?shopId=${shopInfo.id}&skuId=${params.skuId}`)
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
getOrderDetail(params) {
......@@ -114,18 +114,18 @@ export default {
.get(`/order/${params.orderId}`)
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
});
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
getOrderWaiteTime(params) {
return uni.$u.http
.get(`/app/getWaitTineByOrderId?orderId=${params.orderId}`)
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
});
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
// 获取退款详情
getRefundInfo(params) {
......@@ -133,8 +133,8 @@ export default {
.get(`/system/refund/list/${params}`)
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '服务器错误', icon: 'none' })
console.log('服务器错误');
});
}
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
},
};
import Config from '../static/config/index.js';
import WXBizDataCrypt from './WXBizDataCrypt.js';
import context from '../main.js'
import { $EventBus } from './EventBus';
import Config from "../static/config/index.js";
import WXBizDataCrypt from "./WXBizDataCrypt.js";
import context from "../main.js";
import { $EventBus } from "./EventBus";
export default {
// 组装提交订单数据
......@@ -19,7 +19,7 @@ export default {
realAmount: item.sku.discount * item.num, //实付金额
amount: item.sku.price * item.num, //总价格
specRuleDetail: JSON.stringify(item.sku.rules), //规格选项详情
specRuleIds: item.sku.rules.map((item) => item.ruleId).join(','), //规格选项详情
specRuleIds: item.sku.rules.map((item) => item.ruleId).join(","), //规格选项详情
skuId: item.skuId, //"sku ID"
goodsCategory: item.categoryId, //商品分类
};
......@@ -38,30 +38,32 @@ export default {
return DAta;
} else {
context.showToast({
title: '请选择商品',
title: "请选择商品",
});
}
},
// 加入购物车数据
async getallNum(Obj, unCheckCount) {
console.log(Obj);
let shopCarInfo = uni.getStorageSync('shopCarInfo') || [];
let shopCarInfo = uni.getStorageSync("shopCarInfo") || [];
let size = 0;
shopCarInfo.forEach((item) => (size += item.num));
if(!unCheckCount) {
let countOfOrder = uni.getStorageSync('countOfOrder') || 9;
if (size >= countOfOrder) {
context.showToast({
title: '最多可一次购买'+countOfOrder+'杯',
icon: 'none',
});
return false;
}
}
if (!unCheckCount) {
let countOfOrder = uni.getStorageSync("countOfOrder") || 9;
if (size >= countOfOrder) {
context.showToast({
title: "一次最多可购买" + countOfOrder + "杯",
icon: "none",
});
return false;
}
}
if (shopCarInfo) {
let currentGoods = shopCarInfo.find((v) => v.goodsId == Obj.goodsId && v.skuId == Obj.skuId);
let currentGoods = shopCarInfo.find(
(v) => v.goodsId == Obj.goodsId && v.skuId == Obj.skuId
);
if (currentGoods) {
currentGoods.num += Obj.num;
} else {
......@@ -71,8 +73,8 @@ export default {
shopCarInfo = [Obj];
}
console.log(Obj);
uni.setStorageSync('shopCarInfo', shopCarInfo);
$EventBus.$emit('updateCar');
uni.setStorageSync("shopCarInfo", shopCarInfo);
$EventBus.$emit("updateCar");
// if (callback) {
// callback();
// }
......@@ -82,11 +84,11 @@ export default {
let goodsList = [];
let size = 0;
goodsList.forEach((item) => (size += item.num));
let countOfOrder = uni.getStorageSync('countOfOrder');
let countOfOrder = uni.getStorageSync("countOfOrder");
if (size >= countOfOrder) {
context.showToast({
title: '最多可一次购买'+countOfOrder+'杯',
icon: 'none',
title: "一次最多可购买" + countOfOrder + "杯",
icon: "none",
});
return false;
}
......@@ -102,7 +104,7 @@ export default {
} else {
goodsList = [Obj];
}
uni.setStorageSync('goodsList', goodsList);
uni.setStorageSync("goodsList", goodsList);
},
// 解密手机
......@@ -123,16 +125,16 @@ export default {
});
} else {
context.showToast({
title: '二维码错误',
icon: 'none',
title: "二维码错误",
icon: "none",
});
}
}
},
fail() {
context.showToast({
icon: 'none',
title: '扫码失败',
icon: "none",
title: "扫码失败",
});
},
});
......@@ -141,40 +143,57 @@ export default {
var date = new Date();
date.setTime(value);
var month = date.getMonth() + 1;
if (month < 10) month = '0' + month;
if (month < 10) month = "0" + month;
var cdate = date.getDate();
if (cdate < 10) cdate = '0' + cdate;
if (cdate < 10) cdate = "0" + cdate;
var hours = date.getHours();
if (hours < 10) hours = '0' + hours;
if (hours < 10) hours = "0" + hours;
var minutes = date.getMinutes();
if (minutes < 10) minutes = '0' + minutes;
var time = date.getFullYear() + '-' + month + '-' + cdate + ' ' + hours + ':' + minutes;
if (minutes < 10) minutes = "0" + minutes;
var time =
date.getFullYear() +
"-" +
month +
"-" +
cdate +
" " +
hours +
":" +
minutes;
return time;
},
numberFixed(data, fixed = 2) {
if (data == undefined) {
return undefined;
} else if (data == 0) {
return '0';
return "0";
} else {
return (Math.round(Number(data) * Math.pow(10, fixed)) / Math.pow(10, fixed)).toFixed(fixed);
return (
Math.round(Number(data) * Math.pow(10, fixed)) / Math.pow(10, fixed)
).toFixed(fixed);
}
},
isInteger(value) {
return parseFloat(Number(value).toFixed(2))
return parseFloat(Number(value).toFixed(2));
},
// 计算经纬度之间的距离
// 根据经纬度计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
getDistances(lat1, lng1, lat2, lng2) {
function rad(d) {
return d * Math.PI / 180.0;
return (d * Math.PI) / 180.0;
}
var radLat1 = rad(lat1);
var radLat2 = rad(lat2);
var a = radLat1 - radLat2;
var b = rad(lng1) - rad(lng2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
var s =
2 *
Math.asin(
Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)
)
);
s = s * 6378.137; // EARTH_RADIUS;
// 输出为公里
s = Math.round(s * 10000) / 10000;
......@@ -183,11 +202,11 @@ export default {
var distance_str = "";
if (parseInt(distance) >= 1) {
// distance_str = distance.toFixed(1) + "km";
distance_str = distance.toFixed(2) + "km";
// distance_str = distance.toFixed(1) + "km";
distance_str = distance.toFixed(2) + "km";
} else {
// distance_str = distance * 1000 + "m";
distance_str = (distance * 1000).toFixed(2) + "m";
// distance_str = distance * 1000 + "m";
distance_str = (distance * 1000).toFixed(2) + "m";
}
//s=s.toFixed(4);
......@@ -195,13 +214,13 @@ export default {
// console.info('距离是', s);
// console.info('距离是', distance_str);
// return s;
//小小修改,这里返回对象
let objData = {
distance: distance,
distance_str: distance_str
}
return objData
distance: distance,
distance_str: distance_str,
};
return objData;
},
// 单位转换
getPx(rpx) {
......@@ -211,23 +230,23 @@ export default {
},
// 返回上一页
goBack() {
wx.navigateBack({
delta: 1
});
},
wx.navigateBack({
delta: 1,
});
},
// 解析url参数
getUrlParams2(url) {
// 通过 ? 分割获取后面的参数字符串
let urlStr = url.split('?')[1]
// 创建空对象存储参数
let obj = {};
// 再通过 & 将每一个参数单独分割出来
let paramsArr = urlStr.split('&')
for(let i = 0,len = paramsArr.length;i < len;i++){
// 再通过 = 将每一个参数分割为 key:value 的形式
let arr = paramsArr[i].split('=')
obj[arr[0]] = arr[1];
}
return obj
}
let urlStr = url.split("?")[1];
// 创建空对象存储参数
let obj = {};
// 再通过 & 将每一个参数单独分割出来
let paramsArr = urlStr.split("&");
for (let i = 0, len = paramsArr.length; i < len; i++) {
// 再通过 = 将每一个参数分割为 key:value 的形式
let arr = paramsArr[i].split("=");
obj[arr[0]] = arr[1];
}
return obj;
},
};
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