Commit dc5e58b6 by honghong

修改用户信息后不更新

parent 10de5c7f
...@@ -123,11 +123,13 @@ ...@@ -123,11 +123,13 @@
</template> </template>
<script> <script>
import {mapGetters} from 'vuex'
import { import {
addOrderFunction, addOrderFunction,
updateUserMsg updateUserMsg
} from '@/api/system/index.js' } from '@/api/system/index.js'
import {
loginUserInfo
} from '@/api/user.js'
import freeAudio from '@/components/chengpeng-audio/free-audio.vue' import freeAudio from '@/components/chengpeng-audio/free-audio.vue'
import recordCom from '@/components/record/record.vue' import recordCom from '@/components/record/record.vue'
...@@ -209,9 +211,7 @@ ...@@ -209,9 +211,7 @@
mounted() { mounted() {
this.$refs.form.setRules(this.rules); this.$refs.form.setRules(this.rules);
}, },
computed:{
...mapGetters(['userInfo'])
},
watch: { watch: {
detailData: { detailData: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
...@@ -243,12 +243,27 @@ ...@@ -243,12 +243,27 @@
that.formInfo.repairTime = uni.$u.timeFormat(that.formInfo.repairTime, 'yyyy-mm-dd') that.formInfo.repairTime = uni.$u.timeFormat(that.formInfo.repairTime, 'yyyy-mm-dd')
} }
that.inite() that.inite()
that.$set(that.formInfo,'linkman',that.userInfo.user.linkMan) that.upDateUserInfoMount()
that.$set(that.formInfo,'phone',that.userInfo.user.mobile) // that.$set(that.formInfo,'linkman',that.userInfo.user.linkMan)
that.$set(that.formInfo,'title',that.userInfo.user.company) // that.$set(that.formInfo,'phone',that.userInfo.user.mobile)
that.$set(that.formInfo,'repairAddress',that.userInfo.user.address) // that.$set(that.formInfo,'title',that.userInfo.user.company)
// that.$set(that.formInfo,'repairAddress',that.userInfo.user.address)
}, },
methods: { methods: {
upDateUserInfoMount() {
let that = this
loginUserInfo().then(kh => {
const {
data
} = kh
console.log(data, '第三阶段是')
// this.model = data.user
that.$set(that.formInfo,'linkman',data.user.linkMan)
that.$set(that.formInfo,'phone',data.user.mobile)
that.$set(that.formInfo,'title',data.user.company)
that.$set(that.formInfo,'repairAddress',data.user.address)
})
},
inite() { inite() {
let self = this; let self = this;
self.timeValue = Number(new Date()) self.timeValue = Number(new Date())
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
<view class="content"> <view class="content">
<!-- <com-navbar :title="status == 1 ? '添加个人信息' : '修改个人信息'" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" /> --> <!-- <com-navbar :title="status == 1 ? '添加个人信息' : '修改个人信息'" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" /> -->
<view class="content-form"> <view class="content-form">
<u--form label-position="top" labelWidth="120" :model="model" :rules="rules" ref="form"> <u--form label-position="top" labelWidth="140" :model="model" :rules="rules" ref="form">
<u-form-item label="公司名称" prop="company" borderBottom :customStyle="{ <u-form-item label="公司名称" prop="company" borderBottom :customStyle="{
'flex-direction': 'row !important' 'flex-direction': 'row !important'
}"> }">
<u--input inputAlign="right" border="none" v-model="model.company" placeholder="请输入公司名称"> <u--input inputAlign="right" border="none" v-model="model.company" placeholder="请输入公司名称"
@change="changeInput">
</u--input> </u--input>
</u-form-item> </u-form-item>
<u-form-item required label="联系人" prop="linkMan" borderBottom :customStyle="{ <u-form-item required label="联系人" prop="linkMan" borderBottom :customStyle="{
...@@ -69,7 +70,12 @@ ...@@ -69,7 +70,12 @@
import { import {
updateUserMsg updateUserMsg
} from '@/api/system/index.js' } from '@/api/system/index.js'
import {mapGetters} from 'vuex' import {
loginUserInfo
} from '@/api/user.js'
import {
mapGetters
} from 'vuex'
export default { export default {
data() { data() {
const mobile = (rule, value, callback) => { const mobile = (rule, value, callback) => {
...@@ -111,22 +117,33 @@ ...@@ -111,22 +117,33 @@
} }
} }
}, },
computed:{ computed: {
...mapGetters(['userInfo']) ...mapGetters(['userInfo'])
}, },
mounted() { mounted() {
this.$refs.form.setRules(this.rules); this.$refs.form.setRules(this.rules);
}, },
onLoad() { onLoad() {
this.model = { this.upDateUserInfoMount()
...this.userInfo.user,
}
}, },
methods: { methods: {
changeInput(val) {
console.log(val, "======changeInput")
},
upDateUserInfoMount() {
let that = this
loginUserInfo().then(kh => {
const {
data
} = kh
this.model = data.user
})
},
async updateUser(data) { async updateUser(data) {
let that = this let that = this
const back_data = await updateUserMsg(data) const back_data = await updateUserMsg(data)
console.log(back_data,'修改') console.log(back_data, '修改')
const { const {
code code
} = back_data } = back_data
...@@ -134,14 +151,14 @@ ...@@ -134,14 +151,14 @@
uni.showToast({ uni.showToast({
title: '保存成功!', title: '保存成功!',
icon: 'none', icon: 'none',
duration:2000, duration: 2000,
success() { success() {
let time = setTimeout(()=>{ let time = setTimeout(() => {
clearTimeout(time) clearTimeout(time)
uni.navigateBack({ uni.navigateBack({
delta:1 delta: 1
}) })
},1000) }, 1000)
} }
}) })
// that.upDateUserInfoMount() // that.upDateUserInfoMount()
...@@ -151,6 +168,7 @@ ...@@ -151,6 +168,7 @@
let that = this let that = this
that.$refs.form.validate().then(res => { that.$refs.form.validate().then(res => {
// uni.$u.toast('校验通过') // uni.$u.toast('校验通过')
console.log(that.model)
that.updateUser(that.model) that.updateUser(that.model)
}).catch(errors => { }).catch(errors => {
uni.$u.toast('请完善信息') uni.$u.toast('请完善信息')
......
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
}, },
handleCallPhone() { handleCallPhone() {
let phone = '13585756959' let phone = '17717504500'
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: phone, phoneNumber: phone,
success: function() { success: function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment