This commit is contained in:
cclu 2023-09-07 18:39:36 +08:00
parent ad7e905587
commit b65799a706
6 changed files with 216 additions and 40 deletions

10
App.vue
View File

@ -62,8 +62,16 @@
}); });
}); });
this.$util.addUserBehavior( {intoRoute: '/'+options.path, outtoRoute: ''}) //
this.$util.addUserBehavior( {intoRoute: '/'+options.path, outtoRoute: ''}) //
}, },
onShow: function() { onShow: function() {

View File

@ -38,6 +38,8 @@
</template> </template>
<script> <script>
import {mapGetters} from "vuex";
export default { export default {
data(){ data(){
return{ return{
@ -45,6 +47,9 @@ export default {
selectIndex:'/pages/index/index' selectIndex:'/pages/index/index'
} }
}, },
computed:{
...mapGetters({'user':'getUser'})
},
props:{ props:{
page:{ page:{
type:String, type:String,

View File

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

View File

@ -712,6 +712,9 @@
</div> </div>
</div> </div>
</uni-popup> </uni-popup>
<!-- 底部导航栏--> <!-- 底部导航栏-->
<Tabbar ref="tabbar" :page="page"></Tabbar> <Tabbar ref="tabbar" :page="page"></Tabbar>
</view> </view>
@ -895,6 +898,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
...mapGetters({'user':'getUser'}),
'PushAuthority': (state) => state.userData.PushAuthority, 'PushAuthority': (state) => state.userData.PushAuthority,
'ProvinceCode': (state) => state.userData.ProvinceCode, 'ProvinceCode': (state) => state.userData.ProvinceCode,
toDoMsg:(state)=>{return state.toDoMsg}, toDoMsg:(state)=>{return state.toDoMsg},
@ -997,6 +1001,7 @@ export default {
} }
},10000) },10000)
} }
}, },
onShow(){ onShow(){
// tabbar tabbar // tabbar tabbar
@ -1018,6 +1023,7 @@ export default {
}, },
methods:{ methods:{
...mapActions(['memberLogin','getLoginCode']), ...mapActions(['memberLogin','getLoginCode']),
handleShowTrafficDetail(){ handleShowTrafficDetail(){
this.showMonthDetail = !this.showMonthDetail this.showMonthDetail = !this.showMonthDetail
}, },
@ -1959,7 +1965,7 @@ $iphoneHeight: env(safe-area-inset-bottom);
top: 0;left:0; top: 0;left:0;
box-sizing: border-box; box-sizing: border-box;
padding: 0 15px; padding: 0 15px;
z-index:9999999; z-index:999997;
.selectTime { .selectTime {
position: absolute; position: absolute;
display: flex; display: flex;
@ -4275,9 +4281,6 @@ $iphoneHeight: env(safe-area-inset-bottom);
} }
} }
.notice{ .notice{
position: fixed; position: fixed;
bottom: 120px; bottom: 120px;
@ -4372,6 +4375,8 @@ $iphoneHeight: env(safe-area-inset-bottom);
} }
} }
} }
} }
</style> </style>

View File

@ -2,20 +2,37 @@
<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> -->
<button type="primary" class="btn" open-type="getUserInfo" @getuserinfo="bindGetUserInfo">微信授权</button>
</view>
<view class="desc" v-else>
<button type="primary" class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">快速登录账号</button>
</view>
</view> </view>
<view class="desc" v-else>
<button type="primary" class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">快速登录账号</button>
</view>
</view> </view>
<view class="login-tip-text"> <view class="login-tip-text">
该小程序仅供企业内部人员登录使用<br/>您的手机号是核实身份的唯一凭证 该小程序仅供企业内部人员登录使用<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> </view>
</template> </template>
@ -25,7 +42,8 @@ export default {
data() { data() {
return { return {
shouldNavback: false, shouldNavback: false,
showPrivacy:false,// 西
showBtn:false,//
} }
}, },
computed:{ computed:{
@ -34,6 +52,22 @@ export default {
}) })
}, },
onLoad(option) { 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'){ if(option.source=='detail'){
this.shouldNavback = true this.shouldNavback = true
} }
@ -41,6 +75,68 @@ export default {
methods: { methods: {
...mapActions(['updateUser']), ...mapActions(['updateUser']),
...mapMutations(['setUser']), ...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) { getPhoneNumber (e) {
console.log(e) console.log(e)
uni.showLoading({ uni.showLoading({
@ -56,6 +152,7 @@ export default {
} }
// _this.$request.$webPost('WebAPI_Push/WeChat/BusinessPhone',arr).then(function (rs) { // _this.$request.$webPost('WebAPI_Push/WeChat/BusinessPhone',arr).then(function (rs) {
_this.$request.$get('WeChat_BusinessPhone',arr).then(function (rs) { _this.$request.$get('WeChat_BusinessPhone',arr).then(function (rs) {
console.log('rs',rs)
uni.hideLoading() uni.hideLoading()
if (rs.Result_Code === 100) { if (rs.Result_Code === 100) {
_this.setUser(rs.Result_Data) _this.setUser(rs.Result_Data)
@ -72,6 +169,7 @@ export default {
this.updateUser(data) this.updateUser(data)
}, },
bindGetUserInfo (e) { // bindGetUserInfo (e) { //
console.log('e',e)
let _this = this let _this = this
let user = _this.user let user = _this.user
if (e.mp.detail) { if (e.mp.detail) {
@ -79,34 +177,31 @@ export default {
title:'正在加载...', title:'正在加载...',
mask:true mask:true
}) })
uni.getUserInfo({ const res = e.mp.detail
success (res) { let arr = {
let arr = { encryptedData: encodeURIComponent(res.encryptedData),
encryptedData: encodeURIComponent(res.encryptedData), iv: encodeURIComponent(res.iv),
iv: encodeURIComponent(res.iv), }
} // _this.$request.$webPost('WebAPI_Push/WeChat/BusinessLicensed',arr).then(function (rs) {
// _this.$request.$webPost('WebAPI_Push/WeChat/BusinessLicensed',arr).then(function (rs) { _this.$request.$get('WeChat_BusinessLicensed',arr).then(function (rs) {
_this.$request.$get('WeChat_BusinessLicensed',arr).then(function (rs) { uni.hideLoading()
uni.hideLoading() if(rs.Result_Code==100){
if(rs.Result_Code==100){ let newUser = rs.Result_Data
let newUser = rs.Result_Data newUser.WeChat_MiniProToken = _this.user.WeChat_MiniProToken
newUser.WeChat_MiniProToken = _this.user.WeChat_MiniProToken _this.setUser(newUser)
_this.setUser(newUser) if(newUser.Membership_Phone) {
if(newUser.Membership_Phone) { _this.updateUser(newUser)
_this.updateUser(newUser) _this.$util.toNextRoute('switchTab', '/pages/index/index')
_this.$util.toNextRoute('switchTab', '/pages/index/index') // uni.reLaunch({url: '/pages/index/index'})
// uni.reLaunch({url: '/pages/index/index'}) }else{
}else{
} }
_this.$forceUpdate() _this.$forceUpdate()
}else{ }else{
uni.showToast({ uni.showToast({
title: rs.ResultDesc, title: rs.ResultDesc,
icon: 'none', icon: 'none',
duration:2000 duration:2000
})
}
}) })
} }
}) })
@ -119,7 +214,7 @@ export default {
} }
</script> </script>
<style scoped> <style scoped lang="scss">
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -150,4 +245,65 @@ image {
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>

View File

@ -121,6 +121,7 @@ const actions = {
if(!_id) return if(!_id) return
// console.log(_user) // console.log(_user)
await request.$get('WeChat_GetBusinessMemberInfo',{Membership_Id:_id}).then(res=>{ await request.$get('WeChat_GetBusinessMemberInfo',{Membership_Id:_id}).then(res=>{
console.log('res222',res)
// request.$webGet('WebAPI_Push/Member/GetMemberInfo',{Membership_Id:_id,memberShipId:_id}).then(res=>{ // request.$webGet('WebAPI_Push/Member/GetMemberInfo',{Membership_Id:_id,memberShipId:_id}).then(res=>{
if(res.Result_Code==100) { if(res.Result_Code==100) {
let data = res.Result_Data let data = res.Result_Data