diff --git a/uniapp/src/api/user.ts b/uniapp/src/api/user.ts index 8fa0de03..c81c137b 100644 --- a/uniapp/src/api/user.ts +++ b/uniapp/src/api/user.ts @@ -26,3 +26,18 @@ export function userMnpMobile(data: any) { export function userChangePwd(data: any) { return request.post({ url: '/user/changePwd', data }, { isAuth: true }) } + +// 绑定小程序 +export function mnpAuthBind(data: any) { + return request.post({ url: '/user/bindMnp', data }) +} + +// 绑定公众号 +export function oaAuthBind(data: any) { + return request.post({ url: '/user/bindOa', data }) +} + +//更新微信小程序头像昵称 +export function updateUser(data: Record, header: any) { + return request.post({ url: '/user/updateUser', data, header }) +} diff --git a/uniapp/src/components/avatar-upload/avatar-upload.vue b/uniapp/src/components/avatar-upload/avatar-upload.vue new file mode 100644 index 00000000..e1d91cda --- /dev/null +++ b/uniapp/src/components/avatar-upload/avatar-upload.vue @@ -0,0 +1,107 @@ + + + + diff --git a/uniapp/src/components/mplogin-popup/mplogin-popup.vue b/uniapp/src/components/mplogin-popup/mplogin-popup.vue new file mode 100644 index 00000000..a9514cd4 --- /dev/null +++ b/uniapp/src/components/mplogin-popup/mplogin-popup.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/uniapp/src/pages/login/login.vue b/uniapp/src/pages/login/login.vue index c963df98..2320ccd9 100644 --- a/uniapp/src/pages/login/login.vue +++ b/uniapp/src/pages/login/login.vue @@ -154,12 +154,19 @@ + diff --git a/uniapp/src/utils/util.ts b/uniapp/src/utils/util.ts index a46e05c9..2577ed7f 100644 --- a/uniapp/src/utils/util.ts +++ b/uniapp/src/utils/util.ts @@ -93,3 +93,34 @@ export function objectToQuery(params: Record): string { } return query.slice(0, -1) } + +/** + * @description 组合异步任务 + * @param { string } task 异步任务 + */ + +export function series(...task: Array<(_arg: any) => any>) { + return function (): Promise { + return new Promise((resolve, reject) => { + const iteratorTask = task.values() + const next = (res?: any) => { + const nextTask = iteratorTask.next() + if (nextTask.done) { + resolve(res) + } else { + Promise.resolve(nextTask.value(res)).then(next).catch(reject) + } + } + next() + }) + } +} + +/** + * @description 添加单位 + * @param {String | Number} value 值 100 + * @param {String} unit 单位 px em rem + */ +export const addUnit = (value: string | number, unit = 'rpx') => { + return !Object.is(Number(value), NaN) ? `${value}${unit}` : value +} \ No newline at end of file