【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.

272 lines
5.7 KiB

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