t-i-navbar-2.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="status_bar">
  5. <!-- 这里是状态栏 -->
  6. </view>
  7. <view class="navbar">
  8. <view class="left" @click="switch_kuang()">
  9. <image v-if="mine_code == 'ningdongyunying'" src="./icon/ningdongyunying.png" mode=""></image>
  10. <image v-if="mine_code == 'zaoquan'" src="./icon/zaoquan.png" mode=""></image>
  11. <image v-if="mine_code == 'yangchangwan'" src="@/static/switch-kuang/yangchangwan.png" mode=""></image>
  12. <image v-if="mine_code == 'meihuajing'" src="@/static/switch-kuang/meihuajing.png" mode=""></image>
  13. <image v-if="mine_code == 'jinfeng' || mine_code == 'jinfeng_neiwang'" src="@/static/switch-kuang/jinfeng.png" mode=""></image>
  14. <image v-if="mine_code == 'xixuan'" src="@/static/switch-kuang/xixuan.png" mode=""></image>
  15. <image v-if="mine_code == 'qingshuiying'" src="@/static/switch-kuang/qingshuiying.png" mode=""></image>
  16. <image v-if="mine_code == 'wuyegongsi'" src="@/static/switch-kuang/wuyegongsi.png" mode=""></image>
  17. <image v-if="mine_code == 'jinjiaqu' || mine_code == 'jinjiaqu_neiwang'" src="@/static/switch-kuang/jinjiaqu.png" mode=""></image>
  18. <image v-if="mine_code == 'shicaocun'" src="@/static/switch-kuang/shicaocun.png" mode=""></image>
  19. <uni-icons type="arrowdown" color="#fff"></uni-icons>
  20. </view>
  21. <!-- <view class="left">
  22. <image v-if="mine_code == 'zaoquan'" src="./icon/zaoquan.png" mode=""></image>
  23. <image v-if="mine_code == 'yangchangwan'" src="@/static/switch-kuang/yangchangwan.png" mode=""></image>
  24. <image v-if="mine_code == 'meihuajing'" src="@/static/switch-kuang/meihuajing.png" mode=""></image>
  25. <image v-if="mine_code == 'jinfeng' || mine_code == 'jinfeng_neiwang'" src="@/static/switch-kuang/jinfeng.png" mode=""></image>
  26. <image v-if="mine_code == 'xixuan'" src="@/static/switch-kuang/xixuan.png" mode=""></image>
  27. <image v-if="mine_code == 'qingshuiying'" src="@/static/switch-kuang/qingshuiying.png" mode=""></image>
  28. <image v-if="mine_code == 'wuyegongsi'" src="@/static/switch-kuang/wuyegongsi.png" mode=""></image>
  29. <image v-if="mine_code == 'jinjiaqu' || mine_code == 'jinjiaqu_neiwang'" src="@/static/switch-kuang/jinjiaqu.png" mode=""></image>
  30. <image v-if="mine_code == 'shicaocun'" src="@/static/switch-kuang/shicaocun.png" mode=""></image>
  31. </view> -->
  32. <view class="search" v-if="mine_code != 'qingshuiying' && mine_code != 'wuyegongsi'">
  33. <view class="box">
  34. <view class="left" @click="go_search()">
  35. <view class="icon">
  36. <image src="./icon/search.png" mode=""></image>
  37. </view>
  38. <view class="text">搜索</view>
  39. </view>
  40. <view class="scan" @click="scan()">
  41. <image src="./icon/saoma.png" mode=""></image>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="right">
  46. <swiper class="box" autoplay circular vertical :interval="4000" :duration="1000">
  47. <swiper-item class="item">
  48. <view class="icon">
  49. <image src="./icon/day.png" mode=""></image>
  50. </view>
  51. <view class="num">{{temperature_curr}}</view>
  52. </swiper-item>
  53. <swiper-item class="item" @click="go_integral()">
  54. <view class="icon" style="margin-right: 4rpx;">
  55. 积分
  56. </view>
  57. <view class="num">{{total}} 分</view>
  58. </swiper-item>
  59. </swiper>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="status_bar"></view>
  64. <view style="height: 88rpx;"></view>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. name: "t-i-navbar-2",
  70. props: [
  71. "mine_code",
  72. "navbar_bg_color"
  73. ],
  74. data() {
  75. return {
  76. // 当前温度
  77. temperature_curr: "",
  78. // 总积分
  79. total: 0
  80. };
  81. },
  82. created() {
  83. // 当前温度
  84. uni.request({
  85. url: "http://api.k780.com/?app=weather.today&weaId=286&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json",
  86. method: "GET",
  87. success: (res) => {
  88. // console.log(res.data.result.temperature_curr)
  89. this.temperature_curr = res.data.result.temperature_curr
  90. }
  91. })
  92. // 登录签到
  93. this.add_staff_integral_increase()
  94. //查询员工积分
  95. this.get_staff_integral_query()
  96. },
  97. methods: {
  98. switch_kuang() {
  99. uni.navigateTo({
  100. url: "../../index/switch-kuang/switch-kuang"
  101. })
  102. },
  103. go_search() {
  104. uni.navigateTo({
  105. url: "../../index/search/search?mine_code=" + this.mine_code,
  106. animationType: "fade-in",
  107. animationDuration: 500
  108. })
  109. },
  110. scan() {
  111. // 只允许通过相机扫码
  112. uni.scanCode({
  113. onlyFromCamera: true,
  114. success: function(res) {
  115. // console.log('条码类型:' + res.scanType);
  116. // console.log('条码内容:' + res.result);
  117. let pageId = ""
  118. function GetQueryString(name) {
  119. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  120. var r = res.match(reg);
  121. if (r != null) return unescape(r[2]);
  122. return null;
  123. }
  124. console.log(GetQueryString("pageId"))
  125. if (GetQueryString("pageId")) {
  126. pageId = GetQueryString("pageId")
  127. } else {
  128. pageId = res.split('=')[1]
  129. }
  130. uni.navigateTo({
  131. url: "../../index/record/record?pageId=" + pageId + "&mine_code=" + this
  132. .mine_code,
  133. })
  134. }
  135. })
  136. },
  137. // 添加员工积分 登录签到
  138. add_staff_integral_increase() {
  139. this.$api.staff_integral_increase({
  140. staff_num: uni.getStorageSync('user').staff_num,
  141. integral_type: 1,
  142. integral_num: 1
  143. }).then((res) => {
  144. // console.log(res)
  145. if (res.data.content.is_exists == 0) {
  146. uni.showToast({
  147. icon: "none",
  148. title: "签到成功!"
  149. })
  150. }
  151. })
  152. },
  153. //查询员工积分
  154. get_staff_integral_query() {
  155. this.$api.staff_integral_query({
  156. staff_num: uni.getStorageSync('user').staff_num
  157. }).then((res) => {
  158. // console.log(res)
  159. this.total = res.data.content.data.integral_sum
  160. })
  161. },
  162. // 积分详情
  163. go_integral() {
  164. uni.navigateTo({
  165. url: "../../index/integral/integral?total=" + this.total
  166. })
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss">
  172. .content {
  173. position: fixed;
  174. top: 0;
  175. left: 0;
  176. z-index: 999;
  177. width: 750rpx;
  178. background-image: url(./icon/bg_img.jpg);
  179. background-size: 750rpx 334rpx;
  180. background-repeat: no-repeat;
  181. }
  182. .navbar {
  183. box-sizing: border-box;
  184. padding: 10rpx 25rpx;
  185. display: flex;
  186. align-items: center;
  187. justify-content: space-between;
  188. height: 88rpx;
  189. .left {
  190. display: flex;
  191. align-items: center;
  192. width: 170rpx;
  193. image {
  194. width: 165rpx;
  195. height: 48rpx;
  196. margin-right: 10rpx;
  197. }
  198. }
  199. .search {
  200. width: 370rpx;
  201. .box {
  202. display: flex;
  203. justify-content: space-between;
  204. align-items: center;
  205. height: 68rpx;
  206. background-color: rgba(255, 255, 255, .4);
  207. border-radius: 50rpx;
  208. box-sizing: border-box;
  209. padding: 0 20rpx;
  210. .left {
  211. display: flex;
  212. height: 68rpx;
  213. width: 300rpx;
  214. .icon {
  215. image {
  216. width: 21rpx;
  217. height: 21rpx;
  218. }
  219. }
  220. .text {
  221. color: #FFFFFF;
  222. font-size: 24rpx;
  223. }
  224. }
  225. .scan {
  226. width: 68rpx;
  227. text-align: right;
  228. line-height: 68rpx;
  229. image {
  230. width: 27rpx;
  231. height: 25rpx;
  232. }
  233. }
  234. }
  235. }
  236. .right {
  237. white-space: nowrap;
  238. color: #FFFFFF;
  239. font-size: 24rpx;
  240. width: 124rpx;
  241. margin-left: 20rpx;
  242. border-left: 2rpx solid #FFFFFF;
  243. box-sizing: border-box;
  244. padding-left: 20rpx;
  245. height: 40rpx;
  246. .box {
  247. width: 124rpx;
  248. height: 40rpx;
  249. .item {
  250. display: flex;
  251. align-items: center;
  252. .icon {
  253. margin-right: 10rpx;
  254. image {
  255. width: 40rpx;
  256. height: 40rpx;
  257. }
  258. }
  259. .num {
  260. color: #FFFFFF;
  261. font-size: 24rpx;
  262. }
  263. }
  264. }
  265. }
  266. }
  267. </style>