123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <view class="main">
- <view class="one">
- <upload class='upload' :list="user.icon" name="icon" :count="1" @uplSuc="uplSuc" @uplDel="uplDel">
- </upload>
- </view>
- <view class="two">
- <view class="two_1">
- <view class="left">姓名</view>
- <view class="right">
- <input v-model="user.name" placeholder="请输入真实姓名" />
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- <view class="two_1">
- <view class="left">手机号</view>
- <view class="right">
- <input v-model="user.mobile" placeholder="请输入手机号" />
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- <view class="two_1">
- <view class="left">性别</view>
- <view class="right">
- <picker class="picker" mode="selector" :range="genderList" @change="genderChange" range-key="label">
- <view>{{user.gender||'请选择性别'}}</view>
- </picker>
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- <view class="two_1">
- <view class="left">医院名称</view>
- <view class="right">
- <input v-model="user.hos_name" placeholder="请输入医院名称" />
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- <view class="two_1">
- <view class="left">科室名称</view>
- <view class="right">
- <input v-model="user.dept_name" placeholder="请输入科室名称" />
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- <view class="two_1">
- <view class="left">职务</view>
- <view class="right">
- <input v-model="user.title" placeholder="请输入职务" />
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- <view class="two_1">
- <view class="left">职称</view>
- <view class="right">
- <input v-model="user.post" placeholder="请输入职称" />
- <text class="iconfont icon-dayuhao"></text>
- </view>
- </view>
- </view>
- <view class="thr">
- <button class="button" type="primary" size="mini" @click="onSubmit()">保存</button>
- </view>
- </view>
- </template>
- <script>
- import upload from '../../components/upload/index.vue';
- export default {
- components: {
- upload
- },
- data() {
- return {
- user: {},
- gender_name: '',
- // 字典表
- genderList: [{
- label: '男',
- value: '男'
- },
- {
- label: '女',
- value: '女'
- }
- ],
- }
- },
- onLoad: async function(e) {
- const that = this;
- await that.search();
- },
- onShow: async function() {
- const that = this;
- that.searchToken();
- },
- methods: {
- // 用户信息
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) {
- const user = that.$jwt(res);
- that.$set(that, `user`, user);
- }
- } catch (e) {}
- },
- // 查询
- async search() {
- const that = this;
- },
- // 图片上传
- uplSuc(e) {
- const that = this;
- that.$set(that.user, `icon`, [e.data]);
- },
- // 图片删除
- uplDel(e) {
- const that = this;
- that.$set(that.user, `icon`, [])
- },
- // 性别选择
- genderChange(e) {
- const that = this;
- let data = that.genderList[e.detail.value];
- if (data) that.$set(that.user, `gender`, data.value)
- },
- // 保存
- async onSubmit() {
- const that = this;
- const form = that.user;
- let res;
- res = await that.$api(`/doctor/${form._id}`, 'POST', form);
- if (res.errcode == '0') {
- uni.showToast({
- title: '维护信息成功',
- icon: 'none'
- })
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- })
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- .one {
- display: flex;
- justify-content: center;
- padding: 2vw;
- }
- .two {
- padding: 2vw;
- .two_1 {
- display: flex;
- justify-content: space-between;
- padding: 4vw;
- border-bottom: 1px solid var(--f9Color);
- font-size: var(--font14Size);
- color: var(--f69Color);
- .right {
- display: flex;
- align-items: center;
- input {
- text-align: right;
- padding: 0 1vw;
- }
- }
- }
- }
- .thr {
- text-align: center;
- .button {
- margin: 2vw 0 0 0;
- background-color: var(--f3CColor);
- color: var(--mainColor);
- font-size: var(--font14Size);
- }
- }
- }
- </style>
|