若依前端APP版使用教程

1 增加页面流程

        新增Page>新增API>新增组件>新增样式>新增路径(page.json)

 {
   "path": "pages/mes/pro/feedback/index",
   "style": {
     "navigationBarTitleText": "工单报工"
   }
 }





2 APP中调用企业微信扫一扫功能

        如果公众号,服务号,小程序,引用相应的artifacetId就行了,可参生作者说明文档

2.1  在pom.xml中文件引用包

           
                com.github.binarywang
                weixin-java-cp
                4.5.0
            
package com.ktg.web.controller.system;


import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import org.springframework.stereotype.Service;

@Service
public class QywxService {


    //获取对应应用的签名
    public WxJsapiSignature getJsapiSignture(String url) throws WxErrorException, WxErrorException {
        // 替换成自己应用的appId和secret,agentId
        Integer agentId = 1111111;
        String corpId="XXXXXXXX";
        String corpSecret = "XXXXXXXX";

        WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
        config.setCorpId(corpId);      // 设置微信企业号的appid
        config.setCorpSecret(corpSecret);  // 设置微信企业号的app corpSecret
        config.setAgentId(agentId);     // 设置微信企业号应用ID


        WxCpServiceImpl wxCpService = new WxCpServiceImpl();
        wxCpService.setWxCpConfigStorage(config);
        System.out.println("WxJsapiSignature===url==="+url);

        WxJsapiSignature wxJsapiSignature = wxCpService.createJsapiSignature(url);
        //wxJsapiSignature中可以直接获取签名信息 且方法内部添加了缓存功能
        return wxJsapiSignature;
    }

}
package com.ktg.web.controller.system;

import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class QywxController {

    @Autowired
    private QywxService qywxService;


    @GetMapping(value = "/system/qywx/signature/")
    public WxJsapiSignature getJsapiSignature(@RequestParam("url") String url) {
        try {  // 直接调用wxMpServer 接口
            System.out.println("访问WxJsapiSignature=====/system/qywx/signature/" + url + "");
            WxJsapiSignature wxJsapiSignature = qywxService.getJsapiSignture(url);
            System.out.println("AppId===" + wxJsapiSignature.getAppId());
            System.out.println("Timestamp===" + wxJsapiSignature.getTimestamp());
            System.out.println("NonceStr===" + wxJsapiSignature.getNonceStr());
            System.out.println("Signature===" + wxJsapiSignature.getSignature());
            return wxJsapiSignature;
        } catch (WxErrorException e) {
            return null;
        }
    }

}

你可能感兴趣的:(前端)