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') console.log(token.secretKey,'App Launch')
} else { } else {
uni.reLaunch({ uni.reLaunch({
// url: '/pages/login/login' url: '/pages/login/login'
url:'/pages/ylzList/detail/index' // url:'/pages/mypage/mypage'
}) })
console.log(token.secretKey,'App Launch2') console.log(token.secretKey,'App Launch2')
} }

View File

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

View File

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

View File

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

View File

@ -1,34 +1,22 @@
<template> <template>
<view class="container"> <view class="container">
<div class="img"> <div class="img">
<image <image style="width: 100%; height: 100%" src="../../static/images/bg_img.png" mode="scaleToFill"></image>
style="width: 100%; height: 100%"
src="../../static/images/u8.png"
mode="scaleToFill"
></image>
</div> </div>
<view class="user-title">
<text class="sub" >用户登录</text>
<text class="line"></text>
</view>
<uni-forms :modelValue="formData" class="form"> <uni-forms :modelValue="formData" class="form">
<uni-forms-item> <uni-forms-item>
<uni-easyinput <uni-easyinput type="text" v-model="formData.username" placeholder="请输入用户名" />
type="text"
v-model="formData.username"
placeholder="请输入用户名"
/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item> <uni-forms-item>
<uni-easyinput <uni-easyinput type="password" v-model="formData.password" placeholder="请输入密码" />
type="password"
v-model="formData.password"
placeholder="请输入密码"
/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item> <uni-forms-item>
<checkbox :checked="formData.checked" @click="handleChange(formData)" /><text <checkbox :checked="formData.checked" @click="handleChange(formData)" /><text>记住用户名和密码</text>
>记住用户名和密码</text
>
</uni-forms-item> </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 type="primary" class="button" @click="login(formData)">
登录 登录
</button> </button>
@ -37,176 +25,163 @@
</template> </template>
<script> <script>
import CryptoJS from 'crypto-js' import CryptoJS from 'crypto-js'
import { onMounted } from "vue" import {
let checked = false onMounted
} from "vue"
export default { let checked = false
data () { const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
return { export default {
formData: { data() {
username: '', return {
password: '', formData: {
checked: false 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()
} }
}) }
},
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> </script>
<style> <style lang="scss">
.container { .container {
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
align-items: center; align-items: center;
background-color: #f3f5f8; background-color: #f3f5f8;
} }
.img {
width: 100vw; .img {
height: 50vh;
margin-top: 5vh; width: 100vw;
/* background-color: red; */ height: 40vh;
} margin-top: 0vh;
.form { /* background-color: red; */
margin-top: 4vh; }
width: 80%;
height: 8vh; .form {
align-items: center; margin-top: 10vh;
justify-content: center; width: 80%;
} height: 8vh;
.button { align-items: center;
} justify-content: center;
</style> }
.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"> <div class="info">
<uni-forms :modelValue="formData" > <uni-forms :modelValue="formData" >
<uni-forms-item label="原密码" :required="true" class="form"> <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>
<uni-forms-item label="新密码" :required="true" class="form"> <uni-forms-item label="新密码" :required="true" class="form">
<uni-easyinput type="password" v-model="formData.newSecretKey" 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.secondSecretKey" placeholder="请再次输入新密码" class="password"/>
</uni-forms-item> </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> <button type="primary" class="button" @click="save(formData)"></button>
</uni-forms> </uni-forms>
</div> </div>
@ -34,10 +34,14 @@
export default { export default {
data() { data() {
return { return {
// formData: {
// oldSecretKey: '',
// newSecretKey: '',
// secondSecretKey: '',
// },
formData: { formData: {
oldSecretKey: '', oldPassword: '',
newSecretKey: '', newPassword: '',
secondSecretKey: '',
}, },
} }
}, },
@ -47,28 +51,33 @@
}, },
save(formData){ save(formData){
let new_params = { // let new_params = {
userId: '' , // userId: '' ,
oldSecretKey: '', // oldSecretKey: '',
newSecretKey: '', // newSecretKey: '',
secondSecretKey: '', // secondSecretKey: '',
} // }
new_params.oldSecretKey = CryptoJS.MD5(formData.oldSecretKey).toString() // new_params.oldSecretKey = CryptoJS.MD5(formData.oldSecretKey).toString()
new_params.newSecretKey = CryptoJS.MD5(formData.newSecretKey).toString() // new_params.newSecretKey = CryptoJS.MD5(formData.newSecretKey).toString()
new_params.secondSecretKey = CryptoJS.MD5(formData.secondSecretKey).toString() // new_params.secondSecretKey = CryptoJS.MD5(formData.secondSecretKey).toString()
new_params.userId = uni.getStorageSync('value').userId // new_params.userId = uni.getStorageSync('value').userId
// console.log(formData) // 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); console.log(res);
if (res.data.code === 200) { if (res.data.code === 200) {
uni.showToast({ uni.showToast({
title: res.data.description, title: "修改成功,即将重新登录",
icon:'none', icon:'none',
duration: 2000 duration: 2000
}) })
setTimeout(uni.navigateBack(),2500) setTimeout(() => {
uni.reLaunch({
url: '/pages/login/login'
// url:'/pages/homeIndex/index'
})
},2500)
} else { } else {
uni.showToast({ uni.showToast({
title: res.data.description, title: res.data.description,

View File

@ -10,8 +10,8 @@
></image> ></image>
</div> </div>
<div class="user"> <div class="user">
<div class="username">{{this.userList.userName}}</div> <div class="username">{{this.userList.nickName}}</div>
<div class="userresponse">{{this.userList.orgList[0].orgName}}</div> <div class="userresponse">{{this.userList.dept.deptName}}</div>
</div> </div>
</view> </view>
<view class="funcBar"> <view class="funcBar">
@ -31,7 +31,7 @@
</view> </view>
<view class="version"> <view class="version">
<div class="content"> <div class="content">
<div class="left"> <div class="left" style="display:flex">
<uni-icons type="info" size="25" class="icon-left"></uni-icons> <uni-icons type="info" size="25" class="icon-left"></uni-icons>
版本号 版本号
</div> </div>
@ -45,16 +45,11 @@
</template> </template>
<script> <script>
const func = [ const func = [
{img: '../../static/images/info.png', name: '个人信息', url:'/pages/personInfo/personInfo'}, {img: '../../static/images/info.png', name: '个人信息', url:'/pages/personInfo/personInfo'},
{img: '../../static/images/password.png', name: '修改密码', url:'/pages/modifyPassword/modifyPassword'}, {img: '../../static/images/password.png', name: '修改密码', url:'/pages/modifyPassword/modifyPassword'},
] ]
export default { export default {
data() { data() {
return { return {
userList: uni.getStorageSync('value'), userList: uni.getStorageSync('value'),
@ -65,37 +60,14 @@
default_src: uni.getStorageSync('avatar'), 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: { methods: {
navigateToSubPage(index){ navigateToSubPage(index){
uni.navigateTo({ uni.navigateTo({
url: func[index].url, url: func[index].url,
animationType:'pop-in', 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(){ logout(){
if(uni.getStorageSync('loginChecked')===true){ if(uni.getStorageSync('loginChecked')===true){
uni.redirectTo({ uni.redirectTo({

View File

@ -1,257 +1,219 @@
<template> <template>
<view class="container"> <view class="container">
<div class="userinfo"> <div class="userinfo">
<div class="icon" @click="goBack"> <div class="icon" @click="goBack">
<uni-icons type="back" size="25" color="white"></uni-icons> <uni-icons type="back" size="25" color="white"></uni-icons>
</div> </div>
<div class="Header"> <div class="Header">
<span>个人信息</span> <span>个人信息</span>
</div> </div>
</div> </div>
<uni-list class="info"> <uni-list class="info">
<uni-list-item <uni-list-item title="头像" show-arrow="true" clickable class="listContainer" @click="showActionSheet(default_src)">
title="头像" <template v-slot:footer>
show-arrow="true" <image class="slot-image" :src="default_src" mode="aspectFill"></image>
clickable </template>
class="listContainer" </uni-list-item>
@click="showActionSheet(default_src)" <uni-list-item v-for="(item, index) in userListShow" :key="index" clickable :title="item.name"
> class="listContainer" @click="modifyValue(item)">
<template v-slot:footer > <template v-slot:footer>
<image class="slot-image" :src="default_src" mode="aspectFill"></image> <div class="item" @click.stop="changeItemInfo(item,index)">
</template> <text>{{item.info}}</text>
</uni-list-item> </div>
<uni-list-item </template>
v-for="(item, index) in userListShow" </uni-list-item>
:key="index" </uni-list>
clickable <button type="primary" class="button" @click="save"></button>
:title="item.name" </view>
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> </template>
<script> <script>
let modify = false
let modify = false //访
const userList = uni.getStorageSync('value')
//访 let userListShow = [{
const userList = uni.getStorageSync('value') name: '手机号码',
let userListShow = [ info: userList.phonenumber
{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'
})
} 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> </script>
<style> <style>
.userinfo{ .userinfo {
border-radius: 5px; border-radius: 5px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-top: 5vh; margin-top: 5vh;
margin-left: 2vw; margin-left: 2vw;
margin-bottom: 2vh; margin-bottom: 2vh;
align-items: center; align-items: center;
width: 95%; width: 95%;
height: 6vh; height: 6vh;
background-color: #007afd; background-color: #007afd;
} }
.icon{
width: 6vw; .icon {
height: 6vh; width: 6vw;
align-items: center; height: 6vh;
line-height: 6vh; align-items: center;
} line-height: 6vh;
.Header{ }
display: flex;
flex-direction: row; .Header {
flex: 0.95; display: flex;
justify-content: center; flex-direction: row;
color: white; flex: 0.95;
font-size: 20px; justify-content: center;
} color: white;
.info{ font-size: 20px;
margin: 1vh; }
} .info {
.listContainer{ margin: 1vh;
height: 6vh;
line-height: 8vh; }
}
.button{ .listContainer {
margin-top: 60vh; height: 6vh;
border-radius: 10px; line-height: 8vh;
display: flex; }
flex-direction: column-reverse;
width: 92%; .button {
height: 6vh; margin-top: 60vh;
font-size: 20px; border-radius: 10px;
color: white; display: flex;
background-color: #007afd; flex-direction: column-reverse;
} width: 92%;
.slot-image{ height: 6vh;
margin-top: 12px; font-size: 20px;
width: 40px; color: white;
height: 40px; background-color: #007afd;
border-radius: 50%; }
}
</style> .slot-image {
margin-top: 12px;
width: 40px;
height: 40px;
border-radius: 50%;
}
</style>

View File

@ -34,16 +34,33 @@
h12:22, h12:22,
h24:35, h24:35,
}, },
ylzList:[]
} }
}, },
methods:{ 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(){ toDetail(){
uni.navigateTo({ uni.navigateTo({
url:'/pages/ylzList/detail/index' url:'/pages/ylzList/detail/index'
}) })
}, },
}} },
mounted() {
this.getYlzData();
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

BIN
static/images/bg_img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB