init\
This commit is contained in:
parent
e7378ee656
commit
a1fecbae8e
@ -1,2 +1,2 @@
|
||||
VUE_APP_BASE_API = '/mobile'
|
||||
VUE_APP_BACK_BASE_API = '/mobile'
|
||||
VUE_APP_BACK_ADMIN_API = '/api/admin'
|
||||
48
java-mall-app-shop-admin/.gitignore
vendored
Normal file
48
java-mall-app-shop-admin/.gitignore
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
/admin/
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Lock files
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
# package-lock.json
|
||||
|
||||
# Yarn v2 not using using Zero-Installs
|
||||
.yarn/*
|
||||
#!.yarn/cache
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
|
||||
# Vab
|
||||
public/video
|
||||
*.zip
|
||||
*.7z
|
||||
*.rar
|
||||
src/vab/styles/themes/red.scss
|
||||
/src/vab/styles/themes/red-black.scss
|
||||
/src/vab/styles/themes/red-white.scss
|
||||
/.history
|
||||
@ -1,16 +1,26 @@
|
||||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version": "0.0",
|
||||
"configurations": [{
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
}
|
||||
{
|
||||
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version" : "0.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"app-plus" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
"playground" : "standard",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
0
java-mall-app-shop-admin/403.vue
Normal file
0
java-mall-app-shop-admin/403.vue
Normal file
@ -1,19 +1,50 @@
|
||||
<script>
|
||||
// #ifdef APP-PLUS
|
||||
import APPUpdate, { getCurrentNo } from "@/config/appUpdate";
|
||||
// #endif
|
||||
import { GetAPPversion } from "@/api/checkAPPupdate";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
version: "",
|
||||
};
|
||||
},
|
||||
onLaunch: function () {
|
||||
console.log("App Launch");
|
||||
// #ifdef APP-PLUS
|
||||
getCurrentNo((res) => {
|
||||
this.version = res.version;
|
||||
console.log("asdas", res);
|
||||
});
|
||||
this.onAPPUpdate();
|
||||
// #endif
|
||||
},
|
||||
onShow: function () {
|
||||
console.log("App Show");
|
||||
this.getAPPversion();
|
||||
},
|
||||
onHide: function () {
|
||||
console.log("App Hide");
|
||||
onHide: function () {},
|
||||
onBackPress: function () {},
|
||||
methods: {
|
||||
onAPPUpdate() {
|
||||
APPUpdate(this.version);
|
||||
},
|
||||
async getAPPversion() {
|
||||
let params = {
|
||||
marketId: 100,
|
||||
packageName: "com.xiaofa.shopAdmin",
|
||||
currVersionKey: 1,
|
||||
};
|
||||
|
||||
let res = await GetAPPversion(params);
|
||||
console.log(res);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// @import "uview-ui/index.scss";
|
||||
// @import "./uni_modules/uview-ui/index.scss";
|
||||
// @import "./uni_modules/uview-ui/theme.scss";
|
||||
/*每个页面公共css */
|
||||
|
||||
@import "@/static/font/iconfont.css";
|
||||
|
||||
@ -1,28 +1,23 @@
|
||||
import http from '../utils/http'
|
||||
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* 获取用户协议
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/protocol
|
||||
*/
|
||||
|
||||
export function GetAgreement(params){
|
||||
|
||||
export function GetAgreement (params){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
params.isFilter = true
|
||||
http({
|
||||
url:'/account/login/protocol',
|
||||
method:'get',
|
||||
params,
|
||||
}).then(res=>{
|
||||
if(res.status == 200){
|
||||
resolve(res)
|
||||
}else{
|
||||
reject(res)
|
||||
}
|
||||
}).catch(error => reject(console.warn(error)))
|
||||
console.log('res',res);
|
||||
resolve(res)
|
||||
})
|
||||
})
|
||||
}
|
||||
225
java-mall-app-shop-admin/api/audit.js
Normal file
225
java-mall-app-shop-admin/api/audit.js
Normal file
@ -0,0 +1,225 @@
|
||||
import http from '../utils/http'
|
||||
|
||||
/**
|
||||
* 获取省市区
|
||||
* @author Seven
|
||||
* @data 2025-2-29
|
||||
* @returns { list [] }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/shop-base-district/getAppDistrict
|
||||
*/
|
||||
|
||||
export function GetAppDistrict (params = {}){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/shop-base-district/getAppDistrict',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:process.env.VUE_APP_BACK_BASE_API
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 店铺主营分类(类目)
|
||||
* @author Seven
|
||||
* @data 2025-3-5
|
||||
* @returns { list [] }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/shop-base-product-category/listCategory
|
||||
*/
|
||||
|
||||
export function GetMeritoCategory (params = {}){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/shop-base-product-category/listCategory',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:process.env.VUE_APP_BACK_BASE_API
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 店铺主营分类(类目)二级分类
|
||||
* @author Seven
|
||||
* @data 2025-3-5
|
||||
* @param { category_parent_id }
|
||||
* @returns { list [] }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/shop-base-product-category/treeCategory
|
||||
*/
|
||||
|
||||
export function GetTreeCategory (params = {}){
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/shop-base-product-category/treeCategory',
|
||||
method:'get',
|
||||
params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取百度地图输入点提示词
|
||||
* @author Seven
|
||||
* @data 2025-3-5
|
||||
* @param { category_parent_id }
|
||||
* @returns { query,region }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/merch/baidu/place/v2/suggestion
|
||||
*/
|
||||
|
||||
export function GetBaiduSuggestion (params = {}){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/merch/baidu/place/v2/suggestion',
|
||||
method:'get',
|
||||
params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取入驻审核状态
|
||||
* @author Seven
|
||||
* @data 2025-
|
||||
* @returns { approval_invalid_col:[] ,approval_status":4, approval_remark:'', id:'' }
|
||||
* approval_invalid_col 重新审核 映射需要用到 由B段admin 传过来
|
||||
* approval_status 1-已通过;2-未通过;3-待审核;4 -未申请
|
||||
* approval_remark 驳回备注
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/merch/fresh/approval/status
|
||||
*/
|
||||
|
||||
export function GetAuditStatus (params = {}){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/merch/fresh/approval/status',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
if(res && res.status == 200){
|
||||
uni.setStorageSync("approvalStatus",res.data.approval_status);
|
||||
uni.setStorageSync("approvalStatusInfo",res.data);
|
||||
}
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请信息详情
|
||||
* @author Seven
|
||||
* @data 2025-3-4
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/merch/detail
|
||||
*/
|
||||
|
||||
export function GetAuditInfo(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/merch/detail',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
if(res && res.status == 200){
|
||||
uni.setStorageSync("approvalStatus",res.data.approval_status);
|
||||
uni.setStorageSync("approvalStatusInfo",res.data);
|
||||
}
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取银行列表
|
||||
* @author Seven
|
||||
* @data 2025-3-4
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/global/banks/list
|
||||
*/
|
||||
|
||||
export function GetBankList(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/global/banks/list',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交审核
|
||||
* @author Seven
|
||||
* @data 2025-3-4
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/merch/apply
|
||||
*/
|
||||
|
||||
export function GetMerchApply(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/merch/apply',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新提交审核
|
||||
* @author Seven
|
||||
* @data 2025-3-4
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/merch/re-apply
|
||||
*/
|
||||
|
||||
export function GetRestartMerchApply(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/merch/re-apply',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺分类(类目)
|
||||
* @author Seven
|
||||
* @data 2025-3-4
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/store/biz-category/list
|
||||
*/
|
||||
|
||||
export function GetBizCategoryList(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/biz-category/list',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
25
java-mall-app-shop-admin/api/checkAPPupdate.js
Normal file
25
java-mall-app-shop-admin/api/checkAPPupdate.js
Normal file
@ -0,0 +1,25 @@
|
||||
import http from '../utils/http';
|
||||
import config from '../config/config';
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/admin/app-market-update/check/version
|
||||
*/
|
||||
|
||||
export function GetAPPversion(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url: '/admin/app-market-update/check/version',
|
||||
method: 'post',
|
||||
data: params,
|
||||
baseURL: config.baseApi,
|
||||
})
|
||||
.then((res) => {
|
||||
resolve(res);
|
||||
})
|
||||
.catch((e) => reject(console.warn(e)));
|
||||
});
|
||||
}
|
||||
@ -5,17 +5,16 @@ import http from '../utils/http'
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/setNewPassword
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/doForgetPassword
|
||||
*/
|
||||
|
||||
export function GetForgePassword (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
params.isFilter = true
|
||||
http({
|
||||
url:'/account/login/setNewPassword',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:process.env.VUE_APP_BACK_BASE_API
|
||||
url:'/account/login/doForgetPassword',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
|
||||
@ -1,22 +1,67 @@
|
||||
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config';
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* 获取聊天配置
|
||||
* @author Seven
|
||||
* @data 2025-1-27
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/sns/im/getImConfig
|
||||
* @see https://mall.gpxscs.cn/api/mobile/sns/im/getImConfig?typ=json&uid=10001
|
||||
*/
|
||||
|
||||
export function GetImConfig (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
params.isFilter = false;
|
||||
http({
|
||||
url:'/sns/im/getImConfig',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:process.env.VUE_APP_BACK_BASE_API
|
||||
baseURL:config.baseApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取聊天记录
|
||||
* @author Seven
|
||||
* @data 2025-1-27
|
||||
* @param {typ: json,user_other_id: 10028,type: friend,page: 1} params
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/mobile/sns/userMessage/listChatMsg?typ=json&user_other_id=10028&type=friend&page=1
|
||||
*/
|
||||
|
||||
export function GetImMsgList (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'https://mall.gpxscs.cn/api/mobile/sns/userMessage/listChatMsg',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.apiMobile
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取聊天记录
|
||||
* @author Seven
|
||||
* @data 2025-1-27
|
||||
* @param {typ: json,user_other_id: 10028,type: friend,page: 1} params
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/mobile/sns/userMessage/add
|
||||
*/
|
||||
|
||||
export function GetSendMsgAdd (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'https://mall.gpxscs.cn/api/mobile/sns/userMessage/add',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.apiMobile
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
import http from '../utils/http'
|
||||
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* 登录/注册同一个接口
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @data 2025-1-28
|
||||
* @param number // 验证码
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/doLogin
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/doMerchSmsRegisterAndLogin
|
||||
*/
|
||||
|
||||
export function GetLogin(params){
|
||||
export function GetLogin (params){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
params.isFilter = true;
|
||||
http({
|
||||
url:'/account/login/doLogin',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:process.env.VUE_APP_BACK_BASE_API
|
||||
url:'/account/login/doMerchSmsRegisterAndLogin',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
@ -28,16 +28,37 @@ export function GetLogin(params){
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/user/verifyCode
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/sendVerifyCode
|
||||
*/
|
||||
|
||||
export function GetSmsCode(params){
|
||||
export function GetSmsCode(params){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
params.isFilter = true;
|
||||
http({
|
||||
url:'/account/user/verifyCode',
|
||||
method:'get',
|
||||
url:'/account/login/sendVerifyCode',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/account/account-user-base/doLogin
|
||||
*/
|
||||
|
||||
export function GetAccountLogin(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/account-user-base/doLogin',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
@ -46,21 +67,22 @@ export function GetSmsCode(params){
|
||||
|
||||
|
||||
/**
|
||||
* 验证码登录
|
||||
* 获取图形验证码
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/doSmsLogin
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/shop-base-config/image
|
||||
*/
|
||||
|
||||
export function GetSmsLogin(params){
|
||||
export function GetVerifyCode(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/login/doSmsLogin',
|
||||
method:'get',
|
||||
url:'/shop/shop-base-config/image',
|
||||
method:'GET',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
})
|
||||
}
|
||||
64
java-mall-app-shop-admin/api/order.js
Normal file
64
java-mall-app-shop-admin/api/order.js
Normal file
@ -0,0 +1,64 @@
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 获取订单列表
|
||||
* @author Seven
|
||||
* @data 2025-3-28
|
||||
* @param
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/shop/userOrder/mch/order/list
|
||||
*/
|
||||
|
||||
export function GetOrderList (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/userOrder/mch/order/list',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单列表 模拟数据
|
||||
**/
|
||||
|
||||
// export function GetOrderList (params){
|
||||
// return new Promise((resolve, reject) => {
|
||||
// http({
|
||||
// url:'/mchapp/static/data/order.json',
|
||||
// method:'get',
|
||||
// data:params,
|
||||
// baseURL:''
|
||||
// }).then(res=>{
|
||||
// resolve(res)
|
||||
// }).catch(e => reject(console.warn(e)))
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单SSE
|
||||
* @author Seven
|
||||
* @data 2025-3-28
|
||||
* @param channel
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/mobile/shop/sf-express/order/status/listening
|
||||
*/
|
||||
|
||||
// export function GetOrderList (params){
|
||||
// return new Promise((resolve, reject) => {
|
||||
// http({
|
||||
// url:'/shop/userOrder/mch/order/list',
|
||||
// method:'post',
|
||||
// params,
|
||||
// baseURL:''
|
||||
// }).then(res=>{
|
||||
// resolve(res)
|
||||
// }).catch(e => reject(console.warn(e)))
|
||||
// })
|
||||
// }
|
||||
|
||||
0
java-mall-app-shop-admin/api/pdf.js
Normal file
0
java-mall-app-shop-admin/api/pdf.js
Normal file
27
java-mall-app-shop-admin/api/platform.js
Normal file
27
java-mall-app-shop-admin/api/platform.js
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 获取平台信息
|
||||
* @author Seven
|
||||
* @data 2025-1-28
|
||||
* @param action: 'intro', source_ucc_code:$.getStorageSync('source_ucc_code')
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/config/info
|
||||
*/
|
||||
|
||||
export function GetPlatformInfo(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/config/info',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.baseApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
181
java-mall-app-shop-admin/api/printer.js
Normal file
181
java-mall-app-shop-admin/api/printer.js
Normal file
@ -0,0 +1,181 @@
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 登录/注册同一个接口
|
||||
* @author Seven
|
||||
* @data 2025-3-29
|
||||
* @param number // 验证码
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/page
|
||||
*/
|
||||
|
||||
export function GetPrinterList (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/page',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打印机区域列表
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/region/list
|
||||
*/
|
||||
|
||||
export function GetPrinterflagList (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/region/list',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取打印机品牌列表
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/model/list
|
||||
*/
|
||||
|
||||
export function GetPrinterModelList (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/model/list',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加打印机
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/add/new
|
||||
*/
|
||||
|
||||
export function AddPrinter (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/add/new',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除打印机
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param { printer_id:0} 打票机自增ID
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/delete
|
||||
*/
|
||||
|
||||
export function DelectPrinter (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/delete',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新打印机
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param { printer_id:0} 打票机自增ID
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/update
|
||||
*/
|
||||
|
||||
export function UpdatePrinter (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/update',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新打印机状态
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param {printer_id,status} 打票机自增ID
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/status/update'
|
||||
*/
|
||||
|
||||
export function UpdatePrinterStatus (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/store/printer/status/update',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试打印机
|
||||
* @author Seven
|
||||
* @data 2025-4-5
|
||||
* @param {orderId} DD-20241112-1
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/store/printer/print/order
|
||||
*/
|
||||
|
||||
export function TestPrinter (params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'shop/store/printer/print/order',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
24
java-mall-app-shop-admin/api/protocol.js
Normal file
24
java-mall-app-shop-admin/api/protocol.js
Normal file
@ -0,0 +1,24 @@
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 获取隐私协议
|
||||
* @author Seven
|
||||
* @data 2025-1-28
|
||||
* @param protocols_key : 'reg_description'
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/protoco
|
||||
*/
|
||||
|
||||
export function GetProtoco(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/login/protocol',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.baseApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
import http from '../utils/http'
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/register
|
||||
*/
|
||||
|
||||
export function GetRegister (params){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/login/register',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:process.env.VUE_APP_BACK_BASE_API
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
109
java-mall-app-shop-admin/api/shop.js
Normal file
109
java-mall-app-shop-admin/api/shop.js
Normal file
@ -0,0 +1,109 @@
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 获取商店基础信息
|
||||
* @author Seven
|
||||
* @data 2025-3-27
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/shop-store-base/get
|
||||
*/
|
||||
|
||||
export function GetShopBaseInfo(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/shop-store-base/get?source_lang=zh_CN',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商店基础信息
|
||||
* @author Seven
|
||||
* @data 2025-3-27
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/shop-store-base/storeSetUp
|
||||
*/
|
||||
|
||||
export function UpdataShopInfo(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/shop-store-base/storeSetUp',
|
||||
method:'post',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商家端订单量
|
||||
* @author Seven
|
||||
* @data 2025-4-30
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/analytics/order/getOrderNumToday
|
||||
*/
|
||||
|
||||
export function GetShopOrderNum(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/analytics/order/getOrderNumToday',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商家端订单量
|
||||
* @author Seven
|
||||
* @data 2025-4-30
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/pay/analytics/trade/getSalesAmount
|
||||
*/
|
||||
|
||||
export function GetSalesAmountFun(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/pay/analytics/trade/getSalesAmount',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商家端退货单数
|
||||
* @author Seven
|
||||
* @data 2025-4-30
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/analytics/return/getReturnNumToday
|
||||
*/
|
||||
|
||||
export function GetOrderReturnNum(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'shop/analytics/return/getReturnNumToday',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
29
java-mall-app-shop-admin/api/upload.js
Normal file
29
java-mall-app-shop-admin/api/upload.js
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 上传图片
|
||||
* @author Seven
|
||||
* @data 2025-3-1
|
||||
* @param number // 验证码
|
||||
* @returns { }
|
||||
* @seehttps://mall.gpxscs.cn/mobile/shop/oss/upload
|
||||
*/
|
||||
|
||||
export function UploadFilePromise (imgUrl,formData){
|
||||
let ukey = uni.getStorageSync("ukey");
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
// 完整上传路径 H5端需要解决跨域问题
|
||||
url:'https://mall.gpxscs.cn/mobile/shop/oss/upload',
|
||||
method: "POST",
|
||||
filePath: imgUrl,
|
||||
name: "upfile",
|
||||
formData: { perm_key: ukey, ...formData },
|
||||
success:res =>{
|
||||
const result = JSON.parse(res.data);
|
||||
resolve(result)
|
||||
},
|
||||
fail:res =>{
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
import http from '../utils/http'
|
||||
import config from '../config/config'
|
||||
|
||||
/**
|
||||
* 登录/注册同一个接口
|
||||
* @author Seven
|
||||
* @data 2025-1-28
|
||||
* @param number // 验证码
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/doMerchSmsRegisterAndLogin
|
||||
*/
|
||||
|
||||
export function GetLogin (params){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/login/doMerchSmsRegisterAndLogin',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/mobile/account/login/sendVerifyCode
|
||||
*/
|
||||
|
||||
export function GetSmsCode(params){
|
||||
params.isFilter = true
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/account/login/sendVerifyCode',
|
||||
method:'post',
|
||||
data:params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取商店仪表信息
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/admin/shop/shop-order-info/dashboard
|
||||
*/
|
||||
|
||||
export function GetAccountDashboard(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'/shop/shop-order-info/dashboard',
|
||||
method:'get',
|
||||
params,
|
||||
baseURL:config.adminApi
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @author Seven
|
||||
* @data 2025-1-6
|
||||
* @returns { }
|
||||
* @see https://mall.gpxscs.cn/api/mobile/account/login/doLogout
|
||||
*/
|
||||
|
||||
export function OutLogin(params){
|
||||
return new Promise((resolve, reject) => {
|
||||
http({
|
||||
url:'https://mall.gpxscs.cn/api/mobile/account/login/doLogout',
|
||||
method:'get',
|
||||
params,
|
||||
}).then(res=>{
|
||||
resolve(res)
|
||||
}).catch(e => reject(console.warn(e)))
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
.favorite-loader {
|
||||
&.bars1 {
|
||||
width: 90rpx;
|
||||
aspect-ratio: 1;
|
||||
--bars1: #000;
|
||||
background:
|
||||
no-repeat linear-gradient(var(--bars1) 0 0) 0% 50%,
|
||||
no-repeat linear-gradient(var(--bars1) 0 0) 50% 50%,
|
||||
no-repeat linear-gradient(var(--bars1) 0 0) 100% 50%;
|
||||
background-size: 20% 100%;
|
||||
animation: bars-l1 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes bars-l1 {
|
||||
0% {
|
||||
background-size: 20% 100%, 20% 100%, 20% 100%
|
||||
}
|
||||
|
||||
33% {
|
||||
background-size: 20% 10%, 20% 100%, 20% 100%
|
||||
}
|
||||
|
||||
50% {
|
||||
background-size: 20% 100%, 20% 10%, 20% 100%
|
||||
}
|
||||
|
||||
66% {
|
||||
background-size: 20% 100%, 20% 100%, 20% 10%
|
||||
}
|
||||
|
||||
100% {
|
||||
background-size: 20% 100%, 20% 100%, 20% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.bars2 {
|
||||
width: 90rpx;
|
||||
aspect-ratio: 1;
|
||||
--bars2: #000;
|
||||
background:
|
||||
no-repeat linear-gradient(var(--bars2) 0 0) 0% 100%,
|
||||
no-repeat linear-gradient(var(--bars2) 0 0) 50% 100%,
|
||||
no-repeat linear-gradient(var(--bars2) 0 0) 100% 100%;
|
||||
animation: bars-l2 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes bars-l2 {
|
||||
0% {
|
||||
background-size: 20% 100%, 20% 100%, 20% 100%
|
||||
}
|
||||
|
||||
20% {
|
||||
background-size: 20% 60%, 20% 100%, 20% 100%
|
||||
}
|
||||
|
||||
40% {
|
||||
background-size: 20% 80%, 20% 60%, 20% 100%
|
||||
}
|
||||
|
||||
60% {
|
||||
background-size: 20% 100%, 20% 80%, 20% 60%
|
||||
}
|
||||
|
||||
80% {
|
||||
background-size: 20% 100%, 20% 100%, 20% 80%
|
||||
}
|
||||
|
||||
100% {
|
||||
background-size: 20% 100%, 20% 100%, 20% 100%
|
||||
}
|
||||
}
|
||||
}
|
||||
198
java-mall-app-shop-admin/components/favorite-loading/dots.scss
Normal file
198
java-mall-app-shop-admin/components/favorite-loading/dots.scss
Normal file
@ -0,0 +1,198 @@
|
||||
.favorite-loader {
|
||||
&.dots1 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 4;
|
||||
--dots1: #000;
|
||||
background: radial-gradient(circle closest-side, var(--dots1) 90%, #0000) 0/calc(100%/3) 100% space;
|
||||
clip-path: inset(0 100% 0 0);
|
||||
animation: dots-l1 1s steps(4) infinite;
|
||||
}
|
||||
|
||||
@keyframes dots-l1 {
|
||||
to {
|
||||
clip-path: inset(0 -34% 0 0)
|
||||
}
|
||||
}
|
||||
|
||||
&.dots2 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 4;
|
||||
--dots2: #000;
|
||||
background: radial-gradient(circle closest-side, var(--dots2) 90%, #0000) 0/calc(100%/3) 100% no-repeat;
|
||||
animation: dots-l2 1s steps(3) infinite;
|
||||
}
|
||||
|
||||
@keyframes dots-l2 {
|
||||
to {
|
||||
background-position: 150%
|
||||
}
|
||||
}
|
||||
|
||||
&.dots3 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 2;
|
||||
--dots3: #000;
|
||||
background:
|
||||
no-repeat radial-gradient(circle closest-side, var(--dots3) 90%, #0000) 0% 50%,
|
||||
no-repeat radial-gradient(circle closest-side, var(--dots3) 90%, #0000) 50% 50%,
|
||||
no-repeat radial-gradient(circle closest-side, var(--dots3) 90%, #0000) 100% 50%;
|
||||
background-size: calc(100%/3) 50%;
|
||||
animation: dots-l3 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes dots-l3 {
|
||||
20% {
|
||||
background-position: 0% 0%, 50% 50%, 100% 50%
|
||||
}
|
||||
|
||||
40% {
|
||||
background-position: 0% 100%, 50% 0%, 100% 50%
|
||||
}
|
||||
|
||||
60% {
|
||||
background-position: 0% 50%, 50% 100%, 100% 0%
|
||||
}
|
||||
|
||||
80% {
|
||||
background-position: 0% 50%, 50% 50%, 100% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.dots4 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 4;
|
||||
--dots4: #000;
|
||||
background:
|
||||
radial-gradient(circle closest-side at left 6px top 50%, var(--dots4) 90%, #0000),
|
||||
radial-gradient(circle closest-side, var(--dots4) 90%, #0000),
|
||||
radial-gradient(circle closest-side at right 6px top 50%, var(--dots4) 90%, #0000);
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
animation: dots-l4 1s infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes dots-l4 {
|
||||
to {
|
||||
width: 25px;
|
||||
aspect-ratio: 1
|
||||
}
|
||||
}
|
||||
|
||||
&.dots5 {
|
||||
width: 30rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--dots5: #000;
|
||||
animation: dots-l5 1s infinite linear alternate;
|
||||
}
|
||||
|
||||
@keyframes dots-l5 {
|
||||
0% {
|
||||
box-shadow: 20px 0 var(--dots5), -20px 0 #0002;
|
||||
background: var(--dots5);
|
||||
}
|
||||
|
||||
33% {
|
||||
box-shadow: 20px 0 var(--dots5), -20px 0 #0002;
|
||||
background: #0002;
|
||||
}
|
||||
|
||||
66% {
|
||||
box-shadow: 20px 0 #0002, -20px 0 var(--dots5);
|
||||
background: #0002;
|
||||
}
|
||||
|
||||
100% {
|
||||
box-shadow: 20px 0 #0002, -20px 0 var(--dots5);
|
||||
background: var(--dots5)
|
||||
}
|
||||
}
|
||||
|
||||
&.dots6 {
|
||||
width: 30rpx;
|
||||
aspect-ratio: 1;
|
||||
--dots6: #000;
|
||||
background: var(--dots6);
|
||||
border-radius: 50%;
|
||||
animation: dots-l6 1s infinite linear alternate;
|
||||
}
|
||||
|
||||
@keyframes dots-l6 {
|
||||
0% {
|
||||
box-shadow: 15px 0, -25px 0;
|
||||
}
|
||||
|
||||
50% {
|
||||
box-shadow: 15px 0, -15px 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
box-shadow: 25px 0, -15px 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.dots7 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 4;
|
||||
--dots7: #000;
|
||||
background:
|
||||
no-repeat radial-gradient(circle closest-side, var(--dots7) 90%, #0000) 0% 50%,
|
||||
no-repeat radial-gradient(circle closest-side, var(--dots7) 90%, #0000) 50% 50%,
|
||||
no-repeat radial-gradient(circle closest-side, var(--dots7) 90%, #0000) 100% 50%;
|
||||
background-size: calc(100%/3) 100%;
|
||||
animation: dots-l7 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes dots-l7 {
|
||||
33% {
|
||||
background-size: calc(100%/3) 0%, calc(100%/3) 100%, calc(100%/3) 100%
|
||||
}
|
||||
|
||||
50% {
|
||||
background-size: calc(100%/3) 100%, calc(100%/3) 0%, calc(100%/3) 100%
|
||||
}
|
||||
|
||||
66% {
|
||||
background-size: calc(100%/3) 100%, calc(100%/3) 100%, calc(100%/3) 0%
|
||||
}
|
||||
}
|
||||
|
||||
&.dots8 {
|
||||
width: 30rpx;
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
--dots8: #000;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 50%;
|
||||
background: var(--dots8);
|
||||
}
|
||||
|
||||
&::before {
|
||||
box-shadow: -25px 0;
|
||||
animation: dots-l8-1 1s infinite linear;
|
||||
}
|
||||
|
||||
&::after {
|
||||
transform: rotate(0deg) translateX(25px);
|
||||
animation: dots-l8-2 1s infinite linear;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes dots-l8-1 {
|
||||
100% {
|
||||
transform: translateX(25px)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes dots-l8-2 {
|
||||
100% {
|
||||
transform: rotate(-180deg) translateX(25px)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<view class="favorite-loader" :class="animation || ''" :style="[getLoaderStyle]">
|
||||
<text v-if="isText">{{text}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'FavoriteLoading',
|
||||
props: {
|
||||
isText: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
default: 'Loading...'
|
||||
},
|
||||
animation: {
|
||||
type: String,
|
||||
default: 'opacity'
|
||||
},
|
||||
color: {
|
||||
type: [Array, String],
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getLoaderStyle() {
|
||||
const styles = {}
|
||||
const color = this.color
|
||||
const animation = this.animation
|
||||
if (color) {
|
||||
if (Array.isArray(color) && color.length === 2) {
|
||||
styles[`--${animation}_0`] = color[0]
|
||||
styles[`--${animation}_1`] = color[1]
|
||||
} else {
|
||||
styles[`--${animation}`] = color
|
||||
}
|
||||
}
|
||||
return styles
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './style.scss';
|
||||
@import './dots.scss';
|
||||
@import './bars.scss';
|
||||
@import './spinner.scss';
|
||||
@import './progress.scss';
|
||||
@import './infinity.scss';
|
||||
@import './pulsing.scss';
|
||||
</style>
|
||||
@ -0,0 +1,17 @@
|
||||
.favorite-loader {
|
||||
&.infinity1 {
|
||||
width: 90px;
|
||||
height: 14px;
|
||||
--infinity1: #000;
|
||||
color: var(--infinity1);
|
||||
background:
|
||||
radial-gradient(circle 10px at right 7px top 50%,#0000 92%,currentColor),
|
||||
radial-gradient(circle 10px at right 0 top 50%,currentColor 92%,#0000);
|
||||
background-size: calc(100%/3) 100%;
|
||||
background-position: 50% 0%;
|
||||
animation: infinity-l1 .5s infinite linear;
|
||||
}
|
||||
@keyframes infinity-l1 {
|
||||
100% {background-position: 0% 0%}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,327 @@
|
||||
.favorite-loader {
|
||||
&.progress1 {
|
||||
width: 240rpx;
|
||||
height: 40rpx;
|
||||
--progress1: #000;
|
||||
background:
|
||||
linear-gradient(var(--progress1) 0 0) 0/0% no-repeat #ddd;
|
||||
animation: progress-l1 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes progress-l1 {
|
||||
100% {
|
||||
background-size: 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress2 {
|
||||
width: 240rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 40rpx;
|
||||
--progress2_0: orange;
|
||||
--progress2_1: lightblue;
|
||||
background:
|
||||
linear-gradient(var(--progress2_0) 0 0) 0/0% no-repeat var(--progress2_1);
|
||||
animation: progress-l2 2s infinite steps(10);
|
||||
}
|
||||
|
||||
@keyframes progress-l2 {
|
||||
100% {
|
||||
background-size: 110%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress3 {
|
||||
width: 240rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 40rpx;
|
||||
--progress3_0: #f03355;
|
||||
--progress3_1: #ffa516;
|
||||
background:
|
||||
repeating-linear-gradient(135deg, var(--progress3_0) 0 10px, var(--progress3_1) 0 20px) 0/0% no-repeat,
|
||||
repeating-linear-gradient(135deg, #ddd 0 10px, #eee 0 20px) 0/100%;
|
||||
animation: progress-l3 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes progress-l3 {
|
||||
100% {
|
||||
background-size: 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress4 {
|
||||
width: 240rpx;
|
||||
height: 40rpx;
|
||||
--progress4: #000;
|
||||
-webkit-mask: linear-gradient(90deg, var(--progress4) 70%, #0000 0) 0/20%;
|
||||
background:
|
||||
linear-gradient(var(--progress4) 0 0) 0/0% no-repeat #ddd;
|
||||
animation: progress-l4 2s infinite steps(6);
|
||||
}
|
||||
|
||||
@keyframes progress-l4 {
|
||||
100% {
|
||||
background-size: 120%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress5 {
|
||||
width: 160rpx;
|
||||
height: 80rpx;
|
||||
--progress5: #000;
|
||||
color: var(--progress5);
|
||||
border: 2px solid currentColor;
|
||||
border-right-color: transparent;
|
||||
padding: 3px;
|
||||
background:
|
||||
repeating-linear-gradient(90deg, currentColor 0 10px, #0000 0 15px) 0/0% no-repeat content-box content-box;
|
||||
position: relative;
|
||||
animation: progress-l5 2s infinite steps(6);
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
bottom: -2px;
|
||||
left: 100%;
|
||||
width: 10px;
|
||||
background:
|
||||
linear-gradient(#0000 calc(50% - 7px), currentColor 0 calc(50% - 5px),
|
||||
#0000 0 calc(50% + 5px), currentColor 0 calc(50% + 7px), #0000 0) left /100% 100%,
|
||||
linear-gradient(currentColor calc(50% - 5px), #0000 0 calc(50% + 5px), currentColor 0) left /2px 100%,
|
||||
linear-gradient(#0000 calc(50% - 5px), currentColor 0 calc(50% + 5px), #0000 0) right/2px 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes progress-l5 {
|
||||
100% {
|
||||
background-size: 120%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress6 {
|
||||
width: 240rpx;
|
||||
height: 44rpx;
|
||||
border-radius: 40rpx;
|
||||
--progress6: #514b82;
|
||||
color: var(--progress6);
|
||||
border: 2px solid;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
margin: 2px;
|
||||
inset: 0 100% 0 0;
|
||||
border-radius: inherit;
|
||||
background: currentColor;
|
||||
animation: progress-l6 2s infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes progress-l6 {
|
||||
100% {
|
||||
inset: 0
|
||||
}
|
||||
}
|
||||
|
||||
&.progress7 {
|
||||
width: 240rpx;
|
||||
height: 48rpx;
|
||||
--progress7_0: #000;
|
||||
--progress7_1: #25b09b;
|
||||
-webkit-mask:
|
||||
radial-gradient(circle closest-side, var(--progress7_0) 94%, #0000) 0 0/25% 100%,
|
||||
linear-gradient(var(--progress7_0) 0 0) center/calc(100% - 12px) calc(100% - 12px) no-repeat;
|
||||
background:
|
||||
linear-gradient(var(--progress7_1) 0 0) 0/0% no-repeat #ddd;
|
||||
animation: progress-l7 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes progress-l7 {
|
||||
100% {
|
||||
background-size: 100%
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.progress8 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
-webkit-mask: linear-gradient(0deg, #000 55%, #0000 0) bottom/100% 18.18%;
|
||||
--progress8_0: #f03355;
|
||||
--progress8_1: #ddd;
|
||||
background:
|
||||
linear-gradient(var(--progress8_0) 0 0) bottom/100% 0% no-repeat var(--progress8_1);
|
||||
animation: progress-l8 2s infinite steps(7);
|
||||
}
|
||||
|
||||
@keyframes progress-l8 {
|
||||
100% {
|
||||
background-size: 100% 115%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress9 {
|
||||
--r1: 154%;
|
||||
--r2: 68.5%;
|
||||
width: 120rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--progress9_0: #269af2;
|
||||
--progress9_1: #ccc;
|
||||
background:
|
||||
radial-gradient(var(--r1) var(--r2) at top, #0000 79.5%, var(--progress9_0) 80%),
|
||||
radial-gradient(var(--r1) var(--r2) at bottom, var(--progress9_0) 79.5%, #0000 80%),
|
||||
radial-gradient(var(--r1) var(--r2) at top, #0000 79.5%, var(--progress9_0) 80%),
|
||||
var(--progress9_1);
|
||||
background-size: 50.5% 220%;
|
||||
background-position: -100% 0%, 0% 0%, 100% 0%;
|
||||
background-repeat: no-repeat;
|
||||
animation: progress-l9 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes progress-l9 {
|
||||
33% {
|
||||
background-position: 0% 33%, 100% 33%, 200% 33%
|
||||
}
|
||||
|
||||
66% {
|
||||
background-position: -100% 66%, 0% 66%, 100% 66%
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: 0% 100%, 100% 100%, 200% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress10 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
animation: progress-l10 2s infinite;
|
||||
--progress10: #f03355;
|
||||
}
|
||||
|
||||
@keyframes progress-l10 {
|
||||
0% {
|
||||
background: conic-gradient(var(--progress10) 0, #0000 0)
|
||||
}
|
||||
|
||||
12.5% {
|
||||
background: conic-gradient(var(--progress10) 45deg, #0000 46deg)
|
||||
}
|
||||
|
||||
25% {
|
||||
background: conic-gradient(var(--progress10) 90deg, #0000 91deg)
|
||||
}
|
||||
|
||||
37.5% {
|
||||
background: conic-gradient(var(--progress10) 135deg, #0000 136deg)
|
||||
}
|
||||
|
||||
50% {
|
||||
background: conic-gradient(var(--progress10) 180deg, #0000 181deg)
|
||||
}
|
||||
|
||||
62.5% {
|
||||
background: conic-gradient(var(--progress10) 225deg, #0000 226deg)
|
||||
}
|
||||
|
||||
75% {
|
||||
background: conic-gradient(var(--progress10) 270deg, #0000 271deg)
|
||||
}
|
||||
|
||||
87.5% {
|
||||
background: conic-gradient(var(--progress10) 315deg, #0000 316deg)
|
||||
}
|
||||
|
||||
100% {
|
||||
background: conic-gradient(var(--progress10) 360deg, #0000 360deg)
|
||||
}
|
||||
}
|
||||
|
||||
&.progress11 {
|
||||
width: 148rpx;
|
||||
height: 48rpx;
|
||||
--progress11_0: #25b09b;
|
||||
--progress11_1: #ddd;
|
||||
-webkit-mask:
|
||||
conic-gradient(from 135deg at top, #0000, #000 .5deg 90deg, #0000 90.5deg) 0 0,
|
||||
conic-gradient(from -45deg at bottom, #0000, #000 .5deg 90deg, #0000 90.5deg) 0 100%;
|
||||
-webkit-mask-size: 25% 50%;
|
||||
-webkit-mask-repeat: repeat-x;
|
||||
background: linear-gradient(var(--progress11_0) 0 0) left/0% 100% no-repeat var(--progress11_1);
|
||||
animation: progress-l11 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes progress-l11 {
|
||||
100% {
|
||||
background-size: 100% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress12 {
|
||||
width: 120rpx;
|
||||
height: 100rpx;
|
||||
--m: no-repeat linear-gradient(90deg, #000 70%, #0000 0);
|
||||
--progress12_0: #514b82;
|
||||
--progress12_1: #ddd;
|
||||
-webkit-mask:
|
||||
var(--m) calc(0*100%/4) 100%/calc(100%/5) calc(1*100%/5),
|
||||
var(--m) calc(1*100%/4) 100%/calc(100%/5) calc(2*100%/5),
|
||||
var(--m) calc(2*100%/4) 100%/calc(100%/5) calc(3*100%/5),
|
||||
var(--m) calc(3*100%/4) 100%/calc(100%/5) calc(4*100%/5),
|
||||
var(--m) calc(4*100%/4) 100%/calc(100%/5) calc(5*100%/5);
|
||||
background: linear-gradient(var(--progress12_0) 0 0) left/0% 100% no-repeat var(--progress12_1);
|
||||
animation: progress-l12 2s infinite steps(6);
|
||||
}
|
||||
|
||||
@keyframes progress-l12 {
|
||||
100% {
|
||||
background-size: 120% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress13 {
|
||||
width: 240rpx;
|
||||
height: 40rpx;
|
||||
--progress13_0: #000;
|
||||
--progress13_1: #ddd;
|
||||
-webkit-mask: radial-gradient(circle closest-side, var(--progress13_0) 94%, #0000) left/20% 100%;
|
||||
background: linear-gradient(var(--progress13_0) 0 0) left/0% 100% no-repeat var(--progress13_1);
|
||||
animation: progress-l13 2s infinite steps(6);
|
||||
}
|
||||
|
||||
@keyframes progress-l13 {
|
||||
100% {
|
||||
background-size: 120% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.progress14 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 1;
|
||||
--progress14_0: #dc1818;
|
||||
--progress14_1: #ccc;
|
||||
background: linear-gradient(var(--progress14_0) 0 0) bottom/100% 0% no-repeat var(--progress14_1);
|
||||
-webkit-mask:
|
||||
radial-gradient(circle at 60% 65%, #000 62%, #0000 65%) top left,
|
||||
radial-gradient(circle at 40% 65%, #000 62%, #0000 65%) top right,
|
||||
linear-gradient(to bottom left, #000 42%, #0000 43%) bottom left,
|
||||
linear-gradient(to bottom right, #000 42%, #0000 43%) bottom right;
|
||||
-webkit-mask-size: 50% 50%;
|
||||
-webkit-mask-repeat: no-repeat;
|
||||
animation: progress-l14 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes progress-l14 {
|
||||
90%,
|
||||
100% {
|
||||
background-size: 100% 100%
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,212 @@
|
||||
.favorite-loader {
|
||||
&.pulsing1 {
|
||||
width: 20px;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--pulsing1: #000;
|
||||
background: var(--pulsing1);
|
||||
box-shadow: 0 0 0 0 #0004;
|
||||
animation: pulsing-l1 1s infinite;
|
||||
}
|
||||
@keyframes pulsing-l1 {
|
||||
100% {box-shadow: 0 0 0 30px #0000}
|
||||
}
|
||||
|
||||
&.pulsing2 {
|
||||
width: 40rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--pulsing2: #000;
|
||||
background: var(--pulsing2);
|
||||
box-shadow: 0 0 0 0 #0004;
|
||||
animation: pulsing-l2 1.5s infinite linear;
|
||||
position: relative;
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
box-shadow: 0 0 0 0 #0004;
|
||||
animation: inherit;
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
&:after {
|
||||
animation-delay: -1s;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l2 {
|
||||
100% {box-shadow: 0 0 0 40px #0000}
|
||||
}
|
||||
|
||||
&.pulsing3 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
--pulsing3: #dc1818;
|
||||
color: var(--pulsing3);
|
||||
background:
|
||||
radial-gradient(circle at 60% 65%, currentColor 62%, #0000 65%) top left,
|
||||
radial-gradient(circle at 40% 65%, currentColor 62%, #0000 65%) top right,
|
||||
linear-gradient(to bottom left, currentColor 42%,#0000 43%) bottom left ,
|
||||
linear-gradient(to bottom right,currentColor 42%,#0000 43%) bottom right;
|
||||
background-size: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
position: relative;
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: inherit;
|
||||
opacity: 0.4;
|
||||
animation: pulsing-l3 1s infinite;
|
||||
}
|
||||
}
|
||||
@keyframes pulsing-l3 {
|
||||
to {transform:scale(1.8);opacity:0}
|
||||
}
|
||||
|
||||
&.pulsing4 {
|
||||
width: 120rpx;
|
||||
aspect-ratio: 1;
|
||||
position:relative;
|
||||
--pulsing4: #f85c00;
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
inset: 0;
|
||||
background:
|
||||
radial-gradient(circle 10px,var(--pulsing4) 94%,#0000),
|
||||
repeating-conic-gradient(from -30deg,#0000 0 60deg,var(--pulsing4) 61deg 120deg);
|
||||
-webkit-mask:radial-gradient(circle 15px,#000 calc(100% - 6px),#0000 calc(100% - 5px) 94%,#000);
|
||||
}
|
||||
&:after {
|
||||
animation: pulsing-l4 1s infinite;
|
||||
transform: perspective(300px) translateZ(0px)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l4 {
|
||||
to {transform:perspective(300px) translateZ(150px);opacity:0}
|
||||
}
|
||||
|
||||
&.pulsing5 {
|
||||
width: 160rpx;
|
||||
aspect-ratio: 1;
|
||||
position:relative;
|
||||
--pulsing5: #ffb940;
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--pulsing5);
|
||||
box-shadow: 0 0 0 50px;
|
||||
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
|
||||
}
|
||||
&:after {
|
||||
animation: pulsing-l5 1s infinite;
|
||||
transform: perspective(300px) translateZ(0px)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l5 {
|
||||
to {transform:perspective(300px) translateZ(150px);opacity:0}
|
||||
}
|
||||
|
||||
&.pulsing6 {
|
||||
width: 80rpx;
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
transform: rotate(45deg);
|
||||
--pulsing6: #514b82;
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 50% 50% 0 50%;
|
||||
background: var(--pulsing6);
|
||||
-webkit-mask: radial-gradient(circle 10px at 50% 50%,#0000 94%,#000);
|
||||
}
|
||||
&:after {
|
||||
animation: pulsing-l6 1s infinite;
|
||||
transform: perspective(300px) translateZ(0px)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l6 {
|
||||
to {transform: perspective(300px) translateZ(150px);opacity:0}
|
||||
}
|
||||
|
||||
&.pulsing7 {
|
||||
width: 200rpx;
|
||||
height: 120rpx;
|
||||
--pulsing7: #269af2;
|
||||
color: var(--pulsing7);
|
||||
--c: radial-gradient(farthest-side,currentColor 96%,#0000);
|
||||
background:
|
||||
var(--c) 100% 100% /30% 60%,
|
||||
var(--c) 70% 0 /50% 100%,
|
||||
var(--c) 0 100% /36% 68%,
|
||||
var(--c) 27% 18% /26% 40%,
|
||||
linear-gradient(currentColor 0 0) bottom/67% 58%;
|
||||
background-repeat: no-repeat;
|
||||
position: relative;
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: inherit;
|
||||
opacity: 0.4;
|
||||
animation: pulsing-l7 1s infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l7 {
|
||||
to {transform:scale(1.8);opacity:0}
|
||||
}
|
||||
|
||||
&.pulsing8 {
|
||||
width: 130rpx;
|
||||
height: 230rpx;
|
||||
position: relative;
|
||||
--pulsing8: #ff8001;
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--pulsing8);
|
||||
box-shadow: 0 0 0 50px;
|
||||
clip-path: polygon(100% 0, 23% 46%, 46% 44%, 15% 69%, 38% 67%, 0 100%, 76% 57%, 53% 58%, 88% 33%, 60% 37%);;
|
||||
}
|
||||
&:after {
|
||||
animation: pulsing-l8 1s infinite;
|
||||
transform: perspective(300px) translateZ(0px)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l8 {
|
||||
to {transform:perspective(300px) translateZ(180px);opacity:0}
|
||||
}
|
||||
|
||||
&.pulsing9 {
|
||||
display: inline-grid;
|
||||
font-size: 50px;
|
||||
&:before,
|
||||
&:after {
|
||||
content: "💯";
|
||||
grid-area: 1/1;
|
||||
}
|
||||
&:after {
|
||||
animation: pulsing-l9 1s infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulsing-l9 {
|
||||
to {transform:scale(1.8);opacity:0}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,394 @@
|
||||
.favorite-loader {
|
||||
&.spinner1 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
border: 8px solid;
|
||||
--spinner1: #000;
|
||||
border-color: var(--spinner1) #0000;
|
||||
animation: spinner-l1 1s infinite;
|
||||
}
|
||||
|
||||
@keyframes spinner-l1 {
|
||||
to {
|
||||
transform: rotate(.5turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner2 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--spinner2_0: lightblue;
|
||||
--spinner2_1: orange;
|
||||
border: 16rpx solid var(--spinner2_0);
|
||||
border-right-color: var(--spinner2_1);
|
||||
animation: spinner-l2 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spinner-l2 {
|
||||
to {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner3 {
|
||||
width: 100rpx;
|
||||
padding: 16rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--spinner3: #25b09b;
|
||||
background: var(--spinner3);
|
||||
--_m:
|
||||
conic-gradient(#0000 10%, #000),
|
||||
linear-gradient(#000 0 0) content-box;
|
||||
-webkit-mask: var(--_m);
|
||||
mask: var(--_m);
|
||||
-webkit-mask-composite: source-out;
|
||||
mask-composite: subtract;
|
||||
animation: spinner-l3 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spinner-l3 {
|
||||
to {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner4 {
|
||||
width: 100rpx;
|
||||
--b: 16rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
padding: 1px;
|
||||
--spinner4: #f03355;
|
||||
background: conic-gradient(#0000 10%, var(--spinner4)) content-box;
|
||||
-webkit-mask:
|
||||
repeating-conic-gradient(#0000 0deg, #000 1deg 20deg, #0000 21deg 36deg),
|
||||
radial-gradient(farthest-side, #0000 calc(100% - var(--b) - 1px), #000 calc(100% - var(--b)));
|
||||
-webkit-mask-composite: destination-in;
|
||||
mask-composite: intersect;
|
||||
animation: spinner-l4 1s infinite steps(10);
|
||||
}
|
||||
|
||||
@keyframes spinner-l4 {
|
||||
to {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.spinner5 {
|
||||
width: 100rpx;
|
||||
--b: 16rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--spinner5: #514b82;
|
||||
background: var(--spinner5);
|
||||
-webkit-mask:
|
||||
repeating-conic-gradient(#0000 0deg, #000 1deg 70deg, #0000 71deg 90deg),
|
||||
radial-gradient(farthest-side, #0000 calc(100% - var(--b) - 1px), #000 calc(100% - var(--b)));
|
||||
-webkit-mask-composite: destination-in;
|
||||
mask-composite: intersect;
|
||||
animation: spinner-l5 1s infinite;
|
||||
}
|
||||
|
||||
@keyframes spinner-l5 {
|
||||
to {
|
||||
transform: rotate(.5turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner6 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
padding: 3px;
|
||||
--spinner6: #ffa516;
|
||||
background:
|
||||
radial-gradient(farthest-side, var(--spinner6) 95%, #0000) 50% 0/12px 12px no-repeat,
|
||||
radial-gradient(farthest-side, #0000 calc(100% - 5px), var(--spinner6) calc(100% - 4px)) content-box;
|
||||
animation: spinner-l6 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes spinner-l6 {
|
||||
to {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner7 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
--spinner7: #25b09b;
|
||||
--_c: no-repeat radial-gradient(farthest-side, var(--spinner7) 92%, #0000);
|
||||
background:
|
||||
var(--_c) top,
|
||||
var(--_c) left,
|
||||
var(--_c) right,
|
||||
var(--_c) bottom;
|
||||
background-size: 12px 12px;
|
||||
animation: spinner-l7 1s infinite;
|
||||
}
|
||||
|
||||
@keyframes spinner-l7 {
|
||||
to {
|
||||
transform: rotate(.5turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner8 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
--spinner8: #f03355;
|
||||
color: var(--spinner8);
|
||||
--_c: no-repeat radial-gradient(farthest-side, currentColor 92%, #0000);
|
||||
background:
|
||||
var(--_c) 50% 0 /12px 12px,
|
||||
var(--_c) 50% 100%/12px 12px,
|
||||
var(--_c) 100% 50%/12px 12px,
|
||||
var(--_c) 0 50%/12px 12px,
|
||||
var(--_c) 50% 50%/12px 12px,
|
||||
conic-gradient(from 90deg at 4px 4px, #0000 90deg, currentColor 0) -4px -4px/calc(50% + 2px) calc(50% + 2px);
|
||||
animation: spinner-l8 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spinner-l8 {
|
||||
to {
|
||||
transform: rotate(.5turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner9 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
--spinner9_0: #f03355;
|
||||
--spinner9_1: #ccc;
|
||||
background:
|
||||
radial-gradient(farthest-side, var(--spinner9_0) 95%, #0000) 50% 1px/12px 12px no-repeat,
|
||||
radial-gradient(farthest-side, #0000 calc(100% - 14px), var(--spinner9_1) 0);
|
||||
animation: spinner-l9 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spinner-l9 {
|
||||
to {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner10 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
padding: 6px;
|
||||
--spinner10: #000;
|
||||
color: var(--spinner10);
|
||||
background:
|
||||
conic-gradient(from 135deg at top, currentColor 90deg, #0000 0) 0 calc(50% - 4px)/17px 8.5px,
|
||||
radial-gradient(farthest-side at bottom left, #0000 calc(100% - 6px), currentColor calc(100% - 5px) 99%, #0000) top right/50% 50% content-box content-box,
|
||||
radial-gradient(farthest-side at top, #0000 calc(100% - 6px), currentColor calc(100% - 5px) 99%, #0000) bottom /100% 50% content-box content-box;
|
||||
background-repeat: no-repeat;
|
||||
animation: spinner-l10 1s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spinner-l10 {
|
||||
100% {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner11 {
|
||||
margin: 0 auto;
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
--spinner11: #25b09b;
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
grid-area: 1/1;
|
||||
--c: no-repeat radial-gradient(farthest-side, var(--spinner11) 92%, #0000);
|
||||
background:
|
||||
var(--c) 50% 0,
|
||||
var(--c) 50% 100%,
|
||||
var(--c) 100% 50%,
|
||||
var(--c) 0 50%;
|
||||
background-size: 12px 12px;
|
||||
animation: spinner-l11 1s infinite;
|
||||
}
|
||||
|
||||
&::before {
|
||||
margin: 4px;
|
||||
filter: hue-rotate(45deg);
|
||||
background-size: 8px 8px;
|
||||
animation-timing-function: linear
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spinner-l11 {
|
||||
100% {
|
||||
transform: rotate(.5turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner12 {
|
||||
margin: 0 auto;
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
border: 4px solid #0000;
|
||||
border-radius: 50%;
|
||||
border-color: #ccc #0000;
|
||||
animation: spinner-l12 1s infinite linear;
|
||||
--spinner12: #f03355;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
grid-area: 1/1;
|
||||
margin: 2px;
|
||||
border: inherit;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&::before {
|
||||
border-color: var(--spinner12) #0000;
|
||||
animation: inherit;
|
||||
animation-duration: .5s;
|
||||
animation-direction: reverse;
|
||||
}
|
||||
|
||||
&::after {
|
||||
margin: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spinner-l12 {
|
||||
100% {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner13 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
--spinner13: #514b82;
|
||||
--c: no-repeat radial-gradient(farthest-side, var(--spinner13) 92%, #0000);
|
||||
background:
|
||||
var(--c) 50% 0,
|
||||
var(--c) 50% 100%,
|
||||
var(--c) 100% 50%,
|
||||
var(--c) 0 50%;
|
||||
background-size: 10px 10px;
|
||||
animation: spinner-l13 1s infinite;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
margin: 3px;
|
||||
background: repeating-conic-gradient(#0000 0 35deg, var(--spinner13) 0 90deg);
|
||||
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 3px), #000 0);
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spinner-l13 {
|
||||
100% {
|
||||
transform: rotate(.5turn)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.spinner14 {
|
||||
margin: 0 auto;
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
--spinner14: #854f1d;
|
||||
color: var(--spinner14);
|
||||
background: radial-gradient(farthest-side, currentColor calc(100% - 6px), #0000 calc(100% - 5px) 0);
|
||||
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 13px), #000 calc(100% - 12px));
|
||||
border-radius: 50%;
|
||||
animation: spinner-l14 2s infinite linear;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
grid-area: 1/1;
|
||||
background:
|
||||
linear-gradient(currentColor 0 0) center,
|
||||
linear-gradient(currentColor 0 0) center;
|
||||
background-size: 100% 10px, 10px 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
&::after {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spinner-l14 {
|
||||
100% {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner15 {
|
||||
--d: 44rpx;
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 50%;
|
||||
--spinner15: #25b09b;
|
||||
color: var(--spinner15);
|
||||
box-shadow:
|
||||
calc(1*var(--d)) calc(0*var(--d)) 0 0,
|
||||
calc(0.707*var(--d)) calc(0.707*var(--d)) 0 1px,
|
||||
calc(0*var(--d)) calc(1*var(--d)) 0 2px,
|
||||
calc(-0.707*var(--d)) calc(0.707*var(--d)) 0 3px,
|
||||
calc(-1*var(--d)) calc(0*var(--d)) 0 4px,
|
||||
calc(-0.707*var(--d)) calc(-0.707*var(--d))0 5px,
|
||||
calc(0*var(--d)) calc(-1*var(--d)) 0 6px;
|
||||
animation: spinner-l15 1s infinite steps(8);
|
||||
}
|
||||
|
||||
@keyframes spinner-l15 {
|
||||
100% {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
|
||||
&.spinner16 {
|
||||
width: 100rpx;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
border: 8px solid #0000;
|
||||
--spinner16: #ffa50097;
|
||||
border-right-color: var(--spinner16);
|
||||
position: relative;
|
||||
animation: spinner-l16 1s infinite linear;
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -8px;
|
||||
border-radius: 50%;
|
||||
border: inherit;
|
||||
animation: inherit;
|
||||
animation-duration: 2s;
|
||||
}
|
||||
|
||||
&:after {
|
||||
animation-duration: 4s;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spinner-l16 {
|
||||
100% {
|
||||
transform: rotate(1turn)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
.favorite-loader {
|
||||
font-size: inherit;
|
||||
text-align: center;
|
||||
line-height: inherit;
|
||||
font-weight: bold;
|
||||
display: inline-flex;
|
||||
animation: l1 1s linear infinite alternate;
|
||||
|
||||
&.opacity {
|
||||
--opacity: #000;
|
||||
color: var(--opacity);
|
||||
animation: l1 1s linear infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes l1 {
|
||||
to {
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
|
||||
&.process {
|
||||
--process: #000;
|
||||
color: var(--process);
|
||||
padding-bottom: 16rpx;
|
||||
background: linear-gradient(currentColor 0 0) 0 100%/0% 3px no-repeat;
|
||||
animation: l2 2s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes l2 {
|
||||
to {
|
||||
background-size: 100% 3px
|
||||
}
|
||||
}
|
||||
|
||||
&.dashedLine {
|
||||
--dashedLine: #000;
|
||||
color: var(--dashedLine);
|
||||
padding: 0 5px 8px 0;
|
||||
background: repeating-linear-gradient(90deg, currentColor 0 8%, #0000 0 10%) 200% 100%/200% 3px no-repeat;
|
||||
animation: l3 2s steps(6) infinite;
|
||||
}
|
||||
|
||||
@keyframes l3 {
|
||||
to {
|
||||
background-position: 80% 100%
|
||||
}
|
||||
}
|
||||
|
||||
&.typewriter {
|
||||
--typewriter: #000;
|
||||
color: var(--typewriter);
|
||||
clip-path: inset(0 100% 0 0);
|
||||
animation: l4 2s steps(11) infinite;
|
||||
}
|
||||
|
||||
@keyframes l4 {
|
||||
to {
|
||||
clip-path: inset(0 -1ch 0 0)
|
||||
}
|
||||
}
|
||||
|
||||
&.colorChange {
|
||||
color: #0000;
|
||||
--colorChange: #C02942;
|
||||
background: linear-gradient(90deg, var(--colorChange) calc(50% + 0.5ch), #000 0) right/calc(200% + 1ch) 100%;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
animation: l5 2s infinite steps(11);
|
||||
}
|
||||
|
||||
@keyframes l5 {
|
||||
to {
|
||||
background-position: left
|
||||
}
|
||||
}
|
||||
}
|
||||
16
java-mall-app-shop-admin/components/lzc-picker/iconfont.css
Normal file
16
java-mall-app-shop-admin/components/lzc-picker/iconfont.css
Normal file
@ -0,0 +1,16 @@
|
||||
@font-face {font-family: "iconfont";
|
||||
src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAKUAAsAAAAABlAAAAJJAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcApcdgE2AiQDCAsGAAQgBYRtBy8bmwXIrjBu4UkbIjvjLimCmu1EP9KHAd4jgmi/3+zde18toRbpnkUTzRKRUkgQE6RA9xL+tMuG6RYp8bFsgmbcecAB9mDhH67tDS3pQsIsmSbPL7chM1RKsFr5mNDBoUDPJItlaZG8fvhi/tciWcbRfJ7L6U2gA1l9oBz3orEmTRpAvTigAPfCKLISSiNtGLvAJdwn0DCHgMfN/kgLK1jLAvE0p7YWzoUVCparCZWavYV4U6qllxTNa/j5+JeKMEmZWQ1njw1PK39hF+TnFG59QoSADpfI2AEUxFVt+oQpGIc10pYlYF+1wRfTfZfYq12wv86qboEZqLgnpau61VyC21L06V8d9cuJmT795hWPJp8ayHj0wrZNx+/+1Nzdf8MBtu9H2p+tgB5tn/W1PEZvgeD5Xf/if61ZgE9foa3Qz0ttd57gtyh79hS62nKmQlXWDiczp2tqaGAK+we+sZbxPeRDzXiEt2o2RVazQhbsDkpNu6io2UPDNn24aagxRVHHlgkQehaSjg9kPYcs2IvSxENFL0w03ASd2bQW82is0d6iB+YE2ZWCOO5tNKodIN0xe51Vh/wE15t5DGQsUcy1UOB6jg19T1NjSyCsJQcFHkPGJJS1XKC7jaXtVpV4nNS9KGYl16KOrCHbFvIA4wRkLkkg/uitaOn9A4jaYWzrlq6a/ARa25hPDiRG9CBbBtGr616e6faolGGLAMGaxAEFZiGGkUCpn7WAXFsxaURSKeH2oNDXEFvfxL/uGDRY1hT2lKy8Y3KDmgYA') format('woff2')
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-close:before {
|
||||
content: "\e622";
|
||||
}
|
||||
|
||||
177
java-mall-app-shop-admin/components/lzc-picker/lzc-picker.vue
Normal file
177
java-mall-app-shop-admin/components/lzc-picker/lzc-picker.vue
Normal file
@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<view>
|
||||
<wyb-popup
|
||||
ref="popup"
|
||||
type="bottom"
|
||||
height="600"
|
||||
:maskClickClose="false"
|
||||
radius="12"
|
||||
:showCloseIcon="false"
|
||||
>
|
||||
<view class="popup-content">
|
||||
<view class="popup_content_title">
|
||||
{{ pickerTittle }}
|
||||
<view class="iconfont icon-close icon_top" @tap="handleHide()"></view>
|
||||
</view>
|
||||
<view class="dialog_search_box">
|
||||
<view class="cuIcon-search text-grey dialog_search_text"></view>
|
||||
<input
|
||||
type="text"
|
||||
@input="inputValue"
|
||||
v-model="input_value"
|
||||
:placeholder="searchPlaceholder"
|
||||
class="dialog_search_inp"
|
||||
/>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="select_item_box">
|
||||
<view
|
||||
class="select_item"
|
||||
hover-class="select_item_hover"
|
||||
@click="handleSelect(data)"
|
||||
v-for="(data, index) in options"
|
||||
:key="index"
|
||||
>
|
||||
{{ data[showKey] || data }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</wyb-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wybPopup from "./wyb-popup.vue";
|
||||
export default {
|
||||
components: {
|
||||
wybPopup,
|
||||
},
|
||||
props: {
|
||||
pickerList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
pickerTittle: {
|
||||
type: String,
|
||||
default: "选择",
|
||||
},
|
||||
showKey: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
searchPlaceholder: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
pickerList: {
|
||||
handler: function (val, oldVal) {
|
||||
this.list = val;
|
||||
this.options = val;
|
||||
},
|
||||
immediate: true,
|
||||
deep: true, // 深度监听
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
input_value: "",
|
||||
list: [],
|
||||
options: [],
|
||||
};
|
||||
},
|
||||
onLoad() {},
|
||||
created() {
|
||||
this.options = this.list;
|
||||
},
|
||||
methods: {
|
||||
handleHide() {
|
||||
this.$refs.popup.hide();
|
||||
var a = this;
|
||||
setTimeout(() => {
|
||||
a.input_value = "";
|
||||
a.options = a.list;
|
||||
}, 100);
|
||||
},
|
||||
handleShow() {
|
||||
this.$refs.popup.show();
|
||||
},
|
||||
handleSelect(item) {
|
||||
console.log(item);
|
||||
var a = this;
|
||||
a.$emit("change", item);
|
||||
a.$refs.popup.hide();
|
||||
setTimeout(() => {
|
||||
a.input_value = "";
|
||||
a.options = a.list;
|
||||
}, 100);
|
||||
},
|
||||
inputValue(e) {
|
||||
var a = this;
|
||||
var inputTxt = e.detail.value;
|
||||
a.options = [];
|
||||
if (inputTxt.length == 0) {
|
||||
a.options = a.list;
|
||||
} else {
|
||||
a.options = a.list.filter((o) => {
|
||||
return String(o[this.showKey]).indexOf(e.detail.value) >= 0;
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "./iconfont.css";
|
||||
.popup_content_title {
|
||||
padding-top: 30rpx;
|
||||
text-align: center;
|
||||
margin-bottom: 30rpx;
|
||||
position: relative;
|
||||
font-size: 36rpx;
|
||||
.icon_top {
|
||||
font-size: 50rpx;
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog_search_box {
|
||||
width: 680rpx;
|
||||
height: 80rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 12rpx;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
.dialog_search_text {
|
||||
margin-left: 30rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.dialog_search_inp {
|
||||
height: 76rpx;
|
||||
line-height: 76rpx;
|
||||
text-align: left;
|
||||
padding-left: 20rpx;
|
||||
width: 590rpx;
|
||||
}
|
||||
}
|
||||
.select_item_box {
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
color: #333;
|
||||
.select_item {
|
||||
width: 680rpx;
|
||||
margin: 0 auto;
|
||||
padding: 28rpx 0;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.select_item_hover {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
423
java-mall-app-shop-admin/components/lzc-picker/wyb-popup.vue
Normal file
423
java-mall-app-shop-admin/components/lzc-picker/wyb-popup.vue
Normal file
@ -0,0 +1,423 @@
|
||||
<template>
|
||||
<view v-if="isShow">
|
||||
<view
|
||||
@tap.stop.prevent
|
||||
@touchmove.stop.prevent
|
||||
class="wyb-popup-box"
|
||||
:style="{
|
||||
transitionDuration: duration + 'ms',
|
||||
opacity: contentOpacity || (type === 'center' ? 0 : 1),
|
||||
transform: contentTransform || autoTransform,
|
||||
zIndex: zIndex,
|
||||
borderTopRightRadius: type === 'center' || type === 'bottom' || type === 'left' ? radius + 'px' : 0,
|
||||
borderTopLeftRadius: type === 'center' || type === 'bottom' || type === 'right' ? radius + 'px' : 0,
|
||||
borderBottomRightRadius: type === 'center' || type === 'top' || type === 'left' ? radius + 'px' : 0,
|
||||
borderBottomLeftRadius: type === 'center' || type === 'top' || type === 'right' ? radius + 'px' : 0,
|
||||
width: autoWidth,
|
||||
height: autoHeight,
|
||||
minWidth: width + 'rpx',
|
||||
minHeight: height + 'rpx',
|
||||
top: sizeChange && type === 'center' ? winReTop : autoTop,
|
||||
bottom: autoBottom,
|
||||
left: autoLeft,
|
||||
right: autoRight,
|
||||
backgroundColor: bgColor}">
|
||||
<view
|
||||
class="wyb-popup-close"
|
||||
v-if="showCloseIcon"
|
||||
:style="{
|
||||
width: closeIcon ? closeIconSize + 'rpx' : 'auto',
|
||||
height: closeIcon ? closeIconSize + 'rpx' : 'auto',
|
||||
top: closeIconPos === 'top-right' || closeIconPos === 'top-left' ? vertOffset + 'rpx' : 'auto',
|
||||
bottom: closeIconPos === 'bottom-right' || closeIconPos === 'bottom-left' ? vertOffset + 'rpx' : 'auto',
|
||||
left: closeIconPos === 'bottom-left' || closeIconPos === 'top-left' ? horiOffset + 'rpx' : 'auto',
|
||||
right: closeIconPos === 'bottom-right' || closeIconPos === 'top-right' ? horiOffset + 'rpx' : 'auto'}">
|
||||
<image class="wyb-popup-custom-close" v-if="showCloseIcon&&closeIcon" :src="closeIcon" @tap="hide" :style="{
|
||||
width: closeIconSize + 'rpx',
|
||||
height: closeIconSize + 'rpx'}" />
|
||||
<view v-if="showCloseIcon&&!closeIcon" class="iconfont icon-close" @tap="hide" />
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
class="wyb-popup-container"
|
||||
:style="{
|
||||
width: autoWidth,
|
||||
height: autoHeight}"
|
||||
:enable-flex="true"
|
||||
:scroll-y="scrollY"
|
||||
:scroll-x="scrollX">
|
||||
<view class="wyb-popup-slot"><slot></slot></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view
|
||||
class="wyb-popup-mask"
|
||||
@tap.stop="close"
|
||||
@touchmove.stop.prevent
|
||||
:style="{
|
||||
opacity: maskOpacity,
|
||||
transitionDuration: duration + 'ms',
|
||||
backgroundColor: 'rgba(0, 0, 0, ' + maskAlpha + ')',
|
||||
zIndex: zIndex - 1}" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
w: uni.getSystemInfoSync().screenWidth,
|
||||
h: uni.getSystemInfoSync().screenHeight,
|
||||
isShow: false,
|
||||
winReBottom: '',
|
||||
winReTop: '',
|
||||
sizeChange: false,
|
||||
contentOpacity: null,
|
||||
contentTransform: null,
|
||||
maskOpacity: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
autoCenterTop() {
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
|
||||
let windowHeight = uni.getSystemInfoSync().windowHeight
|
||||
let popupHeight = this.rpxToPx(this.height)
|
||||
let navHeight = 44
|
||||
let result = `${(windowHeight - popupHeight) / 2 - this.negativeTop}px`
|
||||
return result
|
||||
},
|
||||
autoTransform() {
|
||||
let result = ''
|
||||
switch(this.type) {
|
||||
case 'center':
|
||||
if (this.centerAnim === 'zoom-lessen') {
|
||||
result = `scale(${this.zoomLessenMulti})`
|
||||
} else if (this.centerAnim === 'slide-up') {
|
||||
result = `translateY(${100 * this.slideMulti}%)`
|
||||
} else if (this.centerAnim === 'slide-down') {
|
||||
result = `translateY(${-100 * this.slideMulti}%)`
|
||||
} else if (this.centerAnim === 'fade') {
|
||||
result = 'auto'
|
||||
}
|
||||
break
|
||||
case 'bottom':
|
||||
result = 'translateY(100%)'
|
||||
break
|
||||
case 'top':
|
||||
result = 'translateY(-100%)'
|
||||
break
|
||||
case 'left':
|
||||
result = 'translateX(-100%)'
|
||||
break
|
||||
case 'right':
|
||||
result = 'translateX(100%)'
|
||||
break
|
||||
}
|
||||
return result
|
||||
},
|
||||
autoWidth() {
|
||||
if (this.type === 'center') {
|
||||
return `${this.width}rpx`
|
||||
} else {
|
||||
if (this.mode === 'size-fixed') {
|
||||
if (this.type === 'top' || this.type === 'bottom') {
|
||||
return '100%'
|
||||
} else {
|
||||
return `${this.width}rpx`
|
||||
}
|
||||
} else {
|
||||
if (this.type === 'top' || this.type === 'bottom') {
|
||||
return '100%'
|
||||
} else {
|
||||
return 'auto'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
autoHeight() {
|
||||
if (this.type === 'center') {
|
||||
return `${this.height}rpx`
|
||||
} else {
|
||||
if (this.mode === 'size-fixed') {
|
||||
if (this.type === 'left' || this.type === 'right') {
|
||||
return '100%'
|
||||
} else {
|
||||
return `${this.height}rpx`
|
||||
}
|
||||
} else {
|
||||
if (this.type === 'left' || this.type === 'right') {
|
||||
return '100%'
|
||||
} else {
|
||||
return 'auto'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
autoTop() {
|
||||
if (this.type === 'center') {
|
||||
return this.autoCenterTop
|
||||
} else if (this.type === 'bottom') {
|
||||
return 'auto'
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
},
|
||||
autoBottom() {
|
||||
if (this.type === 'center' || this.type === 'top') {
|
||||
return 'auto'
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
},
|
||||
autoLeft() {
|
||||
if (this.type === 'center') {
|
||||
return `${(this.w - this.rpxToPx(this.width)) / 2}px`
|
||||
} else if (this.type === 'right') {
|
||||
return 'auto'
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
},
|
||||
autoRight() {
|
||||
if (this.type === 'center' || this.type === 'left') {
|
||||
return 'auto'
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'size-auto'
|
||||
},
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: 400
|
||||
},
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: 500
|
||||
},
|
||||
radius: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
},
|
||||
zIndex: {
|
||||
type: [String, Number],
|
||||
default: 10076
|
||||
},
|
||||
maskClickClose: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
maskAlpha: {
|
||||
type: Number,
|
||||
default: 0.5
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 400
|
||||
},
|
||||
showCloseIcon: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
scrollY: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
scrollX: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
closeIconPos: {
|
||||
type: String,
|
||||
default: 'top-right'
|
||||
},
|
||||
closeIcon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
closeIconSize: {
|
||||
type: [String, Number],
|
||||
default: '20'
|
||||
},
|
||||
vertOffset: {
|
||||
type: [String, Number],
|
||||
default: '22'
|
||||
},
|
||||
horiOffset: {
|
||||
type: [String, Number],
|
||||
default: '22'
|
||||
},
|
||||
centerAnim: {
|
||||
type: String,
|
||||
default: 'zoom-lessen'
|
||||
},
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: '#ffffff'
|
||||
},
|
||||
zoomLessenMulti: {
|
||||
type: Number,
|
||||
default: 1.15
|
||||
},
|
||||
slideMulti: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
negativeTop: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// #ifdef H5
|
||||
let winHeight = uni.getSystemInfoSync().windowHeight
|
||||
uni.onWindowResize(res => {
|
||||
this.sizeChange = true
|
||||
if (this.type === 'bottom') {
|
||||
this.winReBottom = winHeight - res.size.windowHeight + 'px'
|
||||
} else if (this.type === 'center') {
|
||||
this.winReTop = ((res.size.windowHeight - this.rpxToPx(this.height)) / 2 - this.negativeTop) + 'px'
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.maskClickClose && this.hide()
|
||||
},
|
||||
show() {
|
||||
this.isShow = true
|
||||
// #ifndef H5
|
||||
this.$nextTick(() => {
|
||||
this.maskIn()
|
||||
this.contentIn()
|
||||
this.wait(this.duration + 1).then(() => {
|
||||
this.$emit('show', {
|
||||
pageScroll: false,
|
||||
overflow: 'hidden'
|
||||
})
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
this.wait(10).then(() => {
|
||||
this.maskIn()
|
||||
this.contentIn()
|
||||
this.wait(this.duration + 1).then(() => {
|
||||
this.$emit('show', {
|
||||
pageScroll: false,
|
||||
overflow: 'hidden'
|
||||
})
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
hide() {
|
||||
this.contentOut()
|
||||
this.maskOut()
|
||||
this.wait(this.duration + 1).then(() => {
|
||||
this.isShow = false
|
||||
this.$emit('hide', {
|
||||
pageScroll: true,
|
||||
overflow: 'scroll'
|
||||
})
|
||||
})
|
||||
},
|
||||
contentIn() {
|
||||
switch (this.type) {
|
||||
case 'center':
|
||||
if (this.centerAnim === 'zoom-lessen') {
|
||||
this.contentOpacity = 1
|
||||
this.contentTransform = 'scale(1)'
|
||||
} else if (this.centerAnim === 'slide-up' || this.centerAnim === 'slide-down') {
|
||||
this.contentOpacity = 1
|
||||
this.contentTransform = 'translateY(0)'
|
||||
} else if (this.centerAnim === 'fade') {
|
||||
this.contentOpacity = 1
|
||||
}
|
||||
break
|
||||
case 'bottom':
|
||||
case 'top':
|
||||
this.contentTransform = 'translateY(0)'
|
||||
break
|
||||
case 'left':
|
||||
case 'right':
|
||||
this.contentTransform = 'translateX(0)'
|
||||
break
|
||||
}
|
||||
},
|
||||
contentOut() {
|
||||
this.contentOpacity = null
|
||||
this.contentTransform = null
|
||||
},
|
||||
maskIn() {
|
||||
this.maskOpacity = 1
|
||||
},
|
||||
maskOut() {
|
||||
this.maskOpacity = 0
|
||||
},
|
||||
rpxToPx(rpx) {
|
||||
return rpx / 750 * this.w
|
||||
},
|
||||
wait(time) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve()
|
||||
}, time)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import "./iconfont.css";
|
||||
.wyb-popup-box{
|
||||
position: fixed;
|
||||
transition-timing-function: ease-out;
|
||||
transition-property: opacity, transform;
|
||||
}
|
||||
|
||||
.wyb-popup-container {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wyb-popup-slot {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wyb-popup-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
transition-timing-function: ease;
|
||||
transition-property: opacity, transform;
|
||||
}
|
||||
|
||||
.wyb-popup-close {
|
||||
position: absolute;
|
||||
font-size:48rpx;
|
||||
color: #808080;
|
||||
z-index: 20000;
|
||||
|
||||
}
|
||||
.wyb-popup-close .iconfont {
|
||||
font-size:48rpx;
|
||||
}
|
||||
.wyb-popup-custom-close {
|
||||
left: 0;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
58
java-mall-app-shop-admin/components/status-bar.vue
Normal file
58
java-mall-app-shop-admin/components/status-bar.vue
Normal file
@ -0,0 +1,58 @@
|
||||
<template name="status-bar" :style="[{'background-color':backgroundColor},{'background':background}]">
|
||||
<block>
|
||||
<view class="status_bar">
|
||||
<view
|
||||
class="top_view"
|
||||
:style="[
|
||||
{ 'background-color': backgroundColor },
|
||||
{ background: background },
|
||||
]"
|
||||
></view>
|
||||
</view>
|
||||
</block>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "status-bar",
|
||||
|
||||
props: {
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: "#f7f7f7",
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
default: "#fff",
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.status_bar {
|
||||
/* #ifdef MP || APP */
|
||||
height: calc(var(--status-bar-height));
|
||||
/* #endif */
|
||||
/* #ifndef MP || APP */
|
||||
height: calc(var(--status-bar-height) - 0px);
|
||||
/* #endif */
|
||||
width: 100%;
|
||||
}
|
||||
.top_view {
|
||||
/* #ifdef MP || APP */
|
||||
height: calc(var(--status-bar-height));
|
||||
/* #endif */
|
||||
/* #ifndef MP || APP */
|
||||
height: calc(var(--status-bar-height) - 0px);
|
||||
/* #endif */
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
642
java-mall-app-shop-admin/components/t-chat-bar/t-chat-bar.vue
Normal file
642
java-mall-app-shop-admin/components/t-chat-bar/t-chat-bar.vue
Normal file
@ -0,0 +1,642 @@
|
||||
<template>
|
||||
<view @touchmove.stop.prevent>
|
||||
<view
|
||||
class="tui-reply-tabbar"
|
||||
:style="{ paddingBottom: `${keyboardHeight}px` }"
|
||||
>
|
||||
<view class="tui-chat-tabbar">
|
||||
<view
|
||||
class="tui-icon tui-icon-im_more tui-icon-mr"
|
||||
@tap="showKeyBoard(3)"
|
||||
></view>
|
||||
<view
|
||||
class="tui-icon tui-icon-im_face tui-icon-mr"
|
||||
@tap="showKeyBoard(2)"
|
||||
></view>
|
||||
<!-- v-show="showIndex != 2" -->
|
||||
<!-- <view class="tui-icon tui-icon-im_keyboard tui-icon-mr" @tap="showKeyBoard(1)" v-show="showIndex == 2"></view> -->
|
||||
|
||||
<!-- <editor
|
||||
id="editor"
|
||||
class="tui-chat-input"
|
||||
@input="inputReply"
|
||||
@click.stop="showKeyBoard(1)"
|
||||
:html="editorContent"
|
||||
@ready="onEditorReady"
|
||||
v-show="!isVoice"
|
||||
>
|
||||
</editor> -->
|
||||
|
||||
<textarea
|
||||
hold-keyboard
|
||||
auto-height
|
||||
class="tui-chat-input"
|
||||
@input="inputReply"
|
||||
:fixed="true"
|
||||
:adjust-position="false"
|
||||
maxlength="300"
|
||||
:value="content"
|
||||
:show-confirm-bar="false"
|
||||
placeholder-class="tui-phcolor"
|
||||
@tap.stop="showKeyBoard(1)"
|
||||
ref="textarea"
|
||||
v-show="!isVoice"
|
||||
></textarea>
|
||||
<view
|
||||
class="tui-chat-voice_btn"
|
||||
hover-class="tui-opcity"
|
||||
:hover-stay-time="150"
|
||||
v-if="isVoice"
|
||||
>{{ isVoice ? "按住 说话" : "松开 发送" }}
|
||||
</view>
|
||||
<view class="tui-send-box">
|
||||
<view
|
||||
class="tui-icon tui-icon-im_voice"
|
||||
v-if="!isVoice && !content"
|
||||
@tap="switchVoice"
|
||||
></view>
|
||||
<view
|
||||
class="tui-icon tui-icon-im_keyboard"
|
||||
v-if="isVoice && !content"
|
||||
@tap="switchInput"
|
||||
></view>
|
||||
<view
|
||||
class="tui-btn-send"
|
||||
v-if="content"
|
||||
:style="{ color: color }"
|
||||
hover-class="tui-opcity"
|
||||
:hover-stay-time="150"
|
||||
@tap="hideKeyboard"
|
||||
>{{ sendText }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tui-reply-more">
|
||||
<view class="tui-face-box" v-if="showIndex == 2">
|
||||
<scroll-view scroll-y :style="{ height: replyContainerH + 'px' }">
|
||||
<view class="tui-face-scroll">
|
||||
<view
|
||||
class="tui-face-img_box"
|
||||
v-for="(item, index) in faceList"
|
||||
:key="index"
|
||||
@tap="inputFace(index)"
|
||||
>
|
||||
<image
|
||||
:src="
|
||||
'https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/' +
|
||||
item.url
|
||||
"
|
||||
class="tui-face-img"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="tui-delete-face_box">
|
||||
<view class="tui-delete-keybord" :class="{ 'tui-opcity': !content }"
|
||||
><text class="tui-icon tui-icon-delete_keybord"></text
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="tui-more-box"
|
||||
:style="{ height: replyContainerH + 'px' }"
|
||||
v-if="showIndex == 3"
|
||||
>
|
||||
<view
|
||||
class="tui-more-item"
|
||||
hover-class="tui-opcity"
|
||||
:hover-stay-time="150"
|
||||
@click="uploadPictures"
|
||||
>
|
||||
<view class="tui-more-icon">
|
||||
<view class="tui-icon tui-icon-photo"></view>
|
||||
</view>
|
||||
<text class="tui-more-text">照片</text>
|
||||
</view>
|
||||
<view
|
||||
class="tui-more-item"
|
||||
hover-class="tui-opcity"
|
||||
:hover-stay-time="150"
|
||||
@click="photograph"
|
||||
>
|
||||
<view class="tui-more-icon">
|
||||
<view class="custom-icon tui-icon-paishe"></view>
|
||||
</view>
|
||||
<text class="tui-more-text">拍摄</text>
|
||||
</view>
|
||||
<view
|
||||
class="tui-more-item"
|
||||
hover-class="tui-opcity"
|
||||
:hover-stay-time="150"
|
||||
@click="uploadVideo"
|
||||
>
|
||||
<view class="tui-more-icon">
|
||||
<view class="tui-icon tui-icon-video"></view>
|
||||
</view>
|
||||
<text class="tui-more-text">视频</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tui-inner-mask" v-if="isLocked"></view>
|
||||
</view>
|
||||
<view
|
||||
class="tui-reply-mask"
|
||||
v-if="mask"
|
||||
:class="{
|
||||
'tui-box-show': showIndex,
|
||||
'tui-mask-show': showIndex && !maskOpacity,
|
||||
}"
|
||||
@touchmove.stop.prevent
|
||||
@tap="hideKeyboard"
|
||||
></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//聊天栏 回复栏
|
||||
// import emoji from "@/utils/emoji.js";
|
||||
import emoji from "../../static/im/emojiData.js";
|
||||
import uParse from "../../uni_modules/uview-ui/components/u-parse/u-parse.vue";
|
||||
export default {
|
||||
components: { uParse },
|
||||
name: "tChatBar",
|
||||
props: {
|
||||
//禁用聊天栏
|
||||
isLocked: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//是否显示遮罩
|
||||
mask: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
//true表示遮罩透明
|
||||
maskOpacity: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
sendText: {
|
||||
type: String,
|
||||
default: "发送",
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: "#5677fc",
|
||||
},
|
||||
isHideKeyBoard: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
created() {
|
||||
//键盘高度监听
|
||||
console.log(emoji.imgArr[1].emojiList);
|
||||
|
||||
this.faceList = emoji.imgArr[1].emojiList
|
||||
.reduce((acc, curr) => acc.concat(curr), [])
|
||||
.filter((item) => item.alt != "[删除]");
|
||||
console.log("faceList", this.faceList);
|
||||
|
||||
let safeH = this.tui.isPhoneX() ? 34 : 0;
|
||||
uni.onKeyboardHeightChange((res) => {
|
||||
let h = res.height - safeH;
|
||||
this.keyboardHeight = h > 0 ? h : 0;
|
||||
//去除 完成那一栏高度影响
|
||||
setTimeout(() => {
|
||||
if (this.showIndex == 1 && this.keyboardHeight != 0) {
|
||||
this.replyContainerH = this.keyboardHeight;
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showIndex: 0, //1-键盘 2-表情 3-其他
|
||||
keyboardHeight: 0,
|
||||
replyContainerH: uni.upx2px(500),
|
||||
faceList: [],
|
||||
content: "",
|
||||
isVoice: false,
|
||||
isEmoji: false,
|
||||
editorContent: "",
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
isHideKeyBoard: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal) {
|
||||
this.showIndex = 0;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onEditorReady() {
|
||||
uni
|
||||
.createSelectorQuery()
|
||||
.select("#editor")
|
||||
.context((res) => {
|
||||
this.content = res.context;
|
||||
})
|
||||
.exec();
|
||||
},
|
||||
hideKeyboard() {
|
||||
//隐藏键盘
|
||||
this.showIndex = 0;
|
||||
// uni.hideKeyboard();
|
||||
|
||||
this.$emit("sendMsg", this.content);
|
||||
this.isEmoji = true;
|
||||
this.content = "";
|
||||
},
|
||||
showKeyBoard(index) {
|
||||
if (this.showIndex == index) return;
|
||||
this.showIndex = index;
|
||||
this.isVoice = false;
|
||||
// if(index==1){
|
||||
// this.$refs.textarea.focus();
|
||||
// }
|
||||
// setTimeout(function() {
|
||||
// if(index==1){
|
||||
// this.$refs.textarea.focus();
|
||||
// }
|
||||
// }, 150);
|
||||
},
|
||||
// inputReply(e) {
|
||||
// this.editorContent = e.detail.html;
|
||||
// },
|
||||
inputReply(e) {
|
||||
this.content = e.detail.value;
|
||||
},
|
||||
getEmojiUrl(emojiPath) {
|
||||
return `https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/${emojiPath}`;
|
||||
},
|
||||
// async inputFace(index) {
|
||||
// // if (!this.content) {
|
||||
// // uni.showToast({
|
||||
// // title: "编辑器未准备好",
|
||||
// // icon: "none",
|
||||
// // });
|
||||
// // return;
|
||||
// // }
|
||||
|
||||
// const emojiUrl = this.getEmojiUrl(this.faceList[index].url);
|
||||
|
||||
// try {
|
||||
// await this.content.insertImage({
|
||||
// src: emojiUrl,
|
||||
// width: "24px",
|
||||
// height: "24px",
|
||||
// alt: this.faceList.find((e) => e.url === emojiUrl),
|
||||
// });
|
||||
|
||||
// console.log("表情插入成功");
|
||||
// } catch (error) {
|
||||
// console.error("插入表情失败:", error);
|
||||
// uni.showToast({
|
||||
// title: "插入表情失败",
|
||||
// icon: "none",
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
inputFace(index) {
|
||||
let face = this.faceList[index].alt;
|
||||
this.content = this.content + face;
|
||||
},
|
||||
parsedContent(content) {
|
||||
return content.replace(
|
||||
/\[img\](.*?)\[img\]/g,
|
||||
'<img src="$1" width="25" height="25" />'
|
||||
);
|
||||
},
|
||||
switchVoice() {
|
||||
this.isVoice = true;
|
||||
this.showIndex = 0;
|
||||
},
|
||||
switchInput() {
|
||||
this.isVoice = false;
|
||||
},
|
||||
uploadPictures() {
|
||||
this.$emit("uploadPictures");
|
||||
},
|
||||
photograph() {
|
||||
this.$emit("photograph");
|
||||
},
|
||||
uploadVideo() {
|
||||
this.$emit("uploadVideo");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@font-face {
|
||||
font-family: "ticons";
|
||||
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAtAAA0AAAAAEcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAALJAAAABoAAAAci1y54UdERUYAAAsEAAAAHgAAAB4AKQAVT1MvMgAAAZwAAABDAAAAVj4mTZRjbWFwAAACAAAAAFMAAAFa2zfTYmdhc3AAAAr8AAAACAAAAAj//wADZ2x5ZgAAAnQAAAapAAAKxGAh9PpoZWFkAAABMAAAAC8AAAA2GNfW1WhoZWEAAAFgAAAAHAAAACQH3gOFaG10eAAAAeAAAAAgAAAAJgygAR1sb2NhAAACVAAAACAAAAAgDwQR8m1heHAAAAF8AAAAHwAAACABJAC0bmFtZQAACSAAAAFJAAACiCnmEVVwb3N0AAAKbAAAAI8AAADgOORb6njaY2BkYGAA4jS+azPi+W2+MnCzMIDArTueOQj6fwsLA3MNkMvBwAQSBQAskgp5AHjaY2BkYGBu+N/AEMPCAAJAkpEBFbAAAEcKAm142mNgZGBg4GdYwcDNAAJMQMwFhAwM/8F8BgAbRAHZAHjaY2BkYWCcwMDKwMDUyXSGgYGhH0IzvmYwYuQAijKwMjNgBQFprikMDs93vF7E3PC/gSGGuYGhASjMCJIDAPZVDTsAeNpjYYAAFihmcGAoADJYGEyAWIGhAUiqMrAAABelAcp42mNgYGBmgGAZBkYGEAgB8hjBfBYGCyDNxcDBwMTA9HzH6wmv575e9P8/AwOYPRXElvAWKREpEMmB6oUCRjYGuAAjE5BgYkAFjAzDHgAABMATOgAAAAAAAAAAAABoAOgBPgGaAfgCWALOAzQDjgSCBQoFYnjalVZdaFxFFJ4zc/fe3Zu9d3N/9u5u1m72L7uNaTbt/tw1pknaJohJNGvbGCtUmzb6UKlGaQUrsYaigk+tP4giGkNEQX2pCL6kaVTwIdgHwYcIEkspIvio+IPZG8/c3cQ1WINwmTlnZs6555v5zpkhjBASFwi9RgySIH2EQCIpgQqmFQKrkOiDspYDQwUpAZliGRIxCEmZZACymaRotoIkmla+H0JW3i52Qdkuspnq1YjpVAOqGgBmRmjBHgIYkiEdrV51qrIMjBaiaViWw/Ijj8hhUz55UjYbZHrNcH71p7Jpv/OrAUM2LNlD1c/QAmTvLV7gjoblrUZ1GbFQsm99ib3H9pEmUiGkzbLLdiabESXRgnIfxCAAlmSFYpC3US3lIIvYEFQf9AOflsqo4ygCx1GUkxlckc1xY7SCz3tOBnW7222huVmwon6WZSBFlVBzSNEM4cvX5r8VhG/nzyyUQYqERVHo/+7FxarHU1289JNAD/a22mbbC8P3joZ3vDqetFeUoaHhM5qK7ZNQ7FP8kqW8Eo50xlRFUY1i7LUvuTN0CVMPUr+oRPzeJ56n6AxdCj9dOnSKxm8ZGTIic5MnHg76dhKBPL5+kV1kjxMfCZM02U2Ih9RhmiAmsxlaqmEzKUNhcwMaMFMC9wiXL1y4LMAzRtG49LFw/YMPrgsfr7pHadda/DM9dchtd8PBhYtXBOHKxQXnvGFcgpapD28Iwo0Pp5wfwL9pYQ/t37DAFs+KEWH9ObbGpvGsQqSAkdqknCFZkUgWCaGAKgoiYRhy3goFCzEwRSkVVAFPpZTKQdEuU7IMisfj/Ly87Pzs8YCyvOJcF0WIraxATBSd67+DFtVhVdF1ZfVv8Shf2WDZ1mCxgh6otdWiJmLYuKEbcXuJRnaQdr7LwKPJW6bo2RCMm6CBhEsxuhhNpex02jkZTaftVGp+GxyOTPcKc2fPzsEV6BzoxA/qffXGNmDg06fnGJsjbn4U1z9hX7G7SCvpx6jFZKbYD3Yxy5NaNEMYN3KED+VRlrKWGYDNEVfBNfmaBcJkvXKLIQ90d/e80TN7222y0SKPjMyOXq2MjPyxIeR8LYavs2EJHJbNiDyIenf32z1v7OXzla8qsyMjlaujT2xKOR9662xchfEL/+BMGxngGNwddnebNbIG+VxnfjAGbUlRqqV2DpIiDoSCbhHg2VDMULJlt1c2TmFjW+07Ae603RYERQeYHB6eBNCjOj19P+gtOtx/mupsur7lG77WclvOBp5CN2/XvGH3lq4MT1I6Ocwp9sB55biq6+px5fwDio5Y4+vX2DUWR56FSYdbnTfI5aNisguBmVik83YvaMVMKoG4tLJttUKbjeV79x4NsfGKrfH6jcghzqmWTtOHnaqzIkd8j07rKiP8l1Vsx8wuYxx0c49RHQe7nZF2G7Cvuv0ScEs77XwN1PnF6zv10EFu9xF8wzsnNRig+vhvGujO9zReN5yp9cTN9Zn1d9gMmyABkiJlUssCDYOr3zHMFBFApsSH6tW5XHIPDA8OYy8VbURqBVm8ulRzS/e5vQ+DX1L1jjOD3sJgwTt4piNxtuLP3Z7zV84mdJXuU3U2sQmjBmttjgdNj+3qVeI7d8aV3l1TPffp4VgsrN/Xk+dzPOamTa4FMFu6MF8q5BiZIs+SC+RN8j5iKPCqhEGmeIAYcF3vcOtTH0io73BLVg56ebGq63ye6yxR0znwxvmbrZe2+R/cpOLQ1ThnrK78W/dynOONc/5tSl9DH9edz7G9+59TrvTSf/iDpm0KGVxptJjV1VbuG5vZm4w783/Li//TtnrHNrXR5WYbvhm+xzeDhLfQOL4aCpyXeD5W0BSx5EmilMBHRBdmX7lYtssifyv0AqdmKChivllZK5ux+e0ZrN2mVshCqxRPOm5Qu2jp8Rl8x6yTtndDo2NdnZEuldlqV6Rjz+FRfJTIIDZpzXDozcMAzVqTCPLTcPqxU6dBvNsjzlcGTTHaInnXltEFNQfueVcSR4UJfA2hrqbb9x8IKaoW27s3pikB68D+nWm/Sn0BfEhMjIyNDZ/YkQsHfFT98cQ0pdMnJo4e2XUgfWvnWLRDoujDK4113po+sOvIUVKrsWSArdHLyHsDs7WITI9BUENiIqCShsT0aNlSdksGe/gNgnTF7agN0GNuafDwlh15dtXx1DIQ/mwvAZRgTJEXfb5FGWsnGPQcaKozqGqAPSxg3+ucO3/OgVK7M+iub4eF9pIif+FTXld8X8h41DSm4J3wF6s/Ju0AAAB42n2QPU4DMRCFn/MHJBJCIKhdUQDa/JQpEyn0CKWjSDbekGjXXnmdSDkBLRUHoOUYHIAbINFyCl6WSZMia+3o85uZ57EBnOMbCv/fJe6EFY7xKFzBETLhKvUX4Rr5XbiOFj6FG9R/hJu4VQPhFi7UGx1U7YS7m9JtywpnGAhXcIon4Sr1lXCN/CpcxxU+hBvUv4SbGONXuIVrZakM4WEwQWCcQWOKDeMCMRwskjIG1qE59GYSzExPN3oRO5s4GyjvV2KXAx5oOeeAKe09t2a+Sif+YMuB1JhuHgVLtimNLiJ0KBtfLJzV3ahzsP2e7ba02L9rgTXH7FENbNT8Pdsz0khsDK+QkjXyMrekElOPaGus8btnKdbzXgiJTrzL9IjHmjR1OvduaeLA4ufyjBx9tLmSPfeoHD5jWQh5v91OxCCKXYY/k9hxGQAAAHjaXYtbDoMwDARx+uRVehHOFLnBLW4gjkJA6u2rBsFH98OaWduZytYUaUL2nya1ChQc4AgnOMMFrpBDASVUUDdvRufR6alHZ/q5jDO3bMS1GKudX36qfqB51KME2uWJhvIkAztbb/UibKhI5nuJcksYqPNoLMX7dmfp8xAM3br3gZ1hj8P6uXBH8gUu/j02AAAAAAH//wACAAEAAAAMAAAAFgAAAAIAAQADAA4AAQAEAAAAAgAAAAB42mNgYGBkAIKrS9Q5QPStO545MBoAQZcGgAAA)
|
||||
format("woff");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.tui-icon {
|
||||
font-family: ticons;
|
||||
font-size: 24px;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
line-height: 1;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.tui-icon-at:before {
|
||||
content: "\eb90";
|
||||
}
|
||||
|
||||
.tui-icon-location:before {
|
||||
content: "\eb95";
|
||||
}
|
||||
|
||||
.tui-icon-im_more:before {
|
||||
content: "\eb96";
|
||||
}
|
||||
|
||||
.tui-icon-im_face:before {
|
||||
content: "\eb97";
|
||||
}
|
||||
|
||||
.tui-icon-link:before {
|
||||
content: "\eb98";
|
||||
}
|
||||
|
||||
.tui-icon-im_voice:before {
|
||||
content: "\eb99";
|
||||
}
|
||||
|
||||
.tui-icon-photo:before {
|
||||
content: "\eb9a";
|
||||
}
|
||||
|
||||
.tui-icon-redpacket:before {
|
||||
content: "\eb9b";
|
||||
}
|
||||
|
||||
.tui-icon-im_keyboard:before {
|
||||
content: "\eb9c";
|
||||
}
|
||||
|
||||
.tui-icon-principal:before {
|
||||
content: "\eb9d";
|
||||
}
|
||||
|
||||
.tui-icon-video:before {
|
||||
content: "\eba2";
|
||||
}
|
||||
|
||||
.tui-icon-delete_keybord:before {
|
||||
content: "\e7b8";
|
||||
}
|
||||
|
||||
.tui-icon-paishe::before {
|
||||
content: "\e604";
|
||||
}
|
||||
|
||||
.tui-reply-tabbar {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
z-index: 999;
|
||||
|
||||
.tui-chat-tabbar {
|
||||
width: 100%;
|
||||
background-color: $uni-bg-color-grey;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
padding: 16rpx 24rpx;
|
||||
padding-bottom: 80rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
border-top: 1rpx solid $uni-text-color-placeholder;
|
||||
-webkit-transform: scaleY(0.5);
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
|
||||
.tui-chat-input {
|
||||
flex: 1;
|
||||
// min-height: 80rpx;
|
||||
min-height: rpx;
|
||||
padding: $uni-spacing-col-base 0;
|
||||
background-color: $uni-bg-color;
|
||||
border-radius: 8rpx;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tui-chat-voice_btn {
|
||||
flex: 1;
|
||||
height: 78rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tui-icon-mr {
|
||||
margin-right: 28rpx;
|
||||
}
|
||||
|
||||
.tui-icon-ml {
|
||||
margin-left: 28rpx;
|
||||
}
|
||||
|
||||
.tui-icon {
|
||||
margin-bottom: 13rpx;
|
||||
}
|
||||
|
||||
.tui-send-box {
|
||||
width: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.tui-btn-send {
|
||||
flex-shrink: 0;
|
||||
padding: 22rpx 0;
|
||||
font-size: 30rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tui-reply-more {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
border-top: 1rpx solid $uni-text-color-placeholder;
|
||||
-webkit-transform: scaleY(0.5);
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
|
||||
.tui-face-box {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background-color: $uni-bg-color-hover;
|
||||
|
||||
.tui-face-scroll {
|
||||
width: 100%;
|
||||
padding: $uni-spacing-row-lg 24rpx 80rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.tui-face-img_box {
|
||||
width: 14.2857%;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.tui-face-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tui-delete-face_box {
|
||||
position: absolute;
|
||||
background-color: $uni-bg-color-hover;
|
||||
width: 108rpx;
|
||||
height: 92rpx;
|
||||
right: 20rpx;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
|
||||
.tui-delete-keybord {
|
||||
width: 108rpx;
|
||||
height: 68rpx;
|
||||
background-color: $uni-bg-color;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: $uni-border-radius-lg;
|
||||
|
||||
.tui-icon {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tui-more-box {
|
||||
width: 100%;
|
||||
padding: $uni-spacing-row-lg;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
background-color: $uni-bg-color-hover;
|
||||
|
||||
.tui-more-item {
|
||||
width: 126rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
margin-right: 40rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.tui-more-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #ffffff;
|
||||
height: 126rpx;
|
||||
width: 126rpx;
|
||||
border-radius: 32rpx;
|
||||
|
||||
.tui-icon {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tui-more-text {
|
||||
font-size: 24rpx;
|
||||
line-height: 24rpx;
|
||||
color: #7e7e7e;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tui-inner-mask {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-color: rgba(248, 248, 248, 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
.tui-reply-mask {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 990;
|
||||
background-color: $uni-bg-color-mask;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.tui-box-show {
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
||||
.tui-mask-show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tui-icon-paishe {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
.ql-container {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.tui-chat-input {
|
||||
/deep/ {
|
||||
.ql-editor {
|
||||
min-height: 56rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
13
java-mall-app-shop-admin/components/table/table-render.js
Normal file
13
java-mall-app-shop-admin/components/table/table-render.js
Normal file
@ -0,0 +1,13 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
tableNameRender(h, {
|
||||
row,
|
||||
col
|
||||
}) {
|
||||
console.log(row)
|
||||
return h('view', row.name)
|
||||
}
|
||||
}
|
||||
})
|
||||
784
java-mall-app-shop-admin/components/table/z-table.vue
Normal file
784
java-mall-app-shop-admin/components/table/z-table.vue
Normal file
@ -0,0 +1,784 @@
|
||||
<template>
|
||||
<view class="z-table">
|
||||
<view class="z-table-main" :style="compluteHeight">
|
||||
<view v-if="!tableLoaded && (!tableData || !columns)" :class="['z-loading', {ztableLoading: tableShow}]">
|
||||
<view class="z-loading-animate"></view>
|
||||
</view>
|
||||
<view class="z-table-container">
|
||||
<view class="z-table-pack">
|
||||
<view class="z-table-title">
|
||||
<view class="z-table-title-item" :class="{ 'z-table-stick-side': stickSide && index == 0 }" :style="{ width: item.width ? item.width + 'rpx' : '200rpx' }"
|
||||
v-for="(item, index) in columns" :key="index" @click="sort(item.key, index)">
|
||||
<view v-if="showSelect && !singleSelect && index === 0" class="select-box" @click="doSelect(true)">
|
||||
<view :class="['select-tip', {'selected': selectAll}]"></view>
|
||||
</view>
|
||||
<view :class="['z-table-col-text', {'text-left': titleTextAlign === 'left', 'text-center': titleTextAlign === 'center', 'text-right': titleTextAlign === 'right'}]">
|
||||
<view v-html="getTitleText(item.title)"></view>
|
||||
<view v-if="item.hasOwnProperty('key') && item.hasOwnProperty('sort') && tableData.length" class="sort">
|
||||
<view class="up-arrow" :class="{ action: nowSortKey == item.key && sortType == 'asc' }"></view>
|
||||
<view class="down-arrow" :class="{ action: nowSortKey == item.key && sortType == 'desc' }"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="tableData.length" :class="['table-container-box', {'short-table': !longTable && showBottomSum}]">
|
||||
<view class="z-table-container-row" :class="{ 'z-table-has-bottom': showBottomSum }" v-for="(row, iIndex) in tableData"
|
||||
:key="iIndex">
|
||||
<view :class="['z-table-container-col', { 'z-table-stick-side': stickSide && jIndex == 0 }]" :style="{ width: col.width ? col.width + 'rpx' : '200rpx' }"
|
||||
v-for="(col, jIndex) in columns" :key="jIndex" @click="itemClick(row, col)">
|
||||
<view v-if="showSelect && jIndex === 0" class="select-box" @click="doSelect(false, iIndex)">
|
||||
<view :class="['select-tip', {'selected': selectArr.includes(iIndex)}]"></view>
|
||||
</view>
|
||||
<view :class="['z-table-col-text', {'text-left': textAlign === 'left', 'text-center': textAlign === 'center', 'text-right': textAlign === 'right'}]">
|
||||
<view v-if="!col.isLink" v-html="getRowContent(row, col)">
|
||||
<!-- <view v-if="!col.render" v-html="getRowContent(row, col)"></view> -->
|
||||
<!-- <renderComponents v-else :row="row" :col="col" /> -->
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<router-link v-else-if="setUrl(row, col).indexOf('http') != 0" :to="setUrl(row, col)" v-html="getRowContent(row, col)"></router-link>
|
||||
<a v-else-if="col.isLink" :href="setUrl(row, col)" v-html="getRowContent(row, col)"></a>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef H5 -->
|
||||
<navigator v-else-if="col.isLink" :url="setUrl(row, col)" v-html="getRowContent(row, col)"></navigator>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :class="['z-table-bottom', {'long-table': longTable}]" v-if="showBottomSum && tableData.length">
|
||||
<view class="z-table-bottom-col" :class="{ 'z-table-stick-side': stickSide && sumIndex == 0 }" :style="{ width: sumCol.width ? sumCol.width + 'rpx' : '200rpx' }"
|
||||
v-for="(sumCol, sumIndex) in columns" :key="sumIndex">
|
||||
<view class="z-table-bottom-text">
|
||||
<!-- <view v-if="sumIndex != 0" class="z-table-bottom-text-title">{{ sumCol.title }}</view> -->
|
||||
<text :class="{ sum: sumIndex == 0 }">{{ sumIndex == 0 ? '总计' : dosum(sumCol) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="tableData && tableData.length == 0 && !tableLoaded" class="table-empty">
|
||||
<!-- image v-if="!showLoading" class="empty-img" src="../static/empty.png"></image -->
|
||||
<view v-html="showLoading ? '' : emptyText"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/*
|
||||
* 表格使用
|
||||
* 注意如果需要异步加载,需要把tableData初始值设为false,当没有数据的时候值为空数组
|
||||
* props: tableData [Array | Boolean] | 表格数据 如果为false则显示loading
|
||||
* columns [Array | Boolean] | 数据映射表 如果为false则显示loading 每列params => title(表头文字可以是html字符串模版), width(每列宽度) [, key(对应tableData的字段名) || format(自定义内容), sort(是否要排序), isLink(是否显示为超链接Object)]
|
||||
* format格式: {template: 字符串模版用#key#表示需要被替换的数据,names: 对应template属性内要被替换的内容的key}
|
||||
* isLink格式: {url: 链接地址, params: 地址带的参数Array[key|value, key|value, ...]每一项都是key和value以'|'链接,如果不带'|'默认键值同名
|
||||
* listenerClick(是否监听点击事件Boolean)}
|
||||
* stickSide Boolean | 是否固定右侧首栏 默认不显示
|
||||
* showBottomSum Boolean | 是否显示底部统计 默认不显示
|
||||
* showLoading Boolean | 是否首次加载首次加载不显示暂无数据内容
|
||||
* emptyText String | 空数据显示的文字内容
|
||||
* tableHeight Number | 设置表格高度会滚动
|
||||
* sort Boolean | 开启排序
|
||||
* showSelect Boolean | 开启选择
|
||||
* singleSelect Boolean | 在开启选择的状态下是否开起单选
|
||||
* textAlign String | 内容对齐方式 left center right
|
||||
* titleTextAlign String | 表头对齐方式 left center right
|
||||
*
|
||||
* event: onSort | 排序事件 返回{key: 被排序列的字段名, type: 正序'asc'/倒序'desc'}
|
||||
* onSelect | 选中时触发 返回选择的行的下标
|
||||
* onClick | 单元格点击事件 返回点击单元格所属行的数据
|
||||
*
|
||||
* function: resetSort | 调用后重置排序 *注意:不会触发sort事件
|
||||
*
|
||||
* */
|
||||
import Vue from 'vue'
|
||||
// import tableRender from './table-render'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
version: '1.1.3',
|
||||
nowSortKey: '',
|
||||
sortType: 'desc', // asc/desc 升序/降序
|
||||
longTable: true,
|
||||
lineHeight: uni.upx2px(64),
|
||||
tableLoaded: false,
|
||||
tableShow: true,
|
||||
selectAll: false,
|
||||
selectArr: []
|
||||
}
|
||||
},
|
||||
// mixin: [tableRender],
|
||||
computed: {
|
||||
compluteHeight() {
|
||||
return this.tableHeight ?
|
||||
'height: ' + uni.upx2px(this.tableHeight) + 'px' :
|
||||
''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
tableData: {
|
||||
type: [Array, Boolean],
|
||||
default () {
|
||||
return false
|
||||
}
|
||||
},
|
||||
columns: {
|
||||
/*
|
||||
*
|
||||
* [{title: xxx, key: 当前列展示对象名, width: 列宽, render: function}]
|
||||
*
|
||||
* */
|
||||
type: [Array, Boolean],
|
||||
required: true
|
||||
},
|
||||
stickSide: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showBottomSum: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showLoading: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: '暂无数据'
|
||||
},
|
||||
tableHeight: {
|
||||
type: [Number, Boolean],
|
||||
default: 0
|
||||
},
|
||||
showSelect: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
singleSelect: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
textAlign: {
|
||||
type: String,
|
||||
default: 'left' // right|center|left
|
||||
},
|
||||
titleTextAlign: {
|
||||
type: String,
|
||||
default: 'left' // right|center|left
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
},
|
||||
// components: {
|
||||
// renderComponents: {
|
||||
// functional: true,
|
||||
// props: {
|
||||
// row: {
|
||||
// type: Object,
|
||||
// required: true
|
||||
// },
|
||||
// col: {
|
||||
// type: Object,
|
||||
// required: true
|
||||
// }
|
||||
// },
|
||||
// render: function(h, ctx) {
|
||||
// return _this[ctx.props.col.render](h, ctx.props)
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
watch: {
|
||||
columns() {
|
||||
this.init()
|
||||
},
|
||||
tableData() {
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async init() {
|
||||
// 重置选择内容
|
||||
this.selectAll = false
|
||||
this.selectArr = []
|
||||
this.tableLoaded = false
|
||||
this.tableShow = true
|
||||
let _this = this
|
||||
let container = await _this.getPageSize('.z-table-container'),
|
||||
pack = await _this.getPageSize('.z-table-pack')
|
||||
_this.timer && clearTimeout(_this.timer)
|
||||
if (container && pack) {
|
||||
_this.$nextTick(function() {
|
||||
if (_this.tableData && _this.tableData.length) {
|
||||
_this.tableShow = false
|
||||
_this.timer = setTimeout(function() {
|
||||
_this.tableLoaded = true
|
||||
}, 300)
|
||||
}
|
||||
})
|
||||
if (container.height != pack.height) {
|
||||
_this.longTable = true
|
||||
} else {
|
||||
_this.longTable = false
|
||||
}
|
||||
} else {
|
||||
_this.tableLoaded = false
|
||||
_this.$nextTick(function() {
|
||||
_this.tableShow = true
|
||||
})
|
||||
}
|
||||
},
|
||||
getPageSize(selecter) {
|
||||
// 获取元素信息
|
||||
let query = uni.createSelectorQuery().in(this),
|
||||
_this = this
|
||||
return new Promise((resolve, reject) => {
|
||||
query
|
||||
.select(selecter)
|
||||
.boundingClientRect(res => {
|
||||
resolve(res)
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
},
|
||||
dosum({key, noSum = false, formatNum = true}) {
|
||||
let sum = '-'
|
||||
if (noSum) return sum
|
||||
if (this.tableData) {
|
||||
if (
|
||||
this.tableData.every(item => {
|
||||
return !Number.isNaN(item[key] - 0)
|
||||
})
|
||||
) {
|
||||
sum = 0
|
||||
this.tableData.map((item, index) => {
|
||||
if (!key && index != 0) {
|
||||
sum = '-'
|
||||
} else {
|
||||
let val = item[key] - 0
|
||||
if (Number.isNaN(val)) {
|
||||
sum += 0
|
||||
} else {
|
||||
sum += val
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// sum = sum == 0 ? "-" : sum
|
||||
return formatNum ? this.numTransform(sum) : sum
|
||||
},
|
||||
getRowContent(row, col) {
|
||||
// 表格值处理函数
|
||||
// 如果columns带了key则显示对应的key
|
||||
// 如果columns带的format则按规定返回format后的html
|
||||
// format规定: params names <Array> 对应tableData的键名,作为匹配template中两个#之间动态内容的名字
|
||||
// params template <String> html字符串模版
|
||||
let tempHTML = ''
|
||||
let rowKey = row[col.key]
|
||||
if ([null, ''].includes(rowKey)) {
|
||||
rowKey = '-'
|
||||
}
|
||||
let { formatNum = true } = col
|
||||
if (rowKey || rowKey === 0) {
|
||||
tempHTML = isNaN(rowKey - 0) || !formatNum ?
|
||||
rowKey :
|
||||
this.numTransform(rowKey - 0)
|
||||
// tempHTML = tempHTML == 0 ? "-" : tempHTML
|
||||
} else if (!!col.format) {
|
||||
let tempFormat = col.format.template
|
||||
col.format.names.map(item => {
|
||||
let regexp = new RegExp(`\#${item}\#`, 'mg')
|
||||
tempFormat = tempFormat.replace(regexp, row[item])
|
||||
})
|
||||
tempHTML = tempFormat
|
||||
} else if (!col.render) {
|
||||
let error = new Error('数据的key或format值至少一个不为空')
|
||||
throw error
|
||||
}
|
||||
// console.log(tempHTML)
|
||||
return tempHTML.toString()
|
||||
},
|
||||
sort(key, index) {
|
||||
if (!key || !this.columns[index].sort) {
|
||||
return
|
||||
}
|
||||
// 排序功能: 如果点击的排序按钮是原先的 那么更改排序类型
|
||||
// 如果点击的另一个排序按钮 那么选择当前排序并且排序类型改为降序(desc)
|
||||
if (key != this.nowSortKey) {
|
||||
this.nowSortKey = key
|
||||
this.sortType = 'desc'
|
||||
} else {
|
||||
this.toggleSort()
|
||||
}
|
||||
this.$emit('onSort', {
|
||||
key: this.nowSortKey,
|
||||
type: this.sortType
|
||||
})
|
||||
},
|
||||
toggleSort() {
|
||||
this.sortType = this.sortType == 'asc' ? 'desc' : 'asc'
|
||||
},
|
||||
numTransform(n) {
|
||||
if (Number.isNaN(n - 0)) {
|
||||
return n
|
||||
}
|
||||
if (Math.abs(n) >= 100000000) {
|
||||
n = Number((n / 100000000).toFixed(1)) + '亿'
|
||||
} else if (Math.abs(n) >= 10000) {
|
||||
n = Number((n / 10000).toFixed(1)) + '万'
|
||||
}
|
||||
return n.toString()
|
||||
},
|
||||
resetSort() {
|
||||
// 重置排序状态
|
||||
this.nowSortKey = ''
|
||||
this.sortType = 'desc'
|
||||
},
|
||||
setUrl(row, col) {
|
||||
if (!col.isLink) {
|
||||
return
|
||||
}
|
||||
let urlParam = {}
|
||||
let {
|
||||
isLink: {
|
||||
url,
|
||||
params = []
|
||||
}
|
||||
} = col
|
||||
params.forEach(item => {
|
||||
if (~item.indexOf('|')) {
|
||||
let temp = item.split('|')
|
||||
urlParam[temp[0]] = row[temp[1]]
|
||||
} else {
|
||||
urlParam[item] = row[item]
|
||||
}
|
||||
})
|
||||
url = this.setUrlParams(url, urlParam)
|
||||
return url
|
||||
},
|
||||
setUrlParams(url, params) {
|
||||
let tempUrl = url,
|
||||
keyArr = Object.keys(params)
|
||||
keyArr.forEach(item => {
|
||||
tempUrl += `&${item}=${params[item]}`
|
||||
})
|
||||
tempUrl = tempUrl.replace(/\&/, '?')
|
||||
return tempUrl
|
||||
},
|
||||
itemClick(row, col) {
|
||||
if (col.listenerClick) {
|
||||
this.$emit('onClick', row)
|
||||
}
|
||||
},
|
||||
doSelect(isAll = false, index) {
|
||||
let temp = new Set()
|
||||
if (isAll) {
|
||||
// 全选
|
||||
if (!this.selectAll) {
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
temp.add(i)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if (!this.singleSelect) {
|
||||
// this.selectArr.forEach(item => {
|
||||
// temp.add(item)
|
||||
// })
|
||||
// }
|
||||
this.selectArr.forEach(item => {
|
||||
temp.add(item)
|
||||
})
|
||||
if (temp.has(index)) {
|
||||
temp.delete(index)
|
||||
} else {
|
||||
if (this.singleSelect) {
|
||||
temp.clear()
|
||||
}
|
||||
temp.add(index)
|
||||
}
|
||||
}
|
||||
this.selectArr = Array.from(temp)
|
||||
// console.log(this.selectArr)
|
||||
if (this.selectArr.length == this.tableData.length) {
|
||||
this.selectAll = true
|
||||
} else {
|
||||
this.selectAll = false
|
||||
}
|
||||
|
||||
this.$emit('onSelect', this.selectArr)
|
||||
},
|
||||
// 1.1.1
|
||||
getTitleText(title) {
|
||||
// 自定义表头
|
||||
let tempHTML = title
|
||||
return tempHTML.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.navigator-hover {
|
||||
background: transparent;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@mixin ellipsis($num: 1) {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@if $num==1 {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@else {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: $num;
|
||||
/* autoprefixer: off */
|
||||
-webkit-box-orient: vertical;
|
||||
/* autoprefixer: on */
|
||||
}
|
||||
}
|
||||
|
||||
// 三角形
|
||||
%triangle-basic {
|
||||
content: '';
|
||||
height: 0;
|
||||
width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@mixin triangle($direction, $size, $borderColor) {
|
||||
@extend %triangle-basic;
|
||||
|
||||
@if $direction==top {
|
||||
border-bottom: $size solid $borderColor;
|
||||
border-left: $size dashed transparent;
|
||||
border-right: $size dashed transparent;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
@else if $direction==right {
|
||||
border-left: $size solid $borderColor;
|
||||
border-top: $size dashed transparent;
|
||||
border-bottom: $size dashed transparent;
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
@else if $direction==bottom {
|
||||
border-top: $size solid $borderColor;
|
||||
border-left: $size dashed transparent;
|
||||
border-right: $size dashed transparent;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
@else if $direction==left {
|
||||
border-right: $size solid $borderColor;
|
||||
border-top: $size dashed transparent;
|
||||
border-bottom: $size dashed transparent;
|
||||
border-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.z-table {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
min-height: 130rpx;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border: solid 2rpx #ccc;
|
||||
font-size: $uni-font-size-sm;
|
||||
box-sizing: border-box;
|
||||
transform: translateZ(0);
|
||||
|
||||
.z-table-main {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-container {
|
||||
height: 100%;
|
||||
overflow: scroll;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-pack {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.z-table-title {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
height: 64rpx;
|
||||
z-index: 1;
|
||||
|
||||
.z-table-title-item {
|
||||
border-bottom: solid 1rpx #dbdbdb;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.z-table-stick-side {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-right: solid 1rpx #dbdbdb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.table-container-box.short-table {
|
||||
padding-bottom: 48rpx;
|
||||
}
|
||||
|
||||
.z-table-title,
|
||||
.z-table-container-row {
|
||||
display: flex;
|
||||
width: fit-content;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
|
||||
.z-table-title-item,
|
||||
.z-table-container-col {
|
||||
@include ellipsis();
|
||||
display: inline-flex;
|
||||
padding: 0 16rpx;
|
||||
height: 64rpx;
|
||||
align-items: center;
|
||||
line-height: 64rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.z-table-container-row {
|
||||
z-index: 0;
|
||||
border-bottom: solid 1rpx #f4f4f4;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-stick-side {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background: #f7f9ff;
|
||||
border-right: solid 1rpx #dbdbdb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-bottom {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
z-index: 9;
|
||||
display: flex;
|
||||
justify-items: center;
|
||||
width: fit-content;
|
||||
background: #4298f7 !important;
|
||||
color: #fff !important;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.long-table {
|
||||
position: sticky;
|
||||
}
|
||||
|
||||
.z-table-stick-side {
|
||||
background: #4298f7 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-bottom-col {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-bottom-text {
|
||||
line-height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.z-table-bottom-text-title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 22rpx;
|
||||
color: #aad0ff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sum {
|
||||
margin-left: 14rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.table-empty {
|
||||
position: absolute;
|
||||
top: 64rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sort {
|
||||
display: flex;
|
||||
padding: 5rpx;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.up-arrow {
|
||||
@include triangle(top, 10rpx, #ccc);
|
||||
display: block;
|
||||
margin-bottom: 5rpx;
|
||||
|
||||
&.action {
|
||||
@include triangle(top, 10rpx, #4298f7);
|
||||
}
|
||||
}
|
||||
|
||||
.down-arrow {
|
||||
@include triangle(bottom, 10rpx, #ccc);
|
||||
display: block;
|
||||
|
||||
&.action {
|
||||
@include triangle(bottom, 10rpx, #4298f7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1.0.5
|
||||
.z-loading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
opacity: 0;
|
||||
transition: all 0.3s;
|
||||
|
||||
&.ztableLoading {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.z-loading-animate {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 100%;
|
||||
border: solid 6rpx #ccc;
|
||||
vertical-align: middle;
|
||||
animation: rotate 1s ease-in-out infinite;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1.1.0
|
||||
.select-box {
|
||||
display: inline-block;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
line-height: 14rpx;
|
||||
margin-right: 15rpx;
|
||||
border: solid 2rpx #4298f7;
|
||||
border-radius: 4rpx;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.select-tip {
|
||||
display: inline-block;
|
||||
opacity: 0;
|
||||
transform: rotate(90deg);
|
||||
transition: all .3s;
|
||||
|
||||
&.selected {
|
||||
position: relative;
|
||||
top: 4rpx;
|
||||
left: -4rpx;
|
||||
height: 4rpx;
|
||||
background: #4298f7;
|
||||
width: 10rpx;
|
||||
opacity: 1;
|
||||
transform: rotate(45deg);
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
display: block;
|
||||
height: 4rpx;
|
||||
background: #4298f7;
|
||||
}
|
||||
|
||||
&:before {
|
||||
bottom: -2rpx;
|
||||
left: -4rpx;
|
||||
width: 8rpx;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
&:after {
|
||||
bottom: 16rpx;
|
||||
right: -16rpx;
|
||||
width: 34rpx;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1.1.1
|
||||
.z-table-col-text {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
justify-content: flex-start;
|
||||
align-content: center;
|
||||
|
||||
&.text-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&.text-right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,431 @@
|
||||
<template>
|
||||
<uniPopup ref="popup" type="bottom">
|
||||
<view class="tpf-time-range-section">
|
||||
<view
|
||||
class="tpf-time-range-title-section flex flex-align-center flex-pack-justify"
|
||||
>
|
||||
<text
|
||||
class="tpf-time-range-title-txt tpf-time-range-cancel"
|
||||
@tap="closePopup('cancel')"
|
||||
>取消</text
|
||||
>
|
||||
<text class="tpf-time-range-title-txt tpf-time-range-title"
|
||||
>时间范围选择</text
|
||||
>
|
||||
<text
|
||||
class="tpf-time-range-title-txt tpf-time-range-sure"
|
||||
@tap="closePopup('sure')"
|
||||
>确定</text
|
||||
>
|
||||
</view>
|
||||
<view
|
||||
class="tpf-time-range-main flex flex-l flex-align-center flex-pack-justify"
|
||||
>
|
||||
<view class="tpf-time-range-item flex flex-v flex-align-center">
|
||||
<text class="tpf-start-time">开始时间</text>
|
||||
<picker-view
|
||||
class="flex-1 tpf-picker-view"
|
||||
:value="startDefaultTimeArr"
|
||||
indicator-style="height: 50px;"
|
||||
@change="startTimeChange"
|
||||
>
|
||||
<picker-view-column>
|
||||
<view
|
||||
class="tpf-time-range-picker-item flex flex-align-center flex-pack-center"
|
||||
v-for="(item, index) in createTimeRange.hours"
|
||||
:key="index"
|
||||
>{{ item }}</view
|
||||
>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view
|
||||
class="tpf-time-range-picker-item flex flex-align-center flex-pack-center"
|
||||
v-for="(item, index) in createTimeRange.startMinutes"
|
||||
:key="index"
|
||||
>{{ item }}</view
|
||||
>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
<text class="tpf-time-divide"> - </text>
|
||||
<view class="tpf-time-range-item flex flex-v flex-align-center">
|
||||
<text class="tpf-start-time">结束时间</text>
|
||||
<picker-view
|
||||
class="flex-1 tpf-picker-view"
|
||||
:value="endDefaultTimeArr"
|
||||
indicator-style="height: 50px;"
|
||||
@change="endTimeChange"
|
||||
>
|
||||
<picker-view-column>
|
||||
<view
|
||||
class="tpf-time-range-picker-item flex flex-align-center flex-pack-center"
|
||||
v-for="(item, index) in createTimeRange.hours"
|
||||
:key="index"
|
||||
>{{ item }}</view
|
||||
>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view
|
||||
class="tpf-time-range-picker-item flex flex-align-center flex-pack-center"
|
||||
v-for="(item, index) in createTimeRange.endMinutes"
|
||||
:key="index"
|
||||
>{{ item }}</view
|
||||
>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uniPopup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* TimeRange 时间范围选择
|
||||
* @description 对时间(时、分)区间进行选择,限制选择范围
|
||||
* @property {string} startTime 定义开始时间
|
||||
* @property {string} startDefaultTime 定义开始默认时间
|
||||
* @property {string} endTime 定义结束时间
|
||||
* @property {string} endDefaultTime 定义结束默认时间
|
||||
* @event {Function()} name
|
||||
*/
|
||||
|
||||
import uniPopup from "../uni-popup/uni-popup.vue";
|
||||
// import { uniPopup } from "@dcloudio/uni-ui";
|
||||
export default {
|
||||
name: "TpfTimeRange",
|
||||
components: {
|
||||
uniPopup,
|
||||
},
|
||||
props: {
|
||||
// 开始时间
|
||||
startTime: {
|
||||
type: String,
|
||||
default: "00:00",
|
||||
validator: (value) => {
|
||||
return /(((2[0-3])|([0-1][0-9])):[0-5][0-9])|24:00/.test(value);
|
||||
},
|
||||
},
|
||||
// 开始默认时间
|
||||
startDefaultTime: {
|
||||
type: String,
|
||||
// #ifdef MP-WEIXIN
|
||||
default: "00:00",
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
default() {
|
||||
return this.startTime;
|
||||
},
|
||||
// #endif
|
||||
|
||||
validator: (value) => {
|
||||
return /(((2[0-3])|([0-1][0-9])):[0-5][0-9])|24:00/.test(value);
|
||||
},
|
||||
},
|
||||
// 结束时间
|
||||
endTime: {
|
||||
type: String,
|
||||
default: "23:59",
|
||||
validator: (value) => {
|
||||
return /(((2[0-3])|([0-1][0-9])):[0-5][0-9])|24:00/.test(value);
|
||||
},
|
||||
},
|
||||
// 结束默认时间
|
||||
endDefaultTime: {
|
||||
type: String,
|
||||
// #ifdef MP-WEIXIN
|
||||
default: "23:59",
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
default() {
|
||||
return this.endTime;
|
||||
},
|
||||
// #endif
|
||||
validator: (value) => {
|
||||
return /(((2[0-3])|([0-1][0-9])):[0-5][0-9])|24:00/.test(value);
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
startDefaultTimeArr: [0, 0],
|
||||
endDefaultTimeArr: [0, 0],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
startTimeChange(e) {
|
||||
this.startDefaultTimeArr = e.detail.value;
|
||||
if (this.compareTwoTimeRange(e.detail.value, this.endDefaultTimeArr))
|
||||
this.endDefaultTimeArr = e.detail.value;
|
||||
},
|
||||
endTimeChange(e) {
|
||||
this.endDefaultTimeArr = e.detail.value;
|
||||
if (this.compareTwoTimeRange(this.startDefaultTimeArr, e.detail.value))
|
||||
this.startDefaultTimeArr = e.detail.value;
|
||||
},
|
||||
open() {
|
||||
this.$refs.popup.open();
|
||||
},
|
||||
closePopup(action = "") {
|
||||
if (
|
||||
this.compareTwoTimeRange(
|
||||
this.startDefaultTimeArr,
|
||||
this.endDefaultTimeArr
|
||||
)
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "开始时间不能大于结束时间",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let startTime =
|
||||
this.createTimeRange.hours[this.startDefaultTimeArr[0]] +
|
||||
":" +
|
||||
this.createTimeRange.startMinutes[this.startDefaultTimeArr[1]];
|
||||
let endTime =
|
||||
this.createTimeRange.hours[this.endDefaultTimeArr[0]] +
|
||||
":" +
|
||||
this.createTimeRange.endMinutes[this.endDefaultTimeArr[1]];
|
||||
this.$emit("timeRange", [startTime, endTime]);
|
||||
this.$refs.popup.close();
|
||||
},
|
||||
compareTwoTimeRange(arr1 = [], arr2 = []) {
|
||||
if (arr1[0] > arr2[0] || (arr1[0] == arr2[0] && arr1[1] > arr2[1]))
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
},
|
||||
beforeCreate() {
|
||||
// 初始化小时
|
||||
let hour = [],
|
||||
minute = [];
|
||||
for (let h = 0; h <= 24; h++) {
|
||||
hour.push(h < 10 ? "0" + h : h + "");
|
||||
}
|
||||
for (let m = 0; m < 60; m++) {
|
||||
minute.push(m < 10 ? "0" + m : m + "");
|
||||
}
|
||||
this.timeRange = { hour, minute };
|
||||
},
|
||||
created() {},
|
||||
computed: {
|
||||
createTimeRange() {
|
||||
let { startTime, startDefaultTime, endTime, endDefaultTime } =
|
||||
this.timeRangeDateChange;
|
||||
let startTimeArr = startTime.split(":"),
|
||||
endTimeArr = endTime.split(":");
|
||||
let hours = this.timeRange.hour.slice(
|
||||
this.timeRange.hour.findIndex((item) => item == startTimeArr[0]),
|
||||
this.timeRange.hour.findIndex((item) => item == endTimeArr[0]) + 1
|
||||
);
|
||||
|
||||
let startMinutes = null;
|
||||
if (startTimeArr[0] == endTimeArr[0]) {
|
||||
startMinutes = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1]),
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) + 1
|
||||
);
|
||||
} else {
|
||||
if (this.startDefaultTimeArr[0] == 0) {
|
||||
startMinutes = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1])
|
||||
);
|
||||
} else if (this.startDefaultTimeArr[0] == hours.length - 1) {
|
||||
startMinutes = this.timeRange.minute.slice(
|
||||
0,
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) + 1
|
||||
);
|
||||
} else {
|
||||
startMinutes = this.timeRange.minute; // 完整数据
|
||||
}
|
||||
}
|
||||
let endMinutes = null;
|
||||
if (startTimeArr[0] == endTimeArr[0]) {
|
||||
endMinutes = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1]),
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) + 1
|
||||
);
|
||||
} else {
|
||||
if (this.endDefaultTimeArr[0] == 0) {
|
||||
endMinutes = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1])
|
||||
);
|
||||
} else if (this.endDefaultTimeArr[0] == hours.length - 1) {
|
||||
endMinutes = this.timeRange.minute.slice(
|
||||
0,
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) + 1
|
||||
);
|
||||
} else {
|
||||
endMinutes = this.timeRange.minute; // 完整数据
|
||||
}
|
||||
}
|
||||
return {
|
||||
hours,
|
||||
startMinutes,
|
||||
endMinutes,
|
||||
};
|
||||
},
|
||||
// 用于监听属性的变化
|
||||
timeRangeDateChange() {
|
||||
let { startTime, startDefaultTime, endTime, endDefaultTime } = this;
|
||||
startTime = startTime < endTime ? startTime : endTime;
|
||||
startDefaultTime =
|
||||
startDefaultTime >= startTime && startDefaultTime <= endTime
|
||||
? startDefaultTime
|
||||
: startTime;
|
||||
endDefaultTime =
|
||||
endDefaultTime >= startTime &&
|
||||
endDefaultTime <= endTime &&
|
||||
endDefaultTime >= startDefaultTime
|
||||
? endDefaultTime
|
||||
: startDefaultTime;
|
||||
return {
|
||||
startTime,
|
||||
startDefaultTime,
|
||||
endTime,
|
||||
endDefaultTime,
|
||||
};
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
timeRangeDateChange: {
|
||||
handler(newVal, oldVal) {
|
||||
let { startTime, startDefaultTime, endTime, endDefaultTime } = newVal;
|
||||
let startTimeArr = startTime.split(":"),
|
||||
endTimeArr = endTime.split(":");
|
||||
let startDefaultTimeArr = startDefaultTime.split(":"),
|
||||
endDefaultTimeArr = endDefaultTime.split(":");
|
||||
|
||||
let hours = this.timeRange.hour.slice(
|
||||
this.timeRange.hour.findIndex((item) => item == startTimeArr[0]),
|
||||
this.timeRange.hour.findIndex((item) => item == endTimeArr[0]) + 1
|
||||
);
|
||||
|
||||
this.$set(
|
||||
this.startDefaultTimeArr,
|
||||
0,
|
||||
hours.includes(startDefaultTimeArr[0])
|
||||
? hours.findIndex((item) => item == startDefaultTimeArr[0])
|
||||
: 0
|
||||
);
|
||||
this.$set(
|
||||
this.endDefaultTimeArr,
|
||||
0,
|
||||
hours.includes(endDefaultTimeArr[0])
|
||||
? hours.findIndex((item) => item == endDefaultTimeArr[0])
|
||||
: this.startDefaultTimeArr[0]
|
||||
);
|
||||
|
||||
let startMinute = null,
|
||||
endMinute = null;
|
||||
if (startTimeArr[0] == endTimeArr[0]) {
|
||||
startMinute = endMinute = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1]),
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) + 1
|
||||
);
|
||||
} else {
|
||||
if (startDefaultTime.split(":")[0] == startTimeArr[0]) {
|
||||
startMinute = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1])
|
||||
);
|
||||
} else if (startDefaultTime.split(":")[0] == endTimeArr[0]) {
|
||||
startMinute = this.timeRange.minute.slice(
|
||||
0,
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) +
|
||||
1
|
||||
);
|
||||
} else {
|
||||
startMinute = this.timeRange.minute;
|
||||
}
|
||||
if (endDefaultTime.split(":")[0] == startTimeArr[0]) {
|
||||
endMinute = this.timeRange.minute.slice(
|
||||
this.timeRange.minute.findIndex((item) => item == startTimeArr[1])
|
||||
);
|
||||
} else if (endDefaultTime.split(":")[0] == endTimeArr[0]) {
|
||||
endMinute = this.timeRange.minute.slice(
|
||||
0,
|
||||
this.timeRange.minute.findIndex((item) => item == endTimeArr[1]) +
|
||||
1
|
||||
);
|
||||
} else {
|
||||
endMinute = this.timeRange.minute;
|
||||
}
|
||||
}
|
||||
this.$set(
|
||||
this.startDefaultTimeArr,
|
||||
1,
|
||||
startMinute.includes(startDefaultTimeArr[1])
|
||||
? startMinute.findIndex((item) => item == startDefaultTimeArr[1])
|
||||
: 0
|
||||
);
|
||||
this.$set(
|
||||
this.endDefaultTimeArr,
|
||||
1,
|
||||
endMinute.includes(endDefaultTimeArr[1])
|
||||
? endMinute.findIndex((item) => item == endDefaultTimeArr[1])
|
||||
: this.startDefaultTimeArr[1]
|
||||
);
|
||||
},
|
||||
deep: true, // 深度监听
|
||||
immediate: true, // 初始化立即执行
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
.flex-v {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-wrap {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.flex-row-wrap {
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
.flex-align-center {
|
||||
align-items: center;
|
||||
}
|
||||
.flex-pack-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.flex-pack-justify {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-pack-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
.tpf-time-range-section {
|
||||
background-color: #fff;
|
||||
}
|
||||
.tpf-time-range-title-section {
|
||||
padding: 20rpx;
|
||||
border-bottom: 1px #f2f2f2 solid;
|
||||
}
|
||||
.tpf-time-range-title-txt {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.tpf-time-range-title {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.tpf-time-range-main {
|
||||
padding: 0 20rpx 20rpx;
|
||||
}
|
||||
.tpf-time-range-item {
|
||||
height: 400rpx;
|
||||
width: 300rpx;
|
||||
}
|
||||
.tpf-start-time {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.tpf-picker-view {
|
||||
width: 280rpx;
|
||||
}
|
||||
</style>
|
||||
129
java-mall-app-shop-admin/components/tui-badge/tui-badge.vue
Normal file
129
java-mall-app-shop-admin/components/tui-badge/tui-badge.vue
Normal file
@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<view :class="[dot ? 'tui-badge-dot' : 'tui-badge', !dot ? 'tui-badge-scale' : '']"
|
||||
:style="{ top: top, right: right, position: absolute ? 'absolute' : 'static', transform: getStyle, margin: margin,background:getBackground,color:getColor }"
|
||||
@tap="handleClick">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tuiBadge',
|
||||
emits: ['click'],
|
||||
props: {
|
||||
//primary,warning,green,danger,white,black,gray,white_red
|
||||
type: {
|
||||
type: String,
|
||||
default: 'primary'
|
||||
},
|
||||
//是否是圆点
|
||||
dot: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
margin: {
|
||||
type: String,
|
||||
default: '0'
|
||||
},
|
||||
//是否绝对定位
|
||||
absolute: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
top: {
|
||||
type: String,
|
||||
default: '-8rpx'
|
||||
},
|
||||
right: {
|
||||
type: String,
|
||||
default: '0'
|
||||
},
|
||||
//缩放比例
|
||||
scaleRatio: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
//水平方向移动距离
|
||||
translateX: {
|
||||
type: String,
|
||||
default: '0'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getStyle() {
|
||||
return `scale(${this.scaleRatio}) translateX(${this.translateX})`;
|
||||
},
|
||||
getBackground() {
|
||||
const global = uni && uni.$tui && uni.$tui.color;
|
||||
let color = {
|
||||
'primary': (global && global.primary) || '#5677fc',
|
||||
'green': (global && global.success) || '#07c160',
|
||||
'warning': (global && global.warning) || '#ff7900',
|
||||
'danger': (global && global.danger) || '#EB0909',
|
||||
'white': '#fff',
|
||||
'black': '#000',
|
||||
'gray': '#ededed',
|
||||
'red': (global && global.pink) || '#f74d54',
|
||||
'pink': (global && global.pink) || '#f74d54',
|
||||
'white_red': '#fff',
|
||||
'white_primary': '#fff',
|
||||
'white_green': '#fff',
|
||||
'white_warning': '#fff',
|
||||
'white_pink': '#fff'
|
||||
} [this.type]
|
||||
return color
|
||||
},
|
||||
getColor() {
|
||||
const global = uni && uni.$tui && uni.$tui.color;
|
||||
let color = {
|
||||
'primary': '#fff',
|
||||
'green': '#fff',
|
||||
'warning': '#fff',
|
||||
'danger': '#fff',
|
||||
'white': '#333',
|
||||
'black': '#fff',
|
||||
'gray': '#999',
|
||||
'red': '#fff',
|
||||
'pink': (global && global.pink) || '#f74d54',
|
||||
'white_red': (global && global.danger) || '#EB0909',
|
||||
'white_primary': (global && global.primary) || '#5677fc',
|
||||
'white_green': (global && global.success) || '#07c160',
|
||||
'white_warning': (global && global.warning) || '#ff7900',
|
||||
'white_pink': (global && global.pink) || '#f74d54',
|
||||
} [this.type]
|
||||
return color
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
this.$emit('click', {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tui-badge-dot {
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.tui-badge {
|
||||
font-size: 24rpx;
|
||||
line-height: 24rpx;
|
||||
height: 36rpx;
|
||||
min-width: 36rpx;
|
||||
padding: 0 10rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.tui-badge-scale {
|
||||
transform-origin: center center;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tui-selected-class tui-dropdown-list"
|
||||
:style="{ height: selectHeight ? selectHeight + 'rpx' : 'auto' }">
|
||||
<slot name="selectionbox"></slot>
|
||||
<view class="tui-dropdown-view" :class="[show ? 'tui-dropdownlist-show' : '']"
|
||||
:style="{ backgroundColor: backgroundColor, height: show ? height + 'rpx' : 0, top: top + 'rpx' }">
|
||||
<slot name="dropdownbox"></slot>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tui-dropdown__mask" :style="{backgroundColor:maskBackground}" v-if="isMask && show"
|
||||
@tap.stop="maskClick">
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tuiDropdownList',
|
||||
emits: ['close'],
|
||||
props: {
|
||||
//控制显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//背景颜色
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: 'transparent'
|
||||
},
|
||||
//top rpx
|
||||
top: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
//下拉框高度 rpx
|
||||
height: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
//选择框高度 单位rpx
|
||||
selectHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
isMask: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
maskBackground: {
|
||||
type: String,
|
||||
default: 'transparent'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
maskClick() {
|
||||
this.$emit('close', {})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tui-dropdown-list {
|
||||
position: relative;
|
||||
z-index: 12;
|
||||
}
|
||||
|
||||
.tui-dropdown-view {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
z-index: -99;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
/* visibility: hidden; */
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.tui-dropdownlist-show {
|
||||
opacity: 1;
|
||||
z-index: 996;
|
||||
/* visibility: visible; */
|
||||
}
|
||||
|
||||
.tui-dropdown__mask {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, .1);
|
||||
z-index: 5;
|
||||
}
|
||||
</style>
|
||||
274
java-mall-app-shop-admin/components/uni-popup/uni-popup.vue
Normal file
274
java-mall-app-shop-admin/components/uni-popup/uni-popup.vue
Normal file
@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<view v-if="showPopup" class="uni-popup" @touchmove.stop.prevent="clear">
|
||||
<uni-transition
|
||||
:mode-class="['fade']"
|
||||
:styles="maskClass"
|
||||
:duration="duration"
|
||||
:show="showTrans"
|
||||
@click="onTap"
|
||||
/>
|
||||
<uni-transition
|
||||
:mode-class="ani"
|
||||
:styles="transClass"
|
||||
:duration="duration"
|
||||
:show="showTrans"
|
||||
@click="onTap"
|
||||
>
|
||||
<view class="uni-popup__wrapper-box" @click.stop="clear">
|
||||
<slot />
|
||||
</view>
|
||||
</uni-transition>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniTransition from "../uni-transition/uni-transition.vue";
|
||||
|
||||
/**
|
||||
* PopUp 弹出层
|
||||
* @description 弹出层组件,为了解决遮罩弹层的问题
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
|
||||
* @property {String} type = [top|center|bottom] 弹出方式
|
||||
* @value top 顶部弹出
|
||||
* @value center 中间弹出
|
||||
* @value bottom 底部弹出
|
||||
* @property {Boolean} animation = [ture|false] 是否开启动画
|
||||
* @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
|
||||
* @event {Function} change 打开关闭弹窗触发,e={show: false}
|
||||
*/
|
||||
|
||||
export default {
|
||||
name: "uniPopup",
|
||||
components: {
|
||||
uniTransition,
|
||||
},
|
||||
props: {
|
||||
// 开启动画
|
||||
animation: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
|
||||
type: {
|
||||
type: String,
|
||||
default: "center",
|
||||
},
|
||||
// maskClick
|
||||
maskClick: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
duration: 300,
|
||||
ani: [],
|
||||
showPopup: false,
|
||||
showTrans: false,
|
||||
maskClass: {
|
||||
position: "fixed",
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
||||
},
|
||||
transClass: {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
type: {
|
||||
handler: function (newVal) {
|
||||
switch (this.type) {
|
||||
case "top":
|
||||
this.ani = ["slide-top"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
};
|
||||
break;
|
||||
case "bottom":
|
||||
this.ani = ["slide-bottom"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
};
|
||||
break;
|
||||
case "center":
|
||||
this.ani = ["zoom-out", "fade"];
|
||||
this.transClass = {
|
||||
position: "fixed",
|
||||
/* #ifndef APP-NVUE */
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
/* #endif */
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.animation) {
|
||||
this.duration = 300;
|
||||
} else {
|
||||
this.duration = 0;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clear(e) {
|
||||
// TODO nvue 取消冒泡
|
||||
e.stopPropagation();
|
||||
},
|
||||
open() {
|
||||
this.showPopup = true;
|
||||
this.$nextTick(() => {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.showTrans = true;
|
||||
}, 50);
|
||||
});
|
||||
this.$emit("change", {
|
||||
show: true,
|
||||
});
|
||||
},
|
||||
close(type) {
|
||||
this.showTrans = false;
|
||||
this.$nextTick(() => {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.$emit("change", {
|
||||
show: false,
|
||||
});
|
||||
this.showPopup = false;
|
||||
}, 300);
|
||||
});
|
||||
},
|
||||
onTap() {
|
||||
if (!this.maskClick) return;
|
||||
this.close();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.uni-popup {
|
||||
position: fixed;
|
||||
/* #ifdef H5 */
|
||||
top: var(--window-top);
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
top: 0;
|
||||
/* #endif */
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
z-index: 99;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-popup__mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: $uni-bg-color-mask;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.mask-ani {
|
||||
transition-property: opacity;
|
||||
transition-duration: 0.2s;
|
||||
}
|
||||
|
||||
.uni-top-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.uni-bottom-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.uni-center-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.uni-popup__wrapper {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
/* #endif */
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.top {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform: translateY(-500px);
|
||||
}
|
||||
|
||||
.bottom {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform: translateY(500px);
|
||||
}
|
||||
|
||||
.center {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* #endif */
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transform: scale(1.2);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.uni-popup__wrapper-box {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
/* #endif */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.content-ani {
|
||||
// transition: transform 0.3s;
|
||||
transition-property: transform, opacity;
|
||||
transition-duration: 0.2s;
|
||||
}
|
||||
|
||||
.uni-top-content {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.uni-bottom-content {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.uni-center-content {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,279 @@
|
||||
<template>
|
||||
<view v-if="isShow" ref="ani" class="uni-transition" :class="[ani.in]" :style="'transform:' +transform+';'+stylesObject"
|
||||
@click="change">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const animation = uni.requireNativePlugin('animation');
|
||||
// #endif
|
||||
/**
|
||||
* Transition 过渡动画
|
||||
* @description 简单过渡动画组件
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=985
|
||||
* @property {Boolean} show = [false|true] 控制组件显示或隐藏
|
||||
* @property {Array} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
|
||||
* @value fade 渐隐渐出过渡
|
||||
* @value slide-top 由上至下过渡
|
||||
* @value slide-right 由右至左过渡
|
||||
* @value slide-bottom 由下至上过渡
|
||||
* @value slide-left 由左至右过渡
|
||||
* @value zoom-in 由小到大过渡
|
||||
* @value zoom-out 由大到小过渡
|
||||
* @property {Number} duration 过渡动画持续时间
|
||||
* @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
|
||||
*/
|
||||
export default {
|
||||
name: 'uniTransition',
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
modeClass: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 300
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
transform: '',
|
||||
ani: { in: '',
|
||||
active: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.open()
|
||||
} else {
|
||||
this.close()
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
stylesObject() {
|
||||
let styles = {
|
||||
...this.styles,
|
||||
'transition-duration': this.duration / 1000 + 's'
|
||||
}
|
||||
let transfrom = ''
|
||||
for (let i in styles) {
|
||||
let line = this.toLine(i)
|
||||
transfrom += line + ':' + styles[i] + ';'
|
||||
}
|
||||
return transfrom
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.timer = null
|
||||
// this.nextTick = (time = 50) => new Promise(resolve => {
|
||||
// clearTimeout(this.timer)
|
||||
// this.timer = setTimeout(resolve, time)
|
||||
// return this.timer
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('click', {
|
||||
detail: this.isShow
|
||||
})
|
||||
},
|
||||
open() {
|
||||
clearTimeout(this.timer)
|
||||
this.isShow = true
|
||||
this.transform = ''
|
||||
this.ani.in = ''
|
||||
for (let i in this.getTranfrom(false)) {
|
||||
if (i === 'opacity') {
|
||||
this.ani.in = 'fade-in'
|
||||
} else {
|
||||
this.transform += `${this.getTranfrom(false)[i]} `
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this._animation(true)
|
||||
}, 50)
|
||||
})
|
||||
|
||||
},
|
||||
close(type) {
|
||||
clearTimeout(this.timer)
|
||||
this._animation(false)
|
||||
},
|
||||
_animation(type) {
|
||||
let styles = this.getTranfrom(type)
|
||||
// #ifdef APP-NVUE
|
||||
if(!this.$refs['ani']) return
|
||||
animation.transition(this.$refs['ani'].ref, {
|
||||
styles,
|
||||
duration: this.duration, //ms
|
||||
timingFunction: 'ease',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
}, () => {
|
||||
if (!type) {
|
||||
this.isShow = false
|
||||
}
|
||||
this.$emit('change', {
|
||||
detail: this.isShow
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
// #ifndef APP-NVUE
|
||||
this.transform = ''
|
||||
for (let i in styles) {
|
||||
if (i === 'opacity') {
|
||||
this.ani.in = `fade-${type?'out':'in'}`
|
||||
} else {
|
||||
this.transform += `${styles[i]} `
|
||||
}
|
||||
}
|
||||
this.timer = setTimeout(() => {
|
||||
if (!type) {
|
||||
this.isShow = false
|
||||
}
|
||||
this.$emit('change', {
|
||||
detail: this.isShow
|
||||
})
|
||||
|
||||
}, this.duration)
|
||||
// #endif
|
||||
|
||||
},
|
||||
getTranfrom(type) {
|
||||
let styles = {
|
||||
transform: ''
|
||||
}
|
||||
this.modeClass.forEach((mode) => {
|
||||
switch (mode) {
|
||||
case 'fade':
|
||||
styles.opacity = type ? 1 : 0
|
||||
break;
|
||||
case 'slide-top':
|
||||
styles.transform += `translateY(${type?'0':'-100%'}) `
|
||||
break;
|
||||
case 'slide-right':
|
||||
styles.transform += `translateX(${type?'0':'100%'}) `
|
||||
break;
|
||||
case 'slide-bottom':
|
||||
styles.transform += `translateY(${type?'0':'100%'}) `
|
||||
break;
|
||||
case 'slide-left':
|
||||
styles.transform += `translateX(${type?'0':'-100%'}) `
|
||||
break;
|
||||
case 'zoom-in':
|
||||
styles.transform += `scale(${type?1:0.8}) `
|
||||
break;
|
||||
case 'zoom-out':
|
||||
styles.transform += `scale(${type?1:1.2}) `
|
||||
break;
|
||||
}
|
||||
})
|
||||
return styles
|
||||
},
|
||||
_modeClassArr(type) {
|
||||
let mode = this.modeClass
|
||||
if (typeof(mode) !== "string") {
|
||||
let modestr = ''
|
||||
mode.forEach((item) => {
|
||||
modestr += (item + '-' + type + ',')
|
||||
})
|
||||
return modestr.substr(0, modestr.length - 1)
|
||||
} else {
|
||||
return mode + '-' + type
|
||||
}
|
||||
},
|
||||
// getEl(el) {
|
||||
// console.log(el || el.ref || null);
|
||||
// return el || el.ref || null
|
||||
// },
|
||||
toLine(name) {
|
||||
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.uni-transition {
|
||||
transition-timing-function: ease;
|
||||
transition-duration: 0.3s;
|
||||
transition-property: transform, opacity;
|
||||
}
|
||||
|
||||
.fade-in {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fade-active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.slide-top-in {
|
||||
/* transition-property: transform, opacity; */
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
.slide-top-active {
|
||||
transform: translateY(0);
|
||||
/* opacity: 1; */
|
||||
}
|
||||
|
||||
.slide-right-in {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
.slide-right-active {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.slide-bottom-in {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
.slide-bottom-active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.slide-left-in {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.slide-left-active {
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.zoom-in-in {
|
||||
transform: scale(0.8);
|
||||
}
|
||||
|
||||
.zoom-out-active {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.zoom-out-in {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
</style>
|
||||
899
java-mall-app-shop-admin/config/appUpdate.js
Normal file
899
java-mall-app-shop-admin/config/appUpdate.js
Normal file
@ -0,0 +1,899 @@
|
||||
// #ifdef APP-PLUS
|
||||
import componentConfig from '@/config/componentConfig';
|
||||
const platform = uni.getSystemInfoSync().platform;
|
||||
// 主颜色
|
||||
const $mainColor = componentConfig.appUpdateColor
|
||||
? componentConfig.appUpdateColor
|
||||
: 'FF5B78';
|
||||
// 弹窗图标url
|
||||
const $iconUrl = componentConfig.appUpdateIcon
|
||||
? componentConfig.appUpdateIcon
|
||||
: '../static/ic_ar.png';
|
||||
|
||||
// 获取当前应用的版本号
|
||||
export const getCurrentNo = function (callback) {
|
||||
// 获取本地应用资源版本号
|
||||
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
|
||||
callback &&
|
||||
callback({
|
||||
versionCode: inf.versionCode,
|
||||
versionName: inf.version,
|
||||
});
|
||||
});
|
||||
};
|
||||
// 从服务器下载应用资源包(wgt文件)
|
||||
const getDownload = function (data) {
|
||||
let dtask;
|
||||
if (data.updateType == 'forcibly' || data.updateType == 'solicit') {
|
||||
let popupData = {
|
||||
progress: true,
|
||||
buttonNum: 2,
|
||||
};
|
||||
if (data.updateType == 'forcibly') {
|
||||
popupData.buttonNum = 0;
|
||||
}
|
||||
let lastProgressValue = 0;
|
||||
let popupObj = downloadPopup(popupData);
|
||||
dtask = plus.downloader.createDownload(
|
||||
data.downloadUrl,
|
||||
{
|
||||
filename: '_doc/update/',
|
||||
},
|
||||
function (download, status) {
|
||||
if (status == 200) {
|
||||
popupObj.change({
|
||||
progressValue: 100,
|
||||
progressTip: '正在安装文件...',
|
||||
progress: true,
|
||||
buttonNum: 0,
|
||||
});
|
||||
plus.runtime.install(
|
||||
download.filename,
|
||||
{},
|
||||
function () {
|
||||
popupObj.change({
|
||||
contentText: '应用资源更新完成!',
|
||||
buttonNum: 1,
|
||||
progress: false,
|
||||
});
|
||||
},
|
||||
function (e) {
|
||||
popupObj.cancel();
|
||||
plus.nativeUI.alert('安装文件失败[' + e.code + ']:' + e.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
popupObj.change({
|
||||
contentText: '文件下载失败...',
|
||||
buttonNum: 1,
|
||||
progress: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
dtask.start();
|
||||
dtask.addEventListener('statechanged', function (task, status) {
|
||||
switch (task.state) {
|
||||
case 1: // 开始
|
||||
popupObj.change({
|
||||
progressValue: 0,
|
||||
progressTip: '准备下载...',
|
||||
progress: true,
|
||||
});
|
||||
break;
|
||||
case 2: // 已连接到服务器
|
||||
popupObj.change({
|
||||
progressValue: 0,
|
||||
progressTip: '开始下载...',
|
||||
progress: true,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
const progress = parseInt(
|
||||
(task.downloadedSize / task.totalSize) * 100
|
||||
);
|
||||
if (progress - lastProgressValue >= 2) {
|
||||
lastProgressValue = progress;
|
||||
popupObj.change({
|
||||
progressValue: progress,
|
||||
progressTip: '已下载' + progress + '%',
|
||||
progress: true,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
// 取消下载
|
||||
popupObj.cancelDownload = function () {
|
||||
dtask && dtask.abort();
|
||||
uni.showToast({
|
||||
title: '已取消下载',
|
||||
icon: 'none',
|
||||
});
|
||||
};
|
||||
// 重启APP
|
||||
popupObj.reboot = function () {
|
||||
plus.runtime.restart();
|
||||
};
|
||||
} else if (data.updateType == 'silent') {
|
||||
dtask = plus.downloader.createDownload(
|
||||
data.downloadUrl,
|
||||
{
|
||||
filename: '_doc/update/',
|
||||
},
|
||||
function (download, status) {
|
||||
if (status == 200) {
|
||||
plus.runtime.install(
|
||||
download.filename,
|
||||
{},
|
||||
function () {
|
||||
console.log('应用资源更新完成');
|
||||
},
|
||||
function (e) {
|
||||
plus.nativeUI.alert('安装文件失败[' + e.code + ']:' + e.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
plus.nativeUI.alert('文件下载失败...');
|
||||
}
|
||||
}
|
||||
);
|
||||
dtask.start();
|
||||
}
|
||||
};
|
||||
// 文字换行
|
||||
function drawtext(text, maxWidth) {
|
||||
let textArr = text.split('');
|
||||
let len = textArr.length;
|
||||
// 上个节点
|
||||
let previousNode = 0;
|
||||
// 记录节点宽度
|
||||
let nodeWidth = 0;
|
||||
// 文本换行数组
|
||||
let rowText = [];
|
||||
// 如果是字母,侧保存长度
|
||||
let letterWidth = 0;
|
||||
// 汉字宽度
|
||||
let chineseWidth = 14;
|
||||
// otherFont宽度
|
||||
let otherWidth = 7;
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) {
|
||||
if (letterWidth > 0) {
|
||||
if (nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth) {
|
||||
rowText.push({
|
||||
type: 'text',
|
||||
content: text.substring(previousNode, i),
|
||||
});
|
||||
previousNode = i;
|
||||
nodeWidth = chineseWidth;
|
||||
letterWidth = 0;
|
||||
} else {
|
||||
nodeWidth += chineseWidth + letterWidth * otherWidth;
|
||||
letterWidth = 0;
|
||||
}
|
||||
} else {
|
||||
if (nodeWidth + chineseWidth > maxWidth) {
|
||||
rowText.push({
|
||||
type: 'text',
|
||||
content: text.substring(previousNode, i),
|
||||
});
|
||||
previousNode = i;
|
||||
nodeWidth = chineseWidth;
|
||||
} else {
|
||||
nodeWidth += chineseWidth;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (/\n/g.test(textArr[i])) {
|
||||
rowText.push({
|
||||
type: 'break',
|
||||
content: text.substring(previousNode, i),
|
||||
});
|
||||
previousNode = i + 1;
|
||||
nodeWidth = 0;
|
||||
letterWidth = 0;
|
||||
} else if (textArr[i] == '\\' && textArr[i + 1] == 'n') {
|
||||
rowText.push({
|
||||
type: 'break',
|
||||
content: text.substring(previousNode, i),
|
||||
});
|
||||
previousNode = i + 2;
|
||||
nodeWidth = 0;
|
||||
letterWidth = 0;
|
||||
} else if (/[a-zA-Z0-9]/g.test(textArr[i])) {
|
||||
letterWidth += 1;
|
||||
if (nodeWidth + letterWidth * otherWidth > maxWidth) {
|
||||
rowText.push({
|
||||
type: 'text',
|
||||
content: text.substring(previousNode, i + 1 - letterWidth),
|
||||
});
|
||||
previousNode = i + 1 - letterWidth;
|
||||
nodeWidth = letterWidth * otherWidth;
|
||||
letterWidth = 0;
|
||||
}
|
||||
} else {
|
||||
if (nodeWidth + otherWidth > maxWidth) {
|
||||
rowText.push({
|
||||
type: 'text',
|
||||
content: text.substring(previousNode, i),
|
||||
});
|
||||
previousNode = i;
|
||||
nodeWidth = otherWidth;
|
||||
} else {
|
||||
nodeWidth += otherWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (previousNode < len) {
|
||||
rowText.push({
|
||||
type: 'text',
|
||||
content: text.substring(previousNode, len),
|
||||
});
|
||||
}
|
||||
return rowText;
|
||||
}
|
||||
// 是否更新弹窗
|
||||
function updatePopup(data, callback) {
|
||||
// 弹窗遮罩层
|
||||
let maskLayer = new plus.nativeObj.View('maskLayer', {
|
||||
//先创建遮罩层
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
backgroundColor: 'rgba(0,0,0,0.5)',
|
||||
});
|
||||
|
||||
// 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
|
||||
const screenWidth = plus.screen.resolutionWidth;
|
||||
const screenHeight = plus.screen.resolutionHeight;
|
||||
//弹窗容器宽度
|
||||
const popupViewWidth = screenWidth * 0.7;
|
||||
// 弹窗容器的Padding
|
||||
const viewContentPadding = 20;
|
||||
// 弹窗容器的宽度
|
||||
const viewContentWidth = parseInt(popupViewWidth - viewContentPadding * 2);
|
||||
// 描述的列表
|
||||
const descriptionList = drawtext(data.versionInfo, viewContentWidth);
|
||||
// 弹窗容器高度
|
||||
let popupViewHeight = 80 + 20 + 20 + 90 + 10;
|
||||
|
||||
let popupViewContentList = [
|
||||
{
|
||||
src: $iconUrl,
|
||||
id: 'logo',
|
||||
tag: 'img',
|
||||
position: {
|
||||
top: '0px',
|
||||
left: (popupViewWidth - 124) / 2 + 'px',
|
||||
width: '124px',
|
||||
height: '80px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'title',
|
||||
text: '发现新版本' + data.versionName,
|
||||
textStyles: {
|
||||
size: '18px',
|
||||
color: '#333',
|
||||
weight: 'bold',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
top: '90px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
];
|
||||
const textHeight = 18;
|
||||
let contentTop = 130;
|
||||
descriptionList.forEach((item, index) => {
|
||||
if (index > 0) {
|
||||
popupViewHeight += textHeight;
|
||||
contentTop += textHeight;
|
||||
}
|
||||
popupViewContentList.push({
|
||||
tag: 'font',
|
||||
id: 'content' + index + 1,
|
||||
text: item.content,
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#666',
|
||||
lineSpacing: '50%',
|
||||
align: 'left',
|
||||
},
|
||||
position: {
|
||||
top: contentTop + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: textHeight + 'px',
|
||||
},
|
||||
});
|
||||
if (item.type == 'break') {
|
||||
contentTop += 10;
|
||||
popupViewHeight += 10;
|
||||
}
|
||||
});
|
||||
|
||||
if (data.updateType == 'forcibly') {
|
||||
popupViewContentList.push({
|
||||
tag: 'rect', //绘制底边按钮
|
||||
rectStyles: {
|
||||
radius: '6px',
|
||||
color: $mainColor,
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
popupViewContentList.push({
|
||||
tag: 'font',
|
||||
id: 'confirmText',
|
||||
text: '立即升级',
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#FFF',
|
||||
lineSpacing: '0%',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// 绘制底边按钮
|
||||
popupViewContentList.push({
|
||||
tag: 'rect',
|
||||
id: 'cancelBox',
|
||||
rectStyles: {
|
||||
radius: '3px',
|
||||
borderColor: '#f1f1f1',
|
||||
borderWidth: '1px',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
popupViewContentList.push({
|
||||
tag: 'rect',
|
||||
id: 'confirmBox',
|
||||
rectStyles: {
|
||||
radius: '3px',
|
||||
color: $mainColor,
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left:
|
||||
(viewContentWidth - viewContentPadding) / 2 +
|
||||
viewContentPadding * 2 +
|
||||
'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
popupViewContentList.push({
|
||||
tag: 'font',
|
||||
id: 'cancelText',
|
||||
text: '暂不升级',
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#666',
|
||||
lineSpacing: '0%',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
popupViewContentList.push({
|
||||
tag: 'font',
|
||||
id: 'confirmText',
|
||||
text: '立即升级',
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#FFF',
|
||||
lineSpacing: '0%',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left:
|
||||
(viewContentWidth - viewContentPadding) / 2 +
|
||||
viewContentPadding * 2 +
|
||||
'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
}
|
||||
// 弹窗内容
|
||||
let popupView = new plus.nativeObj.View('popupView', {
|
||||
//创建底部图标菜单
|
||||
tag: 'rect',
|
||||
top: (screenHeight - popupViewHeight) / 2 + 'px',
|
||||
left: '15%',
|
||||
height: popupViewHeight + 'px',
|
||||
width: '70%',
|
||||
});
|
||||
// 绘制白色背景
|
||||
popupView.drawRect(
|
||||
{
|
||||
color: '#FFFFFF',
|
||||
radius: '8px',
|
||||
},
|
||||
{
|
||||
top: '40px',
|
||||
height: popupViewHeight - 40 + 'px',
|
||||
}
|
||||
);
|
||||
|
||||
popupView.draw(popupViewContentList);
|
||||
popupView.addEventListener('click', function (e) {
|
||||
let maxTop = popupViewHeight - viewContentPadding;
|
||||
let maxLeft = popupViewWidth - viewContentPadding;
|
||||
let buttonWidth = (viewContentWidth - viewContentPadding) / 2;
|
||||
if (e.clientY > maxTop - 30 && e.clientY < maxTop) {
|
||||
if (data.updateType == 'forcibly') {
|
||||
if (e.clientX > viewContentPadding && e.clientX < maxLeft) {
|
||||
// 立即升级
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
callback && callback();
|
||||
}
|
||||
} else {
|
||||
// 暂不升级
|
||||
if (
|
||||
e.clientX > viewContentPadding &&
|
||||
e.clientX < maxLeft - buttonWidth - viewContentPadding
|
||||
) {
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
} else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) {
|
||||
// 立即升级
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
callback && callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (data.updateType == 'solicit') {
|
||||
// 点击遮罩层
|
||||
maskLayer.addEventListener('click', function () {
|
||||
//处理遮罩层点击
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
});
|
||||
}
|
||||
// 显示弹窗
|
||||
maskLayer.show();
|
||||
popupView.show();
|
||||
}
|
||||
// 文件下载的弹窗绘图
|
||||
function downloadPopupDrawing(data) {
|
||||
// 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
|
||||
const screenWidth = plus.screen.resolutionWidth;
|
||||
const screenHeight = plus.screen.resolutionHeight;
|
||||
//弹窗容器宽度
|
||||
const popupViewWidth = screenWidth * 0.7;
|
||||
// 弹窗容器的Padding
|
||||
const viewContentPadding = 20;
|
||||
// 弹窗容器的宽度
|
||||
const viewContentWidth = popupViewWidth - viewContentPadding * 2;
|
||||
// 弹窗容器高度
|
||||
let popupViewHeight = viewContentPadding * 3 + 60;
|
||||
let progressTip = data.progressTip || '准备下载...';
|
||||
let contentText = data.contentText || '正在为您更新,请耐心等待';
|
||||
let elementList = [
|
||||
{
|
||||
tag: 'rect', //背景色
|
||||
color: '#FFFFFF',
|
||||
rectStyles: {
|
||||
radius: '8px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'title',
|
||||
text: '升级APP',
|
||||
textStyles: {
|
||||
size: '16px',
|
||||
color: '#333',
|
||||
weight: 'bold',
|
||||
verticalAlign: 'middle',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
top: viewContentPadding + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'content',
|
||||
text: contentText,
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#333',
|
||||
verticalAlign: 'middle',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
top: viewContentPadding * 2 + 30 + 'px',
|
||||
height: '20px',
|
||||
},
|
||||
},
|
||||
];
|
||||
// 是否有进度条
|
||||
if (data.progress) {
|
||||
popupViewHeight += viewContentPadding + 40;
|
||||
elementList = elementList.concat([
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'progressValue',
|
||||
text: progressTip,
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: $mainColor,
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
top: viewContentPadding * 4 + 20 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'rect', //绘制进度条背景
|
||||
id: 'progressBg',
|
||||
rectStyles: {
|
||||
radius: '4px',
|
||||
borderColor: '#f1f1f1',
|
||||
borderWidth: '1px',
|
||||
},
|
||||
position: {
|
||||
top: viewContentPadding * 4 + 60 + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: '8px',
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (data.buttonNum == 2) {
|
||||
popupViewHeight += viewContentPadding + 30;
|
||||
elementList = elementList.concat([
|
||||
{
|
||||
tag: 'rect', //绘制底边按钮
|
||||
rectStyles: {
|
||||
radius: '3px',
|
||||
borderColor: '#f1f1f1',
|
||||
borderWidth: '1px',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'rect', //绘制底边按钮
|
||||
rectStyles: {
|
||||
radius: '3px',
|
||||
color: $mainColor,
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left:
|
||||
(viewContentWidth - viewContentPadding) / 2 +
|
||||
viewContentPadding * 2 +
|
||||
'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'cancelText',
|
||||
text: '取消下载',
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#666',
|
||||
lineSpacing: '0%',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'confirmText',
|
||||
text: '后台下载',
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#FFF',
|
||||
lineSpacing: '0%',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left:
|
||||
(viewContentWidth - viewContentPadding) / 2 +
|
||||
viewContentPadding * 2 +
|
||||
'px',
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (data.buttonNum == 1) {
|
||||
popupViewHeight += viewContentPadding + 40;
|
||||
elementList = elementList.concat([
|
||||
{
|
||||
tag: 'rect', //绘制底边按钮
|
||||
rectStyles: {
|
||||
radius: '6px',
|
||||
color: $mainColor,
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: '40px',
|
||||
},
|
||||
},
|
||||
{
|
||||
tag: 'font',
|
||||
id: 'confirmText',
|
||||
text: '关闭',
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: '#FFF',
|
||||
lineSpacing: '0%',
|
||||
},
|
||||
position: {
|
||||
bottom: viewContentPadding + 'px',
|
||||
left: viewContentPadding + 'px',
|
||||
width: viewContentWidth + 'px',
|
||||
height: '40px',
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
return {
|
||||
popupViewHeight: popupViewHeight,
|
||||
popupViewWidth: popupViewWidth,
|
||||
screenHeight: screenHeight,
|
||||
viewContentWidth: viewContentWidth,
|
||||
viewContentPadding: viewContentPadding,
|
||||
elementList: elementList,
|
||||
};
|
||||
}
|
||||
// 文件下载的弹窗
|
||||
function downloadPopup(data) {
|
||||
// 弹窗遮罩层
|
||||
let maskLayer = new plus.nativeObj.View('maskLayer', {
|
||||
//先创建遮罩层
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
backgroundColor: 'rgba(0,0,0,0.5)',
|
||||
});
|
||||
let popupViewData = downloadPopupDrawing(data);
|
||||
// 弹窗内容
|
||||
let popupView = new plus.nativeObj.View('popupView', {
|
||||
//创建底部图标菜单
|
||||
tag: 'rect',
|
||||
top:
|
||||
(popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + 'px',
|
||||
left: '15%',
|
||||
height: popupViewData.popupViewHeight + 'px',
|
||||
width: '70%',
|
||||
});
|
||||
let progressValue = 0;
|
||||
let progressTip = 0;
|
||||
let contentText = 0;
|
||||
let buttonNum = 2;
|
||||
if (data.buttonNum >= 0) {
|
||||
buttonNum = data.buttonNum;
|
||||
}
|
||||
popupView.draw(popupViewData.elementList);
|
||||
let callbackData = {
|
||||
change: function (res) {
|
||||
let progressElement = [];
|
||||
if (res.progressValue) {
|
||||
progressValue = res.progressValue;
|
||||
// 绘制进度条
|
||||
progressElement.push({
|
||||
tag: 'rect', //绘制进度条背景
|
||||
id: 'progressValueBg',
|
||||
rectStyles: {
|
||||
radius: '4px',
|
||||
color: $mainColor,
|
||||
},
|
||||
position: {
|
||||
top: popupViewData.viewContentPadding * 4 + 60 + 'px',
|
||||
left: popupViewData.viewContentPadding + 'px',
|
||||
width:
|
||||
popupViewData.viewContentWidth * (res.progressValue / 100) + 'px',
|
||||
height: '8px',
|
||||
},
|
||||
});
|
||||
}
|
||||
if (res.progressTip) {
|
||||
progressTip = res.progressTip;
|
||||
progressElement.push({
|
||||
tag: 'font',
|
||||
id: 'progressValue',
|
||||
text: res.progressTip,
|
||||
textStyles: {
|
||||
size: '14px',
|
||||
color: $mainColor,
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
top: popupViewData.viewContentPadding * 4 + 20 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
}
|
||||
if (res.contentText) {
|
||||
contentText = res.contentText;
|
||||
progressElement.push({
|
||||
tag: 'font',
|
||||
id: 'content',
|
||||
text: res.contentText,
|
||||
textStyles: {
|
||||
size: '16px',
|
||||
color: '#333',
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
position: {
|
||||
top: popupViewData.viewContentPadding * 2 + 30 + 'px',
|
||||
height: '30px',
|
||||
},
|
||||
});
|
||||
}
|
||||
if (res.buttonNum >= 0 && buttonNum != res.buttonNum) {
|
||||
buttonNum = res.buttonNum;
|
||||
popupView.reset();
|
||||
popupViewData = downloadPopupDrawing(
|
||||
Object.assign(
|
||||
{
|
||||
progressValue: progressValue,
|
||||
progressTip: progressTip,
|
||||
contentText: contentText,
|
||||
},
|
||||
res
|
||||
)
|
||||
);
|
||||
let newElement = [];
|
||||
popupViewData.elementList.map((item, index) => {
|
||||
let have = false;
|
||||
progressElement.forEach((childItem, childIndex) => {
|
||||
if (item.id == childItem.id) {
|
||||
have = true;
|
||||
}
|
||||
});
|
||||
if (!have) {
|
||||
newElement.push(item);
|
||||
}
|
||||
});
|
||||
progressElement = newElement.concat(progressElement);
|
||||
popupView.setStyle({
|
||||
tag: 'rect',
|
||||
top:
|
||||
(popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 +
|
||||
'px',
|
||||
left: '15%',
|
||||
height: popupViewData.popupViewHeight + 'px',
|
||||
width: '70%',
|
||||
});
|
||||
popupView.draw(progressElement);
|
||||
} else {
|
||||
popupView.draw(progressElement);
|
||||
}
|
||||
},
|
||||
cancel: function () {
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
},
|
||||
};
|
||||
popupView.addEventListener('click', function (e) {
|
||||
let maxTop =
|
||||
popupViewData.popupViewHeight - popupViewData.viewContentPadding;
|
||||
let maxLeft =
|
||||
popupViewData.popupViewWidth - popupViewData.viewContentPadding;
|
||||
if (e.clientY > maxTop - 40 && e.clientY < maxTop) {
|
||||
if (buttonNum == 1) {
|
||||
// 单按钮
|
||||
if (
|
||||
e.clientX > popupViewData.viewContentPadding &&
|
||||
e.clientX < maxLeft
|
||||
) {
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
callbackData.reboot();
|
||||
}
|
||||
} else if (buttonNum == 2) {
|
||||
// 双按钮
|
||||
let buttonWidth =
|
||||
(popupViewData.viewContentWidth - popupViewData.viewContentPadding) /
|
||||
2;
|
||||
if (
|
||||
e.clientX > popupViewData.viewContentPadding &&
|
||||
e.clientX < maxLeft - buttonWidth - popupViewData.viewContentPadding
|
||||
) {
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
callbackData.cancelDownload();
|
||||
} else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) {
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// 显示弹窗
|
||||
maskLayer.show();
|
||||
popupView.show();
|
||||
// 改变进度条
|
||||
return callbackData;
|
||||
}
|
||||
export default function (isPrompt = false) {
|
||||
getCurrentNo((versionInfo) => {
|
||||
|
||||
componentConfig.getServerNo(versionInfo, isPrompt, (res) => {
|
||||
if (res.updateType == 'forcibly' || res.updateType == 'silent') {
|
||||
if (/\.wgt$/i.test(res.downloadUrl)) {
|
||||
getDownload(res);
|
||||
} else if (/\.html$/i.test(res.downloadUrl)) {
|
||||
plus.runtime.openURL(res.downloadUrl);
|
||||
} else {
|
||||
if (platform == 'android') {
|
||||
getDownload(res);
|
||||
} else {
|
||||
plus.runtime.openURL(res.downloadUrl);
|
||||
}
|
||||
}
|
||||
} else if (res.updateType == 'solicit') {
|
||||
updatePopup(res, function () {
|
||||
if (/\.wgt$/i.test(res.downloadUrl)) {
|
||||
getDownload(res);
|
||||
} else if (/\.html$/i.test(res.downloadUrl)) {
|
||||
plus.runtime.openURL(res.downloadUrl);
|
||||
} else {
|
||||
if (platform == 'android') {
|
||||
getDownload(res);
|
||||
} else {
|
||||
plus.runtime.openURL(res.downloadUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
127
java-mall-app-shop-admin/config/componentConfig.js
Normal file
127
java-mall-app-shop-admin/config/componentConfig.js
Normal file
@ -0,0 +1,127 @@
|
||||
/**** 此文件说明请看注释 *****/
|
||||
// 可以用自己项目的请求方法
|
||||
// 请求配置说明:https://ext.dcloud.net.cn/plugin?id=822
|
||||
import { GetAPPversion } from '../api/checkAPPupdate';
|
||||
/**** 结束 *****/
|
||||
const platform = uni.getSystemInfoSync().platform;
|
||||
const phoneInfo = uni.getSystemInfoSync();
|
||||
export default {
|
||||
// 发起ajax请求获取服务端版本号
|
||||
getServerNo: async (version, isPrompt = false, callback) => {
|
||||
if (platform != 'android') {
|
||||
let appleId = 1549638327; //app的appleId
|
||||
plus.runtime.launchApplication(
|
||||
{
|
||||
action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`,
|
||||
},
|
||||
function (e) {
|
||||
console.log('Open system default browser failed: ' + e.message);
|
||||
}
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// let httpData = {
|
||||
// version: version.versionCode,
|
||||
// // 版本名称
|
||||
// versionName: version.versionName,
|
||||
// // setupPage参数说明(判断用户是不是从设置页面点击的更新,如果是设置页面点击的更新,有不要用静默更新了,不然用户点击没反应很奇怪的)
|
||||
// setupPage: isPrompt,
|
||||
// };
|
||||
// if (platform == 'android') {
|
||||
// httpData.type = 1101;
|
||||
// } else {
|
||||
// httpData.type = 1102;
|
||||
|
||||
/* 接口入参说明
|
||||
* version: 应用当前版本号(已自动获取)
|
||||
* versionName: 应用当前版本名称(已自动获取)
|
||||
* type:平台(1101是安卓,1102是IOS)
|
||||
*/
|
||||
/****************以下是示例*******************/
|
||||
// 可以用自己项目的请求方法(接口自己找后台要,插件不提供)
|
||||
|
||||
let marketId = 100;
|
||||
|
||||
phoneInfo.brand = phoneInfo.brand.toLowerCase();
|
||||
|
||||
switch (phoneInfo.brand) {
|
||||
case 'xiaomi':
|
||||
marketId = 1;
|
||||
break;
|
||||
case 'huawei':
|
||||
marketId = 2;
|
||||
break;
|
||||
case 'tengxun':
|
||||
marketId = 3;
|
||||
break;
|
||||
case 'oppo':
|
||||
marketId = 4;
|
||||
break;
|
||||
case 'vivo':
|
||||
marketId = 5;
|
||||
break;
|
||||
case 'samsung':
|
||||
marketId = 6;
|
||||
break;
|
||||
default:
|
||||
marketId = 100;
|
||||
break;
|
||||
}
|
||||
|
||||
console.log('marketId', marketId);
|
||||
console.log('phoneInfo.brand',phoneInfo.brand)
|
||||
|
||||
let params = {
|
||||
marketId: marketId,
|
||||
packageName: 'com.xiaofa.shopAdmin',
|
||||
currVersionKey: version,
|
||||
};
|
||||
|
||||
let res = await GetAPPversion(params);
|
||||
|
||||
if (res && res.status == 200) {
|
||||
if (res.data) {
|
||||
}
|
||||
}
|
||||
|
||||
// .get('api/common/v1/app_version', httpData, {
|
||||
// isPrompt: isPrompt,
|
||||
// })
|
||||
// .then((res) => {
|
||||
// /* res的数据说明
|
||||
// * | 参数名称 | 一定返回 | 类型 | 描述
|
||||
// * | -------------|--------- | --------- | ------------- |
|
||||
// * | versionCode | y | int | 版本号 |
|
||||
// * | versionName | y | String | 版本名称 |
|
||||
// * | versionInfo | y | String | 版本信息 |
|
||||
// * | updateType | y | String | forcibly = 强制更新, solicit = 弹窗确认更新, silent = 静默更新 |
|
||||
// * | downloadUrl | y | String | 版本下载链接(IOS安装包更新请放跳转store应用商店链接,安卓apk和wgt文件放文件下载链接) |
|
||||
// */
|
||||
// if (res && res.downloadUrl) {
|
||||
// // 兼容之前的版本(updateType是新版才有的参数)
|
||||
// if (res.updateType) {
|
||||
// callback && callback(res);
|
||||
// } else {
|
||||
// if (res.forceUpdate) {
|
||||
// res.updateType = 'forcibly';
|
||||
// } else {
|
||||
// res.updateType = 'solicit';
|
||||
// }
|
||||
// callback && callback(res);
|
||||
// }
|
||||
// } else if (isPrompt) {
|
||||
// uni.showToast({
|
||||
// title: '暂无新版本',
|
||||
// icon: 'none',
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
/****************以上是示例*******************/
|
||||
},
|
||||
// 弹窗主颜色(不填默认粉色)
|
||||
appUpdateColor: 'f00',
|
||||
// 弹窗图标(不填显示默认图标,链接配置示例如: '/static/demo/ic_attention.png')
|
||||
appUpdateIcon: '',
|
||||
};
|
||||
40
java-mall-app-shop-admin/config/config.js
Normal file
40
java-mall-app-shop-admin/config/config.js
Normal file
@ -0,0 +1,40 @@
|
||||
var baseApi = '/mobile'
|
||||
var adminApi = '/api/admin'
|
||||
var apiMobile = '/api/mobile'
|
||||
var imGroupChat = '/account.php'
|
||||
|
||||
|
||||
// const = SOURCE_TYPE_OTHER : 2310, //来源于其它
|
||||
// SOURCE_TYPE_PC : 2311, //来源于pc端
|
||||
// SOURCE_TYPE_H5 : 2312, //来源于H5端
|
||||
// SOURCE_TYPE_APP : 2313, //来源于APP
|
||||
// SOURCE_TYPE_MP : 2314, //来源于小程序
|
||||
|
||||
|
||||
if(process.env.NODE_ENV === 'development'){
|
||||
console.log('开发环境');
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
baseApi = 'https://mall.gpxscs.cn/mobile'
|
||||
adminApi = 'https://mall.gpxscs.cn/api/admin'
|
||||
apiMobile = 'https://mall.gpxscs.cn/api/mobile'
|
||||
imGroupChat = 'https://mall.gpxscs.cn/account.php'
|
||||
// #endif
|
||||
|
||||
}
|
||||
if(process.env.NODE_ENV === 'production'){
|
||||
// #ifdef APP-PLUS
|
||||
baseApi = 'https://mall.gpxscs.cn/mobile'
|
||||
adminApi = 'https://mall.gpxscs.cn/api/admin'
|
||||
apiMobile = 'https://mall.gpxscs.cn/api/mobile'
|
||||
imGroupChat = 'https://mall.gpxscs.cn/account.php'
|
||||
|
||||
// #endif
|
||||
}
|
||||
|
||||
export default{
|
||||
baseApi,
|
||||
adminApi,
|
||||
apiMobile,
|
||||
imGroupChat
|
||||
}
|
||||
269
java-mall-app-shop-admin/config/statecode.js
Normal file
269
java-mall-app-shop-admin/config/statecode.js
Normal file
@ -0,0 +1,269 @@
|
||||
export default {
|
||||
|
||||
DELIVERY_TIME_NO_LIMIT : 1, //不限送货时间:周一至周日
|
||||
DELIVERY_TIME_WORKING_DAY : 2, //工作日送货:周一至周五
|
||||
DELIVERY_TIME_WEEKEND : 3, //双休日、假日送货:周六至周日
|
||||
|
||||
|
||||
PRODUCT_STATE_ILLEGAL : 1000, //违规下架禁售
|
||||
PRODUCT_STATE_NORMAL : 1001, //正常
|
||||
PRODUCT_STATE_OFF_THE_SHELF : 1002, //下架
|
||||
|
||||
|
||||
ACTIVITY_TYPE_BARGAIN : 1101, //加价购
|
||||
ACTIVITY_TYPE_GIFT : 1102, //店铺满赠-小礼品
|
||||
ACTIVITY_TYPE_LIMITED_DISCOUNT : 1103, //限时折扣
|
||||
ACTIVITY_TYPE_DISCOUNT_PACKAGE : 1104, //优惠套装
|
||||
ACTIVITY_TYPE_VOUCHER : 1105, //店铺优惠券 coupon 优惠券
|
||||
ACTIVITY_TYPE_DIY_PACKAGE : 1106, //拼团
|
||||
ACTIVITY_TYPE_REDUCTION : 1107, //满减
|
||||
ACTIVITY_TYPE_MANHUI : 1108, //满返
|
||||
ACTIVITY_TYPE_DOUBLE_POINTS : 1136, //多倍积分
|
||||
ACTIVITY_TYPE_REDUCTION_AGAIN : 1140, //折上折
|
||||
|
||||
ACTIVITY_TYPE_MARKETING : 1131,//市场活动
|
||||
ACTIVITY_TYPE_GIFTBAG : 1132,//组合套餐
|
||||
ACTIVITY_TYPE_LOTTERY : 1121,//幸运大抽奖
|
||||
ACTIVITY_TYPE_FLASHSALE : 1122,//秒杀
|
||||
ACTIVITY_TYPE_GROUPBOOKING: 1123,//市场活动
|
||||
ACTIVITY_TYPE_CUTPRICE : 1124,//砍价
|
||||
ACTIVITY_TYPE_YIYUAN : 1125,//一元购
|
||||
ACTIVITY_TYPE_ONE_PIECE_DISCOUNT : 1135, //单件折
|
||||
ACTIVITY_TYPE_MULTIPLE_FOLD : 1133, //多件折
|
||||
|
||||
|
||||
ACTIVITY_GROUPBOOKING_SALE_PRICE : 1, //以固定折扣购买
|
||||
ACTIVITY_GROUPBOOKING_FIXED_AMOUNT : 2, //以固定价格购买
|
||||
ACTIVITY_GROUPBOOKING_FIXED_DISCOUNT : 3, //优惠固定金额
|
||||
|
||||
MARKRTING_ACTIVITY_JOIN : 1,//参加活动
|
||||
MARKRTING_ACTIVITY_JOIN_BY_QRCODE: 2,//通过二维码参加
|
||||
|
||||
SOURCE_TYPE_OTHER : 2310, //来源于其它
|
||||
SOURCE_TYPE_PC : 2311, //来源于pc端
|
||||
SOURCE_TYPE_H5 : 2312, //来源于H5端
|
||||
SOURCE_TYPE_APP : 2313, //来源于APP
|
||||
SOURCE_TYPE_MP : 2314, //来源于小程序
|
||||
|
||||
SOURCE_FROM_OTHER : 2320, //来源于其它
|
||||
SOURCE_FROM_WECHAT : 2321, //来源于微信平台,包含公众号,小程序等等
|
||||
SOURCE_FROM_BAIDU : 2322, //来源于百度
|
||||
SOURCE_FROM_ALIPAY : 2323, //来源于支付宝
|
||||
SOURCE_FROM_TOUTIAO : 2324, //来源于头条
|
||||
|
||||
VOUCHER_STATE_UNUSED : 1501, //未用
|
||||
VOUCHER_STATE_USED : 1502, //已用
|
||||
VOUCHER_STATE_TIMEOUT : 1503, //过期
|
||||
VOUCHER_STATE_DEL : 1504, //收回
|
||||
|
||||
//商品标签
|
||||
PRODUCT_TAG_NEW : 1401, //新品上架
|
||||
PRODUCT_TAG_REC : 1402, //热卖推荐
|
||||
PRODUCT_TAG_BARGAIN : 1403, //清仓优惠
|
||||
PRODUCT_TAG_BARGAIN1 : 1404, //清仓优惠
|
||||
PRODUCT_TAG_BARGAIN2 : 1405, //清仓优惠
|
||||
|
||||
//商品种类
|
||||
PRODUCT_KIND_ENTITY : 1201, //实体商品 实物商品 (物流发货)
|
||||
PRODUCT_KIND_FUWU : 1202, //虚拟商品 虚拟商品 (无需物流)
|
||||
PRODUCT_KIND_CARD : 1203, //电子卡券 电子卡券 (无需物流)
|
||||
|
||||
|
||||
PRODUCT_VERIFY_REFUSED : 3000, //审核未通过
|
||||
PRODUCT_VERIFY_PASSED : 3001, //审核通过
|
||||
PRODUCT_VERIFY_WAITING : 3002, //审核中
|
||||
|
||||
ORDER_STATE_WAIT_PAY : 2010, //待付款 - 虚拟映射
|
||||
ORDER_STATE_WAIT_PAID : 2016, //已经付款 - 虚拟映射
|
||||
ORDER_STATE_WAIT_REVIEW : 2011, //待订单审核
|
||||
ORDER_STATE_WAIT_FINANCE_REVIEW : 2013, //待财务审核
|
||||
ORDER_STATE_PICKING : 2020, //待配货
|
||||
ORDER_STATE_WAIT_SHIPPING : 2030, //待发货
|
||||
ORDER_STATE_SHIPPED : 2040, //已发货
|
||||
ORDER_STATE_RECEIVED : 2050, //已签收
|
||||
ORDER_STATE_FINISH : 2060, //已完成
|
||||
ORDER_STATE_CANCEL : 2070, //已取消
|
||||
ORDER_STATE_SELF_PICKUP : 2080, //自提 交易关闭 交易关闭
|
||||
|
||||
|
||||
ORDER_PAID_STATE_NO : 3010, //未付款
|
||||
ORDER_PAID_STATE_FINANCE_REVIEW : 3011, //待付款审核
|
||||
ORDER_PAID_STATE_PART : 3012, //部分付款
|
||||
ORDER_PAID_STATE_YES : 3013, //已付款
|
||||
|
||||
ORDER_PICKING_STATE_NO : 3020, //未出库
|
||||
ORDER_PICKING_STATE_PART : 3021, //部分出库通过拆单解决这种问题
|
||||
ORDER_PICKING_STATE_YES : 3022, //已出库
|
||||
|
||||
ORDER_SHIPPED_STATE_NO : 3030, //未发货
|
||||
ORDER_SHIPPED_STATE_PART : 3031, //部分发货
|
||||
ORDER_SHIPPED_STATE_YES : 3032, //已发货
|
||||
|
||||
VIRTUAL_ORDER_USED : 2101, //虚拟订单已使用
|
||||
VIRTUAL_ORDER_UNUSE : 2100, //虚拟订单未使用
|
||||
VIRTUAL_ORDER_TIMEOUT : 2103, //虚拟订单过期
|
||||
|
||||
ORDER_CANCEL_BY_BUYER : 2201, //买家取消订单
|
||||
ORDER_CANCEL_BY_SELLER : 2202, //卖家取消订单
|
||||
ORDER_CANCEL_BY_ADMIN : 2203, //平台取消
|
||||
|
||||
|
||||
//订单来源
|
||||
ORDER_FROM_PC : 2301, //来源于pc端
|
||||
ORDER_FROM_WAP : 2302, //来源于WAP手机端
|
||||
ORDER_FROM_WEBPOS : 2303, //来源于WEBPOS线下下单
|
||||
|
||||
//状态
|
||||
SETTLEMENT_STATE_WAIT_OPERATE : 2401, //已出账
|
||||
SETTLEMENT_STATE_SELLER_COMFIRMED : 2402, //商家已确认
|
||||
SETTLEMENT_STATE_PLATFORM_COMFIRMED : 2403, //平台已审核
|
||||
SETTLEMENT_STATE_FINISH : 2404, //结算完成
|
||||
|
||||
ORDER_RETURN_NO : 2500, //无退货
|
||||
ORDER_RETURN_ING : 2501, //退货中
|
||||
ORDER_RETURN_END : 2502, //退货完成
|
||||
|
||||
ORDER_REFUND_STATE_NO : 2600, //无退款
|
||||
ORDER_REFUND_STATE_ING : 2601, //退款中
|
||||
ORDER_REFUND_STATE_END : 2602, //退款完成
|
||||
|
||||
|
||||
ORDER_TYPE_DD : 3061, //订单类型
|
||||
ORDER_TYPE_FX : 3062, //分销订单
|
||||
ORDER_TYPE_TH : 3066, //分销订单
|
||||
|
||||
|
||||
ACTIVITY_STATE_WAITING : 0, //活动状态:0-未开启
|
||||
ACTIVITY_STATE_NORMAL : 1, //活动状态:1-正常
|
||||
ACTIVITY_STATE_FINISHED : 2, //活动状态:2-已结束
|
||||
ACTIVITY_STATE_CLOSED : 3, //活动状态:3-管理员关闭
|
||||
|
||||
GET_VOUCHER_FREE : 1, //活动状态:1-免费参与,
|
||||
GET_VOUCHER_BY_POINT : 2, //活动状态:2-积分参与,
|
||||
GET_VOUCHER_BY_PURCHASE : 3, //活动状态:3-购买参与
|
||||
|
||||
|
||||
CART_GET_TYPE_BUY : 1, //购买
|
||||
CART_GET_TYPE_POINT : 2, //积分兑换
|
||||
CART_GET_TYPE_GIFT : 3, //赠品
|
||||
CART_GET_TYPE_BARGAIN : 4, //活动促销
|
||||
|
||||
/*
|
||||
BILL_TYPE_PO : 4001, //购货单
|
||||
BILL_TYPE_PORO : 4002, //销货退货单
|
||||
BILL_TYPE_OI : 4003, //其他入库单
|
||||
BILL_TYPE_SO : 4031, //销货单
|
||||
BILL_TYPE_SORO : 4032, //购货退货单
|
||||
BILL_TYPE_OO : 4033, //其他出库单
|
||||
*/
|
||||
|
||||
STOCK_IN_PURCHASE : 2701, //采购入库
|
||||
STOCK_IN_RETURN : 2702, //退货入库
|
||||
STOCK_IN_ALLOCATE : 2703, //调库入库
|
||||
STOCK_IN_INVENTORY_P : 2704, //盘盈入库
|
||||
STOCK_IN_INIT : 2705, //期初入库
|
||||
STOCK_IN_OTHER : 2706, //手工入库
|
||||
STOCK_OUT_SALE : 2751, //销售出库
|
||||
STOCK_OUT_DAMAGED : 2752, //损坏出库
|
||||
STOCK_OUT_ALLOCATE : 2753, //调库出库
|
||||
STOCK_OUT_LOSSES : 2754, //盘亏出库
|
||||
STOCK_OUT_OTHER : 2755, //手工出库
|
||||
STOCK_OUT_PO_RETURN : 2756, //损坏出库
|
||||
|
||||
|
||||
STOCK_OUT_ALL : 2700, //出库单
|
||||
STOCK_IN_ALL : 2750, //入库单
|
||||
|
||||
BILL_TYPE_OUT : 2700, //出库单
|
||||
BILL_TYPE_IN : 2750, //入库单
|
||||
|
||||
|
||||
BILL_TYPE_SO : 2800, //销售订单
|
||||
BILL_TYPE_PO : 2850, //采购订单
|
||||
|
||||
|
||||
//修改掉,和订单状态对应。
|
||||
ORDER_PROCESS_SUBMIT : 3070, //【客户】提交订单1OrderOrder
|
||||
|
||||
ORDER_PROCESS_PAY : 2010, //待支付Order
|
||||
ORDER_PROCESS_CHECK : 2011, //订单审核1OrderOrder
|
||||
ORDER_PROCESS_FINANCE_REVIEW : 2013, //财务审核0OrderOrder
|
||||
ORDER_PROCESS_OUT : 2020, //出库审核商品库存在“出库审核”节点完成后扣减,如需进行库存管理或核算销售成本毛利,需开启此节点。0OrderOrder
|
||||
ORDER_PROCESS_SHIPPED : 2030, //发货确认如需跟踪订单物流信息,需开启此节点0OrderOrder
|
||||
ORDER_PROCESS_RECEIVED : 2040, //【客户】收货确认0OrderOrder
|
||||
|
||||
ORDER_PROCESS_FINISH : 3098, //完成1OrderOrder
|
||||
|
||||
RETURN_PROCESS_SUBMIT : 3100, //【客户】提交退单1ReturnReturn
|
||||
RETURN_PROCESS_CHECK : 3105, //退单审核1ReturnReturn
|
||||
RETURN_PROCESS_RECEIVED : 3110, //收货确认0ReturnReturn
|
||||
RETURN_PROCESS_REFUND : 3115, //退款确认0ReturnReturn
|
||||
RETURN_PROCESS_RECEIPT_CONFIRMATION : 3120, //客户】收款确认0ReturnReturn
|
||||
RETURN_PROCESS_FINISH : 3125, //完成1ReturnReturn3130-商家拒绝退货
|
||||
RETURN_PROCESS_REFUSED : 3130, //-商家拒绝退货
|
||||
RETURN_PROCESS_CANCEL : 3135, //-买家取消
|
||||
|
||||
|
||||
PLANTFORM_RETURN_STATE_WAITING : 3180, //申请状态平台(ENUM):3180-处理中,
|
||||
PLANTFORM_RETURN_STATE_AGREE : 3181, //为待管理员处理卖家同意或者收货后,
|
||||
PLANTFORM_RETURN_PROCESS_FINISH : 3182, //-为已完成
|
||||
|
||||
|
||||
STORE_STATE_WAIT_PROFILE : 3210, //待完善资料
|
||||
STORE_STATE_WAIT_VERIFY : 3220, //等待审核
|
||||
STORE_STATE_NO : 3230, //审核资料没有通过
|
||||
STORE_STATE_YES : 3240, //审核资料通过,待付款
|
||||
|
||||
TRADE_TYPE_SHOPPING : 1201,//购物
|
||||
TRADE_TYPE_TRANSFER : 1202,//转账
|
||||
TRADE_TYPE_DEPOSIT : 1203,//充值
|
||||
TRADE_TYPE_WITHDRAW : 1204,//提现
|
||||
TRADE_TYPE_SALES : 1205,//销售
|
||||
TRADE_TYPE_COMMISSION : 1206,//佣金
|
||||
TRADE_TYPE_REFUND_PAY : 1207,//退货付款
|
||||
TRADE_TYPE_REFUND_GATHERING : 1208,//退货收款
|
||||
|
||||
|
||||
PAYMENT_TYPE_DELIVER : 1301,//货到付款
|
||||
PAYMENT_TYPE_ONLINE : 1302,//在线支付
|
||||
//PAYMENT_TYPE_CREDIT : 1303,//白条支付
|
||||
//PAYMENT_TYPE_CASH : 1304,//现金支付
|
||||
PAYMENT_TYPE_OFFLINE : 1305,//线下支付
|
||||
|
||||
ORDER_ITEM_EVALUATION_NO : 0, //未评价
|
||||
ORDER_ITEM_EVALUATION_YES : 1, //已评价
|
||||
ORDER_ITEM_EVALUATION_TIMEOUT : 2, //失效评价
|
||||
|
||||
ORDER_EVALUATION_NO : 0, //未评价
|
||||
ORDER_EVALUATION_YES : 1, //已评价
|
||||
ORDER_EVALUATION_TIMEOUT : 2, //失效评价
|
||||
|
||||
ORDER_NOT_NEED_RETURN_GOODS : 0, //不用退货
|
||||
ORDER_NEED_RETURN_GOODS : 1, //需要退货
|
||||
|
||||
ORDER_REFUND : 1, //1-退款申请, 2-退货申请, 3-虚拟退款
|
||||
ORDER_RETURN : 2, //需要退货
|
||||
ORDER_VIRTUAL_REFUND : 3, //需要退货
|
||||
|
||||
|
||||
|
||||
TASK_STATE_TENDER : 1000, //采购中
|
||||
TASK_STATE_FINISH : 1010, //已完成
|
||||
TASK_STATE_CANCEL : 1020, //已取消
|
||||
TASK_STATE_REJECT : 1030, //被驳回
|
||||
TASK_STATE_EXAMINE : 1040, //审核中
|
||||
|
||||
|
||||
SERVICE_ORDER_STATE_CLOSED : 1100, //关闭
|
||||
SERVICE_ORDER_STATE_PUBLICATION_WAITING : 1000, //待发布
|
||||
SERVICE_ORDER_STATE_PAY_WAITING : 1010, //待支付
|
||||
SERVICE_ORDER_STATE_REVIEW_WAITING : 1020, //待审核
|
||||
SERVICE_ORDER_STATE_REGISTERING : 1030, //报名中
|
||||
SERVICE_ORDER_STATE_WORKING : 1040, //工作中
|
||||
SERVICE_ORDER_STATE_ACCEPTING_WAITING : 1050, //待验收
|
||||
SERVICE_ORDER_STATE_EXPIRED : 1060, //逾期
|
||||
SERVICE_ORDER_STATE_COMPLAINT : 1070, //申诉中
|
||||
SERVICE_ORDER_STATE_EVALUATION_WAITING : 1080, //待评价
|
||||
SERVICE_ORDER_STATE_FINISH : 1090, //已完成
|
||||
SERVICE_ORDER_STATE_DISTRIBUTE : 1110 //派发中
|
||||
}
|
||||
@ -1,20 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>
|
||||
<%= htmlWebpackPlugin.options.title %>
|
||||
</title>
|
||||
<!-- Open Graph data -->
|
||||
<!-- <meta property="og:title" content="Title Here" /> -->
|
||||
<!-- <meta property="og:url" content="http://www.example.com/" /> -->
|
||||
<!-- <meta property="og:image" content="http://example.com/image.jpg" /> -->
|
||||
<!-- <meta property="og:description" content="Description Here" /> -->
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
|
||||
<link rel="icon" href="./static/xiaofa-logo.png">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>Please enable JavaScript to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
@ -3,14 +3,18 @@ import Vue from 'vue'
|
||||
import store from './store'
|
||||
import uView from '@/uni_modules/uview-ui'
|
||||
import './uni.promisify.adaptor'
|
||||
import tui from './utils/httpRequest'
|
||||
import Socket from './utils/socket.js'
|
||||
// import Utils from './utils/http'
|
||||
import "@/static/font/iconfont.css"
|
||||
// import "@/static/font/iconfont.css"
|
||||
|
||||
Vue.use(uView)
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
// Vue.prototype.$utils = Utils
|
||||
Vue.prototype.tui = tui
|
||||
Vue.prototype.$Socket = Socket;
|
||||
|
||||
|
||||
App.mpType = 'app'
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
{
|
||||
"name" : "java-mall-app-shop-admin",
|
||||
"name" : "小发同城商家版",
|
||||
"appid" : "__UNI__95F809F",
|
||||
"package" : "com.xiaofa.shopAdmin",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"versionCode" : 100,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@ -17,7 +18,13 @@
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
"modules" : {
|
||||
"Maps" : {},
|
||||
"Camera" : {},
|
||||
"Record" : {},
|
||||
"VideoPlayer" : {},
|
||||
"UIWebview" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
@ -41,9 +48,54 @@
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
"ios" : {
|
||||
"privacyDescription" : {
|
||||
"NSPhotoLibraryAddUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||
"NSPhotoLibraryUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||
"NSCameraUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||
"NSMicrophoneUsageDescription" : "此APP会在使用声音识别服务中使用您的麦克风权限",
|
||||
"NSLocationWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限",
|
||||
"NSLocationAlwaysUsageDescription" : "此App会在使用导航服务中使用您的定位权限",
|
||||
"NSLocationAlwaysAndWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限"
|
||||
},
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
"sdkConfigs" : {
|
||||
"maps" : {}
|
||||
},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||
},
|
||||
"ios" : {
|
||||
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||
"ipad" : {
|
||||
"app" : "unpackage/res/icons/76x76.png",
|
||||
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||
"notification" : "unpackage/res/icons/20x20.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||
"settings" : "unpackage/res/icons/29x29.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||
},
|
||||
"iphone" : {
|
||||
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
@ -56,6 +108,31 @@
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"h5" : {
|
||||
// "devServer" : {
|
||||
// "https" : true,
|
||||
// "host" : "127.0.0.1",
|
||||
// "port" : 8080,
|
||||
// "disableHostCheck" : true,
|
||||
// "proxy" : {
|
||||
// "/place/v2/suggestion" : {
|
||||
// "target" : "https://api.map.baidu.com",
|
||||
// "changeOrigin" : true,
|
||||
// "secure" : false
|
||||
// },
|
||||
// "/admin/shop/shop-base-product-category/list" : {
|
||||
// "target" : "https://mall.gpxscs.cn",
|
||||
// "changeOrigin" : true
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
"title" : "小发商城商家中心",
|
||||
"template" : "index.html",
|
||||
"router" : {
|
||||
"mode" : "history",
|
||||
"base" : "/mchapp/"
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
@ -70,3 +147,5 @@
|
||||
},
|
||||
"vueVersion" : "2"
|
||||
}
|
||||
/* 5+App特有相关 */
|
||||
|
||||
|
||||
24
java-mall-app-shop-admin/node_modules/.package-lock.json
generated
vendored
24
java-mall-app-shop-admin/node_modules/.package-lock.json
generated
vendored
@ -65,13 +65,20 @@
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.7.7",
|
||||
"resolved": "https://mirrors.tencent.com/npm/axios/-/axios-1.7.7.tgz",
|
||||
"integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
|
||||
"version": "0.27.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
"follow-redirects": "^1.14.9",
|
||||
"form-data": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/axios-adapter-uniapp": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/axios-adapter-uniapp/-/axios-adapter-uniapp-0.1.4.tgz",
|
||||
"integrity": "sha512-4je5JcWGrrTjPEJXVXJZnOkv+BsnYn/fKbQmjxzdCGFyoQw1gq3tfQ4/WhLzy+Gi9cQJl3K8EH26G7U0BK3wcw==",
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2"
|
||||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
@ -277,11 +284,6 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://mirrors.tencent.com/npm/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://mirrors.tencent.com/npm/readdirp/-/readdirp-4.0.2.tgz",
|
||||
|
||||
1910
java-mall-app-shop-admin/node_modules/axios/CHANGELOG.md
generated
vendored
1910
java-mall-app-shop-admin/node_modules/axios/CHANGELOG.md
generated
vendored
File diff suppressed because it is too large
Load Diff
20
java-mall-app-shop-admin/node_modules/axios/LICENSE
generated
vendored
20
java-mall-app-shop-admin/node_modules/axios/LICENSE
generated
vendored
@ -1,7 +1,19 @@
|
||||
# Copyright (c) 2014-present Matt Zabriskie & Collaborators
|
||||
Copyright (c) 2014-present Matt Zabriskie
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
3
java-mall-app-shop-admin/node_modules/axios/MIGRATION_GUIDE.md
generated
vendored
3
java-mall-app-shop-admin/node_modules/axios/MIGRATION_GUIDE.md
generated
vendored
@ -1,3 +0,0 @@
|
||||
# Migration Guide
|
||||
|
||||
## 0.x.x -> 1.1.0
|
||||
912
java-mall-app-shop-admin/node_modules/axios/README.md
generated
vendored
912
java-mall-app-shop-admin/node_modules/axios/README.md
generated
vendored
File diff suppressed because it is too large
Load Diff
7
java-mall-app-shop-admin/node_modules/axios/SECURITY.md
generated
vendored
7
java-mall-app-shop-admin/node_modules/axios/SECURITY.md
generated
vendored
@ -1,6 +1,5 @@
|
||||
# Reporting a Vulnerability
|
||||
# Security Policy
|
||||
|
||||
If you discover a security vulnerability in axios please disclose it via [our huntr page](https://huntr.dev/repos/axios/axios/). Bounty eligibility, CVE assignment, response times and past reports are all there.
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
||||
Thank you for improving the security of axios.
|
||||
Please report security issues to jasonsaayman@gmail.com
|
||||
|
||||
6646
java-mall-app-shop-admin/node_modules/axios/dist/axios.js
generated
vendored
6646
java-mall-app-shop-admin/node_modules/axios/dist/axios.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1
java-mall-app-shop-admin/node_modules/axios/dist/axios.js.map
generated
vendored
1
java-mall-app-shop-admin/node_modules/axios/dist/axios.js.map
generated
vendored
File diff suppressed because one or more lines are too long
5
java-mall-app-shop-admin/node_modules/axios/dist/axios.min.js
generated
vendored
5
java-mall-app-shop-admin/node_modules/axios/dist/axios.min.js
generated
vendored
File diff suppressed because one or more lines are too long
1
java-mall-app-shop-admin/node_modules/axios/dist/axios.min.js.map
generated
vendored
1
java-mall-app-shop-admin/node_modules/axios/dist/axios.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3753
java-mall-app-shop-admin/node_modules/axios/dist/browser/axios.cjs
generated
vendored
3753
java-mall-app-shop-admin/node_modules/axios/dist/browser/axios.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
1
java-mall-app-shop-admin/node_modules/axios/dist/browser/axios.cjs.map
generated
vendored
1
java-mall-app-shop-admin/node_modules/axios/dist/browser/axios.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
3776
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.js
generated
vendored
3776
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.js.map
generated
vendored
1
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.min.js
generated
vendored
2
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.min.js
generated
vendored
File diff suppressed because one or more lines are too long
1
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.min.js.map
generated
vendored
1
java-mall-app-shop-admin/node_modules/axios/dist/esm/axios.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4782
java-mall-app-shop-admin/node_modules/axios/dist/node/axios.cjs
generated
vendored
4782
java-mall-app-shop-admin/node_modules/axios/dist/node/axios.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
1
java-mall-app-shop-admin/node_modules/axios/dist/node/axios.cjs.map
generated
vendored
1
java-mall-app-shop-admin/node_modules/axios/dist/node/axios.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
545
java-mall-app-shop-admin/node_modules/axios/index.d.cts
generated
vendored
545
java-mall-app-shop-admin/node_modules/axios/index.d.cts
generated
vendored
@ -1,545 +0,0 @@
|
||||
interface RawAxiosHeaders {
|
||||
[key: string]: axios.AxiosHeaderValue;
|
||||
}
|
||||
|
||||
type MethodsHeaders = Partial<{
|
||||
[Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
|
||||
} & {common: AxiosHeaders}>;
|
||||
|
||||
type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
|
||||
|
||||
type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;
|
||||
|
||||
type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization';
|
||||
|
||||
type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
|
||||
|
||||
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
||||
|
||||
declare class AxiosHeaders {
|
||||
constructor(
|
||||
headers?: RawAxiosHeaders | AxiosHeaders | string
|
||||
);
|
||||
|
||||
[key: string]: any;
|
||||
|
||||
set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
||||
|
||||
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
||||
get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue;
|
||||
|
||||
has(header: string, matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
clear(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
normalize(format: boolean): AxiosHeaders;
|
||||
|
||||
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
||||
|
||||
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
||||
|
||||
static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
||||
|
||||
static accessor(header: string | string[]): AxiosHeaders;
|
||||
|
||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
||||
|
||||
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentType(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentLength(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||
hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getAccept(parser?: RegExp): RegExpExecArray | null;
|
||||
getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||
hasAccept(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getUserAgent(parser?: RegExp): RegExpExecArray | null;
|
||||
getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||
hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||
hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
||||
getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;
|
||||
hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>;
|
||||
}
|
||||
|
||||
declare class AxiosError<T = unknown, D = any> extends Error {
|
||||
constructor(
|
||||
message?: string,
|
||||
code?: string,
|
||||
config?: axios.InternalAxiosRequestConfig<D>,
|
||||
request?: any,
|
||||
response?: axios.AxiosResponse<T, D>
|
||||
);
|
||||
|
||||
config?: axios.InternalAxiosRequestConfig<D>;
|
||||
code?: string;
|
||||
request?: any;
|
||||
response?: axios.AxiosResponse<T, D>;
|
||||
isAxiosError: boolean;
|
||||
status?: number;
|
||||
toJSON: () => object;
|
||||
cause?: Error;
|
||||
static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
||||
static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
||||
static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
||||
static readonly ERR_NETWORK = "ERR_NETWORK";
|
||||
static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
|
||||
static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
||||
static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
||||
static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
||||
static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
|
||||
static readonly ERR_CANCELED = "ERR_CANCELED";
|
||||
static readonly ECONNABORTED = "ECONNABORTED";
|
||||
static readonly ETIMEDOUT = "ETIMEDOUT";
|
||||
}
|
||||
|
||||
declare class CanceledError<T> extends AxiosError<T> {
|
||||
}
|
||||
|
||||
declare class Axios {
|
||||
constructor(config?: axios.AxiosRequestConfig);
|
||||
defaults: axios.AxiosDefaults;
|
||||
interceptors: {
|
||||
request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;
|
||||
response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
|
||||
};
|
||||
getUri(config?: axios.AxiosRequestConfig): string;
|
||||
request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
|
||||
}
|
||||
|
||||
declare enum HttpStatusCode {
|
||||
Continue = 100,
|
||||
SwitchingProtocols = 101,
|
||||
Processing = 102,
|
||||
EarlyHints = 103,
|
||||
Ok = 200,
|
||||
Created = 201,
|
||||
Accepted = 202,
|
||||
NonAuthoritativeInformation = 203,
|
||||
NoContent = 204,
|
||||
ResetContent = 205,
|
||||
PartialContent = 206,
|
||||
MultiStatus = 207,
|
||||
AlreadyReported = 208,
|
||||
ImUsed = 226,
|
||||
MultipleChoices = 300,
|
||||
MovedPermanently = 301,
|
||||
Found = 302,
|
||||
SeeOther = 303,
|
||||
NotModified = 304,
|
||||
UseProxy = 305,
|
||||
Unused = 306,
|
||||
TemporaryRedirect = 307,
|
||||
PermanentRedirect = 308,
|
||||
BadRequest = 400,
|
||||
Unauthorized = 401,
|
||||
PaymentRequired = 402,
|
||||
Forbidden = 403,
|
||||
NotFound = 404,
|
||||
MethodNotAllowed = 405,
|
||||
NotAcceptable = 406,
|
||||
ProxyAuthenticationRequired = 407,
|
||||
RequestTimeout = 408,
|
||||
Conflict = 409,
|
||||
Gone = 410,
|
||||
LengthRequired = 411,
|
||||
PreconditionFailed = 412,
|
||||
PayloadTooLarge = 413,
|
||||
UriTooLong = 414,
|
||||
UnsupportedMediaType = 415,
|
||||
RangeNotSatisfiable = 416,
|
||||
ExpectationFailed = 417,
|
||||
ImATeapot = 418,
|
||||
MisdirectedRequest = 421,
|
||||
UnprocessableEntity = 422,
|
||||
Locked = 423,
|
||||
FailedDependency = 424,
|
||||
TooEarly = 425,
|
||||
UpgradeRequired = 426,
|
||||
PreconditionRequired = 428,
|
||||
TooManyRequests = 429,
|
||||
RequestHeaderFieldsTooLarge = 431,
|
||||
UnavailableForLegalReasons = 451,
|
||||
InternalServerError = 500,
|
||||
NotImplemented = 501,
|
||||
BadGateway = 502,
|
||||
ServiceUnavailable = 503,
|
||||
GatewayTimeout = 504,
|
||||
HttpVersionNotSupported = 505,
|
||||
VariantAlsoNegotiates = 506,
|
||||
InsufficientStorage = 507,
|
||||
LoopDetected = 508,
|
||||
NotExtended = 510,
|
||||
NetworkAuthenticationRequired = 511,
|
||||
}
|
||||
|
||||
type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
||||
|
||||
declare namespace axios {
|
||||
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
||||
|
||||
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
'Content-Type': ContentType
|
||||
}>;
|
||||
|
||||
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||
|
||||
type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
|
||||
|
||||
type RawCommonResponseHeaders = {
|
||||
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
"set-cookie": string[];
|
||||
};
|
||||
|
||||
type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
|
||||
|
||||
type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
|
||||
|
||||
interface AxiosRequestTransformer {
|
||||
(this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
|
||||
}
|
||||
|
||||
interface AxiosResponseTransformer {
|
||||
(this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
|
||||
}
|
||||
|
||||
interface AxiosAdapter {
|
||||
(config: InternalAxiosRequestConfig): AxiosPromise;
|
||||
}
|
||||
|
||||
interface AxiosBasicCredentials {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface AxiosProxyConfig {
|
||||
host: string;
|
||||
port: number;
|
||||
auth?: AxiosBasicCredentials;
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
type Method =
|
||||
| 'get' | 'GET'
|
||||
| 'delete' | 'DELETE'
|
||||
| 'head' | 'HEAD'
|
||||
| 'options' | 'OPTIONS'
|
||||
| 'post' | 'POST'
|
||||
| 'put' | 'PUT'
|
||||
| 'patch' | 'PATCH'
|
||||
| 'purge' | 'PURGE'
|
||||
| 'link' | 'LINK'
|
||||
| 'unlink' | 'UNLINK';
|
||||
|
||||
type ResponseType =
|
||||
| 'arraybuffer'
|
||||
| 'blob'
|
||||
| 'document'
|
||||
| 'json'
|
||||
| 'text'
|
||||
| 'stream'
|
||||
| 'formdata';
|
||||
|
||||
type responseEncoding =
|
||||
| 'ascii' | 'ASCII'
|
||||
| 'ansi' | 'ANSI'
|
||||
| 'binary' | 'BINARY'
|
||||
| 'base64' | 'BASE64'
|
||||
| 'base64url' | 'BASE64URL'
|
||||
| 'hex' | 'HEX'
|
||||
| 'latin1' | 'LATIN1'
|
||||
| 'ucs-2' | 'UCS-2'
|
||||
| 'ucs2' | 'UCS2'
|
||||
| 'utf-8' | 'UTF-8'
|
||||
| 'utf8' | 'UTF8'
|
||||
| 'utf16le' | 'UTF16LE';
|
||||
|
||||
interface TransitionalOptions {
|
||||
silentJSONParsing?: boolean;
|
||||
forcedJSONParsing?: boolean;
|
||||
clarifyTimeoutError?: boolean;
|
||||
}
|
||||
|
||||
interface GenericAbortSignal {
|
||||
readonly aborted: boolean;
|
||||
onabort?: ((...args: any) => any) | null;
|
||||
addEventListener?: (...args: any) => any;
|
||||
removeEventListener?: (...args: any) => any;
|
||||
}
|
||||
|
||||
interface FormDataVisitorHelpers {
|
||||
defaultVisitor: SerializerVisitor;
|
||||
convertValue: (value: any) => any;
|
||||
isVisitable: (value: any) => boolean;
|
||||
}
|
||||
|
||||
interface SerializerVisitor {
|
||||
(
|
||||
this: GenericFormData,
|
||||
value: any,
|
||||
key: string | number,
|
||||
path: null | Array<string | number>,
|
||||
helpers: FormDataVisitorHelpers
|
||||
): boolean;
|
||||
}
|
||||
|
||||
interface SerializerOptions {
|
||||
visitor?: SerializerVisitor;
|
||||
dots?: boolean;
|
||||
metaTokens?: boolean;
|
||||
indexes?: boolean | null;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line
|
||||
interface FormSerializerOptions extends SerializerOptions {
|
||||
}
|
||||
|
||||
interface ParamEncoder {
|
||||
(value: any, defaultEncoder: (value: any) => any): any;
|
||||
}
|
||||
|
||||
interface CustomParamsSerializer {
|
||||
(params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
||||
}
|
||||
|
||||
interface ParamsSerializerOptions extends SerializerOptions {
|
||||
encode?: ParamEncoder;
|
||||
serialize?: CustomParamsSerializer;
|
||||
}
|
||||
|
||||
type MaxUploadRate = number;
|
||||
|
||||
type MaxDownloadRate = number;
|
||||
|
||||
type BrowserProgressEvent = any;
|
||||
|
||||
interface AxiosProgressEvent {
|
||||
loaded: number;
|
||||
total?: number;
|
||||
progress?: number;
|
||||
bytes: number;
|
||||
rate?: number;
|
||||
estimated?: number;
|
||||
upload?: boolean;
|
||||
download?: boolean;
|
||||
event?: BrowserProgressEvent;
|
||||
lengthComputable: boolean;
|
||||
}
|
||||
|
||||
type Milliseconds = number;
|
||||
|
||||
type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string;
|
||||
|
||||
type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
|
||||
|
||||
type AddressFamily = 4 | 6 | undefined;
|
||||
|
||||
interface LookupAddressEntry {
|
||||
address: string;
|
||||
family?: AddressFamily;
|
||||
}
|
||||
|
||||
type LookupAddress = string | LookupAddressEntry;
|
||||
|
||||
interface AxiosRequestConfig<D = any> {
|
||||
url?: string;
|
||||
method?: Method | string;
|
||||
baseURL?: string;
|
||||
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
||||
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
||||
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
|
||||
params?: any;
|
||||
paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
|
||||
data?: D;
|
||||
timeout?: Milliseconds;
|
||||
timeoutErrorMessage?: string;
|
||||
withCredentials?: boolean;
|
||||
adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
|
||||
auth?: AxiosBasicCredentials;
|
||||
responseType?: ResponseType;
|
||||
responseEncoding?: responseEncoding | string;
|
||||
xsrfCookieName?: string;
|
||||
xsrfHeaderName?: string;
|
||||
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
||||
onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
||||
maxContentLength?: number;
|
||||
validateStatus?: ((status: number) => boolean) | null;
|
||||
maxBodyLength?: number;
|
||||
maxRedirects?: number;
|
||||
maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
||||
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
|
||||
socketPath?: string | null;
|
||||
transport?: any;
|
||||
httpAgent?: any;
|
||||
httpsAgent?: any;
|
||||
proxy?: AxiosProxyConfig | false;
|
||||
cancelToken?: CancelToken;
|
||||
decompress?: boolean;
|
||||
transitional?: TransitionalOptions;
|
||||
signal?: GenericAbortSignal;
|
||||
insecureHTTPParser?: boolean;
|
||||
env?: {
|
||||
FormData?: new (...args: any[]) => object;
|
||||
};
|
||||
formSerializer?: FormSerializerOptions;
|
||||
family?: AddressFamily;
|
||||
lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
|
||||
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
||||
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
||||
fetchOptions?: Record<string, any>;
|
||||
}
|
||||
|
||||
// Alias
|
||||
type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
|
||||
|
||||
interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig {
|
||||
headers: AxiosRequestHeaders;
|
||||
}
|
||||
|
||||
interface HeadersDefaults {
|
||||
common: RawAxiosRequestHeaders;
|
||||
delete: RawAxiosRequestHeaders;
|
||||
get: RawAxiosRequestHeaders;
|
||||
head: RawAxiosRequestHeaders;
|
||||
post: RawAxiosRequestHeaders;
|
||||
put: RawAxiosRequestHeaders;
|
||||
patch: RawAxiosRequestHeaders;
|
||||
options?: RawAxiosRequestHeaders;
|
||||
purge?: RawAxiosRequestHeaders;
|
||||
link?: RawAxiosRequestHeaders;
|
||||
unlink?: RawAxiosRequestHeaders;
|
||||
}
|
||||
|
||||
interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
||||
headers: HeadersDefaults;
|
||||
}
|
||||
|
||||
interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
||||
headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
|
||||
}
|
||||
|
||||
interface AxiosResponse<T = any, D = any> {
|
||||
data: T;
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
|
||||
config: InternalAxiosRequestConfig<D>;
|
||||
request?: any;
|
||||
}
|
||||
|
||||
type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
||||
|
||||
interface CancelStatic {
|
||||
new (message?: string): Cancel;
|
||||
}
|
||||
|
||||
interface Cancel {
|
||||
message: string | undefined;
|
||||
}
|
||||
|
||||
interface Canceler {
|
||||
(message?: string, config?: AxiosRequestConfig, request?: any): void;
|
||||
}
|
||||
|
||||
interface CancelTokenStatic {
|
||||
new (executor: (cancel: Canceler) => void): CancelToken;
|
||||
source(): CancelTokenSource;
|
||||
}
|
||||
|
||||
interface CancelToken {
|
||||
promise: Promise<Cancel>;
|
||||
reason?: Cancel;
|
||||
throwIfRequested(): void;
|
||||
}
|
||||
|
||||
interface CancelTokenSource {
|
||||
token: CancelToken;
|
||||
cancel: Canceler;
|
||||
}
|
||||
|
||||
interface AxiosInterceptorOptions {
|
||||
synchronous?: boolean;
|
||||
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
|
||||
}
|
||||
|
||||
interface AxiosInterceptorManager<V> {
|
||||
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number;
|
||||
eject(id: number): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
interface AxiosInstance extends Axios {
|
||||
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
||||
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||
|
||||
defaults: Omit<AxiosDefaults, 'headers'> & {
|
||||
headers: HeadersDefaults & {
|
||||
[key: string]: AxiosHeaderValue
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
interface GenericFormData {
|
||||
append(name: string, value: any, options?: any): any;
|
||||
}
|
||||
|
||||
interface GenericHTMLFormElement {
|
||||
name: string;
|
||||
method: string;
|
||||
submit(): void;
|
||||
}
|
||||
|
||||
interface AxiosStatic extends AxiosInstance {
|
||||
create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||
Cancel: CancelStatic;
|
||||
CancelToken: CancelTokenStatic;
|
||||
Axios: typeof Axios;
|
||||
AxiosError: typeof AxiosError;
|
||||
CanceledError: typeof CanceledError;
|
||||
HttpStatusCode: typeof HttpStatusCode;
|
||||
readonly VERSION: string;
|
||||
isCancel(value: any): value is Cancel;
|
||||
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
||||
toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
|
||||
formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
|
||||
getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
||||
AxiosHeaders: typeof AxiosHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
declare const axios: axios.AxiosStatic;
|
||||
|
||||
export = axios;
|
||||
472
java-mall-app-shop-admin/node_modules/axios/index.d.ts
generated
vendored
472
java-mall-app-shop-admin/node_modules/axios/index.d.ts
generated
vendored
@ -1,116 +1,20 @@
|
||||
// TypeScript Version: 4.7
|
||||
export type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
|
||||
// TypeScript Version: 3.0
|
||||
export type AxiosRequestHeaders = Record<string, string | number | boolean>;
|
||||
|
||||
interface RawAxiosHeaders {
|
||||
[key: string]: AxiosHeaderValue;
|
||||
}
|
||||
|
||||
type MethodsHeaders = Partial<{
|
||||
[Key in Method as Lowercase<Key>]: AxiosHeaders;
|
||||
} & {common: AxiosHeaders}>;
|
||||
|
||||
type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean);
|
||||
|
||||
type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
|
||||
|
||||
export class AxiosHeaders {
|
||||
constructor(
|
||||
headers?: RawAxiosHeaders | AxiosHeaders | string
|
||||
);
|
||||
|
||||
[key: string]: any;
|
||||
|
||||
set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
||||
|
||||
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
||||
get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
|
||||
|
||||
has(header: string, matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
clear(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
normalize(format: boolean): AxiosHeaders;
|
||||
|
||||
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
||||
|
||||
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
||||
|
||||
static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
||||
|
||||
static accessor(header: string | string[]): AxiosHeaders;
|
||||
|
||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
||||
|
||||
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentType(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentLength(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getAccept(parser?: RegExp): RegExpExecArray | null;
|
||||
getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasAccept(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getUserAgent(parser?: RegExp): RegExpExecArray | null;
|
||||
getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
||||
getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
|
||||
}
|
||||
|
||||
type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization';
|
||||
|
||||
type ContentType = AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
|
||||
|
||||
export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
'Content-Type': ContentType
|
||||
}>;
|
||||
|
||||
export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||
|
||||
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
||||
|
||||
type RawCommonResponseHeaders = {
|
||||
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
"set-cookie": string[];
|
||||
export type AxiosResponseHeaders = Record<string, string> & {
|
||||
"set-cookie"?: string[]
|
||||
};
|
||||
|
||||
export type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
|
||||
|
||||
export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
|
||||
|
||||
export interface AxiosRequestTransformer {
|
||||
(this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
|
||||
(data: any, headers?: AxiosRequestHeaders): any;
|
||||
}
|
||||
|
||||
export interface AxiosResponseTransformer {
|
||||
(this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
|
||||
(data: any, headers?: AxiosResponseHeaders): any;
|
||||
}
|
||||
|
||||
export interface AxiosAdapter {
|
||||
(config: InternalAxiosRequestConfig): AxiosPromise;
|
||||
(config: AxiosRequestConfig): AxiosPromise;
|
||||
}
|
||||
|
||||
export interface AxiosBasicCredentials {
|
||||
@ -121,110 +25,46 @@ export interface AxiosBasicCredentials {
|
||||
export interface AxiosProxyConfig {
|
||||
host: string;
|
||||
port: number;
|
||||
auth?: AxiosBasicCredentials;
|
||||
auth?: {
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
export enum HttpStatusCode {
|
||||
Continue = 100,
|
||||
SwitchingProtocols = 101,
|
||||
Processing = 102,
|
||||
EarlyHints = 103,
|
||||
Ok = 200,
|
||||
Created = 201,
|
||||
Accepted = 202,
|
||||
NonAuthoritativeInformation = 203,
|
||||
NoContent = 204,
|
||||
ResetContent = 205,
|
||||
PartialContent = 206,
|
||||
MultiStatus = 207,
|
||||
AlreadyReported = 208,
|
||||
ImUsed = 226,
|
||||
MultipleChoices = 300,
|
||||
MovedPermanently = 301,
|
||||
Found = 302,
|
||||
SeeOther = 303,
|
||||
NotModified = 304,
|
||||
UseProxy = 305,
|
||||
Unused = 306,
|
||||
TemporaryRedirect = 307,
|
||||
PermanentRedirect = 308,
|
||||
BadRequest = 400,
|
||||
Unauthorized = 401,
|
||||
PaymentRequired = 402,
|
||||
Forbidden = 403,
|
||||
NotFound = 404,
|
||||
MethodNotAllowed = 405,
|
||||
NotAcceptable = 406,
|
||||
ProxyAuthenticationRequired = 407,
|
||||
RequestTimeout = 408,
|
||||
Conflict = 409,
|
||||
Gone = 410,
|
||||
LengthRequired = 411,
|
||||
PreconditionFailed = 412,
|
||||
PayloadTooLarge = 413,
|
||||
UriTooLong = 414,
|
||||
UnsupportedMediaType = 415,
|
||||
RangeNotSatisfiable = 416,
|
||||
ExpectationFailed = 417,
|
||||
ImATeapot = 418,
|
||||
MisdirectedRequest = 421,
|
||||
UnprocessableEntity = 422,
|
||||
Locked = 423,
|
||||
FailedDependency = 424,
|
||||
TooEarly = 425,
|
||||
UpgradeRequired = 426,
|
||||
PreconditionRequired = 428,
|
||||
TooManyRequests = 429,
|
||||
RequestHeaderFieldsTooLarge = 431,
|
||||
UnavailableForLegalReasons = 451,
|
||||
InternalServerError = 500,
|
||||
NotImplemented = 501,
|
||||
BadGateway = 502,
|
||||
ServiceUnavailable = 503,
|
||||
GatewayTimeout = 504,
|
||||
HttpVersionNotSupported = 505,
|
||||
VariantAlsoNegotiates = 506,
|
||||
InsufficientStorage = 507,
|
||||
LoopDetected = 508,
|
||||
NotExtended = 510,
|
||||
NetworkAuthenticationRequired = 511,
|
||||
}
|
||||
|
||||
export type Method =
|
||||
| 'get' | 'GET'
|
||||
| 'delete' | 'DELETE'
|
||||
| 'head' | 'HEAD'
|
||||
| 'options' | 'OPTIONS'
|
||||
| 'post' | 'POST'
|
||||
| 'put' | 'PUT'
|
||||
| 'patch' | 'PATCH'
|
||||
| 'purge' | 'PURGE'
|
||||
| 'link' | 'LINK'
|
||||
| 'unlink' | 'UNLINK';
|
||||
| 'get' | 'GET'
|
||||
| 'delete' | 'DELETE'
|
||||
| 'head' | 'HEAD'
|
||||
| 'options' | 'OPTIONS'
|
||||
| 'post' | 'POST'
|
||||
| 'put' | 'PUT'
|
||||
| 'patch' | 'PATCH'
|
||||
| 'purge' | 'PURGE'
|
||||
| 'link' | 'LINK'
|
||||
| 'unlink' | 'UNLINK';
|
||||
|
||||
export type ResponseType =
|
||||
| 'arraybuffer'
|
||||
| 'blob'
|
||||
| 'document'
|
||||
| 'json'
|
||||
| 'text'
|
||||
| 'stream'
|
||||
| 'formdata';
|
||||
| 'arraybuffer'
|
||||
| 'blob'
|
||||
| 'document'
|
||||
| 'json'
|
||||
| 'text'
|
||||
| 'stream';
|
||||
|
||||
export type responseEncoding =
|
||||
| 'ascii' | 'ASCII'
|
||||
| 'ansi' | 'ANSI'
|
||||
| 'binary' | 'BINARY'
|
||||
| 'base64' | 'BASE64'
|
||||
| 'base64url' | 'BASE64URL'
|
||||
| 'hex' | 'HEX'
|
||||
| 'latin1' | 'LATIN1'
|
||||
| 'ucs-2' | 'UCS-2'
|
||||
| 'ucs2' | 'UCS2'
|
||||
| 'utf-8' | 'UTF-8'
|
||||
| 'utf8' | 'UTF8'
|
||||
| 'utf16le' | 'UTF16LE';
|
||||
export type responseEncoding =
|
||||
| 'ascii' | 'ASCII'
|
||||
| 'ansi' | 'ANSI'
|
||||
| 'binary' | 'BINARY'
|
||||
| 'base64' | 'BASE64'
|
||||
| 'base64url' | 'BASE64URL'
|
||||
| 'hex' | 'HEX'
|
||||
| 'latin1' | 'LATIN1'
|
||||
| 'ucs-2' | 'UCS-2'
|
||||
| 'ucs2' | 'UCS2'
|
||||
| 'utf-8' | 'UTF-8'
|
||||
| 'utf8' | 'UTF8'
|
||||
| 'utf16le' | 'UTF16LE';
|
||||
|
||||
export interface TransitionalOptions {
|
||||
silentJSONParsing?: boolean;
|
||||
@ -232,198 +72,89 @@ export interface TransitionalOptions {
|
||||
clarifyTimeoutError?: boolean;
|
||||
}
|
||||
|
||||
export interface GenericAbortSignal {
|
||||
readonly aborted: boolean;
|
||||
onabort?: ((...args: any) => any) | null;
|
||||
addEventListener?: (...args: any) => any;
|
||||
removeEventListener?: (...args: any) => any;
|
||||
}
|
||||
|
||||
export interface FormDataVisitorHelpers {
|
||||
defaultVisitor: SerializerVisitor;
|
||||
convertValue: (value: any) => any;
|
||||
isVisitable: (value: any) => boolean;
|
||||
}
|
||||
|
||||
export interface SerializerVisitor {
|
||||
(
|
||||
this: GenericFormData,
|
||||
value: any,
|
||||
key: string | number,
|
||||
path: null | Array<string | number>,
|
||||
helpers: FormDataVisitorHelpers
|
||||
): boolean;
|
||||
}
|
||||
|
||||
export interface SerializerOptions {
|
||||
visitor?: SerializerVisitor;
|
||||
dots?: boolean;
|
||||
metaTokens?: boolean;
|
||||
indexes?: boolean | null;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line
|
||||
export interface FormSerializerOptions extends SerializerOptions {
|
||||
}
|
||||
|
||||
export interface ParamEncoder {
|
||||
(value: any, defaultEncoder: (value: any) => any): any;
|
||||
}
|
||||
|
||||
export interface CustomParamsSerializer {
|
||||
(params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
||||
}
|
||||
|
||||
export interface ParamsSerializerOptions extends SerializerOptions {
|
||||
encode?: ParamEncoder;
|
||||
serialize?: CustomParamsSerializer;
|
||||
}
|
||||
|
||||
type MaxUploadRate = number;
|
||||
|
||||
type MaxDownloadRate = number;
|
||||
|
||||
type BrowserProgressEvent = any;
|
||||
|
||||
export interface AxiosProgressEvent {
|
||||
loaded: number;
|
||||
total?: number;
|
||||
progress?: number;
|
||||
bytes: number;
|
||||
rate?: number;
|
||||
estimated?: number;
|
||||
upload?: boolean;
|
||||
download?: boolean;
|
||||
event?: BrowserProgressEvent;
|
||||
lengthComputable: boolean;
|
||||
}
|
||||
|
||||
type Milliseconds = number;
|
||||
|
||||
type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string;
|
||||
|
||||
type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
|
||||
|
||||
export type AddressFamily = 4 | 6 | undefined;
|
||||
|
||||
export interface LookupAddressEntry {
|
||||
address: string;
|
||||
family?: AddressFamily;
|
||||
}
|
||||
|
||||
export type LookupAddress = string | LookupAddressEntry;
|
||||
|
||||
export interface AxiosRequestConfig<D = any> {
|
||||
url?: string;
|
||||
method?: Method | string;
|
||||
baseURL?: string;
|
||||
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
||||
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
||||
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
|
||||
headers?: AxiosRequestHeaders;
|
||||
params?: any;
|
||||
paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
|
||||
paramsSerializer?: (params: any) => string;
|
||||
data?: D;
|
||||
timeout?: Milliseconds;
|
||||
timeout?: number;
|
||||
timeoutErrorMessage?: string;
|
||||
withCredentials?: boolean;
|
||||
adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
|
||||
adapter?: AxiosAdapter;
|
||||
auth?: AxiosBasicCredentials;
|
||||
responseType?: ResponseType;
|
||||
responseEncoding?: responseEncoding | string;
|
||||
xsrfCookieName?: string;
|
||||
xsrfHeaderName?: string;
|
||||
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
||||
onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
||||
onUploadProgress?: (progressEvent: any) => void;
|
||||
onDownloadProgress?: (progressEvent: any) => void;
|
||||
maxContentLength?: number;
|
||||
validateStatus?: ((status: number) => boolean) | null;
|
||||
maxBodyLength?: number;
|
||||
maxRedirects?: number;
|
||||
maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
||||
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
|
||||
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void;
|
||||
socketPath?: string | null;
|
||||
transport?: any;
|
||||
httpAgent?: any;
|
||||
httpsAgent?: any;
|
||||
proxy?: AxiosProxyConfig | false;
|
||||
cancelToken?: CancelToken;
|
||||
decompress?: boolean;
|
||||
transitional?: TransitionalOptions;
|
||||
signal?: GenericAbortSignal;
|
||||
signal?: AbortSignal;
|
||||
insecureHTTPParser?: boolean;
|
||||
env?: {
|
||||
FormData?: new (...args: any[]) => object;
|
||||
};
|
||||
formSerializer?: FormSerializerOptions;
|
||||
family?: AddressFamily;
|
||||
lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
|
||||
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
||||
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
||||
fetchOptions?: Record<string, any>;
|
||||
}
|
||||
|
||||
// Alias
|
||||
export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
|
||||
|
||||
export interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
|
||||
headers: AxiosRequestHeaders;
|
||||
}
|
||||
|
||||
export interface HeadersDefaults {
|
||||
common: RawAxiosRequestHeaders;
|
||||
delete: RawAxiosRequestHeaders;
|
||||
get: RawAxiosRequestHeaders;
|
||||
head: RawAxiosRequestHeaders;
|
||||
post: RawAxiosRequestHeaders;
|
||||
put: RawAxiosRequestHeaders;
|
||||
patch: RawAxiosRequestHeaders;
|
||||
options?: RawAxiosRequestHeaders;
|
||||
purge?: RawAxiosRequestHeaders;
|
||||
link?: RawAxiosRequestHeaders;
|
||||
unlink?: RawAxiosRequestHeaders;
|
||||
common: AxiosRequestHeaders;
|
||||
delete: AxiosRequestHeaders;
|
||||
get: AxiosRequestHeaders;
|
||||
head: AxiosRequestHeaders;
|
||||
post: AxiosRequestHeaders;
|
||||
put: AxiosRequestHeaders;
|
||||
patch: AxiosRequestHeaders;
|
||||
options?: AxiosRequestHeaders;
|
||||
purge?: AxiosRequestHeaders;
|
||||
link?: AxiosRequestHeaders;
|
||||
unlink?: AxiosRequestHeaders;
|
||||
}
|
||||
|
||||
export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
||||
headers: HeadersDefaults;
|
||||
}
|
||||
|
||||
export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
||||
headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
|
||||
}
|
||||
|
||||
export interface AxiosResponse<T = any, D = any> {
|
||||
export interface AxiosResponse<T = any, D = any> {
|
||||
data: T;
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
|
||||
config: InternalAxiosRequestConfig<D>;
|
||||
headers: AxiosResponseHeaders;
|
||||
config: AxiosRequestConfig<D>;
|
||||
request?: any;
|
||||
}
|
||||
|
||||
export class AxiosError<T = unknown, D = any> extends Error {
|
||||
constructor(
|
||||
message?: string,
|
||||
code?: string,
|
||||
config?: InternalAxiosRequestConfig<D>,
|
||||
request?: any,
|
||||
response?: AxiosResponse<T, D>
|
||||
message?: string,
|
||||
code?: string,
|
||||
config?: AxiosRequestConfig<D>,
|
||||
request?: any,
|
||||
response?: AxiosResponse<T, D>
|
||||
);
|
||||
|
||||
config?: InternalAxiosRequestConfig<D>;
|
||||
config: AxiosRequestConfig<D>;
|
||||
code?: string;
|
||||
request?: any;
|
||||
response?: AxiosResponse<T, D>;
|
||||
isAxiosError: boolean;
|
||||
status?: number;
|
||||
status?: string;
|
||||
toJSON: () => object;
|
||||
cause?: Error;
|
||||
static from<T = unknown, D = any>(
|
||||
error: Error | unknown,
|
||||
code?: string,
|
||||
config?: InternalAxiosRequestConfig<D>,
|
||||
request?: any,
|
||||
response?: AxiosResponse<T, D>,
|
||||
customProps?: object,
|
||||
): AxiosError<T, D>;
|
||||
static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
||||
static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
||||
static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
||||
@ -431,8 +162,6 @@ export class AxiosError<T = unknown, D = any> extends Error {
|
||||
static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
|
||||
static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
||||
static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
||||
static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
||||
static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
|
||||
static readonly ERR_CANCELED = "ERR_CANCELED";
|
||||
static readonly ECONNABORTED = "ECONNABORTED";
|
||||
static readonly ETIMEDOUT = "ETIMEDOUT";
|
||||
@ -441,7 +170,8 @@ export class AxiosError<T = unknown, D = any> extends Error {
|
||||
export class CanceledError<T> extends AxiosError<T> {
|
||||
}
|
||||
|
||||
export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
||||
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
|
||||
}
|
||||
|
||||
export interface CancelStatic {
|
||||
new (message?: string): Cancel;
|
||||
@ -452,7 +182,7 @@ export interface Cancel {
|
||||
}
|
||||
|
||||
export interface Canceler {
|
||||
(message?: string, config?: AxiosRequestConfig, request?: any): void;
|
||||
(message?: string): void;
|
||||
}
|
||||
|
||||
export interface CancelTokenStatic {
|
||||
@ -473,20 +203,19 @@ export interface CancelTokenSource {
|
||||
|
||||
export interface AxiosInterceptorOptions {
|
||||
synchronous?: boolean;
|
||||
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
|
||||
runWhen?: (config: AxiosRequestConfig) => boolean;
|
||||
}
|
||||
|
||||
export interface AxiosInterceptorManager<V> {
|
||||
use(onFulfilled?: ((value: V) => V | Promise<V>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): number;
|
||||
use<T = V>(onFulfilled?: (value: V) => T | Promise<T>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number;
|
||||
eject(id: number): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export class Axios {
|
||||
constructor(config?: AxiosRequestConfig);
|
||||
defaults: AxiosDefaults;
|
||||
interceptors: {
|
||||
request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
|
||||
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
||||
response: AxiosInterceptorManager<AxiosResponse>;
|
||||
};
|
||||
getUri(config?: AxiosRequestConfig): string;
|
||||
@ -504,57 +233,20 @@ export class Axios {
|
||||
}
|
||||
|
||||
export interface AxiosInstance extends Axios {
|
||||
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
||||
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
||||
|
||||
defaults: Omit<AxiosDefaults, 'headers'> & {
|
||||
headers: HeadersDefaults & {
|
||||
[key: string]: AxiosHeaderValue
|
||||
}
|
||||
};
|
||||
(config: AxiosRequestConfig): AxiosPromise;
|
||||
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||
}
|
||||
|
||||
export interface GenericFormData {
|
||||
append(name: string, value: any, options?: any): any;
|
||||
}
|
||||
|
||||
export interface GenericHTMLFormElement {
|
||||
name: string;
|
||||
method: string;
|
||||
submit(): void;
|
||||
}
|
||||
|
||||
export function getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
||||
|
||||
export function toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
|
||||
|
||||
export function formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
|
||||
|
||||
export function isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
||||
|
||||
export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||
|
||||
export function isCancel(value: any): value is Cancel;
|
||||
|
||||
export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||
|
||||
export interface AxiosStatic extends AxiosInstance {
|
||||
create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||
create(config?: AxiosRequestConfig): AxiosInstance;
|
||||
Cancel: CancelStatic;
|
||||
CancelToken: CancelTokenStatic;
|
||||
Axios: typeof Axios;
|
||||
AxiosError: typeof AxiosError;
|
||||
HttpStatusCode: typeof HttpStatusCode;
|
||||
readonly VERSION: string;
|
||||
isCancel: typeof isCancel;
|
||||
all: typeof all;
|
||||
spread: typeof spread;
|
||||
isAxiosError: typeof isAxiosError;
|
||||
toFormData: typeof toFormData;
|
||||
formToJSON: typeof formToJSON;
|
||||
getAdapter: typeof getAdapter;
|
||||
CanceledError: typeof CanceledError;
|
||||
AxiosHeaders: typeof AxiosHeaders;
|
||||
isCancel(value: any): boolean;
|
||||
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||
isAxiosError(payload: any): payload is AxiosError;
|
||||
}
|
||||
|
||||
declare const axios: AxiosStatic;
|
||||
|
||||
44
java-mall-app-shop-admin/node_modules/axios/index.js
generated
vendored
44
java-mall-app-shop-admin/node_modules/axios/index.js
generated
vendored
@ -1,43 +1 @@
|
||||
import axios from './lib/axios.js';
|
||||
|
||||
// This module is intended to unwrap Axios default export as named.
|
||||
// Keep top-level export same with static properties
|
||||
// so that it can keep same with es module or cjs
|
||||
const {
|
||||
Axios,
|
||||
AxiosError,
|
||||
CanceledError,
|
||||
isCancel,
|
||||
CancelToken,
|
||||
VERSION,
|
||||
all,
|
||||
Cancel,
|
||||
isAxiosError,
|
||||
spread,
|
||||
toFormData,
|
||||
AxiosHeaders,
|
||||
HttpStatusCode,
|
||||
formToJSON,
|
||||
getAdapter,
|
||||
mergeConfig
|
||||
} = axios;
|
||||
|
||||
export {
|
||||
axios as default,
|
||||
Axios,
|
||||
AxiosError,
|
||||
CanceledError,
|
||||
isCancel,
|
||||
CancelToken,
|
||||
VERSION,
|
||||
all,
|
||||
Cancel,
|
||||
isAxiosError,
|
||||
spread,
|
||||
toFormData,
|
||||
AxiosHeaders,
|
||||
HttpStatusCode,
|
||||
formToJSON,
|
||||
getAdapter,
|
||||
mergeConfig
|
||||
}
|
||||
module.exports = require('./lib/axios');
|
||||
79
java-mall-app-shop-admin/node_modules/axios/lib/adapters/adapters.js
generated
vendored
79
java-mall-app-shop-admin/node_modules/axios/lib/adapters/adapters.js
generated
vendored
@ -1,79 +0,0 @@
|
||||
import utils from '../utils.js';
|
||||
import httpAdapter from './http.js';
|
||||
import xhrAdapter from './xhr.js';
|
||||
import fetchAdapter from './fetch.js';
|
||||
import AxiosError from "../core/AxiosError.js";
|
||||
|
||||
const knownAdapters = {
|
||||
http: httpAdapter,
|
||||
xhr: xhrAdapter,
|
||||
fetch: fetchAdapter
|
||||
}
|
||||
|
||||
utils.forEach(knownAdapters, (fn, value) => {
|
||||
if (fn) {
|
||||
try {
|
||||
Object.defineProperty(fn, 'name', {value});
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-empty
|
||||
}
|
||||
Object.defineProperty(fn, 'adapterName', {value});
|
||||
}
|
||||
});
|
||||
|
||||
const renderReason = (reason) => `- ${reason}`;
|
||||
|
||||
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||
|
||||
export default {
|
||||
getAdapter: (adapters) => {
|
||||
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
||||
|
||||
const {length} = adapters;
|
||||
let nameOrAdapter;
|
||||
let adapter;
|
||||
|
||||
const rejectedReasons = {};
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
nameOrAdapter = adapters[i];
|
||||
let id;
|
||||
|
||||
adapter = nameOrAdapter;
|
||||
|
||||
if (!isResolvedHandle(nameOrAdapter)) {
|
||||
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||
|
||||
if (adapter === undefined) {
|
||||
throw new AxiosError(`Unknown adapter '${id}'`);
|
||||
}
|
||||
}
|
||||
|
||||
if (adapter) {
|
||||
break;
|
||||
}
|
||||
|
||||
rejectedReasons[id || '#' + i] = adapter;
|
||||
}
|
||||
|
||||
if (!adapter) {
|
||||
|
||||
const reasons = Object.entries(rejectedReasons)
|
||||
.map(([id, state]) => `adapter ${id} ` +
|
||||
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
||||
);
|
||||
|
||||
let s = length ?
|
||||
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
||||
'as no adapter specified';
|
||||
|
||||
throw new AxiosError(
|
||||
`There is no suitable adapter to dispatch the request ` + s,
|
||||
'ERR_NOT_SUPPORT'
|
||||
);
|
||||
}
|
||||
|
||||
return adapter;
|
||||
},
|
||||
adapters: knownAdapters
|
||||
}
|
||||
229
java-mall-app-shop-admin/node_modules/axios/lib/adapters/fetch.js
generated
vendored
229
java-mall-app-shop-admin/node_modules/axios/lib/adapters/fetch.js
generated
vendored
@ -1,229 +0,0 @@
|
||||
import platform from "../platform/index.js";
|
||||
import utils from "../utils.js";
|
||||
import AxiosError from "../core/AxiosError.js";
|
||||
import composeSignals from "../helpers/composeSignals.js";
|
||||
import {trackStream} from "../helpers/trackStream.js";
|
||||
import AxiosHeaders from "../core/AxiosHeaders.js";
|
||||
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
|
||||
import resolveConfig from "../helpers/resolveConfig.js";
|
||||
import settle from "../core/settle.js";
|
||||
|
||||
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
||||
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
||||
|
||||
// used only inside the fetch adapter
|
||||
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
||||
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
||||
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
||||
);
|
||||
|
||||
const test = (fn, ...args) => {
|
||||
try {
|
||||
return !!fn(...args);
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
||||
let duplexAccessed = false;
|
||||
|
||||
const hasContentType = new Request(platform.origin, {
|
||||
body: new ReadableStream(),
|
||||
method: 'POST',
|
||||
get duplex() {
|
||||
duplexAccessed = true;
|
||||
return 'half';
|
||||
},
|
||||
}).headers.has('Content-Type');
|
||||
|
||||
return duplexAccessed && !hasContentType;
|
||||
});
|
||||
|
||||
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||
|
||||
const supportsResponseStream = isReadableStreamSupported &&
|
||||
test(() => utils.isReadableStream(new Response('').body));
|
||||
|
||||
|
||||
const resolvers = {
|
||||
stream: supportsResponseStream && ((res) => res.body)
|
||||
};
|
||||
|
||||
isFetchSupported && (((res) => {
|
||||
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
||||
!resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :
|
||||
(_, config) => {
|
||||
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
||||
})
|
||||
});
|
||||
})(new Response));
|
||||
|
||||
const getBodyLength = async (body) => {
|
||||
if (body == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(utils.isBlob(body)) {
|
||||
return body.size;
|
||||
}
|
||||
|
||||
if(utils.isSpecCompliantForm(body)) {
|
||||
const _request = new Request(platform.origin, {
|
||||
method: 'POST',
|
||||
body,
|
||||
});
|
||||
return (await _request.arrayBuffer()).byteLength;
|
||||
}
|
||||
|
||||
if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
|
||||
return body.byteLength;
|
||||
}
|
||||
|
||||
if(utils.isURLSearchParams(body)) {
|
||||
body = body + '';
|
||||
}
|
||||
|
||||
if(utils.isString(body)) {
|
||||
return (await encodeText(body)).byteLength;
|
||||
}
|
||||
}
|
||||
|
||||
const resolveBodyLength = async (headers, body) => {
|
||||
const length = utils.toFiniteNumber(headers.getContentLength());
|
||||
|
||||
return length == null ? getBodyLength(body) : length;
|
||||
}
|
||||
|
||||
export default isFetchSupported && (async (config) => {
|
||||
let {
|
||||
url,
|
||||
method,
|
||||
data,
|
||||
signal,
|
||||
cancelToken,
|
||||
timeout,
|
||||
onDownloadProgress,
|
||||
onUploadProgress,
|
||||
responseType,
|
||||
headers,
|
||||
withCredentials = 'same-origin',
|
||||
fetchOptions
|
||||
} = resolveConfig(config);
|
||||
|
||||
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
||||
|
||||
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
||||
|
||||
let request;
|
||||
|
||||
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
||||
composedSignal.unsubscribe();
|
||||
});
|
||||
|
||||
let requestContentLength;
|
||||
|
||||
try {
|
||||
if (
|
||||
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
||||
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
||||
) {
|
||||
let _request = new Request(url, {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
duplex: "half"
|
||||
});
|
||||
|
||||
let contentTypeHeader;
|
||||
|
||||
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
||||
headers.setContentType(contentTypeHeader)
|
||||
}
|
||||
|
||||
if (_request.body) {
|
||||
const [onProgress, flush] = progressEventDecorator(
|
||||
requestContentLength,
|
||||
progressEventReducer(asyncDecorator(onUploadProgress))
|
||||
);
|
||||
|
||||
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
||||
}
|
||||
}
|
||||
|
||||
if (!utils.isString(withCredentials)) {
|
||||
withCredentials = withCredentials ? 'include' : 'omit';
|
||||
}
|
||||
|
||||
// Cloudflare Workers throws when credentials are defined
|
||||
// see https://github.com/cloudflare/workerd/issues/902
|
||||
const isCredentialsSupported = "credentials" in Request.prototype;
|
||||
request = new Request(url, {
|
||||
...fetchOptions,
|
||||
signal: composedSignal,
|
||||
method: method.toUpperCase(),
|
||||
headers: headers.normalize().toJSON(),
|
||||
body: data,
|
||||
duplex: "half",
|
||||
credentials: isCredentialsSupported ? withCredentials : undefined
|
||||
});
|
||||
|
||||
let response = await fetch(request);
|
||||
|
||||
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
||||
|
||||
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
||||
const options = {};
|
||||
|
||||
['status', 'statusText', 'headers'].forEach(prop => {
|
||||
options[prop] = response[prop];
|
||||
});
|
||||
|
||||
const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
|
||||
|
||||
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
||||
responseContentLength,
|
||||
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
||||
) || [];
|
||||
|
||||
response = new Response(
|
||||
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
||||
flush && flush();
|
||||
unsubscribe && unsubscribe();
|
||||
}),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
responseType = responseType || 'text';
|
||||
|
||||
let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
|
||||
|
||||
!isStreamResponse && unsubscribe && unsubscribe();
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
settle(resolve, reject, {
|
||||
data: responseData,
|
||||
headers: AxiosHeaders.from(response.headers),
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
config,
|
||||
request
|
||||
})
|
||||
})
|
||||
} catch (err) {
|
||||
unsubscribe && unsubscribe();
|
||||
|
||||
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
||||
throw Object.assign(
|
||||
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
||||
{
|
||||
cause: err.cause || err
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
throw AxiosError.from(err, err && err.code, config, request);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
707
java-mall-app-shop-admin/node_modules/axios/lib/adapters/http.js
generated
vendored
707
java-mall-app-shop-admin/node_modules/axios/lib/adapters/http.js
generated
vendored
@ -1,323 +1,96 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import buildFullPath from '../core/buildFullPath.js';
|
||||
import buildURL from './../helpers/buildURL.js';
|
||||
import {getProxyForUrl} from 'proxy-from-env';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import util from 'util';
|
||||
import followRedirects from 'follow-redirects';
|
||||
import zlib from 'zlib';
|
||||
import {VERSION} from '../env/data.js';
|
||||
import transitionalDefaults from '../defaults/transitional.js';
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import CanceledError from '../cancel/CanceledError.js';
|
||||
import platform from '../platform/index.js';
|
||||
import fromDataURI from '../helpers/fromDataURI.js';
|
||||
import stream from 'stream';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
|
||||
import {EventEmitter} from 'events';
|
||||
import formDataToStream from "../helpers/formDataToStream.js";
|
||||
import readBlob from "../helpers/readBlob.js";
|
||||
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
||||
import callbackify from "../helpers/callbackify.js";
|
||||
import {progressEventReducer, progressEventDecorator, asyncDecorator} from "../helpers/progressEventReducer.js";
|
||||
var utils = require('./../utils');
|
||||
var settle = require('./../core/settle');
|
||||
var buildFullPath = require('../core/buildFullPath');
|
||||
var buildURL = require('./../helpers/buildURL');
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
var httpFollow = require('follow-redirects').http;
|
||||
var httpsFollow = require('follow-redirects').https;
|
||||
var url = require('url');
|
||||
var zlib = require('zlib');
|
||||
var VERSION = require('./../env/data').version;
|
||||
var transitionalDefaults = require('../defaults/transitional');
|
||||
var AxiosError = require('../core/AxiosError');
|
||||
var CanceledError = require('../cancel/CanceledError');
|
||||
|
||||
const zlibOptions = {
|
||||
flush: zlib.constants.Z_SYNC_FLUSH,
|
||||
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
||||
};
|
||||
var isHttps = /https:?/;
|
||||
|
||||
const brotliOptions = {
|
||||
flush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
||||
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
||||
}
|
||||
|
||||
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
||||
|
||||
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
||||
|
||||
const isHttps = /https:?/;
|
||||
|
||||
const supportedProtocols = platform.protocols.map(protocol => {
|
||||
return protocol + ':';
|
||||
});
|
||||
|
||||
const flushOnFinish = (stream, [throttled, flush]) => {
|
||||
stream
|
||||
.on('end', flush)
|
||||
.on('error', flush);
|
||||
|
||||
return throttled;
|
||||
}
|
||||
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
||||
|
||||
/**
|
||||
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
||||
* object.
|
||||
*
|
||||
* @param {Object<string, any>} options - The options object that was passed to the request.
|
||||
*
|
||||
* @returns {Object<string, any>}
|
||||
*/
|
||||
function dispatchBeforeRedirect(options, responseDetails) {
|
||||
if (options.beforeRedirects.proxy) {
|
||||
options.beforeRedirects.proxy(options);
|
||||
}
|
||||
if (options.beforeRedirects.config) {
|
||||
options.beforeRedirects.config(options, responseDetails);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the proxy or config afterRedirects functions are defined, call them with the options
|
||||
*
|
||||
* @param {http.ClientRequestArgs} options
|
||||
* @param {AxiosProxyConfig} configProxy configuration from Axios options object
|
||||
* @param {AxiosProxyConfig} proxy
|
||||
* @param {string} location
|
||||
*
|
||||
* @returns {http.ClientRequestArgs}
|
||||
*/
|
||||
function setProxy(options, configProxy, location) {
|
||||
let proxy = configProxy;
|
||||
if (!proxy && proxy !== false) {
|
||||
const proxyUrl = getProxyForUrl(location);
|
||||
if (proxyUrl) {
|
||||
proxy = new URL(proxyUrl);
|
||||
}
|
||||
}
|
||||
if (proxy) {
|
||||
// Basic proxy authorization
|
||||
if (proxy.username) {
|
||||
proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
|
||||
}
|
||||
function setProxy(options, proxy, location) {
|
||||
options.hostname = proxy.host;
|
||||
options.host = proxy.host;
|
||||
options.port = proxy.port;
|
||||
options.path = location;
|
||||
|
||||
if (proxy.auth) {
|
||||
// Support proxy auth object form
|
||||
if (proxy.auth.username || proxy.auth.password) {
|
||||
proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
|
||||
}
|
||||
const base64 = Buffer
|
||||
.from(proxy.auth, 'utf8')
|
||||
.toString('base64');
|
||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||
}
|
||||
|
||||
options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
|
||||
const proxyHost = proxy.hostname || proxy.host;
|
||||
options.hostname = proxyHost;
|
||||
// Replace 'host' since options is not a URL object
|
||||
options.host = proxyHost;
|
||||
options.port = proxy.port;
|
||||
options.path = location;
|
||||
if (proxy.protocol) {
|
||||
options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;
|
||||
}
|
||||
// Basic proxy authorization
|
||||
if (proxy.auth) {
|
||||
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||
}
|
||||
|
||||
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
|
||||
// Configure proxy for redirected request, passing the original config proxy to apply
|
||||
// the exact same logic as if the redirected request was performed by axios directly.
|
||||
setProxy(redirectOptions, configProxy, redirectOptions.href);
|
||||
// If a proxy is used, any redirects must also pass through the proxy
|
||||
options.beforeRedirect = function beforeRedirect(redirection) {
|
||||
redirection.headers.host = redirection.host;
|
||||
setProxy(redirection, proxy, redirection.href);
|
||||
};
|
||||
}
|
||||
|
||||
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
||||
|
||||
// temporary hotfix
|
||||
|
||||
const wrapAsync = (asyncExecutor) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let onDone;
|
||||
let isDone;
|
||||
|
||||
const done = (value, isRejected) => {
|
||||
if (isDone) return;
|
||||
isDone = true;
|
||||
onDone && onDone(value, isRejected);
|
||||
}
|
||||
|
||||
const _resolve = (value) => {
|
||||
done(value);
|
||||
resolve(value);
|
||||
};
|
||||
|
||||
const _reject = (reason) => {
|
||||
done(reason, true);
|
||||
reject(reason);
|
||||
}
|
||||
|
||||
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
||||
})
|
||||
};
|
||||
|
||||
const resolveFamily = ({address, family}) => {
|
||||
if (!utils.isString(address)) {
|
||||
throw TypeError('address must be a string');
|
||||
}
|
||||
return ({
|
||||
address,
|
||||
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
||||
});
|
||||
}
|
||||
|
||||
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
|
||||
|
||||
/*eslint consistent-return:0*/
|
||||
export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
||||
let {data, lookup, family} = config;
|
||||
const {responseType, responseEncoding} = config;
|
||||
const method = config.method.toUpperCase();
|
||||
let isDone;
|
||||
let rejected = false;
|
||||
let req;
|
||||
|
||||
if (lookup) {
|
||||
const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);
|
||||
// hotfix to support opt.all option which is required for node 20.x
|
||||
lookup = (hostname, opt, cb) => {
|
||||
_lookup(hostname, opt, (err, arg0, arg1) => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
||||
|
||||
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// temporary internal emitter until the AxiosRequest class will be implemented
|
||||
const emitter = new EventEmitter();
|
||||
|
||||
const onFinished = () => {
|
||||
module.exports = function httpAdapter(config) {
|
||||
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
||||
var onCanceled;
|
||||
function done() {
|
||||
if (config.cancelToken) {
|
||||
config.cancelToken.unsubscribe(abort);
|
||||
config.cancelToken.unsubscribe(onCanceled);
|
||||
}
|
||||
|
||||
if (config.signal) {
|
||||
config.signal.removeEventListener('abort', abort);
|
||||
config.signal.removeEventListener('abort', onCanceled);
|
||||
}
|
||||
|
||||
emitter.removeAllListeners();
|
||||
}
|
||||
var resolve = function resolve(value) {
|
||||
done();
|
||||
resolvePromise(value);
|
||||
};
|
||||
var rejected = false;
|
||||
var reject = function reject(value) {
|
||||
done();
|
||||
rejected = true;
|
||||
rejectPromise(value);
|
||||
};
|
||||
var data = config.data;
|
||||
var headers = config.headers;
|
||||
var headerNames = {};
|
||||
|
||||
onDone((value, isRejected) => {
|
||||
isDone = true;
|
||||
if (isRejected) {
|
||||
rejected = true;
|
||||
onFinished();
|
||||
}
|
||||
Object.keys(headers).forEach(function storeLowerName(name) {
|
||||
headerNames[name.toLowerCase()] = name;
|
||||
});
|
||||
|
||||
function abort(reason) {
|
||||
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
||||
}
|
||||
|
||||
emitter.once('abort', reject);
|
||||
|
||||
if (config.cancelToken || config.signal) {
|
||||
config.cancelToken && config.cancelToken.subscribe(abort);
|
||||
if (config.signal) {
|
||||
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse url
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
||||
const protocol = parsed.protocol || supportedProtocols[0];
|
||||
|
||||
if (protocol === 'data:') {
|
||||
let convertedData;
|
||||
|
||||
if (method !== 'GET') {
|
||||
return settle(resolve, reject, {
|
||||
status: 405,
|
||||
statusText: 'method not allowed',
|
||||
headers: {},
|
||||
config
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
convertedData = fromDataURI(config.url, responseType === 'blob', {
|
||||
Blob: config.env && config.env.Blob
|
||||
});
|
||||
} catch (err) {
|
||||
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
||||
}
|
||||
|
||||
if (responseType === 'text') {
|
||||
convertedData = convertedData.toString(responseEncoding);
|
||||
|
||||
if (!responseEncoding || responseEncoding === 'utf8') {
|
||||
convertedData = utils.stripBOM(convertedData);
|
||||
}
|
||||
} else if (responseType === 'stream') {
|
||||
convertedData = stream.Readable.from(convertedData);
|
||||
}
|
||||
|
||||
return settle(resolve, reject, {
|
||||
data: convertedData,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: new AxiosHeaders(),
|
||||
config
|
||||
});
|
||||
}
|
||||
|
||||
if (supportedProtocols.indexOf(protocol) === -1) {
|
||||
return reject(new AxiosError(
|
||||
'Unsupported protocol ' + protocol,
|
||||
AxiosError.ERR_BAD_REQUEST,
|
||||
config
|
||||
));
|
||||
}
|
||||
|
||||
const headers = AxiosHeaders.from(config.headers).normalize();
|
||||
|
||||
// Set User-Agent (required by some servers)
|
||||
// See https://github.com/axios/axios/issues/69
|
||||
// User-Agent is specified; handle case where no UA header is desired
|
||||
// Only set header if it hasn't been set in config
|
||||
headers.set('User-Agent', 'axios/' + VERSION, false);
|
||||
|
||||
const {onUploadProgress, onDownloadProgress} = config;
|
||||
const maxRate = config.maxRate;
|
||||
let maxUploadRate = undefined;
|
||||
let maxDownloadRate = undefined;
|
||||
|
||||
// support for spec compliant FormData objects
|
||||
if (utils.isSpecCompliantForm(data)) {
|
||||
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
||||
|
||||
data = formDataToStream(data, (formHeaders) => {
|
||||
headers.set(formHeaders);
|
||||
}, {
|
||||
tag: `axios-${VERSION}-boundary`,
|
||||
boundary: userBoundary && userBoundary[1] || undefined
|
||||
});
|
||||
// support for https://www.npmjs.com/package/form-data api
|
||||
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
||||
headers.set(data.getHeaders());
|
||||
|
||||
if (!headers.hasContentLength()) {
|
||||
try {
|
||||
const knownLength = await util.promisify(data.getLength).call(data);
|
||||
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
||||
/*eslint no-empty:0*/
|
||||
} catch (e) {
|
||||
}
|
||||
if ('user-agent' in headerNames) {
|
||||
// User-Agent is specified; handle case where no UA header is desired
|
||||
if (!headers[headerNames['user-agent']]) {
|
||||
delete headers[headerNames['user-agent']];
|
||||
}
|
||||
} else if (utils.isBlob(data)) {
|
||||
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
||||
headers.setContentLength(data.size || 0);
|
||||
data = stream.Readable.from(readBlob(data));
|
||||
// Otherwise, use specified value
|
||||
} else {
|
||||
// Only set header if it hasn't been set in config
|
||||
headers['User-Agent'] = 'axios/' + VERSION;
|
||||
}
|
||||
|
||||
// support for https://www.npmjs.com/package/form-data api
|
||||
if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
||||
Object.assign(headers, data.getHeaders());
|
||||
} else if (data && !utils.isStream(data)) {
|
||||
if (Buffer.isBuffer(data)) {
|
||||
// Nothing to do...
|
||||
@ -333,9 +106,6 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
));
|
||||
}
|
||||
|
||||
// Add Content-Length header if data exists
|
||||
headers.setContentLength(data.length, false);
|
||||
|
||||
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
||||
return reject(new AxiosError(
|
||||
'Request body larger than maxBodyLength limit',
|
||||
@ -343,117 +113,145 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
config
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
||||
|
||||
if (utils.isArray(maxRate)) {
|
||||
maxUploadRate = maxRate[0];
|
||||
maxDownloadRate = maxRate[1];
|
||||
} else {
|
||||
maxUploadRate = maxDownloadRate = maxRate;
|
||||
}
|
||||
|
||||
if (data && (onUploadProgress || maxUploadRate)) {
|
||||
if (!utils.isStream(data)) {
|
||||
data = stream.Readable.from(data, {objectMode: false});
|
||||
// Add Content-Length header if data exists
|
||||
if (!headerNames['content-length']) {
|
||||
headers['Content-Length'] = data.length;
|
||||
}
|
||||
|
||||
data = stream.pipeline([data, new AxiosTransformStream({
|
||||
maxRate: utils.toFiniteNumber(maxUploadRate)
|
||||
})], utils.noop);
|
||||
|
||||
onUploadProgress && data.on('progress', flushOnFinish(
|
||||
data,
|
||||
progressEventDecorator(
|
||||
contentLength,
|
||||
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
// HTTP basic authentication
|
||||
let auth = undefined;
|
||||
var auth = undefined;
|
||||
if (config.auth) {
|
||||
const username = config.auth.username || '';
|
||||
const password = config.auth.password || '';
|
||||
var username = config.auth.username || '';
|
||||
var password = config.auth.password || '';
|
||||
auth = username + ':' + password;
|
||||
}
|
||||
|
||||
if (!auth && parsed.username) {
|
||||
const urlUsername = parsed.username;
|
||||
const urlPassword = parsed.password;
|
||||
// Parse url
|
||||
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||
var parsed = url.parse(fullPath);
|
||||
var protocol = parsed.protocol || supportedProtocols[0];
|
||||
|
||||
if (supportedProtocols.indexOf(protocol) === -1) {
|
||||
return reject(new AxiosError(
|
||||
'Unsupported protocol ' + protocol,
|
||||
AxiosError.ERR_BAD_REQUEST,
|
||||
config
|
||||
));
|
||||
}
|
||||
|
||||
if (!auth && parsed.auth) {
|
||||
var urlAuth = parsed.auth.split(':');
|
||||
var urlUsername = urlAuth[0] || '';
|
||||
var urlPassword = urlAuth[1] || '';
|
||||
auth = urlUsername + ':' + urlPassword;
|
||||
}
|
||||
|
||||
auth && headers.delete('authorization');
|
||||
if (auth && headerNames.authorization) {
|
||||
delete headers[headerNames.authorization];
|
||||
}
|
||||
|
||||
let path;
|
||||
var isHttpsRequest = isHttps.test(protocol);
|
||||
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
||||
|
||||
try {
|
||||
path = buildURL(
|
||||
parsed.pathname + parsed.search,
|
||||
config.params,
|
||||
config.paramsSerializer
|
||||
).replace(/^\?/, '');
|
||||
buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, '');
|
||||
} catch (err) {
|
||||
const customErr = new Error(err.message);
|
||||
var customErr = new Error(err.message);
|
||||
customErr.config = config;
|
||||
customErr.url = config.url;
|
||||
customErr.exists = true;
|
||||
return reject(customErr);
|
||||
reject(customErr);
|
||||
}
|
||||
|
||||
headers.set(
|
||||
'Accept-Encoding',
|
||||
'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false
|
||||
);
|
||||
|
||||
const options = {
|
||||
path,
|
||||
method: method,
|
||||
headers: headers.toJSON(),
|
||||
var options = {
|
||||
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
||||
method: config.method.toUpperCase(),
|
||||
headers: headers,
|
||||
agent: agent,
|
||||
agents: { http: config.httpAgent, https: config.httpsAgent },
|
||||
auth,
|
||||
protocol,
|
||||
family,
|
||||
beforeRedirect: dispatchBeforeRedirect,
|
||||
beforeRedirects: {}
|
||||
auth: auth
|
||||
};
|
||||
|
||||
// cacheable-lookup integration hotfix
|
||||
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
||||
|
||||
if (config.socketPath) {
|
||||
options.socketPath = config.socketPath;
|
||||
} else {
|
||||
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
||||
options.hostname = parsed.hostname;
|
||||
options.port = parsed.port;
|
||||
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
||||
}
|
||||
|
||||
let transport;
|
||||
const isHttpsRequest = isHttps.test(options.protocol);
|
||||
options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
||||
var proxy = config.proxy;
|
||||
if (!proxy && proxy !== false) {
|
||||
var proxyEnv = protocol.slice(0, -1) + '_proxy';
|
||||
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
|
||||
if (proxyUrl) {
|
||||
var parsedProxyUrl = url.parse(proxyUrl);
|
||||
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
|
||||
var shouldProxy = true;
|
||||
|
||||
if (noProxyEnv) {
|
||||
var noProxy = noProxyEnv.split(',').map(function trim(s) {
|
||||
return s.trim();
|
||||
});
|
||||
|
||||
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
|
||||
if (!proxyElement) {
|
||||
return false;
|
||||
}
|
||||
if (proxyElement === '*') {
|
||||
return true;
|
||||
}
|
||||
if (proxyElement[0] === '.' &&
|
||||
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return parsed.hostname === proxyElement;
|
||||
});
|
||||
}
|
||||
|
||||
if (shouldProxy) {
|
||||
proxy = {
|
||||
host: parsedProxyUrl.hostname,
|
||||
port: parsedProxyUrl.port,
|
||||
protocol: parsedProxyUrl.protocol
|
||||
};
|
||||
|
||||
if (parsedProxyUrl.auth) {
|
||||
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
|
||||
proxy.auth = {
|
||||
username: proxyUrlAuth[0],
|
||||
password: proxyUrlAuth[1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (proxy) {
|
||||
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
|
||||
setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
||||
}
|
||||
|
||||
var transport;
|
||||
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
|
||||
if (config.transport) {
|
||||
transport = config.transport;
|
||||
} else if (config.maxRedirects === 0) {
|
||||
transport = isHttpsRequest ? https : http;
|
||||
transport = isHttpsProxy ? https : http;
|
||||
} else {
|
||||
if (config.maxRedirects) {
|
||||
options.maxRedirects = config.maxRedirects;
|
||||
}
|
||||
if (config.beforeRedirect) {
|
||||
options.beforeRedirects.config = config.beforeRedirect;
|
||||
options.beforeRedirect = config.beforeRedirect;
|
||||
}
|
||||
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
||||
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
||||
}
|
||||
|
||||
if (config.maxBodyLength > -1) {
|
||||
options.maxBodyLength = config.maxBodyLength;
|
||||
} else {
|
||||
// follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
|
||||
options.maxBodyLength = Infinity;
|
||||
}
|
||||
|
||||
if (config.insecureHTTPParser) {
|
||||
@ -461,156 +259,94 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
// Create the request
|
||||
req = transport.request(options, function handleResponse(res) {
|
||||
if (req.destroyed) return;
|
||||
var req = transport.request(options, function handleResponse(res) {
|
||||
if (req.aborted) return;
|
||||
|
||||
const streams = [res];
|
||||
|
||||
const responseLength = +res.headers['content-length'];
|
||||
|
||||
if (onDownloadProgress || maxDownloadRate) {
|
||||
const transformStream = new AxiosTransformStream({
|
||||
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
||||
});
|
||||
|
||||
onDownloadProgress && transformStream.on('progress', flushOnFinish(
|
||||
transformStream,
|
||||
progressEventDecorator(
|
||||
responseLength,
|
||||
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
||||
)
|
||||
));
|
||||
|
||||
streams.push(transformStream);
|
||||
}
|
||||
|
||||
// decompress the response body transparently if required
|
||||
let responseStream = res;
|
||||
// uncompress the response body transparently if required
|
||||
var stream = res;
|
||||
|
||||
// return the last request in case of redirects
|
||||
const lastRequest = res.req || req;
|
||||
var lastRequest = res.req || req;
|
||||
|
||||
// if decompress disabled we should not decompress
|
||||
if (config.decompress !== false && res.headers['content-encoding']) {
|
||||
// if no content, but headers still say that it is encoded,
|
||||
// remove the header not confuse downstream operations
|
||||
if (method === 'HEAD' || res.statusCode === 204) {
|
||||
delete res.headers['content-encoding'];
|
||||
}
|
||||
|
||||
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
|
||||
// if no content, is HEAD request or decompress disabled we should not decompress
|
||||
if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
|
||||
switch (res.headers['content-encoding']) {
|
||||
/*eslint default-case:0*/
|
||||
case 'gzip':
|
||||
case 'x-gzip':
|
||||
case 'compress':
|
||||
case 'x-compress':
|
||||
// add the unzipper to the body stream processing pipeline
|
||||
streams.push(zlib.createUnzip(zlibOptions));
|
||||
|
||||
// remove the content-encoding in order to not confuse downstream operations
|
||||
delete res.headers['content-encoding'];
|
||||
break;
|
||||
case 'deflate':
|
||||
streams.push(new ZlibHeaderTransformStream());
|
||||
|
||||
// add the unzipper to the body stream processing pipeline
|
||||
streams.push(zlib.createUnzip(zlibOptions));
|
||||
// add the unzipper to the body stream processing pipeline
|
||||
stream = stream.pipe(zlib.createUnzip());
|
||||
|
||||
// remove the content-encoding in order to not confuse downstream operations
|
||||
delete res.headers['content-encoding'];
|
||||
break;
|
||||
case 'br':
|
||||
if (isBrotliSupported) {
|
||||
streams.push(zlib.createBrotliDecompress(brotliOptions));
|
||||
delete res.headers['content-encoding'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
||||
|
||||
const offListeners = stream.finished(responseStream, () => {
|
||||
offListeners();
|
||||
onFinished();
|
||||
});
|
||||
|
||||
const response = {
|
||||
var response = {
|
||||
status: res.statusCode,
|
||||
statusText: res.statusMessage,
|
||||
headers: new AxiosHeaders(res.headers),
|
||||
config,
|
||||
headers: res.headers,
|
||||
config: config,
|
||||
request: lastRequest
|
||||
};
|
||||
|
||||
if (responseType === 'stream') {
|
||||
response.data = responseStream;
|
||||
if (config.responseType === 'stream') {
|
||||
response.data = stream;
|
||||
settle(resolve, reject, response);
|
||||
} else {
|
||||
const responseBuffer = [];
|
||||
let totalResponseBytes = 0;
|
||||
|
||||
responseStream.on('data', function handleStreamData(chunk) {
|
||||
var responseBuffer = [];
|
||||
var totalResponseBytes = 0;
|
||||
stream.on('data', function handleStreamData(chunk) {
|
||||
responseBuffer.push(chunk);
|
||||
totalResponseBytes += chunk.length;
|
||||
|
||||
// make sure the content length is not over the maxContentLength if specified
|
||||
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
||||
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
||||
// stream.destoy() emit aborted event before calling reject() on Node.js v16
|
||||
rejected = true;
|
||||
responseStream.destroy();
|
||||
stream.destroy();
|
||||
reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
||||
}
|
||||
});
|
||||
|
||||
responseStream.on('aborted', function handlerStreamAborted() {
|
||||
stream.on('aborted', function handlerStreamAborted() {
|
||||
if (rejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
const err = new AxiosError(
|
||||
stream.destroy();
|
||||
reject(new AxiosError(
|
||||
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||
AxiosError.ERR_BAD_RESPONSE,
|
||||
config,
|
||||
lastRequest
|
||||
);
|
||||
responseStream.destroy(err);
|
||||
reject(err);
|
||||
));
|
||||
});
|
||||
|
||||
responseStream.on('error', function handleStreamError(err) {
|
||||
if (req.destroyed) return;
|
||||
stream.on('error', function handleStreamError(err) {
|
||||
if (req.aborted) return;
|
||||
reject(AxiosError.from(err, null, config, lastRequest));
|
||||
});
|
||||
|
||||
responseStream.on('end', function handleStreamEnd() {
|
||||
stream.on('end', function handleStreamEnd() {
|
||||
try {
|
||||
let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
||||
if (responseType !== 'arraybuffer') {
|
||||
responseData = responseData.toString(responseEncoding);
|
||||
if (!responseEncoding || responseEncoding === 'utf8') {
|
||||
var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
||||
if (config.responseType !== 'arraybuffer') {
|
||||
responseData = responseData.toString(config.responseEncoding);
|
||||
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
||||
responseData = utils.stripBOM(responseData);
|
||||
}
|
||||
}
|
||||
response.data = responseData;
|
||||
} catch (err) {
|
||||
return reject(AxiosError.from(err, null, config, response.request, response));
|
||||
reject(AxiosError.from(err, null, config, response.request, response));
|
||||
}
|
||||
settle(resolve, reject, response);
|
||||
});
|
||||
}
|
||||
|
||||
emitter.once('abort', err => {
|
||||
if (!responseStream.destroyed) {
|
||||
responseStream.emit('error', err);
|
||||
responseStream.destroy();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
emitter.once('abort', err => {
|
||||
reject(err);
|
||||
req.destroy(err);
|
||||
});
|
||||
|
||||
// Handle errors
|
||||
@ -629,9 +365,9 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
// Handle request timeout
|
||||
if (config.timeout) {
|
||||
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
||||
const timeout = parseInt(config.timeout, 10);
|
||||
var timeout = parseInt(config.timeout, 10);
|
||||
|
||||
if (Number.isNaN(timeout)) {
|
||||
if (isNaN(timeout)) {
|
||||
reject(new AxiosError(
|
||||
'error trying to parse `config.timeout` to int',
|
||||
AxiosError.ERR_BAD_OPTION_VALUE,
|
||||
@ -645,51 +381,44 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
||||
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
||||
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
|
||||
// And then these socket which be hang up will devouring CPU little by little.
|
||||
// And then these socket which be hang up will devoring CPU little by little.
|
||||
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
||||
req.setTimeout(timeout, function handleRequestTimeout() {
|
||||
if (isDone) return;
|
||||
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||
const transitional = config.transitional || transitionalDefaults;
|
||||
if (config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||
}
|
||||
req.abort();
|
||||
var transitional = config.transitional || transitionalDefaults;
|
||||
reject(new AxiosError(
|
||||
timeoutErrorMessage,
|
||||
'timeout of ' + timeout + 'ms exceeded',
|
||||
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
||||
config,
|
||||
req
|
||||
));
|
||||
abort();
|
||||
});
|
||||
}
|
||||
|
||||
if (config.cancelToken || config.signal) {
|
||||
// Handle cancellation
|
||||
// eslint-disable-next-line func-names
|
||||
onCanceled = function(cancel) {
|
||||
if (req.aborted) return;
|
||||
|
||||
req.abort();
|
||||
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
|
||||
};
|
||||
|
||||
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
||||
if (config.signal) {
|
||||
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send the request
|
||||
if (utils.isStream(data)) {
|
||||
let ended = false;
|
||||
let errored = false;
|
||||
|
||||
data.on('end', () => {
|
||||
ended = true;
|
||||
});
|
||||
|
||||
data.once('error', err => {
|
||||
errored = true;
|
||||
req.destroy(err);
|
||||
});
|
||||
|
||||
data.on('close', () => {
|
||||
if (!ended && !errored) {
|
||||
abort(new CanceledError('Request stream has been aborted', config, req));
|
||||
}
|
||||
});
|
||||
|
||||
data.pipe(req);
|
||||
data.on('error', function handleStreamError(err) {
|
||||
reject(AxiosError.from(err, config, null, req));
|
||||
}).pipe(req);
|
||||
} else {
|
||||
req.end(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export const __setProxy = setProxy;
|
||||
};
|
||||
|
||||
157
java-mall-app-shop-admin/node_modules/axios/lib/adapters/xhr.js
generated
vendored
157
java-mall-app-shop-admin/node_modules/axios/lib/adapters/xhr.js
generated
vendored
@ -1,59 +1,68 @@
|
||||
import utils from './../utils.js';
|
||||
import settle from './../core/settle.js';
|
||||
import transitionalDefaults from '../defaults/transitional.js';
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import CanceledError from '../cancel/CanceledError.js';
|
||||
import parseProtocol from '../helpers/parseProtocol.js';
|
||||
import platform from '../platform/index.js';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
import {progressEventReducer} from '../helpers/progressEventReducer.js';
|
||||
import resolveConfig from "../helpers/resolveConfig.js";
|
||||
'use strict';
|
||||
|
||||
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
||||
var utils = require('./../utils');
|
||||
var settle = require('./../core/settle');
|
||||
var cookies = require('./../helpers/cookies');
|
||||
var buildURL = require('./../helpers/buildURL');
|
||||
var buildFullPath = require('../core/buildFullPath');
|
||||
var parseHeaders = require('./../helpers/parseHeaders');
|
||||
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
||||
var transitionalDefaults = require('../defaults/transitional');
|
||||
var AxiosError = require('../core/AxiosError');
|
||||
var CanceledError = require('../cancel/CanceledError');
|
||||
var parseProtocol = require('../helpers/parseProtocol');
|
||||
|
||||
export default isXHRAdapterSupported && function (config) {
|
||||
module.exports = function xhrAdapter(config) {
|
||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||
const _config = resolveConfig(config);
|
||||
let requestData = _config.data;
|
||||
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
||||
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
||||
let onCanceled;
|
||||
let uploadThrottled, downloadThrottled;
|
||||
let flushUpload, flushDownload;
|
||||
|
||||
var requestData = config.data;
|
||||
var requestHeaders = config.headers;
|
||||
var responseType = config.responseType;
|
||||
var onCanceled;
|
||||
function done() {
|
||||
flushUpload && flushUpload(); // flush events
|
||||
flushDownload && flushDownload(); // flush events
|
||||
if (config.cancelToken) {
|
||||
config.cancelToken.unsubscribe(onCanceled);
|
||||
}
|
||||
|
||||
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
||||
|
||||
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
||||
if (config.signal) {
|
||||
config.signal.removeEventListener('abort', onCanceled);
|
||||
}
|
||||
}
|
||||
|
||||
let request = new XMLHttpRequest();
|
||||
if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
|
||||
delete requestHeaders['Content-Type']; // Let the browser set it
|
||||
}
|
||||
|
||||
request.open(_config.method.toUpperCase(), _config.url, true);
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
// HTTP basic authentication
|
||||
if (config.auth) {
|
||||
var username = config.auth.username || '';
|
||||
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
||||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||||
}
|
||||
|
||||
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||
|
||||
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
||||
|
||||
// Set the request timeout in MS
|
||||
request.timeout = _config.timeout;
|
||||
request.timeout = config.timeout;
|
||||
|
||||
function onloadend() {
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
// Prepare the response
|
||||
const responseHeaders = AxiosHeaders.from(
|
||||
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
||||
);
|
||||
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
||||
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
||||
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
||||
request.responseText : request.response;
|
||||
const response = {
|
||||
var response = {
|
||||
data: responseData,
|
||||
status: request.status,
|
||||
statusText: request.statusText,
|
||||
headers: responseHeaders,
|
||||
config,
|
||||
request
|
||||
config: config,
|
||||
request: request
|
||||
};
|
||||
|
||||
settle(function _resolve(value) {
|
||||
@ -107,7 +116,7 @@ export default isXHRAdapterSupported && function (config) {
|
||||
request.onerror = function handleError() {
|
||||
// Real errors are hidden from us by the browser
|
||||
// onerror should only fire if it's a network error
|
||||
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
||||
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request));
|
||||
|
||||
// Clean up request
|
||||
request = null;
|
||||
@ -115,10 +124,10 @@ export default isXHRAdapterSupported && function (config) {
|
||||
|
||||
// Handle timeout
|
||||
request.ontimeout = function handleTimeout() {
|
||||
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||
const transitional = _config.transitional || transitionalDefaults;
|
||||
if (_config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = _config.timeoutErrorMessage;
|
||||
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
||||
var transitional = config.transitional || transitionalDefaults;
|
||||
if (config.timeoutErrorMessage) {
|
||||
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||
}
|
||||
reject(new AxiosError(
|
||||
timeoutErrorMessage,
|
||||
@ -130,68 +139,84 @@ export default isXHRAdapterSupported && function (config) {
|
||||
request = null;
|
||||
};
|
||||
|
||||
// Remove Content-Type if data is undefined
|
||||
requestData === undefined && requestHeaders.setContentType(null);
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (utils.isStandardBrowserEnv()) {
|
||||
// Add xsrf header
|
||||
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
||||
cookies.read(config.xsrfCookieName) :
|
||||
undefined;
|
||||
|
||||
if (xsrfValue) {
|
||||
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Add headers to the request
|
||||
if ('setRequestHeader' in request) {
|
||||
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
||||
request.setRequestHeader(key, val);
|
||||
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
||||
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
||||
// Remove Content-Type if data is undefined
|
||||
delete requestHeaders[key];
|
||||
} else {
|
||||
// Otherwise add header to the request
|
||||
request.setRequestHeader(key, val);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add withCredentials to request if needed
|
||||
if (!utils.isUndefined(_config.withCredentials)) {
|
||||
request.withCredentials = !!_config.withCredentials;
|
||||
if (!utils.isUndefined(config.withCredentials)) {
|
||||
request.withCredentials = !!config.withCredentials;
|
||||
}
|
||||
|
||||
// Add responseType to request if needed
|
||||
if (responseType && responseType !== 'json') {
|
||||
request.responseType = _config.responseType;
|
||||
request.responseType = config.responseType;
|
||||
}
|
||||
|
||||
// Handle progress if needed
|
||||
if (onDownloadProgress) {
|
||||
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
||||
request.addEventListener('progress', downloadThrottled);
|
||||
if (typeof config.onDownloadProgress === 'function') {
|
||||
request.addEventListener('progress', config.onDownloadProgress);
|
||||
}
|
||||
|
||||
// Not all browsers support upload events
|
||||
if (onUploadProgress && request.upload) {
|
||||
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
||||
|
||||
request.upload.addEventListener('progress', uploadThrottled);
|
||||
|
||||
request.upload.addEventListener('loadend', flushUpload);
|
||||
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
||||
request.upload.addEventListener('progress', config.onUploadProgress);
|
||||
}
|
||||
|
||||
if (_config.cancelToken || _config.signal) {
|
||||
if (config.cancelToken || config.signal) {
|
||||
// Handle cancellation
|
||||
// eslint-disable-next-line func-names
|
||||
onCanceled = cancel => {
|
||||
onCanceled = function(cancel) {
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
||||
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
|
||||
request.abort();
|
||||
request = null;
|
||||
};
|
||||
|
||||
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
||||
if (_config.signal) {
|
||||
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
||||
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
||||
if (config.signal) {
|
||||
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
||||
}
|
||||
}
|
||||
|
||||
const protocol = parseProtocol(_config.url);
|
||||
if (!requestData) {
|
||||
requestData = null;
|
||||
}
|
||||
|
||||
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
||||
var protocol = parseProtocol(fullPath);
|
||||
|
||||
if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
|
||||
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Send the request
|
||||
request.send(requestData || null);
|
||||
request.send(requestData);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
69
java-mall-app-shop-admin/node_modules/axios/lib/axios.js
generated
vendored
69
java-mall-app-shop-admin/node_modules/axios/lib/axios.js
generated
vendored
@ -1,39 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './utils.js';
|
||||
import bind from './helpers/bind.js';
|
||||
import Axios from './core/Axios.js';
|
||||
import mergeConfig from './core/mergeConfig.js';
|
||||
import defaults from './defaults/index.js';
|
||||
import formDataToJSON from './helpers/formDataToJSON.js';
|
||||
import CanceledError from './cancel/CanceledError.js';
|
||||
import CancelToken from './cancel/CancelToken.js';
|
||||
import isCancel from './cancel/isCancel.js';
|
||||
import {VERSION} from './env/data.js';
|
||||
import toFormData from './helpers/toFormData.js';
|
||||
import AxiosError from './core/AxiosError.js';
|
||||
import spread from './helpers/spread.js';
|
||||
import isAxiosError from './helpers/isAxiosError.js';
|
||||
import AxiosHeaders from "./core/AxiosHeaders.js";
|
||||
import adapters from './adapters/adapters.js';
|
||||
import HttpStatusCode from './helpers/HttpStatusCode.js';
|
||||
var utils = require('./utils');
|
||||
var bind = require('./helpers/bind');
|
||||
var Axios = require('./core/Axios');
|
||||
var mergeConfig = require('./core/mergeConfig');
|
||||
var defaults = require('./defaults');
|
||||
|
||||
/**
|
||||
* Create an instance of Axios
|
||||
*
|
||||
* @param {Object} defaultConfig The default config for the instance
|
||||
*
|
||||
* @returns {Axios} A new instance of Axios
|
||||
* @return {Axios} A new instance of Axios
|
||||
*/
|
||||
function createInstance(defaultConfig) {
|
||||
const context = new Axios(defaultConfig);
|
||||
const instance = bind(Axios.prototype.request, context);
|
||||
var context = new Axios(defaultConfig);
|
||||
var instance = bind(Axios.prototype.request, context);
|
||||
|
||||
// Copy axios.prototype to instance
|
||||
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
||||
utils.extend(instance, Axios.prototype, context);
|
||||
|
||||
// Copy context to instance
|
||||
utils.extend(instance, context, null, {allOwnKeys: true});
|
||||
utils.extend(instance, context);
|
||||
|
||||
// Factory for creating new instances
|
||||
instance.create = function create(instanceConfig) {
|
||||
@ -44,20 +31,20 @@ function createInstance(defaultConfig) {
|
||||
}
|
||||
|
||||
// Create the default instance to be exported
|
||||
const axios = createInstance(defaults);
|
||||
var axios = createInstance(defaults);
|
||||
|
||||
// Expose Axios class to allow class inheritance
|
||||
axios.Axios = Axios;
|
||||
|
||||
// Expose Cancel & CancelToken
|
||||
axios.CanceledError = CanceledError;
|
||||
axios.CancelToken = CancelToken;
|
||||
axios.isCancel = isCancel;
|
||||
axios.VERSION = VERSION;
|
||||
axios.toFormData = toFormData;
|
||||
axios.CanceledError = require('./cancel/CanceledError');
|
||||
axios.CancelToken = require('./cancel/CancelToken');
|
||||
axios.isCancel = require('./cancel/isCancel');
|
||||
axios.VERSION = require('./env/data').version;
|
||||
axios.toFormData = require('./helpers/toFormData');
|
||||
|
||||
// Expose AxiosError class
|
||||
axios.AxiosError = AxiosError;
|
||||
axios.AxiosError = require('../lib/core/AxiosError');
|
||||
|
||||
// alias for CanceledError for backward compatibility
|
||||
axios.Cancel = axios.CanceledError;
|
||||
@ -66,24 +53,12 @@ axios.Cancel = axios.CanceledError;
|
||||
axios.all = function all(promises) {
|
||||
return Promise.all(promises);
|
||||
};
|
||||
|
||||
axios.spread = spread;
|
||||
axios.spread = require('./helpers/spread');
|
||||
|
||||
// Expose isAxiosError
|
||||
axios.isAxiosError = isAxiosError;
|
||||
axios.isAxiosError = require('./helpers/isAxiosError');
|
||||
|
||||
// Expose mergeConfig
|
||||
axios.mergeConfig = mergeConfig;
|
||||
module.exports = axios;
|
||||
|
||||
axios.AxiosHeaders = AxiosHeaders;
|
||||
|
||||
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
||||
|
||||
axios.getAdapter = adapters.getAdapter;
|
||||
|
||||
axios.HttpStatusCode = HttpStatusCode;
|
||||
|
||||
axios.default = axios;
|
||||
|
||||
// this module should only have a default export
|
||||
export default axios
|
||||
// Allow use of default import syntax in TypeScript
|
||||
module.exports.default = axios;
|
||||
|
||||
214
java-mall-app-shop-admin/node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
214
java-mall-app-shop-admin/node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
@ -1,135 +1,119 @@
|
||||
'use strict';
|
||||
|
||||
import CanceledError from './CanceledError.js';
|
||||
var CanceledError = require('./CanceledError');
|
||||
|
||||
/**
|
||||
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||
*
|
||||
* @class
|
||||
* @param {Function} executor The executor function.
|
||||
*
|
||||
* @returns {CancelToken}
|
||||
*/
|
||||
class CancelToken {
|
||||
constructor(executor) {
|
||||
if (typeof executor !== 'function') {
|
||||
throw new TypeError('executor must be a function.');
|
||||
function CancelToken(executor) {
|
||||
if (typeof executor !== 'function') {
|
||||
throw new TypeError('executor must be a function.');
|
||||
}
|
||||
|
||||
var resolvePromise;
|
||||
|
||||
this.promise = new Promise(function promiseExecutor(resolve) {
|
||||
resolvePromise = resolve;
|
||||
});
|
||||
|
||||
var token = this;
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
this.promise.then(function(cancel) {
|
||||
if (!token._listeners) return;
|
||||
|
||||
var i;
|
||||
var l = token._listeners.length;
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
token._listeners[i](cancel);
|
||||
}
|
||||
token._listeners = null;
|
||||
});
|
||||
|
||||
let resolvePromise;
|
||||
|
||||
this.promise = new Promise(function promiseExecutor(resolve) {
|
||||
resolvePromise = resolve;
|
||||
});
|
||||
|
||||
const token = this;
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
this.promise.then = function(onfulfilled) {
|
||||
var _resolve;
|
||||
// eslint-disable-next-line func-names
|
||||
this.promise.then(cancel => {
|
||||
if (!token._listeners) return;
|
||||
var promise = new Promise(function(resolve) {
|
||||
token.subscribe(resolve);
|
||||
_resolve = resolve;
|
||||
}).then(onfulfilled);
|
||||
|
||||
let i = token._listeners.length;
|
||||
|
||||
while (i-- > 0) {
|
||||
token._listeners[i](cancel);
|
||||
}
|
||||
token._listeners = null;
|
||||
});
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
this.promise.then = onfulfilled => {
|
||||
let _resolve;
|
||||
// eslint-disable-next-line func-names
|
||||
const promise = new Promise(resolve => {
|
||||
token.subscribe(resolve);
|
||||
_resolve = resolve;
|
||||
}).then(onfulfilled);
|
||||
|
||||
promise.cancel = function reject() {
|
||||
token.unsubscribe(_resolve);
|
||||
};
|
||||
|
||||
return promise;
|
||||
promise.cancel = function reject() {
|
||||
token.unsubscribe(_resolve);
|
||||
};
|
||||
|
||||
executor(function cancel(message, config, request) {
|
||||
if (token.reason) {
|
||||
// Cancellation has already been requested
|
||||
return;
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
|
||||
token.reason = new CanceledError(message, config, request);
|
||||
resolvePromise(token.reason);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws a `CanceledError` if cancellation has been requested.
|
||||
*/
|
||||
throwIfRequested() {
|
||||
if (this.reason) {
|
||||
throw this.reason;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to the cancel signal
|
||||
*/
|
||||
|
||||
subscribe(listener) {
|
||||
if (this.reason) {
|
||||
listener(this.reason);
|
||||
executor(function cancel(message) {
|
||||
if (token.reason) {
|
||||
// Cancellation has already been requested
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._listeners) {
|
||||
this._listeners.push(listener);
|
||||
} else {
|
||||
this._listeners = [listener];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe from the cancel signal
|
||||
*/
|
||||
|
||||
unsubscribe(listener) {
|
||||
if (!this._listeners) {
|
||||
return;
|
||||
}
|
||||
const index = this._listeners.indexOf(listener);
|
||||
if (index !== -1) {
|
||||
this._listeners.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
toAbortSignal() {
|
||||
const controller = new AbortController();
|
||||
|
||||
const abort = (err) => {
|
||||
controller.abort(err);
|
||||
};
|
||||
|
||||
this.subscribe(abort);
|
||||
|
||||
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
||||
|
||||
return controller.signal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||
* cancels the `CancelToken`.
|
||||
*/
|
||||
static source() {
|
||||
let cancel;
|
||||
const token = new CancelToken(function executor(c) {
|
||||
cancel = c;
|
||||
});
|
||||
return {
|
||||
token,
|
||||
cancel
|
||||
};
|
||||
}
|
||||
token.reason = new CanceledError(message);
|
||||
resolvePromise(token.reason);
|
||||
});
|
||||
}
|
||||
|
||||
export default CancelToken;
|
||||
/**
|
||||
* Throws a `CanceledError` if cancellation has been requested.
|
||||
*/
|
||||
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
||||
if (this.reason) {
|
||||
throw this.reason;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Subscribe to the cancel signal
|
||||
*/
|
||||
|
||||
CancelToken.prototype.subscribe = function subscribe(listener) {
|
||||
if (this.reason) {
|
||||
listener(this.reason);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._listeners) {
|
||||
this._listeners.push(listener);
|
||||
} else {
|
||||
this._listeners = [listener];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Unsubscribe from the cancel signal
|
||||
*/
|
||||
|
||||
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
||||
if (!this._listeners) {
|
||||
return;
|
||||
}
|
||||
var index = this._listeners.indexOf(listener);
|
||||
if (index !== -1) {
|
||||
this._listeners.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||
* cancels the `CancelToken`.
|
||||
*/
|
||||
CancelToken.source = function source() {
|
||||
var cancel;
|
||||
var token = new CancelToken(function executor(c) {
|
||||
cancel = c;
|
||||
});
|
||||
return {
|
||||
token: token,
|
||||
cancel: cancel
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = CancelToken;
|
||||
|
||||
15
java-mall-app-shop-admin/node_modules/axios/lib/cancel/CanceledError.js
generated
vendored
15
java-mall-app-shop-admin/node_modules/axios/lib/cancel/CanceledError.js
generated
vendored
@ -1,20 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import utils from '../utils.js';
|
||||
var AxiosError = require('../core/AxiosError');
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
||||
*
|
||||
* @class
|
||||
* @param {string=} message The message.
|
||||
* @param {Object=} config The config.
|
||||
* @param {Object=} request The request.
|
||||
*
|
||||
* @returns {CanceledError} The created error.
|
||||
*/
|
||||
function CanceledError(message, config, request) {
|
||||
function CanceledError(message) {
|
||||
// eslint-disable-next-line no-eq-null,eqeqeq
|
||||
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
||||
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED);
|
||||
this.name = 'CanceledError';
|
||||
}
|
||||
|
||||
@ -22,4 +19,4 @@ utils.inherits(CanceledError, AxiosError, {
|
||||
__CANCEL__: true
|
||||
});
|
||||
|
||||
export default CanceledError;
|
||||
module.exports = CanceledError;
|
||||
|
||||
4
java-mall-app-shop-admin/node_modules/axios/lib/cancel/isCancel.js
generated
vendored
4
java-mall-app-shop-admin/node_modules/axios/lib/cancel/isCancel.js
generated
vendored
@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
export default function isCancel(value) {
|
||||
module.exports = function isCancel(value) {
|
||||
return !!(value && value.__CANCEL__);
|
||||
}
|
||||
};
|
||||
|
||||
276
java-mall-app-shop-admin/node_modules/axios/lib/core/Axios.js
generated
vendored
276
java-mall-app-shop-admin/node_modules/axios/lib/core/Axios.js
generated
vendored
@ -1,204 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import buildURL from '../helpers/buildURL.js';
|
||||
import InterceptorManager from './InterceptorManager.js';
|
||||
import dispatchRequest from './dispatchRequest.js';
|
||||
import mergeConfig from './mergeConfig.js';
|
||||
import buildFullPath from './buildFullPath.js';
|
||||
import validator from '../helpers/validator.js';
|
||||
import AxiosHeaders from './AxiosHeaders.js';
|
||||
|
||||
const validators = validator.validators;
|
||||
var utils = require('./../utils');
|
||||
var buildURL = require('../helpers/buildURL');
|
||||
var InterceptorManager = require('./InterceptorManager');
|
||||
var dispatchRequest = require('./dispatchRequest');
|
||||
var mergeConfig = require('./mergeConfig');
|
||||
var buildFullPath = require('./buildFullPath');
|
||||
var validator = require('../helpers/validator');
|
||||
|
||||
var validators = validator.validators;
|
||||
/**
|
||||
* Create a new instance of Axios
|
||||
*
|
||||
* @param {Object} instanceConfig The default config for the instance
|
||||
*
|
||||
* @return {Axios} A new instance of Axios
|
||||
*/
|
||||
class Axios {
|
||||
constructor(instanceConfig) {
|
||||
this.defaults = instanceConfig;
|
||||
this.interceptors = {
|
||||
request: new InterceptorManager(),
|
||||
response: new InterceptorManager()
|
||||
};
|
||||
function Axios(instanceConfig) {
|
||||
this.defaults = instanceConfig;
|
||||
this.interceptors = {
|
||||
request: new InterceptorManager(),
|
||||
response: new InterceptorManager()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a request
|
||||
*
|
||||
* @param {Object} config The config specific for this request (merged with this.defaults)
|
||||
*/
|
||||
Axios.prototype.request = function request(configOrUrl, config) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
// Allow for axios('example/url'[, config]) a la fetch API
|
||||
if (typeof configOrUrl === 'string') {
|
||||
config = config || {};
|
||||
config.url = configOrUrl;
|
||||
} else {
|
||||
config = configOrUrl || {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a request
|
||||
*
|
||||
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
||||
* @param {?Object} config
|
||||
*
|
||||
* @returns {Promise} The Promise to be fulfilled
|
||||
*/
|
||||
async request(configOrUrl, config) {
|
||||
try {
|
||||
return await this._request(configOrUrl, config);
|
||||
} catch (err) {
|
||||
if (err instanceof Error) {
|
||||
let dummy;
|
||||
config = mergeConfig(this.defaults, config);
|
||||
|
||||
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
||||
|
||||
// slice off the Error: ... line
|
||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||
try {
|
||||
if (!err.stack) {
|
||||
err.stack = stack;
|
||||
// match without the 2 top stack lines
|
||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||
err.stack += '\n' + stack
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore the case where "stack" is an un-writable property
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
// Set config.method
|
||||
if (config.method) {
|
||||
config.method = config.method.toLowerCase();
|
||||
} else if (this.defaults.method) {
|
||||
config.method = this.defaults.method.toLowerCase();
|
||||
} else {
|
||||
config.method = 'get';
|
||||
}
|
||||
|
||||
_request(configOrUrl, config) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
// Allow for axios('example/url'[, config]) a la fetch API
|
||||
if (typeof configOrUrl === 'string') {
|
||||
config = config || {};
|
||||
config.url = configOrUrl;
|
||||
} else {
|
||||
config = configOrUrl || {};
|
||||
var transitional = config.transitional;
|
||||
|
||||
if (transitional !== undefined) {
|
||||
validator.assertOptions(transitional, {
|
||||
silentJSONParsing: validators.transitional(validators.boolean),
|
||||
forcedJSONParsing: validators.transitional(validators.boolean),
|
||||
clarifyTimeoutError: validators.transitional(validators.boolean)
|
||||
}, false);
|
||||
}
|
||||
|
||||
// filter out skipped interceptors
|
||||
var requestInterceptorChain = [];
|
||||
var synchronousRequestInterceptors = true;
|
||||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||||
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
config = mergeConfig(this.defaults, config);
|
||||
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
||||
|
||||
const {transitional, paramsSerializer, headers} = config;
|
||||
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
|
||||
if (transitional !== undefined) {
|
||||
validator.assertOptions(transitional, {
|
||||
silentJSONParsing: validators.transitional(validators.boolean),
|
||||
forcedJSONParsing: validators.transitional(validators.boolean),
|
||||
clarifyTimeoutError: validators.transitional(validators.boolean)
|
||||
}, false);
|
||||
}
|
||||
var responseInterceptorChain = [];
|
||||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||||
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
|
||||
if (paramsSerializer != null) {
|
||||
if (utils.isFunction(paramsSerializer)) {
|
||||
config.paramsSerializer = {
|
||||
serialize: paramsSerializer
|
||||
}
|
||||
} else {
|
||||
validator.assertOptions(paramsSerializer, {
|
||||
encode: validators.function,
|
||||
serialize: validators.function
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
var promise;
|
||||
|
||||
// Set config.method
|
||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||
if (!synchronousRequestInterceptors) {
|
||||
var chain = [dispatchRequest, undefined];
|
||||
|
||||
// Flatten headers
|
||||
let contextHeaders = headers && utils.merge(
|
||||
headers.common,
|
||||
headers[config.method]
|
||||
);
|
||||
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
||||
chain = chain.concat(responseInterceptorChain);
|
||||
|
||||
headers && utils.forEach(
|
||||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||
(method) => {
|
||||
delete headers[method];
|
||||
}
|
||||
);
|
||||
|
||||
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
||||
|
||||
// filter out skipped interceptors
|
||||
const requestInterceptorChain = [];
|
||||
let synchronousRequestInterceptors = true;
|
||||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||||
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
||||
|
||||
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
|
||||
const responseInterceptorChain = [];
|
||||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||||
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
|
||||
let promise;
|
||||
let i = 0;
|
||||
let len;
|
||||
|
||||
if (!synchronousRequestInterceptors) {
|
||||
const chain = [dispatchRequest.bind(this), undefined];
|
||||
chain.unshift.apply(chain, requestInterceptorChain);
|
||||
chain.push.apply(chain, responseInterceptorChain);
|
||||
len = chain.length;
|
||||
|
||||
promise = Promise.resolve(config);
|
||||
|
||||
while (i < len) {
|
||||
promise = promise.then(chain[i++], chain[i++]);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
len = requestInterceptorChain.length;
|
||||
|
||||
let newConfig = config;
|
||||
|
||||
i = 0;
|
||||
|
||||
while (i < len) {
|
||||
const onFulfilled = requestInterceptorChain[i++];
|
||||
const onRejected = requestInterceptorChain[i++];
|
||||
try {
|
||||
newConfig = onFulfilled(newConfig);
|
||||
} catch (error) {
|
||||
onRejected.call(this, error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
promise = dispatchRequest.call(this, newConfig);
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
len = responseInterceptorChain.length;
|
||||
|
||||
while (i < len) {
|
||||
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
||||
promise = Promise.resolve(config);
|
||||
while (chain.length) {
|
||||
promise = promise.then(chain.shift(), chain.shift());
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
getUri(config) {
|
||||
config = mergeConfig(this.defaults, config);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
return buildURL(fullPath, config.params, config.paramsSerializer);
|
||||
|
||||
var newConfig = config;
|
||||
while (requestInterceptorChain.length) {
|
||||
var onFulfilled = requestInterceptorChain.shift();
|
||||
var onRejected = requestInterceptorChain.shift();
|
||||
try {
|
||||
newConfig = onFulfilled(newConfig);
|
||||
} catch (error) {
|
||||
onRejected(error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
promise = dispatchRequest(newConfig);
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
while (responseInterceptorChain.length) {
|
||||
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
Axios.prototype.getUri = function getUri(config) {
|
||||
config = mergeConfig(this.defaults, config);
|
||||
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||
return buildURL(fullPath, config.params, config.paramsSerializer);
|
||||
};
|
||||
|
||||
// Provide aliases for supported request methods
|
||||
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||||
/*eslint func-names:0*/
|
||||
Axios.prototype[method] = function(url, config) {
|
||||
return this.request(mergeConfig(config || {}, {
|
||||
method,
|
||||
url,
|
||||
method: method,
|
||||
url: url,
|
||||
data: (config || {}).data
|
||||
}));
|
||||
};
|
||||
@ -210,12 +142,12 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||
function generateHTTPMethod(isForm) {
|
||||
return function httpMethod(url, data, config) {
|
||||
return this.request(mergeConfig(config || {}, {
|
||||
method,
|
||||
method: method,
|
||||
headers: isForm ? {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
} : {},
|
||||
url,
|
||||
data
|
||||
url: url,
|
||||
data: data
|
||||
}));
|
||||
};
|
||||
}
|
||||
@ -225,4 +157,4 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
||||
});
|
||||
|
||||
export default Axios;
|
||||
module.exports = Axios;
|
||||
|
||||
39
java-mall-app-shop-admin/node_modules/axios/lib/core/AxiosError.js
generated
vendored
39
java-mall-app-shop-admin/node_modules/axios/lib/core/AxiosError.js
generated
vendored
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from '../utils.js';
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Create an Error with the specified message, config, error code, request and response.
|
||||
@ -10,27 +10,16 @@ import utils from '../utils.js';
|
||||
* @param {Object} [config] The config.
|
||||
* @param {Object} [request] The request.
|
||||
* @param {Object} [response] The response.
|
||||
*
|
||||
* @returns {Error} The created error.
|
||||
*/
|
||||
function AxiosError(message, code, config, request, response) {
|
||||
Error.call(this);
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
this.stack = (new Error()).stack;
|
||||
}
|
||||
|
||||
this.message = message;
|
||||
this.name = 'AxiosError';
|
||||
code && (this.code = code);
|
||||
config && (this.config = config);
|
||||
request && (this.request = request);
|
||||
if (response) {
|
||||
this.response = response;
|
||||
this.status = response.status ? response.status : null;
|
||||
}
|
||||
response && (this.response = response);
|
||||
}
|
||||
|
||||
utils.inherits(AxiosError, Error, {
|
||||
@ -48,15 +37,15 @@ utils.inherits(AxiosError, Error, {
|
||||
columnNumber: this.columnNumber,
|
||||
stack: this.stack,
|
||||
// Axios
|
||||
config: utils.toJSONObject(this.config),
|
||||
config: this.config,
|
||||
code: this.code,
|
||||
status: this.status
|
||||
status: this.response && this.response.status ? this.response.status : null
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const prototype = AxiosError.prototype;
|
||||
const descriptors = {};
|
||||
var prototype = AxiosError.prototype;
|
||||
var descriptors = {};
|
||||
|
||||
[
|
||||
'ERR_BAD_OPTION_VALUE',
|
||||
@ -68,11 +57,9 @@ const descriptors = {};
|
||||
'ERR_DEPRECATED',
|
||||
'ERR_BAD_RESPONSE',
|
||||
'ERR_BAD_REQUEST',
|
||||
'ERR_CANCELED',
|
||||
'ERR_NOT_SUPPORT',
|
||||
'ERR_INVALID_URL'
|
||||
'ERR_CANCELED'
|
||||
// eslint-disable-next-line func-names
|
||||
].forEach(code => {
|
||||
].forEach(function(code) {
|
||||
descriptors[code] = {value: code};
|
||||
});
|
||||
|
||||
@ -80,19 +67,15 @@ Object.defineProperties(AxiosError, descriptors);
|
||||
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
AxiosError.from = (error, code, config, request, response, customProps) => {
|
||||
const axiosError = Object.create(prototype);
|
||||
AxiosError.from = function(error, code, config, request, response, customProps) {
|
||||
var axiosError = Object.create(prototype);
|
||||
|
||||
utils.toFlatObject(error, axiosError, function filter(obj) {
|
||||
return obj !== Error.prototype;
|
||||
}, prop => {
|
||||
return prop !== 'isAxiosError';
|
||||
});
|
||||
|
||||
AxiosError.call(axiosError, error.message, code, config, request, response);
|
||||
|
||||
axiosError.cause = error;
|
||||
|
||||
axiosError.name = error.name;
|
||||
|
||||
customProps && Object.assign(axiosError, customProps);
|
||||
@ -100,4 +83,4 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
||||
return axiosError;
|
||||
};
|
||||
|
||||
export default AxiosError;
|
||||
module.exports = AxiosError;
|
||||
|
||||
302
java-mall-app-shop-admin/node_modules/axios/lib/core/AxiosHeaders.js
generated
vendored
302
java-mall-app-shop-admin/node_modules/axios/lib/core/AxiosHeaders.js
generated
vendored
@ -1,302 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import utils from '../utils.js';
|
||||
import parseHeaders from '../helpers/parseHeaders.js';
|
||||
|
||||
const $internals = Symbol('internals');
|
||||
|
||||
function normalizeHeader(header) {
|
||||
return header && String(header).trim().toLowerCase();
|
||||
}
|
||||
|
||||
function normalizeValue(value) {
|
||||
if (value === false || value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
||||
}
|
||||
|
||||
function parseTokens(str) {
|
||||
const tokens = Object.create(null);
|
||||
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
||||
let match;
|
||||
|
||||
while ((match = tokensRE.exec(str))) {
|
||||
tokens[match[1]] = match[2];
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
||||
|
||||
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
||||
if (utils.isFunction(filter)) {
|
||||
return filter.call(this, value, header);
|
||||
}
|
||||
|
||||
if (isHeaderNameFilter) {
|
||||
value = header;
|
||||
}
|
||||
|
||||
if (!utils.isString(value)) return;
|
||||
|
||||
if (utils.isString(filter)) {
|
||||
return value.indexOf(filter) !== -1;
|
||||
}
|
||||
|
||||
if (utils.isRegExp(filter)) {
|
||||
return filter.test(value);
|
||||
}
|
||||
}
|
||||
|
||||
function formatHeader(header) {
|
||||
return header.trim()
|
||||
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
||||
return char.toUpperCase() + str;
|
||||
});
|
||||
}
|
||||
|
||||
function buildAccessors(obj, header) {
|
||||
const accessorName = utils.toCamelCase(' ' + header);
|
||||
|
||||
['get', 'set', 'has'].forEach(methodName => {
|
||||
Object.defineProperty(obj, methodName + accessorName, {
|
||||
value: function(arg1, arg2, arg3) {
|
||||
return this[methodName].call(this, header, arg1, arg2, arg3);
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class AxiosHeaders {
|
||||
constructor(headers) {
|
||||
headers && this.set(headers);
|
||||
}
|
||||
|
||||
set(header, valueOrRewrite, rewrite) {
|
||||
const self = this;
|
||||
|
||||
function setHeader(_value, _header, _rewrite) {
|
||||
const lHeader = normalizeHeader(_header);
|
||||
|
||||
if (!lHeader) {
|
||||
throw new Error('header name must be a non-empty string');
|
||||
}
|
||||
|
||||
const key = utils.findKey(self, lHeader);
|
||||
|
||||
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
||||
self[key || _header] = normalizeValue(_value);
|
||||
}
|
||||
}
|
||||
|
||||
const setHeaders = (headers, _rewrite) =>
|
||||
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
||||
|
||||
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
||||
setHeaders(header, valueOrRewrite)
|
||||
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
||||
setHeaders(parseHeaders(header), valueOrRewrite);
|
||||
} else if (utils.isHeaders(header)) {
|
||||
for (const [key, value] of header.entries()) {
|
||||
setHeader(value, key, rewrite);
|
||||
}
|
||||
} else {
|
||||
header != null && setHeader(valueOrRewrite, header, rewrite);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
get(header, parser) {
|
||||
header = normalizeHeader(header);
|
||||
|
||||
if (header) {
|
||||
const key = utils.findKey(this, header);
|
||||
|
||||
if (key) {
|
||||
const value = this[key];
|
||||
|
||||
if (!parser) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (parser === true) {
|
||||
return parseTokens(value);
|
||||
}
|
||||
|
||||
if (utils.isFunction(parser)) {
|
||||
return parser.call(this, value, key);
|
||||
}
|
||||
|
||||
if (utils.isRegExp(parser)) {
|
||||
return parser.exec(value);
|
||||
}
|
||||
|
||||
throw new TypeError('parser must be boolean|regexp|function');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
has(header, matcher) {
|
||||
header = normalizeHeader(header);
|
||||
|
||||
if (header) {
|
||||
const key = utils.findKey(this, header);
|
||||
|
||||
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
delete(header, matcher) {
|
||||
const self = this;
|
||||
let deleted = false;
|
||||
|
||||
function deleteHeader(_header) {
|
||||
_header = normalizeHeader(_header);
|
||||
|
||||
if (_header) {
|
||||
const key = utils.findKey(self, _header);
|
||||
|
||||
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
||||
delete self[key];
|
||||
|
||||
deleted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (utils.isArray(header)) {
|
||||
header.forEach(deleteHeader);
|
||||
} else {
|
||||
deleteHeader(header);
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
clear(matcher) {
|
||||
const keys = Object.keys(this);
|
||||
let i = keys.length;
|
||||
let deleted = false;
|
||||
|
||||
while (i--) {
|
||||
const key = keys[i];
|
||||
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
||||
delete this[key];
|
||||
deleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
normalize(format) {
|
||||
const self = this;
|
||||
const headers = {};
|
||||
|
||||
utils.forEach(this, (value, header) => {
|
||||
const key = utils.findKey(headers, header);
|
||||
|
||||
if (key) {
|
||||
self[key] = normalizeValue(value);
|
||||
delete self[header];
|
||||
return;
|
||||
}
|
||||
|
||||
const normalized = format ? formatHeader(header) : String(header).trim();
|
||||
|
||||
if (normalized !== header) {
|
||||
delete self[header];
|
||||
}
|
||||
|
||||
self[normalized] = normalizeValue(value);
|
||||
|
||||
headers[normalized] = true;
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
concat(...targets) {
|
||||
return this.constructor.concat(this, ...targets);
|
||||
}
|
||||
|
||||
toJSON(asStrings) {
|
||||
const obj = Object.create(null);
|
||||
|
||||
utils.forEach(this, (value, header) => {
|
||||
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
[Symbol.iterator]() {
|
||||
return Object.entries(this.toJSON())[Symbol.iterator]();
|
||||
}
|
||||
|
||||
toString() {
|
||||
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
return 'AxiosHeaders';
|
||||
}
|
||||
|
||||
static from(thing) {
|
||||
return thing instanceof this ? thing : new this(thing);
|
||||
}
|
||||
|
||||
static concat(first, ...targets) {
|
||||
const computed = new this(first);
|
||||
|
||||
targets.forEach((target) => computed.set(target));
|
||||
|
||||
return computed;
|
||||
}
|
||||
|
||||
static accessor(header) {
|
||||
const internals = this[$internals] = (this[$internals] = {
|
||||
accessors: {}
|
||||
});
|
||||
|
||||
const accessors = internals.accessors;
|
||||
const prototype = this.prototype;
|
||||
|
||||
function defineAccessor(_header) {
|
||||
const lHeader = normalizeHeader(_header);
|
||||
|
||||
if (!accessors[lHeader]) {
|
||||
buildAccessors(prototype, _header);
|
||||
accessors[lHeader] = true;
|
||||
}
|
||||
}
|
||||
|
||||
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
||||
|
||||
// reserved names hotfix
|
||||
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
||||
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
||||
return {
|
||||
get: () => value,
|
||||
set(headerValue) {
|
||||
this[mapped] = headerValue;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
utils.freezeMethods(AxiosHeaders);
|
||||
|
||||
export default AxiosHeaders;
|
||||
115
java-mall-app-shop-admin/node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
115
java-mall-app-shop-admin/node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
@ -1,71 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
var utils = require('./../utils');
|
||||
|
||||
class InterceptorManager {
|
||||
constructor() {
|
||||
this.handlers = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new interceptor to the stack
|
||||
*
|
||||
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||
*
|
||||
* @return {Number} An ID used to remove interceptor later
|
||||
*/
|
||||
use(fulfilled, rejected, options) {
|
||||
this.handlers.push({
|
||||
fulfilled,
|
||||
rejected,
|
||||
synchronous: options ? options.synchronous : false,
|
||||
runWhen: options ? options.runWhen : null
|
||||
});
|
||||
return this.handlers.length - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an interceptor from the stack
|
||||
*
|
||||
* @param {Number} id The ID that was returned by `use`
|
||||
*
|
||||
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
||||
*/
|
||||
eject(id) {
|
||||
if (this.handlers[id]) {
|
||||
this.handlers[id] = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all interceptors from the stack
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
clear() {
|
||||
if (this.handlers) {
|
||||
this.handlers = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over all the registered interceptors
|
||||
*
|
||||
* This method is particularly useful for skipping over any
|
||||
* interceptors that may have become `null` calling `eject`.
|
||||
*
|
||||
* @param {Function} fn The function to call for each interceptor
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
forEach(fn) {
|
||||
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||
if (h !== null) {
|
||||
fn(h);
|
||||
}
|
||||
});
|
||||
}
|
||||
function InterceptorManager() {
|
||||
this.handlers = [];
|
||||
}
|
||||
|
||||
export default InterceptorManager;
|
||||
/**
|
||||
* Add a new interceptor to the stack
|
||||
*
|
||||
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||
*
|
||||
* @return {Number} An ID used to remove interceptor later
|
||||
*/
|
||||
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
||||
this.handlers.push({
|
||||
fulfilled: fulfilled,
|
||||
rejected: rejected,
|
||||
synchronous: options ? options.synchronous : false,
|
||||
runWhen: options ? options.runWhen : null
|
||||
});
|
||||
return this.handlers.length - 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove an interceptor from the stack
|
||||
*
|
||||
* @param {Number} id The ID that was returned by `use`
|
||||
*/
|
||||
InterceptorManager.prototype.eject = function eject(id) {
|
||||
if (this.handlers[id]) {
|
||||
this.handlers[id] = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterate over all the registered interceptors
|
||||
*
|
||||
* This method is particularly useful for skipping over any
|
||||
* interceptors that may have become `null` calling `eject`.
|
||||
*
|
||||
* @param {Function} fn The function to call for each interceptor
|
||||
*/
|
||||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||
if (h !== null) {
|
||||
fn(h);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = InterceptorManager;
|
||||
|
||||
9
java-mall-app-shop-admin/node_modules/axios/lib/core/buildFullPath.js
generated
vendored
9
java-mall-app-shop-admin/node_modules/axios/lib/core/buildFullPath.js
generated
vendored
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import isAbsoluteURL from '../helpers/isAbsoluteURL.js';
|
||||
import combineURLs from '../helpers/combineURLs.js';
|
||||
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
|
||||
var combineURLs = require('../helpers/combineURLs');
|
||||
|
||||
/**
|
||||
* Creates a new URL by combining the baseURL with the requestedURL,
|
||||
@ -10,12 +10,11 @@ import combineURLs from '../helpers/combineURLs.js';
|
||||
*
|
||||
* @param {string} baseURL The base URL
|
||||
* @param {string} requestedURL Absolute or relative URL to combine
|
||||
*
|
||||
* @returns {string} The combined full path
|
||||
*/
|
||||
export default function buildFullPath(baseURL, requestedURL) {
|
||||
module.exports = function buildFullPath(baseURL, requestedURL) {
|
||||
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
||||
return combineURLs(baseURL, requestedURL);
|
||||
}
|
||||
return requestedURL;
|
||||
}
|
||||
};
|
||||
|
||||
58
java-mall-app-shop-admin/node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
58
java-mall-app-shop-admin/node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
@ -1,18 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
import transformData from './transformData.js';
|
||||
import isCancel from '../cancel/isCancel.js';
|
||||
import defaults from '../defaults/index.js';
|
||||
import CanceledError from '../cancel/CanceledError.js';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
import adapters from "../adapters/adapters.js";
|
||||
var utils = require('./../utils');
|
||||
var transformData = require('./transformData');
|
||||
var isCancel = require('../cancel/isCancel');
|
||||
var defaults = require('../defaults');
|
||||
var CanceledError = require('../cancel/CanceledError');
|
||||
|
||||
/**
|
||||
* Throws a `CanceledError` if cancellation has been requested.
|
||||
*
|
||||
* @param {Object} config The config that is to be used for the request
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function throwIfCancellationRequested(config) {
|
||||
if (config.cancelToken) {
|
||||
@ -20,7 +15,7 @@ function throwIfCancellationRequested(config) {
|
||||
}
|
||||
|
||||
if (config.signal && config.signal.aborted) {
|
||||
throw new CanceledError(null, config);
|
||||
throw new CanceledError();
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,25 +23,37 @@ function throwIfCancellationRequested(config) {
|
||||
* Dispatch a request to the server using the configured adapter.
|
||||
*
|
||||
* @param {object} config The config that is to be used for the request
|
||||
*
|
||||
* @returns {Promise} The Promise to be fulfilled
|
||||
*/
|
||||
export default function dispatchRequest(config) {
|
||||
module.exports = function dispatchRequest(config) {
|
||||
throwIfCancellationRequested(config);
|
||||
|
||||
config.headers = AxiosHeaders.from(config.headers);
|
||||
// Ensure headers exist
|
||||
config.headers = config.headers || {};
|
||||
|
||||
// Transform request data
|
||||
config.data = transformData.call(
|
||||
config,
|
||||
config.data,
|
||||
config.headers,
|
||||
config.transformRequest
|
||||
);
|
||||
|
||||
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
||||
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
||||
}
|
||||
// Flatten headers
|
||||
config.headers = utils.merge(
|
||||
config.headers.common || {},
|
||||
config.headers[config.method] || {},
|
||||
config.headers
|
||||
);
|
||||
|
||||
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
||||
utils.forEach(
|
||||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||
function cleanHeaderConfig(method) {
|
||||
delete config.headers[method];
|
||||
}
|
||||
);
|
||||
|
||||
var adapter = config.adapter || defaults.adapter;
|
||||
|
||||
return adapter(config).then(function onAdapterResolution(response) {
|
||||
throwIfCancellationRequested(config);
|
||||
@ -54,12 +61,11 @@ export default function dispatchRequest(config) {
|
||||
// Transform response data
|
||||
response.data = transformData.call(
|
||||
config,
|
||||
config.transformResponse,
|
||||
response
|
||||
response.data,
|
||||
response.headers,
|
||||
config.transformResponse
|
||||
);
|
||||
|
||||
response.headers = AxiosHeaders.from(response.headers);
|
||||
|
||||
return response;
|
||||
}, function onAdapterRejection(reason) {
|
||||
if (!isCancel(reason)) {
|
||||
@ -69,13 +75,13 @@ export default function dispatchRequest(config) {
|
||||
if (reason && reason.response) {
|
||||
reason.response.data = transformData.call(
|
||||
config,
|
||||
config.transformResponse,
|
||||
reason.response
|
||||
reason.response.data,
|
||||
reason.response.headers,
|
||||
config.transformResponse
|
||||
);
|
||||
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.reject(reason);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
112
java-mall-app-shop-admin/node_modules/axios/lib/core/mergeConfig.js
generated
vendored
112
java-mall-app-shop-admin/node_modules/axios/lib/core/mergeConfig.js
generated
vendored
@ -1,9 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import utils from '../utils.js';
|
||||
import AxiosHeaders from "./AxiosHeaders.js";
|
||||
|
||||
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
||||
var utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Config-specific merge-function which creates a new config-object
|
||||
@ -11,17 +8,16 @@ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing }
|
||||
*
|
||||
* @param {Object} config1
|
||||
* @param {Object} config2
|
||||
*
|
||||
* @returns {Object} New object resulting from merging config2 to config1
|
||||
*/
|
||||
export default function mergeConfig(config1, config2) {
|
||||
module.exports = function mergeConfig(config1, config2) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
config2 = config2 || {};
|
||||
const config = {};
|
||||
var config = {};
|
||||
|
||||
function getMergedValue(target, source, caseless) {
|
||||
function getMergedValue(target, source) {
|
||||
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||
return utils.merge.call({caseless}, target, source);
|
||||
return utils.merge(target, source);
|
||||
} else if (utils.isPlainObject(source)) {
|
||||
return utils.merge({}, source);
|
||||
} else if (utils.isArray(source)) {
|
||||
@ -31,76 +27,74 @@ export default function mergeConfig(config1, config2) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDeepProperties(a, b, caseless) {
|
||||
if (!utils.isUndefined(b)) {
|
||||
return getMergedValue(a, b, caseless);
|
||||
} else if (!utils.isUndefined(a)) {
|
||||
return getMergedValue(undefined, a, caseless);
|
||||
function mergeDeepProperties(prop) {
|
||||
if (!utils.isUndefined(config2[prop])) {
|
||||
return getMergedValue(config1[prop], config2[prop]);
|
||||
} else if (!utils.isUndefined(config1[prop])) {
|
||||
return getMergedValue(undefined, config1[prop]);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function valueFromConfig2(a, b) {
|
||||
if (!utils.isUndefined(b)) {
|
||||
return getMergedValue(undefined, b);
|
||||
function valueFromConfig2(prop) {
|
||||
if (!utils.isUndefined(config2[prop])) {
|
||||
return getMergedValue(undefined, config2[prop]);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function defaultToConfig2(a, b) {
|
||||
if (!utils.isUndefined(b)) {
|
||||
return getMergedValue(undefined, b);
|
||||
} else if (!utils.isUndefined(a)) {
|
||||
return getMergedValue(undefined, a);
|
||||
function defaultToConfig2(prop) {
|
||||
if (!utils.isUndefined(config2[prop])) {
|
||||
return getMergedValue(undefined, config2[prop]);
|
||||
} else if (!utils.isUndefined(config1[prop])) {
|
||||
return getMergedValue(undefined, config1[prop]);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
function mergeDirectKeys(a, b, prop) {
|
||||
function mergeDirectKeys(prop) {
|
||||
if (prop in config2) {
|
||||
return getMergedValue(a, b);
|
||||
return getMergedValue(config1[prop], config2[prop]);
|
||||
} else if (prop in config1) {
|
||||
return getMergedValue(undefined, a);
|
||||
return getMergedValue(undefined, config1[prop]);
|
||||
}
|
||||
}
|
||||
|
||||
const mergeMap = {
|
||||
url: valueFromConfig2,
|
||||
method: valueFromConfig2,
|
||||
data: valueFromConfig2,
|
||||
baseURL: defaultToConfig2,
|
||||
transformRequest: defaultToConfig2,
|
||||
transformResponse: defaultToConfig2,
|
||||
paramsSerializer: defaultToConfig2,
|
||||
timeout: defaultToConfig2,
|
||||
timeoutMessage: defaultToConfig2,
|
||||
withCredentials: defaultToConfig2,
|
||||
withXSRFToken: defaultToConfig2,
|
||||
adapter: defaultToConfig2,
|
||||
responseType: defaultToConfig2,
|
||||
xsrfCookieName: defaultToConfig2,
|
||||
xsrfHeaderName: defaultToConfig2,
|
||||
onUploadProgress: defaultToConfig2,
|
||||
onDownloadProgress: defaultToConfig2,
|
||||
decompress: defaultToConfig2,
|
||||
maxContentLength: defaultToConfig2,
|
||||
maxBodyLength: defaultToConfig2,
|
||||
beforeRedirect: defaultToConfig2,
|
||||
transport: defaultToConfig2,
|
||||
httpAgent: defaultToConfig2,
|
||||
httpsAgent: defaultToConfig2,
|
||||
cancelToken: defaultToConfig2,
|
||||
socketPath: defaultToConfig2,
|
||||
responseEncoding: defaultToConfig2,
|
||||
validateStatus: mergeDirectKeys,
|
||||
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
||||
var mergeMap = {
|
||||
'url': valueFromConfig2,
|
||||
'method': valueFromConfig2,
|
||||
'data': valueFromConfig2,
|
||||
'baseURL': defaultToConfig2,
|
||||
'transformRequest': defaultToConfig2,
|
||||
'transformResponse': defaultToConfig2,
|
||||
'paramsSerializer': defaultToConfig2,
|
||||
'timeout': defaultToConfig2,
|
||||
'timeoutMessage': defaultToConfig2,
|
||||
'withCredentials': defaultToConfig2,
|
||||
'adapter': defaultToConfig2,
|
||||
'responseType': defaultToConfig2,
|
||||
'xsrfCookieName': defaultToConfig2,
|
||||
'xsrfHeaderName': defaultToConfig2,
|
||||
'onUploadProgress': defaultToConfig2,
|
||||
'onDownloadProgress': defaultToConfig2,
|
||||
'decompress': defaultToConfig2,
|
||||
'maxContentLength': defaultToConfig2,
|
||||
'maxBodyLength': defaultToConfig2,
|
||||
'beforeRedirect': defaultToConfig2,
|
||||
'transport': defaultToConfig2,
|
||||
'httpAgent': defaultToConfig2,
|
||||
'httpsAgent': defaultToConfig2,
|
||||
'cancelToken': defaultToConfig2,
|
||||
'socketPath': defaultToConfig2,
|
||||
'responseEncoding': defaultToConfig2,
|
||||
'validateStatus': mergeDirectKeys
|
||||
};
|
||||
|
||||
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
||||
const merge = mergeMap[prop] || mergeDeepProperties;
|
||||
const configValue = merge(config1[prop], config2[prop], prop);
|
||||
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
||||
var merge = mergeMap[prop] || mergeDeepProperties;
|
||||
var configValue = merge(prop);
|
||||
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
||||
});
|
||||
|
||||
return config;
|
||||
}
|
||||
};
|
||||
|
||||
10
java-mall-app-shop-admin/node_modules/axios/lib/core/settle.js
generated
vendored
10
java-mall-app-shop-admin/node_modules/axios/lib/core/settle.js
generated
vendored
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import AxiosError from './AxiosError.js';
|
||||
var AxiosError = require('./AxiosError');
|
||||
|
||||
/**
|
||||
* Resolve or reject a Promise based on response status.
|
||||
@ -8,11 +8,9 @@ import AxiosError from './AxiosError.js';
|
||||
* @param {Function} resolve A function that resolves the promise.
|
||||
* @param {Function} reject A function that rejects the promise.
|
||||
* @param {object} response The response.
|
||||
*
|
||||
* @returns {object} The response.
|
||||
*/
|
||||
export default function settle(resolve, reject, response) {
|
||||
const validateStatus = response.config.validateStatus;
|
||||
module.exports = function settle(resolve, reject, response) {
|
||||
var validateStatus = response.config.validateStatus;
|
||||
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
||||
resolve(response);
|
||||
} else {
|
||||
@ -24,4 +22,4 @@ export default function settle(resolve, reject, response) {
|
||||
response
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
24
java-mall-app-shop-admin/node_modules/axios/lib/core/transformData.js
generated
vendored
24
java-mall-app-shop-admin/node_modules/axios/lib/core/transformData.js
generated
vendored
@ -1,28 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import defaults from '../defaults/index.js';
|
||||
import AxiosHeaders from '../core/AxiosHeaders.js';
|
||||
var utils = require('./../utils');
|
||||
var defaults = require('../defaults');
|
||||
|
||||
/**
|
||||
* Transform the data for a request or a response
|
||||
*
|
||||
* @param {Object|String} data The data to be transformed
|
||||
* @param {Array} headers The headers for the request or response
|
||||
* @param {Array|Function} fns A single function or Array of functions
|
||||
* @param {?Object} response The response object
|
||||
*
|
||||
* @returns {*} The resulting transformed data
|
||||
*/
|
||||
export default function transformData(fns, response) {
|
||||
const config = this || defaults;
|
||||
const context = response || config;
|
||||
const headers = AxiosHeaders.from(context.headers);
|
||||
let data = context.data;
|
||||
|
||||
module.exports = function transformData(data, headers, fns) {
|
||||
var context = this || defaults;
|
||||
/*eslint no-param-reassign:0*/
|
||||
utils.forEach(fns, function transform(fn) {
|
||||
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
||||
data = fn.call(context, data, headers);
|
||||
});
|
||||
|
||||
headers.normalize();
|
||||
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
127
java-mall-app-shop-admin/node_modules/axios/lib/defaults/index.js
generated
vendored
127
java-mall-app-shop-admin/node_modules/axios/lib/defaults/index.js
generated
vendored
@ -1,23 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
import utils from '../utils.js';
|
||||
import AxiosError from '../core/AxiosError.js';
|
||||
import transitionalDefaults from './transitional.js';
|
||||
import toFormData from '../helpers/toFormData.js';
|
||||
import toURLEncodedForm from '../helpers/toURLEncodedForm.js';
|
||||
import platform from '../platform/index.js';
|
||||
import formDataToJSON from '../helpers/formDataToJSON.js';
|
||||
var utils = require('../utils');
|
||||
var normalizeHeaderName = require('../helpers/normalizeHeaderName');
|
||||
var AxiosError = require('../core/AxiosError');
|
||||
var transitionalDefaults = require('./transitional');
|
||||
var toFormData = require('../helpers/toFormData');
|
||||
|
||||
var DEFAULT_CONTENT_TYPE = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
function setContentTypeIfUnset(headers, value) {
|
||||
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||||
headers['Content-Type'] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultAdapter() {
|
||||
var adapter;
|
||||
if (typeof XMLHttpRequest !== 'undefined') {
|
||||
// For browsers use XHR adapter
|
||||
adapter = require('../adapters/xhr');
|
||||
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
||||
// For node use HTTP adapter
|
||||
adapter = require('../adapters/http');
|
||||
}
|
||||
return adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
||||
* of the input
|
||||
*
|
||||
* @param {any} rawValue - The value to be stringified.
|
||||
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
||||
* @param {Function} encoder - A function that takes a value and returns a string.
|
||||
*
|
||||
* @returns {string} A stringified version of the rawValue.
|
||||
*/
|
||||
function stringifySafely(rawValue, parser, encoder) {
|
||||
if (utils.isString(rawValue)) {
|
||||
try {
|
||||
@ -33,33 +43,22 @@ function stringifySafely(rawValue, parser, encoder) {
|
||||
return (encoder || JSON.stringify)(rawValue);
|
||||
}
|
||||
|
||||
const defaults = {
|
||||
var defaults = {
|
||||
|
||||
transitional: transitionalDefaults,
|
||||
|
||||
adapter: ['xhr', 'http', 'fetch'],
|
||||
adapter: getDefaultAdapter(),
|
||||
|
||||
transformRequest: [function transformRequest(data, headers) {
|
||||
const contentType = headers.getContentType() || '';
|
||||
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
||||
const isObjectPayload = utils.isObject(data);
|
||||
normalizeHeaderName(headers, 'Accept');
|
||||
normalizeHeaderName(headers, 'Content-Type');
|
||||
|
||||
if (isObjectPayload && utils.isHTMLForm(data)) {
|
||||
data = new FormData(data);
|
||||
}
|
||||
|
||||
const isFormData = utils.isFormData(data);
|
||||
|
||||
if (isFormData) {
|
||||
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
||||
}
|
||||
|
||||
if (utils.isArrayBuffer(data) ||
|
||||
if (utils.isFormData(data) ||
|
||||
utils.isArrayBuffer(data) ||
|
||||
utils.isBuffer(data) ||
|
||||
utils.isStream(data) ||
|
||||
utils.isFile(data) ||
|
||||
utils.isBlob(data) ||
|
||||
utils.isReadableStream(data)
|
||||
utils.isBlob(data)
|
||||
) {
|
||||
return data;
|
||||
}
|
||||
@ -67,30 +66,20 @@ const defaults = {
|
||||
return data.buffer;
|
||||
}
|
||||
if (utils.isURLSearchParams(data)) {
|
||||
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
||||
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
let isFileList;
|
||||
var isObjectPayload = utils.isObject(data);
|
||||
var contentType = headers && headers['Content-Type'];
|
||||
|
||||
if (isObjectPayload) {
|
||||
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
||||
return toURLEncodedForm(data, this.formSerializer).toString();
|
||||
}
|
||||
var isFileList;
|
||||
|
||||
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
||||
const _FormData = this.env && this.env.FormData;
|
||||
|
||||
return toFormData(
|
||||
isFileList ? {'files[]': data} : data,
|
||||
_FormData && new _FormData(),
|
||||
this.formSerializer
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isObjectPayload || hasJSONContentType ) {
|
||||
headers.setContentType('application/json', false);
|
||||
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
|
||||
var _FormData = this.env && this.env.FormData;
|
||||
return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
|
||||
} else if (isObjectPayload || contentType === 'application/json') {
|
||||
setContentTypeIfUnset(headers, 'application/json');
|
||||
return stringifySafely(data);
|
||||
}
|
||||
|
||||
@ -98,18 +87,12 @@ const defaults = {
|
||||
}],
|
||||
|
||||
transformResponse: [function transformResponse(data) {
|
||||
const transitional = this.transitional || defaults.transitional;
|
||||
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
||||
const JSONRequested = this.responseType === 'json';
|
||||
|
||||
if (utils.isResponse(data) || utils.isReadableStream(data)) {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
||||
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
||||
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
||||
var transitional = this.transitional || defaults.transitional;
|
||||
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
||||
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
||||
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
||||
|
||||
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
} catch (e) {
|
||||
@ -138,8 +121,7 @@ const defaults = {
|
||||
maxBodyLength: -1,
|
||||
|
||||
env: {
|
||||
FormData: platform.classes.FormData,
|
||||
Blob: platform.classes.Blob
|
||||
FormData: require('./env/FormData')
|
||||
},
|
||||
|
||||
validateStatus: function validateStatus(status) {
|
||||
@ -148,14 +130,17 @@ const defaults = {
|
||||
|
||||
headers: {
|
||||
common: {
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Content-Type': undefined
|
||||
'Accept': 'application/json, text/plain, */*'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
||||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||
defaults.headers[method] = {};
|
||||
});
|
||||
|
||||
export default defaults;
|
||||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||
});
|
||||
|
||||
module.exports = defaults;
|
||||
|
||||
2
java-mall-app-shop-admin/node_modules/axios/lib/defaults/transitional.js
generated
vendored
2
java-mall-app-shop-admin/node_modules/axios/lib/defaults/transitional.js
generated
vendored
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
export default {
|
||||
module.exports = {
|
||||
silentJSONParsing: true,
|
||||
forcedJSONParsing: true,
|
||||
clarifyTimeoutError: false
|
||||
|
||||
2
java-mall-app-shop-admin/node_modules/axios/lib/env/classes/FormData.js
generated
vendored
2
java-mall-app-shop-admin/node_modules/axios/lib/env/classes/FormData.js
generated
vendored
@ -1,2 +0,0 @@
|
||||
import _FormData from 'form-data';
|
||||
export default typeof FormData !== 'undefined' ? FormData : _FormData;
|
||||
4
java-mall-app-shop-admin/node_modules/axios/lib/env/data.js
generated
vendored
4
java-mall-app-shop-admin/node_modules/axios/lib/env/data.js
generated
vendored
@ -1 +1,3 @@
|
||||
export const VERSION = "1.7.7";
|
||||
module.exports = {
|
||||
"version": "0.27.2"
|
||||
};
|
||||
143
java-mall-app-shop-admin/node_modules/axios/lib/helpers/AxiosTransformStream.js
generated
vendored
143
java-mall-app-shop-admin/node_modules/axios/lib/helpers/AxiosTransformStream.js
generated
vendored
@ -1,143 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import stream from 'stream';
|
||||
import utils from '../utils.js';
|
||||
|
||||
const kInternals = Symbol('internals');
|
||||
|
||||
class AxiosTransformStream extends stream.Transform{
|
||||
constructor(options) {
|
||||
options = utils.toFlatObject(options, {
|
||||
maxRate: 0,
|
||||
chunkSize: 64 * 1024,
|
||||
minChunkSize: 100,
|
||||
timeWindow: 500,
|
||||
ticksRate: 2,
|
||||
samplesCount: 15
|
||||
}, null, (prop, source) => {
|
||||
return !utils.isUndefined(source[prop]);
|
||||
});
|
||||
|
||||
super({
|
||||
readableHighWaterMark: options.chunkSize
|
||||
});
|
||||
|
||||
const internals = this[kInternals] = {
|
||||
timeWindow: options.timeWindow,
|
||||
chunkSize: options.chunkSize,
|
||||
maxRate: options.maxRate,
|
||||
minChunkSize: options.minChunkSize,
|
||||
bytesSeen: 0,
|
||||
isCaptured: false,
|
||||
notifiedBytesLoaded: 0,
|
||||
ts: Date.now(),
|
||||
bytes: 0,
|
||||
onReadCallback: null
|
||||
};
|
||||
|
||||
this.on('newListener', event => {
|
||||
if (event === 'progress') {
|
||||
if (!internals.isCaptured) {
|
||||
internals.isCaptured = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_read(size) {
|
||||
const internals = this[kInternals];
|
||||
|
||||
if (internals.onReadCallback) {
|
||||
internals.onReadCallback();
|
||||
}
|
||||
|
||||
return super._read(size);
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
const internals = this[kInternals];
|
||||
const maxRate = internals.maxRate;
|
||||
|
||||
const readableHighWaterMark = this.readableHighWaterMark;
|
||||
|
||||
const timeWindow = internals.timeWindow;
|
||||
|
||||
const divider = 1000 / timeWindow;
|
||||
const bytesThreshold = (maxRate / divider);
|
||||
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
||||
|
||||
const pushChunk = (_chunk, _callback) => {
|
||||
const bytes = Buffer.byteLength(_chunk);
|
||||
internals.bytesSeen += bytes;
|
||||
internals.bytes += bytes;
|
||||
|
||||
internals.isCaptured && this.emit('progress', internals.bytesSeen);
|
||||
|
||||
if (this.push(_chunk)) {
|
||||
process.nextTick(_callback);
|
||||
} else {
|
||||
internals.onReadCallback = () => {
|
||||
internals.onReadCallback = null;
|
||||
process.nextTick(_callback);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const transformChunk = (_chunk, _callback) => {
|
||||
const chunkSize = Buffer.byteLength(_chunk);
|
||||
let chunkRemainder = null;
|
||||
let maxChunkSize = readableHighWaterMark;
|
||||
let bytesLeft;
|
||||
let passed = 0;
|
||||
|
||||
if (maxRate) {
|
||||
const now = Date.now();
|
||||
|
||||
if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {
|
||||
internals.ts = now;
|
||||
bytesLeft = bytesThreshold - internals.bytes;
|
||||
internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
|
||||
passed = 0;
|
||||
}
|
||||
|
||||
bytesLeft = bytesThreshold - internals.bytes;
|
||||
}
|
||||
|
||||
if (maxRate) {
|
||||
if (bytesLeft <= 0) {
|
||||
// next time window
|
||||
return setTimeout(() => {
|
||||
_callback(null, _chunk);
|
||||
}, timeWindow - passed);
|
||||
}
|
||||
|
||||
if (bytesLeft < maxChunkSize) {
|
||||
maxChunkSize = bytesLeft;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {
|
||||
chunkRemainder = _chunk.subarray(maxChunkSize);
|
||||
_chunk = _chunk.subarray(0, maxChunkSize);
|
||||
}
|
||||
|
||||
pushChunk(_chunk, chunkRemainder ? () => {
|
||||
process.nextTick(_callback, null, chunkRemainder);
|
||||
} : _callback);
|
||||
};
|
||||
|
||||
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (_chunk) {
|
||||
transformChunk(_chunk, transformNextChunk);
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default AxiosTransformStream;
|
||||
58
java-mall-app-shop-admin/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
generated
vendored
58
java-mall-app-shop-admin/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
generated
vendored
@ -1,58 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import toFormData from './toFormData.js';
|
||||
|
||||
/**
|
||||
* It encodes a string by replacing all characters that are not in the unreserved set with
|
||||
* their percent-encoded equivalents
|
||||
*
|
||||
* @param {string} str - The string to encode.
|
||||
*
|
||||
* @returns {string} The encoded string.
|
||||
*/
|
||||
function encode(str) {
|
||||
const charMap = {
|
||||
'!': '%21',
|
||||
"'": '%27',
|
||||
'(': '%28',
|
||||
')': '%29',
|
||||
'~': '%7E',
|
||||
'%20': '+',
|
||||
'%00': '\x00'
|
||||
};
|
||||
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
||||
return charMap[match];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* It takes a params object and converts it to a FormData object
|
||||
*
|
||||
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
||||
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function AxiosURLSearchParams(params, options) {
|
||||
this._pairs = [];
|
||||
|
||||
params && toFormData(params, this, options);
|
||||
}
|
||||
|
||||
const prototype = AxiosURLSearchParams.prototype;
|
||||
|
||||
prototype.append = function append(name, value) {
|
||||
this._pairs.push([name, value]);
|
||||
};
|
||||
|
||||
prototype.toString = function toString(encoder) {
|
||||
const _encode = encoder ? function(value) {
|
||||
return encoder.call(this, value, encode);
|
||||
} : encode;
|
||||
|
||||
return this._pairs.map(function each(pair) {
|
||||
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
||||
}, '').join('&');
|
||||
};
|
||||
|
||||
export default AxiosURLSearchParams;
|
||||
71
java-mall-app-shop-admin/node_modules/axios/lib/helpers/HttpStatusCode.js
generated
vendored
71
java-mall-app-shop-admin/node_modules/axios/lib/helpers/HttpStatusCode.js
generated
vendored
@ -1,71 +0,0 @@
|
||||
const HttpStatusCode = {
|
||||
Continue: 100,
|
||||
SwitchingProtocols: 101,
|
||||
Processing: 102,
|
||||
EarlyHints: 103,
|
||||
Ok: 200,
|
||||
Created: 201,
|
||||
Accepted: 202,
|
||||
NonAuthoritativeInformation: 203,
|
||||
NoContent: 204,
|
||||
ResetContent: 205,
|
||||
PartialContent: 206,
|
||||
MultiStatus: 207,
|
||||
AlreadyReported: 208,
|
||||
ImUsed: 226,
|
||||
MultipleChoices: 300,
|
||||
MovedPermanently: 301,
|
||||
Found: 302,
|
||||
SeeOther: 303,
|
||||
NotModified: 304,
|
||||
UseProxy: 305,
|
||||
Unused: 306,
|
||||
TemporaryRedirect: 307,
|
||||
PermanentRedirect: 308,
|
||||
BadRequest: 400,
|
||||
Unauthorized: 401,
|
||||
PaymentRequired: 402,
|
||||
Forbidden: 403,
|
||||
NotFound: 404,
|
||||
MethodNotAllowed: 405,
|
||||
NotAcceptable: 406,
|
||||
ProxyAuthenticationRequired: 407,
|
||||
RequestTimeout: 408,
|
||||
Conflict: 409,
|
||||
Gone: 410,
|
||||
LengthRequired: 411,
|
||||
PreconditionFailed: 412,
|
||||
PayloadTooLarge: 413,
|
||||
UriTooLong: 414,
|
||||
UnsupportedMediaType: 415,
|
||||
RangeNotSatisfiable: 416,
|
||||
ExpectationFailed: 417,
|
||||
ImATeapot: 418,
|
||||
MisdirectedRequest: 421,
|
||||
UnprocessableEntity: 422,
|
||||
Locked: 423,
|
||||
FailedDependency: 424,
|
||||
TooEarly: 425,
|
||||
UpgradeRequired: 426,
|
||||
PreconditionRequired: 428,
|
||||
TooManyRequests: 429,
|
||||
RequestHeaderFieldsTooLarge: 431,
|
||||
UnavailableForLegalReasons: 451,
|
||||
InternalServerError: 500,
|
||||
NotImplemented: 501,
|
||||
BadGateway: 502,
|
||||
ServiceUnavailable: 503,
|
||||
GatewayTimeout: 504,
|
||||
HttpVersionNotSupported: 505,
|
||||
VariantAlsoNegotiates: 506,
|
||||
InsufficientStorage: 507,
|
||||
LoopDetected: 508,
|
||||
NotExtended: 510,
|
||||
NetworkAuthenticationRequired: 511,
|
||||
};
|
||||
|
||||
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
||||
HttpStatusCode[value] = key;
|
||||
});
|
||||
|
||||
export default HttpStatusCode;
|
||||
28
java-mall-app-shop-admin/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js
generated
vendored
28
java-mall-app-shop-admin/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js
generated
vendored
@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
import stream from "stream";
|
||||
|
||||
class ZlibHeaderTransformStream extends stream.Transform {
|
||||
__transform(chunk, encoding, callback) {
|
||||
this.push(chunk);
|
||||
callback();
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
if (chunk.length !== 0) {
|
||||
this._transform = this.__transform;
|
||||
|
||||
// Add Default Compression headers if no zlib headers are present
|
||||
if (chunk[0] !== 120) { // Hex: 78
|
||||
const header = Buffer.alloc(2);
|
||||
header[0] = 120; // Hex: 78
|
||||
header[1] = 156; // Hex: 9C
|
||||
this.push(header, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
this.__transform(chunk, encoding, callback);
|
||||
}
|
||||
}
|
||||
|
||||
export default ZlibHeaderTransformStream;
|
||||
10
java-mall-app-shop-admin/node_modules/axios/lib/helpers/bind.js
generated
vendored
10
java-mall-app-shop-admin/node_modules/axios/lib/helpers/bind.js
generated
vendored
@ -1,7 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
export default function bind(fn, thisArg) {
|
||||
module.exports = function bind(fn, thisArg) {
|
||||
return function wrap() {
|
||||
return fn.apply(thisArg, arguments);
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
return fn.apply(thisArg, args);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
61
java-mall-app-shop-admin/node_modules/axios/lib/helpers/buildURL.js
generated
vendored
61
java-mall-app-shop-admin/node_modules/axios/lib/helpers/buildURL.js
generated
vendored
@ -1,16 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import utils from '../utils.js';
|
||||
import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';
|
||||
var utils = require('./../utils');
|
||||
|
||||
/**
|
||||
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
||||
* URI encoded counterparts
|
||||
*
|
||||
* @param {string} val The value to be encoded.
|
||||
*
|
||||
* @returns {string} The encoded value.
|
||||
*/
|
||||
function encode(val) {
|
||||
return encodeURIComponent(val).
|
||||
replace(/%3A/gi, ':').
|
||||
@ -26,38 +17,54 @@ function encode(val) {
|
||||
*
|
||||
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||||
* @param {object} [params] The params to be appended
|
||||
* @param {?object} options
|
||||
*
|
||||
* @returns {string} The formatted url
|
||||
*/
|
||||
export default function buildURL(url, params, options) {
|
||||
module.exports = function buildURL(url, params, paramsSerializer) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
if (!params) {
|
||||
return url;
|
||||
}
|
||||
|
||||
const _encode = options && options.encode || encode;
|
||||
|
||||
const serializeFn = options && options.serialize;
|
||||
|
||||
let serializedParams;
|
||||
|
||||
if (serializeFn) {
|
||||
serializedParams = serializeFn(params, options);
|
||||
var serializedParams;
|
||||
if (paramsSerializer) {
|
||||
serializedParams = paramsSerializer(params);
|
||||
} else if (utils.isURLSearchParams(params)) {
|
||||
serializedParams = params.toString();
|
||||
} else {
|
||||
serializedParams = utils.isURLSearchParams(params) ?
|
||||
params.toString() :
|
||||
new AxiosURLSearchParams(params, options).toString(_encode);
|
||||
var parts = [];
|
||||
|
||||
utils.forEach(params, function serialize(val, key) {
|
||||
if (val === null || typeof val === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isArray(val)) {
|
||||
key = key + '[]';
|
||||
} else {
|
||||
val = [val];
|
||||
}
|
||||
|
||||
utils.forEach(val, function parseValue(v) {
|
||||
if (utils.isDate(v)) {
|
||||
v = v.toISOString();
|
||||
} else if (utils.isObject(v)) {
|
||||
v = JSON.stringify(v);
|
||||
}
|
||||
parts.push(encode(key) + '=' + encode(v));
|
||||
});
|
||||
});
|
||||
|
||||
serializedParams = parts.join('&');
|
||||
}
|
||||
|
||||
if (serializedParams) {
|
||||
const hashmarkIndex = url.indexOf("#");
|
||||
|
||||
var hashmarkIndex = url.indexOf('#');
|
||||
if (hashmarkIndex !== -1) {
|
||||
url = url.slice(0, hashmarkIndex);
|
||||
}
|
||||
|
||||
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
};
|
||||
|
||||
16
java-mall-app-shop-admin/node_modules/axios/lib/helpers/callbackify.js
generated
vendored
16
java-mall-app-shop-admin/node_modules/axios/lib/helpers/callbackify.js
generated
vendored
@ -1,16 +0,0 @@
|
||||
import utils from "../utils.js";
|
||||
|
||||
const callbackify = (fn, reducer) => {
|
||||
return utils.isAsyncFn(fn) ? function (...args) {
|
||||
const cb = args.pop();
|
||||
fn.apply(this, args).then((value) => {
|
||||
try {
|
||||
reducer ? cb(null, ...reducer(value)) : cb(null, value);
|
||||
} catch (err) {
|
||||
cb(err);
|
||||
}
|
||||
}, cb);
|
||||
} : fn;
|
||||
}
|
||||
|
||||
export default callbackify;
|
||||
7
java-mall-app-shop-admin/node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
7
java-mall-app-shop-admin/node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
@ -5,11 +5,10 @@
|
||||
*
|
||||
* @param {string} baseURL The base URL
|
||||
* @param {string} relativeURL The relative URL
|
||||
*
|
||||
* @returns {string} The combined URL
|
||||
*/
|
||||
export default function combineURLs(baseURL, relativeURL) {
|
||||
module.exports = function combineURLs(baseURL, relativeURL) {
|
||||
return relativeURL
|
||||
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
||||
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
||||
: baseURL;
|
||||
}
|
||||
};
|
||||
|
||||
48
java-mall-app-shop-admin/node_modules/axios/lib/helpers/composeSignals.js
generated
vendored
48
java-mall-app-shop-admin/node_modules/axios/lib/helpers/composeSignals.js
generated
vendored
@ -1,48 +0,0 @@
|
||||
import CanceledError from "../cancel/CanceledError.js";
|
||||
import AxiosError from "../core/AxiosError.js";
|
||||
import utils from '../utils.js';
|
||||
|
||||
const composeSignals = (signals, timeout) => {
|
||||
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
||||
|
||||
if (timeout || length) {
|
||||
let controller = new AbortController();
|
||||
|
||||
let aborted;
|
||||
|
||||
const onabort = function (reason) {
|
||||
if (!aborted) {
|
||||
aborted = true;
|
||||
unsubscribe();
|
||||
const err = reason instanceof Error ? reason : this.reason;
|
||||
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
||||
}
|
||||
}
|
||||
|
||||
let timer = timeout && setTimeout(() => {
|
||||
timer = null;
|
||||
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))
|
||||
}, timeout)
|
||||
|
||||
const unsubscribe = () => {
|
||||
if (signals) {
|
||||
timer && clearTimeout(timer);
|
||||
timer = null;
|
||||
signals.forEach(signal => {
|
||||
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
||||
});
|
||||
signals = null;
|
||||
}
|
||||
}
|
||||
|
||||
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
||||
|
||||
const {signal} = controller;
|
||||
|
||||
signal.unsubscribe = () => utils.asap(unsubscribe);
|
||||
|
||||
return signal;
|
||||
}
|
||||
}
|
||||
|
||||
export default composeSignals;
|
||||
73
java-mall-app-shop-admin/node_modules/axios/lib/helpers/cookies.js
generated
vendored
73
java-mall-app-shop-admin/node_modules/axios/lib/helpers/cookies.js
generated
vendored
@ -1,42 +1,53 @@
|
||||
import utils from './../utils.js';
|
||||
import platform from '../platform/index.js';
|
||||
'use strict';
|
||||
|
||||
export default platform.hasStandardBrowserEnv ?
|
||||
var utils = require('./../utils');
|
||||
|
||||
module.exports = (
|
||||
utils.isStandardBrowserEnv() ?
|
||||
|
||||
// Standard browser envs support document.cookie
|
||||
{
|
||||
write(name, value, expires, path, domain, secure) {
|
||||
const cookie = [name + '=' + encodeURIComponent(value)];
|
||||
(function standardBrowserEnv() {
|
||||
return {
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
var cookie = [];
|
||||
cookie.push(name + '=' + encodeURIComponent(value));
|
||||
|
||||
utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
if (utils.isNumber(expires)) {
|
||||
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||
}
|
||||
|
||||
utils.isString(path) && cookie.push('path=' + path);
|
||||
if (utils.isString(path)) {
|
||||
cookie.push('path=' + path);
|
||||
}
|
||||
|
||||
utils.isString(domain) && cookie.push('domain=' + domain);
|
||||
if (utils.isString(domain)) {
|
||||
cookie.push('domain=' + domain);
|
||||
}
|
||||
|
||||
secure === true && cookie.push('secure');
|
||||
if (secure === true) {
|
||||
cookie.push('secure');
|
||||
}
|
||||
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
document.cookie = cookie.join('; ');
|
||||
},
|
||||
|
||||
read(name) {
|
||||
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
read: function read(name) {
|
||||
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||
return (match ? decodeURIComponent(match[3]) : null);
|
||||
},
|
||||
|
||||
remove(name) {
|
||||
this.write(name, '', Date.now() - 86400000);
|
||||
}
|
||||
}
|
||||
|
||||
:
|
||||
|
||||
// Non-standard browser env (web workers, react-native) lack needed support.
|
||||
{
|
||||
write() {},
|
||||
read() {
|
||||
return null;
|
||||
},
|
||||
remove() {}
|
||||
};
|
||||
remove: function remove(name) {
|
||||
this.write(name, '', Date.now() - 86400000);
|
||||
}
|
||||
};
|
||||
})() :
|
||||
|
||||
// Non standard browser env (web workers, react-native) lack needed support.
|
||||
(function nonStandardBrowserEnv() {
|
||||
return {
|
||||
write: function write() {},
|
||||
read: function read() { return null; },
|
||||
remove: function remove() {}
|
||||
};
|
||||
})()
|
||||
);
|
||||
|
||||
6
java-mall-app-shop-admin/node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
6
java-mall-app-shop-admin/node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
@ -9,10 +9,8 @@
|
||||
* @param {string} method The name of the deprecated method
|
||||
* @param {string} [instead] The alternate method to use if applicable
|
||||
* @param {string} [docs] The documentation URL to get further details
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
export default function deprecatedMethod(method, instead, docs) {
|
||||
module.exports = function deprecatedMethod(method, instead, docs) {
|
||||
try {
|
||||
console.warn(
|
||||
'DEPRECATED method `' + method + '`.' +
|
||||
@ -23,4 +21,4 @@ export default function deprecatedMethod(method, instead, docs) {
|
||||
console.warn('For more information about usage see ' + docs);
|
||||
}
|
||||
} catch (e) { /* Ignore */ }
|
||||
}
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user