first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1 @@
468ef05c-11fa-4967-87dc-1345ad6c3abb

View File

@@ -0,0 +1,120 @@
// import { mapGetters } from 'vuex'
// import { js_api_list } from "@/config/wx_config.js";
// import WxFn from "@/project/models/wx.js";
// import Config from "@/config/index.js";
// import store from '@/store/index.js'
let noop = function () { }
export default {
install(Vue) {
Vue.mixin({
methods: {
goBack() {
window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/')
},
handleError(data, fn = noop) {
// 处理参数不正确时直接返回请求
if (!data) return;
if (!data.data && data.code === '1') return fn(data)
// 登录失效
if ( data.data.code == 400) {
this.$createToast({
time: 1500,
txt: "登录失效",
type: 'txt'
}).show();
setTimeout(() => {
this.$router.replace({
path: '/'
})
}, 1000)
// 没有数据了
} else if ( data.data.code == '500') {
// this.$toast_defalut("参数错误");
if (data.data.msg) {
this.$createToast({
time: 1500,
txt: data.data.msg,
type: 'txt'
}).show();
}
} else {
fn(data)
}
},
// wxConfig(fn) {
// this.$nextTick(async () => {
// let url = window.location.href.split("#")[0];
// let res = await WxFn.wx_config(js_api_list, url);
// this.handleError(res, res => {
// if (window.wx) {
// let data = res.data;
// wx.config({
// debug: data.debug, // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
// appId: data.appId, // 必填,公众号的唯一标识
// timestamp: data.timestamp, // 必填,生成签名的时间戳
// nonceStr: data.nonceStr, // 必填,生成签名的随机串
// signature: data.signature, // 必填,签名
// jsApiList: data.jsApiList // 必填需要使用的JS接口列表
// });
// // wx.ready(function () {
// fn()
// // alert(1);
// // wx.hideAllNonBaseMenuItem();
// // });
// }
// });
// })
// },
// shareArticle(info) {
// let _this = this;
// // alert('开始配置分享')
// // debugger
// wx.ready(function () {
// // alert('分享函数执行前')
// // wx.showAllNonBaseMenuItem();
//
// wx.updateAppMessageShareData({
// // ..._this.share_info
// title: info.title, // 分享标题
// desc: info.desc, // 分享描述
// link: info.url, // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
// imgUrl: _this.get_img_url + info.image, // 分享图标
// success: function () {
// // 设置成功
// // alert('分享成功1')
// }
// });
// wx.updateTimelineShareData({
// title: info.title, // 分享标题
// link: info.url, // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
// imgUrl: _this.get_img_url + info.image, // 分享图标
// success: function () {
// // 设置成功
// // alert('分享成功2')
// }
// });
// });
// wx.error(function (res) {
// // config信息验证失败会执行error函数如签名过期导致验证失败具体错误信息可以打开config的debug模式查看也可以在返回的res参数中查看对于SPA可以在这里更新签名。
// // alert.log(JSON.stringify(res));
// });
// },
//
// //唤起微信授权
// wxAuth(){
// let wxUrl = Config.baseUrl + 'api_wechat/server/getOauthUrl?source=business'
// location.href = wxUrl
// },
},
computed: {
// ...mapGetters([
// 'user',
// 'get_img_url'
// ]),
}
})
}
}