配置全局变量
This commit is contained in:
@@ -7,6 +7,9 @@ App({
|
||||
const logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
wx.removeStorage({
|
||||
key: 'avatarUrl',
|
||||
})
|
||||
// 长时间不操作导致token失效之后执行自动微信登录操作
|
||||
wx.getStorage({
|
||||
key: 'rsaPublicKey',
|
||||
|
||||
+4
-2
@@ -1,3 +1,5 @@
|
||||
import {appId, secret} from '../js/project.config'
|
||||
console.log(appId)
|
||||
export function wxBind(callback){
|
||||
// 获取openid进行手机号和微信的绑定
|
||||
let count = 1
|
||||
@@ -7,8 +9,8 @@ export function wxBind(callback){
|
||||
wx.request({
|
||||
url: 'https://api.weixin.qq.com/sns/jscode2session',
|
||||
data: {
|
||||
appid: 'wx457dfcb58fd556ea',
|
||||
secret: 'e8d2ee25e32c77561efccb7145ba9dc8',
|
||||
appid: appId,
|
||||
secret: secret,
|
||||
js_code: res.code,
|
||||
grant_type: 'authorization_code'
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import http from './http.js'
|
||||
let baseUrl = http.baseUrl
|
||||
let URL_CONFIG = http.URL_CONFIG
|
||||
import { baseUrl, URL_CONFIG } from '../project.config'
|
||||
|
||||
/* 配置路径 */
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ let apiUrl = {
|
||||
}
|
||||
|
||||
export default {
|
||||
baseUrl,
|
||||
URL_CONFIG,
|
||||
//微信账号密码登陆--1
|
||||
wxLoginByUserName(option, success, error) {
|
||||
http.post1(baseUrl + apiUrl.wxLoginByUserName, option).then(res => {
|
||||
@@ -39,8 +37,3 @@ export default {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export{
|
||||
baseUrl,
|
||||
URL_CONFIG
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
import { baseUrl } from '../project.config'
|
||||
let headerDefault = {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
@@ -6,8 +6,6 @@ let headerDefault1 = {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
let TokenKey = 'X-Access-Token'
|
||||
let baseUrl = 'http://bxxt.hzwlsoft.com:1015'
|
||||
let URL_CONFIG = '/jero-boot/'
|
||||
|
||||
const http = (method, url, data, header= headerDefault) => {
|
||||
let Authorization = wx.getStorageSync(TokenKey) ? wx.getStorageSync(TokenKey) : '';
|
||||
@@ -39,8 +37,6 @@ const http = (method, url, data, header= headerDefault) => {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
baseUrl,
|
||||
URL_CONFIG,
|
||||
get: (url, data, header) => http('GET', url, data, header),
|
||||
post: (url, data, header) => http('POST', url, data, header),
|
||||
post1: (url, data, header) => http('POST', url, data, headerDefault1),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import MeetingApi from '../js/http/meetingApi'
|
||||
import { baseUrl } from '../../assets/js/http/api'
|
||||
import { baseUrl } from '../js/project.config'
|
||||
/**
|
||||
* 预览文件的方法
|
||||
* @param fileId 文件id
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
export const appId = 'wx322b63d1e6ff4765'
|
||||
export const secret = 'a3e81ffa80aa5f04d0b104b2ccda7f32'
|
||||
|
||||
export let baseUrl = 'http://bxxt.hzwlsoft.com:1015' // 外网环境
|
||||
// export let baseUrl = 'http://10.10.10.46:8055/' // 测试环境
|
||||
// export const baseUrl = 'http://10.0.1.9:8080' // 本地环境
|
||||
export const URL_CONFIG = '/jero-boot/'
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
// components/imageUpload/imageUpload.js
|
||||
|
||||
import {
|
||||
baseUrl,
|
||||
URL_CONFIG
|
||||
} from "../../assets/js/http/api"
|
||||
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config'
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
|
||||
+9
-9
@@ -49,15 +49,15 @@ Page({
|
||||
const reg = new RegExp("<p>","g")
|
||||
const reg1 = new RegExp("</p>","g")
|
||||
if(res.result.records && res.result.records.length){
|
||||
res.result.records.forEach(item=>{
|
||||
item.msgContent = item.msgContent.replace(reg,"")
|
||||
item.msgContent = item.msgContent.replace(reg1,"")
|
||||
const startIndex = item.msgContent.indexOf("<a")
|
||||
const endIndex = item.msgContent.lastIndexOf("</a>")
|
||||
if(startIndex > -1 && endIndex > -1 ){
|
||||
item.msgContent = item.msgContent.substring(0, startIndex) + item.msgContent.slice(endIndex + 4) + '点击报名'
|
||||
}
|
||||
})
|
||||
// res.result.records.forEach(item=>{
|
||||
// item.msgContent = item.msgContent.replace(reg,"")
|
||||
// item.msgContent = item.msgContent.replace(reg1,"")
|
||||
// const startIndex = item.msgContent.indexOf("<a")
|
||||
// const endIndex = item.msgContent.lastIndexOf("</a>")
|
||||
// if(startIndex > -1 && endIndex > -1 ){
|
||||
// item.msgContent = item.msgContent.substring(0, startIndex) + item.msgContent.slice(endIndex + 4) + '点击报名'
|
||||
// }
|
||||
// })
|
||||
this.setData({
|
||||
list: [...this.data.list, ...res.result.records]
|
||||
})
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</view>
|
||||
<text class="content-time">{{item.sendTime}}</text>
|
||||
</view>
|
||||
<text class="content-bottom">{{item.msgContent}}</text>
|
||||
<rich-text class="content-bottom" nodes="{{item.msgContent}}"></rich-text>
|
||||
<text class="status" wx:if="{{item.readFlag == 0}}"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
<text bindtap="updateInfo">忘记密码?</text>
|
||||
</view>
|
||||
<text class="other-way">或用以下方式登录</text>
|
||||
<view class="weixin">
|
||||
<image src="../../assets/images/wx.png" bindtap="wxLogin"></image>
|
||||
<view class="weixin" bindtap="wxLogin">
|
||||
<image src="../../assets/images/wx.png"></image>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
|
||||
@@ -7,10 +7,7 @@ import {
|
||||
import MeetingApi from '../../assets/js/http/meetingApi'
|
||||
import signUpApi from '../../assets/js/http/signUp'
|
||||
import UserApi from '../../assets/js/http/userApi'
|
||||
import {
|
||||
baseUrl,
|
||||
URL_CONFIG
|
||||
} from '../../assets/js/http/api'
|
||||
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
||||
Page({
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -166,7 +166,7 @@ Page({
|
||||
*/
|
||||
onShow: function () {
|
||||
let userInfo = wx.getStorageSync('userInfo')
|
||||
let userInfoTemp = wx.getStorageSync('userInfoTemp')
|
||||
let avatarUrl = wx.getStorageSync('avatarUrl')
|
||||
let token = wx.getStorageSync('X-Access-Token')
|
||||
this.setData({
|
||||
token
|
||||
@@ -177,7 +177,7 @@ Page({
|
||||
phone: userInfo.phone.substr(0, 3) + '-' + userInfo.phone.substr(3, 4) + '-' + userInfo.phone.substr(7, 4)
|
||||
})
|
||||
}
|
||||
if (userInfoTemp) {
|
||||
if (avatarUrl) {
|
||||
this.setData({
|
||||
avatarUrl: userInfoTemp.avatarUrl
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import UserApi from '../../assets/js/http/userApi'
|
||||
import { baseUrl, URL_CONFIG } from '../../assets/js/http/api'
|
||||
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
||||
Page({
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,10 +5,7 @@ import {
|
||||
previewFile,
|
||||
getFileInfo
|
||||
} from '../../assets/js/preview'
|
||||
import {
|
||||
baseUrl,
|
||||
URL_CONFIG
|
||||
} from '../../assets/js/http/api'
|
||||
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
||||
|
||||
Page({
|
||||
|
||||
|
||||
@@ -5,10 +5,7 @@ import {
|
||||
phoneReg,
|
||||
postcode
|
||||
} from '../../utils/validate'
|
||||
import {
|
||||
baseUrl,
|
||||
URL_CONFIG
|
||||
} from '../../assets/js/http/api'
|
||||
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
||||
Page({
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1. assets/js/project.config.js 为全局的配置文件
|
||||
Reference in New Issue
Block a user