diff --git a/test_mini/app.js b/test_mini/app.js index 0adcdb0..af25636 100644 --- a/test_mini/app.js +++ b/test_mini/app.js @@ -24,7 +24,7 @@ App({ // var currentPage = pages[pages.length - 1] //获取当前页面的对象 // currentPage.showExp() - if(res.data.userinfo.username == null){ + if(res.data.userinfo.role_name == '游客'){ //匿名用户 wx.reLaunch({ url: '/pages/login/login', @@ -57,9 +57,9 @@ App({ globalData: { userInfo: {}, userinfo: {}, // 服务器传回的消费者信息 - //host: 'https://apitest.ahctc.cn', + host: 'https://apitest.ahctc.cn', mediahost: 'https://apitest.ahctc.cn', - host: 'http://127.0.0.1:8000', + //host: 'http://127.0.0.1:8000', //mediahost: 'http://127.0.0.1:8000', token : '', } diff --git a/test_mini/pages/my/index.js b/test_mini/pages/my/index.js index 29ef025..65a6815 100644 --- a/test_mini/pages/my/index.js +++ b/test_mini/pages/my/index.js @@ -73,7 +73,7 @@ Page({ }, register: function() { var that = this - if (!that.data.userinfo.username){ + if (that.data.userinfo.role_name=='游客'){ wx.reLaunch({ url: '/pages/login/login', }) diff --git a/test_mini/project.config.json b/test_mini/project.config.json index acd0dd0..ff08581 100644 --- a/test_mini/project.config.json +++ b/test_mini/project.config.json @@ -23,7 +23,8 @@ "disablePlugins": [], "outputPath": "" }, - "useCompilerModule": true, + "useIsolateContext": true, + "useCompilerModule": false, "userConfirmedUseCompilerModuleSwitch": false }, "compileType": "miniprogram", diff --git a/test_server/crm/views.py b/test_server/crm/views.py index 29dcbea..2ee17c3 100644 --- a/test_server/crm/views.py +++ b/test_server/crm/views.py @@ -230,6 +230,8 @@ class ConsumerViewSet(ModelViewSet): return Response({"error":"单位列错误!"}) if sheet['d2'].value != '工作类别': return Response({"error":"工作类别列错误!"}) + if sheet['e2'].value != '角色': + return Response({"error":"角色列错误!"}) companydict = {} companys = Company.objects.filter(is_delete=0) for i in companys: @@ -247,6 +249,7 @@ class ConsumerViewSet(ModelViewSet): companyname = companyname.replace(' ', '') companyobj = Company.objects.get_or_create(name=companyname)[0] workscope = sheet['d'+str(m)].value + role = sheet['e'+str(m)].value if Consumer.objects.filter(username = username).exists(): obj = Consumer.objects.filter(username = username).first() else: @@ -264,6 +267,13 @@ class ConsumerViewSet(ModelViewSet): except: return Response({"error":"工作类别不存在!"}) obj.role = role1 + if role: + role = role.replace(' ', '') + try: + roleobj = ConsumerRole.objects.get(name=role) + obj.role = roleobj + except: + pass obj.save() m = m + 1 return Response(status=status.HTTP_200_OK) diff --git a/test_server/media/muban/user.xlsx b/test_server/media/muban/user.xlsx index 6d9d625..9d78c9e 100644 Binary files a/test_server/media/muban/user.xlsx and b/test_server/media/muban/user.xlsx differ