Commit 07dd3f1c by xinla

短链

1 parent d5d57322
......@@ -186,9 +186,9 @@ export default {
<el-form-item prop="secret" label="小程序Secret">
<el-input clearable v-model="form.secret" placeholder="请输入" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item prop="" label="小程序原始ID">
<!-- <el-form-item prop="" label="小程序原始ID">
<el-input clearable v-model="form.name" placeholder="请输入" maxlength="30" show-word-limit></el-input>
</el-form-item>
</el-form-item> -->
<el-form-item prop="longLink" label="小程序页面路径">
<el-input clearable v-model="form.longLink" placeholder="请输入" maxlength="30" show-word-limit></el-input>
</el-form-item>
......
......@@ -33,15 +33,15 @@ export default {
<div class="cc ac g-card g-pad20" style="width: 70%">公众号文章示例</div>
</div>
</template>
<template v-else-if="[7, 9, 10].includes(+data.type)">
<template v-else-if="[7, 9].includes(+data.type)">
<div class="g-card g-pad20 cc ac" style="width: 70%; padding-bottom: 50px">
<div class="mt10">小程序</div>
<div class="mt10">{{ data.name || '小程序' }}</div>
<div class="mt20 mb20">
<el-image style="width: 120px; height: 120px" :src="data.avatar">
<!-- <div slot="placeholder">请设置</div> -->
</el-image>
</div>
<el-button type="primary">点击打开小程序</el-button>
<el-button type="primary">点击打开{{ data.name || '小程序' }}</el-button>
</div>
</template>
<template v-else>
......@@ -53,7 +53,7 @@ export default {
:src="data.avatar"
error="头像"
fit="fit"></el-image>
<div class="toe">{{ data.shortLinkName || '名称' }}</div>
<div class="toe">{{ data.name || '名称' }}</div>
<div class="tips mt20 toe">{{ data.describe || '描述' }}</div>
</div>
<el-image style="width: 120px; height: 120px; margin: 20px 0" :src="data.qrCode" fit="fit"></el-image>
......
......@@ -2,23 +2,23 @@
<view class="content">
<template v-if="data.type == 0">
<div class="mask" style="position: absolute">
<div class="cc ac g-card g-pad20" style="width: 70%">公众号文章示例</div>
<web-view :webview-styles="webviewStyles" :src="data.longLink"></web-view>
</div>
</template>
<template v-else-if="[7, 9, 10].includes(+data.type)">
<template v-else-if="[7, 9].includes(+data.type)">
<div class="g-card g-pad20 cc ac" style="width: 70%">
<div class="mt10">小程序</div>
<div class="mt10">{{ data.name || '小程序' }}</div>
<div class="mt20 mb20">
<image style="width: 120px; height: 120px" :src="data.avatar" error="头像" fit="fit"></image>
</div>
<button type="primary" @tap="open()">点击打开小程序</button>
<button type="primary" @tap="open()">点击打开{{ data.name || '小程序' }}</button>
</div>
</template>
<template v-else>
<div class="g-card g-pad20 cc ac" style="width: 70%">
<div class="al bfc-o">
<image class="fl mr10" style="width: 50px; height: 50px" :src="data.avatar" error="头像" fit="fit"></image>
<div class="toe">{{ data.name || '无aa。名称' }}</div>
<div class="toe">{{ data.name || '无名称' }}</div>
<div class="tips mt20 toe">{{ data.describe || '无描述' }}</div>
</div>
<image style="width: 120px; height: 120px; margin: 20px 0" :src="data.qrCode" fit="fit"></image>
......@@ -45,9 +45,8 @@
}
},
onLoad(options) {
const query = options.query; // 这个就是你的参数,是个json对象
console.log('onLoad options', options); // 场景值为 1065
this.getDetail(query.route)
this.getDetail(options.id)
},
created() {
// let id = this.$route.query.id
......@@ -57,14 +56,17 @@
},
methods: {
getDetail(path) {
console.log('path', path)
this.loading = true
getDetail(path)
.then(({
data
}) => {
this.data = data
console.log('data', data)
uni.setNavigationBarTitle({
title: touchTypeDict[data.type].previewMobileTitle,
// title: touchTypeDict[data.type].previewMobileTitle,
title: data.shortLinkName
})
})
.catch(() => {})
......@@ -74,8 +76,8 @@
},
open() {
wx.navigateToMiniProgram({
appId: '',
path: 'page/index/index?id=123',
appId: this.data.appId,
path: this.data.longLink,
extraData: {
foo: 'bar',
},
......
......@@ -14,6 +14,8 @@ http.interceptors.request.use(
// if (config.custom.auth) {
// config.header.token = 'token'
// }
config.header['Authorization'] =
'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX3R5cGUiOiIwMCIsInVzZXJfaWQiOjEsImxvZ2luX3R5cGUiOiJMaW5rV2VDaGF0QVBJIiwidXNlcl9uYW1lIjoiYWRtaW4iLCJ1c2VyX2tleSI6IjYyZjRiYWZmLWY2NzYtNGNlOS1iNDNhLTZhMjhlM2QwYTEwNiIsImNvcnBfbmFtZSI6IuS7n-W-ruenkeaKgCIsImNvcnBfaWQiOiJ3dzYyMmZjODUyZjc5YzNmMTMifQ.CvkoSw7K1eT-AjmfFYX5e2MlxKFNjfqzPpIwPlEuNDRL3ZASTW7t6UlGUl5CbYGI-F-3EPcVvFm9PcEk_YKtlQ'
// if (config.custom.loading) {
// uni.showLoading()
// }
......@@ -35,14 +37,14 @@ http.interceptors.response.use(
(response) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/
let data = response.data
if (data.code == 200 || (data.code != 0 && data.code != 500)) {
return data.result || data.record || data.data
if (data.code == 200) {
return data
}
uni.hideLoading()
uni.showToast({
icon: 'none',
title: data.msg,
duration: 2000,
duration: 3000,
})
return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
},
......@@ -67,7 +69,7 @@ export async function get(url, params) {
})
}
export default function (config = {}) {
export default function(config = {}) {
config.baseURL = cfg.BASE_API
// 兼容get方法使用data传参
if ((config.method || 'get').toLowerCase() === 'get' && !config.params) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!