t-i-navbar.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. uni.request({
  118. url: "http://webdevelop.nxjiewei.com/assets/html/zhks-quankuang/weather.php",
  119. method: "GET",
  120. success: (res) => {
  121. // console.log(res.data)
  122. this.temperature_curr = res.data.text + "℃"
  123. }
  124. })
  125. // 登录签到
  126. this.add_staff_integral_increase()
  127. //查询员工积分
  128. this.get_staff_integral_query()
  129. },
  130. methods: {
  131. switch_kuang() {
  132. uni.navigateTo({
  133. url: "../../index/switch-kuang/switch-kuang"
  134. })
  135. },
  136. go_search() {
  137. uni.navigateTo({
  138. url: "../../index/search/search?mine_code=" + this.mine_code,
  139. animationType: "fade-in",
  140. animationDuration: 500
  141. })
  142. },
  143. scan() {
  144. // 只允许通过相机扫码
  145. uni.scanCode({
  146. onlyFromCamera: true,
  147. success: (res)=> {
  148. console.log('条码类型:' + res.scanType);
  149. console.log('条码内容:' + res.result);
  150. let pageId = ""
  151. function GetQueryString(name) {
  152. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  153. var r = res.result.match(reg);
  154. if (r != null) return unescape(r[2]);
  155. return null;
  156. }
  157. console.log(GetQueryString("pageId"))
  158. if (GetQueryString("pageId")) {
  159. pageId = GetQueryString("pageId")
  160. } else {
  161. pageId = res.result.split('=')[1]
  162. }
  163. uni.navigateTo({
  164. url: "../../index/record/record?pageId=" + pageId + "&mine_code=" + this.mine_code,
  165. })
  166. }
  167. })
  168. },
  169. // 添加员工积分 登录签到
  170. add_staff_integral_increase() {
  171. this.$api.staff_integral_increase({
  172. staff_num: uni.getStorageSync('user').staff_num,
  173. integral_type: 1,
  174. integral_num: 1
  175. }).then((res) => {
  176. // console.log(res)
  177. if (res.data.content.is_exists == 0) {
  178. uni.showToast({
  179. icon: "none",
  180. title: "签到成功!"
  181. })
  182. }
  183. })
  184. },
  185. //查询员工积分
  186. get_staff_integral_query() {
  187. this.$api.staff_integral_query({
  188. staff_num: uni.getStorageSync('user').staff_num
  189. }).then((res) => {
  190. // console.log(res)
  191. this.total = res.data.content.data.integral_sum
  192. })
  193. },
  194. // 积分详情
  195. go_integral() {
  196. uni.navigateTo({
  197. url: "../../index/integral/integral?total=" + this.total
  198. })
  199. },
  200. // 天气
  201. go_tianqi() {
  202. // uni.navigateTo({
  203. // url: "../../index/h5/h5?url=https://xw.tianqi.qq.com/"
  204. // })
  205. uni.navigateTo({
  206. url: "../../index/weather/weather"
  207. })
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="scss">
  213. .content {
  214. position: fixed;
  215. top: 0;
  216. left: 0;
  217. z-index: 999;
  218. width: 750rpx;
  219. // background-image: url(./icon/bg_img.jpg);
  220. background-size: 750rpx 334rpx;
  221. background-repeat: no-repeat;
  222. }
  223. .navbar {
  224. box-sizing: border-box;
  225. padding: 10rpx 25rpx;
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. height: 88rpx;
  230. .left {
  231. display: flex;
  232. align-items: center;
  233. width: 170rpx;
  234. image {
  235. width: 165rpx;
  236. height: 48rpx;
  237. margin-right: 10rpx;
  238. }
  239. }
  240. .search {
  241. // width: 370rpx;
  242. width: 550rpx;
  243. .box {
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. height: 68rpx;
  248. background-color: rgba(255, 255, 255, .4);
  249. border-radius: 50rpx;
  250. box-sizing: border-box;
  251. padding: 0 20rpx;
  252. .left {
  253. display: flex;
  254. height: 68rpx;
  255. width: 300rpx;
  256. .icon {
  257. image {
  258. width: 21rpx;
  259. height: 21rpx;
  260. }
  261. }
  262. .text {
  263. color: #FFFFFF;
  264. font-size: 24rpx;
  265. }
  266. }
  267. .scan {
  268. width: 68rpx;
  269. text-align: right;
  270. line-height: 68rpx;
  271. image {
  272. width: 27rpx;
  273. height: 25rpx;
  274. }
  275. }
  276. }
  277. }
  278. .right {
  279. white-space: nowrap;
  280. color: #FFFFFF;
  281. font-size: 24rpx;
  282. width: 124rpx;
  283. margin-left: 20rpx;
  284. border-left: 2rpx solid #FFFFFF;
  285. box-sizing: border-box;
  286. padding-left: 20rpx;
  287. height: 40rpx;
  288. .box {
  289. width: 124rpx;
  290. height: 40rpx;
  291. .item {
  292. display: flex;
  293. align-items: center;
  294. .icon {
  295. margin-right: 10rpx;
  296. image {
  297. width: 40rpx;
  298. height: 40rpx;
  299. }
  300. }
  301. .num {
  302. color: #FFFFFF;
  303. font-size: 24rpx;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. </style>