Skip to content

Commit

Permalink
项目搭建
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxiaode committed Oct 8, 2018
0 parents commit 135189f
Show file tree
Hide file tree
Showing 50 changed files with 1,912 additions and 0 deletions.
842 changes: 842 additions & 0 deletions app.js

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"pages": [
"pages/home/index",
"pages/index/index",
"pages/userCenter/index",
"pages/order/index",
"pages/about/index"
],
"tabBar": {
"color": "#666",
"selectedColor": "#0152f6",
"position": "bottom",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "assets/home.png",
"selectedIconPath": "assets/homeHover.png",
"text": "首页"
},
{
"pagePath": "pages/userCenter/index",
"iconPath": "assets/user.png",
"selectedIconPath": "assets/userHover.png",
"text": "个人中心"
}
]
},
"window": {
"backgroundTextStyle": "dark",
"navigationBarBackgroundColor": "#1890ff",
"navigationBarTitleText": "shopping",
"navigationBarTextStyle": "white"
}
}
1 change: 1 addition & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/**app.wxss**/
1 change: 1 addition & 0 deletions assets/cart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/homeHover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/item.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/noOrder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/order.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/paided.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/unpaid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/userHover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/welcome.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions components/arrowBtn/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
properties: {
arrowData: Object
},
data: {
arrowData: {
showArrow: true,
arrowL: '',
arrowR: '',
icon: false
}
},
attached() {
this.dataInit()
},
methods: {
dataInit() {
this.setData({
showArrow: this.properties.arrowData.showArrow,
arrowL: this.properties.arrowData.arrowL,
arrowR: this.properties.arrowData.arrowR,
icon: this.properties.arrowData.icon
})
}
}
})
4 changes: 4 additions & 0 deletions components/arrowBtn/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
10 changes: 10 additions & 0 deletions components/arrowBtn/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<view class="arrowBtn">
<view class="arrowL">
<image wx:if="{{arrowData.icon}}" src="{{arrowData.icon}}"></image>
<text>{{arrowData.arrowL}}</text>
</view>
<view class="arrowR">
<text>{{arrowData.arrowR}}</text>
<image wx:if="{{arrowData.showArrow}}" src="../../assets/right.svg"></image>
</view>
</view>
26 changes: 26 additions & 0 deletions components/arrowBtn/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**index.wxss**/
.arrowBtn{
display:flex;justify-content: space-between;align-items: center;
padding:0 30rpx;background:#fff;
height:100rpx;
}
.arrowBtn .arrowL{
display:flex;align-items: center;
}
.arrowBtn .arrowL image{
width:36rpx;height:36rpx;
padding-right:10rpx;
}
.arrowBtn .arrowL text{
font-size:36rpx;font-family:"Microsoft Yahei";
}
.arrowBtn .arrowR{
display:flex;align-items: center;
}
.arrowBtn .arrowR text{
font-size:32rpx;color:#999;
padding-right:10rpx;
}
.arrowBtn .arrowR image{
width:32rpx;height:32rpx;
}
48 changes: 48 additions & 0 deletions components/cookItem/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const app = getApp()
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
properties: {
item: Object
},
data: {
item:{}
},
attached() {
this.dataInit()
},
methods: {
dataInit(){
this.setData({
item: this.properties.item
})
},
handlePlus(event) {
let item = this.data.item
item.num++
this.setData({ item })
app.globalData.cookList.map((element, index) => {
element.cookBd.map((child, idx) => {
if (child.id === item.id) {
child.num = item.num
}
})
})
this.triggerEvent('changePrice')
},
handleMinus(event) {
let item = this.data.item
item.num--
this.setData({ item })
app.globalData.cookList.map((element, index) => {
element.cookBd.map((child, idx) => {
if (child.id === item.id) {
child.num = item.num
}
})
})
this.triggerEvent('changePrice')
}
}
})
4 changes: 4 additions & 0 deletions components/cookItem/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
16 changes: 16 additions & 0 deletions components/cookItem/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<view class="item">
<image class="itemIcon" src="{{item.icon}}"></image>
<view class="itemTxt">
<view class="cookName">{{item.cookName}}</view>
<view class="cookInfo">{{item.cookIntro}}</view>
<view class="cookInfo">月售{{item.sals}} 赞{{item.like}}</view>
<view class="cookPrice">
<text class="cookPriceNum">¥{{item.price}}<text>/500g</text></text>
<view class="changeNum">
<image class="cookIcon minus" wx:if="{{item.num > 0}}" bindtap="handleMinus" src="../../assets/minus.svg"></image>
<view class="num" wx:if="{{item.num > 0}}">{{item.num}}</view>
<image class="cookIcon plus" bindtap="handlePlus" src="../../assets/plus.svg"></image>
</view>
</view>
</view>
</view>
40 changes: 40 additions & 0 deletions components/cookItem/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**index.wxss**/

.item{
display:flex;justify-content:space-around;align-items: center;
padding:20rpx;font-family: "Microsoft Yahei";
border-bottom:solid 2rpx #eee;
}
.item .itemIcon{
width:200rpx;height:200rpx;
}
.item .itemTxt{
display:flex;flex-direction: column;justify-content:space-between;align-items: flex-start;flex:1;
margin-left:20rpx;height:200rpx;
}
.item .cookName{
font-size:36rpx;font-weight:bold;color:#666;
}
.item .cookInfo{
font-size:28rpx;color:#999;
}
.item .cookPrice{
display:flex;justify-content:space-between;align-items: center;width:100%;
font-size:38rpx;font-weight:bold;color:#f00;
}
.item .cookPrice .cookPriceNum{
flex:1;
}
.item .cookPrice .cookPriceNum text{
font-weight:normal;font-size:30rpx;color:#ccc;
}
.item .cookPrice .changeNum{
display:flex;justify-content:flex-end;align-items: center;
}
.item .cookPrice .cookIcon{
width:48rpx;height:48rpx;border-radius:24rpx;
}
.item .cookPrice .num{
color:#333;
flex:1;
}
13 changes: 13 additions & 0 deletions pages/about/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//index.js
//获取应用实例
const app = getApp()

Page({
data: {
},
//事件处理函数
bindViewTap: function() {
},
onLoad: function () {
}
})
5 changes: 5 additions & 0 deletions pages/about/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"component": true,
"usingComponents": {},
"navigationBarTitleText": "关于我们"
}
10 changes: 10 additions & 0 deletions pages/about/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--index.wxml-->
<view class="about">
<image src="../../assets/logo.png"></image>
<view class="aboutCont">
<view>姓名:张孝德</view>
<view>电话:15057159482</view>
<view>门店:亢亢点单</view>
<view>地址:杭州市西湖区</view>
</view>
</view>
11 changes: 11 additions & 0 deletions pages/about/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**index.wxss**/
page{
height:100%;text-align:center;
}
.about image{
width:200rpx;height:200rpx;
}
.about .aboutCont{
text-align:left;width:80%;margin:0 auto;
line-height:100rpx;
}
44 changes: 44 additions & 0 deletions pages/home/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//index.js
//获取应用实例
const app = getApp()

Page({
data: {
},
//事件处理函数
bindViewTap: function() {
},
startRecord() {
// console.log(this.pusher)
// this.pusher.start()
// this.player.play()
// wx.chooseVideo({
// maxDuration: 10,
// success: function (res1) {
// app.startOperating("上传中")
// // 这个就是最终拍摄视频的临时路径了
// var tempFilePath = res1.tempFilePath;
// },
// fail: function () {
// console.error("获取本地视频时出错");
// }
// })
},
endRecord() {
},
onLoad: function () {
setTimeout(()=>{
wx.switchTab({
url: '../index/index'
})
},1000)

// wx.authorize({
// scope: 'scope.userInfo'
// })
// this.pusher = wx.createLivePusherContext('pusher')
// this.player = wx.createLivePusherContext('player')

// wx.startRecord()
}
})
4 changes: 4 additions & 0 deletions pages/home/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#c6f"
}
9 changes: 9 additions & 0 deletions pages/home/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--index.wxml-->
<view class="homePage">
<image src="../../assets/welcome.jpg"></image>
<!-- <button open-type="getUserInfo">获取权限</button>
<live-pusher id="pusher" url="https://domain/push_stream" mode="RTC" autopush />
<live-player id="player" url="https://domain/push_stream" mode="live" autoplay />
<button bindtap='startRecord'>开始录音</button>
<button bindtap='endRecord'>结束录音</button> -->
</view>
10 changes: 10 additions & 0 deletions pages/home/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**index.wxss**/
page{
height:100%;
}
.homePage{
height:100%;overflow:hidden;text-align:center;
}
.homePage image{
min-width:100%;min-height:100%;
}
Loading

0 comments on commit 135189f

Please sign in to comment.