shangtang.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. let mine_code = uni.getStorageSync('mine_code')
  18. if(mine_code == 'ningdongyunying'){
  19. this.mine_code = "ningdongyunying"
  20. }else if(mine_code == 'jinjiaqu' || mine_code == 'jinjiaqu_neiwang'){
  21. this.mine_code = "640323B0011010019259"
  22. }
  23. this.get_token()
  24. },
  25. methods:{
  26. get_token(){
  27. uni.request({
  28. // 登录 获取token
  29. method:"POST",
  30. url: "http://shangtang.jinjiaqu.nxjiewei.com:8011/v1/app/token/get",
  31. header:{
  32. "Content-Type": "application/json"
  33. },
  34. data: {
  35. staff_num: this.staff_num,
  36. area_code: this.mine_code
  37. },
  38. success: (res) => {
  39. console.log(res)
  40. if(res.data.code == 0){
  41. console.log(res.data.data)
  42. // 金家渠
  43. this.href = "http://shangtang.jinjiaqu.nxjiewei.com:8011/h5/index.html?token=" + res.data.data.access_token
  44. }else{
  45. uni.showToast({
  46. icon:"none",
  47. title:"身份信息验证失败!"
  48. })
  49. }
  50. },
  51. fail: (err) => {
  52. uni.showToast({
  53. icon:"none",
  54. title:err
  55. })
  56. }
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. </style>