shangtang.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view>
  3. <web-view :src="href"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. href: "",
  11. staff_num:"",
  12. mine_code:""
  13. };
  14. },
  15. onLoad() {
  16. this.staff_num = uni.getStorageSync('user').staff_num
  17. // this.mine_code = uni.getStorageSync('mine_code')
  18. let mine_code = uni.getStorageSync('mine_code')
  19. if(mine_code == 'ningdongyunying'){
  20. this.mine_code = "ningdongyunying"
  21. }else if(mine_code == 'jinjiaqu'){
  22. this.mine_code = "640323B0011010019259"
  23. }
  24. this.get_token()
  25. },
  26. methods:{
  27. get_token(){
  28. uni.request({
  29. // 登录 获取token
  30. method:"POST",
  31. url: "http://shangtang.nxjiewei.com:8011/v1/app/token/get",
  32. header:{
  33. "Content-Type": "application/json"
  34. },
  35. data: {
  36. staff_num: this.staff_num,
  37. area_code: this.mine_code
  38. },
  39. success: (res) => {
  40. console.log(res.data.data)
  41. this.href = "http://shangtang.nxjiewei.com:8011/?token=" + res.data.data.access_token
  42. },
  43. fail: (err) => {
  44. uni.showToast({
  45. icon:"none",
  46. title:err
  47. })
  48. }
  49. })
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. </style>