123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- const app = getApp()
- const util = require('../../utils/util.js')
- Page({
- data: {
- pushCont: {
- wc_content: ''
- },
- isSetstatus: false,
- isvip: true,
- arr: [],
- indicatorDots: true,
- wv_grade: '',
- wv_account_number: '',
- wv_account_name: '',
- loaddisplay: true,
- dcshow: false,
- wv_register_count: '',
- wv_contract_count: '',
- wv_finish_count: '',
- wv_extract_count: '',
- wv_qrcode: '',
- phoneauth: false,
- autoplay: true,
- interval: 5000,
- duration: 2000,
- usertype: '',
- userInfo: {},
- nickName: '登录',
- avatarUrl: 'https://api.zhumi.tech/MiniProgram/image/head.png',
- hasUserInfo: false,
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- phoneShow: false,
- mask: false
- },
- //事件处理函数
- bindViewTap: function() {
- wx.navigateTo({
- url: '../logs/logs'
- })
- },
- init() {
- const _this = this;
- // 判断用户是否设置过孕期
- util.getData('/getWXUser', {
- xu_openid: app.globalData.openid
- })
- .then(res => {
- // console.log(res);
- if (res.xu_content_type && res.xu_content_date) {
- _this.setData({
- isSetstatus: true
- })
- // 育儿或孕周内容查询
- util.postData('/queryUserContent', {
- openid: app.globalData.openid
- })
- .then(res => {
- // console.log(res)
- _this.setData({
- pushCont: res
- })
- })
- .catch(err => {
- console.log(err);
- })
- }
- })
- .catch(err => {
- console.log(err);
- })
- //获取用户等级
- console.log(app.globalData);
- if (app.globalData.usertype == 2) {
- this.setData({
- nickName: app.globalData.userInfo.nickName,
- avatarUrl: app.globalData.userInfo.avatarUrl
- })
- } else {
- this.setData({
- // nickName: app.globalData.nickName,
- avatarUrl: 'https://yuesuo.yueguanjia.com/MiniProgram/images/head.png'
- })
- }
- //判断是否为介绍人
- if (app.globalData.userphone != null && app.globalData.userphone != 'undefined' && app.globalData.userphone !=
- ' ' && app.globalData.userphone != '') {
- util.getData('/checkDcIntroducers', {
- wv_phone: app.globalData.userphone
- }).then(res => {
- if (res != "") {
- _this.setData({
- dcshow: true,
- phoneauth: true,
- wv_register_count: res.wv_register_count,
- wv_contract_count: res.wv_contract_count,
- wv_finish_count: res.wv_finish_count,
- wv_extract_count: res.wv_extract_count,
- wv_grade: res.wv_gradeid,
- wv_qrcode: res.wv_qrcode,
- wv_account_number: res.wv_account_number,
- wv_account_name: res.wv_account_name
- })
- } else {
- _this.setData({
- dcshow: false,
- phoneauth: true
- })
- }
- })
- } else {
- this.setData({
- dcshow: false,
- phoneauth: false
- })
- }
- },
- onLoad: function() {
- this.setData({
- navH: app.globalData.navHeight
- })
- },
- onShow: function() {
- const _this = this;
- wx.checkSession({
- success(res) {
- app.setUserInfo().then(res => {
- _this.init()
- });
- },
- fail() {
- // session_key 已经失效,需要重新执行登录流程
- console.log('checkfail,')
- }
- })
- },
- getUserInfo: function(e) {
- app.globalData.userInfo = e.detail.userInfo
- this.setData({
- userInfo: e.detail.userInfo,
- hasUserInfo: true
- })
- },
- hrefEq: function(e) {
- app.checkSession().then(res => {
- wx.navigateTo({
- url: '/pages/mine/myeq/myeq'
- })
- });
- },
- hrefAboutus: function(e) {
- wx.navigateTo({
- url: '/pages/mine/aboutus/aboutus'
- })
- },
- hrefAdd: function(e) {
- app.checkSession().then(res => {
- wx.navigateTo({
- url: '/pages/mine/myaddress/myaddress'
- })
- });
- },
- hrefCp: function(e) {
- app.checkSession().then(res => {
- if (app.globalData.userphone == null || app.globalData.userphone == '') {
- app.ifAuthorization();
- } else {
- wx.navigateTo({
- url: '/pages/mine/mycoupon/mycoupon'
- })
- }
- });
- },
- //去授权,不用检测,就是要去那个页面
- hrefAuthPhone: function(e) {
- wx.navigateTo({
- url: '/pages/getphone/getphone?back=mine'
- })
- },
- hrefDc: function(e) {
- wx.navigateTo({
- url: '/pages/mine/mydc/mydc'
- })
- },
- hrefQrcode: function(e) {
- wx.navigateTo({
- url: '/pages/mine/myqrcode/myqrcode?para=' + this.data.wv_qrcode
- })
- },
- hrefOrder: function(e) {
- if (app.globalData.userphone == null || app.globalData.userphone == '') {
- app.ifAuthorization();
- } else {
- app.checkSession().then(res => {
- wx.navigateTo({
- url: '/pages/mine/myorder/myorder'
- })
- });
- }
- },
- review: function() {
- wx.navigateTo({
- url: '/pages/promotion/promotionhref?para=https://tizhi.zhiyi365.com/default.aspx'
- })
- },
- calling: function() {
- wx.makePhoneCall({
- phoneNumber: '400-002-2699',
- success: function() {
- },
- fail: function() {
- }
- })
- },
- tologin() {
- app.checkSession()
- },
- // hrefMyInfo: function() {
- // wx.navigateTo({
- // url: '/pages/mine/myinfo/myinfo?accountnumber=' + this.data.wv_account_number + '&wv_account_name=' + this.data
- // .wv_account_name
- // })
- // },
- selectlife() {
- app.checkSession().then(res => {
- wx.navigateTo({
- url: '/pages/select/select'
- })
- });
- },
- hrefTest () {
- wx.showToast({
- title: '功能正在建设中……',
- icon: 'none',
- duration: 1500
- })
- },
- hrefCall () {
- this.setData({
- mask: true,
- phoneShow: true
- })
- },
- hideAllBox() {
- this.setData({
- //遮罩层隐藏
- mask: false
- })
- },
- callPhone1 () {
- wx.makePhoneCall({
- phoneNumber: '024-25689988'
- })
- },
- callPhone2 () {
- wx.makePhoneCall({
- phoneNumber: '17609810980'
- })
- }
- })
|