瀏覽代碼

【消息推送】

release
GL 4 年之前
父節點
當前提交
5aab2bacb6
共有 8 個文件被更改,包括 379 次插入312 次删除
  1. +9
    -1
      config/config.js
  2. +64
    -8
      custom-tab-bar/index.js
  3. +4
    -4
      ext.json
  4. +1
    -1
      index/index.js
  5. +1
    -1
      index/index.wxml
  6. +294
    -291
      index/user.js
  7. +1
    -1
      project.config.json
  8. +5
    -5
      utils/spell.js

+ 9
- 1
config/config.js 查看文件

@@ -5,7 +5,15 @@ let sockUrls = extConfig.attr.socketUrl;
var config = { var config = {
url: configUrls, url: configUrls,
wsurl: sockUrls, wsurl: sockUrls,
api: {
api: {
/*
*记录微信订阅
*/
wxMsg:'/user/updateMsg',
/**
* 微信消息推送获取模板id
*/
templateId:"/wxMsg/templateList",
/** /**
* 接口用途:login * 接口用途:login
*/ */


+ 64
- 8
custom-tab-bar/index.js 查看文件

@@ -1,12 +1,13 @@
const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
let ifStoreApp = extConfig.attr.ifStoreApp; let ifStoreApp = extConfig.attr.ifStoreApp;
const Http = require("../utils/HttpBasics");
var config = require("../config/config.js");
Component({ Component({
data: { data: {
selected: 0, selected: 0,
"color": "#abb1be", "color": "#abb1be",
"selectedColor": "#FD782D", "selectedColor": "#FD782D",
"list": [
{
"list": [{
"pagePath": "/index/index", "pagePath": "/index/index",
"iconPath": "../assets/images/home.png", "iconPath": "../assets/images/home.png",
"selectedIconPath": "../assets/images/home-a.png", "selectedIconPath": "../assets/images/home-a.png",
@@ -33,10 +34,9 @@ Component({
] ]
}, },
attached() { attached() {
if (ifStoreApp==1){
if (ifStoreApp == 1) {
this.setData({ this.setData({
list: [
{
list: [{
"pagePath": "/index/index", "pagePath": "/index/index",
"iconPath": "../assets/images/home.png", "iconPath": "../assets/images/home.png",
"selectedIconPath": "../assets/images/home-a.png", "selectedIconPath": "../assets/images/home-a.png",
@@ -52,8 +52,7 @@ Component({
}) })
} else if (ifStoreApp == 2) { } else if (ifStoreApp == 2) {
this.setData({ this.setData({
list: [
{
list: [{
"pagePath": "/index/index", "pagePath": "/index/index",
"iconPath": "../assets/images/home.png", "iconPath": "../assets/images/home.png",
"selectedIconPath": "../assets/images/home-a.png", "selectedIconPath": "../assets/images/home-a.png",
@@ -79,10 +78,67 @@ Component({
switchTab(e) { switchTab(e) {
const data = e.currentTarget.dataset; const data = e.currentTarget.dataset;
const url = data.path; const url = data.path;
if(data.index==0||data.index==3){
this.getTemplateId()
}
wx.switchTab({url}); wx.switchTab({url});
this.setData({ this.setData({
selected: data.index selected: data.index
}) })
}
},
getTemplateId() {
Http.get({
url: config.api.templateId,
data: {
pageNum: 1,
pageSize: 100
}
}).then(res => {
const {
code,
data
} = res
if (code == 200) {
this.setData({
templateId: data.list
})
this.setWxMessage()
} else {
return
}
})
},
setWxMessage() {
let tmplIds = []
this.data.templateId.map(res => {
tmplIds.push(res.templateId)
})
console.log(tmplIds[0], "?|?|?|", this.data.templateId)
wx.requestSubscribeMessage({
tmplIds: tmplIds,
success(res) {
let _statue = null
tmplIds.map((item,index)=>{//判读用户是否点击了确定
if(res[item]=="accept"){
_statue = 'ok'
}
})
if (_statue == 'ok') {
Http.post({
url: config.api.wxMsg
}).then(res => {
console.log(res)
})
return
}
// for (let i = 0; i < tmplIds.length;i++){
// if (res.tmplIds[i] == 'accept'){
// console.log("发送")
// }
// }
}
})
},

} }
}) })

+ 4
- 4
ext.json 查看文件

@@ -16,14 +16,14 @@
} }
], ],
"configUrl": "https://ctest.malls.iformall.com/C/api", "configUrl": "https://ctest.malls.iformall.com/C/api",
"etcpAppId": "wx192b7d2e8dcbefd0",
"etcpAppId": "wx219a81b9c87aa4f7",
"etcpVersion": "release", "etcpVersion": "release",
"etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback", "etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback",
"ifHaveWebSocket": "0", "ifHaveWebSocket": "0",
"ifHaveCarModular": "1" "ifHaveCarModular": "1"
}, },
"name": "金泸商务",
"weappId": "wx649b3be73c1afe47",
"name": "富茂光谷测试版",
"weappId": "wx219a81b9c87aa4f7",
"appVersion": "C.test.5.2.0" "appVersion": "C.test.5.2.0"
}, },
"debug": false, "debug": false,
@@ -69,7 +69,7 @@
"provider": "wx2b03c6e691cd7370" "provider": "wx2b03c6e691cd7370"
} }
}, },
"extAppid": "wx649b3be73c1afe47",
"extAppid": "wx219a81b9c87aa4f7",
"extEnable": true, "extEnable": true,
"permission": { "permission": {
"scope.userLocation": { "scope.userLocation": {


+ 1
- 1
index/index.js 查看文件

@@ -287,7 +287,7 @@ Page({
}) })
}, },
onUnload() { onUnload() {
wx.removeStorageSync('squareList')
// wx.removeStorageSync('squareList')
}, },
onShow: function() { onShow: function() {
this.ifShowSqare(); this.ifShowSqare();


+ 1
- 1
index/index.wxml 查看文件

@@ -1,5 +1,5 @@
<navbar text="首页"></navbar> <navbar text="首页"></navbar>
<view class="container" style="padding-top:65px;">
<view class="container" style="padding-top:{{navigationBarHeight}};">
<!-- 所属集团 --> <!-- 所属集团 -->
<view class="underling" bindtap="goSquareList" wx:if="{{isShowSqare}}"> <view class="underling" bindtap="goSquareList" wx:if="{{isShowSqare}}">
<image class="underlingImg" mode="widthFix" src="https://formall.oss-accelerate.aliyuncs.com/cimg/dingwei.png"></image> <image class="underlingImg" mode="widthFix" src="https://formall.oss-accelerate.aliyuncs.com/cimg/dingwei.png"></image>


+ 294
- 291
index/user.js 查看文件

@@ -7,71 +7,72 @@ const imgurl = require("../utils/imgurl");
var config = require("../config/config.js"); var config = require("../config/config.js");
const bgColor = require("../utils/bgColor.js") const bgColor = require("../utils/bgColor.js")
Page({ Page({
/**
* 页面的初始数据
*/
data: {
templateId: [],
aboutShow: false,
navigationBarHeight,
ifStoreApp: ifStoreApp,
aboutUs: imgurl.aboutUs.url,
banneColor: bgColor.colorFirst.user.banneColor,
levelBg: bgColor.colorFirst.user.levelBg,
view: bgColor.colorFirst.user.view,
redirectUrl: imgurl.redirect.url,
editUrl: imgurl.edit.url,
activeUrl: imgurl.active.url,
dingUrl: imgurl.ding.url,
duihuan: imgurl.duihuan.url,
quansUrl: imgurl.quans.url,
wmintegral: imgurl.wmintegral.url,
cardiconUrl: imgurl.cardicon.url,
myactivitygift: imgurl.myactivitygift.url,
myactivity: imgurl.myactivity.url,
cheUrl: imgurl.che.url,
giftUrl: imgurl.gift.url,
wmbarginicon: imgurl.wmbarginicon.url,
wmspellgroup: imgurl.wmspellgroup.url,
canIUse: wx.canIUse('official-account'),
mineFlag: "",
flag: 'hidden',
score: '0',
curPhone: '',
name: "",
birthdate: "",
sex: "",
showEdit: false,
ismember: false,
canvasHidden: false,
maskHidden: true,
imagePath: '',
appVersion: "",
placeholder: ''
},
checkUserStatus() {
let that = this;
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {
wx.navigateTo({
url: '/pages/edit/edit',
})
}).catch(err => {
wx.navigateTo({
url: `/pages/getphoneInfo/index?mineFlag=mine`,
})
})
},
gotoPhoneInfo() {
/** /**
* 页面的初始数据
* 将值传到用户手机号授权的页面
*
*/ */
data: {
aboutShow: false,
navigationBarHeight,
ifStoreApp: ifStoreApp,
aboutUs: imgurl.aboutUs.url,
banneColor: bgColor.colorFirst.user.banneColor,
levelBg: bgColor.colorFirst.user.levelBg,
view: bgColor.colorFirst.user.view,
redirectUrl: imgurl.redirect.url,
editUrl: imgurl.edit.url,
activeUrl: imgurl.active.url,
dingUrl: imgurl.ding.url,
duihuan: imgurl.duihuan.url,
quansUrl: imgurl.quans.url,
wmintegral: imgurl.wmintegral.url,
cardiconUrl: imgurl.cardicon.url,
myactivitygift: imgurl.myactivitygift.url,
myactivity: imgurl.myactivity.url,
cheUrl: imgurl.che.url,
giftUrl: imgurl.gift.url,
wmbarginicon: imgurl.wmbarginicon.url,
wmspellgroup: imgurl.wmspellgroup.url,
canIUse: wx.canIUse('official-account'),
mineFlag: "",
flag: 'hidden',
score: '0',
curPhone: '',
name: "",
birthdate: "",
sex: "",
showEdit: false,
ismember: false,
canvasHidden: false,
maskHidden: true,
imagePath: '',
appVersion: "",
placeholder: ''
},
checkUserStatus() {
let that = this;
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {
wx.navigateTo({
url: '/pages/edit/edit',
})
}).catch(err => {
wx.navigateTo({
url: `/pages/getphoneInfo/index?mineFlag=mine`,
})
})
},
gotoPhoneInfo() {
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: `/pages/getphoneInfo/index?path=main`
});
},
wx.redirectTo({
url: `/pages/getphoneInfo/index?path=main`
});
},


/* 判断是否授权*/ /* 判断是否授权*/
userAuthorization() { userAuthorization() {
@@ -91,250 +92,252 @@ Page({






/**
* 跳转到成长值的页面
*/
gotograde: function() {
wx.navigateTo({
url: '/pages/czdetail/czdetail',
})
},
/**
* 跳转到商场信息的页面
*/
gomallInfo: function() {
wx.navigateTo({
url: '/pages/mallInfo/mallInfo',
})
},
showVersion: function() {
/** /**
* 跳转到成长值的页面
*/
gotograde: function () {
wx.navigateTo({
url: '/pages/czdetail/czdetail',
})
},
/**
* 跳转到商场信息的页面
* 长按显示版本号
*/ */
gomallInfo: function () {
wx.navigateTo({
url: '/pages/mallInfo/mallInfo',
})
},
showVersion: function () {
/**
* 长按显示版本号
*/
let that = this;
if (that.data.flag == 'hidden') {
that.setData({
flag: 'show'
});
}
},
gotoedit: function () {
this.checkUserStatus();
},
onLoad() {
this.getLocation();
this.updateScene();
// this.getRoomId();
// this.getRoomList();
console.log(wx.getExtConfigSync())
},
//获取房间列表
getRoomList(){
debugger
Http.get({
url: config.api.getRoomList,
let that = this;
if (that.data.flag == 'hidden') {
that.setData({
flag: 'show'
});
}
},
gotoedit: function() {
this.checkUserStatus();
},
onLoad() {
this.getLocation();
this.updateScene();
// this.getRoomId();
// this.getRoomList();
console.log(wx.getExtConfigSync())
},
//获取房间列表
getRoomList() {
debugger
Http.get({
url: config.api.getRoomList,
data: {
token: app.globalData.token,
appId: config.weapp.AppId
}
}).then(res => {
console.log(res)
})
},
getRoomId() {
let roomId = [3] // 填写具体的房间号,可通过下面【获取直播房间列表】 API 获取
let customParams = encodeURIComponent(JSON.stringify({
path: 'pages/index/index',
pid: 1
})) // 开发者在直播间页面路径上携带自定义参数(如示例中的path和pid参数),后续可以在分享卡片链接和跳转至商详页时获取,详见【获取自定义参数】、【直播间到商详页面携带参数】章节(上限600个字符,超过部分会被截断)
console.log(customParams, 777777777)
this.setData({
roomId,
customParams
})
},
/**
* 获得经纬度
*/
getLocation() {
let that = this;
wx.getLocation({
type: "wgs84",
success: function(res) {
console.log(res)
if (res && res.longitude && res.latitude) {
Http.post({
url: config.api.updateLBS,
data: { data: {
token: app.globalData.token,
appId:config.weapp.AppId
latitude: res.latitude,
longitude: res.longitude
} }
}).then(res => {
}).then(res => {
console.log(res) console.log(res)
})
}
},
fail: error => {
console.log(error);
}
})
},
/**
* 用户更新scene
*/
updateScene() {
Http.post({
url: config.api.updateScene,
data: {
scene: app.globalData.scene
}
}).then(res => {
console.log(res)
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
let that = this;
that.userAuthorization()
if (typeof that.getTabBar === 'function' &&
that.getTabBar()) {
if (ifStoreApp == 1) {
that.getTabBar().setData({
selected: 1
}) })
},
getRoomId() {
let roomId = [3] // 填写具体的房间号,可通过下面【获取直播房间列表】 API 获取
let customParams = encodeURIComponent(JSON.stringify({ path: 'pages/index/index', pid: 1 })) // 开发者在直播间页面路径上携带自定义参数(如示例中的path和pid参数),后续可以在分享卡片链接和跳转至商详页时获取,详见【获取自定义参数】、【直播间到商详页面携带参数】章节(上限600个字符,超过部分会被截断)
console.log(customParams,777777777)
this.setData({
roomId,
customParams
})
},
/**
* 获得经纬度
*/
getLocation() {
let that = this;
wx.getLocation({
type: "wgs84",
success: function (res) {
console.log(res)
if (res && res.longitude && res.latitude) {
Http.post({
url: config.api.updateLBS,
data: {
latitude: res.latitude,
longitude: res.longitude
}
}).then(res => {
console.log(res)
})
}
},
fail: error => {
console.log(error);
}
} else if (ifStoreApp == 2) {
that.getTabBar().setData({
selected: 2
}) })
},
/**
* 用户更新scene
*/
updateScene() {
Http.post({
url: config.api.updateScene,
data: {
scene: app.globalData.scene
}
}).then(res => {
console.log(res)
} else {
that.getTabBar().setData({
selected: 3
}) })
},
}

}
that.setData({
appVersion: extConfig.appVersion,
})
/** /**
* 生命周期函数--监听页面显示
* couponNum
* couponNum2
*/ */
onShow: function () {
let that = this;
that.userAuthorization()
if (typeof that.getTabBar === 'function' &&
that.getTabBar()) {
if (ifStoreApp == 1) {
that.getTabBar().setData({
selected: 1
})
} else if (ifStoreApp == 2) {
that.getTabBar().setData({
selected: 2
})
} else {
that.getTabBar().setData({
selected: 3
})
}
let num = wx.getStorageSync('couponNum');
let num1 = wx.getStorageSync('couponNum2');
wx.hideTabBarRedDot({
index: 3
});
if (num == 'couponNum1') {
wx.setStorage({
key: 'couponNum',
data: "couponNum1",
})
that.setData({
couponNum: "couponNum1"
})
} else if (num == 'couponNum') {
that.setData({
couponNum: "couponNum"
})
};
if (num1 == 'couponNum3') {
wx.setStorage({
key: 'couponNum2',
data: "couponNum3",
})
that.setData({
couponNum2: "couponNum3"
})
} else if (num1 == 'couponNum2') {
that.setData({
couponNum2: "couponNum2"
});
};


Http.get({
url: config.api.getScore,
data: {}
}).then(res => {
if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) {
that.setData({
showEdit: true
})
}
let curPhone = res.data.phone ? res.data.phone : '';
if (curPhone) {
let curPhoneList = curPhone.split('');
let curPhoneList01 = [];
curPhoneList.forEach((item, index) => {
if (index >= 3 && index <= 6) {
item = '*';
}
curPhoneList01.push(item);
})
curPhone = curPhoneList01.join('');
} }
that.setData({ that.setData({
appVersion: extConfig.appVersion,
score: res.data.score,
curPhone: curPhone,
levelName: res.data.levelName,
}) })
/**
* couponNum
* couponNum2
*/
let num = wx.getStorageSync('couponNum');
let num1 = wx.getStorageSync('couponNum2');
wx.hideTabBarRedDot({
index: 3
});
if (num == 'couponNum1') {
wx.setStorage({
key: 'couponNum',
data: "couponNum1",
})
that.setData({
couponNum: "couponNum1"
})
} else if (num == 'couponNum') {
that.setData({
couponNum: "couponNum"
})
};
if (num1 == 'couponNum3') {
wx.setStorage({
key: 'couponNum2',
data: "couponNum3",
})
that.setData({
couponNum2: "couponNum3"
})
} else if (num1 == 'couponNum2') {
that.setData({
couponNum2: "couponNum2"
});
};

Http.get({
url: config.api.getScore,
data: {}
}).then(res => {
if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) {
that.setData({
showEdit: true
})
}
let curPhone = res.data.phone?res.data.phone:'';
if (curPhone) {
let curPhoneList = curPhone.split('');
let curPhoneList01 = [];
curPhoneList.forEach((item,index) => {
if (index>=3 && index<=6) {
item = '*';
}
curPhoneList01.push(item);
})
curPhone = curPhoneList01.join('');
}
that.setData({
score: res.data.score,
curPhone: curPhone,
levelName: res.data.levelName,
})
if (res.data.nickName) {
that.setData({
ismember: true,
memberId: res.data.id
})
var size = this.setCanvasSize();
var initUrl = JSON.stringify({
flagid: res.data.id
});
}
if (res.data.nickName) {
that.setData({
ismember: true,
memberId: res.data.id
})
var size = this.setCanvasSize();
var initUrl = JSON.stringify({
flagid: res.data.id
});
}
})
.catch(err => {
wx.showModal({
title: '提示',
content: err.errMsg,
showCancel: false
}) })
.catch(err => {
wx.showModal({
title: '提示',
content: err.errMsg,
showCancel: false
})
})
//暂时注释
// that.getrun();
})
//暂时注释
// that.getrun();




//查询关于我们
Http.get({
url: config.api.getMallInfo,
data: {}
}).then(res => {
console.log(res)
if (res.data.businessHours !== '[]') {
that.setData({
aboutShow: true
})
} else {
that.setData({
aboutShow: false
})
}
})
.catch(err => {
})
},
//适配不同屏幕大小的canvas
setCanvasSize: function () {
var size = {};
try {
var res = wx.getSystemInfoSync();
var scale = 750 / 500;
//不同屏幕下canvas的适配比例;设计稿是750宽
var width = res.windowWidth / scale;
var height = width;
//canvas画布为正方形
size.w = width;
size.h = height;
} catch (e) {
// Do something when catch error
console.log("获取设备信息失败" + e);
//查询关于我们
Http.get({
url: config.api.getMallInfo,
data: {}
}).then(res => {
console.log(res)
if (res.data.businessHours !== '[]') {
that.setData({
aboutShow: true
})
} else {
that.setData({
aboutShow: false
})
} }
return size;
},
})
.catch(err => {})
},
//适配不同屏幕大小的canvas
setCanvasSize: function() {
var size = {};
try {
var res = wx.getSystemInfoSync();
var scale = 750 / 500;
//不同屏幕下canvas的适配比例;设计稿是750宽
var width = res.windowWidth / scale;
var height = width;
//canvas画布为正方形
size.w = width;
size.h = height;
} catch (e) {
// Do something when catch error
console.log("获取设备信息失败" + e);
}
return size;
},


});
});

+ 1
- 1
project.config.json 查看文件

@@ -31,7 +31,7 @@
"userConfirmedUseCompilerModuleSwitch": false "userConfirmedUseCompilerModuleSwitch": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.5.0",
"libVersion": "2.9.5",
"appid": "wxfa336cad86ed598d", "appid": "wxfa336cad86ed598d",
"projectname": "oldC", "projectname": "oldC",
"isGameTourist": false, "isGameTourist": false,


+ 5
- 5
utils/spell.js 查看文件

@@ -28,11 +28,11 @@ const spellStatus=[
value: 16 value: 16
}, },
{ {
name: '失败请稍',
name: '失败请稍',
value: 98 value: 98
}, },
{ {
name: '失败请稍',
name: '失败请稍',
value: 99 value: 99
} }
] ]
@@ -66,15 +66,15 @@ const spellStatus02 = [
value: 16 value: 16
}, },
{ {
name: '失败请稍',
name: '失败请稍',
value: 98 value: 98
}, },
{ {
name: '失败请稍',
name: '失败请稍',
value: 99 value: 99
} }
] ]
module.exports={ module.exports={
spellStatus, spellStatus,
spellStatus02 spellStatus02
}
}

Loading…
取消
儲存