1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
| <template>
| <view class="mainbox">
| <img src="/static/images/loginbg.png" class="bgbox">
| <div class="top">
| <img :src="logoSrc" mode="scaleToFill" alt="" class="logo" @error="handleImageError">
| </div>
| <input type="text" class="nickname" placeholder="身份证号" v-model="loginForm.sfzh">
| <input type="text" class="nickname" placeholder="姓名" v-model="loginForm.name">
| <input type="text" class="nickname" placeholder="请输入要修改的手机号" v-model="loginForm.phone">
|
| <div class="btn" @tap="queding" :disabled="loading">
| <div class="txt">确认</div>
| </div>
| </view>
| </template>
|
| <script>
| import {
| edit
| } from '@/api/login'
| import {
| getToken,
| setToken,
| removeToken
| } from '@/utils/auth'
|
| export default {
| name: "Login",
| data() {
| return {
| userInfo: {},
| codeUrl: "",
| val: "",
| canIUseGetUserProfile: false,
| globalConfig: getApp().globalData.config,
| loginForm: {
| phone: "",
| name: "",
| sfzh: ""
| },
| loading: false,
| logoSrc: '/static/images/logo.png', // 默认 Logo
| }
| },
| onLoad(options) {
| let code = uni.getStorageSync('hospId')
| // 获取传递的 code 参数并设置 logoSrc
| if (code) {
| this.logoSrc = `http://47.109.86.30:5902/img/${code}-logo.png`;
| }
| uni.showToast({
| title: '加载中...',
| icon: 'loading',
| duration: 500
| });
| if (uni.getUserProfile) {
| this.canIUseGetUserProfile = true;
| }
| },
| onShow() {
| this.localtoken = uni.getStorageSync('localtoken');
| console.log('localtoken:', this.localtoken);
| },
| methods: {
| handleImageError() {
| this.logoSrc = '/static/images/logo.png'; // 加载失败用默认 logo
| },
| queding() {
| if (this.loading) return; // 避免重复点击
| this.loading = true;
|
| edit(this.loginForm)
| .then((res) => {
| console.log(res);
| if (res.code === 200) {
| uni.showToast({
| title: res.msg || '修改成功',
| icon: 'none',
| duration: 1500,
| success: () => {
| // 1.5 秒后跳转到登录页
| setTimeout(() => {
| uni.redirectTo({
| url: '/pages/login' // 替换成你的登录页路径
| });
| }, 1500);
| }
| });
| } else {
| uni.showToast({
| title: res.msg || '操作失败',
| icon: 'none',
| duration: 2000
| });
| }
| })
| .catch((err) => {
| console.error(err);
| uni.showToast({
| title: '网络错误,请稍后再试',
| icon: 'none',
| duration: 2000
| });
| })
| .finally(() => {
| this.loading = false;
| });
| }
| }
|
| }
| </script>
|
| <style lang="scss" scoped>
| .mainbox {
| display: flex;
| height: 1624rpx;
| flex-direction: column;
|
| .bgbox {
| width: 750rpx;
| height: 1624rpx;
| position: absolute;
| z-index: -1;
| }
|
| .top {
| display: flex;
| flex-direction: column;
| align-items: center;
| width: 100%;
| margin-top: 200rpx;
|
| .logo {
| width: 124rpx;
| height: 140rpx;
| margin-bottom: 16rpx;
| }
|
| .logotxt {
| width: 165rpx;
| height: 62rpx;
| margin-bottom: 81rpx;
| }
| }
|
| .nickname {
| width: 540rpx;
| height: 96rpx;
| background: #F4F5F8;
| border-radius: 48rpx;
| margin: 0 auto 40rpx;
| padding-left: 50rpx;
| font-size: 32rpx;
| color: #9496A2;
| }
|
| .btn {
| width: 540rpx;
| height: 96rpx;
| background: #419FFD;
| border-radius: 48rpx;
| margin: 25rpx auto 25rpx;
| display: flex;
| justify-content: center;
| align-items: center;
| opacity: 1;
|
| &[disabled] {
| opacity: 0.6;
| }
| }
|
| .btn1 {
| width: 540rpx;
| height: 96rpx;
| background: #54adff;
| border-radius: 48rpx;
| margin: 25rpx auto 25rpx;
| display: flex;
| justify-content: center;
| align-items: center;
| opacity: 1;
|
| &[disabled] {
| opacity: 0.6;
| }
| }
|
| .txt {
| font-size: 32rpx;
| color: #FFFFFF;
| }
| }
| </style>
|
|