This commit is contained in:
cclu 2023-09-07 18:43:58 +08:00
parent 31e1289e8e
commit 052710886b
3 changed files with 302 additions and 147 deletions

View File

@ -67,6 +67,7 @@
"postcss" : true "postcss" : true
}, },
"usingComponents" : true, "usingComponents" : true,
"__usePrivacyCheck__": true,
"permission" : { "permission" : {
"scope.userLocation" : { "scope.userLocation" : {
"desc" : "获取位置信息用于展示" "desc" : "获取位置信息用于展示"

View File

@ -9,14 +9,14 @@
:doCout="toDoMsg ? toDoMsg[item.id] : 0" :doCout="toDoMsg ? toDoMsg[item.id] : 0"
:active="item.id=='d5a9e3ef-3699-448f-abcc-819179df60bd' || menus[item.id]==1 || this.membershipType === 9999" :active="item.id=='d5a9e3ef-3699-448f-abcc-819179df60bd' || menus[item.id]==1 || this.membershipType === 9999"
@handleClick="toPage" @handleClick="toPage"
></menuItem> ></menuItem>
</view> </view>
</menuModel> </menuModel>
<!-- <view class="home-model"> <!-- <view class="home-model">
<div class="model-title"> <div class="model-title">
<text class="text">综合办公</text> <text class="text">综合办公</text>
</div> </div>
<div class="model-content"> <div class="model-content">
<menuItem v-for="item in modelMenu.zhbg" <menuItem v-for="item in modelMenu.zhbg"
:key="item.id" :key="item.id"
@ -220,7 +220,7 @@
this.$util.toNextRoute('navigateTo', item.homeUrl) this.$util.toNextRoute('navigateTo', item.homeUrl)
} else if (this.user.Membership_Type !== 9999) { } else if (this.user.Membership_Type !== 9999) {
uni.showToast({ uni.showToast({
title: '您没有该模块权限', title: '您没有该模块权限,请联系管理员',
icon: 'none' icon: 'none'
}) })
} }

View File

@ -1,155 +1,309 @@
<template> <template>
<view class="content"> <view class="content">
<view> <view>
<image src="https://eshangtech.com/ShopICO/yxcl-register-pht.png" mode="aspectFit"></image> <image src="https://eshangtech.com/ShopICO/yxcl-register-pht.png" mode="aspectFit"></image>
<view class="desc" v-if="!user.WeChat_UserId "> <view v-if="showBtn">
<!-- <view class="desc">申请获取你的公开信息(昵称头像)</view> --> <view class="desc" v-if="!user.WeChat_UserId">
<button type="primary" class="btn" open-type="getUserInfo" @getuserinfo="bindGetUserInfo">手机授权</button> <!-- <view class="desc">申请获取你的公开信息(昵称头像)</view> -->
</view> <button type="primary" class="btn" open-type="getUserInfo" @getuserinfo="bindGetUserInfo">微信授权</button>
<view class="desc" v-else> </view>
<button type="primary" class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">快速登录账号</button> <view class="desc" v-else>
</view> <button type="primary" class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">快速登录账号</button>
</view>
</view>
</view>
<view class="login-tip-text"> </view>
该小程序仅供企业内部人员登录使用<br/>您的手机号是核实身份的唯一凭证 <view class="login-tip-text">
</view> 该小程序仅供企业内部人员登录使用<br/>您的手机号是核实身份的唯一凭证
</view> </view>
<view class="privacyMeng" v-if="showPrivacy"></view>
<view class="privacy" v-if="showPrivacy">
<view class="privacyContent">
<p class="contentTitle">用户隐私保护提示</p>
<view class="contentWord">
感谢您使用本产品您使用本产品前应当仔细阅读并同意<text class="tips" @click="handleOpenPrivacyContract">小程序隐私保护指引</text>
当您点击同意并开始使用产品服务时即表示您已理解并同意该条款内容该条款将对您产生法律约束如您拒绝将无法更好的体验产品
</view>
</view>
<view class="btnList">
<button class="btns noAgree" @click="handleRefuse">拒绝</button>
<button class="btns agree" id="agree-btn3" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
</view>
</view>
</template> </template>
<script> <script>
import { mapActions, mapGetters,mapMutations } from 'vuex' import { mapActions, mapGetters,mapMutations } from 'vuex'
export default { export default {
data() { data() {
return { return {
shouldNavback: false, shouldNavback: false,
showPrivacy:false,// 西
showBtn:false,//
}
},
computed:{
...mapGetters({
'user':'getUser',
})
},
onLoad(option) {
let _this = this
wx.getPrivacySetting({
success: res=>{
console.log('res123123',res)
if (res.needAuthorization){
_this.showPrivacy = true
}else{
_this.showBtn = true
// if (this.user.WeChat_MiniProToken) {
// this.memberLogin()
// } else {
// this.getLoginCode()
// }
}
}
})
if(option.source=='detail'){
this.shouldNavback = true
}
},
methods: {
...mapActions(['updateUser']),
...mapMutations(['setUser']),
//
handleOpenPrivacyContract(){
wx.openPrivacyContract({
success: (success) => {
console.log('success',success)
}, //
fail: () => {}, //
complete: () => {}
})
},
//
handleAgreePrivacyAuthorization(e){
console.log('e1',e)
this.showPrivacy = false
this.showBtn = true
},
//
handleRefuse(){
this.showPrivacy = false
},
// //
// handleGetUserInfo(e){
// console.log('e2',e)
// let _this = this
// let user = _this.user
// if (e.mp.detail) {
// uni.showLoading({
// title:'...',
// mask:true
// })
// const res = e.mp.detail
// console.log('res',res)
// let arr = {
// encryptedData: encodeURIComponent(res.encryptedData),
// iv: encodeURIComponent(res.iv),
// }
// // _this.$request.$webPost('WebAPI_Push/WeChat/BusinessLicensed',arr).then(function (rs) {
// _this.$request.$get('WeChat_BusinessLicensed',arr).then(function (rs) {
// console.log('rs',rs)
// uni.hideLoading()
// if(rs.Result_Code==100){
// let newUser = rs.Result_Data
// newUser.WeChat_MiniProToken = _this.user.WeChat_MiniProToken
// _this.setUser(newUser)
// if(newUser.Membership_Phone) {
// _this.updateUser(newUser)
// _this.$util.toNextRoute('switchTab', '/pages/index/index')
// // uni.reLaunch({url: '/pages/index/index'})
// }else{
//
// }
// _this.$forceUpdate()
// }else{
// uni.showToast({
// title: rs.ResultDesc,
// icon: 'none',
// duration:2000
// })
// }
// })
// }
// },
getPhoneNumber (e) {
console.log(e)
uni.showLoading({
title:'正在加载...',
mask:true
})
let _this = this
let _data = e.mp.detail
let user = _this.user
let arr = {
encryptedData: encodeURIComponent(_data.encryptedData),
iv: encodeURIComponent(_data.iv)
}
// _this.$request.$webPost('WebAPI_Push/WeChat/BusinessPhone',arr).then(function (rs) {
_this.$request.$get('WeChat_BusinessPhone',arr).then(function (rs) {
console.log('rs',rs)
uni.hideLoading()
if (rs.Result_Code === 100) {
_this.setUser(rs.Result_Data)
_this.updateUserFn(rs.Result_Data)
_this.$util.toNextRoute('switchTab', '/pages/index/index')
// uni.switchTab({url: '/pages/index/index'})
} } else {
}, uni.showToast({title: rs.Result_Desc || '服务器错误,请联系管理员。', icon: 'none'})
computed:{ }
...mapGetters({ })
'user':'getUser', },
}) async updateUserFn(data) {
}, this.updateUser(data)
onLoad(option) { },
if(option.source=='detail'){ bindGetUserInfo (e) { //
this.shouldNavback = true console.log('e',e)
} let _this = this
}, let user = _this.user
methods: { if (e.mp.detail) {
...mapActions(['updateUser']), uni.showLoading({
...mapMutations(['setUser']), title:'正在加载...',
getPhoneNumber (e) { mask:true
console.log(e) })
uni.showLoading({ const res = e.mp.detail
title:'正在加载...', let arr = {
mask:true encryptedData: encodeURIComponent(res.encryptedData),
}) iv: encodeURIComponent(res.iv),
let _this = this }
let _data = e.mp.detail // _this.$request.$webPost('WebAPI_Push/WeChat/BusinessLicensed',arr).then(function (rs) {
let user = _this.user _this.$request.$get('WeChat_BusinessLicensed',arr).then(function (rs) {
let arr = { uni.hideLoading()
encryptedData: encodeURIComponent(_data.encryptedData), if(rs.Result_Code==100){
iv: encodeURIComponent(_data.iv) let newUser = rs.Result_Data
} newUser.WeChat_MiniProToken = _this.user.WeChat_MiniProToken
// _this.$request.$webPost('WebAPI_Push/WeChat/BusinessPhone',arr).then(function (rs) { _this.setUser(newUser)
_this.$request.$get('WeChat_BusinessPhone',arr).then(function (rs) { if(newUser.Membership_Phone) {
uni.hideLoading() _this.updateUser(newUser)
if (rs.Result_Code === 100) { _this.$util.toNextRoute('switchTab', '/pages/index/index')
_this.setUser(rs.Result_Data) // uni.reLaunch({url: '/pages/index/index'})
_this.updateUserFn(rs.Result_Data) }else{
_this.$util.toNextRoute('switchTab', '/pages/index/index')
// uni.switchTab({url: '/pages/index/index'})
} else { }
uni.showToast({title: rs.Result_Desc || '服务器错误,请联系管理员。', icon: 'none'}) _this.$forceUpdate()
} }else{
}) uni.showToast({
}, title: rs.ResultDesc,
async updateUserFn(data) { icon: 'none',
this.updateUser(data) duration:2000
}, })
bindGetUserInfo (e) { // }
let _this = this })
let user = _this.user }
if (e.mp.detail) { }
uni.showLoading({ },
title:'正在加载...', onUnload() {
mask:true this.$util.addUserBehavior()
}) },
uni.getUserInfo({ }
success (res) {
let arr = {
encryptedData: encodeURIComponent(res.encryptedData),
iv: encodeURIComponent(res.iv),
}
console.log('res',res)
console.log('arr',arr)
// _this.$request.$webPost('WebAPI_Push/WeChat/BusinessLicensed',arr).then(function (rs) {
_this.$request.$get('WeChat_BusinessLicensed',arr).then((rs)=> {
console.log('rs',rs)
uni.hideLoading()
if(rs.Result_Code==100){
let newUser = rs.Result_Data
newUser.WeChat_MiniProToken = _this.user.WeChat_MiniProToken
_this.setUser(newUser)
if(newUser.Membership_Phone) {
_this.updateUser(newUser)
_this.$util.toNextRoute('switchTab', '/pages/index/index')
// uni.reLaunch({url: '/pages/index/index'})
}else{
}
_this.$forceUpdate()
}else{
uni.showToast({
title: rs.ResultDesc,
icon: 'none',
duration:2000
})
}
})
}
})
}
}
},
onUnload() {
this.$util.addUserBehavior()
},
}
</script> </script>
<style scoped> <style scoped lang="scss">
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
height: 100vh; height: 100vh;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
padding-top: 60rpx; padding-top: 60rpx;
} }
image { image {
width: 624rpx; width: 624rpx;
height: 579rpx; height: 579rpx;
} }
.btn { .btn {
margin-top: 84rpx; margin-top: 84rpx;
width: 580rpx; width: 580rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.login-tip-text { .login-tip-text {
position: sticky; position: sticky;
bottom: 120rpx; bottom: 120rpx;
left: 0; left: 0;
width: 580rpx; width: 580rpx;
z-index: 99; z-index: 99;
text-align: center; text-align: center;
font-size: 26rpx; font-size: 26rpx;
color: #888; color: #888;
} }
.privacyMeng{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0,0,0,0.3);
z-index: 999998;
}
.privacy{
position: fixed;
bottom: 0;
width: 100vw;
box-sizing: border-box;
padding: 40rpx 30rpx;
z-index: 999999;
border-top-right-radius: 24px;
border-top-left-radius: 24px;
background: #fff;
.privacyContent{
.contentTitle{
font-size: 48rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #000000;
line-height: 56rpx;
}
.contentWord{
margin-top: 32rpx;
text-indent: 2em;
.tips {
font-size: 28rpx;
font-family: Source Han Sans CN-Normal, Source Han Sans CN;
font-weight: 400;
color: #8BC21F;
line-height: 33rpx;
}
}
}
.btnList{
display: flex;
justify-content: space-evenly;
align-items: center;
margin-top: 48rpx;
.btns{
display: inline-block;
padding: 0 90rpx;
border-radius: 15rpx;
}
.noAgree{
background: rgb(242,242,242);
color: rgb(26,187,107);
font-weight: 600;
}
.agree{
background: rgb(26,187,107);
color: #fff;
font-weight: 600;
}
}
}
</style> </style>