Browse Source

fix: 修改接口路径

210plan
song 3 years ago
parent
commit
75917e50ed
  1. 2
      .env.development
  2. 6
      .env.production
  3. 1
      CHANGELOG.md
  4. 61
      src/apis/tall.js
  5. 4
      src/components/StatisticsCards/StatisticsCards.vue
  6. 134
      src/components/Upload/Upload.vue
  7. 5
      src/pages/detail-webview/detail-webview.vue
  8. 1
      src/pages/task-page/task-page.vue

2
.env.development

@ -1,6 +1,6 @@
VUE_APP_NODE_ENV=development
VUE_APP_BASE_URL=https://test.tall.wiki
VUE_APP_API_URL=https://test.tall.wiki/gateway-1
VUE_APP_API_URL=https://test.tall.wiki/gateway
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws
VUE_APP_PROJECT_PATH=https://test.tall.wiki/carBasicTall
VUE_APP_QUESTION_PATH=https://test.tall.wiki/carbasics

6
.env.production

@ -1,8 +1,8 @@
VUE_APP_NODE_ENV=production
VUE_APP_BASE_URL=https://test.tall.wiki
VUE_APP_API_URL=https://test.tall.wiki/gateway-1
VUE_APP_API_URL=https://test.tall.wiki/gateway
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws
VUE_APP_PROJECT_PATH=https://test.tall.wiki/carBasicTall-1
VUE_APP_QUESTION_PATH=https://test.tall.wiki/carbasics-1
VUE_APP_PROJECT_PATH=https://test.tall.wiki/carBasicTall
VUE_APP_QUESTION_PATH=https://test.tall.wiki/carbasics
VUE_APP_VERSION=v3.1.0
VUE_APP_PUBLIC_PATH=/carBasicCalendar/

1
CHANGELOG.md

@ -4,6 +4,7 @@
范围|描述|commitId
--|--|--
- | 提测试版本 | [b31ecd7](https://101.201.226.163:50022/ZhangBin/Typhoneye/commits/b31ecd7)
- | 修改bug | [0854a84](https://101.201.226.163:50022/ZhangBin/Typhoneye/commits/0854a84)
- | bug修复 | [63940a6](https://101.201.226.163:50022/ZhangBin/Typhoneye/commits/63940a6)

61
src/apis/tall.js

@ -19,66 +19,14 @@ export const login = {
},
};
// 获取手机号
export const bindPhone = {
async index(params) {
try {
/* #endif */
const data = await uni.$u.http.post(`${tall}/users/bindingNoCode`, params);
return data;
} catch (error) {
throw new Error(error);
}
},
};
// 绑定手机号(合并或者替换)
export const bindNowPhone = {
async index(params) {
try {
/* #endif */
const data = await uni.$u.http.post(`${tall}/users/merge`, params);
return data;
} catch (error) {
throw new Error(error);
}
},
};
// 查询首页按钮的名称及跳转
export const getQueryButton = {
async index(params) {
try {
/* #endif */
const data = await uni.$u.http.post(`${carbasics}/questionnaire/queryButton`, params);
return data;
} catch (error) {
return null;
}
},
};
// 查询当前用户是否展示宣传页
export const queryIsShow = {
async index(params) {
try {
/* #endif */
const data = await uni.$u.http.post(`${carbasics}/questionnaire/queryIsShow`, params);
return data;
} catch (error) {
throw new Error(error);
}
},
};
const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {};
// 登录
vm.$u.api.signin = params => login.index(params);
// 绑定手机号无需验证码
vm.$u.api.bindPhone = params => bindPhone.index(params);
vm.$u.api.bindPhone = params => vm.$u.http.post(`${tall}/users/bindingNoCode`, params);
// 手机号已被注册,是否合并
vm.$u.api.bindNowPhone = params => bindNowPhone.index(params);
vm.$u.api.bindNowPhone = params => vm.$u.http.post(`${tall}/users/merge`, params);
// 获取图片验证码
vm.$u.api.getImageCode = () => vm.$u.get(`${tall}/users/code`);
// 获取短信验证码
@ -89,13 +37,12 @@ const install = (Vue, vm) => {
vm.$u.api.phoneBind = (phone, smsCode) => vm.$u.http.post(`${tall}/users/binding`, { phone, smsCode });
// 修改用户信息
vm.$u.api.updateUserInfo = params => vm.$u.http.post(`${tall}/users/userInfo`, params);
// 获取项目列表
vm.$u.api.getProjects = (startTime, endTime) => vm.$u.post(`${tall}/project/query`, { startTime, endTime });
// 查询首页的按钮展示及跳转
vm.$u.api.getQueryButton = params => getQueryButton.index(params);
vm.$u.api.getQueryButton = params => vm.$u.post(`${carbasics}/questionnaire/queryButton`, params);
// 查询当前用户是否展示宣传页按钮
vm.$u.api.queryIsShow = params => queryIsShow.index(params);
vm.$u.api.queryIsShow = params => vm.$u.post(`${carbasics}/questionnaire/queryIsShow`, params);
// 查询日历是否有小红点
vm.$u.api.findRedPoint = (startTime, endTime) => vm.$u.post(`${tall}/project/day`, { startTime, endTime });
// 设置项目顺序

4
src/components/StatisticsCards/StatisticsCards.vue

@ -22,9 +22,9 @@
<view class="rankings" v-if="lists.length">
<view class="bg-white px-2 pb-4">
<view class="box p-4 mb-2" v-for="(list, index) in lists" :key="index">
<view class="sign sign-hign" v-if="list.type === 3">高危</view>
<view class="sign sign-hign" v-if="list.type === 1">高危</view>
<view class="sign sign-middle" v-if="list.type === 2">中危</view>
<view class="sign sign-low" v-if="list.type === 1">低危</view>
<view class="sign sign-low" v-if="list.type === 3">低危</view>
<view class="text-base font-bold">
<span>{{ list.name }}</span>
<span class="ml-4">{{ list.phone }}</span>

134
src/components/Upload/Upload.vue

@ -1,60 +1,71 @@
<template>
<view class="upload">
<!-- <u-icon name="plus" size="24px" class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" @click="handleUpload">
<view>
<view class="upload">
<!-- <u-icon name="plus" size="24px" class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" @click="handleUpload">
</u-icon> -->
<template v-if="user.phone">
<div
v-if="btnList.length === 1"
class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md"
style="line-height: 48px"
@click="jumpV(btnList[0].url)"
>
{{ btnList[0].name }}
</div>
<div v-else-if="btnList.length === 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px">
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)">
{{ btnList[0].name }}
</div>
<div class="flex min-w-16 justify-center" @click="jumpV(btnList[1].url)">{{ btnList[1].name }}</div>
</div>
<div v-else-if="btnList.length > 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px">
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)">
<template v-if="user.phone">
<div
v-if="btnList.length === 1"
class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md"
style="line-height: 48px"
@click="jumpV(btnList[0].url)"
>
{{ btnList[0].name }}
</div>
<div class="flex min-w-16 justify-center" @click="isActive = !isActive">
<div class="mr-1">其他</div>
<u-icon
name="arrow-down"
color="#0284c7"
size="28"
type="down"
:style="{ transform: `rotate(${isActive ? -180 : 0}deg)` }"
@click="isActive = !isActive"
style="transition: transform 0.24s; margin-right: 0px"
/>
<div v-else-if="btnList.length === 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px">
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)">
{{ btnList[0].name }}
</div>
<div class="flex min-w-16 justify-center" @click="jumpV(btnList[1].url)">{{ btnList[1].name }}</div>
</div>
</div>
</template>
<u-button
v-else
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
:custom-style="customStyle"
shape="square"
size="default"
type="primary"
>
授权
</u-button>
<view :style="{ height: isActive ? '200px' : 0 }" style="transition: all 0.24s" class="role-more-box">
<template v-for="(item, index) in btnList">
<div :class="index === btnList.length - 1 ? '' : 'border-bottom'" class="jump-list-box" v-if="index !== 0" :key="item.url">
{{ item.name }}
<div v-else-if="btnList.length > 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px">
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)">
{{ btnList[0].name }}
</div>
<div class="flex min-w-16 justify-center" @click="isActive = !isActive">
<div class="mr-1">其他</div>
<u-icon
name="arrow-down"
color="#0284c7"
size="28"
type="down"
:style="{ transform: `rotate(${isActive ? -180 : 0}deg)` }"
@click="isActive = !isActive"
style="transition: transform 0.24s; margin-right: 0px"
/>
</div>
</div>
</template>
<u-button
v-else
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
:custom-style="customStyle"
shape="square"
size="default"
type="primary"
>
授权
</u-button>
<view :style="{ height: isActive ? '200px' : 0 }" style="transition: all 0.24s" class="role-more-box">
<template v-for="(item, index) in btnList">
<div :class="index === btnList.length - 1 ? '' : 'border-bottom'" class="jump-list-box" v-if="index !== 0" :key="item.url">
{{ item.name }}
</div>
</template>
</view>
<!-- <u-button @click="jump" size="default" type="primary"> 拍照 </u-button> -->
<u-top-tips ref="uTips"></u-top-tips>
</view>
<!-- <u-button @click="jump" size="default" type="primary"> 拍照 </u-button> -->
<u-top-tips ref="uTips"></u-top-tips>
<u-modal
v-model="showPhoneModal"
:content="content"
show-cancel-button
cancel-text="不合并"
confirm-text="合并"
@confirm="bindNowPhone(0)"
@cancel="bindNowPhone(1)"
></u-modal>
</view>
</template>
@ -76,6 +87,9 @@ export default {
},
btnList: [],
isActive: false,
showPhoneModal: false,
content: '当前手机号已被注册,是否合并信息',
phone: '',
};
},
computed: {
@ -113,14 +127,33 @@ export default {
}
}
} catch (error) {
console.error('error: ', error);
console.error('error授权失败: ', error);
this.$refs.uTips.show({
title: '授权失败',
type: 'success',
duration: '3000',
});
if (error.code === 75) {
console.log('data.phone', error.data.phone);
// this.$emit('showModal', error.data.phone);
this.phone = error.data.phone;
this.showPhoneModal = true;
}
}
},
// isMerge:0 , 1
async bindNowPhone(num) {
const params = {
phone: this.phone,
isMerge: num,
};
const data = await this.$u.api.bindNowPhone(params);
this.setUser(data);
this.setToken(data.token);
this.show = false;
},
// wbs
async handleUpload() {
try {
@ -182,6 +215,7 @@ export default {
transform: translate3d(0, 50%, 0);
color: $uni-color-primary !important;
}
.role-more-box {
box-shadow: 0 6px 6px rgba(0, 0, 0, 0.15);
overflow: hidden;

5
src/pages/detail-webview/detail-webview.vue

@ -3,11 +3,15 @@
</template>
<script>
import { mapGetters } from 'vuex';
export default {
data() {
return { src: '' };
},
computed: mapGetters('user', ['userId']),
onLoad(options) {
const obj = { title: '暴风眼Typhoneye', path: '/pages/index/index' };
uni.showShareMenu(obj);
@ -37,6 +41,7 @@ export default {
console.log('接收到的消息:' + JSON.stringify(evt.detail.data));
if (evt.detail.data[0].action === 'back') {
uni.navigateBack();
uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}
},
},

1
src/pages/task-page/task-page.vue

@ -87,7 +87,6 @@ export default {
},
showPage(val) {
console.log('val: ', val);
if (val !== 'function' && val !== 'share' && val !== 'statistics-lists' && val !== 'statistics-cards') {
let url = `/pages/detail-webview/detail-webview?jumpUrl=`;
let jumpUrl = `${url}${this.urlData.url}&projectId=${this.projectId}&roleId=${this.roleId}&userId=${this.userId}`;

Loading…
Cancel
Save