diff --git a/src/api/login.ts b/src/api/login.ts
index e1294d9..92c221b 100644
--- a/src/api/login.ts
+++ b/src/api/login.ts
@@ -14,10 +14,9 @@ export function getMobile(data: { code: string; openid: string }) {
})
}
-export function getUserInfo(data: { mobile: string }) {
+export function getAdminPhone() {
return request.http({
- url: '/api/member_mobile',
- method: 'GET',
- data
+ url: '/api/admin_mobile',
+ method: 'GET'
})
}
diff --git a/src/api/user.ts b/src/api/user.ts
index d153bf4..d348453 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -1,9 +1,51 @@
import { request } from '@/utils/http'
-export function getUserList(data: { name: string }) {
+export interface listType {
+ name: string
+ age: number
+ sex: number
+ nation: string
+ mobile: string
+ position: string
+ work_unit: string
+}
+
+export interface dateListtype extends listType {
+ id: number
+}
+
+export function infoForOpenid(data: { openid: string }) {
+ return request.http({
+ url: '/api/member',
+ method: 'GET',
+ data
+ })
+}
+export function list(data: { name: string }) {
return request.http({
- url: '/api/openid',
+ url: '/api/member_name',
method: 'GET',
data
})
}
+
+export function update(data: { [n: string]: string }, openid: string) {
+ return request.http({
+ url: '/api/member_update',
+ data: Object.assign(data, { openid })
+ })
+}
+
+export function bind(data: { id: number; openid: string }) {
+ return request.http({
+ url: '/api/name_sub',
+ data
+ })
+}
+
+export function add(data: listType) {
+ return request.http({
+ url: '/api/member_add',
+ data
+ })
+}
diff --git a/src/pages.json b/src/pages.json
index 8ba162d..8156b95 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -7,14 +7,6 @@
}
},
"pages": [
- {
- "path": "pages/login/login",
- "style": {
- "navigationBarTitleText": "登录",
- "enablePullDownRefresh": false,
- "navigationStyle": "custom"
- }
- },
{
"path": "pages/votingElection/index",
"style": {
@@ -75,6 +67,14 @@
"navigationBarTitleText": "个人信息",
"enablePullDownRefresh": false
}
+ },
+ {
+ "path": "pages/login/login",
+ "style": {
+ "navigationBarTitleText": "登录",
+ "enablePullDownRefresh": false,
+ "navigationStyle": "custom"
+ }
}
],
"globalStyle": {
diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue
index e19b06b..2577394 100644
--- a/src/pages/login/login.vue
+++ b/src/pages/login/login.vue
@@ -40,9 +40,9 @@ const onGetPhoneNumber = debounce(async (e: phoneEvent) => {
}
const { data: phone } = (await getMobile({ openid: userStore.openId, code: e.detail.code })) as { data: string }
- userStore.userInfo.mobile = phone
+ userStore.mobile = phone
- userStore.getUserInfo({ mobile: phone })
+ userStore.getUserInfo()
onLoginSuccess()
} catch (error) {
@@ -63,7 +63,7 @@ const onLoginSuccess = () => {
}
onShow(() => {
- if (userStore.userInfo.mobile) {
+ if (userStore.mobile) {
onLoginSuccess()
}
})
diff --git a/src/pages/mine/add.vue b/src/pages/mine/add.vue
index 6d9e220..fc58bd7 100644
--- a/src/pages/mine/add.vue
+++ b/src/pages/mine/add.vue
@@ -1,54 +1,88 @@
- 姓名
+ 姓名
-
+
- 电话
+ 电话
-
+
性别
-
+
民族
-
+
年龄
-
+
- 工作单位
+ 工作单位
-
+
职位
-
+
- 确认信息
+ 确认信息
@@ -84,6 +118,17 @@
&-label {
color: #4b5563;
+ position: relative;
+
+ &.required::before {
+ content: '*';
+ color: #f56c6c;
+ margin-right: 4px;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: -16rpx;
+ }
}
&-content {
diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue
index e6870f6..aa55fb2 100644
--- a/src/pages/mine/index.vue
+++ b/src/pages/mine/index.vue
@@ -1,55 +1,126 @@
-
+
姓名
- 搜索
+ 搜索
-
-
- 姓名
-
- 陈思远
+
+
+
+ 姓名
+ {{ row.name }}
-
-
- 电话
-
- 138 8888 8888
+
+ 电话
+ {{ row.mobile }}
-
-
- 工作单位
-
- 未来科技有限公司
+
+ 工作单位
+ {{ row.work_unit }}
-
+
+
- 确认信息
- 新建信息
+ 确认信息
+ 新建信息
@@ -59,48 +130,48 @@ const getList = () => {
姓名
- 陈思远
+ {{ userStore.userInfo.name }}
电话
- 138 8888 8888
+ {{ userStore.userInfo.mobile }}
性别
- 男
-
+ {{ userStore.userInfo.sex === 1 ? '男' : '女' }}
+
民族
- 汉族
-
+ {{ userStore.userInfo.nation }}
+
年龄
- 28
-
+ {{ userStore.userInfo.age }}
+
工作单位
- 未来科技有限公司
-
+ {{ userStore.userInfo.work_unit }}
+
职位
- 高级产品经理
-
+ {{ userStore.userInfo.position }}
+
@@ -108,11 +179,23 @@ const getList = () => {
* 姓名和电话信息需要管理员修改
管理员电话:
- 400-123-4567
+ {{ amdinPhone }}
- 确认信息
+
+
+
+
@@ -120,10 +203,25 @@ const getList = () => {
.userview {
width: 100%;
padding: 32rpx;
- min-height: calc(100vh - 94px);
+ min-height: 100vh;
box-sizing: border-box;
background-color: #f9fafb;
+ .popupView {
+ width: 90vw;
+ padding: 20rpx 40rpx 0;
+
+ .title {
+ font-size: 36rpx;
+ font-weight: 500;
+ margin-bottom: 40rpx;
+ }
+
+ .bts {
+ margin-top: 40rpx;
+ }
+ }
+
.box {
margin-bottom: 32rpx;
border-radius: 24rpx;
@@ -153,7 +251,7 @@ const getList = () => {
padding: 0 32rpx 32rpx;
border: 1rpx solid #fff;
- &.border {
+ &.active {
border-color: #2563eb;
}
diff --git a/src/store/user.ts b/src/store/user.ts
index 26c2c86..7aa721a 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -1,7 +1,8 @@
// 定义组合式API仓库
import { defineStore } from 'pinia'
import { getPrefixName } from '@/config'
-import { getOpenid, getUserInfo as getUserInfoApi } from '@/api/login'
+import { getOpenid } from '@/api/login'
+import { infoForOpenid, bind as bindApi } from '@/api/user'
interface userInfoStoreInt {
[n: string]: any
@@ -10,11 +11,8 @@ export default defineStore(
getPrefixName('user'),
() => {
const openId = ref('')
- const userInfo = ref({
- mobile: ''
- })
-
- const checkLogin = computed(() => openId.value !== '')
+ const mobile = ref('')
+ const userInfo = ref({})
function getopenid(params: { code: string }) {
return new Promise((resolve, reject) => {
@@ -32,13 +30,13 @@ export default defineStore(
})
}
- function getUserInfo(params: { mobile: string }) {
+ function getUserInfo() {
return new Promise((resolve, reject) => {
- getUserInfoApi(params)
+ infoForOpenid({ openid: openId.value })
.then((res) => {
const { data } = res as { data: userInfoStoreInt }
- userInfo.value = Object.assign(userInfo.value, data)
+ userInfo.value = data
resolve({ code: 1, data, message: 'SUCCESS' })
})
@@ -48,6 +46,18 @@ export default defineStore(
})
}
+ function bindUser(id: number) {
+ return new Promise((resolve, reject) => {
+ bindApi({ id, openid: openId.value })
+ .then(() => {
+ resolve({ code: 1, message: 'SUCCESS' })
+ })
+ .catch((err) => {
+ reject(err)
+ })
+ })
+ }
+
function logOut() {
userInfo.value = {}
uni.clearStorageSync()
@@ -64,9 +74,10 @@ export default defineStore(
return {
openId,
+ mobile,
userInfo,
- checkLogin,
getopenid,
+ bindUser,
getUserInfo,
logOut
}