t-i-navbar.vue 8.9 KB

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