小程序优化

feat/task1-c-wallet
gongfuxiang 2019-06-28 23:10:59 +08:00
parent d9e4cbb335
commit a9bf0763c7
10 changed files with 48 additions and 29 deletions

View File

@ -1832,7 +1832,7 @@ class UserService
}
} else {
$data['upd_time'] = time();
if(Db::name('User')->where($where)->update($data))
if(Db::name('User')->where(['id'=>$temp_user['id']])->update($data))
{
$user_id = $temp_user['id'];
}

View File

@ -222,11 +222,7 @@ App({
* auth_data 授权数据
*/
user_login(object, method, auth_data) {
// 邀请人参数
var params = my.getStorageSync({key: this.data.cache_launch_info_key});
var referrer = (params.data == null) ? 0 : (params.data.referrer || 0);
var $this = this;
// 加载loding
my.showLoading({ content: "授权中..." });
@ -238,10 +234,7 @@ App({
my.request({
url: $this.get_request_url("alipayuserauth", "user"),
method: "POST",
data: {
authcode: res.authCode,
referrer: referrer
},
data: {authcode: res.authCode},
dataType: "json",
headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
@ -252,8 +245,18 @@ App({
data: res.data.data
});
my.navigateTo({
url: "/pages/login/login"
my.confirm({
title: '温馨提示',
content: '授权用户信息',
confirmButtonText: '确认',
cancelButtonText: '暂不',
success: (result) => {
if (result.confirm) {
my.navigateTo({
url: "/pages/login/login"
});
}
}
});
} else {
my.showToast({
@ -309,9 +312,14 @@ App({
* auth_data 授权数据
*/
get_user_login_info(object, method, openid, userinfo) {
// 邀请人参数
var params = my.getStorageSync({key: this.data.cache_launch_info_key});
// 请求数据
my.showLoading({ content: "授权中..." });
var $this = this;
userinfo['openid'] = openid;
userinfo['referrer'] = (params.data == null) ? 0 : (params.data.referrer || 0);
my.request({
url: $this.get_request_url('alipayuserinfo', 'user'),
method: 'POST',

4
public/appmini/old/alipay/pages/cart/cart.js Executable file → Normal file
View File

@ -18,13 +18,13 @@ Page({
init(e) {
var user = app.get_user_info(this, "init");
console.log(user)
if (user != false) {
// 用户未绑定用户则转到登录页面
var msg = (user == false) ? '授权用户信息' : '绑定手机号码';
if (app.user_is_need_login(user)) {
my.confirm({
title: '温馨提示',
content: msg,
content: '绑定手机号码',
confirmButtonText: '确认',
cancelButtonText: '暂不',
success: (result) => {

View File

@ -1,6 +1,3 @@
{
"usingComponents": {
"vtabs": "mini-antui/es/vtabs/index",
"vtab-content": "mini-antui/es/vtabs/vtab-content/index"
}
"pullRefresh": true
}

View File

@ -34,7 +34,7 @@
position: relative;
}
.floor-list .word {
padding: 20rpx 20rpx 0 20rpx;
padding: 30rpx 20rpx 0 20rpx;
}
.floor-list .word .vice-name {
color: #fff;
@ -45,7 +45,7 @@
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-align: center;
padding: 20rpx;
padding: 30rpx;
}
.floor-list .word .word-icon {
margin: 10rpx;

View File

@ -133,7 +133,10 @@ Page({
* 表单提交
*/
formSubmit(e)
{
{
// 邀请人参数
var params = my.getStorageSync({key: this.data.cache_launch_info_key});
// 数据验证
var validation = [
{fields: 'mobile', msg: '请填写手机号码'},
@ -146,8 +149,8 @@ Page({
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['referrer'] = (params.data == null) ? (this.data.user.referrer || 0) : (params.data.referrer || 0);
if(app.fields_check(e.detail.value, validation))
{
my.showLoading({content: '处理中...'});

3
public/appmini/old/alipay/pages/user/user.js Executable file → Normal file
View File

@ -56,11 +56,10 @@ Page({
self = this;
if (user != false) {
// 用户未绑定用户则转到登录页面
var msg = (user == false) ? '授权用户信息' : '绑定手机号码';
if (app.user_is_need_login(user)) {
my.confirm({
title: '温馨提示',
content: msg,
content: '绑定手机号码',
confirmButtonText: '确认',
cancelButtonText: '暂不',
success: (result) => {

View File

@ -265,12 +265,21 @@ App({
* auth_data 授权数据
*/
get_user_login_info(object, method, openid, auth_data) {
var $this = this;
// 邀请人参数
var params = my.getStorageSync(this.data.cache_launch_info_key);
var referrer = (params.data == null) ? 0 : (params.data.referrer || 0);
// 远程解密数据
var $this = this;
wx.request({
url: $this.get_request_url('wechatuserinfo', 'user'),
method: 'POST',
data: { encrypted_data: auth_data.encryptedData, iv: auth_data.iv, openid: openid },
data: {
"encrypted_data": auth_data.encryptedData,
"iv": auth_data.iv,
"openid": openid,
"referrer": referrer
},
dataType: 'json',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {

View File

@ -34,7 +34,7 @@
position: relative;
}
.floor-list .word {
padding: 20rpx 20rpx 0 20rpx;
padding: 30rpx 20rpx 0 20rpx;
}
.floor-list .word .vice-name {
color: #fff;
@ -45,7 +45,7 @@
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-align: center;
padding: 20rpx;
padding: 30rpx;
}
.floor-list .word .word-icon {
margin: 10rpx;

View File

@ -133,7 +133,10 @@ Page({
* 表单提交
*/
formSubmit(e)
{
{
// 邀请人参数
var params = my.getStorageSync(this.data.cache_launch_info_key);
// 数据验证
var validation = [
{fields: 'mobile', msg: '请填写手机号码'},
@ -146,8 +149,8 @@ Page({
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'] = 'weixin';
e.detail.value['referrer'] = (params.data == null) ? (this.data.user.referrer || 0) : (params.data.referrer || 0);
if(app.fields_check(e.detail.value, validation))
{
wx.showLoading({title: '处理中...'});