Commit ba24d965 by jscat

nyx weapp: 页面更新; 功能更新

1. 去除memberId, 添加members
2. 去掉matchSeason参数
3. 细化入口页面数据流 activity.js
4. 添加login, addT_member功能 activity-submit.js
parent 55f4ff25
//app.js
//app.js
......@@ -7,10 +7,16 @@ App({
globalData: {
// userInfo setting
nyxCode: "", //userId, 唯一识别码
nickName: "",
authStatus: "", //授权状态, 0表示未授权, 1表示已授权
authStatus: "", //授权状态, 00表示未授权, 01表示已授权
userInfo : {}, //用户信息
matchSeason : "",
members : [], // 商家列表
memberInfo: {
member_id: "",
member_name: "",
member_address: "",
member_logo: "",
}, // 商家信息
emotionHost : "https://930-test-sh.oss-cn-shanghai.aliyuncs.com/emoji/",
onOpenOp : {},
......@@ -227,11 +233,8 @@ App({
regUser: function (uuid) {
var _this = this;
_this.globalData.nyxCode = uuid;
_this.globalData.nickName = "匿名用户"
wx.setStorageSync('nyxCode', uuid)
wx.setStorageSync('nickName', "匿名用户")
wx.setStorageSync('authStatus', "0")
wx.setStorageSync('matchSeason', _this.getSeason())
wx.setStorageSync('authStatus', "00")
var userInfo = {}
userInfo['userId'] = uuid
userInfo['nickName'] = "匿名用户"
......@@ -385,4 +388,88 @@ App({
return promise
},
//具体的登陆及授权功能 - 在用户信息加密后(encryptedData)传到java后台, 后台进一步处理
login: function (resolve, reject) {
config.debug==1?console.log("===login_登陆及授权"):""
var _this = this;
wx.login({
success: function (res) {
var code = res.code;
config.debug==1? console.log("===login_code_", code):""
wx.getUserInfo({
success: function (res) {
config.debug == 1 ? console.log("===wx.getUserInfo_res_获取用户信息成功", res) : ""
//userInfo直接获取
/* userInfo
- nickName
- avatarUrl
- gender
- province
- city
- country
*/
wx.setStorageSync('userInfo', res.userInfo)
_this.globalData.userInfo = res.userInfo
//通过openid换取唯一的nyxCode
//同时更新userInfo
var nyxCode = _this.globalData.nyxCode
wx.request({
url: config.user_login_url,
method: 'post',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
data: { encryptedData: res.encryptedData, iv: res.iv, code: code, userId : nyxCode },
success: function (res) {
config.debug==1?console.info("===wx.login_data_", res):""
wx.setStorageSync('nyxCode', res.data.data.id)
wx.setStorageSync('authStatus', res.data.data.authStatus)
_this.globalData.nyxCode = res.data.data.id
_this.globalData.authStatus = res.data.data.authStatus
resolve("===app.js_login success")
},
fail: function () {
reject("===app.js_login failed")
console.log('系统错误')
}
})
//平台登录
},
fail: function (res) {
config.debug == 1 ? console.log("===app.js_login_获取用户信息失败", res) : ""
}
})
}
})
},
regMember: function (uuid) {
var _this = this;
_this.globalData.nyxCode = uuid;
wx.setStorageSync('nyxCode', uuid)
wx.setStorageSync('authStatus', "00")
var userInfo = {}
userInfo['userId'] = uuid
userInfo['nickName'] = "匿名用户"
userInfo['avatarUrl'] = "https://930-test-sh.oss-cn-shanghai.aliyuncs.com/u_image/icon_avatar1.png"
//设置全局参数
wx.setStorageSync('userInfo', userInfo)
_this.globalData.userInfo = userInfo
var strUrl = config.user_reg_url + "?userid=" + uuid
config.debug == 1 ? console.log("===regUser_strUrl_" + strUrl) : ""
wx.request({
url: strUrl,
method: 'GET',
success: function (res) {
config.debug == 1 ? console.info("===regUser_success_data_", res) : ""
},
fail: function () {
console.log('系统错误')
}
})
},
})
\ No newline at end of file
{
{
{
"pages": [
"pages/member/activity-post/activity-submit/activity-submit",
"pages/activity/activity",
"pages/activity/activity-list/activity-list",
"pages/my/my-members/my-members",
"pages/member/activity-post/activity-submit/activity-submit",
"pages/my/my-members/my-members",
"pages/member/activity-post/activity-edit/activity-edit",
"pages/member/quiz-post/quiz-edit/quiz-edit",
"pages/member/schedule/schedule",
......@@ -38,7 +38,13 @@
"text": "活动",
"iconPath": "./icon/my/activity.png",
"selectedIconPath": "./icon/my/activity.png"
},
},
{
"pagePath": "pages/member/activity-post/activity-post",
"text": "添加",
"iconPath": "./icon/add.png",
"selectedIconPath": "./icon/add.png"
},
{
"pagePath": "pages/my/my",
"text": "个人",
......
//config.js API全局域名配置
//config.js API全局域名配置
......@@ -55,6 +55,7 @@ var config={
socket_url: socket_url,
oss_token_url: host_key + "/api/nyx/oss/getToken",
oss_callback_url: login_url + "/api/nyx/oss/callback",
oss_member_callback_url: login_url + "/api/nyx/oss/member/callback",
post_like_url: host_key + "/api/nyx/post/like",
activity_like_url: host_key + "/api/nyx/activity/like",
activity_like_del_url: host_key + "/api/nyx/activity/like/del",
......@@ -62,5 +63,7 @@ var config={
collect_like_del_url: host_key + "/api/nyx/collect/like/del",
check_text_url: host_key + "/api/nyx/wx/check/text",
check_pic_url: host_key + "/api/nyx/wx/check/pic",
logo_dir: "logo-dir/",
user_dir: "user-dir/",
}
module.exports=config;
\ No newline at end of file
// pages/activity/activity-info/activity-info.js
// pages/activity/activity-info/activity-info.js
......@@ -10,11 +10,11 @@ Page({
*/
data: {
/* 用于判断是否已经登陆 */
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "0",
userInfo : {},
memberId : "",
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
members : "", // 商家信息
windowHeight: "",
windowWidth: "",
......@@ -51,7 +51,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId : wx.getStorageSync('memberId'),
members : wx.getStorageSync('members'),
})
}
......
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs>
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs>
......@@ -28,7 +28,7 @@
</block>
<!-- end 点赞 like -->
<!-- start 克隆 -->
<block wx:if="{{memberId!=''}}">
<block wx:if="{{members.length > 0}}">
<view class="clone-right" bindtap="onClickClone" data-id='{{activityInfo.activity_id}}'>
<view class="note-column" style="font-size: 24rpx;font-weight:normal;color: #000;align-items:center;margin-left: 10rpx;">
<image src="../../../icon/activity/clone.png"></image>
......
.scroll-view_H{
.scroll-view_H{
......@@ -95,13 +95,13 @@
margin-left: 30rpx;
}
.note-column-left{
width : 120rpx;
width : 140rpx;
margin-left: 5%;
display: flex;
}
.writer-image{
width: 120rpx;
height: 120rpx;
width: 140rpx;
height: 140rpx;
}
/* start bottom style */
......
// pages/member/activity-post/activity-edit/activity-edit.js
// pages/member/activity-post/activity-edit/activity-edit.js
......@@ -9,11 +9,11 @@ Page({
data: {
/* 用于判断是否已经登陆 */
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "0",
authStatus : "",
userInfo : {},
memberId : "",
members : [],
header_infoData: {
date: '日期',
......@@ -70,7 +70,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId : wx.getStorageSync('memberId'),
members : wx.getStorageSync('members'),
})
}
......
// pages/activity/activity.js
// pages/activity/activity.js
......@@ -13,6 +13,12 @@ Page({
*/
data: {
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
members : "", // 商家信息
city: "",
county: "",
......@@ -101,9 +107,6 @@ Page({
wx.clearStorageSync('nyxCode');
var nyxCode = "uid_" + util.wxuuid()
wx.setStorageSync('nyxCode', nyxCode);
//todo set mid_456
var memberId = ""
wx.setStorageSync('memberId', memberId);
app.globalData.nyxCode = nyxCode;
app.regUser(nyxCode);
}
......@@ -134,8 +137,14 @@ Page({
})
}
// step2 todo temp 暂时设置所有用户为个人(可以查看个人->商家管理)
wx.setStorageSync('memberId', "")
// step3 确定member信息, 写入 data.members
var members = wx.getStorageSync('members') || []
wx.setStorageSync('members', members)
if(members.length > 0)
{
_this.setData({ members })
app.globalData.members = members
}
var device = wx.getSystemInfoSync()
//self.device = app.globalData.myDevice
......@@ -155,12 +164,12 @@ Page({
title: '酒肆活动',
})
// step3 数据载入页面, 初始化
// 初始载入我收藏的清单, 存入storage
// step4 数据载入页面, 初始化
// 初始载入'我已收藏'的清单, 存入storage
wx.setStorageSync('likeDictStorage', {})
_this.getCollectsStorage(0, 1, 100);
// 初始载入四个推荐的竞答活动
// step5 初始载入四个推荐的竞答活动
if(_this.__data__.activities.length == 0)
{
var switchId = app.globalData.switchId
......@@ -177,7 +186,7 @@ Page({
}
// event 订阅, 主要接受activity-info.js里 emit 发送的消息
// step6 event 订阅, 主要接受activity-info.js里 emit 发送的消息
event.on('LikeChanged', this, function(data) {
var activity_id = data['activity_id']
var num_like = data['num_like']
......@@ -190,7 +199,6 @@ Page({
activities[i]['num_like'] = num_like
}
}
_this.setData({
activities: activities,
})
......
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
......@@ -53,7 +53,7 @@
<text>我的活动</text>
</view> -->
<!-- jscat20200816 添加活动日历 for convinience -->
<block wx:if="{{memberId!=''}}">
<block>
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?city={{city}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
......@@ -61,14 +61,6 @@
</navigator>
</view>
</block>
<block wx:else>
<view class="items">
<navigator url="/pages/member/schedule/schedule">
<image src="../../icon/member/schedule.png"></image>
<text style="font-size:28rpx;">活动日历</text>
</navigator>
</view>
</block>
<view class="items">
<navigator url="/pages/my/my-collects/my-collects">
......
// pages/index/note-info/note-info.js
// pages/index/note-info/note-info.js
......@@ -6,9 +6,9 @@ Page({
*/
data: {
/* 用于判断是否已经登陆 */
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "0",
authStatus : "",
userInfo : {},
windowHeight: "",
......
// pages/index/quiz-result/quiz-result.js
// pages/index/quiz-result/quiz-result.js
......@@ -12,7 +12,7 @@ Page({
data: {
/* 用于判断是否已经登陆 */
nyxCode : "",
authStatus : "0",
authStatus : "",
userInfo : {}, // nickName, avartarUrl, gender, province, city, country
windowHeight: "",
......
// pages/key/key.js
// pages/key/key.js
......@@ -110,11 +110,6 @@ Page({
app.globalData.socketClose = false
}
}
//每次重置matchSeason
wx.setStorageSync('matchSeason', app.getSeason())
//1. 从local storage里读取最新的数据
app.globalData.matchSeason = wx.getStorageSync('matchSeason')
wx.setNavigationBarTitle({
title: "发现有趣的你"
......
<view class="post" style="height:100%;width:100%">
<view class="page-body">
<view class="post" style="height:100%;width:100%">
<view class="page-body">
<form catchsubmit="onSubmitPost" >
<view class="page-body">
<!-- <form > -->
<view class="btn-area">
<button type="normal" formType="submit">活动发布</button>
<block wx:if="{{authStatus=='00'}}">
<button open-type="getUserInfo" bindgetuserinfo="getUserInfo">授权发布</button>
</block>
<block wx:else>
<button bindtap="onSubmit">活动发布</button>
</block>
</view>
<view class="weui-cells__title">#添加内容</view>
......@@ -13,8 +17,67 @@
<view class="weui-textarea-counter">{{inputContent.length}}/300</view>
</view>
</view>
</view>
</form>
</view>
</view>
<!-- </form> -->
<!-- 企业信息 -->
<!-- <view class="note-row"> -->
<!-- <view class="note-column-left align justify"> -->
<view class="weui-cells">
<view class="weui-cell">
<view class="weui-cell__bd">
<view class="weui-uploader">
<view class="weui-uploader__hd">
<view class="weui-uploader__title">商家信息</view>
</view>
<view class="note-row">
<!-- start of column left -->
<view class="note-column-left align justify">
<view class="weui-uploader__bd">
<view class="weui-uploader__files">
<block wx:for="{{logoArray}}" wx:for-item="image">
<view class="weui-uploader__file">
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="previewImage"></image>
</view>
</block>
</view>
<block wx:if="{{logoArray.length == 0}}">
<view class="weui-uploader__input-box">
<view class="weui-uploader__input" bindtap="addLogo"></view>
</view>
</block>
</view>
</view>
<!-- end of note-column-left -->
<view class="note-column" style="margin-left: 20rpx;">
<view class="weui-cells weui-cells_after-title" style="height: 96rpx">
<view>
<view class="weui-cell__bd">
<input class="weui-input" bindinput="bindName" placeholder="请输入名称" />
</view>
</view>
</view>
<view class="weui-cells weui-cells_after-title" style="height: 96rpx">
<view>
<view class="weui-cell__bd">
<input class="weui-input" bindinput="bindAddress" placeholder="请输入地址" />
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
page{
page{
......@@ -3,8 +3,22 @@ page{
background-color:#f5f8fa;
}
.post{
position: absolute;
bottom: 0;
right:0px;
}
.note-row{
width: 100%;
display: flex;
flex-direction: row;
}
.note-column{
display: flex;
flex-direction: column;
}
.note-column-left{
width : 196rpx;
display: flex;
}
.writer-image{
width: 196rpx;
height: 196rpx;
}
\ No newline at end of file
// pages/schedule/schedule.js
// pages/schedule/schedule.js
......@@ -13,12 +13,9 @@ Page({
data: {
/* 用于判断是否已经登陆 */
nyxCode : "",
authStatus : "0",
authStatus : "",
userInfo : {},
memberId: "",
memberName: "",
bGetUserInfo : false,
bUpdateUserData: false,
members: [],
curDate : "",
days : [],
......@@ -37,7 +34,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId : wx.getStorageSync('memberId'),
members : wx.getStorageSync('members'),
})
}
......
// pages/activity/activity.js
// pages/activity/activity.js
......@@ -9,6 +9,13 @@ Page({
* 页面的初始数据
*/
data: {
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
members : "", // 商家信息
collects: [],
// {
// note_image: [ "https://1.jpg", "https://2.jpg"],
......@@ -44,12 +51,11 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId : wx.getStorageSync('memberId'),
members : wx.getStorageSync('members'),
})
}
// step2: todo temp 暂时设置所有用户为个人(可以查看个人->商家管理)
wx.setStorageSync('memberId', "")
// step3 数据载入页面, 初始化
wx.setStorageSync('likeDictStorage', {})
......
// pages/my/my-member/my-member.js
// pages/my/my-member/my-member.js
......@@ -8,11 +8,11 @@ Page({
* 页面的初始数据
*/
data: {
//用户信息初始化
nyxCode: "",
authStatus: "",
userInfo: {},
memberId: "", // 商家id
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
members : "", // 商家信息
},
......@@ -28,7 +28,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId : wx.getStorageSync('memberId'),
members : wx.getStorageSync('members'),
})
}
......@@ -40,10 +40,6 @@ Page({
windowHeight: windowHeight
})
/* end */
//tips:每次进入都重新更新
var matchSeason = _this.data.matchSeason
var nyxCode = _this.data.nyxCode
},
......@@ -96,34 +92,6 @@ Page({
},
// 用户自定义函数
// 获取真实数据
getMatchRank: function (matchSeason, matchTeam) {
var _this = this;
var strUrl = config.match_rank_query_url + '?matchSeason=' + matchSeason + '&matchTeam=' + matchTeam
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示上传成功(可以在阿里云服务器查看上传的图片)
console.log(res.data);
var result = _this.data.studyResult
var list = res.data.data
for (var j = 0; j < list.length; j++) {
var matchType = list[j].matchType
result[matchType] = list[j].ratioFinish == null ? 0 : list[j].ratioFinish
}
wx.setStorageSync('studyResult', result)
_this.setData({
studyResult: result,
})
}
}
})
},
})
\ No newline at end of file
// pages/my/my-orders/my-orders.js
// pages/my/my-orders/my-orders.js
......@@ -12,6 +12,7 @@ Page({
nyxCode: "",
authStatus: "",
userInfo: {},
members : [],
//选中barcode的qrcode和url
qrcode : "",
......@@ -64,7 +65,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId: wx.getStorageSync('memberId'),
members: wx.getStorageSync('members'),
})
}
......
// pages/my/rank/rank.js
// pages/my/rank/rank.js
......@@ -57,7 +57,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId: wx.getStorageSync('memberId'),
members: wx.getStorageSync('members'),
})
}
......
// pages/my/my.js
// pages/my/my.js
......@@ -10,13 +10,11 @@ Page({
* 页面的初始数据
*/
data: {
/* 用于判断是否已经登陆 */
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "0", // 授权状态: 00-未授权, 01-已授权
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
memberId : "",
bGetUserInfo : false,
bUpdateUserData: false,
members : [],
},
......@@ -32,7 +30,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
memberId : wx.getStorageSync('memberId'),
members : wx.getStorageSync('members'),
})
}
......@@ -64,7 +62,7 @@ Page({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
matchSeason: wx.getStorageSync('matchSeason'),
members: wx.getStorageSync('members'),
})
}
},
......@@ -134,7 +132,6 @@ Page({
wx.setStorageSync('userInfo', res.userInfo)
_this.setData({
userInfo: res.userInfo,
bGetUserInfo: false,
})
//通过openid换取唯一的nyxCode
......@@ -156,10 +153,6 @@ Page({
nyxCode: res.data.data.id,
authStatus: res.data.data.authStatus,
})
log.info("my_onLoad_nyxCode", _this.data.nyxCode)
log.info("my_onLoad_authStatus", _this.data.authStatus)
log.info("my_onLoad_userInfo", _this.data.userInfo)
log.info("my_onLoad_matchSeason", _this.data.matchSeason)
//载入页面
getCurrentPages()[getCurrentPages().length - 1].onLoad()
......@@ -172,9 +165,6 @@ Page({
},
fail: function (res) {
config.debug == 1 ? console.log("获取用户信息失败", res) : ""
_this.setData({
bGetUserInfo: false,
})
}
})
}
......@@ -220,23 +210,4 @@ Page({
})
},
// 打开权限设置页提示框
showSettingToast: function (e) {
wx.showModal({
title: '酒肆提示',
confirmText: "授权后即可访问'我的'功能哦",
showCancel: false,
content: e,
success: function (res) {
if (res.confirm) {
wx.navigateTo({
url: './setting/setting',
})
}
}
})
},
})
\ No newline at end of file
<view class="page">
<view class="page">
......@@ -2,7 +2,7 @@
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_access">
<view class="userInfo">
<block wx:if="{{authStatus=='1'}}" >
<block wx:if="{{authStatus=='01'}}" >
<!-- 已登录 -->
<view class="userInfo" bindtap="onToUser">
<image class="avatar" src="{{userInfo.avatarUrl}}"></image>
......@@ -47,7 +47,7 @@
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</navigator>
<!-- 只针对member商家开放 -->
<block wx:if="{{memberId!=''}}">
<block wx:if="{{members.length> 0}}">
<navigator class="weui-cell weui-cell_access" hover-class="weui-cell_active" url="/pages/my/my-members/my-members">
<view class="weui-cell__hd">
<image src="/icon/my/tools.png" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论