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

292 lines
6.1 KiB

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