diff --git a/api/modules/config.js b/api/modules/config.js
index d30227a..f3158df 100644
--- a/api/modules/config.js
+++ b/api/modules/config.js
@@ -9,8 +9,18 @@ export default {
})
},
+ async queryDepartmentList() {
+ return http({
+ url: '/config/queryDepartmentList',
+ method: 'GET'
+ })
+ },
-
-
-
+ // 获取分类的接口
+ async queryCategoryList(){
+ return http({
+ url: '/config/queryCategoryList',
+ method: 'GET'
+ })
+ }
}
\ No newline at end of file
diff --git a/api/modules/exhibit.js b/api/modules/exhibit.js
index e69de29..f3e7469 100644
--- a/api/modules/exhibit.js
+++ b/api/modules/exhibit.js
@@ -0,0 +1,32 @@
+import http from "@/api/http";
+
+export default {
+
+ // 查看展品信息列表
+ async queryShowpieceList(data) {
+ return http({
+ url: '/showpiece/queryShowpieceList',
+ method: 'GET',
+ data
+ })
+ },
+
+ // 查看维修记录列表
+ async queryRepairList(data) {
+ return http({
+ url: '/showpiece/queryRepairList',
+ method: 'GET',
+ data
+ })
+ },
+
+ // 保养-新增保养记录
+ async addMaintenance(data) {
+ return http({
+ url: '/showpiece/addMaintenance',
+ method: 'POST',
+ data,
+ needToken: true
+ })
+ },
+}
\ No newline at end of file
diff --git a/api/modules/login.js b/api/modules/login.js
index 2373a7b..f2f63bb 100644
--- a/api/modules/login.js
+++ b/api/modules/login.js
@@ -18,8 +18,7 @@ export default {
// header: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// },
- showLoading: true,
- noToken: true
+ showLoading: true
})
}
}
\ No newline at end of file
diff --git a/api/modules/user.js b/api/modules/user.js
index 4d964a7..874db2b 100644
--- a/api/modules/user.js
+++ b/api/modules/user.js
@@ -2,39 +2,13 @@
import http from "@/api/http";
export default {
- // 兑换记录- 确认取货
- async finishOrder(data) {
- return http ({
- url: '/order/finishOrder',
- method: 'POST',
- data
- })
- },
-
- // 兑换记录- 查看订单详情
- async queryOrderById(data) {
- return http({
- url: '/order/queryOrderById',
- method: 'GET',
- data
- })
- },
-
- // 兑换记录- 查看订单列表
- async queryOrderList(data) {
- return http({
- url: '/order/queryOrderList',
- method: 'GET',
- data,
- // showLoading: true
- })
- },
// 我的资料- 获取个人信息
async queryUser() {
return http({
url: '/userInfo/queryUser',
- method: 'GET'
+ method: 'GET',
+ needToken: true
})
},
@@ -43,7 +17,8 @@ export default {
return http({
url: '/userInfo/updateUser',
method: 'POST',
- data
+ data,
+ needToken: true
})
},
}
\ No newline at end of file
diff --git a/mixins/config.js b/mixins/config.js
index 024cf32..225a913 100644
--- a/mixins/config.js
+++ b/mixins/config.js
@@ -1,7 +1,7 @@
export default {
data() {
return {
-
+ containerHeight: 0
}
},
methods: {
@@ -9,7 +9,15 @@ export default {
mixinCustomShare() {
return {
}
- }
+ },
+ // 计算容器高度
+ calculateContainerHeight() {
+ const systemInfo = uni.getSystemInfoSync();
+ const statusBarHeight = systemInfo.statusBarHeight || 0;
+ const navigationBarHeight = 44; // 默认导航栏高度
+ this.containerHeight = 2 * (systemInfo.windowHeight - statusBarHeight - navigationBarHeight);
+ console.log('最后的容器高度为', this.containerHeight/2 + 'px', '状态栏高度:', statusBarHeight + 'px', 'nav导航栏高度:', navigationBarHeight + 'px');
+ },
},
computed: {
// 获取全局配置的文本
@@ -27,9 +35,9 @@ export default {
// 默认的全局分享参数
GShare() {
return {
- title: this.configParamText('config_app_name'),
+ title: this.configParamText('app_name'),
desc: this.configParamText('share_desc'),
- imageUrl: this.configParamImage('config_logo'),
+ imageUrl: this.configParamImage('app_logo'),
path: '/pages/index/index'
}
}
@@ -45,5 +53,8 @@ export default {
...this.GShare,
...this.mixinCustomShare()
}
+ },
+ onLoad() {
+ // this.calculateContainerHeight();
}
}
diff --git a/mixins/list.js b/mixins/list.js
index cd5ae7d..e647bce 100644
--- a/mixins/list.js
+++ b/mixins/list.js
@@ -4,7 +4,7 @@ export default {
return {
list: [],
pageNo : 1,
- pageSize : 10,
+ pageSize : 8,
mixinListApi: '',
isLoading: false,
hasMore: true,
@@ -53,6 +53,8 @@ export default {
},
// 获取列表
async getList(isRefresh = false) {
+ // console.log('本次请求的pageNo和pageSize', this.pageNo, this.pageSize)
+
if (!this.hasMore) {
return
}
@@ -66,6 +68,7 @@ export default {
if (this.beforeUpdateDataFn) {
this.beforeUpdateDataFn(this.list)
}
+
const res = await apiMethod({
pageNo: this.pageNo,
pageSize: this.pageSize,
diff --git a/pages.json b/pages.json
index 450d3bd..c8ab294 100644
--- a/pages.json
+++ b/pages.json
@@ -35,7 +35,7 @@
{
"path": "login/userInfo",
"style": {
- "navigationBarTitleText": ""
+ "navigationBarTitleText": "补充信息"
}
},
{
diff --git a/pages/components/SearchInput.vue b/pages/components/SearchInput.vue
index 1120ac7..88f0906 100644
--- a/pages/components/SearchInput.vue
+++ b/pages/components/SearchInput.vue
@@ -1,7 +1,7 @@
-
+
- {{ searchButtonText }}
+ {{ searchButtonText }}
@@ -59,6 +58,7 @@ export default {
this.$emit('input', this.inputValue)
},
handleSearch() {
+ // console.log('搜索的数值为', this.inputValue);
this.$emit('search', this.inputValue)
}
}
diff --git a/pages/index/home.vue b/pages/index/home.vue
index 92e4c43..f8c8dab 100644
--- a/pages/index/home.vue
+++ b/pages/index/home.vue
@@ -31,7 +31,7 @@
-
+
+
+
+
+
diff --git a/subPages/login/login.vue b/subPages/login/login.vue
index 2c9b78f..4577f7b 100644
--- a/subPages/login/login.vue
+++ b/subPages/login/login.vue
@@ -29,7 +29,7 @@
- 阅读并同意我们的
+ 阅读并同意我们的
《服务协议与隐私条款》
与
《个人信息保护指引》
@@ -38,6 +38,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -52,18 +70,43 @@ export default {
methods: {
// 授权登录
handleLogin() {
- // 这里实现微信授权登录逻辑
- console.log('授权登录');
- // 可以调用微信授权API
- // uni.getUserProfile({
- // desc: '用于完善用户资料',
- // success: (res) => {
- // // 登录成功后跳转
- // uni.switchTab({
- // url: '/pages/index/home'
- // });
- // }
- // });
+
+ if (!this.isAgreed) {
+ this.$refs.serviceModal.open();
+ this.$refs.guideModal.open();
+ return
+ }
+ uni.login({
+ provider: 'weixin',
+ success: async (res) => {
+ console.log('登录成功', res);
+ const { result: loginRes} = await this.$api.login.login({
+ code: res.code
+ })
+
+ uni.setStorageSync('token', loginRes.token)
+ const userInfo = loginRes.userInfo
+ if ( !userInfo.department || !userInfo.headImage || !userInfo.nickName || !userInfo.phone ){
+ uni.navigateTo({
+ url: '/subPages/login/userInfo'
+ })
+ return
+ }else {
+ uni.showToast({
+ title: '登录成功',
+ icon: 'success'
+ })
+ uni.switchTab({
+ url: '/pages/index/home'
+ });
+ }
+ // 登录成功后可以调用后端接口保存用户信息
+ },
+ fail: (err) => {
+ console.log('登录失败', err);
+ }
+ })
+
},
// 游客登录
@@ -77,12 +120,14 @@ export default {
// 显示服务协议
showServiceAgreement() {
+ this.$refs.serviceModal.open();
console.log('查看服务协议');
// 这里可以跳转到协议页面或显示弹窗
},
// 显示隐私政策
showPrivacyPolicy() {
+ this.$refs.guideModal.open();
console.log('查看隐私条款');
// 这里可以跳转到隐私政策页面或显示弹窗
},
diff --git a/subPages/login/otherDemo.vue b/subPages/login/otherDemo.vue
new file mode 100644
index 0000000..ffd9c02
--- /dev/null
+++ b/subPages/login/otherDemo.vue
@@ -0,0 +1,415 @@
+
+
+
+
+
+
+
+
+
+ {{ configParamText('config_app_name') }}
+
+
+
+
+
+
+
+
+ 头像
+
+
+
+
+
+
+
+ 昵称
+
+
+
+
+
+ 手机号
+
+
+
+
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/subPages/login/userInfo.vue b/subPages/login/userInfo.vue
index e8922ad..b1b2f71 100644
--- a/subPages/login/userInfo.vue
+++ b/subPages/login/userInfo.vue
@@ -1,6 +1,94 @@
-
- 用户信息
+
+
+
+
+
+
+
+ {{ configParamText('app_name') }}
+ 申请获取您的头像,昵称
+
+
+
+
+
+
+
+ 头像
+
+
+
+
+
+ 昵称
+
+
+
+
+
+ 手机号
+
+
+
+ {{ userInfo.phone }}
+
+
+
+
+ 所在部门
+
+ {{ userInfo.department.title || '请选择' }}
+
+
+
+
+
+
+ 备注
+
+
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
@@ -12,13 +100,36 @@ export default {
userInfo: {
headImage: '',
nickName: '',
- phone: ''
- }
+ phone: '',
+ department: {
+ title: '',
+ id: ''
+ },
+ remark: ''
+ },
+ showDepartmentSheet: false,
+ // 部门选择器数据
}
},
- onLoad() {
- // 获取微信用户信息
- // this.getWechatUserInfo();
+ async onLoad() {
+ this.calculateContainerHeight();
+ await this.getUserInfo();
+ },
+ computed: {
+ // 部门选择器数据格式转换
+ departmentColumns() {
+ if (!this.$store.state.departmentList || this.$store.state.departmentList.length === 0) {
+ return [[]]
+ }
+
+ const departmentNames = this.$store.state.departmentList.map(item => {
+ return {
+ title: item.title,
+ id: item.id
+ }
+ })
+ return [departmentNames]
+ }
},
methods: {
// 获取微信用户信息
@@ -30,6 +141,12 @@ export default {
},
// 提交表单
+ async getUserInfo(){
+ const { result:info } = await this.$api.user.queryUser()
+ this.userInfo.nickName = info.nickName
+ this.userInfo.headImage = info.headImage
+ this.userInfo.phone = info.phone
+ },
// 选择头像并上传到OSS
async onChooseAvatar(e) {
@@ -59,12 +176,7 @@ export default {
icon: 'success'
});
} else {
- // 上传失败,使用本地头像
- // this.userInfo.headImage = e.detail.avatarUrl;
- uni.showToast({
- title: '头像上传失败!请稍后重试!',
- icon: 'none'
- });
+
}
} catch (error) {
uni.hideLoading();
@@ -87,7 +199,7 @@ export default {
// 昵称输入失焦
onNicknameBlur() {
- if (!this.userInfo.nickname.trim()) {
+ if (!this.userInfo.nickName.trim()) {
uni.showToast({
title: '请输入昵称',
icon: 'none'
@@ -95,6 +207,27 @@ export default {
}
},
+ // 显示部门选择器
+ showDepartmentPicker() {
+ this.$refs.departmentPicker.open();
+ },
+
+ // 确认部门选择
+ confirmDepartment(e) {
+ this.userInfo.department = e.value[0];
+ },
+
+ // 取消部门选择
+ cancelDepartment() {
+ // 取消操作
+ },
+
+ // 选择部门(保留原方法以防其他地方使用)
+ selectDepartment(item) {
+ this.userInfo.department = item.value;
+ this.showDepartmentSheet = false;
+ },
+
// 获取手机号
async getPhoneNumber(e) {
console.log('获取手机号回调', e);
@@ -110,9 +243,6 @@ export default {
title: '手机号获取成功',
icon: 'success'
});
- // 这里需要将e.detail.code发送到后端解密获取真实手机号
- // 暂时模拟设置手机号
- // this.userInfo.phone = '138****8888';
} else {
// 如果失败了就申请开启权限
uni.showToast({
@@ -134,15 +264,15 @@ export default {
if (!this.userInfo.phone.trim()) {
uni.showToast({
- title: '请输入手机号',
+ title: '请获取手机号',
icon: 'none'
});
return;
}
- if (!/^1[3-9]\d{9}$/.test(this.userInfo.phone)) {
+ if (!this.userInfo.department.title.trim()) {
uni.showToast({
- title: '请输入正确的手机号',
+ title: '请选择所在部门',
icon: 'none'
});
return;
@@ -150,26 +280,34 @@ export default {
console.log('提交用户信息', this.userInfo);
- // 提交用户信息
- await this.$api.user.updateUser({
- nickName: this.userInfo.nickName,
- phone: this.userInfo.phone,
- headImage: this.userInfo.headImage,
- address: ''
- })
+ try {
+ // 提交用户信息
+ await this.$api.user.updateUser({
+ nickName: this.userInfo.nickName,
+ phone: this.userInfo.phone,
+ headImage: this.userInfo.headImage,
+ department: this.userInfo.department.id,
+ remark: this.userInfo.remark
+ });
- // 这里可以调用API保存用户信息
- uni.showToast({
- title: '信息保存成功',
- icon: 'success'
- });
-
- // 跳转到首页或其他页面
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/index/index'
+ uni.showToast({
+ title: '信息保存成功',
+ icon: 'success'
});
- }, 1000);
+
+ // 跳转到首页
+ setTimeout(() => {
+ uni.switchTab({
+ url: '/pages/index/home'
+ });
+ }, 1000);
+ } catch (error) {
+ console.error('保存用户信息失败:', error);
+ uni.showToast({
+ title: '保存失败,请重试',
+ icon: 'none'
+ });
+ }
}
}
}
@@ -177,164 +315,159 @@ export default {
\ No newline at end of file
diff --git a/subPages/user/profile.vue b/subPages/user/profile.vue
index 9d1684d..c919b34 100644
--- a/subPages/user/profile.vue
+++ b/subPages/user/profile.vue
@@ -12,8 +12,8 @@
@@ -30,7 +30,7 @@
昵称
{
- uni.navigateBack()
- }, 1500)
+ if (res.code === 200) {
+ uni.showToast({
+ title: '保存成功',
+ icon: 'success'
+ })
+
+ // 延迟返回上一页
+ setTimeout(() => {
+ uni.navigateBack()
+ }, 1500)
+ }
+ },
+
+ // 获取个人信息
+ async getProfile() {
+ const res = await this.$api.user.queryUser()
+ if (res.code === 200) {
+ this.userInfo = res.result
+ }
}
+ },
+ onLoad() {
+ this.getProfile()
}
}