t-i-navbar-2.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. if(res.result.indexOf('?') != -1){
  157. uni.navigateTo({
  158. url: "../../index/record/record?pageId=" + pageId + "&mine_code=" + this.mine_code,
  159. })
  160. }else{
  161. uni.navigateTo({
  162. url: "../../index/h5/h5?url=" + res.result
  163. })
  164. }
  165. }
  166. })
  167. },
  168. // 添加员工积分 登录签到
  169. add_staff_integral_increase() {
  170. this.$api.staff_integral_increase({
  171. staff_num: uni.getStorageSync('user').staff_num,
  172. integral_type: 1,
  173. integral_num: 1
  174. }).then((res) => {
  175. // console.log(res)
  176. if (res.data.content.is_exists == 0) {
  177. uni.showToast({
  178. icon: "none",
  179. title: "签到成功!"
  180. })
  181. }
  182. })
  183. },
  184. //查询员工积分
  185. get_staff_integral_query() {
  186. this.$api.staff_integral_query({
  187. staff_num: uni.getStorageSync('user').staff_num
  188. }).then((res) => {
  189. // console.log(res)
  190. this.total = res.data.content.data.integral_sum
  191. })
  192. },
  193. // 积分详情
  194. go_integral() {
  195. uni.navigateTo({
  196. url: "../../index/integral/integral?total=" + this.total
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss">
  203. .content {
  204. position: fixed;
  205. top: 0;
  206. left: 0;
  207. z-index: 999;
  208. width: 750rpx;
  209. background-image: url(./icon/bg_img.jpg);
  210. background-size: 750rpx 334rpx;
  211. background-repeat: no-repeat;
  212. }
  213. .navbar {
  214. box-sizing: border-box;
  215. padding: 10rpx 25rpx;
  216. display: flex;
  217. align-items: center;
  218. justify-content: space-between;
  219. height: 88rpx;
  220. .left {
  221. display: flex;
  222. align-items: center;
  223. width: 170rpx;
  224. image {
  225. width: 165rpx;
  226. height: 48rpx;
  227. margin-right: 10rpx;
  228. }
  229. }
  230. .search {
  231. width: 370rpx;
  232. .box {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. height: 68rpx;
  237. background-color: rgba(255, 255, 255, .4);
  238. border-radius: 50rpx;
  239. box-sizing: border-box;
  240. padding: 0 20rpx;
  241. .left {
  242. display: flex;
  243. height: 68rpx;
  244. width: 300rpx;
  245. .icon {
  246. image {
  247. width: 21rpx;
  248. height: 21rpx;
  249. }
  250. }
  251. .text {
  252. color: #FFFFFF;
  253. font-size: 24rpx;
  254. }
  255. }
  256. .scan {
  257. width: 68rpx;
  258. text-align: right;
  259. line-height: 68rpx;
  260. image {
  261. width: 27rpx;
  262. height: 25rpx;
  263. }
  264. }
  265. }
  266. }
  267. .right {
  268. white-space: nowrap;
  269. color: #FFFFFF;
  270. font-size: 24rpx;
  271. width: 124rpx;
  272. margin-left: 20rpx;
  273. border-left: 2rpx solid #FFFFFF;
  274. box-sizing: border-box;
  275. padding-left: 20rpx;
  276. height: 40rpx;
  277. .box {
  278. width: 124rpx;
  279. height: 40rpx;
  280. .item {
  281. display: flex;
  282. align-items: center;
  283. .icon {
  284. margin-right: 10rpx;
  285. image {
  286. width: 40rpx;
  287. height: 40rpx;
  288. }
  289. }
  290. .num {
  291. color: #FFFFFF;
  292. font-size: 24rpx;
  293. }
  294. }
  295. }
  296. }
  297. }
  298. </style>