Commit 48027f49 by 张立顺

用户协议内容更新

1 parent 7eb967e6
......@@ -85,5 +85,11 @@
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {
"authorization-plugin": {
"version": "1.0.2",
"provider": "wxe10067a63c1856ac"
}
}
}
\ No newline at end of file
const filter = require('../../../utils/filter.js');
const filter = require('../../../utils/filter.js')
import req from '../../restapi.js'
import api from '../../restapi.js'
import util from '../../../utils/util.js'
const app = getApp()
Page(filter.identityFilter({
/**
* 页面的初始数据
*/
data: {
list: [
// {
// name: '我的商户名片',
// icon: './images/card.png',
// },
// {
// name: '求关注',
// icon: './images/follow.png',
// url: '/pages/login/signIn/signIn?isFollow=1',
// },
// {
// name: '邀请注册',
// icon: './images/invite-gys.png'
// },
{
name: '使用帮助',
icon: './images/help.png',
url: 'https://mp.weixin.qq.com/s/5Slqep200aP54zw3FHQXdw',
type: 'h5'
},
{
name: '隐私政策',
icon: './images/policy.png',
url: 'https://dj.glsx.com.cn/agreement/djStorePolicy.html',
type: 'h5'
}
]
},
/**
* 获取导航栏高度
*/
getNavHeight(e) {
console.log(e)
util.getViewInfo('.user-info', res => {
Page(
filter.identityFilter({
/**
* 页面的初始数据
*/
data: {
list: [
// {
// name: '我的商户名片',
// icon: './images/card.png',
// },
// {
// name: '求关注',
// icon: './images/follow.png',
// url: '/pages/login/signIn/signIn?isFollow=1',
// },
// {
// name: '邀请注册',
// icon: './images/invite-gys.png'
// },
{
name: '使用帮助',
icon: './images/help.png',
url: 'https://mp.weixin.qq.com/s/5Slqep200aP54zw3FHQXdw',
type: 'h5'
},
{
name: '隐私政策',
icon: './images/policy.png',
url: 'https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/privacy.html',
// url: 'https://dj.glsx.com.cn/agreement/djStorePolicy.html',
type: 'h5'
}
]
},
/**
* 获取导航栏高度
*/
getNavHeight(e) {
console.log(e)
util.getViewInfo('.user-info', res => {
this.setData({
marginTop: e.detail,
userInfo: res.height
})
})
},
init(e) {
this.setData({
shareImg: e.detail
})
console.log('画完了')
},
/**
* 分享
*/
share() {
if (!this.data.obj.qr) return
this.setData({
showShare: true
})
wx.hideTabBar()
},
hideShare(e) {
this.setData({
marginTop: e.detail,
userInfo: res.height
showShare: e.detail
})
})
},
init(e) {
this.setData({
shareImg: e.detail
})
console.log('画完了')
},
/**
* 分享
*/
share() {
if (!this.data.obj.qr) return
this.setData({
showShare: true
})
wx.hideTabBar()
},
hideShare(e) {
this.setData({
showShare: e.detail
})
wx.showTabBar()
},
edit() {
let {
userInfo
} = app.globalData
console.log(userInfo)
let url = `../edit/edit?uuid=${userInfo.uuid}`
util.navigateTo(url)
},
getFocusUserInfo() {
util.showLoading('加载中...')
let id = app.globalData.userInfo.accountId
if (!id) {
util.showToast('系统异常')
return
}
util.promise(resolve => {
api.getFocusUserInfo(id, res => {
wx.showTabBar()
},
edit() {
let { userInfo } = app.globalData
console.log(userInfo)
let url = `../edit/edit?uuid=${userInfo.uuid}`
util.navigateTo(url)
},
getFocusUserInfo() {
util.showLoading('加载中...')
let id = app.globalData.userInfo.accountId
if (!id) {
util.showToast('系统异常')
return
}
util
.promise(resolve => {
api.getFocusUserInfo(id, res => {
console.log(res)
if (res.returnCode == 0) {
let obj = res.data
let employee = obj.employee
let merchant = obj.merchant
obj.merchantUserType = merchant.userType
if (employee) {
obj.name = employee.name
obj.merchantName = employee.merchantName
obj.logo = employee.photo
obj.phone = employee.phone
} else {
obj.merchantName = merchant.merchantName
obj.shopPhoto = merchant.shopPhoto
obj.phone = merchant.phone
}
obj.tips = '' //`${obj.name||obj.merchantName}希望可以实时关注到您的产品动态快来加入吧`
this.setData({
obj: obj
})
resolve()
} else {
util.showToast('系统异常')
}
})
})
.then(() => {
this.getQrcode()
})
},
getQrcode() {
let data = {
type: 'IRSM_' + this.data.obj.merchantUserType
}
api.getQrcode(data, res => {
console.log(res)
if (res.returnCode == 0) {
let obj = res.data
let employee = obj.employee
let merchant = obj.merchant
obj.merchantUserType = merchant.userType
if (employee) {
obj.name = employee.name
obj.merchantName = employee.merchantName
obj.logo = employee.photo
obj.phone = employee.phone
} else {
obj.merchantName = merchant.merchantName
obj.shopPhoto = merchant.shopPhoto
obj.phone = merchant.phone
}
obj.tips = '';//`${obj.name||obj.merchantName}希望可以实时关注到您的产品动态快来加入吧`
this.setData({
obj: obj
'obj.qr': res.data,
flag: true
})
resolve()
} else {
util.showToast('系统异常')
}
util.hideLoading()
})
}).then(() => {
this.getQrcode()
})
},
getQrcode() {
let data = {
type: 'IRSM_' + this.data.obj.merchantUserType
}
api.getQrcode(data, res => {
console.log(res)
if (res.returnCode == 0) {
this.setData({
'obj.qr': res.data,
flag: true,
})
}
util.hideLoading()
})
},
/**退出 */
logout() {
wx.showModal({
content: '退出登录后将不能使用嘀加智慧门店相关的小程序,确认退出?',
confirmText: '退出',
success(res) {
if (res.confirm) {
// 获取用户信息
wx.login({
success: response => {
app.globalData.code = response.code;
req.logout(_res_ => {
app.globalData.userInfo = null
console.log(_res_)
wx.reLaunch({
url: '../../../pages/index/index',
},
/**退出 */
logout() {
wx.showModal({
content: '退出登录后将不能使用嘀加智慧门店相关的小程序,确认退出?',
confirmText: '退出',
success(res) {
if (res.confirm) {
// 获取用户信息
wx.login({
success: response => {
app.globalData.code = response.code
req.logout(_res_ => {
app.globalData.userInfo = null
console.log(_res_)
wx.reLaunch({
url: '../../../pages/index/index'
})
})
})
}
})
}
})
}
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数-监听登录完成
*/
onLogin: function () {
util.showLoading('')
this.setData({
flag:true
},()=>{
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
let user = app.globalData.userInfo
if (user) {
this.setData({
user
})
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
/**
* 生命周期函数-监听登录完成
*/
onLogin: function () {
util.showLoading('')
this.setData(
{
flag: true
},
() => {
wx.hideLoading()
}
)
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
let user = app.globalData.userInfo
if (user) {
this.setData({
user
})
}
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
}
}))
\ No newline at end of file
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {}
})
)
......@@ -3,7 +3,6 @@ const app = getApp()
import api from '../../utils/restapi.js'
import service from './service.js'
Page({
/**
* 页面的初始数据
*/
......@@ -20,7 +19,7 @@ Page({
},
choose() {
this.setData({
agree: !this.data.agree,
agree: !this.data.agree
})
},
closeProtocol() {
......@@ -29,11 +28,9 @@ Page({
})
},
showPolicy(e) {
let {
url
} = e.currentTarget.dataset
const baseUrl = 'https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/'
const path = `${baseUrl}${url}.html`
let { url } = e.currentTarget.dataset
const baseUrl = 'https://img02.glsx.com.cn/weapp/resource/saas/scrm/html/'
const path = `${baseUrl}${url}.html`
// let path = 'https://dj.glsx.com.cn/agreement/djStorePolicy.html'
wx.navigateTo({
url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
......@@ -49,24 +46,24 @@ Page({
* 获取授权用户信息并跳转
*/
getUserProfile(e) {
console.log(e)
let self = this
wx.getUserProfile({
lang: 'zh_CN',
desc: '用于完善会员资料',
success: res => {
console.log("授权:", res)
console.log('授权:', res)
self.data.gender = res.userInfo.gender
wx.checkSession({
success() {
//session_key 未过期,并且在本生命周期一直有效
self.authUserInfo(res)
console.log(res, 'getUserProfile')
self.authUserInfo(JSON.parse(JSON.stringify(res)))
},
fail() {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: response => {
app.globalData.code = response['code'];
app.globalData.code = response['code']
self.authUserInfo(res)
}
})
......@@ -78,6 +75,41 @@ Page({
}
})
},
getPhoneNumber({ detail }) {
console.log(detail)
this.authUserInfo(JSON.parse(JSON.stringify(detail)))
},
// 插件获取用户授权
onSuccess(e) {
let { detail: res } = e
// console.log("授权:", res)
let self = this
self.data.gender = res.userInfo.gender
wx.checkSession({
success() {
//session_key 未过期,并且在本生命周期一直有效
console.log(res, 'checkSession')
// self.authUserInfo(res)
wx.login({
success: response => {
app.globalData.code = response['code']
console.log(response, 'wx.login')
self.authUserInfo(Object.assign(res, response))
}
})
},
fail() {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: response => {
console.log(response, 'failcheckSession')
app.globalData.code = response['code']
self.authUserInfo(res)
}
})
}
})
},
/**
* 授权用户信息登录
*/
......@@ -91,30 +123,32 @@ Page({
if (sceneData.query.employeeId) {
wechatAuthSetting['sceneParam'] = sceneData.query.employeeId
}
api.authUserInfo(wechatAuthSetting, res => {
console.log('授权用户信息登录', res)
if (res.returnCode == 0) {
let {
userId,
bizSource
} = this.data
let url = `../login/index/index`
if (bizSource) url = `../login/index/index?userId=${userId}&bizSource=${bizSource}`
wx.redirectTo({
url
})
} else {
console.log(wechatAuthSetting, 'wechatAuthSetting')
api.authUserInfo(
wechatAuthSetting,
res => {
console.log('授权用户信息登录', res)
if (res.returnCode == 0) {
let { userId, bizSource } = this.data
let url = `../login/index/index`
if (bizSource) url = `../login/index/index?userId=${userId}&bizSource=${bizSource}`
wx.redirectTo({
url
})
} else {
wx.showToast({
title: res.message || '系统异常',
icon: 'none'
})
}
},
() => {
wx.showToast({
title: res.message || '系统异常',
title: '授权用户信息失败',
icon: 'none'
})
}
}, () => {
wx.showToast({
title: '授权用户信息失败',
icon: 'none'
})
})
)
},
/**
* 生命周期函数--监听页面加载
......@@ -124,11 +158,12 @@ Page({
let isShare = wx.getStorageSync('isShare')
if (isShare) {
this.setData({
userId: isShare.userId,
})
if (isShare.bizSource) this.setData({
bizSource: isShare.bizSource
userId: isShare.userId
})
if (isShare.bizSource)
this.setData({
bizSource: isShare.bizSource
})
} else {
if (options.userId) {
this.setData({
......@@ -144,48 +179,35 @@ Page({
})
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}
})
\ No newline at end of file
onReachBottom: function () {}
})
{
"navigationStyle": "custom"
"navigationStyle": "custom",
"usingComponents": {
"authorization-component": "plugin://authorization-plugin/authorization-component"
}
}
\ No newline at end of file
<view class='fixed'>
<image src='../images/index.png' mode='widthFix'></image>
<image src='../images/index.png' mode='widthFix' />
</view>
<view class="login x-center {{agree?'agree':''}}">
<view>登录</view>
<button bindtap="getUserProfile" hidden="{{!agree}}">登录</button>
<view>登录</view>
<button bindtap="getUserProfile" hidden="{{!agree}}">登录</button>
<!-- <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录</button> -->
<!-- <authorization-component
args="{{args}}"
custom-class="aaaa"
bind:success="onSuccess"
bind:fail="onFail"
>
<button class="test">登录</button>
</authorization-component> -->
</view>
<view class='tips'>
<view class='choose-box' bindtap="choose"></view>
<view class='icon'>
<image src="{{agree?'../images/ok.png':'../images/box.png'}}" class='check-img'></image>
</view>
阅读并同意以下协议
<!-- <text catchtap="showProtocol">《服务协议》</text> -->
<!-- <text catchtap="showPolicy">《隐私政策》</text> -->
<text catchtap="showPolicy" data-url="privacy">《隐私协议》</text>
<text catchtap="showPolicy" data-url="agreement">《用户协议》</text>
<view class='choose-box' bindtap="choose" />
<view class='icon'>
<image src="{{agree?'../images/ok.png':'../images/box.png'}}" class='check-img' />
</view>
阅读并同意以下协议
<!-- <text catchtap="showProtocol">《服务协议》</text> -->
<!-- <text catchtap="showPolicy">《隐私政策》</text> -->
<text catchtap="showPolicy" data-url="privacy">《隐私协议》</text>
<text catchtap="showPolicy" data-url="agreement">《用户协议》</text>
</view>
<!-- 服务协议 -->
<view class='protocol' catchtouchmove="noScroll" hidden="{{protocol}}">
<view class='protocol-box'>
<view class='protocol-title'>
服务协议
<view class='close' bindtap="closeProtocol">
<mp-icon icon="close" color="#999" size="16"></mp-icon>
</view>
</view>
<scroll-view class='protocol-content' scroll-y>
<block wx:for='{{service.data}}' wx:key='index'>
<view class='title'>{{item.title}}</view>
<block wx:for='{{item.content}}' wx:key='ind' wx:for-index='ind' wx:for-item='i'>
<view class='content'>{{i}}</view>
</block>
</block>
</scroll-view>
<view class='protocol-btn' bindtap="agree">同意</view>
</view>
</view>
\ No newline at end of file
<view class='protocol-box'>
<view class='protocol-title'>
服务协议
<view class='close' bindtap="closeProtocol">
<mp-icon icon="close" color="#999" size="16" />
</view>
</view>
<scroll-view class='protocol-content' scroll-y>
<block wx:for='{{service.data}}' wx:key='index'>
<view class='title'>{{item.title}}</view>
<block
wx:for='{{item.content}}'
wx:key='ind'
wx:for-index='ind'
wx:for-item='i'>
<view class='content'>{{i}}</view>
</block>
</block>
</scroll-view>
<view class='protocol-btn' bindtap="agree">同意</view>
</view>
</view>
......@@ -228,5 +228,6 @@
]
}
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "2.12.3"
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!