shangtang.vue 1.7 KB

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