From 4206bf2aa4384118ba66c7261a6b0e3eb96d5fde Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Wed, 1 Sep 2021 17:30:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- package.json | 4 ++-- src/config/user.js | 2 +- src/manifest.json | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c170a6f..450a68b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.1.0 (2021-08-31) +# 0.1.0 (2021-09-01) ### 🌟 新功能 范围|描述|commitId @@ -220,6 +220,7 @@ 信息配置 | 配置eslint等配置 | 7421443 - | 修复不能build的问题 | 0b7b91e - | 删除多余的构建的命令 | 3f4eb2f + - | 添加mp-weixin的构建命令 | 3776a67 范围|描述|commitId diff --git a/package.json b/package.json index aed2d09..df1af49 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "dev:h5-pro": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode production", "build:h5-test": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode development", "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode production", - "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build", - "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build", + "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode production", + "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode production", "cz": "npm run log && git add . && git cz", "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch", "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom", diff --git a/src/config/user.js b/src/config/user.js index a27a905..d6aa986 100644 --- a/src/config/user.js +++ b/src/config/user.js @@ -22,7 +22,7 @@ export const mp = () => { const params = { client: uni.$t.user.clients['mp'], type: uni.$t.user.types['mp'], - data: { identifier: res.code }, + data: { identifier: res.code, credential: 'tall' }, }; resolve(params); } else { diff --git a/src/manifest.json b/src/manifest.json index 0b7f1bc..7464ba9 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "name": "TALL", - "appid": "wx356e01c7eb01d55d", + "appid": "wxf72a76c2ea24a472", "description": "", "versionName": "1.0.0", "versionCode": "100", @@ -57,7 +57,7 @@ /* 快应用特有相关 */ }, "mp-weixin": { - "appid": "wx356e01c7eb01d55d", + "appid": "wxf72a76c2ea24a472", "setting": { "urlCheck": false }, From a3c54f1374eff732d90f66fa4477decaf7fdc340 Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Thu, 2 Sep 2021 10:17:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=94=B6=E5=8F=96=E9=82=A3=EF=BC=8C=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- src/apis/tall.js | 2 ++ src/mixins/userAuth.js | 42 +++++++++++++++++++++++++++++ src/pages/index/index.vue | 6 +++-- src/pages/phone-bind/phone-bind.vue | 5 +++- 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 src/mixins/userAuth.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 450a68b..78d280c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.1.0 (2021-09-01) +# 0.1.0 (2021-09-02) ### 🌟 新功能 范围|描述|commitId @@ -23,6 +23,7 @@ - | 上传逻辑变化 | 3ff1dc2 - | 任务状态时间显示 | 56f5183 - | 任务进行中状态数字 | 27b7326 + - | 修改小程序id | 4206bf2 - | 全局插件及默认插件位置修改 | 6c80d08 - | 升级版本v3.1.0;tailwindcss添加class | 9ef05e1 - | 向右箭头图标变化 | 8e9ca55 diff --git a/src/apis/tall.js b/src/apis/tall.js index 04cedce..37285b3 100644 --- a/src/apis/tall.js +++ b/src/apis/tall.js @@ -30,6 +30,8 @@ const install = (Vue, vm) => { vm.$u.api.getToken = userId => vm.$u.get(`${tall}/users/userId`, { userId }); // 绑定手机号 vm.$u.api.phoneBind = (phone, smsCode) => vm.$u.http.post(`${tall}/users/binding`, { phone, smsCode }); + // 修改用户信息 + vm.$u.api.updateUserInfo = params => vm.$u.http.post(`${tall}/users/userInfo`, params); // 获取项目列表 vm.$u.api.getProjects = (startTime, endTime) => vm.$u.post(`${tall}/project/query`, { startTime, endTime }); diff --git a/src/mixins/userAuth.js b/src/mixins/userAuth.js new file mode 100644 index 0000000..ec42012 --- /dev/null +++ b/src/mixins/userAuth.js @@ -0,0 +1,42 @@ +import { mapState } from 'vuex'; +import { waitTokenRequest } from '@/utils/cacheAndRequest'; + +export default { + computed: mapState('user', ['token', 'user']), + methods: { + // 获取授权 + openAuth() { + if (this.user && this.user.wxInfo && this.user.wxInfo.nickname) return; // 用户信息里有微信信息就不用再获取了 + if (this.token) { + this.updateUserInfo(); + } else { + waitTokenRequest(this.updateUserInfo); + } + }, + + // 弹出授权框 + // 用户允许后 提交微信用户信息 + updateUserInfo() { + /* #ifdef MP-WEIXIN */ + uni.getUserProfile({ + desc: 'TALL仅需要获取您的基本用户信息', + success: res => { + const { avatarUrl, city, country, gender, language, nickName, province } = res.userInfo; + this.$u.api.updateUserInfo({ + city, + country, + headImgUrl: avatarUrl, + language, + nickname: nickName, + province, + sex: gender, + }); + }, + fail: error => { + console.log('error: ', error); + }, + }); + /* #endif */ + }, + }, +}; diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 7b91407..dc7b800 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -1,5 +1,5 @@