5beac84c by 华明祺

no message

1 parent 21da2d2a
Showing 218 changed files with 189 additions and 84 deletions
......@@ -10,9 +10,6 @@ function checkReport() {
}
function getVenue() {
return request({
url: `/systemj/venue/appId`,
......@@ -21,8 +18,6 @@ function getVenue() {
}
function getSiteList(projectId) {
return request({
url: `/systemj/site/getSiteList/${projectId}`,
......@@ -99,6 +94,7 @@ function getMyBalance() {
method: 'get'
})
}
function listCanUse() {
return request({
url: `/systemj/projectConfig/listCanUse`,
......@@ -144,6 +140,7 @@ function xfList(params) {
params: params
})
}
function czList(params) {
return request({
url: `/systemj/memberOrder/maList/recharge`,
......@@ -167,7 +164,8 @@ function getCaptchaSms(params) {
params: params
})
}
function maRebindMemberCard(phonenumber,code) {
function maRebindMemberCard(phonenumber, code) {
const nowOpenId = uni.getStorageSync('nowOpenId');
return request({
url: `/systemj/member/maRebindMemberCard/${phonenumber}/${code}?openId=${nowOpenId}`,
......@@ -182,7 +180,7 @@ function getCancelHint(orderId) {
})
}
//充值提示
function getMemberLevelTip(phonenumber,amount) {
function getMemberLevelTip(phonenumber, amount) {
return request({
url: `/systemj/member/generateMyMemberLevelRemian/${phonenumber}/${amount}`,
method: 'get'
......@@ -215,6 +213,7 @@ function miniappData(params) {
export {checkReport,
export {
checkReport,
getVenue
}
\ No newline at end of file
......
......@@ -49,7 +49,7 @@ function pcLoginByOpenId(openId) {
let user = res.data;
// console.log("openId " + openId, user)
uni.setStorageSync('token', 'Bearer ' + user.token);
uni.setStorageSync('token', user.token);
uni.setStorageSync('currUser', user);
return user;
}).catch(() => {
......@@ -70,7 +70,7 @@ function pcLoginByCode(code) {
let user = res.data
// console.log("code: " + code, user)
// getNowOpenId()
uni.setStorageSync('token', 'Bearer ' + user.token);
uni.setStorageSync('token', user.token);
uni.setStorageSync('currUser', user);
return user;
}).catch((err) => {
......@@ -188,7 +188,7 @@ function h5Login(userName) {
username: userName
}
}).then((res) => {
uni.setStorageSync('token', 'Bearer ' + res.data.token);
uni.setStorageSync('token', res.data.token);
})
}
......
......@@ -25,21 +25,19 @@ function getToken() {
// 获取请求头
function getHeaders() {
const token = getToken()
const header = {
"Authorization": token,
"Content-Type": "application/json",
}
return header
}
function getHeaders2() {
const token = getToken()
const header = {
let header
if (config.localPort) {
header = {
"isToken": false,
"Authorization": token,
'content-type': 'application/x-www-form-urlencoded'
}
} else {
header = {
"Authorization": getToken(),
"Content-Type": "application/json",
}
}
return header
}
......@@ -60,40 +58,68 @@ let request = function(req) {
// })
// }
const baseUrl = config.localPort + '/jsintszxd/request'
const token = getToken()
let tempUrl = req.url
// if (token) {
if (tempUrl.indexOf('?') > -1) {
tempUrl += '&userNo=' + token
} else {
tempUrl += '?userNo=' + token
}
// }
let url, data
if (config.localPort) {
const baseUrl = config.localPort + '/jsintszxd/request'
if (req.method === 'POST') {
url = baseUrl
data = {
appSecretId: config.appSecretId,
restApi: req.url,
restApi: encodeURIComponent(tempUrl),
params: 'jsonBody=' + JSON.stringify(req.params)
}
} else {
url = `${baseUrl}?appSecretId=${config.appSecretId}&restApi=${encodeURIComponent(req.url)}`
if (req.params) {
for (const key of Object.keys(req.params)) {
if (tempUrl.indexOf('?') > -1) {
tempUrl += `&${key}=${req.params[key]}`
} else {
tempUrl += `?${key}=${req.params[key]}`
}
}
}
url = `${baseUrl}?appSecretId=${config.appSecretId}&restApi=${encodeURIComponent(tempUrl)}`
}
} else {
url = config.baseUrl_api + tempUrl
data = req.params
}
return new Promise((resolve, reject) => {
uni.request({
// url: config.baseUrl_api + req.url,
url: url,
method: req.method,
// data: req.params,
// header: getHeaders(),
data: data,
header: getHeaders2()
header: getHeaders()
}).then(res => {
switch (res.statusCode) {
case 200:
// const data = res.data || {};
const data = res.data.data || {};
if (data.code == 200) {
resolve(data)
let tempRes
if (config.localPort) {
tempRes = res.data
} else {
tempRes = res
}
const resData = tempRes.data || {};
if (resData.code == 200) {
resolve(resData)
} else {
//登录超时
if (data.code == 60002 || data.code == 60001) {
if (resData.code == 60002 || resData.code == 60001) {
showLogin()
} else if (data.code == 401) {
} else if (resData.code == 401) {
h5LoginAuto()
.then(() => {
uni.hideLoading();
......@@ -105,17 +131,17 @@ let request = function(req) {
} else {
if (!excludeUrls.includes(req.url)) {
uni.showToast({
title: data.msg,
title: resData.msg,
icon: 'none',
duration: 3000
})
}
}
reject(res)
reject(tempRes)
}
break
default:
reject(res)
reject(tempRes)
}
}).catch(res => {
reject(res)
......@@ -134,7 +160,7 @@ function reLogin() {
pcLoginByOpenId(accountInfo.miniProgram.appId, currUser.openId)
.then((res) => {
let user = res.data;
uni.setStorageSync('token', 'Bearer ' + user.token);
uni.setStorageSync('token', user.token);
uni.setStorageSync('currUser', user);
uni.showToast({
......
// prod
// const baseUrl_api = 'https://research.wtwuxicenter.com/';
// staging
const baseUrl_api = "http://192.168.1.118:6688";
// const baseUrl_api = "http://123.60.96.243:6688";
// const baseUrl_api = "http://121.4.115.48:27001/jsintszxd/request";
const baseUrl_api = "/dev-api";
const appSecretId = 'af14ef3f-ebec-446c-8d1f-c4afa60dd095';
const localPort = localStorage.getItem('localPort')
......
<template>
<view class="pb50">
<view style="padding:0 30rpx;">
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#15CFAB"></uni-segmented-control>
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
activeColor="#15CFAB"></uni-segmented-control>
</view>
<view>
<view class="active" v-for="(item, index) in showList" :key="index" @click="goDetail(item)">
......@@ -13,7 +14,9 @@
<view class="name">{{item.name}}</view>
<view class="pp" style="display: flex;">报到时间:{{item.reportDate.substring(0, 10)}}</view>
<view class="pp" style="display: flex;">培训时间:{{item.trainStart.substring(0, 10)}}{{item.trainEnd.substring(0, 10)}}</view>
<view class="pp" style="display: flex;">培训时间:{{item.trainStart.substring(0, 10)}}
{{item.trainEnd.substring(0, 10)}}
</view>
<!-- <view class="pp" style="display: flex;">主办单位:{{item.organizer}}</view> -->
<!-- <view class="pp" style="display: flex;">承办单位:{{item.manager}}</view> -->
<!-- <view class="pp" style="display: flex;">培训地点:{{item.address}}</view> -->
......@@ -28,25 +31,43 @@
</template>
<script setup>
import { reactive, toRefs, getCurrentInstance } from 'vue';
import {
reactive,
toRefs,
getCurrentInstance
} from 'vue';
import * as hotel from '@/common/hotel.js';
import {onShow,onPullDownRefresh} from '@dcloudio/uni-app';
import {
onShow,
onPullDownRefresh
} from '@dcloudio/uni-app';
const app = getApp();
import config from '@/config';
const { proxy } = getCurrentInstance();
const {
proxy
} = getCurrentInstance();
const data = reactive({
showList: [],
list: [],
list0: [],
list1: [],
query: {},
autoplay:true,
autoplay: true,
items: ['全部', '进行中', '已过期'],
current: 1
});
const { showList,list,list0,list1,query,autoplay,items,current } = toRefs(data);
const {
showList,
list,
list0,
list1,
query,
autoplay,
items,
current
} = toRefs(data);
onShow(option =>{
onShow(option => {
if (app.globalData.isLogin) {
getList();
} else {
......@@ -58,36 +79,40 @@
onPullDownRefresh(() => {
getList();
});
function getList(){
function getList() {
list0.value = []
list1.value = []
hotel.getTrainList().then(res => {
list.value = res.rows
for(var n of list.value){
if(n.status == 0){
for (var n of list.value) {
if (n.status == 0) {
list0.value.push(n)
}
if(n.status == 1){
if (n.status == 1) {
list1.value.push(n)
}
}
getShowList(current.value)
});
}
function goDetail(item){
function goDetail(item) {
let path = `/pages_hotel/hotel/detail?id=${item.trainId}&isApply=${item.isApply}`;
uni.navigateTo({
url: path
});
}
function onClickItem(e){
if(current.value != e.currentIndex){
function onClickItem(e) {
if (current.value != e.currentIndex) {
current.value = e.currentIndex
}
getShowList(e.currentIndex)
}
function getShowList(n){
switch (n){
function getShowList(n) {
switch (n) {
case 0:
showList.value = list.value
break;
......@@ -102,22 +127,72 @@
</script>
<style lang="scss" scoped>
.iconSquera{width: 40rpx;height: 40rpx;}
.topSearch{ display: flex; align-items: center;background: #fff;}
.active{background:#fff;width: 700rpx;margin:30rpx auto 30rpx;box-shadow: 0rpx 0rpx 27rpx 0rpx #DEDEDE;
border-radius:20rpx 20rpx;position: relative;padding: 0 0 30rpx;
.cover{width: 700rpx;height: 320rpx;}
.name{font-size: 32rpx;padding:10rpx 15rpx 0;
color: #000000;}
.pp{padding:0 15rpx;margin: 6rpx 0;
color: #595959;
font-size: 28rpx;}
.btn1{position: absolute; right: 0rpx; bottom: 30rpx; width: 150rpx;
line-height: 30px; height: 60rpx; font-size: 28rpx;padding: 0;}
}
.activeSwiper{height: 320rpx;}
.myEnter{position: fixed;right: 0;bottom: 10%;
image{width: 150rpx;height: 150rpx;}
}
.pb50{padding-bottom: 50rpx;}
.iconSquera {
width: 40rpx;
height: 40rpx;
}
.topSearch {
display: flex;
align-items: center;
background: #fff;
}
.active {
background: #fff;
width: 700rpx;
margin: 30rpx auto 30rpx;
box-shadow: 0rpx 0rpx 27rpx 0rpx #DEDEDE;
border-radius: 20rpx 20rpx;
position: relative;
padding: 0 0 30rpx;
.cover {
width: 700rpx;
height: 320rpx;
}
.name {
font-size: 32rpx;
padding: 10rpx 15rpx 0;
color: #000000;
}
.pp {
padding: 0 15rpx;
margin: 6rpx 0;
color: #595959;
font-size: 28rpx;
}
.btn1 {
position: absolute;
right: 0rpx;
bottom: 30rpx;
width: 150rpx;
line-height: 30px;
height: 60rpx;
font-size: 28rpx;
padding: 0;
}
}
.activeSwiper {
height: 320rpx;
}
.myEnter {
position: fixed;
right: 0;
bottom: 10%;
image {
width: 150rpx;
height: 150rpx;
}
}
.pb50 {
padding-bottom: 50rpx;
}
</style>
\ No newline at end of file
......
......@@ -11,5 +11,17 @@ export default defineConfig({
targets: ['defaults', 'not IE 11'],
}),
],
// base: '/train/'
// base: '/train/',
server: {
port: 5173,
host: true,
open: true,
proxy: {
'/dev-api': {
target: 'http://192.168.43.161:6688',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
}
}
},
})
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!