Browse Source

对接接口

master
前端-胡立永 2 months ago
parent
commit
3701b8bb09
5 changed files with 283 additions and 19 deletions
  1. +16
    -0
      api/api.js
  2. +7
    -0
      pages.json
  3. +54
    -18
      pages/index/center.vue
  4. +182
    -0
      pages/subPack/projectManage/projectManage.vue
  5. +24
    -1
      uni.scss

+ 16
- 0
api/api.js View File

@ -115,6 +115,22 @@ const config = {
showLoading : true, showLoading : true,
debounce : 400, debounce : 400,
}, },
// 项目列表分页
clockProjectList: {
url: '/clock/project/list',
method: 'GET',
auth : true,
},
// 设置项目经纬度
clockProjectLocation: {
url: '/clock/project/location',
method: 'POST',
auth : true,
showLoading : true,
},
} }


+ 7
- 0
pages.json View File

@ -62,6 +62,13 @@
"style": { "style": {
"navigationBarTitleText": "选择工程" "navigationBarTitleText": "选择工程"
} }
},
{
"path" : "projectManage/projectManage",
"style" :
{
"navigationBarTitleText" : "项目管理"
}
} }
] ]
}], }],


+ 54
- 18
pages/index/center.vue View File

@ -7,14 +7,14 @@
<image :src="userInfo.headImage" mode="widthFix"></image> <image :src="userInfo.headImage" mode="widthFix"></image>
</div> </div>
<div class="base"> <div class="base">
<div class="user-name"
v-if="userInfo.auth">{{ userInfo.auth.name }}</div>
<div class="user-name" v-if="userInfo.auth">{{ userInfo.auth.name }}</div>
<!-- <div class="user-project">高新区项目一队项目1</div> --> <!-- <div class="user-project">高新区项目一队项目1</div> -->
<view class="user-project"
v-if="userInfo.team">{{ userInfo.team.name }}</view>
<view class="user-project" v-if="userInfo.team">{{ userInfo.team.name }}</view>
</div> </div>
</div> </div>
<image class="user-bg" src="https://tennis-oss.xzaiyp.top/2024-10-22/b51d97b2-f2a1-4471-9b6d-7fbc2f3f774a.png" mode="widthFix"></image>
<image class="user-bg"
src="https://tennis-oss.xzaiyp.top/2024-10-22/b51d97b2-f2a1-4471-9b6d-7fbc2f3f774a.png" mode="widthFix">
</image>
</div> </div>
<!-- 菜单 --> <!-- 菜单 -->
@ -22,22 +22,40 @@
<uv-cell-group :border="false"> <uv-cell-group :border="false">
<uv-cell @click="clickMenu(1)" title="打卡记录" isLink arrow-direction="right" center> <uv-cell @click="clickMenu(1)" title="打卡记录" isLink arrow-direction="right" center>
<template v-slot:icon> <template v-slot:icon>
<image style="width: 30rpx;" src="https://tennis-oss.xzaiyp.top/2024-10-22/a57869c1-1451-47db-805d-8e29f5c37637.png" mode="widthFix"></image>
<image style="width: 30rpx;"
src="https://tennis-oss.xzaiyp.top/2024-10-22/a57869c1-1451-47db-805d-8e29f5c37637.png"
mode="widthFix"></image>
</template> </template>
</uv-cell> </uv-cell>
<uv-cell @click="clickMenu(2)" icon="setting-fill" isLink arrow-direction="right" title="实名认证" center> <uv-cell @click="clickMenu(2)" icon="setting-fill" isLink arrow-direction="right" title="实名认证" center>
<template v-slot:icon> <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>
<image style="width: 30rpx;"
src="https://tennis-oss.xzaiyp.top/2024-10-22/a57869c1-1451-47db-805d-8e29f5c37637.png"
mode="widthFix"></image>
</template> </template>
</uv-cell> </uv-cell>
<uv-cell @click="$store.commit('logout')" icon="setting-fill" isLink arrow-direction="right" title="退出登录" center>
<uv-cell @click="$store.commit('logout')" icon="setting-fill" isLink arrow-direction="right"
title="退出登录" center>
<template v-slot:icon> <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>
<image style="width: 30rpx;"
src="https://tennis-oss.xzaiyp.top/2024-10-22/a7f27701-49fe-4a1f-8171-19efb1af1102.png"
mode="widthFix"></image>
</template> </template>
</uv-cell> </uv-cell>
<uv-cell @click="clickMenu" icon="integral-fill" title="版本" value="版本1.0" center> <uv-cell @click="clickMenu" icon="integral-fill" title="版本" value="版本1.0" center>
<template v-slot:icon> <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>
<image style="width: 30rpx;"
src="https://tennis-oss.xzaiyp.top/2024-10-22/6878084d-4c1e-4577-8c8b-dd92aebbe2a2.png"
mode="widthFix"></image>
</template>
</uv-cell>
<uv-cell @click="setting"
v-if="userInfo.adminFlag"
icon="integral-fill" title="项目管理" isLink 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>
</template> </template>
</uv-cell> </uv-cell>
</uv-cell-group> </uv-cell-group>
@ -49,7 +67,9 @@
<script> <script>
import tabbar from '../../components/base/tabbar.vue' import tabbar from '../../components/base/tabbar.vue'
import { mapState } from 'vuex'
import {
mapState
} from 'vuex'
export default { export default {
name: "Center", name: "Center",
components: { components: {
@ -63,21 +83,37 @@
onShow() { onShow() {
this.$store.commit('getUserInfo') this.$store.commit('getUserInfo')
}, },
computed : {
computed: {
...mapState(['teamList', 'userInfo']), ...mapState(['teamList', 'userInfo']),
}, },
methods: { methods: {
clickMenu(index){
if(index == 1){
clickMenu(index) {
if (index == 1) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/subPack/record/record" url: "/pages/subPack/record/record"
}) })
}else if(index == 2){
} else if (index == 2) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/subPack/autonym/autonym" url: "/pages/subPack/autonym/autonym"
}) })
} }
}
},
setting(){
// 42.6511674, -73.754968
// uni.chooseLocation({
// latitude: 73.754968,
// longitude: 42.6511674,
// success(res) {
// uni.showModal({
// title: JSON.stringify(res)
// })
// }
// })
uni.navigateTo({
url: '/pages/subPack/projectManage/projectManage'
})
},
} }
} }
</script> </script>
@ -120,11 +156,11 @@
justify-content: space-around; justify-content: space-around;
box-sizing: border-box; box-sizing: border-box;
padding: 10rpx 0rpx 10rpx 10rpx; padding: 10rpx 0rpx 10rpx 10rpx;
.user-name { .user-name {
font-size: 36rpx; font-size: 36rpx;
} }
.user-project { .user-project {
font-size: 30rpx; font-size: 30rpx;
} }


+ 182
- 0
pages/subPack/projectManage/projectManage.vue View File

@ -0,0 +1,182 @@
<template>
<view class="page">
<uni-nav-bar dark :fixed="true" shadow background-color="var(--main-color)" status-bar left-icon="left"
title="项目管理" @clickLeft="$utils.navigateBack" />
<view class="list">
<view class="item"
:key="item.id"
v-for="(item, index) in list">
<view class="Work-List">
<view class="label">
项目名
</view>
<view class="text">
{{ item.name }}
</view>
</view>
<view class="Work-List">
<view class="label">
当前团队
</view>
<view class="text">
{{ item.teamId_dictText }}
</view>
</view>
<view class="Work-List">
<view class="label">
打卡地址
</view>
<view class="text">
{{ item.address }}
</view>
</view>
<view class="Work-List">
<view class="label">
维度
</view>
<view class="text">
{{ item.lat }}
</view>
</view>
<view class="Work-List">
<view class="label">
经度
</view>
<view class="text">
{{ item.lon }}
</view>
</view>
<view class="btns">
<view class="btn"
@click="openChooseLocation(item)">
设置打卡地点
</view>
</view>
</view>
</view>
<uv-action-sheet
ref="actionSheet"
:actions="actions"
@select="select"
@close="close">
</uv-action-sheet>
</view>
</template>
<script>
import mixinsList from '@/mixins/list.js'
export default {
mixins: [mixinsList],
data() {
return {
mixinsListApi : 'clockProjectList',
actions : [
// {
// name:'',
// },
{
name:'项目位置附近',
type : 'form'
},
{
name:'印度尼西亚',
lat : -6.1942,
lon : 106.82156,
},
{
name:'美国(纽约)',
lat: 42.6511674,
lon: -73.754968,
},
],
form : {},
}
},
methods: {
openChooseLocation(item){
this.form = item
this.$refs.actionSheet.open()
},
select(e){
if(e.lat && e.lon){
uni.chooseLocation({
longitude : e.lon, //
latitude : e.lat, //
success : res => this.setAddress(res)
})
}else if(e.type == 'form' && this.form.lat && this.form.lon){
uni.chooseLocation({
longitude : this.form.lon, //
latitude : this.form.lat, //
success : res => this.setAddress(res)
})
}else{
uni.chooseLocation({
success : res => this.setAddress(res)
})
}
},
setAddress(res){
this.$api('clockProjectLocation', {
id : this.form.id,
lat : res.latitude,
lon : res.longitude,
address : res.address,
},res => {
if(res.code == 200){
this.getData()
uni.showToast({
title: '修改成功',
icon: 'none'
})
}
})
},
close(){},
}
}
</script>
<style scoped lang="scss">
.page{
.list{
.item{
box-shadow: 0 0 10rpx 10rpx #00000009;
border-radius: 25rpx;
padding: 15rpx;
background-color: #fff;
font-size: 28rpx;
position: relative;
margin: 20rpx;
.Work-List{
display: flex;
padding: 20rpx 0rpx;
.label{
width: 150rpx;
flex-shrink: 0;
}
.text{
flex: 1;
}
}
.btns{
display: flex;
align-items: center;
justify-content: flex-end;
.btn{
border-radius: 20rpx;
padding: 20rpx;
margin: 10rpx;
background: $uni-color;
color: #fff;
text-align: center;
font-size: 24rpx;
}
}
}
}
}
</style>

+ 24
- 1
uni.scss View File

@ -12,7 +12,7 @@
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件 * 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/ */
/* 颜色变量 */ /* 颜色变量 */
$uni-color: #FD5100;
$uni-color: #4C9EEA;
/* 行为相关颜色 */ /* 行为相关颜色 */
$uni-color-primary: #007aff; $uni-color-primary: #007aff;
@ -84,4 +84,27 @@ $bg-color: white;
// 这个用于控制小程序的自定义导航栏等颜色 // 这个用于控制小程序的自定义导航栏等颜色
page{ page{
--main-color: #4C9EEA; --main-color: #4C9EEA;
}
.uni-color-btn{
border-radius: 40rpx;
padding: 20rpx;
margin: 40rpx;
background: $uni-color;
color: #fff;
text-align: center;
font-size: 28rpx;
}
.uni-uncolor-btn{
border-radius: 40rpx;
padding: 20rpx;
margin: 40rpx;
border: 1px solid $uni-color;
color: $uni-color;
text-align: center;
font-size: 28rpx;
} }

Loading…
Cancel
Save