-
8.idea/.gitignore
-
6.idea/encodings.xml
-
6.idea/misc.xml
-
8.idea/modules.xml
-
6.idea/vcs.xml
-
9.idea/wxamp-ymtxUser.iml
-
19app.js
-
83app.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
-
252pages/home/home.js
-
8pages/home/home.json
-
133pages/home/home.wxml
-
518pages/home/home.wxss
-
BINpages/images/banner1.png
-
BINpages/images/banner2.png
-
BINpages/images/banner3.png
-
BINpages/images/banner4.png
-
BINpages/images/dh.png
-
BINpages/images/dh1.png
-
BINpages/images/dw.png
-
BINpages/images/home.png
-
BINpages/images/home1.png
-
BINpages/images/tx.png
-
BINpages/images/wd.png
-
BINpages/images/wd1.png
-
BINpages/images/xx.png
-
BINpages/images/xx1.png
-
52pages/index/index.js
-
5pages/index/index.json
-
28pages/index/index.wxml
-
63pages/index/index.wxss
-
20pages/logs/logs.js
-
5pages/logs/logs.json
-
7pages/logs/logs.wxml
-
16pages/logs/logs.wxss
-
120pages/map/map.js
-
4pages/map/map.json
-
32pages/map/map.wxml
-
157pages/map/map.wxss
-
66pages/news/news.js
-
4pages/news/news.json
-
2pages/news/news.wxml
-
1pages/news/news.wxss
-
66pages/personal/personal.js
-
4pages/personal/personal.json
-
2pages/personal/personal.wxml
-
1pages/personal/personal.wxss
-
66pagesA/pages/socialWork/socialWork.js
-
3pagesA/pages/socialWork/socialWork.json
-
2pagesA/pages/socialWork/socialWork.wxml
-
1pagesA/pages/socialWork/socialWork.wxss
-
66pagesB/pages/apple/apple.js
-
3pagesB/pages/apple/apple.json
-
2pagesB/pages/apple/apple.wxml
-
1pagesB/pages/apple/apple.wxss
-
41project.config.json
-
24project.private.config.json
-
7sitemap.json
-
13utils/api.js
-
4utils/baseUrl.js
-
8utils/font.wxss
-
85utils/http.js
-
18utils/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-ymtxUser.iml" filepath="$PROJECT_DIR$/.idea/wxamp-ymtxUser.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,83 @@ |
|||
{ |
|||
"pages": [ |
|||
"pages/home/home", |
|||
"pages/news/news", |
|||
"pages/map/map", |
|||
"pages/personal/personal" |
|||
], |
|||
"subPackages": [ |
|||
{ |
|||
"root": "pagesA", |
|||
"pages": [ |
|||
"pages/socialWork/socialWork" |
|||
] |
|||
}, |
|||
{ |
|||
"root": "pagesB", |
|||
"pages": [ |
|||
"pages/apple/apple" |
|||
], |
|||
"independent": true |
|||
} |
|||
], |
|||
"window": { |
|||
"navigationBarBackgroundColor": "#86D8D0", |
|||
"navigationBarTextStyle": "white" |
|||
}, |
|||
"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/news/news", |
|||
"text": "消息", |
|||
"iconPath": "pages/images/xx.png", |
|||
"selectedIconPath": "pages/images/xx1.png" |
|||
}, |
|||
{ |
|||
"pagePath": "pages/map/map", |
|||
"text": "导航", |
|||
"iconPath": "pages/images/dh.png", |
|||
"selectedIconPath": "pages/images/dh1.png" |
|||
}, |
|||
{ |
|||
"pagePath": "pages/personal/personal", |
|||
"text": "我的", |
|||
"iconPath": "pages/images/wd.png", |
|||
"selectedIconPath": "pages/images/wd1.png" |
|||
} |
|||
] |
|||
}, |
|||
"requiredPrivateInfos": [ |
|||
"getLocation", |
|||
"chooseAddress", |
|||
"chooseLocation", |
|||
"startLocationUpdateBackground" |
|||
], |
|||
"permission": { |
|||
"scope.userLocation": { |
|||
"desc": "你的位置信息将用于小程序位置接口的效果展示" |
|||
} |
|||
}, |
|||
"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,252 @@ |
|||
Page({ |
|||
data: { |
|||
// 轮播图数据
|
|||
currentSwiper: 0, |
|||
swiperList: [{ |
|||
id: 1, |
|||
image: '/pages/images/banner1.png', |
|||
tag: '疫病防治', |
|||
title: '春季牛羊常见病预防指南', |
|||
desc: '专业兽医教你科学预防', |
|||
isActive: false |
|||
}, |
|||
{ |
|||
id: 2, |
|||
image: '/pages/images/banner2.png', |
|||
tag: '专家直播', |
|||
title: '畜牧养殖新技术分享会', |
|||
desc: '今晚8点准时开播', |
|||
isActive: false |
|||
}, |
|||
{ |
|||
id: 3, |
|||
image: '/pages/images/banner3.png', |
|||
tag: '市场动态', |
|||
title: '最新牛羊肉价格行情', |
|||
desc: '实时掌握市场变化', |
|||
isActive: false |
|||
}, |
|||
{ |
|||
id: 4, |
|||
image: '/pages/images/banner4.png', |
|||
tag: '在线问诊', |
|||
title: 'AI智能诊断上线', |
|||
desc: '24小时在线解答', |
|||
isActive: false |
|||
} |
|||
], |
|||
|
|||
// 通知公告数据
|
|||
currentNotice: 0, |
|||
noticeList: [{ |
|||
id: 1, |
|||
type: 'urgent', |
|||
typeName: '紧急', |
|||
content: '关于春季动物疫病防控的重要通知,请各位牧民及时查看并做好预防工作', |
|||
time: '03-15 14:30' |
|||
}, |
|||
{ |
|||
id: 2, |
|||
type: 'important', |
|||
typeName: '重要', |
|||
content: '兽药购买资质审核流程更新,请相关商家及时上传最新资质文件', |
|||
time: '03-14 09:15' |
|||
}, |
|||
{ |
|||
id: 3, |
|||
type: 'normal', |
|||
typeName: '通知', |
|||
content: '平台将于3月20日进行系统升级,升级期间部分功能可能无法正常使用', |
|||
time: '03-13 16:45' |
|||
} |
|||
], |
|||
}, |
|||
|
|||
|
|||
//获取当前位置信息
|
|||
getLocation() { |
|||
let that = this; |
|||
// 腾讯获取的密钥
|
|||
let key = 'AOBBZ-6LUK7-WXGXX-HJUXS-HHUM5-FWFPJ' |
|||
wx.getLocation({ |
|||
isHighAccuracy: true, |
|||
type: 'gcj02', |
|||
success: function (res) { |
|||
console.log(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 => { |
|||
console.log(res); |
|||
that.setData({ |
|||
county: res.data.result.address_component.district //城市
|
|||
}); |
|||
|
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
onLoad() { |
|||
// 初始化数据
|
|||
this.initSwiperActiveState(); |
|||
this.getLocation() |
|||
}, |
|||
|
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
|
|||
|
|||
// 初始化轮播图激活状态
|
|||
initSwiperActiveState() { |
|||
const swiperList = this.data.swiperList.map((item, index) => ({ |
|||
...item, |
|||
isActive: index === this.data.currentSwiper |
|||
})); |
|||
this.setData({ |
|||
swiperList |
|||
}); |
|||
}, |
|||
|
|||
// 轮播图变化事件
|
|||
onSwiperChange(e) { |
|||
const current = e.detail.current; |
|||
const swiperList = this.data.swiperList.map((item, index) => ({ |
|||
...item, |
|||
isActive: index === current |
|||
})); |
|||
|
|||
this.setData({ |
|||
currentSwiper: current, |
|||
swiperList |
|||
}); |
|||
}, |
|||
|
|||
// 轮播图指示器点击
|
|||
onIndicatorTap(e) { |
|||
const index = e.currentTarget.dataset.index; |
|||
this.setData({ |
|||
currentSwiper: index |
|||
}); |
|||
}, |
|||
|
|||
// 轮播图点击
|
|||
onSwiperTap(e) { |
|||
const id = e.currentTarget.dataset.id; |
|||
const item = this.data.swiperList.find(item => item.id === id); |
|||
|
|||
if (!item) return; |
|||
|
|||
console.log('轮播图点击:', item); |
|||
|
|||
wx.showToast({ |
|||
title: `进入${item.tag}`, |
|||
icon: 'none', |
|||
duration: 1000 |
|||
}); |
|||
|
|||
// 根据不同类型跳转不同页面
|
|||
switch (id) { |
|||
case 1: |
|||
wx.navigateTo({ |
|||
url: '/pages/knowledge/detail?id=' + id |
|||
}); |
|||
break; |
|||
case 2: |
|||
wx.navigateTo({ |
|||
url: '/pages/live/detail?id=' + id |
|||
}); |
|||
break; |
|||
case 3: |
|||
wx.navigateTo({ |
|||
url: '/pages/market/detail?id=' + id |
|||
}); |
|||
break; |
|||
case 4: |
|||
wx.navigateTo({ |
|||
url: '/pages/consult/ai' |
|||
}); |
|||
break; |
|||
default: |
|||
// 默认跳转到详情页
|
|||
wx.navigateTo({ |
|||
url: '/pages/detail/index?id=' + id |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
|
|||
// 通知点击 - 使用catchtap防止事件冒泡
|
|||
onNoticeTap(e) { |
|||
const id = e.currentTarget.dataset.id; |
|||
console.log('通知点击:', id); |
|||
|
|||
// 显示当前点击的通知内容
|
|||
const notice = this.data.noticeList.find(item => item.id === id); |
|||
if (notice) { |
|||
wx.showModal({ |
|||
title: notice.typeName, |
|||
content: notice.content, |
|||
showCancel: true, |
|||
cancelText: '关闭', |
|||
confirmText: '查看详情', |
|||
success: (res) => { |
|||
if (res.confirm) { |
|||
wx.navigateTo({ |
|||
url: '/pages/notice/detail?id=' + id |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
// 更多通知
|
|||
gotoNotices() { |
|||
wx.navigateTo({ |
|||
url: '' |
|||
}); |
|||
}, |
|||
|
|||
|
|||
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() |
|||
setTimeout(function () { |
|||
wx.showToast({ |
|||
title: '刷新成功', |
|||
icon: 'none', |
|||
duration: 1000 |
|||
}) |
|||
wx.hideNavigationBarLoading() |
|||
wx.stopPullDownRefresh() |
|||
}, 1000) |
|||
}, |
|||
|
|||
// 页面滚动
|
|||
onPageScroll(e) { |
|||
|
|||
} |
|||
}); |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"navigationBarTitleText":"与牧同行", |
|||
"enablePullDownRefresh": true, |
|||
"backgroundTextStyle": "dark", |
|||
"usingComponents": { |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,133 @@ |
|||
<view class="home-container"> |
|||
|
|||
<view class="box"> |
|||
<!-- 定位 --> |
|||
<view class="orientation"> |
|||
<image src="/pages/images/dw.png" mode="" /> |
|||
<view>{{county}}</view> |
|||
</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-id="{{item.id}}" catchtap="onSwiperTap"> |
|||
<image src="{{item.image}}" class="swiper-image" mode="aspectFill" /> |
|||
<view class="swiper-mask"></view> |
|||
<view class="swiper-content"> |
|||
<text class="swiper-tag">{{item.tag}}</text> |
|||
<text class="swiper-title">{{item.title}}</text> |
|||
<text class="swiper-desc">{{item.desc}}</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="card"> |
|||
<view class="card2"> |
|||
<view>问兽医</view> |
|||
<view class="card2_1">智能匹配医生</view> |
|||
<view class="card2_1">平均5分钟恢复</view> |
|||
</view> |
|||
<view class="card3"> |
|||
<view class="card3_1 card3_kp"> |
|||
<view>找专家</view> |
|||
<view>智能匹配医生</view> |
|||
</view> |
|||
<view class="card3_2 card3_kp"> |
|||
<view>去买药</view> |
|||
<view>制定专业的治疗方案</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 知识库 --> |
|||
<view class="repository"> |
|||
<view class="repository1_1 zsk"> |
|||
<view>养殖知识库</view> |
|||
<view>快速查询养殖知识</view> |
|||
</view> |
|||
<view class="repository1_2 zsk"> |
|||
<view>在线培训</view> |
|||
<view>提高养殖技能</view> |
|||
</view> |
|||
<view class="repository1_3 zsk"> |
|||
<view>政策解读</view> |
|||
<view>提供政策指导</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 通知公告区域 --> |
|||
<view class="notice-section"> |
|||
<view class="notice-content"> |
|||
<swiper class="notice-swiper" vertical="{{true}}" autoplay="{{true}}" interval="4000" duration="800" circular="{{true}}" style="height: 200rpx;"> |
|||
<block wx:for="{{noticeList}}" wx:key="id"> |
|||
<swiper-item> |
|||
<view class="notice-item {{index === currentNotice ? 'highlight' : ''}}" data-id="{{item.id}}" catchtap="onNoticeTap"> |
|||
<view class="notice-item-header"> |
|||
<text class="notice-type {{item.type}}">{{item.typeName}}</text> |
|||
<text class="notice-time">{{item.time}}</text> |
|||
</view> |
|||
<text class="notice-text">{{item.content}}</text> |
|||
<view class="notice-arrow"> |
|||
<image src="/pages/images/dw.png"></image> |
|||
</view> |
|||
</view> |
|||
</swiper-item> |
|||
</block> |
|||
</swiper> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 用户提问板块 --> |
|||
<view class="user-question-section"> |
|||
<!-- 标题区域 --> |
|||
<view class="question-header"> |
|||
<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"> |
|||
<view class="question-meta"> |
|||
<view class="question-tag"> |
|||
<text class="tag-icon">【羊】</text> |
|||
<text class="tag-text">发烧、流鼻涕、越来越瘦是什么原因?应该怎么治疗?</text> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="question-info"> |
|||
<view class="user-info"> |
|||
<image src="/pages/images/tx.png" class="user-avatar"></image> |
|||
<view class="user-detail"> |
|||
<view class="user-name">内蒙古养殖户</view> |
|||
<view class="user-location"> |
|||
<text>内蒙古阿拉善左旗</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="time-info"> |
|||
2025-12-25 |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,518 @@ |
|||
/* 页面容器 */ |
|||
.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; |
|||
} |
|||
|
|||
/* 定位 */ |
|||
.orientation { |
|||
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; |
|||
} |
|||
|
|||
/* 轮播图区域 */ |
|||
.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: 30rpx; |
|||
background: #96DBD4; |
|||
border-radius: 6rpx; |
|||
} |
|||
|
|||
/* 卡片类型 */ |
|||
.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; |
|||
} |
|||
|
|||
/* 知识库 */ |
|||
.repository { |
|||
width: 100%; |
|||
display: grid; |
|||
grid-template-columns: 1fr 1fr 1fr; |
|||
column-gap: 20rpx; |
|||
} |
|||
|
|||
.repository>view { |
|||
padding: 20rpx 0 20rpx 20rpx; |
|||
border-radius: 20rpx; |
|||
} |
|||
|
|||
.zsk view:first-child { |
|||
color: #fff; |
|||
margin-bottom: 5rpx; |
|||
} |
|||
|
|||
.zsk view:last-child { |
|||
background-color: #fff; |
|||
font-size: 22rpx; |
|||
display: inline-block; |
|||
padding: 0 10rpx; |
|||
} |
|||
|
|||
.repository1_1 { |
|||
background-color: #6CAB86; |
|||
} |
|||
|
|||
.repository1_2 { |
|||
background-color: #017D77; |
|||
} |
|||
|
|||
.repository1_3 { |
|||
background-color: #FD8140; |
|||
} |
|||
|
|||
/* 通知公告区域 */ |
|||
.notice-section { |
|||
background: #FFFFFF; |
|||
border-radius: 20rpx; |
|||
padding: 20rpx 20rpx 0; |
|||
margin: 20rpx 0; |
|||
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.05); |
|||
animation: fadeIn 0.6s ease-out 0.6s both; |
|||
} |
|||
|
|||
@keyframes fadeIn { |
|||
from { |
|||
opacity: 0; |
|||
} |
|||
to { |
|||
opacity: 1; |
|||
} |
|||
} |
|||
|
|||
.notice-content { |
|||
position: relative; |
|||
} |
|||
|
|||
.notice-swiper { |
|||
height: 200rpx; |
|||
} |
|||
|
|||
.notice-item { |
|||
padding: 20rpx 0; |
|||
transition: all 0.3s ease; |
|||
display: flex; |
|||
flex-direction: column; |
|||
position: relative; |
|||
} |
|||
|
|||
.notice-item.highlight { |
|||
background: rgba(76, 175, 80, 0.05); |
|||
border-radius: 12rpx; |
|||
padding: 20rpx; |
|||
margin: -10rpx -10rpx 0; |
|||
} |
|||
|
|||
.notice-item-header { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
margin-bottom: 16rpx; |
|||
} |
|||
|
|||
.notice-type { |
|||
padding: 4rpx 16rpx; |
|||
border-radius: 20rpx; |
|||
font-size: 22rpx; |
|||
font-weight: 500; |
|||
} |
|||
|
|||
.notice-type.urgent { |
|||
background: rgba(244, 67, 54, 0.1); |
|||
color: #F44336; |
|||
} |
|||
|
|||
.notice-type.important { |
|||
background: rgba(255, 152, 0, 0.1); |
|||
color: #FF9800; |
|||
} |
|||
|
|||
.notice-type.normal { |
|||
background: rgba(33, 150, 243, 0.1); |
|||
color: #2196F3; |
|||
} |
|||
|
|||
.notice-time { |
|||
font-size: 22rpx; |
|||
color: #999999; |
|||
} |
|||
|
|||
.notice-text { |
|||
font-size: 28rpx; |
|||
color: #333333; |
|||
line-height: 1.5; |
|||
flex: 1; |
|||
display: -webkit-box; |
|||
-webkit-box-orient: vertical; |
|||
-webkit-line-clamp: 2; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
/* 用户提问板块 - 优化样式 */ |
|||
.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: #333; |
|||
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-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); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/* 问题元信息 */ |
|||
.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-icon { |
|||
font-size: 28rpx; |
|||
font-weight: bold; |
|||
color: #60C0B9; |
|||
background: rgba(96, 192, 185, 0.1); |
|||
padding: 6rpx 16rpx; |
|||
border-radius: 12rpx; |
|||
flex-shrink: 0; |
|||
line-height: 1.4; |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
|
|||
.user-location { |
|||
display: flex; |
|||
align-items: center; |
|||
gap: 6rpx; |
|||
} |
|||
|
|||
.user-location text { |
|||
font-size: 22rpx; |
|||
color: #999; |
|||
} |
|||
|
|||
.time-info { |
|||
font-size: 22rpx; |
|||
color: #999; |
|||
background: rgba(0, 0, 0, 0.04); |
|||
padding: 6rpx 16rpx; |
|||
border-radius: 16rpx; |
|||
} |
|||
|
After Width: 1920 | Height: 1232 | Size: 2.1 MiB |
|
After Width: 431 | Height: 232 | Size: 175 KiB |
|
After Width: 600 | Height: 394 | Size: 37 KiB |
|
After Width: 300 | Height: 200 | Size: 21 KiB |
|
After Width: 222 | Height: 200 | Size: 4.1 KiB |
|
After Width: 222 | Height: 200 | Size: 4.2 KiB |
|
After Width: 200 | Height: 200 | Size: 3.1 KiB |
|
After Width: 70 | Height: 64 | Size: 982 B |
|
After Width: 218 | Height: 200 | Size: 3.5 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: 5.2 KiB |
|
After Width: 200 | Height: 200 | Size: 5.4 KiB |
@ -0,0 +1,52 @@ |
|||
// index.js
|
|||
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' |
|||
|
|||
Component({ |
|||
data: { |
|||
motto: 'Hello World', |
|||
userInfo: { |
|||
avatarUrl: defaultAvatarUrl, |
|||
nickName: '', |
|||
}, |
|||
hasUserInfo: false, |
|||
canIUseGetUserProfile: wx.canIUse('getUserProfile'), |
|||
canIUseNicknameComp: wx.canIUse('input.type.nickname'), |
|||
}, |
|||
methods: { |
|||
// 事件处理函数
|
|||
bindViewTap() { |
|||
wx.navigateTo({ |
|||
url: '../logs/logs' |
|||
}) |
|||
}, |
|||
onChooseAvatar(e) { |
|||
const { avatarUrl } = e.detail |
|||
const { nickName } = this.data.userInfo |
|||
this.setData({ |
|||
"userInfo.avatarUrl": avatarUrl, |
|||
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl, |
|||
}) |
|||
}, |
|||
onInputChange(e) { |
|||
const nickName = e.detail.value |
|||
const { avatarUrl } = this.data.userInfo |
|||
this.setData({ |
|||
"userInfo.nickName": nickName, |
|||
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl, |
|||
}) |
|||
}, |
|||
getUserProfile(e) { |
|||
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
|||
wx.getUserProfile({ |
|||
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|||
success: (res) => { |
|||
console.log(res) |
|||
this.setData({ |
|||
userInfo: res.userInfo, |
|||
hasUserInfo: true |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
}, |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"navigation-bar": "/components/navigation-bar/navigation-bar" |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
<!--index.wxml--> |
|||
<navigation-bar title="Weixin" back="{{false}}" color="black" background="#FFF"></navigation-bar> |
|||
<scroll-view class="scrollarea" scroll-y type="list"> |
|||
<view class="container"> |
|||
<view class="userinfo"> |
|||
<block wx:if="{{canIUseNicknameComp && !hasUserInfo}}"> |
|||
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar"> |
|||
<image class="avatar" src="{{userInfo.avatarUrl}}"></image> |
|||
</button> |
|||
<view class="nickname-wrapper"> |
|||
<text class="nickname-label">昵称</text> |
|||
<input type="nickname" class="nickname-input" placeholder="请输入昵称" bind:change="onInputChange" /> |
|||
</view> |
|||
</block> |
|||
<block wx:elif="{{!hasUserInfo}}"> |
|||
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button> |
|||
<view wx:else> 请使用2.10.4及以上版本基础库 </view> |
|||
</block> |
|||
<block wx:else> |
|||
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> |
|||
<text class="userinfo-nickname">{{userInfo.nickName}}</text> |
|||
</block> |
|||
</view> |
|||
<view class="usermotto"> |
|||
<text class="user-motto">{{motto}}</text> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
@ -0,0 +1,63 @@ |
|||
/**index.wxss**/ |
|||
page { |
|||
height: 100vh; |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.scrollarea { |
|||
flex: 1; |
|||
overflow-y: hidden; |
|||
} |
|||
|
|||
.userinfo { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
color: #aaa; |
|||
width: 80%; |
|||
} |
|||
|
|||
.userinfo-avatar { |
|||
overflow: hidden; |
|||
width: 128rpx; |
|||
height: 128rpx; |
|||
margin: 20rpx; |
|||
border-radius: 50%; |
|||
} |
|||
|
|||
.usermotto { |
|||
margin-top: 200px; |
|||
} |
|||
|
|||
.avatar-wrapper { |
|||
padding: 0; |
|||
width: 56px !important; |
|||
border-radius: 8px; |
|||
margin-top: 40px; |
|||
margin-bottom: 40px; |
|||
} |
|||
|
|||
.avatar { |
|||
display: block; |
|||
width: 56px; |
|||
height: 56px; |
|||
} |
|||
|
|||
.nickname-wrapper { |
|||
display: flex; |
|||
width: 100%; |
|||
padding: 16px; |
|||
box-sizing: border-box; |
|||
border-top: .5px solid rgba(0, 0, 0, 0.1); |
|||
border-bottom: .5px solid rgba(0, 0, 0, 0.1); |
|||
color: black; |
|||
} |
|||
|
|||
.nickname-label { |
|||
width: 105px; |
|||
} |
|||
|
|||
.nickname-input { |
|||
flex: 1; |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
// logs.js
|
|||
const util = require('../../utils/util.js') |
|||
|
|||
Component({ |
|||
data: { |
|||
logs: [] |
|||
}, |
|||
lifetimes: { |
|||
attached() { |
|||
this.setData({ |
|||
logs: (wx.getStorageSync('logs') || []).map(log => { |
|||
return { |
|||
date: util.formatTime(new Date(log)), |
|||
timeStamp: log |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
}, |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"navigation-bar": "/components/navigation-bar/navigation-bar" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
<!--logs.wxml--> |
|||
<navigation-bar title="查看启动日志" back="{{true}}" color="black" background="#FFF"></navigation-bar> |
|||
<scroll-view class="scrollarea" scroll-y type="list"> |
|||
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log"> |
|||
<view class="log-item">{{index + 1}}. {{log.date}}</view> |
|||
</block> |
|||
</scroll-view> |
|||
@ -0,0 +1,16 @@ |
|||
page { |
|||
height: 100vh; |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
.scrollarea { |
|||
flex: 1; |
|||
overflow-y: hidden; |
|||
} |
|||
.log-item { |
|||
margin-top: 20rpx; |
|||
text-align: center; |
|||
} |
|||
.log-item:last-child { |
|||
padding-bottom: env(safe-area-inset-bottom); |
|||
} |
|||
@ -0,0 +1,120 @@ |
|||
// pages/map/map.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
markers: { |
|||
longitude: null, |
|||
latitude: null |
|||
}, |
|||
activeTab: '', |
|||
}, |
|||
|
|||
|
|||
// 切换标签页
|
|||
switchTab(e) { |
|||
const tab = e.currentTarget.dataset.tab; |
|||
this.setData({ |
|||
activeTab: tab |
|||
}); |
|||
|
|||
// 这里可以添加切换标签后的逻辑
|
|||
if (tab === 'clinic') { |
|||
// 药店诊所相关操作
|
|||
console.log('切换到药店诊所'); |
|||
} else if (tab === 'guide') { |
|||
// 办事指南相关操作
|
|||
console.log('切换到办事指南'); |
|||
} |
|||
}, |
|||
|
|||
// 获取当前位置信息
|
|||
getlocation() { |
|||
var that = this |
|||
wx.getLocation({ |
|||
isHighAccuracy: true, |
|||
type: 'gcj02', |
|||
success: function (res) { |
|||
console.log(res); |
|||
that.setData({ |
|||
['markers.longitude']: res.longitude, |
|||
['markers.latitude']: res.latitude |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
|
|||
// 地图
|
|||
getMap() { |
|||
wx.chooseLocation({ |
|||
success: res => { |
|||
console.log(111, res); |
|||
this.setData({ |
|||
['markers.longitude']: res.longitude, |
|||
['markers.latitude']: res.latitude |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
this.getlocation() |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
"navigationBarTitleText":"地图导航", |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
<view class="page-container"> |
|||
<!-- 按钮区域 --> |
|||
<view class="button-group"> |
|||
<view |
|||
class="button {{activeTab === 'clinic' ? 'active' : ''}}" |
|||
bindtap="switchTab" |
|||
data-tab="clinic" |
|||
> |
|||
药店诊所 |
|||
</view> |
|||
<view |
|||
class="button {{activeTab === 'guide' ? 'active' : ''}}" |
|||
bindtap="switchTab" |
|||
data-tab="guide" |
|||
> |
|||
办事指南 |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 地图区域 --> |
|||
<view class="map-container"> |
|||
<map |
|||
id="myMap" |
|||
enable-zoom |
|||
longitude="{{markers.longitude}}" |
|||
latitude="{{markers.latitude}}" |
|||
enable-3D="{{true}}" |
|||
scale="16" |
|||
markers="{{[markers]}}" |
|||
></map> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,157 @@ |
|||
/* 页面容器 */ |
|||
.page-container { |
|||
width: 100%; |
|||
min-height: 100vh; |
|||
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); |
|||
} |
|||
|
|||
/* 按钮组样式 */ |
|||
.button-group { |
|||
width: 92%; |
|||
margin: 24rpx auto; |
|||
display: flex; |
|||
background: #ffffff; |
|||
border-radius: 20rpx; |
|||
padding: 8rpx; |
|||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08); |
|||
position: relative; |
|||
z-index: 10; |
|||
} |
|||
|
|||
/* 按钮基础样式 */ |
|||
.button { |
|||
flex: 1; |
|||
height: 88rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
font-size: 32rpx; |
|||
font-weight: 500; |
|||
color: #666; |
|||
background: transparent; |
|||
border-radius: 16rpx; |
|||
transition: all 0.3s ease; |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
/* 激活状态按钮 */ |
|||
.button.active { |
|||
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); |
|||
color: #ffffff; |
|||
font-weight: 600; |
|||
box-shadow: 0 4rpx 16rpx rgba(106, 17, 203, 0.3); |
|||
} |
|||
|
|||
/* 按钮点击效果 */ |
|||
.button:active { |
|||
transform: scale(0.98); |
|||
} |
|||
|
|||
/* 地图容器 */ |
|||
.map-container { |
|||
width: 92%; |
|||
margin: 0 auto; |
|||
border-radius: 24rpx; |
|||
overflow: hidden; |
|||
box-shadow: 0 12rpx 48rpx rgba(0, 0, 0, 0.15); |
|||
height: calc(100vh - 200rpx); |
|||
position: relative; |
|||
} |
|||
|
|||
/* 地图本身样式 */ |
|||
.map-container map { |
|||
width: 100%; |
|||
height: 100%; |
|||
border-radius: 24rpx; |
|||
display: block; /* 确保正确显示 */ |
|||
} |
|||
|
|||
/* 问题修复:移除或修改覆盖层 */ |
|||
/* 原来的 ::before 伪元素会覆盖地图,阻挡交互 */ |
|||
/* 如果你需要加载状态,可以这样修改: */ |
|||
|
|||
.map-container.loading::before { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
|||
opacity: 0.3; /* 降低不透明度 */ |
|||
transition: opacity 0.3s; |
|||
border-radius: 24rpx; |
|||
z-index: -1; /* 放到地图后面 */ |
|||
pointer-events: none; /* 关键:不阻挡点击事件 */ |
|||
} |
|||
|
|||
/* 或者完全移除加载状态样式,因为地图有自己的加载状态 */ |
|||
|
|||
/* 地图控制按钮样式(如果需要添加) */ |
|||
.map-controls { |
|||
position: absolute; |
|||
right: 24rpx; |
|||
bottom: 40rpx; |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 16rpx; |
|||
z-index: 100; |
|||
} |
|||
|
|||
.map-control-btn { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
background: rgba(255, 255, 255, 0.95); |
|||
border-radius: 50%; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.15); |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
color: #333; |
|||
transition: all 0.2s; |
|||
border: 1rpx solid rgba(0, 0, 0, 0.1); |
|||
} |
|||
|
|||
.map-control-btn:active { |
|||
background: rgba(240, 240, 240, 0.95); |
|||
transform: scale(0.95); |
|||
} |
|||
|
|||
.map-control-btn.location { |
|||
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); |
|||
color: white; |
|||
} |
|||
|
|||
|
|||
|
|||
/* 响应式适配 */ |
|||
@media (max-width: 480px) { |
|||
.button-group { |
|||
width: 94%; |
|||
margin: 20rpx auto; |
|||
} |
|||
|
|||
.map-container { |
|||
width: 94%; |
|||
height: calc(100vh - 180rpx); |
|||
} |
|||
|
|||
.button { |
|||
height: 80rpx; |
|||
font-size: 28rpx; |
|||
} |
|||
|
|||
.map-controls { |
|||
right: 16rpx; |
|||
bottom: 30rpx; |
|||
} |
|||
|
|||
.map-control-btn { |
|||
width: 70rpx; |
|||
height: 70rpx; |
|||
font-size: 32rpx; |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
// pages/news/news.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
"navigationBarTitleText":"消息", |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pages/news/news.wxml--> |
|||
<text>pages/news/news.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pages/news/news.wxss */ |
|||
@ -0,0 +1,66 @@ |
|||
// pages/personal/personal.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
"navigationBarTitleText":"个人中心", |
|||
"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/socialWork/socialWork.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pagesA/pages/socialWork/socialWork.wxml--> |
|||
<text>pagesA/pages/socialWork/socialWork.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pagesA/pages/socialWork/socialWork.wxss */ |
|||
@ -0,0 +1,66 @@ |
|||
// pagesB/pages/apple/apple.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
<!--pagesB/pages/apple/apple.wxml--> |
|||
<text>pagesB/pages/apple/apple.wxml</text> |
|||
@ -0,0 +1 @@ |
|||
/* pagesB/pages/apple/apple.wxss */ |
|||
@ -0,0 +1,41 @@ |
|||
{ |
|||
"appid": "wx903a5fea119f2d4a", |
|||
"compileType": "miniprogram", |
|||
"libVersion": "3.13.0", |
|||
"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-ymtx", |
|||
"setting": { |
|||
"compileHotReLoad": true, |
|||
"skylineRenderEnable": true, |
|||
"urlCheck": false, |
|||
"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.13.0", |
|||
"condition": {} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", |
|||
"rules": [{ |
|||
"action": "allow", |
|||
"page": "*" |
|||
}] |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
//在这里面定义所有接口,一个文件管理所有接口,易于维护
|
|||
import { http } from './http'; // 引入刚刚封装好的http模块,import属于ES6的语法,微信开发者工具必须打开ES6转ES5选项
|
|||
|
|||
function login(params) { // 请求登录接口
|
|||
http('/login', 'post', params) // 接口请求的路由地址以及请求方法在此处传递
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
export default { // 暴露接口
|
|||
login |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
//url: 'https://wxamp.chenhaitech.com/tglzw' + url, // 就是拼接上前缀,此接口域名是开放接口,可访问
|
|||
var baseUrl = 'https://wx.chenhaitech.com/guoziwei-prod-api' |
|||
// var baseUrl = 'http://192.168.101.111:8080'
|
|||
module.exports = baseUrl |
|||
@ -0,0 +1,8 @@ |
|||
|
|||
@font-face { |
|||
font-family: "思源宋体 Light" !important; |
|||
font-weight: 300; |
|||
src: url("/pages/assets/img/EZSx3exf4cjI.woff2") format("woff2"), |
|||
url("/pages/assets/img/EZSx3exf4cjI.woff") format("woff"); |
|||
font-display: swap; |
|||
} |
|||
@ -0,0 +1,85 @@ |
|||
var baseUrl = require('../utils/baseUrl') |
|||
var ajaxtimes = 0 |
|||
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){ |
|||
wx.showModal({ |
|||
title: '提示', |
|||
content: '登录已过期,请重新登录', |
|||
success (res) { |
|||
if (res.confirm) { |
|||
wx.reLaunch({ |
|||
url: '/pages/logo/logo', |
|||
}) |
|||
} else if (res.cancel) { |
|||
|
|||
} |
|||
} |
|||
}) |
|||
|
|||
}else{ |
|||
params.success && params.success(res.data) |
|||
} |
|||
}, |
|||
fail(err) { |
|||
params.fail && params.fail(err) |
|||
}, |
|||
complete(){ |
|||
//完成一次请求就减一
|
|||
ajaxtimes--; |
|||
if(ajaxtimes===0){ |
|||
wx.hideLoading() |
|||
} |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
function images(status,value) { |
|||
if(value<6){ |
|||
return status != '0' ? '/pages/assets/img/jichu.png':'/pages/assets/img/jichu1.png' |
|||
}else if(value>5 && value<9){ |
|||
return status != '0' ? '/pages/assets/img/tese.png':'/pages/assets/img/tece1.png' |
|||
}else{ |
|||
return status != '0' ? '/pages/assets/img/mofan.png':'/pages/assets/img/mofan1.png' |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
module.exports = { |
|||
|
|||
} |
|||
@ -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 |
|||
} |
|||