From 3ad21ea708ce4fce991a8dfbab01af32d1bd56ec Mon Sep 17 00:00:00 2001 From: qiaomu <3520484422@qq.com> Date: Fri, 29 Nov 2024 15:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B3=95=E5=BE=8B=E6=8F=B4?= =?UTF-8?q?=E5=8A=A9=E5=92=8C=E8=B4=A2=E7=A8=8E=E6=8F=B4=E5=8A=A9=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/aid/index.js | 29 +++++++++++++------ components/aid/index.json | 3 +- components/aid/index.wxml | 13 ++++++--- components/aid/index.wxss | 14 +++++++++ pages/aid/consult/index.js | 56 ++++++++++++++++++++++++++++++++++-- pages/aid/consult/index.wxml | 9 +++--- pages/aid/consult/index.wxss | 19 ++++++++---- pages/aid/detail/index.js | 12 ++++++-- pages/aid/detail/index.json | 3 +- pages/aid/detail/index.wxml | 5 +++- pages/my/index.js | 13 +++++++++ pages/my/index.json | 1 + pages/my/index.wxml | 52 +++++++++++++++++++++------------ pages/my/index.wxss | 35 ++++++++++++++++++++++ service/system.js | 5 ++++ 15 files changed, 219 insertions(+), 50 deletions(-) diff --git a/components/aid/index.js b/components/aid/index.js index 63e0888..eff9662 100644 --- a/components/aid/index.js +++ b/components/aid/index.js @@ -1,5 +1,5 @@ import { getAidList } from "../../service/system"; -import { alertInfo, alertSuccess } from "../../utils/index"; +import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index"; import request from '../../utils/request' const { OK } = request; @@ -32,7 +32,9 @@ Component({ }, lifetimes: { attached() { - this.init() + loadingFunc(async () => { + await this.init(); + }) } }, /** @@ -42,16 +44,14 @@ Component({ async init() { const { type, page, size } = this.data; const { code, message, data = [], total } = await getAidList(page, size, type); - console.log('data', data) if (code !== OK) { alertInfo(message) return } this.setData({ list: data, - total - }, () => { - console.log("this.data", this.data) + total, + totalPage: Math.ceil(total / size) }) }, onRefresh() { @@ -69,10 +69,21 @@ Component({ url: `/pages/aid/detail/index?id=${id}&type=${type}`, }) }, - consult() { + consult(e) { + const { id = "" } = e.currentTarget.dataset; + const { type } = this.data; wx.navigateTo({ - url: `/pages/aid/consult/index?id=${this.data.type}`, + 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(); + }) + }, } }) \ No newline at end of file diff --git a/components/aid/index.json b/components/aid/index.json index ba9c8eb..b34c4c2 100644 --- a/components/aid/index.json +++ b/components/aid/index.json @@ -4,6 +4,7 @@ "Banner": "/components/banner/index", "van-image": "@vant/weapp/image/index", "empty": "/components/empty/index", - "van-icon": "@vant/weapp/icon/index" + "van-icon": "@vant/weapp/icon/index", + "pagination": "/components/pagination/index" } } \ No newline at end of file diff --git a/components/aid/index.wxml b/components/aid/index.wxml index 6b0b643..3d3bf5a 100644 --- a/components/aid/index.wxml +++ b/components/aid/index.wxml @@ -3,7 +3,7 @@
行业精英
- + {{ item.level }} {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} - - - 在线咨询 + + + 在线咨询 + \ No newline at end of file diff --git a/components/aid/index.wxss b/components/aid/index.wxss index a2aa762..0a0f96d 100644 --- a/components/aid/index.wxss +++ b/components/aid/index.wxss @@ -41,4 +41,18 @@ .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; } \ No newline at end of file diff --git a/pages/aid/consult/index.js b/pages/aid/consult/index.js index 02cc906..44f717f 100644 --- a/pages/aid/consult/index.js +++ b/pages/aid/consult/index.js @@ -1,3 +1,9 @@ +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({ @@ -12,10 +18,54 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - const { type } = options; - this.setData({ type }); + 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) + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/aid/consult/index.wxml b/pages/aid/consult/index.wxml index 8c47e33..97228d1 100644 --- a/pages/aid/consult/index.wxml +++ b/pages/aid/consult/index.wxml @@ -12,7 +12,7 @@ required /> @@ -33,7 +32,7 @@ value="{{form.detail}}" label="咨询内容" bind:change="onChange" - data-name="email" + data-name="detail" required type="textarea" autosize="{{true}}" @@ -45,7 +44,7 @@ - - 取消编辑 + + 返回 保存 \ No newline at end of file diff --git a/pages/aid/consult/index.wxss b/pages/aid/consult/index.wxss index eb6977e..bf0c397 100644 --- a/pages/aid/consult/index.wxss +++ b/pages/aid/consult/index.wxss @@ -1,8 +1,17 @@ /* pages/aid/consult/index.wxss */ .submit { - margin: 32rpx; - margin-bottom: 50rpx; - display: flex; - align-items: center; - } \ No newline at end of file + margin: 40rpx; + margin-bottom: 50rpx; + display: flex; + align-items: center; +} + + +.cancelEdit, .save { + flex: 1; +} + +.cancelEdit { + margin-right: 40rpx; +} \ No newline at end of file diff --git a/pages/aid/detail/index.js b/pages/aid/detail/index.js index 00a1804..9c55f3b 100644 --- a/pages/aid/detail/index.js +++ b/pages/aid/detail/index.js @@ -1,5 +1,5 @@ import { getAidDetail } from "../../../service/system"; -import { alertInfo } from "../../../utils/index"; +import { alertInfo, loadingFunc } from "../../../utils/index"; import request from "../../../utils/request" const { OK } = request; // pages/aid/detail/index.js @@ -21,7 +21,9 @@ Page({ const that = this; const { type, id } = options; this.setData({ type, id }, () => { - that.init(); + loadingFunc(async () => { + that.init(); + }) }) }, @@ -36,6 +38,12 @@ Page({ detail: data }) }, + connect() { + const { type, id } = this.data; + wx.navigateTo({ + url: `/pages/aid/consult/index?type=${type}&id=${id}`, + }) + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/aid/detail/index.json b/pages/aid/detail/index.json index 1aed5dd..587fdb4 100644 --- a/pages/aid/detail/index.json +++ b/pages/aid/detail/index.json @@ -3,7 +3,8 @@ "aid": "/components/aid/index", "navigator": "/components/navigator/index", "mp-html": "/components/mp-html/index", - "van-field": "@vant/weapp/field/index" + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/aid/detail/index.wxml b/pages/aid/detail/index.wxml index e4b2a5c..ce8de99 100644 --- a/pages/aid/detail/index.wxml +++ b/pages/aid/detail/index.wxml @@ -39,4 +39,7 @@ - \ No newline at end of file + + + 去联系 + \ No newline at end of file diff --git a/pages/my/index.js b/pages/my/index.js index ba660d0..b6acdd6 100644 --- a/pages/my/index.js +++ b/pages/my/index.js @@ -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', + }) } }) \ No newline at end of file diff --git a/pages/my/index.json b/pages/my/index.json index 849db1b..e3a3189 100644 --- a/pages/my/index.json +++ b/pages/my/index.json @@ -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": "我的", diff --git a/pages/my/index.wxml b/pages/my/index.wxml index 255a35d..e5223d7 100644 --- a/pages/my/index.wxml +++ b/pages/my/index.wxml @@ -1,25 +1,39 @@ - - - - - - - - - - - 成员管理 - + + + + + + {{ user.nickName }} + {{ tenement.name }} + 积分: - - - - - - - + + + + + + + + + + + + + 成员管理 + + + + + + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/my/index.wxss b/pages/my/index.wxss index 0a559ed..4859324 100644 --- a/pages/my/index.wxss +++ b/pages/my/index.wxss @@ -4,3 +4,38 @@ justify-content: space-between; } +.pageWrapper { + padding: 24rpx; + + 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; +} + +.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; +} + diff --git a/service/system.js b/service/system.js index cec3fd1..0e81520 100644 --- a/service/system.js +++ b/service/system.js @@ -64,4 +64,9 @@ export const getAidList = async function(page = 1, size = 10, type = 0) { // 获取财务/律师援助详情 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); } \ No newline at end of file