From 841adc5f28c159ac4a2acb4d17ba1bb8a6ad70ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?LAPTOP-D7TKRI82=5C=E9=82=93?= <52643018@qq.com>
Date: Wed, 23 Jun 2021 09:59:41 +0800
Subject: [PATCH 1/3] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E5=85=A8=E5=B1=80$u?=
=?UTF-8?q?rl=E5=A2=9E=E5=8A=A0=E8=8A=82=E6=B5=81=E9=98=B2=E6=8A=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/mixin.js | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/common/mixin.js b/common/mixin.js
index f7303db..0a87aa9 100644
--- a/common/mixin.js
+++ b/common/mixin.js
@@ -70,18 +70,19 @@ export default{
});
},
$url(url, options = {}){
- // TODO 判断登录逻辑;防抖
- if(options.type && options.type !== ''){
- if(options.type === 'redirect'){ // 关闭当前,跳转
- uni.redirectTo({ url })
- }else if(options.type === 'switch'){ // 跳转
- uni.switchTab({ url })
- }else if(options.type === 'launch'){ // 关闭所有,跳转
- uni.reLaunch({ url })
+ this.$u.throttle(() => {
+ if(options.type && options.type !== ''){
+ if(options.type === 'redirect'){ // 关闭当前,跳转
+ uni.redirectTo({ url })
+ }else if(options.type === 'switch'){ // 跳转
+ uni.switchTab({ url })
+ }else if(options.type === 'launch'){ // 关闭所有,跳转
+ uni.reLaunch({ url })
+ }
+ }else{
+ uni.navigateTo({ url }) // 跳转
}
- }else{
- uni.navigateTo({ url }) // 跳转
- }
+ }, 100);
},
$toBack(){
let pages = getCurrentPages(); // 当前页
From d9cbaf6f1cba989e6d4b88dc62e5f820277ac25c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?LAPTOP-D7TKRI82=5C=E9=82=93?= <52643018@qq.com>
Date: Wed, 23 Jun 2021 10:22:46 +0800
Subject: [PATCH 2/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20=E5=85=A8=E5=B1=80?=
=?UTF-8?q?=E5=85=B1=E4=BA=AB=E6=96=B9=E6=B3=95=E9=9B=86=E5=90=88=20[?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E]=20http=E8=AF=B7=E6=B1=82=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E6=98=BE=E7=A4=BAloading=E6=A1=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/http.js | 8 +++++++-
common/shared.js | 43 +++++++++++++++++++++++++++++++++++++++++++
main.js | 3 +++
3 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 common/shared.js
diff --git a/common/http.js b/common/http.js
index c75ad23..69800b2 100644
--- a/common/http.js
+++ b/common/http.js
@@ -24,7 +24,7 @@ function getsign(params) {
return params;
}
-function $http(url, data = {}){
+function $http(url, data = {}, options = {}){
return new Promise((resolve, reject) => {
// 绑定this
let that = this;
@@ -74,6 +74,12 @@ function $http(url, data = {}){
// 生成sign
getsign(data);
console.log(url, data);
+
+ // 动态赋值是否显示loading加载框 TODO验证一下是否有问题
+ if(that.$shared.isValueType(options.showLoading) != 'undefined'){
+ that.$u.http.setConfig({showLoading: options.showLoading});
+ }
+
// 发起请求
that.$u.post(url, data).then(res => {
resolve(res);
diff --git a/common/shared.js b/common/shared.js
new file mode 100644
index 0000000..c7a8b9c
--- /dev/null
+++ b/common/shared.js
@@ -0,0 +1,43 @@
+/*
+ 全局共享实用方法 shared.js
+ */
+
+// 设置角标, 必须传入下标值,设置值可传可不传,传参时显示,不传时移除角标
+function setBadge(index = 0, value){
+ if(isRight(value)){
+ uni.setTabBarBadge({
+ index: Number(index),
+ text: value > 99 ? '99+' : String(value)
+ })
+ }else{
+ uni.removeTabBarBadge({index: Number(index)});
+ }
+}
+
+// 判断对错/是否显示,万能校验
+function isRight(obj) {
+ if (isValueType(obj) === 'string') {
+ obj = obj.trim();
+ if (obj === 'null' || obj === 'undefined') {
+ return false;
+ }
+ } else if (isValueType(obj) === 'number' && (isValueType(obj) === "number" && !isNaN(obj)) && obj !== 0) {
+ return true;
+ }
+ for (var key in obj) {
+ return true;
+ }
+ return false;
+}
+
+// 判断一个值所属的类型,返回一个字符串
+function isValueType(value) {
+ let str = Object.prototype.toString.call(value);
+ return str.match(/\[object (.*?)\]/)[1].toLowerCase();
+}
+
+module.exports = {
+ setBadge,
+ isRight,
+ isValueType
+}
\ No newline at end of file
diff --git a/main.js b/main.js
index 1a69262..a972626 100644
--- a/main.js
+++ b/main.js
@@ -2,6 +2,7 @@ import Vue from 'vue'
import App from './App'
import mixin from '@/common/mixin.js';
import * as API from '@/common/api.js';
+import $shared from '@/common/shared.js';
Vue.config.productionTip = false
@@ -10,6 +11,8 @@ Vue.mixin(mixin);
// 将API注入全局
Vue.prototype.API = API;
+// 全局共享方法
+Vue.prototype.$shared = $shared;
// 引入全局uView
import uView from 'uview-ui'
From 29b87d6d806cca6e31660df35d6e7f344194ef05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?LAPTOP-D7TKRI82=5C=E9=82=93?= <52643018@qq.com>
Date: Wed, 23 Jun 2021 15:10:44 +0800
Subject: [PATCH 3/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20app.vue=E5=BE=AE?=
=?UTF-8?q?=E4=BF=A1=E7=99=BB=E5=BD=95=E9=80=BB=E8=BE=91=20[=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E]=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=89=88=E6=9C=AC?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A3=80=E6=9F=A5=20[=E6=96=B0=E5=A2=9E]=20?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=92=8C?=
=?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=80=BB=E8=BE=91=20[=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E]=20=E6=89=8B=E6=9C=BA=E5=8F=B7=E7=99=BB=E5=BD=95?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 90 ++++++++++++++++++-
pages.json | 6 ++
pages/center/index.vue | 3 +-
pages/login/accountLogin.vue | 165 +++++++++++++++++++++++++++++++++++
pages/login/index.vue | 78 ++++++++++++++---
5 files changed, 329 insertions(+), 13 deletions(-)
create mode 100644 pages/login/accountLogin.vue
diff --git a/App.vue b/App.vue
index 9943dca..e322074 100644
--- a/App.vue
+++ b/App.vue
@@ -1,13 +1,99 @@
diff --git a/pages.json b/pages.json
index b088f57..ebcdee7 100644
--- a/pages.json
+++ b/pages.json
@@ -76,6 +76,12 @@
"style": {
"navigationBarTitleText": "登录"
}
+ },
+ {
+ "path": "pages/login/accountLogin",
+ "style": {
+ "navigationBarTitleText": "绑定"
+ }
}
],
"globalStyle": {
diff --git a/pages/center/index.vue b/pages/center/index.vue
index 6567d0f..46b25ad 100644
--- a/pages/center/index.vue
+++ b/pages/center/index.vue
@@ -149,7 +149,8 @@
position: absolute;
width: 100%;
height: 100%;
- z-index: -1;
+ z-index: 1;
+ background: transparent;
}
&:last-child{
border-bottom: none;
diff --git a/pages/login/accountLogin.vue b/pages/login/accountLogin.vue
new file mode 100644
index 0000000..f716eae
--- /dev/null
+++ b/pages/login/accountLogin.vue
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ isCodeLogin ? '使用密码登录' : '使用验证码登录' }}
+
+
+
+
+
+
+
diff --git a/pages/login/index.vue b/pages/login/index.vue
index 5908010..c153ccc 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -2,16 +2,28 @@
- 游客jdsfbuskdnko
-
- 暂不绑定继续操作
+ 游客jdsfbuskdnko
+
+
+ 暂不绑定继续操作
+
+
+
+ 使用手机号登录
+
+
-
-
+
+
+
+
请认真阅读并同意
《时空网协议》
@@ -27,14 +39,51 @@
export default {
data(){
return {
- checked: true
+ checked: false, // 是否勾选协议
+ isLogin: false, // 是否已登录
+ userInfo: {}
}
},
onLoad(){
},
methods: {
-
+ // 进入查看协议
+ enterAgree(){
+ console.log("查看协议");
+ },
+ // 勾选协议发生变化
+ checkboxChange(event){
+ console.log(event)
+ this.checked = event.detail.value.length > 0;
+ },
+ // 微信快捷登录获取手机号
+ getPhoneNumber(event){
+ console.log(event);
+ if(event.detail.errMsg == 'getPhoneNumber:ok'){
+ let encryptedData = event.detail.encryptedData;
+ let iv = event.detail.iv;
+ this.isLogin = true; // TODO 接口请求回来再赋值
+ }
+ },
+ // 获取用户信息
+ getUserProfile(){
+ uni.getUserProfile({
+ desc: '您的信息将用于时空网显示',
+ lang: 'zh_CN',
+ complete: result => {
+ console.log(result)
+ if(result.errMsg == 'getUserProfile:ok'){
+ let encryptedData = result.encryptedData;
+ let iv = result.iv;
+ let signature = result.signature;
+ let userInfo = result.userInfo;
+ // 获取成功,请求接口完毕后返回页面
+ this.$toBack();
+ }
+ }
+ });
+ }
}
}
@@ -50,6 +99,7 @@
width: 750rpx;
height: auto;
box-sizing: border-box;
+ position: relative;
.img{
width: 180rpx;
height: 180rpx;
@@ -76,4 +126,12 @@
color: #1e90ff;
}
}
+
+ .mask{
+ position: absolute;
+ bottom: 46rpx;
+ left: 0;
+ width: 100%;
+ height: 190rpx;
+ }