购物车完成
This commit is contained in:
commit
1bf78259d7
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# 德国代购小程序
|
||||
|
||||
### 目录结构
|
||||
- commponents 组件
|
||||
- index 首页组件
|
||||
- page 页面
|
||||
- index 首页
|
||||
- utils 插件
|
||||
- [bin.js](./doc/bin.md)
|
||||
|
||||
## 页面路由
|
||||
- pages/index/index 首页 <br>
|
||||
组件
|
||||
- index/search 顶部搜索框
|
||||
- index/list 商品列表
|
||||
- index/lsit/commodity 商品单条
|
27
app.json
27
app.json
@ -1,15 +1,16 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/shopping/shopping",
|
||||
"pages/index/index",
|
||||
"pages/logs/logs"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "WeChat",
|
||||
"navigationBarTextStyle": "black"
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
"pages": [
|
||||
"pages/shopping/shopping",
|
||||
"pages/index/index",
|
||||
"pages/logs/logs"
|
||||
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "WeChat",
|
||||
"navigationBarTextStyle": "black"
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
357
app.wxss
357
app.wxss
@ -1,10 +1,349 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/* Document
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/* Sections
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the `main` element consistently in IE.
|
||||
*/
|
||||
|
||||
main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the gray background on active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Chrome 57-
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change the font styles in all browsers.
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the padding in Firefox.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
padding: 0.35em 0.75em 0.625em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE 10+.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10.
|
||||
* 2. Remove the padding in IE 10.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/* Interactive
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Add the correct display in Edge, IE 10+, and Firefox.
|
||||
*/
|
||||
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the correct display in all browsers.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/* Misc
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10+.
|
||||
*/
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
8
components/index/list/commodity/index.js
Normal file
8
components/index/list/commodity/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
Component({
|
||||
properties: {
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
})
|
3
components/index/list/commodity/index.json
Normal file
3
components/index/list/commodity/index.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
49
components/index/list/commodity/index.scss
Normal file
49
components/index/list/commodity/index.scss
Normal file
@ -0,0 +1,49 @@
|
||||
.commodity {
|
||||
width: 623rpx;
|
||||
height: 143rpx;
|
||||
margin-top: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.content {
|
||||
width: 614rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 0 24rpx 0 rgba(227, 227, 227, 0.4);
|
||||
.imgthumb {
|
||||
width: 105rpx;
|
||||
height: 105rpx;
|
||||
margin-left: 40rpx;
|
||||
background-color: #333;
|
||||
}
|
||||
.introduce {
|
||||
width: 410rpx;
|
||||
margin-left: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
> text {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
margin-bottom: 22rpx;
|
||||
}
|
||||
> view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
> text:first-child {
|
||||
font-size: 30rpx;
|
||||
color: #dec499;
|
||||
}
|
||||
> text:last-child {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.decorate {
|
||||
width: 9rpx;
|
||||
height: 102rpx;
|
||||
background-color: #3fb66e;
|
||||
}
|
||||
}
|
13
components/index/list/commodity/index.wxml
Normal file
13
components/index/list/commodity/index.wxml
Normal file
@ -0,0 +1,13 @@
|
||||
<view class="commodity">
|
||||
<view class="content">
|
||||
<image class="imgthumb "></image>
|
||||
<view class="introduce">
|
||||
<text>产品名称产品名称产品名称产品名称产品名称产品名称产品名称</text>
|
||||
<view>
|
||||
<text>¥657</text>
|
||||
<text>加入购物车</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="decorate"></view>
|
||||
</view>
|
1
components/index/list/commodity/index.wxss
Normal file
1
components/index/list/commodity/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e}
|
8
components/index/list/index.js
Normal file
8
components/index/list/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
Component({
|
||||
properties: {
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
})
|
6
components/index/list/index.json
Normal file
6
components/index/list/index.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"commodity":"./commodity/index"
|
||||
}
|
||||
}
|
4
components/index/list/index.wxml
Normal file
4
components/index/list/index.wxml
Normal file
@ -0,0 +1,4 @@
|
||||
<view class="list">
|
||||
<text class="title">热门商品</text>
|
||||
<commodity></commodity>
|
||||
</view>
|
1
components/index/list/index.wxss
Normal file
1
components/index/list/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
.list{width:623rpx;margin-top:36rpx}.list .title{font-size:30rpx;color:#333;font-weight:bold;margin-left:32rpx}
|
8
components/index/search/index.js
Normal file
8
components/index/search/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
Component({
|
||||
properties: {
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
})
|
3
components/index/search/index.json
Normal file
3
components/index/search/index.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
23
components/index/search/index.scss
Normal file
23
components/index/search/index.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.search{
|
||||
width: 613rpx;
|
||||
height: 76rpx;
|
||||
margin-top: 30rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 15rpx;
|
||||
display: flex;
|
||||
border:1rpx solid rgba(198,198,198,1);
|
||||
>image{
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
background-color: #000;
|
||||
margin-left: 40rpx;
|
||||
margin-top: 17rpx;
|
||||
}
|
||||
>input{
|
||||
height: 30rpx;
|
||||
width: 480rpx;
|
||||
margin-top: 25rpx;
|
||||
margin-left: 17rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
4
components/index/search/index.wxml
Normal file
4
components/index/search/index.wxml
Normal file
@ -0,0 +1,4 @@
|
||||
<view class="search">
|
||||
<image></image>
|
||||
<input type="text" placeholder="输入您要搜索的产品" />
|
||||
</view>
|
1
components/index/search/index.wxss
Normal file
1
components/index/search/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
.search{width:613rpx;height:76rpx;margin-top:30rpx;box-sizing:border-box;border-radius:15rpx;display:flex;border:1rpx solid #c6c6c6}.search>image{width:42rpx;height:42rpx;background-color:#000;margin-left:40rpx;margin-top:17rpx}.search>input{height:30rpx;width:480rpx;margin-top:25rpx;margin-left:17rpx;font-size:30rpx}
|
30
doc/bin.md
Normal file
30
doc/bin.md
Normal file
@ -0,0 +1,30 @@
|
||||
# bin.js
|
||||
## 引入方式
|
||||
模块导入
|
||||
## request 方法
|
||||
对于wx.request()的简单封装
|
||||
request(object)
|
||||
返回值类型 promise
|
||||
除url必须 其余都为可选 详细参数查阅 [微信开发者文档](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html)
|
||||
```
|
||||
object
|
||||
{
|
||||
url,访问地址 必须
|
||||
method,请求方式
|
||||
header,附加header头
|
||||
dataType,返回类型
|
||||
responseType,类型
|
||||
complete 成功失败都执行的回调函数
|
||||
}
|
||||
````
|
||||
```
|
||||
request({
|
||||
|
||||
}).then((res)=>{
|
||||
请求成功执行方法
|
||||
},(rej)=>{
|
||||
请求失败执行方法
|
||||
}).catch((ree)=>{
|
||||
执行错误时调用方法
|
||||
})
|
||||
```
|
@ -1,54 +1,8 @@
|
||||
//index.js
|
||||
//获取应用实例
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
motto: 'Hello World',
|
||||
userInfo: {},
|
||||
hasUserInfo: false,
|
||||
canIUse: wx.canIUse('button.open-type.getUserInfo')
|
||||
data:{
|
||||
|
||||
},
|
||||
//事件处理函数
|
||||
bindViewTap: function() {
|
||||
wx.navigateTo({
|
||||
url: '../logs/logs'
|
||||
})
|
||||
},
|
||||
onLoad: function () {
|
||||
if (app.globalData.userInfo) {
|
||||
this.setData({
|
||||
userInfo: app.globalData.userInfo,
|
||||
hasUserInfo: true
|
||||
})
|
||||
} else if (this.data.canIUse){
|
||||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
||||
// 所以此处加入 callback 以防止这种情况
|
||||
app.userInfoReadyCallback = res => {
|
||||
this.setData({
|
||||
userInfo: res.userInfo,
|
||||
hasUserInfo: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 在没有 open-type=getUserInfo 版本的兼容处理
|
||||
wx.getUserInfo({
|
||||
success: res => {
|
||||
app.globalData.userInfo = res.userInfo
|
||||
this.setData({
|
||||
userInfo: res.userInfo,
|
||||
hasUserInfo: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
getUserInfo: function(e) {
|
||||
console.log(e)
|
||||
app.globalData.userInfo = e.detail.userInfo
|
||||
this.setData({
|
||||
userInfo: e.detail.userInfo,
|
||||
hasUserInfo: true
|
||||
})
|
||||
onLoad(){
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -1,3 +1,6 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"search":"../components/index/search/index",
|
||||
"list":"../components/index/list/index"
|
||||
}
|
||||
}
|
9
pages/index/index.scss
Normal file
9
pages/index/index.scss
Normal file
@ -0,0 +1,9 @@
|
||||
.box {
|
||||
border-top: #eaeaea solid 1rpx;
|
||||
width: 750rpx;
|
||||
// overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
@ -1,13 +1,4 @@
|
||||
<!--index.wxml-->
|
||||
<view class="container">
|
||||
<view class="userinfo">
|
||||
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
|
||||
<block wx:else>
|
||||
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
|
||||
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
|
||||
</block>
|
||||
</view>
|
||||
<view class="usermotto">
|
||||
<text class="user-motto">{{motto}}</text>
|
||||
</view>
|
||||
<view class="box">
|
||||
<search></search>
|
||||
<list></list>
|
||||
</view>
|
@ -1,21 +1 @@
|
||||
/**index.wxss**/
|
||||
.userinfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.userinfo-avatar {
|
||||
width: 128rpx;
|
||||
height: 128rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.userinfo-nickname {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.usermotto {
|
||||
margin-top: 200px;
|
||||
}
|
||||
.box{border-top:#eaeaea solid 1rpx;width:750rpx;display:flex;align-items:center;flex-direction:column}
|
||||
|
@ -1,15 +0,0 @@
|
||||
//logs.js
|
||||
const util = require('../../utils/util.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
logs: []
|
||||
},
|
||||
onLoad: function () {
|
||||
this.setData({
|
||||
logs: (wx.getStorageSync('logs') || []).map(log => {
|
||||
return util.formatTime(new Date(log))
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "查看启动日志",
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<!--logs.wxml-->
|
||||
<view class="container log-list">
|
||||
<block wx:for="{{logs}}" wx:for-item="log">
|
||||
<text class="log-item">{{index + 1}}. {{log}}</text>
|
||||
</block>
|
||||
</view>
|
@ -1,8 +0,0 @@
|
||||
.log-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 40rpx;
|
||||
}
|
||||
.log-item {
|
||||
margin: 10rpx;
|
||||
}
|
31
utils/bin.js
Normal file
31
utils/bin.js
Normal file
@ -0,0 +1,31 @@
|
||||
//请求接口
|
||||
let request = function (obj){
|
||||
let {
|
||||
url,
|
||||
method,
|
||||
header,
|
||||
dataType,
|
||||
responseType,
|
||||
complete
|
||||
} = obj
|
||||
return new Promise((res,rej)=>{
|
||||
Wx.request({
|
||||
url,
|
||||
method,
|
||||
header,
|
||||
dataType,
|
||||
responseType,
|
||||
success(data){
|
||||
res(data)
|
||||
},
|
||||
fail(data){
|
||||
rej(data)
|
||||
},
|
||||
complete
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
request
|
||||
}
|
Loading…
Reference in New Issue
Block a user