feat(): 个人信息修改

master
李神峰 2024-11-06 15:55:25 +08:00
parent b9c766102d
commit 3992d1e3a0
10 changed files with 456 additions and 636 deletions

View File

@ -12,8 +12,8 @@
console.log(token.secretKey,'App Launch')
} else {
uni.reLaunch({
// url: '/pages/login/login'
url:'/pages/ylzList/detail/index'
url: '/pages/login/login'
// url:'/pages/mypage/mypage'
})
console.log(token.secretKey,'App Launch2')
}

View File

@ -346,12 +346,6 @@
"selectedIconPath": "static/tabs/home2.png",
"text": "首页"
},
{
"pagePath": "pages/addressBook/addressBook",
"iconPath": "/static/tabs/phone_icon@2x.png",
"selectedIconPath": "static/tabs/phone_icon@2x2.png",
"text": "通讯录"
},
{
"pagePath": "pages/mypage/mypage",
"iconPath": "/static/images/my2_icon@2x.png",

View File

@ -71,7 +71,7 @@
import moment from "moment"
import drpOption from './jrxOptions';
import JcsjTable from "./jcsjTable"
const stm = moment().subtract(7, 'months').add(1, 'hour').set({minute: 0, second: 0}).format("YYYY-MM-DD HH:mm");
const stm = moment().subtract(1, 'days').add(1, 'hour').set({minute: 0, second: 0}).format("YYYY-MM-DD HH:mm");
const etm = moment().add(1, 'hour').set({minute: 0, second: 0}).format("YYYY-MM-DD HH:mm");
export default {

View File

@ -8,7 +8,7 @@
</image>
</div>
<div class="info_name">
<div v-if="userList.userName">{{ userList.userName }}</div>
<div v-if="userList.userName">{{ userList.nickName }}</div>
<div v-if="userList.dept">
{{ userList.dept.deptName || '' }}
</div>
@ -26,7 +26,7 @@
<!-- nav -->
<view class="navBar" style="display: flex;flex-wrap: wrap;">
<div class="navList" v-for="(item, index) in getNavList" :key="index">
<div @click="myNavigateTo(item.url,item.value)">
<div @click="myNavigateTo(item.url,item.value)" style="display:flex;flex-direction: column;align-items: center;">
<div class="navIcon">
<image style="width: 100%; height: 100%" :src="item.icon" mode="aspectFit"></image>
<div class="readStatus" v-show="
@ -118,39 +118,6 @@
yjStatus: 0,
// limit: disType(uni.getStorageSync('value').adcd),
limit: 1,
timeList: [{
text: '昨天08:00~当前时间',
value: 1
},
{
text: '今天08:00~当前时间',
value: 2
},
{
text: '昨天08:00~今天08:00',
value: 3
},
{
text: '最近1小时',
value: 4
},
{
text: '最近3小时',
value: 5
},
{
text: '最近6小时',
value: 6
},
{
text: '最近12小时',
value: 7
},
{
text: '最近24小时',
value: 8
}
],
value1: 3,
rainChartData: [],
formData: {
@ -168,7 +135,6 @@
},
rainChartData: [],
chartData: {},
subList: ['河道水情', '水库水情'],
current: 0,
hdList: [],
skList: [],
@ -186,7 +152,8 @@
},
interval: null,
numPic: 0,
allStatus: false
allStatus: false,
ylzList:[],
}
},
onPullDownRefresh() {
@ -208,73 +175,40 @@
},
computed: {
getNavList() {
// const adcd = uni.getStorageSync('value').adcd
// let lever = 0
// if (adcd?.endsWith('000000000')) {
//
return [{
value: '雨情',
return [
{
value: '巡查任务',
key: 1,
icon: '../../static/tabs/xingzhuang2.png',
url: '/pages/rain/rain'
},
{
value: '水情',
key: 2,
icon: '../../static/tabs/water2.png',
url: '/pages/water/water'
},
{
value: '工情灾情',
key: 3,
icon: '../../static/tabs/gongqing2.png',
url: '/pages/gqzq/index'
},
{
value: '信息上报',
key: 4,
icon: '../../static/tabs/xinxi_icon@2x2.png',
url: '/pages/xxsb/index'
},
{
value: '预警',
key: 5,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/forewarning/forewarning'
},
{
value: '巡查任务111',
key: 6,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/xcrw/index'
},
{
value: '维修养护111',
key: 6,
value: '维修养护',
key: 2,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/wxyh/index'
},
{
value: '问题处理111',
key: 7,
value: '问题处理',
key: 3,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/wtcl/index'
},
{
value: '预警111',
key: 7,
value: '预警',
key: 4,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/yj/index'
},
{
value: '视频监控11',
key: 7,
value: '视频监控',
key: 5,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/spjk/index'
},
{
value: '生态流量监控11',
key: 7,
value: '生态流量监控',
key: 6,
icon: '../../static/tabs/yujing_icon@2x2.png',
url: '/pages/stlljk/index'
},
@ -285,41 +219,6 @@
url: '/pages/aqjc/index'
},
]
// } else {
// //
// return [
// {
// value: '',
// key: 1,
// icon: '../../static/tabs/xingzhuang2.png',
// url: '/pages/rain/rain'
// },
// {
// value: '',
// key: 2,
// icon: '../../static/tabs/water2.png',
// url: '/pages/water/water'
// },
// // {
// // value: '',
// // key: 3,
// // icon: '../../static/tabs/gongqing2.png',
// // url: '/pages/gqzq/index'
// // },
// {
// value: '',
// key: 5,
// icon: '../../static/tabs/yujing_icon@2x2.png',
// url: '/pages/orderFeedback/orderFeedback'
// },
// {
// value: '',
// key: 4,
// icon: '../../static/tabs/xinxi_icon@2x2.png',
// url: '/pages/xxsb/index'
// }
// ]
// }
}
},
watch: {
@ -862,39 +761,31 @@
}
.navBar {
height: 100%;
background-color: #fff;
margin-bottom: 12rpx;
/* background-color: pink; */
}
.navBar {
padding: 20px;
padding: 13px;
padding-bottom: 0;
/* text-align: center; */
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
// justify-content: center;
margin-bottom: 10px;
}
.navList {
text-align: center;
margin-right: 0px;
margin-bottom: 10px;
}
.navIcon {
position: relative;
width: 50px;
width: 84px;
height: 50px;
/* border-radius: 10px;
background-color: #007afd; */
display: flex;
justify-content: center;
align-items: center;
}
.readStatus {
position: absolute;
top: 0;
right: 0;
right: 17px;
width: 10px;
height: 10px;
border-radius: 50%;

View File

@ -1,34 +1,22 @@
<template>
<view class="container">
<div class="img">
<image
style="width: 100%; height: 100%"
src="../../static/images/u8.png"
mode="scaleToFill"
></image>
<image style="width: 100%; height: 100%" src="../../static/images/bg_img.png" mode="scaleToFill"></image>
</div>
<view class="user-title">
<text class="sub" >用户登录</text>
<text class="line"></text>
</view>
<uni-forms :modelValue="formData" class="form">
<uni-forms-item>
<uni-easyinput
type="text"
v-model="formData.username"
placeholder="请输入用户名"
/>
<uni-easyinput type="text" v-model="formData.username" placeholder="请输入用户名" />
</uni-forms-item>
<uni-forms-item>
<uni-easyinput
type="password"
v-model="formData.password"
placeholder="请输入密码"
/>
<uni-easyinput type="password" v-model="formData.password" placeholder="请输入密码" />
</uni-forms-item>
<uni-forms-item>
<checkbox :checked="formData.checked" @click="handleChange(formData)" /><text
>记住用户名和密码</text
>
<checkbox :checked="formData.checked" @click="handleChange(formData)" /><text>记住用户名和密码</text>
</uni-forms-item>
<!-- <button type="primary" class="button" @click="xian"></button> -->
<!-- <button type="primary" class="button" @click="xiang"></button> -->
<button type="primary" class="button" @click="login(formData)">
登录
</button>
@ -37,176 +25,163 @@
</template>
<script>
import CryptoJS from 'crypto-js'
import { onMounted } from "vue"
let checked = false
export default {
data () {
return {
formData: {
username: '',
password: '',
checked: false
}
}
},
mounted(){
console.log(uni.getStorageSync('loginChecked'));
if (uni.getStorageSync('loginChecked')===true){
this.formData = {
username: uni.getStorageSync('username'),
password: uni.getStorageSync('password'),
checked: true,
}
}
},
methods: {
handleChange (formData) {
checked = !checked
formData.checked = !formData.checked
},
xian () {
this.formData = {
username: 'cwz',
password: '12345678a',
checked: false
}
},
xiang () {
this.formData = {
username: 'glszfz',
password: '12345678a',
checked: false
}
},
login (formData) {
//loading
uni.showLoading({title:'努力登录中...', mask:true});
//MD5
const encryptData = data => {
const encryptedData = CryptoJS.MD5(data).toString()
return encryptedData
}
//
let postForm = {
username: formData.username,
password: formData.password
}
//
if (formData.checked === true) {
uni.setStorageSync('loginChecked', true)
uni.setStorageSync('username', postForm.username)
uni.setStorageSync('password',formData.password)
uni.setStorageSync('secretKey', postForm.secretKey)
} else {
uni.setStorageSync('loginChecked', false)
uni.removeStorageSync('username')
uni.removeStorageSync('secretKey')
uni.removeStorageSync('password')
this.formData.username = ''
this.formData.password = ''
}
//
console.log(postForm,'---===');
uni.$http.post('/gunshiApp/xyt/login', postForm).then(res => {
uni.showLoading({ title: '努力登录中...', mask: true })
console.log(res,'---===');
if (res.data.code === 200) {
//localStoragetoken
if (res.data.token) {
uni.setStorageSync('Gs-Token', res.data.token)
uni.$http.get('/gunshiApp/xyt/getInfo').then(res => {
// console.log('sss', res.data.data)
uni.setStorageSync('value', res.data.user)
setTimeout(function () {
uni.hideLoading()
uni.reLaunch({
url: '/pages/homeIndex/index'
})
}, 1000)
clearTimeout()
// console.log('-----value------', res.data.data)
})
// userId
uni.$http
.get('/gunshiApp/xfflood/my/info/getByUserId')
.then(res => {
console.log('-----avatar1------', res.data)
if (res.data.data) {
let url =
'/gunshiApp/xfflood/bzProjectManipulationRecord/file/get/'
url = url + res.data.data.fileId
uni.$http.get(url).then(res => {
uni.setStorageSync(
'avatar',
'http://223.75.53.141:9102/test.by-lyf.tmp' +
res.data.data.filePath
)
console.log(
'-----avatar------',
uni.getStorageSync('avatar')
)
})
} else {
uni.setStorageSync('avatar', '../../static/tabs/touxiang.png')
}
// uni.showLoading({title:'...', mask:true});
//
})
}
} else if (res.data.code === 400) {
//
setTimeout(function () {
uni.hideLoading()
uni.showToast({
title: res.data.description,
icon: 'none',
duration: 2000
})
}, 1000)
clearTimeout()
import CryptoJS from 'crypto-js'
import {
onMounted
} from "vue"
let checked = false
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
export default {
data() {
return {
formData: {
username: '',
password: '',
checked: false
}
})
}
},
mounted() {
if (uni.getStorageSync('loginChecked') === true) {
this.formData = {
username: uni.getStorageSync('username'),
password: uni.getStorageSync('password'),
checked: true,
}
}
},
methods: {
handleChange(formData) {
checked = !checked
formData.checked = !formData.checked
},
login(formData) {
//loading
uni.showLoading({
title: '努力登录中...',
mask: true
});
//MD5
const encryptData = data => {
const encryptedData = CryptoJS.MD5(data).toString()
return encryptedData
}
//
let postForm = {
username: formData.username,
password: formData.password
}
//
if (formData.checked === true) {
uni.setStorageSync('loginChecked', true)
uni.setStorageSync('username', postForm.username)
uni.setStorageSync('password', formData.password)
uni.setStorageSync('secretKey', postForm.secretKey)
} else {
uni.setStorageSync('loginChecked', false)
uni.removeStorageSync('username')
uni.removeStorageSync('secretKey')
uni.removeStorageSync('password')
this.formData.username = ''
this.formData.password = ''
}
//
uni.$http.post('/gunshiApp/xyt/login', postForm).then(res => {
uni.showLoading({
title: '努力登录中...',
mask: true
})
if (res.data.code === 200) {
//localStoragetoken
if (res.data.token) {
uni.setStorageSync('Gs-Token', res.data.token)
uni.$http.get('/gunshiApp/xyt/getInfo').then(res => {
// let avatarUrl = res.data.user.avatar ? url + res.data.user.avatar : '../../static/tabs/touxiang.png';
let avatarUrl = res.data.user.avatar ? url + '/gunshiApp/common/1/ResPlanB/微信图片_20240420225339_1723542338744.jpg' : '../../static/tabs/touxiang.png';
console.log("avatarUrl",avatarUrl);
uni.setStorageSync('value', res.data.user)
uni.setStorageSync('avatar', avatarUrl)
setTimeout(function () {
uni.hideLoading()
uni.reLaunch({
url: '/pages/homeIndex/index'
})
}, 1000)
})
}
} else {
setTimeout(function () {
uni.hideLoading()
uni.showToast({
title: res.data.description,
icon: 'none',
duration: 2000
})
}, 1000)
clearTimeout()
}
})
}
}
}
}
</script>
<style>
.container {
display: flex;
flex: 1;
flex-direction: column;
width: 100vw;
height: 100vh;
align-items: center;
background-color: #f3f5f8;
}
.img {
width: 100vw;
height: 50vh;
margin-top: 5vh;
/* background-color: red; */
}
.form {
margin-top: 4vh;
width: 80%;
height: 8vh;
align-items: center;
justify-content: center;
}
.button {
}
</style>
<style lang="scss">
.container {
display: flex;
flex: 1;
flex-direction: column;
width: 100vw;
height: 100vh;
align-items: center;
background-color: #f3f5f8;
}
.img {
width: 100vw;
height: 40vh;
margin-top: 0vh;
/* background-color: red; */
}
.form {
margin-top: 10vh;
width: 80%;
height: 8vh;
align-items: center;
justify-content: center;
}
.user-title {
position: relative;
padding: 4px;
text-align: center;
display: flex;
flex-direction: column;
.sub{
font-size: 28px;
color: #000;
}
.line{
position: absolute;
width: 80px;
height: 5px;
left:20px;
bottom: -10px;
background-color: #00a8ff;
border-radius: 15%;
}
}
</style>

View File

@ -11,14 +11,14 @@
<div class="info">
<uni-forms :modelValue="formData" >
<uni-forms-item label="原密码" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.oldSecretKey" placeholder="请输入原密码" class="password"/>
<uni-easyinput type="password" v-model="formData.oldPassword" placeholder="请输入原密码" class="password"/>
</uni-forms-item>
<uni-forms-item label="新密码" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.newSecretKey" placeholder="请输入新密码" class="password"/>
</uni-forms-item>
<uni-forms-item label="再次输入新密码" label-width="120px" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.secondSecretKey" placeholder="请再次输入新密码" class="password"/>
<uni-easyinput type="password" v-model="formData.newPassword" placeholder="请输入新密码" class="password"/>
</uni-forms-item>
<!-- <uni-forms-item label="再次输入新密码" label-width="120px" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.newPassword" placeholder="请再次输入新密码" class="password"/>
</uni-forms-item> -->
<button type="primary" class="button" @click="save(formData)"></button>
</uni-forms>
</div>
@ -34,10 +34,14 @@
export default {
data() {
return {
// formData: {
// oldSecretKey: '',
// newSecretKey: '',
// secondSecretKey: '',
// },
formData: {
oldSecretKey: '',
newSecretKey: '',
secondSecretKey: '',
oldPassword: '',
newPassword: '',
},
}
},
@ -47,28 +51,33 @@
},
save(formData){
let new_params = {
userId: '' ,
oldSecretKey: '',
newSecretKey: '',
secondSecretKey: '',
}
// let new_params = {
// userId: '' ,
// oldSecretKey: '',
// newSecretKey: '',
// secondSecretKey: '',
// }
new_params.oldSecretKey = CryptoJS.MD5(formData.oldSecretKey).toString()
new_params.newSecretKey = CryptoJS.MD5(formData.newSecretKey).toString()
new_params.secondSecretKey = CryptoJS.MD5(formData.secondSecretKey).toString()
new_params.userId = uni.getStorageSync('value').userId
// new_params.oldSecretKey = CryptoJS.MD5(formData.oldSecretKey).toString()
// new_params.newSecretKey = CryptoJS.MD5(formData.newSecretKey).toString()
// new_params.secondSecretKey = CryptoJS.MD5(formData.secondSecretKey).toString()
// new_params.userId = uni.getStorageSync('value').userId
// console.log(formData)
uni.$http.post('/gunshiApp/xfflood/user/updateSecretKey',new_params).then(res=>{
uni.$http.put(`/gunshiApp/xyt/system/user/profile/updatePwd?oldPassword=${formData.oldPassword}&newPassword=${formData.newPassword}`).then(res=>{
console.log(res);
if (res.data.code === 200) {
uni.showToast({
title: res.data.description,
title: "修改成功,即将重新登录",
icon:'none',
duration: 2000
})
setTimeout(uni.navigateBack(),2500)
setTimeout(() => {
uni.reLaunch({
url: '/pages/login/login'
// url:'/pages/homeIndex/index'
})
},2500)
} else {
uni.showToast({
title: res.data.description,

View File

@ -10,8 +10,8 @@
></image>
</div>
<div class="user">
<div class="username">{{this.userList.userName}}</div>
<div class="userresponse">{{this.userList.orgList[0].orgName}}</div>
<div class="username">{{this.userList.nickName}}</div>
<div class="userresponse">{{this.userList.dept.deptName}}</div>
</div>
</view>
<view class="funcBar">
@ -31,7 +31,7 @@
</view>
<view class="version">
<div class="content">
<div class="left">
<div class="left" style="display:flex">
<uni-icons type="info" size="25" class="icon-left"></uni-icons>
版本号
</div>
@ -45,16 +45,11 @@
</template>
<script>
const func = [
{img: '../../static/images/info.png', name: '个人信息', url:'/pages/personInfo/personInfo'},
{img: '../../static/images/password.png', name: '修改密码', url:'/pages/modifyPassword/modifyPassword'},
]
export default {
data() {
return {
userList: uni.getStorageSync('value'),
@ -65,37 +60,14 @@
default_src: uni.getStorageSync('avatar'),
}
},
onShow() {
this.setInsert()
},
mounted() {
this.default_src = uni.getStorageSync('avatar')
this.userList = uni.getStorageSync('value')
console.log('----mypageAvatar',this.default_src);
console.log('-----userList-----',this.userList);
},
methods: {
navigateToSubPage(index){
uni.navigateTo({
url: func[index].url,
animationType:'pop-in',
})
// console.log('click',index,func[index].url)
},
async setInsert () {
try {
const params = {
createId: uni.getStorageSync('value').userId,
loginType:1,
menu1:'我的',
menu2:'我的',
}
const { data } = await uni.$http.post('/gunshiApp/xfflood/visitMenuLog/insert',params)
console.log('用户行为',params,data)
} catch (error) {}
},
logout(){
if(uni.getStorageSync('loginChecked')===true){
uni.redirectTo({

View File

@ -1,257 +1,219 @@
<template>
<view class="container">
<div class="userinfo">
<div class="icon" @click="goBack">
<uni-icons type="back" size="25" color="white"></uni-icons>
</div>
<div class="Header">
<span>个人信息</span>
</div>
</div>
<uni-list class="info">
<uni-list-item
title="头像"
show-arrow="true"
clickable
class="listContainer"
@click="showActionSheet(default_src)"
>
<template v-slot:footer >
<image class="slot-image" :src="default_src" mode="aspectFill"></image>
</template>
</uni-list-item>
<uni-list-item
v-for="(item, index) in userListShow"
:key="index"
clickable
:title="item.name"
class="listContainer"
@click="modifyValue(item)"
>
<template v-slot:footer >
<div class="item" @click.stop="changeItemInfo(item,index)">
<text >{{item.info}}</text>
</div>
</template>
</uni-list-item>
</uni-list>
<button type="primary" class="button" @click="save"></button>
</view>
<view class="container">
<div class="userinfo">
<div class="icon" @click="goBack">
<uni-icons type="back" size="25" color="white"></uni-icons>
</div>
<div class="Header">
<span>个人信息</span>
</div>
</div>
<uni-list class="info">
<uni-list-item title="头像" show-arrow="true" clickable class="listContainer" @click="showActionSheet(default_src)">
<template v-slot:footer>
<image class="slot-image" :src="default_src" mode="aspectFill"></image>
</template>
</uni-list-item>
<uni-list-item v-for="(item, index) in userListShow" :key="index" clickable :title="item.name"
class="listContainer" @click="modifyValue(item)">
<template v-slot:footer>
<div class="item" @click.stop="changeItemInfo(item,index)">
<text>{{item.info}}</text>
</div>
</template>
</uni-list-item>
</uni-list>
<button type="primary" class="button" @click="save"></button>
</view>
</template>
<script>
let modify = false
//访
const userList = uni.getStorageSync('value')
let userListShow = [
{name: '手机号码', info: userList.phone},
]
export default {
data() {
return {
userList: userList,
userListShow:userListShow,
modify: modify,
default_src: uni.getStorageSync('avatar'),
fileId: '',
phone: userList.phone,
reset: false,
}
},
mounted() { //Storage
this.userList = uni.getStorageSync('value')
this.userListShow[0].info = this.userList.phone
},
methods: {
goBack(){
uni.navigateBack()
},
showActionSheet(default_src){ //
uni.showActionSheet({
itemList: ['拍照/上传照片', '恢复默认头像'],
success: (res) => {
console.log('选择了第' + (res.tapIndex + 1) + '个选项');
if (res.tapIndex === 0) { //
uni.chooseImage({
count: 1,
sizeType: ['origin','compressed'],
sourceType: ['camera', 'album'],
success: (res) => {
const tempFilePaths = res.tempFilePaths;
console.log('--------拍照上传照片--------',res);
this.default_src = tempFilePaths[0]
uni.uploadFile({
url: uni.$http.baseUrl+'/gunshiApp/xfflood/my/info/file/upload/singleSimple',
fileType: 'image',
filePath: tempFilePaths[0],
name: 'file',
success: (res) => {
this.fileId = JSON.parse(res.data).data.fileId
},
})
}
})
} else if(res.tapIndex === 1) { //
console.log('click');
this.reset = true
this.default_src = '../../static/tabs/touxiang.png'
}
},
fail: (err) => {
console.log('弹窗取消');
}
});
},
modifyValue(item){
console.log(item);
},
changeItemInfo(item,index){ //
uni.showModal({
title:"修改"+item.name,
editable:true,
placeholderText:item.info,
confirmText:"确认",
cancelText:"取消",
success: (res) => {
const phoneReg = /^[1][3-9]\d{9}$/;
if (res.confirm){
if (phoneReg.test(res.content) ){
this.userListShow[index].info = res.content
this.phone = res.content
uni.showToast({
title:"修改成功,请保存",
icon: "none",
duration: 1000,
})
} else {
uni.showToast({
title:"请输入正确手机号码",
icon: "none",
duration: 1000,
})
}
}
},
fail: (err) => {
console.log('取消');
}
})
},
save(){
if (this.fileId == ''){ //
if (this.reset) { //
//data
uni.$http.get('/gunshiApp/xfflood/my/info/recover').then(res=>{
uni.setStorageSync('avatar','../../static/tabs/touxiang.png')
})
console.log('重置头像');
}
let params = {
"phone": this.phone,
}
uni.$http.post('/gunshiApp/xfflood/my/info/update',params).then(res=>{
console.log('-----修改图片1-----',res);
let new_userList = uni.getStorageSync('value')
new_userList.phone = this.phone
uni.setStorageSync('value', new_userList)
uni.reLaunch({
url:'/pages/mypage/mypage'
})
},err=>{
console.log('----err----',err);
})
} else { //
let params = {
"phone": this.phone,
"attach": {
"fileId": this.fileId,
},
}
uni.$http.post('/gunshiApp/xfflood/my/info/update',params).then(res=>{
console.log('-----修改图片2-----',res);
if (res.data.code == 200){
console.log('---修改图片3---',res);
let url = '/gunshiApp/xfflood/bzProjectManipulationRecord/file/get/'+this.fileId
uni.$http.get(url).then(res=>{
uni.setStorageSync('avatar','http://223.75.53.141:9102/test.by-lyf.tmp'+res.data.data.filePath)
console.log('-----modifiedAvatar------',uni.getStorageSync('avatar'));
})
uni.reLaunch({
url:'/pages/mypage/mypage'
})
let modify = false
//访
const userList = uni.getStorageSync('value')
let userListShow = [{
name: '手机号码',
info: userList.phonenumber
}, ]
}
})
}
}
}
}
export default {
data() {
return {
userList: userList,
userListShow: userListShow,
modify: modify,
default_src: uni.getStorageSync('avatar'),
phone: userList.phonenumber,
}
},
mounted() { //Storage
this.userList = uni.getStorageSync('value')
this.userListShow[0].info = this.userList.phonenumber
},
methods: {
goBack() {
uni.navigateBack()
},
showActionSheet(default_src) { //
uni.showActionSheet({
itemList: ['拍照/上传照片'],
success: (res) => {
console.log('选择了第' + (res.tapIndex + 1) + '个选项');
if (res.tapIndex === 0) { //
uni.chooseImage({
count: 1,
sizeType: ['origin', 'compressed'],
sourceType: ['camera', 'album'],
success: (res) => {
const tempFilePaths = res.tempFilePaths;
console.log('--------拍照上传照片--------', res);
this.default_src = tempFilePaths[0]
uni.uploadFile({
url: uni.$http.baseUrl + '/gunshiApp/xyt/system/user/profile/avatar',
fileType: 'image',
filePath: tempFilePaths[0],
name: 'avatarfile',
header: {
'Authorization': 'Bearer ' + uni.getStorageSync('Gs-Token')
},
success: (res) => {
uni.$showMsg("上传成功")
},
})
}
})
}
},
fail: (err) => {
console.log('弹窗取消');
}
});
},
modifyValue(item) {
console.log(item);
},
changeItemInfo(item, index) { //
uni.showModal({
title: "修改" + item.name,
editable: true,
placeholderText: item.info,
confirmText: "确认",
cancelText: "取消",
success: (res) => {
const phoneReg = /^[1][3-9]\d{9}$/;
if (res.confirm) {
if (phoneReg.test(res.content)) {
this.userListShow[index].info = res.content
this.phone = res.content
uni.showToast({
title: "修改成功,请保存",
icon: "none",
duration: 1000,
})
} else {
uni.showToast({
title: "请输入正确手机号码",
icon: "none",
duration: 1000,
})
}
}
},
fail: (err) => {
console.log('取消');
}
})
},
async save() {
try {
let new_userList = uni.getStorageSync('value')
new_userList.phonenumber = this.phone;
const
{data}
=await uni.$http.put('/gunshiApp/xyt/system/user/profile', new_userList);
if (data.code == 200) {
uni.setStorageSync('value', new_userList)
uni.setStorageSync('avatar', new_userList.avatar)
uni.reLaunch({
url: '/pages/mypage/mypage'
})
}
uni.$showMsg("保存成功")
} catch (error) {
uni.$showMsg()
}
}
}
}
</script>
<style>
.userinfo{
border-radius: 5px;
display: flex;
flex-direction: row;
margin-top: 5vh;
margin-left: 2vw;
margin-bottom: 2vh;
align-items: center;
width: 95%;
height: 6vh;
background-color: #007afd;
}
.icon{
width: 6vw;
height: 6vh;
align-items: center;
line-height: 6vh;
}
.Header{
display: flex;
flex-direction: row;
flex: 0.95;
justify-content: center;
color: white;
font-size: 20px;
}
.info{
margin: 1vh;
}
.listContainer{
height: 6vh;
line-height: 8vh;
}
.button{
margin-top: 60vh;
border-radius: 10px;
display: flex;
flex-direction: column-reverse;
width: 92%;
height: 6vh;
font-size: 20px;
color: white;
background-color: #007afd;
}
.slot-image{
margin-top: 12px;
width: 40px;
height: 40px;
border-radius: 50%;
}
</style>
.userinfo {
border-radius: 5px;
display: flex;
flex-direction: row;
margin-top: 5vh;
margin-left: 2vw;
margin-bottom: 2vh;
align-items: center;
width: 95%;
height: 6vh;
background-color: #007afd;
}
.icon {
width: 6vw;
height: 6vh;
align-items: center;
line-height: 6vh;
}
.Header {
display: flex;
flex-direction: row;
flex: 0.95;
justify-content: center;
color: white;
font-size: 20px;
}
.info {
margin: 1vh;
}
.listContainer {
height: 6vh;
line-height: 8vh;
}
.button {
margin-top: 60vh;
border-radius: 10px;
display: flex;
flex-direction: column-reverse;
width: 92%;
height: 6vh;
font-size: 20px;
color: white;
background-color: #007afd;
}
.slot-image {
margin-top: 12px;
width: 40px;
height: 40px;
border-radius: 50%;
}
</style>

View File

@ -34,16 +34,33 @@
h12:22,
h24:35,
},
ylzList:[]
}
},
methods:{
//
async getYlzData(){
try {
const {data} = await uni.$http.post(
"/gunshiApp/xyt/stPptnRReal/list")
if(data.code == 200){
this.ylzList = [...data.data];
}
} catch (error) {
uni.$showMsg();
}
},
toDetail(){
uni.navigateTo({
url:'/pages/ylzList/detail/index'
})
},
}}
},
mounted() {
this.getYlzData();
},
}
</script>
<style lang="scss" scoped>

BIN
static/images/bg_img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB