From 0d80ca8f4dad325bf697de5892eda88e79492893 Mon Sep 17 00:00:00 2001
From: ZhaoYang <565837861@qq.com>
Date: Thu, 5 Feb 2026 18:51:06 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81=EF=BC=8C?=
=?UTF-8?q?=E9=97=AE=E8=AF=8A=E5=8D=95=EF=BC=8C=E9=A6=96=E9=A1=B5=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=EF=BC=8C=E7=99=BB=E5=BD=95=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/home/home.js | 189 ++-
pages/home/home.wxml | 43 +-
pages/home/home.wxss | 155 +-
pagesA/images/duig.png | Bin 0 -> 2599 bytes
pagesA/images/name.png | Bin 0 -> 4280 bytes
pagesA/images/sfz.png | Bin 0 -> 3509 bytes
pagesA/pages/askingSy/askingSy.js | 56 +-
pagesA/pages/askingSyAdd/askingSyAdd.js | 96 +-
pagesA/pages/askingSyAdd/askingSyAdd.wxml | 174 +-
pagesA/pages/askingSyAdd/askingSyAdd.wxss | 57 +
pagesA/pages/attestation/attestation.js | 420 +++--
pagesA/pages/attestation/attestation.wxml | 342 ++--
pagesA/pages/attestation/attestation.wxss | 1741 +++++++++++++++------
utils/baseUrl.js | 4 +-
utils/http.js | 46 +-
15 files changed, 2255 insertions(+), 1068 deletions(-)
create mode 100644 pagesA/images/duig.png
create mode 100644 pagesA/images/name.png
create mode 100644 pagesA/images/sfz.png
diff --git a/pages/home/home.js b/pages/home/home.js
index e15bac2..0cb937e 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -9,53 +9,54 @@ Page({
// 通知公告数据
currentNotice: 0,
noticeList: [],
- forum:[]
+ forum: [],
+ suffer: [],
+ // 添加用户数据
+ user: {},
+ county: ''
},
-
// 查询用户信息
- getUserInfo(){
- http.UserInfo({
- data:{},
- success:res=>{
- this.setData({
- user:res.data.area
- })
- }
- })
+ getUserInfo() {
+ http.UserInfo({
+ data: {},
+ success: res => {
+ this.setData({
+ user: res.data.area
+ })
+ }
+ })
},
// 在线问答列表
- getforumList(){
+ getforumList() {
http.forumList({
- data:{},
- success:res=>{
+ data: {},
+ success: res => {
const zxwd = []
zxwd.push(res.rows[0])
this.setData({
- forum:zxwd
+ forum: zxwd
})
}
})
},
// 经验分享列表
- getexperience(){
- http.experience({
- data:{},
- success:res=>{
- console.log(111,res);
- const zyfx = []
- zyfx.push(res.rows[0])
- this.setData({
- suffer:zyfx
- })
- }
- })
+ getexperience() {
+ http.experience({
+ data: {},
+ success: res => {
+ console.log(111, res);
+ const zyfx = []
+ zyfx.push(res.rows[0])
+ this.setData({
+ suffer: zyfx
+ })
+ }
+ })
},
-
-
// 轮播
getCarousel() {
http.carousel({
@@ -68,18 +69,34 @@ Page({
})
},
- // 灾害
+ // 灾害/通知公告
getDisaster() {
http.disaster({
data: {},
success: res => {
+ // 处理通知数据,添加时间戳
+ const notices = res.rows.map(item => {
+ return {
+ ...item,
+ // // 判断是否是24小时内的通知
+ // isNew: this.isNewNotification(item.createdTime)
+ }
+ })
this.setData({
- noticeList: res.rows
+ noticeList: notices
})
}
})
},
+ // // 判断通知是否在24小时内
+ // isNewNotification(createdTime) {
+ // if (!createdTime) return false
+ // const noticeTime = new Date(createdTime.replace(/-/g, '/')).getTime()
+ // const now = new Date().getTime()
+ // const twentyFourHours = 24 * 60 * 60 * 1000
+ // return now - noticeTime < twentyFourHours
+ // },
// 区域划分跳转
bindXzqh() {
@@ -137,11 +154,11 @@ Page({
})
},
- //问答列表
- bindwdlist(){
- wx.navigateTo({
- url: '/pagesB/pages/forumlist/forumlist',
- })
+ // 问答列表
+ bindwdlist() {
+ wx.navigateTo({
+ url: '/pagesB/pages/forumlist/forumlist',
+ })
},
// 问答详情
@@ -154,22 +171,33 @@ Page({
},
// 经验分享列表
- viewexperience(){
+ viewexperience() {
wx.navigateTo({
url: '/pagesB/pages/experienceList/experienceList',
})
},
// 经验分享详情
- bindfx(e){
+ bindfx(e) {
const id = e.currentTarget.dataset.id
- wx.navigateTo({
- url: `/pagesB/pages/experienceDetails/experienceDetails?id=${id}`,
- })
+ wx.navigateTo({
+ url: `/pagesB/pages/experienceDetails/experienceDetails?id=${id}`,
+ })
+ },
+
+ // 查看所有通知
+ viewAllNotices() {
+ wx.navigateTo({
+ url: '/pagesB/pages/noticeList/noticeList',
+ })
},
+ // 查看所有问题
+ viewAllQuestions() {
+ this.bindwdlist()
+ },
- //获取当前位置信息
+ // 获取当前位置信息
getLocation() {
let that = this;
// 腾讯获取的密钥
@@ -202,25 +230,44 @@ Page({
},
onShow() {
-
+ // 页面显示时重置轮播图(解决某些手机上的轮播问题)
+ this.resetSwiper()
},
-
+ // 重置轮播图(解决轮播不自动播放的问题)
+ resetSwiper() {
+ setTimeout(() => {
+ if (this.data.swiperList.length > 0) {
+ this.setData({
+ currentSwiper: this.data.currentSwiper
+ })
+ }
+ }, 300)
+ },
// 轮播图变化事件
onSwiperChange(e) {
const current = e.detail.current;
- const swiperList = this.data.swiperList.map((item, index) => ({
- ...item,
- }));
-
this.setData({
- currentSwiper: current,
- swiperList
+ currentSwiper: current
});
},
+ // 轮播图指示器点击
+ onIndicatorTap(e) {
+ const index = e.currentTarget.dataset.index;
+ this.setData({
+ currentSwiper: index
+ });
+ },
+ // 通知轮播变化事件
+ onNoticeSwiperChange(e) {
+ const current = e.detail.current;
+ this.setData({
+ currentNotice: current
+ });
+ },
// 轮播图点击
onSwiperTap(e) {
@@ -231,11 +278,9 @@ Page({
icon: 'none',
duration: 1000
});
-
},
-
- // 通知点击 - 使用catchtap防止事件冒泡
+ // 通知点击
onNoticeTap(e) {
const id = e.currentTarget.dataset.id;
console.log('通知点击:', id);
@@ -244,15 +289,15 @@ Page({
const notice = this.data.noticeList.find(item => item.id === id);
if (notice) {
wx.showModal({
- title: notice.typeName,
- content: notice.content,
+ title: notice.warningLevel || '通知详情',
+ content: notice.title,
showCancel: true,
cancelText: '关闭',
confirmText: '查看详情',
success: (res) => {
if (res.confirm) {
wx.navigateTo({
- url: '/pages/notice/detail?id=' + id
+ url: '/pagesB/pages/noticeDetail/noticeDetail?id=' + id
});
}
}
@@ -260,18 +305,12 @@ Page({
}
},
- // 更多通知
- gotoNotices() {
- wx.navigateTo({
- url: ''
- });
- },
-
-
onReady() {
- //当前网络状态
+ // 当前网络状态
wx.getNetworkType({
- success: function (res) { // 返回网络类型, 有效值:// wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
+ success: function (res) {
+ // 返回网络类型, 有效值:
+ // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
console.log(res);
var networkType = res.networkType
if (networkType !== 'unknown') {
@@ -285,11 +324,18 @@ Page({
})
},
-
// 下拉刷新
onPullDownRefresh() {
wx.showNavigationBarLoading()
- setTimeout(function () {
+
+ // 重新加载所有数据
+ Promise.all([
+ new Promise(resolve => this.getUserInfo(resolve)),
+ new Promise(resolve => this.getDisaster(resolve)),
+ new Promise(resolve => this.getCarousel(resolve)),
+ new Promise(resolve => this.getforumList(resolve)),
+ new Promise(resolve => this.getexperience(resolve))
+ ]).then(() => {
wx.showToast({
title: '刷新成功',
icon: 'none',
@@ -297,11 +343,14 @@ Page({
})
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
- }, 1000)
+ }).catch(() => {
+ wx.hideNavigationBarLoading()
+ wx.stopPullDownRefresh()
+ })
},
// 页面滚动
onPageScroll(e) {
-
+ // 可以根据需要添加滚动效果
}
});
\ No newline at end of file
diff --git a/pages/home/home.wxml b/pages/home/home.wxml
index 84db7a7..96d85d5 100644
--- a/pages/home/home.wxml
+++ b/pages/home/home.wxml
@@ -22,9 +22,19 @@
-
+
-
+
@@ -87,20 +97,43 @@
+
-
+
- {{item.title}}
+
+ {{item.title}}
+ →
+
+
diff --git a/pages/home/home.wxss b/pages/home/home.wxss
index 499d7fd..f136757 100644
--- a/pages/home/home.wxss
+++ b/pages/home/home.wxss
@@ -6,7 +6,6 @@
padding-top: env(safe-area-inset-top);
}
-
/* 主要内容区域 */
.box {
width: 93%;
@@ -29,7 +28,6 @@
border-radius: 50%;
}
-
.orientation{
display: flex;
align-items: center;
@@ -59,7 +57,7 @@
color: #fff;
}
-/* 轮播图区域 */
+/* 轮播图区域 - 已修复 */
.swiper-container {
position: relative;
border-radius: 20rpx;
@@ -175,13 +173,12 @@
}
.indicator-dot.active {
- width: 30rpx;
+ width: 40rpx;
background: #96DBD4;
border-radius: 6rpx;
}
/* 卡片类型 */
-
.kap {
animation: kapIn 0.5s ease-out 0.5s both;
}
@@ -196,8 +193,6 @@
}
}
-
-
.card {
width: 100%;
display: grid;
@@ -299,7 +294,7 @@
background-color: #FD8140;
}
-/* 通知公告区域 */
+/* 通知公告区域 */
.notice-section {
background: #FFFFFF;
border-radius: 20rpx;
@@ -307,39 +302,99 @@
margin: 20rpx 0;
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.05);
animation: fadeIn 0.6s ease-out 0.6s both;
+ position: relative;
+ overflow: hidden;
}
@keyframes fadeIn {
from {
opacity: 0;
+ transform: translateY(30rpx);
}
to {
opacity: 1;
+ transform: translateY(0);
}
}
+/* 通知标题区域 */
+.notice-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+ padding-bottom: 20rpx;
+ border-bottom: 1px solid rgba(150, 219, 212, 0.2);
+}
+
+.notice-title {
+ display: flex;
+ align-items: center;
+ gap: 12rpx;
+}
+
+.notice-icon {
+ font-size: 32rpx;
+}
+
+.notice-title-text {
+ font-size: 32rpx;
+ font-weight: 600;
+ color: #333;
+ position: relative;
+ padding-left: 16rpx;
+}
+
+.notice-title-text::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 6rpx;
+ height: 28rpx;
+ background: linear-gradient(135deg, #FF9800, #F44336);
+ border-radius: 3rpx;
+}
+
+.notice-more {
+ font-size: 24rpx;
+ color: #96DBD4;
+ padding: 8rpx 16rpx;
+ background: rgba(150, 219, 212, 0.1);
+ border-radius: 20rpx;
+ transition: all 0.3s ease;
+}
+
+.notice-more:active {
+ background: rgba(150, 219, 212, 0.2);
+ transform: scale(0.95);
+}
+
+/* 通知内容区域 */
.notice-content {
position: relative;
}
.notice-swiper {
- height: 150rpx;
+ height: 160rpx;
}
.notice-item {
- padding: 20rpx 0;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
+ justify-content: center;
position: relative;
+ cursor: pointer;
}
.notice-item.highlight {
- background: rgba(76, 175, 80, 0.05);
- border-radius: 12rpx;
+ background: rgba(150, 219, 212, 0.08);
+ border-radius: 16rpx;
padding: 20rpx;
- margin: -10rpx -10rpx 0;
+ margin: 0 -10rpx;
}
.notice-item-header {
@@ -349,47 +404,90 @@
margin-bottom: 16rpx;
}
+.notice-type-container {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+}
+
.notice-type {
- padding: 4rpx 16rpx;
+ padding: 6rpx 16rpx;
border-radius: 20rpx;
font-size: 22rpx;
font-weight: 500;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ min-width: 80rpx;
}
+/* 优化通知类型样式 */
.notice-type.urgent {
- background: rgba(244, 67, 54, 0.1);
- color: #F44336;
+ background: linear-gradient(135deg, #FF5252, #FF1744);
+ color: white;
+ box-shadow: 0 4rpx 12rpx rgba(244, 67, 54, 0.2);
}
.notice-type.important {
- background: rgba(255, 152, 0, 0.1);
- color: #FF9800;
+ background: linear-gradient(135deg, #FF9800, #FF9100);
+ color: white;
+ box-shadow: 0 4rpx 12rpx rgba(255, 152, 0, 0.2);
}
.notice-type.normal {
- background: rgba(33, 150, 243, 0.1);
- color: #2196F3;
+ background: linear-gradient(135deg, #96DBD4, #60C0B9);
+ color: white;
+ box-shadow: 0 4rpx 12rpx rgba(33, 150, 243, 0.2);
+}
+
+.notice-badge {
+ background: #FF4081;
+ color: white;
+ font-size: 18rpx;
+ padding: 2rpx 8rpx;
+ border-radius: 10rpx;
+ margin-left: 4rpx;
}
.notice-time {
font-size: 22rpx;
- color: #999999;
+ color: #888;
+ font-family: 'Arial', sans-serif;
+}
+
+.notice-text-container {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
}
.notice-text {
font-size: 28rpx;
- color: #333333;
+ color: #333;
line-height: 1.5;
flex: 1;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
+ font-weight: 500;
+ padding-right: 20rpx;
+}
+
+.notice-arrow {
+ font-size: 24rpx;
+ color: #96DBD4;
+ opacity: 0.7;
+ transition: all 0.3s ease;
}
+.notice-item.highlight .notice-arrow {
+ opacity: 1;
+ transform: translateX(4rpx);
+}
-/* 用户提问板块 - 优化样式 */
+/* 用户提问板块 */
.user-question-section {
background: #FFFFFF;
border-radius: 24rpx;
@@ -447,7 +545,6 @@
border-radius: 4rpx;
}
-
.title-text1_1 {
font-size: 38rpx;
font-weight: bold;
@@ -457,7 +554,6 @@
padding-left: 20rpx;
}
-
.title-text1_1::before {
content: '';
position: absolute;
@@ -476,8 +572,6 @@
padding-left: 20rpx;
}
-
-
.view-all {
display: flex;
align-items: center;
@@ -494,7 +588,6 @@
transform: scale(0.98);
}
-
.view-all1_1{
display: flex;
align-items: center;
@@ -511,9 +604,6 @@
transform: scale(0.98);
}
-
-
-
/* 问题元信息 */
.question-meta {
display: flex;
@@ -540,7 +630,6 @@
overflow: hidden;
}
-
/* 用户信息 */
.question-info {
display: flex;
@@ -577,7 +666,6 @@
margin-bottom: 6rpx;
}
-
.time-info {
font-size: 22rpx;
color: #999;
@@ -586,7 +674,6 @@
border-radius: 16rpx;
}
-
.post-footer {
display: flex;
align-items: center;
diff --git a/pagesA/images/duig.png b/pagesA/images/duig.png
new file mode 100644
index 0000000000000000000000000000000000000000..41de07fc214b05f1aa9886e9cd563dc9c7b498e5
GIT binary patch
literal 2599
zcmdUx`#;nD8^^c##751GCE4x!!Boqsq`Bu%#_V7YnVOW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rcYxB>IlvRsi{0wfGKil0Oy+Z`K
zgz|%u%u*PC<^py|2M)yS_Fxa`I%AxCP3%olK~W}i^JxUKEZm(+hg^csR;HUbjI!i$
zekKFP|9$g@>oX`Yqm-!g8)QxB4+uCXI54!$tjrXFd{tFgQMNG^JY7kRqrxb7T;A>_
i07HG0pYeYH{h^U~vGU7Py?#36{9sHsFKVp|m;Ybqu5_^g
literal 0
HcmV?d00001
diff --git a/pagesA/images/name.png b/pagesA/images/name.png
new file mode 100644
index 0000000000000000000000000000000000000000..265e3d16bca354c47b184efa9c2c064fd95b8d40
GIT binary patch
literal 4280
zcmb7I`8(9#7oYc7XM_=hG{#^?_FYtHvX3psPRP>75?M-?v5btYF(D~S_H0?A>>~RT
zAsMnIyFvDl`sz>k{&3IhIj?)3``mkWx&
z#n|aM$ofLoUhJ=l;76kdggd!J@JO46RMYWf(+TAYC5tbm@R&DVrNv+5Ytx4l!fqiQu-g^EOd0@kmcB7*9o!`mxXWhem$g`~=dA~m^xL?|pcJx~8H(epWPrD`M
zEl6>5cG|L=IlKAnpjgI(%5@2S?wi90x?)3)@y$67mNu(d?<}ye$t%)9?{95P*~m9P
zq*;gRnp7RsnqaM0QW4w?TW`Fejk(BzqkJ(Gb4{#rin}+1lfk*N=Y{@e?8iZ?9Aus+
zB@5RE5qY5xU20csD%TIUrW$m4b$r9d-msbGPxEN$7D>;mq|lu?k~GoI~Q*drJj-&<2_9?!ce7A(TrhA7~C(8TWkiON5jZ@SmKW)S9mtec{KVG2S+pU?uc(aa~
z5A(=%G=<;y61I{>mFO1<;pOoej20&{cj}GW*p~(@4#>_-I-nsL3Ub{4Tw38=mo^
zkaN-Cc;h;)!GwAjlV3>$n)P%quQG39Mjy8o@UdAPdD8VVQ9ZS4R!%Ws0`$?gN;Xm@
zv#-i$DU!cbaQBSiw#K-jt}&6W*>|z|-bqe$1{i-FmEu(K^_o8Nu3VM+T^sTu%L&8$F{=b+_bt%qA8p;K$CuxNoUxm@}p%
zT{7K<(Lk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hm(g%IAuH)y5X8`winf0CC`A(OKt5+7A
z2u9!Y*^tEn!M!-rX~l$^x3F17YIo{!)a`Q=j*2Oo-R)8^bK2flWb&FMg^_C_O
zAUBK+Lt`mWRnnt&ilx8{-qVk(fJ9mhM;nr*z$rbC-~a!IPdK}_+V`ot?^jv>Fu)v*
KGp#l8Ncu1Ed^q(0
literal 0
HcmV?d00001
diff --git a/pagesA/pages/askingSy/askingSy.js b/pagesA/pages/askingSy/askingSy.js
index 41b2732..4b40826 100644
--- a/pagesA/pages/askingSy/askingSy.js
+++ b/pagesA/pages/askingSy/askingSy.js
@@ -4,35 +4,39 @@ Page({
diagnosisList: []
},
- onLoad: function() {
- this.getwzd()
+ onLoad: function () {
+
+ },
+
+ onShow:function(){
+ this.getwzd()
},
-
+
// 问诊单
- getwzd(){
- http.wzd({
- data:{},
- success:res=>{
- console.log(1111,res);
- this.setData({
- diagnosisList:res.rows
- })
- }
- })
+ getwzd() {
+ http.wzd({
+ data: {},
+ success: res => {
+ console.log(1111, res);
+ this.setData({
+ diagnosisList: res.rows
+ })
+ }
+ })
},
// 格式化日期显示
- formatDate: function(dateString) {
+ formatDate: function (dateString) {
const date = new Date(dateString);
const now = new Date();
const diff = now - date;
const diffDays = Math.floor(diff / (1000 * 60 * 60 * 24));
const diffHours = Math.floor(diff / (1000 * 60 * 60));
const diffMinutes = Math.floor(diff / (1000 * 60));
-
+
if (diffMinutes < 60) {
return `${diffMinutes}分钟前`;
} else if (diffHours < 24) {
@@ -51,30 +55,18 @@ Page({
},
// 新增问诊单
- showCreateModal: function() {
+ showCreateModal: function () {
wx.navigateTo({
url: '/pagesA/pages/askingSyAdd/askingSyAdd',
});
},
// 查看详情
- viewDetail: function(e) {
- console.log(1111,e);
- const status = e.currentTarget.dataset.value.status
+ viewDetail: function (e) {
const data = e.currentTarget.dataset.value
- console.log(data);
-
- if(status=='已回复'){
- wx.navigateTo({
- url: `/pagesA/pages/askingSyDetails/askingSyDetails?data=${encodeURIComponent(JSON.stringify(data))}`,
- });
- }else{
- wx.showToast({
- title: `无回复内容`,
- icon: 'none',
- duration: 1000
- });
- }
+ wx.navigateTo({
+ url: `/pagesA/pages/askingSyDetails/askingSyDetails?data=${encodeURIComponent(JSON.stringify(data))}`,
+ });
},
diff --git a/pagesA/pages/askingSyAdd/askingSyAdd.js b/pagesA/pages/askingSyAdd/askingSyAdd.js
index a4f7f7d..09ae4f2 100644
--- a/pagesA/pages/askingSyAdd/askingSyAdd.js
+++ b/pagesA/pages/askingSyAdd/askingSyAdd.js
@@ -1,5 +1,6 @@
import http from '../../../utils/api'
const baseUrl = require('../../../utils/baseUrl')
+
Page({
/**
* 页面的初始数据
@@ -16,7 +17,9 @@ Page({
isSubmitting: false,
isFormValid: false,
tempImages: [], // 新增:临时存储本地图片路径
- isUploading: false // 新增:防止重复上传
+ isUploading: false, // 新增:防止重复上传
+ showLoadingMask: false, // 新增:显示加载遮罩层
+ loadingText: '提交中...' // 新增:加载提示文字
},
/**
@@ -234,8 +237,11 @@ Page({
return;
}
+ // 显示加载遮罩层
this.setData({
- isSubmitting: true
+ isSubmitting: true,
+ showLoadingMask: true,
+ loadingText: '提交中...'
});
// 准备提交数据
@@ -248,29 +254,77 @@ Page({
data: submitData,
success: (res) => {
console.log('提交成功', res);
- this.setData({
- isSubmitting: false
- });
+
if(res.code==200){
- // 提交成功后的处理
- wx.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 1500,
- success: () => {
- setTimeout(() => {
- // 返回上一页
- // wx.navigateBack();
- }, 1500);
- }
- });
- }else{
- wx.showToast({
- title: '提交失败,请重试',
- icon: 'none'
+ // 提交成功后的处理
+ this.setData({
+ loadingText: '提交成功'
});
+
+ setTimeout(() => {
+ this.setData({
+ isSubmitting: false,
+ showLoadingMask: false
+ });
+
+ wx.showToast({
+ title: '提交成功',
+ icon: 'success',
+ duration: 1500,
+ success: () => {
+ // 返回上一页
+ wx.navigateBack();
+ }
+ });
+ }, 1000);
+ } else {
+ this.setData({
+ loadingText: '提交失败'
+ });
+
+ setTimeout(() => {
+ this.setData({
+ isSubmitting: false,
+ showLoadingMask: false
+ });
+
+ wx.showToast({
+ title: res.msg || '提交失败,请重试',
+ icon: 'none',
+ duration: 2000
+ });
+ }, 1000);
}
},
+ fail: (err) => {
+ this.setData({
+ loadingText: '网络错误'
+ });
+
+ setTimeout(() => {
+ this.setData({
+ isSubmitting: false,
+ showLoadingMask: false
+ });
+
+ wx.showToast({
+ title: '网络异常,请检查网络后重试',
+ icon: 'none',
+ duration: 2000
+ });
+ }, 1000);
+ }
+ });
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload() {
+ // 页面卸载时重置状态
+ this.setData({
+ isSubmitting: false,
+ showLoadingMask: false
});
}
});
\ No newline at end of file
diff --git a/pagesA/pages/askingSyAdd/askingSyAdd.wxml b/pagesA/pages/askingSyAdd/askingSyAdd.wxml
index 4ce9bda..98db029 100644
--- a/pagesA/pages/askingSyAdd/askingSyAdd.wxml
+++ b/pagesA/pages/askingSyAdd/askingSyAdd.wxml
@@ -1,114 +1,122 @@
-
-
-
-
+
+
+
+
+ {{loadingText}}
+
+
\ No newline at end of file
diff --git a/pagesA/pages/askingSyAdd/askingSyAdd.wxss b/pagesA/pages/askingSyAdd/askingSyAdd.wxss
index 5e619eb..c4d4bcd 100644
--- a/pagesA/pages/askingSyAdd/askingSyAdd.wxss
+++ b/pagesA/pages/askingSyAdd/askingSyAdd.wxss
@@ -318,6 +318,47 @@
box-shadow: none;
}
+/* 加载遮罩层 */
+.loading-mask {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 9999;
+}
+
+.loading-content {
+ background: #FFFFFF;
+ border-radius: 24rpx;
+ padding: 60rpx 80rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ animation: scaleIn 0.3s ease-out;
+}
+
+.loading-spinner {
+ width: 80rpx;
+ height: 80rpx;
+ border: 6rpx solid #F0F7FF;
+ border-top: 6rpx solid #4A90E2;
+ border-radius: 50%;
+ animation: spin 1s linear infinite;
+ margin-bottom: 32rpx;
+}
+
+.loading-text {
+ font-size: 28rpx;
+ color: #333;
+ font-weight: 500;
+}
+
/* 动画效果 */
@keyframes fadeIn {
from {
@@ -330,6 +371,22 @@
}
}
+@keyframes scaleIn {
+ from {
+ opacity: 0;
+ transform: scale(0.9);
+ }
+ to {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+
+@keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+
.form-section {
animation: fadeIn 0.4s ease-out forwards;
opacity: 0;
diff --git a/pagesA/pages/attestation/attestation.js b/pagesA/pages/attestation/attestation.js
index 9dfe01f..9730423 100644
--- a/pagesA/pages/attestation/attestation.js
+++ b/pagesA/pages/attestation/attestation.js
@@ -1,25 +1,26 @@
-// pages/real-name-auth/real-name-auth.js
+import http from '../../../utils/api'
+const baseUrl = require('../../../utils/baseUrl')
Page({
data: {
// 表单数据
name: '',
- phone: '',
- smsCode: '',
+ idNumber: '',
// 焦点状态
nameFocus: false,
- phoneFocus: false,
- codeFocus: false,
+ idNumberFocus: false,
// 错误提示
nameError: '',
- phoneError: '',
- smsCodeError: '',
+ idNumberError: '',
- // 验证码相关
- canSendCode: false,
- countdown: 0,
- countdownTimer: null,
+ // 提示显示控制 - 修复:初始为false
+ showNameHint: false,
+ showIdNumberHint: false,
+
+ // 验证状态
+ isNameValid: false,
+ isIdNumberValid: false,
// 协议状态
agreed: false,
@@ -28,211 +29,262 @@ Page({
canSubmit: false,
isSubmitting: false,
- // 弹窗
- showSuccessModal: false
+ // 进度条
+ currentStep: 1,
+ lineProgress1: 0,
+ lineProgress2: 0,
+
+ // 弹窗数据
+ showModal: false,
+ modalTitle: '',
+ modalContent: '',
+
+ // 成功弹窗数据
+ showSuccessModal: false,
+ maskedIdNumber: ''
},
onLoad() {
- this.checkForm();
+ // 页面加载时启动进度条动画
+ setTimeout(() => {
+ this.setData({ lineProgress1: 50 });
+ }, 600);
},
- onUnload() {
- // 清除定时器
- if (this.data.countdownTimer) {
- clearInterval(this.data.countdownTimer);
- }
- },
-
- // 姓名输入处理
+ // 姓名输入处理 - 修复:简化逻辑
onNameInput(e) {
- const name = e.detail.value.trim();
- let nameError = '';
+ const value = e.detail.value.trim();
+ let error = '';
+ let showHint = true;
+ let isValid = false;
- if (name && !/^[\u4e00-\u9fa5]{2,10}$/.test(name)) {
- nameError = '姓名应为2-10个汉字';
+ if (value) {
+ if (!/^[\u4e00-\u9fa5]{2,10}$/.test(value)) {
+ error = '姓名应为2-10个汉字';
+ } else {
+ isValid = true;
+ // 验证通过时保持提示显示,但无错误
+ }
+ } else {
+ // 内容为空时显示正常提示
+ error = '';
}
this.setData({
- name: name,
- nameError: nameError
+ name: value,
+ nameError: error,
+ showNameHint: showHint,
+ isNameValid: isValid
}, () => {
this.checkForm();
- this.checkCanSendCode();
});
},
onNameFocus() {
- this.setData({ nameFocus: true });
+ this.setData({
+ nameFocus: true,
+ showNameHint: true // 获得焦点时显示提示
+ });
},
onNameBlur() {
- this.setData({ nameFocus: false });
+ const { name } = this.data;
+
+ this.setData({
+ nameFocus: false,
+ // 失去焦点时,如果内容为空或验证失败,保持提示显示
+ showNameHint: !!(name && !this.data.isNameValid)
+ });
},
- // 手机号输入处理
- onPhoneInput(e) {
- const phone = e.detail.value.trim();
- let phoneError = '';
-
- if (phone && !/^1[3-9]\d{9}$/.test(phone)) {
- phoneError = '请输入正确的手机号码';
- }
-
+ // 清除姓名
+ clearName() {
this.setData({
- phone: phone,
- phoneError: phoneError
+ name: '',
+ nameError: '',
+ showNameHint: false,
+ isNameValid: false
}, () => {
this.checkForm();
- this.checkCanSendCode();
});
},
- onPhoneFocus() {
- this.setData({ phoneFocus: true });
- },
-
- onPhoneBlur() {
- this.setData({ phoneFocus: false });
- },
-
- // 验证码输入处理
- onSmsCodeInput(e) {
- const smsCode = e.detail.value.trim();
- let smsCodeError = '';
+ // 身份证号输入处理 - 修复:简化逻辑
+ onIdNumberInput(e) {
+ const value = e.detail.value.trim().toUpperCase();
+ let error = '';
+ let showHint = true;
+ let isValid = false;
- if (smsCode && !/^\d{6}$/.test(smsCode)) {
- smsCodeError = '请输入6位数字验证码';
+ if (value) {
+ if (value.length < 18) {
+ error = '还需输入' + (18 - value.length) + '位';
+ } else if (value.length === 18) {
+ if (this.validateIdNumber(value)) {
+ isValid = true;
+ // 验证通过时保持提示显示,但无错误
+ } else {
+ error = '身份证号格式不正确';
+ }
+ }
+ } else {
+ // 内容为空时显示正常提示
+ error = '';
}
this.setData({
- smsCode: smsCode,
- smsCodeError: smsCodeError
+ idNumber: value,
+ idNumberError: error,
+ showIdNumberHint: showHint,
+ isIdNumberValid: isValid
}, () => {
this.checkForm();
});
},
- onCodeFocus() {
- this.setData({ codeFocus: true });
+ onIdNumberFocus() {
+ this.setData({
+ idNumberFocus: true,
+ showIdNumberHint: true // 获得焦点时显示提示
+ });
},
- onCodeBlur() {
- this.setData({ codeFocus: false });
+ onIdNumberBlur() {
+ const { idNumber } = this.data;
+ let error = '';
+ let isValid = false;
+
+ // 最终验证
+ if (idNumber) {
+ if (idNumber.length < 18) {
+ error = '还需输入' + (18 - idNumber.length) + '位';
+ } else if (idNumber.length === 18) {
+ if (this.validateIdNumber(idNumber)) {
+ isValid = true;
+ } else {
+ error = '身份证号格式不正确';
+ }
+ }
+ }
+
+ this.setData({
+ idNumberFocus: false,
+ idNumberError: error,
+ isIdNumberValid: isValid,
+ // 失去焦点时,如果内容为空或验证失败,保持提示显示
+ showIdNumberHint: !!(idNumber && !isValid)
+ });
},
- // 检查是否可以发送验证码
- checkCanSendCode() {
- const { name, phone, nameError, phoneError } = this.data;
- const canSendCode = name && phone && !nameError && !phoneError;
- this.setData({ canSendCode });
+ // 清除身份证号
+ clearIdNumber() {
+ this.setData({
+ idNumber: '',
+ idNumberError: '',
+ showIdNumberHint: false,
+ isIdNumberValid: false
+ }, () => {
+ this.checkForm();
+ });
},
- // 发送验证码
- async sendSmsCode() {
- const { name, phone, countdown } = this.data;
+ // 身份证验证函数
+ validateIdNumber(idNumber) {
+ // 基础格式验证
+ if (!/^\d{17}[\dXx]$/.test(idNumber)) {
+ return false;
+ }
- if (countdown > 0) return;
+ // 地区码验证(简化的验证,实际应该更严谨)
+ const areaCode = idNumber.substring(0, 2);
+ const validAreaCodes = ['11', '12', '13', '14', '15', '21', '22', '23',
+ '31', '32', '33', '34', '35', '36', '37', '41',
+ '42', '43', '44', '45', '46', '50', '51', '52',
+ '53', '54', '61', '62', '63', '64', '65'];
- // 验证手机号格式
- if (!/^1[3-9]\d{9}$/.test(phone)) {
- this.setData({ phoneError: '请输入正确的手机号码' });
- return;
+ if (!validAreaCodes.includes(areaCode)) {
+ return false;
}
- // 显示加载
- wx.showLoading({
- title: '发送中...',
- mask: true
- });
-
- try {
- // 模拟发送验证码请求
- await new Promise(resolve => setTimeout(resolve, 1500));
-
- wx.hideLoading();
-
- // 发送成功
- wx.showToast({
- title: '验证码已发送',
- icon: 'success',
- duration: 2000
- });
-
- // 开始倒计时
- this.startCountdown();
-
- } catch (error) {
- wx.hideLoading();
- wx.showToast({
- title: '发送失败,请重试',
- icon: 'error',
- duration: 2000
- });
+ // 出生日期验证
+ const year = parseInt(idNumber.substring(6, 10));
+ const month = parseInt(idNumber.substring(10, 12));
+ const day = parseInt(idNumber.substring(12, 14));
+
+ const currentYear = new Date().getFullYear();
+ if (year < 1900 || year > currentYear) return false;
+ if (month < 1 || month > 12) return false;
+ if (day < 1 || day > 31) return false;
+
+ // 校验码验证
+ const checkCode = idNumber.charAt(17).toUpperCase();
+ const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
+ const checkCodes = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
+
+ let sum = 0;
+ for (let i = 0; i < 17; i++) {
+ sum += parseInt(idNumber.charAt(i)) * weights[i];
}
- },
-
- // 开始倒计时
- startCountdown() {
- this.setData({ countdown: 60 });
- const timer = setInterval(() => {
- let { countdown } = this.data;
- countdown--;
-
- if (countdown <= 0) {
- clearInterval(timer);
- this.setData({
- countdown: 0,
- countdownTimer: null
- });
- } else {
- this.setData({
- countdown: countdown,
- countdownTimer: timer
- });
- }
- }, 1000);
+ const mod = sum % 11;
+ return checkCode === checkCodes[mod];
},
// 协议处理
toggleAgreement() {
+ const newAgreed = !this.data.agreed;
this.setData({
- agreed: !this.data.agreed
+ agreed: newAgreed
}, () => {
this.checkForm();
});
},
- viewAgreement() {
- wx.navigateTo({
- url: '/pages/web-view/web-view?url=' + encodeURIComponent('https://your-domain.com/agreement')
- });
+ // 显示协议弹窗
+ showAgreementModal() {
+ const title = '用户服务协议';
+ const content = `欢迎您使用"与牧同行"服务!\n\n在使用我们的服务前,请您仔细阅读并同意以下协议:\n\n1. 服务条款\n您在使用与牧同行提供的各项服务时,应当遵守相关法律法规,不得从事任何非法行为。\n\n2. 用户责任\n您需要保证所提供信息的真实性、准确性和完整性。\n\n3. 服务变更\n我们保留随时修改、暂停或终止服务的权利。\n\n4. 免责声明\n在法律法规允许的最大范围内,我们对因使用服务而产生的任何间接损失不承担责任。\n\n5. 法律适用\n本协议的订立、执行和解释及争议的解决均适用中华人民共和国法律。\n\n请您确保已阅读并理解以上条款。`;
+
+ this.showModal(title, content);
},
- viewPrivacy() {
- wx.navigateTo({
- url: '/pages/web-view/web-view?url=' + encodeURIComponent('https://your-domain.com/privacy')
+ // 显示隐私弹窗
+ showPrivacyModal() {
+ const title = '隐私保护协议';
+ const content = `我们非常重视您的隐私保护,请您仔细阅读以下隐私政策:\n\n1. 信息收集\n我们仅收集为您提供服务所必需的信息,包括姓名、身份证号等实名信息。\n\n2. 信息使用\n您的信息仅用于身份验证和服务提供,不会用于其他商业用途。\n\n3. 信息保护\n我们采用先进的安全技术保护您的信息,防止未经授权的访问、使用或泄露。\n\n4. 信息共享\n除非获得您的明确同意,我们不会向第三方共享您的个人信息。\n\n5. 您的权利\n您可以随时查看、更正或删除您的个人信息。\n\n6. 政策更新\n我们可能会不时更新本隐私政策,更新后的政策将在本页面公布。\n\n我们承诺严格遵守相关法律法规,保护您的个人信息安全。`;
+
+ this.showModal(title, content);
+ },
+
+ // 显示弹窗
+ showModal(title, content) {
+ this.setData({
+ modalTitle: title,
+ modalContent: content,
+ showModal: true
});
},
+ // 关闭弹窗
+ closeModal() {
+ this.setData({ showModal: false });
+ },
+
+ // 阻止事件冒泡
+ stopPropagation(e) {
+ // 阻止冒泡
+ },
+
// 检查表单
checkForm() {
const {
- name,
- phone,
- smsCode,
- nameError,
- phoneError,
- smsCodeError,
+ isNameValid,
+ isIdNumberValid,
agreed
} = this.data;
- const isValid = name &&
- phone &&
- smsCode &&
- !nameError &&
- !phoneError &&
- !smsCodeError &&
+ const isValid = isNameValid &&
+ isIdNumberValid &&
agreed;
this.setData({
@@ -244,56 +296,70 @@ Page({
async submitAuth() {
if (!this.data.canSubmit || this.data.isSubmitting) return;
- this.setData({ isSubmitting: true });
-
- // 验证数据
- const { name, phone, smsCode } = this.data;
-
// 最终验证
+ const { name, idNumber } = this.data;
+
if (!/^[\u4e00-\u9fa5]{2,10}$/.test(name)) {
this.setData({
nameError: '姓名应为2-10个汉字',
- isSubmitting: false
+ showNameHint: true,
+ canSubmit: false
});
return;
}
- if (!/^1[3-9]\d{9}$/.test(phone)) {
+ if (!this.validateIdNumber(idNumber)) {
this.setData({
- phoneError: '请输入正确的手机号码',
- isSubmitting: false
+ idNumberError: '身份证号格式不正确',
+ showIdNumberHint: true,
+ canSubmit: false
});
return;
}
+
+ this.setData({
+ isSubmitting: true,
+ currentStep: 2,
+ lineProgress1: 100,
+ lineProgress2: 50
+ });
- if (!/^\d{6}$/.test(smsCode)) {
- this.setData({
- smsCodeError: '请输入6位数字验证码',
- isSubmitting: false
- });
- return;
- }
+ // 显示加载动画
+ wx.showLoading({
+ title: '正在验证...',
+ mask: true
+ });
try {
// 模拟API请求
- await new Promise(resolve => setTimeout(resolve, 2000));
+ await new Promise(resolve => setTimeout(resolve, 1500));
- // 提交成功
- this.setData({
- isSubmitting: false,
- showSuccessModal: true
- });
+ wx.hideLoading();
+
+ // 处理身份证号脱敏显示
+ const maskedId = idNumber.substring(0, 4) + '**********' + idNumber.substring(14);
+
+ // 显示成功弹窗
+ this.showSuccessModal(maskedId);
- // 保存认证信息到本地
+ // 保存认证信息
wx.setStorageSync('realNameAuth', {
name: name,
- phone: phone,
+ idNumber: idNumber,
certified: true,
certifiedTime: new Date().getTime()
});
+ this.setData({
+ isSubmitting: false,
+ currentStep: 3,
+ lineProgress2: 100
+ });
+
} catch (error) {
+ wx.hideLoading();
this.setData({ isSubmitting: false });
+
wx.showToast({
title: '认证失败,请重试',
icon: 'error',
@@ -302,7 +368,15 @@ Page({
}
},
- // 成功弹窗处理
+ // 显示成功弹窗
+ showSuccessModal(maskedId) {
+ this.setData({
+ maskedIdNumber: maskedId,
+ showSuccessModal: true
+ });
+ },
+
+ // 关闭成功弹窗
closeSuccessModal() {
this.setData({ showSuccessModal: false });
},
@@ -311,7 +385,7 @@ Page({
goToHome() {
this.closeSuccessModal();
wx.switchTab({
- url: '/pages/index/index'
+ url: '/pages/personal/personal'
});
}
});
\ No newline at end of file
diff --git a/pagesA/pages/attestation/attestation.wxml b/pagesA/pages/attestation/attestation.wxml
index b86f3a7..574a145 100644
--- a/pagesA/pages/attestation/attestation.wxml
+++ b/pagesA/pages/attestation/attestation.wxml
@@ -1,185 +1,261 @@
-
-
-
-
-
-
+
+
+
+
+
-
-