t-i-navbar.vue 8.4 KB

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