Skip to content

Commit

Permalink
初始化零食商城项目
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslwq committed May 25, 2020
0 parents commit a225b91
Show file tree
Hide file tree
Showing 102 changed files with 3,677 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_store
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 零食商城
## 零食商城
### 零食商城
#### 零食商城
##### 零食商城
###### 零食商城
***
*斜体文字*
* * *
_斜体文字_
*****
斜体文件
---
**粗体文件**

---
__粗体文件__
~~____粗斜体____~~

---

<u>下划线</u>

- 业务逻辑
- 技术要点
- 详细代码
+ 业务逻辑
+ 技术要点
+ 详细代码
* 业务逻辑
* 技术要点
* 详细代码

1. 第一点
- 123
- 456
- 678
2. 第二点
3. 第三点
# 区域
> 引用的第一部分
>> 引用的第一部分子部分
>>> 引用的第一部分子部分子部分
> 引用的第二部分
> 引用的第二部分
> 引用的第二部分
```html
<html>
<head>
</head>
<body>
</body>
</html>

```
```js
console.log(123)
```
[百度](http://www.baidu.com)
![百度](https://www.runoob.com/wp-content/uploads/2019/03/A042DF30-C232-46F3-8436-7D6C35351BBD.jpg)
![图片](./image/1.jpg)

39 changes: 39 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)

// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo

// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
}
})
45 changes: 45 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"pages":[
"pages/index/index",
"pages/theme/theme",
"pages/good/good",
"pages/category/category",
"pages/cart/cart",
"pages/pay/pay",
"pages/my/my",
"pages/address/address",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#a99471",
"navigationBarTitleText": "零食商城",
"navigationBarTextStyle":"white"
},
"tabBar": {
"selectedColor": "#a99471",
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "image/home.png",
"selectedIconPath": "image/home-o.png"
},{
"pagePath": "pages/category/category",
"text": "分类",
"iconPath": "image/category.png",
"selectedIconPath": "image/category-o.png"
},{
"pagePath": "pages/cart/cart",
"text": "购物车",
"iconPath": "image/cart.png",
"selectedIconPath": "image/cart-o.png"
},{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "image/my.png",
"selectedIconPath": "image/my-o.png"
}]
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
18 changes: 18 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

/*
样式的初始化
*/
view,image,navigator,text,swiper,swiper-item,checkbox{
margin:0rpx;
padding:0rpx;
box-sizing: border-box;
}

image{
width: 100%;
height: 100%;
}
/* 页面文件 */
page{
--themeColor:#a89473; /* 主题颜色 */
}
Empty file added asyncUtil.js
Empty file.
36 changes: 36 additions & 0 deletions asyncUtil/asyncUtil.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@


// showModal
let asyncShowModal = function asyncShowModal(content){
return new Promise(function(resolve,reject){
wx.showModal({
content: content,
success:function(res){
if(res.confirm){
resolve(res)
}else{
reject(res)
}
}
})
})
}
// chooseAddress
// https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html
let asyncChooseAddress = function asyncChooseAddress(){
return new Promise(function(resolve,reject){
wx.chooseAddress({
success:function(res){
resolve(res)
},
fail:function(err){
reject(err)
}
})
})
}

// 导出
export {
asyncShowModal, asyncChooseAddress
}
26 changes: 26 additions & 0 deletions components/newest-list/newest-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// components/newest-list/newest-list.js
Component({
/**
* 组件的属性列表
*/
properties: {
newest:{
type:Array,
value:[]
}
},

/**
* 组件的初始数据
*/
data: {

},

/**
* 组件的方法列表
*/
methods: {

}
})
4 changes: 4 additions & 0 deletions components/newest-list/newest-list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
14 changes: 14 additions & 0 deletions components/newest-list/newest-list.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<view class="snack-newest-list">
<navigator
url="/pages/good/good?id={{item.id}}"
open-type="navigate"
class="snack-newest-list-item" wx:for="{{newest}}" wx:key="index">
<view class="imageWrapper">
<image src="{{item.imageUrl}}"></image>
</view>
<view class="desc">
<view class="title">{{item.title+" "}}{{item.count}}</view>
<view class="price">¥{{item.price}}</view>
</view>
</navigator>
</view>
21 changes: 21 additions & 0 deletions components/newest-list/newest-list.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.snack-newest-list {
display: flex;
flex-wrap: wrap;
}
.snack-newest-list .snack-newest-list-item {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.snack-newest-list .snack-newest-list-item .imageWrapper {
height: 180rpx;
width: 180rpx;
}
.snack-newest-list .snack-newest-list-item .desc .title {
text-align: center;
}
.snack-newest-list .snack-newest-list-item .desc .price {
text-align: center;
}
Loading

0 comments on commit a225b91

Please sign in to comment.