暂时对接完接口

This commit is contained in:
tangping 2023-05-30 01:18:41 +08:00
parent 6d62c87253
commit 1ceaf78fb7
29 changed files with 610 additions and 266 deletions

View File

@ -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"

View File

@ -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.

View File

@ -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',

View File

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/assets/images/share.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,5 +1,6 @@
export default {
api: "http://1.14.121.134:9101",
debugApi: "http://1.14.121.134:9101",
home: '',
debug: false
}

View File

@ -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 = () => {
关于我们
</View>
<View className="flex-center about-logo">
<Image src={'https://img.yzcdn.cn/vant/cat.jpeg'} className="about-img" />
<Image src={about.logo} className="about-img" />
</View>
<View className="about-container flex-col justify-center">
<View className="about-item">
<Text>客服邮箱</Text>
<Text className="about-item-text">lhqjN@example.com</Text>
<Text className="about-item-text">{about.email}</Text>
</View>
<View className="about-item">
<Text>当前版本</Text>
<Text className="about-item-text">v1.0</Text>
<Text className="about-item-text">{about.version}</Text>
</View>
</View>
</View>

View File

@ -38,4 +38,5 @@
.about-logo {
margin-top: 40px;
width: 100%;
}

View File

@ -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 <View className="cash-frame bg-slate-50 h-screen text-base">
<View className='addr-detail-title'>
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
立即提现
</View>
<View className="cash-container relative">
<View className="cash-amount flex-col justify-center">
<Text>当前余额</Text>
<Text className="cash-amount-price">50000</Text>
<Text className="cash-amount-price">{user.score}</Text>
</View>
<View>
<View className="form-item mt-22">
@ -80,13 +114,27 @@ const Login = () => {
<View className="form-label">银行卡</View>
<View className="form-control relative">
<Input className="form-input" disabled placeholder="选择提现银行卡" value={bank.text} />
<Button className="code-btn" onClick={() => { setVisible(true) }}>选择银行卡</Button>
<Button className="code-btn" onClick={() => {
if (bankList.length < 1) {
errorNotice('请先添加银行卡')
return
}
setVisible(true)
}}>选择银行卡</Button>
</View>
</View>
<View className="form-item mt-22">
<View className="form-label">支付密码</View>
<View className="form-control relative">
<Input className="form-input" type={'password'} placeholder="请输入支付密码" onInput={(v) => {
setPwd(v.detail.value)
}} />
</View>
</View>
{
account && !!bank.value &&
<View className="cash-footer ">
<Button className="cash-btn">立即提现</Button>
<Button className="cash-btn" onClick={submit}>立即提现</Button>
</View>
}
</View>
@ -94,7 +142,7 @@ const Login = () => {
</View>
<Picker
isVisible={visible}
listData={listData1}
listData={bankList}
onConfirm={(values, list) => confirmPicker(values, list)}
onClose={() => setVisible(false)}

View File

@ -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 <View className="uinfo-frame bg-slate-50 h-screen text-base">
<View className='addr-detail-title'>
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
@ -75,7 +59,7 @@ const uinfo = () => {
</View>
<View className="uinfo-container bg-slate-50 relative">
<View>
<View className="form-item mt-22">
{/* <View className="form-item mt-22">
<View className="form-label">用户名</View>
<View className="form-control relative">
<Input className="form-input" placeholder="请输入用户名" onInput={(v) => {
@ -86,20 +70,20 @@ const uinfo = () => {
}
</View>
</View>
</View> */}
<View className="form-item mt-22">
<View className="form-label">昵称</View>
<View className="form-control relative">
<Input className="form-input" type='text' placeholder="请输入昵称" onInput={(v) => {
setPwd(v.detail.value)
<Input className="form-input" type='text' placeholder="请输入昵称" value={account} onInput={(v) => {
setAccount(v.detail.value)
}} />
{
pwd && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
account && <Image className="w-6 h-6 absolute right-0 bottom-16" src={checked} />
}
</View>
</View>
<View className="uinfo-footer flex flex-col justify-center">
<Button className="uinfo-btn">保存</Button>
<Button className="uinfo-btn" onClick={submit}>保存</Button>
</View>
</View>

View File

@ -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 <View className="conversion-frame bg-slate-50 h-screen text-base">
<View className='addr-detail-title'>
@ -60,7 +62,7 @@ const Login = () => {
<View className="conversion-container relative">
<View className="conversion-amount flex-col justify-center">
<Text>当前收益</Text>
<Text className="conversion-amount-price">50000</Text>
<Text className="conversion-amount-price">{user.profit}</Text>
</View>
<View>
<View className="form-item mt-22">
@ -78,7 +80,7 @@ const Login = () => {
{
<View className="conversion-footer ">
<Button className="conversion-btn">立即转换</Button>
<Button className="conversion-btn" onClick={submit}>立即转换</Button>
</View>
}
</View>

View File

@ -39,7 +39,7 @@ const Index = () => {
<View className='user-title flex-center'>
<View className='home-title-extra'>
<Image src={setting} className='home-title-icon' onClick={() => { navigateTo('/pages/setting/index') }} />
<Image src={message} className='home-title-icon' onClick={() => { navigateTo('/pages/message/index') }} />
<Image src={message} className='home-title-icon' onClick={() => { navigateTo('/pages/message-list/index') }} />
</View>
</View>
<View className='my-header flex-between'>
@ -162,7 +162,9 @@ const Index = () => {
常用工具
</View>
<View className='flex-around mt18'>
<View className='flex-col my-order-tool-item'>
<View className='flex-col my-order-tool-item' onClick={() => {
navigateTo('/pages/invite/index')
}}>
<View className="relative my-order-tool-box">
<Image className='my-tool-icon' src={friend} />
</View>

View File

@ -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 = () => {
<View className='addr-detail-title'>
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
我的收益
</View>
<View className="profit-container relative">
<View className="profit-amount flex-between ">
<View className="flex-col justify-between profit-amount-left">
<Text>当前余额</Text>
<Text className="profit-amount-price">50000</Text>
<Text className="profit-amount-price">{user.profit}</Text>
</View>
<View className="flex-around ">

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '邀请好友'
})

109
src/pages/invite/index.jsx Normal file
View File

@ -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 <View className="invite-container" id="imageWrapper">
<View className='addr-detail-title invite-header '>
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
邀请好友
</View>
<View className="invite-body relative flex-center" >
<View className="flex-col items-center invite-content">
<Text className="invite-body-title">邀请好友福利多多</Text>
<Image src={code} className="invite-code-img mt18" />
<View className="invite-code-help">邀请码{user.invite_code}</View>
<Button className="invite-btn" onClick={shareFn}>立即邀请</Button>
</View>
<Image src={inviteBg} className="invite-body-bg" id='invite-body-bg' />
</View>
<View className="invite-footer flex-between items-start ">
<View className="invite-action flex-col items-center">
<Image src={share} className="invite-action-icon" />
<View>点击分享二维码</View>
</View>
<View className="invite-action flex-col items-center">
<Image src={wechat} className="invite-action-icon" />
<View className="mt6">分享至微信</View>
</View>
<View className="invite-action flex-col items-center">
<Image src={qrcode} className="invite-action-icon" />
<View>好友扫码加入</View>
</View>
</View>
</View>
}
export default Index

View File

@ -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;
}

View File

@ -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 = () => {
消息中心
</View>
<View className="message-detail-container flex-col items-center">
<View className="message-detail-title">秒杀专区暂时下线公告</View>
<View className="message-detail-time">2023-05-23 13:12:00</View>
<View className="message-detail-title">{detail.title}</View>
<View className="message-detail-time">{formatDateByStr(detail.created_at)}</View>
<View className="message-detail-content">
秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告
{detail.content}
</View>
</View>
</View>

View File

@ -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 = () => {
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
消息中心
</View>
<View className="message-list-container flex-col">
<View className="message-item flex-col items-center mt-22">
<View className="message-time">今天8:00</View>
<View className="message-item-body mt-22">
<View className="message-item-content">
<View className="message-item-title">秒杀专区暂时下线公告</View>
<View className="mt20">秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告</View>
</View>
<View className="flex-between message-item-action" onClick={() => { navDetail(1) }}>
<Text>查看详情</Text>
<Image src={next} className="next-icon" />
</View>
</View>
</View>
<View className="message-item flex-col items-center mt-22">
<View className="message-time">今天8:00</View>
<View className="message-item-body mt-22">
<View className="message-item-content">
<View className="message-item-title">秒杀专区暂时下线公告</View>
<View className="mt20">秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告秒杀专区暂时下线公告</View>
</View>
<View className="flex-between message-item-action">
<Text>查看详情</Text>
<Image src={next} className="next-icon" />
</View>
</View>
</View>
<View className="message-list-container flex-col" id="newsScroll">
<Infiniteloading
containerId="newsScroll"
useWindow={false}
loadTxt="loading"
loadMoreTxt={<View></View>}
loadIcon='loading'
hasMore={total > list.length}
onLoadMore={(x) => {
setPage(p => p + 1)
x()
}}
>
{
list.map(item => {
return <View className="message-item flex-col items-center mt32" key={item.id}>
<View className="message-time">{formatDateByStr(item.created_at)}</View>
<View className="message-item-body mt-22">
<View className="message-item-content">
<View className="message-item-title">{item.title}</View>
<View className="mt20">{item.summary}</View>
</View>
<View className="flex-between message-item-action" onClick={() => { navDetail(item.id) }}>
<Text>查看详情</Text>
<Image src={next} className="next-icon" />
</View>
</View>
</View>
})
}
</Infiniteloading>
{
!list.length && <Image src={empty} className="order-empty" />
}
</View>
</View>
}

View File

@ -37,6 +37,7 @@
.message-time {
color: #72778ac6;
font-size: 12px;
}
.message-item-title {

View File

@ -147,14 +147,6 @@ function Index() {
navigateTo(`/pages/settle/index?id=${detail.product_id}`)
}}>再次购买</View>
</View>
<Popup visible={actionVisible} onClose={() => { setShowBasic(false) }}>
<View className='dialog-content flex-center'>
<Image src={success} className='w-4 h-4' />
<Text className='ml12'>{actionText}</Text>
</View>
</Popup>
</View>
)
}

View File

@ -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 <View className="login-frame team-page h-screen text-base">
<View className='addr-detail-title'>
@ -77,49 +53,43 @@ const Login = () => {
<View className="team-container flex-col items-center">
<View className="team-logo flex-col items-center">
<Image src={teamIcon} className="team-logo-img" />
<Text>城市合伙人</Text>
{
user.is_city_partner && <Text>城市合伙人</Text>
}
<Text className="team-logo-text">我的等级</Text>
</View>
<View className="team-pre-container flex-around">
<View className="team-pre-item flex-col justify-center">
<Text className="team-pre-price">0.00</Text>
<View className="team-pre-item flex-col justify-center items-center">
<Text className="team-pre-price">{areas.largest}</Text>
<Text>大区业绩</Text>
</View>
<View className="team-pre-item flex-col justify-center">
<Text className="team-pre-price">0.00</Text>
<View className="team-pre-item flex-col justify-center items-center">
<Text className="team-pre-price">{areas.lesser}</Text>
<Text>小区业绩</Text>
</View>
</View>
<View className="invite-container flex-col items-start">
<View className="invite-title">我邀请的人</View>
<View className="invite-item flex-between">
<View className="invite-item-left flex-start items-center">
<Avatar size={42} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
/>
<View className="flex-col invite-item-content">
<Text>PB-60635</Text>
<Text className="team-pre-item">2021-04-09</Text>
{
list.map(item => {
return <View className="invite-item flex-between" key={item.id}>
<View className="invite-item-left flex-start items-center">
<Avatar size={42} icon={item.avatar} alt={item.nick_name}
/>
<View className="flex-col invite-item-content">
<Text>{item.nick_name}</Text>
<Text className="team-pre-item">{formatDateByStr(item.created_at)}</Text>
</View>
</View>
<View className="invite-level">
<Text className="invite-level-text">{item.user_level?.name}</Text>
</View>
</View>
</View>
<View className="invite-level">
<Text className="invite-level-text">V5</Text>
</View>
</View>
<View className="invite-item flex-between">
<View className="invite-item-left flex-start items-center">
<Avatar size={42} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
/>
<View className="flex-col invite-item-content">
<Text>PB-60635</Text>
<Text className="team-pre-item">2021-04-09</Text>
</View>
</View>
<View className="invite-level">
<Text className="invite-level-text">V5</Text>
</View>
</View>
})
}
</View>
</View>
</View>

View File

@ -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;

View File

@ -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('头像上传中, 请稍后')
// tempFilePathimgsrc
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 (
<View className='addr-container'>
<View className='addr-detail-title'>
<View className='userInfo-container'>
<View className='userInfo-detail-title'>
<Image src={backNav} className="square-35 absolute left-10 nav-icon" onClick={backFn} />
编辑资料
</View>
<View className='addr-body' >
<View className=' addr-item'>
<View className='userInfo-body' >
<View className=' userInfo-item'>
<View className='item-bg' >
<View className='my-order-title flex-between'>
<Avatar size={46} icon={user.avatar} alt={user.nick_name}
@ -85,30 +98,30 @@ function Index() {
</View>
</View>
<View className='addr-item mt-22'>
<View className='addr-form' onClick={() => { navigateTo('/pages/change-user/index') }}>
<View className='addr-form-name'>个人信息</View>
<View className='userInfo-item mt-22'>
<View className='userInfo-form' onClick={() => { navigateTo('/pages/change-user/index') }}>
<View className='userInfo-form-name'>个人信息</View>
<View className='flex justify-between items-center ' >
<Label />
<Image src={next} className='next-icon' />
</View>
</View>
<View className='addr-form' onClick={() => { navigateTo('/pages/change-pwd/index') }}>
<View className='addr-form-name'>修改密码</View>
<View className='userInfo-form' onClick={() => { navigateTo('/pages/change-pwd/index') }}>
<View className='userInfo-form-name'>修改密码</View>
<View className='flex justify-between items-center ' >
<Image src={next} className='next-icon' />
</View>
</View>
<View className='addr-form' onClick={() => { navigateTo('/pages/change-phone/index') }}>
<View className='addr-form-name'>修改手机号</View>
<View className='userInfo-form' onClick={() => { navigateTo('/pages/change-phone/index') }}>
<View className='userInfo-form-name'>修改手机号</View>
<View className='flex justify-between items-center ' >
<Label>{user.phone}</Label>
<Image src={next} className='next-icon ml-2' />
</View>
</View>
<View className='addr-form' onClick={() => { navigateTo('/pages/my-card/index') }}>
<View className='addr-form-name'>我的银行卡</View>
<View className='userInfo-form' onClick={() => { navigateTo('/pages/my-card/index') }}>
<View className='userInfo-form-name'>我的银行卡</View>
<View className='flex justify-between items-center ' >
<Image src={next} className='next-icon' />
</View>

View File

@ -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));
}

View File

@ -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}`)
}

View File

@ -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
}