diff --git a/package.json b/package.json
index cd55bb4..c0023fb 100644
--- a/package.json
+++ b/package.json
@@ -54,6 +54,8 @@
"@tarojs/shared": "3.6.5",
"@tarojs/taro": "3.6.5",
"autoprefixer": "^10.4.14",
+ "html2canvas": "^1.4.1",
+ "jr-qrcode": "^1.1.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-refresh": "^0.11.0"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d2284de..c1f16ab 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -55,6 +55,12 @@ dependencies:
autoprefixer:
specifier: ^10.4.14
version: 10.4.14(postcss@8.4.18)
+ html2canvas:
+ specifier: ^1.4.1
+ version: 1.4.1
+ jr-qrcode:
+ specifier: ^1.1.4
+ version: 1.1.4
react:
specifier: ^18.0.0
version: 18.0.0
@@ -4640,6 +4646,11 @@ packages:
resolution: {integrity: sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==}
dev: true
+ /base64-arraybuffer@1.0.2:
+ resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
+ engines: {node: '>= 0.6.0'}
+ dev: false
+
/base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
@@ -5336,6 +5347,12 @@ packages:
engines: {node: '>=12.22'}
dev: true
+ /css-line-break@2.1.0:
+ resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
+ dependencies:
+ utrie: 1.0.2
+ dev: false
+
/css-loader@6.7.3(webpack@5.78.0):
resolution: {integrity: sha512-qhOH1KlBMnZP8FzRO6YCH9UHXQhVMcEGLyNdb7Hv2cpcmJbW0YrddO+tG1ab5nT41KpHIYGsbeHqxB9xPu1pKQ==}
engines: {node: '>= 12.13.0'}
@@ -7439,6 +7456,14 @@ packages:
webpack: 5.78.0(@swc/core@1.3.42)
dev: true
+ /html2canvas@1.4.1:
+ resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==}
+ engines: {node: '>=8.0.0'}
+ dependencies:
+ css-line-break: 2.1.0
+ text-segmentation: 1.0.3
+ dev: false
+
/htmlparser2@6.1.0:
resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==}
dependencies:
@@ -8077,6 +8102,10 @@ packages:
engines: {node: '>=10'}
dev: true
+ /jr-qrcode@1.1.4:
+ resolution: {integrity: sha512-041B7axC/tzKRFbCc4g5QCaPzga2IgyBGmUBkWQ+t4CMl83DBzFv9tq9XdJr7uIqe9X6zYZC7Cy5J9ttiBNxrw==}
+ dev: false
+
/js-tokens@3.0.2:
resolution: {integrity: sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==}
dev: true
@@ -11405,6 +11434,12 @@ packages:
commander: 2.20.3
source-map-support: 0.5.21
+ /text-segmentation@1.0.3:
+ resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
+ dependencies:
+ utrie: 1.0.2
+ dev: false
+
/text-table@0.2.0:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
dev: true
@@ -11799,6 +11834,12 @@ packages:
engines: {node: '>= 0.4.0'}
dev: true
+ /utrie@1.0.2:
+ resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
+ dependencies:
+ base64-arraybuffer: 1.0.2
+ dev: false
+
/uuid@3.4.0:
resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==}
deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
diff --git a/src/app.config.js b/src/app.config.js
index 067c4e4..25a7e56 100644
--- a/src/app.config.js
+++ b/src/app.config.js
@@ -31,7 +31,8 @@ export default defineAppConfig({
'pages/message/index',
'pages/message-list/index',
'pages/message-detail/index',
- '/pages/login-quick/index'
+ '/pages/login-quick/index',
+ '/pages/invite/index',
],
window: {
backgroundTextStyle: 'light',
diff --git a/src/app.scss b/src/app.scss
index ca8f36b..6e82958 100644
--- a/src/app.scss
+++ b/src/app.scss
@@ -100,6 +100,10 @@
margin-left: 17px;
}
+.mt6 {
+ margin-top: 6px;
+}
+
.mt-8 {
margin-top: 32px;
}
@@ -120,6 +124,10 @@
margin-top: 25px;
}
+.mt32 {
+ margin-top: 32px;
+}
+
.mt-58 {
margin-top: 58px;
diff --git a/src/assets/images/inviteBg.png b/src/assets/images/inviteBg.png
new file mode 100644
index 0000000..8bd30a1
Binary files /dev/null and b/src/assets/images/inviteBg.png differ
diff --git a/src/assets/images/qrcode.png b/src/assets/images/qrcode.png
new file mode 100644
index 0000000..cc1dcbe
Binary files /dev/null and b/src/assets/images/qrcode.png differ
diff --git a/src/assets/images/share.png b/src/assets/images/share.png
new file mode 100644
index 0000000..351b263
Binary files /dev/null and b/src/assets/images/share.png differ
diff --git a/src/assets/images/wechat.png b/src/assets/images/wechat.png
new file mode 100644
index 0000000..9b85eb4
Binary files /dev/null and b/src/assets/images/wechat.png differ
diff --git a/src/config/config.js b/src/config/config.js
index 4cd750b..0208418 100644
--- a/src/config/config.js
+++ b/src/config/config.js
@@ -1,5 +1,6 @@
export default {
api: "http://1.14.121.134:9101",
debugApi: "http://1.14.121.134:9101",
+ home: '',
debug: false
}
diff --git a/src/pages/about-me/index.jsx b/src/pages/about-me/index.jsx
index dcec2a0..89bcbf4 100644
--- a/src/pages/about-me/index.jsx
+++ b/src/pages/about-me/index.jsx
@@ -1,15 +1,22 @@
import { Image, Text, View } from "@tarojs/components"
import next from '@/images/next.png'
import './index.scss'
-import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
-import { useEffect } from "react"
+import { useEffect, useState } from "react"
+import { configs } from "../../utils/api"
const Login = () => {
+ const [about, setAbout] = useState({})
+ useEffect(() => {
+ configs().then(rs => {
+ if (!rs) return
+ setAbout(rs.about)
+ })
+ }, [])
// 返回页面
const backFn = () => {
@@ -30,16 +37,16 @@ const Login = () => {
关于我们
-
+
客服邮箱
- lhqjN@example.com
+ {about.email}
当前版本
- v1.0
+ {about.version}
diff --git a/src/pages/about-me/index.scss b/src/pages/about-me/index.scss
index 6d2c429..b139a7f 100644
--- a/src/pages/about-me/index.scss
+++ b/src/pages/about-me/index.scss
@@ -38,4 +38,5 @@
.about-logo {
margin-top: 40px;
+ width: 100%;
}
\ No newline at end of file
diff --git a/src/pages/cash/index.jsx b/src/pages/cash/index.jsx
index 00e13af..7fbd5f3 100644
--- a/src/pages/cash/index.jsx
+++ b/src/pages/cash/index.jsx
@@ -9,6 +9,9 @@ import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
import { Picker } from "@nutui/nutui-react-taro"
+import { cardList, scoreWithdraw, userDetail } from "../../utils/api"
+import { useEffect } from "react"
+import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
const activeEye = eye
@@ -18,8 +21,23 @@ const Login = () => {
const [visible, setVisible] = useState(false)
const [bank, setBank] = useState({ value: 0, text: '' })
+ const [pwd, setPwd] = useState('')
+ const [user, setUser] = useState({})
+ const [card, setCard] = useState([])
+ const [bankList, setBankList] = useState([])
+ useEffect(() => {
+ userDetail().then(rs => {
+ if (!rs) return
+ setUser(rs)
+ })
+ cardList().then(rs => {
+ if (!rs) return
+ setCard(rs.items)
+ setBankList([rs.items.map(item => ({ value: item.id, text: `${item.bank_name} ${item.account_number}` }))])
+ })
+ }, [])
// 返回页面
const backFn = () => {
@@ -29,39 +47,55 @@ const Login = () => {
const confirmPicker = (val, list) => {
list.forEach(item => {
- console.log(item, "C")
setBank(item)
})
}
- const listData1 = [
- [
- { value: 1, text: '南京市', },
- { value: 2, text: '无锡市', },
- { value: 3, text: '海北藏族自治区', },
- { value: 4, text: '北京市', },
- { value: 5, text: '连云港市', },
- { value: 6, text: '浙江市', },
- { value: 7, text: '江苏市', },
- { value: 8, text: '大庆市', },
- { value: 9, text: '绥化市', },
- { value: 10, text: '潍坊市', },
- { value: 11, text: '请按市', },
- { value: 12, text: '乌鲁木齐市' },
- ],
- ]
+ const submit = async () => {
+ if (!account) {
+ errorNotice("请输入转换金额")
+ return
+ }
+ if (!bank) {
+ errorNotice("请选择提现银行卡")
+ return
+ }
+ if (!pwd) {
+ errorNotice('请输入支付密码')
+ return
+ }
+ if (user.score < 1) {
+ errorNotice("余额不足")
+ return
+ }
+ loading('提现申请中...')
+ const data = card.filter(it => it.id == bank.value)
+ const re = await scoreWithdraw({
+ "account_name": data[0].account_name,
+ "account_number": data[0].account_number,
+ "amount": account,
+ "bank_branch": data[0].bank_branch,
+ "bank_name": data[0].bank_name,
+ "password": pwd
+ })
+ closeLoading()
+ if (!re) return
+ successNotice('提现成功')
+ setTimeout(() => {
+ backFn()
+ }, 1000)
+ }
return
立即提现
-
当前余额
- 50000
+ {user.score}
@@ -80,13 +114,27 @@ const Login = () => {
银行卡
-
+
+
+
+
+ 支付密码
+
+ {
+ setPwd(v.detail.value)
+ }} />
{
account && !!bank.value &&
-
+
}
@@ -94,7 +142,7 @@ const Login = () => {
confirmPicker(values, list)}
onClose={() => setVisible(false)}
diff --git a/src/pages/change-user/index.jsx b/src/pages/change-user/index.jsx
index ba93773..b51f3fe 100644
--- a/src/pages/change-user/index.jsx
+++ b/src/pages/change-user/index.jsx
@@ -8,18 +8,26 @@ import { Button } from "@nutui/nutui-react-taro"
import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
+import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
+import { modifyUser, userDetail } from "../../utils/api"
+import { useEffect } from "react"
const activeEye = eye
const uinfo = () => {
const [account, setAccount] = useState('')
- const [pwd, setPwd] = useState()
- const [uinfoMode, setuinfoMode] = useState('account')
+ const [user, setUser] = useState({})
- const [mobile, setMobile] = useState('')
- const [smsCode, setSmsCode] = useState('')
- const [interval, setIntervalTime] = useState(0)
+
+ useEffect(() => {
+ userDetail().then(rs => {
+ if (!rs) return
+ setUser(rs)
+ setAccount(rs.nick_name)
+ })
+
+ }, [])
// 返回页面
@@ -27,46 +35,22 @@ const uinfo = () => {
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
}
-
- // 去登陆
- const uinfoFn = () => {
- Taro.redirectTo({
- url: '/pages/uinfo/index'
- })
- }
-
- //清理数据
- const cleanFn = () => {
- if (uinfoMode === 'account') {
- setAccount('')
- setPwd('')
+ const submit = async () => {
+ if (!account) {
+ errorNotice("请输入要修改的昵称")
return
}
- setMobile('')
- setSmsCode('')
- }
-
- // 倒计时
- const countDown = () => {
- if (!mobile) {
- return
- }
- setIntervalTime(60)
- if (interval > 0) {
- return
- }
- let start = 60
- const timer = setInterval(() => {
- if (start > 0) {
- start--
- if (start <= 0) {
- clearInterval(timer)
- }
- setIntervalTime(start)
- }
+ loading('昵称修改中...')
+ const re = await modifyUser('nick_name', account)
+ closeLoading()
+ if (!re) return
+ successNotice('昵称修改成功')
+ setTimeout(() => {
+ backFn()
}, 1000)
}
+
return
@@ -75,7 +59,7 @@ const uinfo = () => {
-
+ {/*
用户名
{
@@ -86,20 +70,20 @@ const uinfo = () => {
}
-
+ */}
昵称
- {
- setPwd(v.detail.value)
+ {
+ setAccount(v.detail.value)
}} />
{
- pwd &&
+ account &&
}
-
+
diff --git a/src/pages/conversion/index.jsx b/src/pages/conversion/index.jsx
index b61dacc..acf32f5 100644
--- a/src/pages/conversion/index.jsx
+++ b/src/pages/conversion/index.jsx
@@ -9,48 +9,50 @@ import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
import { Picker } from "@nutui/nutui-react-taro"
+import { profitToScore, userDetail } from "../../utils/api"
+import { useEffect } from "react"
+import { closeLoading, errorNotice, loading, successNotice } from "../../utils/utils"
const activeEye = eye
const Login = () => {
const [account, setAccount] = useState('')
-
+ const [user, setUser] = useState({})
const [visible, setVisible] = useState(false)
const [bank, setBank] = useState({ value: 0, text: '' })
-
+ useEffect(() => {
+ userDetail().then(rs => {
+ if (!rs) return
+ setUser(rs)
+ })
+ }, [])
// 返回页面
const backFn = () => {
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
}
-
- const confirmPicker = (val, list) => {
- list.forEach(item => {
- console.log(item, "C")
- setBank(item)
- })
+ const submit = async () => {
+ if (!account) {
+ errorNotice("请输入转换金额")
+ return
+ }
+ if (user.profit < 1) {
+ errorNotice("余额不足")
+ return
+ }
+ loading('转换中...')
+ const re = await profitToScore(account)
+ closeLoading()
+ if (!re) return
+ successNotice('余额转换成功')
+ setTimeout(() => {
+ backFn()
+ }, 1000)
}
- const listData1 = [
- [
- { value: 1, text: '南京市', },
- { value: 2, text: '无锡市', },
- { value: 3, text: '海北藏族自治区', },
- { value: 4, text: '北京市', },
- { value: 5, text: '连云港市', },
- { value: 6, text: '浙江市', },
- { value: 7, text: '江苏市', },
- { value: 8, text: '大庆市', },
- { value: 9, text: '绥化市', },
- { value: 10, text: '潍坊市', },
- { value: 11, text: '请按市', },
- { value: 12, text: '乌鲁木齐市' },
- ],
- ]
-
return
@@ -60,7 +62,7 @@ const Login = () => {
当前收益
- 50000
+ {user.profit}
@@ -78,7 +80,7 @@ const Login = () => {
{
-
+
}
diff --git a/src/pages/home/index.jsx b/src/pages/home/index.jsx
index 38ea0f8..2575ad9 100644
--- a/src/pages/home/index.jsx
+++ b/src/pages/home/index.jsx
@@ -39,7 +39,7 @@ const Index = () => {
{ navigateTo('/pages/setting/index') }} />
- { navigateTo('/pages/message/index') }} />
+ { navigateTo('/pages/message-list/index') }} />
@@ -162,7 +162,9 @@ const Index = () => {
常用工具
-
+ {
+ navigateTo('/pages/invite/index')
+ }}>
diff --git a/src/pages/income/index.jsx b/src/pages/income/index.jsx
index af8a572..9eea4af 100644
--- a/src/pages/income/index.jsx
+++ b/src/pages/income/index.jsx
@@ -39,7 +39,7 @@ const Login = () => {
useEffect(() => {
let offset = (page - 1) * limit
- userLogs('shopping_score', offset, limit).then(rs => {
+ userLogs('profit', offset, limit).then(rs => {
if (!rs) return
setList(it => [...it, ...rs.items])
setTotal(rs.total)
@@ -59,13 +59,12 @@ const Login = () => {
我的收益
-
当前余额
- 50000
+ {user.profit}
diff --git a/src/pages/invite/index.config.js b/src/pages/invite/index.config.js
new file mode 100644
index 0000000..c9fe430
--- /dev/null
+++ b/src/pages/invite/index.config.js
@@ -0,0 +1,3 @@
+export default definePageConfig({
+ navigationBarTitleText: '邀请好友'
+})
diff --git a/src/pages/invite/index.jsx b/src/pages/invite/index.jsx
new file mode 100644
index 0000000..f22c985
--- /dev/null
+++ b/src/pages/invite/index.jsx
@@ -0,0 +1,109 @@
+import { View, Image, Text } from "@tarojs/components"
+import backNav from '@/images/backNav.png'
+import inviteBg from '@/images/inviteBg.png'
+import share from '@/images/share.png'
+import wechat from '@/images/wechat.png'
+import qrcode from '@/images/qrcode.png'
+import './index.scss'
+import { backTo, errorNotice, successNotice } from "../../utils/utils"
+import { userDetail } from "../../utils/api"
+import { useState } from "react"
+import jrQrcode from 'jr-qrcode'
+import { useEffect } from "react"
+import { Button } from "@nutui/nutui-react-taro"
+import config from "../../config/config"
+import Taro from "@tarojs/taro"
+import html2canvas from 'html2canvas';
+
+
+const Index = () => {
+
+ const [user, setUser] = useState({})
+ const [code, setCode] = useState('')
+
+ useEffect(() => {
+ userDetail().then(rs => {
+ if (!rs) return
+ setUser(rs)
+ const img = jrQrcode.getQrBase64(window.location.host + '/#/pages/index/index?code=' + rs.invite_code)
+ setCode(img)
+ })
+
+ }, [])
+
+ const backFn = () => {
+ backTo()
+ }
+
+ const genImage = () => {
+ const canvas = document.createElement("canvas")
+ let canvasBox = document.getElementById('imageWrapper')
+ const width = canvasBox.offsetWidth
+ const height = canvasBox.offsetHeight
+ canvas.width = width * 3
+ canvas.height = height * 3
+
+ const options = {
+ backgroundColor: '#F67952',
+ canvas: canvas,
+ useCORS: true,
+ y: 66,
+ allowTaint: true,
+ onrendered: (x) => {
+ console.log(x, "CCC")
+ }
+ };
+
+ html2canvas(canvasBox, options).then((canvas) => {
+ let dataURL = canvas.toDataURL("image/png");
+ //下载
+ downloadImage(dataURL);
+ //显示
+ })
+ }
+
+ const downloadImage = (url) => {
+ let link = document.createElement("a");
+ link.href = url;
+ link.setAttribute("download", "邀请码.png");
+ link.click();
+ }
+
+ const shareFn = async () => {
+ genImage()
+ }
+
+ return
+
+
+ 邀请好友
+
+
+
+
+ 邀请好友,福利多多
+
+ 邀请码:{user.invite_code}
+
+
+
+
+
+
+
+ 点击分享二维码
+
+
+
+ 分享至微信
+
+
+
+ 好友扫码加入
+
+
+
+}
+
+
+export default Index
\ No newline at end of file
diff --git a/src/pages/invite/index.scss b/src/pages/invite/index.scss
new file mode 100644
index 0000000..024cdd4
--- /dev/null
+++ b/src/pages/invite/index.scss
@@ -0,0 +1,79 @@
+.invite-container {
+ width: 100vw;
+ min-height: 100vh;
+ height: auto;
+ background: #F67952;
+}
+
+.invite-header {
+ background: #fff;
+}
+
+.invite-body {
+ width: 100vw;
+ margin-top: 60px;
+ position: relative;
+ z-index: 1;
+}
+
+.invite-body-bg {
+ width: 315px;
+ position: absolute;
+ top: 0px;
+ z-index: -1;
+}
+
+.invite-content {
+ z-index: 10;
+}
+
+.invite-body-title {
+ font-size: 20px;
+ color: #000;
+ margin-top: 40px;
+
+}
+
+.invite-code-img {
+ width: 168px;
+ height: 168px;
+}
+
+.invite-code-help {
+ font-weight: 400;
+ color: rgba(0, 0, 0, 0.5);
+ font-size: 16px;
+ margin-top: 6px;
+}
+
+.invite-btn {
+ width: 185px;
+ height: 46px;
+ border-radius: 123px 123px 123px 123px;
+ background: #F67952;
+ border: none;
+ color: #FFFFFF;
+ margin-top: 30px;
+ font-size: 16px;
+}
+
+.invite-footer {
+ width: 315px;
+ margin: 0 auto;
+ margin-top: 70px;
+ align-content: flex-start;
+ justify-items: flex-start;
+ align-items: flex-start;
+}
+
+.invite-action {
+ font-size: 12px;
+ color: #fff;
+ width: 78px;
+ text-align: center;
+}
+
+.invite-action-icon {
+ width: 24px;
+ margin-bottom: 8px;
+}
\ No newline at end of file
diff --git a/src/pages/message-detail/index.jsx b/src/pages/message-detail/index.jsx
index 6304c89..d189390 100644
--- a/src/pages/message-detail/index.jsx
+++ b/src/pages/message-detail/index.jsx
@@ -5,10 +5,25 @@ import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
import { useEffect } from "react"
+import { useRouter } from "@tarojs/taro"
+import { msgDetail } from "../../utils/api"
+import { formatDateByStr } from "../../utils/utils"
const Login = () => {
+ const params = useRouter().params
+ const [id] = useState(params.id)
+ const [detail, setDetail] = useState({})
+
+ useEffect(() => {
+ if (!id) return
+ msgDetail(id).then(rs => {
+ if (!rs) return
+ setDetail(rs)
+ })
+ }, [id])
+
// 返回页面
const backFn = () => {
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
@@ -21,10 +36,10 @@ const Login = () => {
消息中心
- 秒杀专区暂时下线公告
- 2023-05-23 13:12:00
+ {detail.title}
+ {formatDateByStr(detail.created_at)}
- 秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告
+ {detail.content}
diff --git a/src/pages/message-list/index.jsx b/src/pages/message-list/index.jsx
index db9eac1..77256aa 100644
--- a/src/pages/message-list/index.jsx
+++ b/src/pages/message-list/index.jsx
@@ -5,10 +5,25 @@ import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
import { useEffect } from "react"
-
+import { Infiniteloading } from "@nutui/nutui-react-taro"
+import empty from '@/images/empty.png'
+import { msgList } from "../../utils/api"
+import { formatDateByStr } from "../../utils/utils"
const Login = () => {
+ const limit = 20
+ const [page, setPage] = useState(1)
+ const [list, setList] = useState([])
+ const [total, setTotal] = useState(0)
+ useEffect(() => {
+ const offset = (page - 1) * limit
+
+ msgList({ offset, limit }).then(re => {
+ setList(it => [...it, ...re.items])
+ setTotal(re.total)
+ })
+ }, [page])
// 返回页面
const backFn = () => {
Taro.getCurrentPages().length > 0 && Taro.navigateBack()
@@ -25,33 +40,41 @@ const Login = () => {
消息中心
-
-
- 今天8:00
-
-
- 秒杀专区暂时下线公告
- 秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告
-
- { navDetail(1) }}>
- 查看详情
-
-
-
-
-
- 今天8:00
-
-
- 秒杀专区暂时下线公告
- 秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告
-
-
- 查看详情
-
-
-
-
+
+
+ }
+ loadIcon='loading'
+ hasMore={total > list.length}
+ onLoadMore={(x) => {
+ setPage(p => p + 1)
+ x()
+ }}
+ >
+ {
+ list.map(item => {
+ return
+ {formatDateByStr(item.created_at)}
+
+
+ {item.title}
+ {item.summary}
+
+ { navDetail(item.id) }}>
+ 查看详情
+
+
+
+
+ })
+ }
+
+ {
+ !list.length &&
+ }
}
diff --git a/src/pages/message-list/index.scss b/src/pages/message-list/index.scss
index 398eee9..700113f 100644
--- a/src/pages/message-list/index.scss
+++ b/src/pages/message-list/index.scss
@@ -37,6 +37,7 @@
.message-time {
color: #72778ac6;
+ font-size: 12px;
}
.message-item-title {
diff --git a/src/pages/order-detail/index.jsx b/src/pages/order-detail/index.jsx
index a2b033c..b36abb3 100644
--- a/src/pages/order-detail/index.jsx
+++ b/src/pages/order-detail/index.jsx
@@ -147,14 +147,6 @@ function Index() {
navigateTo(`/pages/settle/index?id=${detail.product_id}`)
}}>再次购买
-
-
- { setShowBasic(false) }}>
-
-
- {actionText}
-
-
)
}
diff --git a/src/pages/team/index.jsx b/src/pages/team/index.jsx
index be02100..35027ab 100644
--- a/src/pages/team/index.jsx
+++ b/src/pages/team/index.jsx
@@ -9,19 +9,32 @@ import { useState } from "react"
import Taro from "@tarojs/taro"
import backNav from '@/images/backNav.png'
import { Avatar } from "@nutui/nutui-react-taro"
+import { invitedAreas, invitedUser, userDetail } from "../../utils/api"
+import { useEffect } from "react"
+import { formatDateByStr } from "../../utils/utils"
const activeEye = eye
const Login = () => {
- const [account, setAccount] = useState('')
- const [pwd, setPwd] = useState()
- const [loginMode, setLoginMode] = useState('account')
-
- const [mobile, setMobile] = useState('')
- const [smsCode, setSmsCode] = useState('')
- const [interval, setIntervalTime] = useState(0)
+ const [user, setUser] = useState({})
+ const [list, setList] = useState([])
+ const [areas, setAreas] = useState({})
+ useEffect(() => {
+ userDetail().then(rs => {
+ if (!rs) return
+ setUser(rs)
+ })
+ invitedUser().then(rs => {
+ if (!rs) return
+ setList(rs.items ?? [])
+ })
+ invitedAreas().then(rs => {
+ if (!rs) return
+ setAreas(rs)
+ })
+ }, [])
// 返回页面
const backFn = () => {
@@ -29,44 +42,7 @@ const Login = () => {
}
- // 去登陆
- const loginFn = () => {
- Taro.redirectTo({
- url: '/pages/login/index'
- })
- }
- //清理数据
- const cleanFn = () => {
- if (loginMode === 'account') {
- setAccount('')
- setPwd('')
- return
- }
- setMobile('')
- setSmsCode('')
- }
-
- // 倒计时
- const countDown = () => {
- if (!mobile) {
- return
- }
- setIntervalTime(60)
- if (interval > 0) {
- return
- }
- let start = 60
- const timer = setInterval(() => {
- if (start > 0) {
- start--
- if (start <= 0) {
- clearInterval(timer)
- }
- setIntervalTime(start)
- }
- }, 1000)
- }
return
@@ -77,49 +53,43 @@ const Login = () => {
- 城市合伙人
+ {
+ user.is_city_partner && 城市合伙人
+ }
我的等级
-
- 0.00
+
+ {areas.largest}
大区业绩
-
- 0.00
+
+ {areas.lesser}
小区业绩
我邀请的人
-
-
-
-
- PB-60635
- 2021-04-09
+
+ {
+ list.map(item => {
+ return
+
+
+
+ {item.nick_name}
+ {formatDateByStr(item.created_at)}
+
+
+
+ {item.user_level?.name}
+
-
-
- V5
-
-
-
-
-
-
- PB-60635
- 2021-04-09
-
-
-
- V5
-
-
+ })
+ }
diff --git a/src/pages/team/index.scss b/src/pages/team/index.scss
index 2fcac02..541559f 100644
--- a/src/pages/team/index.scss
+++ b/src/pages/team/index.scss
@@ -49,6 +49,7 @@
.invite-container {
margin-top: 20px;
+ width: 100%;
}
.invite-title {
@@ -78,7 +79,7 @@
}
.invite-level {
- width: 38px;
+ padding: 0 8px;
height: 24px;
background: linear-gradient(117deg, #0F1732 0%, #2F3A58 100%);
border-radius: 12px;
diff --git a/src/pages/user-info/index.jsx b/src/pages/user-info/index.jsx
index 8aa6f2e..e86f687 100644
--- a/src/pages/user-info/index.jsx
+++ b/src/pages/user-info/index.jsx
@@ -13,8 +13,9 @@ import { useRouter } from '@tarojs/taro';
import { Button, Textarea, Address } from '@nutui/nutui-react-taro';
import { Avatar } from '@nutui/nutui-react-taro';
import { Overlay } from '@nutui/nutui-react-taro';
-import { userDetail } from '../../utils/api';
-import { navigateTo } from '../../utils/utils';
+import { modifyUser, userDetail } from '../../utils/api';
+import { closeLoading, errorNotice, loading, navigateTo, successNotice } from '../../utils/utils';
+import { upload } from '../../utils/request';
@@ -54,25 +55,37 @@ function Index() {
Taro.chooseImage({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
+ count: 1,
sourceType: [type], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
- success: function (res) {
+ success: async function (res) {
+ setVisible(false)
+ loading('头像上传中, 请稍后')
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
var tempFilePaths = res.tempFilePaths
- console.log(tempFilePaths)
+ try {
+ const re = await upload(tempFilePaths[0])
+ const r = await modifyUser('avatar', re.url)
+ closeLoading()
+ if (!r) return
+ successNotice('头像上传成功')
+ setUser({ ...user, avatar: re.url })
+ } catch {
+ errorNotice('头像上传失败')
+ }
}
})
}
return (
-
-
+
+
编辑资料
-
-
+
+
-
- { navigateTo('/pages/change-user/index') }}>
- 个人信息
+
+ { navigateTo('/pages/change-user/index') }}>
+ 个人信息
- { navigateTo('/pages/change-pwd/index') }}>
- 修改密码
+ { navigateTo('/pages/change-pwd/index') }}>
+ 修改密码
- { navigateTo('/pages/change-phone/index') }}>
- 修改手机号
+ { navigateTo('/pages/change-phone/index') }}>
+ 修改手机号
- { navigateTo('/pages/my-card/index') }}>
- 我的银行卡
+ { navigateTo('/pages/my-card/index') }}>
+ 我的银行卡
diff --git a/src/pages/user-info/index.scss b/src/pages/user-info/index.scss
index 5f81cf9..6d3494b 100644
--- a/src/pages/user-info/index.scss
+++ b/src/pages/user-info/index.scss
@@ -1,4 +1,4 @@
-.addr-container {
+.userInfo-container {
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-size: 14px;
background: #FBFBFD;
@@ -11,7 +11,7 @@
border-radius: 16px 16px 16px 16px;
}
-.addr-detail-title {
+.userInfo-detail-title {
width: 100vw;
height: 60px;
font-size: 18px;
@@ -24,7 +24,7 @@
justify-content: center;
}
-.addr-body {
+.userInfo-body {
padding: 21px;
height: auto;
box-sizing: border-box;
@@ -34,7 +34,7 @@
align-content: center;
}
-.addr-box {
+.userInfo-box {
width: 333px;
background: #FFFFFF;
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
@@ -43,7 +43,7 @@
padding: 0 12px;
}
-.addr-item {
+.userInfo-item {
width: 333px;
background: #FFFFFF;
box-shadow: 4px 7px 9px 0px rgba(56, 63, 68, 0.03);
@@ -60,7 +60,7 @@
font-size: 12px;
}
-.addr-form {
+.userInfo-form {
width: 308px;
box-sizing: border-box;
height: 48px;
@@ -73,18 +73,18 @@
font-size: 14px;
}
-.addr-form-name {
+.userInfo-form-name {
font-weight: bold;
color: #000000;
font-size: 15px;
margin-right: 10px;
}
-.addr-form-input {
+.userInfo-form-input {
width: 230px;
}
-.addr-btn {
+.userInfo-btn {
width: 233px;
height: 55px;
border-radius: 107px 107px 107px 107px;
@@ -98,12 +98,12 @@
left: calc((100vw - 233px)/2);
}
-.addr-item>.nut-textarea {
+.userInfo-item>.nut-textarea {
padding-left: 0;
padding-right: 0;
}
-.addr-item .weui-input {
+.userInfo-item .weui-input {
color: var(--nutui-textarea-text-color, var(--nutui-gray-1, #1a1a1a));
}
diff --git a/src/utils/api.js b/src/utils/api.js
index c88ffde..826b224 100644
--- a/src/utils/api.js
+++ b/src/utils/api.js
@@ -88,4 +88,38 @@ export const userLogs = async (type, data = {}) => {
export const transferAmount = async (data = {}) => {
return await p(`/users/assets/score-transfer`, data)
+}
+
+
+export const profitToScore = async (amount) => {
+ return await p(`/users/assets/profit-to-score`, { amount })
+}
+
+export const scoreWithdraw = async (data) => {
+ return await p(`/users/assets/score-withdraw`, data)
+}
+
+//
+export const modifyUser = async (field, value) => {
+ return await put(`/users/profile/fields`, { field, value })
+}
+
+export const invitedUser = async () => {
+ return await g(`/users/teams/invited-users`)
+}
+
+export const invitedAreas = async () => {
+ return await g(`/users/teams/invitee-areas`)
+}
+
+export const configs = async () => {
+ return await g('/config')
+}
+
+export const msgList = async (params) => {
+ return await g('/news', params)
+}
+
+export const msgDetail = async (id) => {
+ return await g(`/news/${id}`)
}
\ No newline at end of file
diff --git a/src/utils/request.js b/src/utils/request.js
index decf3c1..fb182ff 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -101,7 +101,7 @@ export function put(url, data, base) {
export const upload = async (file) => {
let base = config.api
if (config.debug) {
- base = config.debugApi
+ // base = config.debugApi
}
let jwt = GetData(JWT);
jwt = typeof jwt === 'string' ? jwt : ''
@@ -109,27 +109,35 @@ export const upload = async (file) => {
// 'Jwt': `Bearer ${jwt}`,
'Authorization': 'Bearer ' + jwt
}
- const re = await Taro.uploadFile({
- url: `${base}api/camp_chat/upload_image`,
- filePath: file,
- name: 'image',
- header: header,
- })
- if (re.statusCode == 200) {
- const resp = JSON.parse(re.data)
- if (resp.hasOwnProperty("data")) {
- return resp.data
+ try {
+ const re = await Taro.uploadFile({
+ url: `${base}/files`,
+ filePath: file,
+ name: 'file',
+ header: header,
+ fileName: 'file',
+ withCredentials: false
+ })
+
+ if (re.statusCode == 200) {
+ const resp = JSON.parse(re.data)
+ if (resp.hasOwnProperty("data")) {
+ return resp.data
+ }
}
+ } catch {
+ Taro.showModal({
+ "title": "信息提示",
+ showCancel: false,
+ "content": "上传失败",
+ mask: true
+ })
+ return null
}
- Taro.showModal({
- "title": "信息提示",
- showCancel: false,
- "content": re.errMsg,
- mask: true
- })
+
RequestError.prototype = Object.create(Error.prototype)
RequestError.prototype.constructor = RequestError
- throw new RequestError(re.errMsg, re.statusCode)
+ return null
}