Compare commits

...

12 Commits

Author SHA1 Message Date
ebba3ca7d3 添加 README.md 2024-01-24 09:59:48 +08:00
757412fac6 更新 app.json 2024-01-09 16:11:02 +08:00
1c043f2041 更新 policy.wxss 2024-01-09 16:04:43 +08:00
35d6a58a44 更新 policy.wxml 2024-01-09 16:04:40 +08:00
9d6a63ddd3 更新 policy.js 2024-01-09 16:04:38 +08:00
d11830d360 更新 home.js 2024-01-09 16:04:36 +08:00
138d104692 更新 config.js 2024-01-09 15:22:47 +08:00
2e6702a3bf 更新 home.wxml 2024-01-09 15:22:44 +08:00
3463cd1bd8 更新 login.js 2024-01-08 14:13:37 +08:00
61e2f4d9ad 更新 login.wxss 2024-01-06 15:28:02 +08:00
0e2fe478b1 更新 login.wxml 2024-01-06 15:27:59 +08:00
d546c90dbc 更新 login.js 2024-01-06 15:27:56 +08:00
11 changed files with 77 additions and 54 deletions

1
README.md Normal file
View File

@@ -0,0 +1 @@
微信小程序

View File

@@ -15,14 +15,6 @@
"navigationBarBackgroundColor": "#2b4b6b"
},
"style": "v2",
"rendererOptions": {
"skyline": {
"defaultDisplayBlock": true,
"disableABTest": true,
"sdkVersionBegin": "3.0.0",
"sdkVersionEnd": "15.255.255"
}
},
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"

View File

@@ -22,8 +22,15 @@ Page({
wx.request({
url: requestUrl + '/api/get-menu', // 更改为你的实际API地址
success: (res) => {
let code = res.data.code
console.log(res.data)
this.setData({ menuItems: res.data.data });
if (code == 0) {
console.log("请求菜单信息成功")
this.setData({ menuItems: res.data.data });
} else{
console.log("请求菜单信息失败")
}
}
});
},

View File

@@ -12,7 +12,7 @@
<view class="grid-container">
<view class="card">
<navigator wx:for="{{menuItems}}" wx:key="id" url="{{item.url}}" class="grid-item">
<image src="data:image/png;base64,{{item.base64EncodedImage}}"></image>
<image src="{{item.image_url}}"></image>
<text>{{item.menu_name}}</text>
</navigator>
</view>

View File

@@ -14,7 +14,8 @@ Page({
*/
data: {
phoneNumber: '', // 手机号
password: '' // 密码
password: '', // 密码
checked: false,
},
handlePhoneInput(event) {
this.setData({ phoneNumber: event.detail.value });
@@ -22,8 +23,23 @@ Page({
handlePasswordInput(event) {
this.setData({ password: event.detail.value });
},
togglePasswordVisibility() {
this.setData({ passwordVisible: !this.data.passwordVisible });
},
checkAccepted(e) {
if(e.detail.value.length>0){
this.setData({
checked:true
})
}else{
this.setData({
checked:false
})
}
},
handleLogin() {
wx.request({
if (this.data.checked) {
wx.request({
url: requestUrl + '/user/login', // 你的接口地址
method: 'POST',
data: {
@@ -52,6 +68,13 @@ Page({
console.log('登录失败', error);
}
});
} else {
// 如果协议未被接受,显示提示或者阻止登录
wx.showToast({
title: '请先同意用户使用协议',
icon: 'none',
});
}
},
/**
* 生命周期函数--监听页面加载

View File

@@ -7,14 +7,16 @@
<!-- 手机号输入区 -->
<view class="phone">
<image src="/assets/images/icon/Phone.svg" class="phone-icon"></image>
<input bindinput ="handlePhoneInput" placeholder="请输入手机号" />
<input bindinput="handlePhoneInput" placeholder="请输入手机号" />
</view>
<!-- 密码输入区 -->
<view class="password">
<image src="/assets/images/icon/password.svg" class="password-icon"></image>
<input type="password" bindinput="handlePasswordInput" placeholder="请输入密码" />
<image src="/assets/images/icon/eye.svg" class="eye-icon"></image>
<!-- 根据passwordVisible动态设置input类型 -->
<input type="{{passwordVisible ? 'text' : 'password'}}" bindinput="handlePasswordInput" placeholder="请输入密码" />
<!-- 绑定点击事件到togglePasswordVisibility函数 -->
<image src="/assets/images/icon/eye.svg" class="eye-icon" bindtap="togglePasswordVisibility"></image>
</view>
<!-- 忘记密码链接 -->
@@ -24,14 +26,16 @@
<!-- 登录按钮 -->
<view class="login-btn">
<button class="btn-dl" bind:tap="handleLogin" type="primary">登录</button>
<!-- 绑定点击事件到handleLogin函数 -->
<button class="btn-dl" bindtap="handleLogin" type="primary">登录</button>
</view>
<!-- 协议区 -->
<view class="agreement-area">
<checkbox class="agreement"></checkbox>
<view class="agreement-text">同意小程序《使用协议》</view>
</view>
<checkbox-group bindchange="checkAccepted" class="agreement-area">
<checkbox class="agreement-box" checked="{{checked}}"></checkbox>
<view class="agreement-text">小程序《用户使用协议》</view>
</checkbox-group>
</view>
<!-- 登录提示框 -->

View File

@@ -123,7 +123,7 @@
position: absolute;
}
/* 复选框 */
.login .login-card .agreement-area .agreement{
.login .login-card .agreement-area .agreement-box{
margin-left: 85rpx;
/* 修改复选框的大小 */
transform:scale(.6);

View File

@@ -1,38 +1,32 @@
// pages/policy/policy.js
import { requestUrl } from '../../utils/config.js';
Page({
/**
* 页面的初始数据
*/
data: {
policies: [
{ title: "政策标题1", date: "2024-01-01" },
{ title: "政策标题2", date: "2023-01-02" },
{ title: "政策标题3", date: "2022-01-02" },
{ title: "政策标题4", date: "2023-01-02" },
{ title: "政策标题5", date: "2022-01-02" },
{ title: "政策标题6", date: "2023-01-02" },
{ title: "政策标题7", date: "2021-01-02" },
{ title: "政策标题8", date: "2021-01-02" },
{ title: "政策标题9", date: "2024-02-02" },
{ title: "政策标题10", date: "2024-03-02" },
{ title: "政策标题11", date: "2024-04-02" },
{ title: "政策标题12", date: "2024-01-02" },
{ title: "政策标题13", date: "2024-01-02" },
{ title: "政策标题14", date: "2024-01-02" },
{ title: "政策标题15", date: "2024-01-02" },
{ title: "政策标题16", date: "2024-01-02" },
{ title: "政策标题17", date: "2024-01-02" },
// 更多政策数据...
]
// 更多数据...
policy_list:[],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.request({
url:requestUrl + '/api/policy-list',
method: 'GET',
success: (res) => {
let code = res.data.code
if (code == 0) {
console.log("请求政策列表成功")
this.setData({policy_list:res.data.data});
} else {
console.log('请求政策列表失败')
}
}
})
},
/**

View File

@@ -1,19 +1,18 @@
<view class="policy-page">
<!-- 搜索框 -->
<view class="search-bar">
<input type="text" placeholder="请输入关键字搜索" confirm-type="search" />
<input class="input-class" type="text" placeholder="请输入关键字搜索" confirm-type="search" />
</view>
<!-- 政策列表 -->
<view class="policy-list">
<!-- 循环遍历政策数据 -->
<block wx:for="{{policies}}" wx:key="unique">
<block wx:for="{{policy_list}}" wx:key="unique">
<!-- 每项政策使用圆角矩形卡片展示 -->
<view class="policy-card">
<view class="policy-item">
<view class="title">{{item.title}}
</view>
<view class="date">发布时间:{{item.date}}</view>
<text class="title">{{item.title}}</text>
<text class="date">发布时间:{{item.date}}</text>
</view>
</view>
</block>

View File

@@ -3,22 +3,25 @@
flex-direction: column;
}
.search-bar input {
.search-bar, .input-class {
width: 90%;
padding: 10px;
border: 1px solid #ccc; /* 轻微边框 */
border-radius: 5px; /* 圆角 */
margin:0 auto; /* 上下保持0左右自动实现水平居中 */
}
.policy-item .title, .policy-item .date {
display: block;
}
.policy-list .policy-item {
padding: 10px;
padding: 10rpx;
}
.policy-item .title {
font-size: 18px;
font-size: 36rpx;
color: #333;
}
@@ -31,6 +34,6 @@
background-color: white; /* 卡片背景色 */
border-radius: 10px; /* 圆角 */
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 阴影效果 */
margin: 10px; /* 外边距,根据需要调整 */
padding: 15px; /* 内边距,根据需要调整 */
margin: 20rpx; /* 外边距,根据需要调整 */
padding: 20rpx; /* 内边距,根据需要调整 */
}

View File

@@ -1,6 +1,6 @@
// 在config.js
//本地测试
// const requestUrl = "http://127.0.0.1:8000";
const requestUrl = "http://127.0.0.1:8000";
// 服务器测试
const requestUrl = "https://wx-ed1284f.kimgo.cn";
// const requestUrl = "https://wx-ed1284f.kimgo.cn";
export { requestUrl };