Commit af1fd72c authored by 石盼盼's avatar 石盼盼

接口对接

parent ff9d7ae0
{ {
"name": "fhxm", "name": "repair",
"version": "0.1.0", "version": "0.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
......
{ {
"name": "fhxm", "name": "repair",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
......
<template> <template>
<div id="app"> <div id="app">
<keep-alive> <keep-alive v-if="$route.meta.keepAlive">
<router-view /> <router-view />
</keep-alive> </keep-alive>
<router-view v-else />
<div class="goBack-btn flex-h flex-hc flex-align-center" v-if="!$route.meta.hideBack" > <div class="goBack-btn flex-h flex-hc flex-align-center" v-if="!$route.meta.hideBack" >
<i class="iconfont icon-icon_fanhuishouye" @click="gohome"></i> <i class="iconfont icon-icon_fanhuishouye" @click="gohome"></i>
</div> </div>
......
...@@ -8,10 +8,10 @@ const baseUrl = '/api' ...@@ -8,10 +8,10 @@ const baseUrl = '/api'
// } // }
// todo: url // todo: url
// const httpUrl = 'https://fhxmtest.xueyoubangedu.com' // 测试接口 const httpUrl = 'https://repairtest.zeruiedu.com' // 测试接口
// const h5Url = 'http://fhxmtest.h5.xueyoubangedu.com' // 测试h5线上地址 const h5Url = 'https://repair.zeruiedu.com' // 测试h5线上地址
const httpUrl = 'https://fenghexm.xueyoubangedu.com' // 正式接口 // const httpUrl = 'https://fenghexm.xueyoubangedu.com' // 正式接口
const h5Url = 'http://depository.fhxmcy.com' // 正式h5线上地址 // const h5Url = 'http://depository.fhxmcy.com' // 正式h5线上地址
export default { export default {
// url地址 // url地址
...@@ -21,11 +21,18 @@ export default { ...@@ -21,11 +21,18 @@ export default {
WINDOWHREF_ASK: `${httpUrl}/api/scm/login?callBack=${h5Url}&scopes=snsapi_userinfo&type=1`, WINDOWHREF_ASK: `${httpUrl}/api/scm/login?callBack=${h5Url}&scopes=snsapi_userinfo&type=1`,
// 登录相关 // 登录相关
SENDCODE: baseUrl + '/scm/send', // 发送验证码 SENDCODE: baseUrl + '/worker/send', // 发送验证码
BINDLOGIN: baseUrl + '/scm/bind/login', // 绑定后台账号 BINDLOGIN: baseUrl + '/worker/bind/login', // 手机号验证码登录绑定微信
BINDLOGINTWO: baseUrl + '/scm/bind/login/two', // 绑定后台账号 USERINFO: baseUrl + '/worker/user/info', // 获取用户信息
REFRESHTOKEN: baseUrl + '/scm/change/token', // 更新token REPAIR_LIST: baseUrl + '/worker/repair/list', // 工人/审核员端报修单列表
LOGOUT: baseUrl + '/scm/logout', // 更新token ORDER_STATUS: baseUrl + '/worker/repair/order/status', // 获取订单状态
REPAIR_BEGIN: baseUrl + '/worker/repair/begin', // 开始维修接口
REPAIR_ORDER_DETAIL: baseUrl + '/worker/repair/order/detail', // 报修单详情
REPAIR_ORDER: baseUrl + '/worker/material/order', // 发起收费生成耗材单
MATERIAL_REMARK: baseUrl + '/worker/material/remark', // 备注耗材
// BINDLOGINTWO: baseUrl + '/scm/bind/login/two', // 绑定后台账号
// REFRESHTOKEN: baseUrl + '/scm/change/token', // 更新token
// LOGOUT: baseUrl + '/scm/logout', // 更新token
// 首页 // 首页
WARNGOODS: baseUrl + '/scm/warn_goods/today', // 今日预警 WARNGOODS: baseUrl + '/scm/warn_goods/today', // 今日预警
......
...@@ -34,34 +34,35 @@ service.interceptors.request.use( ...@@ -34,34 +34,35 @@ service.interceptors.request.use(
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
const { data, config } = response const { data, config } = response
return data
// console.log('添加响应拦截器', response) // console.log('添加响应拦截器', response)
if (data.code === 400) { // if (data.code === 400) {
console.log('===== token过期 =====') // console.log('===== token过期 =====')
const promisefresh = new Promise(function (resolve, reject) { // const promisefresh = new Promise(function (resolve, reject) {
updateToken(() => { // updateToken(() => {
config.headers.token = window.localStorage.getItem('token') // config.headers.token = window.localStorage.getItem('token')
axios.request(response.config).then(res => { // axios.request(response.config).then(res => {
const curData = res.data // const curData = res.data
if (curData.code === 200) { // if (curData.code === 200) {
resolve(curData) // resolve(curData)
} else { // } else {
// window.localStorage.removeItem('token') // // window.localStorage.removeItem('token')
// window.localStorage.removeItem('status') // // window.localStorage.removeItem('status')
resolve(curData) // resolve(curData)
} // }
}) // })
}, (err) => { // }, (err) => {
resolve(err) // resolve(err)
window.localStorage.clear() // window.localStorage.clear()
Toast('身份失效,请重新登录') // Toast('身份失效,请重新登录')
window.document.location = selfApi.WINDOWHREF_LOGIN // url- // window.document.location = selfApi.WINDOWHREF_LOGIN // url-
console.log('错误--------', err) // console.log('错误--------', err)
}) // })
}) // })
return promisefresh // return promisefresh
} else { // } else {
return data // return data
} // }
}, },
error => { error => {
let info = {} let info = {}
......
...@@ -22,7 +22,7 @@ export function updateToken (cb, errcb) { ...@@ -22,7 +22,7 @@ export function updateToken (cb, errcb) {
typeof cb === 'function' && cb() typeof cb === 'function' && cb()
} else { } else {
console.log('token换取失败-------', curdata) console.log('token换取失败-------', curdata)
typeof errcb === 'function' && errcb(curdata) // typeof errcb === 'function' && errcb(curdata)
} }
} }
}) })
......
import axios from './axios' import axios from './axios'
import { Toast, Dialog } from 'vant' import {
Toast,
Dialog
} from 'vant'
import router from '../router/index' import router from '../router/index'
import selfApi from '@/api/apiList' import selfApi from '@/api/apiList'
const instance = axios() const instance = axios()
export default { export default {
get (url, params, headers, toast = true) { get(url, params, headers, toast = true) {
const options = {} const options = {}
options.headers = { options.headers = {
token: window.localStorage.getItem('token'), // token: window.localStorage.getItem('token'),
type: 1 token: 'sys'
// type: 1
} }
if (params) { if (params) {
...@@ -19,7 +23,10 @@ export default { ...@@ -19,7 +23,10 @@ export default {
} }
if (headers) { if (headers) {
options.headers = { ...options.headers, ...headers } options.headers = {
...options.headers,
...headers
}
} }
Toast.allowMultiple() Toast.allowMultiple()
let tipsToast = '' let tipsToast = ''
...@@ -33,7 +40,11 @@ export default { ...@@ -33,7 +40,11 @@ export default {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
instance.get(url, options).then(res => { instance.get(url, options).then(res => {
const { code, data, message } = res const {
data,
message
} = res
const code = res.meta.code
// console.log(code, typeof code, '11111111111111') // console.log(code, typeof code, '11111111111111')
toast && tipsToast.clear() toast && tipsToast.clear()
if (code === 200) { if (code === 200) {
...@@ -53,19 +64,23 @@ export default { ...@@ -53,19 +64,23 @@ export default {
}) })
}, },
post (url, data, headers, params, toast = true) { post(url, data, headers, params, toast = true) {
const options = {} const options = {}
options.headers = { options.headers = {
token: window.localStorage.getItem('token'), // token: window.localStorage.getItem('token'),
type: 1 token: 'sys'
// type: 1
} }
if (params) { if (params) {
options.params = params options.params = params
} }
if (headers) { if (headers) {
options.headers = { ...options.headers, ...headers } options.headers = {
...options.headers,
...headers
}
} }
Toast.allowMultiple() Toast.allowMultiple()
let tipsToast = '' let tipsToast = ''
...@@ -79,7 +94,11 @@ export default { ...@@ -79,7 +94,11 @@ export default {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
instance.post(url, data, options).then(res => { instance.post(url, data, options).then(res => {
const { code, data, message } = res const {
data,
message
} = res
const code = res.meta.code
toast && tipsToast.clear() toast && tipsToast.clear()
if (code === 200) { if (code === 200) {
resolve(data) resolve(data)
...@@ -98,15 +117,22 @@ export default { ...@@ -98,15 +117,22 @@ export default {
}) })
}, },
put (url, params, headers) { put(url, params, headers) {
const options = {} const options = {}
if (headers) { if (headers) {
options.headers = { ...options.headers, ...headers } options.headers = {
...options.headers,
...headers
}
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
instance.put(url, params, options).then(res => { instance.put(url, params, options).then(res => {
const { code, data, message } = res const {
code,
data,
message
} = res
if (code === 200) { if (code === 200) {
resolve(data) resolve(data)
} else if (code !== 400) { } else if (code !== 400) {
...@@ -119,14 +145,17 @@ export default { ...@@ -119,14 +145,17 @@ export default {
}) })
}, },
delete (url, params, headers) { delete(url, params, headers) {
const options = {} const options = {}
if (params) { if (params) {
options.params = params options.params = params
} }
if (headers) { if (headers) {
options.headers = { ...options.headers, ...headers } options.headers = {
...options.headers,
...headers
}
} }
return instance.delete(url, options) return instance.delete(url, options)
} }
......
...@@ -7,7 +7,7 @@ import myApi from './api/apiList' ...@@ -7,7 +7,7 @@ import myApi from './api/apiList'
import myAxios from './api/index' import myAxios from './api/index'
import Vant from 'vant' import Vant from 'vant'
import 'vant/lib/index.css' import 'vant/lib/index.css'
// import vConsole from '@/plugins/vconsole.js' import vConsole from '@/plugins/vconsole.js'
import myCondition from '@/components/common/condition.vue' import myCondition from '@/components/common/condition.vue'
import listTips from '@/components/common/listtips.vue' import listTips from '@/components/common/listtips.vue'
// Vue.component('chooseDate', chooseDate) // Vue.component('chooseDate', chooseDate)
...@@ -15,7 +15,7 @@ import listTips from '@/components/common/listtips.vue' ...@@ -15,7 +15,7 @@ import listTips from '@/components/common/listtips.vue'
// import chooseDate from '@/components/common/chooseDate.vue' // import chooseDate from '@/components/common/chooseDate.vue'
Vue.component('myCondition', myCondition) Vue.component('myCondition', myCondition)
Vue.component('listTips', listTips) Vue.component('listTips', listTips)
// Vue.use(vConsole) Vue.use(vConsole)
Vue.config.productionTip = false Vue.config.productionTip = false
......
...@@ -5,88 +5,94 @@ import Home from '../views/tabbar/Home.vue' ...@@ -5,88 +5,94 @@ import Home from '../views/tabbar/Home.vue'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [{ const routes = [
path: '/', {
name: 'home', path: '/home',
meta: { name: 'home',
title: '首页', meta: {
hideBack: true title: '工单',
hideBack: true,
keepAlive: true
},
component: Home
}, },
component: Home {
}, path: '/',
{ redirect: '/login'
path: '/my',
name: 'my',
meta: {
title: '我的',
hideBack: true
}, },
component: () => import('../views/tabbar/my.vue') {
}, path: '/my',
name: 'my',
{ meta: {
path: '/mine', title: '我的',
name: 'mine', hideBack: true
meta: { },
title: '我的', component: () => import('../views/tabbar/my.vue')
hideBack: true
}, },
component: () => import('../views/tabbar/mine.vue')
}, {
{ path: '/mine',
path: '/modifyPhone', name: 'mine',
name: 'mesmodifyPhonesage', meta: {
meta: { title: '我的',
title: '修改手机号', hideBack: true
hideBack: true },
component: () => import('../views/tabbar/mine.vue')
}, },
component: () => import('../views/tabbar/modifyPhone.vue') {
}, path: '/modifyPhone',
// 登录 name: 'mesmodifyPhonesage',
{ meta: {
path: '/login', title: '修改手机号',
name: 'login', hideBack: true
meta: { },
title: '机构登录', component: () => import('../views/tabbar/modifyPhone.vue')
hideBack: true
}, },
component: () => import('@/views/login/login.vue') // 登录
}, {
{ path: '/login',
path: '/againLogin', name: 'login',
name: 'againLogin', meta: {
meta: { title: '登录',
title: '机构登录', hideBack: true
hideBack: true },
component: () => import('@/views/login/login.vue')
}, },
component: () => import('@/views/login/againlogin.vue') {
}, path: '/againLogin',
// 个人中心 name: 'againLogin',
{ meta: {
path: '/charge', title: '登录',
name: 'charge', hideBack: true
meta: { },
title: '发起收费', component: () => import('@/views/login/againlogin.vue')
hideBack: true
}, },
component: () => import('@/views/my/charge.vue') // 个人中心
}, {
{ path: '/charge',
path: '/relationUsers', name: 'charge',
name: 'relationUsers', meta: {
meta: { title: '发起收费',
title: '我的' hideBack: true
},
component: () => import('@/views/my/charge.vue')
}, },
component: () => import('@/views/my/relation-users.vue') {
}, path: '/relationUsers',
{ name: 'relationUsers',
path: '/addRelation', meta: {
name: 'addRelation', title: '我的'
meta: { },
title: '绑定机构' component: () => import('@/views/my/relation-users.vue')
}, },
component: () => import('@/views/my/add-relation.vue') {
} path: '/addRelation',
name: 'addRelation',
meta: {
title: '绑定机构'
},
component: () => import('@/views/my/add-relation.vue')
}
] ]
const router = new VueRouter({ const router = new VueRouter({
......
...@@ -49,6 +49,7 @@ export default { ...@@ -49,6 +49,7 @@ export default {
return false return false
}, },
getCode () { getCode () {
console.log(111);
if (this.isSending) return if (this.isSending) return
if (this.tel.length !== 11) { if (this.tel.length !== 11) {
this.$toast('请正确输入手机号码') this.$toast('请正确输入手机号码')
...@@ -84,8 +85,7 @@ export default { ...@@ -84,8 +85,7 @@ export default {
// const _this = this // const _this = this
this.$http.post(this.$myApi.BINDLOGIN, curParams) this.$http.post(this.$myApi.BINDLOGIN, curParams)
.then(res => { .then(res => {
window.localStorage.removeItem('againLogin') this.$router.replace('/home')
window.document.location = this.$myApi.WINDOWHREF_ASK // url-
}) })
.catch(() => {}) .catch(() => {})
}, },
......
<template> <template>
<div class="cont"> <div class="cont" v-if="order">
<div class="top"> <div class="top">
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="title">维修类目:</div> <div class="title">维修类目:</div>
<div class="title">供水</div> <div class="title">{{order.repair_type.type_name}}</div>
</div> </div>
<div class="item-title">问题描述:</div> <div class="item-title">问题描述:</div>
<div class="item-desc que-desc">重点水房类-水房的阀门关不紧</div> <div class="item-desc que-desc">{{order.description}}</div>
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="item-title">服务地址:</div> <div class="item-title">服务地址:</div>
<div class="item-desc">公寓区-16号楼-东侧水房</div> <div
class="item-desc"
>{{order.region.region_name}}-{{order.room.room_name}}-{{order.address}}</div>
</div> </div>
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="item-title">客户姓名:</div> <div class="item-title">客户姓名:</div>
<div class="item-desc">张三三</div> <div class="item-desc">{{order.realname}}</div>
</div> </div>
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="item-title">联系电话:</div> <div class="item-title">联系电话:</div>
<div class="item-desc phone">186787867463</div> <div class="item-desc phone">{{order.telephone}}</div>
</div> </div>
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="item-title">提交时间:</div> <div class="item-title">提交时间:</div>
...@@ -25,9 +27,8 @@ ...@@ -25,9 +27,8 @@
</div> </div>
<div class="item flex-h flex-vc"> <div class="item flex-h flex-vc">
<div class="item-title">图片详情:</div> <div class="item-title">图片详情:</div>
<div class="img flex-h"> <div class="img flex-h" v-for="(child, index) in order.image" :key="index">
<img src="https://img01.yzcdn.cn/vant/cat.jpeg" alt /> <img :src="child.url" alt />
<img src="https://img01.yzcdn.cn/vant/cat.jpeg" alt />
</div> </div>
</div> </div>
</div> </div>
...@@ -116,9 +117,33 @@ export default { ...@@ -116,9 +117,33 @@ export default {
hc_name: '请选择', hc_name: '请选择',
hcPicker: false, hcPicker: false,
hcNum: '', hcNum: '',
repair_order_id: '',
order: '',
} }
}, },
created(){
console.log('change页面')
this.repair_order_id = this.$route.query.id
console.log(this.$route.query.id,'接收的id');
this.getDetail()
},
// mounted(){
// this.getDetail()
// },
methods:{ methods:{
getDetail(){
let repair_order_id = this.repair_order_id.toString()
const curParams = {
repair_order_id: this.repair_order_id
}
// const _this = this
this.$http.get(this.$myApi.REPAIR_ORDER_DETAIL, curParams)
.then(res => {
this.order = res.order
console.log(this.order,123456);
})
.catch(() => {})
},
showZl(index){ showZl(index){
this.addList[index].zlSelect = true this.addList[index].zlSelect = true
}, },
......
This diff is collapsed.
<template> <template>
<div class="cont"> <div class="cont" v-if="user">
<div class="top"></div> <div class="top"></div>
<div class="info-item"> <div class="info-item">
<div class="photo"> <div class="photo">
<img src="@assets/images/my/touxiang.png" alt=""> <img src="@assets/images/my/touxiang.png" alt />
</div> </div>
<div class="btn">工作中</div> <div class="btn">工作中</div>
<div class="name">张初一</div> <div class="name">{{user.name}}</div>
<div class="group">能源保障组</div> <div class="group">{{user.department.name}}</div>
<div class="tel flex-h"> <div class="tel flex-h">
<div class="telNumber">13180043557</div> <div class="telNumber">{{user.phone}}</div>
<img src="@assets/images/my/bianji.png" alt=""> <img src="@assets/images/my/bianji.png" alt />
</div> </div>
</div> </div>
<!-- tabbar --> <!-- tabbar -->
...@@ -25,6 +25,23 @@ export default { ...@@ -25,6 +25,23 @@ export default {
components: { components: {
myTabbar myTabbar
}, },
data(){
return{
user: '',
}
},
created() {
this.getUserInfo()
},
methods: {
getUserInfo () {
this.$http.get(this.$myApi.USERINFO)
.then(res => {
this.user = res
})
.catch(() => {})
},
}
} }
</script> </script>
...@@ -69,29 +86,29 @@ export default { ...@@ -69,29 +86,29 @@ export default {
line-height: 0.48rem; line-height: 0.48rem;
margin: 1.13rem auto 0.59rem; margin: 1.13rem auto 0.59rem;
} }
.name{ .name {
color: #000000; color: #000000;
font-size: 0.38rem; font-size: 0.38rem;
margin-bottom: 0.27rem; margin-bottom: 0.27rem;
font-weight: bold; font-weight: bold;
} }
.group{ .group {
color: #000000; color: #000000;
font-size: 0.3rem; font-size: 0.3rem;
margin-bottom: 0.48rem; margin-bottom: 0.48rem;
} }
.tel{ .tel {
width: 2rem; width: 2rem;
height: 0.28rem; height: 0.28rem;
margin: 0 auto; margin: 0 auto;
} }
.tel .telNumber{ .tel .telNumber {
color: #000000; color: #000000;
font-size: 0.3rem; font-size: 0.3rem;
margin-right: 0.2rem; margin-right: 0.2rem;
} }
.tel img{ .tel img {
width: 0.28rem; width: 0.28rem;
height: 0.28rem; height: 0.28rem;
} }
</style> </style>
\ No newline at end of file
...@@ -61,8 +61,8 @@ module.exports = { ...@@ -61,8 +61,8 @@ module.exports = {
proxy: { proxy: {
'/api/': { '/api/': {
// todo: url // todo: url
// target: 'https://fhxmtest.xueyoubangedu.com/api', // 测试 target: 'https://repairtest.zeruiedu.com/api', // 测试
target: 'https://fenghexm.xueyoubangedu.com/api', // 正式 // target: 'https://repair.zeruiedu.com/api', // 正式
autoRewrite: true, autoRewrite: true,
changeOrigin: true, changeOrigin: true,
ws: true, ws: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment