适配app+分销开发

master
gongfuxiang 2023-11-24 21:34:40 +08:00
parent 22b3cac96a
commit 8c825be956
16 changed files with 489 additions and 66 deletions

View File

@ -327,10 +327,7 @@ button:before {
*
*/
.page-bottom-fixed {
padding-bottom: calc(172rpx + env(safe-area-inset-bottom) - 40rpx) !important;
/* #ifdef H5 */
padding-bottom: 172rpx !important;
/* #endif */
}
/**

View File

@ -546,6 +546,20 @@
"enablePullDownRefresh": true,
"navigationBarTitleText": "推广订单"
}
},
{
"path": "visit-list/visit-list",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "拜访客户"
}
},
{
"path": "visit-form/visit-form",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "新增拜访客户"
}
}
]
},

View File

@ -84,23 +84,42 @@ export default {
},
//
choose_location() {
choose_location() {
// app
// #ifdef APP
uni.navigateBack();
// #endif
//
uni.chooseLocation({
success: (res) => {
uni.setStorageSync(this.cache_key, res);
success: (res) => {
//
uni.setStorageSync(this.cache_key, res);
// 
uni.$emit('refresh', { location_success: true });
// app
// #ifndef APP
setTimeout(function () {
uni.navigateBack();
}, 500);
}, 500);
// #endif
},
fail: (res) => {
//
if (res.errMsg.indexOf("cancel") != -1) {
uni.navigateBack();
} else {
this.setData({ error_msg: res.errMsg });
app.globalData.showToast(res.errMsg);
fail: (res) => {
//
// error=11 msgcancel
var msg = res.errorMessage || res.chooseLocation || res.errMsg || '位置选择失败';
if(res.error == 11 || msg.indexOf('cancel') != -1) {
// app
// #ifndef APP
uni.navigateBack();
// #endif
} else {
this.setData({ error_msg: res.errMsg });
app.globalData.showToast(res.errMsg);
}
},
}
});
},
},

View File

@ -98,7 +98,17 @@ export default {
if (this.home_extraction_address_position == 1) {
//
if (this.is_first == 0) {
this.user_location_init();
//
uni.$off('refresh');
// 
    uni.$on('refresh', (data) => {
//
        if((data.location_success || false) == true) {
this.user_location_init();
        }
    });
//
this.init();
}
} else {

View File

@ -4,7 +4,7 @@
<!-- true为空对象 false为非空对象 Object.keys(info).length == 0 -->
<view class="ask-container bg-white spacing-mb">
<view class="padding-main">
<view class="fw-b text-size-xl spacing-mb">{{ info.title }}</view>
<view v-if="(info.title || null) != null" class="fw-b text-size-xl spacing-mb">{{ info.title }}</view>
<view class="cr-grey-9 text-size-xs margin-bottom-sm flex-row">
留言时间: {{ info.add_time_date }}
<view class="fw-b padding-horizontal-xs">·</view>
@ -93,7 +93,7 @@
logo_square: app.globalData.get_application_logo_square(),
data_list_loding_status: 1,
data_bottom_line_status: true,
data: null,
info: null,
data_base: null,
emoji_list: [],
//
@ -181,8 +181,8 @@
goods_is_loading: 0,
});
//
if(info != null) {
//
this.setData({
share_info: {
title: info.title,
@ -191,6 +191,9 @@
query: 'id=' + info.id
}
});
//
uni.setNavigationBarTitle({ title: info.title || info.content });
}
} else {
this.setData({

View File

@ -4,9 +4,9 @@
}
.scroll-box {
height: calc(100vh - 194rpx - var(--status-bar-height) - 5px);
height: calc(100vh - 174rpx - var(--status-bar-height));
/* #ifdef H5 */
height: calc(100vh - 170rpx);
height: calc(100vh - 174rpx);
/* #endif */
}

View File

@ -1,8 +1,8 @@
<template>
<view :class="theme_view">
<component-nav-back :prop-fixed="false" prop-class="bg-white" prop-color="#333">
<template slot="right" :class="status_bar_height > 0 ? 'top-search-width' : ''">
<view class="margin-left-main" :class="status_bar_height > 0 ? '' : 'flex-1 flex-width'">
<template slot="right" :class="is_mp_env ? 'top-search-width' : ''">
<view class="margin-left-main" :class="is_mp_env ? '' : 'flex-1 flex-width'">
<component-search @onsearch="search_button_event" propIsOnEvent :propIsRequired="false" propIconColor="#ccc" propPlaceholderClass="cr-grey-c" propBgColor="#f6f6f6"></component-search>
</view>
</template>
@ -72,7 +72,10 @@
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
status_bar_height: parseInt(app.globalData.get_system_info('statusBarHeight', 0)),
is_mp_env: false,
// #ifdef MP
is_mp_env: true,
// #endif
data_base: {},
data_list: [],
data_total: 0,

View File

@ -1,28 +1,28 @@
<template>
<view :class="theme_view">
<view v-if="(data || null) != null">
<view v-if="(info || null) != null">
<view class="padding-main bg-white spacing-mb">
<view class="spacing-mb">
<view class="fw-b text-size-xl">{{ data.title }}</view>
<view class="fw-b text-size-xl">{{ info.title }}</view>
<view class="cr-grey-9 margin-top-lg oh br-t padding-top-main text-size-xs">
<view class="fl">
<text>时间</text>
<text>{{ data.add_time }}</text>
<text>{{ info.add_time }}</text>
</view>
<view class="fr">
<text class="margin-left-xxxl">浏览</text>
<text>{{ data.access_count }}</text>
<text>{{ info.access_count }}</text>
</view>
</view>
</view>
<view class="oh web-html-content spacing-mb">
<view v-if="(data.video_url || null) != null && ((data.is_live_play || 0) == 0 || client_type == 'weixin')">
<video :src="data.video_url" class="wh-auto" :autoplay="false" :controls="true"></video>
<view v-if="(info.video_url || null) != null && ((info.is_live_play || 0) == 0 || client_type == 'weixin')">
<video :src="info.video_url" class="wh-auto" :autoplay="false" :controls="true"></video>
</view>
<mp-html :content="data.content" />
<mp-html :content="info.content" />
</view>
<!-- 评论内容 -->
<component-blog-comments :propData="data" :propDataBase="data_base" :propEmojiList="emoji_list"></component-blog-comments>
<component-blog-comments :propData="info" :propDataBase="data_base" :propEmojiList="emoji_list"></component-blog-comments>
</view>
<view class="padding-horizontal-main">
@ -56,12 +56,12 @@
</view>
<!-- 相关商品 -->
<view v-if="(data.goods_list || null) != null && data.goods_list.length > 0">
<view v-if="(info.goods_list || null) != null && info.goods_list.length > 0">
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<text class="text-wrapper title-left-border">相关商品</text>
<navigator url="/pages/goods-search/goods-search" hover-class="none" class="arrow-right padding-right cr-grey">更多</navigator>
</view>
<component-goods-list :propData="{ style_type: 1, goods_list: data.goods_list }" :propCurrencySymbol="currency_symbol"></component-goods-list>
<component-goods-list :propData="{ style_type: 1, goods_list: info.goods_list }" :propCurrencySymbol="currency_symbol"></component-goods-list>
</view>
</view>
</view>
@ -94,7 +94,7 @@
client_type: app.globalData.application_client_type(),
params: null,
data_base: null,
data: null,
info: null,
right_list: [],
last_next: null,
emoji_list: [],
@ -158,31 +158,34 @@
uni.stopPullDownRefresh();
var data = res.data.data;
if (res.data.code == 0 && (data.data || null) != null) {
var blog = data.data;
var info = data.data || null;
var base = data.base || null;
this.setData({
data_bottom_line_status: true,
data_list_loding_status: 3,
data_base: data.base || null,
data: blog,
data_base: base,
info: info,
right_list: data.right_list || [],
last_next: data.last_next || null,
emoji_list: data.emoji_list || [],
blog_main_name: (data.base || null) == null ? '博文' : data.base.blog_main_name || '博文',
blog_main_name: (info == null) ? (base == null ? '博文' : (base.blog_main_name || '博文')) : info.title,
});
//
this.setData({
share_info: {
title: this.data.seo_title || this.data.title,
desc: this.data.seo_desc || this.data.describe,
path: '/pages/plugins/blog/detail/detail',
query: 'id=' + this.data.id,
img: this.data.cover,
}
});
//
uni.setNavigationBarTitle({ title: this.data.title });
if(info != null) {
//
this.setData({
share_info: {
title: info.seo_title || info.title,
desc: info.seo_desc || info.describe,
path: '/pages/plugins/blog/detail/detail',
query: 'id=' + info.id,
img: info.cover,
}
});
//
uni.setNavigationBarTitle({ title: info.title });
}
} else {
this.setData({
data_list_loding_status: 0,

View File

@ -128,7 +128,15 @@
},
onShow() {
this.user_location_init();
//
uni.$off('refresh');
// 
    uni.$on('refresh', (data) => {
//
        if((data.location_success || false) == true) {
this.user_location_init();
        }
    });
//
app.globalData.page_share_handle();

View File

@ -93,7 +93,17 @@ export default {
if (this.home_extraction_address_position == 1) {
//
if (this.is_first == 0) {
this.user_location_init();
//
uni.$off('refresh');
// 
    uni.$on('refresh', (data) => {
//
        if((data.location_success || false) == true) {
this.user_location_init();
        }
    });
//
this.init();
}
} else {

View File

@ -0,0 +1,3 @@
/*
*
*/

View File

@ -0,0 +1,325 @@
<template>
<view :class="theme_view">
<view v-if="data_list_loding_status != 1" class="page-bottom-fixed">
<form @submit="form_submit" class="form-container">
<view class="padding-main oh border-radius-main">
<view class="user-search">
<component-search
@onsearch="search_submit_event"
:propIsOnEvent="true"
:propIsRequired="false"
propPlaceholder="输入用户名/昵称/手机/邮箱"
propClass="br"
:propIsBtn="true"
:propDefaultValue="search_input_keywords_value"
<!-- #ifdef MP || APP -->
propIcon="icon-mendian-sousuosm"
propIconColor="#333"
@onicon="search_icon_event"
:propIsIconOnEvent="true"
<!-- #endif -->
></component-search>
</view>
<view class="form-gorup bg-white border-radius-main margin-top-main">
<view class="form-gorup-title">拜访内容<text class="form-group-tips-must">*</text></view>
<textarea class="cr-base textarea-height" name="content" maxlength="230" auto-height placeholder-class="cr-grey-9" placeholder="拜访内容,最多230个字符"></textarea>
</view>
<view class="form-gorup form-container-upload oh border-radius-main margin-top-main">
<view class="form-gorup-title">上传照片<text class="form-group-tips-must">*</text><text class="form-group-tips">最多上传{{form_images_max_count}}</text></view>
<view class="form-upload-data oh">
<block v-if="form_images_list.length > 0">
<view v-for="(item, index) in form_images_list" :key="index" class="item fl">
<text class="delete-icon" @tap="upload_delete_event" :data-index="index">x</text>
<image :src="item" @tap="upload_show_event" :data-index="index" mode="aspectFill"></image>
</view>
</block>
<image v-if="(form_images_list || null) == null || form_images_list.length < form_images_max_count" class="item fl upload-icon" :src="common_static_url + 'upload-icon.png'" mode="aspectFill" @tap="file_upload_event"></image>
</view>
</view>
<view class="bottom-fixed">
<view class="bottom-line-exclude">
<button class="bg-main br-main cr-white round text-size" type="default" form-type="submit" hover-class="none" :disabled="form_submit_disabled_status">提交</button>
</view>
</view>
</view>
</form>
</view>
<block v-else>
<component-no-data :propStatus="data_list_loding_status" :propMag="data_list_loding_msg"></component-no-data>
</block>
</view>
</template>
<script>
const app = getApp();
import componentNoData from "../../../../components/no-data/no-data";
import componentSearch from '../../../../components/search/search';
var common_static_url = app.globalData.get_static_url("common");
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
common_static_url: common_static_url,
data_list_loding_status: 1,
data_list_loding_msg: '',
params: null,
search_input_keywords_value: "",
form_images_list: [],
form_images_max_count: 30,
editor_path_type: "",
form_submit_disabled_status: false,
};
},
components: {
componentNoData,
componentSearch
},
props: {},
onLoad(params) {
this.setData({
params: params,
});
},
onShow() {
//
app.globalData.page_share_handle();
},
methods: {
//
init() {
var user = app.globalData.get_user_info(this, "init");
if (user != false) {
//
if (app.globalData.user_is_need_login(user)) {
uni.redirectTo({
url: "/pages/login/login?event_callback=init",
});
return false;
} else {
//
this.get_data();
}
} else {
this.setData({
data_list_loding_status: 0,
});
}
},
//
get_data() {
uni.request({
url: app.globalData.get_request_url("saveinfo", "visit", "distribution"),
method: "POST",
data: this.params,
dataType: "json",
success: (res) => {
uni.hideLoading();
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
data: data.data,
editor_path_type: data.editor_path_type || "",
data_list_loding_status: 3,
data_list_loding_msg: '',
});
} else {
this.setData({
data_list_loding_status: 0,
data_list_loding_msg: res.data.msg,
});
if (app.globalData.is_login_check(res.data, this, "get_data")) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: '网络开小差了哦~',
});
app.globalData.showToast("网络开小差了哦~");
},
});
},
//
form_submit(e) {
//
var form_data = e.detail.value;
form_data['images'] = this.form_images_list;
//
var validation = [
{ fields: 'content', msg: '请填写拜访内容' },
{ fields: 'images', msg: '请上传拜访图片' },
];
//
if (app.globalData.fields_check(form_data, validation)) {
this.setData({
form_submit_disabled_status: true,
});
uni.request({
url: app.globalData.get_request_url('save', 'visit', 'distribution'),
method: 'POST',
data: form_data,
dataType: 'json',
success: (res) => {
if (res.data.code == 0) {
var data = res.data.data;
} else {
this.setData({
form_submit_disabled_status: false,
});
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(res.data.msg);
} else {
app.globalData.showToast('提交失败,请重试!');
}
}
},
fail: () => {
this.setData({
form_submit_disabled_status: false,
});
app.globalData.showToast('获取数据失败');
},
});
}
},
//
search_input_keywords_event(e) {
this.setData({
search_input_keywords_value: e.detail.value,
});
},
//
search_submit_event(e) {
this.setData({
search_input_keywords_value: e
});
this.search_user();
},
// icon
search_icon_event(e) {
var self = this;
uni.scanCode({
success: function (res) {
self.setData({
search_input_keywords_value: res.result
});
self.search_user();
},
});
},
//
search_user() {
console.log(this.search_input_keywords_value)
},
//
upload_show_event(e) {
uni.previewImage({
current: this.form_images_list[e.currentTarget.dataset.index],
urls: this.form_images_list,
});
},
//
upload_delete_event(e) {
var self = this;
uni.showModal({
title: "温馨提示",
content: "删除后不可恢复、继续吗?",
success(res) {
if (res.confirm) {
var list = self.form_images_list;
list.splice(e.currentTarget.dataset.index, 1);
self.setData({
form_images_list: list,
});
}
},
});
},
//
file_upload_event(e) {
var self = this;
uni.chooseImage({
count: this.form_images_max_count,
success(res) {
var success = 0;
var fail = 0;
var length = res.tempFilePaths.length;
var count = 0;
self.upload_one_by_one(res.tempFilePaths, success, fail, count, length);
},
});
},
//
upload_one_by_one(img_paths, success, fail, count, length) {
var self = this;
if (self.form_images_list.length < this.form_images_max_count) {
uni.uploadFile({
url: app.globalData.get_request_url("index", "ueditor"),
filePath: img_paths[count],
name: "upfile",
formData: {
action: "uploadimage",
path_type: self.editor_path_type,
},
success: function (res) {
success++;
if (res.statusCode == 200) {
var data = typeof res.data == "object" ? res.data : JSON.parse(res.data);
if (data.code == 0 && (data.data.url || null) != null) {
var list = self.form_images_list;
list.push(data.data.url);
self.setData({
form_images_list: list,
});
} else {
app.globalData.showToast(data.msg);
}
}
},
fail: function (e) {
fail++;
},
complete: function (e) {
count++;
//
if (count >= length) {
//
//app.showToast('' + success +'', 'success');
} else {
//
self.upload_one_by_one(img_paths, success, fail, count, length);
}
},
});
}
}
},
};
</script>
<style>
@import "./visit-form.css";
</style>

View File

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -6,7 +6,7 @@
<!-- 头部 -->
<view class="header pr z-i">
<component-nav-back :prop-fixed="false" prop-color="#333">
<template slot="right" :class="status_bar_height > 0 ? 'top-search-width' : 'flex-1 flex-width'">
<template slot="right" :class="is_mp_env ? 'top-search-width' : 'flex-1 flex-width'">
<view :class="'va-m padding-left-main ' + (is_realstore_top_nav_back == 1 ? 'nav-search' : 'wh-auto')">
<!-- #ifndef H5 -->
<component-search
@ -308,15 +308,19 @@
import componentCartParaCurve from '../../../../components/cart-para-curve/cart-para-curve';
var common_static_url = app.globalData.get_static_url('common');
var status_bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0));
var status_bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true));
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
theme_color: app.globalData.get_theme_color(),
status_bar_height: status_bar_height,
content_style: '',
common_static_url: common_static_url,
is_mp_env: false,
// #ifdef MP
is_mp_env: true,
// #endif
content_style: '',
data_list_loding_status: 1,
data_list_loding_msg: '',
data_is_loading: 0,
@ -454,7 +458,7 @@
goods_category: data.goods_category || [],
favor_user: data.favor_user || [],
tablecode: tablecode,
content_style: 'height: calc(100vh - '+content_other_height+' - '+status_bar_height+'px - '+(tablecode == null ? '0rpx' : '44rpx')+');',
content_style: 'height: calc(100vh - '+content_other_height+' - '+this.status_bar_height+'px - '+(tablecode == null ? '0rpx' : '44rpx')+');',
});
//

View File

@ -78,15 +78,12 @@
import componentTitle from '../../../../components/title/title';
var realstore_static_url = app.globalData.get_static_url('realstore', true);
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
realstore_static_url: realstore_static_url,
// #ifdef H5
screen_width: window.innerWidth,
// #endif
screen_width: parseInt(app.globalData.get_system_info('windowWidth', 0, true)),
data_list_loding_status: 1,
data_list_loding_msg: '',
data_bottom_line_status: false,
@ -131,6 +128,15 @@
onShow() {
//
this.user_location_init();
//
uni.$off('refresh');
// 
    uni.$on('refresh', (data) => {
//
        if((data.location_success || false) == true) {
this.user_location_init();
        }
    });
//
this.get_data();
@ -143,7 +149,9 @@
//
onUnload: function () {
// #ifdef H5
window.removeEventListener('resize', this.handle_resize);
// #endif
},
methods: {

View File

@ -218,7 +218,7 @@
this.setData({
params: params,
});
},
},
onReady: function () {
uni.setNavigationBarTitle({
@ -235,8 +235,16 @@
this.init();
},
onShow() {
this.user_location_init();
onShow() {
//
uni.$off('refresh');
// 
    uni.$on('refresh', (data) => {
//
        if((data.location_success || false) == true) {
this.user_location_init();
        }
    });
//
app.globalData.page_share_handle();