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,12 +25,14 @@
</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"
export default {
data() {
return { return {
formData: { formData: {
username: '', username: '',
@ -51,10 +41,8 @@ export default {
} }
} }
}, },
mounted(){ mounted() {
console.log(uni.getStorageSync('loginChecked')); if (uni.getStorageSync('loginChecked') === true) {
if (uni.getStorageSync('loginChecked')===true){
this.formData = { this.formData = {
username: uni.getStorageSync('username'), username: uni.getStorageSync('username'),
password: uni.getStorageSync('password'), password: uni.getStorageSync('password'),
@ -63,27 +51,16 @@ export default {
} }
}, },
methods: { methods: {
handleChange (formData) { handleChange(formData) {
checked = !checked checked = !checked
formData.checked = !formData.checked formData.checked = !formData.checked
}, },
xian () { login(formData) {
this.formData = {
username: 'cwz',
password: '12345678a',
checked: false
}
},
xiang () {
this.formData = {
username: 'glszfz',
password: '12345678a',
checked: false
}
},
login (formData) {
//loading //loading
uni.showLoading({title:'努力登录中...', mask:true}); uni.showLoading({
title: '努力登录中...',
mask: true
});
//MD5 //MD5
const encryptData = data => { const encryptData = data => {
@ -101,7 +78,7 @@ export default {
if (formData.checked === true) { if (formData.checked === true) {
uni.setStorageSync('loginChecked', true) uni.setStorageSync('loginChecked', true)
uni.setStorageSync('username', postForm.username) uni.setStorageSync('username', postForm.username)
uni.setStorageSync('password',formData.password) uni.setStorageSync('password', formData.password)
uni.setStorageSync('secretKey', postForm.secretKey) uni.setStorageSync('secretKey', postForm.secretKey)
} else { } else {
uni.setStorageSync('loginChecked', false) uni.setStorageSync('loginChecked', false)
@ -113,61 +90,32 @@ export default {
} }
// //
console.log(postForm,'---===');
uni.$http.post('/gunshiApp/xyt/login', postForm).then(res => { uni.$http.post('/gunshiApp/xyt/login', postForm).then(res => {
uni.showLoading({ title: '努力登录中...', mask: true }) uni.showLoading({
console.log(res,'---==='); title: '努力登录中...',
mask: true
})
if (res.data.code === 200) { if (res.data.code === 200) {
//localStoragetoken //localStoragetoken
if (res.data.token) { if (res.data.token) {
uni.setStorageSync('Gs-Token', res.data.token) uni.setStorageSync('Gs-Token', res.data.token)
uni.$http.get('/gunshiApp/xyt/getInfo').then(res => { uni.$http.get('/gunshiApp/xyt/getInfo').then(res => {
// console.log('sss', res.data.data) // 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('value', res.data.user)
uni.setStorageSync('avatar', avatarUrl)
setTimeout(function () { setTimeout(function () {
uni.hideLoading() uni.hideLoading()
uni.reLaunch({ uni.reLaunch({
url: '/pages/homeIndex/index' url: '/pages/homeIndex/index'
}) })
}, 1000) }, 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 { } else {
uni.setStorageSync('avatar', '../../static/tabs/touxiang.png')
}
// uni.showLoading({title:'...', mask:true});
//
})
}
} else if (res.data.code === 400) {
//
setTimeout(function () { setTimeout(function () {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
@ -181,11 +129,11 @@ export default {
}) })
} }
} }
} }
</script> </script>
<style> <style lang="scss">
.container { .container {
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
@ -193,20 +141,47 @@ export default {
height: 100vh; height: 100vh;
align-items: center; align-items: center;
background-color: #f3f5f8; background-color: #f3f5f8;
} }
.img {
.img {
width: 100vw; width: 100vw;
height: 50vh; height: 40vh;
margin-top: 5vh; margin-top: 0vh;
/* background-color: red; */ /* background-color: red; */
} }
.form {
margin-top: 4vh; .form {
margin-top: 10vh;
width: 80%; width: 80%;
height: 8vh; height: 8vh;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.button {
} .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> </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

@ -10,28 +10,16 @@
</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"
clickable
class="listContainer"
@click="showActionSheet(default_src)"
>
<template v-slot:footer >
<image class="slot-image" :src="default_src" mode="aspectFill"></image> <image class="slot-image" :src="default_src" mode="aspectFill"></image>
</template> </template>
</uni-list-item> </uni-list-item>
<uni-list-item <uni-list-item v-for="(item, index) in userListShow" :key="index" clickable :title="item.name"
v-for="(item, index) in userListShow" class="listContainer" @click="modifyValue(item)">
:key="index" <template v-slot:footer>
clickable
:title="item.name"
class="listContainer"
@click="modifyValue(item)"
>
<template v-slot:footer >
<div class="item" @click.stop="changeItemInfo(item,index)"> <div class="item" @click.stop="changeItemInfo(item,index)">
<text >{{item.info}}</text> <text>{{item.info}}</text>
</div> </div>
</template> </template>
</uni-list-item> </uni-list-item>
@ -43,65 +31,61 @@
</template> </template>
<script> <script>
let modify = false let modify = false
//访 //访
const userList = uni.getStorageSync('value') const userList = uni.getStorageSync('value')
let userListShow = [ let userListShow = [{
{name: '手机号码', info: userList.phone}, name: '手机号码',
] info: userList.phonenumber
}, ]
export default { export default {
data() { data() {
return { return {
userList: userList, userList: userList,
userListShow:userListShow, userListShow: userListShow,
modify: modify, modify: modify,
default_src: uni.getStorageSync('avatar'), default_src: uni.getStorageSync('avatar'),
fileId: '', phone: userList.phonenumber,
phone: userList.phone,
reset: false,
} }
}, },
mounted() { //Storage mounted() { //Storage
this.userList = uni.getStorageSync('value') this.userList = uni.getStorageSync('value')
this.userListShow[0].info = this.userList.phone this.userListShow[0].info = this.userList.phonenumber
}, },
methods: { methods: {
goBack(){ goBack() {
uni.navigateBack() uni.navigateBack()
}, },
showActionSheet(default_src){ // showActionSheet(default_src) { //
uni.showActionSheet({ uni.showActionSheet({
itemList: ['拍照/上传照片', '恢复默认头像'], itemList: ['拍照/上传照片'],
success: (res) => { success: (res) => {
console.log('选择了第' + (res.tapIndex + 1) + '个选项'); console.log('选择了第' + (res.tapIndex + 1) + '个选项');
if (res.tapIndex === 0) { // if (res.tapIndex === 0) { //
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sizeType: ['origin','compressed'], sizeType: ['origin', 'compressed'],
sourceType: ['camera', 'album'], sourceType: ['camera', 'album'],
success: (res) => { success: (res) => {
const tempFilePaths = res.tempFilePaths; const tempFilePaths = res.tempFilePaths;
console.log('--------拍照上传照片--------',res); console.log('--------拍照上传照片--------', res);
this.default_src = tempFilePaths[0] this.default_src = tempFilePaths[0]
uni.uploadFile({ uni.uploadFile({
url: uni.$http.baseUrl+'/gunshiApp/xfflood/my/info/file/upload/singleSimple', url: uni.$http.baseUrl + '/gunshiApp/xyt/system/user/profile/avatar',
fileType: 'image', fileType: 'image',
filePath: tempFilePaths[0], filePath: tempFilePaths[0],
name: 'file', name: 'avatarfile',
header: {
'Authorization': 'Bearer ' + uni.getStorageSync('Gs-Token')
},
success: (res) => { success: (res) => {
this.fileId = JSON.parse(res.data).data.fileId uni.$showMsg("上传成功")
}, },
}) })
} }
}) })
} else if(res.tapIndex === 1) { //
console.log('click');
this.reset = true
this.default_src = '../../static/tabs/touxiang.png'
} }
}, },
fail: (err) => { fail: (err) => {
@ -109,31 +93,31 @@
} }
}); });
}, },
modifyValue(item){ modifyValue(item) {
console.log(item); console.log(item);
}, },
changeItemInfo(item,index){ // changeItemInfo(item, index) { //
uni.showModal({ uni.showModal({
title:"修改"+item.name, title: "修改" + item.name,
editable:true, editable: true,
placeholderText:item.info, placeholderText: item.info,
confirmText:"确认", confirmText: "确认",
cancelText:"取消", cancelText: "取消",
success: (res) => { success: (res) => {
const phoneReg = /^[1][3-9]\d{9}$/; const phoneReg = /^[1][3-9]\d{9}$/;
if (res.confirm){ if (res.confirm) {
if (phoneReg.test(res.content) ){ if (phoneReg.test(res.content)) {
this.userListShow[index].info = res.content this.userListShow[index].info = res.content
this.phone = res.content this.phone = res.content
uni.showToast({ uni.showToast({
title:"修改成功,请保存", title: "修改成功,请保存",
icon: "none", icon: "none",
duration: 1000, duration: 1000,
}) })
} else { } else {
uni.showToast({ uni.showToast({
title:"请输入正确手机号码", title: "请输入正确手机号码",
icon: "none", icon: "none",
duration: 1000, duration: 1000,
}) })
@ -146,55 +130,27 @@
} }
}) })
}, },
save(){ async save() {
if (this.fileId == ''){ // try {
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') let new_userList = uni.getStorageSync('value')
new_userList.phone = this.phone 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('value', new_userList)
uni.setStorageSync('avatar', new_userList.avatar)
uni.reLaunch({ uni.reLaunch({
url:'/pages/mypage/mypage' url: '/pages/mypage/mypage'
})
},err=>{
console.log('----err----',err);
}) })
}
uni.$showMsg("保存成功")
} catch (error) {
uni.$showMsg()
}
} 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'
})
}
})
}
} }
} }
@ -202,7 +158,7 @@
</script> </script>
<style> <style>
.userinfo{ .userinfo {
border-radius: 5px; border-radius: 5px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -215,13 +171,15 @@
background-color: #007afd; background-color: #007afd;
} }
.icon{
.icon {
width: 6vw; width: 6vw;
height: 6vh; height: 6vh;
align-items: center; align-items: center;
line-height: 6vh; line-height: 6vh;
} }
.Header{
.Header {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex: 0.95; flex: 0.95;
@ -229,15 +187,18 @@
color: white; color: white;
font-size: 20px; font-size: 20px;
} }
.info{
.info {
margin: 1vh; margin: 1vh;
} }
.listContainer{
.listContainer {
height: 6vh; height: 6vh;
line-height: 8vh; line-height: 8vh;
} }
.button{
.button {
margin-top: 60vh; margin-top: 60vh;
border-radius: 10px; border-radius: 10px;
display: flex; display: flex;
@ -248,7 +209,8 @@
color: white; color: white;
background-color: #007afd; background-color: #007afd;
} }
.slot-image{
.slot-image {
margin-top: 12px; margin-top: 12px;
width: 40px; width: 40px;
height: 40px; height: 40px;

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