| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import {
- imgServerUrl
- } from '../../config/config.js'
- import {
- getCenterInfo,
- getResume
- } from '../../services/index.js'
- import {
- updataStorageData
- } from '../../utils/storage.js'
- import {
- checkPhone
- } from '../../services/wx.js'
- var app = getApp()
- Page({
- data: {
- imgServerUrl: imgServerUrl,
- userInfo: {},
- noPhone:true,
- },
- onShow: function() {
- if (app.globalData.userInfo) {
- console.log('有info===', app.globalData)
- this.setData({
- userInfo: app.globalData.userInfo
- })
- } else if (this.data.canIUse) {
- // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
- // 所以此处加入 callback 以防止这种情况
- app.userInfoReadyCallback = res => {
- console.log('userInfoReadyCallback===', app.globalData)
- this.setData({
- userInfo: app.globalData.userInfo
- })
- }
- } else {
- // 在没有 open-type=getUserInfo 版本的兼容处理
- wx.getUserInfo({
- success: res => {
- app.globalData.userInfo = res.userInfo
- console.log('兼容处理===', app.globalData)
- this.setData({
- userInfo: useapp.globalData.userInforInfo
- })
- }
- })
- }
- this.fetchData();
- this.getUserResume();
- if (this.data.noPhone){
- //检查手机号
- checkPhone({
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }).then(data => {
- console.log("hh")
- })
- }
- },
- //获取用户简历详情
- getUserResume() {
- let paramsObj = {
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- getResume(paramsObj).then(data => {
- if (data.data.userResume) {
- this.setData({
- hpUserResumeId: data.data.userResume.id
- })
- }
- })
- },
- //获取用户认证状态
- fetchData() {
- let paramsObj = {
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- getCenterInfo(paramsObj).then(data => {
- let {
- approveStatus
- } = data.data
- this.setData({
- approveStatus, // 认证状态(0:未认证 1:等待认证 2:未通过 3:已认证) ,
- })
- })
- },
- // 简历
- tojianli() {
- if (this.data.hpUserResumeId) {
- wx.navigateTo({
- url: '../jianli/index?hpUserResumeId=' + this.data.hpUserResumeId,
- })
- } else {
- wx.navigateTo({
- url: '../user-info/user-info',
- })
- }
- },
- //去认证页面
- toAuth() {
- let approveState = this.data.approveStatus
- console.log(approveState)
- if (approveState == 0) {
- //身份认证
- wx.navigateTo({
- url: '../identification/index',
- })
- } else if (approveState == 3) {
- //个人信息页面
- wx.navigateTo({
- url: '../user-form/index',
- })
- } else if (approveState == 2) {
- //认证不通过
- wx.navigateTo({
- url: '../result/index?type=auth&status=0',
- })
- } else if (approveState == 1) {
- //待审核
- wx.navigateTo({
- url: '../result/index?type=auth&status=2',
- })
- }
- },
- })
|