Browse Source

feat: 登录提示是否合并账号

tall
jarvis 4 years ago
parent
commit
6a9b0540e1
  1. 3
      CHANGELOG.md
  2. 1
      package.json
  3. 3
      src/apis/tall.js
  4. 2
      src/components/PrettyExchange/PrettyExchange.vue
  5. 74
      src/pages/phone-bind/phone-bind.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-09-27)
# 0.1.0 (2021-09-30)
### 🌟 新功能
范围|描述|commitId
@ -173,6 +173,7 @@
### 🔨 代码重构
范围|描述|commitId
--|--|--
- | 更改版本号 | 5f1d9f4
- | 界面样式调整 | 4367249
- | 去掉tailwindcss | 4bed47e
- | 任务状态重构 | 4693655

1
package.json

@ -45,6 +45,7 @@
"@babel/runtime": "~7.12.0",
"@dcloudio/types": "^2.5.1",
"@dcloudio/uni-automator": "^2.0.0-32220210818002",
"@dcloudio/uni-cli-i18n": "^2.0.0-32920210927001",
"@dcloudio/uni-cli-shared": "^2.0.0-32220210818002",
"@dcloudio/uni-migration": "^2.0.0-32220210818002",
"@dcloudio/uni-template-compiler": "^2.0.0-32220210818002",

3
src/apis/tall.js

@ -30,6 +30,9 @@ 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.phoneMerge = (phone, isMerge) => vm.$u.http.post(`${tall}/users/merge`, { phone, isMerge });
// 修改用户信息
vm.$u.api.updateUserInfo = params => vm.$u.http.post(`${tall}/users/userInfo`, params);

2
src/components/PrettyExchange/PrettyExchange.vue

@ -156,7 +156,7 @@ export default {
color: '#909399',
fontSize: 28,
},
menuList: [{ text: '复制' }, { text: '编辑' }, { text: '删除' }, { text: '置顶' }, { text: '排序' }],
menuList: [{ text: '' }, { text: '编辑' }, { text: '删除' }, { text: '置顶' }, { text: '排序' }],
// show: false,
border: 'border border-blue-500 shadow rounded-md',
showBorder: false,

74
src/pages/phone-bind/phone-bind.vue

@ -23,6 +23,24 @@
<u-verification-code :seconds="seconds" ref="uCode" @change="codeChange"></u-verification-code>
<u-top-tips ref="uTips"></u-top-tips>
<u-popup v-model="bindingPhone" mode="center" width="200px" height="200px" closeable style="padding: 15px" border-radius="15">
<view class="isBindingPhone"> 该手机号已经注册过账号是否将账号合并 </view>
<div class="btns">
<u-button size="mini" @click="noMerge()">取消</u-button>
<u-button type="primary" size="mini" @click="yesMerge()">确定</u-button>
</div>
</u-popup>
<u-popup v-model="mergePop" mode="center" closeable style="padding: 15px" width="350px" height="250px" border-radius="15">
<view class="isBindingPhoneOk">
<p>1您可以选择合并账号完成手机号的绑定系统会为您自动合并两个账号的数据信息</p>
<p>2如果选择不合并已注册手机号的已有数据可能会被清空</p>
<p class="subtitle">注意合并账号可能会带来不确定的数据丢失</p>
</view>
<div class="btns">
<u-button size="mini" @click="isMerge(1)">取消合并</u-button>
<u-button type="primary" size="mini" @click="isMerge(0)">确定合并</u-button>
</div>
</u-popup>
</view>
</template>
@ -73,6 +91,10 @@ export default {
seconds: 120, //
codeTips: '',
errorType: ['message'],
//
bindingPhone: false,
//
mergePop: false,
};
},
@ -94,11 +116,15 @@ export default {
});
setTimeout(() => uni.navigateBack(), 2000);
} catch (error) {
this.$refs.uTips.show({
/* this.$refs.uTips.show({
title: error.msg || '手机号绑定失败',
type: 'error',
duration: '3000',
});
}); */
if (error.code === 75) {
this.bindingPhone = true;
}
console.log(error.code);
}
} else {
console.log('验证失败');
@ -170,6 +196,34 @@ export default {
}
return true;
},
//
noMerge() {
this.bindingPhone = false;
},
//
yesMerge() {
this.mergePop = true;
},
//
async isMerge(merge) {
try {
const data = await this.$u.api.phoneMerge(this.model.phone, merge);
console.log(data);
this.$refs.uTips.show({
title: '手机号合并成功, 即将跳转上一页',
type: 'success',
duration: '3000',
});
setTimeout(() => uni.navigateBack(), 2000);
} catch (error) {
this.$refs.uTips.show({
title: error.msg || '手机号合并失败',
type: 'error',
duration: '3000',
});
}
this.mergePop = false;
},
},
};
</script>
@ -189,4 +243,20 @@ export default {
color: $u-tips-color;
}
}
.isBindingPhone {
padding: 15px;
margin-top: 40px;
}
.btns {
display: flex;
justify-content: space-between;
margin-top: 30px;
}
.isBindingPhoneOk {
margin-top: 35px;
padding: 15px;
}
.subtitle {
color: red;
}
</style>

Loading…
Cancel
Save