后台接口对接
This commit is contained in:
parent
ecb9010f5a
commit
139b0d59fd
|
|
@ -1,5 +1,6 @@
|
||||||
export default {
|
export default {
|
||||||
deptId: 101,
|
deptId: 101,
|
||||||
|
from: 'server',
|
||||||
initPageNum: 1,
|
initPageNum: 1,
|
||||||
initPageSize: 5
|
initPageSize: 5
|
||||||
}
|
}
|
||||||
|
|
@ -7,10 +7,15 @@ export default {
|
||||||
uni.addInterceptor('request', {
|
uni.addInterceptor('request', {
|
||||||
invoke(args) {
|
invoke(args) {
|
||||||
// request 触发前拼接 url
|
// request 触发前拼接 url
|
||||||
// args.url = 'https://www.opsoul.com' + args.url;
|
args.url = 'https://www.opsoul.com' + args.url;
|
||||||
args.url = 'http://127.0.0.1:80' + args.url;
|
// args.url = 'http://127.0.0.1:80' + args.url;
|
||||||
if (args.data) {
|
if (args.data) {
|
||||||
args.data.deptId = globalData.deptId;
|
args.data.deptId = globalData.deptId;
|
||||||
|
args.data.from = globalData.from;
|
||||||
|
}
|
||||||
|
if (args.header) {
|
||||||
|
args.header.deptId = globalData.deptId;
|
||||||
|
args.header.from = globalData.from;
|
||||||
}
|
}
|
||||||
// console.log("停止触发");
|
// console.log("停止触发");
|
||||||
// return false;
|
// return false;
|
||||||
|
|
@ -65,13 +70,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async login() {
|
async login() {
|
||||||
// 从缓存中获取登录信息
|
let userInfo = await wx.getUserProfile({
|
||||||
let userInfo = uni.getStorageSync('userProfile');
|
|
||||||
if (userInfo) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
userInfo = await wx.getUserProfile({
|
|
||||||
desc: '用于小程序登录'
|
desc: '用于小程序登录'
|
||||||
});
|
});
|
||||||
console.log("从微信获取基本用户信息:" + userInfo);
|
console.log("从微信获取基本用户信息:" + userInfo);
|
||||||
|
|
@ -95,7 +94,7 @@ export default {
|
||||||
let registerRes = await this.registerUser({
|
let registerRes = await this.registerUser({
|
||||||
openId: openId,
|
openId: openId,
|
||||||
name: userInfo.userInfo.nickName,
|
name: userInfo.userInfo.nickName,
|
||||||
customerLogoUrl: userInfo.userInfo.avatarUrl,
|
workerLogoUrl: userInfo.userInfo.avatarUrl,
|
||||||
status: 0
|
status: 0
|
||||||
});
|
});
|
||||||
if (registerRes.code === 0) {
|
if (registerRes.code === 0) {
|
||||||
|
|
@ -111,9 +110,9 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("通过后台服务获取用户信息:" + userInfo);
|
console.log("通过后台服务获取用户信息:" + userInfo);
|
||||||
if (!userInfo || userInfo.customerId == null || userInfo.customerId == undefined) {
|
if (!userInfo || userInfo.workerId == null || userInfo.workerId == undefined) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'error',
|
icon: 'none',
|
||||||
title: '微信用户信息获取失败,请退出小程序重试'
|
title: '微信用户信息获取失败,请退出小程序重试'
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -124,7 +123,7 @@ export default {
|
||||||
},
|
},
|
||||||
async registerUser(params = {}) {
|
async registerUser(params = {}) {
|
||||||
let res = await uni.request({
|
let res = await uni.request({
|
||||||
url: '/wx/addUser',
|
url: '/wx/addWorker',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -132,7 +131,7 @@ export default {
|
||||||
},
|
},
|
||||||
async qryUserInfo(openId) {
|
async qryUserInfo(openId) {
|
||||||
let res = await uni.request({
|
let res = await uni.request({
|
||||||
url: '/wx/getUserInfo',
|
url: '/wx/getWorkerInfo',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
openId: openId
|
openId: openId
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<view class="flex justify-between padding-bottom align-center solid-bottom">
|
<view class="flex justify-between padding-bottom align-center solid-bottom">
|
||||||
<view class="flex justify-start align-center">
|
<view class="flex justify-start align-center">
|
||||||
<view class="cu-avatar round"
|
<view class="cu-avatar round"
|
||||||
:style="'width: 120rpx; height: 120rpx; background-image:url(' + curUserInfo.customerLogoUrl + ');'"></view>
|
:style="'width: 120rpx; height: 120rpx; background-image:url(' + curUserInfo.workerLogoUrl + ');'"></view>
|
||||||
<view class="margin-lr-sm">
|
<view class="margin-lr-sm">
|
||||||
<view class="text-xl margin-bottom-xs">{{curUserInfo.name}}</view>
|
<view class="text-xl margin-bottom-xs">{{curUserInfo.name}}</view>
|
||||||
<!-- <view class="padding-xs text-sm">
|
<!-- <view class="padding-xs text-sm">
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,18 @@
|
||||||
</cu-custom>
|
</cu-custom>
|
||||||
<view class="cu-chat" @click="downPanelBlur" style="min-height: 70vh;">
|
<view class="cu-chat" @click="downPanelBlur" style="min-height: 70vh;">
|
||||||
<view class="cu-item self" v-for="(item,index) in chatMsgList"
|
<view class="cu-item self" v-for="(item,index) in chatMsgList"
|
||||||
v-if="item.sendUserId === curUserInfo.customerId">
|
v-if="item.sendUserId === curUserInfo.workerId">
|
||||||
<view class="main">
|
<view class="main">
|
||||||
<view class="content bg-main-color shadow">
|
<view class="content bg-main-color shadow">
|
||||||
<text>{{item.msg}}</text>
|
<text>{{item.msg}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-avatar radius" :style="'background-image:url(' + curUserInfo.customerLogoUrl + ');'">
|
<view class="cu-avatar radius" :style="'background-image:url(' + curUserInfo.workerLogoUrl + ');'">
|
||||||
</view>
|
</view>
|
||||||
<view class="date">{{item.time}}</view>
|
<view class="date">{{item.time}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-item" v-else>
|
<view class="cu-item" v-else>
|
||||||
<view class="cu-avatar radius" :style="'background-image:url(' + personToChat.customerLogoUrl + ');'">
|
<view class="cu-avatar radius" :style="'background-image:url(' + personToChat.workerLogoUrl + ');'">
|
||||||
</view>
|
</view>
|
||||||
<view class="main">
|
<view class="main">
|
||||||
<view class="content shadow">
|
<view class="content shadow">
|
||||||
|
|
@ -121,8 +121,8 @@
|
||||||
// TODO:模拟调用后台服务发送消息
|
// TODO:模拟调用后台服务发送消息
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.chatMsgList.push({
|
this.chatMsgList.push({
|
||||||
sendUserId: this.curUserInfo.customerId,
|
sendUserId: this.curUserInfo.workerId,
|
||||||
recvUserId: this.personToChat.customerId,
|
recvUserId: this.personToChat.workerId,
|
||||||
msg: content,
|
msg: content,
|
||||||
time: new Date()
|
time: new Date()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<view class="bg-gradual-color padding text-center"
|
<view class="bg-gradual-color padding text-center"
|
||||||
:style="'padding-top: ' + pageContentTop + 'px; padding-bottom: 100rpx;'">
|
:style="'padding-top: ' + pageContentTop + 'px; padding-bottom: 100rpx;'">
|
||||||
<view class="cu-avatar round"
|
<view class="cu-avatar round"
|
||||||
:style="'width: 150rpx; height: 150rpx; background-image:url(' + curUserInfo.customerLogoUrl + ');'">
|
:style="'width: 150rpx; height: 150rpx; background-image:url(' + curUserInfo.workerLogoUrl + ');'">
|
||||||
</view>
|
</view>
|
||||||
<view class="text-xl margin-sm">{{curUserInfo.name}}</view>
|
<view class="text-xl margin-sm">{{curUserInfo.name}}</view>
|
||||||
<view class="cu-list grid no-border col-2" style="background-color: inherit;">
|
<view class="cu-list grid no-border col-2" style="background-color: inherit;">
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,23 @@
|
||||||
<block slot="backText">返回</block>
|
<block slot="backText">返回</block>
|
||||||
<block slot="content">帐号安全</block>
|
<block slot="content">帐号安全</block>
|
||||||
</cu-custom>
|
</cu-custom>
|
||||||
<view class="margin-top-sm bg-white">
|
<view class="margin-top-sm bg-white" @click="bindNewPhoneNum">
|
||||||
<view class="cu-form-group">
|
<view class="cu-form-group">
|
||||||
<view class="title">绑定手机</view>
|
<view class="title">绑定手机</view>
|
||||||
<view>{{curUserInfo.phone}}</view>
|
<view>{{curUserInfo.phone}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<phone-vertify ref="phoneBindVertify" @confirm="phoneBindRes"></phone-vertify>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import phoneVertify from '@/pages/my/modal/phone-vertify.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
phoneVertify
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
curUserInfo: {}
|
curUserInfo: {}
|
||||||
|
|
@ -27,6 +33,12 @@
|
||||||
methods: {
|
methods: {
|
||||||
async loadData() {
|
async loadData() {
|
||||||
this.curUserInfo = await this.$request.getCurUserNoCache();
|
this.curUserInfo = await this.$request.getCurUserNoCache();
|
||||||
|
},
|
||||||
|
bindNewPhoneNum() {
|
||||||
|
this.$refs.phoneBindVertify.showModal();
|
||||||
|
},
|
||||||
|
phoneBindRes(e) {
|
||||||
|
console.log(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<template>
|
||||||
|
<!-- 模态框 -->
|
||||||
|
<view class="cu-modal" :class="isShow?'show':''">
|
||||||
|
<view class="cu-dialog bg-white">
|
||||||
|
<view class="cu-bar bg-white justify-end solid-bottom">
|
||||||
|
<view class="content">手机号验证</view>
|
||||||
|
<view class="action" @click="hideModal">
|
||||||
|
<text class="cuIcon-close text-red"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="padding-xl flex justify-start">
|
||||||
|
<input type="number" maxlength="11" class="radius-input flex-twice" v-model="phoneNum">
|
||||||
|
<button class="cu-btn bg-main-color shadow-blur flex-sub margin-left-sm">发送验证码</button>
|
||||||
|
</view>
|
||||||
|
<view class="cu-bar bg-white solid-top">
|
||||||
|
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="hideModal" @click="confirm">{{confirmMsg}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'phone-vertify',
|
||||||
|
emits: ['confirm'],
|
||||||
|
props: {
|
||||||
|
confirmMsg: {
|
||||||
|
type: String,
|
||||||
|
default: '确定'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isShow: false,
|
||||||
|
phoneNum: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showModal(e) {
|
||||||
|
this.isShow = true
|
||||||
|
},
|
||||||
|
hideModal(e) {
|
||||||
|
this.isShow = false
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
this.$emit('confirm', this.phoneNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue