新增首页、打开页面、添加家人页面和个人中心页面

This commit is contained in:
aixianling
2024-11-26 09:56:27 +08:00
parent 5b36d282c4
commit f83091b0e6
16 changed files with 2494 additions and 0 deletions

View File

@@ -0,0 +1,441 @@
<template>
<div class="page">
<div class="header-bg">
<div class="header-info">
<div class="wrap" @click="handleLogin()">
<div class="user-img-div">
<img :src="user.avatarUrl" alt="" class="user-img" v-if="user.id && user.avatarUrl"/>
<img class="user-img" src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" v-else alt="">
</div>
<div class="user-info">
<div class="option">
<template v-if="!user.id">
<p>登录</p>
<p>点击进行登录</p>
</template>
<template v-else>
<p v-if="isApprove">{{ user.realName }}</p>
<p v-else>{{ user.nickName }}</p>
<p>{{ user.areaName || "" }}</p>
</template>
</div>
<p class="info" v-if="user.id" @click.stop="$linkTo('./userInfo')">个人信息</p>
</div>
</div>
</div>
</div>
<div class="approve" @click="$linkTo('./userInfo')">
<img class="icon" src="https://cdn.cunwuyun.cn/wxmp/mine/approve.png" alt="">
<div class="flex">
<span class="cert" v-if="isApprove" v-text="approveLabel"></span>
<u-icon v-else name="arrow-right" color="#E7F2FF" size="28"
:label="approveLabel" label-color="#E7F2FF" label-pos="left" @click="approve"/>
</div>
</div>
<div class="list-wrap">
<div class="card" v-for="(group,index) in listGroup" :key="index">
<div class="item" v-for="(item) in group" hover-class="bg-hover" :key="item.label"
@click="linkTo(item.path, item.type)">
<div class="block">
<img class="icon" :src="item.icon" alt="">
</div>
<span class="desc solid" v-if="!item.share">{{ item.label }}</span>
<button open-type="share" v-else>
<span>{{ item.label }}</span>
</button>
</div>
<!-- <div class="item" hover-class="bg-hover" @click="scan">
<div class="block">
<img class="icon" src="https://cdn.cunwuyun.cn/wxmp/mine/saoyisao.png" alt="">
</div>
<span class="desc">扫一扫</span>
</div> -->
</div>
</div>
<div class="logout" v-if="token">
<b class="login-out" @click="onLogout">退出登录</b>
</div>
<AiLogin ref="login" @success="getAuth()"/>
</div>
</template>
<script>
import {mapActions, mapState} from "vuex";
export default {
name: "AppMine",
appName: "我的",
customNavigation: true,
navigationBarBackgroundColor: '#ffffff',
navigationBarTextStyle: 'black',
computed: {
...mapState(['user', 'token']),
isApprove() {
return this.user?.status == 2;
},
approveLabel() {
return this.user?.areaId? "已认证" : "前往认证"
},
listGroup() {
return [
[
// {
// icon: "https://cdn.cunwuyun.cn/wxmp/mine/wodejiaxiang.png",
// label: "我的家乡",
// path: "/mods/AppHometown/AppHometown",
// type: 'token'
// },
{
icon: "https://cdn.cunwuyun.cn/wechat/biaopin/mine/mine-icon-wdjt.png",
label: "我的家庭",
path: "./myFamily",
type: 'token'
},
{
icon: "https://cdn.cunwuyun.cn/wechat/biaopin/mine/mine-icon-wdjf.png",
label: "我的积分",
path: "./myIntegral",
type: 'token'
},
{
icon: "https://cdn.cunwuyun.cn/wechat/biaopin/mine/mine-icon-wdewm.png",
label: "我的二维码",
path: "./myHarvestQR",
type: 'token'
},
{
icon: "https://cdn.cunwuyun.cn/wechat/biaopin/mine/mine-icon-sys.png",
label: "扫一扫",
path: "./myHarvestQR",
type: 'scan'
},
{
icon: "https://cdn.cunwuyun.cn/wechat/biaopin/mine/mine-icon-fxxcx.png",
label: "分享小程序",
path: "./myHarvestQR",
type: 'share',
share: true
},
],
// [
// {
// icon: "https://cdn.cunwuyun.cn/wxmp/mine/wodejifen.png",
// label: "我的积分",
// path: "/mods/AppCreditPoints/AppCreditPoints?type=detail",
// type: 'idNumber'
// },
// {
// icon: "https://cdn.cunwuyun.cn/wxmp/mine/chaoshidingdan.png",
// label: "超市订单",
// path: "/mods/AppOrderList/AppOrderList",
// type: 'idNumber'
// },
// {
// icon: "https://cdn.cunwuyun.cn/wxmp/mine/banshijindu.png",
// label: "办事进度",
// path: "/mods/AppProgress/AppProgress",
// type: 'idNumber'
// }
// ],
]
}
},
methods: {
...mapActions(['getUserInfo']),
approve() {
if (!this.token) {
this.$refs.login.show();
} else if (!this.isApprove) {
if (this.user.status == 0) {
this.$linkTo('/mods/AppAuth/AppAuth');
} else {
this.$linkTo('/mods/AppAuth/authSuccess')
}
}
},
linkTo(url, type) {
if (type) {
if (this.token) {
if (type == 'token') {
this.$linkTo(url)
}
if (type == 'idNumber') {
if (this.user.status == 0) {
if (!this.user.phone) {
this.$linkTo('/pages/phone/bingPhoneNumber?from=auth')
} else {
this.$linkTo('/mods/AppAuth/AppAuth')
}
} else {
this.$linkTo(url)
}
}
if (type == 'scan') {
this.scan()
}
if (type == 'share') {
}
if (type == 'null') {
this.$u.toast('内容建设中...')
}
} else {
this.$refs.login.show()
}
} else {
this.$linkTo(url)
}
},
handleLogin() {
if (!this.token) {
this.$refs.login.show();
}
},
getAuth() {
this.$nextTick(() => {
this.token && this.getUserInfo('qujing')
})
},
onLogout() {
uni.showModal({
title: '提示',
content: "是否要退出登录",
success: res => {
if (res.confirm) {
this.$store.commit('logout')
this.$toast('退出成功');
setTimeout(() => {
this.getAuth();
}, 500)
}
}
})
},
scan() {
uni.scanCode({
success: (res) => {
var info = JSON.parse(res.result)
uni.navigateTo({url: `./addFamily?avatarUrl=${info.avatarUrl || ''}&nickName=${info.nickName}&openId=${info.openId}`})
}
});
}
},
onLoad() {
this.getAuth();
uni.$on('auth',()=> {
this.getAuth();
})
},
onShareAppMessage() {
return {
title: '欢迎使用数字乡村治理服务一体化平台~',
path: `/pages/AppModules/AppModules`
}
},
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
min-height: 100%;
background-color: #F3F6F9;
position: relative;
.header-bg {
width: 100%;
height: 512px;
position: relative;
.header-info {
width: 100%;
height: 100%;
background: url('https://cdn.cunwuyun.cn/wechat/biaopin/mine/mine-top-bg.png') no-repeat;
background-size: 100% auto;
box-sizing: border-box;
padding: 240px 0 0 48px;
.wrap {
width: 100%;
height: 96px;
display: flex;
align-items: center;
.user-img-div {
display: inline-block;
width: 96px;
height: 96px;
border-radius: 50%;
overflow: hidden;
border: 4px solid #FFFFFF;
flex-shrink: 0;
.user-img {
display: inline-block;
width: 96px;
height: 96px;
border-radius: 58px;
}
}
.user-info {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
margin-left: 26px;
box-sizing: border-box;
padding-right: 32px;
.option {
& > p:first-child {
font-size: 34px;
font-weight: 600;
color: #333333;
line-height: 54px;
}
& > p:last-child {
font-size: 26px;
font-weight: 400;
color: #7088A0;
line-height: 36px;
}
}
.info {
width: 136px;
height: 48px;
border-radius: 8px;
border: 2px solid #7088A0;
font-size: 26px;
font-weight: 400;
color: #7088A0;
display: flex;
align-items: center;
justify-content: center;
}
}
}
}
}
.approve {
position: absolute;
left: 50%;
top: 400px;
transform: translateX(-50%);
width: 686px;
height: 112px;
background: linear-gradient(90deg, #8FB4FF 0%, #4181FF 100%);
border-radius: 16px;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 20px;
.icon {
width: 296px;
height: 52px;
}
.cert {
font-family: PingFangSC-Regular, PingFang SC;
font-size: 28px;
color: #E7F2FF;
margin-right: 4px;
}
}
.list-wrap {
box-sizing: border-box;
padding: 32px;
.card {
width: 100%;
min-height: 100px;
border-radius: 16px;
background-color: #fff;
margin-bottom: 32px;
.item {
height: 100px;
display: flex;
align-items: center;
&:last-child {
.desc {
// border-bottom: none !important;
}
}
.block {
width: 80px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
.icon {
width: 44px;
height: 44px;
}
}
.desc, & > button {
height: 100%;
flex: 1;
font-size: 30px;
font-weight: 400;
color: #666666;
display: flex;
align-items: center;
box-sizing: border-box;
& > span {
width: 100%;
height: 100%;
text-align: left;
display: flex;
align-items: center;
}
&::after {
border: none;
}
}
.solid {
border-bottom: 1px solid #EEE;
}
.no-border {
border-bottom: none;
}
}
&:first-of-type {
margin-bottom: 32px;
}
}
}
.logout {
width: 100%;
height: 96px;
padding: 0 32px;
box-sizing: border-box;
line-height: 96px;
text-align: center;
.login-out {
background: #FFF;
border-radius: 16px;
font-size: 34px;
font-weight: 500;
color: #4181FF;
}
}
}
</style>

View File

@@ -0,0 +1,84 @@
<template>
<div class="page">
<div class="content">
<img :src="familyInfo.avatarUrl" alt="" v-if="familyInfo.avatarUrl">
<img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" v-else>
<p class="user-name">{{familyInfo.nickName}}</p>
<div class="btn" @click="add">加为家人</div>
</div>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
appName: "加家人",
computed: {
...mapState(['user', 'token'])
},
data() {
return {
familyInfo: {}
}
},
onLoad(options) {
this.familyInfo = {...options}
},
methods: {
add() {
this.$instance.post(`/app/appwechatuserrelation/addRelation?openId=${this.familyInfo.openId}`).then(res=> {
if(res.code == 0) {
this.$u.toast('添加成功')
setTimeout(() => uni.navigateBack({}), 1500)
}
}).catch(err => {
this.$u.toast(err)
})
}
}
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
height: 100vh;
padding: 32px 32px 96px 32px;
box-sizing: border-box;
background-color: #f3f6f9;
.content {
width: 100%;
height: 100%;
background-color: #fff;
border-radius: 8px;
text-align: center;
img {
width: 176px;
height: 176px;
border-radius: 88px;
margin: 160px auto 24px auto;
}
.user-name {
margin-bottom: 100px;
line-height: 42px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 36px;
color: #333;
}
.btn {
width: 400px;
height: 80px;
text-align: center;
line-height: 80px;
background: #4181FF;
border-radius: 44px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 34px;
color: #FFF;
margin: 0 auto;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,133 @@
<template>
<div class="page">
<div class="user-list" v-if="list.length">
<div class="item">
<div class="item-left">
<img :src="user.avatarUrl" alt="">
<div class="user-info">
<h3>{{user.nickName}}</h3>
<p>{{user.girdName || ''}}</p>
</div>
</div>
</div>
<div class="item" v-for="(item, index) in list" :key="index" v-if="user.openId != item.openId">
<div class="item-left">
<img :src="item.avatarUrl" alt="" v-if="item.avatarUrl">
<img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" v-else>
<div class="user-info">
<h3>{{item.nickName}}</h3>
<p>{{item.girdName || ''}}</p>
</div>
</div>
<div class="item-right">
<div @click="toTransfer(item)">转积分</div>
</div>
</div>
</div>
<AiEmpty v-else/>
<p class="bottom-text">如果绑定错误请联系网格员解绑</p>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
appName: "我的家庭",
computed: {
...mapState(['user', 'token'])
},
data() {
return {
list: [],
userInfo: {}
}
},
onLoad() {
this.getList()
},
methods: {
getList() {
this.$instance.post(`/app/appwechatuserrelation/list`).then(res => {
if (res.code === 0 && res.data) {
this.list = res.data
}
})
},
toTransfer(row) {
uni.navigateTo({url: `./transferIntrgral?openId=${row.openId}&nickName=${row.nickName}&avatarUrl=${row.avatarUrl || ''}`})
}
},
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
height: 100vh;
background-color: #f3f6f9;
.user-list {
padding: 32px 32px 0;
height: calc(100% - 180px);
overflow-y: scroll;
.item {
padding: 26px;
background-color: #fff;
display: flex;
margin-bottom: 24px;
.item-left {
width: calc(100% - 150px);
display: flex;
img {
width: 108px;
height: 108px;
border-radius: 54px;
}
.user-info {
margin-left: 20px;
h3 {
line-height: 42px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 32px;
color: #333;
margin-bottom: 10px;
}
p {
font-family: PingFangSC-Regular;
font-size: 24px;
color: #999;
line-height: 40px;
}
}
}
.item-right {
width: 150px;
div {
width: 126px;
height: 56px;
line-height: 56px;
text-align: center;
background: #2D7DFF;
border-radius: 30px;
font-family: PingFangSC-Regular;
font-size: 26px;
color: #FFF;
margin-top: 26px;
}
}
}
}
.bottom-text {
line-height: 34px;
font-family: PingFangSC-Regular;
font-size: 24px;
color: #999;
position: fixed;
bottom: 92px;
left: 180px;
}
}
</style>

View File

@@ -0,0 +1,125 @@
<template>
<div class="AppHarvestQR">
<div class="card">
<div class="myself">
<img class="avatar" :src="user.avatarUrl" alt="" v-if="user.avatarUrl">
<img class="avatar" src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" v-else>
<div class="info">
<div class="name">{{ user.nickName }}</div>
<div class="area">{{ user.areaName }}</div>
</div>
</div>
<div class="qr">
<img :src="user.qrCode" alt="">
</div>
<div class="my-qr">我的丰收码</div>
<div class="pic">
<img src="https://cdn.cunwuyun.cn/fengdu/img-zhuangshi.png" alt="">
</div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "AppHarvestQR",
data() {
return {
qrCode: '',
}
},
methods: {
getQrCode() {
this.$instance.post('/app/appwechatuserqujing/queryMyQrCode').then(res=> {
if(res?.data) {
this.qrCode = res.data
}
})
}
},
computed: {
...mapState(['user'])
},
onLoad() {
// this.getQrCode()
uni.setNavigationBarTitle({
title: '我的丰收码'
})
}
}
</script>
<style lang="scss" scoped>
.AppHarvestQR {
padding: 32px;
box-sizing: border-box;
.card {
width: 100%;
height: 100%;
box-sizing: border-box;
border-radius: 16px;
background: #FFF;
.myself {
padding: 72px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
.avatar {
width: 108px;
height: 108px;
border-radius: 16px;
}
.info {
width: calc(100% - 128px);
height: 100%;
.name {
color: #333333;
font-size: 34px;
font-weight: 500;
margin-top: 10px;
}
.area {
color: #999999;
font-size: 28px;
font-weight: 400;
margin-top: 10px;
}
}
}
.qr {
margin: 10% auto 24px;
width: 542px;
height: 542px;
border-radius: 32px;
border: 8px solid #f6f5f8;
padding: 36px;
box-sizing: border-box;
img {
width: 100%;
height: 100%;
}
}
.my-qr {
color: #999999;
font-size: 32px;
font-weight: 400;
text-align: center;
}
.pic {
margin-top: 10%;
width: 100%;
height: 234px;
img {
width: 100%;
height: 234px;
}
}
}
}
</style>

View File

@@ -0,0 +1,224 @@
<template>
<div class="myIntegral">
<div class="header-content">
<div class="top">
<div class="total">
<h1>{{info.integral || '0'}}</h1>
<p>积分余额</p>
</div>
<div class="total right-total">
<h1>{{info.houseIntegral || '0'}}</h1>
<p>家庭积分</p>
</div>
</div>
<div class="bottom">
<div class="item">
<div class="num">{{ info.serialNo || '0'}}</div>
<div class="label">积分排行</div>
</div>
<div class="item">
<div class="num">{{ info.totalIntegral|| '0'}}</div>
<div class="label">历史累计获取</div>
</div>
</div>
<img src="https://cdn.cunwuyun.cn/dvcp/credit/head.png" alt="">
</div>
<div class="detail-content" v-if="list && list.length">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="item-info">
<p>{{ item.integralRuleName || ''}}
<span v-if="item.integralRuleName && item.eventDesc">:</span>
{{ item.eventDesc || '' }}</p>
<span>&nbsp;&nbsp;&nbsp;{{ item.doTime }}</span>
</div>
<div class="item-num" :class="'color-'+ item.integralCalcType">
{{ (item.integralCalcType == 1 ? '+' : '-') + item.changeIntegral }}
</div>
</div>
</div>
<AiEmpty v-else/>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "myIntegral",
appName: "我的积分",
computed: {
...mapState(['user', 'token'])
},
data() {
return {
info: {},
current: 1,
list: [],
}
},
mounted() {
this.getToatl()
},
methods: {
getToatl() {
this.$instance.post(`/app/appintegraluser/integralUserInfoFD`).then(res => {
if (res?.data) {
this.info = res.data
this.getList()
}
})
},
getList() {
this.$instance.post(`/app/appintegraldetail/list?integralUserId=${this.info.id}&current=${this.current}&size=10`).then(res => {
if (res?.data) {
if (this.current > res.data.pages) {
return
}
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
}
})
},
},
onReachBottom() {
this.current++
this.getList()
}
}
</script>
<style scoped lang="scss">
.myIntegral {
width: 100vw;
overflow-x: hidden;
height: calc(100% - 136px);
background-color: #f3f6f9;
padding-bottom: 30px;
.header-content {
width: 690px;
height: 358px;
background: #FFF;
border-radius: 16px;
margin: 70px 0 40px 30px;
position: relative;
.top {
width: 100%;
height: 213px;
z-index: 99;
position: relative;
.total {
width: 50%;
padding-top: 48px;
box-sizing: border-box;
text-align: center;
h1 {
font-size: 68px;
color: #5AAD6A;
}
p {
font-size: 28px;
font-weight: 400;
color: #999999;
}
}
.right-total {
position: absolute;
top: 0;
right: 0;
h1 {
color: #4083E9;
}
}
}
.bottom {
display: flex;
justify-content: space-around;
width: 100%;
height: 145px;
padding: 16px 0;
box-sizing: border-box;
border-top: 2px solid #EEEEEE;
.item {
text-align: center;
z-index: 99;
.num {
font-family: DIN;
font-size: 48px;
font-weight: bold;
color: #333333;
}
.label {
font-size: 24px;
color: #999;
margin-top: 10px;
}
}
}
img {
position: absolute;
width: 360px;
height: 250px;
top: -40px;
right: 0;
}
}
.detail-content {
width: 690px;
background: #FFF;
border-radius: 16px;
margin: 0 0 0 32px;
padding: 16px 30px;
box-sizing: border-box;
.item {
padding: 34px 0 32px 0;
border-bottom: 2px solid #ddd;
display: flex;
.item-info {
width: 500px;
p {
word-break: break-all;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
line-height: 44px;
}
span {
display: inline-block;
margin-top: 8px;
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999;
line-height: 34px;
}
}
.item-num {
width: calc(100% - 500px);
text-align: right;
font-size: 36px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
line-height: 50px;
}
}
.item:last-child {
border-bottom: none;
}
}
.color-1 {
color: #2C51CE !important;
}
.color-0 {
color: #E6736E !important;
}
}
</style>

View File

@@ -0,0 +1,130 @@
<template>
<div class="page">
<div class="content">
<p class="text">积分收入方</p>
<img :src="userInfo.avatarUrl" alt="" v-if="userInfo.avatarUrl">
<img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" v-else>
<p class="user-name">{{userInfo.nickName}}</p>
<u-input v-model="num" type="number" placeholder="请输入积分数量" :maxlength="11" :border="true" input-align="center" border-color="#ddd" height="76" class="input-num" />
<p class="num-text">剩余积分余额{{total}}</p>
<div class="btn" @click="confirm">确认转出</div>
</div>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
appName: "我的家庭",
computed: {
...mapState(['user', 'token'])
},
data() {
return {
num: '',
total: '',
userInfo: {}
}
},
onLoad(options) {
this.userInfo = {...options}
this.getIntegral()
},
methods: {
getIntegral() {
this.$instance.post(`/app/appintegraluser/girdDetail?id=${this.user.openId}`).then(res => {
if (res.code === 0) {
this.total = res.data.integral || 0
}
})
},
confirm() {
if (!/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/g.test(this.num)) {
this.num = ''
return this.$message.error('积分数量最多只保留两位小数点')
}
if (this.num > this.total) {
return this.$u.toast('转出积分不能大于剩余积分')
}
this.$instance.post(`/app/appintegraluser/transferIntegral`,{
fromId: this.user.openId,
ids: [this.userInfo.openId],
integral: this.num,
integralUserType: '3',
integralCalcType: '1'
}).then(res => {
if (res.code === 0) {
this.$u.toast('积分转出成功!')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
}
}
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
height: 100vh;
padding: 32px 32px 96px 32px;
box-sizing: border-box;
background-color: #f3f6f9;
.content {
width: 100%;
height: 100%;
background-color: #fff;
border-radius: 8px;
text-align: center;
.text {
padding-top: 96px;
line-height: 40px;
font-family: PingFangSC-Regular;
font-size: 28px;
color: #999;
margin-bottom: 26px;
}
img {
width: 176px;
height: 176px;
border-radius: 88px;
margin: 0 auto 24px auto;
}
.user-name {
margin-bottom: 100px;
line-height: 42px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 36px;
color: #333;
}
.input-num {
width: calc(100% - 144px);
margin: 0 0 16px 72px;
}
.num-text {
color: #222;
font-size: 28px;
font-family: PingFangSC;
font-weight: 400;
line-height: 40px;
margin-bottom: 82px;
}
.btn {
width: 400px;
height: 80px;
text-align: center;
line-height: 80px;
background: #4181FF;
border-radius: 44px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 34px;
color: #FFF;
margin: 0 auto;
}
}
}
</style>

View File

@@ -0,0 +1,398 @@
<template>
<div class="page">
<div class="info-list">
<div class="item-content mar-b8">
<div class="item solid">
<p class="mar-t22">头像</p>
<!-- <button class="user-img-div" v-if="editAvatarUrl" open-type="chooseAvatar" @chooseavatar="handleWeixinSync">
<img v-if="user.avatarUrl && !avatar" :src="user.avatarUrl" class="user-img">
<img v-if="avatar" :src="avatar" alt="" class="user-img">
<img v-if="!user.avatarUrl && !avatar" src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img">
</button> -->
<div class="user-img-div" v-if="editAvatarUrl">
<AiUploader v-model="avatarUrlList" multiple placeholder="上传头像" :limit="1"></AiUploader>
</div>
<div class="user-img-div" v-else>
<img v-if="user.avatarUrl && !avatar" :src="user.avatarUrl" class="user-img">
<img v-else src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img">
</div>
</div>
<div class="item">
<p>用户昵称</p>
<div class="item-right" v-if="!editNickName">
<p class="name">{{ user.nickName }}</p>
</div>
<input class="item-right" v-else type="text" v-model="userName">
</div>
</div>
<div class="item-content mar-b8">
<div class="item">
<p>手机号</p>
<div class="item-right" v-if="!!!editPhone">
<p class="name">{{ user.phone || ''}}</p>
</div>
<input class="item-right" v-else type="number" v-model="userPhone" maxlength="11">
</div>
</div>
<div class="item-content mar-b8">
<!-- <div class="item solid">
<p>真实姓名</p>
<div class="item-right" v-if="!editRealName">
<p class="name">{{ user.realName || '' }}</p>
</div>
<input class="item-right" v-else type="text" v-model="userRealName" @input="idNumberInput">
</div>
<div class="item solid">
<p>身份证号</p>
<div class="item-right" v-if="!editIdNumber">
<p class="name">{{ user.idNumber || '' }}</p>
</div>
<input class="item-right" v-else type="idNumber" v-model="userIdNumber" maxlength="18" @input="idNumberInput">
</div> -->
<div class="item">
<p>所属网格</p>
<div class="item-right" v-if="!editGird">
<p class="name">{{ user.girdName || '' }}</p>
</div>
<AiPagePicker type="gird" class="item-right" v-model="userGirdId" :params="{formType:2}" @select="handleSelectGrid" nodeKey="id" v-else>
<AiMore v-model="userGirdName" />
</AiPagePicker>
</div>
</div>
<div class="btn-wrapper btn-edit">
<b class="btn" @click="btnText? submit(): editBtn()">{{ btnText? '提交': '修改' }}</b>
</div>
</div>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: "userInfo",
computed: {
...mapState(['user', 'token']),
},
onLoad(o) {
this.isFromTabbar = o.isFromTabbar
this.path = o.path
this.getUserInfo('qujing')
uni.setNavigationBarTitle({
title: '个人中心'
})
},
data() {
return {
editAvatarUrl: false,
editNickName: false,
editPhone: false,
editRealName: false,
editIdNumber: false,
editGird: false,
avatar: '',
userName: '',
userPhone: '',
userRealName: '',
userIdNumber: '',
userGirdId: '',
userGirdName: '',
btnText: false,
isFromTabbar: '',
path: '',
avatarUrlList: []
}
},
methods: {
...mapActions(['getUserInfo', 'autoLogin']),
editBtn() {
this.btnText = true
this.editAvatarUrl = true;
this.avatar = this.user.avatarUrl
this.editNickName = true;
this.userName = this.user.nickName
this.editPhone = true;
this.userPhone = this.user.phone
this.editRealName = true;
this.userRealName = this.user.realName
this.editIdNumber = true;
this.userIdNumber = this.user.idNumber
this.editGird = true
this.userGirdId = this.user.girdId
this.userGirdName = this.user.girdName
this.avatarUrlList = [{'url': this.user.avatarUrl}]
},
submit() {
if(this.flag) return
if(!this.avatarUrlList.length) {
return this.$u.toast('请上传头像')
}
if (!this.userName) {
return this.$u.toast('请输入用户昵称')
}
if (this.userName == '微信用户') {
return this.$u.toast('请修改用户昵称')
}
if (!this.userPhone) {
return this.$u.toast('请输入手机号')
}
// if (!this.userRealName) {
// return this.$u.toast('请输入真实姓名')
// }
// if (!this.userIdNumber) {
// return this.$u.toast('请输入身份证号')
// }
// if (!this.$idCardNoUtil.checkIdCardNo(this.userIdNumber)) {
// return this.$u.toast('请输入正确的身份证号码')
// }
if (!this.userGirdId) {
return this.$u.toast('请选择所属网格')
}
// if (!this.userAreaId) {
// return this.$u.toast('请选择所属地区')
// }
// if (!/[^0]0{0,2}$/.test(this.userAreaId)) {
// return this.$u.toast('所属地区必须选到村级')
// }
this.flag = true
this.$instance.post(`/app/appwechatuserqujing/idNumberAttestation`, {
// avatarUrl: this.avatar,
avatarUrl: this.avatarUrlList[0].url,
nickName: this.userName,
phone: this.userPhone,
name: this.userName,
idNumber: this.userIdNumber,
girdId: this.userGirdId,
girdName: this.userGirdName
}).then(res=> {
if(res?.code==0) {
this.$u.toast('提交成功')
this.autoLogin({ loginWay:'qujing'})
uni.$emit('auth')
setTimeout(() => {
if (this.isFromTabbar == 1) {
uni.switchTab({ url: this.path })
} else {
uni.navigateBack()
}
}, 600);
}
}).catch(err=> {
this.$u.toast(err.msg)
})
},
upLoad(img) {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${this.$instance.defaults.baseURL}/admin/file/add`,
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token')
},
success: uploadFileRes => {
this.avatar = JSON.parse(uploadFileRes.data).data[0].split(';')[0]
resolve(uploadFileRes)
},
fail: err => {
reject(err)
}
})
})
},
handleWeixinSync({detail}) {
const { avatarUrl } = detail
if(avatarUrl?.length) {
this.upLoad(avatarUrl)
}
},
handleSelectGrid(v) {
this.userGirdName = v.girdName
this.userGirdId = v.id
},
idNumberInput() {
if(this.userIdNumber.length == 18 && this.userRealName) {
if(!this.userGirdId) {
this.$instance.post(`/app/appresidentapplet/queryDetailByIdNumberAndName`,{
name: this.userRealName,
idNumber: this.userIdNumber
}).then(res=> {
if(res.data && res.data.id) {
this.userGirdId = res.data.id
this.userGirdName = res.data.girdName
}
})
}
}
}
}
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
background-color: #F5F5F5;
.info-list {
padding: 50px 32px 0 32px;
box-sizing: border-box;
.item-content {
padding: 0 32px;
box-sizing: border-box;
background-color: #fff;
border-radius: 32px;
}
.item {
padding: 36px 0;
line-height: 40px;
width: 100%;
box-sizing: content-box;
display: flex;
p {
color: #333;
font-weight: 400;
width: 200px;
}
div {
color: #666;
font-size: 28px;
}
.item-right {
width: calc(100% - 200px);
text-align: right;
font-size: 28px;
p {
width: 100%;
}
.ai-area__wrapper {
display: flex;
align-items: center;
padding-left: 100px;
span {
color: #333;
font-size: 30px;
}
i {
color: #999;
font-size: 30px;
}
image {
width: 16px;
height: 8px;
}
}
}
::v-deep .AiAreaPicker {
float: right;
}
.user-img-div {
width: calc(100% - 200px);
text-align: right;
display: inline-block;
}
.user-img {
width: 104px;
height: 104px;
vertical-align: middle;
border-radius: 50%;
}
.right-icon {
width: 40px;
height: 40px;
vertical-align: middle;
}
.mar-t22 {
margin-top: 44px;
}
}
.login-out {
width: 100%;
font-size: 30px;
text-align: center;
color: #4181FF;
}
}
.self-knowledge-show {
position: fixed;
left: 0;
top: 0;
z-index: 100;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.3);
}
.toast-bg {
position: fixed;
z-index: 101;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.toast {
background-color: #fff;
width: 686px;
height: 316px;
font-size: 36px;
}
.toast-msg {
text-align: center;
line-height: 50px;
color: #333;
font-weight: 500;
padding: 84px 0 80px 0;
}
.toast-btn {
display: inline-block;
width: 120px;
text-align: center;
line-height: 50px;
}
.cancel {
margin-left: 394px;
margin-right: 40px;
}
.confirm {
color: #197DF0;
}
.btn-edit {
background: #FFF;
}
::v-deep.ai-uploader {
text-align: right;
display: inline-block;
.imgList {
width: 228px;
height: 200px;
display: inline-block!important;
}
}
}
</style>