init
This commit is contained in:
commit
03e9f64ff4
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
/miniprogram_npm/
|
||||||
|
/node_modules/
|
||||||
19
app.js
Normal file
19
app.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
})
|
||||||
15
app.json
Normal file
15
app.json
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/logs/logs"
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationBarTitleText": "Weixin",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff"
|
||||||
|
},
|
||||||
|
"style": "v2",
|
||||||
|
"componentFramework": "glass-easel",
|
||||||
|
"sitemapLocation": "sitemap.json",
|
||||||
|
"lazyCodeLoading": "requiredComponents"
|
||||||
|
}
|
||||||
10
app.wxss
Normal file
10
app.wxss
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/**app.wxss**/
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 200rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
18
package-lock.json
generated
Normal file
18
package-lock.json
generated
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "car_front",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"@vant/weapp": "^1.11.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@vant/weapp": {
|
||||||
|
"version": "1.11.7",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.11.7.tgz",
|
||||||
|
"integrity": "sha512-Rwn9BBnb4kHSV4XmvBicwtd42J+amEUfnFDcXJsGNPNX4a9c/DoT6YLsm4X1wB2+sQbdiQsbFBLAvGRBxCkD8g==",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
package.json
Normal file
5
package.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"@vant/weapp": "^1.11.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
44
pages/index/index.js
Normal file
44
pages/index/index.js
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
bannerList: [
|
||||||
|
'http://192.168.1.11:8089/uploads/20250630/054c53776891b766c6f1bd65059a5b27.jpg',
|
||||||
|
'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg'
|
||||||
|
],
|
||||||
|
company: {
|
||||||
|
name: '某某汽车服务有限公司',
|
||||||
|
address: '上海市浦东新区世纪大道100号',
|
||||||
|
latitude: 31.2304, // 地图坐标
|
||||||
|
longitude: 121.4737,
|
||||||
|
phone: '021-88888888'
|
||||||
|
},
|
||||||
|
carList: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: '丰田 卡罗拉 1.2T 自动',
|
||||||
|
image: 'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg',
|
||||||
|
registerDate: '2021-05',
|
||||||
|
mileage: 3.5,
|
||||||
|
emission: '国六'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
title: '本田 思域 1.5T 手动',
|
||||||
|
image: 'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg',
|
||||||
|
registerDate: '2020-08',
|
||||||
|
mileage: 5.2,
|
||||||
|
emission: '国五'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
openMap() {
|
||||||
|
const { latitude, longitude, address, name } = this.data.company
|
||||||
|
wx.openLocation({
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
scale: 18,
|
||||||
|
name,
|
||||||
|
address
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
7
pages/index/index.json
Normal file
7
pages/index/index.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
"van-icon": "@vant/weapp/icon/index",
|
||||||
|
"van-button": "@vant/weapp/button/index",
|
||||||
|
"van-card": "@vant/weapp/card/index"
|
||||||
|
}
|
||||||
|
}
|
||||||
39
pages/index/index.wxml
Normal file
39
pages/index/index.wxml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
<!-- 顶部轮播图 -->
|
||||||
|
<swiper autoplay="3000" circular indicator-dots class="banner">
|
||||||
|
<block wx:for="{{bannerList}}" wx:key="index">
|
||||||
|
<swiper-item>
|
||||||
|
<image src="{{item}}" class="banner-image" mode="aspectFill" />
|
||||||
|
</swiper-item>
|
||||||
|
</block>
|
||||||
|
</swiper>
|
||||||
|
|
||||||
|
<!-- 公司信息 -->
|
||||||
|
<view class="company-info">
|
||||||
|
<view class="company-name">{{company.name}}</view>
|
||||||
|
<view class="company-address">
|
||||||
|
<van-icon name="location-o" size="16px" />
|
||||||
|
<text>{{company.address}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="company-actions">
|
||||||
|
<van-button size="small" type="primary" plain icon="location-o" bindtap="openMap">导航</van-button>
|
||||||
|
<van-button size="small" type="info" plain icon="phone" open-type="makePhoneCall" data-phone="{{company.phone}}">电话</van-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 车辆列表 -->
|
||||||
|
<!-- 汽车列表 -->
|
||||||
|
<view class="car-list">
|
||||||
|
<block wx:for="{{carList}}" wx:key="id">
|
||||||
|
<view class="car-item">
|
||||||
|
<image src="{{item.image}}" class="car-image" mode="aspectFill" />
|
||||||
|
<view class="car-info">
|
||||||
|
<view class="car-title">{{item.title}}</view>
|
||||||
|
<view class="car-detail">
|
||||||
|
<span class="car-subtext">{{item.registerDate}}</span>
|
||||||
|
<span class="car-subtext">{{item.mileage}} km</span>
|
||||||
|
<span class="car-subtext">{{item.emission}}</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
100
pages/index/index.wxss
Normal file
100
pages/index/index.wxss
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
.banner {
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
.banner-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-info {
|
||||||
|
padding: 20rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.company-name {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
.company-address {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
.company-address van-icon {
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
.company-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-list {
|
||||||
|
padding: 20rpx;
|
||||||
|
background-color: #f7f8fa;
|
||||||
|
}
|
||||||
|
.banner {
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
.banner-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.car-list {
|
||||||
|
padding: 20rpx;
|
||||||
|
background-color: #f7f8fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-item {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 1rpx 4rpx rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-image {
|
||||||
|
width: 220rpx;
|
||||||
|
height: 140rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-info {
|
||||||
|
flex: 1;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-title {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-detail text {
|
||||||
|
display: block;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 6rpx;
|
||||||
|
}
|
||||||
|
.car-detail {
|
||||||
|
font-size: 24rpx; /* 父容器整体字体大小 */
|
||||||
|
color: #999999; /* 次要文字颜色 */
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx; /* 间隔,兼容微信小程序flex-gap */
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-subtext {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
18
pages/logs/logs.js
Normal file
18
pages/logs/logs.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
4
pages/logs/logs.json
Normal file
4
pages/logs/logs.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
}
|
||||||
|
}
|
||||||
6
pages/logs/logs.wxml
Normal file
6
pages/logs/logs.wxml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<!--logs.wxml-->
|
||||||
|
<scroll-view class="scrollarea" scroll-y type="list">
|
||||||
|
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
|
||||||
|
<view class="log-item">{{index + 1}}. {{log.date}}</view>
|
||||||
|
</block>
|
||||||
|
</scroll-view>
|
||||||
16
pages/logs/logs.wxss
Normal file
16
pages/logs/logs.wxss
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
page {
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.scrollarea {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
.log-item {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.log-item:last-child {
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
}
|
||||||
41
project.config.json
Normal file
41
project.config.json
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"compileType": "miniprogram",
|
||||||
|
"libVersion": "trial",
|
||||||
|
"packOptions": {
|
||||||
|
"ignore": [],
|
||||||
|
"include": []
|
||||||
|
},
|
||||||
|
"setting": {
|
||||||
|
"coverView": true,
|
||||||
|
"es6": true,
|
||||||
|
"postcss": true,
|
||||||
|
"minified": true,
|
||||||
|
"enhance": true,
|
||||||
|
"showShadowRootInWxmlPanel": true,
|
||||||
|
"packNpmRelationList": [],
|
||||||
|
"babelSetting": {
|
||||||
|
"ignore": [],
|
||||||
|
"disablePlugins": [],
|
||||||
|
"outputPath": ""
|
||||||
|
},
|
||||||
|
"compileWorklet": false,
|
||||||
|
"uglifyFileName": false,
|
||||||
|
"uploadWithSourceMap": true,
|
||||||
|
"packNpmManually": false,
|
||||||
|
"minifyWXSS": true,
|
||||||
|
"minifyWXML": true,
|
||||||
|
"localPlugins": false,
|
||||||
|
"condition": false,
|
||||||
|
"swc": false,
|
||||||
|
"disableSWC": true,
|
||||||
|
"disableUseStrict": false,
|
||||||
|
"useCompilerPlugins": false
|
||||||
|
},
|
||||||
|
"condition": {},
|
||||||
|
"editorSetting": {
|
||||||
|
"tabIndent": "auto",
|
||||||
|
"tabSize": 2
|
||||||
|
},
|
||||||
|
"appid": "wxfebb5f10af4f59ce",
|
||||||
|
"simulatorPluginLibVersion": {}
|
||||||
|
}
|
||||||
23
project.private.config.json
Normal file
23
project.private.config.json
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
|
"projectname": "car_front",
|
||||||
|
"setting": {
|
||||||
|
"compileHotReLoad": true,
|
||||||
|
"urlCheck": true,
|
||||||
|
"coverView": true,
|
||||||
|
"lazyloadPlaceholderEnable": false,
|
||||||
|
"skylineRenderEnable": false,
|
||||||
|
"preloadBackgroundData": false,
|
||||||
|
"autoAudits": false,
|
||||||
|
"useApiHook": true,
|
||||||
|
"useApiHostProcess": true,
|
||||||
|
"showShadowRootInWxmlPanel": true,
|
||||||
|
"useStaticServer": false,
|
||||||
|
"useLanDebug": false,
|
||||||
|
"showES6CompileOption": false,
|
||||||
|
"bigPackageSizeSupport": false,
|
||||||
|
"checkInvalidKey": true,
|
||||||
|
"ignoreDevUnusedFiles": true
|
||||||
|
},
|
||||||
|
"libVersion": "3.8.10"
|
||||||
|
}
|
||||||
7
sitemap.json
Normal file
7
sitemap.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [{
|
||||||
|
"action": "allow",
|
||||||
|
"page": "*"
|
||||||
|
}]
|
||||||
|
}
|
||||||
19
utils/util.js
Normal file
19
utils/util.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
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…
Reference in New Issue
Block a user