t-i-navbar-2.vue 8.6 KB

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