43 changed files with 5189 additions and 0 deletions
Unified View
Diff Options
-
BIN.DS_Store
-
24.hbuilderx/launch.json
-
18App.vue
-
16apis/clientApi.js
-
47common/css/reset.scss
-
33common/js/publicFn.js
-
11main.js
-
91manifest.json
-
72pages.json
-
40pages/cart/index.vue
-
15pages/login/index.vue
-
40pages/mine/index.vue
-
40pages/store/index.vue
-
BINstatic/imgs/tabbar/store-blue.png
-
BINstatic/imgs/tabbar/store-gray.png
-
BINstatic/logo.png
-
7store/index.js
-
76uni.scss
-
0unpackage/dist/dev/.automator/app-plus/.automator.json
-
1unpackage/dist/dev/app-plus/__uniappchooselocation.js
-
BINunpackage/dist/dev/app-plus/__uniapperror.png
-
1unpackage/dist/dev/app-plus/__uniappes6.js
-
1unpackage/dist/dev/app-plus/__uniappopenlocation.js
-
1unpackage/dist/dev/app-plus/__uniapppicker.js
-
8unpackage/dist/dev/app-plus/__uniappquill.js
-
1unpackage/dist/dev/app-plus/__uniappquillimageresize.js
-
1unpackage/dist/dev/app-plus/__uniappscan.js
-
BINunpackage/dist/dev/app-plus/__uniappsuccess.png
-
25unpackage/dist/dev/app-plus/__uniappview.html
-
8unpackage/dist/dev/app-plus/app-config-service.js
-
154unpackage/dist/dev/app-plus/app-config.js
-
2824unpackage/dist/dev/app-plus/app-service.js
-
1390unpackage/dist/dev/app-plus/app-view.js
-
1unpackage/dist/dev/app-plus/manifest.json
-
BINunpackage/dist/dev/app-plus/static/imgs/tabbar/store-blue.png
-
BINunpackage/dist/dev/app-plus/static/imgs/tabbar/store-gray.png
-
BINunpackage/dist/dev/app-plus/static/logo.png
-
1unpackage/dist/dev/app-plus/view.css
-
6unpackage/dist/dev/app-plus/view.umd.min.js
-
14utils/hook.js
-
112utils/http/http.js
-
101utils/http/index.js
-
9utils/is.js
@ -0,0 +1,24 @@ |
|||||
|
{ // 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" |
||||
|
}, |
||||
|
"h5" : |
||||
|
{ |
||||
|
"launchtype" : "local" |
||||
|
}, |
||||
|
"mp-weixin" : |
||||
|
{ |
||||
|
"launchtype" : "local" |
||||
|
}, |
||||
|
"type" : "uniCloud" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
<script> |
||||
|
export default { |
||||
|
onLaunch: function() { |
||||
|
console.log('App Launch') |
||||
|
}, |
||||
|
onShow: function() { |
||||
|
console.log('App Show') |
||||
|
}, |
||||
|
onHide: function() { |
||||
|
console.log('App Hide') |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
/*每个页面公共css */ |
||||
|
@import url("./common/css/reset.scss"); |
||||
|
</style> |
||||
@ -0,0 +1,16 @@ |
|||||
|
import http from '../utils/http/index.js' |
||||
|
export const getList = (data) => { |
||||
|
return http.get({ |
||||
|
url:'/trading-center/wechatapplet/get/paper-brand/brand-list', |
||||
|
data, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param {Object} data :{filePath:'',fileType:'',fileName:''} |
||||
|
*/ |
||||
|
export const upload = (data) => { |
||||
|
return http.uploadFile({ |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
page { |
||||
|
font-size:$uni-font-size-base; |
||||
|
line-height: 1; |
||||
|
background-color: #fff; |
||||
|
-webkit-overflow-scrolling: touch; /* 使ios列表滑动流畅*/ |
||||
|
} |
||||
|
|
||||
|
page, |
||||
|
view, |
||||
|
input, |
||||
|
text, |
||||
|
form, |
||||
|
navigator, |
||||
|
rich-text, |
||||
|
picker, |
||||
|
scroll-view, |
||||
|
cover-view, |
||||
|
open-data { |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
rich-text, |
||||
|
open-data, |
||||
|
form { |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
cover-view { |
||||
|
line-height: 1.5; |
||||
|
white-space: normal; |
||||
|
} |
||||
|
|
||||
|
::webkit-scrollbar { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border: 0; |
||||
|
} |
||||
|
|
||||
|
/* 清除浮动 */ |
||||
|
.clearfix:after { |
||||
|
content: "."; |
||||
|
display: block; |
||||
|
height: 0; |
||||
|
clear: both; |
||||
|
visibility: hidden; |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
// 日期转换方法
|
||||
|
/** |
||||
|
* 日期格式化,样例 yyyy-mm-dd hh:MM:ss |
||||
|
* @param date Date 需要转换的日期 |
||||
|
* @param fmt string 转化的格式 |
||||
|
*/ |
||||
|
const dateTimeFormat = (date, fmt) => { |
||||
|
if (!date) { |
||||
|
throw new Error('日期不正确') |
||||
|
} |
||||
|
let ret |
||||
|
const opt = { |
||||
|
'y+': date.getFullYear().toString(), // 年
|
||||
|
'm+': (date.getMonth() + 1).toString(), // 月
|
||||
|
'd+': date.getDate().toString(), // 日
|
||||
|
'h+': date.getHours().toString(), // 时
|
||||
|
'M+': date.getMinutes().toString(), // 分
|
||||
|
's+': date.getSeconds().toString() // 秒
|
||||
|
} |
||||
|
for (let k in opt) { |
||||
|
ret = new RegExp('(' + k + ')').exec(fmt) |
||||
|
if (ret) { |
||||
|
fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')) |
||||
|
} |
||||
|
} |
||||
|
return fmt |
||||
|
} |
||||
|
|
||||
|
const pubFn = { |
||||
|
dateTimeFormat |
||||
|
} |
||||
|
|
||||
|
export default pubFn |
||||
@ -0,0 +1,11 @@ |
|||||
|
import App from './App' |
||||
|
import pubFn from './common/js/publicFn.js' |
||||
|
import store from "./store"; |
||||
|
import Vue from 'vue' |
||||
|
Vue.config.productionTip = false |
||||
|
Vue.prototype.$store = store; |
||||
|
App.mpType = 'app' |
||||
|
const app = new Vue({ |
||||
|
...App |
||||
|
}) |
||||
|
app.$mount() |
||||
@ -0,0 +1,91 @@ |
|||||
|
{ |
||||
|
"name" : "uniapp-demo", |
||||
|
"appid" : "", |
||||
|
"description" : "", |
||||
|
"versionName" : "1.0.0", |
||||
|
"versionCode" : "100", |
||||
|
"transformPx" : false, |
||||
|
"networkTimeout" : { |
||||
|
"request" : 6000 |
||||
|
}, |
||||
|
/* 5+App特有相关 */ |
||||
|
"app-plus" : { |
||||
|
"usingComponents" : true, |
||||
|
"nvueStyleCompiler" : "uni-app", |
||||
|
"compilerVersion" : 3, |
||||
|
"splashscreen" : { |
||||
|
"alwaysShowBeforeRender" : true, |
||||
|
"waiting" : true, |
||||
|
"autoclose" : true, |
||||
|
"delay" : 0 |
||||
|
}, |
||||
|
/* 模块配置 */ |
||||
|
"modules" : {}, |
||||
|
/* 应用发布信息 */ |
||||
|
"distribute" : { |
||||
|
/* android打包配置 */ |
||||
|
"android" : { |
||||
|
"permissions" : [ |
||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>", |
||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", |
||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" |
||||
|
] |
||||
|
}, |
||||
|
/* ios打包配置 */ |
||||
|
"ios" : {}, |
||||
|
/* SDK配置 */ |
||||
|
"sdkConfigs" : { |
||||
|
"maps" : {}, |
||||
|
"payment" : { |
||||
|
"weixin" : { |
||||
|
"__platform__" : [ "ios", "android" ], |
||||
|
"appid" : "", |
||||
|
"UniversalLinks" : "" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"uniStatistics" : { |
||||
|
"enable" : true |
||||
|
} |
||||
|
}, |
||||
|
/* 快应用特有相关 */ |
||||
|
"quickapp" : {}, |
||||
|
/* 小程序特有相关 */ |
||||
|
"mp-weixin" : { |
||||
|
"appid" : "", |
||||
|
"setting" : { |
||||
|
"urlCheck" : false |
||||
|
}, |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"mp-alipay" : { |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"mp-baidu" : { |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"mp-toutiao" : { |
||||
|
"usingComponents" : true |
||||
|
}, |
||||
|
"uniStatistics" : { |
||||
|
"enable" : false |
||||
|
}, |
||||
|
"vueVersion" : "2", |
||||
|
"h5" : { |
||||
|
"router" : { |
||||
|
"mode" : "history" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,72 @@ |
|||||
|
{ |
||||
|
"pages": [ |
||||
|
{ |
||||
|
"path": "pages/store/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "店铺首页" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/cart/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "购物车" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/mine/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "个人中心" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/login/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "登录", |
||||
|
"enablePullDownRefresh": false |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"globalStyle": { |
||||
|
"navigationBarTextStyle": "black", |
||||
|
"navigationBarTitleText": "uni-app", |
||||
|
"navigationBarBackgroundColor": "#F8F8F8", |
||||
|
"backgroundColor": "#F8F8F8" |
||||
|
}, |
||||
|
"tabBar": { |
||||
|
"color": "#888", |
||||
|
"selectedColor": "#007AFF", |
||||
|
"borderStyle": "white", |
||||
|
"backgroundColor": "#f9f9f9", |
||||
|
"list": [ |
||||
|
{ |
||||
|
"pagePath": "pages/store/index", |
||||
|
"iconPath": "static/imgs/tabbar/store-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/store-blue.png", |
||||
|
"text": "店铺首页" |
||||
|
}, |
||||
|
{ |
||||
|
"pagePath": "pages/cart/index", |
||||
|
"iconPath": "static/imgs/tabbar/store-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/store-blue.png", |
||||
|
"text": "购物车" |
||||
|
}, |
||||
|
{ |
||||
|
"pagePath": "pages/mine/index", |
||||
|
"iconPath": "static/imgs/tabbar/store-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/store-blue.png", |
||||
|
"text": "个人中心" |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
"condition": { |
||||
|
//模式配置,仅开发期间生效 |
||||
|
"current": 0, //当前激活的模式(list 的索引项) |
||||
|
"list": [ |
||||
|
{ |
||||
|
"name": "", //模式名称 |
||||
|
"path": "", //启动页面,必选 |
||||
|
"query": "" //启动参数,在页面的onLoad函数里面得到 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
<template> |
||||
|
<view class="content"> |
||||
|
mine |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.content { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.logo { |
||||
|
height: 200rpx; |
||||
|
width: 200rpx; |
||||
|
margin-top: 200rpx; |
||||
|
margin-left: auto; |
||||
|
margin-right: auto; |
||||
|
margin-bottom: 50rpx; |
||||
|
} |
||||
|
|
||||
|
.text-area { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.title { |
||||
|
font-size: 36rpx; |
||||
|
color: #8f8f94; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,15 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
login |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,40 @@ |
|||||
|
<template> |
||||
|
<view class="content"> |
||||
|
mine |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.content { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.logo { |
||||
|
height: 200rpx; |
||||
|
width: 200rpx; |
||||
|
margin-top: 200rpx; |
||||
|
margin-left: auto; |
||||
|
margin-right: auto; |
||||
|
margin-bottom: 50rpx; |
||||
|
} |
||||
|
|
||||
|
.text-area { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.title { |
||||
|
font-size: 36rpx; |
||||
|
color: #8f8f94; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,40 @@ |
|||||
|
<template> |
||||
|
<view class="content"> |
||||
|
store |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.content { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.logo { |
||||
|
height: 200rpx; |
||||
|
width: 200rpx; |
||||
|
margin-top: 200rpx; |
||||
|
margin-left: auto; |
||||
|
margin-right: auto; |
||||
|
margin-bottom: 50rpx; |
||||
|
} |
||||
|
|
||||
|
.text-area { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.title { |
||||
|
font-size: 36rpx; |
||||
|
color: #8f8f94; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,7 @@ |
|||||
|
import Vue from 'vue' |
||||
|
import Vuex from 'vuex' |
||||
|
Vue.use(Vuex) |
||||
|
const store = new Vuex.Store({ |
||||
|
state: {} |
||||
|
}) |
||||
|
export default store |
||||
@ -0,0 +1,76 @@ |
|||||
|
/** |
||||
|
* 这里是uni-app内置的常用样式变量 |
||||
|
* |
||||
|
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 |
||||
|
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 |
||||
|
* |
||||
|
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 |
||||
|
*/ |
||||
|
|
||||
|
/* 颜色变量 */ |
||||
|
|
||||
|
/* 行为相关颜色 */ |
||||
|
$uni-color-primary: #007aff; |
||||
|
$uni-color-success: #4cd964; |
||||
|
$uni-color-warning: #f0ad4e; |
||||
|
$uni-color-error: #dd524d; |
||||
|
|
||||
|
/* 文字基本颜色 */ |
||||
|
$uni-text-color:#333;//基本色 |
||||
|
$uni-text-color-inverse:#fff;//反色 |
||||
|
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 |
||||
|
$uni-text-color-placeholder: #808080; |
||||
|
$uni-text-color-disable:#c0c0c0; |
||||
|
|
||||
|
/* 背景颜色 */ |
||||
|
$uni-bg-color:#ffffff; |
||||
|
$uni-bg-color-grey:#f8f8f8; |
||||
|
$uni-bg-color-hover:#f1f1f1;//点击状态颜色 |
||||
|
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 |
||||
|
|
||||
|
/* 边框颜色 */ |
||||
|
$uni-border-color:#c8c7cc; |
||||
|
|
||||
|
/* 尺寸变量 */ |
||||
|
|
||||
|
/* 文字尺寸 */ |
||||
|
$uni-font-size-sm:12px; |
||||
|
$uni-font-size-base:14px; |
||||
|
$uni-font-size-lg:16; |
||||
|
|
||||
|
/* 图片尺寸 */ |
||||
|
$uni-img-size-sm:20px; |
||||
|
$uni-img-size-base:26px; |
||||
|
$uni-img-size-lg:40px; |
||||
|
|
||||
|
/* Border Radius */ |
||||
|
$uni-border-radius-sm: 2px; |
||||
|
$uni-border-radius-base: 3px; |
||||
|
$uni-border-radius-lg: 6px; |
||||
|
$uni-border-radius-circle: 50%; |
||||
|
|
||||
|
/* 水平间距 */ |
||||
|
$uni-spacing-row-sm: 5px; |
||||
|
$uni-spacing-row-base: 10px; |
||||
|
$uni-spacing-row-lg: 15px; |
||||
|
|
||||
|
/* 垂直间距 */ |
||||
|
$uni-spacing-col-sm: 4px; |
||||
|
$uni-spacing-col-base: 8px; |
||||
|
$uni-spacing-col-lg: 12px; |
||||
|
|
||||
|
/* 透明度 */ |
||||
|
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 |
||||
|
|
||||
|
/* 文章场景相关 */ |
||||
|
$uni-color-title: #2C405A; // 文章标题颜色 |
||||
|
$uni-font-size-title:20px; |
||||
|
$uni-color-subtitle: #555555; // 二级标题颜色 |
||||
|
$uni-font-size-subtitle:26px; |
||||
|
$uni-color-paragraph: #3F536E; // 文章段落颜色 |
||||
|
$uni-font-size-paragraph:15px; |
||||
1
unpackage/dist/dev/app-plus/__uniappchooselocation.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1
unpackage/dist/dev/app-plus/__uniappes6.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1
unpackage/dist/dev/app-plus/__uniappopenlocation.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1
unpackage/dist/dev/app-plus/__uniapppicker.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
8
unpackage/dist/dev/app-plus/__uniappquill.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1
unpackage/dist/dev/app-plus/__uniappquillimageresize.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1
unpackage/dist/dev/app-plus/__uniappscan.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,25 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh-CN"> |
||||
|
|
||||
|
<head> |
||||
|
<meta charset="UTF-8" /> |
||||
|
<script> |
||||
|
var __UniViewStartTime__ = Date.now(); |
||||
|
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>View</title> |
||||
|
<link rel="stylesheet" href="view.css" /> |
||||
|
</head> |
||||
|
|
||||
|
<body> |
||||
|
<div id="app"></div> |
||||
|
<script src="__uniappes6.js"></script> |
||||
|
<script src="view.umd.min.js"></script> |
||||
|
<script src="app-view.js"></script> |
||||
|
</body> |
||||
|
|
||||
|
</html> |
||||
@ -0,0 +1,8 @@ |
|||||
|
|
||||
|
var isReady=false;var onReadyCallbacks=[]; |
||||
|
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
||||
|
var __uniConfig = {"pages":["pages/store/index","pages/cart/index","pages/mine/index","pages/login/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#888","selectedColor":"#007AFF","borderStyle":"white","backgroundColor":"#f9f9f9","list":[{"pagePath":"pages/store/index","iconPath":"static/imgs/tabbar/store-gray.png","selectedIconPath":"static/imgs/tabbar/store-blue.png","text":"店铺首页"},{"pagePath":"pages/cart/index","iconPath":"static/imgs/tabbar/store-gray.png","selectedIconPath":"static/imgs/tabbar/store-blue.png","text":"购物车"},{"pagePath":"pages/mine/index","iconPath":"static/imgs/tabbar/store-gray.png","selectedIconPath":"static/imgs/tabbar/store-blue.png","text":"个人中心"}]},"networkTimeout":{"request":6000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"uniapp-demo","compilerVersion":"3.2.16","entryPagePath":"pages/store/index"}; |
||||
|
var __uniRoutes = [{"path":"/pages/store/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"店铺首页"}},{"path":"/pages/cart/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"购物车"}},{"path":"/pages/mine/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"个人中心"}},{"path":"/pages/login/index","meta":{},"window":{"navigationBarTitleText":"登录","enablePullDownRefresh":false}}]; |
||||
|
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
||||
|
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
||||
|
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |
||||
@ -0,0 +1,154 @@ |
|||||
|
/******/ (function(modules) { // webpackBootstrap
|
||||
|
/******/ // install a JSONP callback for chunk loading
|
||||
|
/******/ function webpackJsonpCallback(data) { |
||||
|
/******/ var chunkIds = data[0]; |
||||
|
/******/ var moreModules = data[1]; |
||||
|
/******/ var executeModules = data[2]; |
||||
|
/******/ |
||||
|
/******/ // add "moreModules" to the modules object,
|
||||
|
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
|
/******/ var moduleId, chunkId, i = 0, resolves = []; |
||||
|
/******/ for(;i < chunkIds.length; i++) { |
||||
|
/******/ chunkId = chunkIds[i]; |
||||
|
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { |
||||
|
/******/ resolves.push(installedChunks[chunkId][0]); |
||||
|
/******/ } |
||||
|
/******/ installedChunks[chunkId] = 0; |
||||
|
/******/ } |
||||
|
/******/ for(moduleId in moreModules) { |
||||
|
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { |
||||
|
/******/ modules[moduleId] = moreModules[moduleId]; |
||||
|
/******/ } |
||||
|
/******/ } |
||||
|
/******/ if(parentJsonpFunction) parentJsonpFunction(data); |
||||
|
/******/ |
||||
|
/******/ while(resolves.length) { |
||||
|
/******/ resolves.shift()(); |
||||
|
/******/ } |
||||
|
/******/ |
||||
|
/******/ // add entry modules from loaded chunk to deferred list
|
||||
|
/******/ deferredModules.push.apply(deferredModules, executeModules || []); |
||||
|
/******/ |
||||
|
/******/ // run deferred modules when all chunks ready
|
||||
|
/******/ return checkDeferredModules(); |
||||
|
/******/ }; |
||||
|
/******/ function checkDeferredModules() { |
||||
|
/******/ var result; |
||||
|
/******/ for(var i = 0; i < deferredModules.length; i++) { |
||||
|
/******/ var deferredModule = deferredModules[i]; |
||||
|
/******/ var fulfilled = true; |
||||
|
/******/ for(var j = 1; j < deferredModule.length; j++) { |
||||
|
/******/ var depId = deferredModule[j]; |
||||
|
/******/ if(installedChunks[depId] !== 0) fulfilled = false; |
||||
|
/******/ } |
||||
|
/******/ if(fulfilled) { |
||||
|
/******/ deferredModules.splice(i--, 1); |
||||
|
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); |
||||
|
/******/ } |
||||
|
/******/ } |
||||
|
/******/ |
||||
|
/******/ return result; |
||||
|
/******/ } |
||||
|
/******/ |
||||
|
/******/ // The module cache
|
||||
|
/******/ var installedModules = {}; |
||||
|
/******/ |
||||
|
/******/ // object to store loaded and loading chunks
|
||||
|
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
|
/******/ // Promise = chunk loading, 0 = chunk loaded
|
||||
|
/******/ var installedChunks = { |
||||
|
/******/ "app-config": 0 |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ var deferredModules = []; |
||||
|
/******/ |
||||
|
/******/ // The require function
|
||||
|
/******/ function __webpack_require__(moduleId) { |
||||
|
/******/ |
||||
|
/******/ // Check if module is in cache
|
||||
|
/******/ if(installedModules[moduleId]) { |
||||
|
/******/ return installedModules[moduleId].exports; |
||||
|
/******/ } |
||||
|
/******/ // Create a new module (and put it into the cache)
|
||||
|
/******/ var module = installedModules[moduleId] = { |
||||
|
/******/ i: moduleId, |
||||
|
/******/ l: false, |
||||
|
/******/ exports: {} |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // Execute the module function
|
||||
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||||
|
/******/ |
||||
|
/******/ // Flag the module as loaded
|
||||
|
/******/ module.l = true; |
||||
|
/******/ |
||||
|
/******/ // Return the exports of the module
|
||||
|
/******/ return module.exports; |
||||
|
/******/ } |
||||
|
/******/ |
||||
|
/******/ |
||||
|
/******/ // expose the modules object (__webpack_modules__)
|
||||
|
/******/ __webpack_require__.m = modules; |
||||
|
/******/ |
||||
|
/******/ // expose the module cache
|
||||
|
/******/ __webpack_require__.c = installedModules; |
||||
|
/******/ |
||||
|
/******/ // define getter function for harmony exports
|
||||
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
||||
|
/******/ if(!__webpack_require__.o(exports, name)) { |
||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
||||
|
/******/ } |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // define __esModule on exports
|
||||
|
/******/ __webpack_require__.r = function(exports) { |
||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
||||
|
/******/ } |
||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // create a fake namespace object
|
||||
|
/******/ // mode & 1: value is a module id, require it
|
||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||
|
/******/ // mode & 4: return value when already ns object
|
||||
|
/******/ // mode & 8|1: behave like require
|
||||
|
/******/ __webpack_require__.t = function(value, mode) { |
||||
|
/******/ if(mode & 1) value = __webpack_require__(value); |
||||
|
/******/ if(mode & 8) return value; |
||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
||||
|
/******/ var ns = Object.create(null); |
||||
|
/******/ __webpack_require__.r(ns); |
||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
||||
|
/******/ return ns; |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
|
/******/ __webpack_require__.n = function(module) { |
||||
|
/******/ var getter = module && module.__esModule ? |
||||
|
/******/ function getDefault() { return module['default']; } : |
||||
|
/******/ function getModuleExports() { return module; }; |
||||
|
/******/ __webpack_require__.d(getter, 'a', getter); |
||||
|
/******/ return getter; |
||||
|
/******/ }; |
||||
|
/******/ |
||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||||
|
/******/ |
||||
|
/******/ // __webpack_public_path__
|
||||
|
/******/ __webpack_require__.p = "/"; |
||||
|
/******/ |
||||
|
/******/ var jsonpArray = this["webpackJsonp"] = this["webpackJsonp"] || []; |
||||
|
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); |
||||
|
/******/ jsonpArray.push = webpackJsonpCallback; |
||||
|
/******/ jsonpArray = jsonpArray.slice(); |
||||
|
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); |
||||
|
/******/ var parentJsonpFunction = oldJsonpFunction; |
||||
|
/******/ |
||||
|
/******/ |
||||
|
/******/ // run deferred modules from other chunks
|
||||
|
/******/ checkDeferredModules(); |
||||
|
/******/ }) |
||||
|
/************************************************************************/ |
||||
|
/******/ ([]); |
||||
2824
unpackage/dist/dev/app-plus/app-service.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1390
unpackage/dist/dev/app-plus/app-view.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1 @@ |
|||||
|
{"@platforms":["android","iPhone","iPad"],"id":"","name":"uniapp-demo","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-feature android:name=\"android.hardware.camera\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"maps":{},"payment":{"weixin":{"__platform__":["ios","android"],"appid":"","UniversalLinks":""}},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":true},"arguments":"{\"name\":\"\",\"path\":\"\",\"query\":\"\",\"id\":0}","allowsInlineMediaPlayback":true,"safearea":{"background":"#f9f9f9","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.2.16","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#888","selectedColor":"#007AFF","borderStyle":"rgba(255,255,255,0.4)","backgroundColor":"#f9f9f9","list":[{"pagePath":"pages/store/index","iconPath":"static/imgs/tabbar/store-gray.png","selectedIconPath":"static/imgs/tabbar/store-blue.png","text":"店铺首页"},{"pagePath":"pages/cart/index","iconPath":"static/imgs/tabbar/store-gray.png","selectedIconPath":"static/imgs/tabbar/store-blue.png","text":"购物车"},{"pagePath":"pages/mine/index","iconPath":"static/imgs/tabbar/store-gray.png","selectedIconPath":"static/imgs/tabbar/store-blue.png","text":"个人中心"}],"height":"50px","child":["lauchwebview"],"selected":0},"launch_path":"__uniappview.html"}} |
||||
1
unpackage/dist/dev/app-plus/view.css
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
6
unpackage/dist/dev/app-plus/view.umd.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,14 @@ |
|||||
|
// 框架方法封装
|
||||
|
const tabList = ['client','trade','mall','mine'] |
||||
|
|
||||
|
/** |
||||
|
* @param {string} 跳转的tabBar页面 |
||||
|
* @return {null} |
||||
|
*/ |
||||
|
export function tab2(tabPage) { |
||||
|
if(tabList.includes(tabPage)) { |
||||
|
uni.switchTab({ |
||||
|
url:`/pages/${tabPage}/index` |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,112 @@ |
|||||
|
import { |
||||
|
isFunction |
||||
|
} from '../is.js' |
||||
|
const urlEnv = process.env.NODE_ENV === 'production' ? '-test' : '' |
||||
|
const uplaodUrl = `https://api-ops-yyt${urlEnv}.qniao.cn/cloud-print-user-center/utils/uploadImage` |
||||
|
export default class Http { |
||||
|
constructor(config = {}, { |
||||
|
reqInterceptor, |
||||
|
resInterceptor, |
||||
|
tranformConfig |
||||
|
} = {}) { |
||||
|
this.baseUrl = config.baseUrl |
||||
|
this.header = config.header || { |
||||
|
'content-type': 'application/json;charset=UTF-8' |
||||
|
} |
||||
|
this.requestOption = config.requestOption || {} |
||||
|
this.reqInterceptor = reqInterceptor |
||||
|
this.resInterceptor = resInterceptor |
||||
|
this.tranformConfig = tranformConfig |
||||
|
} |
||||
|
post(config, options) { |
||||
|
return this.request({ |
||||
|
method: 'POST', |
||||
|
...config |
||||
|
}, options) |
||||
|
} |
||||
|
get(config, options) { |
||||
|
return this.request({ |
||||
|
method: 'GET', |
||||
|
...config |
||||
|
}, options) |
||||
|
} |
||||
|
/** |
||||
|
* @param {Object} config 和请求相关的参数 |
||||
|
* @param {Object} options 对请求数据进行额外处理的参数 |
||||
|
*/ |
||||
|
request(config, options) { |
||||
|
let conf = Object.assign({}, config) |
||||
|
const { |
||||
|
tranformConfig, |
||||
|
reqInterceptor, |
||||
|
resInterceptor |
||||
|
} = this |
||||
|
if (tranformConfig && isFunction(tranformConfig)) { |
||||
|
conf = tranformConfig(this, config) |
||||
|
} |
||||
|
let opt = Object.assign({}, this.requestOption, options) |
||||
|
if (reqInterceptor && isFunction(reqInterceptor)) { |
||||
|
conf = reqInterceptor(conf, opt) |
||||
|
} |
||||
|
return new Promise((resolve, reject) => { |
||||
|
uni.request({ |
||||
|
url: conf.url, |
||||
|
data: conf.data, |
||||
|
header: conf.header, |
||||
|
success: (res) => { |
||||
|
console.log('native response', res) |
||||
|
let data = resInterceptor(res, opt) |
||||
|
// 服务器错误也会用then抛出,需要自己判断data==null
|
||||
|
resolve(data) |
||||
|
}, |
||||
|
fail: (err) => { |
||||
|
uni.showToast({ |
||||
|
title: '发生未知错误,请联系客服' |
||||
|
}) |
||||
|
reject(err) |
||||
|
} |
||||
|
}) |
||||
|
}).catch(err => { |
||||
|
// 吃掉请求产生的异常
|
||||
|
// 后期可以记录
|
||||
|
console.log('native response error', err) |
||||
|
}) |
||||
|
} |
||||
|
// config:{}
|
||||
|
uploadFile(config, options) { |
||||
|
return new Promise((resolve, rejetc) => { |
||||
|
let conf = Object.assign({}, config) |
||||
|
conf.url = uplaodUrl |
||||
|
const { |
||||
|
reqInterceptor |
||||
|
} = this |
||||
|
let opt = Object.assign({}, this.requestOption, options) |
||||
|
if (reqInterceptor && isFunction(reqInterceptor)) { |
||||
|
conf = reqInterceptor(conf, opt) |
||||
|
} |
||||
|
delete conf.header['Content-Type'] |
||||
|
uni.uploadFile({ |
||||
|
url: conf.url, |
||||
|
header: { |
||||
|
...conf.header, |
||||
|
image: config.data.filePath, |
||||
|
// 'Content-Type': 'image/png'
|
||||
|
}, |
||||
|
filePath: config.data.filePath, |
||||
|
name: config.data.fileName || 'image', |
||||
|
formData: { |
||||
|
image: config.data.filePath |
||||
|
}, |
||||
|
success: (res) => { |
||||
|
uni.hideLoading() |
||||
|
resolve(res.data) |
||||
|
}, |
||||
|
fail: (err) => { |
||||
|
reject(err) |
||||
|
} |
||||
|
}) |
||||
|
}).catch(err => { |
||||
|
console.log('upload native err', err) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,101 @@ |
|||||
|
import Http from './http.js' |
||||
|
|
||||
|
// 请求封装文件
|
||||
|
const urlEnv = process.env.NODE_ENV === 'production' ? '-test' : '' |
||||
|
const xappid = '503258978847966403' |
||||
|
// 请求url列表
|
||||
|
const prefixList = { |
||||
|
'/yyt-uec': `https://api-client-yyt${urlEnv}.qniao.cn`, |
||||
|
'/base-paper-trading': `https://api-client-yyt${urlEnv}.qniao.cn`, |
||||
|
'/uec': `https://api-client-uec${urlEnv}.qniao.cn` |
||||
|
} |
||||
|
|
||||
|
const config = { |
||||
|
baseUrl: '', |
||||
|
header: { |
||||
|
'content-type': 'application/json;charset=UTF-8' |
||||
|
}, |
||||
|
requestOption:{ |
||||
|
// 是否需要隐藏loading
|
||||
|
hideLoading:false, |
||||
|
// 是否返回原始数据
|
||||
|
isReturnNativeResponse:false, |
||||
|
// 需要对返回数据进行处理
|
||||
|
isTransformResponse:true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 请求拦截
|
||||
|
const reqInterceptor = (config, options) => { |
||||
|
// 添加token
|
||||
|
const token = uni.getStorageSync('Qn_token') |
||||
|
config.header = { |
||||
|
...config.header, |
||||
|
'Authorization': token || 'iHP4V/g6O5DXHixyNrf7tm/UsBwShEYjzGx1kBBPitXOsbrMnv5z4DHjhbgWwrgz/eyAbzsk0APv+gBprZdnNQ==', |
||||
|
'X-APP-ID': xappid |
||||
|
} |
||||
|
// 改变url
|
||||
|
let newUrl = '' |
||||
|
const {url = ''} = config |
||||
|
if (url.startsWith('http')) { |
||||
|
newUrl = url |
||||
|
} else { |
||||
|
for (let key in prefixList) { |
||||
|
if (url.startsWith(key)) { |
||||
|
newUrl = prefixList[key] + url |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
config.url = newUrl |
||||
|
if (!options.hideLoading) { |
||||
|
uni.showLoading({ |
||||
|
title: '加载中...' |
||||
|
}) |
||||
|
} |
||||
|
return config |
||||
|
} |
||||
|
|
||||
|
// 响应拦截
|
||||
|
const resInterceptor = (response,options) => { |
||||
|
if(options.isReturnNativeResponse) { |
||||
|
return response |
||||
|
} |
||||
|
// 直接返回 {code,data,message}
|
||||
|
if(!options.isTransformResponse) { |
||||
|
return response.data |
||||
|
} |
||||
|
const {statusCode} = response |
||||
|
const res = response.data |
||||
|
if (statusCode >= 200 && statusCode < 300) { |
||||
|
uni.hideLoading() |
||||
|
return res |
||||
|
} else { |
||||
|
uni.showToast({ |
||||
|
title:'服务器错误,请联系客服' |
||||
|
}) |
||||
|
// 后期可以加记录
|
||||
|
return null |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const tranformConfig = (ins, config) => { |
||||
|
let conf = { |
||||
|
...config |
||||
|
} |
||||
|
conf.baseUrl = config.baseUrl || ins.baseUrl || '' |
||||
|
conf.header = config.header || ins.header |
||||
|
conf.method = config.method || 'GET' |
||||
|
conf.data = config.data || config.params || {} |
||||
|
conf.dataType = config.dataType || 'json' |
||||
|
conf.responseType = config.responseType || 'text' |
||||
|
return conf |
||||
|
} |
||||
|
const http = new Http(config, { |
||||
|
reqInterceptor, |
||||
|
resInterceptor, |
||||
|
tranformConfig |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
export default http |
||||
@ -0,0 +1,9 @@ |
|||||
|
const toString = Object.prototype.toString |
||||
|
|
||||
|
export function is(val, type) { |
||||
|
return toString.call(val) === `[object ${type}]` |
||||
|
} |
||||
|
|
||||
|
export function isFunction(val) { |
||||
|
return is(val,'Function') |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save