提交 a0042f5b authored 作者: 正反's avatar 正反

公众号关注

上级 e5a1e965
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
{ {
"launchtype" : "local" "launchtype" : "local"
}, },
"h5" :
{
"launchtype" : "local"
},
"mp-weixin" : "mp-weixin" :
{ {
"launchtype" : "local" "launchtype" : "local"
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<view class="modal"> <view class="modal">
<u-modal v-model="loginModal" :show-cancel-button="true" :title-style="loginModalTitleStyle" title="授权登录" <u-modal v-model="loginModal" :show-cancel-button="true" :title-style="loginModalTitleStyle" title="授权登录"
confirm-text="立即登录" cancel-text="暂不登录" confirm-color="#7c59fc" @confirm="handleLogin"> confirm-text="立即登录" cancel-text="暂不登录" confirm-color="#7c59fc" @confirm="handleLogin()">
<view class="slot-content"> <view class="slot-content">
<view class="modal-title">京台服务师傅端</view> <view class="modal-title">京台服务师傅端</view>
<view class="modal-sub-title">靖靖智能科技(上海)有限公司</view> <view class="modal-sub-title">靖靖智能科技(上海)有限公司</view>
...@@ -69,6 +69,14 @@ ...@@ -69,6 +69,14 @@
@confirm="auth"></u-modal> @confirm="auth"></u-modal>
</view> </view>
<view>
<u-modal v-model="showModal" :content="content" confirm-text="了解详情" title="温馨提示" show-cancel-button="ture"
:title-style="titleStyle" :cancel-style="cancelStyle" :confirm-style="confirmStyle" @confirm="toHelp()">
<text class="Modaltext">您尚未关注“京台服务”公众号,无法接收订单推送通知,操作可参考帮助中心</text>
</u-modal>
</view>
</view> </view>
</template> </template>
<script> <script>
...@@ -87,6 +95,7 @@ ...@@ -87,6 +95,7 @@
onLoad() { onLoad() {
this.init() this.init()
uni.$u.mpShare.title = '页面分享'; uni.$u.mpShare.title = '页面分享';
this.cheackUnionID()
}, },
onShow() { onShow() {
let that = this let that = this
...@@ -97,18 +106,45 @@ ...@@ -97,18 +106,45 @@
// }else{ // }else{
// console.log("实名认证了,继续操作吧") // console.log("实名认证了,继续操作吧")
// } // }
this.init() // this.init()
// if(this.state.initComplete == true){ // if(this.state.initComplete == true){
// this.$store.state.loading = true // this.$store.state.loading = true
// //查询订单信息 // //查询订单信息
// this.sfview() // this.sfview()
// } // }
}, },
// onHide() {
// if(this.timer) {
// clearTimeout(this.timer);
// this.timer = null;
// }
// },
// onUnload() {
// if(this.timer) {
// clearTimeout(this.timer);
// this.timer = null;
// }
// },
data() { data() {
return { return {
unionid: '',
timer: '',
showModal: false,
offset: [5, 0], offset: [5, 0],
subIndex: '', subIndex: '',
changeColor: false, changeColor: false,
titleStyle: {
fontWeight: "bold"
},
cancelStyle: {
fontWeight: "bold",
color: "#000000"
},
confirmStyle: {
fontWeight: "bold",
color: "#000000"
},
btnStyle: { btnStyle: {
background: "#7D5AFC", background: "#7D5AFC",
color: '#FFFFFF' color: '#FFFFFF'
...@@ -190,7 +226,7 @@ ...@@ -190,7 +226,7 @@
success(res) { success(res) {
that.$store.state.login = true that.$store.state.login = true
that.$store.state.code = res.code that.$store.state.code = res.code
console.log(res) console.log("信息:", res)
loading() loading()
Validation(res.code).then((res) => { Validation(res.code).then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
...@@ -281,7 +317,57 @@ ...@@ -281,7 +317,57 @@
} }
}) })
}, },
//跳转至帮助中心
toHelp() {
uni.navigateTo({
url: '../help/help'
})
},
//获取unionid,判断用户是否关注公众号
cheackUnionID() {
let that = this
wx.login({
success(res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
data: {
appid: 'wx6e2d664687c88632',
secret: 'fd9f861950556225abbdcca3876576ed',
js_code: res.code,
grant_type: 'authorization_code'
},
header: {
'content-type': 'application/json' // 默认值
},
success(res) {
console.log("dengluxiaoxi:", res.data.unionid)
if (res.data.unionid) {
that.$store.state.unionid = res.data.unionid
that.unionid = res.data.unionid
console.log(that.unionid)
}
that.SetTime()
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
console.log(that.$store.state.code)
},
//设置定时器每30秒提醒未关注用户关注公众号
SetTime() {
let that=this
if (this.$store.state.unionid.length < 1) {
that.showModal=true
this.timer = setInterval(() => {
that.showModal=true
}, 30000)
}
},
//跳转至认证 //跳转至认证
auth() { auth() {
uni.navigateTo({ uni.navigateTo({
...@@ -553,4 +639,16 @@ ...@@ -553,4 +639,16 @@
background-color: #7D5AFC; background-color: #7D5AFC;
color: #ffffff; color: #ffffff;
} }
.Modaltext {
padding-left: 25rpx;
padding-right: 25rpx;
margin-top: 20rpx;
text-align: center;
vertical-align: middle;
margin-bottom: 30rpx;
display: block;
font-size: 33rpx;
color: #aeb2b9;
}
</style> </style>
...@@ -21,7 +21,8 @@ const store = new Vuex.Store({ ...@@ -21,7 +21,8 @@ const store = new Vuex.Store({
encryptedData:'', encryptedData:'',
iv:'', iv:'',
//设备信息 //设备信息
sysInfo:'' sysInfo:'',
unionid:''
}, },
mutations: { mutations: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论