[最新代码]

This commit is contained in:
zhangjing
2021-06-25 10:11:46 +08:00
parent b555234d49
commit aacd11356b
29 changed files with 199 additions and 42 deletions

View File

@@ -26,6 +26,7 @@ Page({
isUser : false, //用户登录状态
noticeData : '', //首页公告
loading : true, //骨架屏加载
subState : '', //订阅状态
address : {
city: "", //市
area: "", //区
@@ -70,13 +71,13 @@ Page({
indexInfo() {
if(this.data.stateType == 'shaky') {
wx.$api.index.index(this.data.city, this.data.longitude, this.data.latitude).then(res=>{
console.log(res.data.adverts)
this.setData({
adverts : res.data.adverts,
cardArr : res.data.rights,
activities : res.data.activities,
noticeData : res.data.notice,
loading : false,
subState :res.data.welfare_subscribe,
address : {
city: res.data.location.city_name,
area: res.data.location.district_name || "",
@@ -96,7 +97,6 @@ Page({
})
} else {
wx.$api.index.choice(this.data.stateType,this.data.city, this.data.longitude, this.data.latitude).then(res=>{
console.log(res.data.adverts)
this.setData({
adverts : res.data.adverts,
cardArr : res.data.categorys,
@@ -171,7 +171,6 @@ Page({
* 点击轮播图片
*/
clickImg(e) {
console.log(e.currentTarget.dataset)
let newChannel = e.currentTarget.dataset.channel,
newImg = e.currentTarget.dataset.img,
newUrl = e.currentTarget.dataset.url
@@ -325,8 +324,15 @@ Page({
* 订阅
*/
subscribeTap() {
if(!this.data.isUser) {
// 去登录
wx.navigateTo({
url: "/pages/login/login"
})
return
}
wx.requestSubscribeMessage({
tmplIds: ['g8cEL-Tf2_Pdh8VyBdsYbhv09VVm8om-ZblhXIaVDiY'],
tmplIds: ['6SJqWbasj42O_d7yET1s5G1eg62Z4SS3pByBeuXekSo'],
success: res=> {
if(res.errMsg == "requestSubscribeMessage:ok") {
wx.$api.index.subscribe(1).then(res=>{
@@ -334,9 +340,14 @@ Page({
title: res.data,
icon : 'none',
})
// 获取卡权益
this.indexInfo();
setTimeout(function () {
wx.hideLoading();
}, 1000)
}).catch(err=>{
})