Commit ca47f110 authored by 石盼盼's avatar 石盼盼

Merge branch 'spp' into 'master'

Spp

See merge request !17
parents c8bb10f1 8eb4f0a5
......@@ -13926,6 +13926,11 @@
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
"dev": true
},
"weixin-js-sdk": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
"integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ=="
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
......
......@@ -17,7 +17,8 @@
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"webpack": "^4.43.0"
"webpack": "^4.43.0",
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.0",
......
......@@ -9,8 +9,8 @@ const baseUrl = '/api'
// todo: url
const httpUrl = 'https://repairtest.zeruiedu.com' // 测试接口
const h5Url ='http://localhost:8080' // 测试h5线上地址
// const h5Url = 'http://repair.h5.zeruiedu.com' // 测试h5线上地址
// const h5Url ='http://localhost:8080' // 测试h5线上地址
const h5Url = 'http://repair.h5.zeruiedu.com' // 测试h5线上地址
window.localStorage.setItem('httpUrl', httpUrl)
window.localStorage.setItem('h5Url', h5Url)
// const httpUrl = 'https://fenghexm.xueyoubangedu.com' // 正式接口
......@@ -49,5 +49,7 @@ export default {
// 管理员端
GET_WORKER: baseUrl + '/worker/get/worker', // 查看评论
REPAIR_CANCEL: baseUrl + '/worker/repair/cancel', // 查看评论
REPAIR_ASSIGN: baseUrl + '/worker/repair/assign' // 指派工人
REPAIR_ASSIGN: baseUrl + '/worker/repair/assign', // 指派工人
WX_JSSDK: baseUrl + '/worker/wx/jssdk', // 获取jssdk参数
}
var wx = require('weixin-js-sdk')
import axios from 'axios'
import apiList from './apiList'
import myAxios from './index'
import {
Toast
} from 'vant'
import logo2 from "@/assets/images/login/logo2.png"
// 微信分享方法
const share = (param) => {
Toast.loading({
message: "加载中...",
duration: 0, //持续展示 toast
})
const successCall = (res) => {
console.log('res', res)
Toast.clear()
let result = res.conf
// let result = res.data
// let {
// wxConfig,
// shareCircle,
// shareFriend
// } = result
wx.config({
debug: false,
appId: result.appId,
timestamp: result.timestamp,
nonceStr: result.nonceStr,
signature: result.signature,
jsApiList: result.jsApiList
})
const hideMenuItems = [
'menuItem:openWithSafari', // 在Safari中打开
'menuItem:openWithQQBrowser', // 在QQ浏览器中打开
'menuItem:share:qq', // 分享qq
'menuItem:share:QZone', // 分享到 QQ 空间
'menuItem:share:brand', // 一些特殊公众
'menuItem:setFont', // 调整字体
'menuItem:dayMode', // 日间模式
'menuItem:nightMode', // 夜间模式
'menuItem:readMode' // 阅读模式
] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
wx.ready(function () {
//分享到朋友圈
// wx.updateTimelineShareData({
// title: `${shareCircle.title}:${shareCircle.desc}`, // 分享标题
// link: shareCircle.link, // 分享链接
// imgUrl: shareCircle.imgUrl != null ?
// shareCircle.imgUrl : "https://apissources.bamasoso.com/image/logo2.png", // 分享图标
// success: async () => {}
// })
// 分享给朋友
wx.updateAppMessageShareData({
title: 'E速报修', // 分享标题
desc: '您身边的校园服务管家', // 分享描述
link: 'http://repair.h5.zeruiedu.com/', // 分享链接
imgUrl: `${localStorage.getItem('httpUrl')}/logo2.png`, // 分享图标
success: async () => {
console.log('分享至朋友-成功')
}
})
wx.hideMenuItems({
menuList: hideMenuItems
})
wx.showMenuItems({
menuList: ["menuItem:share:appMessage", "menuItem:share:timeline"] // 要显示的菜单项,所有menu项见附录3
})
})
}
const curParams = {
// tel: this.tel
url: window.location.href
}
myAxios.post(apiList.WX_JSSDK, curParams)
.then(res => {
console.log(res,111111)
successCall(res)
Toast.clear()
})
.catch(() => {})
}
export {
share
}
// todo 其它微信SDK方法
......@@ -20,6 +20,7 @@
</div>
</template>
<script>
import { share } from '@/api/wxShare.js'
export default {
name: 'login',
data () {
......@@ -32,6 +33,9 @@ export default {
timer: null
}
},
created () {
share()
},
methods: {
checkData () {
if (this.tel.length !== 11) {
......
......@@ -253,6 +253,7 @@
import myTabbar from '@components/common/tabbar.vue'
import { trimStrSpace } from '@assets/js/format.js'
import { ImagePreview, Toast } from 'vant';
import { share } from '@/api/wxShare.js'
export default {
name: 'home',
components: {
......@@ -314,6 +315,7 @@ export default {
}
},
created () {
share()
this.getList()
this.getUserInfo()
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment