diff --git a/api/httpSetting.js b/api/httpSetting.js index c1110f4..805e0d5 100644 --- a/api/httpSetting.js +++ b/api/httpSetting.js @@ -22,7 +22,7 @@ const BASE_URL = baseApi[env] || 'http://110.40.156.216:30005/api'; function request(url, method, data = {}) { - const userInfo = uni.getStorageSync('loginInfo') || {}; + const loginRes = uni.getStorageSync('loginRes') || {}; const UTCOffset = new Date().getTimezoneOffset(); return new Promise((resolve, reject) => { uni.request({ @@ -30,12 +30,9 @@ function request(url, method, data = {}) { method: method, data: data, header: { - 'AccessToken': userInfo.accessToken || '-1', // 请求头,可根据需要调整 - 'UserId': userInfo.userId || '1', // 请求头,可根据需要调整 - 'LanguageType': 0, - 'LoginName': userInfo.loginName || '', - 'CompanyId': userInfo.companyId || '', - 'UTCOffset': UTCOffset, + 'AccessToken': loginRes.accessToken || '-1', // 请求头,可根据需要调整 + 'UserId': loginRes.appUserId || '-1', // 请求头,可根据需要调整 + 'LanguageType': 0, }, success: (res) => { if (res.statusCode === 200) { @@ -45,24 +42,6 @@ function request(url, method, data = {}) { } else { reject(res.data) } - /* if (res.data.code === 500) { - uni.showToast({ - title: '系统错误', // 提示的文本内容 - icon: 'none', // 提示的图标,可选值:'success' | 'loading' | 'none' - duration: 2000 // 提示框的显示时间,单位为毫秒,默认1500ms - }); - } - if (res.data.code === 401) { - uni.showToast({ - title: '登录过期,重新登录中', // 提示的文本内容 - icon: 'none', // 提示的图标,可选值:'success' | 'loading' | 'none' - duration: 2000 // 提示框的显示时间,单位为毫秒,默认1500ms - }); - } - if (res.data.code === 20001) { - reject(res.data); - } - resolve(res.data) */ } else { reject(res); } @@ -88,4 +67,48 @@ export function get(url, params = {}) { // POST 请求 export function post(url, data = {}) { return request(url, 'POST', data); -} \ No newline at end of file +} + +export function uploadFile(url, filePath = '', data = {}) { + const loginRes = uni.getStorageSync('loginRes') || {}; + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: BASE_URL + url, // 完整的URL + filePath: filePath, + name: 'image', + header: { + 'AccessToken': loginRes.accessToken || '-1', // 请求头,可根据需要调整 + 'UserId': loginRes.appUserId || '-1', // 请求头,可根据需要调整 + LanguageType: 0, + // 其他需要的请求头信息(如Token) + }, + formData: data, + success: (res) => { + if (res.statusCode === 200) { + if (res.data.code === 500) { + uni.showToast({ + title: '系统错误', // 提示的文本内容 + icon: 'none', // 提示的图标,可选值:'success' | 'loading' | 'none' + duration: 2000 // 提示框的显示时间,单位为毫秒,默认1500ms + }); + } + if (res.data.code === 20001) { + reject(res.data); + } + resolve(res.data); // 返回数据 + } else { + reject(res.data); // 返回错误信息 + } + }, + fail: (err) => { + uni.showToast({ + title: '请求错误', // 提示的文本内容 + icon: 'none', // 提示的图标,可选值:'success' | 'loading' | 'none' + duration: 2000 // 提示框的显示时间,单位为毫秒,默认1500ms + }); + reject(err); // 请求失败 + } + }); + }) + +} diff --git a/api/index.js b/api/index.js index 37fc018..2c0ec7a 100644 --- a/api/index.js +++ b/api/index.js @@ -1,4 +1,4 @@ -import { get, post } from "./httpSetting"; +import { get, post, uploadFile } from "./httpSetting"; /** * 登录 @@ -6,3 +6,12 @@ import { get, post } from "./httpSetting"; export const userLogin = (params ={}) => post('/app/auth/login', params); export const getAppJobVO = (params ={}) => get('/app/job/getAppJobVO', params); + +export const appUserQuery = (params ={}) => get('/app/user/query', params); + +export const appUserEditAvatar = (filePath, params ={}) => uploadFile('/app/user/editAvatar', filePath, params); + +export const appserEditUser = (params ={}) => post('/app/user/editUser', params); + +export const factoryMapGetListPage = (params ={}) => get('/app/factoryMap/getListPage', params); + diff --git a/components/popup-drawer/popup-drawer.vue b/components/popup-drawer/popup-drawer.vue new file mode 100644 index 0000000..975acd5 --- /dev/null +++ b/components/popup-drawer/popup-drawer.vue @@ -0,0 +1,278 @@ + + + + + diff --git a/components/recruitment/recruitment.vue b/components/recruitment/recruitment.vue index e0c922f..09a479c 100644 --- a/components/recruitment/recruitment.vue +++ b/components/recruitment/recruitment.vue @@ -4,7 +4,7 @@

{{dataSource.factoryName || '默认工厂'}}

- {{dataSource.factoryType || '电子厂'}} +
{{dataSource.workTime || '8:00-20:00'}} - {{dataSource.workType || '两班倒'}} - {{dataSource.workContent || '主营汽车线束'}} - {{dataSource.distance || '距你2.5km'}} + {{dataSource.gender}} + {{dataSource.jobName || '主营汽车线束'}} + {{`距你${Math.round(dataSource.distanceMeters)}米`}} + {{item.tagName}} @@ -55,36 +56,38 @@ }, data() { return { - isFavorite: false, - companyData: [{ + isFavorite: false + }; + }, + computed: { + companyData() { + return [ + { label: '薪资', - value: '20', + value: this.dataSource.hourlyWage || '无', // 使用默认值25 unit: '', exLabel: '元/小时' }, { label: '年龄', - value: '20-42', + value: this.dataSource.ageRange || '无', unit: '', exLabel: '元/小时' }, { label: '吃饭', - value: '2', + value: this.dataSource.mealPlan || '无', unit: '餐', exLabel: '白-夜' }, { label: '住宿', - value: '20', + value: this.dataSource.dorm || '无', unit: '', exLabel: '人间' }, - ], - - }; - }, - computed: { + ]; + }, processedCompanyData() { return this.dataSource.companyData || this.companyData; } @@ -94,7 +97,7 @@ makeCall(e) { e.stopPropagation(); uni.makePhoneCall({ - phoneNumber: '400-123-4567' + phoneNumber: this.dataSource.phoneNumber }); }, // 切换收藏状态 @@ -196,7 +199,8 @@ gap: 12px; font-size: 12px; color: #666; - margin-bottom: 12px; + margin-bottom: 12px; + flex-wrap: wrap; } .card-bm { diff --git a/pages.json b/pages.json index 6548280..c42e78b 100644 --- a/pages.json +++ b/pages.json @@ -18,6 +18,13 @@ "navigationBarTitleText": "个人中心" } }, + { + "path" : "pages/my/editProfile", + "style" : + { + "navigationBarTitleText" : "编辑资料" + } + }, { "path" : "pages/map/map", "style" : diff --git a/pages/index/index.vue b/pages/index/index.vue index 57c291e..a54f3a1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,92 +1,323 @@ - \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index 55ad5f1..ba3923e 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -38,7 +38,7 @@ + + \ No newline at end of file diff --git a/pages/my/my.vue b/pages/my/my.vue index 306b264..9dfc78c 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -1,11 +1,19 @@