| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <view>
- <scroll-view scroll-y class="page">
- <cu-custom bgColor="bg-luohu" :isBack="true">
- <block slot="backText">返回</block>
- <block slot="content">用户详情</block>
- </cu-custom>
- <view class="example-body " style="display: flex;justify-content: center; margin-top: 80rpx;">
- <u-avatar :src="photo" size="160" @click="getImage">
- </u-avatar>
- </view>
- <uni-card>
- <view class="cu-list menu">
- <u-form :model="user" ref="uForm" label-width="160">
- <u-form-item label="单位名称">
- <u-input v-model="user.qq" input-align="right" disabled />
- </u-form-item>
- <u-form-item label="客户姓名">
- <u-input v-model="user.name" input-align="right" />
- </u-form-item>
- <u-form-item label="手机号">
- <u-input v-model="user.mobile" input-align="right" />
- </u-form-item>
- <u-form-item label="邮箱">
- <u-input v-model="user.email" input-align="right" />
- </u-form-item>
- <u-form-item label="地址">
- <u-input v-model="user.address" input-align="right" />
- </u-form-item>
- </u-form>
- <u-button class="u-m-t-40 btn-back-color" type="error" @click="sumbit">提交</u-button>
- </view>
- </uni-card>
- </scroll-view>
- </view>
- </template>
- <script>
- import {
- ACCESS_TOKEN,
- USER_NAME,
- USER_INFO
- } from "@/common/util/constants"
- import api from '@/api/api.js'
- import http from '@/common/service/http.js'
- export default {
- data() {
- return {
- id: '',
- user: {
- companyname: '',
- number: '',
- username: '',
- },
- photo: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg'
- };
- },
- onLoad() {
- let user = uni.getStorageSync(USER_INFO).employee;
- this.id = user.id
- this.loadinfo()
- },
- methods: {
- loadinfo() {
- let token = uni.getStorageSync(ACCESS_TOKEN)
- this.$http.get('ibps/platform/v3/employee/load', {
- params: {
- employeeId: this.id
- }
- }).then(res => {
- if (res.data.state == '200') {
- let result = res.data.data
- this.user = result
- if (result.photo != '') {
- this.photo = http.apiHosp + 'ibps/platform/v3' + this.user.photo +
- '&access_token=' +
- token + '&tenantId='
- }
- }
- }).catch(e => {})
- },
- //手机号码判断
- checkPhone(value) {
- const reg = /^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\d{8}$/
- if (!reg.test(value)) {
- return false
- }
- return true
- },
- sumbit() {
- uni.showLoading({
- mask: true,
- title: "加载中"
- })
- if (this.user.name == '') {
- uni.showToast({
- title: '请填写姓名',
- icon: 'none',
- duration: 2000
- })
- uni.hideLoading()
- return
- }
- if (!this.checkPhone(this.user.mobile)) {
- uni.showToast({
- title: '请填写正确的手机号码',
- icon: 'none',
- duration: 2000
- })
- uni.hideLoading()
- return
- }
- this.$http.post('ibps/platform/v3/employee/update', {
- partyEmployeePo: this.user,
- user: this.user,
- attrValueVoList: [],
- positionVoList: [],
- roleVoList: [],
- userGroupPoList: []
- }).then(res => {
- if (res.data.state == '200') {
- let datas = res.data
- uni.showToast({
- title: datas.message,
- icon: 'none',
- duration: 2000
- })
- let info = uni.getStorageSync(USER_INFO);
- info.user = this.user
- uni.setStorage({
- key: 'login_user_info',
- data: info
- })
- } else {
- let datas = res.data
- uni.showToast({
- title: datas.cause,
- icon: 'none',
- duration: 2000
- })
- }
- uni.hideLoading()
- }).catch(res => {
- let datas = res.data
- uni.showToast({
- title: datas.cause,
- icon: 'none',
- duration: 2000
- })
- uni.hideLoading()
- })
- },
- getImage() {
- let token = uni.getStorageSync(ACCESS_TOKEN)
- uni.chooseImage({
- success: (res) => {
- const tempFilePaths = res.tempFilePaths;
- // this.select(tempFilePaths[0])
- uni.uploadFile({
- // url: http.apiHosp + 'ibps/platform/v3/file/upload/mobile', //仅为示例,非真实的接口地址
- url: http.apiHosp + '/ibps/platform/v3/file/upload', //仅为示例,非真实的接口地址
- filePath: tempFilePaths[0],
- name: 'file',
- formData: {
- 'ext': '.jpg'
- },
- header: {
- 'X-Authorization-access_token': token,
- 'X-Authorization-systemid': ''
- },
- success: (res) => {
- let data = JSON.parse(res.data)
- if (data.state == 200) {
- let datas = data.data
- this.user.photo = '/file/getImage?attachmentId=' + datas.id
- let phto = '/file/getImage?attachmentId=' + datas.id +
- '&access_token=' + token + '&tenantId='
- this.photo = http.apiHosp + 'ibps/platform/v3' + phto
- }
- }
- });
- }
- });
- },
- }
- }
- </script>
- <style>
- .page {
- height: 100Vh;
- width: 100vw;
- }
- .page.show {
- overflow: hidden;
- }
- .switch-sex::after {
- content: "\e716";
- }
- .switch-sex::before {
- content: "\e7a9";
- }
- .switch-music::after {
- content: "\e66a";
- }
- .switch-music::before {
- content: "\e6db";
- }
- .example-body {
- padding: 10px;
- padding-top: 0;
- }
- .custom-image-box {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- }
- .text {
- font-size: 14px;
- color: #333;
- }
- </style>
- <style lang="scss" scoped>
- /deep/ .uni-input-input {
- color: #8799a3;
- }
- /deep/ .u-form-item--left__content__label {
- color: #8799a3;
- }
- </style>
|