Commit 9a4c683a by 李嘉林

多主题新增扫一扫

parent 65016047
...@@ -19,7 +19,8 @@ import { ...@@ -19,7 +19,8 @@ import {
$themeAddToCard, $themeAddToCard,
$themeArticleLike, $themeArticleLike,
getCoupon, getCoupon,
themeMemberCardClick themeMemberCardClick,
themeScanningCodeClick
} from "@/utils/mayi"; } from "@/utils/mayi";
// import { $themeToLink, $themeAddToCard, $themeArticleLike } from "@/utils/mayi"; // import { $themeToLink, $themeAddToCard, $themeArticleLike } from "@/utils/mayi";
import "@/utils/themeModule"; import "@/utils/themeModule";
...@@ -72,6 +73,7 @@ global.themeToLinkInit({ ...@@ -72,6 +73,7 @@ global.themeToLinkInit({
wx, wx,
getCoupon, getCoupon,
themeMemberCardClick, themeMemberCardClick,
themeScanningCodeClick,
requireFun: { requireFun: {
createdUserJWT: createdUserJWTApi, createdUserJWT: createdUserJWTApi,
getBcakUrl: getBcakUrlApi getBcakUrl: getBcakUrlApi
......
...@@ -357,4 +357,46 @@ export function themeMemberCardClick(item) { ...@@ -357,4 +357,46 @@ export function themeMemberCardClick(item) {
} }
} }
}); });
}; };
\ No newline at end of file // 扫码
export function themeScanningCodeClick() {
let app = getApp()
let { $themeToLink } = app;
console.log("themeScanningCodeClick")
wx.scanCode({
success(res) {
console.log(res, '-----scanCode-success')
let { scanType, path,result } = res;
if (scanType == 'WX_CODE') {
// 微信二维码
$themeToLink({
type :1.1,
link : path[0] == '/'?path:`/${path}`
});
} else if (scanType == 'QR_CODE') {
// 二维码
// http链接或h5链接
// type 1h5页面 1.1小程序页面 1.2http链接
if (result.startsWith('http') || result.startsWith('/')) {
// 链接跳转
$themeToLink({
type: result.startsWith('http')?1.2:1,
link: result
})
} else {
// 跳转搜索页
$themeToLink({
type: 1,
link: '/contentSearch/contentSearch?placeHolderText=' + result
})
}
}
},
fail(res) {
console.log(res,'-----scanCode-fail')
},
complete(res) {
console.log(res,'-----scanCode-complete')
},
});
}
\ No newline at end of file
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