workerList.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view>
  3. <view class="titlelist" style="position: relative;" v-for="weixin in weixinList" :key="weixin.id">
  4. <uni-list-item :title="weixin.workName" @click="tranByWorkName(weixin.id,weixin.workName)"></uni-list-item>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
  10. export default {
  11. components: {
  12. uniListItem,
  13. },
  14. data() {
  15. return {
  16. weixinList:[]
  17. }
  18. },
  19. onShow() {
  20. this.globalUser = uni.getStorageSync("globalUser");
  21. var token = uni.getStorageSync("token");
  22. this.level = uni.getStorageSync("level");
  23. if (token.length > 1) {
  24. this.worker();
  25. } else {
  26. uni.reLaunch({
  27. url: '../Login/Login',
  28. });
  29. }
  30. },
  31. methods: {
  32. worker(){
  33. var newparm = uni.getStorageSync("newparm");
  34. if (newparm.toString().length > 1) {
  35. if (newparm.openId.length > 1) {
  36. var that = this;
  37. var serverUrl = that.serverurl;
  38. var token = uni.getStorageSync("token");
  39. var openId = newparm.openId;
  40. uni.request({
  41. url: serverUrl + "/TWeixin/getWeixinList?openId="+openId,
  42. method: "GET",
  43. header: {
  44. 'token': token
  45. },
  46. success: (Result) => {
  47. var res = Result;
  48. if (res.data.code == true) {
  49. this.weixinList = res.data.data;
  50. } else {
  51. uni.showModal({
  52. title: '提示',
  53. content: res.data.message,
  54. });
  55. }
  56. }
  57. });
  58. }
  59. }
  60. },
  61. tranByWorkName(id,workName){
  62. uni.navigateTo({
  63. url: './worker?id='+ id + "&workName= "+workName
  64. });
  65. }
  66. }
  67. }
  68. </script>
  69. <style>
  70. .titlelist {
  71. color: #363D44;
  72. font-size: 16upx;
  73. font-family: "PingFang-SC-Medium";
  74. }
  75. </style>