first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
.DS_Store
node_modules
myWxapp/node_modules
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -0,0 +1,17 @@
//app.js
// const utils = require("./utils/util.js")
// global.$utils = utils
import Api from "./utils/api.js";
import Utils from "./utils/util.js";
global.$api = new Api()
global.$utils = new Utils()
App({
onLaunch: function () {
},
globalData: {
statusBarHeight: global.$utils.getStatusBarHeight()
}
})

View File

@@ -0,0 +1,52 @@
{
"usingComponents": {
"van-button": "@vant/weapp/button"
},
"pages": [
"pages/index/index",
"pages/login/login",
"pages/me/me",
"pages/search/search",
"pages/info/info",
"pages/type/type",
"pages/car/car",
"pages/orderState/orderState",
"components/swiper/swiper"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"tabBar": {
"list": [
{
"iconPath": "static/index_01.png",
"selectedIconPath": "static/index_02.png",
"pagePath": "pages/index/index",
"text": "首页"
},
{
"iconPath": "static/type_01.png",
"selectedIconPath": "static/type_02.png",
"pagePath": "pages/type/type",
"text": "分类"
},
{
"iconPath": "static/car_01.png",
"selectedIconPath": "static/car_02.png",
"pagePath": "pages/car/car",
"text": "购物车"
},
{
"iconPath": "static/me_01.png",
"selectedIconPath": "static/me_02.png",
"pagePath": "pages/me/me",
"text": "我的"
}
]
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

View File

@@ -0,0 +1,6 @@
.van-icon-arrow-left {
vertical-align: middle;
}
.van-search {
background: rgba(0,0,0,0) !important;
}

View File

@@ -0,0 +1,47 @@
Component({
data: {
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 2000,
current: 0, // 默认第一张图
imgheights: [], //所有图片的高度
height: wx.getSystemInfoSync()['statusBarHeight'] + 50
},
properties: {
// 需要被渲染显示的图片地址数组
list: {
type: Array,
value: []
},
// 如果父组件自定义顶部导航后建议传true做边距
// 如果没有自定义那么不传数值默认false图片和顶部没有边距
padding: {
type: Boolean,
value: false
}
},
methods: {
imageLoad: function (e) {//获取图片真实宽度
var imgwidth = e.detail.width,
imgheight = e.detail.height,
ratio = imgwidth / imgheight;
console.log(imgwidth, imgheight)
//计算的高度值
var viewHeight = 750 / ratio;
var imgheight = viewHeight;
var imgheights = this.data.imgheights;
//把每一张图片的对应的高度记录到数组里
imgheights[e.target.dataset.id] = imgheight;
this.setData({
imgheights: imgheights
})
},
bindchange: function (e) {
// console.log(e.detail.current)
this.setData({ current: e.detail.current })
},
}
})

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,18 @@
<view class="swiper" style="padding-top: {{padding ? height : 20}}px;">
<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}"
interval="{{interval}}"
bindchange="bindchange"
style="height:{{imgheights[current]}}rpx;"
duration="{{duration}}">
<block wx:for="{{list}}" wx:key="index">
<swiper-item>
<image data-id="{{index}}"
mode="widthFix"
src="{{item}}"
bindload="imageLoad">
</image>
</swiper-item>
</block>
</swiper>
</view>

View File

@@ -0,0 +1,6 @@
.swiper{
padding-top: 68px;
}
image {
width: 100%;
}

View File

@@ -0,0 +1,3 @@
export default {
baseUrl: 'http://127.0.0.1:9090'
}

View File

@@ -0,0 +1,15 @@
{
"name": "myWxapp",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@vant/weapp": "^1.0.0"
}
}

View File

@@ -0,0 +1,192 @@
// pages/car/car.js
const app = getApp()
Page({
//复选框
data: {
checked: true,
result: [],
CarList: [],
ll: [],
isChoiceStatus: true,
showEdit: true,
muns: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
// this.getTypeList()
this.test()
},
async test() {
var token = wx.getStorageSync('token')
// console.log(token)
var data = await global.$api.post({
url: "/car/getCarList",
data: {},
})
console.log(data.result)
this.setData({
CarList: data.result
})
},
async onPirce(event) {
console.log("even",event)
var data = await global.$api.post({
url: "/car/updateCarNum",
data: {
carid: event.currentTarget.dataset.id,
quantity: event.detail
}
})
},
TotalMoney () {
console.log(this.data.result)
if (this.data.result.length != 0) {
var price = 0, data = []
this.data.result.forEach(val => {
this.data.CarList.forEach(v => {
if (val.indexOf(v.car_id) != -1) {
// console.log(v)
data.push(v)
}
console.log(data)
})
})
data.forEach(val => {
// console.log(val)
price += val.wares_nowprice * val.car_num
})
console.log(price)
this.setData({
muns : price * 100
})
}else{
this.setData({
muns: 0
})
}
},
onChange(event) {
console.log(event)
this.setData({
result: event.detail// 数组
})
// console.log(this.data.result)
this.TotalMoney()
},
onClickButton(e) {//提交订单
},
typeLogin() {
wx.getStorage({
key: 'token',
success(res) {
console.log(res.data)
}
})
},
async onSubmit() {
var price = 0, datas = []
this.data.result.forEach(val => {
this.data.CarList.forEach(v => {
if (val.indexOf(v.car_id) != -1) {
// console.log(v)
datas.push(v)
}
// console.log(datas)
})
})
// console.log(datas[0].wares_id)
var data = await global.$api.post({
url: "/car/submitCar",
data: {
carList: {
"waresid": datas[0].wares_id,
"goodsnum": datas[0].car_num,
"goodsprice": datas[0].wares_nowprice,
}
}
})
console.log(data)
wx.navigateTo({
url: '../payment/payment?price=' + this.data.result,
})
},
async ondelete() {
console.log("tdyhjgfds")
var data = await global.$api.post({
url: "/car/deleteCar",
data: {
carid: this.data.result
}
})
},
checkAll() {
this.setData({
isChoiceStatus: !this.data.isChoiceStatus
})
if (this.data.isChoiceStatus == false) {
var lll = []
this.data.CarList.forEach((item, index) => {
lll.push(JSON.stringify(item.car_id))
this.setData({
result: lll
})
console.log(this.data.result)
this.TotalMoney()
})
} else {
this.setData({
result: []
})
this.TotalMoney()
}
},
CheckBox: function (e) {
console.log("eeee");
},
EditCar() {
this.setData({
showEdit: !this.data.showEdit
})
console.log(this.data.showEdit)
}
})

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"van-card": "@vant/weapp/card/index",
"van-stepper": "@vant/weapp/stepper/index",
"van-submit-bar": "@vant/weapp/submit-bar/index",
"van-checkbox": "@vant/weapp/checkbox/index",
"van-checkbox-group": "@vant/weapp/checkbox-group/index"
}
}

View File

@@ -0,0 +1,40 @@
<!--pages/car/car.wxml-->
<view class="car">
<view bindtap="EditCar">{{ showEdit ? '编辑' : '完成' }}</view>
<van-checkbox-group value="{{ result }}" bind:change="onChange">
<view class="carlist" wx:for="{{CarList}}" wx:key="index">
<van-checkbox name="{{ item.car_id }}"></van-checkbox>
<van-card
price="{{item.wares_nowprice}}"
desc="{{item.wares_info}}"
title="{{item.wares_title}}"
thumb="{{ item.wares_infoimg[0] }}"
>
<view slot="footer">
<van-stepper value="{{ item.car_num }}" data-id="{{item.car_id}}" bind:change="onPirce" />
</view>
</van-card>
</view>
</van-checkbox-group>
<van-submit-bar
wx:if="{{showEdit}}"
price="{{ muns }}"
button-text="疯狂买"
bind:submit="onSubmit"
>
<p bindtap="checkAll">{{ isChoiceStatus ? '全选' : '取消' }}</p>
</van-submit-bar>
<van-submit-bar
wx:else
button-text="删除"
bind:submit="ondelete"
>
<p class="car_left" bindtap="checkAll">{{ isChoiceStatus ? '全选' : '取消' }}</p>
</van-submit-bar>
</view>

View File

@@ -0,0 +1,39 @@
.car_left{
position: absolute;
left: 0
}
.van-submit-bar{
width: 100%
}
.van-checkbox__label{
width: 90%;
}
.van-checkbox{
align-items: center;
}
.van-card{
background-color: #fff !important
}
.value-class {
flex: none !important;
}
.van-submit-bar__bar{
width: 100%
}
.van-button--square{
width: 100% !important;
}
.car_commodity{
margin-left: 5%;
width: 95%
}
.ctrl{
padding-left: 5%
}
.carlist {
display: flex;
justify-content: flex-start;
align-items: center;
}

View File

@@ -0,0 +1,58 @@
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
ShopList: [],
value: '',
height: 0,
SwiperList: ['../../static/banner.jpg', '../../static/banner.jpg','../../static/banner.jpg'],
typeList: [
{ id: 1, text: '限时白嫖', href: '/list', icon: '../../static/type_1.png' },
{ id: 2, text: '新品推荐', href: '/list', icon: '../../static/type_2.png' },
{ id: 3, text: '低价高配', href: '/list', icon: '../../static/type_3.png' },
{ id: 4, text: '超值特卖', href: '/list', icon: '../../static/type_4.png' }
]
},
onLoad: function () {
this.getHomeList()
this.setData({
height: app.globalData.statusBarHeight
})
},
onClickLeft() {
wx.showToast({ title: '点击返回', icon: 'none' });
},
onClickRight() {
wx.showToast({ title: '点击按钮', icon: 'none' });
},
async getHomeList() {
var data = await global.$api.post({
url: "/home/index",
data: {}
});
console.log("index:",data)
data.result.forEach((val) => {
val.wares_info = val.wares_info.substring(0,10) + '..';
val.wares_masterimg = JSON.parse(val.wares_masterimg)[0]
})
this.setData({
ShopList: data.result
})
console.log(data.result);
},
enterInfo(item) {
console.log("item: ", item.currentTarget.dataset.list.wares_id)
wx.navigateTo({
url: `/pages/info/info?id=${item.currentTarget.dataset.list.wares_id}`
})
},
enterlist(e) {
var a = e.currentTarget.dataset.id+1
console.log(a)
wx.navigateTo({
url: `/pages/list/list?id=${a}`
})
},
})

View File

@@ -0,0 +1,13 @@
{
"navigationBarTitleText": "首页",
"navigationStyle": "custom",
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-search": "@vant/weapp/search/index",
"lb-swiper": "/components/swiper/swiper",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
}

View File

@@ -0,0 +1,66 @@
<view class="container">
<navigator url='../search/search'>
<view class="header" style="margin-top: {{height}}px;">
<image src="../../static/logoing.png"></image>
<van-search
shape="round"
class="search-input"
value="{{ value }}"
placeholder="请输入搜索关键词" />
</view>
</navigator>
<lb-swiper list="{{SwiperList}}"/>
<van-grid border="{{false}}">
<van-grid-item use-slot data-id="{{index}}" wx:for="{{ typeList }}" bindtap="enterlist" wx:key="index">
<image src="{{item.icon}}"></image>
<text>{{item.text}}</text>
</van-grid-item>
</van-grid>
<van-row>
<van-col span="12">
<image
src="../../static/banner4.jpg"
alt="">
</image>
</van-col>
<van-col span="12">
<van-row>
<van-col span="24">
<image style="height: 118px"
src="../../static/banner2.jpg"
alt="">
</image>
<image style="height: 118px"
src="../../static/banner3.jpg"
alt="">
</image>
</van-col>
</van-row>
</van-col>
</van-row>
<van-row>
<van-col span="24">
<image style="height: 160px" src="../../static/banner1.jpg"
alt="">
</image>
</van-col>
</van-row>
<van-row>
<van-col class="shop_item"
wx:for="{{ShopList}}"
span="12"
data-list="{{item}}"
bindtap="enterInfo"
wx:key="index">
<image src="{{item.wares_masterimg}}"></image>
<text class="title">{{item.wares_title}}</text>
<text class="info">{{ item.wares_info}}...</text>
<text class="price">¥{{item.wares_nowprice}}</text>
</van-col>
</van-row>
</view>

View File

@@ -0,0 +1,55 @@
.header {
height: 46px;
width: 100%;
position: fixed;
display: flex;
justify-content: flex-start;
padding: 0 10px;
box-sizing: border-box;
align-items: center;
z-index:99999;
}
.header image{
width: 25px;
height: 20px;
}
.search-input {
width: 69%;
}
.van-grid image {
width: 40px;
height: 40px;
margin-bottom: 5px;
}
.van-grid text {
font-size: 13px;
}
.van-col--12 {
text-align: center
}
.shop_item {
margin-bottom: 10px;
}
.shop_item image{
width: 150px;
height: 145px;
}
.shop_item text {
display: block
}
.shop_item .title{
font-size: 14px;
color: rgba(0,0,0,.87);
}
.shop_item .info{
font-size: 12px;
color: rgba(0,0,0,.54);
margin-top: 4px;
}
.shop_item .price{
font-size: 14px;
color: #ea625b;
margin-top: 4px;
line-height: 21px;
}

View File

@@ -0,0 +1,68 @@
// pages/info/info.js
Page({
/**
* 页面的初始数据
*/
data: {
id: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id: options.id
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

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

View File

@@ -0,0 +1,2 @@
<!--pages/info/info.wxml-->
<text>pages/info/info.wxml: {{ id }}</text>

View File

@@ -0,0 +1 @@
/* pages/info/info.wxss */

View File

@@ -0,0 +1,51 @@
// pages/list/list.js
const app = getApp()
Page({
data: {
getList:[],
getActList:[],
id: '',
typeList: [
{ id: 1, title: "限时白嫖" },
{ id: 2, title: "新品推荐" },
{ id: 3, title: "低价高配" },
{ id: 4, title: "超值特卖" }
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log("info",options.id)
this.setData({ id:options.id})
console.log("setdata", this.data.id)
this.getActList()
},
async getActList() {
var data = await global.$api.post({
url: "/home/activity",
data: {
id: this.data.id
}
});
console.log(data)
data.result.forEach((val) => {
val.wares_info = val.wares_info.substring(0,10) + '..';
val.wares_masterimg = JSON.parse(val.wares_masterimg)[0]
})
this.setData({
getList: data.result
})
console.log(data.result);
},
enterInfo(item) {
console.log("item: ", item.currentTarget.dataset.list.wares_id)
wx.navigateTo({
url: `/pages/info/info?id=${item.currentTarget.dataset.list.wares_id}`
})
},
})

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "活动",
"usingComponents": {
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
}

View File

@@ -0,0 +1,21 @@
<view class="container">
<van-row>
<van-col span="24">
<image style="width: 100%;height: 160px" src="../../static/banner1.jpg"
alt="">
</image>
</van-col>
</van-row>
<view class="content"
wx:for="{{getList}}"
data-list="{{item}}"
bindtap="enterInfo"
wx:key="index">
<image src="{{item.wares_masterimg}}" class="content_img" ></image>
<view class="content_title">
<text class="title">{{item.wares_title}}</text>
<text class="info">{{ item.wares_info}}...</text>
<text class="price">¥{{item.wares_nowprice}}</text>
</view>
</view>
</view>

View File

@@ -0,0 +1,34 @@
.content {
display: flex;
margin: 10px;
box-sizing: border-box;
height: 160px;
border-bottom: 1px #eee solid;
}
.content_img {
width: 150px !important;
height: 150px !important;
}
.content_title {
display: flex;
margin-left: 10px;
flex-direction: column;
color: rgba(0,0,0,.87);
}
.title{
font-size: 22px;
}
.info{
width: 150px;
height: 50px;
font-size: 14px;
margin-top: 10px;
color: #9a9a9a;
overflow: hidden;
}
.price{
margin-top: 20px;
font-size: 22px;
margin-left: .1rem;
color: #f56600;
}

View File

@@ -0,0 +1,99 @@
// pages/login/login.js
//登录示例
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
UserList:{
name: '',
pwd: ''
}
},
Userinput: function (e) {
this.setData({
'UserList.name': e.detail.value
})
},
Pwdinput: function (e) {
this.setData({
'UserList.pwd': e.detail.value
})
},
async Userlogin () {
if (this.data.UserList.name.length == 0 || this.data.UserList.pwd.length == 0) {
wx.showToast({
title: '用户名和密码不能为空',
icon: 'none',
duration: 2000
})
// this.setData({
// infoMess: '温馨提示:用户名和密码不能为空!',
// })
} else {
var data = await global.$api.post({
url: "/user/login",
data: this.data.UserList
});
wx.showToast({
title: '登录成功',
icon: 'success',
duration: 2000,
success: function () {
wx.switchTab({ url: '/pages/index/index'})
// wx.navigateTo({ url: '/pages/index/index' })
}
})
// wx.navigateTo({ url: `/pages/index/index` })
wx.setStorageSync('token', data.result.token);
console.log("data: ", data)
}
},
onLoad: function (options) {
var value = wx.getStorageSync('token')
// console.log(value)
},
/**
* 生命周期函数--监听页面加载
*/
addUser: function () {
},
//注册页面跳转
Register(){
wx.navigateTo({
url: `/pages/register/register`
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
})

View File

@@ -0,0 +1,9 @@
{
"navigationBarTitleText": "挚友买商城",
"navigationBarBackgroundColor":"#666beb",
"navigationBarTextStyle": "white",
"navigationStyle":"default",
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index"
}
}

View File

@@ -0,0 +1,41 @@
<!--pages/login/login.wxml-->
<view class="login">
<image src="../../static/logo/login_img1.png" class="loginback_img" mode="widthFix"></image>
<view class="login-from">
<view class="login_title">
<text>登录</text>
</view>
<form bindsubmit="formSubmit" class='form'>
<view class="myno">
<!-- 用户名 -->
<view class="weui-cell weui-cell_input">
<image class="nameImage" src="../../static/logo/user.png"></image>
<view class="weui-cell__bd">
<input class="weui-input" bindinput="Userinput" placeholder="请输入用户名" />
</view>
</view>
</view>
<view class="mypwd">
<!-- 密码 -->
<view class="weui-cell weui-cell_input">
<image class="nameImage" src="../../static/logo/lock.png"></image>
<!-- <view class="weui-cell__hd">
<view class="weui-label">密码</view>
</view> -->
<view class="weui-cell__bd">
<input class="weui-input" type="password" bindinput="Pwdinput" placeholder="请输入密码" value='{{pwd}}'/>
</view>
</view>
</view>
<!--按钮-->
<view class="loginBtnView">
<button class="loginBtn" bindtap="Userlogin">登录</button>
</view>
</form>
<view bindtap="Register" class="register">
<text>还没有账号?点此注册。</text>
</view>
<view>{{infoMess}}</view>
<view>{{username}}</view>
</view>
</view>

View File

@@ -0,0 +1,152 @@
/* pages/login/login.wxss */
/* 头部 */
.header {
height: 46px;
width: 100%;
position: fixed;
display: flex;
justify-content: flex-start;
padding: 0 10px;
box-sizing: border-box;
color: #fff;
align-items: center;
text-align: center;
}
/* 整体 */
.login_password{
width: 324px;
height: 208px;
position: relative;
margin: auto;
border-radius: 20px;
}
/* 标题 */
.login_title{
padding-left: 162px;
width: 100%;
font-size: 40px;
color: #fff;
padding-bottom: 114px;
}
/* 背景图片 */
.user{
width: 20px;
height: 20px;
z-index: -1;
}
/* 头部标题 */
.shopshop{
padding-left: 116px;
font-size: 20px;
color: #ffff;
padding-top: 60px;
z-index: 999;
}
.input{
padding-top: 82px;
padding-left: 118px;
position: absolute;
}
.username{
padding-bottom: 12px;
}
page{
height:100%;
}
.loginback_img{
width: 100%;
height: 100%;
position:fixed;
background-size:100% 100%;
vertical-align: middle;
z-index: -1;
}
/* pages/login/login.wxss */
.container {
height: 100%;
display: flex;
flex-direction: column;
padding: 0;
box-sizing: border-box;
/* background-color: #f2f2f2; */
}
/*登录图片*/
.login-icon{
flex: none;
margin: 0 auto;
margin-top: 200rpx;
}
.login-img{
width: 220rpx;
height: 220rpx;
border-radius: 110rpx;
opacity: 0.6;
}
/*表单内容*/
.login-from {
padding-top: 95px;
flex: auto;
height: 100%;
}
/* input位置 */
input{
padding-left: 74px;
}
.weui-cell{
display: flex;
padding-top: 12px;
}
/* 输入框 */
.myno{
width: 90%;
height: 80rpx;
margin: 0 auto;
border:1px solid #ccc;
border-radius: 50rpx;
}
.mypwd{
width: 90%;
height: 80rpx;
margin: 0 auto;
border:1px solid #ccc;
border-radius: 50rpx;
margin-top: 20rpx;
}
/*按钮*/
.loginBtnView {
margin-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
}
.loginBtn {
width: 90%;
height: 80rpx;
margin-top: 35px;
color: #fff;
background-color:#7e8ef0;
border: 0.1rpx solid #ccc;
border-radius: 40rpx;
}
/*输入框图片内容 */
.nameImage, .keyImage {
margin-left: 40px;
width: 20px;
height: 20px;
}
.register{
width: 100%;
padding-left: 111px;
padding-top: 11px;
color: #ffff;
z-index: 9999;
}

View File

@@ -0,0 +1,78 @@
// pages/me/me.js
Page({
/**
* 页面的初始数据
*/
data: {
typeList: [
{ text: '全部订单', icon: '../../static/logo/user/choujiang.png' },
{ text: '待付款', icon: '../../static/logo/user/bank.png' },
{ text: '待发货', icon: '../../static/logo/user/security.png' },
{ text: '待收货', icon: '../../static/logo/user/renw.png' },
{ text: '退款/售后', icon: '../../static/logo/user/mingxi.png' }
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
enterlist(e) {
var a = e.currentTarget.dataset.id + 1
console.log(a)
wx.navigateTo({
url: `/pages/orderState/orderState?id=${a}`
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,13 @@
{
"navigationBarTitleText": "我的",
"navigationBarBackgroundColor": "#666beb",
"navigationBarTextStyle": "white",
"navigationStyle": "default",
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index"
}
}

View File

@@ -0,0 +1,32 @@
<!--pages/me/me.wxml-->
<view class="me">
<view class="header">
<image class="me_back" src="../../static/logo/me_back.png" ></image>
<view class="user_he">
<image class="setting" src="../../static/logo/user_head.png" ></image>
<view class="user_ll">
<text class="user_name">你好啊哈哈哈哈</text>
<text class="user_qiandao">签名:丈夫志不大,何以佐乾坤。</text>
</view>
</view>
</view>
<view>
<van-grid border="{{false}}" column-num="5">
<van-grid-item use-slot wx:for="{{ typeList }}" wx:key="index" bindtap="enterlist" data-id="{{ index }}">
<image src="{{item.icon}}"></image>
<text>{{item.text}}</text>
</van-grid-item>
</van-grid>
</view>
<view class="hh">
<van-cell :clickable="true" :center="true" title="收货地址">
<image class="hh_a" slot="icon" src="../../static/logo/user/addr.png" alt=""></image>
</van-cell>
<van-cell :clickable="true" :center="true" title="我的收藏">
<image class="hh_a" slot="icon" src="../../static/logo/user/point.png" alt=""></image>
</van-cell>
<van-cell :clickable="true" :center="true" title="我的设置">
<image class="hh_a" slot="icon" src="../../static/logo/user/security.png" alt=""></image>
</van-cell>
</view>
</view>

View File

@@ -0,0 +1,59 @@
/* pages/me/me.wxss */
.van-grid image {
width: 40px;
height: 40px;
margin-bottom: 5px;
}
.van-grid text {
font-size: 13px;
}
.van-col--12 {
text-align: center
}
.header{
width: 100%;
height: 200px;
background-position: center center;
background-size: cover;
position: relative;
}
.me_back{
width: 100%;
z-index: -1;
position:fixed;
background-size:100%;
vertical-align: middle;
}
.setting{
width: 62px;
height: 58px;
z-index: 9;
}
.user_he{
position: absolute;
left: 32px;
display: flex;
top: 114px;
}
.user_ll{
padding-top: 13px;
padding-left: 4px;
}
.user_qiandao{
display: block;
font-size: 12px;
padding-top: 5px;
}
.hh_a{
width: 40px;
height: 37px;
}
.van-cell__title{
flex: 1;
padding-left: 20px;
padding-top: 8px;
}

View File

@@ -0,0 +1,82 @@
// pages/orderState/orderState.js
Page({
/**
* 页面的初始数据
*/
data: {
active:0,
titleList:[
{ id: -1, title: "全部订单", orderList:[]},
{ id: 0, title: "待付款", orderList: []},
{ id: 1, title: "待发货", orderList: []},
{ id: 2, title: "待收货", orderList: []},
{ id: 3, title: "退货/售后", orderList: []}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
console.log("data", this.data.titleList)
this.setData({
active: options.id
})
// console.log(options.id);
if (options.id === undefined || options.id == ""){
this.getOrderList(-1)
}else {
var a = options.id-1
console.log(a);
this.getOrderList(a)
}
},
onClick(event) {
var that = this
// wx.showToast({
// title: `点击标签 ${event.detail.name}`,
// icon: 'none'
// });
// console.log(that.data.titleList[event.detail.name].title);
wx.setNavigationBarTitle({
title: that.data.titleList[event.detail.name]
})
this.getOrderList(that.data.titleList[event.detail.name].id)
},
async getOrderList(index) {
var sume= index + 1
console.log(index);
// console.log(this.data.titleList[sume].orderList.length)
if (this.data.titleList[sume].orderList.length === 0) {
var data = await global.$api.post({
url: "/order/allOrder",
data: {
status: index
}
});
if (JSON.stringify(data.result) != "{}"){
data.result.forEach((val) => {
val.wares_info = val.wares_info.substring(0, 10) + '..';
val.wares_masterimg = JSON.parse(val.wares_masterimg)[0]
})
var datalist = this.data.titleList
datalist[sume].orderList = data.result
this.setData({
titleList: datalist
})
}
}
},
setDetails (item) {
console.log("id: ", item.currentTarget.dataset.id)
wx.navigateTo({
url: `/pages/info/info?id=${item.currentTarget.dataset.id}`
})
}
})

View File

@@ -0,0 +1,9 @@
{
"navigationStyle": "default",
"navigationBarTitleText":"全部订单",
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-card": "@vant/weapp/card/index"
}
}

View File

@@ -0,0 +1,18 @@
<view class="order_state">
<van-tabs active="{{ active }}" bind:click="onClick">
<van-tab title="{{ item.title }}" wx:for="{{titleList}}" wx:key="index">
<van-card
wx:for="{{titleList[index].orderList}}"
wx:key="index"
num="{{item.goods_num}}"
price="{{item.wares_nowprice}}"
desc="{{item.wares_info}}"
title="{{item.wares_title}}"
thumb="{{item.wares_masterimg}}"
data-id="{{item.wares_id}}"
bindtap="setDetails"
/>
</van-tab>
</van-tabs>
</view>

View File

@@ -0,0 +1 @@
/* saaa */

View File

@@ -0,0 +1,117 @@
// pages/register/register.js
Page({
/**
* 页面的初始数据
*/
data: {
UserMessage:{
name: "",
pwd: "",
phone: ""
}
},
Userinput: function (e) {
this.setData({
'UserMessage.name': e.detail.value
})
},
Pwdinput: function (e) {
this.setData({
'UserMessage.pwd': e.detail.value
})
},
Phoneinput: function (e) {
this.setData({
'UserMessage.phone': e.detail.value
})
},
async Registerlogin() {
if (this.data.UserMessage.name.length == 0 || this.data.UserMessage.pwd.length == 0 || this.data.UserMessage.pwd.length == 0) {
wx.showToast({
title: '用户名和密码不能为空',
icon: 'none',
duration: 2000
})
// this.setData({
// infoMess: '温馨提示:用户名和密码不能为空!',
// })
} else {
var data = await global.$api.post({
url: "/user/add",
data: this.data.UserMessage
});
wx.showToast({
title: '注册成功',
icon: 'success',
duration: 2000,
success: function () {
wx.switchTab({ url: '/pages/login/login' })
// wx.navigateTo({ url: '/pages/index/index' })
}
})
console.log("data: ", data)
}
},
Login() {
wx.navigateTo({
url: `/pages/login/login`
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,9 @@
{
"navigationBarTitleText": "挚友买商城",
"navigationBarBackgroundColor": "#666beb",
"navigationBarTextStyle": "white",
"navigationStyle": "default",
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index"
}
}

View File

@@ -0,0 +1,50 @@
<!--pages/login/login.wxml-->
<view class="login">
<image src="../../static/logo/login_img1.png" class="loginback_img" mode="widthFix"></image>
<view class="login-from">
<view class="login_title">
<text>注册</text>
</view>
<form bindsubmit="formSubmit" class='form'>
<view class="myno">
<!-- 用户名 -->
<view class="weui-cell weui-cell_input">
<image class="nameImage" src="../../static/logo/user.png"></image>
<view class="weui-cell__bd">
<input class="weui-input" bindinput="Userinput" placeholder="请输入用户名" />
</view>
</view>
</view>
<view class="myno">
<!-- 用户名 -->
<view class="weui-cell weui-cell_input">
<image class="nameImage" src="../../static/logo/phone.png"></image>
<view class="weui-cell__bd">
<input class="weui-input" bindinput="Phoneinput" placeholder="请输入手机号" />
</view>
</view>
</view>
<view class="mypwd">
<!-- 密码 -->
<view class="weui-cell weui-cell_input">
<image class="nameImage" src="../../static/logo/lock.png"></image>
<!-- <view class="weui-cell__hd">
<view class="weui-label">密码</view>
</view> -->
<view class="weui-cell__bd">
<input class="weui-input" type="password" bindinput="Pwdinput" placeholder="请输入密码" value='{{pwd}}'/>
</view>
</view>
</view>
<!--按钮-->
<view class="loginBtnView">
<button class="loginBtn" bindtap="Registerlogin">注册</button>
</view>
</form>
<view bindtap="Login" class="register">
<text>还没有账号?点此登录。</text>
</view>
<view>{{infoMess}}</view>
<view>{{username}}</view>
</view>
</view>

View File

@@ -0,0 +1,152 @@
/* pages/login/login.wxss */
/* 头部 */
.header {
height: 46px;
width: 100%;
position: fixed;
display: flex;
justify-content: flex-start;
padding: 0 10px;
box-sizing: border-box;
color: #fff;
align-items: center;
text-align: center;
}
/* 整体 */
.login_password{
width: 324px;
height: 208px;
position: relative;
margin: auto;
border-radius: 20px;
}
/* 标题 */
.login_title{
padding-left: 162px;
width: 100%;
font-size: 40px;
color: #fff;
padding-bottom: 114px;
}
/* 背景图片 */
.user{
width: 20px;
height: 20px;
z-index: -1;
}
/* 头部标题 */
.shopshop{
padding-left: 116px;
font-size: 20px;
color: #ffff;
padding-top: 60px;
z-index: 999;
}
.input{
padding-top: 82px;
padding-left: 118px;
position: absolute;
}
.username{
padding-bottom: 12px;
}
page{
height:100%;
}
.loginback_img{
width: 100%;
height: 100%;
position:fixed;
background-size:100% 100%;
vertical-align: middle;
z-index: -1;
}
/* pages/login/login.wxss */
.container {
height: 100%;
display: flex;
flex-direction: column;
padding: 0;
box-sizing: border-box;
/* background-color: #f2f2f2; */
}
/*登录图片*/
.login-icon{
flex: none;
margin: 0 auto;
margin-top: 200rpx;
}
.login-img{
width: 220rpx;
height: 220rpx;
border-radius: 110rpx;
opacity: 0.6;
}
/*表单内容*/
.login-from {
padding-top: 95px;
flex: auto;
height: 100%;
}
/* input位置 */
input{
padding-left: 74px;
}
.weui-cell{
display: flex;
padding-top: 12px;
}
/* 输入框 */
.myno{
width: 90%;
height: 80rpx;
margin: 0 auto;
border:1px solid #ccc;
border-radius: 50rpx;
}
.mypwd{
width: 90%;
height: 80rpx;
margin: 0 auto;
border:1px solid #ccc;
border-radius: 50rpx;
margin-top: 20rpx;
}
/*按钮*/
.loginBtnView {
margin-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
}
.loginBtn {
width: 90%;
height: 80rpx;
margin-top: 35px;
color: #fff;
background-color:#7e8ef0;
border: 0.1rpx solid #ccc;
border-radius: 40rpx;
}
/*输入框图片内容 */
.nameImage, .keyImage {
margin-left: 40px;
width: 20px;
height: 20px;
}
.register{
width: 100%;
padding-left: 111px;
padding-top: 11px;
color: #ffff;
z-index: 9999;
}

View File

@@ -0,0 +1,84 @@
const app = getApp()
Page({
data: {
height: 0,
SearchKeyword: "",
showView: true,
searchList: [],
inputValue: '',
tagList: [
{ text: "小米" },
{ text: "华为" },
{ text: "16t" },
{ text: "11Pro" },
{ text: "锤子" },
{ text: "三星" }
]
},
onLoad: function () {
this.getSearch();
this.setData({
height: app.globalData.statusBarHeight
})
},
//显示,隐藏
onChangeShowState: function () {
this.setData({
showView: (!this.data.showView)
})
},
//获取input里的值
getitems: function (e) {
this.setData({
inputValue: e.detail.value
})
// this.getSearch(this.data.inputValue);
console.log(e.detail.value)
},
// getSear: function (data) {
// this.getitems()
// },
//上下联动
getitem: function(data) {
// var a = data.currentTarget.dataset.hi
// console.log(a)
this.setData({
SearchKeyword: "",
SearchKeyword: data.currentTarget.dataset.hi
})
this.getSearch(this.data.SearchKeyword);
console.log(this.data.SearchKeyword)
},
async getSearch(datas) {
console.log(datas)
var data = await global.$api.post({
url: "/home/search",
data: {
keyword: datas
}
});
console.log(data)
this.searchList = data;
data.result.forEach((val) => {
val.wares_info = val.wares_info.substring(0, 10) + '..';
val.wares_masterimg = JSON.parse(val.wares_masterimg)[0]
})
this.setData({
searchList: data.result
})
},
cliekss(){
this.getSearch(this.data.inputValue)
},
enterInfo(item) {
console.log("item: ", item.currentTarget.dataset.list.wares_id)
wx.navigateTo({
url: `/pages/info/info?id=${item.currentTarget.dataset.list.wares_id}`
})
}
});

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "搜索",
"navigationStyle": "custom",
"usingComponents": {
"van-tag": "@vant/weapp/tag/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
}

View File

@@ -0,0 +1,30 @@
<view class="search">
<view class="search_head" style="margin-top: {{height}}px;">
搜索
</view>
<view class="search_top">
<input placeholder="请输入搜索内容" class="button" value="{{SearchKeyword}}" bindtap="onChangeShowState" bindinput="getitems"/>
<view bindtap="cliekss" class="sum"><text>搜索</text></view>
</view>
<view class="content">
<view class="{{showView?'popular':'list'}}" bindtap="onChangeShowState">
<view class="title">热门搜索</view>
<van-tag round wx:for="{{tagList}}" data-hi="{{item.text}}" wx:key="index" type="warning" size="large" bindtap="getitem">{{item.text}}</van-tag>
</view>
<view class="{{showView?'list':'popular'}}">
<van-row type="flex">
<van-col class="shop_item"
wx:for="{{searchList}}"
span="12"
data-list="{{item}}"
bindtap="enterInfo"
wx:key="index">
<image src="{{item.wares_masterimg}}"></image>
<text class="title">{{item.wares_title}}</text>
<text class="info">{{ item.wares_info}}...</text>
<text class="price">¥{{item.wares_nowprice}}</text>
</van-col>
</van-row>
</view>
</view>
</view>

View File

@@ -0,0 +1,84 @@
.search{
width: 100%
}
.search_head{
text-align: center;
width: 100%;
position: fixed;
background: #fff
}
.search_top {
margin-top: 75px;
height: 32px;
width: 100%;
position: fixed;
display: flex;
justify-content : space-between;
align-items: center
}
.button{
margin: auto;
width: 70%;
height: 30px;
font-size: 15px;
border-radius: 47px;
padding-left: 15px;
background: #f8f8f8;
border: #000 1px;
opacity:0.8
}
.sum{
font-size: 14px;
color: #000;
padding-right: 30px
}
.content{
padding-top: 120px;
}
.popular {
padding: 1px;
display: block;
}
.title{
text-align: center;
font-size: 18px;
}
.van-tag {
margin-left: 15px;
margin-top: 10px
}
.list{
margin-top: 10px;
display: none;
}
.van-col--12 {
text-align: center
}
.shop_item {
margin-bottom: 10px;
}
.shop_item image{
width: 160px;
height: 145px;
}
.shop_item text {
display: block
}
.shop_item .title{
font-size: 14px;
color: rgba(0,0,0,.87);
}
.shop_item .info{
font-size: 12px;
color: rgba(0,0,0,.54);
margin-top: 4px;
}
.shop_item .price{
font-size: 14px;
color: #ea625b;
margin-top: 4px;
line-height: 21px;
}

View File

@@ -0,0 +1,64 @@
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
activeIndex: 0,
currentTypeName: '小米',
items: [
{ text: '小米', content: [] },
{ text: '魅族', content: [] },
{ text: '华为', content: [] },
{ text: 'iphone', content: [] },
{ text: '三星', content: [] },
{ text: '锤子', content: [] },
{ text: '诺基亚', content: [] },
]
},
onLoad: function () {
this.getTypeList(0)
},
// changeTitle(e) {
// this.setData({
// currentTypeName: this.data.items[e.currentTarget.dataset.index].text
// })
// this.getTypeList(e.currentTarget.dataset.index)
// this.setData({
// activeIndex: e.currentTarget.dataset.index
// })
// },
changeTitle(e) {
this.setData({
currentTypeName: this.data.items[e.detail.index].text
})
this.getTypeList(e.detail.index)
this.setData({
activeIndex: e.detail.index
})
},
async getTypeList(index) {
if (this.data.items[index].content.length == 0) {
var data = await global.$api.post({
url: "/type/list",
data: {
typename: this.data.currentTypeName
}
});
let contentlist = 'items[' + index + '].content'
this.setData({
[contentlist]: data.result
})
}
},
enterInfo(item) {
console.log("item: ", item.currentTarget.dataset.list.wares_id)
wx.navigateTo({
url: `/pages/info/info?id=${item.currentTarget.dataset.list.wares_id}`
})
}
})

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "分类",
"usingComponents": {
"van-tree-select": "@vant/weapp/tree-select/index"
}
}

View File

@@ -0,0 +1,21 @@
<view class='type'>
<view class="tabs">
<view class="tabs-title">
<!-- <text bindtap="changeTitle" data-index="{{index}}" wx:for="{{items}}" wx:key="index">{{item.text}}</text> -->
<van-tree-select
items="{{ items }}"
main-active-index="{{ activeIndex }}"
bind:click-nav="changeTitle"
/>
</view>
<view class="tabs-content">
<view class="info" wx:for="{{items[activeIndex].content}}" wx:for-index="idx" data-list="{{item}}"
bindtap="enterInfo">
<image src="{{item.wares_masterimg}}"></image>
<text>{{item.wares_title}}</text>
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,49 @@
/* pages/type/type.wxss */
.tabs-title {
width: 20%;
float: left;
position: fixed;
top: 0px;
left: 0;
height: 100%;
}
.tabs-title text {
height: 50px;
line-height: 50px;
text-align: center;
}
.tabs-content {
width: 78%;
float: right;
}
.tabs-title text {
display: block
}
.info {
width: 50%;
height: 200px;
text-align: center;
}
.info image {
width: 100px;
height: 130px;
}
.info text {
display: block;
}
.tabs-content {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
margin-top: 10px;
}
.active {
background: #ffffff;
}
.van-tree-select {
height: 100% !important;
}
.van-sidebar-item,.van-sidebar-item--selected {
height: 55px;
line-height: 34px;
}

View File

@@ -0,0 +1,55 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": true,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "2.9.4",
"appid": "wx21366c2534acf389",
"projectname": "myWxapp",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -0,0 +1,23 @@
import config from "../config/config.js"
export default class Api {
constructor () {
this.baseUrl = config.baseUrl
}
post (params) {
console.log("params: ", params)
return new Promise((resolve,reject)=>{
wx.request({
url: `${this.baseUrl}${params.url}`,
data: params.data,
method: 'POST',
header:{
"token": wx.getStorageSync('token')
},
success(res) {
resolve(res.data)
}
})
})
}
}

View File

@@ -0,0 +1,12 @@
export default class Utils {
getStatusBarHeight() {
try {
const res = wx.getSystemInfoSync()
return res.statusBarHeight
} catch (e) {
console.log("获取系统信息失败")
}
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "Shop电商App",
"version": "1.2.0",
"description": "Shop电商app后端接口",
"title": "电商App",
"url" : "http://127.0.0.1:9090",
"header": {
"title": "使用注意事项",
"filename": "header.md"
}
}

View File

@@ -0,0 +1,57 @@
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var validator = require('./utils/Validator');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var typeRouter = require('./routes/type');
var carRouter = require('./routes/car');
var orderRouter = require('./routes/order');
var app = express();
app.all('*', function (req, res, next) {
res.header("Access-Control-Allow-Credentials",true)
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET, PUT, POST, OPTIONS')
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, token, data')
if (req.method == 'OPTIONS') {
res.sendStatus(200)
} else {
next()
}
});
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
// 导入全局拦截器
app.use(validator.Validator);
app.use('/home', indexRouter);
app.use('/user', usersRouter);
app.use('/type', typeRouter);
app.use('/car', carRouter);
app.use('/order', orderRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
});
module.exports = app;

View File

@@ -0,0 +1,90 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('shop-backend:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '9090');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
console.log("You App is run: http://127.0.0.1:9090")
}

View File

@@ -0,0 +1,42 @@
module.exports = {
mysql: {
host: 'localhost',
user: 'root',
password: 'lb714500',
database: 'shop'
},
jwt: 'Pc!0YQPA$57iksjA',
rsa: {
private_key: '../config/private_key.pem',
public_key: '../config/public_key.pem'
},
filter: {
login: '/user/login',
add: '/user/add'
},
sql: {
getUserAddress: 'SELECT user_address from `user` where user_id = ?',
updateUserMoney: 'UPDATE `user` SET user_money = ? WHERE user_id = ?',
userOrderTotalMoney: 'SELECT goods_totalprice from goods where goods_id = ?',
getUserMoney: 'SELECT user_money from `user` where user_id = ?',
buyOrder: 'UPDATE goods SET goods_status = ? WHERE goods_id = ?',
getStatusOrder: 'SELECT goods.*, wares.* FROM goods, wares WHERE goods.wares_id = wares.wares_id AND goods.user_id = ? AND goods.goods_status = ?',
getAllOrder: 'SELECT goods.*, wares.* FROM goods, wares WHERE goods.wares_id = wares.wares_id AND goods.user_id = ?',
addCarToOrder: 'INSERT INTO goods (user_id,wares_id,goods_num,goods_price,goods_totalprice) VALUES (?,?,?,?,?)',
updateCarNum: 'UPDATE car SET car_num = ? WHERE car_id = ?',
deleteCarShop: 'DELETE FROM car WHERE car_id = ?',
getCarList: 'SELECT car.user_id,car.car_id,car.car_num, wares.* FROM car ,wares WHERE car.wares_id = wares.wares_id AND car.user_id = ?',
selectCarShop: 'SELECT * from car where user_id = ? and wares_id = ?',
addCar: 'INSERT INTO car (user_id,wares_id,car_num) VALUES (?,?,?)',
getLikeList: 'SELECT collection.like_id, wares.* FROM collection ,wares WHERE collection.wares_id = wares.wares_id AND collection.user_id = ?',
selectLike: 'SELECT * from collection where wares_id = ? and user_id = ?',
likeShop: 'INSERT INTO collection (wares_id,user_id) VALUES (?, ?)',
getSearchShop: `SELECT * from wares where wares_title LIKE "%?%"`,
getTypeList: 'SELECT wares_title,wares_id,wares_masterimg from wares where wares_type = ?',
getActivity: 'SELECT * from wares where wares_activity = ?',
getInfo: 'SELECT * from wares where wares_id = ?',
getIndex: 'SELECT * from wares ORDER BY wares_id DESC LIMIT 20',
addUser: 'INSERT INTO `user` (user_name,user_pwd,user_phone,user_time) VALUES (?, ?, ?, ?)',
userLogin: 'SELECT * from user where user_name = ? and user_pwd = ?'
}
};

Some files were not shown because too many files have changed in this diff Show More