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

283 lines
6.0 KiB

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