后台接口对接
This commit is contained in:
parent
ecb9010f5a
commit
139b0d59fd
|
|
@ -1,5 +1,6 @@
|
|||
export default {
|
||||
deptId: 101,
|
||||
from: 'server',
|
||||
initPageNum: 1,
|
||||
initPageSize: 5
|
||||
}
|
||||
|
|
@ -7,10 +7,15 @@ export default {
|
|||
uni.addInterceptor('request', {
|
||||
invoke(args) {
|
||||
// request 触发前拼接 url
|
||||
// args.url = 'https://www.opsoul.com' + args.url;
|
||||
args.url = 'http://127.0.0.1:80' + args.url;
|
||||
args.url = 'https://www.opsoul.com' + args.url;
|
||||
// args.url = 'http://127.0.0.1:80' + args.url;
|
||||
if (args.data) {
|
||||
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("停止触发");
|
||||
// return false;
|
||||
|
|
@ -64,14 +69,8 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
async login() {
|
||||
// 从缓存中获取登录信息
|
||||
let userInfo = uni.getStorageSync('userProfile');
|
||||
if (userInfo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
userInfo = await wx.getUserProfile({
|
||||
async login() {
|
||||
let userInfo = await wx.getUserProfile({
|
||||
desc: '用于小程序登录'
|
||||
});
|
||||
console.log("从微信获取基本用户信息:" + userInfo);
|
||||
|
|
@ -95,7 +94,7 @@ export default {
|
|||
let registerRes = await this.registerUser({
|
||||
openId: openId,
|
||||
name: userInfo.userInfo.nickName,
|
||||
customerLogoUrl: userInfo.userInfo.avatarUrl,
|
||||
workerLogoUrl: userInfo.userInfo.avatarUrl,
|
||||
status: 0
|
||||
});
|
||||
if (registerRes.code === 0) {
|
||||
|
|
@ -111,9 +110,9 @@ export default {
|
|||
}
|
||||
}
|
||||
console.log("通过后台服务获取用户信息:" + userInfo);
|
||||
if (!userInfo || userInfo.customerId == null || userInfo.customerId == undefined) {
|
||||
if (!userInfo || userInfo.workerId == null || userInfo.workerId == undefined) {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
icon: 'none',
|
||||
title: '微信用户信息获取失败,请退出小程序重试'
|
||||
})
|
||||
return false;
|
||||
|
|
@ -124,7 +123,7 @@ export default {
|
|||
},
|
||||
async registerUser(params = {}) {
|
||||
let res = await uni.request({
|
||||
url: '/wx/addUser',
|
||||
url: '/wx/addWorker',
|
||||
method: 'POST',
|
||||
data: params
|
||||
})
|
||||
|
|
@ -132,7 +131,7 @@ export default {
|
|||
},
|
||||
async qryUserInfo(openId) {
|
||||
let res = await uni.request({
|
||||
url: '/wx/getUserInfo',
|
||||
url: '/wx/getWorkerInfo',
|
||||
method: 'POST',
|
||||
data: {
|
||||
openId: openId
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<view class="flex justify-between padding-bottom align-center solid-bottom">
|
||||
<view class="flex justify-start align-center">
|
||||
<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="text-xl margin-bottom-xs">{{curUserInfo.name}}</view>
|
||||
<!-- <view class="padding-xs text-sm">
|
||||
|
|
@ -99,17 +99,17 @@
|
|||
@click="chooseEntryType('serv')">服务商</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 强制要求用户授权登录的弹窗 -->
|
||||
<view class="cu-modal" :class="isAuthWxLoginModal?'show':''">
|
||||
<view class="cu-dialog">
|
||||
<view class="padding-xl">
|
||||
需先授权微信登录才可正常使用功能
|
||||
</view>
|
||||
<view class="cu-bar bg-white">
|
||||
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="authWxLogin">确认授权</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 强制要求用户授权登录的弹窗 -->
|
||||
<view class="cu-modal" :class="isAuthWxLoginModal?'show':''">
|
||||
<view class="cu-dialog">
|
||||
<view class="padding-xl">
|
||||
需先授权微信登录才可正常使用功能
|
||||
</view>
|
||||
<view class="cu-bar bg-white">
|
||||
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="authWxLogin">确认授权</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -125,40 +125,40 @@
|
|||
title: '需求大厅',
|
||||
name: '查看详情',
|
||||
color: 'blue',
|
||||
cuIcon: 'list',
|
||||
cuIcon: 'list',
|
||||
pageUrl: ''
|
||||
}, {
|
||||
id: 2,
|
||||
title: '我的订单',
|
||||
name: '查看详情',
|
||||
color: 'orange',
|
||||
cuIcon: 'text',
|
||||
cuIcon: 'text',
|
||||
pageUrl: '/pages/order-manage/order-manage'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '叮咚学院',
|
||||
name: '查看详情',
|
||||
color: 'cyan',
|
||||
cuIcon: 'emoji',
|
||||
cuIcon: 'emoji',
|
||||
pageUrl: ''
|
||||
}, {
|
||||
id: 4,
|
||||
title: '邀请师傅',
|
||||
name: '查看详情',
|
||||
color: 'pink',
|
||||
cuIcon: 'profile',
|
||||
cuIcon: 'profile',
|
||||
pageUrl: ''
|
||||
}, {
|
||||
id: 5,
|
||||
title: '区域代理',
|
||||
name: '查看详情',
|
||||
color: 'olive',
|
||||
cuIcon: 'group',
|
||||
cuIcon: 'group',
|
||||
pageUrl: '/pages/area-proxy/my-team'
|
||||
}],
|
||||
}],
|
||||
curUserInfo: {},
|
||||
myInfo: {},
|
||||
isShowSteer: false,
|
||||
isShowSteer: false,
|
||||
isAuthWxLoginModal: false
|
||||
}
|
||||
},
|
||||
|
|
@ -166,24 +166,24 @@
|
|||
this.loadData();
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
this.curUserInfo = this.$request.getCurUserInfo();
|
||||
console.log(this.curUserInfo)
|
||||
this.isAuthWxLoginModal = this.curUserInfo ? false : true;
|
||||
if (!this.isAuthWxLoginModal) {
|
||||
this.myInfo = await this.$api.data('myInfo');
|
||||
this.isShowSteer = !this.myInfo.entryType;
|
||||
let newServModules = this.servModules.concat();
|
||||
if (this.myInfo.hasCheckedRule) {
|
||||
newServModules[0].pageUrl = '/pages/demand-center/accept-demand-center';
|
||||
} else {
|
||||
let paramObj = {
|
||||
hasCheckedRule: this.myInfo.hasCheckedRule,
|
||||
navigate: true
|
||||
}
|
||||
newServModules[0].pageUrl = '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON.stringify(paramObj));
|
||||
}
|
||||
this.servModules = newServModules;
|
||||
async loadData() {
|
||||
this.curUserInfo = this.$request.getCurUserInfo();
|
||||
console.log(this.curUserInfo)
|
||||
this.isAuthWxLoginModal = this.curUserInfo ? false : true;
|
||||
if (!this.isAuthWxLoginModal) {
|
||||
this.myInfo = await this.$api.data('myInfo');
|
||||
this.isShowSteer = !this.myInfo.entryType;
|
||||
let newServModules = this.servModules.concat();
|
||||
if (this.myInfo.hasCheckedRule) {
|
||||
newServModules[0].pageUrl = '/pages/demand-center/accept-demand-center';
|
||||
} else {
|
||||
let paramObj = {
|
||||
hasCheckedRule: this.myInfo.hasCheckedRule,
|
||||
navigate: true
|
||||
}
|
||||
newServModules[0].pageUrl = '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON.stringify(paramObj));
|
||||
}
|
||||
this.servModules = newServModules;
|
||||
}
|
||||
},
|
||||
chooseEntryType(typeCode) {
|
||||
|
|
@ -191,22 +191,22 @@
|
|||
},
|
||||
hideModal(e) {
|
||||
this.isShowSteer = false
|
||||
},
|
||||
showMasterRule() {
|
||||
let paramObj = {
|
||||
hasCheckedRule: this.myInfo.hasCheckedRule,
|
||||
navigate: false
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON.stringify(paramObj))
|
||||
})
|
||||
},
|
||||
authWxLogin() {
|
||||
this.$request.login().then(res => {
|
||||
if (res) {
|
||||
this.loadData();
|
||||
}
|
||||
})
|
||||
},
|
||||
showMasterRule() {
|
||||
let paramObj = {
|
||||
hasCheckedRule: this.myInfo.hasCheckedRule,
|
||||
navigate: false
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON.stringify(paramObj))
|
||||
})
|
||||
},
|
||||
authWxLogin() {
|
||||
this.$request.login().then(res => {
|
||||
if (res) {
|
||||
this.loadData();
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -242,12 +242,12 @@
|
|||
|
||||
.nav-list>navigator:nth-child(even) {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.right-tag {
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
position: relative;
|
||||
right: -30rpx;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
.right-tag {
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
position: relative;
|
||||
right: -30rpx;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@
|
|||
</cu-custom>
|
||||
<view class="cu-chat" @click="downPanelBlur" style="min-height: 70vh;">
|
||||
<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="content bg-main-color shadow">
|
||||
<text>{{item.msg}}</text>
|
||||
</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 class="date">{{item.time}}</view>
|
||||
</view>
|
||||
<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 class="main">
|
||||
<view class="content shadow">
|
||||
|
|
@ -113,21 +113,21 @@
|
|||
this.showEmoji = true;
|
||||
this.InputBottom = this.InputBottom === 0 ? 300 : this.InputBottom;
|
||||
},
|
||||
sendMsg(type) {
|
||||
if (type === 'text' && this.inputContent != '') {
|
||||
this.showLoading = true;
|
||||
let content = this.inputContent;
|
||||
this.inputContent = '';
|
||||
// TODO:模拟调用后台服务发送消息
|
||||
setTimeout(() => {
|
||||
this.chatMsgList.push({
|
||||
sendUserId: this.curUserInfo.customerId,
|
||||
recvUserId: this.personToChat.customerId,
|
||||
msg: content,
|
||||
time: new Date()
|
||||
})
|
||||
this.showLoading = false;
|
||||
}, 0)
|
||||
sendMsg(type) {
|
||||
if (type === 'text' && this.inputContent != '') {
|
||||
this.showLoading = true;
|
||||
let content = this.inputContent;
|
||||
this.inputContent = '';
|
||||
// TODO:模拟调用后台服务发送消息
|
||||
setTimeout(() => {
|
||||
this.chatMsgList.push({
|
||||
sendUserId: this.curUserInfo.workerId,
|
||||
recvUserId: this.personToChat.workerId,
|
||||
msg: content,
|
||||
time: new Date()
|
||||
})
|
||||
this.showLoading = false;
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -164,4 +164,4 @@
|
|||
display: inline-block;
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<view class="bg-gradual-color padding text-center"
|
||||
:style="'padding-top: ' + pageContentTop + 'px; padding-bottom: 100rpx;'">
|
||||
<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 class="text-xl margin-sm">{{curUserInfo.name}}</view>
|
||||
<view class="cu-list grid no-border col-2" style="background-color: inherit;">
|
||||
|
|
@ -41,14 +41,14 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="bg-white">
|
||||
<view class="margin-top">
|
||||
<view class="flex justify-between align-center solid-bottom padding padding-lr-lg text-lg" v-for="(item, index) in menuList" @click="clickMenuItem(item)">
|
||||
<view class="flex justify-start align-center">
|
||||
<view class="margin-right-sm text-main-color text-xl"><view :class="'cuIcon-' + item.icon"></view></view>
|
||||
<view>{{item.name}}</view>
|
||||
</view>
|
||||
<view class="cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="margin-top">
|
||||
<view class="flex justify-between align-center solid-bottom padding padding-lr-lg text-lg" v-for="(item, index) in menuList" @click="clickMenuItem(item)">
|
||||
<view class="flex justify-start align-center">
|
||||
<view class="margin-right-sm text-main-color text-xl"><view :class="'cuIcon-' + item.icon"></view></view>
|
||||
<view>{{item.name}}</view>
|
||||
</view>
|
||||
<view class="cuIcon-right"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -62,49 +62,49 @@
|
|||
return {
|
||||
pageContentTop: this.CustomBar,
|
||||
curUserInfo: {},
|
||||
myInfo: {},
|
||||
menuList: [{
|
||||
name: '提现',
|
||||
icon: 'moneybag',
|
||||
pageUrl: '/pages/my/withdraw'
|
||||
}, {
|
||||
name: '交易明细',
|
||||
icon: 'form',
|
||||
pageUrl: '/pages/my/my-money-bag'
|
||||
}, {
|
||||
name: '服务明细',
|
||||
icon: 'calendar'
|
||||
}, {
|
||||
name: '师傅入驻',
|
||||
icon: 'profile',
|
||||
pageUrl: '/pages/my/master-occupancy'
|
||||
}, {
|
||||
name: '商品管理',
|
||||
icon: 'goods',
|
||||
pageUrl: '/pages/my/goods-manage'
|
||||
}, {
|
||||
name: '个人信息',
|
||||
icon: 'lock',
|
||||
pageUrl: '/pages/my/personal-info'
|
||||
}, {
|
||||
name: '法律声明',
|
||||
icon: 'read'
|
||||
}, {
|
||||
name: '店铺认证',
|
||||
icon: 'taoxiaopu'
|
||||
}, {
|
||||
name: '签约协议',
|
||||
icon: 'punch'
|
||||
}, {
|
||||
name: '反馈到平台',
|
||||
icon: 'comment'
|
||||
}, {
|
||||
name: '开放平台',
|
||||
icon: 'community'
|
||||
}, {
|
||||
name: '师傅缴费',
|
||||
icon: 'sponsor',
|
||||
pageUrl: '/pages/my/pay-deposit'
|
||||
myInfo: {},
|
||||
menuList: [{
|
||||
name: '提现',
|
||||
icon: 'moneybag',
|
||||
pageUrl: '/pages/my/withdraw'
|
||||
}, {
|
||||
name: '交易明细',
|
||||
icon: 'form',
|
||||
pageUrl: '/pages/my/my-money-bag'
|
||||
}, {
|
||||
name: '服务明细',
|
||||
icon: 'calendar'
|
||||
}, {
|
||||
name: '师傅入驻',
|
||||
icon: 'profile',
|
||||
pageUrl: '/pages/my/master-occupancy'
|
||||
}, {
|
||||
name: '商品管理',
|
||||
icon: 'goods',
|
||||
pageUrl: '/pages/my/goods-manage'
|
||||
}, {
|
||||
name: '个人信息',
|
||||
icon: 'lock',
|
||||
pageUrl: '/pages/my/personal-info'
|
||||
}, {
|
||||
name: '法律声明',
|
||||
icon: 'read'
|
||||
}, {
|
||||
name: '店铺认证',
|
||||
icon: 'taoxiaopu'
|
||||
}, {
|
||||
name: '签约协议',
|
||||
icon: 'punch'
|
||||
}, {
|
||||
name: '反馈到平台',
|
||||
icon: 'comment'
|
||||
}, {
|
||||
name: '开放平台',
|
||||
icon: 'community'
|
||||
}, {
|
||||
name: '师傅缴费',
|
||||
icon: 'sponsor',
|
||||
pageUrl: '/pages/my/pay-deposit'
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
|
@ -115,11 +115,11 @@
|
|||
async loadData() {
|
||||
this.curUserInfo = this.$request.getCurUserInfo();
|
||||
this.myInfo = await this.$api.data('myInfo');
|
||||
},
|
||||
clickMenuItem(menu) {
|
||||
uni.navigateTo({
|
||||
url: menu.pageUrl
|
||||
})
|
||||
},
|
||||
clickMenuItem(menu) {
|
||||
uni.navigateTo({
|
||||
url: menu.pageUrl
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -139,4 +139,4 @@
|
|||
z-index: -1;
|
||||
padding-top: 100rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -5,17 +5,23 @@
|
|||
<block slot="backText">返回</block>
|
||||
<block slot="content">帐号安全</block>
|
||||
</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="title">绑定手机</view>
|
||||
<view>{{curUserInfo.phone}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<phone-vertify ref="phoneBindVertify" @confirm="phoneBindRes"></phone-vertify>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import phoneVertify from '@/pages/my/modal/phone-vertify.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
phoneVertify
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
curUserInfo: {}
|
||||
|
|
@ -27,6 +33,12 @@
|
|||
methods: {
|
||||
async loadData() {
|
||||
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