Commit 48027f49 by 张立顺

用户协议内容更新

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