Compare commits

..

4 Commits

34 changed files with 718 additions and 59 deletions

View File

@ -25,7 +25,9 @@
"pages/workBench/index",
"pages/webPage/index",
"pages/aid/finance/index",
"pages/aid/law/index"
"pages/aid/law/index",
"pages/aid/detail/index",
"pages/aid/consult/index"
],
"subPackages": [
{

View File

@ -1,3 +1,9 @@
import { getAidList } from "../../service/system";
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
// components/aid/index.js
Component({
@ -5,20 +11,79 @@ Component({
* 组件的属性列表
*/
properties: {
type: Number,
bannerType: Number,
},
lifetimes: {
attached() {
this.init();
}
},
/**
* 组件的初始数据
*/
data: {
park: {},
list: [],
total: 0,
page: 1,
size: 20,
},
lifetimes: {
attached() {
loadingFunc(async () => {
await this.init();
})
}
},
/**
* 组件的方法列表
*/
methods: {
async init() {
const { type, page, size } = this.data;
const { code, message, data = [], total } = await getAidList(page, size, type);
if (code !== OK) {
alertInfo(message)
return
}
this.setData({
list: data,
total,
totalPage: Math.ceil(total / size)
})
},
onRefresh() {
const that = this;
this.setData({
page: 1,
}, () => {
that.init();
})
},
jumpToDetail(e) {
const { id = "" } = e.currentTarget.dataset;
const { type } = this.data;
wx.navigateTo({
url: `/pages/aid/detail/index?id=${id}&type=${type}`,
})
},
consult(e) {
const { id = "" } = e.currentTarget.dataset;
const { type } = this.data;
wx.navigateTo({
url: `/pages/aid/consult/index?id=${id}&type=${type}`,
})
},
async onChangePage(e) {
const page = e.detail.currentIndex;
const that = this;
this.setData({
page
}, () => {
that.init();
})
},
}
})

View File

@ -1,4 +1,10 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"Banner": "/components/banner/index",
"van-image": "@vant/weapp/image/index",
"empty": "/components/empty/index",
"van-icon": "@vant/weapp/icon/index",
"pagination": "/components/pagination/index"
}
}

View File

@ -1,2 +1,34 @@
<!--components/aid/index.wxml-->
<text>components/aid/index.wxml</text>
<Banner park="{{park.id}}" type="{{bannerType}}" />
<div class="title">行业精英</div>
<view wx:if="{{list.length}}">
<view wx:for="{{list}}" wx:key="id" >
<view class="userInfoItem" bind:tap="jumpToDetail" data-id="{{item.id}}">
<view class="content">
<van-image
width="200rpx"
height="200rpx"
lazy-load
src="{{item.avatar}}"
/>
<view class="userInfo">
<view style="display: flex;font-size: 30rpx;">
<view class="userName"> {{ item.name }} </view>
<view class="userLevel"> {{ item.level }} </view>
</view>
<view class="synopsis"> {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} </view>
<view class="connect" catch:tap="consult" data-id="{{item.id}}">
<van-icon name="service-o" color="#1989fa" />
<view style="margin-left: 10rpx;color: #1989fa;"> 在线咨询 </view>
</view>
</view>
</view>
</view>
</view>
<pagination
currentIndex="{{page}}"
totalPage="{{totalPage}}"
bind:pagingChange="onChangePage"
/>
</view>
<empty wx:else bind:refresh="onRefresh" />

View File

@ -1 +1,58 @@
/* components/aid/index.wxss */
.title {
padding-top: 30rpx;
padding-left: 30rpx;
display: flex;
}
.userInfoItem {
padding: 30rpx;
}
.userInfoItem .content {
display: flex;
align-items: center;
border-bottom: 1rpx solid #ccc;
}
.userInfo {
height: 200rpx;
margin-left: 30rpx;
flex: 1;
}
.userLevel {
margin-left: 30rpx;
font-weight: 600;
}
.synopsis {
height: 80rpx;
overflow: hidden;
margin-top: 20rpx;
margin-bottom: 10rpx;
font-size: 32rpx;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.connect {
display: flex;
justify-content: flex-end;
}
.userName {
width: 150rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.userLevel {
width: 250rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

View File

@ -1,8 +1,10 @@
import { getBannerList } from "../../../../service/system"
import { alertInfo } from "../../../../utils/index";
import request from '../../../../utils/request'
import { getBannerList } from "../../service/system"
import { alertInfo } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
const result = wx.getAccountInfoSync();
const { envVersion } = result.miniProgram;
// pages/home/components/home-swiper/index.js
Component({
@ -12,10 +14,14 @@ Component({
*/
properties: {
park: String,
type: Number,
},
observers: {
'park': function(newValue) {
this.init(newValue)
'park,type': function(newPark, newType) {
if ((!newPark && newType === 0) || (!newType && newType !== 0)) {
return
}
this.init(newPark, newType)
}
},
/**
@ -24,8 +30,8 @@ Component({
data: {
indicatorDots: true,
vertical: false,
autoplay: false,
interval: 2000,
autoplay: true,
interval: 6000,
duration: 500,
list: [],
},
@ -33,11 +39,11 @@ Component({
* 组件的方法列表
*/
methods: {
async init(park) {
const { code, message, data = [] } = await getBannerList(park, 1);
async init(park, type) {
const { code, message, data = [] } = await getBannerList(park, type);
if (code !== OK) {
alertInfo(message);
this.setData({ list: [] })
this.setData({ list: [], park, type })
return
}
this.setData({ list: data })
@ -47,9 +53,9 @@ Component({
switch(data.jumpType) {
case 1:
wx.navigateToMiniProgram({
appId: data.appId,
appId: data.appid,
path: data.wxPath,
envVersion: "trial"
envVersion: envVersion
})
break;
case 2:

View File

@ -1,12 +1,14 @@
<!--pages/home/components/home-swiper/index.wxml-->
<swiper
indicator-dots="{{indicatorDots}}"
indicator-dots="{{list.length > 1}}"
autoplay="{{autoplay}}"
interval="{{interval}}"
duration="{{duration}}"
circular="{{true}}"
wx:if="{{list.length}}"
style="height: 288rpx"
>
<block wx:for="{{list}}" wx:key="{{item.id}}" wx:item="item">
<block wx:for="{{list}}" wx:key="id" wx:item="item">
<swiper-item>
<van-image
width="100%"

View File

@ -0,0 +1,24 @@
// components/discountCoupon/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,2 @@
<!--components/discountCoupon/index.wxml-->
<text>components/discountCoupon/index.wxml</text>

View File

@ -0,0 +1 @@
/* components/discountCoupon/index.wxss */

117
pages/aid/consult/index.js Normal file
View File

@ -0,0 +1,117 @@
import { askAid } from "../../../service/system";
import dayjs from "../../../utils/dayjs";
import { alertInfo, alertSuccess, isValidPhoneNumber, loadingFunc } from "../../../utils/index";
import request from '../../../utils/request'
const { OK } = request
// pages/aid/consult/index.js
Page({
/**
* 页面的初始数据
*/
data: {
form: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id, type } = options;
this.setData({ type: Number(type), id });
},
onChange(e) {
const data = e.detail;
const { name } = e.currentTarget.dataset
const { form } = this.data;
form[name] = data;
this.setData({
form,
})
},
back() {
wx.navigateBack()
},
async submit() {
const { form } = this.data;
const { name, phone, detail } = form;
if (!name) {
alertInfo("请输入名字")
return;
}
if (!phone) {
alertInfo("请输入手机号")
return;
}
if (phone && !isValidPhoneNumber(phone)) {
alertInfo("手机号格式不正确")
return
}
if (!detail) {
alertInfo("请输入详情")
return
}
const that = this;
loadingFunc(async () => {
const { type, id } = that.data;
const { code, message } = await askAid({ ...form, type, createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), connectId: id })
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("创建成功")
setTimeout(() => {
wx.navigateBack();
}, 500)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,8 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,50 @@
<!--pages/aid/consult/index.wxml-->
<navigator title="填写咨询信息" canBack="{{true}}" />
<van-cell-group>
<van-field
value="{{form.name}}"
label="名字"
placeholder="请输入名字"
bind:change="onChange"
data-name="name"
title-width="140rpx"
required
/>
<van-field
value="{{form.phone}}"
label="手机号"
bind:change="onChange"
data-name="phone"
placeholder="请输入手机号"
required
title-width="140rpx"
/>
<van-field
value="{{form.email}}"
label="邮箱"
bind:change="onChange"
data-name="email"
placeholder="请输入邮箱"
title-width="140rpx"
/>
<van-field
value="{{form.detail}}"
label="咨询内容"
bind:change="onChange"
data-name="detail"
required
type="textarea"
autosize="{{true}}"
placeholder="请输入咨询内容"
title-width="140rpx"
/>
<view style="margin-top: 20rpx; margin-left: 30rpx;">
<mp-html content="{{detail.detail}}" />
</view>
</van-cell-group>
<view class="submit">
<van-button block class="cancelEdit" bind:click="back">返回</van-button>
<van-button type="info" block class="save" bind:click="submit">保存</van-button>
</view>

View File

@ -0,0 +1,17 @@
/* pages/aid/consult/index.wxss */
.submit {
margin: 40rpx;
margin-bottom: 50rpx;
display: flex;
align-items: center;
}
.cancelEdit, .save {
flex: 1;
}
.cancelEdit {
margin-right: 40rpx;
}

95
pages/aid/detail/index.js Normal file
View File

@ -0,0 +1,95 @@
import { getAidDetail } from "../../../service/system";
import { alertInfo, loadingFunc } from "../../../utils/index";
import request from "../../../utils/request"
const { OK } = request;
// pages/aid/detail/index.js
Page({
/**
* 页面的初始数据
*/
data: {
detail: {},
id: "",
type: undefined,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const that = this;
const { type, id } = options;
this.setData({ type, id }, () => {
loadingFunc(async () => {
that.init();
})
})
},
async init() {
const { id, type } = this.data;
const { code, message, data = {} } = await getAidDetail(id);
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
detail: data
})
},
connect() {
const { type, id } = this.data;
wx.navigateTo({
url: `/pages/aid/consult/index?type=${type}&id=${id}`,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,10 @@
{
"usingComponents": {
"aid": "/components/aid/index",
"navigator": "/components/navigator/index",
"mp-html": "/components/mp-html/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,53 @@
<!--pages/aid/detail/index.wxml-->
<navigator title="详情" canBack="{{true}}" />
<van-cell-group>
<van-field
value="{{detail.name}}"
label="名字"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.level}}"
label="职称"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.company}}"
label="所在单位"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
value="{{detail.synopsis}}"
label="简介"
readonly
autosize="{{true}}"
type="textarea"
border="{{ false }}"
/>
<van-field
use-input-slot
label="详细"
readonly
border="{{ false }}"
>
</van-field>
<view style="margin-top: 20rpx; margin-left: 30rpx;">
<mp-html content="{{detail.detail}}" />
</view>
</van-cell-group>
<view style="margin-top: 40rpx;margin-left: 30rpx;margin-bottom: 30rpx;margin-right: 30rpx;">
<van-button type="info" block class="save" bind:click="connect">去联系</van-button>
</view>

View File

@ -0,0 +1 @@
/* pages/aid/detail/index.wxss */

View File

@ -1,3 +1,7 @@
{
"usingComponents": {}
"usingComponents": {
"aid": "/components/aid/index",
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@ -1,2 +1,3 @@
<!--pages/aid/finance/index.wxml-->
<text>pages/aid/finance/index.wxml</text>
<navigator title="财税援助" canBack="{{true}}" />
<aid bannerType="{{2}}" type="{{1}}" />

View File

@ -1,3 +1,7 @@
{
"usingComponents": {}
"usingComponents": {
"aid": "/components/aid/index",
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@ -1,2 +1,3 @@
<!--pages/aid/law/index.wxml-->
<text>pages/aid/law/index.wxml</text>
<navigator title="法律援助" canBack="{{true}}" />
<aid bannerType="{{3}}" type="{{2}}" />

View File

@ -10,7 +10,7 @@
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index",
"van-action-sheet": "@vant/weapp/action-sheet/index",
"home-swiper": "./components/home-swiper/index"
"banner": "/components/banner/index"
},
"navigationStyle": "custom"
}

View File

@ -33,7 +33,7 @@
<!-- <view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view> -->
</view>
</view>
<home-swiper wx:if="{{park.id}}" park="{{park.id}}" />
<banner type="{{1}}" wx:if="{{park.id}}" park="{{park.id}}" />
<view class="rechargeWrapper">
<view class="card">
<view class="cardTop">

View File

@ -14,7 +14,7 @@
height: 46px;
display: flex;
align-items: center;
padding: 0 32rpx;
padding: 0 24rpx;
color: #fff;
font-size: 34rpx;
}
@ -35,7 +35,7 @@
.notLoginWrapper, .logined {
padding: 16rpx 32rpx;
padding-left: 50rpx;
padding-left: 28rpx;
background-color: var(--middle-green);
display: flex;
align-items: center;
@ -67,9 +67,9 @@
.card {
margin-top: 0rpx;
margin-left: 46rpx;
margin-right: 46rpx;
border-radius: 30rpx;
margin-left: 24rpx;
margin-right: 24rpx;
border-radius: 16rpx;
padding: 22rpx 30rpx;
/* background-color: rgb(173, 217, 203); */
background: linear-gradient(to bottom right, rgb(212, 240, 231), rgb(145, 206, 185));
@ -116,10 +116,10 @@
background: #fff;
padding: 20rpx 30rpx;
margin-top: 24rpx;
margin-left: 46rpx;
margin-right: 46rpx;
margin-left: 24rpx;
margin-right: 24rpx;
margin-bottom: 30rpx;
border-radius: 30rpx;
border-radius: 16rpx;
}
.operate {
@ -159,8 +159,10 @@
}
.others {
margin-left: 46rpx;
margin-right: 46rpx;
margin-left: 24rpx;
margin-right: 24rpx;
margin-top: 10rpx;
margin-bottom: 40rpx;
border-radius: 16rpx;
overflow: hidden;
}

View File

@ -13,6 +13,7 @@ Page({
*/
data: {
user: {},
tenement: {},
visible: false,
},
@ -62,6 +63,8 @@ Page({
}
this.init()
this.getUnReadNumber()
const tenement = wx.getStorageSync('tenement')
this.setData({ tenement })
},
async init() {
const tenement = wx.getStorageSync('tenement')
@ -131,5 +134,15 @@ Page({
wx.navigateTo({
url: '/pages/aid/finance/index',
})
},
jumpToLaw() {
wx.navigateTo({
url: '/pages/aid/law/index',
})
},
jumpToEncyclopedia() {
wx.navigateTo({
url: '/pages/encyclopedia/index',
})
}
})

View File

@ -7,6 +7,7 @@
"dot": "/components/dot/index",
"navigator": "/components/navigator/index",
"van-grid": "@vant/weapp/grid/index",
"avatar": "/components/avatar/index",
"van-grid-item": "@vant/weapp/grid-item/index"
},
"navigationBarTitleText": "我的",

View File

@ -1,25 +1,41 @@
<!--pages/my/index.wxml-->
<navigator title="我的" />
<van-grid column-num="3">
<view class="pageWrapper">
<view class="userInfo">
<avatar text="{{ user.nickName }}" />
<view class="info">
<view class="nickName"> {{ user.nickName }} </view>
<view class="tenement"> {{ tenement.name }} </view>
<view class="integration"> 积分: - </view>
</view>
</view>
<view style="margin-bottom: 20rpx;border-radius: 16rpx; overflow: hidden;">
<van-grid column-num="3">
<van-grid-item icon="friends-o" text="财税援助" bind:click="jumpToFinance" />
<van-grid-item icon="envelop-o" text="法律援助" />
<van-grid-item icon="notes-o" text="电力百科" />
</van-grid>
<van-cell title="联系客服" value="" is-link bind:tap="connect" />
<van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
<van-cell wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
<van-grid-item icon="envelop-o" text="法律援助" bind:click="jumpToLaw" />
<van-grid-item icon="notes-o" text="电力百科" bind:click="jumpToEncyclopedia" />
</van-grid>
</view>
<view style="border-radius: 16rpx; overflow: hidden;">
<van-cell title="联系客服" value="" is-link bind:tap="connect" icon="service-o" />
<van-cell icon="qr" wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
<van-cell icon="friends-o" wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
<view slot="title">
<view class="cellWrapper">
<view class="text"> 成员管理 </view>
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
</view>
</view>
</van-cell>
<van-cell title="发票抬头" value="" is-link bind:tap="jumpToUpdateInvoice" />
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
<van-cell title="常见问题" value="" is-link bind:tap="jumpToQuestions" />
<van-cell title="工作台" wx:if="{{user.workStatus}}" value="" is-link bind:tap="jumpToWorkBench" />
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
</van-cell>
<van-cell title="发票抬头" icon="discount-o" value="" is-link bind:tap="jumpToUpdateInvoice">
</van-cell>
<van-cell title="绑定企业" icon="exchange" value="" is-link bind:tap="bindTenement" />
<van-cell title="常见问题" icon="question-o" value="" is-link bind:tap="jumpToQuestions" />
<van-cell title="工作台" icon="records-o" wx:if="{{user.workStatus}}" value="" is-link bind:tap="jumpToWorkBench" />
<van-cell title="退出登录" icon="revoke" value="" is-link bind:tap="logout" />
</view>
<van-dialog id="van-dialog" />
<van-dialog id="van-dialog" />
</view>

View File

@ -4,3 +4,39 @@
justify-content: space-between;
}
.pageWrapper {
padding: 24rpx;
min-height: 80vh;
background: linear-gradient(to bottom, var(--middle-green), #fff );
}
.userInfo {
display: flex;
align-items: center;
padding: 24rpx;
background-color: #fff;
margin-bottom: 24rpx;
overflow: hidden;
border-radius: 16rpx;
}
.userInfo .info {
margin-left: 30rpx;
flex: 1;
}
.userInfo .info .nickName {
font-size: 34rpx;
font-weight: 700;
}
.userInfo .info .tenement {
font-size: 28rpx;
margin-top: 6rpx;
}
.integration {
font-size: 28rpx;
margin-top: 6rpx;
}

View File

@ -10,6 +10,20 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/aid/consult/index",
"pathName": "pages/aid/consult/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/aid/law/index",
"pathName": "pages/aid/law/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/my/index",
"pathName": "pages/my/index",

View File

@ -51,7 +51,22 @@ export const getEncyclopediaDetail = async function(id) {
return await GET(`/wx/getEncyclopediaDetail/${id}`);
}
// 获取分类列表
// 获取banner列表
export const getBannerList = async function(park = "", address = "") {
return await GET(`/wx/getBannerList?park=${park}&address=${address}`);
}
// 获取财务/律师援助列表
export const getAidList = async function(page = 1, size = 10, type = 0) {
return await GET(`/aid/getList?page=${page}&size=${size}&type=${type}`);
}
// 获取财务/律师援助详情
export const getAidDetail = async function(id) {
return await GET(`/aid/detail/${id}`);
}
// 提交财务/律师援助
export const askAid = async function(data) {
return await POST(`/wx/aid/approve`, data);
}