-
8.idea/.gitignore
-
6.idea/encodings.xml
-
6.idea/misc.xml
-
8.idea/modules.xml
-
6.idea/vcs.xml
-
9.idea/wxamp-ymtxMerchant.iml
-
19app.js
-
69app.json
-
15app.wxss
-
105components/navigation-bar/navigation-bar.js
-
5components/navigation-bar/navigation-bar.json
-
64components/navigation-bar/navigation-bar.wxml
-
96components/navigation-bar/navigation-bar.wxss
-
301pages/home/home.js
-
6pages/home/home.json
-
183pages/home/home.wxml
-
501pages/home/home.wxss
-
BINpages/images/EZSx3exf4cjI.woff
-
BINpages/images/EZSx3exf4cjI.woff2
-
BINpages/images/dw.png
-
BINpages/images/fkjy.png
-
BINpages/images/home.png
-
BINpages/images/home1.png
-
BINpages/images/logout.png
-
BINpages/images/smrz.png
-
BINpages/images/tx.png
-
BINpages/images/wd.png
-
BINpages/images/wd1.png
-
BINpages/images/xx.png
-
BINpages/images/xx1.png
-
199pages/login/login.js
-
4pages/login/login.json
-
90pages/login/login.wxml
-
506pages/login/login.wxss
-
66pages/message/message.js
-
3pages/message/message.json
-
2pages/message/message.wxml
-
1pages/message/message.wxss
-
66pages/personal/personal.js
-
3pages/personal/personal.json
-
2pages/personal/personal.wxml
-
1pages/personal/personal.wxss
-
66pagesA/pages/askingSy/askingSy.js
-
3pagesA/pages/askingSy/askingSy.json
-
2pagesA/pages/askingSy/askingSy.wxml
-
1pagesA/pages/askingSy/askingSy.wxss
-
66pagesB/pages/repository/repository.js
-
3pagesB/pages/repository/repository.json
-
2pagesB/pages/repository/repository.wxml
-
1pagesB/pages/repository/repository.wxss
-
41project.config.json
-
24project.private.config.json
-
7sitemap.json
-
242utils/api.js
-
5utils/baseUrl.js
-
8utils/font.wxss
-
102utils/http.js
-
45utils/tool.wxs
-
19utils/util.js
@ -0,0 +1,8 @@ |
|||
# 默认忽略的文件 |
|||
/shelf/ |
|||
/workspace.xml |
|||
# 基于编辑器的 HTTP 客户端请求 |
|||
/httpRequests/ |
|||
# Datasource local storage ignored files |
|||
/dataSources/ |
|||
/dataSources.local.xml |
|||
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8"> |
|||
<file url="PROJECT" charset="UTF-8" /> |
|||
</component> |
|||
</project> |
|||
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ProjectRootManager"> |
|||
<output url="file://$PROJECT_DIR$/out" /> |
|||
</component> |
|||
</project> |
|||
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ProjectModuleManager"> |
|||
<modules> |
|||
<module fileurl="file://$PROJECT_DIR$/.idea/wxamp-ymtxMerchant.iml" filepath="$PROJECT_DIR$/.idea/wxamp-ymtxMerchant.iml" /> |
|||
</modules> |
|||
</component> |
|||
</project> |
|||
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="VcsDirectoryMappings"> |
|||
<mapping directory="" vcs="Git" /> |
|||
</component> |
|||
</project> |
|||
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<module type="JAVA_MODULE" version="4"> |
|||
<component name="NewModuleRootManager" inherit-compiler-output="true"> |
|||
<exclude-output /> |
|||
<content url="file://$MODULE_DIR$" /> |
|||
<orderEntry type="inheritedJdk" /> |
|||
<orderEntry type="sourceFolder" forTests="false" /> |
|||
</component> |
|||
</module> |
|||
@ -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 |
|||
} |
|||
}) |
|||
@ -0,0 +1,69 @@ |
|||
{ |
|||
"pages": [ |
|||
"pages/home/home", |
|||
"pages/login/login", |
|||
"pages/message/message", |
|||
"pages/personal/personal" |
|||
], |
|||
"subPackages": [ |
|||
{ |
|||
"root": "pagesA", |
|||
"pages": [ |
|||
"pages/askingSy/askingSy" |
|||
] |
|||
}, |
|||
{ |
|||
"root": "pagesB", |
|||
"pages": [ |
|||
"pages/repository/repository" |
|||
], |
|||
"independent": true |
|||
} |
|||
], |
|||
|
|||
"tabBar": { |
|||
"color": "#2E2E2E", |
|||
"selectedColor": "#50C1BA", |
|||
"borderStyle": "black", |
|||
"list": [ |
|||
{ |
|||
"pagePath": "pages/home/home", |
|||
"text": "首页", |
|||
"iconPath": "pages/images/home.png", |
|||
"selectedIconPath": "pages/images/home1.png" |
|||
}, |
|||
{ |
|||
"pagePath": "pages/message/message", |
|||
"text": "消息", |
|||
"iconPath": "pages/images/xx.png", |
|||
"selectedIconPath": "pages/images/xx1.png" |
|||
}, |
|||
{ |
|||
"pagePath": "pages/personal/personal", |
|||
"text": "我的", |
|||
"iconPath": "pages/images/wd.png", |
|||
"selectedIconPath": "pages/images/wd1.png" |
|||
} |
|||
] |
|||
}, |
|||
|
|||
"window": { |
|||
"backgroundColor": "#86D8D0", |
|||
"navigationBarBackgroundColor": "#86D8D0", |
|||
"navigationBarTextStyle": "white" |
|||
}, |
|||
"renderer": "webview", |
|||
"rendererOptions": { |
|||
"skyline": { |
|||
"defaultDisplayBlock": true, |
|||
"defaultContentBox": true, |
|||
"tagNameStyleIsolation": "legacy", |
|||
"disableABTest": true, |
|||
"sdkVersionBegin": "3.0.0", |
|||
"sdkVersionEnd": "15.255.255" |
|||
} |
|||
}, |
|||
"componentFramework": "glass-easel", |
|||
"sitemapLocation": "sitemap.json", |
|||
"lazyCodeLoading": "requiredComponents" |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
@import'/utils/font.wxss'; |
|||
|
|||
.container { |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
padding: 200rpx 0; |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
page { |
|||
font-family: '思源宋体 Light' !important; |
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
Component({ |
|||
options: { |
|||
multipleSlots: true // 在组件定义时的选项中启用多slot支持
|
|||
}, |
|||
/** |
|||
* 组件的属性列表 |
|||
*/ |
|||
properties: { |
|||
extClass: { |
|||
type: String, |
|||
value: '' |
|||
}, |
|||
title: { |
|||
type: String, |
|||
value: '' |
|||
}, |
|||
background: { |
|||
type: String, |
|||
value: '' |
|||
}, |
|||
color: { |
|||
type: String, |
|||
value: '' |
|||
}, |
|||
back: { |
|||
type: Boolean, |
|||
value: true |
|||
}, |
|||
loading: { |
|||
type: Boolean, |
|||
value: false |
|||
}, |
|||
homeButton: { |
|||
type: Boolean, |
|||
value: false, |
|||
}, |
|||
animated: { |
|||
// 显示隐藏的时候opacity动画效果
|
|||
type: Boolean, |
|||
value: true |
|||
}, |
|||
show: { |
|||
// 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在
|
|||
type: Boolean, |
|||
value: true, |
|||
observer: '_showChange' |
|||
}, |
|||
// back为true的时候,返回的页面深度
|
|||
delta: { |
|||
type: Number, |
|||
value: 1 |
|||
}, |
|||
}, |
|||
/** |
|||
* 组件的初始数据 |
|||
*/ |
|||
data: { |
|||
displayStyle: '' |
|||
}, |
|||
lifetimes: { |
|||
attached() { |
|||
const rect = wx.getMenuButtonBoundingClientRect() |
|||
wx.getSystemInfo({ |
|||
success: (res) => { |
|||
const isAndroid = res.platform === 'android' |
|||
const isDevtools = res.platform === 'devtools' |
|||
this.setData({ |
|||
ios: !isAndroid, |
|||
innerPaddingRight: `padding-right: ${res.windowWidth - rect.left}px`, |
|||
leftWidth: `width: ${res.windowWidth - rect.left }px`, |
|||
safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${res.safeArea.top}px); padding-top: ${res.safeArea.top}px` : `` |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
}, |
|||
/** |
|||
* 组件的方法列表 |
|||
*/ |
|||
methods: { |
|||
_showChange(show) { |
|||
const animated = this.data.animated |
|||
let displayStyle = '' |
|||
if (animated) { |
|||
displayStyle = `opacity: ${ |
|||
show ? '1' : '0' |
|||
};transition:opacity 0.5s;`
|
|||
} else { |
|||
displayStyle = `display: ${show ? '' : 'none'}` |
|||
} |
|||
this.setData({ |
|||
displayStyle |
|||
}) |
|||
}, |
|||
back() { |
|||
const data = this.data |
|||
if (data.delta) { |
|||
wx.navigateBack({ |
|||
delta: data.delta |
|||
}) |
|||
} |
|||
this.triggerEvent('back', { delta: data.delta }, {}) |
|||
} |
|||
}, |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"component": true, |
|||
"styleIsolation": "apply-shared", |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
<view class="weui-navigation-bar {{extClass}}"> |
|||
<view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="color: {{color}}; background: {{background}}; {{displayStyle}}; {{innerPaddingRight}}; {{safeAreaTop}};"> |
|||
|
|||
<!-- 左侧按钮 --> |
|||
<view class='weui-navigation-bar__left' style="{{leftWidth}};"> |
|||
<block wx:if="{{back || homeButton}}"> |
|||
<!-- 返回上一页 --> |
|||
<block wx:if="{{back}}"> |
|||
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_goback"> |
|||
<view |
|||
bindtap="back" |
|||
class="weui-navigation-bar__btn_goback_wrapper" |
|||
hover-class="weui-active" |
|||
hover-stay-time="100" |
|||
aria-role="button" |
|||
aria-label="返回" |
|||
> |
|||
<view class="weui-navigation-bar__button weui-navigation-bar__btn_goback"></view> |
|||
</view> |
|||
</view> |
|||
</block> |
|||
<!-- 返回首页 --> |
|||
<block wx:if="{{homeButton}}"> |
|||
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_home"> |
|||
<view |
|||
bindtap="home" |
|||
class="weui-navigation-bar__btn_home_wrapper" |
|||
hover-class="weui-active" |
|||
aria-role="button" |
|||
aria-label="首页" |
|||
> |
|||
<view class="weui-navigation-bar__button weui-navigation-bar__btn_home"></view> |
|||
</view> |
|||
</view> |
|||
</block> |
|||
</block> |
|||
<block wx:else> |
|||
<slot name="left"></slot> |
|||
</block> |
|||
</view> |
|||
|
|||
<!-- 标题 --> |
|||
<view class='weui-navigation-bar__center'> |
|||
<view wx:if="{{loading}}" class="weui-navigation-bar__loading" aria-role="alert"> |
|||
<view |
|||
class="weui-loading" |
|||
aria-role="img" |
|||
aria-label="加载中" |
|||
></view> |
|||
</view> |
|||
<block wx:if="{{title}}"> |
|||
<text>{{title}}</text> |
|||
</block> |
|||
<block wx:else> |
|||
<slot name="center"></slot> |
|||
</block> |
|||
</view> |
|||
|
|||
<!-- 右侧留空 --> |
|||
<view class='weui-navigation-bar__right'> |
|||
<slot name="right"></slot> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,96 @@ |
|||
.weui-navigation-bar { |
|||
--weui-FG-0:rgba(0,0,0,.9); |
|||
--height: 44px; |
|||
--left: 16px; |
|||
} |
|||
.weui-navigation-bar .android { |
|||
--height: 48px; |
|||
} |
|||
|
|||
.weui-navigation-bar { |
|||
overflow: hidden; |
|||
color: var(--weui-FG-0); |
|||
flex: none; |
|||
} |
|||
|
|||
.weui-navigation-bar__inner { |
|||
position: relative; |
|||
top: 0; |
|||
left: 0; |
|||
height: calc(var(--height) + env(safe-area-inset-top)); |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
justify-content: center; |
|||
padding-top: env(safe-area-inset-top); |
|||
width: 100%; |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
.weui-navigation-bar__left { |
|||
position: relative; |
|||
padding-left: var(--left); |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: flex-start; |
|||
height: 100%; |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
.weui-navigation-bar__btn_goback_wrapper { |
|||
padding: 11px 18px 11px 16px; |
|||
margin: -11px -18px -11px -16px; |
|||
} |
|||
|
|||
.weui-navigation-bar__btn_goback_wrapper.weui-active { |
|||
opacity: 0.5; |
|||
} |
|||
|
|||
.weui-navigation-bar__btn_goback { |
|||
font-size: 12px; |
|||
width: 12px; |
|||
height: 24px; |
|||
-webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%; |
|||
mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%; |
|||
-webkit-mask-size: cover; |
|||
mask-size: cover; |
|||
background-color: var(--weui-FG-0); |
|||
} |
|||
|
|||
.weui-navigation-bar__center { |
|||
font-size: 17px; |
|||
text-align: center; |
|||
position: relative; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
justify-content: center; |
|||
font-weight: bold; |
|||
flex: 1; |
|||
height: 100%; |
|||
} |
|||
|
|||
.weui-navigation-bar__loading { |
|||
margin-right: 4px; |
|||
align-items: center; |
|||
} |
|||
|
|||
.weui-loading { |
|||
font-size: 16px; |
|||
width: 16px; |
|||
height: 16px; |
|||
display: block; |
|||
background: transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A") no-repeat; |
|||
background-size: 100%; |
|||
margin-left: 0; |
|||
animation: loading linear infinite 1s; |
|||
} |
|||
|
|||
@keyframes loading { |
|||
from { |
|||
transform: rotate(0); |
|||
} |
|||
to { |
|||
transform: rotate(360deg); |
|||
} |
|||
} |
|||
@ -0,0 +1,301 @@ |
|||
import http from '../../utils/api' |
|||
const baseUrl = require('../../utils/baseUrl') |
|||
Page({ |
|||
data: { |
|||
// 轮播图数据
|
|||
currentSwiper: 0, |
|||
baseUrl: baseUrl, |
|||
swiperList: [], |
|||
articleList:[ |
|||
{title:'文章发布',describe:'快速发布养殖知识',icon:'/pages/images/fkjy.png'}, |
|||
{title:'在线学习',describe:'视频培训发布',icon:'/pages/images/tx.png'} |
|||
], |
|||
// 通知公告数据
|
|||
currentNotice: 0, |
|||
noticeList: [], |
|||
forum: [], |
|||
suffer: [], |
|||
// 添加用户数据
|
|||
user: {}, |
|||
county: '' |
|||
}, |
|||
|
|||
// 查询用户信息
|
|||
getUserInfo() { |
|||
http.UserInfo({ |
|||
data: {}, |
|||
success: res => { |
|||
console.log(111,res); |
|||
this.setData({ |
|||
user: res.data.user.area |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 在线问答列表
|
|||
getforumList() { |
|||
http.forumList({ |
|||
data: {}, |
|||
success: res => { |
|||
const zxwd = [] |
|||
zxwd.push(res.rows[0]) |
|||
this.setData({ |
|||
forum: zxwd |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 经验分享列表
|
|||
getexperience() { |
|||
http.experience({ |
|||
data: {}, |
|||
success: res => { |
|||
const zyfx = [] |
|||
zyfx.push(res.rows[0]) |
|||
this.setData({ |
|||
suffer: zyfx |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 轮播
|
|||
getCarousel() { |
|||
http.carousel({ |
|||
data: {}, |
|||
success: res => { |
|||
this.setData({ |
|||
swiperList: res.rows |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 灾害/通知公告
|
|||
getDisaster() { |
|||
http.disaster({ |
|||
data: {}, |
|||
success: res => { |
|||
// 处理通知数据,添加时间戳
|
|||
const notices = res.rows.map(item => { |
|||
return { |
|||
...item, |
|||
// // 判断是否是24小时内的通知
|
|||
// isNew: this.isNewNotification(item.createdTime)
|
|||
} |
|||
}) |
|||
this.setData({ |
|||
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() { |
|||
wx.navigateTo({ |
|||
url: '/pagesB/pages/administrativeDivision/administrativeDivision', |
|||
}) |
|||
}, |
|||
|
|||
// AI问诊
|
|||
bindAI() { |
|||
wx.navigateTo({ |
|||
url: '/pagesA/pages/wzai/wzai', |
|||
}) |
|||
}, |
|||
|
|||
// 问兽医
|
|||
bindWsy() { |
|||
wx.navigateTo({ |
|||
url: '/pagesA/pages/askingSy/askingSy', |
|||
}) |
|||
}, |
|||
|
|||
// 找专家
|
|||
bindZj() { |
|||
wx.navigateTo({ |
|||
url: '/pagesA/pages/expert/expert', |
|||
}) |
|||
}, |
|||
|
|||
// 去买药
|
|||
bindYao() { |
|||
wx.navigateTo({ |
|||
url: '/pagesA/pages/medicine/medicine', |
|||
}) |
|||
}, |
|||
|
|||
|
|||
// 问答列表
|
|||
bindwdlist() { |
|||
wx.navigateTo({ |
|||
url: '/pagesB/pages/forumlist/forumlist', |
|||
}) |
|||
}, |
|||
|
|||
// 问答详情
|
|||
bindTw(e) { |
|||
console.log(e); |
|||
const id = e.currentTarget.dataset.id |
|||
wx.navigateTo({ |
|||
url: `/pagesB/pages/onlineAsk/onlineAsk?id=${id}`, |
|||
}) |
|||
}, |
|||
|
|||
// 经验分享列表
|
|||
viewexperience() { |
|||
wx.navigateTo({ |
|||
url: '/pagesB/pages/experienceList/experienceList', |
|||
}) |
|||
}, |
|||
|
|||
// 经验分享详情
|
|||
bindfx(e) { |
|||
const id = e.currentTarget.dataset.id |
|||
wx.navigateTo({ |
|||
url: `/pagesB/pages/experienceDetails/experienceDetails?id=${id}`, |
|||
}) |
|||
}, |
|||
|
|||
|
|||
|
|||
// 查看所有问题
|
|||
viewAllQuestions() { |
|||
this.bindwdlist() |
|||
}, |
|||
|
|||
// 获取当前位置信息
|
|||
getLocation() { |
|||
let that = this; |
|||
// 腾讯获取的密钥
|
|||
let key = 'AOBBZ-6LUK7-WXGXX-HJUXS-HHUM5-FWFPJ' |
|||
wx.getLocation({ |
|||
isHighAccuracy: true, |
|||
type: 'gcj02', |
|||
success: function (res) { |
|||
let latitude = res.latitude; |
|||
let longitude = res.longitude; |
|||
wx.request({ |
|||
url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${latitude},${longitude}&key=${key}`, |
|||
success: res => { |
|||
that.setData({ |
|||
county: res.data.result.address_component.district //城市
|
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
onLoad() { |
|||
this.getDisaster() |
|||
this.getCarousel() |
|||
this.getLocation() |
|||
this.getforumList() |
|||
this.getexperience() |
|||
}, |
|||
|
|||
onShow() { |
|||
this.resetSwiper() |
|||
this.getUserInfo() |
|||
}, |
|||
|
|||
// 重置轮播图(解决轮播不自动播放的问题)
|
|||
resetSwiper() { |
|||
setTimeout(() => { |
|||
if (this.data.swiperList.length > 0) { |
|||
this.setData({ |
|||
currentSwiper: this.data.currentSwiper |
|||
}) |
|||
} |
|||
}, 300) |
|||
}, |
|||
|
|||
// 轮播图变化事件
|
|||
onSwiperChange(e) { |
|||
const current = e.detail.current; |
|||
this.setData({ |
|||
currentSwiper: current |
|||
}); |
|||
}, |
|||
|
|||
// 轮播图指示器点击
|
|||
onIndicatorTap(e) { |
|||
const index = e.currentTarget.dataset.index; |
|||
this.setData({ |
|||
currentSwiper: index |
|||
}); |
|||
}, |
|||
|
|||
|
|||
// 轮播图点击
|
|||
onSwiperTap(e) { |
|||
console.log(1111, e); |
|||
var id = e.currentTarget.dataset.value.carouselId |
|||
wx.navigateTo({ |
|||
url: `/pagesA/pages/carouselDetail/carouselDetail?id=${id}`, |
|||
}) |
|||
}, |
|||
|
|||
|
|||
onReady() { |
|||
// 当前网络状态
|
|||
wx.getNetworkType({ |
|||
success: function (res) { |
|||
// 返回网络类型, 有效值:
|
|||
// wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
|
|||
console.log(res); |
|||
var networkType = res.networkType |
|||
if (networkType !== 'unknown') { |
|||
wx.showToast({ |
|||
title: '当前使用"' + networkType + '"网络', |
|||
icon: 'none', |
|||
duration: 1000 |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 下拉刷新
|
|||
onPullDownRefresh() { |
|||
wx.showNavigationBarLoading() |
|||
|
|||
// 重新加载所有数据
|
|||
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', |
|||
duration: 1000 |
|||
}) |
|||
wx.hideNavigationBarLoading() |
|||
wx.stopPullDownRefresh() |
|||
}).catch(() => { |
|||
wx.hideNavigationBarLoading() |
|||
wx.stopPullDownRefresh() |
|||
}) |
|||
}, |
|||
|
|||
// 页面滚动
|
|||
onPageScroll(e) { |
|||
// 可以根据需要添加滚动效果
|
|||
} |
|||
}); |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"navigationBarTitleText":"与牧同行", |
|||
"enablePullDownRefresh": true, |
|||
"backgroundTextStyle": "dark", |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,183 @@ |
|||
<wxs module="tool" src="../../utils/tool.wxs"></wxs> |
|||
<view class="home-container"> |
|||
<view class="box"> |
|||
|
|||
<view class="orientation"> |
|||
|
|||
<!-- 定位 --> |
|||
<!-- <view class="orientation2"> |
|||
<image src="/pages/images/dw.png" mode="" /> |
|||
<view>{{county}}</view> |
|||
</view> --> |
|||
|
|||
<!-- 行政区划 --> |
|||
<view class="orientation3" bind:tap="bindXzqh"> |
|||
<image src="/pages/images/dw.png" mode="" /> |
|||
<view>{{user.name || '去选择'}}</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- AI问诊 --> |
|||
<view class="Aidiagnosis" bind:tap="bindAI"> |
|||
<image src="/pages/images/aiwz.png" mode="" /> |
|||
</view> |
|||
|
|||
<!-- 轮播图区域--> |
|||
<view class="swiper-container"> |
|||
<swiper class="custom-swiper" indicator-dots="{{false}}" indicator-color="rgba(255,255,255,0.4)" indicator-active-color="#4CAF50" autoplay="{{true}}" interval="5000" duration="500" circular="{{true}}" current="{{currentSwiper}}" bindchange="onSwiperChange" style="height: 360rpx;"> |
|||
<block wx:for="{{swiperList}}" wx:key="id"> |
|||
<swiper-item> |
|||
<view class="swiper-item {{item.isActive ? 'active' : ''}}" data-value="{{item}}" catchtap="onSwiperTap"> |
|||
<image src="{{baseUrl+item.imageUrl}}" class="swiper-image" mode="aspectFill" /> |
|||
<view class="swiper-mask"></view> |
|||
<view class="swiper-content"> |
|||
<text class="swiper-tag">{{item.adsType}}</text> |
|||
<text class="swiper-title">{{item.title}}</text> |
|||
<text class="swiper-desc">{{item.subtitle}}</text> |
|||
</view> |
|||
<view class="swiper-gradient"></view> |
|||
</view> |
|||
</swiper-item> |
|||
</block> |
|||
</swiper> |
|||
<!-- 自定义指示器 --> |
|||
<view class="custom-indicator"> |
|||
<block wx:for="{{swiperList}}" wx:key="id"> |
|||
<view class="indicator-dot {{currentSwiper === index ? 'active' : ''}}" data-index="{{index}}" bindtap="onIndicatorTap"></view> |
|||
</block> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="kap"> |
|||
<!-- 卡片类型 --> |
|||
<view class="card"> |
|||
<view class="card2" bind:tap="bindWsy"> |
|||
<view>接受咨询</view> |
|||
<view class="card2_1">回复问诊单信息</view> |
|||
<view class="card2_1">快捷回复</view> |
|||
</view> |
|||
<view class="card3"> |
|||
<view class="card3_1 card3_kp" bind:tap="bindZj"> |
|||
<view>远程诊疗</view> |
|||
<view>足不出户方便快捷</view> |
|||
</view> |
|||
<view class="card3_2 card3_kp" bind:tap="bindYao"> |
|||
<view>方案制定</view> |
|||
<view>制定专业的治疗方案</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 文章发布-视频培训 --> |
|||
<view class="article"> |
|||
<view class="article1_1" wx:for="{{articleList}}"> |
|||
<view class="article2"> |
|||
<view>{{item.title}}</view> |
|||
<view>{{item.describe}}</view> |
|||
</view> |
|||
<view class="article3"> |
|||
<image src="{{item.icon}}" mode="widthFix"/> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
<!-- 用户提问板块 --> |
|||
<view class="user-question-section"> |
|||
<!-- 标题区域 --> |
|||
<view class="question-header" bind:tap="bindwdlist"> |
|||
<view class="question-title"> |
|||
<view class="title-text">在线问答</view> |
|||
<view class="title-sub">看看其他养殖户遇到的问题</view> |
|||
</view> |
|||
<view class="view-all" bindtap="viewAllQuestions"> |
|||
查看全部 |
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
<!-- 问题列表 --> |
|||
<view class="question-card placeholder" wx:for="{{forum}}" bind:tap="bindTw" data-id="{{item.id}}"> |
|||
<view class="question-meta"> |
|||
<view class="question-tag"> |
|||
<text class="tag-text">{{item.title}}</text> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="question-info"> |
|||
<view class="user-info"> |
|||
<image src="{{baseUrl+item.avatar}}" class="user-avatar"></image> |
|||
<view class="user-detail"> |
|||
<view class="user-name">{{item.nickName}}</view> |
|||
</view> |
|||
</view> |
|||
<view class="time-info"> |
|||
{{item.createdAt}} |
|||
</view> |
|||
</view> |
|||
<!-- 底部信息 --> |
|||
<view class="post-footer"> |
|||
<view class="post-meta"> |
|||
<view class="meta-item"> |
|||
<image class="meta-icon" src="/pagesB/images/hf.png" mode="aspectFit"></image> |
|||
<text class="meta-count">{{item.answerCount || 0}}</text> |
|||
</view> |
|||
<view class="meta-item"> |
|||
<image class="meta-icon" src="/pagesB/images/lll.png" mode="aspectFit"></image> |
|||
<text class="meta-count">{{item.viewCount || 0}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
|
|||
<!-- 经验分享板块 --> |
|||
<view class="user-question-section"> |
|||
<!-- 标题区域 --> |
|||
<view class="question-header" > |
|||
<view class="question-title"> |
|||
<view class="title-text1_1">经验分享</view> |
|||
<view class="title-sub">分享自己养殖经验</view> |
|||
</view> |
|||
<view class="view-all1_1" bindtap="viewexperience"> |
|||
查看全部 |
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
<!-- 问题列表 --> |
|||
<view class="question-card placeholder" wx:for="{{suffer}}" bind:tap="bindfx" data-id="{{item.id}}"> |
|||
<view class="question-meta"> |
|||
<view class="question-tag"> |
|||
<text class="tag-text">{{item.title}}</text> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="question-info"> |
|||
<view class="user-info"> |
|||
<image src="{{baseUrl+item.vetAvatar}}" class="user-avatar"></image> |
|||
<view class="user-detail"> |
|||
<view class="user-name">{{item.vetName}}</view> |
|||
</view> |
|||
</view> |
|||
<view class="time-info"> |
|||
{{item.publishTime}} |
|||
</view> |
|||
</view> |
|||
<!-- 底部信息 --> |
|||
<view class="post-footer"> |
|||
<view class="post-meta"> |
|||
<view class="meta-item"> |
|||
<image class="meta-icon" src="/pagesB/images/lll.png" mode="aspectFit"></image> |
|||
<text class="meta-count">{{item.viewCount || 0}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,501 @@ |
|||
/* 页面容器 */ |
|||
.home-container { |
|||
width: 100%; |
|||
min-height: 100vh; |
|||
background: linear-gradient(180deg, #86D8D0 0%, #a9dfda 30%, #cfe9e7 60%, #ECF8F7 90%); |
|||
padding-top: env(safe-area-inset-top); |
|||
} |
|||
|
|||
/* 主要内容区域 */ |
|||
.box { |
|||
width: 93%; |
|||
margin: 0 auto; |
|||
padding-bottom: 40rpx; |
|||
} |
|||
|
|||
/* AI问诊 */ |
|||
.Aidiagnosis { |
|||
position: fixed; |
|||
right: 0; |
|||
bottom: 150px; |
|||
margin: 0 auto; |
|||
z-index: 100; |
|||
} |
|||
|
|||
.Aidiagnosis image { |
|||
width: 120rpx; |
|||
height: 120rpx; |
|||
border-radius: 50%; |
|||
} |
|||
|
|||
.orientation{ |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
margin-bottom: 10rpx; |
|||
} |
|||
|
|||
/* 定位 */ |
|||
.orientation2 { |
|||
display: flex; |
|||
align-items: center; |
|||
padding: 20rpx 0; |
|||
color: #fff; |
|||
font-weight: bold; |
|||
font-size: 26rpx; |
|||
} |
|||
|
|||
.orientation image { |
|||
width: 40rpx; |
|||
height: 40rpx; |
|||
margin-right: 10rpx; |
|||
} |
|||
|
|||
.orientation3{ |
|||
display: flex; |
|||
align-items: center; |
|||
color: #fff; |
|||
} |
|||
|
|||
/* 轮播图区域 - 已修复 */ |
|||
.swiper-container { |
|||
position: relative; |
|||
border-radius: 20rpx; |
|||
overflow: hidden; |
|||
box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.1); |
|||
animation: scaleIn 0.6s ease-out 0.4s both; |
|||
} |
|||
|
|||
@keyframes scaleIn { |
|||
from { |
|||
opacity: 0; |
|||
transform: scale(0.95); |
|||
} |
|||
|
|||
to { |
|||
opacity: 1; |
|||
transform: scale(1); |
|||
} |
|||
} |
|||
|
|||
.custom-swiper { |
|||
border-radius: 20rpx; |
|||
} |
|||
|
|||
.swiper-item { |
|||
position: relative; |
|||
height: 360rpx; |
|||
overflow: hidden; |
|||
border-radius: 20rpx; |
|||
transition: transform 0.5s ease; |
|||
} |
|||
|
|||
.swiper-item.active { |
|||
transform: scale(1.02); |
|||
} |
|||
|
|||
.swiper-image { |
|||
width: 100%; |
|||
height: 100%; |
|||
transition: transform 8s ease; |
|||
} |
|||
|
|||
.swiper-mask { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent 50%); |
|||
} |
|||
|
|||
.swiper-content { |
|||
position: absolute; |
|||
bottom: 60rpx; |
|||
left: 40rpx; |
|||
z-index: 2; |
|||
max-width: 60%; |
|||
} |
|||
|
|||
.swiper-tag { |
|||
display: inline-block; |
|||
padding: 6rpx 20rpx; |
|||
background: rgba(76, 175, 80, 0.9); |
|||
color: white; |
|||
font-size: 20rpx; |
|||
border-radius: 20rpx; |
|||
margin-bottom: 16rpx; |
|||
backdrop-filter: blur(10rpx); |
|||
} |
|||
|
|||
.swiper-title { |
|||
display: block; |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
color: #FFFFFF; |
|||
margin-bottom: 8rpx; |
|||
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3); |
|||
line-height: 1.4; |
|||
} |
|||
|
|||
.swiper-desc { |
|||
display: block; |
|||
font-size: 24rpx; |
|||
color: rgba(255, 255, 255, 0.9); |
|||
text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.swiper-gradient { |
|||
position: absolute; |
|||
bottom: 0; |
|||
left: 0; |
|||
right: 0; |
|||
height: 120rpx; |
|||
background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent); |
|||
} |
|||
|
|||
.custom-indicator { |
|||
position: absolute; |
|||
bottom: 30rpx; |
|||
right: 30rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
z-index: 3; |
|||
} |
|||
|
|||
.indicator-dot { |
|||
width: 12rpx; |
|||
height: 12rpx; |
|||
border-radius: 50%; |
|||
background: rgba(255, 255, 255, 0.5); |
|||
margin: 0 6rpx; |
|||
transition: all 0.3s ease; |
|||
} |
|||
|
|||
.indicator-dot.active { |
|||
width: 40rpx; |
|||
background: #96DBD4; |
|||
border-radius: 6rpx; |
|||
} |
|||
|
|||
/* 卡片类型 */ |
|||
.kap { |
|||
animation: kapIn 0.5s ease-out 0.5s both; |
|||
} |
|||
|
|||
@keyframes kapIn { |
|||
from { |
|||
opacity: 0; |
|||
} |
|||
|
|||
to { |
|||
opacity: 1; |
|||
} |
|||
} |
|||
|
|||
.card { |
|||
width: 100%; |
|||
display: grid; |
|||
grid-template-columns: 1.1fr 2fr; |
|||
column-gap: 20rpx; |
|||
margin: 20rpx 0; |
|||
} |
|||
|
|||
.card2 { |
|||
background-color: #F8918C; |
|||
border-radius: 25rpx; |
|||
padding: 30rpx 20rpx 120rpx; |
|||
} |
|||
|
|||
.card2 view:nth-child(1) { |
|||
font-size: 38rpx; |
|||
color: #fff; |
|||
font-weight: bold; |
|||
letter-spacing: 0.1em; |
|||
} |
|||
|
|||
.card2_1 { |
|||
margin: 10rpx 0; |
|||
font-size: 26rpx; |
|||
color: #FDE8E1; |
|||
} |
|||
|
|||
.card3 { |
|||
display: grid; |
|||
grid-template-rows: 1fr 1fr; |
|||
row-gap: 20rpx; |
|||
} |
|||
|
|||
.card3>view { |
|||
border-radius: 25rpx; |
|||
padding: 0 0 0 20rpx; |
|||
} |
|||
|
|||
.card3_1 { |
|||
background-color: #5EBEB8; |
|||
} |
|||
|
|||
.card3_1 view:last-child { |
|||
color: #D9F0EE; |
|||
} |
|||
|
|||
.card3_2 { |
|||
background-color: #E9B770; |
|||
} |
|||
|
|||
.card3_2 view:last-child { |
|||
color: #F4E8DB; |
|||
} |
|||
|
|||
.card3_kp view:first-child { |
|||
font-size: 38rpx; |
|||
color: #fff; |
|||
margin: 30rpx 0 10rpx 0; |
|||
} |
|||
|
|||
.card3_kp view:last-child { |
|||
font-size: 26rpx; |
|||
} |
|||
|
|||
|
|||
/* 文章发布-视频培训 */ |
|||
.article1_1{ |
|||
width:100%; |
|||
box-sizing: border-box; |
|||
background-color: #fff; |
|||
border-radius: 20rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
padding: 10rpx 30rpx; |
|||
margin-top: 30rpx; |
|||
} |
|||
.article2 view:first-child{ |
|||
font-weight: bold; |
|||
} |
|||
.article2 view:last-child{ |
|||
color: #C5C6CC; |
|||
font-size: 24rpx; |
|||
margin-top: 10rpx; |
|||
} |
|||
.article3 image{ |
|||
width: 100rpx; |
|||
} |
|||
|
|||
|
|||
/* 用户提问板块 */ |
|||
.user-question-section { |
|||
background: #FFFFFF; |
|||
border-radius: 24rpx; |
|||
padding: 32rpx; |
|||
margin: 40rpx 0 20rpx; |
|||
box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.06); |
|||
animation: slideUp 0.8s ease-out 0.8s both; |
|||
} |
|||
|
|||
@keyframes slideUp { |
|||
from { |
|||
opacity: 0; |
|||
transform: translateY(60rpx); |
|||
} |
|||
|
|||
to { |
|||
opacity: 1; |
|||
transform: translateY(0); |
|||
} |
|||
} |
|||
|
|||
/* 标题区域 */ |
|||
.question-header { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
margin-bottom: 40rpx; |
|||
padding-bottom: 24rpx; |
|||
border-bottom: 1px solid rgba(150, 219, 212, 0.3); |
|||
} |
|||
|
|||
.question-title { |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.title-text { |
|||
font-size: 38rpx; |
|||
font-weight: bold; |
|||
color: #7ad1cb; |
|||
margin-bottom: 8rpx; |
|||
position: relative; |
|||
padding-left: 20rpx; |
|||
} |
|||
|
|||
.title-text::before { |
|||
content: ''; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 50%; |
|||
transform: translateY(-50%); |
|||
width: 8rpx; |
|||
height: 32rpx; |
|||
background: #60C0B9; |
|||
border-radius: 4rpx; |
|||
} |
|||
|
|||
.title-text1_1 { |
|||
font-size: 38rpx; |
|||
font-weight: bold; |
|||
color: #7499C8; |
|||
margin-bottom: 8rpx; |
|||
position: relative; |
|||
padding-left: 20rpx; |
|||
} |
|||
|
|||
.title-text1_1::before { |
|||
content: ''; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 50%; |
|||
transform: translateY(-50%); |
|||
width: 8rpx; |
|||
height: 32rpx; |
|||
background: #79b2d3; |
|||
border-radius: 4rpx; |
|||
} |
|||
|
|||
.title-sub { |
|||
font-size: 24rpx; |
|||
color: #999; |
|||
padding-left: 20rpx; |
|||
} |
|||
|
|||
.view-all { |
|||
display: flex; |
|||
align-items: center; |
|||
font-size: 26rpx; |
|||
color: #60C0B9; |
|||
padding: 12rpx 24rpx; |
|||
background: rgba(96, 192, 185, 0.1); |
|||
border-radius: 30rpx; |
|||
transition: all 0.3s ease; |
|||
} |
|||
|
|||
.view-all:active { |
|||
background: rgba(96, 192, 185, 0.2); |
|||
transform: scale(0.98); |
|||
} |
|||
|
|||
.view-all1_1{ |
|||
display: flex; |
|||
align-items: center; |
|||
font-size: 26rpx; |
|||
color: #608ac0; |
|||
padding: 12rpx 24rpx; |
|||
background: rgba(96, 192, 185, 0.1); |
|||
border-radius: 30rpx; |
|||
transition: all 0.3s ease; |
|||
} |
|||
|
|||
.view-all1_1:active { |
|||
background: rgba(131, 158, 199, 0.2); |
|||
transform: scale(0.98); |
|||
} |
|||
|
|||
/* 问题元信息 */ |
|||
.question-meta { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: flex-start; |
|||
margin-bottom: 28rpx; |
|||
} |
|||
|
|||
.question-tag { |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: flex-start; |
|||
gap: 12rpx; |
|||
} |
|||
|
|||
.tag-text { |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
line-height: 1.5; |
|||
font-weight: 500; |
|||
display: -webkit-box; |
|||
-webkit-box-orient: vertical; |
|||
-webkit-line-clamp: 2; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
/* 用户信息 */ |
|||
.question-info { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
margin-bottom: 28rpx; |
|||
padding-bottom: 20rpx; |
|||
border-bottom: 1px dashed rgba(0, 0, 0, 0.08); |
|||
} |
|||
|
|||
.user-info { |
|||
display: flex; |
|||
align-items: center; |
|||
gap: 16rpx; |
|||
} |
|||
|
|||
.user-avatar { |
|||
width: 64rpx; |
|||
height: 64rpx; |
|||
border-radius: 50%; |
|||
background: #E0F2F1; |
|||
border: 2rpx solid #60C0B9; |
|||
} |
|||
|
|||
.user-detail { |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.user-name { |
|||
font-size: 26rpx; |
|||
font-weight: 500; |
|||
color: #333; |
|||
margin-bottom: 6rpx; |
|||
} |
|||
|
|||
.time-info { |
|||
font-size: 22rpx; |
|||
color: #999; |
|||
background: rgba(0, 0, 0, 0.04); |
|||
padding: 6rpx 16rpx; |
|||
border-radius: 16rpx; |
|||
} |
|||
|
|||
.post-footer { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: flex-end; |
|||
} |
|||
|
|||
.post-meta { |
|||
display: flex; |
|||
align-items: center; |
|||
gap: 25rpx; |
|||
} |
|||
|
|||
.meta-item { |
|||
display: flex; |
|||
align-items: center; |
|||
gap: 8rpx; |
|||
} |
|||
|
|||
.meta-icon { |
|||
width: 28rpx; |
|||
height: 28rpx; |
|||
opacity: 0.5; |
|||
} |
|||
|
|||
.meta-count { |
|||
font-size: 26rpx; |
|||
font-weight: 600; |
|||
color: #64748b; |
|||
} |
|||
|
After Width: 200 | Height: 200 | Size: 3.1 KiB |
|
After Width: 200 | Height: 200 | Size: 4.5 KiB |
|
After Width: 70 | Height: 64 | Size: 982 B |
|
After Width: 218 | Height: 200 | Size: 3.5 KiB |
|
After Width: 200 | Height: 200 | Size: 4.4 KiB |
|
After Width: 200 | Height: 200 | Size: 4.3 KiB |
|
After Width: 90 | Height: 90 | Size: 5.6 KiB |
|
After Width: 64 | Height: 64 | Size: 1.7 KiB |
|
After Width: 200 | Height: 200 | Size: 5.3 KiB |
|
After Width: 200 | Height: 200 | Size: 4.3 KiB |
|
After Width: 200 | Height: 200 | Size: 4.3 KiB |
@ -0,0 +1,199 @@ |
|||
import http from '../../utils/api' |
|||
Page({ |
|||
data: { |
|||
isAgree: true, // 是否同意协议
|
|||
showAgreementModal: false, // 是否显示协议弹窗
|
|||
modalTitle: '', // 弹窗标题
|
|||
modalContent: '', // 弹窗内容
|
|||
isLoading: false, // 是否显示加载中,
|
|||
phoneData: {}, |
|||
}, |
|||
|
|||
onLoad() { |
|||
this.login() |
|||
}, |
|||
|
|||
|
|||
// 登录获取
|
|||
login() { |
|||
// 小程序接口
|
|||
var that = this |
|||
wx.login({ |
|||
success(res) { |
|||
//登录接口
|
|||
http.login({ |
|||
data: { |
|||
code: res.code, |
|||
clientType: 'vet-app' |
|||
}, |
|||
success: function (res) { |
|||
console.log(111111,res); |
|||
if (res.data) { |
|||
that.setData({ |
|||
phoneData: res.data |
|||
}) |
|||
wx.showToast({ |
|||
title: res.data.message, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
} |
|||
|
|||
if (res.data.token) { |
|||
wx.setStorageSync('token', res.data.token) |
|||
wx.switchTab({ |
|||
url: '/pages/home/home' |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
}) |
|||
}, |
|||
fail: (error) => { |
|||
console.log('登录失败!' + error); |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
|
|||
// 获取用户手机号
|
|||
getPhoneNumber(e) { |
|||
if (!this.data.isAgree) { |
|||
wx.showToast({ |
|||
title: '请先同意协议', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
// 显示加载中
|
|||
this.setData({ |
|||
isLoading: true |
|||
}); |
|||
|
|||
// 检查是否获取到手机号
|
|||
if (e.detail.errMsg === "getPhoneNumber:ok") { |
|||
// 这里应该将加密数据发送到后端进行解密
|
|||
this.data.phoneData.encryptedData = e.detail.encryptedData |
|||
this.data.phoneData.iv = e.detail.iv |
|||
http.getPhoneNumber({ |
|||
data: this.data.phoneData, |
|||
success: res => { |
|||
if (res.code == 200) { |
|||
wx.setStorageSync('token', res.token) |
|||
|
|||
setTimeout(() => { |
|||
wx.switchTab({ |
|||
url: '/pages/home/home' |
|||
}); |
|||
}, 1500); |
|||
|
|||
this.setData({ |
|||
isLoading: false |
|||
}) |
|||
wx.showToast({ |
|||
title: '登录成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}); |
|||
}else{ |
|||
wx.showToast({ |
|||
title: res.msg, |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
this.setData({ |
|||
isLoading:false |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
} else { |
|||
// 用户拒绝授权
|
|||
this.setData({ |
|||
isLoading: false |
|||
}); |
|||
|
|||
wx.showToast({ |
|||
title: '需要手机号授权才能登录', |
|||
icon: 'none', |
|||
duration: 2000 |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
// 切换协议同意状态
|
|||
toggleAgreement() { |
|||
this.setData({ |
|||
isAgree: !this.data.isAgree |
|||
}); |
|||
}, |
|||
|
|||
// 显示用户协议
|
|||
showAgreement() { |
|||
const content = `欢迎您使用与牧同行服务!
|
|||
一、服务说明 |
|||
与牧同行为您提供智慧放牧管理、牲畜追踪、草场监测等服务。通过我们的平台,您可以更高效地管理牧场资源,提升放牧效率。 |
|||
二、账号注册 |
|||
1. 您需要使用手机号完成注册 |
|||
2. 您应保证提供的信息真实、准确、完整 |
|||
3. 您对账号安全负全部责任 |
|||
三、使用规范 |
|||
1. 不得利用本服务从事任何违法违规活动 |
|||
2. 不得干扰或破坏本服务的正常运行 |
|||
3. 遵守相关法律法规和平台规则 |
|||
四、服务变更与终止 |
|||
我们可能根据需要变更服务内容,如您不同意变更,可停止使用本服务。 |
|||
五、免责声明 |
|||
对于不可抗力、网络问题等导致的服务中断,我们不承担相应责任。 |
|||
六、法律适用 |
|||
本协议受中华人民共和国法律管辖。 |
|||
感谢您选择与牧同行!`;
|
|||
|
|||
this.setData({ |
|||
showAgreementModal: true, |
|||
modalTitle: '用户协议', |
|||
modalContent: content |
|||
}); |
|||
}, |
|||
|
|||
// 显示隐私政策
|
|||
showPrivacy() { |
|||
const content = `与牧同行隐私政策
|
|||
我们深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。 |
|||
一、我们如何收集和使用您的个人信息 |
|||
我们仅会出于本政策所述的以下目的,收集和使用您的个人信息: |
|||
1. 账号注册:手机号 |
|||
2. 服务提供:位置信息、设备信息 |
|||
3. 安全保障:登录日志、操作记录 |
|||
二、我们如何共享、转让、公开披露您的个人信息 |
|||
1. 我们不会与任何公司、组织和个人共享您的个人信息 |
|||
2. 我们不会将您的个人信息转让给任何公司、组织和个人 |
|||
3. 我们仅会在法律要求的情况下公开披露您的个人信息 |
|||
三、我们如何保护您的个人信息 |
|||
1. 我们已使用符合业界标准的安全防护措施保护您提供的个人信息 |
|||
2. 我们会采取合理可行的措施,确保未收集无关的个人信息 |
|||
四、您的权利 |
|||
您有权访问、更正、删除您的个人信息,以及改变您授权同意的范围或撤回授权。 |
|||
五、我们如何处理儿童的个人信息 |
|||
我们的服务主要面向成人。如果没有父母或监护人的同意,儿童不应创建自己的个人信息主体账户。 |
|||
六、本政策如何更新 |
|||
我们可能适时修订本政策内容,并通过公告等方式通知您。 |
|||
如有任何疑问,请通过客服渠道联系我们。`;
|
|||
|
|||
this.setData({ |
|||
showAgreementModal: true, |
|||
modalTitle: '隐私政策', |
|||
modalContent: content |
|||
}); |
|||
}, |
|||
|
|||
// 隐藏弹窗
|
|||
hideModal() { |
|||
this.setData({ |
|||
showAgreementModal: false |
|||
}); |
|||
} |
|||
}) |
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
"navigationBarTitleText":"登录", |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,90 @@ |
|||
<view class="login-container"> |
|||
<!-- 顶部波浪背景 --> |
|||
<view class="wave-background"> |
|||
<view class="wave wave-1"></view> |
|||
<view class="wave wave-2"></view> |
|||
<view class="wave wave-3"></view> |
|||
</view> |
|||
|
|||
<!-- 装饰元素 --> |
|||
<view class="decorations"> |
|||
<view class="cloud cloud-1"></view> |
|||
<view class="cloud cloud-2"></view> |
|||
<view class="cloud cloud-3"></view> |
|||
<view class="grass grass-1"></view> |
|||
<view class="grass grass-2"></view> |
|||
<view class="grass grass-3"></view> |
|||
<view class="sheep"></view> |
|||
</view> |
|||
|
|||
<!-- 主要内容区域 --> |
|||
<view class="main-content"> |
|||
<!-- Logo区域 --> |
|||
<view class="logo-section"> |
|||
<view class="logo-container"> |
|||
<view class="logo-circle"> |
|||
<view class="logo-inner"> |
|||
<text class="logo-text">牧</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<text class="app-title">与牧同行</text> |
|||
</view> |
|||
|
|||
<!-- 登录区域 --> |
|||
<view class="login-section"> |
|||
<view class="welcome-text"> |
|||
<text class="welcome-main">欢迎回来</text> |
|||
<text class="welcome-desc">请使用手机号快捷登录</text> |
|||
</view> |
|||
|
|||
<!-- 手机号登录按钮 --> |
|||
<button class="phone-login-btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" hover-class="phone-btn-hover"> |
|||
<view class="btn-inner"> |
|||
<image src="/pages/images/sjh.png" mode="" /> |
|||
<text class="btn-text">手机号快捷登录</text> |
|||
</view> |
|||
</button> |
|||
|
|||
<!-- 协议确认 --> |
|||
<view class="agreement-section"> |
|||
<view class="agreement-checkbox {{isAgree ? 'checked' : ''}}" bindtap="toggleAgreement"> |
|||
<text class="checkmark" wx:if="{{isAgree}}">✓</text> |
|||
</view> |
|||
<view class="agreement-text"> |
|||
我已阅读并同意 |
|||
<view class="link" bindtap="showAgreement">《用户协议》</view> |
|||
和 |
|||
<view class="link" bindtap="showPrivacy">《隐私政策》</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 底部装饰 --> |
|||
<view class="bottom-decor"> |
|||
<view class="bottom-wave"></view> |
|||
</view> |
|||
|
|||
<!-- 协议弹窗 --> |
|||
<view class="agreement-modal" wx:if="{{showAgreementModal}}"> |
|||
<view class="modal-mask" bindtap="hideModal"></view> |
|||
<view class="modal-content"> |
|||
<view class="modal-header"> |
|||
<text class="modal-title">{{modalTitle}}</text> |
|||
<view class="modal-close" bindtap="hideModal">×</view> |
|||
</view> |
|||
<scroll-view class="modal-body" scroll-y> |
|||
<text class="modal-text">{{modalContent}}</text> |
|||
</scroll-view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 加载提示 --> |
|||
<view class="loading-mask" wx:if="{{isLoading}}"> |
|||
<view class="loading-content"> |
|||
<view class="loading-spinner"></view> |
|||
<text class="loading-text">登录中...</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,506 @@ |
|||
/* pages/login/login.wxss */ |
|||
|
|||
.login-container { |
|||
height: 100vh; |
|||
width: 100%; |
|||
position: relative; |
|||
overflow: hidden; |
|||
background: linear-gradient(180deg, #f8fafc 0%, #f0f9ff 100%); |
|||
} |
|||
|
|||
/* 波浪背景 */ |
|||
.wave-background { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 400rpx; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.wave { |
|||
position: absolute; |
|||
bottom: 0; |
|||
width: 200%; |
|||
height: 100%; |
|||
background: linear-gradient(90deg, #86D8D0 0%, #A8E6CF 100%); |
|||
border-radius: 0 0 50% 50%; |
|||
animation: waveMove 15s linear infinite; |
|||
} |
|||
|
|||
.wave-1 { |
|||
opacity: 0.7; |
|||
animation-delay: 0s; |
|||
} |
|||
|
|||
.wave-2 { |
|||
opacity: 0.5; |
|||
animation-delay: 5s; |
|||
background: linear-gradient(90deg, #7ACCC4 0%, #98D6C6 100%); |
|||
} |
|||
|
|||
.wave-3 { |
|||
opacity: 0.3; |
|||
animation-delay: 10s; |
|||
background: linear-gradient(90deg, #6EC0B8 0%, #88C6BD 100%); |
|||
} |
|||
|
|||
@keyframes waveMove { |
|||
0% { |
|||
transform: translateX(0) rotate(0deg); |
|||
} |
|||
|
|||
50% { |
|||
transform: translateX(-25%) rotate(1deg); |
|||
} |
|||
|
|||
100% { |
|||
transform: translateX(-50%) rotate(0deg); |
|||
} |
|||
} |
|||
|
|||
/* 装饰元素 */ |
|||
.decorations { |
|||
position: absolute; |
|||
width: 100%; |
|||
height: 100%; |
|||
pointer-events: none; |
|||
} |
|||
|
|||
.cloud { |
|||
position: absolute; |
|||
background-color: rgba(255, 255, 255, 0.9); |
|||
border-radius: 100rpx; |
|||
} |
|||
|
|||
.cloud-1 { |
|||
width: 120rpx; |
|||
height: 40rpx; |
|||
top: 120rpx; |
|||
left: 10%; |
|||
box-shadow: |
|||
20rpx 0 0 0 rgba(255, 255, 255, 0.9), |
|||
40rpx 0 0 0 rgba(255, 255, 255, 0.9); |
|||
} |
|||
|
|||
.cloud-2 { |
|||
width: 90rpx; |
|||
height: 30rpx; |
|||
top: 80rpx; |
|||
right: 15%; |
|||
box-shadow: |
|||
15rpx 0 0 0 rgba(255, 255, 255, 0.9), |
|||
30rpx 0 0 0 rgba(255, 255, 255, 0.9); |
|||
} |
|||
|
|||
.cloud-3 { |
|||
width: 70rpx; |
|||
height: 25rpx; |
|||
top: 180rpx; |
|||
left: 70%; |
|||
box-shadow: |
|||
12rpx 0 0 0 rgba(255, 255, 255, 0.9), |
|||
24rpx 0 0 0 rgba(255, 255, 255, 0.9); |
|||
} |
|||
|
|||
.grass { |
|||
position: absolute; |
|||
bottom: 0; |
|||
width: 8rpx; |
|||
background-color: #86D8D0; |
|||
border-radius: 4rpx 4rpx 0 0; |
|||
} |
|||
|
|||
.grass-1 { |
|||
height: 80rpx; |
|||
left: 20%; |
|||
} |
|||
|
|||
.grass-2 { |
|||
height: 60rpx; |
|||
left: 35%; |
|||
} |
|||
|
|||
.grass-3 { |
|||
height: 100rpx; |
|||
left: 50%; |
|||
} |
|||
|
|||
.grass:before, |
|||
.grass:after { |
|||
content: ''; |
|||
position: absolute; |
|||
width: 8rpx; |
|||
background-color: #86D8D0; |
|||
border-radius: 4rpx; |
|||
} |
|||
|
|||
.grass:before { |
|||
height: 40rpx; |
|||
transform: rotate(-30deg); |
|||
top: -20rpx; |
|||
left: -10rpx; |
|||
} |
|||
|
|||
.grass:after { |
|||
height: 30rpx; |
|||
transform: rotate(30deg); |
|||
top: -15rpx; |
|||
right: -10rpx; |
|||
} |
|||
|
|||
.sheep { |
|||
position: absolute; |
|||
bottom: 120rpx; |
|||
right: 20%; |
|||
width: 80rpx; |
|||
height: 50rpx; |
|||
background-color: white; |
|||
border-radius: 50%; |
|||
box-shadow: |
|||
-15rpx -10rpx 0 0 white, |
|||
15rpx -8rpx 0 0 white; |
|||
} |
|||
|
|||
.sheep:before { |
|||
content: ''; |
|||
position: absolute; |
|||
width: 20rpx; |
|||
height: 20rpx; |
|||
background-color: #333; |
|||
border-radius: 50%; |
|||
top: -5rpx; |
|||
left: 15rpx; |
|||
} |
|||
|
|||
/* 主要内容区域 */ |
|||
.main-content { |
|||
position: relative; |
|||
z-index: 10; |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
padding: 0 60rpx; |
|||
padding-top: 120rpx; |
|||
} |
|||
|
|||
/* Logo区域 */ |
|||
.logo-section { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
margin-bottom: 120rpx; |
|||
} |
|||
|
|||
.logo-container { |
|||
margin-bottom: 40rpx; |
|||
} |
|||
|
|||
.logo-circle { |
|||
width: 180rpx; |
|||
height: 180rpx; |
|||
border-radius: 50%; |
|||
background: linear-gradient(135deg, #86D8D0 0%, #6BC4BC 100%); |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
box-shadow: |
|||
0 20rpx 40rpx rgba(134, 216, 208, 0.3), |
|||
inset 0 -4rpx 8rpx rgba(107, 196, 188, 0.4), |
|||
inset 0 4rpx 8rpx rgba(255, 255, 255, 0.8); |
|||
position: relative; |
|||
} |
|||
|
|||
.logo-circle:before { |
|||
content: ''; |
|||
position: absolute; |
|||
width: 160rpx; |
|||
height: 160rpx; |
|||
border-radius: 50%; |
|||
border: 2rpx solid rgba(255, 255, 255, 0.3); |
|||
} |
|||
|
|||
.logo-inner { |
|||
width: 140rpx; |
|||
height: 140rpx; |
|||
border-radius: 50%; |
|||
background: white; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
box-shadow: |
|||
inset 0 4rpx 8rpx rgba(134, 216, 208, 0.2), |
|||
0 4rpx 8rpx rgba(0, 0, 0, 0.1); |
|||
} |
|||
|
|||
.logo-text { |
|||
font-size: 64rpx; |
|||
font-weight: bold; |
|||
color: #86D8D0; |
|||
letter-spacing: 4rpx; |
|||
} |
|||
|
|||
.app-title { |
|||
font-size: 56rpx; |
|||
font-weight: 700; |
|||
color: #333; |
|||
margin-bottom: 16rpx; |
|||
letter-spacing: 2rpx; |
|||
} |
|||
|
|||
|
|||
|
|||
/* 登录区域 */ |
|||
.login-section { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
} |
|||
|
|||
.welcome-text { |
|||
text-align: center; |
|||
margin-bottom: 80rpx; |
|||
} |
|||
|
|||
.welcome-main { |
|||
display: block; |
|||
font-size: 44rpx; |
|||
font-weight: 600; |
|||
color: #333; |
|||
margin-bottom: 16rpx; |
|||
} |
|||
|
|||
.welcome-desc { |
|||
display: block; |
|||
font-size: 28rpx; |
|||
color: #888; |
|||
font-weight: 300; |
|||
} |
|||
|
|||
/* 手机号登录按钮 */ |
|||
.phone-login-btn { |
|||
width: 100%; |
|||
height: 100rpx; |
|||
border-radius: 50rpx; |
|||
background: linear-gradient(to right, #86D8D0, #6BC4BC); |
|||
box-shadow: |
|||
0 12rpx 24rpx rgba(134, 216, 208, 0.3), |
|||
0 4rpx 12rpx rgba(0, 0, 0, 0.08); |
|||
margin-bottom: 50rpx; |
|||
transition: all 0.3s ease; |
|||
} |
|||
|
|||
.phone-btn-hover { |
|||
transform: translateY(-4rpx); |
|||
box-shadow: |
|||
0 16rpx 32rpx rgba(134, 216, 208, 0.4), |
|||
0 6rpx 16rpx rgba(0, 0, 0, 0.12); |
|||
} |
|||
|
|||
.btn-inner { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
height: 100%; |
|||
} |
|||
|
|||
.btn-inner image { |
|||
width: 45rpx; |
|||
height: 45rpx; |
|||
padding: 0 20rpx; |
|||
} |
|||
|
|||
|
|||
.btn-text { |
|||
color: white; |
|||
font-size: 34rpx; |
|||
font-weight: 500; |
|||
letter-spacing: 2rpx; |
|||
} |
|||
|
|||
/* 协议确认 */ |
|||
.agreement-section { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.agreement-checkbox { |
|||
width: 30rpx; |
|||
height: 30rpx; |
|||
border: 2rpx solid #ccc; |
|||
border-radius: 6rpx; |
|||
margin-right: 16rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
transition: all 0.2s ease; |
|||
} |
|||
|
|||
.agreement-checkbox.checked { |
|||
background-color: #86D8D0; |
|||
border-color: #86D8D0; |
|||
} |
|||
|
|||
.checkmark { |
|||
color: white; |
|||
font-size: 24rpx; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.agreement-text { |
|||
font-size: 24rpx; |
|||
color: #888; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
|
|||
.link { |
|||
color: #86D8D0; |
|||
} |
|||
|
|||
/* 底部装饰 */ |
|||
.bottom-decor { |
|||
position: absolute; |
|||
bottom: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 60rpx; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.bottom-wave { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 200%; |
|||
height: 200%; |
|||
background: linear-gradient(90deg, #86D8D0 0%, #A8E6CF 100%); |
|||
border-radius: 50% 50% 0 0; |
|||
animation: bottomWave 20s linear infinite; |
|||
} |
|||
|
|||
@keyframes bottomWave { |
|||
0% { |
|||
transform: translateX(0) rotate(0deg); |
|||
} |
|||
|
|||
50% { |
|||
transform: translateX(-25%) rotate(0.5deg); |
|||
} |
|||
|
|||
100% { |
|||
transform: translateX(-50%) rotate(0deg); |
|||
} |
|||
} |
|||
|
|||
/* 协议弹窗 */ |
|||
.agreement-modal { |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
z-index: 1000; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.modal-mask { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: rgba(0, 0, 0, 0.5); |
|||
} |
|||
|
|||
.modal-content { |
|||
position: relative; |
|||
width: 85%; |
|||
max-height: 80%; |
|||
background-color: white; |
|||
border-radius: 24rpx; |
|||
overflow: hidden; |
|||
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15); |
|||
} |
|||
|
|||
.modal-header { |
|||
padding: 40rpx; |
|||
border-bottom: 1rpx solid #f0f0f0; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
} |
|||
|
|||
.modal-title { |
|||
font-size: 36rpx; |
|||
font-weight: 600; |
|||
color: #333; |
|||
} |
|||
|
|||
.modal-close { |
|||
font-size: 48rpx; |
|||
color: #999; |
|||
line-height: 1; |
|||
} |
|||
|
|||
.modal-body { |
|||
max-height: 600rpx; |
|||
padding: 20rpx; |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
.modal-text { |
|||
font-size: 28rpx; |
|||
color: #666; |
|||
line-height: 1.8; |
|||
padding: 20rpx 0; |
|||
} |
|||
|
|||
/* 加载提示 */ |
|||
.loading-mask { |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: rgba(0, 0, 0, 0.5); |
|||
z-index: 1001; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.loading-content { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
} |
|||
|
|||
.loading-spinner { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
border: 6rpx solid rgba(134, 216, 208, 0.2); |
|||
border-top-color: #86D8D0; |
|||
border-radius: 50%; |
|||
animation: loadingSpin 1s linear infinite; |
|||
margin-bottom: 30rpx; |
|||
} |
|||
|
|||
@keyframes loadingSpin { |
|||
0% { |
|||
transform: rotate(0deg); |
|||
} |
|||
|
|||
100% { |
|||
transform: rotate(360deg); |
|||
} |
|||
} |
|||
|
|||
.loading-text { |
|||
font-size: 28rpx; |
|||
color: #fff; |
|||
font-weight: 300; |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
// pages/message/message.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pages/message/message.wxml--> |
|||
<text>pages/message/message.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pages/message/message.wxss */ |
|||
@ -0,0 +1,66 @@ |
|||
// pages/personal/personal.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pages/personal/personal.wxml--> |
|||
<text>pages/personal/personal.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pages/personal/personal.wxss */ |
|||
@ -0,0 +1,66 @@ |
|||
// pagesA/pages/askingSy/askingSy.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pagesA/pages/askingSy/askingSy.wxml--> |
|||
<text>pagesA/pages/askingSy/askingSy.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pagesA/pages/askingSy/askingSy.wxss */ |
|||
@ -0,0 +1,66 @@ |
|||
// pagesB/pages/repository/repository.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pagesB/pages/repository/repository.wxml--> |
|||
<text>pagesB/pages/repository/repository.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pagesB/pages/repository/repository.wxss */ |
|||
@ -0,0 +1,41 @@ |
|||
{ |
|||
"appid": "wxf03bf1d9f08c05f0", |
|||
"compileType": "miniprogram", |
|||
"libVersion": "3.14.2", |
|||
"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 |
|||
}, |
|||
"simulatorPluginLibVersion": {} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
{ |
|||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", |
|||
"projectname": "wxamp-ymtxMerchant", |
|||
"setting": { |
|||
"compileHotReLoad": true, |
|||
"skylineRenderEnable": true, |
|||
"urlCheck": true, |
|||
"coverView": true, |
|||
"lazyloadPlaceholderEnable": 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.14.2", |
|||
"condition": {} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", |
|||
"rules": [{ |
|||
"action": "allow", |
|||
"page": "*" |
|||
}] |
|||
} |
|||
@ -0,0 +1,242 @@ |
|||
//在这里面定义所有接口,一个文件管理所有接口,易于维护
|
|||
import { http } from './http'; // 引入刚刚封装好的http模块,import属于ES6的语法,微信开发者工具必须打开ES6转ES5选项
|
|||
|
|||
// 授权登录接口
|
|||
function login(params) { |
|||
http('/auth/wechat/login', 'post', params) |
|||
} |
|||
|
|||
// 获取手机号接口
|
|||
function getPhoneNumber(params) { |
|||
http('/auth/wechat/bind', 'post', params) |
|||
} |
|||
|
|||
// 轮播
|
|||
function carousel(params) { |
|||
http('/muhu/ads/list', 'get', params) |
|||
} |
|||
|
|||
// 轮播详情
|
|||
function carouselDetail(params) { |
|||
http('/muhu/ads/' + params.data.id, 'get', params) |
|||
} |
|||
|
|||
// 通知公告
|
|||
function disaster(params) { |
|||
http('/muhu/warning/list', 'get', params) |
|||
} |
|||
|
|||
// 通知公告详情
|
|||
function disasterDetail(params) { |
|||
http('/muhu/warning/' + params.data.id, 'get', params) |
|||
} |
|||
|
|||
// 地图导航药店诊所
|
|||
function pharmacy(params) { |
|||
http('/muhu/info/list', 'get', params) |
|||
} |
|||
|
|||
// 办事指南
|
|||
function guidance(params) { |
|||
http('/muhu/guide/list', 'get', params) |
|||
} |
|||
|
|||
// AI问诊快捷词列表
|
|||
function inquiry(params) { |
|||
http('/system/base/list', 'get', params) |
|||
} |
|||
|
|||
// AI问诊模糊搜索
|
|||
function search(params) { |
|||
http('/system/base/search', 'get', params) |
|||
} |
|||
|
|||
// 销售市场
|
|||
function sales(params) { |
|||
http('/muhu/sales/list', 'get', params) |
|||
} |
|||
|
|||
// 饲料市场
|
|||
function feed(params) { |
|||
http('/muhu/feed/list', 'get', params) |
|||
} |
|||
|
|||
// 市场趋势
|
|||
function trend(params) { |
|||
http('/muhu/trend/list', 'get', params) |
|||
} |
|||
|
|||
// 问兽医-问诊单列表
|
|||
function wzd(params) { |
|||
http('/muhu/consultation/list', 'get', params) |
|||
} |
|||
|
|||
// 问兽医-问诊单新增
|
|||
function wzdAdd(params) { |
|||
http('/muhu/consultation', 'post', params) |
|||
} |
|||
|
|||
// 问兽医-兽医回复详情
|
|||
function wzdxq(params) { |
|||
http('/vet/comments/list', 'get', params) |
|||
} |
|||
|
|||
// 专家列表
|
|||
function expertsList(params) { |
|||
http('/vet/experts/list', 'get', params) |
|||
} |
|||
|
|||
// 药品推荐列表
|
|||
function recommendationList(params) { |
|||
http('/system/recommendation/list', 'get', params) |
|||
} |
|||
|
|||
// 药品推荐详情
|
|||
function recommendationXq(params) { |
|||
http('/system/recommendation/'+ params.data.id , 'get', params) |
|||
} |
|||
|
|||
// 知识库查询列表
|
|||
function queryList(params) { |
|||
http('/system/query/list', 'get', params) |
|||
} |
|||
|
|||
// 知识库查询提示
|
|||
function tipList(params) { |
|||
http('/system/tip/list', 'get', params) |
|||
} |
|||
|
|||
// 在线培训文章发布
|
|||
function article(params) { |
|||
http('/vet/knowledge/published/list', 'get', params) |
|||
} |
|||
|
|||
// 文章分类字典
|
|||
function articleZd(params) { |
|||
http('/system/dict/data/list', 'get', params) |
|||
} |
|||
|
|||
// 在线培训文章发布详情
|
|||
function articleDetails(params) { |
|||
http('/vet/knowledge/published/' + params.data.id, 'get', params) |
|||
} |
|||
|
|||
// 政策解读列表
|
|||
function policyelucidation(params) { |
|||
http('/system/interpretation/published/list', 'get', params) |
|||
} |
|||
|
|||
// 政策解读详情
|
|||
function policyeDetails(params) { |
|||
http('/system/interpretation/published/' + params.data.id, 'get', params) |
|||
} |
|||
|
|||
// 政策解读类型字典
|
|||
function policyeZd(params) { |
|||
http('/system/dict/data/list', 'get', params) |
|||
} |
|||
|
|||
// 行政区划
|
|||
function areaChildren(params) { |
|||
http('/muhu/user/areaChildren', 'get', params) |
|||
} |
|||
|
|||
// 提交行政区划信息
|
|||
function userCode(params) { |
|||
http('/muhu/user/saveUserAreaCode/' + params.data.areaCode, 'put', params) |
|||
} |
|||
|
|||
// 查询用户信息
|
|||
function UserInfo(params) { |
|||
http('/muhu/user/getUserInfo', 'get', params) |
|||
} |
|||
|
|||
// 视频列表
|
|||
function videoList(params) { |
|||
http('/vet/training/public/list', 'get', params) |
|||
} |
|||
|
|||
// 视频详情
|
|||
function videoDetails(params) { |
|||
http('/vet/training/public/'+params.data.id, 'get', params) |
|||
} |
|||
|
|||
// 视频字典
|
|||
function videoZd(params) { |
|||
http('/system/dict/data/list', 'get', params) |
|||
} |
|||
|
|||
//在线问答列表
|
|||
function forumList(params) { |
|||
http('/system/questions/list', 'get', params) |
|||
} |
|||
|
|||
//在线问答详情
|
|||
function forumDetails(params) { |
|||
http('/system/questions/'+params.data.id, 'get', params) |
|||
} |
|||
|
|||
//在线问答新增帖子
|
|||
function forumAdd(params) { |
|||
http('/system/questions', 'post', params) |
|||
} |
|||
|
|||
//在线问答详情回复
|
|||
function forumReply(params) { |
|||
http('/system/answers/list', 'get', params) |
|||
} |
|||
|
|||
//新增回复
|
|||
function commentReply(params) { |
|||
http('/system/answers', 'post', params) |
|||
} |
|||
|
|||
// 经验分享列表
|
|||
function experience(params) { |
|||
http('/vet/article/list', 'get', params) |
|||
} |
|||
|
|||
// 经验分享详情
|
|||
function experienceDetails(params) { |
|||
http('/vet/article/' + params.data.id, 'get', params) |
|||
} |
|||
|
|||
// 经验分享分类字典
|
|||
function experiencezd(params) { |
|||
http('/vet/article/options', 'get', params) |
|||
} |
|||
|
|||
// 实名认证
|
|||
function realName(params) { |
|||
http('/muhu/user/auth/submit', 'post', params) |
|||
} |
|||
|
|||
// 上传修改头像
|
|||
function revise(params) { |
|||
http('/muhu/user', 'put', params) |
|||
} |
|||
|
|||
// 个人中心反馈建议
|
|||
function feedback(params) { |
|||
http('/muhu/feedback', 'post', params) |
|||
} |
|||
|
|||
// 预警类型
|
|||
function warningType(params) { |
|||
http('/system/dict/data/list', 'get', params) |
|||
} |
|||
|
|||
// 个人中心今日问诊
|
|||
function today(params) { |
|||
http('/muhu/consultation/today', 'get', params) |
|||
} |
|||
|
|||
|
|||
export default { // 暴露接口
|
|||
login,carousel,disaster,pharmacy,guidance,getPhoneNumber,inquiry,policyeDetails, |
|||
search,trend,feed,sales,wzd,wzdxq,wzdAdd,expertsList,recommendationList,policyeZd, |
|||
recommendationXq,queryList,tipList,article,articleDetails,articleZd,policyelucidation, |
|||
areaChildren,userCode,UserInfo,videoList,videoZd,videoDetails,forumList,forumAdd,forumDetails, |
|||
forumReply,commentReply,experience,experiencezd,experienceDetails,realName,revise,feedback, |
|||
warningType,disasterDetail,today,carouselDetail |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
// var baseUrl = 'https://wx.chenhaitech.com/ymtx-prod-api'
|
|||
var baseUrl = 'http://192.168.101.109:8080' |
|||
// var baseUrl = 'http://192.168.101.105:8082'
|
|||
// var baseUrl = 'http://192.168.101.111:8081'
|
|||
module.exports = baseUrl |
|||
@ -0,0 +1,8 @@ |
|||
|
|||
@font-face { |
|||
font-family: "思源宋体 Light" !important; |
|||
font-weight: 300; |
|||
src: url("/pages/images/EZSx3exf4cjI.woff2") format("woff2"), |
|||
url("/pages/images/EZSx3exf4cjI.woff") format("woff"); |
|||
font-display: swap; |
|||
} |
|||
@ -0,0 +1,102 @@ |
|||
var baseUrl = require('../utils/baseUrl') |
|||
var ajaxtimes = 0 |
|||
var isShowingTokenExpiredModal = false // 新增:标记是否正在显示token过期弹窗
|
|||
|
|||
module.exports = { |
|||
http(url, method, params) { |
|||
//发送一次请求就加1
|
|||
ajaxtimes++ |
|||
let token = 'token' // 获取token,自行获取token和签名,token和签名表示每个接口都要发送的数据
|
|||
let sign = 'sign' // 获取签名 (后台怎么定义的,就传什么)
|
|||
let data = { |
|||
token, |
|||
sign |
|||
} |
|||
|
|||
wx.showLoading({ |
|||
title: '加载中...', |
|||
}) |
|||
|
|||
let urls = baseUrl + url |
|||
if (params.data) { // 在这里判断一下data是否存在,params表示前端需要传递的数据,params是一个对象,有三组键值对,data:表示请求要发送的数据,success:成功的回调,fail:失败的回调,这三个字段可缺可无,其余字段会忽略
|
|||
for (let key in params.data) { // 在这里判断传过来的参数值为null,就删除这个属性
|
|||
if (params.data[key] == null || params.data[key] == 'null') { |
|||
delete params.data[key] |
|||
} |
|||
} |
|||
data = { |
|||
...data, |
|||
...params.data |
|||
} |
|||
} |
|||
|
|||
if (params.id) { |
|||
urls = urls + '/' + params.id |
|||
} |
|||
// console.log(urls);
|
|||
var value = null |
|||
try { |
|||
value = wx.getStorageSync('token') |
|||
if (value) { |
|||
// console.log(value);
|
|||
} |
|||
} catch (e) { |
|||
// Do something when catch error
|
|||
} |
|||
wx.request({ |
|||
url: urls, // 就是拼接上前缀,此接口域名是开放接口,可访问
|
|||
method: method, // 判断请求类型,除了值等于'post'外,其余值均视作get 其他的请求类型也可以自己加上的 method: method == 'post' ? 'post' : 'get'
|
|||
data, |
|||
header: { |
|||
'content-type': 'application/json', |
|||
'Authorization':'Bearer '+ value |
|||
}, |
|||
success(res) { |
|||
// console.log(res);
|
|||
if(res.data.code == 401){ |
|||
// 只在没有显示弹窗时才显示
|
|||
if (!isShowingTokenExpiredModal) { |
|||
isShowingTokenExpiredModal = true |
|||
wx.showModal({ |
|||
title: '提示', |
|||
content: '登录已过期,请重新登录', |
|||
success (res) { |
|||
if (res.confirm) { |
|||
// 重置标记
|
|||
isShowingTokenExpiredModal = false |
|||
wx.reLaunch({ |
|||
url: '/pages/login/login', |
|||
}) |
|||
} else if (res.cancel) { |
|||
// 重置标记
|
|||
isShowingTokenExpiredModal = false |
|||
} |
|||
}, |
|||
// 确保在模态框关闭时重置标记
|
|||
complete: function() { |
|||
// 如果success回调没有执行(例如直接点击蒙层关闭),在这里重置标记
|
|||
setTimeout(() => { |
|||
isShowingTokenExpiredModal = false |
|||
}, 300) |
|||
} |
|||
}) |
|||
} |
|||
// 401错误时,不调用params.success,直接返回
|
|||
return |
|||
} else { |
|||
params.success && params.success(res.data) |
|||
} |
|||
}, |
|||
fail(err) { |
|||
params.fail && params.fail(err) |
|||
}, |
|||
complete(){ |
|||
//完成一次请求就减一
|
|||
ajaxtimes--; |
|||
if(ajaxtimes===0){ |
|||
wx.hideLoading() |
|||
} |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
// 通知 |
|||
function type(name) { |
|||
if(name=='紧急'){ |
|||
return 'urgent' |
|||
}else if(name=='重要'){ |
|||
return 'important' |
|||
}else{ |
|||
return 'normal' |
|||
} |
|||
} |
|||
|
|||
// 严重程度区分 |
|||
function ztLevel(type) { |
|||
if(type=='轻度'){ |
|||
return 'low' |
|||
}else if(type=='中度'){ |
|||
return 'moderate' |
|||
}else{ |
|||
return 'high' |
|||
} |
|||
} |
|||
|
|||
// 药品标签 |
|||
function medicineType(type) { |
|||
if(type=='处方药'){ |
|||
return 'prescription' |
|||
}else if(type=='非处方药'){ |
|||
return 'otc' |
|||
}else if(type=='中成药'){ |
|||
return 'chinese' |
|||
}else{ |
|||
return 'health' |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
module.exports = { |
|||
type:type, |
|||
ztLevel:ztLevel, |
|||
medicineType:medicineType |
|||
} |
|||
@ -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 |
|||
} |
|||