|
|
@@ -29,10 +29,6 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="group-card">
|
|
|
- <!-- <view class="list-item">
|
|
|
- <text class="item-title">工作类型</text>
|
|
|
- <view class="tag-blue-outline">{{ userInfo.workType }}</view>
|
|
|
- </view> -->
|
|
|
<view class="list-item" @click="showStatusPicker">
|
|
|
<text class="item-title">工作状态</text>
|
|
|
<view class="item-right">
|
|
|
@@ -101,8 +97,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// 引入 API @author steelwei
|
|
|
-import { getMyProfile, updateAvatar, updateName, updateStatus, updateCity } from '@/api/fulfiller/fulfiller'
|
|
|
+// 引入 API
|
|
|
+import { getMyProfile, updateAvatar, updateStatus, updateCity } from '@/api/fulfiller/fulfiller'
|
|
|
import { uploadFile } from '@/api/fulfiller/app'
|
|
|
import { getAreaStationList } from '@/api/system/areaStation'
|
|
|
|
|
|
@@ -139,44 +135,40 @@ export default {
|
|
|
uni.$off('updateName');
|
|
|
},
|
|
|
methods: {
|
|
|
- // 加载用户信息 @author steelwei
|
|
|
+ // 加载用户信息
|
|
|
async loadUserInfo() {
|
|
|
uni.showLoading({ title: '加载中...' });
|
|
|
try {
|
|
|
const res = await getMyProfile();
|
|
|
- if (res.code === 200) {
|
|
|
- const data = res.data;
|
|
|
- this.userInfo = {
|
|
|
- name: data.realName || data.name,
|
|
|
- workType: data.workType === 'full_time' ? '全职' : '兼职',
|
|
|
- workStatus: this.formatStatus(data.status),
|
|
|
- city: data.cityName || '',
|
|
|
- avatar: data.avatarUrl || '/static/touxiang.png',
|
|
|
- stationName: data.stationName || '',
|
|
|
- stationFullName: '加载中...'
|
|
|
- };
|
|
|
-
|
|
|
- // 异步查找完整路径
|
|
|
- if (data.stationId) {
|
|
|
- if (this.fullTree.length === 0) {
|
|
|
- await this.loadAreaStationTree();
|
|
|
- }
|
|
|
- this.userInfo.stationFullName = this.findStationFullName(data.stationId, this.fullTree) || data.stationName || '未分配站点';
|
|
|
- } else {
|
|
|
- this.userInfo.stationFullName = '未分配站点';
|
|
|
+ const data = res.data;
|
|
|
+ this.userInfo = {
|
|
|
+ name: data.realName || data.name,
|
|
|
+ workType: data.workType === 'full_time' ? '全职' : '兼职',
|
|
|
+ workStatus: this.formatStatus(data.status),
|
|
|
+ city: data.cityName || '',
|
|
|
+ avatar: data.avatarUrl || '/static/touxiang.png',
|
|
|
+ stationName: data.stationName || '',
|
|
|
+ stationFullName: '加载中...'
|
|
|
+ };
|
|
|
+
|
|
|
+ // 异步查找完整路径
|
|
|
+ if (data.stationId) {
|
|
|
+ if (this.fullTree.length === 0) {
|
|
|
+ await this.loadAreaStationTree();
|
|
|
}
|
|
|
+ this.userInfo.stationFullName = this.findStationFullName(data.stationId, this.fullTree) || data.stationName || '未分配站点';
|
|
|
} else {
|
|
|
- uni.showToast({ title: res.msg || '加载失败', icon: 'none' });
|
|
|
+ this.userInfo.stationFullName = '未分配站点';
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('加载用户信息失败:', error);
|
|
|
- uni.showToast({ title: '网络错误', icon: 'none' });
|
|
|
+ uni.showToast({ title: error.message || error.msg || '加载信息失败', icon: 'none' });
|
|
|
} finally {
|
|
|
uni.hideLoading();
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 格式化状态 @author steelwei
|
|
|
+ // 格式化状态
|
|
|
formatStatus(status) {
|
|
|
const statusMap = {
|
|
|
'busy': '接单中',
|
|
|
@@ -186,7 +178,7 @@ export default {
|
|
|
return statusMap[status] || status;
|
|
|
},
|
|
|
|
|
|
- // 查找站点完整路径 (城市/区域/站点) @author steelwei
|
|
|
+ // 查找站点完整路径 (城市/区域/站点)
|
|
|
findStationFullName(stationId, tree) {
|
|
|
if (!stationId || !tree || tree.length === 0) return '';
|
|
|
|
|
|
@@ -214,7 +206,7 @@ export default {
|
|
|
uni.navigateBack({ delta: 1 });
|
|
|
},
|
|
|
|
|
|
- // 修改头像 @author steelwei
|
|
|
+ // 修改头像
|
|
|
changeAvatar() {
|
|
|
uni.chooseImage({
|
|
|
count: 1,
|
|
|
@@ -225,21 +217,15 @@ export default {
|
|
|
uni.showLoading({ title: '上传中...' });
|
|
|
try {
|
|
|
const uploadRes = await uploadFile(tempFilePath);
|
|
|
- if (uploadRes.code === 200) {
|
|
|
- const { url, ossId } = uploadRes.data;
|
|
|
-
|
|
|
- // 调用接口更新头像 @author steelwei
|
|
|
- const result = await updateAvatar(ossId);
|
|
|
- if (result.code === 200) {
|
|
|
- this.userInfo.avatar = url;
|
|
|
- uni.showToast({ title: '修改成功', icon: 'success' });
|
|
|
- } else {
|
|
|
- uni.showToast({ title: result.msg || '修改失败', icon: 'none' });
|
|
|
- }
|
|
|
- }
|
|
|
+ const { url, ossId } = uploadRes.data;
|
|
|
+
|
|
|
+ // 调用接口更新头像
|
|
|
+ await updateAvatar(ossId);
|
|
|
+ this.userInfo.avatar = url;
|
|
|
+ uni.showToast({ title: '修改成功', icon: 'success' });
|
|
|
} catch (error) {
|
|
|
console.error('修改头像失败:', error);
|
|
|
- uni.showToast({ title: '上传失败', icon: 'none' });
|
|
|
+ uni.showToast({ title: error.message || error.msg || '上传失败', icon: 'none' });
|
|
|
} finally {
|
|
|
uni.hideLoading();
|
|
|
}
|
|
|
@@ -261,7 +247,7 @@ export default {
|
|
|
this.isStatusPickerShow = false;
|
|
|
},
|
|
|
|
|
|
- // 选择状态 @author steelwei
|
|
|
+ // 选择状态
|
|
|
async selectStatus(statusText) {
|
|
|
const statusMap = {
|
|
|
'接单中': 'busy',
|
|
|
@@ -270,22 +256,18 @@ export default {
|
|
|
const status = statusMap[statusText];
|
|
|
|
|
|
try {
|
|
|
- const res = await updateStatus(status);
|
|
|
- if (res.code === 200) {
|
|
|
- this.userInfo.workStatus = statusText;
|
|
|
- uni.showToast({ title: '状态已更新', icon: 'success' });
|
|
|
- } else {
|
|
|
- uni.showToast({ title: res.msg || '修改失败', icon: 'none' });
|
|
|
- }
|
|
|
+ await updateStatus(status);
|
|
|
+ this.userInfo.workStatus = statusText;
|
|
|
+ uni.showToast({ title: '状态已更新', icon: 'success' });
|
|
|
} catch (error) {
|
|
|
console.error('修改状态失败:', error);
|
|
|
- uni.showToast({ title: '网络错误', icon: 'none' });
|
|
|
+ uni.showToast({ title: error.message || error.msg || '状态更新失败', icon: 'none' });
|
|
|
} finally {
|
|
|
this.closeStatusPicker();
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 城市和站点级联选择器 @author steelwei
|
|
|
+ // 城市和站点级联选择器
|
|
|
async showCityPicker() {
|
|
|
this.isCityPickerShow = true;
|
|
|
if (this.fullTree.length === 0) {
|
|
|
@@ -317,6 +299,7 @@ export default {
|
|
|
} catch (err) {
|
|
|
console.error('加载站点数据失败:', err);
|
|
|
this.fullTree = [];
|
|
|
+ uni.showToast({ title: err.message || err.msg || '获取站点失败', icon: 'none' });
|
|
|
} finally {
|
|
|
uni.hideLoading();
|
|
|
}
|
|
|
@@ -352,7 +335,7 @@ export default {
|
|
|
this.currentCityList = parent ? parent.children : [];
|
|
|
}
|
|
|
},
|
|
|
- // 确认城市与站点选择 @author steelwei
|
|
|
+ // 确认城市与站点选择
|
|
|
async confirmCity() {
|
|
|
if (this.selectedPathway.length === 0) {
|
|
|
uni.showToast({ title: '请选择站点', icon: 'none' });
|
|
|
@@ -369,19 +352,15 @@ export default {
|
|
|
};
|
|
|
|
|
|
try {
|
|
|
- const res = await updateCity(reqData);
|
|
|
- if (res.code === 200) {
|
|
|
- this.userInfo.stationFullName = fullName;
|
|
|
- uni.showToast({ title: '修改成功', icon: 'success' });
|
|
|
- this.closeCityPicker();
|
|
|
- // 重置以便下一次打开
|
|
|
- this.selectedPathway = [];
|
|
|
- } else {
|
|
|
- uni.showToast({ title: res.msg || '修改失败', icon: 'none' });
|
|
|
- }
|
|
|
+ await updateCity(reqData);
|
|
|
+ this.userInfo.stationFullName = fullName;
|
|
|
+ uni.showToast({ title: '修改成功', icon: 'success' });
|
|
|
+ this.closeCityPicker();
|
|
|
+ // 重置以便下一次打开
|
|
|
+ this.selectedPathway = [];
|
|
|
} catch (error) {
|
|
|
console.error('修改失败:', error);
|
|
|
- uni.showToast({ title: '网络错误', icon: 'none' });
|
|
|
+ uni.showToast({ title: error.message || error.msg || '站点更新失败', icon: 'none' });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -422,7 +401,6 @@ page {
|
|
|
|
|
|
.header-title {
|
|
|
font-size: 28rpx;
|
|
|
- /* 14pt */
|
|
|
font-weight: bold;
|
|
|
color: #333;
|
|
|
}
|
|
|
@@ -473,7 +451,6 @@ page {
|
|
|
|
|
|
.user-avatar {
|
|
|
width: 64rpx;
|
|
|
- /* Smaller avatar */
|
|
|
height: 64rpx;
|
|
|
border-radius: 50%;
|
|
|
}
|
|
|
@@ -489,15 +466,6 @@ page {
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
|
|
|
-.tag-blue-outline {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #2979FF;
|
|
|
- border: 1px solid #2979FF;
|
|
|
- padding: 4rpx 20rpx;
|
|
|
- border-radius: 30rpx;
|
|
|
- background-color: #fff;
|
|
|
-}
|
|
|
-
|
|
|
/* Popup Styles */
|
|
|
.popup-mask {
|
|
|
position: fixed;
|
|
|
@@ -517,7 +485,6 @@ page {
|
|
|
border-top-left-radius: 20rpx;
|
|
|
border-top-right-radius: 20rpx;
|
|
|
padding-bottom: 30rpx;
|
|
|
- /* Safe area */
|
|
|
}
|
|
|
|
|
|
.popup-title {
|
|
|
@@ -569,7 +536,7 @@ page {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
-/* 级联城市选择器(与我要加入页面一致) */
|
|
|
+/* 级联城市选择器 */
|
|
|
.picker-body {
|
|
|
display: flex;
|
|
|
height: 500rpx;
|