diff --git a/test_client/src/api/crm.js b/test_client/src/api/crm.js
index 8ce4497..dd1a3f5 100644
--- a/test_client/src/api/crm.js
+++ b/test_client/src/api/crm.js
@@ -77,4 +77,10 @@ export function exportConsumer(query) {
method: 'get',
params: query
})
+}
+export function unbindConsumer(id) {
+ return request({
+ url: `/crm/consumer/${id}/unbind`,
+ method: 'get',
+ })
}
\ No newline at end of file
diff --git a/test_client/src/api/user.js b/test_client/src/api/user.js
index 294797f..a72fe94 100644
--- a/test_client/src/api/user.js
+++ b/test_client/src/api/user.js
@@ -63,3 +63,5 @@ export function deleteUser(id, data) {
data
})
}
+
+
diff --git a/test_client/src/views/crm/consumer.vue b/test_client/src/views/crm/consumer.vue
index 1968abd..42505ec 100644
--- a/test_client/src/views/crm/consumer.vue
+++ b/test_client/src/views/crm/consumer.vue
@@ -132,7 +132,7 @@
{{ scope.row.create_time }}
-
+
+ 解绑微信
@@ -231,7 +238,8 @@ import {
updateConsumer,
importConsumer,
exportConsumer,
- deleteConsumers
+ deleteConsumers,
+ unbindConsumer
} from "@/api/crm";
import { getSubjectAll } from "@/api/question";
import { getWorkScopeAll } from "@/api/examtest";
@@ -399,6 +407,19 @@ export default {
this.$refs["consumerForm"].clearValidate();
});
},
+ handleUnbind(scope) {
+ unbindConsumer(scope.row.id).then(res => {
+ if(res.code>=200){
+ this.$message({
+ type: "success",
+ message: "解绑成功!"
+ });
+ this.getList()
+ }
+ }).catch(err => {
+ console.error(err)
+ })
+ },
handleDelete(scope) {
this.$confirm("确认删除该用户吗?将丢失数据!", "警告", {
confirmButtonText: "确认",
diff --git a/test_client/src/views/news/news.vue b/test_client/src/views/news/news.vue
index c9df686..1e3fa62 100644
--- a/test_client/src/views/news/news.vue
+++ b/test_client/src/views/news/news.vue
@@ -48,7 +48,7 @@
{{ scope.row.update_time }}
-
+
-
+
diff --git a/test_mini/pages/main/main.js b/test_mini/pages/main/main.js
index dbd79a7..6a8d940 100644
--- a/test_mini/pages/main/main.js
+++ b/test_mini/pages/main/main.js
@@ -17,7 +17,7 @@ Page({
nowWork:null,
msgList: [
{ title: "欢迎使用中科辐射学堂!" },
- { title: "如有疑问,请致电课程顾问师老师:18355135390" },]
+ { title: "如有疑问,请致电课程顾问" },]
},
imgH: function (e) {
let winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度
@@ -107,10 +107,17 @@ Page({
url: '/pages/lianxi/index',
})
}else{
- wx.showToast({
- title: '未开通权限\r\n请致电18355135390',
- icon: 'none',
- duration: 2000
+ wx.showModal({
+ title: '暂未开通权限!',
+ content: '查看各地区课程顾问联系方式。',
+ confirmText: '查看',
+ success(res) {
+ if (res.confirm) {
+ wx.navigateTo({
+ url: '/pages/article/detail?id=6',
+ })
+ }
+ }
})
}
},
@@ -166,10 +173,17 @@ Page({
url: '/pages/yati/index',
})
} else {
- wx.showToast({
- title: '未开通权限\r\n请联系课程顾问',
- icon: 'none',
- duration: 2000
+ wx.showModal({
+ title: '暂未开通权限!',
+ content: '查看各地区课程顾问联系方式。',
+ confirmText: '查看',
+ success(res) {
+ if (res.confirm) {
+ wx.navigateTo({
+ url: '/pages/article/detail?id=6',
+ })
+ }
+ }
})
}
},
diff --git a/test_mini/pages/my/index.wxml b/test_mini/pages/my/index.wxml
index 69f8b41..f00aeb4 100644
--- a/test_mini/pages/my/index.wxml
+++ b/test_mini/pages/my/index.wxml
@@ -50,7 +50,7 @@
diff --git a/test_server/crm/views.py b/test_server/crm/views.py
index 8e02da2..a7abf9c 100644
--- a/test_server/crm/views.py
+++ b/test_server/crm/views.py
@@ -244,6 +244,18 @@ class ConsumerViewSet(ModelViewSet):
path = export_consumer(serializer.data)
return Response({'path': path})
+ @action(methods=['get'], detail=True, url_name='consumer_unbind', perms_map=[{'*':'consumer_unbind'}])
+ def unbind(self, request, *args, **kwargs):
+ obj = self.get_object()
+ if obj.username and obj.openid:
+ obj.openid = None
+ obj.nickname = None
+ obj.avatar = None
+ obj.save()
+ return Response(status=status.HTTP_200_OK)
+ else:
+ return Response({"error":"不支持解绑!"})
+
class ConsumerMPLoginView(APIView):
"""
小程序登陆颁发token
diff --git a/test_server/examtest/views.py b/test_server/examtest/views.py
index 7b7949f..704c924 100644
--- a/test_server/examtest/views.py
+++ b/test_server/examtest/views.py
@@ -246,7 +246,7 @@ class ExamTestViewSet(ModelViewSet):
queryset = ExamTest.objects.filter(consumer=request.user)
ret = {}
ret['total'] = queryset.count()
- ret['avg_score'] = round(queryset.aggregate(avg=Avg('score'))['avg'])
+ ret['avg_score'] = round(queryset.aggregate(avg=Avg('score'))['avg']) if ret['total'] else 0
ret['pass_rate'] = round(((queryset.filter(is_pass=True).count())/ret['total'])*100) if ret['total'] else 0
return Response(ret)
diff --git a/test_server/server/settings.py b/test_server/server/settings.py
index 65e0fcf..54baaa3 100644
--- a/test_server/server/settings.py
+++ b/test_server/server/settings.py
@@ -174,4 +174,4 @@ MEDIA_URL = '/media/'
## 以下需要根据loonlfow的启动地址,apptoken中的应用及token做相应修改
WORKFLOW_URL = "http://127.0.0.1:8888"
WORKFLOW_TOKEN = "716a22f8-5d58-11ea-a5c7-1063c8f02116"
-WORKFLOW_APP="oa"
\ No newline at end of file
+WORKFLOW_APP="oa"
diff --git a/test_server/server/urls.py b/test_server/server/urls.py
index 53dbe33..ffcfa08 100644
--- a/test_server/server/urls.py
+++ b/test_server/server/urls.py
@@ -38,4 +38,4 @@ urlpatterns = [
path('redirect/',redirect),
path('admin/', admin.site.urls),
path('docs/', include_docs_urls(title="答题平台接口文档",authentication_classes=[], permission_classes=[])),
-]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)