| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- var netUtil = require('network.js')
- var baseUrl = require('wxconstant.js').BaseUrl()
- //判断是否进行注册
- function judgeisReg(openid){
- var url = baseUrl + 'loan/enterprise/getEnterpriseDO'
- var data = {
- openid: openid
- }
- netUtil.requestLoading(url, data, '正在请求...', 'POST', function (res) {
- if (res.data.data) {
- var isFinancing = res.data.data.isFinancing
- var isRegistered = res.data.data.isRegistered
- if (isRegistered == false){
- wx.showModal({
- title: '提示',
- content: '您当前尚未进行注册认证,是否立即前去认证',
- success:function(res){
- console.log(res)
- if (res.confirm == true && res.cancel == false){
- wx.navigateTo({
- url: '../registered/registered',
- })
- }
- }
- })
- }
- try {
- wx.setStorageSync('isFinancing', isFinancing)
- wx.setStorageSync('isRegistered', isRegistered)
- } catch (e) {
- }
- }
- }, function (res) {
- wx.showToast({
- title: '数据获取失败',
- icon: 'none',
- duration: 2000
- })
- })
- }
- //公用获取openid方法
- function getComOpenid(){
- var openid
- wx.login({
- success: function (res) {
- var url = baseUrl + 'usr/getOpenid'
- if (res.code) {
- var data = {
- code: res.code
- }
- netUtil.requestLoading(url, data, '正在请求...', 'GET', function (res) {
- if (res.data) {
- if (res.data.data.openid) {
- wx.setStorageSync('openid', res.data.data.openid)
- openid = res.data.data.openid
- }
- }
- }, function (res) {
- wx.showToast({
- title: '数据获取失败',
- icon: 'none',
- duration: 2000
- })
- })
- }
- }
- })
- return openid
- }
- module.exports = {
- judgeisReg: judgeisReg,
- getComOpenid: getComOpenid
- }
|