Browse Source

1

dev_delivery
jiazhipeng 1 week ago
parent
commit
2f08c5ef2e
  1. 2
      App.vue
  2. 2
      mixins/myMixins.js
  3. 10
      pages.json
  4. 16
      pages/index/index.vue
  5. 6
      pages/login/login.vue
  6. 190
      pages/login/phoneLogin.vue
  7. 4
      static/js/CommonFunction.js
  8. 4
      store/modules/user.js
  9. 9
      subPackages/webPage/webPage.vue

2
App.vue

@ -5,6 +5,7 @@
console.log('App Launch')
// 1
// #ifdef MP-WEIXIN
uni.setStorageSync('SHFlag', false)
this.Post({id:2388},'/api/multimedia/detail').then(res => {
if (res && res.data) {
@ -16,6 +17,7 @@
uni.setStorageSync('SHFlag', false)
}
});
// #endif
},
onShow: function() {
console.log('App Show')

2
mixins/myMixins.js

@ -11,12 +11,14 @@ export const myMixins ={
if(option && option.wechat_qrcode){
uni.setStorageSync('wechat_qrcode',option.wechat_qrcode)
}
// #ifdef MP-WEIXIN
// 分享
uni.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
// #endif
},
// 分享到朋友圈
onShareTimeline() {

10
pages.json

@ -38,6 +38,16 @@
"navigationBarTitleText": "登录"
}
}
// #ifdef H5
,
{
"path": "pages/login/phoneLogin",
"style": {
"navigationBarTitleText": "登录"
}
}
// #endif
],
"subPackages": [{
"root": "subPackages",

16
pages/index/index.vue

@ -163,6 +163,7 @@
initSHFlag () {
let _this = this
//
// #ifdef MP-WEIXIN
try {
_this.SHFlag = uni.getStorageSync('SHFlag')?true: false
} catch (e) {
@ -177,6 +178,11 @@
}
console.log(_this.SHFlag)
},500)
// #endif
// #ifdef H5
_this.SHFlag = false
// #endif
},
initRectInfo () {
@ -261,13 +267,13 @@
}
//
this.navList = res.data.nav_menu
this.navList = res.data.nav_menu || []
// 广
this.recommendNav = res.data.recommend_data
this.recommendNav = res.data.recommend_data || []
//
this.moduleList = res.data.func_data
this.moduleList = res.data.func_data || []
})
// banner
@ -276,7 +282,7 @@
position: 0,
},"/api/adv/getAdv").then(res => {
if (res) {
this.topBanner = res.data
this.topBanner = res.data || []
}
});
@ -286,7 +292,7 @@
position: 1,
},"/api/adv/getAdv").then(res => {
if (res) {
this.smallBanner = res.data
this.smallBanner = res.data || []
}
});

6
pages/login/login.vue

@ -31,12 +31,18 @@ export default {
};
},
onLoad(options) {
// #ifdef H5
window.location.replace("/pages/login/phoneLogin")
// #endif
// #ifdef MP-WEIXIN
//
if (options.needAuth === '1') {
setTimeout(() => {
this.$refs.popup.open('bottom');
}, 400);
}
// #endif
},
methods: {
//

190
pages/login/phoneLogin.vue

@ -0,0 +1,190 @@
<template>
<view style="padding-top: 88rpx;">
<view class="login-tip">时味苏州PHoneLogin 申请获得</view>
<view class="login-tip2">以下权限</view>
<view class="login-tip-box">
<text>获得你的公开信息昵称头像地区及性别</text>
</view>
<view class="btn-box">
<button bindtap="cancel" type="default" @click="redirectIndex">取消</button>
<button type="primary" @click="getUserInfo">同意</button>
</view>
<view class="flex-center article-box">
<radio-group @change="toggleAgreement">
<radio value="1" :checked="isAgreed" style="transform:scale(0.7)"></radio>
</radio-group>
<view>同意<text @click="gotoInfo(9)">用户服务协议</text><text @click="gotoInfo(12)">隐私政策</text></view>
</view>
<uni-popup ref="popup" type="bottom" background-color="#fff">
<button type="default" open-type="getPhoneNumber" @getphonenumber="handlePhoneNumber" style="width: 100%;height: 12vh;line-height: 12vh;">点击授权手机号</button>
</uni-popup>
</view>
</template>
<script>
export default {
name: "login",
data() {
return {
isAgreed: false,
openid: ''
};
},
onLoad(options) {
},
methods: {
//
handlePhoneNumber(e) {
if (e.detail.errMsg === "getPhoneNumber:ok") { //
this.$refs.popup.close();
this.Post({
code: e.detail.code,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
openid: this.openid
}, '/api/uservice/user/bindPhoneNumber')
.then(res => {
this.$store.commit('changeUserInfo', res.data);
this.navigateBasedOnPath();
})
.catch(error => {
console.error('绑定手机号失败:', error);
uni.showToast({
title: '绑定手机号失败,请稍后重试',
icon: 'none'
});
});
} else {
console.error('获取手机号失败:', e.detail.errMsg);
uni.showToast({
title: '获取手机号失败,请稍后重试',
icon: 'none'
});
}
},
//
gotoInfo(id) {
uni.navigateTo({
url: '/subPackages/user/privacyInfo?id=' + id
});
},
//
toggleAgreement() {
this.isAgreed = !this.isAgreed;
},
//
redirectIndex() {
uni.switchTab({
url: '/pages/index/index',
});
},
//
getUserInfo() {
if (!this.isAgreed) {
uni.showToast({
title: '请先勾选同意《用户服务协议》、《隐私政策》',
icon: 'none'
});
return;
}
let data = {
avatar: "https://jdsz.obs.cn-east-3.myhuaweicloud.com:443/backend/upload/202509281759047643d42d0a25de93f030757727b6a74a999c2f5f0426.png",
birthday: "2020-02-05",
createtime: 1760087570,
email: "",
expires_in: 2592000,
expiretime: 1762679570,
from_source: "WECHAT",
fullname: "",
gender: 1,
id: 6069705,
id_number: "",
isBindMobile: 1,
is_enterprise: 2,
mobile: "19941952818",
name_verification: "UNCERTFIED",
nickname: "abc",
score: 106,
token: "c04a0d8e-b2dd-4a47-a2e8-0a7652520bad",
user_id: 6069705,
username: "",
uuid: "3c6f7d59-5c27-42ad-902b-89043fc4b4f8",
}
this.$store.commit('changeUserInfo', data);
},
//
navigateBasedOnPath() {
if (this.$store.state.user.toPath.includes('user/user')) {
uni.switchTab({
url: this.$store.state.user.toPath
});
} else {
uni.navigateBack({});
}
}
},
};
</script>
<style>
.login-tip {
font-size: 28rpx;
margin: 0 60rpx;
margin-top: 40rpx;
}
.login-tip2 {
font-size: 44rpx;
margin: 0rpx 60rpx;
margin-top: 20rpx;
font-weight: 400;
}
.login-tip-box {
display: flex;
align-items: flex-start;
margin: 0 60rpx;
font-size: 28rpx;
margin-top: 40rpx;
line-height: 40rpx;
}
.login-tip-box .icon-gou1 {
line-height: 80rpx;
margin-top: -20rpx;
margin-right: 30rpx;
color: #666;
}
.btn-box {
display: flex;
position: absolute;
bottom: 100rpx;
left: 0;
right: 0;
}
.btn-box button {
width: 400rpx;
}
.article-box {
position: absolute;
left: 0;
right: 0;
justify-content: center;
font-size: 24rpx;
color: #1aad19;
bottom: 40rpx;
}
.article-box .iconfont {
margin-right: 10rpx;
font-size: 26rpx;
}
.article-box text {
border-bottom: 1px solid;
}
</style>

4
static/js/CommonFunction.js

@ -256,6 +256,10 @@ Vue.prototype.getMaxCoupon = async function (param) {
// H5小程序跳转外部链接
Vue.prototype.gotoWebUrl = url => {
uni.navigateTo({
url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url)
})
// #ifdef MP-WEIXIN
uni.navigateTo({
url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url)

4
store/modules/user.js

@ -55,7 +55,9 @@ export default {
// #endif
// #ifdef H5
uni.navigateTo({
url: '/pages/login/phoneLogin'
})
// #endif
},
//订单数据

9
subPackages/webPage/webPage.vue

@ -10,9 +10,18 @@
}
},
onLoad(option) {
// #ifdef H5
if (option.url) {
let url = decodeURIComponent(option.url)
window.location.replace(url)
}
// #endif
// #ifdef MP-WEIXIN
if (option.url) {
this.url = decodeURIComponent(option.url)
}
// #endif
}
}
</script>

Loading…
Cancel
Save