Browse Source

修复bug

pull/6/head
longjieli 2 months ago
parent
commit
5bd9e8c6a2
8 changed files with 309 additions and 91 deletions
  1. +39
    -39
      api/login.js
  2. +13
    -0
      api/user/user.js
  3. +6
    -1
      pages.json
  4. +2
    -3
      pages/login/index.vue
  5. +226
    -0
      pages/login/wxUserInfo.vue
  6. +1
    -1
      pages/workbenchManage/components/modal.vue
  7. +11
    -35
      pages/workbenchManage/index.vue
  8. +11
    -12
      utils/request.js

+ 39
- 39
api/login.js View File

@ -2,58 +2,58 @@ import request from '@/utils/request'
// 登录方法
export function login(username, password, code, uuid) {
const data = {
username,
password,
code,
uuid
}
return request({
'url': '/login',
headers: {
isToken: false
},
'method': 'post',
'data': data
})
const data = {
username,
password,
code,
uuid
}
return request({
'url': '/login',
headers: {
isToken: false
},
'method': 'post',
'data': data
})
}
// 注册方法
export function register(data) {
return request({
url: '/register',
headers: {
isToken: false
},
method: 'post',
data: data
})
return request({
url: '/register',
headers: {
isToken: false
},
method: 'post',
data: data
})
}
// 获取用户详细信息
export function getInfo() {
return request({
'url': '/getInfo',
'method': 'get'
})
return request({
'url': '/getInfo',
'method': 'get'
})
}
// 退出方法
export function logout() {
return request({
'url': '/logout',
'method': 'post'
})
return request({
'url': '/logout',
'method': 'post'
})
}
// 获取验证码
export function getCodeImg() {
return request({
'url': '/captchaImage',
headers: {
isToken: false
},
method: 'get',
timeout: 20000
})
}
return request({
'url': '/captchaImage',
headers: {
isToken: false
},
method: 'get',
timeout: 20000
})
}

+ 13
- 0
api/user/user.js View File

@ -0,0 +1,13 @@
import request from '@/utils/request'
// 更新用户信息
export const updateUserInfo = (data) => {
return request({
url: '/applet/info/updateInfo',
headers: {
isToken: false
},
method: 'post',
data
})
}

+ 6
- 1
pages.json View File

@ -9,7 +9,6 @@
}
},
"pages": [
{
"path": "pages/workbenchManage/index",
"style": {
@ -45,6 +44,12 @@
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/login/wxUserInfo",
"style": {
"navigationBarTitleText": "用户信息"
}
}
],
"subPackages": [{


+ 2
- 3
pages/login/index.vue View File

@ -54,15 +54,14 @@
uni.login({
success: (res) => {
const code = res.code
console.log(code)
wxLogin({
code
}).then(res => {
if (res.code === 200) {
uni.setStorageSync("token", res.data.token)
uni.setStorageSync("baseInfo", JSON.stringify(res.data.userInfo))
uni.navigateBack({
delta: 1
uni.navigateTo({
url: "/pages/login/wxUserInfo"
})
}
})


+ 226
- 0
pages/login/wxUserInfo.vue View File

@ -0,0 +1,226 @@
<template>
<view class="login">
<!-- <view class="logo">
<image :src="configList.logo_image" mode=""></image>
</view> -->
<view class="title">
猫妈狗爸
</view>
<view class="title">
申请获取你的头像昵称
</view>
<button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<view class="line">
<view class="">
头像
</view>
<view class="">
<image :src="userInfoForm.headImage" v-if="userInfoForm.headImage"
style="width: 60rpx;height: 60rpx;" mode=""></image>
<!-- <image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image> -->
</view>
</view>
</button>
<view class="line">
<view class="">
昵称
</view>
<view class="">
<input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
v-model="userInfoForm.nickName" />
</view>
</view>
<view class="line">
<view class="">
手机号
</view>
<view class="" v-if="userInfoForm.phone">
<input placeholder="请输入手机号" style="text-align: right;" disabled v-model="userInfoForm.phone" />
</view>
<view class="" v-else>
<button class="getPhoneNumber" open-type="getPhoneNumber" @getphonenumber="getPhone">
获取电话号码
</button>
</view>
</view>
<view class="btn" @click="submit">
确认
</view>
</view>
</template>
<script>
import {
ossUpload
} from "@/utils/oss-upload/oss/index.js"
import {
getPhoneNumber
} from "@/api/system/user.js"
import {
updateUserInfo
} from "@/api/user/user.js"
export default {
data() {
return {
userInfo: {
phone: "",
nickName: "",
headImage: ""
},
userInfoForm: {
headImage: '',
nickName: '',
phone: '',
}
};
},
onShow() {},
onLoad() {
this.userInfoForm.phone = this.userInfo.phone || ''
this.userInfoForm.nickName = this.userInfo.nickName || ''
this.userInfoForm.headImage = this.userInfo.headImage || ''
},
computed: {},
methods: {
onChooseAvatar(res) {
let self = this
ossUpload(res.target.avatarUrl)
.then(url => {
self.userInfoForm.headImage = url
})
},
async getPhone(e) {
let result = await getPhoneNumber({
code: e.detail.code
})
result = JSON.parse(result.msg);
this.userInfoForm.phone = result.phone_info.phoneNumber;
},
submit() {
let self = this
uni.createSelectorQuery().in(this)
.select("#nickName")
.fields({
properties: ["value"],
})
.exec((res) => {
const nickName = res?.[0]?.value
self.userInfoForm.nickName = nickName
if (!this.userInfoForm.headImage) {
return uni.showToast({
title: '请选择头像',
icon: "none"
})
} else if (!this.userInfoForm.nickName) {
return uni.showToast({
title: '请填写昵称',
icon: "none"
})
} else if (!this.userInfoForm.phone) {
return uni.showToast({
title: '请填写手机号',
icon: "none"
})
}
// Id
const baseUserInfo = JSON.parse(uni.getStorageSync("baseInfo"));
updateUserInfo({
userId: baseUserInfo.userId,
userImage: self.userInfoForm.headImage,
userName: self.userInfoForm.nickName,
userTelephone: self.userInfoForm.phone
}).then(res => {
if (res.code == 200) {
uni.switchTab({
url: "/pages/workbenchManage/index"
})
}
})
})
},
}
}
</script>
<style lang="scss" scoped>
.login {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 80vh;
.logo {
height: 140rpx;
width: 140rpx;
image {
height: 140rpx;
width: 140rpx;
border-radius: 30rpx;
}
margin-bottom: 20rpx;
}
.title {
line-height: 45rpx;
font-weight: 900;
}
.line {
display: flex;
justify-content: space-between;
align-items: center;
width: 80%;
border-bottom: 1px solid #00000023;
padding: 30rpx 0;
margin: 0 auto;
}
.chooseAvatar {
width: 100%;
padding: 0;
margin: 0;
margin-top: 10vh;
border: none;
}
.btn {
background: #FFBF60;
// background: $uni-color;
color: #fff;
width: 80%;
padding: 20rpx 0;
text-align: center;
border-radius: 15rpx;
margin-top: 10vh;
}
.getPhoneNumber {
// all: unset;
display: flex;
justify-content: center;
align-items: center;
// background: $uni-linear-gradient-btn-color;
// background: $uni-color;
color: #fff;
width: 200rpx;
height: 60rpx;
border-radius: 30rpx;
font-size: 24rpx;
}
}
</style>

+ 1
- 1
pages/workbenchManage/components/modal.vue View File

@ -42,7 +42,7 @@
})
const init = () => {
successList().then(res => {
state.info = res.rows[0]
// state.info = res.rows[0]
})
}
const close = () => {


+ 11
- 35
pages/workbenchManage/index.vue View File

@ -4,26 +4,25 @@
<!-- <up-swiper :list="list1" indicator circular indicatorMode="dot" height="370rpx"></up-swiper> -->
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" style="height: 370rpx;">
<swiper-item class="w-100 h-100" v-for="item in state.banner" :key="item.id">
<image class="w-100 h-100" :src="item.image" mode=""></image>
</swiper-item>
</swiper>
</view>
<view class="container">
<view class="container-list">
<view class="mb28 col3 font32">合伙人工作台{{state}}</view>
<view class="mb28 col3 font32">合伙人工作台</view>
<!-- 申请加入 -->
<view class="container-list-but font28" v-if="userHh!==1||show">
<view class="flex flex-between">
<view>
<view class="mb20" style="width: 400rpx;">{{iconState.list2[0].iconName}}</view>
<!-- <view class="mb20" style="width: 400rpx;">{{iconState.list2[0].iconName}}</view> -->
<view class="font24 add-but col-white" @click="handleJoin(1)">申请加入 ></view>
</view>
<image :src="iconState.list2[0].icon"></image>
<!-- <image :src="iconState.list2[0].icon"></image> -->
</view>
</view>
<!-- 申请加入后 -->
<view class="flex flex-between font24 flex-wrap" v-if="userHh===1">
<view class="flex flex-between font24 flex-wrap" v-if="userHh==1">
<view class="icon-list" @click="handleGoto(1,item)" v-for="item in iconState.list1" :key="item.id">
<up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
height="68rpx"></up-image>
@ -39,18 +38,18 @@
<view class="container-list-but" style="background: #FFECE5" v-if="userBcs!==1||show">
<view class="flex flex-between">
<view>
<view class="mb20" style="width: 450rpx;">{{iconState.list2[1].iconName}}</view>
<!-- <view class="mb20" style="width: 450rpx;">{{iconState.list2[1].iconName}}</view> -->
<!-- <view class="mb20">亲密接触获得服务报酬</view> -->
<view class="font24 add-but col-white" style="background: #FF8343" @click="handleJoin(2)">
申请加入 ></view>
</view>
<image :src="iconState.list2[1].icon"></image>
<!-- <image :src="iconState.list2[1].icon"></image> -->
</view>
</view>
<!-- 申请之后 -->
<!-- 申请加入后 -->
<view class="flex-rowl flex-wrap" v-if="userBcs===1">
<view class="icon-list" v-for="item in iconState.accompanyData" :key="item.id"
<view class="icon-list" v-for="item in iconState.list2" :key="item.id"
@click="handleClick(item)">
<up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
height="68rpx"></up-image>
@ -87,27 +86,6 @@
getLoginStatus
} from "../../utils/useMixin";
const accompanyData = [{
name: "服务信息",
code: '1',
url: ""
}, {
name: "服务记录",
code: '2',
url: ""
}, {
name: "接单地址",
code: '3',
url: ""
}, {
name: "平台手册",
code: '4',
url: ""
}, {
name: "我的评价",
code: '5',
url: ""
}]
const state = reactive({
banner: []
})
@ -192,16 +170,14 @@
const iconState = reactive({
list1: [],
list2: [],
accompanyData: []
})
const getpz = () => {
indexConfig().then(res => {
iconState.list1 = res.rows
//
iconState.list1 = res?.rows?.slice(0,4) || [];
//
iconState.list2 = res?.rows?.slice(4) || [];
})
indexConfigIco().then(res => {
iconState.list2 = res.data
})
}
const show = ref(true)


+ 11
- 12
utils/request.js View File

@ -42,7 +42,6 @@ const request = config => {
}).then(res => {
console.log(res);
const code = res.data.code || 200
console.log(code);
const msg = errorCode[code] || res.data.msg || errorCode['default']
if (code === 401) {
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
@ -65,17 +64,17 @@ const request = config => {
resolve(res.data)
})
.catch(error => {
let {
message
} = error
if (message === 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
toast(message)
// let {
// message
// } = error
// if (message === 'Network Error') {
// message = '后端接口连接异常'
// } else if (message.includes('timeout')) {
// message = '系统接口请求超时'
// } else if (message.includes('Request failed with status code')) {
// message = '系统接口' + message.substr(message.length - 3) + '异常'
// }
// toast(message)
reject(error)
})
})


Loading…
Cancel
Save