chb 2 жил өмнө
parent
commit
cfe9e8affb

+ 15 - 1
mixin/questionMixin.js

@@ -43,6 +43,7 @@ export default {
                     has_apply:false
                 }
             }, *///无权限用户信息
+		    updateHasApply:false
         }
     },
     computed:{
@@ -298,13 +299,26 @@ export default {
             this.pupData.show = true
         },
         //拨号
-        handleCallPhone(tel) {
+        async handleCallPhone(tel) {
             uni.makePhoneCall({
                 phoneNumber: tel ? tel : ' ',
                 success: () => {
                     this.pupData.show = false
                 }
             });
+            if(!this.noAuthInfo.customer_info.has_apply && !this.updateHasApply){
+                // 请求申请
+                const res = await apiApplyPermission({
+                    company_name: this.noAuthInfo.customer_info.company_name,
+                    real_name: this.noAuthInfo.customer_info.name,
+                    source: 5,
+                    from_page: '问答社区'
+                })
+                if (res.code === 200) {
+                    this.updateHasApply = true
+                    console.log('自动申请成功');
+                }
+            }
         },
         //弹窗申请权限
         async handleApply() {

+ 11 - 2
pages-question/answerDetail.vue

@@ -245,6 +245,7 @@
 import mixin from "../mixin/questionMixin";
 import { apiReplayAsk, apiGetQuestion, apiSetRead,apiCountAudioClick } from "@/api/question";
 import { apiApplyPermission} from '@/api/user';
+import {apiGetSceneToParams} from "../api/common.js"
 import { uploadAudioToServer } from "@/utils/upload";
 export default {
   mixins: [mixin],
@@ -287,9 +288,17 @@ export default {
 			}, *///mock用户信息
     };
   },
-  onLoad(options) {
+  async onLoad(options) {
     this.initAudio();
-    this.getQuestionItem(options.id);
+		let obj={}
+		if(options.scene){
+			// 小程序码进来的
+			let res = await apiGetSceneToParams({scene_key:options.scene})
+			if(res.code==200){
+				obj=JSON.parse(res.data)
+			}
+		}
+    this.getQuestionItem(obj.id || options.id);
   },
   onShow(){
     uni.authorize({