Browse Source

对接接口

master
前端-胡立永 4 months ago
parent
commit
be14e5f6d1
17 changed files with 380 additions and 64 deletions
  1. +2
    -0
      App.vue
  2. +47
    -3
      api/api.js
  3. +1
    -1
      api/http.js
  4. +0
    -5
      components/PrivacyAgreementPoup/PrivacyAgreementPoup.vue
  5. +18
    -8
      components/broadside/broadside.vue
  6. +45
    -0
      components/config/configPopup.vue
  7. +116
    -0
      components/config/customerServicePopup.vue
  8. +1
    -1
      config.js
  9. +1
    -1
      manifest.json
  10. +8
    -6
      pages.json
  11. +17
    -3
      pages/index/center.vue
  12. +13
    -2
      pages/index/index.vue
  13. +1
    -3
      pages/login/login.vue
  14. +14
    -11
      pages/login/wxUserInfo.vue
  15. BIN
      pages/subPack/static/icon.png
  16. +59
    -18
      pages/subPack/team/team.vue
  17. +37
    -2
      store/store.js

+ 2
- 0
App.vue View File

@ -4,6 +4,8 @@
},
onShow: function() {
// this.$store.commit('initConfig')
this.$store.commit('getTeam')
this.$store.commit('getUserInfo')
},
onHide: function() {
}


+ 47
- 3
api/api.js View File

@ -23,12 +23,19 @@ const config = {
},
// 修改个人信息接口
updateInfo: {
url: '/info/updateInfo',
url: '/user/edit',
method: 'POST',
auth: true,
limit : 500,
limit : 800,
showLoading : true,
},
// 获取用户信息
getInfo: {
url: '/user/info',
method: 'GET',
auth: true,
limit : 800,
},
//隐私政策
getPrivacyPolicy: {
url: '/login/getPrivacyPolicy',
@ -39,6 +46,43 @@ const config = {
url: '/login/getUserAgreement',
method: 'GET',
},
// 获取团队
teamList: {
url: '/team/list',
method: 'GET',
},
// 申请加入团队
teamApply: {
url: '/team/apply',
method: 'POST',
},
// 实名认证
authApply: {
url: '/auth/apply',
method: 'POST',
},
// 实名认证详情
authInfo: {
url: '/auth/info',
method: 'GET',
},
// 打卡
clock: {
url: '/clock/in',
method: 'POST',
},
// 打卡详情列表
clockList: {
url: 'clock/in/log',
method: 'GET',
},
}
@ -74,7 +118,7 @@ export function api(key, data, callback, loadingTitle) {
if (req.auth) {
if (!uni.getStorageSync('token')) {
uni.navigateTo({
url: '/pages_order/auth/wxLogin'
url: '/pages/login/login'
})
console.error('需要登录')
return


+ 1
- 1
api/http.js View File

@ -30,7 +30,7 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
uni.removeStorageSync('token')
console.error('登录过期');
uni.navigateTo({
url: '/pages_order/auth/wxLogin'
url: '/pages/login/login'
})
}


+ 0
- 5
components/PrivacyAgreementPoup/PrivacyAgreementPoup.vue View File

@ -60,11 +60,6 @@
})
}
},
created() {
setTimeout(() => {
this.init()
}, 500)
},
methods: {
//


+ 18
- 8
components/broadside/broadside.vue View File

@ -5,22 +5,28 @@
<view class="content">
<!-- 用户信息 -->
<view class="user-info">
<image src="@/static/logo.png" mode="widthFix"></image>
<image :src="userInfo.headImage" mode="widthFix"></image>
<view class="base">
<view class="name">李知意</view>
<view class="project">高新区项目一队</view>
<view class="name">{{ userInfo.nickName }}</view>
<view class="project"
v-if="userInfo.team">{{ userInfo.team.name }}</view>
</view>
</view>
<!-- 团队项目列表 -->
<view class="team-list">
<view v-for="(item,index) in 100" :class="{ 'active-team' : index == 0}" class="team-item">
<view class="team-list"
v-if="userInfo.team">
<view
class="active-team team-item">
<view class="team-item-left">
<image src="@/static/image/broadside/project.png" mode="widthFix"></image>
<view class="team-name">高新区项目一队</view>
<image src="@/static/image/broadside/project.png"
mode="widthFix"></image>
<view class="team-name">{{ userInfo.team.name }}</view>
</view>
<view class="team-item-right">
<uni-icons v-if="index == 0" type="checkmarkempty" size="30" color="#fff"></uni-icons>
<uni-icons
type="checkmarkempty" size="30"
color="#fff"></uni-icons>
</view>
</view>
</view>
@ -30,6 +36,7 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "broadSide",
data() {
@ -37,6 +44,9 @@
}
},
computed : {
...mapState(['teamList', 'userInfo']),
},
methods: {
open() {
this.$refs.popup.open('left');


+ 45
- 0
components/config/configPopup.vue View File

@ -0,0 +1,45 @@
<template>
<view class="configPopup">
<uv-popup ref="popup" :round="30" :customStyle="{height: '50vh'}">
<view class="content">
<uv-parse :content="content"></uv-parse>
</view>
</uv-popup>
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'configPoup',
data() {
return {
content : ''
}
},
onShow(){
},
methods: {
//
open(key){
this.content = this.configList[key]
this.$refs.popup.open('bottom');
}
},
computed : {
...mapState(['configList'])
}
}
</script>
<style lang="scss" scoped>
.configPopup {
.content{
padding: 30rpx 20rpx;
}
}
</style>

+ 116
- 0
components/config/customerServicePopup.vue View File

@ -0,0 +1,116 @@
<template>
<!-- 联系客服弹框 -->
<uv-overlay :show="show" @click="close">
<view class="warp">
<view class="rect" @tap.stop>
<view class="title">联系客服</view>
<view class="center">确定拨打客服电话?</view>
<view class="bottom">
<view class="btn1"
@click="close">
取消
</view>
<view class="btn2"
@click="confirm">
确定
</view>
</view>
</view>
</view>
</uv-overlay>
</template>
<script>
export default {
data() {
return {
show: false,
phone:'',
}
},
mounted() {
this.getCustomPhone()
},
methods: {
getCustomPhone(){
this.$api('customUser', {}, res => {
this.phone = res.result.phone
})
},
open() {
this.show = true
},
close() {
this.show = false
},
//
confirm() {
this.show = false
uni.makePhoneCall({
phoneNumber: this.phone,
success() {
console.log('安卓拨打成功');
},
fail() {
console.log('安卓拨打失败');
}
})
},
}
}
</script>
<style scoped lang="scss">
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.rect {
width: 600rpx;
height: 300rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
.title {
padding: 10rpx 0 0 15rpx;
background-color: $uni-color;
color: #FFF;
text-align: left;
width: 100%;
height: 18%;
font-size: 36rpx;
}
.center {
height: 40%;
display: flex;
justify-content: center;
align-items: center;
font-size: 36rpx;
}
.bottom {
display: flex;
justify-content: center;
gap: 50rpx;
view{
height: 60rpx;
line-height: 60rpx;
padding: 0 50rpx;
border-radius: 30rpx;
}
.btn1{
background-color: #fff;
}
.btn2{
background-color: $uni-color;
color: #fff;
}
}
}
</style>

+ 1
- 1
config.js View File

@ -12,7 +12,7 @@ const type = 'dev'
// 环境配置
const config = {
dev: {
baseUrl: 'http://www.gcosc.fun:82',
baseUrl: 'http://dev.java996.icu/clockin-api',
},
prod: {
baseUrl: 'http://xxx.xxx.xxx/xxx',


+ 1
- 1
manifest.json View File

@ -52,7 +52,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxf7152f59d366236b",
"appid" : "wx69aadfc270684d2e",
"setting" : {
"urlCheck" : false
},


+ 8
- 6
pages.json View File

@ -1,15 +1,17 @@
{
"pages": [{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
}, {
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "打卡"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/index/center",
"style": {


+ 17
- 3
pages/index/center.vue View File

@ -4,11 +4,13 @@
<div class="user-info">
<div class="user-box">
<div class="user-img">
<image src="@/static/logo.png" mode="widthFix"></image>
<image :src="userInfo.headImage" mode="widthFix"></image>
</div>
<div class="base">
<div class="user-name">李知意</div>
<div class="user-project">高新区项目一队项目1</div>
<div class="user-name">{{ userInfo.nickName }}</div>
<!-- <div class="user-project">高新区项目一队项目1</div> -->
<view class="user-project"
v-if="userInfo.team">{{ userInfo.team.name }}</view>
</div>
</div>
<image class="user-bg" src="https://tennis-oss.xzaiyp.top/2024-10-22/b51d97b2-f2a1-4471-9b6d-7fbc2f3f774a.png" mode="widthFix"></image>
@ -27,6 +29,11 @@
<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/a7f27701-49fe-4a1f-8171-19efb1af1102.png" mode="widthFix"></image>
</template>
</uv-cell>
<uv-cell @click="$store.commit('logout')" icon="setting-fill" isLink arrow-direction="right" title="退出登录" center>
<template v-slot:icon>
<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/a7f27701-49fe-4a1f-8171-19efb1af1102.png" mode="widthFix"></image>
</template>
</uv-cell>
<uv-cell @click="clickMenu" icon="integral-fill" title="版本" value="版本1.0" center>
<template v-slot:icon>
<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/6878084d-4c1e-4577-8c8b-dd92aebbe2a2.png" mode="widthFix"></image>
@ -41,6 +48,7 @@
<script>
import tabbar from '../../components/base/tabbar.vue'
import { mapState } from 'vuex'
export default {
name: "Center",
components: {
@ -51,6 +59,12 @@
}
},
onShow() {
this.$store.commit('getUserInfo')
},
computed : {
...mapState(['teamList', 'userInfo']),
},
methods: {
clickMenu(index){
if(index == 1){


+ 13
- 2
pages/index/index.vue View File

@ -25,7 +25,7 @@
<view class="punch-card">
<view @click="callCard" class="circle">
<view class="title">拍照打卡</view>
<view class="time">2021-10-10 10:00:00</view>
<view class="time">{{ date.format('YYYY-MM-DD HH:mm:ss') }}</view>
</view>
</view>
@ -63,11 +63,22 @@
return {
latitude: 39.909,
longitude: 116.39742,
covers: []
covers: [],
inter : null,
date : this.$dayjs()
}
},
onLoad() {
this.inter = setInterval(() => {
this.date = this.$dayjs()
}, 1000)
},
onUnload() {
clearInterval(this.inter)
},
onShow() {
this.getLocation()
this.$store.commit('getUserInfo')
},
methods: {
//


+ 1
- 3
pages/login/login.vue View File

@ -48,9 +48,7 @@
title: "请勾选隐私协议"
})
}
uni.navigateTo({
url: "/pages/login/wxUserInfo"
})
this.$store.commit('login')
}
}
}


+ 14
- 11
pages/login/wxUserInfo.vue View File

@ -81,19 +81,22 @@
})) {
return
}
self.$api('updateInfo', {
headImg : self.userInfo.headImage,
nickname : self.userInfo.nickName,
}, res => {
if (res.code == 200) {
this.$store.commit('getUserInfo')
uni.redirectTo({
url:'/pages/index/index'
})
}
})
// self.$api('updateInfo', self.userInfo, res => {
// if (res.code == 200) {
// this.replushUserInfo()
// uni.switchTab({
// url: '/pages/repair/repair'
// })
// }
// uni.reLaunch({
// url: "/pages/subPack/team/team"
// })
uni.reLaunch({
url: "/pages/subPack/team/team"
})
})
},


BIN
pages/subPack/static/icon.png View File

Before After
Width: 210  |  Height: 202  |  Size: 20 KiB

+ 59
- 18
pages/subPack/team/team.vue View File

@ -13,16 +13,26 @@
<view class="team-form-item">
<view class="title">团队</view>
<view class="select">
<uni-data-select v-model="value" :localdata="range" :clear="false"></uni-data-select>
<uni-data-select
v-model="form.teamId"
:localdata="range"
style="width: 600rpx;font-size: 30rpx;"
:clear="false"></uni-data-select>
</view>
</view>
<view class="team-form-item">
<view class="title">姓名</view>
<view class="name-input">
<input type="text" placeholder="请输入姓名" />
<input type="text" placeholder="请输入姓名" v-model="form.name"/>
</view>
</view>
</view>
<uv-popup ref="popup" :round="30">
<view class="content-popup">
</view>
</uv-popup>
<!-- 提交审核 -->
<div @click="submit" class="btn">
@ -32,30 +42,51 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: "Team",
data() {
return {
value: 0,
range: [{
value: 0,
text: "高新区项目一队代理商的领导"
},
{
value: 1,
text: "望城区项目二队"
},
{
value: 2,
text: "雨花区项目一队"
},
],
range: [],
form : {
name : '',
teamId : '',
},
}
},
computed : {
...mapState(['teamList', 'userInfo']),
},
onLoad() {
let team = []
this.teamList.forEach(n => {
team.push({
value: n.id,
text: n.name
})
})
this.range = team
},
methods: {
submit() {
uni.navigateTo({
url: "/pages/index/index"
// this.$refs.popup.open()
// return
if (this.$utils.verificationAll(this.form, {
teamId : '请选择团队',
name : '请输入姓名',
})) {
return
}
this.$api('teamApply', this.form, res => {
if(res.code == 200){
uni.reLaunch({
url: '/pages/index/index'
})
}
})
}
}
@ -63,6 +94,13 @@
</script>
<style lang="scss" scoped>
.content-popup{
padding: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
width: 600rpx;
}
.team {
display: flex;
flex-direction: column;
@ -70,6 +108,9 @@
align-items: center;
min-height: 100vh;
background: white;
/deep/ .uni-select__input-text{
font-size: 30rpx !important;
}
// logo
.logo {


+ 37
- 2
store/store.js View File

@ -10,6 +10,7 @@ const store = new Vuex.Store({
state: {
configList: [], //配置列表
userInfo : {}, //用户信息
teamList : [],//团队列表
},
getters: {
@ -36,6 +37,7 @@ const store = new Vuex.Store({
uni.showLoading({
title: '登录中...'
})
let self = this
uni.login({
success(res) {
if(res.errMsg != "login:ok"){
@ -57,19 +59,52 @@ const store = new Vuex.Store({
if(!state.userInfo.nickName || !state.userInfo.headImage){
uni.navigateTo({
url: '/pages_order/auth/wxUserInfo'
url: '/pages/login/wxUserInfo'
})
}else{
self.commit('getUserInfo')
uni.navigateBack(-1)
}
})
}
})
},
logout(state){
uni.showModal({
title: '确认退出登录吗',
success(r) {
if(r.confirm){
state.userInfo = {}
state.role = false
uni.removeStorageSync('token')
uni.reLaunch({
url: '/pages/index/index'
})
}
}
})
},
getUserInfo(state){
api('infoGetInfo', res => {
api('getInfo', res => {
if(res.code == 200){
state.userInfo = res.result
if(!state.userInfo.team){
uni.navigateTo({
url: "/pages/subPack/team/team"
})
}else if(!state.userInfo.auth){
uni.navigateTo({
url: "/pages/subPack/autonym/autonym"
})
}
}
})
},
getTeam(state){
api('teamList', res => {
if(res.code == 200){
state.teamList = res.result
}
})
},


Loading…
Cancel
Save