【PT.SCC实名制管理系统】24.10.01 -30天,考勤打卡小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
6.1 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="home">
  3. <!-- 顶部背景 -->
  4. <view class="home-top">
  5. <image class="home-top-bg" src="https://tennis-oss.xzaiyp.top/2024-10-22/81f3569e-c60c-4945-bfc9-b0e976f26d8e.png" mode="widthFix"></image>
  6. </view>
  7. <!-- 卡片(地图) -->
  8. <view class="card">
  9. <view @click="openBroadside" class="team">
  10. <view class="change-icon">
  11. <image src="https://tennis-oss.xzaiyp.top/2024-10-22/4e624b94-e080-4ec4-86de-196ad83538a5.png" mode="widthFix"></image>
  12. </view>
  13. <view class="project">
  14. 高新区项目一队项目1
  15. </view>
  16. </view>
  17. <view class="map">
  18. <map style="width: 100%; height: 100%" :latitude="latitude" :longitude="longitude" :markers="covers" :scale="14">
  19. </map>
  20. </view>
  21. </view>
  22. <!-- 打卡按钮 -->
  23. <view class="punch-card">
  24. <view @click="callCard" class="circle">
  25. <view class="title">拍照打卡</view>
  26. <view class="time">{{ date.format('YYYY-MM-DD HH:mm:ss') }}</view>
  27. </view>
  28. </view>
  29. <!-- 签到记录 -->
  30. <div @click="toRecord" class="sign">
  31. <div class="sign-title">
  32. <image class="sign-title-img" src="https://tennis-oss.xzaiyp.top/2024-10-22/3d70c0d0-f298-4187-8b01-d809757f4049.png" mode="widthFix"></image>
  33. <div class="title">打卡记录</div>
  34. </div>
  35. <div class="project">
  36. <text class="project-name"
  37. v-if="userInfo.team">{{ userInfo.team.name }}</text>
  38. <uv-icon name="arrow-right" color="#000"></uv-icon>
  39. </div>
  40. </div>
  41. <!-- tab栏 -->
  42. <tabbar :select="0"></tabbar>
  43. <!-- 侧边栏 -->
  44. <broadside ref="broadside"></broadside>
  45. </view>
  46. </template>
  47. <script>
  48. import tabbar from '../../components/base/tabbar.vue'
  49. import broadside from '../../components/broadside/broadside.vue'
  50. import { mapState } from 'vuex'
  51. export default {
  52. name: "Home",
  53. components: {
  54. tabbar,
  55. broadside
  56. },
  57. data() {
  58. return {
  59. latitude: 39.909,
  60. longitude: 116.39742,
  61. covers: [],
  62. inter : null,
  63. date : this.$dayjs()
  64. }
  65. },
  66. computed : {
  67. ...mapState(['teamList', 'userInfo']),
  68. },
  69. onLoad() {
  70. this.inter = setInterval(() => {
  71. this.date = this.$dayjs()
  72. }, 1000)
  73. },
  74. onUnload() {
  75. clearInterval(this.inter)
  76. },
  77. onShow() {
  78. this.getLocation()
  79. this.$store.commit('getUserInfo')
  80. },
  81. methods: {
  82. // 跳转签到记录
  83. toRecord() {
  84. uni.navigateTo({
  85. url: "/pages/subPack/record/record"
  86. })
  87. },
  88. //打开侧边栏
  89. openBroadside() {
  90. this.$refs.broadside.open()
  91. },
  92. //获取用户位置
  93. getLocation() {
  94. let self = this;
  95. uni.getLocation({
  96. type: 'gcj02',
  97. success: function(res) {
  98. self.longitude = res.longitude;
  99. self.latitude = res.latitude;
  100. self.covers.push({
  101. id: 1,
  102. latitude: res.latitude,
  103. longitude: res.longitude,
  104. iconPath: 'https://tennis-oss.xzaiyp.top/2024-10-22/103fa1db-8524-45e6-8d00-c36a69977a5b.png',
  105. width: 30,
  106. height: 30
  107. })
  108. },
  109. fail() {
  110. self.checkAndRequestLocationPermission()
  111. }
  112. });
  113. },
  114. checkAndRequestLocationPermission() {
  115. let self = this;
  116. uni.getSetting({
  117. success: function(res) {
  118. if (!res.authSetting['scope.userLocation']) {
  119. // 用户未授权定位权限
  120. uni.showModal({
  121. title: '提示',
  122. content: '当前定位未开启,请点击确定手动开启定位',
  123. success: function(modalRes) {
  124. if (modalRes.confirm) {
  125. // 用户选择确认开启定位
  126. uni.openSetting({
  127. success: function(settingRes) {
  128. if (settingRes.authSetting[
  129. 'scope.userLocation']) {
  130. // 重新获取位置信息
  131. self.getLocation();
  132. } else {
  133. // 用户未开启定位权限
  134. console.log('用户未开启定位权限');
  135. }
  136. },
  137. fail: function(err) {
  138. console.log('打开设置页面失败:', err);
  139. }
  140. });
  141. } else {
  142. // 用户选择取消
  143. self.getLocation()
  144. }
  145. }
  146. });
  147. } else {
  148. // 用户已授权定位权限但获取位置失败(可能是设备未开启定位服务)
  149. console.log('用户已授权定位权限,但获取位置失败');
  150. // 可以提示用户检查设备定位服务是否开启
  151. }
  152. }
  153. });
  154. },
  155. //打卡(跳转人脸识别)
  156. callCard(){
  157. uni.navigateTo({
  158. url: "/pages/subPack/human/human"
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .home {
  166. background: $bg-color;
  167. min-height: 100vh;
  168. // 顶部背景
  169. .home-top {
  170. height: 490rpx;
  171. overflow: hidden;
  172. .home-top-bg {
  173. width: 750rpx;
  174. }
  175. }
  176. // 卡片(地图)
  177. .card {
  178. width: 95%;
  179. margin: -340rpx auto 0rpx auto;
  180. position: relative;
  181. .team {
  182. display: flex;
  183. margin: 15rpx 0rpx;
  184. color: white;
  185. font-size: 34rpx;
  186. .change-icon {
  187. display: flex;
  188. align-items: center;
  189. width: 40rpx;
  190. margin-right: 10rpx;
  191. image {
  192. width: 100%;
  193. }
  194. }
  195. }
  196. .map {
  197. height: 350rpx;
  198. background: $main-color;
  199. border-radius: 20rpx;
  200. overflow: hidden;
  201. }
  202. }
  203. //打卡按钮
  204. .punch-card {
  205. display: flex;
  206. justify-content: center;
  207. margin: 60rpx 0rpx;
  208. .circle {
  209. display: flex;
  210. flex-direction: column;
  211. justify-content: center;
  212. align-items: center;
  213. width: 370rpx;
  214. height: 370rpx;
  215. border-radius: 50%;
  216. background: $main-color;
  217. color: white;
  218. .title {
  219. font-size: 36rpx;
  220. }
  221. .time {
  222. font-size: 30rpx;
  223. margin-top: 20rpx;
  224. }
  225. }
  226. }
  227. // 签到记录
  228. .sign {
  229. display: flex;
  230. flex-wrap: wrap;
  231. width: 90%;
  232. margin: 0rpx auto;
  233. background: white;
  234. border-radius: 15rpx;
  235. box-sizing: border-box;
  236. padding: 30rpx 30rpx 30rpx 20rpx;
  237. box-shadow: 0rpx 0rpx 10rpx rgba(0, 0, 0, .1);
  238. .sign-title {
  239. display: flex;
  240. width: 30%;
  241. .sign-title-img {
  242. width: 40rpx;
  243. margin-right: 15rpx;
  244. }
  245. .title {}
  246. }
  247. .project {
  248. display: flex;
  249. width: 70%;
  250. justify-content: space-between;
  251. .project-name {
  252. color: $main-color;
  253. }
  254. }
  255. }
  256. }
  257. </style>