role导入
This commit is contained in:
parent
99bf3e5b4b
commit
323c4189e9
|
@ -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 : '',
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
})
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"useCompilerModule": true,
|
||||
"useIsolateContext": true,
|
||||
"useCompilerModule": false,
|
||||
"userConfirmedUseCompilerModuleSwitch": false
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
|
|
|
@ -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)
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue