t-i-navbar.vue 9.3 KB

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