wbb的实践报告

master
wbb 2 years ago
parent e88999738c
commit 62dfcdad82

@ -17,7 +17,9 @@
"pages/addAddress/addAddress",
"pages/myorder/myorder",
"pages/orderdetail/orderdetail",
"pages/searchfood/searchfood"
"pages/searchfood/searchfood",
"pages/select1/select1",
"pages/select2/select2"
],
"tabBar": {

@ -36,7 +36,7 @@ Page({
wx.hideLoading({
})
wx.setStorageSync('foodlist', res.data)
let foodlist= wx.getStorageSync('foodlist')
var foodlist= wx.getStorageSync('foodlist')
console.log(foodlist)

@ -5,18 +5,20 @@ Page({
tastes: ['香辣','香咸','酸甜','椒麻'],
index:null,
current:'',
re:[],
selectlist:[]
},
tasteSelect:function(e){
wx.showLoading({
title: '正在为您精心挑选食物~',
})
var taste=e.currentTarget.dataset.taste
console.log(taste)
var foodlist=this.data.foodlist
console.log(foodlist)
var foodlistselect=[]
console.log(foodlist[1].taste)
//对食物进行筛选
for(var i=0;i<foodlist.length;i++){
if(foodlist[i].taste==taste){
@ -33,6 +35,7 @@ console.log(foodlistselect);
if(select<0){
select="0"
}
console.log(select)
var selection=foodlistselect[select]
console.log(selection)
@ -43,6 +46,8 @@ console.log(foodlistselect);
selection.checks="false"
var selection2=[]
selection2.push(selection)
wx.hideLoading({
success: (res) => {
wx.showModal({
title:'提示',
content:'今天吃'+name,
@ -53,37 +58,25 @@ console.log(foodlistselect);
url:'/pages/paying/paying?info='+JSON.stringify(selection2)+'&totalprice='+total
})
}
}
})
}
})
},
// wx.navigateTo({
// url: '/pages/fuzzy/fuzzy?list='+JSON.stringify(list),
// })
/**
* 页面的初始数据
*/
/**
* 生命周期函数--监听页面加载
*/
onLoad:function(options) {
var foodlist=JSON.parse(options.info)
console.log(foodlist)
this.setData({
foodlist:foodlist
})
},
/**

@ -3,5 +3,6 @@
<view wx:for="{{tastes}}">
<view class="button" hover-class="button_hover" >
<text bindtap="tasteSelect" data-taste="{{item}}">{{item}}</text>
</view></view>
</view>
</view>
</view>

@ -1,31 +0,0 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

@ -1,19 +0,0 @@
// app.js
App({
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
globalData: {
userInfo: null
}
})

@ -1,14 +0,0 @@
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

@ -1,10 +0,0 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 KiB

@ -1,77 +0,0 @@
//index.js
//获取应用实例
let animation = wx.createAnimation({
duration: 2000,
timingFunction: 'linear'
})
Page({
data: {
rotate: 0, //度数
turning: false //是否点击
},
//事件处理函数
start: function() {
let _this = this;
let cat = 60;
if (!this.data.turning) {
let rdm = 0; //随机度数
rdm = Math.floor(Math.random() * 3600); //最大10圈
//rdm = 1200;//直接确定转的度数
animation.rotate(rdm).step();
this.setData({
rotate: animation.export(),
turning: true
});
setTimeout(() => {
this.setData({
turning: false
});
let num = rdm % 360; //转了多少度
//console.log(num);
function showModal(str) {
wx.showModal({
title: '提示',
content: str,
success: function() { //点击确定后还原到0度
let animation = wx.createAnimation({
duration: 100,
timingFunction: 'linear'
});
animation.rotate(0).step();
_this.setData({
rotate: animation.export(),
turning: false
});
},
fail: function(res) {
console.log(res)
}
})
}
if (num <= cat * 0.5 && num>=cat*0 || num>=cat*5.5 ) {
showModal('今天就吃自选餐吧不要再想了GOGO');
}else if (num <= cat * 1.5 && num >= cat * 0.5) {
showModal('今天就吃麻辣烫吧不要再想了GOGO');
} else if (num <= cat * 2.5 && num >= cat * 1.5) {
showModal('今天就吃汉堡炸鸡吧不要再想了GOGO');
} else if (num <= cat * 3.5 && num >= cat * 2.5) {
showModal('今天就吃面食吧不要再想了GOGO');
} else if (num <= cat * 4.5 && num >= cat * 3.5) {
showModal('今天就吃烤盘饭吧不要再想了GOGO');
} else if (num <= cat * 5.5 && num >= cat * 4.5) {
showModal('今天就吃煎饼果子吧不要再想了GOGO');
}
console.log(num)
}, 2000)
}
},
onLoad: function() {
},
})

@ -1,3 +0,0 @@
{
"usingComponents": {}
}

@ -1,16 +0,0 @@
<!--index.wxml-->
<view class="container">
<image src='/images/bg_2.png' class="bg_2"></image>
<image src='/images/start.png' animation="{{rotate}}" bindtap="start" class="start"></image>
<view class="detail">自选餐</view>
<view class="detail">麻辣烫</view>
<view class="detail">汉堡炸鸡</view>
<view class="detail">面食</view>
<view class="detail">烤盘饭</view>
<view class="detail">煎饼果子</view>
<view class="btnView">
<button class="btn1" type="warn" plain="true">返回</button>
</view>
</view>

@ -1,70 +0,0 @@
/**index.wxss**/
.container view{
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
}
.bg_2{
width: 514rpx;
height: 514rpx;
position: absolute;
top: 60rpx;
}
.start{
width: 134rpx;
height: 163rpx;
position: absolute;
top: 220rpx;
}
.detail{
position: absolute;
}
/* 自选餐 */
.container>.detail:nth-child(3){
top:20px;left:125px;
width: 70px; height: 20px;
font-weight:bold;
color: rgb(3, 10, 32);
}
/* 麻辣烫 */
.container>.detail:nth-child(4){
top:60px;left:175px;
width: 70px; height: 20px;
font-weight:bold;
color: rgb(0, 0, 0);
}
/* 炸鸡汉堡 */
.container>.detail:nth-child(5){
top:115px;left:180px;
width: 70px; height: 20px;
font-weight:bold;
color: rgb(2, 3, 7);
}
/* 面食 */
.container>.detail:nth-child(6){
top:150px;left:125px;
width: 70px; height: 20px;
font-weight:bold;
color: rgb(0, 4, 15);
}
/* 烤盘饭 */
.container>.detail:nth-child(7){
top: 118px;left:70px;
width: 70px; height: 20px;
font-weight:bold;
color: rgb(0, 3, 12);
}
/* 煎饼果子 */
.container>.detail:nth-child(8){
top:60px;left:70px;
width: 70px; height: 20px;
font-weight:bold;
color: rgb(0, 2, 7);
}
.container>.btnView>.btn1{
top:220px;left:-40px;
}

@ -1,18 +0,0 @@
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

@ -1,6 +0,0 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>

@ -1,8 +0,0 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

@ -1,51 +0,0 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"bundle": false,
"userConfirmedBundleSwitch": false,
"urlCheck": true,
"scopeDataCheck": false,
"coverView": true,
"es6": true,
"postcss": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"preloadBackgroundData": false,
"minified": true,
"autoAudits": false,
"newFeature": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"useIsolateContext": true,
"nodeModules": false,
"enhance": true,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"enableEngineNative": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false,
"minifyWXML": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "2.19.4",
"appid": "wx0c976aa21b9e6e57",
"projectname": "miniprogram-92",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
}
}

@ -1,7 +0,0 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "miniprogram-1",
"setting": {
"compileHotReLoad": true
}
}

@ -1,7 +0,0 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -1,19 +0,0 @@
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
}
module.exports = {
formatTime
}
Loading…
Cancel
Save