Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
e62ceabd
ShopXO
项目概览
jamesyang1999
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e62ceabd
编写于
1月 03, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信小程序登录+绑定手机号码
上级
66f7cbe9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
90 addition
and
158 deletion
+90
-158
public/appmini/old/wechat/app.js
public/appmini/old/wechat/app.js
+1
-55
public/appmini/old/wechat/app.wxss
public/appmini/old/wechat/app.wxss
+9
-9
public/appmini/old/wechat/pages/buy/buy.wxml
public/appmini/old/wechat/pages/buy/buy.wxml
+1
-1
public/appmini/old/wechat/pages/cart/cart.js
public/appmini/old/wechat/pages/cart/cart.js
+31
-63
public/appmini/old/wechat/pages/cart/cart.wxml
public/appmini/old/wechat/pages/cart/cart.wxml
+1
-1
public/appmini/old/wechat/pages/goods-detail/goods-detail.wxml
...c/appmini/old/wechat/pages/goods-detail/goods-detail.wxml
+1
-1
public/appmini/old/wechat/pages/login/login.js
public/appmini/old/wechat/pages/login/login.js
+40
-26
public/appmini/old/wechat/pages/login/login.wxml
public/appmini/old/wechat/pages/login/login.wxml
+2
-2
public/appmini/old/wechat/pages/login/login.wxss
public/appmini/old/wechat/pages/login/login.wxss
+4
-0
未找到文件。
public/appmini/old/wechat/app.js
浏览文件 @
e62ceabd
...
...
@@ -181,23 +181,6 @@ App({
);
},
/**
* 获取平台用户信息
* object 回调操作对象
* method 回调操作对象的函数
* return 有用户数据直接返回, 则回调调用者
*/
get_user_info
(
object
,
method
)
{
var
user
=
this
.
get_user_cache_info
();
if
(
user
==
false
)
{
// 唤醒用户授权
this
.
user_auth_code
(
object
,
method
);
return
false
;
}
return
user
;
},
/**
* 从缓存获取用户信息
*/
...
...
@@ -209,50 +192,13 @@ App({
return
user
;
},
/**
* 用户授权
* object 回调操作对象
* method 回调操作对象的函数
*/
user_auth_code
(
object
,
method
)
{
// 加载loding
wx
.
showLoading
({
title
:
'
授权中...
'
});
var
$this
=
this
;
// 请求授权接口
wx
.
getSetting
({
success
(
res
)
{
if
(
!
res
.
authSetting
[
'
scope.userInfo
'
])
{
wx
.
navigateTo
({
url
:
"
/pages/login/login
"
});
// wx.authorize({
// scope: 'scope.userInfo',
// success() {
// $this.user_auth_login(object, method);
// },
// fail: (e) => {
// wx.hideLoading();
// $this.showToast('授权失败');
// }
// });
}
else
{
$this
.
user_auth_login
(
object
,
method
);
}
},
fail
:
(
e
)
=>
{
wx
.
hideLoading
();
$this
.
showToast
(
'
授权校验失败
'
);
}
});
},
/**
* 用户登录
* object 回调操作对象
* method 回调操作对象的函数
*/
user_auth_login
(
object
,
method
)
{
wx
.
showLoading
({
title
:
"
授权中...
"
});
var
$this
=
this
;
wx
.
checkSession
({
success
:
function
()
{
...
...
public/appmini/old/wechat/app.wxss
浏览文件 @
e62ceabd
...
...
@@ -120,20 +120,20 @@ textarea {
.my-btn-default{
font-size: 38rpx;
color: #fff;
border: none;
background-color:#d2364c;
color: #fff
!important
;
border: none
!important
;
background-color:#d2364c
!important
;
border-radius: 2px;
}
.my-btn-default.btn-disabled{
background-color: #a6a6a6;
color: #fff;
background-color: #a6a6a6
!important
;
color: #fff
!important
;
}
.my-btn-gray{
font-size: 30rpx;
color: #fff;
border: none;
background-color:#a6a6a6;
color: #fff
!important
;
border: none
!important
;
background-color:#a6a6a6
!important
;
border-radius: 2px;
}
...
...
@@ -240,7 +240,7 @@ textarea {
background-color: #ed6977 !important;
}
.bg-warning {
background-color: #F37B1D
!important;
background-color: #F37B1D !important;
}
.bg-active-main {
background-color: #d2364c !important;
...
...
public/appmini/old/wechat/pages/buy/buy.wxml
浏览文件 @
e62ceabd
...
...
@@ -42,7 +42,7 @@
</view>
<!-- 留言 -->
<textarea
onI
nput="bind_user_note_event" maxlength="60" auto-height placeholder="留言" class="spacing-mb" />
<textarea
bindi
nput="bind_user_note_event" maxlength="60" auto-height placeholder="留言" class="spacing-mb" />
<!-- 扩展数据展示 -->
<view wx:if="{{extension_list.length > 0}}" class="extension-list spacing-mb">
...
...
public/appmini/old/wechat/pages/cart/cart.js
浏览文件 @
e62ceabd
...
...
@@ -17,26 +17,24 @@ Page({
},
init
(
e
)
{
var
user
=
app
.
get_user_info
(
this
,
"
init
"
);
if
(
user
!=
false
)
{
// 用户未绑定用户则转到登录页面
if
((
user
.
mobile
||
null
)
==
null
)
{
wx
.
showModal
({
title
:
'
温馨提示
'
,
content
:
'
绑定手机号码
'
,
confirmText
:
'
确认
'
,
cancelText
:
'
暂不
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
wx
.
navigateTo
({
url
:
"
/pages/login/login?event_callback=init
"
});
}
},
});
}
else
{
this
.
get_data
();
}
var
user
=
app
.
get_user_cache_info
(
this
,
"
init
"
);
// 用户未绑定用户则转到登录页面
if
(
user
==
false
||
((
user
.
mobile
||
null
)
==
null
))
{
wx
.
showModal
({
title
:
'
温馨提示
'
,
content
:
'
绑定手机号码
'
,
confirmText
:
'
确认
'
,
cancelText
:
'
暂不
'
,
success
:
(
result
)
=>
{
if
(
result
.
confirm
)
{
wx
.
navigateTo
({
url
:
"
/pages/login/login?event_callback=init
"
});
}
},
});
}
else
{
this
.
get_data
();
}
},
...
...
@@ -75,10 +73,7 @@ Page({
data_bottom_line_status
:
false
,
data_list_loding_msg
:
res
.
data
.
msg
,
});
wx
.
showToast
({
type
:
"
fail
"
,
content
:
res
.
data
.
msg
});
app
.
showToast
(
res
.
data
.
msg
);
}
},
fail
:
()
=>
{
...
...
@@ -89,10 +84,7 @@ Page({
data_list_loding_msg
:
'
服务器请求出错
'
,
});
wx
.
showToast
({
type
:
"
fail
"
,
content
:
"
服务器请求出错
"
});
app
.
showToast
(
"
服务器请求出错
"
);
}
});
},
...
...
@@ -132,18 +124,18 @@ Page({
if
(
buy_number
<
buy_min_number
)
{
buy_number
=
buy_min_number
;
if
(
buy_min_number
>
1
)
{
wx
.
showToast
({
content
:
'
起购
'
+
buy_min_number
+
inventory_unit
}
);
app
.
showToast
(
'
起购
'
+
buy_min_number
+
inventory_unit
);
return
false
;
}
}
if
(
buy_max_number
>
0
&&
buy_number
>
buy_max_number
)
{
buy_number
=
buy_max_number
;
wx
.
showToast
({
content
:
'
限购
'
+
buy_max_number
+
inventory_unit
}
);
app
.
showToast
(
'
限购
'
+
buy_max_number
+
inventory_unit
);
return
false
;
}
if
(
buy_number
>
inventory
)
{
buy_number
=
inventory
;
wx
.
showToast
({
content
:
'
库存数量
'
+
inventory
+
inventory_unit
}
);
app
.
showToast
(
'
库存数量
'
+
inventory
+
inventory_unit
);
return
false
;
}
...
...
@@ -167,17 +159,11 @@ Page({
// 选择处理
this
.
selected_calculate
();
}
else
{
wx
.
showToast
({
type
:
"
fail
"
,
content
:
res
.
data
.
msg
});
app
.
showToast
(
res
.
data
.
msg
);
}
},
fail
:
()
=>
{
wx
.
showToast
({
type
:
"
fail
"
,
content
:
"
服务器请求出错
"
});
app
.
showToast
(
"
服务器请求出错
"
);
}
});
},
...
...
@@ -225,17 +211,11 @@ Page({
if
(
res
.
data
.
code
==
0
)
{
this
.
cart_delete
(
id
,
type
);
}
else
{
wx
.
showToast
({
type
:
'
fail
'
,
content
:
res
.
data
.
msg
});
app
.
showToast
(
res
.
data
.
msg
);
}
},
fail
:
()
=>
{
wx
.
showToast
({
type
:
'
fail
'
,
content
:
'
服务器请求出错
'
});
app
.
showToast
(
"
服务器请求出错
"
);
}
});
},
...
...
@@ -257,22 +237,13 @@ Page({
data_list_loding_status
:
temp_data_list
.
length
==
0
?
0
:
this
.
data
.
data_list_loding_status
,
});
wx
.
showToast
({
type
:
'
success
'
,
content
:
(
type
==
'
delete
'
)
?
'
删除成功
'
:
'
收藏成功
'
});
app
.
showToast
(((
type
==
'
delete
'
)
?
'
删除成功
'
:
'
收藏成功
'
),
'
success
'
);
}
else
{
wx
.
showToast
({
type
:
'
fail
'
,
content
:
(
type
==
'
delete
'
)
?
'
删除失败
'
:
'
收藏失败
'
});
app
.
showToast
((
type
==
'
delete
'
)
?
'
删除失败
'
:
'
收藏失败
'
);
}
},
fail
:
()
=>
{
wx
.
showToast
({
type
:
'
fail
'
,
content
:
'
服务器请求出错
'
});
app
.
showToast
(
"
服务器请求出错
"
);
}
});
},
...
...
@@ -342,10 +313,7 @@ Page({
}
if
(
selected_count
<=
0
)
{
wx
.
showToast
({
type
:
"
fail
"
,
content
:
'
请选择商品
'
});
app
.
showToast
(
"
请选择商品
"
);
return
false
}
...
...
public/appmini/old/wechat/pages/cart/cart.wxml
浏览文件 @
e62ceabd
...
...
@@ -23,7 +23,7 @@
<!-- 数量 -->
<view class="number-content tc oh">
<view bindtap="goods_buy_number_event" class="number-submit tc cr-888 fl" data-index="{{index}}" data-type="0">-</view>
<input
onB
lur="goods_buy_number_blur" class="tc cr-888 fl" type="number" value="{{item.stock}}" data-index="{{index}}" />
<input
bindb
lur="goods_buy_number_blur" class="tc cr-888 fl" type="number" value="{{item.stock}}" data-index="{{index}}" />
<view bindtap="goods_buy_number_event" class="number-submit tc cr-888 fl" data-index="{{index}}" data-type="1">+</view>
</view>
...
...
public/appmini/old/wechat/pages/goods-detail/goods-detail.wxml
浏览文件 @
e62ceabd
...
...
@@ -121,7 +121,7 @@
<view class="title fl">购买数量</view>
<view class="number-content tc oh">
<view bindtap="goods_buy_number_event" class="number-submit tc cr-888 fl" data-type="0">-</view>
<input
onB
lur="goods_buy_number_blur" class="tc cr-888 fl" type="number" value="{{temp_buy_number}}" />
<input
bindb
lur="goods_buy_number_blur" class="tc cr-888 fl" type="number" value="{{temp_buy_number}}" />
<view bindtap="goods_buy_number_event" class="number-submit tc cr-888 fl" data-type="1">+</view>
</view>
</view>
...
...
public/appmini/old/wechat/pages/login/login.js
浏览文件 @
e62ceabd
...
...
@@ -30,9 +30,38 @@ Page({
* 登录授权事件
*/
get_user_info_event
(
e
)
{
console
.
log
(
e
,
e
.
detail
.
userInfo
);
//app.user_auth_login();
wx
.
navigateBack
();
this
.
user_auth_code
();
},
/**
* 用户授权
* object 回调操作对象
* method 回调操作对象的函数
*/
user_auth_code
(
object
,
method
)
{
// 请求授权接口
var
$this
=
this
;
wx
.
getSetting
({
success
(
res
)
{
if
(
!
res
.
authSetting
[
'
scope.userInfo
'
])
{
$this
.
setData
({
user
:
null
});
}
else
{
app
.
user_auth_login
(
$this
,
'
user_auth_back_event
'
);
}
},
fail
:
(
e
)
=>
{
app
.
showToast
(
"
授权校验失败
"
);
}
});
},
/**
* 授权返回事件
*/
user_auth_back_event
()
{
this
.
setData
({
user
:
app
.
get_user_cache_info
()
||
null
});
},
/**
...
...
@@ -83,20 +112,14 @@ Page({
}
else
{
this
.
setData
({
verify_submit_text
:
'
获取验证码
'
,
verify_loading
:
false
,
verify_disabled
:
false
});
wx
.
showToast
({
type
:
'
fail
'
,
content
:
res
.
data
.
msg
});
app
.
showToast
(
res
.
data
.
msg
);
}
},
fail
:
()
=>
{
wx
.
hideLoading
();
this
.
setData
({
verify_submit_text
:
'
获取验证码
'
,
verify_loading
:
false
,
verify_disabled
:
false
});
wx
.
showToast
({
type
:
'
fail
'
,
content
:
'
服务器请求出错
'
});
app
.
showToast
(
"
服务器请求出错
"
);
}
});
}
...
...
@@ -111,16 +134,16 @@ Page({
var
validation
=
[
{
fields
:
'
mobile
'
,
msg
:
'
请填写手机号码
'
},
{
fields
:
'
verify
'
,
msg
:
'
请填写验证码
'
},
{
fields
:
'
alipay
_openid
'
,
msg
:
'
授权id不能为空
'
}
{
fields
:
'
weixin
_openid
'
,
msg
:
'
授权id不能为空
'
}
];
e
.
detail
.
value
[
'
alipay_openid
'
]
=
this
.
data
.
user
.
alipay
_openid
;
e
.
detail
.
value
[
'
weixin_openid
'
]
=
this
.
data
.
user
.
weixin
_openid
;
e
.
detail
.
value
[
'
nickname
'
]
=
this
.
data
.
user
.
nickname
;
e
.
detail
.
value
[
'
avatar
'
]
=
this
.
data
.
user
.
avatar
;
e
.
detail
.
value
[
'
province
'
]
=
this
.
data
.
user
.
province
;
e
.
detail
.
value
[
'
city
'
]
=
this
.
data
.
user
.
city
;
e
.
detail
.
value
[
'
gender
'
]
=
this
.
data
.
user
.
gender
;
e
.
detail
.
value
[
'
referrer
'
]
=
this
.
data
.
user
.
referrer
;
e
.
detail
.
value
[
'
app_type
'
]
=
'
alipay
'
;
e
.
detail
.
value
[
'
app_type
'
]
=
'
weixin
'
;
if
(
app
.
fields_check
(
e
.
detail
.
value
,
validation
))
{
wx
.
showLoading
({
content
:
'
处理中...
'
});
...
...
@@ -139,10 +162,7 @@ Page({
if
(
res
.
data
.
code
==
0
&&
(
res
.
data
.
data
||
null
)
!=
null
)
{
clearInterval
(
this
.
data
.
temp_clear_time
);
wx
.
showToast
({
type
:
'
success
'
,
content
:
res
.
data
.
msg
});
app
.
showToast
(
res
.
data
.
msg
,
'
success
'
);
wx
.
setStorage
({
key
:
app
.
data
.
cache_user_info_key
,
...
...
@@ -162,20 +182,14 @@ Page({
}
else
{
this
.
setData
({
form_submit_loading
:
false
});
wx
.
showToast
({
type
:
'
fail
'
,
content
:
res
.
data
.
msg
});
app
.
showToast
(
res
.
data
.
msg
);
}
},
fail
:
()
=>
{
wx
.
hideLoading
();
this
.
setData
({
form_submit_loading
:
false
});
wx
.
showToast
({
type
:
'
fail
'
,
content
:
'
服务器请求出错
'
});
app
.
showToast
(
"
服务器请求出错
"
);
}
});
}
...
...
public/appmini/old/wechat/pages/login/login.wxml
浏览文件 @
e62ceabd
<view wx:if="{{user != null}}" class="content">
<form bindsubmit="formSubmit">
<input type="number" placeholder="输入手机号码" maxlength="11" name="mobile"
onI
nput="bind_key_input" class="mobile" />
<input type="number" placeholder="输入手机号码" maxlength="11" name="mobile"
bindi
nput="bind_key_input" class="mobile" />
<view class="code clearfix">
<input type="number" placeholder="验证码" maxlength="6" name="verify" class="verify" />
<button type="default" hover-class="none" size="mini" loading="{{verify_loading}}" disabled="{{verify_disabled}}" bindtap="verify_send" class="verify-sub
fr
{{verify_disabled ? 'sub-disabled' : ''}}">{{verify_submit_text}}</button>
<button type="default" hover-class="none" size="mini" loading="{{verify_loading}}" disabled="{{verify_disabled}}" bindtap="verify_send" class="verify-sub {{verify_disabled ? 'sub-disabled' : ''}}">{{verify_submit_text}}</button>
</view>
<button type="default" formType="submit" hover-class="none" plain loading="{{form_submit_loading}}" disabled="{{form_submit_loading}}" class="submit {{form_submit_loading ? 'my-btn-gray' : 'my-btn-default'}}">确认绑定</button>
</form>
...
...
public/appmini/old/wechat/pages/login/login.wxss
浏览文件 @
e62ceabd
...
...
@@ -23,6 +23,7 @@ page{
.content .code{
margin: 20rpx 0;
border-bottom: solid 1px #eee;
position: relative;
}
.content .code .verify{
width: 63%;
...
...
@@ -34,6 +35,9 @@ page{
height: 35px;
line-height: 35px;
border-radius: 10rpx;
position: absolute;
top: 0;
right: 0;
}
.content .code .verify-sub.sub-disabled{
border: solid 1px #eee;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录