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

291 lines
6.1 KiB

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